]> wirehaze git hosting - BOS.git/commitdiff

wirehaze git hosting

VFS structures in place, minor typos fixed
authorChristoffer Bubach <christoffer@ridestore.com>
Fri, 16 Jan 2015 01:16:46 +0000 (02:16 +0100)
committerChristoffer Bubach <christoffer@ridestore.com>
Fri, 16 Jan 2015 01:16:46 +0000 (02:16 +0100)
doc/services.txt
kernel/fat12/fat12.asm
kernel/system/services.asm
kernel/vfs/parse.asm
kernel/vfs/vfs.asm

index 58eeecbbc25dec55d68b3c28398599677da57ab2..4ada963e752b2c4b07645befc5d51928f84dd65a 100644 (file)
@@ -38,6 +38,7 @@ default include:
 - general PCI devices
 - special one for all things USB?
 - GUI specific functions
+- printing services
 - running stuff in 16 and 64 bit, with extra DOS emulation
   and/or other services
 
@@ -65,12 +66,9 @@ services.asm  (main service 0x00)
    - get/set interrupts
    - execute kernel monitor command/script
    - get time/date
-   - DMA functions, here or in VFS/floppy/memory drivers?
    - GDT function, create new segments 'n shit
    - pc-speaker beep if not even stdio is found
    - CMOS / PIC functions
-   - run 16/64 bit code - seperate services for this? (int21h included?)
-   - get specified...
 
 
 stdio.asm (service number 0x01)
@@ -146,6 +144,7 @@ proccess.asm (service number 0x03)
        more executable formats, possibly other
        execution modes: realmode, longmode
    - Remove driver
+   - run 16/64 bit code - seperate services for this? (int21h included?)
 
 
 memory.asm (service number 0x04)
index a96178245aba6e52c2d00cc61c1c300f730e0705..416fe43d42b1cbb66d7f0dc78c68ee55235318da 100644 (file)
@@ -7,7 +7,7 @@
 ;----------------------------------------------------------;
 
     ;---------------------------------------------;
-    ;   main FAT12 info structure                 ;
+    ;   FAT12 main info structure                 ;
     ;---------------------------------------------;
     struc fat12
     {
         .boot                            bootsector  
         .dir_entries:
             times 16 * sizeof.dir_entry  db 0        ; 512b dir entry buffer
-        .fat_buffer:      times 512      db 0        ; 512b FAT cluster info buffer           
+        .fat_buffer:      times 512      db 0        ; 512b FAT cluster info buffer
     }
 
+    virtual at 0                                      ; could use "at esi" instead
+        fat12 fat12
+        sizeof.fat12 = $-$$     
+    end virtual
+
     ;---------------------------------------------;
     ;   FAT12 bootsector structure                ;
     ;---------------------------------------------;
         .boot_signature    db  0,0                    ; 0x55,0xAA
     }
 
+    virtual at 0
+        bootsector bootsector
+        sizeof.bootsector = $-$$
+    end virtual
+
     ;---------------------------------------------;
     ;   FAT12 directory entry structure           ;
     ;---------------------------------------------;
-    struct dir_entry
+    struc dir_entry
     {
         .filename          db  0,0,0,0,0,0,0,0
         .extension         db  0,0,0
         .filesize          dd  0
     }
 
+    virtual at 0
+        dir_entry dir_entry
+        sizeof.dir_entry = $-$$
+    end virtual
+
     ;---------------------------------------------;
     ;   FAT12 directory entry for LFN             ;
     ;---------------------------------------------;
-    struct lnf_entry
+    struc lfn_entry
     {
         .order             db  0                      ; LFN entry in sequence, never 0x00 or 0xE5.
         .namefirst         dw  0,0,0,0,0              ; 5 first unicode (2byte) chars
 
     virtual at 0
         lfn_entry lfn_entry
-        sizeof.lfn_entry = $
-    end virtual
-
-    virtual at 0
-        dir_entry dir_entry
-        sizeof.dir_entry = $
-    end virtual
-
-    virtual at 0
-        bootsector bootsector
-        sizeof.bootsector = $
-    end virtual
-
-    virtual at 0
-        disk disk 
-        sizeof.disk = $     
+        sizeof.lfn_entry = $-$$
     end virtual
 
     ;------------------------------------------;
 
 
 
-fd0: fat12            ; define fd0 data..  tmp example.
+fd0 fat12            ; define fd0 data..  tmp example.
 
 ; TODO, alloc memory for struct and keep pointer only.
 ; ---------------
@@ -191,7 +191,10 @@ calc_lfn_chksum:
         mov    cx, 11
         xor    ax, ax                                 ; return value start with null
     .l1:
-        add    ax, byte [esi]                         ; add next char to sum
+        push   cx
+        movzx  cx, byte [esi]                         ; add next char to sum
+        add    ax, cx
+        pop    cx
         shr    ax, 1                                  ; shift sum right by 1
         inc    esi                                    ; prepare for next character
         loop   .l1
index 3f57ddd39af22ffb11f7b28481f09319095e8412..3bd5b989da3b2b6bb506e4d860a04bbc461ecc0a 100755 (executable)
@@ -1,8 +1,8 @@
 ;----------------------------------------------------------;\r
-; BOS 0.04                  Christoffer Bubach, 2004-2005. ;\r
+; BOS 0.05                  Christoffer Bubach, 2004-2015. ;\r
 ;----------------------------------------------------------;\r
 ;                                                          ;\r
-;     System interrupts..                                  ;\r
+;   Service handler for components such as VFS & STDIO.    ;\r
 ;                                                          ;\r
 ;----------------------------------------------------------;\r
 \r
index a067cce36c8d6d6e5b05157eb2385be0823a705e..e3264f2c232870c6a8e1e12e6111ef5dfe5ae264 100644 (file)
@@ -29,19 +29,19 @@ parse_path:
           mov     bl, 0x00                            ; fd base is 0x00
           cmp     word [esi], 'FD'                    ; fd check
           je      .drive_found
-          mov     bl, 0x0F                            ; hd base is 0x0F
+          mov     bl, 0x10                            ; hd base is 0x10
           cmp     word [esi], 'HD'                    ; hd check
           je      .drive_found
-          mov     bl, 0x5F                            ; cd base is 0x5F
+          mov     bl, 0x60                            ; cd base is 0x60
           cmp     word [esi], 'CD'                    ; cd check
           je      .drive_found
-          mov     bl, 0x7F                            ; rd base is 0x7F
-          cmp     word [esi], 'RD'                    ; rd (ram drive) check
+          mov     bl, 0x80                            ; vd base is 0x80
+          cmp     word [esi], 'VD'                    ; vd (virtual ram drive) check
           je      .drive_found
-          mov     bl, 0x8F                            ; rm base is 0x8F
-          cmp     word [esi], 'RM'                    ; rm (removable/usb)
+          mov     bl, 0x90                            ; rd base is 0x90
+          cmp     word [esi], 'RD'                    ; rd (removable/usb)
           je      .drive_found
-          mov     bl, 0xAF                            ; nd base is 0xAF
+          mov     bl, 0xB0                            ; nd base is 0xB0
           cmp     word [esi], 'ND'                    ; nd (net) check
           je      .drive_found
 
index ff661fd2ef8e3004a0a9240f761fc2a85f9394a9..ab2f0facc35e1f91f131447278be0a42b30a5cd4 100644 (file)
@@ -2,10 +2,84 @@
 ; BOS kernel                Christoffer Bubach, 2012-2015. ;
 ;----------------------------------------------------------;
 ;                                                          ;
-;        VFS  handling all devices and filesystems.        ;
+;        VFS handling all devices and filesystems.         ;
 ;                                                          ;
 ;----------------------------------------------------------;
 
+    ;---------------------------------------------;
+    ;   VFS main structure                        ;
+    ;---------------------------------------------;
+    struc VFS
+    {
+        .number:                times 255      db 0   ; 00=FD, 0x10=HD, 0x60=CD, 0x80=VD, 90=RD, B0=ND
+        .storage:
+            times 255 * sizeof.VFS_storage     db 0   ; storage driver structure
+        .filesystem:          
+            times 255 * sizeof.VFS_filesystem  db 0   ; filesystem driver structure
+    }
+
+    virtual at 0                                      ; could use "at esi" instead
+        VFS VFS
+        sizeof.VFS = $-$$     
+    end virtual
+
+    ;---------------------------------------------;
+    ;   VFS storage driver structure              ;
+    ;---------------------------------------------;
+    struc VFS_storage
+    {
+        .data_pointer         dd  0                   ; internal driver data
+        .init                 dd  0                   ; pointer to init
+        .deinit               dd  0                   ; remove driver
+        .read                 dd  0                   ; read device
+        .write                dd  0                   ; write device
+        .ioctl                dd  0                   ; handle device specific extras
+    }
+
+    virtual at 0
+        VFS_storage VFS_storage
+        sizeof.VFS_storage = $-$$
+    end virtual
+
+    ;---------------------------------------------;
+    ;   VFS filesystem structure                  ;
+    ;---------------------------------------------;
+    struc VFS_filesystem
+    {
+        .data_pointer         dd  0                   ; internal driver data
+        .init                 dd  0                   ; pointer to init
+        .deinit               dd  0                   ; remove driver
+        .format               dd  0                   ; format drive
+        .mount                dd  0                   ; mount drive
+        .unmount              dd  0                   ; unmount drive
+        .find                 dd  0                   ; find file
+        .findnext             dd  0                   ; get next match
+        .open                 dd  0                   ; open file, get handle
+        .read                 dd  0                   ; read file from handle
+        .write                dd  0                   ; write file from handle
+        .seek                 dd  0                   ; seek from handle
+        .remove               dd  0                   ; remove file/dir
+        .create               dd  0                   ; create file/dir
+        .ioctl                dd  0                   ; extra calls if exists
+    }
+
+    virtual at 0
+        VFS_filesystem VFS_filesystem
+        sizeof.VFS_filesystem = $-$$
+    end virtual
+
+
+VFS_structure VFS
+
+;--------------------------------------------------------------;
+;   init_vfs  -  detect connected drives                       ;
+;--------------------------------------------------------------;
+;                                                              ;
+;       in:  reg = pointer to VFS drive info                   ;
+;                                                              ;
+;       out: reg = pointer to struct(s) if FAT12 found         ;
+;                                                              ;
+;--------------------------------------------------------------;
 init_vfs:
         push   eax
         ; a bit more code here