Browse Source

--- Merging r19009 into '.':
U rtl/linux/powerpc/dllprt0.as
--- Merging r19022 into '.':
U rtl/linux/powerpc64/dllprt0.as

# revisions: 19009,19022
r19009 | pierre | 2011-09-07 14:53:50 +0200 (Wed, 07 Sep 2011) | 1 line
Changed paths:
M /trunk/rtl/linux/powerpc/dllprt0.as

* Try to implement dllprt0 for linux powerpc processor
r19022 | pierre | 2011-09-07 23:57:37 +0200 (Wed, 07 Sep 2011) | 1 line
Changed paths:
M /trunk/rtl/linux/powerpc64/dllprt0.as

* IsLibrary is a byte-sized boolean, thus use stb instruction to set value

git-svn-id: branches/fixes_2_6@21428 -

marco 13 years ago
parent
commit
11aad34ae5
2 changed files with 96 additions and 1 deletions
  1. 95 0
      rtl/linux/powerpc/dllprt0.as
  2. 1 1
      rtl/linux/powerpc64/dllprt0.as

+ 95 - 0
rtl/linux/powerpc/dllprt0.as

@@ -0,0 +1,95 @@
+/* Startup code for programs linked with GNU libc.
+   Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+    .section ".text"
+    .globl FPC_SHARED_LIB_START
+    .type  FPC_SHARED_LIB_START,@function
+
+    .globl  _start
+_start:
+FPC_SHARED_LIB_START:
+    mr      26,1
+    /* Set up an initial stack frame, and clear the LR.  */
+    clrrwi   1,1,4
+    li       0,0
+    stwu     1,-16(1)
+    mtlr     0
+    stw      0,0(1)
+    lwz      3,0(26)       /* get argc */
+    lis     11,operatingsystem_parameter_argc@ha
+    stw      3,operatingsystem_parameter_argc@l(11);
+
+    addi     4,26,4        /* get argv */
+    lis     11,operatingsystem_parameter_argv@ha
+    stw      4,operatingsystem_parameter_argv@l(11);
+
+    addi    27,3,1        /* calculate argc + 1 into r27 */
+    slwi    27,27,2       /* calculate (argc + 1) * sizeof(char *) into r27 */
+    add      5,4,27       /* get address of env[0] */
+    lis     11,operatingsystem_parameter_envp@ha
+    stw      5,operatingsystem_parameter_envp@l(11);
+
+    lis     11,__stkptr@ha
+    stw      1,__stkptr@l(11);
+    /* update library flag in RTL */
+    lis	   11,operatingsystem_islibrary@ha
+    li      6, 1
+    stb     6, operatingsystem_islibrary@l(11)
+
+
+    bl         PASCALMAIN
+
+    b          _haltproc
+
+    .globl  _haltproc
+    .globl  FPC_SHARED_LIB_EXIT
+     .type  FPC_SHARED_LIB_EXIT,@function
+     .type   _haltproc,@function
+FPC_SHARED_LIB_EXIT:
+_haltproc:
+    li       0,1          /* exit call */
+    sc
+    b          _haltproc
+
+/* Define a symbol for the first piece of initialized data.  */
+    .section ".data"
+    .globl __data_start
+__data_start:
+data_start:
+
+    .section ".bss"
+
+    .type __stkptr, @object
+    .size __stkptr, 4
+    .global __stkptr
+__stkptr:
+    .skip 4
+
+    .type operatingsystem_parameters, @object
+    .size operatingsystem_parameters, 12
+operatingsystem_parameters:
+    .skip 3 * 4
+    .global operatingsystem_parameter_argc
+    .global operatingsystem_parameter_argv
+    .global operatingsystem_parameter_envp
+    .set operatingsystem_parameter_argc, operatingsystem_parameters+0
+    .set operatingsystem_parameter_argv, operatingsystem_parameters+4
+    .set operatingsystem_parameter_envp, operatingsystem_parameters+8
+
+.section .note.GNU-stack,"",%progbits

+ 1 - 1
rtl/linux/powerpc64/dllprt0.as

@@ -342,7 +342,7 @@ FUNCTION_PROLOG FPC_SHARED_LIB_START
     /* update library flag in RTL */
     LOAD_64BIT_VAL 8, operatingsystem_islibrary
     li      6, 1
-    stw     6, 0(8)
+    stb     6, 0(8)
 
     LOAD_64BIT_VAL 8, __stkptr
     std     1,0(8)