1
0
mirror of https://gitlab.os-k.eu/os-k-team/os-k.git synced 2023-08-25 14:03:10 +02:00

Working static paging

This commit is contained in:
Adrien Bourmault 2019-05-15 16:38:57 +02:00
parent 2c7967f772
commit 9152ac341f
3 changed files with 7 additions and 8 deletions

View File

@ -50,7 +50,6 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg)
MmInitMemoryMap();
MmInitPaging();
// Interrupts launching
KeSetupIDT();
KeEnableIRQs();

View File

@ -31,7 +31,7 @@ enum
MF_NX = 1 << 31
};
#define RAM 8
#define RAM_MAX 16
#define NB_4K 2
//-----------
@ -40,7 +40,7 @@ volatile pdpe_t MmPML4[512] __attribute__((__aligned__(4096)));
volatile pde_t MmPDP[512] __attribute__((__aligned__(4096)));
volatile pde_t MmPD[512 * RAM] __attribute__((__aligned__(4096)));
volatile pde_t MmPD[512 * RAM_MAX] __attribute__((__aligned__(4096)));
volatile pte_t MmPT[512 * NB_4K] __attribute__((__aligned__(4096)));
@ -60,7 +60,7 @@ void MmInitPaging(void)
// STACK GUARD PAGE
if ((ulong)i*4096 == (ulong)BtLoaderInfo.stackEndAddr) {
MmPT[i] = ((ulong)i * 4096) | MF_PRESENT;
MmPT[i] = ((ulong)i * 4096);
MmStackGuards[0] = i;
continue;
}
@ -76,7 +76,7 @@ void MmInitPaging(void)
// STACK GARD PAGE
if ((ulong)i*4096 == (ulong)BtLoaderInfo.kernelEndAddr) {
MmPT[i] = ((ulong)i * 4096) | MF_PRESENT;
MmPT[i] = ((ulong)i * 4096);
MmStackGuards[1] = i;
continue;
}
@ -88,11 +88,11 @@ void MmInitPaging(void)
MmPD[i] = (ulong)(&MmPT[i*512])| MF_PRESENT | MF_READWRITE;
}
for (int i = NB_4K; i < 512 * RAM; i++) {
for (int i = NB_4K; i < 512 * RAM_MAX; i++) {
MmPD[i] = ((ulong)i * 2048 * 1024) | MF_PRESENT | MF_READWRITE | MF_HUGE;
}
for (int i = 0; i < RAM; i++) {
for (int i = 0; i < RAM_MAX; i++) {
MmPDP[i] = (ulong)(&MmPD[i*512])| MF_PRESENT | MF_READWRITE;
}

View File

@ -224,7 +224,7 @@ error_t CmdDie(int argc, char **argv, char *cmdline)
error_t CmdPF(int argc, char **argv, char *cmdline)
{
*((char*)0xDEADBEEF0) = 1;
*((char*)BtLoaderInfo.stackEndAddr + 16) = 1;
return EOK;
}