1
0
mirror of https://gitlab.os-k.eu/os-k-team/kvisc.git synced 2023-08-25 14:05:46 +02:00
This commit is contained in:
julianb0 2019-07-15 20:58:17 +02:00
parent 498e46ddc8
commit 1cd5286440
No known key found for this signature in database
GPG Key ID: DDF8325C95299A62
3 changed files with 14 additions and 14 deletions

20
ka/ABI
View File

@ -19,7 +19,7 @@ A function's assembly code looks like this:
ret ret
'N' is the number of local variables used by the function. 'N' is the number of local variables used by the function.
The above code is equivalent to the following, but faster: The above code is equivalent to (and can be substitued by) the following:
label: label:
push rbp push rbp
mov rbp, rsp mov rbp, rsp
@ -36,16 +36,14 @@ Between the 'enter' and the 'leave', the stack looks like this:
. . . .
. (caller's) . . (caller's) .
|---------------| |---------------|
| saved rip | rbp+8 | saved rip | rbp+8 rsp+(N*8)+16
| saved rbp | rbp+0 | saved rbp | rbp rsp+(N*8)+8
| . | rsp+(N*8) \ | . | rbp-8 rsp+(N*8) \
| . | ... | | . | rbp-16 rsp+(N-1)*8 |
| . | ... | | . | ... | <- local
| . | ... |- Local variables | . | rbp-(N-1)*8 rsp+8 | variables
| . | rsp+16 | | . | rbp-(N*8) rsp |
| . | rsp+8 | |---------------| /
| . | rsp+0 /
|---------------|
. (red zone) . . (red zone) .
. . . .
. . . .

View File

@ -28,9 +28,6 @@ start:
call main call main
mov rax, Sys.Exit
trap 0
crash crash
; ;

View File

@ -28,11 +28,16 @@ InitSyscalls:
ret ret
SwitchToCMD:
mov rax, Sys.Exit
trap 0
; ;
; Main function ; Main function
; ;
main: main:
call PrintBootMsg call PrintBootMsg
call InitSyscalls call InitSyscalls
call SwitchToCMD
ret ret