summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAhmed S. Darwish <darwish.07@gmail.com>2011-03-06 14:21:31 +0200
committerH. Peter Anvin <hpa@linux.intel.com>2011-03-07 12:02:35 -0800
commitc987272b97ecb89db19ee438dba0c8c2418f8ffe (patch)
treedd74999c4020988d599dcd349164af4b71198a34
parent4686166dbaeb5c89672da6e48227f4e402b7bae8 (diff)
downloadsyslinux-c987272b97ecb89db19ee438dba0c8c2418f8ffe.tar.gz
core: Fix 'trackbuf' descriptor list byte lengthsyslinux-4.04-pre12
(Tested using a Linux bzImage, with and without an initrd.) Per shuffle_and_boot documentation, %ecx must contain the descriptor list byte length, but it's set with such list end address instead. Fix. Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r--core/bcopy32.inc2
-rw-r--r--core/bcopyxx.inc2
-rw-r--r--core/bootsect.inc8
-rw-r--r--core/runkernel.inc2
4 files changed, 10 insertions, 4 deletions
diff --git a/core/bcopy32.inc b/core/bcopy32.inc
index 6537546b..ab601452 100644
--- a/core/bcopy32.inc
+++ b/core/bcopy32.inc
@@ -65,6 +65,8 @@ bcopy: jecxz .ret
; If len == 0: this marks the end of the list; dst indicates
; the entry point and src the mode (0 = pm, 1 = rm)
;
+; (*) dst, src, and len are four bytes each
+;
shuffle_and_boot_raw:
mov bx,pm_shuffle
jmp enter_pm
diff --git a/core/bcopyxx.inc b/core/bcopyxx.inc
index c669b7a8..cfdda0bc 100644
--- a/core/bcopyxx.inc
+++ b/core/bcopyxx.inc
@@ -205,6 +205,8 @@ pm_bcopy:
; If len == 0: this marks the end of the list; dst indicates
; the entry point and src the mode (0 = pm, 1 = rm)
;
+; (*) dst, src, and len are four bytes each
+;
pm_shuffle:
cli ; End interrupt service (for good)
mov ebx,edi ; EBX <- descriptor list
diff --git a/core/bootsect.inc b/core/bootsect.inc
index b4402f1c..6c204096 100644
--- a/core/bootsect.inc
+++ b/core/bootsect.inc
@@ -169,7 +169,7 @@ replace_bootstrap_noclearmode:
mov [es:di+8],ax ; New DI
mov [es:di+4],bx ; New ES
%endif
- pop ax ; List length
+ pop ax ; descriptor list entries count
push di
push es
@@ -179,8 +179,8 @@ replace_bootstrap_noclearmode:
mov ebx,trackbuf
imul di,ax,12
+ push di ; length of list
add di,bx ; DI <- end of list
- push di
; Terminating entry...
lea eax,[replace_stub] ; Entrypoint
@@ -196,8 +196,10 @@ replace_bootstrap_noclearmode:
mov cx,__replacestub_dwords
rep movsd
+ ; ECX <- final list length
xor ecx,ecx
- pop cx ; ECX <- length of list
+ pop cx ; original length in bytes
+ add cx, 12 ; + termination entry size
pop word [replace_stub.ss]
pop word [replace_stub.esp]
diff --git a/core/runkernel.inc b/core/runkernel.inc
index 25b073ff..2e943465 100644
--- a/core/runkernel.inc
+++ b/core/runkernel.inc
@@ -453,7 +453,7 @@ setup_move:
.no_initrd:
push dword run_linux_kernel
- push cx ; Length of descriptor list
+ push cx ; descriptor list entries count
; BX points to the final real mode segment, and will be loaded
; into DS.