[BOOTSECTORS]: Sync the .asm files with their .S counterparts (make easier for diff'ing).

svn path=/trunk/; revision=70431
This commit is contained in:
Hermès Bélusca-Maïto
2015-12-26 20:43:50 +00:00
parent 654e3f7743
commit 631d55b60c
6 changed files with 41 additions and 39 deletions
+1 -1
View File
@@ -29,7 +29,7 @@
// of the PutChars function in the boot sector.
//
// When it locates freeldr.sys on the disk it will
// load the first sector of the file to 0000:8000
// load the first sector of the file to 0000:F800
// With the help of this sector we should be able
// to load the entire file off the disk, no matter
// how fragmented it is.
+11 -13
View File
@@ -29,7 +29,7 @@
; of the PutChars function in the boot sector.
;
; When it locates freeldr.sys on the disk it will
; load the first sector of the file to 0000:8000
; load the first sector of the file to 0000:F800
; With the help of this sector we should be able
; to load the entire file off the disk, no matter
; how fragmented it is.
@@ -187,12 +187,12 @@ SearchRootDirSector:
FoundFreeLoader:
; We found freeldr.sys on the disk
; so we need to load the first 512
; bytes of it to 0000:8000
; bytes of it to 0000:F800
; ES:DI has dir entry (ES:DI == 07E0:XXXX)
mov ax,WORD [es:di+1ah] ; Get start cluster
push ax ; Save start cluster
push WORD 800h ; Put 800h on the stack and load it
pop es ; Into ES so that we load the cluster at 0000:8000
push WORD 0F80h ; FREELDR_BASE / 16 ; Put load segment on the stack and load it
pop es ; Into ES so that we load the cluster at 0000:F800
call ReadCluster ; Read the cluster
pop ax ; Restore start cluster of FreeLoader
@@ -204,16 +204,14 @@ FoundFreeLoader:
; Now AX has start cluster of FreeLoader and we
; have loaded the helper code in the first 512 bytes
; of FreeLoader to 0000:8000. Now transfer control
; of FreeLoader to 0000:F800. Now transfer control
; to the helper code. Skip the first three bytes
; because they contain a jump instruction to skip
; over the helper code in the FreeLoader image.
;jmp 0000:9003h
push 0 ; push segment (0x0000)
mov bx, [0x8000 + 0xA8] ; load the RVA of the EntryPoint into eax
add bx, 0x8003 ; RVA -> VA and skip 3 bytes (jump to fathelper code)
push bx ; push offset
retf ; Transfer control to FreeLoader
;ljmp16 0, FREELDR_BASE + 3
db 0EAh
dw 0F803h
dw 0
@@ -225,8 +223,8 @@ ErrBoot:
call PutChars ; Display it
Reboot:
mov si,msgAnyKey ; Press any key message
call PutChars ; Display it
; mov si,msgAnyKey ; Press any key message
; call PutChars ; Display it
xor ax,ax
int 16h ; Wait for a keypress
int 19h ; Reboot
+1 -1
View File
@@ -400,7 +400,7 @@ LoadFile:
cmp eax, HEX(0ffffff8) // Check to see if this is the last cluster in the chain
jae LoadFileDone // If so continue, if not then read the next one
push eax
xor bx, bx // Load ROSLDR starting at 0000:8000h
xor bx, bx // Load ROSLDR starting at 0000:F800h
push es
call ReadCluster
pop es
+7 -7
View File
@@ -361,14 +361,14 @@ CheckEndCluster:
jmp PrintFileSystemError ; If so exit with error
InitializeLoadSegment:
mov bx,800h
mov bx,0F80h ; FREELDR_BASE / 16
mov es,bx
LoadFile:
cmp eax,0ffffff8h ; Check to see if this is the last cluster in the chain
jae LoadFileDone ; If so continue, if not then read the next one
push eax
xor bx,bx ; Load ROSLDR starting at 0000:8000h
xor bx,bx ; Load ROSLDR starting at 0000:F800h
push es
call ReadCluster
pop es
@@ -391,11 +391,11 @@ LoadFileDone:
mov dl,[BYTE bp+BootDrive] ; Load boot drive into DL
mov dh,[BootPartition] ; Load boot partition into DH
push 0 ; push segment (0x0000)
mov eax, [0x8000 + 0xA8] ; load the RVA of the EntryPoint into eax
add eax, 0x8000 ; RVA -> VA
push ax ; push offset
retf ; Transfer control to FreeLoader
; Transfer execution to the bootloader
;ljmp16 0, FREELDR_BASE
db 0EAh
dw 0F800h
dw 0
; Returns the FAT entry for a given cluster number
; On entry EAX has cluster number
+10 -8
View File
@@ -360,7 +360,10 @@ get_fs_structures:
call crlf
%endif
mov bx, 0x8000 ; bx = load address
; use high segment, as some bios can fail, when offset is too big
mov bx, 0x0F80 ; FREELDR_BASE / 16 ; es = load segment
mov es, bx
xor ebx, ebx ; bx = load offset
mov si, di ; restore file pointer
mov cx, 0xFFFF ; load the whole file
call getfssec ; get the whole file
@@ -373,13 +376,12 @@ get_fs_structures:
mov dl, [DriveNo] ; dl = boot drive
mov dh, 0 ; dh = boot partition
push 0 ; push segment (0x0000)
mov eax, [0x8000 + 0xA8] ; load the RVA of the EntryPoint into eax
add eax, 0x8000 ; RVA -> VA
push ax ; push offset
retf ; Transfer control to ROSLDR
; Transfer execution to the bootloader
;ljmp16 0, FREELDR_BASE
db 0xEA
dw 0xF800
dw 0
;
; searchdir:
@@ -944,7 +946,7 @@ findfail_msg: db 'Failed to find file!', 0
startldr_msg: db 'Starting SETUPLDR.SYS', 0
%endif
nosecsize_msg: db 'No sector size, assume 0800', CR, LF, 0
; nosecsize_msg: db 'No sector size, assume 0800', CR, LF, 0
spec_err_msg: db 'Load spec failed, trying wing ...', CR, LF, 0
maybe_msg: db 'Found smth at drive = ', 0
alright_msg: db 'might be ok, continuing...', CR, LF, 0
+11 -9
View File
@@ -332,7 +332,10 @@ get_fs_structures:
call crlf
%endif
mov bx, 0x8000 ; bx = load address
; use high segment, as some bios can fail, when offset is too big
mov bx, 0x0F80 ; FREELDR_BASE / 16 ; es = load segment
mov es, bx
xor ebx, ebx ; bx = load offset
mov si, di ; restore file pointer
mov cx, 0xFFFF ; load the whole file
call getfssec ; get the whole file
@@ -345,13 +348,12 @@ get_fs_structures:
mov dl, [DriveNo] ; dl = boot drive
mov dh, 0 ; dh = boot partition
push 0 ; push segment (0x0000)
mov eax, [0x8000 + 0xA8] ; load the RVA of the EntryPoint into eax
add eax, 0x8000 ; RVA -> VA
push ax ; push offset
retf ; Transfer control to ROSLDR
; Transfer execution to the bootloader
;ljmp16 0, FREELDR_BASE
db 0xEA
dw 0xF800
dw 0
;
; searchdir:
@@ -892,7 +894,7 @@ getchar:
isolinux_banner db CR, LF, 'Loading IsoBoot...', CR, LF, 0
copyright_str db ' Copyright (C) 1994-2002 H. Peter Anvin', CR, LF, 0
copyright_str db ' (C) 1994-2002 H. Peter Anvin', CR, LF, 0
presskey_msg db 'Press any key to boot from CD', 0
dot_msg db '.',0
@@ -910,7 +912,7 @@ findfail_msg: db 'Failed to find file!', 0
startldr_msg: db 'Starting SETUPLDR.SYS', 0
%endif
nosecsize_msg: db 'Failed to get sector size, assuming 0800', CR, LF, 0
; nosecsize_msg: db 'Failed to get sector size, assuming 0800', CR, LF, 0
spec_err_msg: db 'Loading spec packet failed, trying to wing it...', CR, LF, 0
maybe_msg: db 'Found something at drive = ', 0
alright_msg: db 'Looks like it might be right, continuing...', CR, LF, 0