feature: kalloc_frame and demo in the main
This commit is contained in:
@ -2,28 +2,12 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define NOT_PRESENT (1 << 0)
|
||||
#define RW (1 << 1)
|
||||
#define SUPERVISOR (0 << 2)
|
||||
#define INIT_FLAGS (NOT_PRESENT | RW | SUPERVISOR)
|
||||
|
||||
struct page_directory_entry {
|
||||
uint32_t present : 1;
|
||||
uint32_t rw : 1;
|
||||
uint32_t user : 1;
|
||||
uint32_t page_size : 1;
|
||||
uint32_t unused : 8;
|
||||
uint32_t frame : 20;
|
||||
};
|
||||
|
||||
struct page_table_entry {
|
||||
uint32_t present : 1;
|
||||
uint32_t rw : 1;
|
||||
uint32_t user : 1;
|
||||
uint32_t accessed : 1;
|
||||
uint32_t dirty : 1;
|
||||
uint32_t unused : 7;
|
||||
uint32_t frame : 20;
|
||||
};
|
||||
#define PRESENT (1 << 0)
|
||||
#define RW (1 << 1)
|
||||
#define SUPERVISOR (0 << 2)
|
||||
#define ACCESSED (1 << 4)
|
||||
#define INIT_FLAGS (PRESENT | RW | SUPERVISOR)
|
||||
#define PAGE_SIZE 4096
|
||||
|
||||
void init_memory(void);
|
||||
uintptr_t kalloc_frame(uint32_t nb_frames);
|
||||
|
Reference in New Issue
Block a user