From 0a9bdf66956cff22f334c4f9db4e70c8fc5364ab Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Tue, 24 Oct 2006 16:40:45 -0700 Subject: [PATCH] When chainloading, set ES:DI to point to the $PnP ICS if available. Arguably these really should be kept from the original invocation instead of saved. This is doable for PXELINUX, but might be very hard to do for the disk-based ones. Think hard about it. --- bootsect.inc | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/bootsect.inc b/bootsect.inc index b1360a5..d52aefb 100644 --- a/bootsect.inc +++ b/bootsect.inc @@ -132,10 +132,39 @@ replace_bootstrap: pop di .stackok: - mov [es:di+28],edx - mov [es:di+12],esi - mov [es:di+6],bx + mov [es:di+28],edx ; New EDX + mov [es:di+12],esi ; New ESI + mov [es:di+6],bx ; New DS + ; Hunt for $PnP header if one exists + mov ax,0F000h + mov fs,ax + xor bx,bx +.findpnp: + cmp dword [fs:bx], "$PnP" + jz .foundpnp + inc bx + jnz .findpnp + jmp .donepnp ; No $PnP header found +.foundpnp: + movzx cx,byte [fs:bx+5] ; Size of $PnP header + cmp cl,21h + jb .findpnp ; Invalid $PnP header (too short) + push bx + xor ax,ax +.checkpnp: + add al,byte [fs:bx] + inc bx + loop .checkpnp + pop bx + and al,al + jnz .findpnp + + ; Found a valid $PnP header, point ES:DI to it + mov [es:di+8], bx ; New DI + mov [es:di+4], fs ; New ES + +.donepnp: pop ax ; Copy list count pop bx ; Copy from... -- 2.7.4