;
replace_bootstrap_one:
- push word trackbuf ; Address of descriptor list
push word 1 ; Length of descriptor list
+ push word trackbuf ; Address of descriptor list
; Fall through
;
cmp dword [fs:bx], "$PnP"
jz .foundpnp
inc bx
- jnz .findpnp
+ cmp bx,-3 ; Don't get a segment overflow error!
+ jb .findpnp
jmp .donepnp ; No $PnP header found
.foundpnp:
movzx cx,byte [fs:bx+5] ; Size of $PnP header
%endif
.donepnp:
- pop ax ; Copy list count
pop bx ; Copy from...
+ pop ax ; Copy list count
cli
mov cx,es
Typical values are 682 and 1365.
-AX=0012h [3.05] Cleanup, shuffle and boot
+AX=0012h [3.40] Cleanup, shuffle and boot
Input: AX 0012h
DX derivative-specific flags (see function 000Ch)
ES:DI shuffle descriptor list (must be in low memory)
(except DS, ESI and EDX) and the stack will be set up as they
were set up by the PXE ROM.
+ This interface was probably broken before version 3.40.
+
AX=0013h [3.08] Idle loop call
Input: AX 0013h
; INT 22h AX=0012h Cleanup, shuffle and boot
;
comapi_shuffle:
- call comapi_cleanup
- mov cx,P_CX
- cmp cx,(2*trackbufsize)/12
+ cmp P_CX,(2*trackbufsize)/12
ja .error
+ call comapi_cleanup
+
+ mov cx, P_CX
push cx ; On stack: descriptor count
lea cx,[ecx+ecx*2] ; CX *= 3
; INT 22h AX=001Ah Cleanup, shuffle and boot to flat protected mode
;
comapi_shufflepm:
- call comapi_cleanup
- mov cx,P_CX
- cmp cx,(2*trackbufsize)/12
+ cmp P_CX,(2*trackbufsize)/12
ja .error
+ call comapi_cleanup
+
+ mov cx, P_CX
push cx ; On stack: descriptor count
lea cx,[ecx+ecx*2] ; CX *= 3
mov fs,P_DS
mov si,P_SI
- xor edi,edi
- mov di,PMTrampolineBuf
+ mov edi,PMTrampolineBuf
mov al,0B8h ; MOV EAX opcode
mov cx,9
.maketramp:
inc ax ; Next register opcode
fs movsd ; immediate value
loop .maketramp
- mov byte [di-9],0E9h ; Last opcode is JMP
- sub dword [di-8],edi ; Make JMP target relative
+ mov byte [di-5],0E9h ; Last opcode is JMP
+ sub [di-4],edi ; Make JMP target relative
mov dword [EntryPoint],trampoline_to_pm
xor bx,bx ; DS on entry