* We can't access stage1 data in stage2, as we don't know the offset to use

(where the BIOS loads the stage1 part to).
* Therefore, I moved the BIOS drive to the stack, and now the boot menu finally
  actually works.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40167 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2011-01-08 21:24:54 +00:00
parent ac53d7af3c
commit 89f0e174b0

View File

@ -173,6 +173,7 @@ struc Locals
cursorX resb 1 cursorX resb 1
cursorY resb 1 cursorY resb 1
cursorShape resw 1 cursorShape resw 1
biosDrive resb 1
endstruc endstruc
cursorPosition equ cursorX cursorPosition equ cursorX
@ -257,7 +258,7 @@ stage1:
mov sp, 0xFFFF - sizeof(Locals) ; Make stack empty mov sp, 0xFFFF - sizeof(Locals) ; Make stack empty
mov bp, sp mov bp, sp
mov [bootDrive], dl ; Store boot drive mov [bp + biosDrive], dl ; Store boot drive
cld ; String operations increment index cld ; String operations increment index
; registers ; registers
CLEAR_SCREEN CLEAR_SCREEN
@ -283,7 +284,7 @@ stage1:
; Chain load rest of boot loader ; Chain load rest of boot loader
mov ah, EXTENDED_READ ; Load 3 more sectors mov ah, EXTENDED_READ ; Load 3 more sectors
mov dl, [bootDrive] mov dl, [bp + biosDrive]
mov si, nextStageDAP mov si, nextStageDAP
int BIOS_DISK_SERVICES int BIOS_DISK_SERVICES
jc .error ; I/O error jc .error ; I/O error
@ -298,7 +299,7 @@ stage1:
mov ah, READ_CHAR mov ah, READ_CHAR
int BIOS_KEYBOARD_SERVICES int BIOS_KEYBOARD_SERVICES
mov dl, [bootDrive] mov dl, [bp + biosDrive]
int BIOS_REBOOT int BIOS_REBOOT
printStringStage1: printStringStage1:
@ -328,9 +329,6 @@ nextStageDAP:
at AddressPacket.offset, dw 1 at AddressPacket.offset, dw 1
iend iend
bootDrive:
db 0
kTitle: kTitle:
db TITLE, 0x00 db TITLE, 0x00
kSelectOSMessage: kSelectOSMessage:
@ -357,7 +355,7 @@ kMBRSignature:
; ======================= SECOND SECTOR ================================ ; ======================= SECOND SECTOR ================================
; ====================================================================== ; ======================================================================
; Use code available in stage 1 ; Use code available in stage 2
%define printstr printStringStage2 %define printstr printStringStage2
%assign TIMEOUT_OFF 0xffff %assign TIMEOUT_OFF 0xffff
@ -609,7 +607,7 @@ getSelectedBootLoaderAddress:
jz .takeOverBootDrive jz .takeOverBootDrive
ret ret
.takeOverBootDrive: .takeOverBootDrive:
mov dl, [bootDrive] mov dl, [bp + biosDrive]
mov [si], dl mov [si], dl
ret ret