diff --git a/kernel/Makefile b/kernel/Makefile index 326e12b..cf14c08 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -18,6 +18,7 @@ SRCS = kernel.asm \ dev/at/cga.inc \ dev/at/kbd.inc \ dev/at/floppy.inc \ + dev/dev.inc \ fs/fat.inc \ fs/stpdfs.inc \ fs/xv6fs.inc \ diff --git a/kernel/dev/at/cga.inc b/kernel/dev/at/cga.inc index df7bfb0..c9bccaa 100644 --- a/kernel/dev/at/cga.inc +++ b/kernel/dev/at/cga.inc @@ -87,7 +87,7 @@ cga_putc: xor ah, ah mov cx, [ebp-0x2] add cx, ax - jmp .end + jmp .next @@: mov edx, CGA_MEMORY xor ecx, ecx @@ -99,6 +99,7 @@ cga_putc: mov cx, [ebp-0x2] inc cx +.next: mov ax, cx mov dl, CGA_COLUMNS div dl @@ -110,20 +111,20 @@ cga_putc: ; scroll up push esi push edi - mov ecx, CGA_COLUMNS*(CGA_LINES-1) + mov ecx, CGA_COLUMNS*(CGA_LINES)*2 mov edi, CGA_MEMORY mov esi, CGA_MEMORY+80*2 rep movsw mov ecx, CGA_COLUMNS xor ax, ax - mov edi, CGA_MEMORY+(CGA_COLUMNS*(CGA_LINES-1)*2) + mov edi, CGA_MEMORY+(CGA_COLUMNS*(CGA_LINES)*2) rep stosw pop esi pop edi - mov cx, CGA_COLUMNS*(CGA_LINES-1) + mov cx, CGA_COLUMNS*(CGA_LINES) .end: mov ax, cx call cga_setpos diff --git a/kernel/dev/at/cmos.inc b/kernel/dev/at/cmos.inc index a456f79..d8e8272 100644 --- a/kernel/dev/at/cmos.inc +++ b/kernel/dev/at/cmos.inc @@ -57,4 +57,8 @@ CMOS_COMMAND = 0x70 CMOS_DATA = 0x71 +CMOS_REG_SECOND = 0x00 +CMOS_REG_MINUTE = 0x02 +CMOS_REG_HOUR = 0x04 + CMOS_FLOPPY_TYPE = 0x10 diff --git a/kernel/dev/at/floppy.inc b/kernel/dev/at/floppy.inc index 7440a11..4044fb1 100644 --- a/kernel/dev/at/floppy.inc +++ b/kernel/dev/at/floppy.inc @@ -37,5 +37,10 @@ floppy_probe: floppy_irq: iret +floppy_device: + dd floppy_probe + dd 0 + dd 0 + szMsgFloppy0Found db "floppy0: Found", 0 szMsgFloppy1Found db "floppy1: Found", 0 diff --git a/kernel/dev/console.inc b/kernel/dev/console.inc index 2f02b74..2c5d748 100644 --- a/kernel/dev/console.inc +++ b/kernel/dev/console.inc @@ -21,4 +21,9 @@ console_read: console_init: ret +console_device: + dd console_probe + dd console_write + dd console_write + uConsoleLock dd 0 diff --git a/kernel/dev/dev.inc b/kernel/dev/dev.inc index 2cdd945..a13866e 100644 --- a/kernel/dev/dev.inc +++ b/kernel/dev/dev.inc @@ -1,10 +1,27 @@ ;; File: dev.inc struc Device { + .probe dd ? .write dd ? .read dd ? - .probe dd ? } +DEFN Device + +aDevices: + dd console_device + dd floppy_device +.end: dev_init: + mov ecx, aDevices +@@: + mov eax, [ecx] + mov eax, [eax + Device.probe] + push ecx + call eax + pop ecx + add ecx, 4 + cmp ecx, aDevices.end + jb @b + ret diff --git a/kernel/fs/fat.inc b/kernel/fs/fat.inc index 55ffee7..8d4897b 100644 --- a/kernel/fs/fat.inc +++ b/kernel/fs/fat.inc @@ -71,3 +71,27 @@ fatfs_init: mov eax, vfs_fatfs call vfs_register ret + +fatfs_mount: + ret + +fatfs_start: + ret + +fatfs_unmount: + ret + +fatfs_root: + ret + +fatfs_statvfs: + ret + +fatfs_loadvnode: + ret + +fatfs_newvnode: + ret + +fatfs_mountroot: + ret diff --git a/kernel/kernel.asm b/kernel/kernel.asm index de0e9d8..f3eac09 100644 --- a/kernel/kernel.asm +++ b/kernel/kernel.asm @@ -65,6 +65,8 @@ kmain: call pit_init + call dev_init + call vfs_init mov eax, SYSCALL_EXIT @@ -73,8 +75,6 @@ kmain: ;mov al, 'X' ;call cga_putc - call floppy_probe - .halt: hlt jmp $ @@ -91,6 +91,7 @@ kmain: include 'dev/at/floppy.inc' include 'klog.inc' include 'dev/console.inc' + include 'dev/dev.inc' include 'mm/mm.inc' include 'lock.inc' include 'gdt.inc' diff --git a/kernel/klog.inc b/kernel/klog.inc index 90f336d..210e911 100644 --- a/kernel/klog.inc +++ b/kernel/klog.inc @@ -1,13 +1,6 @@ ;; File: klog.inc ;; Kernel logging utilities -CMOS_COMMAND = 0x70 -CMOS_DATA = 0x71 - -CMOS_REG_SECOND = 0x00 -CMOS_REG_MINUTE = 0x02 -CMOS_REG_HOUR = 0x04 - COM1 = 0x3F8 klog_kputc: