if _REENTRANT is defined, store the error value in (*__errno()), rather than

in errno directly, to support threads packages.
This commit is contained in:
cgd 1996-11-08 00:52:46 +00:00
parent c30a5d9842
commit 1ae38b6471
1 changed files with 27 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cerror.S,v 1.3 1996/10/17 03:08:17 cgd Exp $ */
/* $NetBSD: cerror.S,v 1.4 1996/11/08 00:52:46 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@ -29,12 +29,37 @@
#include "SYS.h"
IMPORT(errno, 4)
#ifdef _REENTRANT
#define FRAME_SIZE 16
#define FRAME_RA_OFFSET 0
#define FRAME_V0_OFFSET 8
#endif
#ifdef _REENTRANT
NESTED(cerror, 0, FRAME_SIZE, ra, IM_RA|IM_V0, 0)
#else
LEAF(cerror, 0)
#endif
br t0, L1
L1: LDGP(t0)
#ifdef _REENTRANT
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)
#else
stl v0, errno
#endif
ldiq v0, -1
#ifdef _REENTRANT
ldq ra, FRAME_RA_OFFSET(sp)
lda sp, FRAME_SIZE(sp)
#endif
RET
END(cerror)