correct drive_num argument on read_disk_raw
This commit is contained in:
@@ -78,7 +78,7 @@ endstruc
|
|||||||
;
|
;
|
||||||
; uint8_t read_stage2_raw(uint16_t buf_segment, uint16_t buf_offset,
|
; uint8_t read_stage2_raw(uint16_t buf_segment, uint16_t buf_offset,
|
||||||
; uint32_t lba,
|
; uint32_t lba,
|
||||||
; uint16_t count, uint16_t drive_num)
|
; uint16_t count, uint8_t drive_num)
|
||||||
ALIGN 4, db 0x90
|
ALIGN 4, db 0x90
|
||||||
read_disk_raw:
|
read_disk_raw:
|
||||||
__CDECL16_ENTRY
|
__CDECL16_ENTRY
|
||||||
@@ -88,12 +88,12 @@ read_disk_raw:
|
|||||||
xor ax, ax
|
xor ax, ax
|
||||||
push ax ; val = 0
|
push ax ; val = 0
|
||||||
mov ax, lba_packet
|
mov ax, lba_packet
|
||||||
mov bx, ax
|
|
||||||
push ax ; dest = lba_packet address
|
push ax ; dest = lba_packet address
|
||||||
call kmemset
|
call kmemset
|
||||||
add sp, 0x06
|
add sp, 0x06
|
||||||
|
|
||||||
mov byte [bx + LBAPkt_t.size], 0x10
|
mov bx, lba_packet
|
||||||
|
mov byte [bx + LBAPkt_t.size], LBAPkt_t_size
|
||||||
|
|
||||||
mov ax, [bp + 12]
|
mov ax, [bp + 12]
|
||||||
mov word [bx + LBAPkt_t.xfer_size], ax
|
mov word [bx + LBAPkt_t.xfer_size], ax
|
||||||
@@ -104,7 +104,7 @@ read_disk_raw:
|
|||||||
mov ax, [bp + 6]
|
mov ax, [bp + 6]
|
||||||
mov word [bx + LBAPkt_t.offset], ax
|
mov word [bx + LBAPkt_t.offset], ax
|
||||||
|
|
||||||
mov ax, [bp + 4]
|
movzx ax, byte [bp + 4]
|
||||||
mov word [bx + LBAPkt_t.segment], ax
|
mov word [bx + LBAPkt_t.segment], ax
|
||||||
|
|
||||||
mov si, bx ; ds:si LBAPkt_t
|
mov si, bx ; ds:si LBAPkt_t
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ InitFATDriver:
|
|||||||
|
|
||||||
.calc_active_part:
|
.calc_active_part:
|
||||||
mov bx, [partition_offset_ptr]
|
mov bx, [partition_offset_ptr]
|
||||||
mov ax, [bx + 0]
|
mov ax, word [ds:bx]
|
||||||
|
|
||||||
mov dx, partition_table
|
mov dx, partition_table
|
||||||
add dx, ax ; dx points to the partition that was booted from
|
add dx, ax ; dx points to the partition that was booted from
|
||||||
@@ -93,14 +93,14 @@ SearchFATDIR:
|
|||||||
.load_first_dir:
|
.load_first_dir:
|
||||||
mov eax, dword [fat32_state + FAT32_State_t.active_dir_cluster_32]
|
mov eax, dword [fat32_state + FAT32_State_t.active_dir_cluster_32]
|
||||||
push dword eax ; cluster
|
push dword eax ; cluster
|
||||||
lea ax, [dir_buffer]
|
mov ax, dir_buffer
|
||||||
push ax ; offset
|
push ax ; offset
|
||||||
xor ax, ax
|
xor ax, ax
|
||||||
push ax ; segment
|
push ax ; segment
|
||||||
call ReadFATCluster ; uint8_t ReadFATCluster(uint16_t seg, uint16_t offset, uint32_t cluster)
|
call ReadFATCluster ; uint8_t ReadFATCluster(uint16_t seg, uint16_t offset, uint32_t cluster)
|
||||||
add sp, 0x8
|
add sp, 0x8
|
||||||
|
|
||||||
lea si, [dir_buffer]
|
mov si, dir_buffer
|
||||||
jmp SearchFATDIR.empty_dir_entry
|
jmp SearchFATDIR.empty_dir_entry
|
||||||
|
|
||||||
.load_next_dir:
|
.load_next_dir:
|
||||||
@@ -121,7 +121,7 @@ SearchFATDIR:
|
|||||||
mov eax, [fat32_state + FAT32_State_t.active_dir_cluster_32]
|
mov eax, [fat32_state + FAT32_State_t.active_dir_cluster_32]
|
||||||
push dword eax ; cluster
|
push dword eax ; cluster
|
||||||
|
|
||||||
lea ax, [dir_buffer]
|
mov ax, dir_buffer
|
||||||
push ax ; offset
|
push ax ; offset
|
||||||
|
|
||||||
xor ax, ax
|
xor ax, ax
|
||||||
@@ -129,7 +129,7 @@ SearchFATDIR:
|
|||||||
call ReadFATCluster ; uint8_t ReadFATCluster(uint16_t seg, uint16_t offset, uint32_t cluster)
|
call ReadFATCluster ; uint8_t ReadFATCluster(uint16_t seg, uint16_t offset, uint32_t cluster)
|
||||||
sub sp, 0x8
|
sub sp, 0x8
|
||||||
|
|
||||||
lea si, [dir_buffer]
|
mov si, dir_buffer
|
||||||
.empty_dir_entry:
|
.empty_dir_entry:
|
||||||
; check for 0x0 in first byte, if true then there are no more files
|
; check for 0x0 in first byte, if true then there are no more files
|
||||||
; if true we did not find the file, we should error here
|
; if true we did not find the file, we should error here
|
||||||
@@ -151,7 +151,7 @@ SearchFATDIR:
|
|||||||
; if we are at the end of the buffer, then load the next buffer
|
; if we are at the end of the buffer, then load the next buffer
|
||||||
add si, 0x20 ; 32 bytes
|
add si, 0x20 ; 32 bytes
|
||||||
|
|
||||||
lea ax, [dir_buffer]
|
mov ax, dir_buffer
|
||||||
add ax, 0x1FF ; 512 - 1 bytes
|
add ax, 0x1FF ; 512 - 1 bytes
|
||||||
cmp si, ax
|
cmp si, ax
|
||||||
jae SearchFATDIR.load_next_dir
|
jae SearchFATDIR.load_next_dir
|
||||||
@@ -169,7 +169,7 @@ SearchFATDIR:
|
|||||||
|
|
||||||
mov cx, 0xA ; max of 11 filename length of 11 characters
|
mov cx, 0xA ; max of 11 filename length of 11 characters
|
||||||
; si points to the start of the current directory entry
|
; si points to the start of the current directory entry
|
||||||
lea di, [BootTarget_str] ; current memory location (8.3 name is at offset 0)
|
mov di, BootTarget_str ; current memory location (8.3 name is at offset 0)
|
||||||
repe cmpsb ; compare the strings
|
repe cmpsb ; compare the strings
|
||||||
|
|
||||||
pop di
|
pop di
|
||||||
@@ -195,10 +195,8 @@ NextCluster:
|
|||||||
__CDECL16_ENTRY
|
__CDECL16_ENTRY
|
||||||
.func:
|
.func:
|
||||||
mov bx, [boot_drive_ptr]
|
mov bx, [boot_drive_ptr]
|
||||||
movzx ax, byte [bx + 0]
|
movzx ax, byte [ds:bx]
|
||||||
mov byte [bp - 2], al ; save boot drive as a local for easy access
|
mov byte [bp - 2], al ; save boot drive as a local for easy access
|
||||||
;movzx ax, byte [bx + 0] ; 67h override would probably work but this is the 16bit way to do it
|
|
||||||
;mov byte [bp - 2], al ; save boot drive as a local for easy access
|
|
||||||
|
|
||||||
mov edx, dword [bp + 4]
|
mov edx, dword [bp + 4]
|
||||||
mov si, fat32_nc_data
|
mov si, fat32_nc_data
|
||||||
@@ -237,6 +235,7 @@ NextCluster:
|
|||||||
add eax, ecx ; fat_sector + first_fat_sector
|
add eax, ecx ; fat_sector + first_fat_sector
|
||||||
mov dword [si + FAT32_NextClusterData_t.fat_sector], eax
|
mov dword [si + FAT32_NextClusterData_t.fat_sector], eax
|
||||||
.load_fat_table:
|
.load_fat_table:
|
||||||
|
__BOCHS_MAGIC_DEBUG
|
||||||
movzx ax, byte [bp - 2]
|
movzx ax, byte [bp - 2]
|
||||||
push ax
|
push ax
|
||||||
|
|
||||||
@@ -289,7 +288,7 @@ ReadFATCluster:
|
|||||||
__CDECL16_ENTRY
|
__CDECL16_ENTRY
|
||||||
.func:
|
.func:
|
||||||
mov bx, [boot_drive_ptr]
|
mov bx, [boot_drive_ptr]
|
||||||
movzx ax, byte [bx + 0]
|
movzx ax, byte [ds:bx]
|
||||||
mov byte [bp - 2], al ; save boot drive as a local for easy access
|
mov byte [bp - 2], al ; save boot drive as a local for easy access
|
||||||
|
|
||||||
mov dword eax, [bp + 8]
|
mov dword eax, [bp + 8]
|
||||||
|
|||||||
Reference in New Issue
Block a user