diff options
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | code16.c (renamed from e820.c) | 51 | ||||
-rw-r--r-- | code16gcc.h | 14 | ||||
-rw-r--r-- | int10.c | 39 | ||||
-rw-r--r-- | int15.c | 16 |
5 files changed, 51 insertions, 73 deletions
@@ -1,5 +1,4 @@ -obj16-y = e820.o int10.o int15.o -obj-y = $(obj16-y) entry.o main.o string.o printf.o cstart.o fw_cfg.o +obj-y = code16.o entry.o main.o string.o printf.o cstart.o fw_cfg.o obj-y += linuxboot.o all-y = bios.bin @@ -14,7 +13,6 @@ BIOS_CFLAGS += -mregparm=3 BIOS_CFLAGS += -fno-stack-protector -fno-delete-null-pointer-checks BIOS_CFLAGS += -ffreestanding BIOS_CFLAGS += -Iinclude -$(obj16-y): BIOS_CFLAGS += -include code16gcc.h dummy := $(shell mkdir -p .deps) autodepend-flags = -MMD -MF .deps/cc-$(patsubst %/,%,$(dir $*))-$(notdir $*).d @@ -1,6 +1,7 @@ +asm(".code16gcc"); #include "bios.h" #include "segment.h" - +#include "ioport.h" #include "processor-flags.h" #include "e820.h" @@ -65,3 +66,51 @@ bioscall void e820_query_map(struct biosregs *regs) if (ndx >= map_size) regs->ebx = 0; /* end of map */ } + +bioscall void int15_handler(struct biosregs *regs) +{ + switch (regs->eax) { + case 0xe820: + e820_query_map(regs); + break; + default: + /* Set CF to indicate failure. */ + regs->eflags |= X86_EFLAGS_CF; + break; + } +} +/* + * It's probably much more useful to make this print to the serial + * line rather than print to a non-displayed VGA memory + */ +static inline void int10_putchar(struct biosregs *args) +{ + uint8_t al = args->eax & 0xFF; + + outb(0x3f8, al); +} + +#define VBE_STATUS_OK 0x004F +#define VBE_STATUS_FAIL 0x014F + +static void int10_vesa(struct biosregs *args) +{ + args->eax = VBE_STATUS_FAIL; +} + +bioscall void int10_handler(struct biosregs *args) +{ + uint8_t ah; + + ah = (args->eax & 0xff00) >> 8; + + switch (ah) { + case 0x0e: + int10_putchar(args); + break; + case 0x4f: + int10_vesa(args); + break; + } + +} diff --git a/code16gcc.h b/code16gcc.h deleted file mode 100644 index a4feb62..0000000 --- a/code16gcc.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * code16gcc.h - * - * This file is -include'd when compiling 16-bit C code. - * Note: this asm() needs to be emitted before gcc emits any code. - * Depending on gcc version, this requires -fno-unit-at-a-time or - * -fno-toplevel-reorder. - * - * Hopefully gcc will eventually have a real -m16 option so we can - * drop this hack long term. - */ - - -asm(".code16gcc"); diff --git a/int10.c b/int10.c deleted file mode 100644 index 0e506cc..0000000 --- a/int10.c +++ /dev/null @@ -1,39 +0,0 @@ -#include "bios.h" -#include "segment.h" -#include "ioport.h" - -/* - * It's probably much more useful to make this print to the serial - * line rather than print to a non-displayed VGA memory - */ -static inline void int10_putchar(struct biosregs *args) -{ - uint8_t al = args->eax & 0xFF; - - outb(0x3f8, al); -} - -#define VBE_STATUS_OK 0x004F -#define VBE_STATUS_FAIL 0x014F - -static void int10_vesa(struct biosregs *args) -{ - args->eax = VBE_STATUS_FAIL; -} - -bioscall void int10_handler(struct biosregs *args) -{ - uint8_t ah; - - ah = (args->eax & 0xff00) >> 8; - - switch (ah) { - case 0x0e: - int10_putchar(args); - break; - case 0x4f: - int10_vesa(args); - break; - } - -} diff --git a/int15.c b/int15.c deleted file mode 100644 index d8ff820..0000000 --- a/int15.c +++ /dev/null @@ -1,16 +0,0 @@ -#include "bios.h" - -#include "processor-flags.h" - -bioscall void int15_handler(struct biosregs *regs) -{ - switch (regs->eax) { - case 0xe820: - e820_query_map(regs); - break; - default: - /* Set CF to indicate failure. */ - regs->eflags |= X86_EFLAGS_CF; - break; - } -} |