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:
parent
2c7967f772
commit
9152ac341f
@ -50,7 +50,6 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg)
|
|||||||
MmInitMemoryMap();
|
MmInitMemoryMap();
|
||||||
MmInitPaging();
|
MmInitPaging();
|
||||||
|
|
||||||
|
|
||||||
// Interrupts launching
|
// Interrupts launching
|
||||||
KeSetupIDT();
|
KeSetupIDT();
|
||||||
KeEnableIRQs();
|
KeEnableIRQs();
|
||||||
|
@ -31,7 +31,7 @@ enum
|
|||||||
MF_NX = 1 << 31
|
MF_NX = 1 << 31
|
||||||
};
|
};
|
||||||
|
|
||||||
#define RAM 8
|
#define RAM_MAX 16
|
||||||
#define NB_4K 2
|
#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 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)));
|
volatile pte_t MmPT[512 * NB_4K] __attribute__((__aligned__(4096)));
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ void MmInitPaging(void)
|
|||||||
|
|
||||||
// STACK GUARD PAGE
|
// STACK GUARD PAGE
|
||||||
if ((ulong)i*4096 == (ulong)BtLoaderInfo.stackEndAddr) {
|
if ((ulong)i*4096 == (ulong)BtLoaderInfo.stackEndAddr) {
|
||||||
MmPT[i] = ((ulong)i * 4096) | MF_PRESENT;
|
MmPT[i] = ((ulong)i * 4096);
|
||||||
MmStackGuards[0] = i;
|
MmStackGuards[0] = i;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ void MmInitPaging(void)
|
|||||||
|
|
||||||
// STACK GARD PAGE
|
// STACK GARD PAGE
|
||||||
if ((ulong)i*4096 == (ulong)BtLoaderInfo.kernelEndAddr) {
|
if ((ulong)i*4096 == (ulong)BtLoaderInfo.kernelEndAddr) {
|
||||||
MmPT[i] = ((ulong)i * 4096) | MF_PRESENT;
|
MmPT[i] = ((ulong)i * 4096);
|
||||||
MmStackGuards[1] = i;
|
MmStackGuards[1] = i;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -88,11 +88,11 @@ void MmInitPaging(void)
|
|||||||
MmPD[i] = (ulong)(&MmPT[i*512])| MF_PRESENT | MF_READWRITE;
|
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;
|
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;
|
MmPDP[i] = (ulong)(&MmPD[i*512])| MF_PRESENT | MF_READWRITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ error_t CmdDie(int argc, char **argv, char *cmdline)
|
|||||||
|
|
||||||
error_t CmdPF(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;
|
return EOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user