]> git.proxmox.com Git - qemu.git/commitdiff
ARM cache flush support (untested) - '-d' option fix
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
Sun, 25 Apr 2004 18:00:45 +0000 (18:00 +0000)
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
Sun, 25 Apr 2004 18:00:45 +0000 (18:00 +0000)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@748 c046a42c-6fe2-441c-8c8c-71466251a162

linux-user/arm/syscall.h
linux-user/main.c

index 34153c998d8e26ec6e18452ada54d739a8adab9b..0ced33ee5be4494c0af3e05f47bf620318eb662b 100644 (file)
@@ -26,3 +26,5 @@ struct target_pt_regs {
 #define ARM_ORIG_r0    uregs[17]
 
 #define ARM_SYSCALL_BASE       0x900000
+
+#define ARM_NR_cacheflush (ARM_SYSCALL_BASE + 0xf0000 + 2)
index 60182923046ee6e37ab2bb6fb59a51cbc2eb68cb..2af888fddcf3729915e925138bac6f953cc48cca 100644 (file)
@@ -246,6 +246,27 @@ void cpu_loop(CPUX86State *env)
 
 #ifdef TARGET_ARM
 
+/* XXX: find a better solution */
+extern void tb_invalidate_page_range(target_ulong start, target_ulong end);
+
+static void arm_cache_flush(target_ulong start, target_ulong last)
+{
+    target_ulong addr, last1;
+
+    if (last < start)
+        return;
+    addr = start;
+    for(;;) {
+        last1 = ((addr + TARGET_PAGE_SIZE) & TARGET_PAGE_MASK) - 1;
+        if (last1 > last)
+            last1 = last;
+        tb_invalidate_page_range(addr, last1 + 1);
+        if (last1 == last)
+            break;
+        addr = last1 + 1;
+    }
+}
+
 void cpu_loop(CPUARMState *env)
 {
     int trapnr;
@@ -281,7 +302,9 @@ void cpu_loop(CPUARMState *env)
                 /* system call */
                 insn = ldl((void *)(env->regs[15] - 4));
                 n = insn & 0xffffff;
-                if (n >= ARM_SYSCALL_BASE) {
+                if (n == ARM_NR_cacheflush) {
+                    arm_cache_flush(env->regs[0], env->regs[1]);
+                } else if (n >= ARM_SYSCALL_BASE) {
                     /* linux syscall */
                     n -= ARM_SYSCALL_BASE;
                     env->regs[0] = do_syscall(env, 
@@ -792,7 +815,7 @@ void cpu_loop(CPUPPCState *env)
 void usage(void)
 {
     printf("qemu-" TARGET_ARCH " version " QEMU_VERSION ", Copyright (c) 2003 Fabrice Bellard\n"
-           "usage: qemu-" TARGET_ARCH " [-h] [-d] [-L path] [-s size] program [arguments...]\n"
+           "usage: qemu-" TARGET_ARCH " [-h] [-d opts] [-L path] [-s size] program [arguments...]\n"
            "Linux CPU emulator (compiled for %s emulation)\n"
            "\n"
            "-h           print this help\n"
@@ -803,7 +826,7 @@ void usage(void)
 #ifdef USE_CODE_COPY
            "-no-code-copy   disable code copy acceleration\n"
 #endif
-           "-d           activate log (logfile=%s)\n"
+           "-d options   activate log (logfile=%s)\n"
            "-p pagesize  set the host page size to 'pagesize'\n",
            TARGET_ARCH,
            interp_prefix, 
@@ -850,8 +873,12 @@ int main(int argc, char **argv)
         } else if (!strcmp(r, "d")) {
             int mask;
             CPULogItem *item;
+
+           if (optind >= argc)
+               break;
             
-            mask = cpu_str_to_log_mask(optarg);
+           r = argv[optind++];
+            mask = cpu_str_to_log_mask(r);
             if (!mask) {
                 printf("Log items (comma separated):\n");
                 for(item = cpu_log_items; item->mask != 0; item++) {