40 Commits

Author SHA1 Message Date
Wang Chen
504838dc04 Add RV64 support.
Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
2025-04-28 17:25:30 +08:00
Chen Wang
f343f9a41f rvos: remove other steps except 11
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-04-28 17:23:21 +08:00
6eanut
48d1d6ebaf VIRT_PLIC_PRIORITY_BASE 0x04->0x00 2025-04-28 17:10:11 +08:00
Chen Wang
eb61470e22 Improve memory/page init
Align heap start and caculate number of reserved pages
according to the length of ram available.

See
https://gitee.com/unicornx/riscv-operating-system-mooc/issues/I9LNCF.

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
v0.9.11
2024-06-06 10:13:52 +08:00
Chen Wang
0e16685c97 add ignore of output folers for os examples
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2024-06-05 21:02:39 +08:00
Chen Wang
a982ea7317 update reamdme_zh, add info about porting rvos
Signed-off-by: Chen Wang <wangchen20@iscas.ac.cn>
2024-04-11 07:46:05 +08:00
Chen Wang
7df4ae5a19 optimize the uart get process
Also remove the while in uart_isr. Generally unlimited loop in interrupt
handler is not recommended.

Signed-off-by: Wang Chen <unicorn_wang@outlook.com>
v0.9.10
2024-03-28 09:08:10 +08:00
Wang Chen
0cacbd6a22 remove qq group 1 from the readme.
Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
2024-03-27 16:44:14 +08:00
Wang Chen
2fcd517c78 Use %p to print pointer
We use %ld to print mcause.code to compatilbe with rv64 and it do
no harm for rv32.

Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
2024-03-27 14:50:35 +08:00
Wang Chen
fd1d098906 Encapsulate some types related to cpu word length.
The purpose is to facilitate porting to RV64.

Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
2024-03-27 14:30:53 +08:00
Wang Chen
1976f03d28 move all output to out folder
Now after build the source directories are clean.

Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
2024-03-27 09:07:06 +08:00
Wang Chen
492cac5ba9 add defines.mk
Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
2024-03-27 08:22:05 +08:00
Wang Chen
a2617cffa6 create common.mk for os projects
Makefiles of rvos projects contains too many duplicated contents.
Cleanup and move it into a new common.mk file for os only, this will
not touch asm samples.

Finally the common..mk which was used for both asm & os is removed.

Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
2024-03-26 09:01:03 +08:00
Wang Chen
992b0ba91c fixed bug for syscall example
The original logic of setting mstatus has problem.
The or directive cannot set .MPP to 0.

Optimize the original code and use csrs and csrc instead.

Note we cannot assume the default value of mstatus is zero.
rvos may not be the first one to run on the system/virt.
It just so lucky that the initial value of mstatus is zero
on QEMU/virt.

Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
2024-03-25 21:10:40 +08:00
Wang Chen
4698c95063 fixed PLIC_MENABLE issue
Learn from https://github.com/LiuJiLan/RVOS_On_VisionFive2.
Thanks.

Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
2024-03-06 18:32:20 +08:00
Wang Chen
c0e6ce15f0 added QQ group 2
Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
2024-02-01 19:44:45 +08:00
Wang Chen
0446eb2b9d fixed bug #I85M48
https://gitee.com/unicornx/riscv-operating-system-mooc/issues/I85M48

Signed-off-by:  Wang Chen <wangchen20@iscas.ac.cn>
v0.9.9
2024-01-06 09:41:30 +08:00
Chen Wang
27723d09ed Compatible support for new gcc
With gcc version >= 11.1.0, to support new ISA spec changes, which
moved some instructions from the I extension to the Zicsr and Zifencei
extensions, we have to explicitly specify Zicsr and Zifencei via -march.
But it is not required for old gcc versions.

To cope with both cases, we use rv32g instead of rv32ima.
"g" = "imafd". RVOS doesn't use "f" & "d", and we also don't want "c".

We use "g" to just to make life easy, otherwise we may have to intriduce
some mechanism to judge and differ the version of gcc used.

Also updated some comments to move to rv32g and don't involve words such
as "rv32ima".

Signed-off-by: Chen Wang <wangchen20@iscas.ac.cn>
2023-12-19 08:26:42 +08:00
Hunter
2474692c8b Fix uses of .align
The GNU assembler responds to .align in a platform-dependent way. For a
use of '.align x', gas will align to 'x' bytes for some platforms,
but '2^x' bytes for other platforms including RISC-V. We are currently
reserving too much space with .align, so correct them by switching to
the more predictable .balign directive.

Signed-off-by: Hunter <>
2023-12-19 07:51:43 +08:00
Wang Chen
457713c30e Don't set MPIE explicitly
Because according to ISA specification: interrupts for M-mode, which
is higher than U-mode, are always globally enabled regardless of the
setting of the global MIE bit.
We don't set mstatus.MPIE to 1 explicitly to avoid misleading people
into thinking it is must-haveto-do.

Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
Co-authored-by: LiuJiLan <ldc31415926@126.com>
v0.9.8
2023-06-18 09:11:19 +08:00
Wang Chen
a94fb0cd58 stack pointer aligment
Following the standard RISC-V calling convention, make sure
the stack pointer sp is always 16-byte aligned.

Fixed an issue, make sure the sp of task point to the bottom
of the stack, while originally we waste one byte (forgive my
stupid ~~~).

Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
2023-06-17 22:12:59 +08:00
Wang Chen
6d2c046c67 don't save/retore gp&tp
Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
Co-authored-by: LiuJiLan <ldc31415926@126.com>
2023-06-17 16:14:18 +08:00
Wang Chen
f77939f1e8 improved code comments about restore/save context of task
Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
v0.9.7
2023-02-12 13:23:20 +08:00
Wang Chen
c674ffc9bc optimize page alloc
Signed-off-by: ablechen <17895010372@163.com>
Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
v0.9.6
2022-11-23 10:52:43 +08:00
Wang Chen
744226d09e improved comments
Signed-off-by: ablechen <17895010372@163.com>
Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
2022-11-23 10:06:37 +08:00
Chen Wang
cec375a5e6 fixed some bugs
- https://gitee.com/unicornx/riscv-operating-system-mooc/issues/I55JRV
- https://gitee.com/unicornx/riscv-operating-system-mooc/issues/I4UUHU
- https://gitee.com/unicornx/riscv-operating-system-mooc/issues/I4D6N9

Signed-off-by: Chen Wang <wangchen20@iscas.ac.cn>
v0.9.5
2022-06-12 16:37:03 +08:00
Wang Chen
ae10d3e698 fixed some minor issues.
- https://gitee.com/unicornx/riscv-operating-system-mooc/issues/I4QLTP
- https://gitee.com/unicornx/riscv-operating-system-mooc/issues/I4PJTQ
- https://gitee.com/unicornx/riscv-operating-system-mooc/issues/I49VW5

Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
v0.9.4
2022-01-27 11:06:44 +08:00
Wang Chen
ca2629bebc I493SN:fix bugs introduced by I441IC v0.9.3 2021-09-08 08:38:58 +08:00
Wang Chen
d9f5e22e99 fixed issues I47WMN, I477IX,I441IC v0.9.2 2021-09-06 10:30:57 +08:00
Wang Chen
09ea96ffed fixed issues I42AUE & I42BLV v0.9.1 2021-08-01 16:05:35 +08:00
Wang Chen
100cc9f1d9 This commitment contains following changes:
- updated openday report
- fixed I41BDM
- I3ZLLK, code part & errata part fixing
- fixed I3XWKC, ppt & errata part
- fixed I418VG
v0.9
2021-07-22 17:10:04 +08:00
Wang Chen
07d7c9bfe6 I3TIR4 & I3TIOA & I3TIO6, added updated slides & poster v0.8 2021-06-07 09:20:42 +08:00
Wang Chen
4e72000601 updated before 7th class v0.7 2021-05-13 11:44:18 +08:00
Wang Chen
6ae80a44d4 updated before 6th class v0.6 2021-05-06 15:08:22 +08:00
Wang Chen
d1bd44e1bd updated before 5th class v0.5 2021-04-29 16:32:57 +08:00
Wang Chen
ae6016caf2 updated before 4th class v0.4 2021-04-22 14:33:24 +08:00
Wang Chen
a9a5c2fdb3 updated before 3rd class v0.3 2021-04-15 14:47:40 +08:00
Wang Chen
5dbe7364e2 updatad before second class v0.2 2021-04-08 15:32:45 +08:00
Wang Chen
ad15280f3a initial versioin v0.1 2021-04-01 20:02:31 +08:00
Wang Chen
8ad78e0e0a first commit 2021-03-31 14:21:34 +08:00