]> wirehaze git hosting - BOS.git/commitdiff

wirehaze git hosting

Now bootable
authorChristoffer Bubach <christoffer@ridestore.com>
Sun, 11 Jan 2015 05:41:33 +0000 (06:41 +0100)
committerChristoffer Bubach <christoffer@ridestore.com>
Sun, 11 Jan 2015 05:41:33 +0000 (06:41 +0100)
kernel/16bit/init16bit.asm
kernel/int/idt.asm
kernel/shell/commands.asm

index 4815455af1b8a265ecd71388ffd901aaa79dc654..ac3793685eeee292f10e3ba6b5017a4621bc7f9d 100755 (executable)
@@ -15,7 +15,7 @@ init16bit:
 \r
         xor    eax, eax                               ; clear mem for IDT and GDT\r
         mov    edi, [idtr.address]                    ; IDT address\r
-        mov    ecx, ([idtr.size] + [idtr.size])/4\r
+        mov    ecx, (0x800 + 0x800)/4\r
         rep    stosd\r
 \r
         mov    eax, cs\r
@@ -29,7 +29,7 @@ init16bit:
         mov    [gdt.BOS_16data + 7], ah\r
 \r
         lea    esi, [gdt]\r
-        mov    edi, [gdtr.address]                    ; GDT address\r
+        mov    edi, 0x7400                            ; GDT address\r
         mov    ecx, (gdt_end - gdt)/4\r
         rep    movsd                                  ; Move it to final pos.\r
 \r
index cafbc63fc5dd368645431a0a1f513147232b1ea1..5b4a8d8a3942b843e50b44ad86fe1aa990fcd343 100644 (file)
 ;----------------------------------------------------------;\r
-; BOS kernel               Christoffer Bubach, 2003-2005. ;\r
+; BOS kernel                Christoffer Bubach, 2003-2005. ;\r
 ;----------------------------------------------------------;\r
-;                                                         ;\r
-;      set/modify IDT entries                             ;\r
-;                                                         ;\r
+;                                                          ;\r
+;    set/modify IDT entries                                ;\r
+;                                                          ;\r
 ;----------------------------------------------------------;\r
 \r
 \r
 \r
 ;--------------------------------------------------;\r
-;     set up IDT                                  ;\r
-; in:  edi = pointer to "unhandled int"-function.  ;\r
+;     set up IDT                                   ;\r
+; in:  esi = pointer to "unhandled int"-function.  ;\r
 ;--------------------------------------------------;\r
 init_idt:\r
-         push    eax\r
-         push    ecx\r
+        push   eax\r
+        push   ecx\r
 \r
-         mov     ecx, 0\r
-     .loop:                                          ; loop\r
-         mov     eax, edi                            ; and\r
-         mov     [(0x6c00+ecx)], ax                  ; set whole IDT\r
-         add     ecx, 2                              ; to one ISR\r
+        xor    ecx, ecx\r
+    .l1:\r
+        mov    eax, esi                               ; loop full IDT and\r
+        mov    [(0x6c00+ecx)], ax                     ; set to one ISR\r
+        add    ecx, 2\r
 \r
-         mov     dword [(0x6c00+ecx)], 0x8E000008    ; 0x6c00 is where\r
-         add     ecx, 4                              ; we put the IDT\r
+        mov    dword [(0x6c00+ecx)], 0x8E000008       ; 0x6c00 is where\r
+        add    ecx, 4                                 ; we put the IDT\r
 \r
-         mov     eax, edi\r
-         shr     eax, 16\r
-         mov     [(0x6c00+ecx)], ax\r
-         add     ecx, 2\r
+        mov    eax, esi\r
+        shr    eax, 16\r
+        mov    [(0x6c00+ecx)], ax\r
+        add    ecx, 2\r
 \r
-         cmp     ecx, 0x800                          ; 256 ints\r
-         jb      .loop                               ; * 8 bytes each\r
+        cmp    ecx, 0x800                             ; 256 ints\r
+        jb     .l1                                    ; * 8 bytes each\r
 \r
-         pop     ecx\r
-         pop     eax\r
-         ret\r
+        pop    ecx\r
+        pop    eax\r
+        ret\r
 \r
 \r
 \r
 ;--------------------------------------;\r
-;  modify IDT, set any int            ;\r
-;     in: cl  = int number            ;\r
-;        edi = int function pointer   ;\r
+;  modify IDT, set any int             ;\r
+;     in: cl  = int number             ;\r
+;      edi = int function pointer      ;\r
 ;--------------------------------------;\r
 set_int:\r
-         push    eax\r
-         push    ecx\r
+               push   eax\r
+               push   ecx\r
 \r
-         mov     al, 8                               ; 8 bytes for each int\r
-         mul     cl                                  ; cl * al = ax\r
-         movzx   ecx, ax                             ; ecx = offset in IDT (1/2 for dword list)\r
-         ;;mov   [(idt_list+ecx/2)], edi             ; add new int to idt entry list\r
-         mov     dword [(idt_list+ecx)], edi         ; add new int to idt entry list\r
+               mov    al, 8                                  ; 8 bytes for each int\r
+               mul    cl                                     ; cl * al = ax\r
+               movzx  ecx, ax                                ; ecx = IDT offset\r
+               shr    ecx, 1                                 ; 1/2 for dword list\r
+               mov    dword [(idt_list+ecx)], edi            ; add to dword int list\r
+               movzx  ecx, ax                                ; ecx = IDT offset\r
 \r
-         mov     eax, edi\r
-         mov     [(0x6c00+ecx)], ax\r
-         add     ecx, 2\r
+               mov    eax, edi\r
+               mov    [(0x6c00+ecx)], ax\r
+               add    ecx, 2\r
 \r
-         mov     dword [(0x6c00+ecx)], 0x8E000008\r
-         add     ecx, 4\r
+               mov    dword [(0x6c00+ecx)], 0x8E000008\r
+               add    ecx, 4\r
 \r
-         mov     eax, edi\r
-         shr     eax, 16\r
-         mov     [(0x6c00+ecx)], ax\r
+               mov    eax, edi\r
+               shr    eax, 16\r
+               mov    [(0x6c00+ecx)], ax\r
 \r
-         pop     ecx\r
-         pop     eax\r
-         ret\r
+               pop    ecx\r
+               pop    eax\r
+               ret\r
 \r
 \r
 \r
 ;------------------------------------------------;\r
-;   get int address                             ;\r
-;      in:  cl = int number                     ;\r
-;      out: esi = address or 0 if none present  ;\r
+;   get int address                              ;\r
+;      in:  cl    = int number                   ;\r
+;      out: esi = address or 0 if none present   ;\r
 ;------------------------------------------------;\r
 get_int:\r
-         push    eax\r
+               push   eax\r
 \r
-         mov     eax, 4                              ; 4 bytes for each address\r
-         mul     cl                                  ; cl * al = ax\r
-         mov     esi, idt_list\r
-         add     esi, eax\r
+               mov    eax, 4                                 ; 4 bytes for each address\r
+               mul    cl                                     ; cl * al = ax\r
+               mov    esi, idt_list\r
+               add    esi, eax\r
 \r
-         pop     eax\r
-         ret\r
+               pop    eax\r
+               ret\r
 \r
 \r
 \r
 \r
 ;----------------------------------------;\r
-;   sets ints from list                 ;\r
-;      in:  esi = pointer to int list   ;\r
+;   sets ints from list                  ;\r
+;      in:  esi = pointer to int list    ;\r
 ;----------------------------------------;\r
 set_idt_list:\r
-         push    eax\r
-         push    edi\r
+               push   eax\r
+               push   edi\r
 \r
-         mov     ecx, 0\r
-     .loop:\r
-         lodsd\r
-         or      eax, eax\r
-         jz      .next\r
-         mov     edi, eax\r
-         call    set_int\r
-     .next:\r
-         inc     ecx\r
-         cmp     ecx, 0x100\r
-         jb      .loop\r
+               xor    ecx, ecx\r
+       .l1:\r
+               lodsd\r
+               or     eax, eax\r
+               jz     .next\r
+               mov    edi, eax\r
+               call   set_int\r
+       .next:\r
+               inc    ecx\r
+               cmp    ecx, 0x100\r
+               jb     .l1\r
 \r
-         pop     edi\r
-         pop     eax\r
-         ret\r
+               pop    edi\r
+               pop    eax\r
+               ret\r
 \r
 \r
 \r
 ;------------------------------;\r
 ;   list of idt entries.       ;\r
-;          0 = not handled    ;\r
+;        0 = not handled       ;\r
 ;------------------------------;\r
-idt_list:           dd   isr00\r
-                    dd   isr01\r
-                    dd   isr02\r
-                    dd   isr03\r
-                    dd   isr04\r
-                    dd   isr05\r
-                    dd   isr06\r
-                    dd   isr07\r
-                    dd   isr08\r
-                    dd   isr09\r
-                    dd   isr0A\r
-                    dd   isr0B\r
-                    dd   isr0C\r
-                    dd   isr0D\r
-                    dd   isr0E\r
-                    dd   0\r
-                    dd   isr10\r
-                    dd   isr11\r
-                    dd   isr12\r
-                    dd   isr13\r
-           times 12 dd   0                           ; 12 unused ints\r
-                    dd   isr20\r
-                    dd   isr21\r
-           times 16 dd   0                           ; 16 unused ints\r
-                    dd   isr32                       ; First free and BOS system interrupt.\r
-          times 205 dd   0                           ; 205 unused ints
\ No newline at end of file
+idt_list:   dd   isr00\r
+            dd   isr01\r
+            dd   isr02\r
+            dd   isr03\r
+            dd   isr04\r
+            dd   isr05\r
+            dd   isr06\r
+            dd   isr07\r
+            dd   isr08\r
+            dd   isr09\r
+            dd   isr0A\r
+            dd   isr0B\r
+            dd   isr0C\r
+            dd   isr0D\r
+            dd   isr0E\r
+            dd   0\r
+            dd   isr10\r
+            dd   isr11\r
+            dd   isr12\r
+            dd   isr13\r
+   times 12 dd   0                                    ; 12 unused ints\r
+            dd   isr20\r
+            dd   isr21\r
+   times 16 dd   0                                    ; 16 unused ints\r
+            dd   isr32                                ; First free and BOS system interrupt.\r
+  times 205 dd   0                                    ; 205 unused ints
\ No newline at end of file
index 1c66dc74949e17ae3fbecc90a3569509b525ec68..3314e0132a585edd146a56863ded672b14fe8107 100755 (executable)
          call    print_char\r
 \r
          call    fdd_reset\r
-         call    fdd_recalibrate                     ; do somthing about the error.. :P\r
+         mov     al, 1\r
+         call    fdd_recal_seek                      ; do somthing about the error.. :P\r
 \r
      .end:\r
          ret\r