mirror of
https://github.com/hermitcore/libhermit.git
synced 2025-03-09 00:00:03 +01:00
some code cleanups, the current version is just proof of concept
This commit is contained in:
parent
66195c7795
commit
724a2cd70d
2 changed files with 5 additions and 14 deletions
|
@ -201,16 +201,17 @@ L1:
|
|||
|
||||
; Set CR3
|
||||
mov eax, boot_pml4
|
||||
or eax, (1 << 0) ; set present bit
|
||||
mov cr3, eax
|
||||
|
||||
; Set CR4
|
||||
mov eax, cr4
|
||||
and eax, 0xfffbf9ff ; disable SSE
|
||||
or eax, (1 << 4) ; enable PSE
|
||||
or eax, (1 << 7) ; enabel PGE
|
||||
or eax, (1 << 7) ; enable PGE
|
||||
or eax, (1 << 20) ; enable SMEP
|
||||
mov cr4, eax
|
||||
|
||||
; Set CR0
|
||||
; Set CR0 (PM-bit is already set)
|
||||
mov eax, cr0
|
||||
and eax, ~(1 << 2) ; disable FPU emulation
|
||||
or eax, (1 << 1) ; enable FPU montitoring
|
||||
|
@ -218,7 +219,6 @@ L1:
|
|||
and eax, ~(1 << 29) ; disable write through caching
|
||||
and eax, ~(1 << 16) ; allow kernel write access to read-only pages
|
||||
or eax, (1 << 31) ; enable paging
|
||||
or eax, (1 << 0) ; long mode also needs PM-bit set
|
||||
mov cr0, eax
|
||||
|
||||
ret
|
||||
|
@ -247,15 +247,6 @@ start64:
|
|||
call main
|
||||
jmp $
|
||||
|
||||
;global gdt_flush
|
||||
;extern gp
|
||||
|
||||
; This will set up our new segment registers and is declared in
|
||||
; C as 'extern void gdt_flush();'
|
||||
;gdt_flush:
|
||||
; lgdt [gp]
|
||||
; ret
|
||||
|
||||
SECTION .data
|
||||
|
||||
global mb_info:
|
||||
|
|
|
@ -136,9 +136,9 @@ void main(void)
|
|||
*((uint64_t*) (viraddr + 0x08)) = phyaddr; // physical start address
|
||||
*((uint32_t*) (viraddr + 0x1C)) = 0; // apicid;
|
||||
*((uint32_t*) (viraddr + 0x24)) = 1; // number of used cpus
|
||||
*((uint32_t*) (viraddr + 0x30)) = 0; // apicid
|
||||
*((uint64_t*) (viraddr + 0x38)) = prog_header->file_size;
|
||||
*((uint32_t*) (viraddr + 0x60)) = 1; // numa nodes
|
||||
*((uint32_t*) (viraddr + 0x30)) = 0; // apicid
|
||||
}
|
||||
break;
|
||||
case ELF_PT_GNU_STACK: // Indicates stack executability => nothing todo
|
||||
|
|
Loading…
Add table
Reference in a new issue