31 lines
392 B
Plaintext
31 lines
392 B
Plaintext
%include "src/constants/sizes.asm"
|
|
|
|
extern exit
|
|
extern main
|
|
|
|
section .text
|
|
global _start
|
|
global stack_is_top
|
|
|
|
_start:
|
|
mov rdi, [rsp]
|
|
lea rsi, [rsp + SIZE_QWORD]
|
|
push rsp ;Can maybe used as a method to find out if we're at top of the stack
|
|
push -1
|
|
|
|
call main
|
|
|
|
mov rdi, rax
|
|
call exit
|
|
|
|
stack_is_top:
|
|
xor rax, rax
|
|
mov rdi, rsp
|
|
cmp rdi, [rsp]
|
|
je .yes
|
|
jmp .q
|
|
.yes:
|
|
inc al
|
|
.q:
|
|
ret
|