Compare commits
3 commits
b8b8f58fee
...
1825a89ab5
Author | SHA1 | Date | |
---|---|---|---|
|
1825a89ab5 | ||
|
eb6dd2be2c | ||
|
1d3036da7a |
3 changed files with 18 additions and 4 deletions
2
Makefile
2
Makefile
|
@ -168,6 +168,8 @@ QEMUOPTS += -device virtio-blk-device,drive=x0,bus=virtio-mmio-bus.0
|
|||
qemu: $K/kernel fs.img
|
||||
$(QEMU) $(QEMUOPTS)
|
||||
|
||||
kernel: $K/kernel
|
||||
|
||||
.gdbinit: .gdbinit.tmpl-riscv
|
||||
sed "s/:1234/:$(GDBPORT)/" < $^ > $@
|
||||
|
||||
|
|
|
@ -429,6 +429,16 @@ typedef u64 *pagetable_t; // 512 PTEs
|
|||
/**
|
||||
* Page Table Entry Flags
|
||||
*/
|
||||
/** Valid */
|
||||
#define PTE_V (1L << 0)
|
||||
/** Readable */
|
||||
#define PTE_R (1L << 1)
|
||||
/** Writable */
|
||||
#define PTE_W (1L << 2)
|
||||
/** Executable */
|
||||
#define PTE_X (1L << 3)
|
||||
/** User-accessible */
|
||||
#define PTE_U (1L << 4)
|
||||
|
||||
#define PTE_V (1L << 0) /** PTE Valid */
|
||||
#define PTE_R (1L << 1) /** PTE Readable */
|
||||
|
|
10
kernel/vm.c
10
kernel/vm.c
|
@ -12,7 +12,7 @@ extern char etext[]; // kernel.ld sets this to end of kernel code.
|
|||
|
||||
extern char trampoline[]; // trampoline.S
|
||||
|
||||
// Make a direct-map page table for the kernel.
|
||||
/** Make a direct-map page table for the kernel. */
|
||||
pagetable_t
|
||||
kvmmake(void)
|
||||
{
|
||||
|
@ -49,15 +49,17 @@ kvmmake(void)
|
|||
return kpgtbl;
|
||||
}
|
||||
|
||||
// Initialize the one kernel_pagetable
|
||||
/** Initialize the one kernel_pagetable */
|
||||
void
|
||||
kvminit(void)
|
||||
{
|
||||
kernel_pagetable = kvmmake();
|
||||
}
|
||||
|
||||
// Switch h/w page table register to the kernel's page table,
|
||||
// and enable paging.
|
||||
/**
|
||||
* Switch h/w page table register to the kernel's page table,
|
||||
* and enable paging.
|
||||
*/
|
||||
void
|
||||
kvminithart()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue