Unify our assembler macros.
Our <machine/asm.h> files were modified from upstream, to the extent
that no architecture was actually using the upstream ENTRY or END macros,
assuming that architecture even had such a macro upstream. This patch moves
everyone to the same macros, with just a few tweaks remaining in the
<machine/asm.h> files, which no one should now use directly.
I've removed most of the unused cruft from the <machine/asm.h> files, though
there's still rather a lot in the mips/mips64 ones.
Bug: 12229603
Change-Id: I2fff287dc571ac1087abe9070362fb9420d85d6d
diff --git a/libc/arch-x86_64/bionic/__bionic_clone.S b/libc/arch-x86_64/bionic/__bionic_clone.S
index 7692013..cf98d76 100644
--- a/libc/arch-x86_64/bionic/__bionic_clone.S
+++ b/libc/arch-x86_64/bionic/__bionic_clone.S
@@ -26,8 +26,7 @@
* SUCH DAMAGE.
*/
-#include <asm/unistd.h>
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
// pid_t __bionic_clone(int flags, void* child_stack, pid_t* parent_tid, void* tls, pid_t* child_tid, int (*fn)(void*), void* arg);
ENTRY(__bionic_clone)
diff --git a/libc/arch-x86_64/bionic/__get_sp.S b/libc/arch-x86_64/bionic/__get_sp.S
index 0c693b3..9cc18a9 100644
--- a/libc/arch-x86_64/bionic/__get_sp.S
+++ b/libc/arch-x86_64/bionic/__get_sp.S
@@ -26,7 +26,7 @@
* SUCH DAMAGE.
*/
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
ENTRY(__get_sp)
mov %rsp, %rax
diff --git a/libc/arch-x86_64/bionic/__rt_sigreturn.S b/libc/arch-x86_64/bionic/__rt_sigreturn.S
index e03bb88..eddceb1 100644
--- a/libc/arch-x86_64/bionic/__rt_sigreturn.S
+++ b/libc/arch-x86_64/bionic/__rt_sigreturn.S
@@ -26,11 +26,9 @@
* SUCH DAMAGE.
*/
-#include <asm/unistd.h>
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
-ENTRY(__rt_sigreturn)
- .hidden _C_LABEL(__rt_sigreturn) // TODO: add an ENTRY_PRIVATE macro for x86_64.
+ENTRY_PRIVATE(__rt_sigreturn)
movl $__NR_rt_sigreturn, %eax
syscall
END(__rt_sigreturn)
diff --git a/libc/arch-x86_64/bionic/_setjmp.S b/libc/arch-x86_64/bionic/_setjmp.S
index e9b8dbb..c617030 100644
--- a/libc/arch-x86_64/bionic/_setjmp.S
+++ b/libc/arch-x86_64/bionic/_setjmp.S
@@ -36,8 +36,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
#include <machine/setjmp.h>
/*
diff --git a/libc/arch-x86_64/bionic/setjmp.S b/libc/arch-x86_64/bionic/setjmp.S
index 3f4a432..c81b573 100644
--- a/libc/arch-x86_64/bionic/setjmp.S
+++ b/libc/arch-x86_64/bionic/setjmp.S
@@ -36,8 +36,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
#include <machine/setjmp.h>
/*
diff --git a/libc/arch-x86_64/bionic/sigsetjmp.S b/libc/arch-x86_64/bionic/sigsetjmp.S
index 174222f..718743f 100644
--- a/libc/arch-x86_64/bionic/sigsetjmp.S
+++ b/libc/arch-x86_64/bionic/sigsetjmp.S
@@ -37,7 +37,7 @@
*/
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
#include <machine/setjmp.h>
/*
diff --git a/libc/arch-x86_64/include/machine/asm.h b/libc/arch-x86_64/include/machine/asm.h
index 310b230..0af6dae 100644
--- a/libc/arch-x86_64/include/machine/asm.h
+++ b/libc/arch-x86_64/include/machine/asm.h
@@ -37,8 +37,6 @@
#ifndef _AMD64_ASM_H_
#define _AMD64_ASM_H_
-#ifdef __x86_64__
-
#ifdef __PIC__
#define PIC_PLT(x) x@PLT
#define PIC_GOT(x) x@GOTPCREL(%rip)
@@ -47,19 +45,6 @@
#define PIC_GOT(x) x
#endif
-# define _C_LABEL(x) x
-#define _ASM_LABEL(x) x
-
-#define CVAROFF(x,y) (_C_LABEL(x)+y)(%rip)
-
-#ifdef __STDC__
-# define __CONCAT(x,y) x ## y
-# define __STRING(x) #x
-#else
-# define __CONCAT(x,y) x/**/y
-# define __STRING(x) "x"
-#endif
-
/* let kernels and others override entrypoint alignment */
#ifndef _ALIGN_TEXT
# ifdef _STANDALONE
@@ -69,78 +54,4 @@
# endif
#endif
-#define _ENTRY(x) \
- .text; _ALIGN_TEXT; .globl x; .type x,@function; x: .cfi_startproc;
-#define _LABEL(x) \
- .globl x; x:
-
-#ifdef _KERNEL
-/* XXX Can't use __CONCAT() here, as it would be evaluated incorrectly. */
-#ifdef __STDC__
-#define IDTVEC(name) \
- ALIGN_TEXT; .globl X ## name; .type X ## name,@function; X ## name:
-#define IDTVEC_END(name) \
- .size X ## name, . - X ## name
-#else
-#define IDTVEC(name) \
- ALIGN_TEXT; .globl X/**/name; .type X/**/name,@function; X/**/name:
-#define IDTVEC_END(name) \
- .size X/**/name, . - X/**/name
-#endif /* __STDC__ */
-#endif /* _KERNEL */
-
-#ifdef __STDC__
-#define CPUVAR(off) %gs:CPU_INFO_ ## off
-#else
-#define CPUVAR(off) %gs:CPU_INFO_/**/off
-#endif
-
-
-#ifdef GPROF
-# define _PROF_PROLOGUE \
- pushq %rbp; leaq (%rsp),%rbp; call PIC_PLT(__mcount); popq %rbp
-#else
-# define _PROF_PROLOGUE
-#endif
-
-#define ENTRY(y) _ENTRY(_C_LABEL(y)); _PROF_PROLOGUE
-#define NENTRY(y) _ENTRY(_C_LABEL(y))
-#define ALTENTRY(x) NENTRY(x)
-#define ASENTRY(y) _ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
-#define LABEL(y) _LABEL(_C_LABEL(y))
-#define END(y) .cfi_endproc; .size y, . - y
-
-#define ASMSTR .asciz
-
-#define RCSID(x) .pushsection ".ident"; .asciz x; .popsection
-
-#define WEAK_ALIAS(alias,sym) \
- .weak alias; \
- alias = sym
-
-/*
- * STRONG_ALIAS: create a strong alias.
- */
-#define STRONG_ALIAS(alias,sym) \
- .globl alias; \
- alias = sym
-
-#ifdef __STDC__
-#define WARN_REFERENCES(sym,msg) \
- .pushsection .gnu.warning. ## sym; \
- .ascii msg; \
- .popsection
-#else
-#define WARN_REFERENCES(sym,msg) \
- .pushsection .gnu.warning./**/sym; \
- .ascii msg; \
- .popsection
-#endif /* __STDC__ */
-
-#else /* __x86_64__ */
-
-#include <i386/asm.h>
-
-#endif /* __x86_64__ */
-
#endif /* !_AMD64_ASM_H_ */