Commit 2ad207d4a0522fa0ea64abe93c4334f87444e45e

Authored by pbrook
1 parent eea589cc

Thumb semihosting fixes.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3729 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 10 additions and 1 deletions
target-arm/helper.c
@@ -602,6 +602,15 @@ void do_interrupt_v7m(CPUARMState *env) @@ -602,6 +602,15 @@ void do_interrupt_v7m(CPUARMState *env)
602 armv7m_nvic_set_pending(env->v7m.nvic, ARMV7M_EXCP_MEM); 602 armv7m_nvic_set_pending(env->v7m.nvic, ARMV7M_EXCP_MEM);
603 return; 603 return;
604 case EXCP_BKPT: 604 case EXCP_BKPT:
  605 + if (semihosting_enabled) {
  606 + int nr;
  607 + nr = lduw_code(env->regs[15]) & 0xff;
  608 + if (nr == 0xab) {
  609 + env->regs[15] += 2;
  610 + env->regs[0] = do_arm_semihosting(env);
  611 + return;
  612 + }
  613 + }
605 armv7m_nvic_set_pending(env->v7m.nvic, ARMV7M_EXCP_DEBUG); 614 armv7m_nvic_set_pending(env->v7m.nvic, ARMV7M_EXCP_DEBUG);
606 return; 615 return;
607 case EXCP_IRQ: 616 case EXCP_IRQ:
@@ -687,7 +696,7 @@ void do_interrupt(CPUARMState *env) @@ -687,7 +696,7 @@ void do_interrupt(CPUARMState *env)
687 break; 696 break;
688 case EXCP_BKPT: 697 case EXCP_BKPT:
689 /* See if this is a semihosting syscall. */ 698 /* See if this is a semihosting syscall. */
690 - if (env->thumb) { 699 + if (env->thumb && semihosting_enabled) {
691 mask = lduw_code(env->regs[15]) & 0xff; 700 mask = lduw_code(env->regs[15]) & 0xff;
692 if (mask == 0xab 701 if (mask == 0xab
693 && (env->uncached_cpsr & CPSR_M) != ARM_CPU_MODE_USR) { 702 && (env->uncached_cpsr & CPSR_M) != ARM_CPU_MODE_USR) {