Rev 3835 | Rev 3863 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3743 | rimsky | 1 | /* |
2 | * Copyright (c) 2006 Jakub Jermar |
||
3 | * Copyright (c) 2008 Pavel Rimsky |
||
4 | * All rights reserved. |
||
5 | * |
||
6 | * Redistribution and use in source and binary forms, with or without |
||
7 | * modification, are permitted provided that the following conditions |
||
8 | * are met: |
||
9 | * |
||
10 | * - Redistributions of source code must retain the above copyright |
||
11 | * notice, this list of conditions and the following disclaimer. |
||
12 | * - Redistributions in binary form must reproduce the above copyright |
||
13 | * notice, this list of conditions and the following disclaimer in the |
||
14 | * documentation and/or other materials provided with the distribution. |
||
15 | * - The name of the author may not be used to endorse or promote products |
||
16 | * derived from this software without specific prior written permission. |
||
17 | * |
||
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
||
19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
||
20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
||
21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
||
22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
||
23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||
24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||
25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||
26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
||
27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
28 | */ |
||
29 | |||
30 | /** @addtogroup sparc64interrupt |
||
31 | * @{ |
||
32 | */ |
||
33 | /** |
||
34 | * @file |
||
35 | * @brief This file contains fast MMU trap handlers. |
||
36 | */ |
||
37 | |||
38 | #ifndef KERN_sparc64_sun4v_MMU_TRAP_H_ |
||
39 | #define KERN_sparc64_sun4v_MMU_TRAP_H_ |
||
40 | |||
41 | #include <arch/stack.h> |
||
3862 | rimsky | 42 | #include <arch/regdef.h> |
43 | #include <arch/arch.h> |
||
3835 | rimsky | 44 | #include <arch/sun4v/hypercall.h> |
3862 | rimsky | 45 | #include <arch/mm/tlb.h> |
46 | #include <arch/mm/mmu.h> |
||
47 | #include <arch/mm/tte.h> |
||
3743 | rimsky | 48 | #include <arch/trap/regwin.h> |
49 | |||
50 | #ifdef CONFIG_TSB |
||
51 | #include <arch/mm/tsb.h> |
||
52 | #endif |
||
53 | |||
54 | #define TT_FAST_INSTRUCTION_ACCESS_MMU_MISS 0x64 |
||
55 | #define TT_FAST_DATA_ACCESS_MMU_MISS 0x68 |
||
56 | #define TT_FAST_DATA_ACCESS_PROTECTION 0x6c |
||
57 | |||
58 | #define FAST_MMU_HANDLER_SIZE 128 |
||
59 | |||
60 | #ifdef __ASM__ |
||
61 | |||
3835 | rimsky | 62 | /* MMU fault status area data fault offset */ |
63 | #define FSA_DFA_OFFSET 0x48 |
||
64 | |||
65 | /* MMU fault status area data context */ |
||
66 | #define FSA_DFC_OFFSET 0x50 |
||
67 | |||
68 | /* offset of the target address within the TTE Data entry */ |
||
69 | #define TTE_DATA_TADDR_OFFSET 13 |
||
70 | |||
3743 | rimsky | 71 | .macro FAST_INSTRUCTION_ACCESS_MMU_MISS_HANDLER |
72 | .endm |
||
73 | |||
74 | /* |
||
3835 | rimsky | 75 | * Handler of the Fast Data Access MMU Miss trap. If the trap occurred in the kernel |
76 | * (context 0), an identity mapping (with displacement) is installed. Otherwise |
||
77 | * a higher level service routine is called. |
||
78 | * |
||
79 | * TODO implement calling the higher level service routine |
||
3743 | rimsky | 80 | */ |
81 | .macro FAST_DATA_ACCESS_MMU_MISS_HANDLER tl |
||
3835 | rimsky | 82 | |
83 | mov SCRATCHPAD_MMU_FSA, %g1 |
||
84 | ldxa [%g1] ASI_SCRATCHPAD, %g1 ! g1 <= RA of MMU fault status area |
||
85 | |||
86 | /* service by higher-level routine when context != 0 */ |
||
87 | add %g1, FSA_DFC_OFFSET, %g2 ! g2 <= RA of data fault context |
||
88 | ldxa [%g2] ASI_REAL, %g3 ! read the fault context |
||
89 | brnz %g3, 0f |
||
90 | nop |
||
91 | |||
92 | /* read the faulting address */ |
||
93 | add %g1, FSA_DFA_OFFSET, %g2 ! g2 <= RA of data fault address |
||
94 | ldxa [%g2] ASI_REAL, %g1 ! read the fault address |
||
95 | srlx %g1, TTE_DATA_TADDR_OFFSET, %g1 ! truncate it to page boundary |
||
96 | sllx %g1, TTE_DATA_TADDR_OFFSET, %g1 |
||
97 | |||
98 | /* exclude page number 0 from installing the identity mapping */ |
||
99 | brz %g1, 0f |
||
100 | nop |
||
101 | |||
102 | /* installing the identity does not fit into 32 instructions, call a separate routine */ |
||
103 | ba install_identity_mapping |
||
104 | nop |
||
105 | |||
106 | 0: ! TODO - call higher level service routine |
||
107 | |||
3743 | rimsky | 108 | .endm |
109 | |||
110 | .macro FAST_DATA_ACCESS_PROTECTION_HANDLER tl |
||
111 | .endm |
||
112 | |||
113 | #endif /* __ASM__ */ |
||
114 | |||
115 | #endif |
||
116 | |||
117 | /** @} |
||
118 | */ |