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
'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:
push rbp
mov rbp, rsp
@ -36,16 +36,14 @@ Between the 'enter' and the 'leave', the stack looks like this:
. .
. (caller's) .
|---------------|
| saved rip | rbp+8
| saved rbp | rbp+0
| . | rsp+(N*8) \
| . | ... |
| . | ... |
| . | ... |- Local variables
| . | rsp+16 |
| . | rsp+8 |
| . | rsp+0 /
|---------------|
| saved rip | rbp+8 rsp+(N*8)+16
| saved rbp | rbp rsp+(N*8)+8
| . | rbp-8 rsp+(N*8) \
| . | rbp-16 rsp+(N-1)*8 |
| . | ... | <- local
| . | rbp-(N-1)*8 rsp+8 | variables
| . | rbp-(N*8) rsp |
|---------------| /
. (red zone) .
. .
. .

View File

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

View File

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