;␊ |
; Turbo added EFI System Partition boot support␊ |
;␊ |
; Added KillerJK's switchPass2 modifications␊ |
;␊ |
␊ |
;␊ |
; Set to 1 to enable obscure debug messages.␊ |
|
␊ |
call loadBootSector␊ |
jne .continue␊ |
jmp␉ initBootLoader␊ |
jmp␉ SHORT initBootLoader␊ |
␊ |
.continue:␊ |
add si, part_size ␉␉␉; advance SI to next partition entry␊ |
add si, BYTE part_size␉␉␉␉; advance SI to next partition entry␊ |
loop .loop ␉␉ ␉; loop through all partition entries␊ |
␊ |
;␊ |
|
; for a possible GPT Header at LBA 1␊ |
; ␊ |
dec␉ bl␊ |
jz␉ checkGPT␉␉␉␉␉␉; found Protective MBR before␊ |
jnz .switchPass2␉␉␉␉␉; didn't find Protective MBR before␊ |
call checkGPT␉␉␉␉␉␉␊ |
␊ |
.switchPass2␊ |
;␊ |
; Switching to Pass 2 ␊ |
; try to find a boot1h aware HFS+ MBR partition␊ |
|
␊ |
.exit:␊ |
ret␉␉␉␉␉␉␉␉␉␉; Giving up.␊ |
␊ |
␊ |
;␊ |
; Jump to partition booter. The drive number is already in register DL.␊ |
; SI is pointing to the modified partition entry.␊ |
;␊ |
initBootLoader: ␊ |
␊ |
DebugChar('J')␊ |
␊ |
%if VERBOSE␊ |
LogString(done_str)␊ |
%endif␊ |
␊ |
jmp kBoot0LoadAddr␊ |
␊ |
␊ |
; ␊ |
; Found Protective MBR Partition Type: 0xEE␊ |
|
; of LBA1 for possible GPT Table Header␊ |
;␊ |
checkGPT:␊ |
␊ |
push bx␊ |
␉␊ |
mov␉ di, kLBA1Buffer␉␉␉␉␉␉; address of GUID Partition Table Header␊ |
cmp␉ DWORD [di], kGPTSignatureLow␉␉; looking for 'EFI '␊ |
jne␉ .exit␉␉␉␉␉␉␉␉; not found. Giving up.␊ |
|
loop .gpt_loop␉␉␉␉␉␉␉␉; loop through all partition entries␉␊ |
␊ |
.exit:␊ |
pop bx␊ |
ret␉␉␉␉␉␉␉␉␉␉␉␉; no more GUID partitions. Giving up.␊ |
␊ |
␊ |
DebugChar('J')␊ |
;␊ |
; Jump to partition booter. The drive number is already in register DL.␊ |
; SI is pointing to the modified partition entry.␊ |
;␊ |
initBootLoader: ␊ |
␊ |
%if VERBOSE␊ |
LogString(done_str)␊ |
%endif␊ |
␊ |
jmp kBoot0LoadAddr␊ |
␊ |
␊ |
;--------------------------------------------------------------------------␊ |
; loadBootSector - Load boot sector␊ |
;␊ |
|
␊ |
mov al, 3␊ |
mov bx, kBoot0LoadAddr␊ |
call load ; will not return on success␊ |
call load␊ |
jc error␊ |
␊ |
␉or␉␉dh, dh␊ |
|
xor ah, ah ; offset 3, must be 0␊ |
push ax ; offset 2, number of sectors␊ |
␊ |
push WORD 16 ; offset 0-1, packet size␊ |
; It pushes 2 bytes with a smaller opcode than if WORD was used␊ |
push BYTE 16 ; offset 0-1, packet size␊ |
␊ |
DebugChar('<')␊ |
%if DEBUG␊ |