Jelajahi Sumber

* fixed a bug in the startup code for tiny memory model, which caused the
program MCB address not to be calculated correctly, when the program is a tiny
model .exe file, leading to possible memory corruption. Previously, the code
assumed that dos_psp=CS, but that's only true for tiny .com files; tiny .exe
files have a 256-byte gap between dos_psp and CS.

git-svn-id: trunk@28032 -

nickysn 11 tahun lalu
induk
melakukan
3164a10d9d
1 mengubah file dengan 3 tambahan dan 4 penghapusan
  1. 3 4
      rtl/msdos/prt0comn.asm

+ 3 - 4
rtl/msdos/prt0comn.asm

@@ -147,15 +147,14 @@ cpu_detect_done:
         ; allocate max heap
         ; TODO: also support user specified heap size
         ; try to resize our main DOS memory block until the end of the data segment
+        mov cx, word [dos_psp]
 %ifdef __TINY__
-        mov cx, cs
-        mov dx, 1000h  ; 64kb in paragraphs
+        mov dx, cs
 %else
-        mov cx, word [dos_psp]
         mov dx, dgroup
+%endif
         sub dx, cx  ; dx = (ds - psp) in paragraphs
         add dx, 1000h  ; 64kb in paragraphs
-%endif
 
          ; get our MCB size in paragraphs
         dec cx