提交 ab91c386 编写于 作者: Z Zihao Yu

riscv32: move PC_START to 0x80100000 to match the mapping of qemu

上级 e0913557
......@@ -4,7 +4,7 @@
#include "common.h"
#include "memory.h"
#define PC_START IMAGE_START
#define PC_START (0x80000000u + IMAGE_START)
typedef struct {
union {
......
......@@ -3,8 +3,9 @@
// this is not consistent with uint8_t
// but it is ok since we do not access the array directly
const uint32_t isa_default_img [] = {
0x00002023, // sw zero, 0(zero)
0x00002503, // lw a0,0(zero)
0x800002b7, // lui t0,0x80000
0x0002a023, // sw zero,0(t0)
0x0002a503, // lw a0,0(t0)
0x0000006b, // nemu_trap
};
const long isa_default_img_size = sizeof(isa_default_img);
......
#include "nemu.h"
#include "memory/memory.h"
static inline paddr_t va2pa(vaddr_t addr) {
return addr & ~0x80000000u;
}
uint32_t isa_vaddr_read(vaddr_t addr, int len) {
return paddr_read(addr, len);
return paddr_read(va2pa(addr), len);
}
void isa_vaddr_write(vaddr_t addr, uint32_t data, int len) {
paddr_write(addr, data, len);
paddr_write(va2pa(addr), data, len);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册