Compare commits

...

3 commits

Author SHA1 Message Date
Imbus
1825a89ab5 Comment conversion 2025-01-13 16:35:15 +01:00
Imbus
eb6dd2be2c PTE flag comments 2025-01-13 16:35:15 +01:00
Imbus
1d3036da7a Makefile target 'kernel' 2025-01-13 16:34:47 +01:00
3 changed files with 18 additions and 4 deletions

View file

@ -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)/" < $^ > $@

View file

@ -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 */

View file

@ -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()
{