xref: /openbsd/lib/libc/arch/mips64/sys/cerror.S (revision fe38b55c)
1*fe38b55cSguenther/*	$OpenBSD: cerror.S,v 1.7 2016/05/07 19:05:22 guenther Exp $ */
20eea0d08Spefo/*-
30eea0d08Spefo * Copyright (c) 1991, 1993
40eea0d08Spefo *	The Regents of the University of California.  All rights reserved.
50eea0d08Spefo *
60eea0d08Spefo * This code is derived from software contributed to Berkeley by
70eea0d08Spefo * Ralph Campbell.
80eea0d08Spefo *
90eea0d08Spefo * Redistribution and use in source and binary forms, with or without
100eea0d08Spefo * modification, are permitted provided that the following conditions
110eea0d08Spefo * are met:
120eea0d08Spefo * 1. Redistributions of source code must retain the above copyright
130eea0d08Spefo *    notice, this list of conditions and the following disclaimer.
140eea0d08Spefo * 2. Redistributions in binary form must reproduce the above copyright
150eea0d08Spefo *    notice, this list of conditions and the following disclaimer in the
160eea0d08Spefo *    documentation and/or other materials provided with the distribution.
170eea0d08Spefo * 3. Neither the name of the University nor the names of its contributors
180eea0d08Spefo *    may be used to endorse or promote products derived from this software
190eea0d08Spefo *    without specific prior written permission.
200eea0d08Spefo *
210eea0d08Spefo * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
220eea0d08Spefo * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
230eea0d08Spefo * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
240eea0d08Spefo * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
250eea0d08Spefo * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
260eea0d08Spefo * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
270eea0d08Spefo * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
280eea0d08Spefo * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
290eea0d08Spefo * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
300eea0d08Spefo * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
310eea0d08Spefo * SUCH DAMAGE.
320eea0d08Spefo */
330eea0d08Spefo
340eea0d08Spefo#include "SYS.h"
350eea0d08Spefo
36*fe38b55cSguentherFRAMESZ= 4*REGSZ
37*fe38b55cSguentherS0OFF= FRAMESZ-3*REGSZ
385738bc62SpefoGPOFF= FRAMESZ-2*REGSZ
39*fe38b55cSguentherRAOFF= FRAMESZ-1*REGSZ
405738bc62Spefo
41*fe38b55cSguenther	.hidden	_thread_cb
42*fe38b55cSguenther	.hidden	CERROR
439372e0f0Sguenther
44*fe38b55cSguentherNON_LEAF(CERROR, FRAMESZ, ra)
455738bc62Spefo	PTR_SUBU sp, FRAMESZ
46*fe38b55cSguenther#if !__PIC__ || !notyet
47*fe38b55cSguenther	SETUP_GP64(GPOFF, CERROR)
48*fe38b55cSguenther#endif
49*fe38b55cSguenther	.set	reorder
50*fe38b55cSguenther	REG_S	ra, RAOFF(sp)
51*fe38b55cSguenther	REG_S	s0, S0OFF(sp)
52*fe38b55cSguenther
53*fe38b55cSguenther	move	s0, v0
54*fe38b55cSguenther	dla	v0, _thread_cb
55*fe38b55cSguenther	ld	t9, 0(v0)
56*fe38b55cSguenther	jal	t9
57*fe38b55cSguenther
58*fe38b55cSguenther	sw	s0, 0(v0)
59*fe38b55cSguenther
60*fe38b55cSguenther	LI	v0, -1
61*fe38b55cSguenther	REG_L	s0, S0OFF(sp)
62*fe38b55cSguenther	REG_L	ra, RAOFF(sp)
63*fe38b55cSguenther#if !__PIC__ || !notyet
645738bc62Spefo	RESTORE_GP64
65*fe38b55cSguenther#endif
665738bc62Spefo	PTR_ADDU sp, FRAMESZ
670eea0d08Spefo	j	ra
68*fe38b55cSguentherEND(CERROR)
69