* Remove use of direct U_UNIT_NAME or TC_UNIT_NAME

symbols in assembler sources.
  Added to corresponding system variables or typed constants a
  public name 'operatingsystem_XXX' alias and used that alias in assembler
  source.

git-svn-id: trunk@18943 -
This commit is contained in:
pierre 2011-09-02 12:51:48 +00:00
parent a127c411b2
commit f0aa48b083
20 changed files with 100 additions and 95 deletions

View File

@ -72,10 +72,10 @@ var
memw : array[0..($7fffffff div sizeof(word))-1] of word absolute $0:$0;
meml : array[0..($7fffffff div sizeof(longint))-1] of longint absolute $0:$0;
{ C-compatible arguments and environment }
argc : longint;
argv : ppchar;
envp : ppchar;
dos_argv0 : pchar;
argc:longint;public name 'operatingsystem_parameter_argc';
argv:PPchar;public name 'operatingsystem_parameter_argv';
envp:PPchar;public name 'operatingsystem_parameter_envp';
dos_argv0 : pchar; public name 'dos_argv0';
AllFilesMask: string [3];
@ -125,8 +125,8 @@ type
end;
var
stub_info : p_stub_info;
go32_info_block : t_go32_info_block;
stub_info : p_stub_info; public name 'operatingsystem_stub_info';
go32_info_block : t_go32_info_block; public name 'operatingsystem_go32_info_block';
{$ifdef SYSTEMDEBUG}
const
accept_sbrk : boolean = true;

View File

@ -217,7 +217,7 @@ dos_alloc_ok:
pushl %eax
call ___sbrk
movl %eax, __stubinfo
movl %eax,U_SYSTEM_STUB_INFO
movl %eax,operatingsystem_stub_info
movl %eax, %edi
.byte 0x64 /* fs: */
movl STUBINFO_SIZE, %ecx
@ -245,7 +245,11 @@ use_stubinfo_stack_size:
movl %eax, ___djgpp_stack_limit /* Bottom of stack */
addl $256,%eax
movl %eax,__stkbottom /* for stack checks */
movl %eax,U_SYSTEM_STACKBOTTOM
/* movl %eax,operatingsystem_stackbottom */
/* StackBottom is
a ThrteadVar and can not be given a symbol with name,
copying value of __stkbottom to system.STackBottom variable
is done in system unit startup code. PM */
movl ___djgpp_stack_limit,%eax /* Bottom of stack */
addl __stklen, %eax
@ -290,7 +294,7 @@ exit:
popl %ecx
no_exception:
cli /* Just in case they didn't unhook ints */
FREESEL U_SYSTEM_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 sbrk16_api_seg /* sbrk cs */
movw sbrk16_first_byte+6,%dx /* selector for allocated DOS mem */
@ -632,12 +636,12 @@ _setup_core_selector:
/* addl $4,%esp */
cmpl $-1,%eax
jne .L24
movw $0,U_SYSTEM_GO32_INFO_BLOCK+26
movw $0,operatingsystem_go32_info_block+26
leave
ret
.align 2,0x90
.L24:
movw %ax,U_SYSTEM_GO32_INFO_BLOCK+26
movw %ax,operatingsystem_go32_info_block+26
movw %ax,_core_selector
pushl $0x10ffff
andl $0xffff,%eax
@ -650,7 +654,7 @@ _setup_core_selector:
_setup_screens:
pushl %ebp
movl %esp,%ebp
movw U_SYSTEM_GO32_INFO_BLOCK+26,%dx
movw operatingsystem_go32_info_block+26,%dx
movl $1048563,%ecx
/APP
movw %dx, %gs
@ -659,8 +663,8 @@ _setup_screens:
/NO_APP
cmpw $64896,%ax
jne .L26
movl $655360,U_SYSTEM_GO32_INFO_BLOCK+8
movl $655360,U_SYSTEM_GO32_INFO_BLOCK+4
movl $655360,operatingsystem_go32_info_block+8
movl $655360,operatingsystem_go32_info_block+4
leave
ret
.align 2,0x90
@ -673,14 +677,14 @@ _setup_screens:
/NO_APP
cmpb $7,%al
jne .L29
movl $720896,U_SYSTEM_GO32_INFO_BLOCK+4
movl $753664,U_SYSTEM_GO32_INFO_BLOCK+8
movl $720896,operatingsystem_go32_info_block+4
movl $753664,operatingsystem_go32_info_block+8
leave
ret
.align 2,0x90
.L29:
movl $753664,U_SYSTEM_GO32_INFO_BLOCK+4
movl $720896,U_SYSTEM_GO32_INFO_BLOCK+8
movl $753664,operatingsystem_go32_info_block+4
movl $720896,operatingsystem_go32_info_block+8
leave
ret
@ -693,36 +697,36 @@ _setup_go32_info_block:
leal -8(%ebp),%eax
pushl %eax
call ___dpmi_get_version
movl $40,U_SYSTEM_GO32_INFO_BLOCK
movl $40,operatingsystem_go32_info_block
movl __stubinfo,%edx
movzwl 36(%edx),%eax
sall $4,%eax
movl %eax,U_SYSTEM_GO32_INFO_BLOCK+12
movl %eax,operatingsystem_go32_info_block+12
movzwl 32(%edx),%ecx
movl %ecx,U_SYSTEM_GO32_INFO_BLOCK+16
movl %ecx,operatingsystem_go32_info_block+16
movzwl 38(%edx),%ecx
movl %ecx,U_SYSTEM_GO32_INFO_BLOCK+20
movl %ecx,operatingsystem_go32_info_block+20
movb -3(%ebp),%al
movb %al,U_SYSTEM_GO32_INFO_BLOCK+24
movb %al,operatingsystem_go32_info_block+24
movb -2(%ebp),%al
movb %al,U_SYSTEM_GO32_INFO_BLOCK+25
movl $-1,U_SYSTEM_GO32_INFO_BLOCK+28
pushl $U_SYSTEM_GO32_INFO_BLOCK+32
movb %al,operatingsystem_go32_info_block+25
movl $-1,operatingsystem_go32_info_block+28
pushl $operatingsystem_go32_info_block+32
movzwl 38(%edx),%eax
pushl %eax
call ___dpmi_get_segment_base_address
movw $4,U_SYSTEM_GO32_INFO_BLOCK+36
movw $4,operatingsystem_go32_info_block+36
movb -8(%ebp),%dl
salw $8,%dx
movzbw -7(%ebp),%ax
orw %ax,%dx
movw %dx,U_SYSTEM_GO32_INFO_BLOCK+38
movw %dx,operatingsystem_go32_info_block+38
call copy_to_c_go32_info_block
leave
ret
copy_to_c_go32_info_block:
leal U_SYSTEM_GO32_INFO_BLOCK,%esi
leal operatingsystem_go32_info_block,%esi
leal __go32_info_block,%edi
movl $10,%ecx
rep
@ -771,7 +775,7 @@ ___prt1_startup:
fldcw ___fpucw
.Lno_387:
popl %eax
pushl U_SYSTEM_ENVP
pushl operatingsystem_parameter_envp
pushl ___crt0_argv
pushl ___crt0_argc
call _pascal_start
@ -779,7 +783,7 @@ ___prt1_startup:
/* call _exit changed to */
call exit
.align 2,0x90
/* .comm U_SYSTEM_DOS_ARGV0,4 */
/* .comm dos_argv0,4 */
.comm ___dos_argv0,4
.comm ___crt0_argc,4
.comm ___crt0_argv,4
@ -837,7 +841,7 @@ _fpc_windows_error:
.globl _pascal_start
_pascal_start:
/* %ebx doesn't contain ScreenPrimary */
movl U_SYSTEM_GO32_INFO_BLOCK+4,%ebx
movl operatingsystem_go32_info_block+4,%ebx
movl %ebx,_ScreenPrimary
/* core selector in %fs */
/* keep original fs for debuggers !!!!! (PM) */
@ -851,7 +855,7 @@ _pascal_start:
movl $0x0,%ebp
movl %esp,%ebx
movl 12(%ebx),%eax
movl %eax,U_SYSTEM_ENVP
movl %eax,operatingsystem_parameter_envp
movl %eax,_environ
movl 8(%ebx),%eax
movl %eax,_args
@ -868,7 +872,7 @@ _pascal_start:
.data
/* .comm U_SYSTEM_ENVP,4 */
/* .comm operatingsystem_parameter_envp,4 */
.globl _ScreenPrimary
_ScreenPrimary:
.long 0

View File

@ -473,13 +473,13 @@ var
{ Delphi compatibility }
{$ifdef FPC_HAS_FEATURE_DYNLIBS}
IsLibrary : boolean = false;
IsLibrary : boolean = false; public name 'operatingsystem_islibrary';
{$else FPC_HAS_FEATURE_DYNLIBS}
const
IsLibrary = false;
var
{$endif FPC_HAS_FEATURE_DYNLIBS}
IsConsole : boolean = false;
IsConsole : boolean = false; public name 'operatingsystem_isconsole';
{ Threading support }
fpc_threadvar_relocate_proc : pointer; public name 'FPC_THREADVAR_RELOCATE';

View File

@ -33,7 +33,7 @@ FPC_SHARED_LIB_START:
movl %eax,operatingsystem_parameter_argc /* Move the argument counter */
movl %ecx,operatingsystem_parameter_argv /* Move the argument pointer */
movb $1,TC_SYSTEM_ISLIBRARY
movb $1,operatingsystem_islibrary
/* Save initial stackpointer */
movl %esp,__stkptr

View File

@ -340,7 +340,7 @@ FUNCTION_PROLOG FPC_SHARED_LIB_START
std 5, 0(10)
/* update library flag in RTL */
LOAD_64BIT_VAL 8, TC_SYSTEM_ISLIBRARY
LOAD_64BIT_VAL 8, operatingsystem_islibrary
li 6, 1
stw 6, 0(8)
@ -351,7 +351,7 @@ FUNCTION_PROLOG FPC_SHARED_LIB_START
nop
/* return to the caller */
addi 1,1,144 /* restore stack */
addi 1,1,144 /* restore stack */
ld 0,16(1) /* prepare for method return */
mtlr 0
blr

View File

@ -54,7 +54,7 @@ _startlib:
movq operatingsystem_parameter_envp@GOTPCREL(%rip),%rbx
movq %rdx,(%rbx)
movq TC_SYSTEM_ISLIBRARY@GOTPCREL(%rip),%rbx
movq operatingsystem_islibrary@GOTPCREL(%rip),%rbx
movb $1,(%rbx)
/* Save initial stackpointer */

View File

@ -63,8 +63,8 @@ __start:
pushl %ecx
pushl %edx
pushl %eax
movl %eax,U_SYSTEM_ARGC
movl %edx,U_SYSTEM_ARGV
movl %eax,operatingsystem_parameter_argc
movl %edx,operatingsystem_parameter_argv
call ___start
#NO_APP
@ -87,7 +87,7 @@ ___start:
movl 28(%ebp),%edi
movl environ@GOT(%ebx),%eax
movl %edx,(%eax)
movl %edx,U_SYSTEM_ENVP
movl %edx,operatingsystem_parameter_envp
movl __progname@GOT(%ebx),%edx
movl (%esi),%eax
movl %eax,(%edx)
@ -154,7 +154,7 @@ ___start:
_haltproc:
mov $1,%eax
movzwl U_SYSTEM_EXITCODE,%ebx
movzwl operatingsystem_result,%ebx
pushl %ebx
call _actualsyscall
addl $4,%esp

View File

@ -78,11 +78,11 @@ ___start:
movl %esp,%ebp
movl 16(%ebp),%eax
movl %eax,environ
movl %eax,U_SYSTEM_ENVP
movl %eax,operatingsystem_parameter_envp
movl 8(%ebp),%eax
movl %eax,U_SYSTEM_ARGC
movl %eax,operatingsystem_parameter_argc
movl 12(%ebp),%eax
movl %eax,U_SYSTEM_ARGV
movl %eax,operatingsystem_parameter_argv
movl (%eax),%edx
movl %edx,__progname
testl %edx,%edx
@ -132,7 +132,7 @@ ___start:
_haltproc:
mov $1,%eax
movzwl U_SYSTEM_EXITCODE,%ebx
movzwl operatingsystem_result,%ebx
pushl %ebx
call _actualsyscall
addl $4,%esp

View File

@ -105,19 +105,19 @@ _start:
mr 3,24
mr 4,27
lis 11,U_SYSTEM_ARGC@ha
stw 3,U_SYSTEM_ARGC@l(11);
lis 11,U_SYSTEM_ARGV@ha
stw 4,U_SYSTEM_ARGV@l(11);
lis 11,operatingsystem_parameter_argc@ha
stw 3,operatingsystem_parameter_argc@l(11);
lis 11,operatingsystem_parameter_argv@ha
stw 4,operatingsystem_parameter_argv@l(11);
lis 11,U_SYSTEM_ENVP@ha
stw 5,U_SYSTEM_ENVP@l(11);
lis 11,operatingsystem_parameter_envp@ha
stw 5,operatingsystem_parameter_envp@l(11);
mtlr 0
bl main@plt
_haltproc:
lis 3,U_SYSTEM_EXITCODE@h
stw 3,U_SYSTEM_EXITCODE@l(3)
lis 3,operatingsystem_result@h
stw 3,operatingsystem_result@l(3)
bl exit@plt
.Lfe1:
.size _start,.Lfe1-_start

View File

@ -101,13 +101,13 @@ _start:
mr 3,24
mr 4,27
lis 11,U_SYSTEM_ARGC@ha
stw 3,U_SYSTEM_ARGC@l(11);
lis 11,U_SYSTEM_ARGV@ha
stw 4,U_SYSTEM_ARGV@l(11);
lis 11,operatingsystem_parameter_argc@ha
stw 3,operatingsystem_parameter_argc@l(11);
lis 11,operatingsystem_parameter_argv@ha
stw 4,operatingsystem_parameter_argv@l(11);
lis 11,U_SYSTEM_ENVP@ha
stw 5,U_SYSTEM_ENVP@l(11);
lis 11,operatingsystem_parameter_envp@ha
stw 5,operatingsystem_parameter_envp@l(11);
mtlr 0
bl PASCALMAIN
@ -117,8 +117,8 @@ _start:
_haltproc:
li 0,1 /* exit call */
lis 3,U_SYSTEM_EXITCODE@h
stw 3,U_SYSTEM_EXITCODE@l(3)
lis 3,operatingsystem_result@h
stw 3,operatingsystem_result@l(3)
sc
b _haltproc

View File

@ -59,7 +59,7 @@ ___start:
movl 12(%ebp),%esi
movl 16(%ebp),%eax
movl %eax,environ
movl %eax,U_SYSTEM_ENVP
movl %eax,operatingsystem_parameter_envp
movl (%esi),%ebx
testl %ebx,%ebx
je .L3
@ -100,8 +100,8 @@ ___start:
subl $16,%esp
pushl %eax
movl 8(%ebp),%eax
movl %eax,U_SYSTEM_ARGC
movl %esi,U_SYSTEM_ARGV
movl %eax,operatingsystem_parameter_argc
movl %esi,operatingsystem_parameter_argv
popl %eax
# pushl environ
# pushl %esi
@ -120,7 +120,7 @@ ___start:
_haltproc:
mov $1,%eax
movzwl U_SYSTEM_EXITCODE,%ebx
movzwl operatingsystem_result,%ebx
pushl %ebx
call .Lactualsyscall
addl $4,%esp

View File

@ -59,7 +59,7 @@ ___start:
movl 12(%ebp),%esi
movl 16(%ebp),%eax
movl %eax,environ
movl %eax,U_SYSTEM_ENVP
movl %eax,operatingsystem_parameter_envp
movl (%esi),%ebx
testl %ebx,%ebx
je .L3
@ -100,8 +100,8 @@ ___start:
subl $16,%esp
pushl %eax
movl 8(%ebp),%eax
movl %eax,U_SYSTEM_ARGC
movl %esi,U_SYSTEM_ARGV
movl %eax,operatingsystem_parameter_argc
movl %esi,operatingsystem_parameter_argv
popl %eax
# pushl environ
# pushl %esi
@ -121,7 +121,7 @@ ___start:
_haltproc:
mov $1,%eax
movzwl U_SYSTEM_EXITCODE,%ebx
movzwl operatingsystem_result,%ebx
pushl %ebx
call .Lactualsyscall
addl $4,%esp

View File

@ -34,7 +34,7 @@ asm_exit:
bl exitthread
_PISCONSOLE:
.long U_SYSTEM_ISCONSOLE
.long operatingsystem_isconsole
.globl exitthread
exitthread:

View File

@ -12,9 +12,9 @@
.extern _init
.extern atexit
.extern errno
.extern operatingsystem_argc
.extern operatingsystem_argv
.extern operatingsystem_envp
.extern operatingsystem_parameter_argc
.extern operatingsystem_parameter_argv
.extern operatingsystem_parameter_envp
.text
.byte 'N', 'I', 'A', 'M' /* Used by debugger for setting a break point */
@ -43,17 +43,17 @@ _start:
// argc
movl 0(%esp),%esi
movl 0(%esp), %eax
movl %eax, operatingsystem_argc
movl %eax, operatingsystem_parameter_argc
// argv
leal 4(%esp),%ecx
movl %ecx, operatingsystem_argv
movl %ecx, operatingsystem_parameter_argv
// envp
leal (%ecx,%esi,4),%eax
// auxv vector pointer
leal 4(%eax),%edi
// pointer to environment
leal 8(%eax),%edx
movl %edx, operatingsystem_envp
movl %edx, operatingsystem_parameter_envp
cmpl $0,4(%eax)
je .Ldoneargv
.align 4

View File

@ -29,9 +29,9 @@ interface
{$I heaph.inc}
var
argc : longint; public name 'operatingsystem_argc';
argv : ppchar;public name 'operatingsystem_argv';
envp : ppchar;public name 'operatingsystem_envp';
argc : longint; public name 'operatingsystem_parameter_argc';
argv : ppchar;public name 'operatingsystem_parameter_argv';
envp : ppchar;public name 'operatingsystem_parameter_envp';
var

View File

@ -4,12 +4,12 @@
.text
.globl _mainCRTStartup
_mainCRTStartup:
movb $1,U_SYSTEM_ISCONSOLE
movb $1,operatingsystem_isconsole
jmp _start
.globl _WinMainCRTStartup
_WinMainCRTStartup:
movb $0,U_SYSTEM_ISCONSOLE
movb $0,operatingsystem_isconsole
_start:
subl $0x8,%esp
andl $0xfffffff0,%esp

View File

@ -93,14 +93,15 @@ type
var
{ C compatible arguments }
argc : longint;
argv : ppchar;
argc : longint; public name 'operatingsystem_parameter_argc';
argv : ppchar; public name 'operatingsystem_parameter_argv';
{ Win32 Info }
startupinfo : tstartupinfo;
hprevinst,
MainInstance,
cmdshow : longint;
DLLreason,DLLparam:longint;
DLLreason : longint; public name 'operatingsystem_dllreason';
DLLparam : longint; public name 'operatingsystem_dllparam';
StartupConsoleMode : DWORD;
type

View File

@ -4,12 +4,12 @@
.text
.globl _mainCRTStartup
_mainCRTStartup:
movb $1,U_SYSTEM_ISCONSOLE
movb $1,operatingsystem_isconsole
jmp _start
.globl _WinMainCRTStartup
_WinMainCRTStartup:
movb $0,U_SYSTEM_ISCONSOLE
movb $0,operatingsystem_isconsole
_start:
subl $0x8,%esp
andl $0xfffffff0,%esp

View File

@ -3,11 +3,11 @@
.text
.globl _mainCRTStartup
_mainCRTStartup:
movb $1,U_SYSTEM_ISCONSOLE
movb $1,operatingsystem_isconsole
jmp .LDLL_Entry
.globl _WinMainCRTStartup
_WinMainCRTStartup:
movb $0,U_SYSTEM_ISCONSOLE
movb $0,operatingsystem_isconsole
.LDLL_Entry:
pushl %ebp
movl %esp,%ebp
@ -17,9 +17,9 @@ _WinMainCRTStartup:
movl 8(%ebp),%edi
movl %edi,SysInstance
movl 12(%ebp),%edi
movl %edi,U_SYSTEM_DLLREASON
movl %edi,operatingsystem_parameter_dllreason
movl 16(%ebp),%edi
movl %edi,U_SYSTEM_DLLPARAM
movl %edi,operatingsystem_parameter_dllparam
movl %esp,__stkptr
call _FPC_DLL_Entry
popl %edi

View File

@ -4,12 +4,12 @@
.text
.globl _mainCRTStartup
_mainCRTStartup:
movb $1,U_SYSTEM_ISCONSOLE
movb $1,operatingsystem_isconsole
movl %esp,__stkptr
call _FPC_EXE_Entry
.globl _WinMainCRTStartup
_WinMainCRTStartup:
movb $0,U_SYSTEM_ISCONSOLE
movb $0,operatingsystem_isconsole
movl %esp,__stkptr
call _FPC_EXE_Entry