mirror of
https://github.com/limine-bootloader/limine
synced 2024-11-23 00:51:54 +03:00
protos: Make sure Linux and chainload protocols use the proper real mode IVT when spun up
This commit is contained in:
parent
17c184ca25
commit
2e12cc0a40
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
/limine-install/limine-install
|
||||
/bin
|
||||
/build
|
||||
/toolchain
|
||||
|
Binary file not shown.
@ -9,12 +9,19 @@
|
||||
#include <drivers/disk.h>
|
||||
#include <lib/term.h>
|
||||
#include <mm/mtrr.h>
|
||||
#include <sys/idt.h>
|
||||
|
||||
__attribute__((section(".realmode"), used))
|
||||
__attribute__((noinline))
|
||||
__attribute__((section(".realmode")))
|
||||
static void spinup(uint8_t drive) {
|
||||
struct idtr real_mode_idt = { 0x3ff, 0x0 };
|
||||
|
||||
asm volatile (
|
||||
"cli\n\t"
|
||||
"cld\n\t"
|
||||
|
||||
"lidt [eax]\n\t"
|
||||
|
||||
"jmp 0x08:1f\n\t"
|
||||
"1: .code16\n\t"
|
||||
"mov ax, 0x10\n\t"
|
||||
@ -46,7 +53,7 @@ static void spinup(uint8_t drive) {
|
||||
|
||||
".code32\n\t"
|
||||
:
|
||||
: "d" (drive)
|
||||
: "a" (&real_mode_idt), "d" (drive)
|
||||
: "memory"
|
||||
);
|
||||
}
|
||||
|
@ -13,16 +13,23 @@
|
||||
#include <lib/uri.h>
|
||||
#include <mm/pmm.h>
|
||||
#include <mm/mtrr.h>
|
||||
#include <sys/idt.h>
|
||||
|
||||
#define KERNEL_LOAD_ADDR ((size_t)0x100000)
|
||||
#define KERNEL_HEAP_SIZE ((size_t)0x6000)
|
||||
|
||||
__attribute__((section(".realmode"), used))
|
||||
__attribute__((noinline))
|
||||
__attribute__((section(".realmode")))
|
||||
static void spinup(uint16_t real_mode_code_seg, uint16_t kernel_entry_seg,
|
||||
uint16_t stack_pointer) {
|
||||
struct idtr real_mode_idt = { 0x3ff, 0x0 };
|
||||
|
||||
asm volatile (
|
||||
"cli\n\t"
|
||||
"cld\n\t"
|
||||
|
||||
"lidt [eax]\n\t"
|
||||
|
||||
"jmp 0x08:1f\n\t"
|
||||
"1: .code16\n\t"
|
||||
"mov ax, 0x10\n\t"
|
||||
@ -53,7 +60,7 @@ static void spinup(uint16_t real_mode_code_seg, uint16_t kernel_entry_seg,
|
||||
|
||||
".code32\n\t"
|
||||
:
|
||||
: "b" (real_mode_code_seg), "c" (kernel_entry_seg),
|
||||
: "a" (&real_mode_idt), "b" (real_mode_code_seg), "c" (kernel_entry_seg),
|
||||
"d" (stack_pointer)
|
||||
: "memory"
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user