From f8a6f927525d1f0e1f7f71e2f1f18570c07a75a3 Mon Sep 17 00:00:00 2001 From: tkchia Date: Fri, 26 Aug 2022 17:28:25 +0000 Subject: [PATCH] plat/msdos386: fix: RM int 0x21 calls was clobbering high halves of esi and edi registers --- plat/msdos386/stub.s | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/plat/msdos386/stub.s b/plat/msdos386/stub.s index 184c14a89..2e31daa02 100644 --- a/plat/msdos386/stub.s +++ b/plat/msdos386/stub.s @@ -3,14 +3,8 @@ ! $State$ ! $Revision$ -! Declare segments (the order is important). +#include "libsysasm.h" -.sect .text -.sect .rom -.sect .data -.sect .bss - -.sect .text .use16 exe_header: .data2 0x5a4d ! magic number @@ -319,12 +313,12 @@ int21: o32 or ebx, 0x210000 ! Simulate interrupt in the high half of ebx. interrupt: - mov (dpmi_eax), ax - mov (dpmi_ebx), bx - mov (dpmi_ecx), cx - mov (dpmi_edx), dx - mov (dpmi_esi), si - mov (dpmi_edi), di + o32 mov (dpmi_eax), eax + o32 mov (dpmi_ebx), ebx + o32 mov (dpmi_ecx), ecx + o32 mov (dpmi_edx), edx + o32 mov (dpmi_esi), esi + o32 mov (dpmi_edi), edi pushf pop (dpmi_flags) mov ax, (rseg) @@ -340,12 +334,12 @@ interrupt: xor cx, cx int 0x31 ! simulate DOS interrupt pop es - o32 movzx eax, (dpmi_eax) - o32 movzx ebx, (dpmi_ebx) - o32 movzx ecx, (dpmi_ecx) - o32 movzx edx, (dpmi_edx) - o32 movzx esi, (dpmi_esi) - o32 movzx edi, (dpmi_edi) + o32 mov eax, (dpmi_eax) + o32 mov ebx, (dpmi_ebx) + o32 mov ecx, (dpmi_ecx) + o32 mov edx, (dpmi_edx) + o32 mov esi, (dpmi_esi) + o32 mov edi, (dpmi_edi) push (dpmi_flags) popf ret @@ -410,7 +404,6 @@ stack: .space 512 dosstack: -TRANSFER_BUFFER_SIZE = 32*1024 transfer_buffer: .space TRANSFER_BUFFER_SIZE