fix missinterpretation of the page attributes & code cleanups
This commit is contained in:
parent
27ef95794b
commit
b3b4862b79
2 changed files with 2 additions and 17 deletions
|
@ -372,12 +372,10 @@ boot_stack:
|
|||
; These tables do a simple identity paging and will
|
||||
; be replaced in page_init() by more fine-granular mappings.
|
||||
ALIGN 4096
|
||||
global boot_map
|
||||
boot_map:
|
||||
boot_pgd:
|
||||
DD boot_pgt + 0x107 ; PG_PRESENT | PG_GLOBAL | PG_RW | PG_USER
|
||||
times 1022 DD 0 ; PAGE_MAP_ENTRIES - 2
|
||||
DD boot_pgd + 0x303 ; PG_PRESENT | PG_GLOBAL | PG_RW | PG_SELF (self-reference)
|
||||
DD boot_pgd + 0x303 ; PG_PRESENT | PG_GLOBAL | PG_RW | PG_SELF (self-reference)
|
||||
boot_pgt:
|
||||
times 1024 DD 0
|
||||
|
||||
|
|
|
@ -55,9 +55,6 @@ extern const void kernel_start;
|
|||
/** Lock for kernel space page tables */
|
||||
static spinlock_t kslock = SPINLOCK_INIT;
|
||||
|
||||
/** This PGD table is initialized in entry.asm */
|
||||
extern size_t* boot_map;
|
||||
|
||||
/** A self-reference enables direct access to all page tables */
|
||||
static size_t* self[PAGE_LEVELS] = {
|
||||
(size_t *) 0xFFC00000,
|
||||
|
@ -86,16 +83,6 @@ int page_set_flags(size_t viraddr, uint32_t npages, int flags)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
int page_map_bootmap(size_t viraddr, size_t phyaddr, size_t bits)
|
||||
{
|
||||
if (BUILTIN_EXPECT(viraddr >= PAGE_MAP_ENTRIES*PAGE_SIZE, 0))
|
||||
return -EINVAL;
|
||||
|
||||
boot_map[PAGE_MAP_ENTRIES + (viraddr >> PAGE_BITS)] = phyaddr | bits | PG_PRESENT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int page_map(size_t viraddr, size_t phyaddr, size_t npages, size_t bits)
|
||||
{
|
||||
int lvl, ret = -ENOMEM;
|
||||
|
@ -130,7 +117,7 @@ int page_map(size_t viraddr, size_t phyaddr, size_t npages, size_t bits)
|
|||
atomic_int32_inc(¤t_task->user_usage);
|
||||
|
||||
/* Reference the new table within its parent */
|
||||
self[lvl][vpn] = phyaddr | bits | PG_PRESENT;
|
||||
self[lvl][vpn] = phyaddr | bits | PG_PRESENT | PG_USER | PG_RW;
|
||||
|
||||
/* Fill new table with zeros */
|
||||
memset(&self[lvl-1][vpn<<PAGE_MAP_BITS], 0, PAGE_SIZE);
|
||||
|
|
Loading…
Add table
Reference in a new issue