2021-06-29 16:16:25 +03:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <mm/vmm.h>
|
2021-08-26 02:41:13 +03:00
|
|
|
#if bios == 1
|
|
|
|
# include <sys/idt.h>
|
|
|
|
#endif
|
2021-06-29 16:16:25 +03:00
|
|
|
|
|
|
|
__attribute__((noreturn)) void multiboot1_spinup_32(
|
|
|
|
uint32_t entry_point, uint32_t multiboot1_info) {
|
2021-08-26 02:41:13 +03:00
|
|
|
#if bios == 1
|
|
|
|
struct idtr idtr;
|
|
|
|
|
|
|
|
idtr.limit = 0x3ff;
|
|
|
|
idtr.ptr = 0;
|
|
|
|
|
|
|
|
asm volatile (
|
|
|
|
"lidt %0"
|
|
|
|
:
|
|
|
|
: "m" (idtr)
|
|
|
|
: "memory"
|
|
|
|
);
|
|
|
|
#endif
|
|
|
|
|
2021-06-29 16:16:25 +03:00
|
|
|
asm volatile (
|
|
|
|
"cld\n\t"
|
|
|
|
|
2021-10-02 23:17:22 +03:00
|
|
|
"push %2\n\t"
|
2021-06-29 16:16:25 +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-06-29 16:16:25 +03:00
|
|
|
|
2021-10-02 23:17:22 +03:00
|
|
|
"ret\n\t"
|
2021-06-29 16:16:25 +03:00
|
|
|
:
|
2021-10-02 23:17:22 +03:00
|
|
|
: "a" (0x2badb002),
|
|
|
|
"b" (multiboot1_info),
|
|
|
|
"r" (entry_point)
|
2021-06-29 16:16:25 +03:00
|
|
|
: "memory"
|
|
|
|
);
|
|
|
|
|
|
|
|
__builtin_unreachable();
|
|
|
|
}
|