diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2016-09-22 18:20:00 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2016-09-22 18:20:00 +0000 |
commit | 163c178c28c692a3f94d13642cd8004f806b050b (patch) | |
tree | 66d5a7f01e73326bc6473890cd1e2039db797afa /lib | |
parent | 0c24f9e43bf6a6818747c0cf2ca813ac21b918ae (diff) |
Simplify __cerror now that %r27 is always the TCB pointer.
Don't need a PLT relocation for __cerror.
Move macros for doing internal aliases in ASM from SYS.h to DEFS.h
__cerror tweaks by Miod Vallat, testing by aoyama@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/arch/m88k/DEFS.h | 24 | ||||
-rw-r--r-- | lib/libc/arch/m88k/SYS.h | 30 | ||||
-rw-r--r-- | lib/libc/arch/m88k/sys/cerror.S | 40 |
3 files changed, 40 insertions, 54 deletions
diff --git a/lib/libc/arch/m88k/DEFS.h b/lib/libc/arch/m88k/DEFS.h index e9c0af2c3dc..3db1a435fc1 100644 --- a/lib/libc/arch/m88k/DEFS.h +++ b/lib/libc/arch/m88k/DEFS.h @@ -1,3 +1,25 @@ -/* $OpenBSD: DEFS.h,v 1.2 2000/03/01 17:31:20 todd Exp $ */ +/* $OpenBSD: DEFS.h,v 1.3 2016/09/22 18:19:59 guenther Exp $ */ #include <machine/asm.h> + +/* + * We define a hidden alias with the prefix "_libc_" for each global symbol + * that may be used internally. By referencing _libc_x instead of x, other + * parts of libc prevent overriding by the application and avoid unnecessary + * relocations. + */ +#define _HIDDEN(x) _libc_##x +#define _HIDDEN_ALIAS(x,y) \ + STRONG_ALIAS(_HIDDEN(x),y); \ + .hidden _HIDDEN(x) +#define _HIDDEN_FALIAS(x,y) \ + _HIDDEN_ALIAS(x,y); \ + .type _HIDDEN(x),@function + +/* + * For functions implemented in ASM that aren't syscalls. + * END_STRONG(x) Like DEF_STRONG() in C; for standard/reserved C names + * END_WEAK(x) Like DEF_WEAK() in C; for non-ISO C names + */ +#define END_STRONG(x) END(x); _HIDDEN_FALIAS(x,x); END(_HIDDEN(x)) +#define END_WEAK(x) END_STRONG(x); .weak x diff --git a/lib/libc/arch/m88k/SYS.h b/lib/libc/arch/m88k/SYS.h index b6d4ce2b825..636b5e7ea82 100644 --- a/lib/libc/arch/m88k/SYS.h +++ b/lib/libc/arch/m88k/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.23 2016/06/16 03:21:09 guenther Exp $*/ +/* $OpenBSD: SYS.h,v 1.24 2016/09/22 18:19:59 guenther Exp $*/ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -35,29 +35,7 @@ */ #include <sys/syscall.h> -#include <machine/asm.h> - -/* - * We define a hidden alias with the prefix "_libc_" for each global symbol - * that may be used internally. By referencing _libc_x instead of x, other - * parts of libc prevent overriding by the application and avoid unnecessary - * relocations. - */ -#define _HIDDEN(x) _libc_##x -#define _HIDDEN_ALIAS(x,y) \ - STRONG_ALIAS(_HIDDEN(x),y); \ - .hidden _HIDDEN(x) -#define _HIDDEN_FALIAS(x,y) \ - _HIDDEN_ALIAS(x,y); \ - .type _HIDDEN(x),@function - -/* - * For functions implemented in ASM that aren't syscalls. - * END_STRONG(x) Like DEF_STRONG() in C; for standard/reserved C names - * END_WEAK(x) Like DEF_WEAK() in C; for non-ISO C names - */ -#define END_STRONG(x) END(x); _HIDDEN_FALIAS(x,x); END(_HIDDEN(x)) -#define END_WEAK(x) END_STRONG(x); .weak x +#include "DEFS.h" #define __CONCAT(p,x) p##x @@ -69,7 +47,6 @@ #define __ALIAS(prefix,name) WEAK_ALIAS(name,__CONCAT(prefix,name)) #ifdef __PIC__ -#define CERROR __cerror#plt #define PIC_SAVE(reg) or reg, %r25, %r0 #define PIC_RESTORE(reg) or %r25, reg, %r0 #define PIC_SETUP \ @@ -96,9 +73,8 @@ ld %r11, %r25, __CONCAT(sym,#got_rel); \ st reg, %r11, %r0 #endif -#else -#define CERROR __cerror #endif +#define CERROR __cerror #define __DO_SYSCALL(x) \ or %r13, %r0, __SYSCALLNAME(SYS_,x); \ diff --git a/lib/libc/arch/m88k/sys/cerror.S b/lib/libc/arch/m88k/sys/cerror.S index 5fa6765c740..20b2d43581a 100644 --- a/lib/libc/arch/m88k/sys/cerror.S +++ b/lib/libc/arch/m88k/sys/cerror.S @@ -1,4 +1,4 @@ -/* $OpenBSD: cerror.S,v 1.13 2016/05/07 19:05:21 guenther Exp $ */ +/* $OpenBSD: cerror.S,v 1.14 2016/09/22 18:19:59 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -35,7 +35,7 @@ #include "DEFS.h" - .globl _C_LABEL(__errno) + .globl _HIDDEN(__errno) /* * long long __cerror(register_t errcode) @@ -44,29 +44,17 @@ */ ASENTRY(__cerror) - /* if %r26 has been initialized, don't bother setting up a frame */ - bcnd ne0, %r26, has_r26 - - subu %r31,%r31,16 - st %r25,%r0,%r31 - st %r1,%r31,4 - -#ifdef __PIC__ - bsr.n _C_LABEL(__errno)#plt -#else - bsr.n _C_LABEL(__errno) -#endif - or %r25,%r0,%r2 - or %r26,%r0,%r2 /* save errno ptr */ - or %r2,%r0,%r25 /* and restore errno value */ - - ld %r1,%r31,4 - ld %r25,%r0,%r31 - addu %r31,%r31,16 - -has_r26: - st %r2,%r0,%r26 - subu %r2,%r0,1 + subu %r4,%r27,8 + subu %r3,%r0,1 + st %r2,%r4,%r0 jmp.n %r1 - or %r3, %r0, %r2 + or %r2, %r0, %r3 END(__cerror) + +#if 0 +/* ahh, if only */ +ASENTRY(__errno) + jmp.n %r1 + subu %r2,%r27,8 +END(__errno) +#endif |