~vorlon/ubuntu/natty/eglibc/multiarch

« back to all changes in this revision

Viewing changes to sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S

  • Committer: Steve Langasek
  • Date: 2011-02-18 21:18:44 UTC
  • mfrom: (103.1.7 eglibc)
  • Revision ID: steve.langasek@linaro.org-20110218211844-lodmi8b1qhyq3f3x
Tags: 2.13~pre1-0ubuntu1+multiarch.1
merge from natty

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
        cror    cr0*4+eq,cr1*4+eq,cr0*4+eq
47
47
        beq-    cr0,L(badargs)
48
48
 
49
 
        /* Set up stack frame for parent.  */
50
 
        stdu    r1,-80(r1)
51
 
        cfi_adjust_cfa_offset (80)
52
 
        std     r29,56(r1)
53
 
        std     r30,64(r1)
54
 
        std     r31,72(r1)
55
 
        cfi_offset(r29,-56)
56
 
        cfi_offset(r30,-64)
57
 
        cfi_offset(r31,-72)
58
 
#ifdef RESET_PID
59
 
        std     r28,48(r1)
60
 
        cfi_offset(r28,-48)
61
 
#endif
 
49
        /* Save some regs in parm save area.  */
 
50
#ifdef RESET_PID
 
51
        std     r29,48(r1)
 
52
#endif
 
53
        std     r30,56(r1)
 
54
        std     r31,64(r1)
 
55
#ifdef RESET_PID
 
56
        cfi_offset(r29,48)
 
57
#endif
 
58
        cfi_offset(r30,56)
 
59
        cfi_offset(r31,64)
62
60
 
63
61
        /* Set up stack frame for child.  */
64
62
        clrrdi  r4,r4,4
65
63
        li      r0,0
66
 
        stdu    r0,-48(r4) /* min stack frame is 48 bytes per ABI */
 
64
        stdu    r0,-112(r4) /* min stack frame is 112 bytes per ABI */
67
65
 
68
66
        /* Save fn, args, stack across syscall.  */
69
 
        mr      r29,r3                  /* Function in r29.  */
70
 
        mr      r30,r4                  /* Stack pointer in r30.  */
 
67
        mr      r30,r3                  /* Function in r30.  */
71
68
#ifdef RESET_PID
72
 
        mr      r28,r5                  /* Flags in r28.  */
 
69
        mr      r29,r5                  /* Flags in r29.  */
73
70
#endif
74
71
        mr      r31,r6                  /* Argument in r31.  */
75
72
 
76
 
        /* 'flags' argument is first parameter to clone syscall. (The other
77
 
           argument is the stack pointer, already in r4.)  */
 
73
        /* 'flags' argument is first parameter to clone syscall.
 
74
           Second is the stack pointer, already in r4.  */
78
75
        mr      r3,r5
79
76
  /* Move the parent_tid, child_tid and tls arguments. */
80
77
        mr      r5,r7
94
91
        bne-    cr1,L(parent)           /* The '-' is to minimise the race.  */
95
92
 
96
93
#ifdef RESET_PID
97
 
        andis.  r0,r28,CLONE_THREAD>>16
 
94
        andis.  r0,r29,CLONE_THREAD>>16
98
95
        bne+    cr0,L(oldpid)
99
 
        andi.   r0,r28,CLONE_VM
 
96
        andi.   r0,r29,CLONE_VM
100
97
        li      r3,-1
101
98
        bne-    cr0,L(nomoregetpid)
102
99
        DO_CALL(SYS_ify(getpid))
108
105
 
109
106
        std     r2,40(r1)
110
107
        /* Call procedure.  */
111
 
        ld      r0,0(r29)
112
 
        ld      r2,8(r29)
 
108
        ld      r0,0(r30)
 
109
        ld      r2,8(r30)
113
110
        mtctr   r0
114
111
        mr      r3,r31
115
112
        bctrl
119
116
        b       JUMPTARGET(__GI__exit)
120
117
#else
121
118
        b       JUMPTARGET(_exit)
 
119
        /* We won't ever get here but provide a nop so that the linker
 
120
           will insert a toc adjusting stub if necessary.  */
 
121
        nop
122
122
#endif
123
123
 
 
124
L(badargs):
 
125
        cfi_startproc
 
126
        li      r3,EINVAL
 
127
        TAIL_CALL_SYSCALL_ERROR
 
128
 
124
129
L(parent):
125
130
        /* Parent.  Restore registers & return.  */
126
131
#ifdef RESET_PID
127
 
        ld      r28,48(r1)
128
 
#endif
129
 
        ld      r31,72(r1)
130
 
        ld      r30,64(r1)
131
 
        ld      r29,56(r1)
132
 
        addi    r1,r1,80
133
 
        bnslr+
134
 
        b       JUMPTARGET(__syscall_error)
135
 
 
136
 
L(badargs):
137
 
        li      r3,EINVAL
138
 
        b       JUMPTARGET(__syscall_error)
139
 
 
140
 
        cfi_startproc
 
132
        cfi_offset(r29,48)
 
133
#endif
 
134
        cfi_offset(r30,56)
 
135
        cfi_offset(r31,64)
 
136
#ifdef RESET_PID
 
137
        ld      r29,48(r1)
 
138
#endif
 
139
        ld      r30,56(r1)
 
140
        ld      r31,64(r1)
 
141
#ifdef RESET_PID
 
142
        cfi_restore(r29)
 
143
#endif
 
144
        cfi_restore(r30)
 
145
        cfi_restore(r31)
 
146
        PSEUDO_RET
 
147
 
141
148
END (BP_SYM (__clone))
142
149
 
143
150
weak_alias (BP_SYM (__clone), BP_SYM (clone))