diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2016-05-16 16:20:59 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2016-05-16 16:20:59 +0000 |
commit | c6346875bf6b262bd6ba36838dff4ddb7a4eff9e (patch) | |
tree | 1bc69f8d72e2e2c9b6ad949750e6cd5f95d4bd52 /lib/libc/arch/alpha | |
parent | 1846c0f2c58becf59288e3ac719fa1d1f3efcfdf (diff) |
Eliminate cerror: use PAL_rdunique to get the TCB address directly
ok deraadt@ kettenis@
Diffstat (limited to 'lib/libc/arch/alpha')
-rw-r--r-- | lib/libc/arch/alpha/Makefile.inc | 4 | ||||
-rw-r--r-- | lib/libc/arch/alpha/SYS.h | 13 | ||||
-rw-r--r-- | lib/libc/arch/alpha/sys/cerror.S | 54 |
3 files changed, 12 insertions, 59 deletions
diff --git a/lib/libc/arch/alpha/Makefile.inc b/lib/libc/arch/alpha/Makefile.inc index 050910e7bcd..b4f278f5f57 100644 --- a/lib/libc/arch/alpha/Makefile.inc +++ b/lib/libc/arch/alpha/Makefile.inc @@ -1,8 +1,6 @@ -# $OpenBSD: Makefile.inc,v 1.7 2016/05/07 19:05:21 guenther Exp $ +# $OpenBSD: Makefile.inc,v 1.8 2016/05/16 16:20:58 guenther Exp $ # $NetBSD: Makefile.inc,v 1.4 1996/10/17 02:58:18 cgd Exp $ -CERROR= cerror.S - # `source' files built from m4 source SRCS+= __divqu.S __divq.S __divlu.S __divl.S SRCS+= __remqu.S __remq.S __remlu.S __reml.S diff --git a/lib/libc/arch/alpha/SYS.h b/lib/libc/arch/alpha/SYS.h index c1bb2bef372..b84d0801aac 100644 --- a/lib/libc/arch/alpha/SYS.h +++ b/lib/libc/arch/alpha/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.13 2015/10/23 04:39:24 guenther Exp $ */ +/* $OpenBSD: SYS.h,v 1.14 2016/05/16 16:20:58 guenther Exp $ */ /* $NetBSD: SYS.h,v 1.4 1996/10/17 03:03:53 cgd Exp $ */ /* @@ -29,8 +29,13 @@ */ #include <machine/asm.h> +#include <machine/pal.h> /* for PAL_rdunique */ #include <sys/syscall.h> + +/* offsetof(struct tib, tib_errno) - offsetof(struct tib, __tib_tcb) */ +#define TCB_OFFSET_ERRNO (-12) + /* * 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 @@ -67,7 +72,11 @@ LLABEL(name,0): \ LDGP(gp); \ beq a3, LLABEL(name,1); \ - jmp zero, __cerror; \ + mov v0, t0; \ + call_pal PAL_rdunique; \ + stl t0, TCB_OFFSET_ERRNO(v0); \ + ldiq v0, -1; \ + RET; \ LLABEL(name,1): #define __LEAF(p,n,e) \ diff --git a/lib/libc/arch/alpha/sys/cerror.S b/lib/libc/arch/alpha/sys/cerror.S deleted file mode 100644 index 6bee6c9e106..00000000000 --- a/lib/libc/arch/alpha/sys/cerror.S +++ /dev/null @@ -1,54 +0,0 @@ -/* $OpenBSD: cerror.S,v 1.7 2016/05/07 19:05:21 guenther Exp $ */ -/* $NetBSD: cerror.S,v 1.3 1996/10/17 03:08:17 cgd Exp $ */ - -/* - * Copyright (c) 1994, 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#include "SYS.h" - -#define FRAME_SIZE 16 -#define FRAME_RA_OFFSET 0 -#define FRAME_V0_OFFSET 8 - -NESTED(__cerror, 0, FRAME_SIZE, ra, IM_RA|IM_V0, 0) -LEAF_NOPROFILE(__cerror, 0) - br t0, L1 -L1: LDGP(t0) - - lda sp, -FRAME_SIZE(sp) - stq ra, FRAME_RA_OFFSET(sp) - stq v0, FRAME_V0_OFFSET(sp) - - CALL(__errno) - - ldq t0, FRAME_V0_OFFSET(sp) - stl t0, 0(v0) - ldiq v0, -1 - ldq ra, FRAME_RA_OFFSET(sp) - lda sp, FRAME_SIZE(sp) - RET -END(__cerror) |