Beispiel #1
0
/* The fault handler itself. All of the exception routines
 * eventually pass control to this function after saving 
 * the processor state. 
*/
void isr_fault_handler(struct regs *r)
{
  char errno[20];
  itoa(r->int_no,errno,20);
  if(r->int_no < 32)
  {
    /* Display Interrupt Description and Loop Endlessly */
    putsp("\n[krnl]: ","FLAGRANT ERROR! (");
    putsp(errno," - ");
    puts(exception_messages[r->int_no]);
    puts(") Computer Over.\n");
    dump_cpu();
    for(;;);
  }
}
Beispiel #2
0
static void isr_handler(regs_t* r)
{
    if (r->intn < 32)   //int_no>=32 is impossible.
    {
        // Try to find a handler
        if( filter_fill_regs( r ) )
        {
            // handled
            return;
        }else{
            // not handled
            kprintf("%C[EXCEPTION]%C ", 0x0E, 0x0F);
            printf("Not handled: %s (%d)\n", except_msg[ r->intn ], r->err );
            dump_cpu( r );
            PANIC(1, "System halted.");
        }
    }
}
Beispiel #3
0
/**
 * dump - dump info
 **/
void dump(struct s_hardware *hardware)
{
    if (hardware->is_pxe_valid==false) {
	    printf("PXE stack was not detected, Dump feature is not available\n");
	    return;
    }

    const union syslinux_derivative_info *sdi = syslinux_derivative_info();
    int err=0;
    ZZJSON *json = NULL;
    ZZJSON_CONFIG config = { ZZJSON_VERY_STRICT, NULL,
		(int(*)(void*)) fgetc,
		NULL,
		malloc, calloc, free, realloc,
		stderr, NULL, stdout,
		(int(*)(void *,const char*,...)) dumpprintf,
		(int(*)(int,void*)) fputc 
    };

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

    /* By now, we only support TFTP reporting */
    upload=&upload_tftp;
    upload->name="tftp";

    /* The following defines the behavior of the reporting */
    char *arg[64];
    char filename[512]={0};
    compute_filename(hardware, filename, sizeof(filename));

    /* The filename */
    arg[0] = filename;
    /* The server to upload the file */
    if (strlen(hardware->tftp_ip) != 0) {
	    arg[1] = hardware->tftp_ip;
	    arg[2] = NULL;
    } else {
	    arg[1] = NULL;
	    snprintf(hardware->tftp_ip, sizeof(hardware->tftp_ip),
			    "%u.%u.%u.%u",
			    ((uint8_t *)&sdi->pxe.ipinfo->serverip)[0],
			    ((uint8_t *)&sdi->pxe.ipinfo->serverip)[1],
			    ((uint8_t *)&sdi->pxe.ipinfo->serverip)[2],
			    ((uint8_t *)&sdi->pxe.ipinfo->serverip)[3]);

    }

    /* We initiate the cpio to send */
    cpio_init(upload,(const char **)arg);

    dump_cpu(hardware, &config, &json);
    dump_pxe(hardware, &config, &json);
    dump_syslinux(hardware, &config, &json);
    dump_vpd(hardware, &config, &json);
    dump_vesa(hardware, &config, &json);
    dump_disks(hardware, &config, &json);
    dump_dmi(hardware, &config, &json);
    dump_memory(hardware, &config, &json);
    dump_pci(hardware, &config, &json);
    dump_acpi(hardware, &config, &json);
    dump_kernel(hardware, &config, &json);
    dump_hdt(hardware, &config, &json);

    /* We close & flush the file to send */
    cpio_close(upload);

    if ((err=flush_data(upload)) != TFTP_OK) {
	/* As we manage a tftp connection, let's display the associated error message */
	more_printf("Dump failed !\n");
	more_printf("TFTP ERROR on  : %s:/%s \n",hardware->tftp_ip, filename);
	more_printf("TFTP ERROR msg : %s \n",tftp_string_error_message[-err]);
    } else {
	more_printf("Dump file sent at %s:/%s\n",hardware->tftp_ip, filename);
    }
}