Kernel: Use PAGE_SIZE in more places
This commit is contained in:
parent
f5deb1048a
commit
97eacc027e
@ -27,5 +27,5 @@ namespace Paging
|
|||||||
struct PageTable
|
struct PageTable
|
||||||
{
|
{
|
||||||
PageDirectoryEntry entries[512];
|
PageDirectoryEntry entries[512];
|
||||||
} __attribute__((aligned(0x1000)));
|
} __attribute__((aligned(PAGE_SIZE)));
|
||||||
}
|
}
|
@ -49,15 +49,15 @@ struct InternalGDT
|
|||||||
GDTEntry user_data;
|
GDTEntry user_data;
|
||||||
GDTEntry tss;
|
GDTEntry tss;
|
||||||
HighGDTEntry tss2;
|
HighGDTEntry tss2;
|
||||||
} __attribute__((packed)) __attribute((aligned(0x1000)));
|
} __attribute__((packed)) __attribute((aligned(PAGE_SIZE)));
|
||||||
|
|
||||||
__attribute__((aligned(0x1000))) static InternalGDT internal_gdt = {{0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00},
|
__attribute__((aligned(PAGE_SIZE))) static InternalGDT internal_gdt = {{0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00},
|
||||||
{0xffff, 0x0000, 0x00, 0x9a, 0xaf, 0x00},
|
{0xffff, 0x0000, 0x00, 0x9a, 0xaf, 0x00},
|
||||||
{0xffff, 0x0000, 0x00, 0x92, 0xcf, 0x00},
|
{0xffff, 0x0000, 0x00, 0x92, 0xcf, 0x00},
|
||||||
{0xffff, 0x0000, 0x00, 0xfa, 0xaf, 0x00},
|
{0xffff, 0x0000, 0x00, 0xfa, 0xaf, 0x00},
|
||||||
{0xffff, 0x0000, 0x00, 0xf2, 0xcf, 0x00},
|
{0xffff, 0x0000, 0x00, 0xf2, 0xcf, 0x00},
|
||||||
{0x0000, 0x0000, 0x00, 0xe9, 0x0f, 0x00},
|
{0x0000, 0x0000, 0x00, 0xe9, 0x0f, 0x00},
|
||||||
{0x00000000, 0x00000000}};
|
{0x00000000, 0x00000000}};
|
||||||
|
|
||||||
static TSS main_tss;
|
static TSS main_tss;
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ namespace Paging
|
|||||||
{
|
{
|
||||||
PDP = (PageTable*)PMM::request_page();
|
PDP = (PageTable*)PMM::request_page();
|
||||||
ASSERT(!(PMM_DID_FAIL(PDP)));
|
ASSERT(!(PMM_DID_FAIL(PDP)));
|
||||||
memset(PDP, 0, 0x1000);
|
memset(PDP, 0, PAGE_SIZE);
|
||||||
PDE.set_address((uint64_t)PDP);
|
PDE.set_address((uint64_t)PDP);
|
||||||
PDE.Present = true;
|
PDE.Present = true;
|
||||||
PDE.ReadWrite = true;
|
PDE.ReadWrite = true;
|
||||||
@ -184,7 +184,7 @@ namespace Paging
|
|||||||
{
|
{
|
||||||
PD = (PageTable*)PMM::request_page();
|
PD = (PageTable*)PMM::request_page();
|
||||||
ASSERT(!(PMM_DID_FAIL(PD)));
|
ASSERT(!(PMM_DID_FAIL(PD)));
|
||||||
memset(PD, 0, 0x1000);
|
memset(PD, 0, PAGE_SIZE);
|
||||||
PDE.set_address((uint64_t)PD);
|
PDE.set_address((uint64_t)PD);
|
||||||
PDE.Present = true;
|
PDE.Present = true;
|
||||||
PDE.ReadWrite = true;
|
PDE.ReadWrite = true;
|
||||||
@ -204,7 +204,7 @@ namespace Paging
|
|||||||
{
|
{
|
||||||
PT = (PageTable*)PMM::request_page();
|
PT = (PageTable*)PMM::request_page();
|
||||||
ASSERT(!(PMM_DID_FAIL(PT)));
|
ASSERT(!(PMM_DID_FAIL(PT)));
|
||||||
memset(PT, 0, 0x1000);
|
memset(PT, 0, PAGE_SIZE);
|
||||||
PDE.set_address((uint64_t)PT);
|
PDE.set_address((uint64_t)PT);
|
||||||
PDE.Present = true;
|
PDE.Present = true;
|
||||||
PDE.ReadWrite = true;
|
PDE.ReadWrite = true;
|
||||||
|
@ -103,7 +103,7 @@ ELFImage* ELFLoader::load_elf_from_address(uintptr_t addr)
|
|||||||
kerrorln("Address is NULL, this is invalid :(");
|
kerrorln("Address is NULL, this is invalid :(");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
uint64_t pages = Utilities::get_blocks_from_size(0x1000, phdr->p_memsz);
|
uint64_t pages = Utilities::get_blocks_from_size(PAGE_SIZE, phdr->p_memsz);
|
||||||
void* buffer = MemoryManager::get_pages_at(phdr->p_vaddr, pages,
|
void* buffer = MemoryManager::get_pages_at(phdr->p_vaddr, pages,
|
||||||
phdr->p_flags & 2 ? MAP_READ_WRITE | MAP_USER : MAP_USER);
|
phdr->p_flags & 2 ? MAP_READ_WRITE | MAP_USER : MAP_USER);
|
||||||
memcpy(buffer, (void*)(addr + phdr->p_offset), phdr->p_filesz);
|
memcpy(buffer, (void*)(addr + phdr->p_offset), phdr->p_filesz);
|
||||||
|
Loading…
Reference in New Issue
Block a user