com32: use xfer_buf_seg as the bounce buffer
authorH. Peter Anvin <hpa@zytor.com>
Tue, 14 Apr 2009 03:06:00 +0000 (20:06 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Tue, 14 Apr 2009 03:06:00 +0000 (20:06 -0700)
We cannot realistically realign comboot_seg without breaking com16
modules (which have the DOS-derived assumption that they own the rest
of low memory.)  However, we can use xfer_buf_seg as the com32 bounce
buffer, which allows us to retain the benefit of a 64K-aligned buffer.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
core/com32.inc
core/comboot.inc

index 9881ae0..3a762a6 100644 (file)
@@ -176,7 +176,7 @@ com32_call_start:
                push dword com32_cfarcall       ; Cfarcall entry point
                push dword com32_farcall        ; Farcall entry point
                push dword (1 << 16)            ; 64K bounce buffer
-               push dword (comboot_seg << 4)   ; Bounce buffer address
+               push dword (xfer_buf_seg << 4)  ; Bounce buffer address
                push dword com32_intcall        ; Intcall entry point
                push dword command_line         ; Command line pointer
                push dword 7                    ; Argument count
index 724af5f..c169414 100644 (file)
@@ -777,17 +777,14 @@ comapi_runkernel:
                mov [Kernel_EAX],eax
 
                ; It's not just possible, but quite likely, that ES:BX
-               ; points into real_mode_seg, so we need to exercise some
-               ; special care here... use xfer_buf_seg as an intermediary
+               ; points into real_mode_seg or xfer_buf_seg, so we
+               ; need to exercise some special care here... use
+               ; trackbuf as an intermediary
                push ds
-               push es
-               mov ax,xfer_buf_seg
                mov ds,P_ES
                mov si,P_BX
-               mov es,ax
-               xor di,di
+               mov di,trackbuf
                call strcpy
-               pop es
                pop ds
 
 %if IS_PXELINUX
@@ -799,18 +796,14 @@ comapi_runkernel:
 
 .finish:
                ; Copy the command line into its proper place
-               push ds
                push es
-               mov ax,xfer_buf_seg
                mov dx,real_mode_seg
-               mov ds,ax
                mov es,dx
-               xor si,si
+               mov si,trackbuf
                mov di,cmd_line_here
                call strcpy
                mov byte [es:di-1],' '          ; Simulate APPEND
                pop es
-               pop ds
                mov [CmdLinePtr],di
                mov word [CmdOptPtr],zero_string
                jmp kernel_good_saved