First Hello world syscall
All checks were successful
Build documentation / build-and-deploy (push) Successful in 26s

This commit is contained in:
2026-01-03 02:04:09 +01:00
parent 1341dc00d9
commit e52268cd8e
26 changed files with 228 additions and 140 deletions

View File

@@ -1,4 +1,5 @@
#include <amd64/intr_defs.h>
#include <amd64/regsasm.h>
.extern amd64_intr_handler
@@ -9,67 +10,20 @@
pushq $0; \
pushq $z;
#define push_regs \
pushq %rax; \
pushq %rcx; \
pushq %rdx; \
pushq %rsi; \
pushq %rdi; \
pushq %rbp; \
pushq %rbx; \
pushq %r8; \
pushq %r9; \
pushq %r10; \
pushq %r11; \
pushq %r12; \
pushq %r13; \
pushq %r14; \
pushq %r15;
#define pop_regs \
popq %r15; \
popq %r14; \
popq %r13; \
popq %r12; \
popq %r11; \
popq %r10; \
popq %r9; \
popq %r8; \
popq %rbx; \
popq %rbp; \
popq %rdi; \
popq %rsi; \
popq %rdx; \
popq %rcx; \
popq %rax;
#define make_intr_stub(x, n) \
.global amd64_intr ## n; \
amd64_intr ## n:; \
x(n); \
cli; \
movq %rsp, %rax; \
movq 144(%rax), %rax; \
testb $3, %al; \
jz 1f; \
swapgs; \
1:; \
push_regs; \
cld; \
movq %rsp, %rdi; \
movq %rsp, %rax; \
movq %rsp, %rbp; \
subq $8, %rsp; \
andq $~0xF, %rsp; \
movq %rax, (%rsp); \
callq amd64_intr_handler; \
movq (%rsp), %rsp; \
movq %rbp, %rsp; \
pop_regs; \
movq %rsp, %rax; \
movq 144(%rax), %rax; \
testb $3, %al; \
jz 2f; \
swapgs; \
2:; \
addq $16, %rsp; \
iretq;