Subversion Repositories HelenOS

Rev

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

Rev 2263 Rev 2264
Line 40... Line 40...
40
#include <config.h>
40
#include <config.h>
41
#include <arch/exception.h>
41
#include <arch/exception.h>
42
#include <typedefs.h>
42
#include <typedefs.h>
43
#include <arch/types.h>
43
#include <arch/types.h>
44
#include <interrupt.h>
44
#include <interrupt.h>
45
 
-
 
46
//TODO: remove in final version
-
 
47
#include "../aux_print/printf.h"
45
#include <arch/debug_print/print.h>
48
 
46
 
49
 
47
 
50
// localy used types
48
// localy used types
51
/**
49
/**
52
 * Decribes structure of fault status register in coprocessor 15
50
 * Decribes structure of fault status register in coprocessor 15
Line 153... Line 151...
153
}
151
}
154
 
152
 
155
//TODO: remove in final version
153
//TODO: remove in final version
156
static void print_istate(istate_t* istate);
154
static void print_istate(istate_t* istate);
157
static void print_istate(istate_t* istate) {
155
static void print_istate(istate_t* istate) {
158
 aux_printf("\nIstate dump:\n");
156
 dprintf("\nIstate dump:\n");
159
 aux_printf("    r0:%X    r1:%X    r2:%X    r3:%X\n", istate->r0,  istate->r1, istate->r2,  istate->r3);
157
 dprintf("    r0:%X    r1:%X    r2:%X    r3:%X\n", istate->r0,  istate->r1, istate->r2,  istate->r3);
160
 aux_printf("    r4:%X    r5:%X    r6:%X    r7:%X\n", istate->r4,  istate->r5, istate->r6,  istate->r7);
158
 dprintf("    r4:%X    r5:%X    r6:%X    r7:%X\n", istate->r4,  istate->r5, istate->r6,  istate->r7);
161
 aux_printf("    r8:%X    r8:%X   r10:%X   r11:%X\n", istate->r8,  istate->r9, istate->r10, istate->r11);
159
 dprintf("    r8:%X    r8:%X   r10:%X   r11:%X\n", istate->r8,  istate->r9, istate->r10, istate->r11);
162
 aux_printf("   r12:%X    sp:%X    lr:%X  spsr:%X\n", istate->r12, istate->sp, istate->lr,  istate->spsr);
160
 dprintf("   r12:%X    sp:%X    lr:%X  spsr:%X\n", istate->r12, istate->sp, istate->lr,  istate->spsr);
163
}
161
}
164
 
162
 
165
/**
163
/**
166
 * \return Value stored in fault status register
164
 * \return Value stored in fault status register
167
 */
165
 */
Line 200... Line 198...
200
        instruction_union_t tmp;
198
        instruction_union_t tmp;
201
        tmp.ip = instr_addr;
199
        tmp.ip = instr_addr;
202
    // get instruction op code
200
    // get instruction op code
203
    instruction_t i_code = *(tmp.instr);
201
    instruction_t i_code = *(tmp.instr);
204
 
202
 
205
        aux_printf("get_instruction_memmory_access\n");
203
        dprintf("get_instruction_memmory_access\n");
206
    aux_printf(" i_code:%X\n",i_code);
204
    dprintf(" i_code:%X\n",i_code);
207
    aux_printf(" i_code.condition:%d\n", i_code.condition);
205
    dprintf(" i_code.condition:%d\n", i_code.condition);
208
    aux_printf(" i_code.instr_type:%d\n",i_code.instr_type);
206
    dprintf(" i_code.instr_type:%d\n",i_code.instr_type);
209
    aux_printf(" i_code.opcode:%d\n",i_code.opcode);
207
    dprintf(" i_code.opcode:%d\n",i_code.opcode);
210
    aux_printf(" i_code.acess:%d\n", i_code.access);
208
    dprintf(" i_code.acess:%d\n", i_code.access);
211
    aux_printf(" i_code.dummy:%d\n", i_code.dummy);
209
    dprintf(" i_code.dummy:%d\n", i_code.dummy);
212
    aux_printf(" i_code.bits567%d\n", i_code.bits567);
210
    dprintf(" i_code.bits567%d\n", i_code.bits567);
213
    aux_printf(" i_code.bit4:%d\n", i_code.bit4);
211
    dprintf(" i_code.bit4:%d\n", i_code.bit4);
214
    aux_printf(" i_code.dummy1:%d\n", i_code.dummy1);
212
    dprintf(" i_code.dummy1:%d\n", i_code.dummy1);
215
 
213
 
216
 
214
 
217
        // undefined instructions ... (or special instructions)
215
        // undefined instructions ... (or special instructions)
218
    if ( i_code.condition == 0xf ) {
216
    if ( i_code.condition == 0xf ) {
219
        panic("page_fault - on instruction not acessing to memmory (instr_code:%X, badvaddr:%X)",i_code, badvaddr);
217
        panic("page_fault - on instruction not acessing to memmory (instr_code:%X, badvaddr:%X)",i_code, badvaddr);
Line 275... Line 273...
275
        uintptr_t  page = read_fault_address_register();
273
        uintptr_t  page = read_fault_address_register();
276
 
274
 
277
    pf_access_t access = get_memmory_access_type( istate->lr, page);
275
    pf_access_t access = get_memmory_access_type( istate->lr, page);
278
 
276
 
279
    print_istate(istate);
277
    print_istate(istate);
280
    aux_printf(" page fault : ip:%X, va:%X, status:%x(%x), access:%d\n", istate->lr, page, fsr.status,fsr, access);
278
    dprintf(" page fault : ip:%X, va:%X, status:%x(%x), access:%d\n", istate->lr, page, fsr.status,fsr, access);
281
 
279
 
282
        int ret = as_page_fault(page, access, istate);
280
        int ret = as_page_fault(page, access, istate);
283
    aux_printf(" as_page_fault ret:%d\n", ret);
281
    dprintf(" as_page_fault ret:%d\n", ret);
284
        if (ret == AS_PF_FAULT) {
282
        if (ret == AS_PF_FAULT) {
285
        fault_if_from_uspace(istate, "Page fault: %#x", page);
283
        fault_if_from_uspace(istate, "Page fault: %#x", page);
286
 
284
 
287
                panic("page fault\n");
285
                panic("page fault\n");
288
        }
286
        }
Line 299... Line 297...
299
 * \param n number of exception
297
 * \param n number of exception
300
 */
298
 */
301
void prefetch_abourt(int n, istate_t *istate) {
299
void prefetch_abourt(int n, istate_t *istate) {
302
 // Prefetch can be made be bkpt instruction
300
 // Prefetch can be made be bkpt instruction
303
    print_istate(istate);
301
    print_istate(istate);
304
    aux_printf(" prefetch_abourt ... instruction on adress:%x can't be fetched\n", istate->lr);
302
    dprintf(" prefetch_abourt ... instruction on adress:%x can't be fetched\n", istate->lr);
305
 
303
 
306
        int ret = as_page_fault(istate->lr, PF_ACCESS_EXEC, istate);
304
        int ret = as_page_fault(istate->lr, PF_ACCESS_EXEC, istate);
307
    aux_printf(" as_page_fault ret:%d\n", ret);
305
    dprintf(" as_page_fault ret:%d\n", ret);
308
        if (ret == AS_PF_FAULT) {
306
        if (ret == AS_PF_FAULT) {
309
                panic("page fault - instruction fetch at addr:%X\n", istate->lr);
307
                panic("page fault - instruction fetch at addr:%X\n", istate->lr);
310
        }
308
        }
311
 
309
 
312
    panic("Prefetch abourt ... solved");
310
    panic("Prefetch abourt ... solved");