plat/msdos386: fix a few more issues with startup and stub code
- correctly calculate size of BSS area to clear - make realloc routine set both ds & es to point to new data segment - correctly initialize real mode flags when simulating real mode interrupt via DPMI - other minor fixes
This commit is contained in:
parent
95ed8ee484
commit
249e4b9069
|
@ -43,12 +43,12 @@ begtext:
|
||||||
! Clear BSS.
|
! Clear BSS.
|
||||||
|
|
||||||
mov edi, begbss
|
mov edi, begbss
|
||||||
mov ecx, endbss+1
|
mov ecx, endbss+3
|
||||||
sub ecx, edi
|
sub ecx, edi
|
||||||
shr ecx, 1
|
shr ecx, 2
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
cld
|
cld
|
||||||
rep stosw
|
rep stos
|
||||||
|
|
||||||
! It's now safe to switch stacks.
|
! It's now safe to switch stacks.
|
||||||
|
|
||||||
|
@ -63,10 +63,9 @@ begtext:
|
||||||
o16 mov ax, 0x0000
|
o16 mov ax, 0x0000
|
||||||
o16 mov cx, 1
|
o16 mov cx, 1
|
||||||
int 0x31 ! allocate LDT
|
int 0x31 ! allocate LDT
|
||||||
|
o16 mov (.doshandle), ax
|
||||||
mov es, ax
|
mov es, ax
|
||||||
o16 mov bx, ax
|
xchg ebx, eax
|
||||||
o16 mov (.doshandle), bx
|
|
||||||
mov es, bx
|
|
||||||
|
|
||||||
xor ecx, ecx
|
xor ecx, ecx
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
|
|
|
@ -148,6 +148,8 @@ exe_start:
|
||||||
mov bx, fs
|
mov bx, fs
|
||||||
mov dx, (pmemlen+0)
|
mov dx, (pmemlen+0)
|
||||||
mov cx, (pmemlen+2)
|
mov cx, (pmemlen+2)
|
||||||
|
sub dx, 1
|
||||||
|
sbb cx, 0
|
||||||
mov ax, 0x0008
|
mov ax, 0x0008
|
||||||
int 0x31 ! set segment limit
|
int 0x31 ! set segment limit
|
||||||
|
|
||||||
|
@ -227,7 +229,8 @@ exe_start:
|
||||||
! is running from. This can't happen from inside the 32-bit code itself
|
! is running from. This can't happen from inside the 32-bit code itself
|
||||||
! because it might move.
|
! because it might move.
|
||||||
!
|
!
|
||||||
! On entry, ds and ss are ignored. On exit, ds is set to the 32-bit segment.
|
! On entry, ds and ss are ignored. On exit, ds and es are set to the
|
||||||
|
! 32-bit segment.
|
||||||
! eax: new block size
|
! eax: new block size
|
||||||
realloc:
|
realloc:
|
||||||
cseg mov ds, (psegds)
|
cseg mov ds, (psegds)
|
||||||
|
@ -276,6 +279,7 @@ realloc:
|
||||||
cli ! atomically switch stacks back
|
cli ! atomically switch stacks back
|
||||||
mov ss, (dpmi_ss)
|
mov ss, (dpmi_ss)
|
||||||
o32 mov esp, (dpmi_ebp)
|
o32 mov esp, (dpmi_ebp)
|
||||||
|
mov es, (psegds32)
|
||||||
mov ds, (psegds32)
|
mov ds, (psegds32)
|
||||||
sti
|
sti
|
||||||
|
|
||||||
|
@ -321,6 +325,8 @@ interrupt:
|
||||||
mov (dpmi_edx), dx
|
mov (dpmi_edx), dx
|
||||||
mov (dpmi_esi), si
|
mov (dpmi_esi), si
|
||||||
mov (dpmi_edi), di
|
mov (dpmi_edi), di
|
||||||
|
pushf
|
||||||
|
pop (dpmi_flags)
|
||||||
mov ax, (rseg)
|
mov ax, (rseg)
|
||||||
mov (dpmi_ds), ax
|
mov (dpmi_ds), ax
|
||||||
mov (dpmi_ss), ax
|
mov (dpmi_ss), ax
|
||||||
|
|
Loading…
Reference in a new issue