trap_table.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2005 Jakub Jermar
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  *
00009  * - Redistributions of source code must retain the above copyright
00010  *   notice, this list of conditions and the following disclaimer.
00011  * - Redistributions in binary form must reproduce the above copyright
00012  *   notice, this list of conditions and the following disclaimer in the
00013  *   documentation and/or other materials provided with the distribution.
00014  * - The name of the author may not be used to endorse or promote products
00015  *   derived from this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00018  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00019  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00020  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
00021  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00022  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00023  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00024  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00026  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  */
00028 
00035 #ifndef __sparc64_TRAP_TABLE_H__
00036 #define __sparc64_TRAP_TABLE_H__
00037 
00038 #ifndef __ASM__
00039 #include <arch/types.h>
00040 #endif /* __ASM__ */
00041 
00042 #include <arch/stack.h>
00043 
00044 #define TRAP_TABLE_ENTRY_COUNT  1024
00045 #define TRAP_TABLE_ENTRY_SIZE   32
00046 #define TRAP_TABLE_SIZE         (TRAP_TABLE_ENTRY_COUNT*TRAP_TABLE_ENTRY_SIZE)
00047 
00048 #ifndef __ASM__
00049 struct trap_table_entry {
00050         __u8 octets[TRAP_TABLE_ENTRY_SIZE];
00051 } __attribute__ ((packed));
00052 
00053 typedef struct trap_table_entry trap_table_entry_t;
00054 
00055 extern trap_table_entry_t trap_table[TRAP_TABLE_ENTRY_COUNT];
00056 extern trap_table_entry_t trap_table_save[TRAP_TABLE_ENTRY_COUNT];
00057 #endif /* !__ASM__ */
00058 
00059 #ifdef __ASM__
00060 .macro SAVE_GLOBALS
00061         mov %g1, %l1
00062         mov %g2, %l2
00063         mov %g3, %l3
00064         mov %g4, %l4
00065         mov %g5, %l5
00066         mov %g6, %l6
00067         mov %g7, %l7
00068 .endm
00069 
00070 .macro RESTORE_GLOBALS
00071         mov %l1, %g1
00072         mov %l2, %g2
00073         mov %l3, %g3
00074         mov %l4, %g4
00075         mov %l5, %g5
00076         mov %l6, %g6
00077         mov %l7, %g7
00078 .endm
00079 
00080 #define PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE    (STACK_WINDOW_SAVE_AREA_SIZE+(4*8))
00081 #define SAVED_TSTATE    -(1*8)
00082 #define SAVED_TPC       -(2*8)
00083 #define SAVED_TNPC      -(3*8)
00084 #define SAVED_PSTATE    -(4*8)
00085 
00086 .macro PREEMPTIBLE_HANDLER f
00087         set \f, %l0
00088         b preemptible_handler
00089         nop
00090 .endm
00091 
00092 .macro SIMPLE_HANDLER f
00093         call \f
00094         nop
00095 .endm
00096 #endif /* __ASM__ */
00097 
00098 #endif
00099 

Generated on Sun Jun 18 17:37:25 2006 for HelenOS Kernel (sparc64) by  doxygen 1.4.6