Subversion Repositories HelenOS

Rev

Rev 3770 | Rev 3862 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3770 Rev 3835
Line 38... Line 38...
38
#ifndef KERN_sparc64_sun4v_MMU_TRAP_H_
38
#ifndef KERN_sparc64_sun4v_MMU_TRAP_H_
39
#define KERN_sparc64_sun4v_MMU_TRAP_H_
39
#define KERN_sparc64_sun4v_MMU_TRAP_H_
40
 
40
 
41
#include <arch/stack.h>
41
#include <arch/stack.h>
42
#include <arch/sun4v/regdef.h>
42
#include <arch/sun4v/regdef.h>
-
 
43
#include <arch/sun4v/arch.h>
-
 
44
#include <arch/sun4v/hypercall.h>
43
#include <arch/mm/sun4v/tlb.h>
45
#include <arch/mm/sun4v/tlb.h>
44
#include <arch/mm/sun4v/mmu.h>
46
#include <arch/mm/sun4v/mmu.h>
45
#include <arch/mm/sun4v/tte.h>
47
#include <arch/mm/sun4v/tte.h>
46
#include <arch/trap/regwin.h>
48
#include <arch/trap/regwin.h>
47
 
49
 
Line 55... Line 57...
55
 
57
 
56
#define FAST_MMU_HANDLER_SIZE           128
58
#define FAST_MMU_HANDLER_SIZE           128
57
 
59
 
58
#ifdef __ASM__
60
#ifdef __ASM__
59
 
61
 
-
 
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
 
60
.macro FAST_INSTRUCTION_ACCESS_MMU_MISS_HANDLER
71
.macro FAST_INSTRUCTION_ACCESS_MMU_MISS_HANDLER
61
.endm
72
.endm
62
 
73
 
63
/*
74
/*
64
 * So far it is here only to process the trap which occurs when the kernel
75
 * Handler of the Fast Data Access MMU Miss trap. If the trap occurred in the kernel
65
 * needs to access the bootinfo structure, which is placed in the bootloader
76
 * (context 0), an identity mapping (with displacement) is installed. Otherwise
66
 * memory (i.e. before address 0x400000).
77
 * a higher level service routine is called.
-
 
78
 *
-
 
79
 * TODO implement calling the higher level service routine
67
 */
80
 */
68
.macro FAST_DATA_ACCESS_MMU_MISS_HANDLER tl
81
.macro FAST_DATA_ACCESS_MMU_MISS_HANDLER tl
-
 
82
 
69
    save %sp, -STACK_WINDOW_SAVE_AREA_SIZE, %sp
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
70
    set 0x8000, %o0
89
    brnz %g3, 0f
71
    set 0x0, %o1
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
72
    setx 0x80000000804087c3, %g1, %o2
96
    sllx %g1, TTE_DATA_TADDR_OFFSET, %g1
-
 
97
 
-
 
98
    /* exclude page number 0 from installing the identity mapping */
73
    set 0x3, %o3
99
    brz %g1, 0f
74
    ta 0x83
100
    nop
-
 
101
 
-
 
102
    /* installing the identity does not fit into 32 instructions, call a separate routine */
75
    restore %g0, 0, %g0
103
    ba install_identity_mapping
76
    retry
104
    nop
-
 
105
 
-
 
106
    0: ! TODO - call higher level service routine
-
 
107
 
77
.endm
108
.endm
78
 
109
 
79
.macro FAST_DATA_ACCESS_PROTECTION_HANDLER tl
110
.macro FAST_DATA_ACCESS_PROTECTION_HANDLER tl
80
.endm
111
.endm
81
 
112