$(OUT)blob.16.s: ; $(call whole-compile, $(CFLAGS16) -S, $(addprefix src/, $(SRC16)),$@)
TABLEASM=$(addprefix $(OUT), $(patsubst %.c,%.proc.16.s,$(TABLESRC)))
-$(OUT)romlayout16.o: romlayout.S $(OUT)blob.proc.16.s $(TABLEASM)
+$(OUT)romlayout16.o: romlayout.S $(OUT)blob.16.s $(TABLEASM)
@echo " Generating 16bit layout of $@"
$(Q)$(CC) $(CFLAGS16) -c $< -o $@
-$(OUT)rom16.o: $(OUT)romlayout16.o
+$(OUT)rom16.o: $(OUT)romlayout16.o $(OUT)rombios16.lds
@echo " Linking $@"
- $(Q)ld -melf_i386 -e post16 -Ttext 0 $< -o $@
+ $(Q)ld -T $(OUT)rombios16.lds $< -o $@
$(OUT)romlayout32.o: $(OUT)rom16.offset.auto.h ; $(call whole-compile, $(CFLAGS), $(addprefix src/, $(SRC32)),$@)
Code assumes ebda segment is static - it doesn't read 0x40e.
-See if using an ld script for 16bit mode is a good idea.
-
The __call16 code does a long jump to the interrupt trampolines - this
is unnecessary.
#define CONFIG_SUBMODEL_ID 0x00
#define CONFIG_BIOS_REVISION 0x01
+// Start of fixed addresses in 0xf0000 segment.
+#define CONFIG_START_FIXED 0xe050
+
#endif // config.h
--- /dev/null
+// Linker definitions for 16bit code
+//
+// Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net>
+// Copyright (C) 2002 MandrakeSoft S.A.
+//
+// This file may be distributed under the terms of the GNU GPLv3 license.
+
+#include "config.h"
+
+OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
+OUTPUT_ARCH("i386")
+ENTRY(post16);
+SECTIONS
+{
+ . = 0;
+ .text : {
+ *(.text)
+ *(.rodata)
+ *(.rodata.*)
+ *(.data)
+ bios16c_end = .;
+ . = CONFIG_START_FIXED;
+ *(.text.fixed.addr)
+ }
+
+ /DISCARD/ : { *(.stab)
+ *(.stabstr)
+ *(.comment)
+ *(.note)
+ }
+}
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH("i386")
-ENTRY(_start);
+ENTRY(post32);
SECTIONS
{
. = (OFFSET_bios16c_end | 0xf0000);
. = ALIGN(16);
_text32_start = . ;
.text : { *(.text) }
- .rodata : { *(.rodata) }
+ .rodata : { *(.rodata) }
.data : { *(.data) }
// XXX - should change code so it doesn't require global variables.
. = 0x00040000;
#define REAL_MODE_CS (4 << 3) // 0x20
#define REAL_MODE_DS (5 << 3) // 0x28
- .code16gcc
-
/****************************************************************
* Include of 16bit C code
****************************************************************/
- .globl bios16c_start, bios16c_end
-bios16c_start:
-.include "out/blob.proc.16.s"
- .text
-bios16c_end:
+ .code16gcc
+.include "out/blob.16.s"
/****************************************************************
movl $ CONFIG_STACK_OFFSET , %esp
.endm
+ // Specify a location in the fixed part of bios area.
+ .macro ORG addr
+ .section .text.fixed.addr
+ .org \addr - CONFIG_START_FIXED
+ .endm
+
/****************************************************************
* POST handler
****************************************************************/
- .org 0xe05b
+ ORG 0xe05b
.globl post16
post16:
// init the stack pointer
iretw
.endm
- .org 0xe2c3
+ ORG 0xe2c3
IRQ_ENTRY nmi
IRQ_ENTRY_ARG 13
IRQ_ENTRY 1c
IRQ_ENTRY 70
- .org 0xe3fe
+ ORG 0xe3fe
jmp entry_13
- .org 0xe401
+ ORG 0xe401
// XXX - Fixed Disk Parameter Table
- .org 0xe6f2
+ ORG 0xe6f2
jmp entry_19
- .org 0xe6f5
+ ORG 0xe6f5
.include "out/cbt.proc.16.s"
.text
- .org 0xe729
+ ORG 0xe729
// XXX - Baud Rate Generator Table
- .org 0xe739
+ ORG 0xe739
IRQ_ENTRY_ARG 14
IRQ_ENTRY 74
IRQ_TRAMPOLINE 1c
IRQ_TRAMPOLINE 4a
- .org 0xe82e
+ ORG 0xe82e
IRQ_ENTRY_ARG 16
- .org 0xe987
+ ORG 0xe987
IRQ_ENTRY 09
- .org 0xec59
+ ORG 0xec59
IRQ_ENTRY_ARG 40
- .org 0xef57
+ ORG 0xef57
IRQ_ENTRY 0e
- .org 0xefc7
+ ORG 0xefc7
.include "out/floppy_dbt.proc.16.s"
.text
- .org 0xefd2
+ ORG 0xefd2
IRQ_ENTRY_ARG 17
- .org 0xf045
+ ORG 0xf045
// XXX int 10
iretw
- .org 0xf065
+ ORG 0xf065
IRQ_ENTRY_ARG 10
- .org 0xf0a4
+ ORG 0xf0a4
// XXX int 1D
iretw
.globl freespace2_start, freespace2_end
freespace2_start:
- .org 0xf841
+ ORG 0xf841
freespace2_end:
jmp entry_12
- .org 0xf84d
+ ORG 0xf84d
jmp entry_11
- .org 0xf859
+ ORG 0xf859
IRQ_ENTRY_ARG 15
- .org 0xfa6e
+ ORG 0xfa6e
.include "out/font.proc.16.s"
.text
- .org 0xfe6e
+ ORG 0xfe6e
IRQ_ENTRY_ARG 1a
- .org 0xfea5
+ ORG 0xfea5
IRQ_ENTRY 08
- .org 0xfef3
+ ORG 0xfef3
// XXX - Initial Interrupt Vector Offsets Loaded by POST
- .org 0xff00
+ ORG 0xff00
// XXX - BIOS_COPYRIGHT_STRING
.ascii "(c) 2002 MandrakeSoft S.A. Written by Kevin Lawton & the Bochs team."
- .org 0xff53
+ ORG 0xff53
.globl dummy_iret_handler
dummy_iret_handler:
iretw
- .org 0xff54
+ ORG 0xff54
IRQ_ENTRY_ARG 05
- .org 0xfff0 // Power-up Entry Point
+ ORG 0xfff0 // Power-up Entry Point
ljmpw $0xf000, $post16
- .org 0xfff5
+ ORG 0xfff5
// BIOS build date
.ascii "06/23/99"
- .org 0xfffe
+ ORG 0xfffe
.byte CONFIG_MODEL_ID
.byte 0x00