4 * Generic CPU utility functions
6 * Copyright (c) 2009 Nathan Keynes.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
21 void cpu_print_registers( FILE *f, cpu_desc_t cpu )
26 fprintf( f, "%s registers:\n", cpu->name );
27 for( i=0; cpu->regs_info[i].name != NULL; i++ ) {
28 void *value = cpu->get_register(i);
31 switch( cpu->regs_info[i].type ) {
33 fprintf( f, "%5s: %08x ", cpu->regs_info[i].name, *(uint32_t *)value );
36 fprintf( f, "%5s: %.8f ", cpu->regs_info[i].name, (double)*(float *)value );
39 fprintf( f, "%5s: %.8f ", cpu->regs_info[i].name, *(double *)value );
.