mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-27 12:10:36 +02:00
Merge forgotten go32v2 2.6.0 branch changes back into trunk.
------------------------------------------------------------------------ r20577 | pierre | 2012-03-22 16:35:26 +0100 (Thu, 22 Mar 2012) | 4 lines // * Provide both environ and _environ inside startup file // to avoid loading of old or new crt1.o object from DJGPP libc. // Not merged as this is now treated in linker script. * Make some labels local to be able to get a complete disassembly of start function using GDB. ------------------------------------------------------------------------ git-svn-id: trunk@24231 -
This commit is contained in:
parent
57c5821042
commit
7b411e70b8
@ -111,11 +111,11 @@ start:
|
|||||||
movw %ds, %bx
|
movw %ds, %bx
|
||||||
movw $0x000a, %ax
|
movw $0x000a, %ax
|
||||||
int $0x31
|
int $0x31
|
||||||
jnc ds_alias_ok
|
jnc .Lds_alias_ok
|
||||||
movb $0x4c, %ah
|
movb $0x4c, %ah
|
||||||
int $0x21
|
int $0x21
|
||||||
|
|
||||||
ds_alias_ok:
|
.Lds_alias_ok:
|
||||||
movw %ax, ___v2prt0_ds_alias
|
movw %ax, ___v2prt0_ds_alias
|
||||||
movl %eax, %ebx
|
movl %eax, %ebx
|
||||||
movw $0x0009, %ax
|
movw $0x0009, %ax
|
||||||
@ -149,11 +149,11 @@ ds_alias_ok:
|
|||||||
shrl $4, %ebx
|
shrl $4, %ebx
|
||||||
movw $0x0100, %ax
|
movw $0x0100, %ax
|
||||||
int $0x31
|
int $0x31
|
||||||
jnc dos_alloc_ok
|
jnc .Ldos_alloc_ok
|
||||||
movb $0x4c, %ah
|
movb $0x4c, %ah
|
||||||
int $0x21
|
int $0x21
|
||||||
|
|
||||||
dos_alloc_ok:
|
.Ldos_alloc_ok:
|
||||||
movw %cs, 2(%esi)
|
movw %cs, 2(%esi)
|
||||||
/* store API information */
|
/* store API information */
|
||||||
movw %ds, 4(%esi)
|
movw %ds, 4(%esi)
|
||||||
@ -234,14 +234,14 @@ dos_alloc_ok:
|
|||||||
.byte 0x64 /* fs: */
|
.byte 0x64 /* fs: */
|
||||||
movl STUBINFO_MINSTACK, %ecx /* get stub-requested stack size */
|
movl STUBINFO_MINSTACK, %ecx /* get stub-requested stack size */
|
||||||
cmpl %ecx, %eax
|
cmpl %ecx, %eax
|
||||||
jge use_stubinfo_stack_size /* use the larger of the two */
|
jge .Luse_stubinfo_stack_size /* use the larger of the two */
|
||||||
movl %ecx, %eax
|
movl %ecx, %eax
|
||||||
movl %eax, __stklen /* store the actual stack length */
|
movl %eax, __stklen /* store the actual stack length */
|
||||||
use_stubinfo_stack_size:
|
.Luse_stubinfo_stack_size:
|
||||||
pushl %eax
|
pushl %eax
|
||||||
call ___sbrk /* allocate the memory */
|
call ___sbrk /* allocate the memory */
|
||||||
cmpl $-1, %eax
|
cmpl $-1, %eax
|
||||||
je no_memory
|
je .Lno_memory
|
||||||
movl %eax, ___djgpp_stack_limit /* Bottom of stack */
|
movl %eax, ___djgpp_stack_limit /* Bottom of stack */
|
||||||
addl $256,%eax
|
addl $256,%eax
|
||||||
movl %eax,__stkbottom /* for stack checks */
|
movl %eax,__stkbottom /* for stack checks */
|
||||||
@ -262,7 +262,7 @@ use_stubinfo_stack_size:
|
|||||||
call ___prt1_startup /* run program */
|
call ___prt1_startup /* run program */
|
||||||
jmp exit
|
jmp exit
|
||||||
|
|
||||||
no_memory:
|
.Lno_memory:
|
||||||
movb $0xff, %al
|
movb $0xff, %al
|
||||||
jmp exit
|
jmp exit
|
||||||
|
|
||||||
@ -288,11 +288,11 @@ exit:
|
|||||||
movw %ax,%fs
|
movw %ax,%fs
|
||||||
movw %ax,%gs
|
movw %ax,%gs
|
||||||
cmpl $0,_exception_exit
|
cmpl $0,_exception_exit
|
||||||
jz no_exception
|
jz .Lno_exception
|
||||||
pushl %ecx
|
pushl %ecx
|
||||||
call *_exception_exit
|
call *_exception_exit
|
||||||
popl %ecx
|
popl %ecx
|
||||||
no_exception:
|
.Lno_exception:
|
||||||
cli /* Just in case they didn't unhook ints */
|
cli /* Just in case they didn't unhook ints */
|
||||||
FREESEL operatingsystem_go32_info_block+26 /* selector for linear memory */
|
FREESEL operatingsystem_go32_info_block+26 /* selector for linear memory */
|
||||||
FREESEL ___v2prt0_ds_alias /* DS alias for rmcb exceptions */
|
FREESEL ___v2prt0_ds_alias /* DS alias for rmcb exceptions */
|
||||||
@ -360,13 +360,13 @@ ___sbrk:
|
|||||||
movl __what_size_app_thinks_it_is, %eax
|
movl __what_size_app_thinks_it_is, %eax
|
||||||
movl 4(%esp), %ecx /* Increment size */
|
movl 4(%esp), %ecx /* Increment size */
|
||||||
addl %ecx, %eax
|
addl %ecx, %eax
|
||||||
jnc brk_common
|
jnc .Lbrk_common
|
||||||
/* Carry is only set if a negative increment or wrap happens. Negative
|
/* Carry is only set if a negative increment or wrap happens. Negative
|
||||||
increment is semi-OK, wrap (only for multiple zone sbrk) isn't. */
|
increment is semi-OK, wrap (only for multiple zone sbrk) isn't. */
|
||||||
test $0x80000000, %ecx /* Clears carry */
|
test $0x80000000, %ecx /* Clears carry */
|
||||||
jnz brk_common
|
jnz .Lbrk_common
|
||||||
stc /* Put carry back */
|
stc /* Put carry back */
|
||||||
jmp brk_common
|
jmp .Lbrk_common
|
||||||
|
|
||||||
.globl ___brk
|
.globl ___brk
|
||||||
.align 2
|
.align 2
|
||||||
@ -374,7 +374,7 @@ ___brk:
|
|||||||
movl 4(%esp), %eax
|
movl 4(%esp), %eax
|
||||||
clc
|
clc
|
||||||
|
|
||||||
brk_common:
|
.Lbrk_common:
|
||||||
pushl %esi
|
pushl %esi
|
||||||
pushl %edi
|
pushl %edi
|
||||||
pushl %ebx
|
pushl %ebx
|
||||||
@ -386,7 +386,7 @@ brk_common:
|
|||||||
/* multi code is not present */
|
/* multi code is not present */
|
||||||
/* jc 10f Wrap for multi-zone */
|
/* jc 10f Wrap for multi-zone */
|
||||||
cmpl __what_size_dpmi_thinks_we_are, %eax /* don't bother shrinking */
|
cmpl __what_size_dpmi_thinks_we_are, %eax /* don't bother shrinking */
|
||||||
jbe brk_nochange
|
jbe .Lbrk_nochange
|
||||||
|
|
||||||
addl $0x0000ffff, %eax /* round up to 64K block */
|
addl $0x0000ffff, %eax /* round up to 64K block */
|
||||||
andl $0xffff0000, %eax
|
andl $0xffff0000, %eax
|
||||||
@ -409,7 +409,7 @@ brk_common:
|
|||||||
|
|
||||||
test %dl,%dl
|
test %dl,%dl
|
||||||
popl %edx
|
popl %edx
|
||||||
jne brk_error
|
jne .Lbrk_error
|
||||||
|
|
||||||
movl %edi, ___djgpp_memory_handle_list /* store new handle */
|
movl %edi, ___djgpp_memory_handle_list /* store new handle */
|
||||||
movw %si, ___djgpp_memory_handle_list+2
|
movw %si, ___djgpp_memory_handle_list+2
|
||||||
@ -456,7 +456,7 @@ brk_common:
|
|||||||
movl ___djgpp_selector_limit, %edx
|
movl ___djgpp_selector_limit, %edx
|
||||||
12: incl %edx /* Size not limit */
|
12: incl %edx /* Size not limit */
|
||||||
testb $0x60, __crt0_startup_flags /* include/crt0.h */
|
testb $0x60, __crt0_startup_flags /* include/crt0.h */
|
||||||
jz no_fill_sbrk_memory
|
jz .Lno_fill_sbrk_memory
|
||||||
pushl %ds
|
pushl %ds
|
||||||
popl %es
|
popl %es
|
||||||
|
|
||||||
@ -465,26 +465,26 @@ brk_common:
|
|||||||
subl %edi, %ecx /* Adjust count for base */
|
subl %edi, %ecx /* Adjust count for base */
|
||||||
xorl %eax, %eax
|
xorl %eax, %eax
|
||||||
testb $0x40, __crt0_startup_flags
|
testb $0x40, __crt0_startup_flags
|
||||||
jz no_deadbeef
|
jz .Lno_deadbeef
|
||||||
movl $0xdeadbeef, %eax /* something really easy to spot */
|
movl $0xdeadbeef, %eax /* something really easy to spot */
|
||||||
no_deadbeef:
|
.Lno_deadbeef:
|
||||||
shrl $2, %ecx /* div 4 Longwords not bytes */
|
shrl $2, %ecx /* div 4 Longwords not bytes */
|
||||||
cld
|
cld
|
||||||
rep
|
rep
|
||||||
stosl
|
stosl
|
||||||
no_fill_sbrk_memory:
|
.Lno_fill_sbrk_memory:
|
||||||
movl %edx, __what_size_dpmi_thinks_we_are
|
movl %edx, __what_size_dpmi_thinks_we_are
|
||||||
|
|
||||||
brk_nochange: /* successful return */
|
.Lbrk_nochange: /* successful return */
|
||||||
movl __what_we_return_to_app_as_old_size, %eax
|
movl __what_we_return_to_app_as_old_size, %eax
|
||||||
jmp brk_return
|
jmp .Lbrk_return
|
||||||
|
|
||||||
brk_error: /* error return */
|
.Lbrk_error: /* error return */
|
||||||
movl __what_we_return_to_app_as_old_size, %eax
|
movl __what_we_return_to_app_as_old_size, %eax
|
||||||
movl %eax, __what_size_app_thinks_it_is
|
movl %eax, __what_size_app_thinks_it_is
|
||||||
movl $0, %eax
|
movl $0, %eax
|
||||||
|
|
||||||
brk_return:
|
.Lbrk_return:
|
||||||
popl %ebx
|
popl %ebx
|
||||||
popl %edi
|
popl %edi
|
||||||
popl %esi
|
popl %esi
|
||||||
|
Loading…
Reference in New Issue
Block a user