Commit 6f1f31c069b20611f8df768bd4cc484a49624d62
1 parent
5467a722
ARM cache flush support (untested) - '-d' option fix
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@748 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
33 additions
and
4 deletions
linux-user/arm/syscall.h
linux-user/main.c
... | ... | @@ -246,6 +246,27 @@ void cpu_loop(CPUX86State *env) |
246 | 246 | |
247 | 247 | #ifdef TARGET_ARM |
248 | 248 | |
249 | +/* XXX: find a better solution */ | |
250 | +extern void tb_invalidate_page_range(target_ulong start, target_ulong end); | |
251 | + | |
252 | +static void arm_cache_flush(target_ulong start, target_ulong last) | |
253 | +{ | |
254 | + target_ulong addr, last1; | |
255 | + | |
256 | + if (last < start) | |
257 | + return; | |
258 | + addr = start; | |
259 | + for(;;) { | |
260 | + last1 = ((addr + TARGET_PAGE_SIZE) & TARGET_PAGE_MASK) - 1; | |
261 | + if (last1 > last) | |
262 | + last1 = last; | |
263 | + tb_invalidate_page_range(addr, last1 + 1); | |
264 | + if (last1 == last) | |
265 | + break; | |
266 | + addr = last1 + 1; | |
267 | + } | |
268 | +} | |
269 | + | |
249 | 270 | void cpu_loop(CPUARMState *env) |
250 | 271 | { |
251 | 272 | int trapnr; |
... | ... | @@ -281,7 +302,9 @@ void cpu_loop(CPUARMState *env) |
281 | 302 | /* system call */ |
282 | 303 | insn = ldl((void *)(env->regs[15] - 4)); |
283 | 304 | n = insn & 0xffffff; |
284 | - if (n >= ARM_SYSCALL_BASE) { | |
305 | + if (n == ARM_NR_cacheflush) { | |
306 | + arm_cache_flush(env->regs[0], env->regs[1]); | |
307 | + } else if (n >= ARM_SYSCALL_BASE) { | |
285 | 308 | /* linux syscall */ |
286 | 309 | n -= ARM_SYSCALL_BASE; |
287 | 310 | env->regs[0] = do_syscall(env, |
... | ... | @@ -792,7 +815,7 @@ void cpu_loop(CPUPPCState *env) |
792 | 815 | void usage(void) |
793 | 816 | { |
794 | 817 | printf("qemu-" TARGET_ARCH " version " QEMU_VERSION ", Copyright (c) 2003 Fabrice Bellard\n" |
795 | - "usage: qemu-" TARGET_ARCH " [-h] [-d] [-L path] [-s size] program [arguments...]\n" | |
818 | + "usage: qemu-" TARGET_ARCH " [-h] [-d opts] [-L path] [-s size] program [arguments...]\n" | |
796 | 819 | "Linux CPU emulator (compiled for %s emulation)\n" |
797 | 820 | "\n" |
798 | 821 | "-h print this help\n" |
... | ... | @@ -803,7 +826,7 @@ void usage(void) |
803 | 826 | #ifdef USE_CODE_COPY |
804 | 827 | "-no-code-copy disable code copy acceleration\n" |
805 | 828 | #endif |
806 | - "-d activate log (logfile=%s)\n" | |
829 | + "-d options activate log (logfile=%s)\n" | |
807 | 830 | "-p pagesize set the host page size to 'pagesize'\n", |
808 | 831 | TARGET_ARCH, |
809 | 832 | interp_prefix, |
... | ... | @@ -850,8 +873,12 @@ int main(int argc, char **argv) |
850 | 873 | } else if (!strcmp(r, "d")) { |
851 | 874 | int mask; |
852 | 875 | CPULogItem *item; |
876 | + | |
877 | + if (optind >= argc) | |
878 | + break; | |
853 | 879 | |
854 | - mask = cpu_str_to_log_mask(optarg); | |
880 | + r = argv[optind++]; | |
881 | + mask = cpu_str_to_log_mask(r); | |
855 | 882 | if (!mask) { |
856 | 883 | printf("Log items (comma separated):\n"); |
857 | 884 | for(item = cpu_log_items; item->mask != 0; item++) { | ... | ... |