Subversion Repositories HelenOS-historic

Rev

Rev 634 | Rev 664 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 634 Rev 663
1
#
1
#
2
# Copyright (C) 2005 Jakub Jermar
2
# Copyright (C) 2005 Jakub Jermar
3
# All rights reserved.
3
# All rights reserved.
4
#
4
#
5
# Redistribution and use in source and binary forms, with or without
5
# Redistribution and use in source and binary forms, with or without
6
# modification, are permitted provided that the following conditions
6
# modification, are permitted provided that the following conditions
7
# are met:
7
# are met:
8
#
8
#
9
# - Redistributions of source code must retain the above copyright
9
# - Redistributions of source code must retain the above copyright
10
#   notice, this list of conditions and the following disclaimer.
10
#   notice, this list of conditions and the following disclaimer.
11
# - Redistributions in binary form must reproduce the above copyright
11
# - Redistributions in binary form must reproduce the above copyright
12
#   notice, this list of conditions and the following disclaimer in the
12
#   notice, this list of conditions and the following disclaimer in the
13
#   documentation and/or other materials provided with the distribution.
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
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.
15
#   derived from this software without specific prior written permission.
16
#
16
#
17
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
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
18
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
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
23
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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
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.
26
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
#
27
#
28
 
28
 
29
/**
29
/**
30
 * This file contains two trap tables.
30
 * This file contains two trap tables.
31
 * First, trap_table, is the one wich contains handlers implemented by
31
 * First, trap_table, is the one wich contains handlers implemented by
32
 * kernel. During initialization, these handlers are copied out to
32
 * kernel. During initialization, these handlers are copied out to
33
 * the second trap table, trap_table_save, and the first table is
33
 * the second trap table, trap_table_save, and the first table is
34
 * overwritten with copy of OFW's own trap table. The copy is then patched
34
 * overwritten with copy of OFW's own trap table. The copy is then patched
35
 * from the trap_table_save.
35
 * from the trap_table_save.
36
 *
36
 *
37
 * This arrangement is beneficial because kernel handlers stay on their
37
 * This arrangement is beneficial because kernel handlers stay on their
38
 * link-time addresses which is good for debugging.
38
 * link-time addresses which is good for debugging.
39
 */
39
 */
40
 
40
 
41
.text
41
.text
42
 
42
 
43
#include <arch/trap/trap_table.h>
43
#include <arch/trap/trap_table.h>
44
#include <arch/trap/regwin.h>
44
#include <arch/trap/regwin.h>
-
 
45
#include <arch/trap/interrupt.h>
45
 
46
 
46
#define TABLE_SIZE	TRAP_TABLE_SIZE
47
#define TABLE_SIZE	TRAP_TABLE_SIZE
47
#define ENTRY_SIZE	TRAP_TABLE_ENTRY_SIZE
48
#define ENTRY_SIZE	TRAP_TABLE_ENTRY_SIZE
48
 
49
 
49
/*
50
/*
50
 * Kernel trap table.
51
 * Kernel trap table.
51
 */
52
 */
52
.align TABLE_SIZE
53
.align TABLE_SIZE
53
.global trap_table
54
.global trap_table
54
trap_table:
55
trap_table:
55
 
56
 
56
/* TT = 0x24, TL = 0 *, clean_window handler */
57
/* TT = 0x24, TL = 0, clean_window handler */
57
.org trap_table + TT_CLEAN_WINDOW*ENTRY_SIZE
58
.org trap_table + TT_CLEAN_WINDOW*ENTRY_SIZE
58
.global clean_window_handler
59
.global clean_window_handler
59
clean_window_handler:
60
clean_window_handler:
60
	CLEAN_WINDOW_HANDLER
61
	CLEAN_WINDOW_HANDLER
61
 
62
 
-
 
63
/* TT = 0x60, TL = 0, interrupt_vector_trap handler */
-
 
64
.org trap_table + TT_INTERRUPT_VECTOR_TRAP*ENTRY_SIZE
-
 
65
.global interrupt_vector_trap_handler
-
 
66
interrupt_vector_trap_handler:
-
 
67
	INTERRUPT_VECTOR_TRAP_HANDLER
-
 
68
 
62
/* TT = 0x80, TL = 0 *, spill_0_normal handler */
69
/* TT = 0x80, TL = 0, spill_0_normal handler */
63
.org trap_table + TT_SPILL_0_NORMAL*ENTRY_SIZE
70
.org trap_table + TT_SPILL_0_NORMAL*ENTRY_SIZE
64
.global spill_0_normal
71
.global spill_0_normal
65
spill_0_normal:
72
spill_0_normal:
66
	SPILL_NORMAL_HANDLER
73
	SPILL_NORMAL_HANDLER
67
 
74
 
68
/* TT = 0xc0, TL = 0 *, fill_0_normal handler */
75
/* TT = 0xc0, TL = 0, fill_0_normal handler */
69
.org trap_table + TT_FILL_0_NORMAL*ENTRY_SIZE
76
.org trap_table + TT_FILL_0_NORMAL*ENTRY_SIZE
-
 
77
.global fill_0_normal
70
fill_0_normal:
78
fill_0_normal:
71
	FILL_NORMAL_HANDLER
79
	FILL_NORMAL_HANDLER
72
 
80
 
73
/*
81
/*
74
 * Software traps for TL=0.
82
 * Handlers for TL>0.
75
 */
83
 */
76
.org trap_table + 256*ENTRY_SIZE
-
 
77
tl_0_software_traps:
-
 
78
 
84
 
79
/* Reserved area. */
85
/* TT = 0x24, TL > 0, clean_window handler */
80
.org trap_table + 384*ENTRY_SIZE
86
.org trap_table + (TT_CLEAN_WINDOW+512)*ENTRY_SIZE
-
 
87
.global clean_window_handler_high
-
 
88
clean_window_handler_high:
81
.space 128*ENTRY_SIZE, 0
89
	CLEAN_WINDOW_HANDLER
82
 
90
 
83
/*
-
 
84
 * Hardware interrupts for TL>0.
-
 
85
 */
-
 
86
.org trap_table + 512*ENTRY_SIZE
-
 
87
tl_non_0_hardware_traps:
-
 
88
 
91
 
89
/*
-
 
90
 * Register window spill/fill traps for TL>0.
92
/* TT = 0x80, TL > 0, spill_0_normal handler */
91
 */
93
 
92
.org trap_table + 640*ENTRY_SIZE
94
.org trap_table + (TT_SPILL_0_NORMAL+512)*ENTRY_SIZE
-
 
95
.global spill_0_normal_high
93
tl_non_0_regwin_traps:
96
spill_0_normal_high:
-
 
97
	SPILL_NORMAL_HANDLER
94
 
98
 
95
/*
-
 
96
 * Software traps for TL>0.
-
 
97
 */
-
 
98
.org trap_table + 768*ENTRY_SIZE
-
 
99
tl_non_0_software_traps:
-
 
100
 
99
 
101
/* Reserved area. */
100
/* TT = 0xc0, TL > 0, fill_0_normal handler */
102
.org trap_table + 896*ENTRY_SIZE
101
.org trap_table + (TT_FILL_0_NORMAL+512)*ENTRY_SIZE
103
.space 128*ENTRY_SIZE, 0
102
.global fill_0_normal_high
-
 
103
fill_0_normal_high:
-
 
104
	FILL_NORMAL_HANDLER
-
 
105
 
104
 
106
 
105
 
107
 
106
/*
108
/*
107
 * Save trap table.
109
 * Save trap table.
108
 */
110
 */
-
 
111
.align TABLE_SIZE
109
.global trap_table_save
112
.global trap_table_save
110
trap_table_save:
113
trap_table_save:
111
	.space TABLE_SIZE, 0
114
	.space TABLE_SIZE, 0
112
 
115