multiboot: Zero out all undefined GPRs before handoff

This commit is contained in:
mintsuki 2021-10-02 22:17:22 +02:00
parent 5d6135e67a
commit 403f18da52
2 changed files with 20 additions and 12 deletions

View File

@ -25,15 +25,19 @@ __attribute__((noreturn)) void multiboot1_spinup_32(
asm volatile (
"cld\n\t"
"pushl $0x18\n\t"
"pushl %%edi\n\t"
"push %2\n\t"
"movl $0x2BADB002, %%eax\n\t"
"xor %%ecx, %%ecx\n\t"
"xor %%edx, %%edx\n\t"
"xor %%esi, %%esi\n\t"
"xor %%edi, %%edi\n\t"
"xor %%ebp, %%ebp\n\t"
"lret\n\t"
"ret\n\t"
:
: "D" (entry_point),
"b" (multiboot1_info)
: "a" (0x2badb002),
"b" (multiboot1_info),
"r" (entry_point)
: "memory"
);

View File

@ -25,15 +25,19 @@ __attribute__((noreturn)) void multiboot2_spinup_32(
asm volatile (
"cld\n\t"
"pushl $0x18\n\t"
"pushl %%edi\n\t"
"push %2\n\t"
"movl $0x36D76289, %%eax\n\t"
"xor %%ecx, %%ecx\n\t"
"xor %%edx, %%edx\n\t"
"xor %%esi, %%esi\n\t"
"xor %%edi, %%edi\n\t"
"xor %%ebp, %%ebp\n\t"
"lret\n\t"
"ret\n\t"
:
: "D" (entry_point),
"b" (multiboot2_info)
: "a" (0x36d76289),
"b" (multiboot2_info),
"r" (entry_point)
: "memory"
);