Compare commits
3 Commits
1e9de446f0
...
fat_v2
| Author | SHA1 | Date | |
|---|---|---|---|
| 4a944bc493 | |||
| 137735431a | |||
| 6caaf6aa6d |
24
docs/okteta/structures/mbr/main.osd
Normal file
24
docs/okteta/structures/mbr/main.osd
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<data>
|
||||||
|
<struct name="MBR">
|
||||||
|
<!-- 446 bytes: bootstrap code -->
|
||||||
|
<array name="bootCode" length="446">
|
||||||
|
<primitive type="UInt8"/>
|
||||||
|
</array>
|
||||||
|
|
||||||
|
<!-- 4 x 16-byte partition entries -->
|
||||||
|
<array name="partitions" length="4">
|
||||||
|
<struct name="PartitionEntry">
|
||||||
|
<primitive name="status" type="UInt8"/> <!-- 0x80=bootable -->
|
||||||
|
<array name="chsFirst" length="3"><primitive type="UInt8"/></array>
|
||||||
|
<primitive name="type" type="UInt8"/>
|
||||||
|
<array name="chsLast" length="3"><primitive type="UInt8"/></array>
|
||||||
|
<primitive name="lbaStart" type="UInt32"/>
|
||||||
|
<primitive name="lbaSectors" type="UInt32"/>
|
||||||
|
</struct>
|
||||||
|
</array>
|
||||||
|
|
||||||
|
<!-- Signature 0x55AA (little-endian UInt16 == 0xAA55 on disk) -->
|
||||||
|
<primitive name="signature" type="UInt16"/>
|
||||||
|
</struct>
|
||||||
|
</data>
|
||||||
12
docs/okteta/structures/mbr/metadata.desktop
Normal file
12
docs/okteta/structures/mbr/metadata.desktop
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Icon=application-x-executable
|
||||||
|
Type=Service
|
||||||
|
ServiceTypes=KPluginInfo
|
||||||
|
Name=Stevia MBR Structure
|
||||||
|
X-KDE-PluginInfo-Author=Elaina Claus
|
||||||
|
X-KDE-PluginInfo-Name=mbr
|
||||||
|
X-KDE-PluginInfo-Version=1.0
|
||||||
|
X-KDE-PluginInfo-Website=https://chtm.me
|
||||||
|
X-KDE-PluginInfo-Category=structure
|
||||||
|
X-KDE-PluginInfo-License=MIT
|
||||||
|
X-KDE-PluginInfo-EnabledByDefault=false
|
||||||
57
docs/okteta/structures/vbr/main.osd
Normal file
57
docs/okteta/structures/vbr/main.osd
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<data>
|
||||||
|
<struct name="VBR">
|
||||||
|
<!-- 3 bytes: jmp over bpb code -->
|
||||||
|
<array name="jmpcode" length="3">
|
||||||
|
<primitive name="opcode" type="UInt8"/>
|
||||||
|
</array>
|
||||||
|
|
||||||
|
<array name="bs_ident" length="8">
|
||||||
|
<primitive type="Char"/>
|
||||||
|
</array>
|
||||||
|
|
||||||
|
<struct name="FAT32_bpb">
|
||||||
|
<primitive name="BytesPerSector" type="UInt16"/>
|
||||||
|
<primitive name="SectorsPerCluster" type="UInt8"/>
|
||||||
|
<primitive name="ReservedSectors" type="UInt16"/>
|
||||||
|
<primitive name="FatCount" type="UInt8"/>
|
||||||
|
<primitive name="RootEntryCount16" type="UInt16"/>
|
||||||
|
<primitive name="TotalSectors16" type="UInt16"/>
|
||||||
|
<primitive name="MediaDesc" type="UInt8"/>
|
||||||
|
<primitive name="FATSize16" type="UInt16"/>
|
||||||
|
<primitive name="SectorsPerTrack" type="UInt16"/>
|
||||||
|
<primitive name="HeadCount" type="UInt16"/>
|
||||||
|
<primitive name="HiddenSectors" type="UInt32"/>
|
||||||
|
<primitive name="TotalSectors32" type="UInt32"/>
|
||||||
|
</struct>
|
||||||
|
|
||||||
|
<struct name="FAT32_ebpb">
|
||||||
|
<primitive name="FATSize32" type="UInt32"/>
|
||||||
|
<primitive name="ExtFlags" type="UInt16"/>
|
||||||
|
<primitive name="FSVersion" type="UInt16"/>
|
||||||
|
<primitive name="RootDirCluster" type="UInt32"/>
|
||||||
|
<primitive name="FSInfoSector" type="UInt16"/>
|
||||||
|
<primitive name="BkBootSector" type="UInt16"/>
|
||||||
|
<array name="reserved0" length="12">
|
||||||
|
<primitive type="uint8"/>
|
||||||
|
</array>
|
||||||
|
<primitive name="DriveNumber" type="UInt8"/>
|
||||||
|
<primitive name="NtFlags" type="UInt8"/>
|
||||||
|
<primitive name="Signature" type="UInt8"/>
|
||||||
|
<primitive name="VolumeId" type="UInt32"/>
|
||||||
|
<array name="VolumeLabel" length="11">
|
||||||
|
<primitive type="Char"/>
|
||||||
|
</array>
|
||||||
|
<array name="FilesystemIdent" length="8">
|
||||||
|
<primitive type="Char"/>
|
||||||
|
</array>
|
||||||
|
</struct>
|
||||||
|
|
||||||
|
<array name="BootCode" length="420">
|
||||||
|
<primitive type="UInt8"/>
|
||||||
|
</array>
|
||||||
|
|
||||||
|
<!-- Signature 0xAA55 -->
|
||||||
|
<primitive name="signature" type="UInt16"/>
|
||||||
|
</struct>
|
||||||
|
</data>
|
||||||
12
docs/okteta/structures/vbr/metadata.desktop
Normal file
12
docs/okteta/structures/vbr/metadata.desktop
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Icon=application-x-executable
|
||||||
|
Type=Service
|
||||||
|
ServiceTypes=KPluginInfo
|
||||||
|
Name=Stevia FAT32 VBR Structure
|
||||||
|
X-KDE-PluginInfo-Author=Elaina Claus
|
||||||
|
X-KDE-PluginInfo-Name=vbr32
|
||||||
|
X-KDE-PluginInfo-Version=1.0
|
||||||
|
X-KDE-PluginInfo-Website=https://chtm.me
|
||||||
|
X-KDE-PluginInfo-Category=structure
|
||||||
|
X-KDE-PluginInfo-License=MIT
|
||||||
|
X-KDE-PluginInfo-EnabledByDefault=false
|
||||||
@@ -126,11 +126,12 @@ FAT32_load_vbr:
|
|||||||
; - fill fat32_bpb_t and compute derived fields
|
; - fill fat32_bpb_t and compute derived fields
|
||||||
; - read FSInfo (free count/next free)
|
; - read FSInfo (free count/next free)
|
||||||
; - ???
|
; - ???
|
||||||
; int fat32_mount(uint32_t partition_lba, fat32_bpb_t* out);
|
; int fat32_mount(FAT32_State_t* state, uint32_t partition_lba);
|
||||||
FAT32_mountfs:
|
FAT32_mountfs:
|
||||||
__CDECL16_PROC_ENTRY
|
__CDECL16_PROC_ENTRY
|
||||||
.proc:
|
.proc:
|
||||||
; mount: parse BPB, derive fat0_lba, data_lba, cluster0_lba.
|
; mount: parse BPB, derive fat0_lba, data_lba, cluster0_lba.
|
||||||
|
|
||||||
.endp:
|
.endp:
|
||||||
__CDECL16_PROC_EXIT
|
__CDECL16_PROC_EXIT
|
||||||
ret
|
ret
|
||||||
@@ -138,7 +139,7 @@ FAT32_mountfs:
|
|||||||
ERROR STEVIA_DEBUG_ERR
|
ERROR STEVIA_DEBUG_ERR
|
||||||
|
|
||||||
|
|
||||||
; int fat32_read_fat(const fat32_bpb_t* v, uint32_t clus, uint32_t* out);
|
; int fat32_read_fat(FAT32_State_t* state, uint32_t clus, uint32_t* out);
|
||||||
FAT32_read_fat:
|
FAT32_read_fat:
|
||||||
__CDECL16_PROC_ENTRY
|
__CDECL16_PROC_ENTRY
|
||||||
.proc:
|
.proc:
|
||||||
@@ -153,7 +154,7 @@ FAT32_read_fat:
|
|||||||
; EOC if (val & 0x0FFFFFFF) >= 0x0FFFFFF8.
|
; EOC if (val & 0x0FFFFFFF) >= 0x0FFFFFF8.
|
||||||
; bad if == 0x0FFFFFF7.
|
; bad if == 0x0FFFFFF7.
|
||||||
; free if == 0x00000000.
|
; free if == 0x00000000.
|
||||||
; int fat32_next_clus(const fat32_bpb_t* v, uint32_t clus, uint32_t* out_next);
|
; int fat32_next_clus(FAT32_State_t* state, uint32_t clus, uint32_t* out_next);
|
||||||
FAT32_next_cluster:
|
FAT32_next_cluster:
|
||||||
__CDECL16_PROC_ENTRY
|
__CDECL16_PROC_ENTRY
|
||||||
.proc:
|
.proc:
|
||||||
@@ -165,7 +166,7 @@ FAT32_next_cluster:
|
|||||||
ERROR STEVIA_DEBUG_ERR
|
ERROR STEVIA_DEBUG_ERR
|
||||||
|
|
||||||
; e.g:
|
; e.g:
|
||||||
; uint64_t clus_to_lba(const fat32_bpb_t* v, uint32_t clus) {
|
; uint64_t clus_to_lba(FAT32_State_t* state, uint32_t clus) {
|
||||||
; return v->data_lba + (uint64_t)(clus - 2) * v->secs_per_clus;
|
; return v->data_lba + (uint64_t)(clus - 2) * v->secs_per_clus;
|
||||||
; }
|
; }
|
||||||
FAT32_clus_to_lba:
|
FAT32_clus_to_lba:
|
||||||
|
|||||||
@@ -195,20 +195,11 @@ endstruc
|
|||||||
|
|
||||||
; 32 bytes
|
; 32 bytes
|
||||||
struc FAT32_State_t
|
struc FAT32_State_t
|
||||||
.first_data_sector_32 resd 1
|
.u32_TotalClusters resd 1
|
||||||
.first_fat_sector_32 resd 1
|
.u32_DataAreaStartSector resd 1
|
||||||
.fat_size_32 resd 1
|
.u32_FATAreaStartSector resd 1
|
||||||
.curr_FAT_cluster_32 resd 1
|
.p16_FATBuffer resw 1
|
||||||
.curr_dir_cluster_32 resd 1
|
.p16_ClustBuffer resw 1
|
||||||
.curr_drive_lba_32 resd 1
|
|
||||||
endstruc
|
|
||||||
|
|
||||||
; 16 bytes
|
|
||||||
struc FAT32_NextClusterData_t
|
|
||||||
.fat_offset resd 1
|
|
||||||
.fat_sector resd 1
|
|
||||||
.entry_offset resd 1
|
|
||||||
.reserved_1 resd 1
|
|
||||||
endstruc
|
endstruc
|
||||||
|
|
||||||
; FAT32 Attributes
|
; FAT32 Attributes
|
||||||
|
|||||||
@@ -453,17 +453,19 @@ align 16, resb 1
|
|||||||
%define BIOSMemoryMap_SIZE 1024
|
%define BIOSMemoryMap_SIZE 1024
|
||||||
BIOSMemoryMap:
|
BIOSMemoryMap:
|
||||||
resb BIOSMemoryMap_SIZE
|
resb BIOSMemoryMap_SIZE
|
||||||
|
|
||||||
align 16, resb 1
|
|
||||||
stack_bottom:
|
|
||||||
resb 2048
|
|
||||||
stack_top:
|
|
||||||
end_bss:
|
end_bss:
|
||||||
|
; !!! End bss data !!!
|
||||||
|
%define STACK_SIZE 0x1000 ; 4 KiB
|
||||||
|
|
||||||
; Pad to the cap (emits nothing in the file; only increases .bss virtual size).
|
; Pad to the cap (emits nothing in the file; only increases .bss virtual size).
|
||||||
; If BSS_SIZE > BSS_MAX_BYTES, this becomes negative and NASM errors out.
|
; If BSS_SIZE > BSS_MAX_BYTES, this becomes negative and NASM errors out.
|
||||||
%define BSS_MAX_BYTES 0x2000
|
%define BSS_MAX_BYTES (0x2000 - STACK_SIZE)
|
||||||
resb (BSS_MAX_BYTES - (end_bss - begin_bss))
|
resb (BSS_MAX_BYTES - (end_bss - begin_bss))
|
||||||
|
|
||||||
|
align 16, resb 1
|
||||||
|
stack_bottom:
|
||||||
|
resb STACK_SIZE
|
||||||
|
stack_top:
|
||||||
|
|
||||||
; Optional: keep a label for later math:
|
; Optional: keep a label for later math:
|
||||||
bss_cap_end:
|
bss_cap_end:
|
||||||
Reference in New Issue
Block a user