Simplify tile assembly definitions

With tilepro removal, the uppercase instruction are not anymore
required to be defines as potentially macros.  This is a
mechanical change done by the following shell script:

---
INSNS="LD LD4U ST ST4 BNEZ BEQZ BEQZT BGTZ CMPEQI CMPEQ CMOVEQZ CMOVNEZ"

FILES=$(find sysdeps/tile sysdeps/unix/sysv/linux/tile -iname *.S)

for insn in $INSNS; do
  repl=$(echo $insn | tr '[:upper:]' '[:lower:]')
  sed -i 's/\b'$insn'\b/'$repl'/g' $FILES
done
---

Checked with a build for tilegx-linux-gnu and tilegx-linux-gnu-32 with
and without the patch, there is no difference in generated binary with
a dissassemble.

	* sysdeps/tile/__longjmp.S (__longjmp): Use lowercase instructions.
	* sysdeps/tile/__tls_get_addr.S (__tls_get_addr): Likewise.
	* sysdeps/tile/_mcount.S (__mcount): Likewise.
	* sysdeps/tile/crti.S (_init, _fini): Likewise.
	* sysdeps/tile/crtn.S: Likewise.
	* sysdeps/tile/dl-start.S (_start): Likewise.
	* sysdeps/tile/dl-trampoline.S: Likewise.
	* sysdeps/tile/setjmp.S (__sigsetjmp): Likewise.
	* sysdeps/tile/start.S (_start): Likewise.
	* sysdeps/unix/sysv/linux/tile/clone.S (_clone): Likewise.
	* sysdeps/unix/sysv/linux/tile/getcontext.S (__getcontext): Likewise.
	* sysdeps/unix/sysv/linux/tile/ioctl.S (__ioctl): Likewise.
	* sysdeps/unix/sysv/linux/tile/setcontext.S (__setcontext): Likewise.
	* sysdeps/unix/sysv/linux/tile/swapcontext.S (__swapcontext): Likewise.
	* sysdeps/unix/sysv/linux/tile/syscall.S (syscall): Likewise.
	* sysdeps/unix/sysv/linux/tile/vfork.S (__vfork): Likewise.
This commit is contained in:
Adhemerval Zanella 2017-12-13 16:14:30 -02:00
parent 24d1d8ec9e
commit 8d2d239cb7
17 changed files with 236 additions and 219 deletions

View File

@ -1,5 +1,22 @@
2017-12-20 Adhemerval Zanella <adhemerval.zanella@linaro.org> 2017-12-20 Adhemerval Zanella <adhemerval.zanella@linaro.org>
* sysdeps/tile/__longjmp.S (__longjmp): Use lowercase instructions.
* sysdeps/tile/__tls_get_addr.S (__tls_get_addr): Likewise.
* sysdeps/tile/_mcount.S (__mcount): Likewise.
* sysdeps/tile/crti.S (_init, _fini): Likewise.
* sysdeps/tile/crtn.S: Likewise.
* sysdeps/tile/dl-start.S (_start): Likewise.
* sysdeps/tile/dl-trampoline.S: Likewise.
* sysdeps/tile/setjmp.S (__sigsetjmp): Likewise.
* sysdeps/tile/start.S (_start): Likewise.
* sysdeps/unix/sysv/linux/tile/clone.S (_clone): Likewise.
* sysdeps/unix/sysv/linux/tile/getcontext.S (__getcontext): Likewise.
* sysdeps/unix/sysv/linux/tile/ioctl.S (__ioctl): Likewise.
* sysdeps/unix/sysv/linux/tile/setcontext.S (__setcontext): Likewise.
* sysdeps/unix/sysv/linux/tile/swapcontext.S (__swapcontext): Likewise.
* sysdeps/unix/sysv/linux/tile/syscall.S (syscall): Likewise.
* sysdeps/unix/sysv/linux/tile/vfork.S (__vfork): Likewise.
* stdlib/bug-getcontext.c (do_test): Remove tilepro mention in * stdlib/bug-getcontext.c (do_test): Remove tilepro mention in
comment. comment.
* sysdeps/tile/preconfigure: Remove tilegx folder. * sysdeps/tile/preconfigure: Remove tilegx folder.

View File

@ -28,7 +28,7 @@
ENTRY (__longjmp) ENTRY (__longjmp)
FEEDBACK_ENTER(__longjmp) FEEDBACK_ENTER(__longjmp)
#define RESTORE(r) { LD r, r0 ; ADDI_PTR r0, r0, REGSIZE } #define RESTORE(r) { ld r, r0 ; ADDI_PTR r0, r0, REGSIZE }
FOR_EACH_CALLEE_SAVED_REG(RESTORE) FOR_EACH_CALLEE_SAVED_REG(RESTORE)
/* Make longjmp(buf, 0) return "1" instead. /* Make longjmp(buf, 0) return "1" instead.
@ -36,9 +36,9 @@ ENTRY (__longjmp)
we can validly load EX_CONTEXT for iret without being we can validly load EX_CONTEXT for iret without being
interrupted halfway through. */ interrupted halfway through. */
{ {
LD r2, r0 /* retrieve ICS bit from jmp_buf */ ld r2, r0 /* retrieve ICS bit from jmp_buf */
movei r3, 1 movei r3, 1
CMPEQI r0, r1, 0 cmpeqi r0, r1, 0
} }
{ {
mtspr INTERRUPT_CRITICAL_SECTION, r3 mtspr INTERRUPT_CRITICAL_SECTION, r3

View File

@ -53,20 +53,20 @@ ENTRY (__tls_get_addr)
} }
{ {
LD_PTR r29, r29 /* r29 = ti_offset */ LD_PTR r29, r29 /* r29 = ti_offset */
CMPEQ r25, r28, r25 /* r25 nonzero if generation OK */ cmpeq r25, r28, r25 /* r25 nonzero if generation OK */
shli r28, r26, LOG_SIZEOF_DTV_T /* byte index into dtv array */ shli r28, r26, LOG_SIZEOF_DTV_T /* byte index into dtv array */
} }
{ {
BEQZ r25, .Lslowpath beqz r25, .Lslowpath
CMPEQI r25, r26, -1 /* r25 nonzero if ti_module invalid */ cmpeqi r25, r26, -1 /* r25 nonzero if ti_module invalid */
} }
{ {
BNEZ r25, .Lslowpath bnez r25, .Lslowpath
ADD_PTR r28, r28, r27 /* pointer into module array */ ADD_PTR r28, r28, r27 /* pointer into module array */
} }
LD_PTR r26, r28 /* r26 = module TLS pointer */ LD_PTR r26, r28 /* r26 = module TLS pointer */
CMPEQI r25, r26, -1 /* check r26 == TLS_DTV_UNALLOCATED */ cmpeqi r25, r26, -1 /* check r26 == TLS_DTV_UNALLOCATED */
BNEZ r25, .Lslowpath bnez r25, .Lslowpath
{ {
ADD_PTR r0, r26, r29 ADD_PTR r0, r26, r29
jrp lr jrp lr
@ -74,68 +74,68 @@ ENTRY (__tls_get_addr)
.Lslowpath: .Lslowpath:
{ {
ST sp, lr st sp, lr
ADDLI_PTR r29, sp, - (25 * REGSIZE) ADDLI_PTR r29, sp, - (25 * REGSIZE)
} }
cfi_offset (lr, 0) cfi_offset (lr, 0)
{ {
ST r29, sp st r29, sp
ADDLI_PTR sp, sp, - (26 * REGSIZE) ADDLI_PTR sp, sp, - (26 * REGSIZE)
} }
cfi_def_cfa_offset (26 * REGSIZE) cfi_def_cfa_offset (26 * REGSIZE)
ADDI_PTR r29, sp, (2 * REGSIZE) ADDI_PTR r29, sp, (2 * REGSIZE)
{ ST r29, r1; ADDI_PTR r29, r29, REGSIZE } { st r29, r1; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r2; ADDI_PTR r29, r29, REGSIZE } { st r29, r2; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r3; ADDI_PTR r29, r29, REGSIZE } { st r29, r3; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r4; ADDI_PTR r29, r29, REGSIZE } { st r29, r4; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r5; ADDI_PTR r29, r29, REGSIZE } { st r29, r5; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r6; ADDI_PTR r29, r29, REGSIZE } { st r29, r6; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r7; ADDI_PTR r29, r29, REGSIZE } { st r29, r7; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r8; ADDI_PTR r29, r29, REGSIZE } { st r29, r8; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r9; ADDI_PTR r29, r29, REGSIZE } { st r29, r9; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r10; ADDI_PTR r29, r29, REGSIZE } { st r29, r10; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r11; ADDI_PTR r29, r29, REGSIZE } { st r29, r11; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r12; ADDI_PTR r29, r29, REGSIZE } { st r29, r12; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r13; ADDI_PTR r29, r29, REGSIZE } { st r29, r13; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r14; ADDI_PTR r29, r29, REGSIZE } { st r29, r14; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r15; ADDI_PTR r29, r29, REGSIZE } { st r29, r15; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r16; ADDI_PTR r29, r29, REGSIZE } { st r29, r16; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r17; ADDI_PTR r29, r29, REGSIZE } { st r29, r17; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r18; ADDI_PTR r29, r29, REGSIZE } { st r29, r18; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r19; ADDI_PTR r29, r29, REGSIZE } { st r29, r19; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r20; ADDI_PTR r29, r29, REGSIZE } { st r29, r20; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r21; ADDI_PTR r29, r29, REGSIZE } { st r29, r21; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r22; ADDI_PTR r29, r29, REGSIZE } { st r29, r22; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r23; ADDI_PTR r29, r29, REGSIZE } { st r29, r23; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r24; ADDI_PTR r29, r29, REGSIZE } { st r29, r24; ADDI_PTR r29, r29, REGSIZE }
.hidden __tls_get_addr_slow .hidden __tls_get_addr_slow
jal __tls_get_addr_slow jal __tls_get_addr_slow
ADDI_PTR r29, sp, (2 * REGSIZE) ADDI_PTR r29, sp, (2 * REGSIZE)
{ LD r1, r29; ADDI_PTR r29, r29, REGSIZE } { ld r1, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r2, r29; ADDI_PTR r29, r29, REGSIZE } { ld r2, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r3, r29; ADDI_PTR r29, r29, REGSIZE } { ld r3, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r4, r29; ADDI_PTR r29, r29, REGSIZE } { ld r4, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r5, r29; ADDI_PTR r29, r29, REGSIZE } { ld r5, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r6, r29; ADDI_PTR r29, r29, REGSIZE } { ld r6, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r7, r29; ADDI_PTR r29, r29, REGSIZE } { ld r7, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r8, r29; ADDI_PTR r29, r29, REGSIZE } { ld r8, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r9, r29; ADDI_PTR r29, r29, REGSIZE } { ld r9, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r10, r29; ADDI_PTR r29, r29, REGSIZE } { ld r10, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r11, r29; ADDI_PTR r29, r29, REGSIZE } { ld r11, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r12, r29; ADDI_PTR r29, r29, REGSIZE } { ld r12, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r13, r29; ADDI_PTR r29, r29, REGSIZE } { ld r13, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r14, r29; ADDI_PTR r29, r29, REGSIZE } { ld r14, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r15, r29; ADDI_PTR r29, r29, REGSIZE } { ld r15, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r16, r29; ADDI_PTR r29, r29, REGSIZE } { ld r16, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r17, r29; ADDI_PTR r29, r29, REGSIZE } { ld r17, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r18, r29; ADDI_PTR r29, r29, REGSIZE } { ld r18, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r19, r29; ADDI_PTR r29, r29, REGSIZE } { ld r19, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r20, r29; ADDI_PTR r29, r29, REGSIZE } { ld r20, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r21, r29; ADDI_PTR r29, r29, REGSIZE } { ld r21, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r22, r29; ADDI_PTR r29, r29, REGSIZE } { ld r22, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r23, r29; ADDI_PTR r29, r29, REGSIZE } { ld r23, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r24, r29; ADDLI_PTR sp, sp, (26 * REGSIZE) } { ld r24, r29; ADDLI_PTR sp, sp, (26 * REGSIZE) }
cfi_def_cfa_offset (0) cfi_def_cfa_offset (0)
LD lr, sp ld lr, sp
jrp lr jrp lr
END (__tls_get_addr) END (__tls_get_addr)

View File

@ -33,27 +33,27 @@
.text .text
ENTRY(__mcount) ENTRY(__mcount)
{ {
ST sp, lr st sp, lr
ADDI_PTR r29, sp, - (12 * REGSIZE) ADDI_PTR r29, sp, - (12 * REGSIZE)
} }
cfi_offset (lr, 0) cfi_offset (lr, 0)
{ {
ADDI_PTR sp, sp, - (13 * REGSIZE) ADDI_PTR sp, sp, - (13 * REGSIZE)
ST r29, sp st r29, sp
ADDI_PTR r29, r29, REGSIZE ADDI_PTR r29, r29, REGSIZE
} }
cfi_def_cfa_offset (13 * REGSIZE) cfi_def_cfa_offset (13 * REGSIZE)
{ ST r29, r0; ADDI_PTR r29, r29, REGSIZE } { st r29, r0; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r1; ADDI_PTR r29, r29, REGSIZE } { st r29, r1; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r2; ADDI_PTR r29, r29, REGSIZE } { st r29, r2; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r3; ADDI_PTR r29, r29, REGSIZE } { st r29, r3; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r4; ADDI_PTR r29, r29, REGSIZE } { st r29, r4; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r5; ADDI_PTR r29, r29, REGSIZE } { st r29, r5; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r6; ADDI_PTR r29, r29, REGSIZE } { st r29, r6; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r7; ADDI_PTR r29, r29, REGSIZE } { st r29, r7; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r8; ADDI_PTR r29, r29, REGSIZE } { st r29, r8; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r9; ADDI_PTR r29, r29, REGSIZE } { st r29, r9; ADDI_PTR r29, r29, REGSIZE }
{ ST r29, r10; ADDI_PTR r29, r29, REGSIZE; move r0, r10 } { st r29, r10; ADDI_PTR r29, r29, REGSIZE; move r0, r10 }
{ {
move r1, lr move r1, lr
jal __mcount_internal jal __mcount_internal
@ -61,20 +61,20 @@ ENTRY(__mcount)
{ {
ADDI_PTR r29, sp, (2 * REGSIZE) ADDI_PTR r29, sp, (2 * REGSIZE)
} }
{ LD r0, r29; ADDI_PTR r29, r29, REGSIZE } { ld r0, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r1, r29; ADDI_PTR r29, r29, REGSIZE } { ld r1, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r2, r29; ADDI_PTR r29, r29, REGSIZE } { ld r2, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r3, r29; ADDI_PTR r29, r29, REGSIZE } { ld r3, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r4, r29; ADDI_PTR r29, r29, REGSIZE } { ld r4, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r5, r29; ADDI_PTR r29, r29, REGSIZE } { ld r5, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r6, r29; ADDI_PTR r29, r29, REGSIZE } { ld r6, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r7, r29; ADDI_PTR r29, r29, REGSIZE } { ld r7, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r8, r29; ADDI_PTR r29, r29, REGSIZE } { ld r8, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r9, r29; ADDI_PTR r29, r29, REGSIZE } { ld r9, r29; ADDI_PTR r29, r29, REGSIZE }
{ LD r10, r29; ADDI_PTR sp, sp, (13 * REGSIZE) } { ld r10, r29; ADDI_PTR sp, sp, (13 * REGSIZE) }
cfi_def_cfa_offset (0) cfi_def_cfa_offset (0)
{ {
LD lr, sp ld lr, sp
} }
{ {
move lr, r10 move lr, r10

View File

@ -63,10 +63,10 @@ _init:
{ {
move r29, sp move r29, sp
ADDI_PTR r28, sp, -REGSIZE ADDI_PTR r28, sp, -REGSIZE
ST sp, lr st sp, lr
} }
ADDI_PTR sp, sp, -(2 * REGSIZE) ADDI_PTR sp, sp, -(2 * REGSIZE)
ST r28, r29 st r28, r29
#if PREINIT_FUNCTION_WEAK #if PREINIT_FUNCTION_WEAK
lnk r2 lnk r2
0: 0:
@ -82,7 +82,7 @@ _init:
ADD_PTR r0, r0, r1 ADD_PTR r0, r0, r1
ADD_PTR r0, r0, r2 ADD_PTR r0, r0, r2
LD_PTR r0, r0 LD_PTR r0, r0
BEQZ r0, .Lno_weak_fn beqz r0, .Lno_weak_fn
jalr r0 jalr r0
#elif !defined(NO_PLT_PCREL) #elif !defined(NO_PLT_PCREL)
/* Since we are calling from the start of the object to the PLT, /* Since we are calling from the start of the object to the PLT,
@ -107,7 +107,7 @@ _fini:
{ {
move r29, sp move r29, sp
ADDI_PTR r28, sp, -REGSIZE ADDI_PTR r28, sp, -REGSIZE
ST sp, lr st sp, lr
} }
ADDI_PTR sp, sp, -(2 * REGSIZE) ADDI_PTR sp, sp, -(2 * REGSIZE)
ST r28, r29 st r28, r29

View File

@ -42,7 +42,7 @@
ADDI_PTR r29, sp, (2 * REGSIZE) ADDI_PTR r29, sp, (2 * REGSIZE)
{ {
ADDI_PTR sp, sp, (2 * REGSIZE) ADDI_PTR sp, sp, (2 * REGSIZE)
LD lr, r29 ld lr, r29
} }
jrp lr jrp lr
@ -50,6 +50,6 @@
ADDI_PTR r29, sp, (2 * REGSIZE) ADDI_PTR r29, sp, (2 * REGSIZE)
{ {
ADDI_PTR sp, sp, (2 * REGSIZE) ADDI_PTR sp, sp, (2 * REGSIZE)
LD lr, r29 ld lr, r29
} }
jrp lr jrp lr

View File

@ -43,7 +43,7 @@ ENTRY (_start)
/* Save zero for caller sp in our 'caller' save area, and make /* Save zero for caller sp in our 'caller' save area, and make
sure lr has a zero value, to limit backtraces. */ sure lr has a zero value, to limit backtraces. */
move lr, zero move lr, zero
ST r4, zero st r4, zero
} }
{ {
move r0, r52 move r0, r52
@ -56,8 +56,8 @@ ENTRY (_start)
in which case we have to adjust the argument vector. */ in which case we have to adjust the argument vector. */
lnk r51; .Llink: lnk r51; .Llink:
pic_addr r4, _dl_skip_args pic_addr r4, _dl_skip_args
LD4U r4, r4 ld4u r4, r4
BEQZT r4, .Lno_skip beqzt r4, .Lno_skip
/* Load the argc word at the initial sp and adjust it. /* Load the argc word at the initial sp and adjust it.
We basically jump "sp" up over the first few argv entries We basically jump "sp" up over the first few argv entries

View File

@ -73,8 +73,8 @@
f(r20); f(r21); f(r22); f(r23); \ f(r20); f(r21); f(r22); f(r23); \
f(r24); f(r25) f(r24); f(r25)
#define SAVE(REG) { ST r27, REG; ADDI_PTR r27, r27, REGSIZE } #define SAVE(REG) { st r27, REG; ADDI_PTR r27, r27, REGSIZE }
#define RESTORE(REG) { LD REG, r27; ADDI_PTR r27, r27, REGSIZE } #define RESTORE(REG) { ld REG, r27; ADDI_PTR r27, r27, REGSIZE }
.macro dl_resolve, name, profile, framesize .macro dl_resolve, name, profile, framesize
.text .text
@ -86,7 +86,7 @@
\name: \name:
cfi_startproc cfi_startproc
{ {
ST sp, lr st sp, lr
move r26, sp move r26, sp
} }
{ {
@ -95,24 +95,24 @@
} }
cfi_def_cfa_offset (\framesize) cfi_def_cfa_offset (\framesize)
{ {
ST r27, r26 st r27, r26
ADDI_PTR r27, r27, FRAME_REGS - FRAME_SP ADDI_PTR r27, r27, FRAME_REGS - FRAME_SP
} }
FOR_EACH_REG(SAVE) FOR_EACH_REG(SAVE)
{ {
ST r27, lr st r27, lr
ADDLI_PTR r27, sp, FRAME_TPNT ADDLI_PTR r27, sp, FRAME_TPNT
} }
cfi_offset (lr, FRAME_LR - \framesize) cfi_offset (lr, FRAME_LR - \framesize)
.if \profile .if \profile
{ {
move r0, r28 /* tpnt value */ move r0, r28 /* tpnt value */
ST r27, r28 st r27, r28
ADDI_PTR r27, r27, FRAME_INDEX - FRAME_TPNT ADDI_PTR r27, r27, FRAME_INDEX - FRAME_TPNT
} }
{ {
move r1, r29 /* PLT index */ move r1, r29 /* PLT index */
ST r27, r29 st r27, r29
} }
{ {
move r2, lr /* retaddr */ move r2, lr /* retaddr */
@ -124,7 +124,7 @@
} }
ADDLI_PTR r28, sp, FRAME_STACKFRAME ADDLI_PTR r28, sp, FRAME_STACKFRAME
LD_PTR r28, r28 LD_PTR r28, r28
BGTZ r28, 1f bgtz r28, 1f
.else .else
{ {
move r0, r28 /* tpnt value 1 */ move r0, r28 /* tpnt value 1 */
@ -141,12 +141,12 @@
FOR_EACH_REG(RESTORE) FOR_EACH_REG(RESTORE)
.if \profile .if \profile
ADDLI_PTR r28, sp, FRAME_STACKFRAME ADDLI_PTR r28, sp, FRAME_STACKFRAME
LD r28, r28 ld r28, r28
BGTZ r28, 1f bgtz r28, 1f
.endif .endif
{ {
/* Restore original user return address. */ /* Restore original user return address. */
LD lr, r27 ld lr, r27
/* Pop off our stack frame. */ /* Pop off our stack frame. */
ADDLI_PTR sp, sp, \framesize ADDLI_PTR sp, sp, \framesize
} }
@ -162,11 +162,11 @@
} }
FOR_EACH_REG(SAVE) FOR_EACH_REG(SAVE)
{ {
LD r0, r28 ld r0, r28
ADDI_PTR r28, r28, FRAME_INDEX - FRAME_TPNT ADDI_PTR r28, r28, FRAME_INDEX - FRAME_TPNT
} }
{ {
LD r1, r28 ld r1, r28
ADDLI_PTR r2, sp, FRAME_REGS ADDLI_PTR r2, sp, FRAME_REGS
} }
{ {
@ -179,7 +179,7 @@
} }
FOR_EACH_REG(RESTORE) FOR_EACH_REG(RESTORE)
{ {
LD lr, lr ld lr, lr
ADDLI_PTR sp, sp, \framesize ADDLI_PTR sp, sp, \framesize
} }
jrp lr jrp lr

View File

@ -36,11 +36,11 @@ ENTRY(__sigsetjmp)
1: 1:
move r2, r0 move r2, r0
#define SAVE(r) { ST r2, r ; ADDI_PTR r2, r2, REGSIZE } #define SAVE(r) { st r2, r ; ADDI_PTR r2, r2, REGSIZE }
FOR_EACH_CALLEE_SAVED_REG(SAVE) FOR_EACH_CALLEE_SAVED_REG(SAVE)
mfspr r3, INTERRUPT_CRITICAL_SECTION mfspr r3, INTERRUPT_CRITICAL_SECTION
ST r2, r3 st r2, r3
j plt(__sigjmp_save) j plt(__sigjmp_save)
jrp lr /* Keep the backtracer happy. */ jrp lr /* Keep the backtracer happy. */
END(__sigsetjmp) END(__sigsetjmp)

View File

@ -109,11 +109,11 @@ _start:
/* Zero out callee space for return address. Unnecessary but free. /* Zero out callee space for return address. Unnecessary but free.
This is just paranoia to help backtracing not go awry. */ This is just paranoia to help backtracing not go awry. */
ST sp, zero st sp, zero
} }
{ {
/* Zero out our frame pointer for __libc_start_main. */ /* Zero out our frame pointer for __libc_start_main. */
ST r12, zero st r12, zero
/* Zero out lr to make __libc_start_main the end of backtrace. */ /* Zero out lr to make __libc_start_main the end of backtrace. */
move lr, zero move lr, zero

View File

@ -44,32 +44,32 @@ ENTRY (__clone)
/* Create a stack frame so we can pass callee-saves to new task. */ /* Create a stack frame so we can pass callee-saves to new task. */
{ {
move r10, sp move r10, sp
ST sp, lr st sp, lr
ADDI_PTR sp, sp, -FRAME_SIZE ADDI_PTR sp, sp, -FRAME_SIZE
} }
cfi_offset (lr, 0) cfi_offset (lr, 0)
cfi_def_cfa_offset (FRAME_SIZE) cfi_def_cfa_offset (FRAME_SIZE)
ADDI_PTR r11, sp, FRAME_SP ADDI_PTR r11, sp, FRAME_SP
{ {
ST r11, r10 st r11, r10
ADDI_PTR r11, sp, FRAME_R30 ADDI_PTR r11, sp, FRAME_R30
} }
{ {
ST r11, r30 st r11, r30
ADDI_PTR r11, sp, FRAME_R31 ADDI_PTR r11, sp, FRAME_R31
} }
cfi_offset (r30, FRAME_R30 - FRAME_SIZE) cfi_offset (r30, FRAME_R30 - FRAME_SIZE)
{ {
ST r11, r31 st r11, r31
ADDI_PTR r11, sp, FRAME_R32 ADDI_PTR r11, sp, FRAME_R32
} }
cfi_offset (r31, FRAME_R31 - FRAME_SIZE) cfi_offset (r31, FRAME_R31 - FRAME_SIZE)
ST r11, r32 st r11, r32
cfi_offset (r32, FRAME_R32 - FRAME_SIZE) cfi_offset (r32, FRAME_R32 - FRAME_SIZE)
/* sanity check arguments */ /* sanity check arguments */
BEQZ r0, .Linvalid beqz r0, .Linvalid
BEQZ r1, .Linvalid beqz r1, .Linvalid
/* Make sure child stack is properly aligned, and set up the /* Make sure child stack is properly aligned, and set up the
top frame so that we can call out of it immediately in the top frame so that we can call out of it immediately in the
@ -79,7 +79,7 @@ ENTRY (__clone)
ADDI_PTR r1, r1, -C_ABI_SAVE_AREA_SIZE ADDI_PTR r1, r1, -C_ABI_SAVE_AREA_SIZE
andi r1, r1, -C_ABI_SAVE_AREA_SIZE andi r1, r1, -C_ABI_SAVE_AREA_SIZE
ADDI_PTR r9, r1, REGSIZE /* sp of this frame on entry, i.e. zero */ ADDI_PTR r9, r1, REGSIZE /* sp of this frame on entry, i.e. zero */
ST r9, zero st r9, zero
/* We need to switch the argument convention around from /* We need to switch the argument convention around from
libc to kernel: libc to kernel:
@ -118,30 +118,30 @@ ENTRY (__clone)
moveli TREG_SYSCALL_NR_NAME, __NR_clone moveli TREG_SYSCALL_NR_NAME, __NR_clone
} }
swint1 swint1
BEQZ r0, .Lthread_start /* If in child task. */ beqz r0, .Lthread_start /* If in child task. */
.Ldone: .Ldone:
/* Restore the callee-saved registers and return. */ /* Restore the callee-saved registers and return. */
ADDLI_PTR lr, sp, FRAME_SIZE ADDLI_PTR lr, sp, FRAME_SIZE
{ {
LD lr, lr ld lr, lr
ADDLI_PTR r30, sp, FRAME_R30 ADDLI_PTR r30, sp, FRAME_R30
} }
{ {
LD r30, r30 ld r30, r30
ADDLI_PTR r31, sp, FRAME_R31 ADDLI_PTR r31, sp, FRAME_R31
} }
{ {
LD r31, r31 ld r31, r31
ADDLI_PTR r32, sp, FRAME_R32 ADDLI_PTR r32, sp, FRAME_R32
} }
{ {
LD r32, r32 ld r32, r32
ADDI_PTR sp, sp, FRAME_SIZE ADDI_PTR sp, sp, FRAME_SIZE
} }
cfi_def_cfa_offset (0) cfi_def_cfa_offset (0)
BNEZ r1, .Lerror bnez r1, .Lerror
jrp lr jrp lr
.Lerror: .Lerror:

View File

@ -33,38 +33,38 @@ ENTRY (__getcontext)
Save value "1" to uc_flags to later recognize getcontext(). */ Save value "1" to uc_flags to later recognize getcontext(). */
{ movei r11, 1; ADDI_PTR r10, r0, UC_FLAGS_OFFSET } { movei r11, 1; ADDI_PTR r10, r0, UC_FLAGS_OFFSET }
{ ST_PTR r10, r11; addli r10, r0, UC_REG(30) } { ST_PTR r10, r11; addli r10, r0, UC_REG(30) }
{ ST r10, r30; ADDI_PTR r10, r10, REGSIZE } { st r10, r30; ADDI_PTR r10, r10, REGSIZE }
{ ST r10, r31; ADDI_PTR r10, r10, REGSIZE } { st r10, r31; ADDI_PTR r10, r10, REGSIZE }
{ ST r10, r32; ADDI_PTR r10, r10, REGSIZE } { st r10, r32; ADDI_PTR r10, r10, REGSIZE }
{ ST r10, r33; ADDI_PTR r10, r10, REGSIZE } { st r10, r33; ADDI_PTR r10, r10, REGSIZE }
{ ST r10, r34; ADDI_PTR r10, r10, REGSIZE } { st r10, r34; ADDI_PTR r10, r10, REGSIZE }
{ ST r10, r35; ADDI_PTR r10, r10, REGSIZE } { st r10, r35; ADDI_PTR r10, r10, REGSIZE }
{ ST r10, r36; ADDI_PTR r10, r10, REGSIZE } { st r10, r36; ADDI_PTR r10, r10, REGSIZE }
{ ST r10, r37; ADDI_PTR r10, r10, REGSIZE } { st r10, r37; ADDI_PTR r10, r10, REGSIZE }
{ ST r10, r38; ADDI_PTR r10, r10, REGSIZE } { st r10, r38; ADDI_PTR r10, r10, REGSIZE }
{ ST r10, r39; ADDI_PTR r10, r10, REGSIZE } { st r10, r39; ADDI_PTR r10, r10, REGSIZE }
{ ST r10, r40; ADDI_PTR r10, r10, REGSIZE } { st r10, r40; ADDI_PTR r10, r10, REGSIZE }
{ ST r10, r41; ADDI_PTR r10, r10, REGSIZE } { st r10, r41; ADDI_PTR r10, r10, REGSIZE }
{ ST r10, r42; ADDI_PTR r10, r10, REGSIZE } { st r10, r42; ADDI_PTR r10, r10, REGSIZE }
{ ST r10, r43; ADDI_PTR r10, r10, REGSIZE } { st r10, r43; ADDI_PTR r10, r10, REGSIZE }
{ ST r10, r44; ADDI_PTR r10, r10, REGSIZE } { st r10, r44; ADDI_PTR r10, r10, REGSIZE }
{ ST r10, r45; ADDI_PTR r10, r10, REGSIZE } { st r10, r45; ADDI_PTR r10, r10, REGSIZE }
{ ST r10, r46; ADDI_PTR r10, r10, REGSIZE } { st r10, r46; ADDI_PTR r10, r10, REGSIZE }
{ ST r10, r47; ADDI_PTR r10, r10, REGSIZE } { st r10, r47; ADDI_PTR r10, r10, REGSIZE }
{ ST r10, r48; ADDI_PTR r10, r10, REGSIZE } { st r10, r48; ADDI_PTR r10, r10, REGSIZE }
{ ST r10, r49; ADDI_PTR r10, r10, REGSIZE } { st r10, r49; ADDI_PTR r10, r10, REGSIZE }
{ ST r10, r50; ADDI_PTR r10, r10, REGSIZE } { st r10, r50; ADDI_PTR r10, r10, REGSIZE }
{ ST r10, r51; ADDI_PTR r10, r10, REGSIZE } { st r10, r51; ADDI_PTR r10, r10, REGSIZE }
{ ST r10, r52; ADDI_PTR r10, r10, REGSIZE } { st r10, r52; ADDI_PTR r10, r10, REGSIZE }
{ ST r10, tp; ADDI_PTR r10, r10, REGSIZE } { st r10, tp; ADDI_PTR r10, r10, REGSIZE }
{ ST r10, sp; ADDI_PTR r10, r10, REGSIZE } { st r10, sp; ADDI_PTR r10, r10, REGSIZE }
{ ST r10, lr; ADDI_PTR r10, r10, REGSIZE } { st r10, lr; ADDI_PTR r10, r10, REGSIZE }
lnk r11 /* Point PC at the "jrp lr" instruction. */ lnk r11 /* Point PC at the "jrp lr" instruction. */
addli r11, r11, .Lreturn - . addli r11, r11, .Lreturn - .
{ ST r10, r11; ADDI_PTR r10, r10, REGSIZE } { st r10, r11; ADDI_PTR r10, r10, REGSIZE }
mfspr r11, INTERRUPT_CRITICAL_SECTION mfspr r11, INTERRUPT_CRITICAL_SECTION
{ {
ST r10, r11 st r10, r11
movei r1, 0 movei r1, 0
} }
@ -78,7 +78,7 @@ ENTRY (__getcontext)
moveli TREG_SYSCALL_NR_NAME, __NR_rt_sigprocmask moveli TREG_SYSCALL_NR_NAME, __NR_rt_sigprocmask
} }
swint1 swint1
BNEZ r1, .Lsyscall_error bnez r1, .Lsyscall_error
.Lreturn: .Lreturn:
{ {

View File

@ -35,7 +35,7 @@ ENTRY (__ioctl)
moveli TREG_SYSCALL_NR_NAME, __NR_ioctl moveli TREG_SYSCALL_NR_NAME, __NR_ioctl
} }
swint1 swint1
BNEZ r1, 0f bnez r1, 0f
jrp lr jrp lr
PSEUDO_END (__ioctl) PSEUDO_END (__ioctl)
libc_hidden_def (__ioctl) libc_hidden_def (__ioctl)

View File

@ -39,15 +39,15 @@ ENTRY (__setcontext)
#endif #endif
LD_PTR r10, r0 LD_PTR r10, r0
{ {
BEQZ r10, .Lsigreturn beqz r10, .Lsigreturn
addi r10, r10, -1 /* Confirm that it has value "1". */ addi r10, r10, -1 /* Confirm that it has value "1". */
} }
BNEZ r10, .Lbadcontext bnez r10, .Lbadcontext
/* Save lr and r0 briefly on the stack and set the signal mask: /* Save lr and r0 briefly on the stack and set the signal mask:
rt_sigprocmask (SIG_SETMASK, &ucp->uc_sigmask, NULL, _NSIG / 8). */ rt_sigprocmask (SIG_SETMASK, &ucp->uc_sigmask, NULL, _NSIG / 8). */
{ {
ST sp, lr st sp, lr
ADDI_PTR r11, sp, -(2 * REGSIZE) ADDI_PTR r11, sp, -(2 * REGSIZE)
move r10, sp move r10, sp
} }
@ -55,11 +55,11 @@ ENTRY (__setcontext)
cfi_def_cfa_offset (3 * REGSIZE) cfi_def_cfa_offset (3 * REGSIZE)
cfi_offset (lr, 0) cfi_offset (lr, 0)
{ {
ST r11, r10 st r11, r10
ADDI_PTR r10, sp, (2 * REGSIZE) ADDI_PTR r10, sp, (2 * REGSIZE)
} }
{ {
ST r10, r0 st r10, r0
ADDLI_PTR r1, r0, UC_SIGMASK_OFFSET ADDLI_PTR r1, r0, UC_SIGMASK_OFFSET
} }
cfi_offset (r0, -REGSIZE) cfi_offset (r0, -REGSIZE)
@ -74,62 +74,62 @@ ENTRY (__setcontext)
swint1 swint1
ADDI_PTR r11, sp, 2 * REGSIZE /* Restore uc_context to r11. */ ADDI_PTR r11, sp, 2 * REGSIZE /* Restore uc_context to r11. */
{ {
LD r11, r11 ld r11, r11
ADDI_PTR sp, sp, 3 * REGSIZE ADDI_PTR sp, sp, 3 * REGSIZE
} }
cfi_def_cfa_offset (0) cfi_def_cfa_offset (0)
LD lr, sp ld lr, sp
{ {
ADDI_PTR r10, r11, UC_REG(0) ADDI_PTR r10, r11, UC_REG(0)
BNEZ r1, .Lsyscall_error bnez r1, .Lsyscall_error
} }
/* Restore the argument registers; note they will be random /* Restore the argument registers; note they will be random
unless makecontext() has been called. */ unless makecontext() has been called. */
{ LD r0, r10; ADDI_PTR r10, r10, REGSIZE } { ld r0, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r1, r10; ADDI_PTR r10, r10, REGSIZE } { ld r1, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r2, r10; ADDI_PTR r10, r10, REGSIZE } { ld r2, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r3, r10; ADDI_PTR r10, r10, REGSIZE } { ld r3, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r4, r10; ADDI_PTR r10, r10, REGSIZE } { ld r4, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r5, r10; ADDI_PTR r10, r10, REGSIZE } { ld r5, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r6, r10; ADDI_PTR r10, r10, REGSIZE } { ld r6, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r7, r10; ADDI_PTR r10, r10, REGSIZE } { ld r7, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r8, r10; ADDI_PTR r10, r10, REGSIZE } { ld r8, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r9, r10; ADDLI_PTR r10, r10, UC_REG(30) - UC_REG(9) } { ld r9, r10; ADDLI_PTR r10, r10, UC_REG(30) - UC_REG(9) }
/* Restore the callee-saved GPRs. */ /* Restore the callee-saved GPRs. */
{ LD r30, r10; ADDI_PTR r10, r10, REGSIZE } { ld r30, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r31, r10; ADDI_PTR r10, r10, REGSIZE } { ld r31, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r32, r10; ADDI_PTR r10, r10, REGSIZE } { ld r32, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r33, r10; ADDI_PTR r10, r10, REGSIZE } { ld r33, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r34, r10; ADDI_PTR r10, r10, REGSIZE } { ld r34, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r35, r10; ADDI_PTR r10, r10, REGSIZE } { ld r35, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r36, r10; ADDI_PTR r10, r10, REGSIZE } { ld r36, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r37, r10; ADDI_PTR r10, r10, REGSIZE } { ld r37, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r38, r10; ADDI_PTR r10, r10, REGSIZE } { ld r38, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r39, r10; ADDI_PTR r10, r10, REGSIZE } { ld r39, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r40, r10; ADDI_PTR r10, r10, REGSIZE } { ld r40, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r41, r10; ADDI_PTR r10, r10, REGSIZE } { ld r41, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r42, r10; ADDI_PTR r10, r10, REGSIZE } { ld r42, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r43, r10; ADDI_PTR r10, r10, REGSIZE } { ld r43, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r44, r10; ADDI_PTR r10, r10, REGSIZE } { ld r44, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r45, r10; ADDI_PTR r10, r10, REGSIZE } { ld r45, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r46, r10; ADDI_PTR r10, r10, REGSIZE } { ld r46, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r47, r10; ADDI_PTR r10, r10, REGSIZE } { ld r47, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r48, r10; ADDI_PTR r10, r10, REGSIZE } { ld r48, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r49, r10; ADDI_PTR r10, r10, REGSIZE } { ld r49, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r50, r10; ADDI_PTR r10, r10, REGSIZE } { ld r50, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r51, r10; ADDI_PTR r10, r10, REGSIZE } { ld r51, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r52, r10; ADDI_PTR r10, r10, REGSIZE * 2 } { ld r52, r10; ADDI_PTR r10, r10, REGSIZE * 2 }
/* Skip tp since it must not change for a given thread. */ /* Skip tp since it must not change for a given thread. */
{ LD sp, r10; ADDI_PTR r10, r10, REGSIZE } { ld sp, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD lr, r10; ADDI_PTR r10, r10, REGSIZE } { ld lr, r10; ADDI_PTR r10, r10, REGSIZE }
{ LD r11, r10; ADDI_PTR r10, r10, REGSIZE } { ld r11, r10; ADDI_PTR r10, r10, REGSIZE }
/* Construct an iret context; we set ICS so we can validly load /* Construct an iret context; we set ICS so we can validly load
EX_CONTEXT for iret without being interrupted halfway through. */ EX_CONTEXT for iret without being interrupted halfway through. */
{ {
LD r12, r10 ld r12, r10
movei r13, 1 movei r13, 1
} }
{ {
@ -157,15 +157,15 @@ ENTRY (__setcontext)
cfi_def_cfa_offset (C_ABI_SAVE_AREA_SIZE + SI_MAX_SIZE + UC_SIZE) cfi_def_cfa_offset (C_ABI_SAVE_AREA_SIZE + SI_MAX_SIZE + UC_SIZE)
moveli r2, UC_SIZE / REGSIZE moveli r2, UC_SIZE / REGSIZE
0: { 0: {
LD r10, r0 ld r10, r0
ADDI_PTR r0, r0, REGSIZE ADDI_PTR r0, r0, REGSIZE
} }
{ {
ST r1, r10 st r1, r10
ADDI_PTR r1, r1, REGSIZE ADDI_PTR r1, r1, REGSIZE
addi r2, r2, -1 addi r2, r2, -1
} }
BNEZ r2, 0b bnez r2, 0b
moveli TREG_SYSCALL_NR_NAME, __NR_rt_sigreturn moveli TREG_SYSCALL_NR_NAME, __NR_rt_sigreturn
swint1 swint1
@ -193,7 +193,7 @@ ENTRY (__startcontext)
cfi_undefined (lr) cfi_undefined (lr)
FEEDBACK_ENTER(__startcontext) FEEDBACK_ENTER(__startcontext)
jalr r31 jalr r31
BEQZ r30, 1f beqz r30, 1f
{ {
move r0, r30 move r0, r30
jal __setcontext jal __setcontext

View File

@ -27,7 +27,7 @@ ENTRY (__swapcontext)
FEEDBACK_ENTER(__swapcontext) FEEDBACK_ENTER(__swapcontext)
/* Set up a frame and save r0 and r1. */ /* Set up a frame and save r0 and r1. */
{ {
ST sp, lr st sp, lr
ADDI_PTR r11, sp, -(3 * REGSIZE) ADDI_PTR r11, sp, -(3 * REGSIZE)
move r10, sp move r10, sp
} }
@ -35,43 +35,43 @@ ENTRY (__swapcontext)
cfi_def_cfa_offset (4 * REGSIZE) cfi_def_cfa_offset (4 * REGSIZE)
cfi_offset (lr, 0) cfi_offset (lr, 0)
{ {
ST r11, r10 st r11, r10
ADDI_PTR r10, sp, (2 * REGSIZE) ADDI_PTR r10, sp, (2 * REGSIZE)
} }
{ {
ST r10, r0 st r10, r0
ADDI_PTR r10, sp, (3 * REGSIZE) ADDI_PTR r10, sp, (3 * REGSIZE)
} }
ST r10, r1 st r10, r1
/* Save the current context. */ /* Save the current context. */
jal __getcontext jal __getcontext
/* Tear down the frame and restore r0, r1, and lr. */ /* Tear down the frame and restore r0, r1, and lr. */
{ {
BNEZ r0, .Lerror bnez r0, .Lerror
ADDI_PTR r1, sp, 3 * REGSIZE ADDI_PTR r1, sp, 3 * REGSIZE
} }
{ {
LD r1, r1 ld r1, r1
ADDI_PTR r0, sp, 2 * REGSIZE ADDI_PTR r0, sp, 2 * REGSIZE
} }
{ {
LD r0, r0 ld r0, r0
ADDI_PTR sp, sp, 4 * REGSIZE ADDI_PTR sp, sp, 4 * REGSIZE
} }
cfi_def_cfa_offset (0) cfi_def_cfa_offset (0)
{ {
LD lr, sp ld lr, sp
ADDLI_PTR r10, r0, UC_REG(54) ADDLI_PTR r10, r0, UC_REG(54)
} }
/* Update the stored sp and lr. */ /* Update the stored sp and lr. */
{ {
ST r10, sp st r10, sp
ADDLI_PTR r10, r0, UC_REG(55) ADDLI_PTR r10, r0, UC_REG(55)
} }
ST r10, lr st r10, lr
/* Tail-call setcontext to finish up. */ /* Tail-call setcontext to finish up. */
{ {
@ -82,7 +82,7 @@ ENTRY (__swapcontext)
.Lerror: .Lerror:
ADDI_PTR sp, sp, 4 * REGSIZE ADDI_PTR sp, sp, 4 * REGSIZE
cfi_def_cfa_offset (0) cfi_def_cfa_offset (0)
LD lr, sp ld lr, sp
jrp lr jrp lr
END (__swapcontext) END (__swapcontext)

View File

@ -27,6 +27,6 @@ ENTRY (syscall)
{ move r3, r4; move r4, r5 } { move r3, r4; move r4, r5 }
{ move r5, r6; move r6, r7 } { move r5, r6; move r6, r7 }
swint1 swint1
BNEZ r1, 0f bnez r1, 0f
jrp lr jrp lr
PSEUDO_END (syscall) PSEUDO_END (syscall)

View File

@ -40,7 +40,7 @@ ENTRY (__vfork)
moveli TREG_SYSCALL_NR_NAME, __NR_clone moveli TREG_SYSCALL_NR_NAME, __NR_clone
swint1 swint1
BNEZ r1, 0f bnez r1, 0f
jrp lr jrp lr
PSEUDO_END (__vfork) PSEUDO_END (__vfork)
libc_hidden_def (__vfork) libc_hidden_def (__vfork)