summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2014-09-03 23:21:33 +0200
committerMichal Idziorek <m.i@gmx.at>2014-09-03 23:21:33 +0200
commite7648669694806b366824c0dc0c8b80c8d167d35 (patch)
treeb1243ceaa1f7835ef8a77ef033bcacce9debacf7 /kernel
parent4a46c2e07a9b79af01bbc984f20e01b12e98129f (diff)
debugging floppy driver :(
Diffstat (limited to 'kernel')
-rw-r--r--kernel/config.h2
-rw-r--r--kernel/floppy.c6
-rw-r--r--kernel/interrupts.c46
-rw-r--r--kernel/kernel.c13
-rw-r--r--kernel/shell.c4
5 files changed, 20 insertions, 51 deletions
diff --git a/kernel/config.h b/kernel/config.h
index 15d2121..7af5c03 100644
--- a/kernel/config.h
+++ b/kernel/config.h
@@ -1,2 +1,4 @@
#define FOOLOS_COMPILE_FLOPPY
+#define FOOLOS_TEST_FLOPPY_READ
+//#define FOOLOS_TEST_FLOPPY_WRITE
diff --git a/kernel/floppy.c b/kernel/floppy.c
index 355801c..50bd8d0 100644
--- a/kernel/floppy.c
+++ b/kernel/floppy.c
@@ -303,12 +303,10 @@ void flpydsk_reset()
flpydsk_calibrate ( _CurrentDrive );
}
-void int_floppy_handler()
+void int_floppy()
{
- X86_IRQ_BEGIN
_FloppyDiskIRQ=1;
- X86_IRQ_END
}
@@ -536,7 +534,6 @@ void floppy_init()
flpydsk_reset ();
-#ifdef FOOLOS_TEST_FLOPPY
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"test read (sector: 0)");
flpydsk_read_sector(0);
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"finished reading");
@@ -552,7 +549,6 @@ void floppy_init()
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"test write (sector: 100)");
flpydsk_write_sector(100);
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"finished writing");
-#endif
}
diff --git a/kernel/interrupts.c b/kernel/interrupts.c
index 599221c..81ad1c9 100644
--- a/kernel/interrupts.c
+++ b/kernel/interrupts.c
@@ -32,9 +32,19 @@ void int_def_handler()
{
X86_IRQ_BEGIN
+ panic(FOOLOS_MODULE_NAME,"Unexpected Interrupt occured");
+
X86_IRQ_END
}
+void show_error(uint32_t err)
+{
+ log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"interrupt error code: 0x%08x",err);
+ log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"External Event: %x",err&0b001);
+ log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"Location: %x",err&0b110);
+ log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"Selector: %x",err&0b1111111111111000);
+}
+
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 }
void int_irq2(){ X86_IRQ_BEGIN panic(FOOLOS_MODULE_NAME,"Non Maskable Interrupt"); X86_IRQ_END }
@@ -49,14 +59,6 @@ void int_irq10(){ X86_IRQ_BEGIN panic(FOOLOS_MODULE_NAME,"Invalid TSS"); X86_
void int_irq11(){ X86_IRQ_BEGIN panic(FOOLOS_MODULE_NAME,"Segment Not Present"); X86_IRQ_END }
void int_irq12(){ X86_IRQ_BEGIN panic(FOOLOS_MODULE_NAME,"Stack Segment Overrun"); X86_IRQ_END }
-void show_error(uint32_t err)
-{
- log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"interrupt error code: 0x%08x",err);
- log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"External Event: %x",err&0b001);
- log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"Location: %x",err&0b110);
- log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"Selector: %x",err&0b1111111111111000);
-}
-
void int_irq13()
{
X86_IRQ_BEGIN
@@ -136,31 +138,3 @@ void int_install()
__asm__("lidt %0"::"m" (idtd));
}
-/*
-//print interrupt table; //TODO!
-void int_show()
-{
- uint16_t *ptr3=&idt[0]; // TODO!
-
- scr_put_string("idt located: ");
- scr_put_hex(ptr3);
- scr_nextline();
-
-
- // first two bytes as chars
- int offset;
- for(offset=32;offset<40;offset++)
- {
- print_hex(offset-32); //ir // install keyboard handler
- int_install_ir(33, 0b10001110, 0x08,&int_kb_handler);
-q
- print_string(" -> ");
- print_hex(*(ptr3+offset*4)); //addrLo
- print_hex(*(ptr3+1+offset*4)); //sel
- print_hex(*(ptr3+2+offset*4)); //zeros & flags
- print_hex(*(ptr3+3+offset*4)); //addrHi
- print_nextline();
- }
-}
-*/
-
diff --git a/kernel/kernel.c b/kernel/kernel.c
index a582563..85c3da1 100644
--- a/kernel/kernel.c
+++ b/kernel/kernel.c
@@ -11,7 +11,7 @@
// todo: move somewhere else!?
void int_clock_handler();
void int_kb_handler();
-//void int_floppy_handler();
+void int_floppy_handler();
uint32_t read_eip();
uint32_t c1,c2,c3;
@@ -53,6 +53,7 @@ void kernel_main(uint32_t initial_stack, int mp)
// move the foolfont and aps code before it gets overwritten!
uint8_t *source=0x16600;
uint8_t *dest=0x80000;
+
for(int i=0;i<2*512;i++)
{
dest[i]=source[i];
@@ -133,7 +134,7 @@ void kernel_main(uint32_t initial_stack, int mp)
int_install_ir(33, 0b10001110, 0x08,&int_kb_handler);
// install floppy interrupt handler (irq 6 => 38)
- //int_install_ir(38, 0b10001110, 0x08,&int_floppy_handler);
+ int_install_ir(38, 0b10001110, 0x08,&int_floppy_handler);
// now we can enable interrupts back again
x86_int_enable();
@@ -159,13 +160,13 @@ void kernel_main(uint32_t initial_stack, int mp)
panic(FOOLOS_MODULE_NAME,"ACPI and MP search failed! I do not want to continue!");
// Start the other Processors (also before paging !)
- smp_start_aps(&procdata);
+ // smp_start_aps(&procdata);
/////////////////////
// paging (pass the vesa physbase address for identity mapping)
- vmem_init(vesa_physbase);
+ //vmem_init(vesa_physbase);
//////////////////////
@@ -176,13 +177,13 @@ void kernel_main(uint32_t initial_stack, int mp)
// Its driver will be hopefully implemented one day ;)
//
- pci_init();
+ //pci_init();
//
// Initialize Floppy Disk
//
- //floppy_init();
+ floppy_init();
//
diff --git a/kernel/shell.c b/kernel/shell.c
index cc529da..b377ce0 100644
--- a/kernel/shell.c
+++ b/kernel/shell.c
@@ -21,7 +21,6 @@ void shell_init()
{
pos=0;
command[0]=0;
- scr_put_string("Command> ");
}
void shell_put(char x)
@@ -89,9 +88,6 @@ void shell_execute()
}
pos=0;
- scr_nextline();
- scr_put_string("Command> ");
-
}