mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-13 11:09:13 +02:00
* 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 -
This commit is contained in:
parent
cd6b15f49a
commit
3164a10d9d
@ -147,15 +147,14 @@ cpu_detect_done:
|
|||||||
; allocate max heap
|
; allocate max heap
|
||||||
; TODO: also support user specified heap size
|
; TODO: also support user specified heap size
|
||||||
; try to resize our main DOS memory block until the end of the data segment
|
; try to resize our main DOS memory block until the end of the data segment
|
||||||
%ifdef __TINY__
|
|
||||||
mov cx, cs
|
|
||||||
mov dx, 1000h ; 64kb in paragraphs
|
|
||||||
%else
|
|
||||||
mov cx, word [dos_psp]
|
mov cx, word [dos_psp]
|
||||||
|
%ifdef __TINY__
|
||||||
|
mov dx, cs
|
||||||
|
%else
|
||||||
mov dx, dgroup
|
mov dx, dgroup
|
||||||
|
%endif
|
||||||
sub dx, cx ; dx = (ds - psp) in paragraphs
|
sub dx, cx ; dx = (ds - psp) in paragraphs
|
||||||
add dx, 1000h ; 64kb in paragraphs
|
add dx, 1000h ; 64kb in paragraphs
|
||||||
%endif
|
|
||||||
|
|
||||||
; get our MCB size in paragraphs
|
; get our MCB size in paragraphs
|
||||||
dec cx
|
dec cx
|
||||||
|
Loading…
Reference in New Issue
Block a user