From: Philip Homburg Date: Thu, 2 Oct 2008 13:48:05 +0000 (+0000) Subject: Some changes that were missing from the previous commit X-Git-Tag: v3.1.4~230 X-Git-Url: http://zhaoyanbai.com/repos/icons/static/man.3.ps?a=commitdiff_plain;h=005bc7a649e932f0b51056889720eabcc03f55ac;p=minix.git Some changes that were missing from the previous commit --- diff --git a/commands/swifi/db_access.c b/commands/swifi/db_access.c index d6a732a59..0d64687d0 100644 --- a/commands/swifi/db_access.c +++ b/commands/swifi/db_access.c @@ -33,6 +33,8 @@ #include "ddb.h" #include "db_access.h" +#include "extra.h" + /* * Access unaligned data items on aligned (longword) * boundaries. @@ -55,7 +57,7 @@ db_read_bytes(addr, size, data) src = (char *)addr; while (--size >= 0) - *data++ = *src++; + *data++ = text_read_ub(src++); } diff --git a/commands/swifi/db_disasm.c b/commands/swifi/db_disasm.c index 295377a02..953cfbfaf 100644 --- a/commands/swifi/db_disasm.c +++ b/commands/swifi/db_disasm.c @@ -30,7 +30,9 @@ * Instruction disassembler. */ +#if 0 #include +#endif #include "ddb.h" #include "db_access.h" @@ -861,11 +863,12 @@ static const int db_lengths[] = { result = db_get_value((loc), (size), (is_signed)); \ (loc) += (size); -//static db_addr_t +/*static db_addr_t // db_disasm_esc __P((db_addr_t loc, int inst, int short_addr, // int size, const char *seg)); //static void db_print_address __P((const char *seg, int size, // struct i_addr *addrp)); +*/ static db_addr_t db_read_address __P((db_addr_t loc, int short_addr, int regmodrm, struct i_addr *addrp)); @@ -1099,13 +1102,19 @@ my_disasm(db_addr_t loc, seg = "%gs"; break; case 0xf0: +#if 0 // db_printf("lock "); +#endif break; case 0xf2: +#if 0 // db_printf("repne "); +#endif break; case 0xf3: +#if 0 // db_printf("repe "); /* XXX repe VS rep */ +#endif break; default: prefix = FALSE; @@ -1141,7 +1150,9 @@ my_disasm(db_addr_t loc, get_value_inc(regmodrm, loc, 1, FALSE); loc = db_read_address(loc, short_addr, regmodrm, &address); modAddr=prev_loc; +#if 0 // printf("modrm at %x, offset %d\n", loc, loc-prev_loc); +#endif } i_name = ip->i_name; @@ -1187,51 +1198,75 @@ my_disasm(db_addr_t loc, switch (i_mode & 0xFF) { case E: +#if 0 // db_print_address(seg, size, &address); +#endif break; case Eind: +#if 0 // db_print_address(seg, size, &address); +#endif break; case El: +#if 0 // db_print_address(seg, LONG, &address); +#endif break; case Ew: +#if 0 // db_print_address(seg, WORD, &address); +#endif break; case Eb: +#if 0 // db_print_address(seg, BYTE, &address); +#endif break; case R: +#if 0 // db_printf("%s", db_reg[size][f_reg(regmodrm)]); +#endif break; case Rw: +#if 0 // db_printf("%s", db_reg[WORD][f_reg(regmodrm)]); +#endif break; case Ri: +#if 0 // db_printf("%s", db_reg[size][f_rm(inst)]); +#endif break; case Ril: +#if 0 // db_printf("%s", db_reg[LONG][f_rm(inst)]); +#endif break; case S: +#if 0 // db_printf("%s", db_seg_reg[f_reg(regmodrm)]); +#endif break; case Si: +#if 0 // db_printf("%s", db_seg_reg[f_reg(inst)]); +#endif break; case A: +#if 0 // db_printf("%s", db_reg[size][0]); /* acc */ +#endif break; case BX: @@ -1295,7 +1330,9 @@ my_disasm(db_addr_t loc, get_value_inc(displ, loc, len, FALSE); if (seg) ; else +#if 0 // db_printsym((db_addr_t)displ, DB_STGY_ANY); +#endif break; case Db: @@ -1303,7 +1340,9 @@ my_disasm(db_addr_t loc, displ += loc; if (size == WORD) displ &= 0xFFFF; +#if 0 // db_printsym((db_addr_t)displ, DB_STGY_XTRN); +#endif break; case Dl: @@ -1312,7 +1351,9 @@ my_disasm(db_addr_t loc, displ += loc; if (size == WORD) displ &= 0xFFFF; +#if 0 // db_printsym((db_addr_t)displ, DB_STGY_XTRN); +#endif break; case o1: @@ -1328,6 +1369,8 @@ my_disasm(db_addr_t loc, break; } } +#if 0 // db_printf("\n"); +#endif return (loc); } diff --git a/commands/swifi/db_machdep.h b/commands/swifi/db_machdep.h index 07f71dc3f..fa6aa2c28 100644 --- a/commands/swifi/db_machdep.h +++ b/commands/swifi/db_machdep.h @@ -29,8 +29,10 @@ #ifndef _MACHINE_DB_MACHDEP_H_ #define _MACHINE_DB_MACHDEP_H_ +#if 0 //#include //#include +#endif #ifndef TRUE #define TRUE 1 diff --git a/commands/swifi/db_sym.c b/commands/swifi/db_sym.c index 86460b1a2..c91528fa1 100644 --- a/commands/swifi/db_sym.c +++ b/commands/swifi/db_sym.c @@ -30,15 +30,21 @@ * Author: David B. Golub, Carnegie Mellon University * Date: 7/90 */ +#if 0 //#include //#include +#endif +#if 0 #include #include #include +#endif #include "ddb.h" #include "db_sym.h" #include "swifi.h" +#include "extra.h" + /* * Multiple symbol tables */ @@ -382,13 +388,17 @@ find_faulty_instr(db_expr_t off, int type, int *instr_len) cur_value = value; while(cur_value < sec_end) { if(verbose) { +#if 0 // db_printsym(cur_value, DB_STGY_PROC); // printk(":\t"); +#endif } prev_value=cur_value; modAddr=0; if(verbose) { +#if 0 //cur_value=db_disasm(prev_value, FALSE); +#endif } else { cur_value=my_disasm(prev_value, FALSE); } @@ -397,7 +407,7 @@ find_faulty_instr(db_expr_t off, int type, int *instr_len) if(cur_value-prev_value == 1) { unsigned char *c; c=(char *) prev_value; - if(*c==0xc9) { + if(text_read_ub(c)==0xc9) { if(verbose) printk("bailing out as we hit a leave\n"); found=0; break; @@ -452,22 +462,24 @@ find_faulty_instr(db_expr_t off, int type, int *instr_len) /* look for repX prefix */ - if(*c==0xf3 || *c==0xf2) { + if(text_read_ub(c)==0xf3 || text_read_ub(c)==0xf2) { if(verbose) printk("found repX prefix\n"); /* take out repX prefix only */ found=1; cur_value=prev_value+1; break; - } else if( ((*c)&0xf0)==0x70 || (*c>=0xe0 && *c<=0xe2) ) { + } else if( (text_read_ub(c)&0xf0)==0x70 || + (text_read_ub(c)>=0xe0 && text_read_ub(c)<=0xe2) ) { /* look for jXX 8 (7X), loop,jcx (e0-3), jXX 16/32 (0f 8X) */ found=1; if(verbose) printk("found jXX rel8, loop or jcx\n"); break; - } else if(*c==0x66 || *c==0x67) { /* override prefix */ + } else if(text_read_ub(c)==0x66 || + text_read_ub(c)==0x67) { /* override prefix */ c++; - } else if(*(c++)==0xf && ((*c)&0xf0)==0x80 ) { + } else if(text_read_ub(c++)==0xf && (text_read_ub(c)&0xf0)==0x80 ) { found=1; /* 0x0f 0x8X */ if(verbose) printk("found branch!\n"); break; @@ -481,7 +493,8 @@ find_faulty_instr(db_expr_t off, int type, int *instr_len) if(cur_value>off && modAddr) { unsigned char *c; c=(char *) modAddr; - if( (*c)>0x3f && (*c)<0xc0 && (((*c)&7)!=5) ) { + if( text_read_ub(c)>0x3f && text_read_ub(c)<0xc0 && + (text_read_ub(c)&7)!=5 ) { found=1; break; } @@ -493,9 +506,9 @@ find_faulty_instr(db_expr_t off, int type, int *instr_len) */ unsigned char *c; c=(char *) prev_value; - if( *c==0x8a || *c==0x8b) { + if( text_read_ub(c)==0x8a || text_read_ub(c)==0x8b) { c++; - if( ((*(c++))&0xc7)==0x45 && ((*c)&0x80)==0 ) { + if( ((text_read_ub(c++))&0xc7)==0x45 && (text_read_ub(c)&0x80)==0 ) { /* 75% chance that we'll choose the next arg */ if(random()&0x3) { found=1; @@ -512,26 +525,28 @@ find_faulty_instr(db_expr_t off, int type, int *instr_len) */ unsigned char *c; c=(char *) prev_value; - if (((*c & 0xf8) == 0x50) || - (*c == 0xff)) { - if (*c == 0xff) { + if (((text_read_ub(c) & 0xf8) == 0x50) || + (text_read_ub(c) == 0xff)) { + if (text_read_ub(c) == 0xff) { c++; +#if 0 // // Look for push x(ebp) - if ((*c & 0x78) != 0x70) { +#endif + if ((text_read_ub(c) & 0x78) != 0x70) { continue; } - // + /* // Skip the offset - // + */ c++; } c++; - if (*c == 0x9d) { - // + if (text_read_ub(c) == 0x9d) { + /* // Increment cur_value to include the // popf instruction - // + */ cur_value++; found = 1; break; @@ -545,12 +560,14 @@ find_faulty_instr(db_expr_t off, int type, int *instr_len) if(found) { *instr_len=cur_value-prev_value; off=prev_value; - if(1 || verbose) { + if(verbose) { printk("%s", name); if (d) printk("+0x%x", d); printk(" @ %x, ", value); printk("instr @ %x, len=%d, ", off, *instr_len); +#if 0 // db_disasm(prev_value, FALSE); +#endif } return off; } else { diff --git a/commands/swifi/ddb.h b/commands/swifi/ddb.h index 03553f21e..24a47eed5 100644 --- a/commands/swifi/ddb.h +++ b/commands/swifi/ddb.h @@ -88,7 +88,9 @@ void db_check_interrupt __P((void)); void db_clear_watchpoints __P((void)); db_addr_t db_disasm __P((db_addr_t loc, boolean_t altfmt)); /* instruction disassembler */ +#if 0 //void db_error __P((char *s)); +#endif #define db_error printk int db_expression __P((db_expr_t *valuep)); int db_get_variable __P((db_expr_t *valuep)); diff --git a/commands/swifi/swifi-user.h b/commands/swifi/swifi-user.h index d24aecedd..995112df6 100644 --- a/commands/swifi/swifi-user.h +++ b/commands/swifi/swifi-user.h @@ -40,7 +40,14 @@ typedef struct swifi_result { unsigned long new; } swifi_result_t, *pswifi_result_t; +long +sys_inject_fault(char * module, + unsigned long argFaultType, + unsigned long argRandomSeed, + unsigned long argNumFaults, + pswifi_result_t result_record, + unsigned long argInjectFault); -#endif // _SWIFI_USER_H +#endif /* _SWIFI_USER_H */ diff --git a/commands/swifi/swifi.h b/commands/swifi/swifi.h index b5e5364e7..82103bf4f 100644 --- a/commands/swifi/swifi.h +++ b/commands/swifi/swifi.h @@ -1,6 +1,8 @@ #ifndef _LINUX_SWIFI_H #define _LINUX_SWIFI_H +#include + #include "swifi-user.h" long @@ -53,9 +55,10 @@ void * swifi_kmalloc(size_t size, int flags); +#if 0 void * swifi___vmalloc(unsigned long size, int gfp_mask, pgprot_t prot); - +#endif -#endif // _LINUX_SWIFI_H +#endif /* _LINUX_SWIFI_H */