Skip to contentSkip to conversation

Add option to disable TB cache

PATCH New Hervé Poussineau 1 participant 1 message Jan 8, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add option to disable TB cache

Hi,

This patch adds the "-translation no-cache" option to disable the use of Translation Blocks Cache.
The emulated system runs much slower, but it is easier to debug it. The -translation value can be extended to handle more settings.

It also adds help for "-startdate" flag and displays right log file name.

Hervé

Index: cpu-all.h
===================================================================
RCS file: /sources/qemu/qemu/cpu-all.h,v
retrieving revision 1.81

cpu-all.h +14 -0
diff -u -r1.81 cpu-all.h
@@ -787,6 +787,20 @@
 void cpu_set_log_filename(const char *filename);
 int cpu_str_to_log_mask(const char *str);
 
+#define CPU_SETTING_NO_CACHE (1 << 0)
+
+/* define translation settings */
+typedef struct CPUTranslationSetting {
+    int mask;
+    const char *name;
+    const char *help;
+} CPUTranslationSetting;
+
+extern CPUTranslationSetting cpu_translation_settings[];
+
+void cpu_set_translation_settings(int translation_flags);
+int cpu_str_to_translation_mask(const char *str);
+
 /* IO ports API */
 
 /* NOTE: as these functions may be even used when there is an isa

Index: cpu-exec.c
===================================================================
RCS file: /sources/qemu/qemu/cpu-exec.c,v
retrieving revision 1.130

cpu-exec.c +61 -1

92 lines not on this page · raw message

Index: vl.c
===================================================================
RCS file: /sources/qemu/qemu/vl.c,v
retrieving revision 1.394

vl.c +24 -1
diff -u -r1.394 vl.c
@@ -237,6 +237,8 @@
 static CPUState *next_cpu;
 static int event_pending = 1;
 
+extern char *logfilename;
+
 #define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR)
 
 /***********************************************************/
@@ -7617,6 +7617,9 @@
 #endif
            "-clock          force the use of the given methods for timer alarm.\n"
            "                To see what timers are available use -clock help\n"
+           "-startdate      select initial date of the Qemu clock\n"
+           "-translation setting1,... configures code translation\n"
+           "                (use -translation ? for a list of settings)\n"
            "\n"
            "During emulation, the following keys are useful:\n"
            "ctrl-alt-f      toggle full screen\n"
@@ -7632,7 +7635,7 @@
            DEFAULT_NETWORK_DOWN_SCRIPT,
 #endif
            DEFAULT_GDBSTUB_PORT,
-           "/tmp/qemu.log");
+           logfilename);
     exit(exitcode);
 }
 
@@ -7719,6 +7722,7 @@
     QEMU_OPTION_old_param,
     QEMU_OPTION_clock,
     QEMU_OPTION_startdate,
+    QEMU_OPTION_translation,
 };
 
 typedef struct QEMUOption {
@@ -7827,6 +7831,7 @@
 #endif
     { "clock", HAS_ARG, QEMU_OPTION_clock },
     { "startdate", HAS_ARG, QEMU_OPTION_startdate },
+    { "translation", HAS_ARG, QEMU_OPTION_translation },
     { NULL },
 };
 
@@ -8661,6 +8666,22 @@
                     }
                 }
                 break;
+            case QEMU_OPTION_translation:
+                {
+                    int mask;
+                    CPUTranslationSetting *setting;
+
+                    mask = cpu_str_to_translation_mask(optarg);
+                    if (!mask) {
+                        printf("Translation settings (comma separated):\n");
+                        for(setting = cpu_translation_settings; setting->mask != 0; setting++) {
+                            printf("%-10s %s\n", setting->name, setting->help);
+                    }
+                    exit(1);
+                    }
+                    cpu_set_translation_settings(mask);
+                }
+                break;
             }
         }
     }