diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2021-04-30 09:31:30 +0200 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2021-04-30 09:31:30 +0200 |
| commit | 66f2ca62469eba4b46e1f19f54dde9476b08d956 (patch) | |
| tree | 0a419a62a6af21c593e9f6b0d632b5953bc58721 /src/core | |
| parent | 717556178c2017e374ee1108e6b25a24507a1dde (diff) | |
Debug interrupts, allow to show bmp images
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/idt.cc | 1 | ||||
| -rw-r--r-- | src/core/int.S | 3 | ||||
| -rw-r--r-- | src/core/paging.cc | 23 |
3 files changed, 17 insertions, 10 deletions
diff --git a/src/core/idt.cc b/src/core/idt.cc index 25264b6..d2b7ccc 100644 --- a/src/core/idt.cc +++ b/src/core/idt.cc @@ -1,4 +1,5 @@ #include "idt.hpp" +#include "boucane.hpp" #include "core/paging.hpp" #include "libs/string.hpp" diff --git a/src/core/int.S b/src/core/int.S index daf0224..861d5cc 100644 --- a/src/core/int.S +++ b/src/core/int.S @@ -6,7 +6,8 @@ .macro call_printk msg mov \msg, %rdi mov $0, %eax # Required for variadic functions - call printk + mov $printk,%rcx + call *(%rcx) .endm .globl INT_DEFAULT diff --git a/src/core/paging.cc b/src/core/paging.cc index b21e660..b12fb4c 100644 --- a/src/core/paging.cc +++ b/src/core/paging.cc @@ -36,7 +36,10 @@ void paging_enable() { // Setting up new kernel address space for(u64 i=0;i<=0x10000000;i+=4096){ + // Higher half mapping PAGE_MAP(i); + // Allow access to RAM: + paging_allocate_addr(kpages[0], i, i, PAGING_OPT_P|PAGING_OPT_RW, 1); } // 4096 bytes stack @@ -145,32 +148,35 @@ void paging_allocate_addr(u64* pml4_table, u64 virt, u64 phy, u16 options, char // Solve pdp if(pml4_table[pml4] == 0){ - pml4_table[pml4]=(u64)(useKernelTables ? paging_allocate_table() : VIRT(PAGE_ALLOCATE())); + pml4_table[pml4]=(u64)(useKernelTables ? paging_allocate_table() : PAGE_ALLOCATE()); pml4_table[pml4]|=options; paging_allocate_addr(pml4_table,virt,phy,options,useKernelTables); return; } // Solve pd - u64* pdp_table=(u64*)(VIRT(PAGE(pml4_table[pml4]))); + u64* pdp_table=(u64*)(PAGE(pml4_table[pml4])); + pdp_table=useKernelTables ? VIRT(pdp_table) : pdp_table; if(pdp_table[pdp] == 0){ - pdp_table[pdp]=(u64)(useKernelTables ? paging_allocate_table() : VIRT(PAGE_ALLOCATE())); + pdp_table[pdp]=(u64)(useKernelTables ? paging_allocate_table() : PAGE_ALLOCATE()); pdp_table[pdp]|=options; paging_allocate_addr(pml4_table,virt,phy,options,useKernelTables); return; } // Solve pt - u64* pd_table=(u64*)(VIRT(PAGE(pdp_table[pdp]))); + u64* pd_table=(u64*)(PAGE(pdp_table[pdp])); + pd_table=useKernelTables ? VIRT(pd_table) : pd_table; if(pd_table[pd] == 0){ - pd_table[pd]=(u64)(useKernelTables ? paging_allocate_table() : VIRT(PAGE_ALLOCATE())); + pd_table[pd]=(u64)(useKernelTables ? paging_allocate_table() : PAGE_ALLOCATE()); pd_table[pd]|=options; paging_allocate_addr(pml4_table,virt,phy,options,useKernelTables); return; } // Solve address - u64* pt_table=(u64*)(VIRT(PAGE(pd_table[pd]))); + u64* pt_table=(u64*)(PAGE(pd_table[pd])); + pt_table=useKernelTables ? VIRT(pt_table) : pt_table; if(pt_table[pt] == 0){ pt_table[pt]=PAGE(phy); pt_table[pt]|=options; @@ -180,8 +186,7 @@ void paging_allocate_addr(u64* pml4_table, u64 virt, u64 phy, u16 options, char } u64* paging_create_task(int npages){ - u64 *pml4=VIRT(PAGE_ALLOCATE()); - u64 sum=(u64)pml4+kvar_kernel_vma; - paging_allocate_addr(pml4, 0, (u64)PAGE_ALLOCATE(), PAGING_OPT_P|PAGING_OPT_RW, 0); + u64 *pml4=PAGE_ALLOCATE(); + // paging_allocate_addr(pml4, 0, (u64)PAGE_ALLOCATE(), PAGING_OPT_P|PAGING_OPT_RW, 0); return pml4; }
\ No newline at end of file |
