From cd2c78dd46ec8c60b24aaec24aab7a729e478d8d Mon Sep 17 00:00:00 2001 From: Jiajie Chen Date: Sat, 27 Apr 2019 23:04:10 +0800 Subject: [PATCH] Add Rocket Chip platform in README --- README.md | 2 +- crate/memory/src/memory_set/mod.rs | 3 +- kernel/src/arch/riscv32/boot/linker64.ld | 49 ++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 kernel/src/arch/riscv32/boot/linker64.ld diff --git a/README.md b/README.md index 7c5d6bd..35f5a35 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Going to be the next generation teaching operating system. Supported architectures: x86_64, RISCV32/64, AArch64, MIPS32 -Tested boards: QEMU, HiFive Unleashed, x86_64 PC (i5/i7), Raspberry Pi 3B+ +Tested boards: QEMU, HiFive Unleashed, x86_64 PC (i5/i7), Raspberry Pi 3B+, Kendryte K210 and FPGA running Rocket Chip ![demo](./docs/2_OSLab/os2atc/demo.png) diff --git a/crate/memory/src/memory_set/mod.rs b/crate/memory/src/memory_set/mod.rs index 94d8765..4f0f9a5 100644 --- a/crate/memory/src/memory_set/mod.rs +++ b/crate/memory/src/memory_set/mod.rs @@ -58,7 +58,8 @@ impl MemoryArea { fn check_read_array(&self, ptr: *const S, count: usize) -> bool { // page align ptr as usize >= Page::of_addr(self.start_addr).start_address() - && unsafe { ptr.add(count) as usize } < Page::of_addr(self.end_addr + PAGE_SIZE - 1).start_address() + && unsafe { ptr.add(count) as usize } + < Page::of_addr(self.end_addr + PAGE_SIZE - 1).start_address() } /// Check the array is within the writable memory fn check_write_array(&self, ptr: *mut S, count: usize) -> bool { diff --git a/kernel/src/arch/riscv32/boot/linker64.ld b/kernel/src/arch/riscv32/boot/linker64.ld new file mode 100644 index 0000000..87ca826 --- /dev/null +++ b/kernel/src/arch/riscv32/boot/linker64.ld @@ -0,0 +1,49 @@ +/* Copy from bbl-ucore : https://ring00.github.io/bbl-ucore */ + +/* Simple linker script for the ucore kernel. + See the GNU ld 'info' manual ("info ld") to learn the syntax. */ + +OUTPUT_ARCH(riscv) +ENTRY(_start) + +BASE_ADDRESS = 0xffffffffc0200000; + +SECTIONS +{ + /* Load the kernel at this address: "." means the current address */ + . = BASE_ADDRESS; + start = .; + + .text : { + stext = .; + *(.text.entry) + *(.text .text.*) + . = ALIGN(4K); + etext = .; + } + + .rodata : { + srodata = .; + *(.rodata .rodata.*) + . = ALIGN(4K); + erodata = .; + } + + .data : { + sdata = .; + *(.data .data.*) + edata = .; + } + + .stack : { + *(.bss.stack) + } + + .bss : { + sbss = .; + *(.bss .bss.*) + ebss = .; + } + + PROVIDE(end = .); +}