2021-09-09 11:40:07 +03:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <mm/vmm.h>
|
|
|
|
#if bios == 1
|
|
|
|
# include <sys/idt.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
__attribute__((noreturn)) void multiboot2_spinup_32(
|
|
|
|
uint32_t entry_point, uint32_t multiboot2_info) {
|
|
|
|
#if bios == 1
|
|
|
|
struct idtr idtr;
|
|
|
|
|
|
|
|
idtr.limit = 0x3ff;
|
|
|
|
idtr.ptr = 0;
|
|
|
|
|
|
|
|
asm volatile (
|
|
|
|
"lidt %0"
|
|
|
|
:
|
|
|
|
: "m" (idtr)
|
|
|
|
: "memory"
|
|
|
|
);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
asm volatile (
|
|
|
|
"cld\n\t"
|
|
|
|
|
2021-10-02 23:17:22 +03:00
|
|
|
"push %2\n\t"
|
2021-09-09 11:40:07 +03:00
|
|
|
|
2021-10-02 23:17:22 +03:00
|
|
|
"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"
|
2021-09-09 11:40:07 +03:00
|
|
|
|
2021-10-02 23:17:22 +03:00
|
|
|
"ret\n\t"
|
2021-09-09 11:40:07 +03:00
|
|
|
:
|
2021-10-02 23:17:22 +03:00
|
|
|
: "a" (0x36d76289),
|
|
|
|
"b" (multiboot2_info),
|
|
|
|
"r" (entry_point)
|
2021-09-09 11:40:07 +03:00
|
|
|
: "memory"
|
|
|
|
);
|
|
|
|
|
|
|
|
__builtin_unreachable();
|
|
|
|
}
|