Move variables from assembler to C code.

Define macro VAR16FIXED for declaring a variable at a fixed location.
Introduce new file src/misc.c, and move non int15 calls from system.c
    to it.
Implement all fixed location variables in C code.
Move IDT/GDT defs to misc.c.  Remove unused gdt entry 1.
This commit is contained in:
Kevin O'Connor 2009-01-17 18:49:20 -05:00
parent 095e89bc0b
commit 308537650f
16 changed files with 253 additions and 268 deletions

View File

@ -8,13 +8,12 @@
OUT=out/
# Source files
SRCBOTH=output.c util.c floppy.c ata.c system.c mouse.c kbd.c pci.c \
SRCBOTH=output.c util.c floppy.c ata.c misc.c mouse.c kbd.c pci.c \
serial.c clock.c pic.c cdrom.c ps2port.c smpdetect.c resume.c \
pnpbios.c pirtable.c
SRC16=$(SRCBOTH) disk.c apm.c pcibios.c vgahooks.c
SRC16=$(SRCBOTH) system.c disk.c apm.c pcibios.c vgahooks.c font.c
SRC32=$(SRCBOTH) post.c shadow.c post_menu.c memmap.c coreboot.c boot.c \
acpi.c smm.c mptable.c smbios.c pciinit.c optionroms.c mtrr.c
TABLESRC=font.c cbt.c floppy_dbt.c
cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \
/dev/null 2>&1`"; then echo "$(2)"; else echo "$(3)"; fi ;)
@ -34,8 +33,7 @@ CFLAGS16INC = $(COMMONCFLAGS) -DMODE16=1 -fno-jump-tables -fno-defer-pop \
CFLAGS16INC += -ffunction-sections -fdata-sections
CFLAGS16 = $(CFLAGS16INC) -g
TABLETMP=$(addprefix $(OUT), $(patsubst %.c,%.16.s,$(TABLESRC)))
all: $(OUT) $(OUT)bios.bin $(TABLETMP)
all: $(OUT) $(OUT)bios.bin
# Run with "make V=1" to see the actual compile commands
ifdef V
@ -60,15 +58,12 @@ vpath %.S src
# involves including all the content textually via #include
# directives. The second method uses gcc's "-combine" option.
ifdef AVOIDCOMBINE
DEPHACK=
define whole-compile
@echo " Compiling whole program $3"
$(Q)printf '$(foreach i,$2,#include "../$i"\n)' > $3.tmp.c
$(Q)$(CC) $1 -c $3.tmp.c -o $3
endef
else
# Ugly way to get gcc to generate .d files correctly.
DEPHACK=-combine src/null.c
define whole-compile
@echo " Compiling whole program $3"
$(Q)$(CC) $1 -combine -c $2 -o $3
@ -76,26 +71,21 @@ endef
endif
$(OUT)%.proc.16.s: $(OUT)%.16.s
@echo " Moving data sections to text in $@"
$(Q)sed 's/^\t\.section\t\.\(ro\)\?data.*// ; s/^\t\.data$$//' < $< > $@
$(OUT)%.16.s: %.c
$(OUT)%.s: %.c
@echo " Compiling to assembler $@"
$(Q)$(CC) $(CFLAGS16INC) $(DEPHACK) -S -c $< -o $@
$(Q)$(CC) $(CFLAGS16INC) -S -c $< -o $@
$(OUT)%.lds: %.lds.S
@echo " Precompiling $@"
$(Q)$(CPP) -P -D__ASSEMBLY__ $< -o $@
$(OUT)asm-offsets.h: $(OUT)asm-offsets.16.s
$(OUT)asm-offsets.h: $(OUT)asm-offsets.s
@echo " Generating offset file $@"
$(Q)./tools/gen-offsets.sh $< $@
$(OUT)ccode.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)ccode.16.s $(OUT)asm-offsets.h $(TABLEASM)
$(OUT)romlayout16.o: romlayout.S $(OUT)ccode.16.s $(OUT)asm-offsets.h
@echo " Compiling (16bit) $@"
$(Q)$(CC) $(CFLAGS16INC) -c -D__ASSEMBLY__ $< -o $@

View File

@ -15,18 +15,18 @@
* Interupt vector table
****************************************************************/
struct ivec {
struct rmode_IVT {
union {
struct {
u16 offset;
u16 seg;
};
u32 segoff;
};
} ivec[256];
};
#define SET_IVT(vector, seg, off) \
SET_FARVAR(SEG_IVT, ((struct ivec *)0)[vector].segoff, ((seg) << 16) | (off))
SET_FARVAR(SEG_IVT, ((struct rmode_IVT *)0)->ivec[vector].segoff, ((seg) << 16) | (off))
/****************************************************************
@ -284,6 +284,6 @@ struct bios_config_table_s {
u8 feature1, feature2, feature3, feature4, feature5;
} PACKED;
extern struct bios_config_table_s BIOS_CONFIG_TABLE;
extern struct bios_config_table_s BIOS_CONFIG_TABLE __aligned(1);
#endif // __BIOSVAR_H

View File

@ -1,42 +0,0 @@
// BIOS configuration table.
//
// 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 LGPLv3 license.
#include "biosvar.h" // CONFIG_BIOS_TABLE
// DMA channel 3 used by hard disk BIOS
#define CBT_F1_DMA3USED (1<<7)
// 2nd interrupt controller (8259) installed
#define CBT_F1_2NDPIC (1<<6)
// Real-Time Clock installed
#define CBT_F1_RTC (1<<5)
// INT 15/AH=4Fh called upon INT 09h
#define CBT_F1_INT154F (1<<4)
// wait for external event (INT 15/AH=41h) supported
#define CBT_F1_WAITEXT (1<<3)
// extended BIOS area allocated (usually at top of RAM)
#define CBT_F1_EBDA (1<<2)
// bus is Micro Channel instead of ISA
#define CBT_F1_MCA (1<<1)
// system has dual bus (Micro Channel + ISA)
#define CBT_F1_MCAISA (1<<0)
// INT 16/AH=09h (keyboard functionality) supported
#define CBT_F2_INT1609 (1<<6)
struct bios_config_table_s BIOS_CONFIG_TABLE __aligned(1) VAR16 = {
.size = sizeof(BIOS_CONFIG_TABLE) - 2,
.model = CONFIG_MODEL_ID,
.submodel = CONFIG_SUBMODEL_ID,
.biosrev = CONFIG_BIOS_REVISION,
.feature1 = (
CBT_F1_2NDPIC | CBT_F1_RTC | CBT_F1_EBDA
| (CONFIG_KBD_CALL_INT15_4F ? CBT_F1_INT154F : 0)),
.feature2 = CBT_F2_INT1609,
.feature3 = 0,
.feature4 = 0,
.feature5 = 0,
};

View File

@ -111,12 +111,12 @@
#define SEG_BIOS 0xf000
// Segment definitions in protected mode (see rombios32_gdt in romlayout.S)
#define SEG32_MODE32_CS (2 << 3)
#define SEG32_MODE32_DS (3 << 3)
#define SEG32_MODE16_CS (4 << 3)
#define SEG32_MODE16_DS (5 << 3)
#define SEG32_MODE16BIG_CS (6 << 3)
#define SEG32_MODE16BIG_DS (7 << 3)
#define SEG32_MODE32_CS (1 << 3)
#define SEG32_MODE32_DS (2 << 3)
#define SEG32_MODE16_CS (3 << 3)
#define SEG32_MODE16_DS (4 << 3)
#define SEG32_MODE16BIG_CS (5 << 3)
#define SEG32_MODE16BIG_DS (6 << 3)
// Debugging levels. If non-zero and CONFIG_DEBUG_LEVEL is greater
// than the specified value, then the corresponding irq handler will

View File

@ -712,3 +712,6 @@ handle_76()
SET_BDA(disk_interrupt_flag, 0xff);
eoi_pic2();
}
// Old Fixed Disk Parameter Table (newer tables are in the ebda).
struct fdpt_s OldFDPT VAR16FIXED(0xe401);

View File

@ -39,6 +39,23 @@ struct floppy_ext_dbt_s diskette_param_table2 VAR16_32 = {
.drive_type = 4, // drive type in cmos
};
// Since no provisions are made for multiple drive types, most
// values in this table are ignored. I set parameters for 1.44M
// floppy here
struct floppy_dbt_s diskette_param_table VAR16FIXED(0xefc7) = {
.specify1 = 0xAF,
.specify2 = 0x02, // head load time 0000001, DMA used
.shutoff_ticks = 0x25,
.bps_code = 0x02,
.sectors = 18,
.interblock_len = 0x1B,
.data_len = 0xFF,
.gap_len = 0x6C,
.fill_byte = 0xF6,
.settle_time = 0x0F,
.startup_time = 0x08,
};
void
floppy_drive_setup()
{

View File

@ -1,24 +0,0 @@
// Floppy controller parameter table.
//
// Copyright (C) 2002 MandrakeSoft S.A.
//
// This file may be distributed under the terms of the GNU LGPLv3 license.
#include "disk.h" // struct floppy_dbt_s
// Since no provisions are made for multiple drive types, most
// values in this table are ignored. I set parameters for 1.44M
// floppy here
struct floppy_dbt_s diskette_param_table __aligned(1) VAR16 = {
.specify1 = 0xAF,
.specify2 = 0x02, // head load time 0000001, DMA used
.shutoff_ticks = 0x25,
.bps_code = 0x02,
.sectors = 18,
.interblock_len = 0x1B,
.data_len = 0xFF,
.gap_len = 0x6C,
.fill_byte = 0xF6,
.settle_time = 0x0F,
.startup_time = 0x08,
};

View File

@ -7,7 +7,7 @@
* found at ftp://ftp.simtel.net/pub/simtelnet/msdos/screen/fntcol16.zip
* This font is public domain
*/
const u8 vgafont8[128*8] __aligned(1) VAR16 = {
u8 vgafont8[128*8] VAR16FIXED(0xfa6e) = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x7e, 0x81, 0xa5, 0x81, 0xbd, 0x99, 0x81, 0x7e,
0x7e, 0xff, 0xdb, 0xff, 0xc3, 0xe7, 0xff, 0x7e,

193
src/misc.c Normal file
View File

@ -0,0 +1,193 @@
// Code for misc 16bit handlers and variables.
//
// 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 LGPLv3 license.
#include "bregs.h" // struct bregs
#include "biosvar.h" // GET_BDA
#include "util.h" // debug_enter
#include "pic.h" // enable_hwirq
// Amount of continuous ram under 4Gig
u32 RamSize VAR16_32;
// Amount of continuous ram >4Gig
u64 RamSizeOver4G;
/****************************************************************
* Misc 16bit ISRs
****************************************************************/
// INT 12h Memory Size Service Entry Point
void VISIBLE16
handle_12(struct bregs *regs)
{
debug_enter(regs, DEBUG_HDL_12);
regs->ax = GET_BDA(mem_size_kb);
}
// INT 11h Equipment List Service Entry Point
void VISIBLE16
handle_11(struct bregs *regs)
{
debug_enter(regs, DEBUG_HDL_11);
regs->ax = GET_BDA(equipment_list_flags);
}
// INT 05h Print Screen Service Entry Point
void VISIBLE16
handle_05(struct bregs *regs)
{
debug_enter(regs, DEBUG_HDL_05);
}
// INT 10h Video Support Service Entry Point
void VISIBLE16
handle_10(struct bregs *regs)
{
debug_enter(regs, DEBUG_HDL_10);
// dont do anything, since the VGA BIOS handles int10h requests
}
void VISIBLE16
handle_nmi()
{
debug_isr(DEBUG_ISR_nmi);
BX_PANIC("NMI Handler called\n");
}
void
mathcp_setup()
{
dprintf(3, "math cp init\n");
// 80x87 coprocessor installed
SETBITS_BDA(equipment_list_flags, 0x02);
enable_hwirq(13, entry_75);
}
// INT 75 - IRQ13 - MATH COPROCESSOR EXCEPTION
void VISIBLE16
handle_75()
{
debug_isr(DEBUG_ISR_75);
// clear irq13
outb(0, PORT_MATH_CLEAR);
// clear interrupt
eoi_pic2();
// legacy nmi call
u32 eax=0, flags;
call16_simpint(0x02, &eax, &flags);
}
/****************************************************************
* BIOS_CONFIG_TABLE
****************************************************************/
// DMA channel 3 used by hard disk BIOS
#define CBT_F1_DMA3USED (1<<7)
// 2nd interrupt controller (8259) installed
#define CBT_F1_2NDPIC (1<<6)
// Real-Time Clock installed
#define CBT_F1_RTC (1<<5)
// INT 15/AH=4Fh called upon INT 09h
#define CBT_F1_INT154F (1<<4)
// wait for external event (INT 15/AH=41h) supported
#define CBT_F1_WAITEXT (1<<3)
// extended BIOS area allocated (usually at top of RAM)
#define CBT_F1_EBDA (1<<2)
// bus is Micro Channel instead of ISA
#define CBT_F1_MCA (1<<1)
// system has dual bus (Micro Channel + ISA)
#define CBT_F1_MCAISA (1<<0)
// INT 16/AH=09h (keyboard functionality) supported
#define CBT_F2_INT1609 (1<<6)
struct bios_config_table_s BIOS_CONFIG_TABLE VAR16FIXED(0xe6f5) = {
.size = sizeof(BIOS_CONFIG_TABLE) - 2,
.model = CONFIG_MODEL_ID,
.submodel = CONFIG_SUBMODEL_ID,
.biosrev = CONFIG_BIOS_REVISION,
.feature1 = (
CBT_F1_2NDPIC | CBT_F1_RTC | CBT_F1_EBDA
| (CONFIG_KBD_CALL_INT15_4F ? CBT_F1_INT154F : 0)),
.feature2 = CBT_F2_INT1609,
.feature3 = 0,
.feature4 = 0,
.feature5 = 0,
};
/****************************************************************
* GDT and IDT tables
****************************************************************/
struct descloc_s {
u16 length;
u32 addr;
} PACKED;
// Real mode IDT descriptor
struct descloc_s rmode_IDT_info VAR16_32 = {
.length = sizeof(struct rmode_IVT) - 1,
.addr = (u32)MAKE_FARPTR(SEG_IVT, 0),
};
// Dummy IDT that forces a machine shutdown if an irq happens in
// protected mode.
u8 dummy_IDT VAR16_32;
// Protected mode IDT descriptor
struct descloc_s pmode_IDT_info VAR16_32 = {
.length = sizeof(dummy_IDT) - 1,
.addr = (u32)MAKE_FARPTR(SEG_BIOS, &dummy_IDT),
};
// GDT
u64 rombios32_gdt[] VAR16_32 __aligned(8) = {
// First entry can't be used.
0x0000000000000000LL,
// 32 bit flat code segment (SEG32_MODE32_CS)
0x00cf9b000000ffffLL,
// 32 bit flat data segment (SEG32_MODE32_DS)
0x00cf93000000ffffLL,
// 16 bit code segment base=0xf0000 limit=0xffff (SEG32_MODE16_CS)
0x00009b0f0000ffffLL,
// 16 bit data segment base=0x0 limit=0xffff (SEG32_MODE16_DS)
0x000093000000ffffLL,
// 16 bit code segment base=0 limit=0xffffffff (SEG32_MODE16BIG_CS)
0x008f9b000000ffffLL,
// 16 bit data segment base=0 limit=0xffffffff (SEG32_MODE16BIG_DS)
0x008f93000000ffffLL,
};
// GDT descriptor
struct descloc_s rombios32_gdt_48 VAR16_32 = {
.length = sizeof(rombios32_gdt) - 1,
.addr = (u32)MAKE_FARPTR(SEG_BIOS, rombios32_gdt),
};
/****************************************************************
* Misc fixed vars
****************************************************************/
char BiosCopyright[] VAR16FIXED(0xff00) =
"(c) 2002 MandrakeSoft S.A. Written by Kevin Lawton & the Bochs team.";
// BIOS build date
char BiosDate[] VAR16FIXED(0xfff5) = "06/23/99";
u8 BiosModelId VAR16FIXED(0xfffe) = CONFIG_MODEL_ID;
u8 BiosChecksum VAR16FIXED(0xffff);
// XXX - Initial Interrupt Vector Offsets Loaded by POST
u8 InitVectors[13] VAR16FIXED(0xfef3);
// XXX - INT 1D - SYSTEM DATA - VIDEO PARAMETER TABLES
u8 VideoParams[88] VAR16FIXED(0xf0a4);

View File

@ -1,2 +0,0 @@
// GCC does something odd when one uses -combine with just one .c
// file. So this dummy file makes gcc happy.

View File

@ -245,8 +245,7 @@ _start()
interactive_bootmenu();
// Setup bios checksum.
extern char bios_checksum;
bios_checksum = -checksum((u8*)BUILD_BIOS_ADDR, BUILD_BIOS_SIZE - 1);
BiosChecksum = -checksum((u8*)BUILD_BIOS_ADDR, BUILD_BIOS_SIZE - 1);
// Prep for boot process.
make_bios_readonly();

View File

@ -451,88 +451,21 @@ permanent_halt:
ORG 0xe2c3
IRQ_ENTRY nmi
/****************************************************************
* GDT and IDT tables (between 0xe2c3 - 0xe3fe)
****************************************************************/
// Protected mode IDT descriptor
//
// I just make the limit 0, so the machine will shutdown
// if an exception occurs during protected mode memory
// transfers.
//
// Set base to f0000 to correspond to beginning of BIOS,
// in case I actually define an IDT later
// Set limit to 0
.type pmode_IDT_info, @object
pmode_IDT_info:
.word 0x0000 // limit 15:00
.long 0xf0000 // base 16:47
// Real mode IDT descriptor
//
// Set to typical real-mode values.
// base = 000000
// limit = 03ff
.type rmode_IDT_info, @object
rmode_IDT_info:
.word 0x03ff // limit 15:00
.long 0 // base 16:47
.type rombios32_gdt_48, @object
rombios32_gdt_48:
.word (rombios32_gdt_end - rombios32_gdt)
.long (BUILD_BIOS_ADDR + rombios32_gdt)
//.balign 8
.type rombios32_gdt, @object
rombios32_gdt:
.word 0, 0, 0, 0
.word 0, 0, 0, 0
// 32 bit flat code segment (SEG32_MODE32_CS)
.word 0xffff, 0, 0x9b00, 0x00cf
// 32 bit flat data segment (SEG32_MODE32_DS)
.word 0xffff, 0, 0x9300, 0x00cf
// 16 bit code segment base=0xf0000 limit=0xffff (SEG32_MODE16_CS)
.word 0xffff, 0, 0x9b0f, 0x0000
// 16 bit data segment base=0x0 limit=0xffff (SEG32_MODE16_DS)
.word 0xffff, 0, 0x9300, 0x0000
// 16 bit code segment base=0 limit=0xffffffff (SEG32_MODE16BIG_CS)
.word 0xffff, 0, 0x9b00, 0x008f
// 16 bit data segment base=0 limit=0xffffffff (SEG32_MODE16BIG_DS)
.word 0xffff, 0, 0x9300, 0x008f
rombios32_gdt_end:
/****************************************************************
* Interrupt entry points (continued)
****************************************************************/
ORG 0xe3fe
.global entry_13_official
entry_13_official:
jmp entry_13
ORG 0xe401
.type __fdpt, @object
__fdpt:
// XXX - Fixed Disk Parameter Table
.space 16
// 0xe401 - OldFDPT in disk.c
ORG 0xe6f2
.global entry_19_official
entry_19_official:
jmp entry_19
ORG 0xe6f5
.include "out/cbt.proc.16.s"
.text
// 0xe6f5 - BIOS_CONFIG_TABLE in misc.c
ORG 0xe729
.type __brgt, @object
__brgt:
// XXX - Baud Rate Generator Table
.space 16
// 0xe729 - BaudTable in serial.c
ORG 0xe739
IRQ_ENTRY_ARG 14
@ -549,9 +482,7 @@ __brgt:
ORG 0xef57
IRQ_ENTRY 0e
ORG 0xefc7
.include "out/floppy_dbt.proc.16.s"
.text
// 0xefc7 - diskette_param_table in floppy.c
ORG 0xefd2
IRQ_ENTRY_ARG 17
@ -564,11 +495,7 @@ __int10_0x0f:
ORG 0xf065
IRQ_ENTRY_ARG 10
ORG 0xf0a4
.type __int1d, @object
__int1d:
// XXX - INT 1D - SYSTEM DATA - VIDEO PARAMETER TABLES
.space 0x58
// 0xf0a4 - VideoParams in misc.c
ORG 0xf841
.global entry_12_official
@ -608,9 +535,7 @@ entry_18:
pushl $_code32_handle_18
jmp transition32
ORG 0xfa6e
.include "out/font.proc.16.s"
.text
// 0xfa6e - vgafont8 in font.c
ORG 0xfe6e
IRQ_ENTRY_ARG 1a
@ -618,16 +543,9 @@ entry_18:
ORG 0xfea5
IRQ_ENTRY 08
ORG 0xfef3
__initvector:
// XXX - Initial Interrupt Vector Offsets Loaded by POST
.space 13
// 0xfef3 - InitVectors in misc.c
ORG 0xff00
.type __copyright, @object
__copyright:
// XXX - BIOS_COPYRIGHT_STRING
.asciz "(c) 2002 MandrakeSoft S.A. Written by Kevin Lawton & the Bochs team."
// 0xff00 - BiosCopyright in misc.c
ORG 0xff53
.global dummy_iret_handler
@ -642,20 +560,10 @@ dummy_iret_handler:
reset_vector:
ljmpw $SEG_BIOS, $post16
ORG 0xfff5
.type __biosdate, @object
__biosdate:
// BIOS build date
.ascii "06/23/99"
// 0xfff5 - BiosDate in misc.c
ORG 0xfffe
.type __model_id, @object
__model_id:
.byte CONFIG_MODEL_ID
// 0xfffe - BiosModelId in misc.c
.global bios_checksum
.type bios_checksum, @object
bios_checksum:
.byte 0x00
// 0xffff - BiosChecksum in misc.c
.end

View File

@ -170,6 +170,9 @@ handle_14(struct bregs *regs)
}
}
// XXX - Baud Rate Generator Table
u8 BaudTable[16] VAR16FIXED(0xe729);
/****************************************************************
* LPT ports

View File

@ -1,4 +1,4 @@
// 16bit system callbacks
// Handler for int 0x15 "system" calls
//
// Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net>
// Copyright (C) 2002 MandrakeSoft S.A.
@ -269,10 +269,6 @@ handle_15e801(struct bregs *regs)
// Info on e820 map location and size.
struct e820entry *e820_list VAR16_32;
int e820_count VAR16_32;
// Amount of continuous ram under 4Gig
u32 RamSize VAR16_32;
// Amount of continuous ram >4Gig
u64 RamSizeOver4G;
static void
handle_15e820(struct bregs *regs)
@ -340,65 +336,3 @@ handle_15(struct bregs *regs)
default: handle_15XX(regs); break;
}
}
// INT 12h Memory Size Service Entry Point
void VISIBLE16
handle_12(struct bregs *regs)
{
debug_enter(regs, DEBUG_HDL_12);
regs->ax = GET_BDA(mem_size_kb);
}
// INT 11h Equipment List Service Entry Point
void VISIBLE16
handle_11(struct bregs *regs)
{
debug_enter(regs, DEBUG_HDL_11);
regs->ax = GET_BDA(equipment_list_flags);
}
// INT 05h Print Screen Service Entry Point
void VISIBLE16
handle_05(struct bregs *regs)
{
debug_enter(regs, DEBUG_HDL_05);
}
// INT 10h Video Support Service Entry Point
void VISIBLE16
handle_10(struct bregs *regs)
{
debug_enter(regs, DEBUG_HDL_10);
// dont do anything, since the VGA BIOS handles int10h requests
}
void VISIBLE16
handle_nmi()
{
debug_isr(DEBUG_ISR_nmi);
BX_PANIC("NMI Handler called\n");
}
void
mathcp_setup()
{
dprintf(3, "math cp init\n");
// 80x87 coprocessor installed
SETBITS_BDA(equipment_list_flags, 0x02);
enable_hwirq(13, entry_75);
}
// INT 75 - IRQ13 - MATH COPROCESSOR EXCEPTION
void VISIBLE16
handle_75()
{
debug_isr(DEBUG_ISR_75);
// clear irq13
outb(0, PORT_MATH_CLEAR);
// clear interrupt
eoi_pic2();
// legacy nmi call
u32 eax=0, flags;
call16_simpint(0x02, &eax, &flags);
}

View File

@ -32,6 +32,8 @@ union u64_u32_u {
# define VAR16 __attribute__((section(".data16." __FILE__ "." __stringify(__LINE__))))
// Designate a variable as visible to both 32bit and 16bit code.
# define VAR16_32 VAR16 __VISIBLE
// Designate a variable at a specific 16bit address
# define VAR16FIXED(addr) __aligned(1) __VISIBLE __attribute__((section(".fixedaddr." __stringify(addr))))
// Designate top-level assembler as 16bit only.
# define ASM16(code) asm(".section .text.asm." __FILE__ "." __stringify(__LINE__) "\n\t" code)
#else
@ -39,6 +41,7 @@ union u64_u32_u {
# define VISIBLE32 __VISIBLE
# define VAR16 __attribute__((section(".discard.var16")))
# define VAR16_32 VAR16 __VISIBLE __attribute__((weak))
# define VAR16FIXED(addr) VAR16_32
# define ASM16(code)
#endif

View File

@ -184,4 +184,7 @@ void mtrr_setup(void);
// romlayout.S
void reset_vector() __attribute__ ((noreturn));
// misc.c
extern u8 BiosChecksum;
#endif // util.h