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 - Fixed build and run after x86_64 and arm7 changes to API
[tpg/acess2.git]
/
Kernel
/
arch
/
x86_64
/
start64.asm
diff --git
a/Kernel/arch/x86_64/start64.asm
b/Kernel/arch/x86_64/start64.asm
index
04bac26
..
5027a1e
100644
(file)
--- a/
Kernel/arch/x86_64/start64.asm
+++ b/
Kernel/arch/x86_64/start64.asm
@@
-2,7
+2,8
@@
; Acess2 x86_64 Port
;
[bits 64]
; Acess2 x86_64 Port
;
[bits 64]
-KERNEL_BASE equ 0xFFFF800000000000
+;KERNEL_BASE equ 0xFFFF800000000000
+KERNEL_BASE equ 0xFFFFFFFF80000000
[extern kmain]
[extern kmain]
@@
-24,6
+25,9
@@
start64:
jmp rax
.himem:
jmp rax
.himem:
+ xor rax, rax
+ mov dr0, rax ; Set CPU0
+
; Clear the screen
mov rax, 0x1F201F201F201F20 ; Set the screen to White on blue, space (4 characters)
mov edi, 0xB8000
; Clear the screen
mov rax, 0x1F201F201F201F20 ; Set the screen to White on blue, space (4 characters)
mov edi, 0xB8000
@@
-31,7
+35,7
@@
start64:
rep stosq
; Set kernel stack
rep stosq
; Set kernel stack
- mov rsp,
gInitialKernelStack
+ mov rsp,
0xFFFFA00000000000 + 0x10000
; Call main
mov edi, [gMultibootMagic - KERNEL_BASE]
; Call main
mov edi, [gMultibootMagic - KERNEL_BASE]
@@
-43,17
+47,12
@@
start64:
hlt
jmp .hlt
hlt
jmp .hlt
-[global GetRIP]
-GetRIP:
- mov rax, [rsp]
- ret
-
[global GetCPUNum]
GetCPUNum:
[global GetCPUNum]
GetCPUNum:
- str ax
- mov gs, ax
xor rax, rax
xor rax, rax
- mov al, [gs:104] ; End of TSS
+ str ax
+ sub ax, 0x38 ; TSS Base
+ shr ax, 4 ; One 16-byte TSS per CPU
ret
KSTACK_USERSTATE_SIZE equ (16+1+5)*8 ; GPRegs, CPU, IRET
ret
KSTACK_USERSTATE_SIZE equ (16+1+5)*8 ; GPRegs, CPU, IRET
@@
-102,16
+101,53
@@
Proc_ReturnToUser:
CallWithArgArray:
push rbp
mov rbp, rsp
CallWithArgArray:
push rbp
mov rbp, rsp
- mov rcx, [rbp+3*8] ; Get NArgs
- mov rdx, [rbp+4*8]
-
-.top:
- mov rax, [rdx+rcx*8-8]
- push rax
- loop .top
+ push r10
+ push r11
+
+ mov [rbp+2*8], rdi ; Save Ptr to stack
- mov rax, [rbp+2*8]
+ mov r11, rsi ; NArgs
+ mov r10, rdx ; Args
+
+ ; Arg 1: RDI
+ mov rdi, [r10]
+ add r10, 8
+ dec r11
+ jz .call
+ ; Arg 2: RSI
+ mov rsi, [r10]
+ add r10, 8
+ dec r11
+ jz .call
+ ; Arg 3: RDX
+ mov rdx, [r10]
+ add r10, 8
+ dec r11
+ jz .call
+ ; Arg 4: RCX
+ mov rcx, [r10]
+ add r10, 8
+ dec r11
+ jz .call
+ ; Arg 5: R8
+ mov r8, [r10]
+ add r10, 8
+ dec r11
+ jz .call
+ ; Arg 6: R9
+ mov r9, [r10]
+ add r10, 8
+ dec r11
+ jz .call
+ ; No support for more
+
+.call:
+ mov rax, [rbp+2*8] ; Ptr
call rax
call rax
+
+ pop r11
+ pop r10
+
lea rsp, [rbp]
pop rbp
ret
lea rsp, [rbp]
pop rbp
ret
@@
-125,8
+161,3
@@
User_Syscall_Exit:
; RDI: Return Value
int 0xAC
; RDI: Return Value
int 0xAC
-[section .bss]
-[global gInitialKernelStack]
- resd 1024*4 ; 4 Pages
-gInitialKernelStack:
-
UCC
git Repository :: git.ucc.asn.au