#when -DNDEBUG is set the kassert functions are disabled
#JRLDEBUG=-DNDEBUG
-JRLDEBUG= -DSERIAL_PRINT_DEBUG=1 -DSERIAL_PRINT_DEBUG_LEVEL=1000 -DSERIAL_PRINT=1
-
-#
-#
-#Peter's compile flags
-PAD=
+ifeq ($(SERIAL_DEBUG), 1)
+JRLDEBUG= -DDEBUG_SERIAL
+else
+JRLDEBUG=
+endif
# Figure out if we're compiling with cygwin, http://cygwin.com
SYSTEM_NAME := $(shell uname -s)
gdt.c tss.c segment.c \
bget.c malloc.c \
synch.c kthread.c \
+ vm_cons.c debug.c \
+ pci.c \
serial.c reboot.c \
paging.c \
main.c
# ----------------------------------------------------------------------
# Flags used for all C source files
-GENERAL_OPTS := -O -Wall $(EXTRA_C_OPTS) $(JRLDEBUG) $(PADFLAGS)
+GENERAL_OPTS := -O -Wall $(EXTRA_C_OPTS) $(JRLDEBUG)
CC_GENERAL_OPTS := $(GENERAL_OPTS) -Werror
# Flags used for kernel C source files
$(PAD) guest.img 1474560
guest-iso: guest-img
-
mkisofs -pad -b guest.img -R -o guest.iso guest.img
+geekos/idt.o: ../src/geekos/idt.c ../include/geekos/kassert.h \
+ ../include/geekos/screen.h ../include/geekos/ktypes.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \
+ ../include/geekos/defs.h ../include/geekos/idt.h \
+ ../include/geekos/int.h ../include/geekos/debug.h \
+ ../include/geekos/string.h ../include/geekos/../libc/string.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h
+geekos/int.o: ../src/geekos/int.c ../include/geekos/idt.h \
+ ../include/geekos/int.h ../include/geekos/kassert.h \
+ ../include/geekos/screen.h ../include/geekos/ktypes.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \
+ ../include/geekos/defs.h ../include/geekos/irq.h \
+ ../include/geekos/debug.h ../include/geekos/string.h \
+ ../include/geekos/../libc/string.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \
+ ../include/geekos/cpu.h
+geekos/trap.o: ../src/geekos/trap.c ../include/geekos/idt.h \
+ ../include/geekos/int.h ../include/geekos/kassert.h \
+ ../include/geekos/screen.h ../include/geekos/ktypes.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \
+ ../include/geekos/defs.h ../include/geekos/kthread.h \
+ ../include/geekos/list.h ../include/geekos/trap.h \
+ ../include/geekos/debug.h ../include/geekos/string.h \
+ ../include/geekos/../libc/string.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h
+geekos/irq.o: ../src/geekos/irq.c ../include/geekos/kassert.h \
+ ../include/geekos/screen.h ../include/geekos/ktypes.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \
+ ../include/geekos/idt.h ../include/geekos/int.h \
+ ../include/geekos/defs.h ../include/geekos/io.h ../include/geekos/irq.h
+geekos/io.o: ../src/geekos/io.c ../include/geekos/io.h \
+ ../include/geekos/ktypes.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h
+geekos/blockdev.o: ../src/geekos/blockdev.c ../include/geekos/errno.h \
+ ../include/geekos/screen.h ../include/geekos/ktypes.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \
+ ../include/geekos/string.h ../include/geekos/../libc/string.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \
+ ../include/geekos/malloc.h ../include/geekos/int.h \
+ ../include/geekos/kassert.h ../include/geekos/defs.h \
+ ../include/geekos/kthread.h ../include/geekos/list.h \
+ ../include/geekos/synch.h ../include/geekos/blockdev.h \
+ ../include/geekos/fileio.h
+geekos/ide.o: ../src/geekos/ide.c ../include/geekos/serial.h \
+ ../include/geekos/irq.h ../include/geekos/int.h \
+ ../include/geekos/kassert.h ../include/geekos/screen.h \
+ ../include/geekos/ktypes.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \
+ ../include/geekos/defs.h ../include/geekos/string.h \
+ ../include/geekos/../libc/string.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \
+ ../include/geekos/io.h ../include/geekos/errno.h \
+ ../include/geekos/malloc.h ../include/geekos/timer.h \
+ ../include/geekos/kthread.h ../include/geekos/list.h \
+ ../include/geekos/blockdev.h ../include/geekos/fileio.h \
+ ../include/geekos/ide.h
+geekos/keyboard.o: ../src/geekos/keyboard.c ../include/geekos/kthread.h \
+ ../include/geekos/ktypes.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+ ../include/geekos/list.h ../include/geekos/kassert.h \
+ ../include/geekos/screen.h ../include/geekos/fmtout.h \
+ ../include/geekos/../libc/fmtout.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \
+ ../include/geekos/irq.h ../include/geekos/int.h \
+ ../include/geekos/defs.h ../include/geekos/io.h \
+ ../include/geekos/keyboard.h
+geekos/screen.o: ../src/geekos/screen.c \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \
+ ../include/geekos/kassert.h ../include/geekos/screen.h \
+ ../include/geekos/ktypes.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \
+ ../include/geekos/io.h ../include/geekos/int.h ../include/geekos/defs.h
+geekos/timer.o: ../src/geekos/timer.c \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/limits.h \
+ ../include/geekos/io.h ../include/geekos/ktypes.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+ ../include/geekos/int.h ../include/geekos/kassert.h \
+ ../include/geekos/screen.h ../include/geekos/fmtout.h \
+ ../include/geekos/../libc/fmtout.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \
+ ../include/geekos/defs.h ../include/geekos/irq.h \
+ ../include/geekos/kthread.h ../include/geekos/list.h \
+ ../include/geekos/timer.h ../include/geekos/debug.h \
+ ../include/geekos/string.h ../include/geekos/../libc/string.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h
+geekos/mem.o: ../src/geekos/mem.c ../include/geekos/defs.h \
+ ../include/geekos/ktypes.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+ ../include/geekos/kassert.h ../include/geekos/screen.h \
+ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \
+ ../include/geekos/bootinfo.h ../include/geekos/gdt.h \
+ ../include/geekos/int.h ../include/geekos/malloc.h \
+ ../include/geekos/string.h ../include/geekos/../libc/string.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \
+ ../include/geekos/paging.h ../include/geekos/list.h \
+ ../include/geekos/mem.h
+geekos/crc32.o: ../src/geekos/crc32.c ../include/geekos/crc32.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \
+ ../include/geekos/ktypes.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+ ../include/geekos/kassert.h ../include/geekos/screen.h \
+ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \
+ ../include/geekos/serial.h ../include/geekos/irq.h \
+ ../include/geekos/int.h ../include/geekos/defs.h \
+ ../include/geekos/string.h ../include/geekos/../libc/string.h \
+ ../include/geekos/io.h
+geekos/gdt.o: ../src/geekos/gdt.c ../include/geekos/kassert.h \
+ ../include/geekos/screen.h ../include/geekos/ktypes.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \
+ ../include/geekos/segment.h ../include/geekos/int.h \
+ ../include/geekos/defs.h ../include/geekos/tss.h \
+ ../include/geekos/gdt.h ../include/libc/string.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h
+geekos/tss.o: ../src/geekos/tss.c ../include/geekos/kassert.h \
+ ../include/geekos/screen.h ../include/geekos/ktypes.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \
+ ../include/geekos/defs.h ../include/geekos/gdt.h \
+ ../include/geekos/segment.h ../include/geekos/string.h \
+ ../include/geekos/../libc/string.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \
+ ../include/geekos/tss.h ../include/geekos/serial.h \
+ ../include/geekos/irq.h ../include/geekos/int.h ../include/geekos/io.h
+geekos/segment.o: ../src/geekos/segment.c ../include/geekos/kassert.h \
+ ../include/geekos/screen.h ../include/geekos/ktypes.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \
+ ../include/geekos/string.h ../include/geekos/../libc/string.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \
+ ../include/geekos/tss.h ../include/geekos/segment.h
+geekos/bget.o: ../src/geekos/bget.c ../include/geekos/string.h \
+ ../include/geekos/../libc/string.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \
+ ../include/geekos/kassert.h ../include/geekos/screen.h \
+ ../include/geekos/ktypes.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \
+ ../include/geekos/bget.h
+geekos/malloc.o: ../src/geekos/malloc.c ../include/geekos/screen.h \
+ ../include/geekos/ktypes.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \
+ ../include/geekos/int.h ../include/geekos/kassert.h \
+ ../include/geekos/defs.h ../include/geekos/bget.h \
+ ../include/geekos/malloc.h
+geekos/synch.o: ../src/geekos/synch.c ../include/geekos/kthread.h \
+ ../include/geekos/ktypes.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+ ../include/geekos/list.h ../include/geekos/kassert.h \
+ ../include/geekos/screen.h ../include/geekos/fmtout.h \
+ ../include/geekos/../libc/fmtout.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \
+ ../include/geekos/int.h ../include/geekos/defs.h \
+ ../include/geekos/synch.h
+geekos/kthread.o: ../src/geekos/kthread.c ../include/geekos/kassert.h \
+ ../include/geekos/screen.h ../include/geekos/ktypes.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \
+ ../include/geekos/defs.h ../include/geekos/int.h \
+ ../include/geekos/mem.h ../include/geekos/list.h \
+ ../include/geekos/paging.h ../include/geekos/bootinfo.h \
+ ../include/geekos/symbol.h ../include/geekos/string.h \
+ ../include/geekos/../libc/string.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \
+ ../include/geekos/kthread.h ../include/geekos/malloc.h \
+ ../include/geekos/serial.h ../include/geekos/irq.h \
+ ../include/geekos/io.h
+geekos/vm_cons.o: ../src/geekos/vm_cons.c ../include/geekos/fmtout.h \
+ ../include/geekos/../libc/fmtout.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \
+ ../include/geekos/string.h ../include/geekos/../libc/string.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \
+ ../include/geekos/idt.h ../include/geekos/int.h \
+ ../include/geekos/kassert.h ../include/geekos/screen.h \
+ ../include/geekos/ktypes.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+ ../include/geekos/defs.h ../include/geekos/vm_cons.h \
+ ../include/geekos/io.h
+geekos/debug.o: ../src/geekos/debug.c ../include/geekos/string.h \
+ ../include/geekos/../libc/string.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \
+ ../include/geekos/debug.h ../include/geekos/fmtout.h \
+ ../include/geekos/../libc/fmtout.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \
+ ../include/geekos/vm_cons.h ../include/geekos/io.h \
+ ../include/geekos/ktypes.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+ ../include/geekos/screen.h
+geekos/serial.o: ../src/geekos/serial.c ../include/geekos/serial.h \
+ ../include/geekos/irq.h ../include/geekos/int.h \
+ ../include/geekos/kassert.h ../include/geekos/screen.h \
+ ../include/geekos/ktypes.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \
+ ../include/geekos/defs.h ../include/geekos/string.h \
+ ../include/geekos/../libc/string.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \
+ ../include/geekos/io.h ../include/geekos/reboot.h \
+ ../include/geekos/gdt.h ../include/geekos/idt.h
+geekos/reboot.o: ../src/geekos/reboot.c ../include/geekos/reboot.h \
+ ../include/libc/string.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h
+geekos/paging.o: ../src/geekos/paging.c ../include/geekos/string.h \
+ ../include/geekos/../libc/string.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \
+ ../include/geekos/int.h ../include/geekos/kassert.h \
+ ../include/geekos/screen.h ../include/geekos/ktypes.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \
+ ../include/geekos/defs.h ../include/geekos/idt.h \
+ ../include/geekos/kthread.h ../include/geekos/list.h \
+ ../include/geekos/mem.h ../include/geekos/paging.h \
+ ../include/geekos/bootinfo.h ../include/geekos/malloc.h \
+ ../include/geekos/gdt.h ../include/geekos/segment.h \
+ ../include/geekos/crc32.h ../include/geekos/debug.h
+geekos/main.o: ../src/geekos/main.c ../include/geekos/bootinfo.h \
+ ../include/geekos/string.h ../include/geekos/../libc/string.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \
+ ../include/geekos/screen.h ../include/geekos/ktypes.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \
+ ../include/geekos/mem.h ../include/geekos/defs.h \
+ ../include/geekos/list.h ../include/geekos/kassert.h \
+ ../include/geekos/paging.h ../include/geekos/crc32.h \
+ ../include/geekos/tss.h ../include/geekos/int.h \
+ ../include/geekos/kthread.h ../include/geekos/trap.h \
+ ../include/geekos/timer.h ../include/geekos/keyboard.h \
+ ../include/geekos/io.h ../include/geekos/serial.h \
+ ../include/geekos/irq.h ../include/geekos/reboot.h \
+ ../include/geekos/ide.h ../include/geekos/vm_cons.h \
+ ../include/geekos/debug.h ../include/geekos/gdt.h
+common/fmtout.o: ../src/common/fmtout.c \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \
+ ../include/geekos/string.h ../include/geekos/../libc/string.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/limits.h \
+ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h
+common/string.o: ../src/common/string.c ../include/libc/fmtout.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \
+ ../include/libc/string.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h
+common/memmove.o: ../src/common/memmove.c ../include/libc/string.h \
+ /home/jarusl/palacios/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h
/*
* x86 port IO routines
* Copyright (c) 2001, David H. Hovemeyer <daveho@cs.umd.edu>
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
* This is free software. You are permitted to use,
* redistribute, and modify it as specified in the file "COPYING".
void Out_Word(ushort_t port, ushort_t value);
ushort_t In_Word(ushort_t port);
+void Out_DWord(ushort_t port, uint_t value);
+uint_t In_DWord(ushort_t port);
+
void IO_Delay(void);
#endif /* GEEKOS_IO_H */
return faultAddress;
}
-void SerialPrintPD(pde_t *pde);
-void SerialPrintPT(void *starting_address, pte_t *pte);
-void SerialPrintPDE(void *virtual_address, pde_t *pde);
-void SerialPrintPTE(void *virtual_address,pte_t *pte);
-void SerialDumpPageTables(pde_t *pde);
+void PrintPD(pde_t *pde);
+void PrintPT(void *starting_address, pte_t *pte);
+void PrintPDE(void *virtual_address, pde_t *pde);
+void PrintPTE(void *virtual_address,pte_t *pte);
+void DumpPageTables(pde_t *pde);
pte_t *LookupPage(void *vaddr);
#define GEEKOS_SCREEN_H
#include <geekos/ktypes.h>
+#include <geekos/fmtout.h>
#define BLACK 0
#define BLUE 1
void Put_String(const char* s);
void Put_Buf(const char* buf, ulong_t length);
void Print(const char* fmt, ...) __attribute__ ((format (printf, 1, 2)));
-
+void PrintList(const char * fmt, va_list ap);
#endif /* GEEKOS */
#endif /* GEEKOS_SCREEN_H */
#define DEFAULT_SERIAL_ADDR 0x3F8
-#ifndef SERIAL_PRINT
-#define SERIAL_PRINT 1
-#endif
-#ifndef SERIAL_PRINT_DEBUG
-#define SERIAL_PRINT_DEBUG 1
-#endif
-#ifndef SERIAL_PRINT_DEBUG_LEVEL
-#define SERIAL_PRINT_DEBUG_LEVEL 10
-#endif
-
-#define SERIAL_PRINT_MAXBUF 256
-
-
-#if SERIAL_PRINT
-#define SerialPrint(format, args...) \
-do { \
- char buf[SERIAL_PRINT_MAXBUF]; \
- snprintf( buf, SERIAL_PRINT_MAXBUF, format, ## args ) ; \
- SerialPutLineN(buf, SERIAL_PRINT_MAXBUF); \
-} while (0)
-#else
-#define SerialPrint(format, args...) do {} while (0)
-#endif
-
-
-#define PrintBoth(format, args...) \
-do { \
- Print(format, ## args); \
- SerialPrint(format, ##args); \
- } while (0)
-
-
-#if SERIAL_PRINT_DEBUG
-#define SerialPrintLevel(level, format, args...) \
-do { \
- char buf[SERIAL_PRINT_MAXBUF]; \
- if (level >= SERIAL_PRINT_DEBUG_LEVEL ) { \
- snprintf( buf, SERIAL_PRINT_MAXBUF, format, ## args ) ; \
- SerialPutLineN(buf, SERIAL_PRINT_MAXBUF); \
- } \
-} while (0)
-#else
-#define SerialPrintLevel(level, format, args...) do {} while (0)
-#endif
+void SerialPrint(const char * format, ...);
+void SerialPrintList(const char * format, va_list ap);
void SerialPutLine(char * line);
void SerialPutLineN(char * line, int len);
#include <geekos/crc32.h>
#include <geekos/kassert.h>
-#include <geekos/serial.h>
+#include <geekos/debug.h>
#define POLYNOMIAL (ulong_t)0xedb88320
static ulong_t crc_table[256];
#include <geekos/kassert.h>
#include <geekos/defs.h>
#include <geekos/idt.h>
-#include <geekos/serial.h>
+#include <geekos/debug.h>
/* ----------------------------------------------------------------------
* Private data and functions
-void DumpIDT()
-{
- int i;
- Print("IDT Contents:\n");
- for (i=0;i<NUM_IDT_ENTRIES/16;i++) {
- if (s_IDT[i].ig.present) {
- Print("%d: segmentselector=%u, offset=%u, offsetLow=%u, segmentSelector=%u, reserved=%u, signature=%u, dpl=%u, present=%u, offsetHigh=%u\n",
- i,
- s_IDT[i].ig.segmentSelector,
- (s_IDT[i].ig.offsetHigh<<16) + s_IDT[i].ig.offsetLow,
- s_IDT[i].ig.offsetLow,
- s_IDT[i].ig.segmentSelector,
- s_IDT[i].ig.reserved,
- s_IDT[i].ig.signature,
- s_IDT[i].ig.dpl,
- s_IDT[i].ig.present,
- s_IDT[i].ig.offsetHigh);
- }
- }
-}
-void SerialDumpIDT()
+void DumpIDT()
{
int i;
- SerialPrint("IDT Contents:\n");
+ PrintBoth("IDT Contents:\n");
for (i=0;i<NUM_IDT_ENTRIES;i++) {
if (s_IDT[i].ig.present) {
- SerialPrint("%d: segmentselector=%u, offset=%u, offsetLow=%u, segmentSelector=%u, reserved=%u, signature=%u, dpl=%u, present=%u, offsetHigh=%u\n",
+ PrintBoth("%d: segmentselector=%u, offset=%u, offsetLow=%u, segmentSelector=%u, reserved=%u, signature=%u, dpl=%u, present=%u, offsetHigh=%u\n",
i,
s_IDT[i].ig.segmentSelector,
(s_IDT[i].ig.offsetHigh<<16) + s_IDT[i].ig.offsetLow,
s_IDT[i].ig.dpl,
s_IDT[i].ig.present,
s_IDT[i].ig.offsetHigh);
- SerialPrint("\n");
+ PrintBoth("\n");
}
}
}
#include <geekos/screen.h>
#include <geekos/kassert.h>
#include <geekos/int.h>
-#include <geekos/serial.h>
+#include <geekos/irq.h>
+#include <geekos/debug.h>
#include <geekos/cpu.h>
{
Begin_IRQ(state);
- Print("Unexpected Interrupt! Ignoring!\n");
- SerialPrint("*** Unexpected interrupt! *** Ignoring!\n");
+ PrintBoth("*** Unexpected interrupt! *** Ignoring!\n");
Dump_Interrupt_State(state);
End_IRQ(state);
// STOP();
}
-#if 0
+
static void Print_Selector(const char* regName, uint_t value)
{
- Print("%s: index=%d, ti=%d, rpl=%d\n",
+ PrintBoth("%s: index=%d, ti=%d, rpl=%d\n",
regName, value >> 3, (value >> 2) & 1, value & 3);
}
-#endif
-static void SerialPrint_Selector(const char* regName, uint_t value)
-{
- SerialPrint("%s: index=%d, ti=%d, rpl=%d\n",
- regName, value >> 3, (value >> 2) & 1, value & 3);
-}
+
/* ----------------------------------------------------------------------
* Public functions
{
uint_t errorCode = state->errorCode;
- SerialPrint("eax=%08x ebx=%08x ecx=%08x edx=%08x\n"
+ PrintBoth("eax=%08x ebx=%08x ecx=%08x edx=%08x\n"
"esi=%08x edi=%08x ebp=%08x\n"
"eip=%08x cs=%08x eflags=%08x\n"
"Interrupt number=%d, error code=%d\n"
);
if (Is_User_Interrupt(state)) {
struct User_Interrupt_State *ustate = (struct User_Interrupt_State*) state;
- SerialPrint("user esp=%08x, user ss=%08x\n", ustate->espUser, ustate->ssUser);
+ PrintBoth("user esp=%08x, user ss=%08x\n", ustate->espUser, ustate->ssUser);
}
- SerialPrint_Selector("cs", state->cs);
- SerialPrint_Selector("ds", state->ds);
- SerialPrint_Selector("es", state->es);
- SerialPrint_Selector("fs", state->fs);
- SerialPrint_Selector("gs", state->gs);
+ Print_Selector("cs", state->cs);
+ Print_Selector("ds", state->ds);
+ Print_Selector("es", state->es);
+ Print_Selector("fs", state->fs);
+ Print_Selector("gs", state->gs);
}
);
}
-extern uchar_t InByteLL(ushort_t port);
-
/*
* Read a byte from an I/O port.
*/
uchar_t In_Byte(ushort_t port)
{
- /*
uchar_t value;
__asm__ __volatile__ (
);
return value;
- */
-
- return InByteLL(port);
}
/*
}
/*
- * Read a byte from an I/O port.
+ * Read a word from an I/O port.
*/
ushort_t In_Word(ushort_t port)
{
}
/*
+ * Write a double word to an I/O port.
+ */
+void Out_DWord(ushort_t port, uint_t value)
+{
+ __asm__ __volatile__ (
+ "outl %0, %1"
+ :
+ : "a" (value), "Nd" (port)
+ );
+}
+
+/*
+ * Read a double word from an I/O port.
+ */
+uint_t In_DWord(ushort_t port)
+{
+ uint_t value;
+
+ __asm__ __volatile__ (
+ "inl %1, %0"
+ : "=a" (value)
+ : "Nd" (port)
+ );
+
+ return value;
+}
+
+/*
* Short delay. May be needed when talking to some
* (slow) I/O devices.
*/
#include <geekos/string.h>
#include <geekos/kthread.h>
#include <geekos/malloc.h>
-#include <geekos/serial.h>
+#include <geekos/debug.h>
/* ----------------------------------------------------------------------
* Private data
* redistribute, and modify it as specified in the file "COPYING".
*/
+#include <geekos/debug.h>
#include <geekos/bootinfo.h>
#include <geekos/string.h>
#include <geekos/screen.h>
#include <geekos/mem.h>
#include <geekos/paging.h>
#include <geekos/ide.h>
-
+#include <geekos/vm_cons.h>
+#include <geekos/pci.h>
#include <geekos/gdt.h>
+
+#define TEST_PAGING 0
+#define TEST_PCI 1
+
/*
static inline unsigned int cpuid_ecx(unsigned int op)
{
while ((key_press = Wait_For_Key())) {
if (key_press == KEY_F4) {
- Print("\nToggling Speaker Port\n");
- SerialPrintLevel(100,"\nToggling Speaker Port\n");
+ PrintBoth("\nToggling Speaker Port\n");
*doIBuzz = (*doIBuzz + 1) % 2;
} else if (key_press == KEY_F5) {
- Print("\nMachine Restart\n");
- SerialPrintLevel(100,"\nMachine Restart\n");
+ PrintBoth("\nMachine Restart\n");
machine_real_restart();
}
}
Init_BSS();
Init_Screen();
InitSerial();
+
+ Init_VMCons();
Init_Mem(bootInfo);
Init_CRC32();
Init_TSS();
- SerialPrint("\n\nHello, Welcome to this horrid output-only serial interface\n");
- SerialPrint("Eventually, this will let us control the VMM\n\n");
+ PrintBoth("\n\nHello, Welcome to this horrid output-only serial interface\n");
+ PrintBoth("Eventually, this will let us control the VMM\n\n");
- SerialPrint("\n\n===>");
+ PrintBoth("\n\n===>");
- SerialPrintLevel(1000,"Launching Noisemaker and keyboard listener threads\n");
+ PrintBoth("Launching Noisemaker and keyboard listener threads\n");
key_thread = Start_Kernel_Thread(Keyboard_Listener, (ulong_t)&doIBuzz, PRIORITY_NORMAL, false);
spkr_thread = Start_Kernel_Thread(Buzzer, (ulong_t)&doIBuzz, PRIORITY_NORMAL, false);
- SerialPrintLevel(1000,"Next: setup GDT\n");
+ PrintBoth("Next: setup GDT\n");
- {
- int i = 0;
- for (i = 0; i < 1024; i++) {
- uint_t * addr = (uint_t *)0xa00000;
- uint_t foo = *addr;
- SerialPrint("Read From 0x%x=%d\n", (uint_t)addr, foo);
- }
+ if (TEST_PAGING) {
+ int i = 0;
+ for (i = 0; i < 1024; i++) {
+ uint_t * addr = (uint_t *)0xa00000;
+ uint_t foo = *addr;
+
+ PrintBoth("Read From 0x%x=%d\n", (uint_t)addr, foo);
+ }
+
+ // Invalidate_PG((void *)0x2000);
+
+ // VM_Test(bootInfo, 32);
+ //VM_Test(bootInfo, 1536);
}
- // Invalidate_PG((void *)0x2000);
- // VM_Test(bootInfo, 32);
- //VM_Test(bootInfo, 1536);
+
+ if (TEST_PCI) {
+ Init_PCI();
+
+
+ }
while(1);
//#include <geekos/vfs.h>
#include <geekos/crc32.h>
#include <geekos/paging.h>
-#include <geekos/serial.h>
+#include <geekos/debug.h>
/* ----------------------------------------------------------------------
* flag to indicate if debugging paging code
*/
int debugFaults = 0;
-#define Debug(args...) if (debugFaults) Print(args)
+#define Debug(args...) if (debugFaults) PrintBoth(args)
-void SerialPrintPD(pde_t *pde)
+void PrintPD(pde_t *pde)
{
uint_t i;
- SerialPrint("Page Directory at %p:\n",pde);
+ PrintBoth("Page Directory at %p:\n",pde);
for (i = 0; i < NUM_PAGE_DIR_ENTRIES; i++) {
if (pde[i].present) {
if ((i * PAGE_SIZE * 1024) > 0x40000000) {
- SerialPrintPDE((void*)(PAGE_SIZE*NUM_PAGE_TABLE_ENTRIES*i),&(pde[i]));
+ PrintPDE((void*)(PAGE_SIZE*NUM_PAGE_TABLE_ENTRIES*i),&(pde[i]));
}
}
}
}
-void SerialPrintPT(void *starting_address, pte_t *pte)
+void PrintPT(void *starting_address, pte_t *pte)
{
int i;
- SerialPrint("Page Table at %p:\n",pte);
+ PrintBoth("Page Table at %p:\n",pte);
for (i=0;i<NUM_PAGE_TABLE_ENTRIES;i++) {
if (pte[i].present) {
- SerialPrintPTE(starting_address + PAGE_SIZE*i,&(pte[i]));
+ PrintPTE(starting_address + PAGE_SIZE*i,&(pte[i]));
}
}
}
-void SerialPrintPDE(void *virtual_address, pde_t *pde)
+void PrintPDE(void *virtual_address, pde_t *pde)
{
- SerialPrint("PDE %p -> %p : present=%x, flags=%x, accessed=%x, reserved=%x, largePages=%x, globalPage=%x, kernelInfo=%x\n",
+ Print("PDE %p -> %p : present=%x, flags=%x, accessed=%x, reserved=%x, largePages=%x, globalPage=%x, kernelInfo=%x\n",
virtual_address,
(void*) (pde->pageTableBaseAddr << PAGE_POWER),
pde->present,
pde->kernelInfo);
}
-void SerialPrintPTE(void *virtual_address, pte_t *pte)
+void PrintPTE(void *virtual_address, pte_t *pte)
{
- SerialPrint("PTE %p -> %p : present=%x, flags=%x, accessed=%x, dirty=%x, pteAttribute=%x, globalPage=%x, kernelInfo=%x\n",
+ PrintBoth("PTE %p -> %p : present=%x, flags=%x, accessed=%x, dirty=%x, pteAttribute=%x, globalPage=%x, kernelInfo=%x\n",
virtual_address,
(void*)(pte->pageBaseAddr << PAGE_POWER),
pte->present,
}
-void SerialDumpPageTables(pde_t *pde)
+void DumpPageTables(pde_t *pde)
{
uint_t i;
- SerialPrint("Dumping the pages starting with the pde page at %p\n",pde);
+ PrintBoth("Dumping the pages starting with the pde page at %p\n",pde);
for (i = 0; i < NUM_PAGE_DIR_ENTRIES; i++) {
if (pde[i].present) {
if ((i * PAGE_SIZE * 1024) >= 0x40000000) {
- SerialPrintPDE((void *)(PAGE_SIZE * NUM_PAGE_TABLE_ENTRIES * i), &(pde[i]));
- SerialPrintPT((void *)(PAGE_SIZE * NUM_PAGE_TABLE_ENTRIES * i), (void *)(pde[i].pageTableBaseAddr << PAGE_POWER));
+ PrintPDE((void *)(PAGE_SIZE * NUM_PAGE_TABLE_ENTRIES * i), &(pde[i]));
+ PrintPT((void *)(PAGE_SIZE * NUM_PAGE_TABLE_ENTRIES * i), (void *)(pde[i].pageTableBaseAddr << PAGE_POWER));
}
}
}
g_freePageCount+=0;
- SerialPrintLevel(100,"Pid %d, Page Fault received, at address %x (%d pages free)\n",
+ PrintBoth("Pid %d, Page Fault received, at address %x (%d pages free)\n",
g_currentThread->pid, address, g_freePageCount);
if (faultCode.protectionViolation)
- SerialPrintLevel(100," Protection Violation, ");
+ PrintBoth(" Protection Violation, ");
else
- SerialPrintLevel(100," Non-present page, ");
+ PrintBoth(" Non-present page, ");
if (faultCode.writeFault)
- SerialPrintLevel(100,"Write Fault, ");
+ PrintBoth("Write Fault, ");
else
- SerialPrintLevel(100,"Read Fault, ");
+ PrintBoth("Read Fault, ");
if (faultCode.userModeFault)
- SerialPrintLevel(100,"in User Mode\n");
+ PrintBoth("in User Mode\n");
else
- SerialPrintLevel(100,"in Supervisor Mode\n");
+ PrintBoth("in Supervisor Mode\n");
}
/*
/* Get the address that caused the page fault */
address = Get_Page_Fault_Address();
- Debug("Page fault @%lx\n", address);
+ PrintBoth("Page fault @%lx\n", address);
/* Get the fault code */
faultCode = *((faultcode_t *) &(state->errorCode));
/* rest of your handling code here */
- SerialPrintLevel(100,"Unexpected Page Fault received\n");
+ PrintBoth("Unexpected Page Fault received\n");
Print_Fault_Info(address, faultCode);
Dump_Interrupt_State(state);
/* user faults just kill the process */
PrintBoth("Intitialing Virtual Memory\n");
if (checkPaging()) {
- SerialPrintLevel(100,"Paging is currently ON\n");
+ PrintBoth("Paging is currently ON\n");
return ;
}
- SerialPrintLevel(100,"Paging is currently OFF - initializing the pages for a 1-1 map\n");
+ PrintBoth("Paging is currently OFF - initializing the pages for a 1-1 map\n");
numpages=bootInfo->memSizeKB / (PAGE_SIZE/1024);
numpagetables = numpages / NUM_PAGE_TABLE_ENTRIES + ((numpages % NUM_PAGE_TABLE_ENTRIES) != 0 );
- SerialPrintLevel(100,"We need %d pages, and thus %d page tables, and one page directory\n",numpages, numpagetables);
+ PrintBoth("We need %d pages, and thus %d page tables, and one page directory\n",numpages, numpagetables);
pd = (pde_t*)Alloc_Page();
if (!pd) {
- SerialPrintLevel(100,"We are giving up since we can't allocate a page directory!\n");
+ PrintBoth("We are giving up since we can't allocate a page directory!\n");
return;
} else {
- SerialPrintLevel(100,"Our PDE is at physical address %p\n",pd);
+ PrintBoth("Our PDE is at physical address %p\n",pd);
}
for (i=0;i<NUM_PAGE_DIR_ENTRIES;i++) {
} else {
pt = (pte_t*)Alloc_Page();
if (!pt) {
- SerialPrintLevel(100,"We are giving up since we can't allocate page table %d\n",i);
+ PrintBoth("We are giving up since we can't allocate page table %d\n",i);
} else {
- //SerialPrintLevel(100,"Page Table %d is at physical address %p\n",i,pt);
+ //PrintBoth("Page Table %d is at physical address %p\n",i,pt);
}
pd[i].present=1;
pd[i].flags= VM_READ | VM_WRITE | VM_EXEC | VM_USER;
}
- SerialPrintLevel(100,"Done creating 1<->1 initial page tables\n");
- SerialPrintLevel(100,"Now installing page fault handler\n");
+ PrintBoth("Done creating 1<->1 initial page tables\n");
+ PrintBoth("Now installing page fault handler\n");
// SerialDumpPageTables(pd);
Install_Interrupt_Handler(14,Page_Fault_Handler);
- SerialPrintLevel(100,"Now turning on the paging bit!\n");
+ PrintBoth("Now turning on the paging bit!\n");
Enable_Paging(pd);
- SerialPrintLevel(100,"We are still alive after paging turned on!\n");
- SerialPrintLevel(100,"checkPaging returns %d\n",checkPaging());
+ PrintBoth("We are still alive after paging turned on!\n");
+ PrintBoth("checkPaging returns %d\n",checkPaging());
}
PrintBoth("Loading CR3\n");
Set_PDBR(pd);
- SerialDumpPageTables(pd);
+ DumpPageTables(pd);
PrintBoth("Writing to Test Area\n");
uint_t * test_ptr = (uint_t *)two_gig;
for (i = 0; i < num_test_pages; i++) {
- SerialPrint("Writing %d to %p\n", i, test_ptr);
+ PrintBoth("Writing %d to %p\n", i, test_ptr);
*test_ptr = (uint_t)i;
test_ptr += PAGE_SIZE / 4;
}
Set_PDBR(pd);
PrintBoth("Page Mapping Reversed\n");
- SerialDumpPageTables(pd);
+ DumpPageTables(pd);
PrintBoth("Page Consistency Check\n");
* Print to console using printf()-style formatting.
* Calls into Format_Output in common library.
*/
+
+static __inline__ void PrintInternal(const char * format, va_list ap) {
+ Format_Output(&s_outputSink, format, ap);
+}
+
+
void Print(const char *fmt, ...)
{
va_list args;
bool iflag = Begin_Int_Atomic();
va_start(args, fmt);
- Format_Output(&s_outputSink, fmt, args);
+ PrintInternal(fmt, args);
va_end(args);
End_Int_Atomic(iflag);
}
+void PrintList(const char * fmt, va_list ap) {
+ bool iflag = Begin_Int_Atomic();
+ PrintInternal(fmt, ap);
+ End_Int_Atomic(iflag);
+}
End_IRQ(state);
}
-void InitSerial() {
- Print("Initialzing Serial\n");
- Install_IRQ(COM1_IRQ, Serial_Interrupt_Handler);
- Enable_IRQ(COM1_IRQ);
- InitSerialAddr(DEFAULT_SERIAL_ADDR);
-}
void InitSerialAddr(unsigned short io_addr) {
serial_io_addr = io_addr;
SerialPrint("\n");
}
}
+
+
+static struct Output_Sink serial_output_sink;
+static void Serial_Emit(struct Output_Sink * o, int ch) {
+ SerialPutChar((unsigned char)ch);
+}
+static void Serial_Finish(struct Output_Sink * o) { return; }
+
+
+static void __inline__ SerialPrintInternal(const char * format, va_list ap) {
+ Format_Output(&serial_output_sink, format, ap);
+}
+
+
+void SerialPrint(const char * format, ...) {
+ va_list args;
+ bool iflag = Begin_Int_Atomic();
+
+ va_start(args, format);
+ SerialPrintInternal(format, args);
+ va_end(args);
+
+ End_Int_Atomic(iflag);
+}
+
+void SerialPrintList(const char * format, va_list ap) {
+ bool iflag = Begin_Int_Atomic();
+ SerialPrintInternal(format, ap);
+ End_Int_Atomic(iflag);
+
+}
+
+
+
+void InitSerial() {
+ Print("Initialzing Serial\n");
+
+ serial_output_sink.Emit = &Serial_Emit;
+ serial_output_sink.Finish = &Serial_Finish;
+
+ Install_IRQ(COM1_IRQ, Serial_Interrupt_Handler);
+ Enable_IRQ(COM1_IRQ);
+ InitSerialAddr(DEFAULT_SERIAL_ADDR);
+}
#include <geekos/kthread.h>
#include <geekos/timer.h>
-#include <geekos/serial.h>
+#include <geekos/debug.h>
#define HZ 100
Begin_IRQ(state);
- SerialPrintLevel(10,"Host Timer Interrupt Handler Running\n");
+ PrintBoth("Host Timer Interrupt Handler Running\n");
/* Update global and per-thread number of ticks */
++g_numTicks;
#include <geekos/kthread.h>
#include <geekos/defs.h>
#include <geekos/trap.h>
-#include <geekos/serial.h>
+#include <geekos/debug.h>
/*
* TODO: need to add handlers for other exceptions (such as bounds
static void GPF_Handler(struct Interrupt_State* state)
{
/* Send the thread to the reaper... */
- SerialPrintLevel(1000,"Exception %d received, killing thread %p\n",state->intNum, g_currentThread);
+ PrintBoth("Exception %d received, killing thread %p\n",state->intNum, g_currentThread);
Dump_Interrupt_State(state);
Exit(-1);
#include <geekos/string.h>
#include <geekos/tss.h>
-#include <geekos/serial.h>
+#include <geekos/debug.h>
/*
* We use one TSS in GeekOS.