ppc, ppc64: use common ALIAS/FUNC/END macros

pull/24/head
Daniel Kolesa 2021-01-08 04:52:46 +01:00
parent 6026980cac
commit cf05112306
8 changed files with 48 additions and 47 deletions

View File

@ -10,12 +10,12 @@
* from the use of this software. * from the use of this software.
*/ */
.global libucontext_getcontext #include "common-defs.h"
ALIAS(getcontext, libucontext_getcontext)
.hidden __libucontext_swapcontext .hidden __libucontext_swapcontext
.type libucontext_getcontext, @function FUNC(libucontext_getcontext)
libucontext_getcontext:
li 4, 0 li 4, 0
b __libucontext_swapcontext@local b __libucontext_swapcontext@local
END(libucontext_getcontext)
.weak getcontext
getcontext = libucontext_getcontext

View File

@ -10,13 +10,13 @@
* from the use of this software. * from the use of this software.
*/ */
.global libucontext_setcontext #include "common-defs.h"
ALIAS(setcontext, libucontext_setcontext)
.hidden __libucontext_swapcontext .hidden __libucontext_swapcontext
.type libucontext_setcontext, @function FUNC(libucontext_setcontext)
libucontext_setcontext:
mr 4, 3 mr 4, 3
li 3, 0 li 3, 0
b __libucontext_swapcontext@local b __libucontext_swapcontext@local
END(libucontext_setcontext)
.weak setcontext
setcontext = libucontext_setcontext

View File

@ -10,8 +10,10 @@
* from the use of this software. * from the use of this software.
*/ */
.globl libucontext_trampoline; #include "common-defs.h"
libucontext_trampoline:
.hidden libucontext_trampoline
FUNC(libucontext_trampoline)
/* get the proper context into position and test for NULL */ /* get the proper context into position and test for NULL */
mr. 3,31 mr. 3,31
@ -23,3 +25,4 @@ libucontext_trampoline:
no_linked_context: no_linked_context:
b exit@GOT b exit@GOT
END(libucontext_trampoline)

View File

@ -10,18 +10,16 @@
* from the use of this software. * from the use of this software.
*/ */
.global __libucontext_swapcontext #include "common-defs.h"
.type __libucontext_swapcontext, @function
__libucontext_swapcontext: ALIAS(swapcontext, __libucontext_swapcontext)
ALIAS(libucontext_swapcontext, __libucontext_swapcontext)
FUNC(__libucontext_swapcontext)
li 0, 249 # SYS_swapcontext li 0, 249 # SYS_swapcontext
li 5, 1184 # sizeof(ucontext_t) li 5, 1184 # sizeof(ucontext_t)
sc sc
.hidden __retfromsyscall .hidden __retfromsyscall
b __retfromsyscall@local b __retfromsyscall@local
END(__libucontext_swapcontext)
.weak swapcontext
swapcontext = libucontext_swapcontext
.weak libucontext_swapcontext
libucontext_swapcontext = __libucontext_swapcontext

View File

@ -10,10 +10,12 @@
* from the use of this software. * from the use of this software.
*/ */
.global libucontext_getcontext #include "common-defs.h"
ALIAS(getcontext, libucontext_getcontext)
.hidden __libucontext_swapcontext .hidden __libucontext_swapcontext
.type libucontext_getcontext, @function FUNC(libucontext_getcontext)
libucontext_getcontext:
addis 2, 12, .TOC.-libucontext_getcontext@ha addis 2, 12, .TOC.-libucontext_getcontext@ha
addi 2, 12, .TOC.-libucontext_getcontext@l addi 2, 12, .TOC.-libucontext_getcontext@l
@ -21,6 +23,4 @@ libucontext_getcontext:
li 4, 0 li 4, 0
b __libucontext_swapcontext b __libucontext_swapcontext
END(libucontext_getcontext)
.weak getcontext
getcontext = libucontext_getcontext

View File

@ -10,10 +10,12 @@
* from the use of this software. * from the use of this software.
*/ */
.global libucontext_setcontext #include "common-defs.h"
ALIAS(setcontext, libucontext_setcontext)
.hidden __libucontext_swapcontext .hidden __libucontext_swapcontext
.type libucontext_setcontext, @function FUNC(libucontext_setcontext)
libucontext_setcontext:
addis 2, 12, .TOC.-libucontext_setcontext@ha addis 2, 12, .TOC.-libucontext_setcontext@ha
addi 2, 12, .TOC.-libucontext_setcontext@l addi 2, 12, .TOC.-libucontext_setcontext@l
@ -22,6 +24,4 @@ libucontext_setcontext:
mr 4, 3 mr 4, 3
li 3, 0 li 3, 0
b __libucontext_swapcontext b __libucontext_swapcontext
END(libucontext_setcontext)
.weak setcontext
setcontext = libucontext_setcontext

View File

@ -10,9 +10,10 @@
* from the use of this software. * from the use of this software.
*/ */
.globl libucontext_trampoline; #include "common-defs.h"
.hidden libucontext_trampoline;
libucontext_trampoline: .hidden libucontext_trampoline
FUNC(libucontext_trampoline)
cmpdi 31,0 /* test if ucontext link pointer is null */ cmpdi 31,0 /* test if ucontext link pointer is null */
beq no_linked_context /* if it is, exit */ beq no_linked_context /* if it is, exit */
@ -29,3 +30,4 @@ libucontext_trampoline:
no_linked_context: no_linked_context:
b exit@GOT b exit@GOT
nop nop
END(libucontext_trampoline)

View File

@ -10,9 +10,12 @@
* from the use of this software. * from the use of this software.
*/ */
.global __libucontext_swapcontext #include "common-defs.h"
.type __libucontext_swapcontext, @function
__libucontext_swapcontext: ALIAS(swapcontext, __libucontext_swapcontext)
ALIAS(libucontext_swapcontext, __libucontext_swapcontext)
FUNC(__libucontext_swapcontext)
addis 2, 12, .TOC.-__libucontext_swapcontext@ha addis 2, 12, .TOC.-__libucontext_swapcontext@ha
addi 2, 12, .TOC.-__libucontext_swapcontext@l addi 2, 12, .TOC.-__libucontext_swapcontext@l
@ -24,9 +27,4 @@ __libucontext_swapcontext:
.hidden __retfromsyscall .hidden __retfromsyscall
b __retfromsyscall b __retfromsyscall
END(__libucontext_swapcontext)
.weak swapcontext
swapcontext = __libucontext_swapcontext
.weak libucontext_swapcontext
libucontext_swapcontext = __libucontext_swapcontext