aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2006-10-24 16:40:45 -0700
committerH. Peter Anvin <hpa@zytor.com>2006-10-24 16:40:45 -0700
commit0a9bdf66956cff22f334c4f9db4e70c8fc5364ab (patch)
treed5d6240bd67b22340ed9b442c94becf511a8cbc6
parent06194a9dc9b93997146f59b0065847fa7c48f265 (diff)
downloadsyslinux.git-0a9bdf66956cff22f334c4f9db4e70c8fc5364ab.tar.gz
syslinux.git-0a9bdf66956cff22f334c4f9db4e70c8fc5364ab.tar.xz
syslinux.git-0a9bdf66956cff22f334c4f9db4e70c8fc5364ab.zip
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.
-rw-r--r--bootsect.inc35
1 files changed, 32 insertions, 3 deletions
diff --git a/bootsect.inc b/bootsect.inc
index b1360a57..d52aefba 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...