summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile17
-rw-r--r--src/boot/stage2_a20.asm28
-rw-r--r--src/drivers/video/vga.c4
3 files changed, 25 insertions, 24 deletions
diff --git a/src/Makefile b/src/Makefile
index 96acb38..15018f6 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -2,14 +2,15 @@ CC := gcc
DEFINES = -DOS_ABAOS
OPT := -O0
INCLUDES = -I. -Ilibc -Ihardware -Idrivers -Idrivers/hdi -Idrivers/hdi/ps2 -Idrivers/video -Inet -Idrivers/net -Ikernel -Igui
-CFLAGS := -std=c99 -m32 -march=i486 -ffreestanding $(OPT) -g -Werror $(INCLUDES) $(DEFINES)
+CFLAGS := -std=c99 -m32 -march=i386 -ffreestanding -nostdlib $(OPT) -g -Werror $(INCLUDES) $(DEFINES)
LD := ld
-LDFLAGS := -lgcc
+LDFLAGS := -m elf_i386
NASMFLAGS := -f elf32
NASM := nasm
OBJCOPY := objcopy
MAGIC := $(shell printf '%x' `date +%s`)
TRUNCATE := truncate
+QEMU := qemu-system-i386
all: image.bin kernel.sym
@@ -26,7 +27,7 @@ image.bin: boot.bin kernel.bin magic.bin
cat boot.bin kernel.bin > image.tmp
$(TRUNCATE) -s 89088 image.tmp
cat image.tmp magic.bin > image.bin
- $(TRUNATE) -s 1474560 image.bin
+ $(TRUNCATE) -s 1474560 image.bin
boot.bin: boot/boot.asm boot/boot_gdt.asm boot/stage1_functions.asm boot/stage2_real_functions.asm boot/stage2_pm_functions.asm boot/stage2_switch_mode.asm boot/stage2_a20.asm
$(NASM) boot/boot.asm -DMAGIC='"$(MAGIC)"' -f bin -o boot.bin
@@ -38,7 +39,7 @@ kernel.sym: kernel.elf
$(OBJCOPY) --only-keep-debug kernel.elf kernel.sym
kernel.elf: kernel/entry.o kernel/kernel.o kernel/kernel_asm.o kernel/console.o kernel/vgatext.o kernel/serial.o kernel/memorymanagement.o kernel/tasks.o hardware/port.o hardware/port_asm.o hardware/interrupts.o hardware/interrupts_asm.o hardware/pci.o drivers/driver.o drivers/hdi/mouse.o drivers/hdi/keyboard.o drivers/hdi/ps2/ps2keyboard.o drivers/hdi/ps2/ps2mouse.o drivers/video/video.o drivers/video/vga.o drivers/video/vga_font.o net/ethernet.o net/arp.o net/ipv4.o drivers/net/network.o drivers/net/rtl8139.o gui/widget.o gui/composite_widget.o gui/window.o gui/desktop.o gui/text_widget.o libc/string.o libc/stdlib.o libc/stdio.o libc/setjmp.o
- $(LD) -o kernel.elf -N -n -Ttext 0x8800 -e kernel_entry --oformat elf32-i386 \
+ $(LD) $(LDFLAGS) -o kernel.elf -N -n -Ttext 0x8800 -e kernel_entry --oformat elf32-i386 \
kernel/entry.o \
kernel/kernel.o kernel/kernel_asm.o \
kernel/console.o kernel/vgatext.o kernel/serial.o \
@@ -170,15 +171,15 @@ clean:
drivers/*.o drivers/*/*.o drivers/*/*/*.o gui/*.o
run-qemu-hd: image.bin
- qemu-system-i386 -cpu 486 -usb -netdev user,id=net0,net=10.0.0.0/24,host=10.0.0.2,dhcpstart=10.0.0.16 -device rtl8139,netdev=net0-d guest_errors -m 32 -drive "file=image.bin,if=ide,format=raw" \
+ $(QEMU) -cpu 486 -usb -netdev user,id=net0,net=10.0.0.0/24,host=10.0.0.2,dhcpstart=10.0.0.16 -device rtl8139,netdev=net0-d guest_errors -m 32 -drive "file=image.bin,if=ide,format=raw" \
-serial file:serial.log
run-qemu-usb: image.bin
- qemu-system-i386 -cpu 486 -usb -netdev user,id=net0,net=10.0.0.0/24,host=10.0.0.2,dhcpstart=10.0.0.16 -device rtl8139,netdev=net0-d guest_errors -m 32 -usb -usbdevice disk:/dev/sde \
+ $(QEMU) -cpu 486 -usb -netdev user,id=net0,net=10.0.0.0/24,host=10.0.0.2,dhcpstart=10.0.0.16 -device rtl8139,netdev=net0-d guest_errors -m 32 -usb -usbdevice disk:/dev/sde \
-serial file:serial.log
run-qemu: image.bin
- qemu-system-i386 -cpu 486 -usb \
+ $(QEMU) -cpu 486 -usb \
-netdev user,id=net0,net=10.0.0.0/24,host=10.0.0.2,dhcpstart=10.0.0.16,hostfwd=tcp::8080-:80,hostfwd=udp::8081-:81 \
-device rtl8139,netdev=net0 \
-object filter-dump,id=net0,netdev=net0,file=network.log \
@@ -186,7 +187,7 @@ run-qemu: image.bin
-serial file:serial.log
run-qemu-debug: image.bin
- qemu-system-i386 -cpu 486 -usb \
+ $(QEMU) -cpu 486 -usb \
-netdev user,id=net0,net=10.0.0.0/24,host=10.0.0.2,dhcpstart=10.0.0.16,hostfwd=tcp::8080-:80,hostfwd=udp::8081-:81 \
-device rtl8139,netdev=net0 \
-object filter-dump,id=net0,netdev=net0,file=network.log \
diff --git a/src/boot/stage2_a20.asm b/src/boot/stage2_a20.asm
index c0951ad..d9e2b36 100644
--- a/src/boot/stage2_a20.asm
+++ b/src/boot/stage2_a20.asm
@@ -62,6 +62,20 @@ check_and_enable_A20:
cmp ax, 1
je A20_ENABLED
+A20_FAST_SPECIAL_PORT:
+
+ mov al, 'F'
+ call print_char
+
+ in al, 0x92
+ or al, 2
+ out 0x92, al
+
+ call check_A20_enabled
+ cmp ax, 1
+ je A20_ENABLED
+ ret
+
A20_ENABLE_KBD_PORT:
mov al, 'K'
call print_char
@@ -129,20 +143,6 @@ A20_ENABLE_KBD_OUT:
cmp ax, 1
je A20_ENABLED
-A20_FAST_SPECIAL_PORT:
-
- mov al, 'F'
- call print_char
-
- in al, 0x92
- or al, 2
- out 0x92, al
-
- call check_A20_enabled
- cmp ax, 1
- je A20_ENABLED
- ret
-
A20_ENABLE_VIA_BIOS:
mov al, 'B'
call print_char
diff --git a/src/drivers/video/vga.c b/src/drivers/video/vga.c
index 3ce0e86..c4c226a 100644
--- a/src/drivers/video/vga.c
+++ b/src/drivers/video/vga.c
@@ -154,11 +154,11 @@ void vga_print_name( void *obj )
void vga_print_info( void *obj )
{
- // TODO: print avaiable modes, colors, resolutions
+ // TODO: print available modes, colors, resolutions
}
static void write_registers( vga_t *vga, uint8_t *regs )
-{
+{
// misc
port8_write( &vga->misc_port, *( regs++ ) );