xref: /openbsd-src/lib/libc/arch/arm/sys/cerror.S (revision 4c4efc0ac71948c25fbd7928bf095843ea9b8ff6)
1*4c4efc0aSguenther/*	$OpenBSD: cerror.S,v 1.11 2023/02/11 06:10:39 guenther Exp $	*/
2d987040fSdrahn/*	$NetBSD: cerror.S,v 1.5 2003/08/07 16:42:04 agc Exp $	*/
3d987040fSdrahn
4d987040fSdrahn/*-
5d987040fSdrahn * Copyright (c) 1990 The Regents of the University of California.
6d987040fSdrahn * All rights reserved.
7d987040fSdrahn *
8d987040fSdrahn * Redistribution and use in source and binary forms, with or without
9d987040fSdrahn * modification, are permitted provided that the following conditions
10d987040fSdrahn * are met:
11d987040fSdrahn * 1. Redistributions of source code must retain the above copyright
12d987040fSdrahn *    notice, this list of conditions and the following disclaimer.
13d987040fSdrahn * 2. Redistributions in binary form must reproduce the above copyright
14d987040fSdrahn *    notice, this list of conditions and the following disclaimer in the
15d987040fSdrahn *    documentation and/or other materials provided with the distribution.
16d987040fSdrahn * 3. Neither the name of the University nor the names of its contributors
17d987040fSdrahn *    may be used to endorse or promote products derived from this software
18d987040fSdrahn *    without specific prior written permission.
19d987040fSdrahn *
20d987040fSdrahn * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21d987040fSdrahn * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22d987040fSdrahn * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23d987040fSdrahn * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24d987040fSdrahn * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25d987040fSdrahn * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26d987040fSdrahn * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27d987040fSdrahn * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28d987040fSdrahn * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29d987040fSdrahn * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30d987040fSdrahn * SUCH DAMAGE.
31d987040fSdrahn *
32d987040fSdrahn *	from: @(#)cerror.s	5.1 (Berkeley) 4/23/90
33d987040fSdrahn */
34d987040fSdrahn
35d987040fSdrahn#include "SYS.h"
36d987040fSdrahn
37aa9f6bfeSguenther/* offsetof(struct tib, tib_errno) - offsetof(struct tib, __tib_tcb) */
38aa9f6bfeSguenther#define TCB_OFFSET_ERRNO	(-8)
39aa9f6bfeSguenther
40fe38b55cSguenther_ENTRY(CERROR)
41aa9f6bfeSguenther	mrc	p15, 0, r1, c13, c0, 3
42aa9f6bfeSguenther	str	r0, [r1, #TCB_OFFSET_ERRNO]
43d987040fSdrahn	mvn	r0, #0x00000000
44*4c4efc0aSguenther	mvn	r1, #0x00000000	/* for lseek */
45aa9f6bfeSguenther	mov	pc, lr
46aa9f6bfeSguentherEND(CERROR)
47