Subversion Repositories HelenOS

Rev

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

Rev 2304 Rev 2318
Line 132... Line 132...
132
 * \param badvaddr     Virtual address the instruction tries to access
132
 * \param badvaddr     Virtual address the instruction tries to access
133
 *
133
 *
134
 * \return Type of access into memmory
134
 * \return Type of access into memmory
135
 * \note   Returns #PF_ACESS_EXEC if no memory access is requested
135
 * \note   Returns #PF_ACESS_EXEC if no memory access is requested
136
 */
136
 */
137
//TODO: remove debug print in final version ... instead panic return PF_ACESS_EXEC
-
 
138
static pf_access_t get_memory_access_type(uint32_t instr_addr, uintptr_t badvaddr)
137
static pf_access_t get_memory_access_type(uint32_t instr_addr, uintptr_t badvaddr)
139
{  
138
{  
140
    instruction_union_t instr_union;
139
    instruction_union_t instr_union;
141
    instr_union.pc = instr_addr;
140
    instr_union.pc = instr_addr;
142
 
141
 
Line 162... Line 161...
162
    if (is_swap_instruction(instr)) {
161
    if (is_swap_instruction(instr)) {
163
        /* Swap instructions make read and write in one step.
162
        /* Swap instructions make read and write in one step.
164
         * Type of access that caused exception have to page tables
163
         * Type of access that caused exception have to page tables
165
         *  and access rights.
164
         *  and access rights.
166
         */
165
         */
167
        //TODO: ALF!!!!! cann't use AS asi is define as THE->as and THE structure is
-
 
168
        //sored after stack_base of current thread
-
 
169
        //but now ... in exception we have separate stacks <==> different 
-
 
170
        //stack_pointer ... so AS contains nonsence data
-
 
171
        //same case as_page_fault .... it's nessesary to solve "stack" problem
-
 
172
       
166
       
173
        pte_level1_t* pte = (pte_level1_t*)
167
        pte_level1_t* pte = (pte_level1_t*)
174
        pt_mapping_operations.mapping_find(AS, badvaddr);
168
        pt_mapping_operations.mapping_find(AS, badvaddr);
175
 
169
 
176
        ASSERT(pte);
170
        if ( pte == NULL ) {
-
 
171
            return PF_ACCESS_READ;
-
 
172
        }
177
 
173
 
178
        /* check if read possible
174
        /* check if read possible
179
        * Note: Don't check PTE_READABLE because it returns 1 everytimes */
175
        * Note: Don't check PTE_READABLE because it returns 1 everytimes */
180
        if ( !PTE_PRESENT(pte) ) {
176
        if ( !PTE_PRESENT(pte) ) {
181
            return PF_ACCESS_READ;
177
            return PF_ACCESS_READ;