|
|
1.1 ! root 1: /* $Header: /usr/src/sys/i8086/ibm_at/RCS/dump.c,v 1.1 88/03/24 17:33:35 src Exp $ ! 2: * ! 3: * Function to dump Kernel data inforation. ! 4: * ! 5: * $Log: /usr/src/sys/i8086/ibm_at/RCS/dump.c,v $ ! 6: * Revision 1.1 88/03/24 17:33:35 src ! 7: * Initial revision ! 8: * ! 9: */ ! 10: #include <ascii.h> ! 11: #include <coherent.h> ! 12: #include <sys/i8086.h> ! 13: #include <sys/proc.h> ! 14: #include <sys/uproc.h> ! 15: #include <sys/seg.h> ! 16: ! 17: int nodump = 1; ! 18: ! 19: /* ! 20: * Note: ip1 is a dummy parameter facilitating access to calling stack frame. ! 21: */ ! 22: dumpall( ip1 ) ! 23: int ip1; ! 24: { ! 25: register PROC * pp; ! 26: register SEG * sp; ! 27: faddr_t gp; ! 28: faddr_t fp; ! 29: int s; ! 30: extern saddr_t gdtsel; ! 31: extern saddr_t uasa, ucs, uds, scs, sds; ! 32: extern int nesterr; ! 33: ! 34: if ( nodump ) ! 35: return; ! 36: ! 37: s = sphi(); ! 38: ! 39: printf("\nuasa=%x ucs=%x uds=%x scs=%x sds=%x nesterr=%u\n", ! 40: uasa, ucs, uds, scs, sds, nesterr ); ! 41: ! 42: ! 43: printf("\nGlobal Descriptor Table:\n"); ! 44: FP_SEL(gp) = gdtsel; ! 45: FP_OFF(gp) = 5; /* offset of flags byte */ ! 46: FP_SEL(fp) = 0; ! 47: FP_OFF(fp) = 0; ! 48: do { ! 49: if ( ffbyte(gp) ) ! 50: vprint(fp); ! 51: FP_OFF(gp) += 8; ! 52: FP_SEL(fp) += 8; ! 53: } while ( FP_SEL(fp) != 0 ); ! 54: ! 55: showevq(); ! 56: showtim(); ! 57: putchar( A_FF ); ! 58: ! 59: printf("\nProcesses:\n"); ! 60: for ( pp = procq.p_nforw; pp != &procq; pp = pp->p_nforw ) ! 61: showproc( pp ); ! 62: putchar( A_FF ); ! 63: ! 64: printf( "\nMemory Segments:\n\n" ); ! 65: for ( sp = segmq.s_forw; sp != &segmq; sp = sp->s_forw ) ! 66: showseg( sp, "" ); ! 67: putchar( A_FF ); ! 68: ! 69: if ( segdq.s_forw != &segdq ) { ! 70: printf( "\nDisk Segments:\n\n"); ! 71: for ( sp = segdq.s_forw; sp != &segdq; sp = sp->s_forw ) ! 72: showseg( sp, "" ); ! 73: putchar( A_FF ); ! 74: } ! 75: ! 76: printf("\nLocal Stack: sp=%x\n", (&ip1)-1 ); ! 77: FP_SEL(fp) = sds; ! 78: FP_OFF(fp) = (char*)(&u) + 1022; ! 79: do { ! 80: printf(" %x: %x\n", FP_OFF(fp), ffword(fp) ); ! 81: FP_OFF(fp) -= 2; ! 82: } while ( FP_OFF(fp) >= (&ip1)-1 ); ! 83: putchar( A_FF ); ! 84: ! 85: printf("\nUser Stack: ss:sp = %x:%x\n", regl[OSS], regl[OSP] ); ! 86: FP_SEL(gp) = gdtsel; ! 87: FP_OFF(gp) = regl[OSS] & ~7; ! 88: if ( ((regl[OSS]&7) == 0) && regl[OSS] && regl[OSP] && ffbyte(gp+5) ) { ! 89: FP_SEL(fp) = regl[OSS]; ! 90: FP_OFF(fp) = regl[OSP] + 120; ! 91: if ( FP_OFF(fp) > udl ) ! 92: FP_OFF(fp) = udl & ~1; ! 93: do { ! 94: printf(" %x: %x\n", FP_OFF(fp), ffword(fp) ); ! 95: FP_OFF(fp) -= 2; ! 96: } while ( FP_OFF(fp) >= regl[OSP] ); ! 97: } ! 98: putchar( A_FF ); ! 99: ! 100: putchar( A_LF ); ! 101: spl( s ); ! 102: } ! 103: ! 104: static ! 105: showevq() ! 106: { ! 107: register PROC * pp; ! 108: register int i; ! 109: ! 110: printf("\nEvent Queues:\n"); ! 111: ! 112: for ( i = 0; i < nel(linkq); i++ ) { ! 113: ! 114: if ( linkq[i].p_lforw == linkq[i].p_lback ) ! 115: continue; ! 116: ! 117: pp = linkq[i].p_lforw; ! 118: printf("%x:", i ); ! 119: ! 120: do { ! 121: printf("\t%x: lforw=%x lback=%x pid=%d event=%x\n", ! 122: pp, ! 123: pp->p_lforw, ! 124: pp->p_lback, ! 125: pp->p_pid, ! 126: pp->p_event ! 127: ); ! 128: } while ((pp = pp->p_lforw) != (PROC *) &linkq[i] ); ! 129: } ! 130: } ! 131: ! 132: static ! 133: showtim() ! 134: { ! 135: register TIM * tp; ! 136: register int i; ! 137: ! 138: printf("\nTiming Queues: lbolt=%lx\n", lbolt ); ! 139: ! 140: for ( i = 0; i < nel(timq); i++ ) { ! 141: ! 142: if ( ! (tp = timq[i]) ) ! 143: continue; ! 144: ! 145: printf("%x:", i ); ! 146: ! 147: do { ! 148: printf("\t%x: next=%x last=%x func=%x farg=%x lbolt=%lx\n", ! 149: tp, ! 150: tp->t_next, ! 151: tp->t_last, ! 152: tp->t_func, ! 153: tp->t_farg, ! 154: tp->t_lbolt ! 155: ); ! 156: } while ( tp = tp->t_next ); ! 157: } ! 158: } ! 159: ! 160: static ! 161: showproc( pp ) ! 162: register PROC * pp; ! 163: { ! 164: register int i; ! 165: ! 166: printf("\n%x:\tnforw=%x nback=%x pid=%d ppid=%d state=%x flags=%x\n", ! 167: pp, ! 168: pp->p_nforw, /* Forward pointer */ ! 169: pp->p_nback, /* Backward pointer */ ! 170: pp->p_pid, /* Process id */ ! 171: pp->p_ppid, /* Process id of parent */ ! 172: pp->p_state, ! 173: pp->p_flags ! 174: ); ! 175: ! 176: if ( pp->p_polltim.t_last ) ! 177: printf("\tpolltim@%x: next=%x last=%x func=%x farg=%x lbolt=%lx\n", ! 178: &pp->p_polltim, ! 179: pp->p_polltim.t_next, ! 180: pp->p_polltim.t_last, ! 181: pp->p_polltim.t_func, ! 182: pp->p_polltim.t_farg, ! 183: pp->p_polltim.t_lbolt ! 184: ); ! 185: ! 186: if ( pp->p_alrmtim.t_last ) ! 187: printf("\talrmtim@%x: next=%x last=%x func=%x farg=%x lbolt=%lx\n", ! 188: &pp->p_alrmtim, ! 189: pp->p_alrmtim.t_next, ! 190: pp->p_alrmtim.t_last, ! 191: pp->p_alrmtim.t_func, ! 192: pp->p_alrmtim.t_farg, ! 193: pp->p_alrmtim.t_lbolt ! 194: ); ! 195: ! 196: for ( i = 0; i <= NUSEG; i++ ) { ! 197: static char * nam[] = { "UA", "SS", "SI", "PI", "SD", "PD", "UX" }; ! 198: if ( pp->p_segp[i] ) { ! 199: printf("\n %s: ", nam[i] ); ! 200: showseg( pp->p_segp[i], " " ); ! 201: } ! 202: } ! 203: } ! 204: ! 205: static ! 206: showseg( sp, prefix ) ! 207: register SEG * sp; ! 208: char * prefix; ! 209: { ! 210: printf("%x: forw=%x back=%x ip=%x flags=%x urefc=%d lrefc=%d\n", ! 211: sp, ! 212: sp->s_forw, /* Forward pointer */ ! 213: sp->s_back, /* Backward pointer */ ! 214: sp->s_ip, /* Inode pointer for shared text */ ! 215: sp->s_flags, /* Flags */ ! 216: sp->s_urefc, /* Reference count of segment */ ! 217: sp->s_lrefc /* Lock reference count */ ! 218: ); ! 219: ! 220: printf( "%s faddr=%X size=%X paddr=%X\n", ! 221: prefix, ! 222: sp->s_faddr, /* Memory access selector */ ! 223: sp->s_size, /* Size in bytes */ ! 224: sp->s_paddr /* Physical base address */ ! 225: ); ! 226: ! 227: printf("%s ", prefix); ! 228: vprint( sp->s_faddr ); ! 229: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.