source: mainline/kernel/arch/sparc64/include/trap/trap_table.h@ e11ae91

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since e11ae91 was 0fa6044, checked in by Jakub Jermar <jakub@…>, 19 years ago

sparc64 work.

Fix bug introduced in revision 1852. When fixing CWP,
the input registers of the current window (i.e. output
registers of the window belonging to the interrupted
context) must be preserved. Preserve those registers
in memory. Sure there exist more efficient ways how to
copy the inputs.

Simplify before_thread_runs_arch(), resp. after_thread_ran_arch(),
and make them install, resp. uninstall, DTLB locked mapping for
eventual userspace window buffer.

  • Property mode set to 100644
File size: 3.0 KB
Line 
1/*
2 * Copyright (C) 2005 Jakub Jermar
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup sparc64interrupt
30 * @{
31 */
32/** @file
33 */
34
35#ifndef __sparc64_TRAP_TABLE_H__
36#define __sparc64_TRAP_TABLE_H__
37
38#ifndef __ASM__
39#include <arch/types.h>
40#endif /* __ASM__ */
41
42#include <arch/stack.h>
43
44#define TRAP_TABLE_ENTRY_COUNT 1024
45#define TRAP_TABLE_ENTRY_SIZE 32
46#define TRAP_TABLE_SIZE (TRAP_TABLE_ENTRY_COUNT*TRAP_TABLE_ENTRY_SIZE)
47
48#ifndef __ASM__
49struct trap_table_entry {
50 uint8_t octets[TRAP_TABLE_ENTRY_SIZE];
51} __attribute__ ((packed));
52
53typedef struct trap_table_entry trap_table_entry_t;
54
55extern trap_table_entry_t trap_table[TRAP_TABLE_ENTRY_COUNT];
56extern trap_table_entry_t trap_table_save[TRAP_TABLE_ENTRY_COUNT];
57#endif /* !__ASM__ */
58
59#ifdef __ASM__
60.macro SAVE_GLOBALS
61 mov %g1, %l1
62 mov %g2, %l2
63 mov %g3, %l3
64 mov %g4, %l4
65 mov %g5, %l5
66 mov %g6, %l6
67 mov %g7, %l7
68.endm
69
70.macro RESTORE_GLOBALS
71 mov %l1, %g1
72 mov %l2, %g2
73 mov %l3, %g3
74 mov %l4, %g4
75 mov %l5, %g5
76 mov %l6, %g6
77 mov %l7, %g7
78.endm
79
80/*
81 * The following needs to be in sync with the
82 * definition of the istate structure.
83 */
84#define PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE (STACK_WINDOW_SAVE_AREA_SIZE+(12*8))
85#define SAVED_TSTATE -(1*8)
86#define SAVED_TPC -(2*8)
87#define SAVED_TNPC -(3*8) /* <-- istate_t begins here */
88/* alignment gap */
89#define SAVED_I0 -(5*8)
90#define SAVED_I1 -(6*8)
91#define SAVED_I2 -(7*8)
92#define SAVED_I3 -(8*8)
93#define SAVED_I4 -(9*8)
94#define SAVED_I5 -(10*8)
95#define SAVED_I6 -(11*8)
96#define SAVED_I7 -(12*8)
97
98.macro PREEMPTIBLE_HANDLER f
99 sethi %hi(\f), %g1
100 b preemptible_handler
101 or %g1, %lo(\f), %g1
102.endm
103
104.macro SIMPLE_HANDLER f
105 call \f
106 nop
107.endm
108#endif /* __ASM__ */
109
110#endif
111
112/** @}
113 */
114
Note: See TracBrowser for help on using the repository browser.