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,$@)' gzip -n -9 < '$(call SHESCAPE,$<)' > '$(call SHESCAPE,$@)'
$(call MKESCAPE,$(BUILDDIR))/stage2.bin: $(call MKESCAPE,$(BUILDDIR))/limine.sys $(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 $(call MKESCAPE,$(BUILDDIR))/stage2.map.o: $(call MKESCAPE,$(BUILDDIR))/limine_nomap.elf
cd '$(call SHESCAPE,$(BUILDDIR))' && \ cd '$(call SHESCAPE,$(BUILDDIR))' && \

View File

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

View File

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

View File

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