diff options
| author | Michal Idziorek <m.i@gmx.at> | 2014-09-04 11:13:43 +0200 |
|---|---|---|
| committer | Michal Idziorek <m.i@gmx.at> | 2014-09-04 11:13:43 +0200 |
| commit | 706d8edc5abf15960ff8bebf9a2a6dc76b23eeac (patch) | |
| tree | 9211bd0d4c336f5cee954d3f43df3853d2b310dc | |
| parent | 5a1d77e158bee2f81623a8ebce7a154a9d8eed99 (diff) | |
using raimage instead of floppy
| -rw-r--r-- | Makefile | 27 | ||||
| -rw-r--r-- | README.md | 9 | ||||
| -rw-r--r-- | asm/int_floppy_handler.asm | 16 | ||||
| -rw-r--r-- | bochsrc | 6 | ||||
| -rw-r--r-- | kernel/config.h | 4 | ||||
| -rw-r--r-- | kernel/floppy.c | 10 | ||||
| -rw-r--r-- | kernel/floppy.h | 1 | ||||
| -rw-r--r-- | kernel/kernel.c | 19 |
8 files changed, 40 insertions, 52 deletions
@@ -13,18 +13,15 @@ ############ some constants ############ -USB_STICK=/dev/sdf #take care! +USB_STICK=/dev/sdg #take care! MP_IMG_START=26112 #code for the other processors intialllly at 0x6600 FONT_DATA_START=26624 #fool font initially at 0x6800 -DATA_START=32768 #0x8000 here we put some "files" later a fs. - #here our kernel will be loaded by the bootloader. KERNEL_START=0x10000 - ############ flags ############ CFLAGS=-ffreestanding -std=gnu99 -m32 -fno-asynchronous-unwind-tables -O0 @@ -64,7 +61,7 @@ FILLUP=./data/fill.bin ############ final image (default target) ############ -all: FoolOS.img +all: FoolOS.img FoolData.img ############ nasm assembling rules ############ @@ -93,27 +90,24 @@ binfont.bin: data/binfont.src # master boot record, kernel binary and fool-font -FoolOS.img: $(MBR) kernel.bin $(MP_BIN) binfont.img $(FILLUP) data.img +FoolOS.img: $(MBR) kernel.bin $(MP_BIN) binfont.img $(FILLUP) cp $(FILLUP) $@ dd if=$(MBR) of=$@ bs=1 seek=0 conv=notrunc dd if=kernel.bin of=$@ bs=1 seek=512 conv=notrunc dd if=$(MP_BIN) of=$@ bs=1 seek=$(MP_IMG_START) conv=notrunc dd if=binfont.img of=$@ bs=1 seek=$(FONT_DATA_START) conv=notrunc - dd if=data.img of=$@ bs=1 seek=$(DATA_START) conv=notrunc - -data.img: data/testdata - cp $^ $@ - binfont.img: binfont.bin cat $^ > $@ +FoolData.img: data/testdata + cp $^ $@ ############ vm stuff ############ # run in our local bochs (we need cirrus support for our vesa mode) -run: FoolOS.img +run: all ~/opt/bochs-2.6.6/bochs -q -rc bochsdebug @@ -127,12 +121,3 @@ stick: FoolOS.img cat FoolOS.img > $(USB_STICK) && sync xxd $(USB_STICK) | head -n 50 - - -##### floppy operations ####### -floppy_losetup_on: - sudo losetup /dev/loop0 data/floppy.img -floppy_losetup_off: - sudo losetup -d /dev/loop0 -floppy_init: - sudo dd if=/dev/zero of=data/floppy.img count=2880 bs=512 @@ -55,11 +55,8 @@ Please note that all features are only very rudimentary and buggy. Todos ----- -* USB driver -* Ext2 driver -* Higher half kernel - * Shell +* Sync primitives * E1000 driver @@ -75,6 +72,10 @@ Todos * mouse driver * window manager +* USB driver +* Ext2 driver +* Higher half kernel + Issues ------ diff --git a/asm/int_floppy_handler.asm b/asm/int_floppy_handler.asm deleted file mode 100644 index 53fb9e7..0000000 --- a/asm/int_floppy_handler.asm +++ /dev/null @@ -1,16 +0,0 @@ -global int_floppy_handler -[extern int_floppy] - - -[bits 32] -int_floppy_handler: - - cli - - call int_floppy - - mov al, 0x20 ;Port number AND command number to Acknowledge IRQ - out 0x20, al ;Acknowledge IRQ, so we keep getting interrupts - - sti - iret ;Interrupt-Return @@ -242,7 +242,7 @@ cpu: count=2, ips=10000000 #, reset_on_triple_fault=1, ignore_bad_msrs=1, msrs=" #optromimage3: file=optionalrom.bin, address=0xd2000 #optromimage4: file=optionalrom.bin, address=0xd3000 -#optramimage1: file=/path/file1.img, address=0x0010000 +optramimage1: file=FoolData.img, address=0x80400 #optramimage2: file=/path/file2.img, address=0x0020000 #optramimage3: file=/path/file3.img, address=0x0030000 #optramimage4: file=/path/file4.img, address=0x0040000 @@ -326,7 +326,7 @@ floppya: 1_44=FoolOS.img, status=inserted # ata0 and ata1 are enabled by default with the values shown below # # Examples: - ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14 +# ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14 # ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15 # ata2: enabled=1, ioaddr1=0x1e8, ioaddr2=0x3e0, irq=11 # ata3: enabled=1, ioaddr1=0x168, ioaddr2=0x360, irq=9 @@ -406,7 +406,7 @@ floppya: 1_44=FoolOS.img, status=inserted #======================================================================= #boot: floppy #boot: disk -boot: floppy +#boot: floppy #======================================================================= # CLOCK: diff --git a/kernel/config.h b/kernel/config.h index 7af5c03..02ba57c 100644 --- a/kernel/config.h +++ b/kernel/config.h @@ -1,4 +1,2 @@ -#define FOOLOS_COMPILE_FLOPPY -#define FOOLOS_TEST_FLOPPY_READ -//#define FOOLOS_TEST_FLOPPY_WRITE +//#define FOOLOS_COMPILE_FLOPPY diff --git a/kernel/floppy.c b/kernel/floppy.c index 5f34c56..1dbe137 100644 --- a/kernel/floppy.c +++ b/kernel/floppy.c @@ -308,9 +308,11 @@ void flpydsk_reset() flpydsk_calibrate ( _CurrentDrive ); } -void int_floppy() +void int_floppy_handler() { + X86_IRQ_BEGIN _FloppyDiskIRQ=1; + X86_IRQ_END } void flpydsk_wait_irq() @@ -563,9 +565,9 @@ void floppy_init() flpydsk_reset (); - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"test write (sector: 100)"); - flpydsk_write_sector(100); - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"finished writing"); +// log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"test write (sector: 100)"); +// flpydsk_write_sector(100); +// log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"finished writing"); } diff --git a/kernel/floppy.h b/kernel/floppy.h new file mode 100644 index 0000000..c149a3a --- /dev/null +++ b/kernel/floppy.h @@ -0,0 +1 @@ +void int_floppy_handler(); diff --git a/kernel/kernel.c b/kernel/kernel.c index a6322f0..0b87b64 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -1,4 +1,5 @@ #define FOOLOS_MODULE_NAME "kernel" +#include "config.h" #include "lib/logger/log.h" #include "lib/int/stdint.h" @@ -6,12 +7,16 @@ #include "smp.h" #include "time.h" +#ifdef FOOLOS_COMPILE_FLOPPY +#include "floppy.h" +#endif + /////// // interrupt handler prototypes // todo: move somewhere else!? void int_clock_handler(); void int_kb_handler(); -void int_floppy_handler(); + uint32_t read_eip(); uint32_t c1,c2,c3; @@ -66,6 +71,11 @@ void kernel_main(uint32_t initial_stack, int mp) dest[i]=source[i]; } + + + /////////////////// BULLSHIT ABOVE THIS LINE: TODO: CLEANUP + + // // We want to get output to the screen as fast as possible! // @@ -90,6 +100,9 @@ void kernel_main(uint32_t initial_stack, int mp) uint32_t vesa_physbase=vesa_init(0x8300,0x8400,0x80000); + char *ramdisk=0x80400; + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"ramdisk: %s",ramdisk); + // // Print initial address of the esp stack pointer // @@ -133,8 +146,10 @@ void kernel_main(uint32_t initial_stack, int mp) // install keyboard interrupt handler (irq 1 => 33) int_install_ir(33, 0b10001110, 0x08,&int_kb_handler); +#ifdef FOOLOS_COMPILE_FLOPPY // install floppy interrupt handler (irq 6 => 38) int_install_ir(38, 0b10001110, 0x08,&int_floppy_handler); +#endif // now we can enable interrupts back again x86_int_enable(); @@ -183,7 +198,9 @@ void kernel_main(uint32_t initial_stack, int mp) // Initialize Floppy Disk // + #ifdef FOOLOS_COMPILE_FLOPPY floppy_init(); + #endif // |
