xref: /openbsd-src/sys/arch/arm/include/undefined.h (revision e61d6212cec1591cdd89b42f0117cf9bfbb56abb)
1*e61d6212Spatrick /*	$OpenBSD: undefined.h,v 1.4 2019/03/13 09:28:21 patrick Exp $	*/
2e1e4f5b1Sdrahn /*	$NetBSD: undefined.h,v 1.4 2001/12/20 01:20:23 thorpej Exp $	*/
3e1e4f5b1Sdrahn 
4e1e4f5b1Sdrahn /*
5e1e4f5b1Sdrahn  * Copyright (c) 1995-1996 Mark Brinicombe.
6e1e4f5b1Sdrahn  * Copyright (c) 1995 Brini.
7e1e4f5b1Sdrahn  * All rights reserved.
8e1e4f5b1Sdrahn  *
9e1e4f5b1Sdrahn  * This code is derived from software written for Brini by Mark Brinicombe
10e1e4f5b1Sdrahn  *
11e1e4f5b1Sdrahn  * Redistribution and use in source and binary forms, with or without
12e1e4f5b1Sdrahn  * modification, are permitted provided that the following conditions
13e1e4f5b1Sdrahn  * are met:
14e1e4f5b1Sdrahn  * 1. Redistributions of source code must retain the above copyright
15e1e4f5b1Sdrahn  *    notice, this list of conditions and the following disclaimer.
16e1e4f5b1Sdrahn  * 2. Redistributions in binary form must reproduce the above copyright
17e1e4f5b1Sdrahn  *    notice, this list of conditions and the following disclaimer in the
18e1e4f5b1Sdrahn  *    documentation and/or other materials provided with the distribution.
19e1e4f5b1Sdrahn  * 3. All advertising materials mentioning features or use of this software
20e1e4f5b1Sdrahn  *    must display the following acknowledgement:
21e1e4f5b1Sdrahn  *	This product includes software developed by Brini.
22e1e4f5b1Sdrahn  * 4. The name of the company nor the name of the author may be used to
23e1e4f5b1Sdrahn  *    endorse or promote products derived from this software without specific
24e1e4f5b1Sdrahn  *    prior written permission.
25e1e4f5b1Sdrahn  *
26e1e4f5b1Sdrahn  * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
27e1e4f5b1Sdrahn  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28e1e4f5b1Sdrahn  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
29e1e4f5b1Sdrahn  * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
30e1e4f5b1Sdrahn  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31e1e4f5b1Sdrahn  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32e1e4f5b1Sdrahn  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33e1e4f5b1Sdrahn  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34e1e4f5b1Sdrahn  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35e1e4f5b1Sdrahn  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36e1e4f5b1Sdrahn  * SUCH DAMAGE.
37e1e4f5b1Sdrahn  *
38e1e4f5b1Sdrahn  * RiscBSD kernel project
39e1e4f5b1Sdrahn  *
40e1e4f5b1Sdrahn  * undefined.h
41e1e4f5b1Sdrahn  *
42e1e4f5b1Sdrahn  * Undefined instruction types, symbols and prototypes
43e1e4f5b1Sdrahn  *
44e1e4f5b1Sdrahn  * Created      : 08/02/95
45e1e4f5b1Sdrahn  */
46e1e4f5b1Sdrahn 
47e1e4f5b1Sdrahn 
48e1e4f5b1Sdrahn #ifndef _ARM_UNDEFINED_H_
49e1e4f5b1Sdrahn #define _ARM_UNDEFINED_H_
50e1e4f5b1Sdrahn #ifdef _KERNEL
51e1e4f5b1Sdrahn 
52e1e4f5b1Sdrahn #include <sys/queue.h>
53e1e4f5b1Sdrahn 
54*e61d6212Spatrick typedef int (*undef_handler_t) (unsigned int, unsigned int, trapframe_t *, int, uint32_t);
55e1e4f5b1Sdrahn 
56e1e4f5b1Sdrahn #define FP_COPROC	1
57e1e4f5b1Sdrahn #define FP_COPROC2	2
58e1e4f5b1Sdrahn #define MAX_COPROCS	16
59e1e4f5b1Sdrahn 
60e1e4f5b1Sdrahn /* Prototypes for undefined.c */
61e1e4f5b1Sdrahn 
6238b77b7aSdrahn void *install_coproc_handler (int, undef_handler_t);
6338b77b7aSdrahn void remove_coproc_handler (void *);
6438b77b7aSdrahn void undefined_init (void);
65e1e4f5b1Sdrahn 
66e1e4f5b1Sdrahn /*
67e1e4f5b1Sdrahn  * XXX Stuff below here is for use before malloc() is available.  Most code
68e1e4f5b1Sdrahn  * shouldn't use it.
69e1e4f5b1Sdrahn  */
70e1e4f5b1Sdrahn 
71e1e4f5b1Sdrahn struct undefined_handler {
72e1e4f5b1Sdrahn 	LIST_ENTRY(undefined_handler) uh_link;
73e1e4f5b1Sdrahn 	undef_handler_t uh_handler;
74e1e4f5b1Sdrahn };
75e1e4f5b1Sdrahn 
76e1e4f5b1Sdrahn /*
77e1e4f5b1Sdrahn  * Handlers installed using install_coproc_handler_static shouldn't be
78e1e4f5b1Sdrahn  * removed.
79e1e4f5b1Sdrahn  */
8038b77b7aSdrahn void install_coproc_handler_static (int, struct undefined_handler *);
81e1e4f5b1Sdrahn 
82e1e4f5b1Sdrahn /* Calls up to undefined.c from trap handlers */
83e1e4f5b1Sdrahn void undefinedinstruction(struct trapframe *);
84e1e4f5b1Sdrahn 
85e1e4f5b1Sdrahn #endif
86e1e4f5b1Sdrahn 
87e1e4f5b1Sdrahn #endif /* _ARM_UNDEFINED_H_ */
88