Skip to content
Snippets Groups Projects
Commit f737f3cf authored by Wilke Pierre's avatar Wilke Pierre
Browse files

Fix runcmd issue with gcc + configure PMP correctly

parent b46c2ad2
No related branches found
No related tags found
No related merge requests found
......@@ -174,6 +174,9 @@ QEMUOPTS = -machine virt -bios none -kernel $K/kernel -m 128M -smp $(CPUS) -nogr
QEMUOPTS += -drive file=fs.img,if=none,format=raw,id=x0 -device virtio-blk-device,drive=x0,bus=virtio-mmio-bus.0
QEMUOPTS += -monitor telnet:127.0.0.1:12345,server,nowait
qemu-version:
$(QEMU) --version
qemu: $K/kernel fs.img
$(QEMU) $(QEMUOPTS)
......
......@@ -183,6 +183,18 @@ w_mtvec(uint64 x)
asm volatile("csrw mtvec, %0" : : "r" (x));
}
static inline void
w_pmpcfg0(uint64 x)
{
asm volatile("csrw pmpcfg0, %0" : : "r" (x));
}
static inline void
w_pmpaddr0(uint64 x)
{
asm volatile("csrw pmpaddr0, %0" : : "r" (x));
}
// use riscv's sv39 page table scheme.
#define SATP_SV39 (8L << 60)
......
......@@ -38,6 +38,11 @@ start()
w_mideleg(0xffff);
w_sie(r_sie() | SIE_SEIE | SIE_STIE | SIE_SSIE);
// configure Physical Memory Protection to give supervisor mode
// access to all of physical memory.
w_pmpaddr0(0x3fffffffffffffull);
w_pmpcfg0(0xf);
// ask for clock interrupts.
timerinit();
......
......@@ -54,6 +54,7 @@ void panic(char*);
struct cmd *parsecmd(char*);
// Execute cmd. Never returns.
__attribute__((noreturn))
void
runcmd(struct cmd *cmd)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment