mirror of
https://github.com/limine-bootloader/limine
synced 2025-01-24 13:32:19 +03:00
Add memory clobbers where missing and remove useless stivale signature
This commit is contained in:
parent
e45f8ac41a
commit
ddd4172dcd
2
Makefile
2
Makefile
@ -14,7 +14,7 @@ test.img:
|
||||
dd if=/dev/zero bs=1M count=0 seek=4096 of=test.img
|
||||
ifeq ($(OS), Linux)
|
||||
parted -s test.img mklabel msdos
|
||||
parted -s test.img mkpart primary 100%
|
||||
parted -s test.img mkpart primary 0% 100%
|
||||
else ifeq ($(OS), FreeBSD)
|
||||
sudo mdconfig -a -t vnode -f test.img -u md9
|
||||
sudo gpart create -s mbr md9
|
||||
|
@ -73,8 +73,6 @@ PIC/APIC IRQs are all masked.
|
||||
|
||||
`rdi` will point to the stivale structure (described below).
|
||||
|
||||
`rax` contains the stivale signature `0x73746976616c6521` (`stivale!` in ASCII).
|
||||
|
||||
All other general purpose registers are set to 0.
|
||||
|
||||
### 32-bit kernel
|
||||
@ -101,8 +99,6 @@ PIC/APIC IRQs are all masked.
|
||||
|
||||
`esp` is set to the requested stack as per stivale header.
|
||||
|
||||
`edx:eax` contain the stivale signature `0x73746976:0x616c6521` (`stivale!` in ASCII).
|
||||
|
||||
A pointer to the stivale structure (described below) is pushed onto this stack
|
||||
before the entry point is called.
|
||||
|
||||
|
BIN
qloader2.bin
BIN
qloader2.bin
Binary file not shown.
@ -30,7 +30,7 @@ int cpuid(uint32_t leaf, uint32_t subleaf,
|
||||
}
|
||||
|
||||
__attribute__((noreturn)) void panic(const char *fmt, ...) {
|
||||
asm volatile ("cli");
|
||||
asm volatile ("cli" ::: "memory");
|
||||
|
||||
va_list args;
|
||||
|
||||
@ -42,7 +42,7 @@ __attribute__((noreturn)) void panic(const char *fmt, ...) {
|
||||
va_end(args);
|
||||
|
||||
for (;;) {
|
||||
asm volatile ("hlt");
|
||||
asm volatile ("hlt" ::: "memory");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,21 +7,21 @@
|
||||
asm volatile ( "out dx, al" \
|
||||
: \
|
||||
: "a" (value), "d" (port) \
|
||||
: ); \
|
||||
: "memory" ); \
|
||||
})
|
||||
|
||||
#define port_out_w(port, value) ({ \
|
||||
asm volatile ( "out dx, ax" \
|
||||
: \
|
||||
: "a" (value), "d" (port) \
|
||||
: ); \
|
||||
: "memory" ); \
|
||||
})
|
||||
|
||||
#define port_out_d(port, value) ({ \
|
||||
asm volatile ( "out dx, eax" \
|
||||
: \
|
||||
: "a" (value), "d" (port) \
|
||||
: ); \
|
||||
: "memory" ); \
|
||||
})
|
||||
|
||||
#define port_in_b(port) ({ \
|
||||
@ -29,7 +29,7 @@
|
||||
asm volatile ( "in al, dx" \
|
||||
: "=a" (value) \
|
||||
: "d" (port) \
|
||||
: ); \
|
||||
: "memory" ); \
|
||||
value; \
|
||||
})
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
asm volatile ( "in ax, dx" \
|
||||
: "=a" (value) \
|
||||
: "d" (port) \
|
||||
: ); \
|
||||
: "memory" ); \
|
||||
value; \
|
||||
})
|
||||
|
||||
@ -47,13 +47,8 @@
|
||||
asm volatile ( "in eax, dx" \
|
||||
: "=a" (value) \
|
||||
: "d" (port) \
|
||||
: ); \
|
||||
: "memory" ); \
|
||||
value; \
|
||||
})
|
||||
|
||||
#define io_wait() ({ port_out_b(0x80, 0x00); })
|
||||
|
||||
#define disable_interrupts() ({ asm volatile ("cli"); })
|
||||
#define enable_interrupts() ({ asm volatile ("sti"); })
|
||||
|
||||
#endif
|
||||
|
@ -62,5 +62,6 @@ void chainload(void) {
|
||||
".code32\n\t"
|
||||
:
|
||||
: "d" (drive)
|
||||
: "memory"
|
||||
);
|
||||
}
|
||||
|
@ -166,5 +166,6 @@ void linux_load(char *cmdline, int boot_drive) {
|
||||
"retf\n\t"
|
||||
:
|
||||
: "b" (real_mode_code_seg), "c" (kernel_entry_seg)
|
||||
: "memory"
|
||||
);
|
||||
}
|
||||
|
@ -353,8 +353,7 @@ void stivale_load(char *cmdline, int boot_drive) {
|
||||
"push 0x28\n\t"
|
||||
"push [rbx]\n\t"
|
||||
|
||||
"mov rax, 0x73746976616c6521\n\t"
|
||||
|
||||
"xor rax, rax\n\t"
|
||||
"xor rbx, rbx\n\t"
|
||||
"xor rcx, rcx\n\t"
|
||||
"xor rdx, rdx\n\t"
|
||||
@ -390,11 +389,10 @@ void stivale_load(char *cmdline, int boot_drive) {
|
||||
"push 0x18\n\t"
|
||||
"push [ebx]\n\t"
|
||||
|
||||
"mov edx, 0x73746976\n\t"
|
||||
"mov eax, 0x616c6521\n\t"
|
||||
|
||||
"xor eax, eax\n\t"
|
||||
"xor ebx, ebx\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"
|
||||
|
Loading…
Reference in New Issue
Block a user