2019-05-31 15:45:59 +02:00
|
|
|
// Physical memory layout
|
2011-08-07 18:30:34 +02:00
|
|
|
|
2019-05-31 15:45:59 +02:00
|
|
|
// qemu -machine virt is set up like this:
|
|
|
|
// 00001000 -- boot ROM, provided by qemu
|
2019-06-04 16:43:45 +02:00
|
|
|
// 0C000000 -- PLIC
|
2019-05-31 15:45:59 +02:00
|
|
|
// 10000000 -- uart0 registers
|
|
|
|
// 80000000 -- boot ROM jumps here in machine mode
|
2019-05-31 17:45:42 +02:00
|
|
|
// -kernel loads the kernel here
|
|
|
|
// 88000000 -- -initrd fs.img ramdisk image.
|
2019-05-31 15:45:59 +02:00
|
|
|
// unused RAM after 80000000.
|
2011-08-07 18:30:34 +02:00
|
|
|
|
2019-05-31 15:45:59 +02:00
|
|
|
// the kernel uses physical memory thus:
|
|
|
|
// 80000000 -- entry.S, then kernel text and data
|
|
|
|
// end -- start of kernel page allocation area
|
|
|
|
// PHYSTOP -- end RAM used by the kernel
|
2011-08-07 18:30:34 +02:00
|
|
|
|
2019-06-03 20:13:07 +02:00
|
|
|
// qemu puts UART registers here in physical memory.
|
2019-05-31 15:45:59 +02:00
|
|
|
#define UART0 0x10000000L
|
2019-06-03 21:23:12 +02:00
|
|
|
#define UART0_IRQ 10
|
2011-08-07 18:30:34 +02:00
|
|
|
|
2019-06-03 20:13:07 +02:00
|
|
|
// qemu puts programmable interrupt controller here.
|
|
|
|
#define PLIC 0x0c000000L
|
|
|
|
|
2019-05-31 17:45:42 +02:00
|
|
|
#define RAMDISK 0x88000000
|
|
|
|
|
2019-05-31 15:45:59 +02:00
|
|
|
// the kernel expects there to be RAM
|
|
|
|
// for use by the kernel and user pages
|
|
|
|
// from physical address 0x80000000 to PHYSTOP.
|
|
|
|
#define KERNBASE 0x80000000L
|
2019-06-04 16:43:45 +02:00
|
|
|
#define PHYSTOP (KERNBASE + 128*1024*1024)
|
2019-05-31 15:45:59 +02:00
|
|
|
|
|
|
|
// map the trampoline page to the highest address,
|
|
|
|
// in both user and kernel space.
|
|
|
|
#define TRAMPOLINE (MAXVA - PGSIZE)
|