// Code for misc 16bit handlers and variables.
//
-// Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net>
+// Copyright (C) 2008,2009 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 "pic.h" // enable_hwirq
// Amount of continuous ram under 4Gig
-u32 RamSize VAR16_32;
+u32 RamSize VAR16VISIBLE;
// Amount of continuous ram >4Gig
u64 RamSizeOver4G;
+// Space for bios tables built an run-time.
+char BiosTableSpace[CONFIG_MAX_BIOSTABLE] __aligned(MALLOC_MIN_ALIGN) VAR16VISIBLE;
/****************************************************************
// dont do anything, since the VGA BIOS handles int10h requests
}
+// NMI handler
void VISIBLE16
-handle_nmi()
+handle_02(void)
{
- debug_isr(DEBUG_ISR_nmi);
- BX_PANIC("NMI Handler called\n");
+ debug_isr(DEBUG_ISR_02);
}
void
-mathcp_setup()
+mathcp_setup(void)
{
dprintf(3, "math cp init\n");
// 80x87 coprocessor installed
SETBITS_BDA(equipment_list_flags, 0x02);
- enable_hwirq(13, entry_75);
+ enable_hwirq(13, FUNC16(entry_75));
}
// INT 75 - IRQ13 - MATH COPROCESSOR EXCEPTION
void VISIBLE16
-handle_75()
+handle_75(void)
{
debug_isr(DEBUG_ISR_75);
* GDT and IDT tables
****************************************************************/
-struct descloc_s {
- u16 length;
- u32 addr;
-} PACKED;
-
// Real mode IDT descriptor
-struct descloc_s rmode_IDT_info VAR16_32 = {
+struct descloc_s rmode_IDT_info VAR16VISIBLE = {
.length = sizeof(struct rmode_IVT) - 1,
- .addr = (u32)MAKE_FARPTR(SEG_IVT, 0),
+ .addr = (u32)MAKE_FLATPTR(SEG_IVT, 0),
};
// Dummy IDT that forces a machine shutdown if an irq happens in
// protected mode.
-u8 dummy_IDT VAR16_32;
+u8 dummy_IDT VAR16VISIBLE;
// Protected mode IDT descriptor
-struct descloc_s pmode_IDT_info VAR16_32 = {
+struct descloc_s pmode_IDT_info VAR16VISIBLE = {
.length = sizeof(dummy_IDT) - 1,
- .addr = (u32)MAKE_FARPTR(SEG_BIOS, &dummy_IDT),
+ .addr = (u32)MAKE_FLATPTR(SEG_BIOS, &dummy_IDT),
};
// GDT
-u64 rombios32_gdt[] VAR16_32 __aligned(8) = {
+u64 rombios32_gdt[] VAR16VISIBLE __aligned(8) = {
// First entry can't be used.
0x0000000000000000LL,
// 32 bit flat code segment (SEG32_MODE32_CS)
- 0x00cf9b000000ffffLL,
+ GDT_GRANLIMIT(0xffffffff) | GDT_CODE | GDT_B,
// 32 bit flat data segment (SEG32_MODE32_DS)
- 0x00cf93000000ffffLL,
+ GDT_GRANLIMIT(0xffffffff) | GDT_DATA | GDT_B,
// 16 bit code segment base=0xf0000 limit=0xffff (SEG32_MODE16_CS)
- 0x00009b0f0000ffffLL,
+ GDT_LIMIT(BUILD_BIOS_SIZE-1) | GDT_CODE | GDT_BASE(BUILD_BIOS_ADDR),
// 16 bit data segment base=0x0 limit=0xffff (SEG32_MODE16_DS)
- 0x000093000000ffffLL,
- // 16 bit code segment base=0 limit=0xffffffff (SEG32_MODE16BIG_CS)
- 0x008f9b000000ffffLL,
+ GDT_LIMIT(0x0ffff) | GDT_DATA,
+ // 16 bit code segment base=0xf0000 limit=0xffffffff (SEG32_MODE16BIG_CS)
+ GDT_GRANLIMIT(0xffffffff) | GDT_CODE | GDT_BASE(BUILD_BIOS_ADDR),
// 16 bit data segment base=0 limit=0xffffffff (SEG32_MODE16BIG_DS)
- 0x008f93000000ffffLL,
+ GDT_GRANLIMIT(0xffffffff) | GDT_DATA,
};
// GDT descriptor
-struct descloc_s rombios32_gdt_48 VAR16_32 = {
+struct descloc_s rombios32_gdt_48 VAR16VISIBLE = {
.length = sizeof(rombios32_gdt) - 1,
- .addr = (u32)MAKE_FARPTR(SEG_BIOS, rombios32_gdt),
+ .addr = (u32)MAKE_FLATPTR(SEG_BIOS, rombios32_gdt),
};