19 Commits

Author SHA1 Message Date
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>
2024-06-06 10:13:52 +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
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
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
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>
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>
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>
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>
2022-01-27 11:06:44 +08:00
Wang Chen
d9f5e22e99 fixed issues I47WMN, I477IX,I441IC 2021-09-06 10:30:57 +08:00
Wang Chen
09ea96ffed fixed issues I42AUE & I42BLV 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
2021-07-22 17:10:04 +08:00
Wang Chen
07d7c9bfe6 I3TIR4 & I3TIOA & I3TIO6, added updated slides & poster 2021-06-07 09:20:42 +08:00
Wang Chen
a9a5c2fdb3 updated before 3rd class 2021-04-15 14:47:40 +08:00
Wang Chen
ad15280f3a initial versioin 2021-04-01 20:02:31 +08:00