1*1e4f69d0Smsaitoh /* $NetBSD: undefined.h,v 1.16 2021/12/05 04:42:55 msaitoh Exp $ */ 2c1f753f9Sreinoud 3c1f753f9Sreinoud /* 4c1f753f9Sreinoud * Copyright (c) 1995-1996 Mark Brinicombe. 5c1f753f9Sreinoud * Copyright (c) 1995 Brini. 6c1f753f9Sreinoud * All rights reserved. 7c1f753f9Sreinoud * 8c1f753f9Sreinoud * This code is derived from software written for Brini by Mark Brinicombe 9c1f753f9Sreinoud * 10c1f753f9Sreinoud * Redistribution and use in source and binary forms, with or without 11c1f753f9Sreinoud * modification, are permitted provided that the following conditions 12c1f753f9Sreinoud * are met: 13c1f753f9Sreinoud * 1. Redistributions of source code must retain the above copyright 14c1f753f9Sreinoud * notice, this list of conditions and the following disclaimer. 15c1f753f9Sreinoud * 2. Redistributions in binary form must reproduce the above copyright 16c1f753f9Sreinoud * notice, this list of conditions and the following disclaimer in the 17c1f753f9Sreinoud * documentation and/or other materials provided with the distribution. 18c1f753f9Sreinoud * 3. All advertising materials mentioning features or use of this software 19c1f753f9Sreinoud * must display the following acknowledgement: 20c1f753f9Sreinoud * This product includes software developed by Brini. 21c1f753f9Sreinoud * 4. The name of the company nor the name of the author may be used to 22c1f753f9Sreinoud * endorse or promote products derived from this software without specific 23c1f753f9Sreinoud * prior written permission. 24c1f753f9Sreinoud * 25c1f753f9Sreinoud * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED 26c1f753f9Sreinoud * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 27c1f753f9Sreinoud * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 28c1f753f9Sreinoud * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 29c1f753f9Sreinoud * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 30c1f753f9Sreinoud * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 31c1f753f9Sreinoud * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32c1f753f9Sreinoud * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 33c1f753f9Sreinoud * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34c1f753f9Sreinoud * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35c1f753f9Sreinoud * SUCH DAMAGE. 36c1f753f9Sreinoud * 37c1f753f9Sreinoud * RiscBSD kernel project 38c1f753f9Sreinoud * 39c1f753f9Sreinoud * undefined.h 40c1f753f9Sreinoud * 41c1f753f9Sreinoud * Undefined instruction types, symbols and prototypes 42c1f753f9Sreinoud * 43c1f753f9Sreinoud * Created : 08/02/95 44c1f753f9Sreinoud */ 45c1f753f9Sreinoud 46ce5529eaSbjh21 47ce5529eaSbjh21 #ifndef _ARM_UNDEFINED_H_ 48ce5529eaSbjh21 #define _ARM_UNDEFINED_H_ 49c1f753f9Sreinoud #ifdef _KERNEL 50c1f753f9Sreinoud 51ce5529eaSbjh21 #include <sys/queue.h> 52ce5529eaSbjh21 5302cdf4d2Sdsl typedef int (*undef_handler_t)(unsigned int, unsigned int, trapframe_t *, int); 54c1f753f9Sreinoud 55b0a3a430Srearnsha /* 56c8bb6ba9Srearnsha * Enumeration of coprocessor numbers. Values may be duplicated 57c8bb6ba9Srearnsha * (the iWMMX coprocessor clashes with the FPA, for example), but 58c8bb6ba9Srearnsha * keep this table in numeric order. 59b0a3a430Srearnsha */ 60c8bb6ba9Srearnsha enum arm_coprocs { 61c8bb6ba9Srearnsha FPA_COPROC = 1, 62c8bb6ba9Srearnsha FPA_COPROC2 = 2, 63b45167b6Srearnsha VFP_COPROC = 10, 64b45167b6Srearnsha VFP_COPROC2 = 11, 65c8bb6ba9Srearnsha DEBUG_COPROC = 14, 66c8bb6ba9Srearnsha SYSTEM_COPROC = 15, 67c8bb6ba9Srearnsha /* 68c8bb6ba9Srearnsha * The following are not really co-processors, but are on the end 69c8bb6ba9Srearnsha * of the unknown instruction table for each coproc. 70c8bb6ba9Srearnsha */ 71c8bb6ba9Srearnsha CORE_UNKNOWN_HANDLER = 16, 72c8bb6ba9Srearnsha #ifdef THUMB_CODE 73c8bb6ba9Srearnsha THUMB_UNKNOWN_HANDLER = 17, 74c8bb6ba9Srearnsha #endif 75c8bb6ba9Srearnsha NUM_UNKNOWN_HANDLERS /* Last entry */ 76c8bb6ba9Srearnsha }; 77b0a3a430Srearnsha 78c1f753f9Sreinoud /* Prototypes for undefined.c */ 79c1f753f9Sreinoud 8002cdf4d2Sdsl void *install_coproc_handler(int, undef_handler_t); 81e677f16fSskrll void replace_coproc_handler(int, undef_handler_t); 8202cdf4d2Sdsl void remove_coproc_handler(void *); 8302cdf4d2Sdsl void undefined_init(void); 84c1f753f9Sreinoud 85ce5529eaSbjh21 /* 86e677f16fSskrll * Stuff below here is for use before kmem(9) is available. Most code 87ce5529eaSbjh21 * shouldn't use it. 88ce5529eaSbjh21 */ 89ce5529eaSbjh21 90ce5529eaSbjh21 struct undefined_handler { 91ce5529eaSbjh21 LIST_ENTRY(undefined_handler) uh_link; 92ce5529eaSbjh21 undef_handler_t uh_handler; 93ce5529eaSbjh21 }; 94ce5529eaSbjh21 95ce5529eaSbjh21 /* 96ce5529eaSbjh21 * Handlers installed using install_coproc_handler_static shouldn't be 97*1e4f69d0Smsaitoh * removed. We special case the 'test vfp existence' handler. 98ce5529eaSbjh21 */ 9902cdf4d2Sdsl void install_coproc_handler_static(int, struct undefined_handler *); 100ce5529eaSbjh21 1016b12ec55Sbjh21 /* Calls up to undefined.c from trap handlers */ 1026b12ec55Sbjh21 void undefinedinstruction(struct trapframe *); 1036b12ec55Sbjh21 104c1f753f9Sreinoud #endif 105c1f753f9Sreinoud 106c1f753f9Sreinoud /* End of undefined.h */ 107ce5529eaSbjh21 108ce5529eaSbjh21 #endif /* _ARM_UNDEFINED_H_ */ 109