Skip to content

Commit

Permalink
add memory identity mapping when booting
Browse files Browse the repository at this point in the history
  • Loading branch information
elliott10 committed Jul 28, 2021
1 parent da91916 commit 3ca86e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion linux-object/src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ impl LinuxProcess {
files.insert(2.into(), stdout);

LinuxProcess {
root_inode: create_root_fs(rootfs),
root_inode: create_root_fs(rootfs), //Arc::clone(&ROOT_INODE),访问磁盘可能更快?
parent: Weak::default(),
inner: Mutex::new(LinuxProcessInner {
files,
Expand Down
9 changes: 5 additions & 4 deletions zCore/src/arch/riscv/boot/entry64.asm
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,15 @@ bootstacktop:
.section .data
.align 12 #12位对齐
boot_page_table_sv39:
#1G的一个大页: 0xffffffff_00000000 --> 0x00000000
#1G的一个大页: 0x00000000_80000000 --> 0x80000000
#1G的一个大页: 0xffffffff_80000000 --> 0x80000000

#前510项置0
.zero 8 * 508

.quad (0x00000 << 10) | 0xef
.zero 8
.zero 8
.quad (0x80000 << 10) | 0xef #0x80000000 --> 0x80000000

.zero 8 * 507
#倒数第二项,PPN=0x80000(当转换为物理地址时还需左移12位), 标志位DAG_XWRV置1
.quad (0x80000 << 10) | 0xef
.zero 8
Expand Down

0 comments on commit 3ca86e0

Please sign in to comment.