Ejemplo n.º 1
0
void read_regs(char *name) {

int i, j;
char fn[32], txt[128], c, *cp;
FILE *nf = NULL;
struct regdesc *reg;

   if (regs) return;
   bzero((void *) fn, 32);
   for (i=0; i<31; i++) {
      if (i<strlen(name)) fn[i]=toupper(name[i]);
      else break;
   }

   strcat(fn,".regs");
   nf = fopen(GetFile(fn),"r");
   if (nf == NULL) {
      printf("%s:not available\n",fn);
      return;
   }

   while (1) {
      if (fgets(txt,128,nf) == NULL) break;
      cp = "NAME";
      if (strncmp(cp, txt, strlen(cp)) == 0) {
	 cp = &txt[strlen(cp)];
	 bzero((void *) dev_name, 32);
	 for (i=0, j=0; i<31; i++) {
	    c = *cp++;
	    if ((c == '\n') ||  (c == 0)) break;
	    if (isspace(c)) continue;
	    dev_name[j++] = c;
	 }
      }
      if (strncmp("$", txt, 1) == 0) {
	 reg = new_reg();

	 sscanf(txt,"$ %s %s 0x%X %d %d %d",
		reg->name,
		reg->flags,
		&reg->offset,
		&reg->size,
		&reg->window,
		&reg->depth);
	 reg_cnt++;
      }
   }
   print_regs(1);
   print_regs(2);
   printf("Device:%s %d:reg descriptions read\n",dev_name, reg_cnt);
}
Ejemplo n.º 2
0
static void print_exception_info(struct exc_state *state, uint64_t idx)
{
	if (idx < NUM_EXC_VIDS)
		printk(BIOS_DEBUG, "exception %s\n", exception_names[idx]);

	print_regs(state);
}
Ejemplo n.º 3
0
void
print_trapframe(struct trapframe *tf) {
    cprintf("trapframe at %p\n", tf);
    print_regs(&tf->tf_regs);
    cprintf("  ds   0x----%04x\n", tf->tf_ds);
    cprintf("  es   0x----%04x\n", tf->tf_es);
    cprintf("  fs   0x----%04x\n", tf->tf_fs);
    cprintf("  gs   0x----%04x\n", tf->tf_gs);
    cprintf("  trap 0x%08x %s\n", tf->tf_trapno, trapname(tf->tf_trapno));
    cprintf("  err  0x%08x\n", tf->tf_err);
    cprintf("  eip  0x%08x\n", tf->tf_eip);
    cprintf("  cs   0x----%04x\n", tf->tf_cs);
    cprintf("  flag 0x%08x ", tf->tf_eflags);

    int i, j;
    for (i = 0, j = 1; i < sizeof(IA32flags) / sizeof(IA32flags[0]); i ++, j <<= 1) {
        if ((tf->tf_eflags & j) && IA32flags[i] != NULL) {
            cprintf("%s,", IA32flags[i]);
        }
    }
    cprintf("IOPL=%d\n", (tf->tf_eflags & FL_IOPL_MASK) >> 12);

    if (!trap_in_kernel(tf)) {
        cprintf("  esp  0x%08x\n", tf->tf_esp);
        cprintf("  ss   0x----%04x\n", tf->tf_ss);
    }
}
Ejemplo n.º 4
0
static void __faultE(uint32 number,
            regs r, uint32 error,
            uint32 eip, uint32 cs, uint32 eflags)
{
    uint32 _cr2, _cr3;

    kprintf("");
    kprintf("*** Exception 0x%X* (%s)",number,etable[number]);
#ifdef __SMP__
    if (smp_configured)
      kprintf ("      on cpu#%d", smp_my_cpu ());
#endif
    print_regs(&r, eip, cs, eflags);
    
    asm("mov %%cr2, %0":"=r" (_cr2));    
    asm("mov %%cr3, %0":"=r" (_cr3));
    kprintf("   cr2 = %x   cr3 = %x error = %x",_cr2,_cr3,error);
    kprintf("");
    kprintf("Task %d (%s) crashed.",current->rsrc.id,current->rsrc.name);

	if((cs & 0xFFF8) == SEL_UCODE) user_debug(&r, &eip, &eflags);
	
#ifdef DEBUG_ON_FAULT
    current->flags = tDEAD;
    k_debugger(&r, eip, cs, eflags);
#endif
    
#ifdef HALT_ON_FAULT
    asm("hlt");
#endif    
    
    terminate();    
}
Ejemplo n.º 5
0
void print_frame(struct frame *tf)
{
	STATIC_INIT_SPIN_LOCK(pflock);
	spin_lock(&pflock);
	printk("TRAP frame at %p from CPU %d\n", tf, get_cpuid());
	print_regs(&tf->tf_regs);
	printk("  es   0x----%04x\n", tf->tf_es);
	printk("  ds   0x----%04x\n", tf->tf_ds);
	printk("  trap 0x%08x %s\n", tf->tf_trapno, trapname(tf->tf_trapno));
	// If this trap was a page fault that just happened
	// (so %cr2 is meaningful), print the faulting linear address.
	if (tf->tf_trapno == T_PGFLT)
		printk("  cr2  0x%08x\n", rcr2());
	printk("  err  0x%08x", tf->tf_err);
	// For page faults, print decoded fault error code:
	// U/K=fault occurred in user/kernel mode
	// W/R=a write/read caused the fault
	// PR=a protection violation caused the fault (NP=page not present).
	if (tf->tf_trapno == T_PGFLT)
		printk(" [%s, %s, %s]\n",
			tf->tf_err & 4 ? "user" : "kernel",
			tf->tf_err & 2 ? "write" : "read",
			tf->tf_err & 1 ? "protection" : "not-present");
	else
		printk("\n");
	printk("  eip  0x%08x\n", tf->tf_eip);
	printk("  cs   0x----%04x\n", tf->tf_cs);
	printk("  flag 0x%08x\n", tf->tf_eflags);
	if ((tf->tf_cs & 3) != 0) {
		printk("  esp  0x%08x\n", tf->tf_esp);
		printk("  ss   0x----%04x\n", tf->tf_ss);
	}
	spin_unlock(&pflock);
}
Ejemplo n.º 6
0
void k_debugger(regs *r,uint32 eip, uint32 cs, uint32 eflags)
{
    char *line;
    uint32 n;
	
    kprintf("OpenBLT Kernel Debugger");

    for(;;){
        krefresh();
        line = kgetline(linebuf,80);

		if(!strncmp(line,"pgroup ",7)) { dumppgroup(readnum(line+7)); continue; }
        if(!strncmp(line,"resource ", 9)) { dumponersrc(line+9); continue; }
        if(!strcmp(line,"resources")) { dumprsrc(&resource_list); continue; }
		if(!strncmp(line,"queue ",6)) { dumpqueue(readnum(line+6)); continue; }
        if(!strcmp(line,"tasks")) { dumptasks(); continue; }
        if(!strcmp(line,"ports")) { dumpports(); continue; }
        if(!strcmp(line,"memory")) { memory_status(); continue; }
        if(!strcmp(line,"trace")) { trace(r->ebp,eip); continue; }
        if(!strcmp(line,"regs")) { print_regs(r,eip,cs,eflags); continue; }
        if(!strncmp(line,"dump ",5)) { dump(readnum(line+5),16); continue; }
        if(!strncmp(line,"aspace ",7)) { dumpaddr(readnum(line+7)); continue; }
        if(!strcmp(line,"reboot")) { reboot(); }
        if(!strncmp(line,"checksum ",9)) { checksum(line+9); continue; }
		if(!strncmp(line,"team ",5)) { dumpteam(readnum(line+5)); continue; }
		if(!strncmp(line,"find ",5)) { findpage(readnum(line+5)); continue; }
		if(!strcmp(line,"teams")) { dumpteams(); continue; }
		
        if(!strcmp(line,"exit")) break;
        if(!strcmp(line,"x")) break;
        if(!strcmp(line,"c")) break;
    }
}
Ejemplo n.º 7
0
/// Update processor context
void update_regs()
{
	gotoxy(REGS_X, REGS_Y);
	print_regs(&p);
	dissassemble(&p);
	printf("%s                  \n", asm_m);
}
Ejemplo n.º 8
0
void
print_trapframe(struct Trapframe *tf)
{
	cprintf("TRAP frame at %p\n", tf);
	print_regs(&tf->tf_regs);
	cprintf("  es   0x----%04x\n", tf->tf_es);
	cprintf("  ds   0x----%04x\n", tf->tf_ds);
	cprintf("  trap 0x%08x %s\n", tf->tf_trapno, trapname(tf->tf_trapno));
	// If this trap was a page fault that just happened
	// (so %cr2 is meaningful), print the faulting linear address.
	if (tf == last_tf && tf->tf_trapno == T_PGFLT)
		cprintf("  cr2  0x%08x\n", rcr2());
	cprintf("  err  0x%08x", tf->tf_err);
	// For page faults, print decoded fault error code:
	// U/K=fault occurred in user/kernel mode
	// W/R=a write/read caused the fault
	// PR=a protection violation caused the fault (NP=page not present).
	if (tf->tf_trapno == T_PGFLT)
		cprintf(" [%s, %s, %s]\n",
			tf->tf_err & 4 ? "user" : "kernel",
			tf->tf_err & 2 ? "write" : "read",
			tf->tf_err & 1 ? "protection" : "not-present");
	else
		cprintf("\n");
	cprintf("  eip  0x%08x\n", tf->tf_eip);
	cprintf("  cs   0x----%04x\n", tf->tf_cs);
	cprintf("  flag 0x%08x\n", tf->tf_eflags);
	if ((tf->tf_cs & 3) != 0) {
		cprintf("  esp  0x%08x\n", tf->tf_esp);
		cprintf("  ss   0x----%04x\n", tf->tf_ss);
	}
}
Ejemplo n.º 9
0
static void __fault(uint32 number,
           regs r,
           uint32 eip, uint32 cs, uint32 eflags)
{

    kprintf("");
    kprintf("*** Exception 0x%X (%s)",number,etable[number]);
    print_regs(&r, eip, cs, eflags);

    kprintf("");
    kprintf("Task %d (%s) crashed.",current->rsrc.id,current->rsrc.name);
	
	if((cs & 0xFFF8) == SEL_UCODE) user_debug(&r, &eip, &eflags);
	
#ifdef DEBUG_ON_FAULT
    if(number != 2){
        current->flags = tDEAD;
    }
    k_debugger(&r, eip, cs, eflags);
#endif
#ifdef HALT_ON_FAULT
    asm("hlt");
#endif    
    if(number != 2){
        terminate();    
    }
}
Ejemplo n.º 10
0
static void print_exception_info(struct exc_state *state, uint64_t idx)
{
	if (idx < NUM_EXC_VIDS)
		printk(BIOS_DEBUG, "exception %s\n", exception_names[idx]);

	print_regs(state);
	/* Few words below SP in case we need state from a returned function. */
	dump_stack(state->regs.sp - 32, 512);
}
Ejemplo n.º 11
0
static int vce_abort(void *device_id, mm_job_post_t *job)
{
	struct vce_device_t *id = (struct vce_device_t *)device_id;

	pr_info("vce_abort:\n");
	print_regs(id);
	vce_reset(id);

	return 0;
}
Ejemplo n.º 12
0
static int dbg_ricoh_show(struct seq_file *s, void *unused)
{
	struct ricoh618 *ricoh = s->private;
	struct i2c_client *client = ricoh->client;

	seq_printf(s, "RICOH618 Registers\n");
	seq_printf(s, "------------------\n");

	print_regs("System Regs",		s, client, 0x0, 0x05);
	print_regs("Power Control Regs",	s, client, 0x07, 0x2B);
	print_regs("DCDC  Regs",		s, client, 0x2C, 0x43);
	print_regs("LDO   Regs",		s, client, 0x44, 0x5C);
	print_regs("ADC   Regs",		s, client, 0x64, 0x8F);
	print_regs("GPIO  Regs",		s, client, 0x90, 0x9B);
	print_regs("INTC  Regs",		s, client, 0x9C, 0x9E);
	print_regs("OPT   Regs",		s, client, 0xB0, 0xB1);
	print_regs("CHG   Regs",		s, client, 0xB2, 0xDF);
	print_regs("FUEL  Regs",		s, client, 0xE0, 0xFC);
	return 0;
}
Ejemplo n.º 13
0
void print_trapframe(struct trapframe *tf)
{
	kprintf("trapframe at %p\n", tf);
	print_regs(&tf->tf_regs);
	kprintf("  usr_lr   0x%08x\n", tf->__tf_user_lr);
	kprintf("  sp   0x%08x\n", tf->tf_esp);
	kprintf("  lr   0x%08x\n", tf->tf_epc);
	kprintf("  spsr 0x%08x %s\n", tf->tf_sr, modenames[tf->tf_sr & 0xF]);
	kprintf("  trap 0x%08x %s\n", tf->tf_trapno, trapname(tf->tf_trapno));
	kprintf("  err  0x%08x\n", tf->tf_err);
}
Ejemplo n.º 14
0
static void __init ricoh61x_debuginit(struct ricoh61x *ricoh)
{
	struct i2c_client *client = ricoh->client;

	printk(KERN_INFO "RICOH61x Registers\n");
	printk(KERN_INFO "------------------\n");

	print_regs("System Regs",		client, 0x0, 0x05);
	print_regs("Power Control Regs",	client, 0x07, 0x2B);
	print_regs("DCDC  Regs",		client, 0x2C, 0x43);
	print_regs("LDO   Regs",		client, 0x44, 0x5C);
	print_regs("ADC   Regs",		client, 0x64, 0x8F);
	print_regs("GPIO  Regs",		client, 0x90, 0x9B);
	print_regs("INTC  Regs",		client, 0x9C, 0x9E);
	print_regs("OPT   Regs",		client, 0xB0, 0xB1);
	print_regs("CHG   Regs",		client, 0xB2, 0xDF);
	print_regs("FUEL  Regs",		client, 0xE0, 0xFC);

	return 0;
}
Ejemplo n.º 15
0
void
print_trapframe(struct trapframe *tf) {
    cprintf("trapframe at %p\n", tf);
    print_regs(&tf->tf_regs);
    cprintf("  LO           0x----%08x\n", tf->tf_LO);
    cprintf("  HI           0x----%08x\n", tf->tf_HI);
    cprintf("  Status       0x----%08x\n", tf->tf_Status);
    cprintf("  Cause        0x----%08x\n", tf->tf_Cause);
    cprintf("  EPC          0x----%08x\n", tf->tf_EPC);
    cprintf("  BadVAddr     0x----%08x\n", tf->tf_BadVAddr);

    cprintf("  Exception    %s\n", trapname((tf->tf_Cause & 0x0000007c) >> 2));
}
Ejemplo n.º 16
0
void
print_trapframe(struct Trapframe *tf)
{
	cprintf("TRAP frame at %p\n", tf);
	print_regs(&tf->tf_regs);
	cprintf("  es   0x----%04x\n", tf->tf_es);
	cprintf("  ds   0x----%04x\n", tf->tf_ds);
	cprintf("  trap 0x%08x %s\n", tf->tf_trapno, trapname(tf->tf_trapno));
	cprintf("  err  0x%08x\n", tf->tf_err);
	cprintf("  eip  0x%08x\n", tf->tf_eip);
	cprintf("  cs   0x----%04x\n", tf->tf_cs);
	cprintf("  flag 0x%08x\n", tf->tf_eflags);
	cprintf("  esp  0x%08x\n", tf->tf_esp);
	cprintf("  ss   0x----%04x\n", tf->tf_ss);
}
Ejemplo n.º 17
0
static void ipu_run_test(struct ipu *ipu, bool swap)
{
	printf("Enabling clock...\n");
	ipu_enable_clock(ipu);
	printf("Clock enabled. Reseting IPU...\n");
	ipu_reset(ipu, IPU_NEAREST_NEIGHBOR, 320, 144, 320, 240, swap);
	printf("IPU reseted. Running IPU...\n");
	ipu_run(ipu);
	printf("IPU should be running now. Waiting for EOF status bit...\n");
	ipu_wait_completion(ipu);
	printf("Sequence completed! IPU exited with status code %x.\n\n",
				read_reg(ipu, REG_STATUS) & 0x7);
	print_regs(ipu);
	printf("\nStopping clock...\n");
	ipu_disable_clock(ipu);
}
Ejemplo n.º 18
0
Archivo: main.c Proyecto: znuh/unsorted
void dump_regs(int fd, as3935_t *buf) {
	uint8_t regs[9] = {0};
	int res;
	
	res = write(fd, regs, 1);
	assert(res == 1);

	res = read(fd, regs, sizeof(regs));
	assert(res == sizeof(regs));
	
	hexdump(regs,sizeof(regs));
	print_regs((as3935_t*)regs);
	
	if(buf)
		memcpy(buf, regs, sizeof(as3935_t));
}
Ejemplo n.º 19
0
static int read_regs(struct file *filp)
{
   int ret;
   bcm_phone_pcm_regs_t regs;

   memset(&(regs), 0, sizeof(regs));

   ret = bcm_drv_unlocked_ioctl(filp, BCMPH_IOCTL_READ_PCM_REGS, (unsigned long)(&(regs)));
   if (!ret) {
      print_regs(&(regs));
   }
   else {
      fprintf(stderr, "Error reading PCM registers.\n");
   }

   return (ret);
}
Ejemplo n.º 20
0
int main(int argc, char **argv) {

	if(argc != 2){
		printf("[-]args's length(%d) is not right", argc);
		return -1;
	}
	pid_t target_pid = atoi(argv[1]);
	printf("[+]    target_pid | %d\n", target_pid);

	ptrace_attach(target_pid);

	struct pt_regs regs;
	ptrace_getregs(target_pid, &regs);
	print_regs(&regs);

	ptrace_detach(target_pid);
}
Ejemplo n.º 21
0
void print_trapframe(struct trapframe *tf)
{
	PRINT_HEX("trapframe at ", tf);
	print_regs(&tf->tf_regs);
	PRINT_HEX(" $ra\t: ", tf->tf_ra);
	PRINT_HEX(" BadVA\t: ", tf->tf_vaddr);
	PRINT_HEX(" Status\t: ", tf->tf_status);
	PRINT_HEX(" Cause\t: ", tf->tf_cause);
	PRINT_HEX(" EPC\t: ", tf->tf_epc);
	if (!trap_in_kernel(tf)) {
		kprintf("Trap in usermode: ");
	} else {
		kprintf("Trap in kernel: ");
	}
	kprintf(trapname(GET_CAUSE_EXCODE(tf->tf_cause)));
	kputchar('\n');
}
Ejemplo n.º 22
0
int EditWindowNumber(int arg) {
ArgVal   *v;
AtomType  at;

   arg++;

   v = &(vals[arg]);
   at = v->Type;
   if (at == Numeric) {
      arg++;
      if ((v->Number == 1) || (v->Number == 2)) {
	 win = v->Number;
      } else printf("Bad window number:%d Must be [1..2]\n",v->Number);
   }
   printf("Wn:%d selected\n",win);
   print_regs(win);
   return arg;
}
Ejemplo n.º 23
0
int main(int argc, char **argv) {
#define Debug 1
	if(argc != 3){
		printf("[-]args's length(%d) is not right\n", argc);
		return -1;
	}
	pid_t target_pid 	= atoi(argv[1]);
	int targetInteger 	= atoi(argv[2]);
	printf("[+]    target_pid | %d\n", target_pid);

	ptrace_attach(target_pid);
	struct pt_regs regs;
	ptrace_getregs(target_pid, &regs);

	printf("[+] print regs:\n");
#if Debug
	print_regs(&regs);
#endif
	printf("[+] search target integer:%d\n", targetInteger);
	getSpaceAddress(target_pid, "heap", 	&heap_start, &heap_end);
	getSpaceAddress(target_pid, "stack", 	&statck_start, &statck_end);
	getSpaceAddress(target_pid, "vectors", 	&vectors_start, &vectors_end);
	// 打印区域地址
	printf("[+]heap:0x%08X - 0x%08X\n", heap_start, heap_end);
	printf("[+]statck:0x%08X - 0x%08X\n", statck_start, statck_end);
	printf("[+]vectors:0x%08X - 0x%08X\n", vectors_start, vectors_end);
	// 搜索段
	SearchSegment(target_pid, "heap region data", "PK", heap_start, heap_end);
	SearchSegment(target_pid, "statck region data", "PK", statck_start, statck_end);
	SearchSegment(target_pid, "vectors region data", "PK", vectors_start, vectors_end);

	SearchSegment(target_pid, "heap region data", "dex", heap_start, heap_end);
	SearchSegment(target_pid, "statck region data", "dex", statck_start, statck_end);
	SearchSegment(target_pid, "vectors region data", "dex", vectors_start, vectors_end);

	SearchSegment(target_pid, "heap region data", "com.", heap_start, heap_end);
	SearchSegment(target_pid, "statck region data", "com.", statck_start, statck_end);
	SearchSegment(target_pid, "vectors region data", "com.", vectors_start, vectors_end);

	SearchSegment(target_pid, "heap region data", "android", heap_start, heap_end);
	SearchSegment(target_pid, "statck region data", "android", statck_start, statck_end);
	SearchSegment(target_pid, "vectors region data", "android", vectors_start, vectors_end);
}
Ejemplo n.º 24
0
/*
 * If interrupt number is within range of PIC, then
 * Send an EOI (end of interrupt) signal to the PICs.
 */
inline
void
finish_isr  (the_x86_regs *regs)
{
  int no = regs->int_no;
  if ((no > 31) && (no < 48)) {   // For H/W interrupts only.
    if ((no >= 40) && (no <=47))  // For cascaded slave PIC
      outb(0xA0, 0x20);           // Send the EoI signal.
    outb(0x20, 0x20);             // Always reset the master.
  } else {
    kbprintf   (   "Here are the registers and error code.\n");
    kttyprintf (0, "Here are the registers and error code.\n");

    kprintf    (   "%-6s 0x%08X\n", "Error code",    regs->err_code);
    kttyprintf (0, "%-6s 0x%08X\n", "Error code",    regs->err_code);

    print_regs (regs);
    wheeling_idle ();
  }
}
Ejemplo n.º 25
0
/* baseAddr is the base address of RAM to be assigned to VM. 
 * Kernel must be placed 32KiB into this section of RAM.  */
struct guestVM_s *createVM(unsigned int baseAddr, unsigned int memorySize)
{
	struct guestVM_s *guest = malloc(sizeof(struct guestVM_s));

	guest->stageOneTable = createPageTable();
	mapMemoryToVM(guest, baseAddr, 0x40000000, memorySize, 0x1FF); /* base memory map */
	mapMemoryToVM(guest, 0x01c28000, 0x01c28000,  0x1000, 0x1B1);   /* UART0 */
	mapMemoryToVM(guest, 0x01c00000, 0x01c00000,  0x1000, 0x1B1);   /* SRAM config regs */
	mapMemoryToVM(guest, 0x01c01000, 0x01c01000,  0x1000, 0x1B1);   /* DRAM config regs */
	mapMemoryToVM(guest, 0x01c02000, 0x01c02000,  0x1000, 0x1B1);   /* DMA config regs */
	mapMemoryToVM(guest, 0x01c0a000, 0x01c0a000,  0x1000, 0x1B1);   /* TVE0 config regs */
	mapMemoryToVM(guest, 0x01c0C000, 0x01c0C000,  0x2000, 0x1B1);   /* LCD config regs */
	mapMemoryToVM(guest, 0x01c0F000, 0x01c0F000,  0x4000, 0x1B1);   /* MMC device regs */
	mapMemoryToVM(guest, 0x01c13000, 0x01c13000,  0x1000, 0x1B1);   /* USB config regs */
	mapMemoryToVM(guest, 0x01c14000, 0x01c14000,  0x1000, 0x1B1);   /* USB config regs */
	mapMemoryToVM(guest, 0x01c16000, 0x01c16000,  0x1000, 0x1B1);   /* USB config regs */
	mapMemoryToVM(guest, 0x01c1B000, 0x01c1B000,  0x1000, 0x1B1);   /* USB config regs */
	mapMemoryToVM(guest, 0x01c1C000, 0x01c1C000,  0x1000, 0x1B1);   /* USB config regs */
	mapMemoryToVM(guest, 0x01c18000, 0x01c18000,  0x1000, 0x1B1);   /* SATA config regs */
	mapMemoryToVM(guest, 0x01c22000, 0x01c22000,  0x1000, 0x1B1);   /* PS2 config regs */
	mapMemoryToVM(guest, 0x01c25000, 0x01c25000,  0x1000, 0x1B1);   /* PS2 config regs */
	mapMemoryToVM(guest, 0x01c2a000, 0x01c2a000,  0x2000, 0x1B1);   /* PS2 config regs */
	mapMemoryToVM(guest, 0x01c2c000, 0x01c2c000,  0x1000, 0x1B1);   /* PS2 config regs */
	mapMemoryToVM(guest, 0x01e00000, 0x01e00000, 0x40000, 0x1B1);   /* DEFE config regs */
	mapMemoryToVM(guest, 0x01e40000, 0x01e40000, 0x40000, 0x1B1);   /* DEBE config regs */
	mapMemoryToVM(guest, (unsigned int)GICV(0), (unsigned int)GICC, 
		0x1000, 0x1B1);   /* VGIC mappings */

	guest->regs.pc = (0x40008000);
	guest->regs.cpsr = 0x00000013;
	guest->regs.r0 = 0;
	guest->regs.r1 = 0x000010bb;
	guest->regs.r2 = 0x40000000;
	guest->regs.r3 = 0;
	guest->vgic.ctlr = 0;

	printh("New Guest Regs:\r\n");
	print_regs(&(guest->regs));
	return guest;
}
Ejemplo n.º 26
0
Archivo: 1.c Proyecto: TySag/project
void
print_trapframe(struct trapframe *tf) {
    PRINT_HEX("trapframe at ", tf);
    print_regs(&tf->tf_regs);
    PRINT_HEX(" $ra\t: ", tf->tf_ra);
    PRINT_HEX(" BadVA\t: ", tf->tf_vaddr);
    PRINT_HEX(" Status\t: ", tf->tf_status);
    PRINT_HEX(" Cause\t: ", tf->tf_cause);
    PRINT_HEX(" EPC\t: ", tf->tf_epc);
    if (!trap_in_kernel(tf)) {
      kprintf("Trap in usermode: ");
    }else{
      kprintf("Trap in kernel: ");
    }
    kprintf(trapname(GET_CAUSE_EXCODE(tf->tf_cause)));
    kputchar('\n'); 
 //   /*
    int i;
    for (i = 0; i < 20; ++i) {
        int *addr = (int*)(tf->tf_epc + i * 4);
        kprintf("0x%08x=0x%08x\n", addr, *addr);
    }
 //   */
}
Ejemplo n.º 27
0
void exception_dispatch(u32 idx)
{
	die_if(idx >= EXC_COUNT || !names[idx], "Bad exception index %u!", idx);

	if (hook && hook(idx))
		return;

	printf("%s Exception\n", names[idx]);
	print_regs();
	switch (idx) {
	case EXC_PABORT:
		printf("IFAR = %#.8x\n", read_ifar());
		printf("IFSR = %#.8x\n", read_ifsr());
		printf("AIFSR = %#.8x\n", read_aifsr());
		break;
	case EXC_DABORT:
		printf("DFAR = %#.8x\n", read_dfar());
		printf("DFSR = %#.8x\n", read_dfsr());
		printf("ADFSR = %#.8x\n", read_adfsr());
		break;
	};
	dump_stack(exception_state.regs[13], 512);
	halt();
}
Ejemplo n.º 28
0
long long perf_mmap_read( void *our_mmap, int mmap_size,
                    long long prev_head,
		    int sample_type, int read_format, long long reg_mask,
		    void *validate,
		    int quiet, int *events_read ) {

	struct perf_event_mmap_page *control_page = (struct perf_event_mmap_page * )our_mmap;
	long long head,offset;
	int i,size;
	long long bytesize,prev_head_wrap;

	unsigned char *data;

	void *data_mmap= (void *)((size_t)our_mmap+getpagesize());

	if (mmap_size==0) return 0;

	if (control_page==NULL) {
		fprintf(stderr,"ERROR mmap page NULL\n");
		return -1;
	}

	head=control_page->data_head;
	//rmb(); /* Must always follow read of data_head */

	size=head-prev_head;

	printf("Head: %lld Prev_head=%lld\n",head,prev_head);
	printf("%d new bytes\n",size);

	bytesize=mmap_size*getpagesize();

	if (size>bytesize) {
		printf("error!  we overflowed the mmap buffer %d>%lld bytes\n",
			size,bytesize);
	}

	data= (unsigned char *)malloc(bytesize);
	if (data==NULL) {
		return -1;
	}

	prev_head_wrap=prev_head%bytesize;

	//   printf("Copying %d bytes from %d to %d\n",
	//	  bytesize-prev_head_wrap,prev_head_wrap,0);
	memcpy(data,(unsigned char*)data_mmap + prev_head_wrap,
		bytesize-prev_head_wrap);

	//printf("Copying %d bytes from %d to %d\n",
	//	  prev_head_wrap,0,bytesize-prev_head_wrap);

	memcpy(data+(bytesize-prev_head_wrap),(unsigned char *)data_mmap,
		prev_head_wrap);

	struct perf_event_header *event;


	offset=0;
	if (events_read) *events_read=0;

	while(offset<size) {

		//printf("Offset %d Size %d\n",offset,size);
		event = ( struct perf_event_header * ) & data[offset];

		/********************/
		/* Print event Type */
		/********************/

		if (!quiet) {
			switch(event->type) {
				case PERF_RECORD_MMAP:
					printf("PERF_RECORD_MMAP"); break;
				case PERF_RECORD_LOST:
					printf("PERF_RECORD_LOST"); break;
				case PERF_RECORD_COMM:
					printf("PERF_RECORD_COMM"); break;
				case PERF_RECORD_EXIT:
					printf("PERF_RECORD_EXIT"); break;
				case PERF_RECORD_THROTTLE:
					printf("PERF_RECORD_THROTTLE"); break;
				case PERF_RECORD_UNTHROTTLE:
					printf("PERF_RECORD_UNTHROTTLE"); break;
				case PERF_RECORD_FORK:
					printf("PERF_RECORD_FORK"); break;
				case PERF_RECORD_READ:
					printf("PERF_RECORD_READ"); break;
				case PERF_RECORD_SAMPLE:
					printf("PERF_RECORD_SAMPLE [%x]",sample_type); break;
				case PERF_RECORD_MMAP2:
					printf("PERF_RECORD_MMAP2"); break;
				default: printf("UNKNOWN %d",event->type); break;
			}

			printf(", MISC=%d (",event->misc);
			switch(event->misc & PERF_RECORD_MISC_CPUMODE_MASK) {
				case PERF_RECORD_MISC_CPUMODE_UNKNOWN:
					printf("PERF_RECORD_MISC_CPUMODE_UNKNOWN"); break; 
				case PERF_RECORD_MISC_KERNEL:
					printf("PERF_RECORD_MISC_KERNEL"); break;
				case PERF_RECORD_MISC_USER:
					printf("PERF_RECORD_MISC_USER"); break;
				case PERF_RECORD_MISC_HYPERVISOR:
					printf("PERF_RECORD_MISC_HYPERVISOR"); break;
				case PERF_RECORD_MISC_GUEST_KERNEL:
					printf("PERF_RECORD_MISC_GUEST_KERNEL"); break;
				case PERF_RECORD_MISC_GUEST_USER:
					printf("PERF_RECORD_MISC_GUEST_USER"); break;
				default:
					printf("Unknown %d!\n",event->misc); break;
			}

			/* Both have the same value */
			if (event->misc & PERF_RECORD_MISC_MMAP_DATA) {
				printf(",PERF_RECORD_MISC_MMAP_DATA or PERF_RECORD_MISC_COMM_EXEC ");
			}

			if (event->misc & PERF_RECORD_MISC_EXACT_IP) {
				printf(",PERF_RECORD_MISC_EXACT_IP ");
			}

			if (event->misc & PERF_RECORD_MISC_EXT_RESERVED) {
				printf(",PERF_RECORD_MISC_EXT_RESERVED ");
			}

			printf("), Size=%d\n",event->size);
		}

		offset+=8; /* skip header */

		/***********************/
		/* Print event Details */
		/***********************/

		switch(event->type) {

		/* Lost */
		case PERF_RECORD_LOST: {
			long long id,lost;
			memcpy(&id,&data[offset],sizeof(long long));
			if (!quiet) printf("\tID: %lld\n",id);
			offset+=8;
			memcpy(&lost,&data[offset],sizeof(long long));
			if (!quiet) printf("\tLOST: %lld\n",lost);
			offset+=8;
			}
			break;

		/* COMM */
		case PERF_RECORD_COMM: {
			int pid,tid,string_size;
			char *string;

			memcpy(&pid,&data[offset],sizeof(int));
			if (!quiet) printf("\tPID: %d\n",pid);
			offset+=4;
			memcpy(&tid,&data[offset],sizeof(int));
			if (!quiet) printf("\tTID: %d\n",tid);
			offset+=4;

			/* FIXME: sample_id handling? */

			/* two ints plus the 64-bit header */
			string_size=event->size-16;
			string=(char *)calloc(string_size,sizeof(char));
			memcpy(string,&data[offset],string_size);
			if (!quiet) printf("\tcomm: %s\n",string);
			offset+=string_size;
			if (string) free(string);
			}
			break;

		/* Fork */
		case PERF_RECORD_FORK: {
			int pid,ppid,tid,ptid;
			long long fork_time;

			memcpy(&pid,&data[offset],sizeof(int));
			if (!quiet) printf("\tPID: %d\n",pid);
			offset+=4;
			memcpy(&ppid,&data[offset],sizeof(int));
			if (!quiet) printf("\tPPID: %d\n",ppid);
			offset+=4;
			memcpy(&tid,&data[offset],sizeof(int));
			if (!quiet) printf("\tTID: %d\n",tid);
			offset+=4;
			memcpy(&ptid,&data[offset],sizeof(int));
			if (!quiet) printf("\tPTID: %d\n",ptid);
			offset+=4;
			memcpy(&fork_time,&data[offset],sizeof(long long));
			if (!quiet) printf("\tTime: %lld\n",fork_time);
			offset+=8;
			}
			break;

		/* mmap */
		case PERF_RECORD_MMAP: {
			int pid,tid,string_size;
			long long address,len,pgoff;
			char *filename;

			memcpy(&pid,&data[offset],sizeof(int));
			if (!quiet) printf("\tPID: %d\n",pid);
			offset+=4;
			memcpy(&tid,&data[offset],sizeof(int));
			if (!quiet) printf("\tTID: %d\n",tid);
			offset+=4;
			memcpy(&address,&data[offset],sizeof(long long));
			if (!quiet) printf("\tAddress: %llx\n",address);
			offset+=8;
			memcpy(&len,&data[offset],sizeof(long long));
			if (!quiet) printf("\tLength: %llx\n",len);
			offset+=8;
			memcpy(&pgoff,&data[offset],sizeof(long long));
			if (!quiet) printf("\tPage Offset: %llx\n",pgoff);
			offset+=8;

			string_size=event->size-40;
			filename=(char *)calloc(string_size,sizeof(char));
			memcpy(filename,&data[offset],string_size);
			if (!quiet) printf("\tFilename: %s\n",filename);
			offset+=string_size;
			if (filename) free(filename);

			}
			break;

		/* mmap2 */
		case PERF_RECORD_MMAP2: {
			int pid,tid,string_size;
			long long address,len,pgoff;
			int major,minor;
			long long ino,ino_generation;
			int prot,flags;
			char *filename;

			memcpy(&pid,&data[offset],sizeof(int));
			if (!quiet) printf("\tPID: %d\n",pid);
			offset+=4;
			memcpy(&tid,&data[offset],sizeof(int));
			if (!quiet) printf("\tTID: %d\n",tid);
			offset+=4;
			memcpy(&address,&data[offset],sizeof(long long));
			if (!quiet) printf("\tAddress: %llx\n",address);
			offset+=8;
			memcpy(&len,&data[offset],sizeof(long long));
			if (!quiet) printf("\tLength: %llx\n",len);
			offset+=8;
			memcpy(&pgoff,&data[offset],sizeof(long long));
			if (!quiet) printf("\tPage Offset: %llx\n",pgoff);
			offset+=8;
			memcpy(&major,&data[offset],sizeof(int));
			if (!quiet) printf("\tMajor: %d\n",major);
			offset+=4;
			memcpy(&minor,&data[offset],sizeof(int));
			if (!quiet) printf("\tMinor: %d\n",minor);
			offset+=4;
			memcpy(&ino,&data[offset],sizeof(long long));
			if (!quiet) printf("\tIno: %llx\n",ino);
			offset+=8;
			memcpy(&ino_generation,&data[offset],sizeof(long long));
			if (!quiet) printf("\tIno generation: %llx\n",ino_generation);
			offset+=8;
			memcpy(&prot,&data[offset],sizeof(int));
			if (!quiet) printf("\tProt: %d\n",prot);
			offset+=4;
			memcpy(&flags,&data[offset],sizeof(int));
			if (!quiet) printf("\tFlags: %d\n",flags);
			offset+=4;

			string_size=event->size-72;
			filename=(char *)calloc(string_size,sizeof(char));
			memcpy(filename,&data[offset],string_size);
			if (!quiet) printf("\tFilename: %s\n",filename);
			offset+=string_size;
			if (filename) free(filename);

			}
			break;

		/* Exit */
		case PERF_RECORD_EXIT: {
			int pid,ppid,tid,ptid;
			long long fork_time;

			memcpy(&pid,&data[offset],sizeof(int));
			if (!quiet) printf("\tPID: %d\n",pid);
			offset+=4;
			memcpy(&ppid,&data[offset],sizeof(int));
			if (!quiet) printf("\tPPID: %d\n",ppid);
			offset+=4;
			memcpy(&tid,&data[offset],sizeof(int));
			if (!quiet) printf("\tTID: %d\n",tid);
			offset+=4;
			memcpy(&ptid,&data[offset],sizeof(int));
			if (!quiet) printf("\tPTID: %d\n",ptid);
			offset+=4;
			memcpy(&fork_time,&data[offset],sizeof(long long));
			if (!quiet) printf("\tTime: %lld\n",fork_time);
			offset+=8;
			}
			break;

		/* Sample */
		case PERF_RECORD_SAMPLE: {
		#if 1	
			long long iter = offset-8;
			while(iter < (offset + 128)) {
				long long value;
				memcpy(&value, &data[iter], sizeof(long long));
				if (!quiet) printf("\t offset %llx: %llx\n", iter, value);
				iter += 8;		
			}
		#endif
 			if (sample_type & PERF_SAMPLE_IP) {
				long long ip;
				memcpy(&ip,&data[offset],sizeof(long long));
				if (!quiet) printf("\tPERF_SAMPLE_IP, IP: %llx\n",ip);
				offset+=8;
			}
			if (sample_type & PERF_SAMPLE_TID) {
				int pid, tid;
				memcpy(&pid,&data[offset],sizeof(int));
				memcpy(&tid,&data[offset+4],sizeof(int));

				if (!quiet) {
					printf("\tPERF_SAMPLE_TID, pid: %d  tid %d\n",pid,tid);
				}
				offset+=8;
			}

			if (sample_type & PERF_SAMPLE_TIME) {
				long long time;
				memcpy(&time,&data[offset],sizeof(long long));
				if (!quiet) printf("\tPERF_SAMPLE_TIME, time: %lld\n",time);
				offset+=8;
			}
			if (sample_type & PERF_SAMPLE_ADDR) {
				long long addr;
				memcpy(&addr,&data[offset],sizeof(long long));
				if (!quiet) printf("\tPERF_SAMPLE_ADDR, addr: %llx. Offset %llx\n",addr, offset);
				offset+=8;
			}
			if (sample_type & PERF_SAMPLE_ID) {
				long long sample_id;
				memcpy(&sample_id,&data[offset],sizeof(long long));
				if (!quiet) printf("\tPERF_SAMPLE_ID, sample_id: %lld. Offset %llx\n",sample_id, offset);
				offset+=8;
			}
			if (sample_type & PERF_SAMPLE_STREAM_ID) {
				long long sample_stream_id;
				memcpy(&sample_stream_id,&data[offset],sizeof(long long));
				if (!quiet) {
					printf("\tPERF_SAMPLE_STREAM_ID, sample_stream_id: %lld\n",sample_stream_id);
				}
				offset+=8;
			}
			if (sample_type & PERF_SAMPLE_CPU) {
				int cpu, res;
				memcpy(&cpu,&data[offset],sizeof(int));
				memcpy(&res,&data[offset+4],sizeof(int));
				if (!quiet) printf("\tPERF_SAMPLE_CPU, cpu: %d  res %d\n",cpu,res);
				offset+=8;
			}
			if (sample_type & PERF_SAMPLE_PERIOD) {
				long long period;
				memcpy(&period,&data[offset],sizeof(long long));
				if (!quiet) printf("\tPERF_SAMPLE_PERIOD, period: %lld\n",period);
				offset+=8;
			}
			if (sample_type & PERF_SAMPLE_READ) {
				int length;

				if (!quiet) printf("\tPERF_SAMPLE_READ, read_format\n");
				length=handle_struct_read_format(&data[offset],
						read_format,
						validate,quiet);
				if (length>=0) offset+=length;
			}
			if (sample_type & PERF_SAMPLE_CALLCHAIN) {
				long long nr,ip;
				memcpy(&nr,&data[offset],sizeof(long long));
				if (!quiet) printf("\tPERF_SAMPLE_CALLCHAIN, callchain length: %lld\n",nr);
				offset+=8;

				for(i=0;i<nr;i++) {
					memcpy(&ip,&data[offset],sizeof(long long));
					if (!quiet) printf("\t\t ip[%d]: %llx\n",i,ip);
					offset+=8;
				}
			}
			if (sample_type & PERF_SAMPLE_RAW) {
				int size;

				memcpy(&size,&data[offset],sizeof(int));
				if (!quiet) printf("\tPERF_SAMPLE_RAW, Raw length: %d\n",size);
				offset+=4;

				if (!quiet) printf("\t\t");
				for(i=0;i<size;i++) {
					if (!quiet) printf("%d ",data[offset]);
					offset+=1;
				}
				if (!quiet) printf("\n");
			}

			if (sample_type & PERF_SAMPLE_BRANCH_STACK) {
				long long bnr;
				memcpy(&bnr,&data[offset],sizeof(long long));
				if (!quiet) {
					printf("\tPERF_SAMPLE_BRANCH_STACK, branch_stack entries: %lld\n",bnr);
				}
				offset+=8;

				for(i=0;i<bnr;i++) {
					long long from,to,flags;

					/* From value */
					memcpy(&from,&data[offset],sizeof(long long));
					offset+=8;


					/* To Value */
					memcpy(&to,&data[offset],sizeof(long long));
					offset+=8;
					if (!quiet) {
						printf("\t\t lbr[%d]: %llx %llx ",
							i,from,to);
		 			}

					/* Flags */
					memcpy(&flags,&data[offset],sizeof(long long));
					offset+=8;

					if (!quiet) {
						if (flags==0) printf("0");

						if (flags&1) {
							printf("MISPREDICTED ");
							flags&=~2;
						}

						if (flags&2) {
							printf("PREDICTED ");
							flags&=~2;
						}

						if (flags&4) {
							printf("IN_TRANSACTION ");
							flags&=~4;
						}

						if (flags&8) {
							printf("TRANSACTION_ABORT ");
							flags&=~8;
						}
						printf("\n");
					}
	      			}
	   		}
			if (sample_type & PERF_SAMPLE_REGS_USER) {
				long long abi;

				memcpy(&abi,&data[offset],sizeof(long long));
				if (!quiet) {
					printf("\tPERF_SAMPLE_REGS_USER, ABI: ");
					if (abi==PERF_SAMPLE_REGS_ABI_NONE) printf ("PERF_SAMPLE_REGS_ABI_NONE");
					if (abi==PERF_SAMPLE_REGS_ABI_32) printf("PERF_SAMPLE_REGS_ABI_32");
					if (abi==PERF_SAMPLE_REGS_ABI_64) printf("PERF_SAMPLE_REGS_ABI_64");
					printf("\n");
				}
				offset+=8;

				offset+=print_regs(quiet,abi,reg_mask,
						&data[offset]);

				if (!quiet) printf("\n");
			}

			if (sample_type & PERF_SAMPLE_STACK_USER) {
				long long size,dyn_size;
				int *stack_data;
				int k;

				memcpy(&size,&data[offset],sizeof(long long));
				if (!quiet) printf("\tPERF_SAMPLE_STACK_USER, Requested size: %lld\n",size);
				offset+=8;

				stack_data=(int *)malloc(size);
				memcpy(stack_data,&data[offset],size);
				offset+=size;

				memcpy(&dyn_size,&data[offset],sizeof(long long));
				if (!quiet) printf("\t\tDynamic (used) size: %lld\n",dyn_size);
				offset+=8;

				if (!quiet) printf("\t\t");
				for(k=0;k<dyn_size;k+=4) {
					if (!quiet) printf("0x%x ",stack_data[k]);
				}

				free(stack_data);

				if (!quiet) printf("\n");
			}

			if (sample_type & PERF_SAMPLE_WEIGHT) {
				long long weight;

				memcpy(&weight,&data[offset],sizeof(long long));
				if (!quiet) printf("\tPERF_SAMPLE_WEIGHT, Weight: %lld ",weight);
				offset+=8;

				if (!quiet) printf("\n");
			}

			if (sample_type & PERF_SAMPLE_DATA_SRC) {
				long long src;

				memcpy(&src,&data[offset],sizeof(long long));
				if (!quiet) printf("\tPERF_SAMPLE_DATA_SRC, Raw: %llx\n",src);
				offset+=8;

				if (!quiet) {
					if (src!=0) printf("\t\t");
					if (src & (PERF_MEM_OP_NA<<PERF_MEM_OP_SHIFT))
						printf("Op Not available ");
					if (src & (PERF_MEM_OP_LOAD<<PERF_MEM_OP_SHIFT))
						printf("Load ");
					if (src & (PERF_MEM_OP_STORE<<PERF_MEM_OP_SHIFT))
						printf("Store ");
					if (src & (PERF_MEM_OP_PFETCH<<PERF_MEM_OP_SHIFT))
						printf("Prefetch ");
					if (src & (PERF_MEM_OP_EXEC<<PERF_MEM_OP_SHIFT))
						printf("Executable code ");

					if (src & (PERF_MEM_LVL_NA<<PERF_MEM_LVL_SHIFT))
						printf("Level Not available ");
					if (src & (PERF_MEM_LVL_HIT<<PERF_MEM_LVL_SHIFT))
						printf("Hit ");
					if (src & (PERF_MEM_LVL_MISS<<PERF_MEM_LVL_SHIFT))
						printf("Miss ");
					if (src & (PERF_MEM_LVL_L1<<PERF_MEM_LVL_SHIFT))
						printf("L1 cache ");
					if (src & (PERF_MEM_LVL_LFB<<PERF_MEM_LVL_SHIFT))
						printf("Line fill buffer ");
					if (src & (PERF_MEM_LVL_L2<<PERF_MEM_LVL_SHIFT))
						printf("L2 cache ");
					if (src & (PERF_MEM_LVL_L3<<PERF_MEM_LVL_SHIFT))
						printf("L3 cache ");
					if (src & (PERF_MEM_LVL_LOC_RAM<<PERF_MEM_LVL_SHIFT))
						printf("Local DRAM ");
					if (src & (PERF_MEM_LVL_REM_RAM1<<PERF_MEM_LVL_SHIFT))
						printf("Remote DRAM 1 hop ");
					if (src & (PERF_MEM_LVL_REM_RAM2<<PERF_MEM_LVL_SHIFT))
						printf("Remote DRAM 2 hops ");
					if (src & (PERF_MEM_LVL_REM_CCE1<<PERF_MEM_LVL_SHIFT))
						printf("Remote cache 1 hop ");
					if (src & (PERF_MEM_LVL_REM_CCE2<<PERF_MEM_LVL_SHIFT))
						printf("Remote cache 2 hops ");
					if (src & (PERF_MEM_LVL_IO<<PERF_MEM_LVL_SHIFT))
						printf("I/O memory ");
					if (src & (PERF_MEM_LVL_UNC<<PERF_MEM_LVL_SHIFT))
						printf("Uncached memory ");

					if (src & (PERF_MEM_SNOOP_NA<<PERF_MEM_SNOOP_SHIFT))
						printf("Not available ");
					if (src & (PERF_MEM_SNOOP_NONE<<PERF_MEM_SNOOP_SHIFT))
						printf("No snoop ");
					if (src & (PERF_MEM_SNOOP_HIT<<PERF_MEM_SNOOP_SHIFT))
						printf("Snoop hit ");
					if (src & (PERF_MEM_SNOOP_MISS<<PERF_MEM_SNOOP_SHIFT))
						printf("Snoop miss ");
					if (src & (PERF_MEM_SNOOP_HITM<<PERF_MEM_SNOOP_SHIFT))
						printf("Snoop hit modified ");

					if (src & (PERF_MEM_LOCK_NA<<PERF_MEM_LOCK_SHIFT))
						printf("Not available ");
					if (src & (PERF_MEM_LOCK_LOCKED<<PERF_MEM_LOCK_SHIFT))
						printf("Locked transaction ");

					if (src & (PERF_MEM_TLB_NA<<PERF_MEM_TLB_SHIFT))
						printf("Not available ");
					if (src & (PERF_MEM_TLB_HIT<<PERF_MEM_TLB_SHIFT))
						printf("Hit ");
					if (src & (PERF_MEM_TLB_MISS<<PERF_MEM_TLB_SHIFT))
						printf("Miss ");
					if (src & (PERF_MEM_TLB_L1<<PERF_MEM_TLB_SHIFT))
						printf("Level 1 TLB ");
					if (src & (PERF_MEM_TLB_L2<<PERF_MEM_TLB_SHIFT))
						printf("Level 2 TLB ");
					if (src & (PERF_MEM_TLB_WK<<PERF_MEM_TLB_SHIFT))
						printf("Hardware walker ");
					if (src & (PERF_MEM_TLB_OS<<PERF_MEM_TLB_SHIFT))
						printf("OS fault handler ");
				}

				if (!quiet) printf("\n");
			}

			if (sample_type & PERF_SAMPLE_IDENTIFIER) {
				long long abi;

				memcpy(&abi,&data[offset],sizeof(long long));
				if (!quiet) printf("\tPERF_SAMPLE_IDENTIFIER, Raw length: %lld\n",abi);
				offset+=8;

				if (!quiet) printf("\n");
			}

			if (sample_type & PERF_SAMPLE_TRANSACTION) {
				long long abi;

				memcpy(&abi,&data[offset],sizeof(long long));
				if (!quiet) printf("\tPERF_SAMPLE_TRANSACTION, Raw length: %lld\n",abi);
				offset+=8;

				if (!quiet) printf("\n");
			}
			}
			break;

			default: if (!quiet) printf("\tUnknown type %d\n",event->type);
		}
		if (events_read) (*events_read)++;
	}

	control_page->data_tail=head;

	free(data);

	return head;

}
Ejemplo n.º 29
0
void handle_trap_prefetch_abort(struct cpuRegs_s *regs)
{
	print_str("\r\nPrefetch Abort Trap");
	print_regs(regs);
}
Ejemplo n.º 30
0
void handle_trap_data_abort(struct cpuRegs_s *regs)
{
	print_str("\r\nData Abort Trap");
	print_regs(regs);
}