mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Fixed the EXT2/3 boot sector code so that it only uses the boot drive in the boot sector if it exists (i.e. not 0xff)
Otherwise it uses the boot drive passed in the DL register. Updated the EXT2/3 installer to reflect the changes in the boot sector code for EXT2/3. svn path=/trunk/; revision=4540
This commit is contained in:
parent
b4d0aca25a
commit
273b6dd69f
3 changed files with 23 additions and 9 deletions
|
@ -1,6 +1,6 @@
|
||||||
; EXT2.ASM
|
; EXT2.ASM
|
||||||
; EXT2 Boot Sector
|
; EXT2 Boot Sector
|
||||||
; Copyright (c) 2002 Brian Palmer
|
; Copyright (c) 2002, 2003 Brian Palmer
|
||||||
|
|
||||||
; [bp-0x04] Here we will store the number of sectors per track
|
; [bp-0x04] Here we will store the number of sectors per track
|
||||||
; [bp-0x08] Here we will store the number of heads
|
; [bp-0x08] Here we will store the number of heads
|
||||||
|
@ -62,8 +62,14 @@ main:
|
||||||
mov sp,7b00h ; Setup a stack
|
mov sp,7b00h ; Setup a stack
|
||||||
|
|
||||||
|
|
||||||
|
cmp BYTE [BYTE bp+BootDrive],BYTE 0xff ; If they have specified a boot drive then use it
|
||||||
|
jne GetDriveParameters
|
||||||
|
|
||||||
|
mov [BYTE bp+BootDrive],dl ; Save the boot drive
|
||||||
|
|
||||||
|
|
||||||
GetDriveParameters:
|
GetDriveParameters:
|
||||||
mov ax,0800h
|
mov ah,08h
|
||||||
mov dl,[BYTE bp+BootDrive] ; Get boot drive in dl
|
mov dl,[BYTE bp+BootDrive] ; Get boot drive in dl
|
||||||
int 13h ; Request drive parameters from the bios
|
int 13h ; Request drive parameters from the bios
|
||||||
jnc CalcDriveSize ; If the call succeeded then calculate the drive size
|
jnc CalcDriveSize ; If the call succeeded then calculate the drive size
|
||||||
|
@ -334,7 +340,9 @@ Done:
|
||||||
|
|
||||||
|
|
||||||
msgDiskError db 'Disk error',0
|
msgDiskError db 'Disk error',0
|
||||||
msgAnyKey db 'Press any key to restart',0
|
; Sorry, need the space...
|
||||||
|
;msgAnyKey db 'Press any key to restart',0
|
||||||
|
msgAnyKey db 'Press any key',0
|
||||||
|
|
||||||
times 509-($-$$) db 0 ; Pad to 509 bytes
|
times 509-($-$$) db 0 ; Pad to 509 bytes
|
||||||
|
|
||||||
|
@ -628,19 +636,19 @@ Ext2ReadDirectBlocksLoop:
|
||||||
; And reboots
|
; And reboots
|
||||||
PrintFileNotFound:
|
PrintFileNotFound:
|
||||||
mov si,msgFreeLdr ; FreeLdr not found message
|
mov si,msgFreeLdr ; FreeLdr not found message
|
||||||
jmp short DisplayAndRebootIt
|
jmp short DisplayItAndReboot
|
||||||
|
|
||||||
; Displays a file size is 0 error
|
; Displays a file size is 0 error
|
||||||
; And reboots
|
; And reboots
|
||||||
PrintFileSizeError:
|
PrintFileSizeError:
|
||||||
mov si,msgFileSize ; Error message
|
mov si,msgFileSize ; Error message
|
||||||
jmp short DisplayAndRebootIt
|
jmp short DisplayItAndReboot
|
||||||
|
|
||||||
; Displays a file is not a regular file error
|
; Displays a file is not a regular file error
|
||||||
; And reboots
|
; And reboots
|
||||||
PrintRegFileError:
|
PrintRegFileError:
|
||||||
mov si,msgRegFile ; Error message
|
mov si,msgRegFile ; Error message
|
||||||
DisplayAndRebootIt:
|
DisplayItAndReboot:
|
||||||
call PutChars ; Display it
|
call PutChars ; Display it
|
||||||
jmp Reboot
|
jmp Reboot
|
||||||
|
|
||||||
|
|
|
@ -111,8 +111,8 @@ int main(int argc, char *argv[])
|
||||||
printf("Cylinders: %d\n", Ext2DriveGeometry.cylinders);
|
printf("Cylinders: %d\n", Ext2DriveGeometry.cylinders);
|
||||||
printf("Start: %d\n", Ext2DriveGeometry.start);
|
printf("Start: %d\n", Ext2DriveGeometry.start);
|
||||||
|
|
||||||
Ext2BootCode->BootDrive = 0x80;
|
Ext2BootCode->BootDrive = 0xff;
|
||||||
Ext2BootCode->BootPartition = 0x05;
|
Ext2BootCode->BootPartition = 0x00;
|
||||||
//Ext2BootCode->SectorsPerTrack = Ext2DriveGeometry.sectors;
|
//Ext2BootCode->SectorsPerTrack = Ext2DriveGeometry.sectors;
|
||||||
//Ext2BootCode->NumberOfHeads = Ext2DriveGeometry.heads;
|
//Ext2BootCode->NumberOfHeads = Ext2DriveGeometry.heads;
|
||||||
Ext2BootCode->Ext2VolumeStartSector = Ext2DriveGeometry.start;
|
Ext2BootCode->Ext2VolumeStartSector = Ext2DriveGeometry.start;
|
||||||
|
|
|
@ -8,7 +8,7 @@ typedef struct
|
||||||
{
|
{
|
||||||
unsigned char JmpBoot[3];
|
unsigned char JmpBoot[3];
|
||||||
unsigned char BootDrive;
|
unsigned char BootDrive;
|
||||||
unsigned char BootPartition;
|
//unsigned char BootPartition;
|
||||||
//unsigned char SectorsPerTrack;
|
//unsigned char SectorsPerTrack;
|
||||||
//unsigned short NumberOfHeads;
|
//unsigned short NumberOfHeads;
|
||||||
//unsigned long Reserved1;
|
//unsigned long Reserved1;
|
||||||
|
@ -22,6 +22,12 @@ typedef struct
|
||||||
unsigned long Ext2FirstDataBlock; // First data block (1 for 1024-byte blocks, 0 for bigger sizes)
|
unsigned long Ext2FirstDataBlock; // First data block (1 for 1024-byte blocks, 0 for bigger sizes)
|
||||||
unsigned long Ext2InodesPerGroup; // Number of inodes per group
|
unsigned long Ext2InodesPerGroup; // Number of inodes per group
|
||||||
unsigned long Ext2InodesPerBlock; // Number of inodes per block
|
unsigned long Ext2InodesPerBlock; // Number of inodes per block
|
||||||
|
|
||||||
|
unsigned char BootCodeAndData[459];
|
||||||
|
|
||||||
|
unsigned char BootPartition;
|
||||||
|
unsigned short BootSignature;
|
||||||
|
|
||||||
} PACKED EXT2_BOOTCODE, *PEXT2_BOOTCODE;
|
} PACKED EXT2_BOOTCODE, *PEXT2_BOOTCODE;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue