Commit 775b58d8cb46050f2d0375cb938c293383e970e8

Authored by bellard
1 parent eb6a0540

removed warnings - fixed arm stack copy bug


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3593 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 19 additions and 8 deletions
linux-user/signal.c
... ... @@ -670,6 +670,7 @@ setup_sigcontext(struct target_sigcontext *sc, struct target_fpstate *fpstate,
670 670 CPUX86State *env, unsigned long mask)
671 671 {
672 672 int err = 0;
  673 + uint16_t magic;
673 674  
674 675 /* already locked in setup_frame() */
675 676 err |= __put_user(env->segs[R_GS].selector, (unsigned int *)&sc->gs);
... ... @@ -694,7 +695,8 @@ setup_sigcontext(struct target_sigcontext *sc, struct target_fpstate *fpstate,
694 695  
695 696 cpu_x86_fsave(env, (void *)fpstate, 1);
696 697 fpstate->status = fpstate->sw;
697   - err |= __put_user(0xffff, &fpstate->magic);
  698 + magic = 0xffff;
  699 + err |= __put_user(magic, &fpstate->magic);
698 700 err |= __put_user(fpstate, &sc->fpstate);
699 701  
700 702 /* non-iBCS2 extensions.. */
... ... @@ -766,15 +768,18 @@ static void setup_frame(int sig, struct emulated_sigaction *ka,
766 768 if (ka->sa.sa_flags & TARGET_SA_RESTORER) {
767 769 err |= __put_user(ka->sa.sa_restorer, &frame->pretcode);
768 770 } else {
  771 + uint16_t val16;
769 772 err |= __put_user(frame->retcode, &frame->pretcode);
770 773 /* This is popl %eax ; movl $,%eax ; int $0x80 */
771   - err |= __put_user(0xb858, (short *)(frame->retcode+0));
  774 + val16 = 0xb858;
  775 + err |= __put_user(val16, (uint16_t *)(frame->retcode+0));
772 776 #if defined(TARGET_X86_64)
773 777 #warning "Fix this !"
774 778 #else
775 779 err |= __put_user(TARGET_NR_sigreturn, (int *)(frame->retcode+2));
776 780 #endif
777   - err |= __put_user(0x80cd, (short *)(frame->retcode+6));
  781 + val16 = 0x80cd;
  782 + err |= __put_user(val16, (uint16_t *)(frame->retcode+6));
778 783 }
779 784  
780 785 if (err)
... ... @@ -848,11 +853,14 @@ static void setup_rt_frame(int sig, struct emulated_sigaction *ka,
848 853 if (ka->sa.sa_flags & TARGET_SA_RESTORER) {
849 854 err |= __put_user(ka->sa.sa_restorer, &frame->pretcode);
850 855 } else {
  856 + uint16_t val16;
  857 +
851 858 err |= __put_user(frame->retcode, &frame->pretcode);
852 859 /* This is movl $,%eax ; int $0x80 */
853   - err |= __put_user(0xb8, (char *)(frame->retcode+0));
  860 + err |= __put_user(0xb8, (char *)(frame->retcode+0));
854 861 err |= __put_user(TARGET_NR_rt_sigreturn, (int *)(frame->retcode+1));
855   - err |= __put_user(0x80cd, (short *)(frame->retcode+5));
  862 + val16 = 0x80cd;
  863 + err |= __put_user(val16, (uint16_t *)(frame->retcode+5));
856 864 }
857 865  
858 866 if (err)
... ... @@ -1234,7 +1242,7 @@ static void setup_rt_frame(int usig, struct emulated_sigaction *ka,
1234 1242 __put_user(target_sigaltstack_used.ss_sp, &stack.ss_sp);
1235 1243 __put_user(target_sigaltstack_used.ss_size, &stack.ss_size);
1236 1244 __put_user(sas_ss_flags(get_sp_from_cpustate(env)), &stack.ss_flags);
1237   - err |= copy_to_user(&frame->uc.tuc_stack, &stack, sizeof(stack));
  1245 + memcpy(&frame->uc.tuc_stack, &stack, sizeof(stack));
1238 1246  
1239 1247 err |= setup_sigcontext(&frame->uc.tuc_mcontext, /*&frame->fpstate,*/
1240 1248 env, set->sig[0]);
... ... @@ -1585,13 +1593,16 @@ static void setup_frame(int sig, struct emulated_sigaction *ka,
1585 1593 if (ka->sa.sa_restorer)
1586 1594 env->regwptr[UREG_I7] = (unsigned long)ka->sa.sa_restorer;
1587 1595 else {
  1596 + uint32_t val32;
1588 1597 env->regwptr[UREG_I7] = h2g(&(sf->insns[0]) - 2);
1589 1598  
1590 1599 /* mov __NR_sigreturn, %g1 */
1591   - err |= __put_user(0x821020d8, &sf->insns[0]);
  1600 + val32 = 0x821020d8;
  1601 + err |= __put_user(val32, &sf->insns[0]);
1592 1602  
1593 1603 /* t 0x10 */
1594   - err |= __put_user(0x91d02010, &sf->insns[1]);
  1604 + val32 = 0x91d02010;
  1605 + err |= __put_user(val32, &sf->insns[1]);
1595 1606 if (err)
1596 1607 goto sigsegv;
1597 1608  
... ...