summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--asm/int_clock_handler.asm14
-rw-r--r--bochsrc10
-rw-r--r--kernel/interrupts.c2
-rw-r--r--kernel/kernel.c14
-rw-r--r--kernel/task.c12
6 files changed, 24 insertions, 30 deletions
diff --git a/Makefile b/Makefile
index e080398..688dc80 100644
--- a/Makefile
+++ b/Makefile
@@ -101,7 +101,7 @@ run: FoolOS.img
############ cleanup ############
clean:
- -rm *.bin *.img bochs.log $(KERNEL_ENTRY) $(ASMOBJECTS) $(OBJECTS) $(FILLUP) $(MBR)
+ -rm *.bin *.img bochs.log $(KERNEL_ENTRY) $(ASMOBJECTS) $(OBJECTS) $(FILLUP) $(MBR)
diff --git a/asm/int_clock_handler.asm b/asm/int_clock_handler.asm
index dd0de96..177492f 100644
--- a/asm/int_clock_handler.asm
+++ b/asm/int_clock_handler.asm
@@ -1,21 +1,21 @@
global int_clock_handler
[extern task_switch_next]
-CLOCK_COUNTER:
- db 0x00
+;CLOCK_COUNTER:
+; db 0x00
[bits 32]
int_clock_handler:
;Notice there is no IRQ number or error code - we don't need them
- inc byte [CLOCK_COUNTER]
+; inc byte [CLOCK_COUNTER]
- cmp byte [CLOCK_COUNTER], 0x10
+; cmp byte [CLOCK_COUNTER], 0x2
- jne skip_clock
+; jne skip_clock
- mov byte [CLOCK_COUNTER], 0x00
+; mov byte [CLOCK_COUNTER], 0x00
pusha ;Push all standard registers
@@ -27,7 +27,7 @@ int_clock_handler:
popa ;Put the standard registers back
- skip_clock:
+; skip_clock:
mov al, 0x20 ;Port number AND command number to Acknowledge IRQ
out 0x20, al ;Acknowledge IRQ, so we keep getting interrupts
diff --git a/bochsrc b/bochsrc
index 83f5417..59c6d08 100644
--- a/bochsrc
+++ b/bochsrc
@@ -136,7 +136,7 @@ romimage: file=/home/miguel/opt/bochs-2.6.6/bios/BIOS-bochs-latest
# 2.2.6 2.1Ghz Athlon XP with Linux 2.6/g++ 3.4 12 to 15 Mips
# 2.0.1 1.6Ghz Intel P4 with Win2000/g++ 3.3 5 to 7 Mips
#=======================================================================
-cpu: count=1, ips=1000000 #, reset_on_triple_fault=1, ignore_bad_msrs=1, msrs="msrs.def"
+cpu: count=1, ips=10000000 #, reset_on_triple_fault=1, ignore_bad_msrs=1, msrs="msrs.def"
#=======================================================================
# CPUID:
@@ -467,7 +467,7 @@ clock: sync=realtime, time0=local
# make it "/dev/null" (Unix) or "nul" (win32). :^(
#
# Examples:
-# log: ./bochs.out
+ log: ./bochs.out
# log: /dev/tty
#=======================================================================
#log: /dev/stdout
@@ -511,8 +511,8 @@ clock: sync=realtime, time0=local
# cause bochs to become unstable. The panic is a "graceful exit," so
# if you disable it you may get a spectacular disaster instead.
#=======================================================================
-panic: action=report
-error: action=report
+panic: action=ask
+error: action=ask
info: action=report
debug: action=ignore
#debug: action=report
@@ -963,4 +963,6 @@ private_colormap: enabled=0
##
pci: enabled=1, chipset=i440fx, slot1=cirrus
#i440fxsupport: enabled=1, slot1=cirrus
+e1000: enabled=1, mac=52:54:00:12:34:56 #, ethmod=slirp, script=slirp.conf
+
diff --git a/kernel/interrupts.c b/kernel/interrupts.c
index 348972e..e67e74d 100644
--- a/kernel/interrupts.c
+++ b/kernel/interrupts.c
@@ -48,7 +48,7 @@ void int_def_handler()
{
X86_IRQ_BEGIN
- int_unhandled++;
+ panic(FOOLOS_MODULE_NAME,"unhandled EXCEPTION!");
X86_IRQ_END
}
diff --git a/kernel/kernel.c b/kernel/kernel.c
index 3eebef6..287a62a 100644
--- a/kernel/kernel.c
+++ b/kernel/kernel.c
@@ -24,12 +24,6 @@ void int_floppy_handler();
uint32_t read_eip();
-void int_unhandled()
-{
- X86_IRQ_BEGIN
- panic(FOOLOS_MODULE_NAME,"unhandled EXCEPTION!");
- X86_IRQ_END
-}
void int_irq0(){ X86_IRQ_BEGIN panic(FOOLOS_MODULE_NAME,"Divide by 0"); X86_IRQ_END }
void int_irq1(){ X86_IRQ_BEGIN panic(FOOLOS_MODULE_NAME,"Single step (debugger)"); X86_IRQ_END }
@@ -99,11 +93,11 @@ void kernel_main(uint32_t initial_stack)
//
uint32_t vesa_physbase=vesa_init(0x8300,0x8400,0x7200);
+ // initial stack
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"initial esp: 0x%08X",initial_stack);
// PIT config (timer)
timer_init();
-
// we know that here, the bootloader placed the mamory map!
mem_init(0x7c00+0x400,*((uint16_t *)(0x7c00+0x600)));
@@ -134,8 +128,6 @@ void kernel_main(uint32_t initial_stack)
// install floppy interrupt handler
int_install_ir(38, 0b10001110, 0x08,&int_floppy_handler);
- // install test software interrupt handler
- int_install_ir(88, 0b10001110, 0x08,&int_unhandled);
// exceptions
int_install_ir(0, 0b10001110, 0x08,&int_irq0);
@@ -167,14 +159,14 @@ void kernel_main(uint32_t initial_stack)
pci_init();
// floppy
- floppy_init();
-
+ floppy_init();
//init shell
shell_init();
// multitasking
task_init();
+
/*
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"test mem");
diff --git a/kernel/task.c b/kernel/task.c
index 8884079..df9367d 100644
--- a/kernel/task.c
+++ b/kernel/task.c
@@ -9,14 +9,14 @@ int started;
void task_test1()
{
- uint8_t c1;
+ uint16_t c1;
while(1)
{
c1++;
asm("cli");
- PutString("task1: %03d", 0,560,0xffffff, c1);
+ PutString("task1: %03d", 0,560,0xffffff, c1/100);
asm("sti");
}
@@ -25,13 +25,13 @@ void task_test1()
void task_test2()
{
- uint8_t c2;
+ uint16_t c2;
while(1)
{
c2++;
asm("cli");
- PutString("task2: %03d", 0,580,0xffffff, c2);
+ PutString("task2: %03d", 0,580,0xffffff, c2/100);
asm("sti");
}
@@ -105,7 +105,7 @@ uint32_t task_switch_next(uint32_t oldesp)
}
uint32_t esp=0;
- log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"oldesp: 0x%08X saved / next task: %d (esp: 0x%08X) ",oldesp, CurrentTask,Threads[CurrentTask].esp0);
+ log(FOOLOS_MODULE_NAME,FOOLOS_LOG_FINE,"oldesp: 0x%08X saved / next task: %d (esp: 0x%08X) ",oldesp, CurrentTask,Threads[CurrentTask].esp0);
return Threads[CurrentTask].esp0; //Return new stack pointer to ASM
}
@@ -123,10 +123,10 @@ void stack_trace(uint32_t *stack,int size)
void task_init()
{
- started=0xabcde;
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"init multitasking.");
task_create(0,task_test1);
task_create(1,task_test2);
+ started=0xabcde;
}