x86 support!

This commit is contained in:
veclavtlica
2026-10-08 10:50:42 +03:00
parent 3db75378c4
commit dc594e5e82
5 changed files with 126 additions and 3 deletions
+26
View File
@@ -0,0 +1,26 @@
/* No libc starting point. Jump straight into action! */
__attribute__((naked)) __attribute__((force_align_arg_pointer))
__attribute__((noreturn)) extern void
_start(void) {
__asm__ volatile("xorl %ebp, %ebp\n"
"movl (%esp), %ecx\n"
"leal 4(%esp), %edx\n"
/* 3. Align the stack pointer to a 16-byte boundary */
"andl $-16, %esp\n"
/* 4. Reserve stack space for main's arguments + padding
We need to pass 2 arguments (8 bytes).
To keep %esp 16-byte aligned before the "call",
we allocate 16 bytes total. */
"subl $16, %esp\n"
/* 5. Place arguments onto the newly aligned stack */
"movl %ecx, (%esp)\n"
"movl %edx, 4(%esp)\n"
"call plr_display_x11_main\n"
"movl %eax, %ebx\n"
"movl $1, %eax\n"
"int $0x80");
}