2021-09-09 11:40:07 +03:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdbool.h>
|
2021-12-31 12:58:05 +03:00
|
|
|
#include <stdnoreturn.h>
|
2021-09-09 11:40:07 +03:00
|
|
|
#include <mm/vmm.h>
|
|
|
|
#if bios == 1
|
|
|
|
# include <sys/idt.h>
|
|
|
|
#endif
|
|
|
|
|
2021-12-31 12:58:05 +03:00
|
|
|
noreturn void multiboot2_spinup_32(uint32_t entry_point, uint32_t multiboot2_info) {
|
2021-09-09 11:40:07 +03:00
|
|
|
#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();
|
|
|
|
}
|