git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Kernel/x86_64 - Fixed bugs exposed by -O3
[tpg/acess2.git]
/
Kernel
/
arch
/
x86_64
/
start32.asm
diff --git
a/Kernel/arch/x86_64/start32.asm
b/Kernel/arch/x86_64/start32.asm
index
6de3a87
..
52b133c
100644
(file)
--- a/
Kernel/arch/x86_64/start32.asm
+++ b/
Kernel/arch/x86_64/start32.asm
@@
-1,3
+1,8
@@
+;
+; Acess2 x86_64 port
+;
+
+%include "arch/x86_64/include/common.inc.asm"
[BITS 32]
[BITS 32]
@@
-57,15
+62,16
@@
start:
mov eax, gInitialPML4 - KERNEL_BASE
mov cr3, eax
mov eax, gInitialPML4 - KERNEL_BASE
mov cr3, eax
- ; Enable long/compatability mode
+ ; Enable IA-32e mode
+ ; (Also enables SYSCALL and NX)
mov ecx, 0xC0000080
rdmsr
mov ecx, 0xC0000080
rdmsr
- or
ax, 0x100
+ or
eax, (1 << 11)|(1 << 8)|(1 << 0) ; NXE, LME, SCE
wrmsr
; Enable paging
mov eax, cr0
wrmsr
; Enable paging
mov eax, cr0
- or eax, 0x800
00000
+ or eax, 0x800
10000 ; PG & WP
mov cr0, eax
; Load GDT
mov cr0, eax
; Load GDT
@@
-85,6
+91,8
@@
start:
jmp .loop
.hlt:
jmp .loop
.hlt:
+ cli
+ hlt
jmp .hlt
[section .data]
jmp .hlt
[section .data]
@@
-150,11
+158,11
@@
gKStackPT: ; Covers 2 MiB
; Initial stack - 64KiB
dq 0
%assign i 0
; Initial stack - 64KiB
dq 0
%assign i 0
- %rep
16
-1
+ %rep
INITIAL_KSTACK_SIZE
-1
dd gInitialKernelStack - KERNEL_BASE + i*0x1000 + 0x103, 0
%assign i i+1
%endrep
dd gInitialKernelStack - KERNEL_BASE + i*0x1000 + 0x103, 0
%assign i i+1
%endrep
- times 512-
16
dq 0
+ times 512-
INITIAL_KSTACK_SIZE
dq 0
gInitialPT1: ; 2 MiB
%assign i 0
%rep 512
gInitialPT1: ; 2 MiB
%assign i 0
%rep 512
@@
-171,8
+179,10
@@
gInitialPT2: ; 2 MiB
[section .padata]
[global gInitialKernelStack]
gInitialKernelStack:
[section .padata]
[global gInitialKernelStack]
gInitialKernelStack:
- times 0x1000*(
16-1) db 0 ; 16
Pages
+ times 0x1000*(
INITIAL_KSTACK_SIZE-1) db 0 ; 8
Pages
[section .rodata]
csNot64BitCapable:
db "Not 64-bit Capable",0
[section .rodata]
csNot64BitCapable:
db "Not 64-bit Capable",0
+
+; vim: ft=nasm
UCC
git Repository :: git.ucc.asn.au