filename | src/cpu.c |
changeset | 1093:34faf227070e |
prev | 1091:186558374345 |
author | nkeynes |
date | Tue Jul 13 18:23:16 2010 +1000 (13 years ago) |
permissions | -rw-r--r-- |
last change | Rearrange the main translation loop to allow translated blocks to jump directly to their successors without needing to return to the main loop in between. Shaves about 6% off the core runtime. |
view | annotate | diff | log | raw |
1 /**
2 * $Id$
3 *
4 * Generic CPU utility functions
5 *
6 * Copyright (c) 2009 Nathan Keynes.
7 *
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.
12 *
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.
17 */
19 #include "cpu.h"
21 void cpu_print_registers( FILE *f, cpu_desc_t cpu )
22 {
23 int i;
24 int column = 0;
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);
29 if( value != NULL ) {
30 column++;
31 switch( cpu->regs_info[i].type ) {
32 case REG_TYPE_INT:
33 fprintf( f, "%5s: %08x ", cpu->regs_info[i].name, *(uint32_t *)value );
34 break;
35 case REG_TYPE_FLOAT:
36 fprintf( f, "%5s: %.8f ", cpu->regs_info[i].name, (double)*(float *)value );
37 break;
38 case REG_TYPE_DOUBLE:
39 fprintf( f, "%5s: %.8f ", cpu->regs_info[i].name, *(double *)value );
40 break;
41 case REG_TYPE_NONE:
42 column = 4;
43 }
44 }
45 if( column == 4 ) {
46 fprintf( f, "\n" );
47 column = 0;
48 }
49 }
50 if( column != 0 ) {
51 fprintf( f, "\n" );
52 }
53 }
.