Hello, please find enclosed the source code to differentiate reads from writes..... THE PAGE FAULT HANDLER ------------------------------------------------ segv_handler(int sig, siginfo_t *sip, ucontext_t *uc) { ... unsigned long pc, *pcptr; ... pc = (unsigned long) uc->uc_mcontext.gregs[1]; pcptr = (unsigned long *) pc; instruction = *pcptr; ... write_fault = STORE_INSTRUCTION(instruction); read_fault = LOAD_INSTRUCTION(instruction); ASSERT(! (write_fault && read_fault)); ASSERT(write_fault || read_fault); ... } INSTRUCTION DECODING --------------------------------------------------- (LIFTED FROM QUARKS PROJECT AT RIVERSIDE) -- start of .H #ifndef SOLARIS THIS FILE IS ONLY FOR SPARC INSTRUCTION SET #endif #define op1_mask 0xC0000000 #define op2_mask 0x01F80000 #define op1_shift 24 #define op2_shift 19 #define OP_WIDTH 8 #define num_load_opcodes 20 static char *ld_op_bits[num_load_opcodes] = { "11000000", /* LD */ "11000001", /* LDUB */ "11000011", /* LDD */ "11110011", /* LDDC */ "11100011", /* LDDF */ "11100000", /* LDF */ "11010000", /* LDA (p) */ "11110000", /* LDC */ "11110001", /* LDCSR */ "11010011", /* LDDA (p) */ "11100001", /* LDFSR */ "11001001", /* LDSB */ "11011001", /* LDSBA (p) */ "11001010", /* LDSH */ "11011010", /* LDSHA (p) */ "11001101", /* LDSTUB */ "11011101", /* LDSTUBA(p)*/ "11010001", /* LDUBA (p) */ "11000010", /* LDUH */ "11010010", /* LDUHA (p) */ }; #define num_store_opcodes 16 static char *st_op_bits[num_store_opcodes] = { "11000100", /* ST */ "11010100", /* STA (p) */ "11000101", /* STB */ "11010101", /* STBA (p) */ "11110100", /* STC */ "11110101", /* STCR */ "11000111", /* STD */ "11010111", /* STDA (p) */ "11110111", /* STDC */ "11110110", /* STDCQ (p) */ "11100111", /* STDF */ "11100110", /* STDFQ (p) */ "11100100", /* STF */ "11100101", /* STFSR */ "10000110", /* STH */ "11010110", /* STHA (p) */ }; ---- END OF .H #ifndef SOLARIS THIS FILE IS ONLY FOR SPARC INSTRUCTION SET #endif static unsigned short *load_opcodes = 0; static unsigned short *store_opcodes = 0; static void init_opcodes() { int i,j,factor,sum; load_opcodes = (unsigned short *) malloc(sizeof(unsigned short)*num_load_opcodes); store_opcodes = (unsigned short *) malloc(sizeof(unsigned short)*num_store_opcodes); for (i=0; i= 0; j--) { sum += factor * ((ld_op_bits[i][j] == '1') ? 1 : 0); factor = factor << 1; } load_opcodes[i] = sum; } for (i=0; i= 0; j--) { sum += factor * ((st_op_bits[i][j] == '1') ? 1 : 0); factor = factor << 1; } store_opcodes[i] = sum; } } int LOAD_INSTRUCTION(unsigned long inst) { int i; unsigned long opcode = ((inst & op1_mask) >> op1_shift) | ((inst & op2_mask) >> op2_shift); if (! load_opcodes) init_opcodes(); for (i=0; i> op1_shift) | ((inst & op2_mask) >> op2_shift); if (! store_opcodes) init_opcodes(); for (i=0; i