misc: Load BIOS port at 0xf000 instead of 0x8000

This commit is contained in:
mintsuki 2023-03-07 02:21:09 +01:00
parent 5bc6fbca3b
commit 4ef529b4eb
4 changed files with 9 additions and 9 deletions

View File

@ -208,7 +208,7 @@ $(call MKESCAPE,$(BUILDDIR))/stage2.bin.gz: $(call MKESCAPE,$(BUILDDIR))/stage2.
gzip -n -9 < '$(call SHESCAPE,$<)' > '$(call SHESCAPE,$@)'
$(call MKESCAPE,$(BUILDDIR))/stage2.bin: $(call MKESCAPE,$(BUILDDIR))/limine.sys
dd if='$(call SHESCAPE,$<)' bs=$$(( 0x$$("$(CROSS_READELF)" -S '$(call SHESCAPE,$(BUILDDIR))/limine.elf' | $(GREP) '\.text\.stage3' | $(SED) 's/^.*] //' | $(AWK) '{print $$3}' | $(SED) 's/^0*//') - 0x8000 )) count=1 of='$(call SHESCAPE,$@)' 2>/dev/null
dd if='$(call SHESCAPE,$<)' bs=$$(( 0x$$("$(CROSS_READELF)" -S '$(call SHESCAPE,$(BUILDDIR))/limine.elf' | $(GREP) '\.text\.stage3' | $(SED) 's/^.*] //' | $(AWK) '{print $$3}' | $(SED) 's/^0*//') - 0xf000 )) count=1 of='$(call SHESCAPE,$@)' 2>/dev/null
$(call MKESCAPE,$(BUILDDIR))/stage2.map.o: $(call MKESCAPE,$(BUILDDIR))/limine_nomap.elf
cd '$(call SHESCAPE,$(BUILDDIR))' && \

View File

@ -58,8 +58,8 @@ static bool stage3_init(struct volume *part) {
}
fread(stage3, stage3_addr,
(uintptr_t)stage3_addr - 0x8000,
stage3->size - ((uintptr_t)stage3_addr - 0x8000));
(uintptr_t)stage3_addr - 0xf000,
stage3->size - ((uintptr_t)stage3_addr - 0xf000));
fclose(stage3);

View File

@ -12,7 +12,7 @@ PHDRS
SECTIONS
{
. = 0x8000;
. = 0xf000;
.text.stage2 : {
*(.entry)
@ -80,7 +80,7 @@ SECTIONS
.note.gnu.build-id : {
*(.note.gnu.build-id)
limine_sys_size = . - 0x8000;
limine_sys_size = . - 0xf000;
} :data_s3
.bss : {

View File

@ -4,18 +4,18 @@
#include <tinf.h>
noreturn void entry(uint8_t *compressed_stage2, size_t stage2_size, uint8_t boot_drive, int pxe) {
// The decompressor should decompress compressed_stage2 to address 0x8000.
uint8_t *dest = (uint8_t *)0x8000;
// The decompressor should decompress compressed_stage2 to address 0xf000.
uint8_t *dest = (uint8_t *)0xf000;
tinf_gzip_uncompress(dest, compressed_stage2, stage2_size);
asm volatile (
"movl $0x7c00, %%esp\n\t"
"movl $0xf000, %%esp\n\t"
"xorl %%ebp, %%ebp\n\t"
"pushl %1\n\t"
"pushl %0\n\t"
"pushl $0\n\t"
"pushl $0x8000\n\t"
"pushl $0xf000\n\t"
"ret\n\t"
:
: "r" ((uint32_t)boot_drive), "r" (pxe)