/[qemu]/qemu/target-i386/op.c
ViewVC logotype

Diff of /qemu/target-i386/op.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.23 by bellard, Sun Nov 14 15:39:16 2004 UTC revision 1.24 by bellard, Mon Jan 3 23:50:08 2005 UTC
# Line 22  Line 22 
22  #include "exec.h"  #include "exec.h"
23    
24  /* n must be a constant to be efficient */  /* n must be a constant to be efficient */
25  static inline int lshift(int x, int n)  static inline target_long lshift(target_long x, int n)
26  {  {
27      if (n >= 0)      if (n >= 0)
28          return x << n;          return x << n;
# Line 80  static inline int lshift(int x, int n) Line 80  static inline int lshift(int x, int n)
80  #undef REG  #undef REG
81  #undef REGNAME  #undef REGNAME
82    
83    #ifdef TARGET_X86_64
84    
85    #define REG (env->regs[8])
86    #define REGNAME _R8
87    #include "opreg_template.h"
88    #undef REG
89    #undef REGNAME
90    
91    #define REG (env->regs[9])
92    #define REGNAME _R9
93    #include "opreg_template.h"
94    #undef REG
95    #undef REGNAME
96    
97    #define REG (env->regs[10])
98    #define REGNAME _R10
99    #include "opreg_template.h"
100    #undef REG
101    #undef REGNAME
102    
103    #define REG (env->regs[11])
104    #define REGNAME _R11
105    #include "opreg_template.h"
106    #undef REG
107    #undef REGNAME
108    
109    #define REG (env->regs[12])
110    #define REGNAME _R12
111    #include "opreg_template.h"
112    #undef REG
113    #undef REGNAME
114    
115    #define REG (env->regs[13])
116    #define REGNAME _R13
117    #include "opreg_template.h"
118    #undef REG
119    #undef REGNAME
120    
121    #define REG (env->regs[14])
122    #define REGNAME _R14
123    #include "opreg_template.h"
124    #undef REG
125    #undef REGNAME
126    
127    #define REG (env->regs[15])
128    #define REGNAME _R15
129    #include "opreg_template.h"
130    #undef REG
131    #undef REGNAME
132    
133    #endif
134    
135  /* operations with flags */  /* operations with flags */
136    
137  /* update flags with T0 and T1 (add/sub case) */  /* update flags with T0 and T1 (add/sub case) */
# Line 170  void OPPROTO op_bswapl_T0(void) Line 222  void OPPROTO op_bswapl_T0(void)
222      T0 = bswap32(T0);      T0 = bswap32(T0);
223  }  }
224    
225    #ifdef TARGET_X86_64
226    void OPPROTO op_bswapq_T0(void)
227    {
228        T0 = bswap64(T0);
229    }
230    #endif
231    
232  /* multiply/divide */  /* multiply/divide */
233    
234  /* XXX: add eflags optimizations */  /* XXX: add eflags optimizations */
# Line 179  void OPPROTO op_mulb_AL_T0(void) Line 238  void OPPROTO op_mulb_AL_T0(void)
238  {  {
239      unsigned int res;      unsigned int res;
240      res = (uint8_t)EAX * (uint8_t)T0;      res = (uint8_t)EAX * (uint8_t)T0;
241      EAX = (EAX & 0xffff0000) | res;      EAX = (EAX & ~0xffff) | res;
242      CC_DST = res;      CC_DST = res;
243      CC_SRC = (res & 0xff00);      CC_SRC = (res & 0xff00);
244  }  }
# Line 188  void OPPROTO op_imulb_AL_T0(void) Line 247  void OPPROTO op_imulb_AL_T0(void)
247  {  {
248      int res;      int res;
249      res = (int8_t)EAX * (int8_t)T0;      res = (int8_t)EAX * (int8_t)T0;
250      EAX = (EAX & 0xffff0000) | (res & 0xffff);      EAX = (EAX & ~0xffff) | (res & 0xffff);
251      CC_DST = res;      CC_DST = res;
252      CC_SRC = (res != (int8_t)res);      CC_SRC = (res != (int8_t)res);
253  }  }
# Line 197  void OPPROTO op_mulw_AX_T0(void) Line 256  void OPPROTO op_mulw_AX_T0(void)
256  {  {
257      unsigned int res;      unsigned int res;
258      res = (uint16_t)EAX * (uint16_t)T0;      res = (uint16_t)EAX * (uint16_t)T0;
259      EAX = (EAX & 0xffff0000) | (res & 0xffff);      EAX = (EAX & ~0xffff) | (res & 0xffff);
260      EDX = (EDX & 0xffff0000) | ((res >> 16) & 0xffff);      EDX = (EDX & ~0xffff) | ((res >> 16) & 0xffff);
261      CC_DST = res;      CC_DST = res;
262      CC_SRC = res >> 16;      CC_SRC = res >> 16;
263  }  }
# Line 207  void OPPROTO op_imulw_AX_T0(void) Line 266  void OPPROTO op_imulw_AX_T0(void)
266  {  {
267      int res;      int res;
268      res = (int16_t)EAX * (int16_t)T0;      res = (int16_t)EAX * (int16_t)T0;
269      EAX = (EAX & 0xffff0000) | (res & 0xffff);      EAX = (EAX & ~0xffff) | (res & 0xffff);
270      EDX = (EDX & 0xffff0000) | ((res >> 16) & 0xffff);      EDX = (EDX & ~0xffff) | ((res >> 16) & 0xffff);
271      CC_DST = res;      CC_DST = res;
272      CC_SRC = (res != (int16_t)res);      CC_SRC = (res != (int16_t)res);
273  }  }
# Line 217  void OPPROTO op_mull_EAX_T0(void) Line 276  void OPPROTO op_mull_EAX_T0(void)
276  {  {
277      uint64_t res;      uint64_t res;
278      res = (uint64_t)((uint32_t)EAX) * (uint64_t)((uint32_t)T0);      res = (uint64_t)((uint32_t)EAX) * (uint64_t)((uint32_t)T0);
279      EAX = res;      EAX = (uint32_t)res;
280      EDX = res >> 32;      EDX = (uint32_t)(res >> 32);
281      CC_DST = res;      CC_DST = (uint32_t)res;
282      CC_SRC = res >> 32;      CC_SRC = (uint32_t)(res >> 32);
283  }  }
284    
285  void OPPROTO op_imull_EAX_T0(void)  void OPPROTO op_imull_EAX_T0(void)
# Line 251  void OPPROTO op_imull_T0_T1(void) Line 310  void OPPROTO op_imull_T0_T1(void)
310      CC_SRC = (res != (int32_t)res);      CC_SRC = (res != (int32_t)res);
311  }  }
312    
313    #ifdef TARGET_X86_64
314    void OPPROTO op_mulq_EAX_T0(void)
315    {
316        helper_mulq_EAX_T0();
317    }
318    
319    void OPPROTO op_imulq_EAX_T0(void)
320    {
321        helper_imulq_EAX_T0();
322    }
323    
324    void OPPROTO op_imulq_T0_T1(void)
325    {
326        helper_imulq_T0_T1();
327    }
328    #endif
329    
330  /* division, flags are undefined */  /* division, flags are undefined */
331  /* XXX: add exceptions for overflow */  /* XXX: add exceptions for overflow */
332    
# Line 261  void OPPROTO op_divb_AL_T0(void) Line 337  void OPPROTO op_divb_AL_T0(void)
337      num = (EAX & 0xffff);      num = (EAX & 0xffff);
338      den = (T0 & 0xff);      den = (T0 & 0xff);
339      if (den == 0) {      if (den == 0) {
         EIP = PARAM1;  
340          raise_exception(EXCP00_DIVZ);          raise_exception(EXCP00_DIVZ);
341      }      }
342      q = (num / den) & 0xff;      q = (num / den) & 0xff;
343      r = (num % den) & 0xff;      r = (num % den) & 0xff;
344      EAX = (EAX & 0xffff0000) | (r << 8) | q;      EAX = (EAX & ~0xffff) | (r << 8) | q;
345  }  }
346    
347  void OPPROTO op_idivb_AL_T0(void)  void OPPROTO op_idivb_AL_T0(void)
# Line 276  void OPPROTO op_idivb_AL_T0(void) Line 351  void OPPROTO op_idivb_AL_T0(void)
351      num = (int16_t)EAX;      num = (int16_t)EAX;
352      den = (int8_t)T0;      den = (int8_t)T0;
353      if (den == 0) {      if (den == 0) {
         EIP = PARAM1;  
354          raise_exception(EXCP00_DIVZ);          raise_exception(EXCP00_DIVZ);
355      }      }
356      q = (num / den) & 0xff;      q = (num / den) & 0xff;
357      r = (num % den) & 0xff;      r = (num % den) & 0xff;
358      EAX = (EAX & 0xffff0000) | (r << 8) | q;      EAX = (EAX & ~0xffff) | (r << 8) | q;
359  }  }
360    
361  void OPPROTO op_divw_AX_T0(void)  void OPPROTO op_divw_AX_T0(void)
# Line 291  void OPPROTO op_divw_AX_T0(void) Line 365  void OPPROTO op_divw_AX_T0(void)
365      num = (EAX & 0xffff) | ((EDX & 0xffff) << 16);      num = (EAX & 0xffff) | ((EDX & 0xffff) << 16);
366      den = (T0 & 0xffff);      den = (T0 & 0xffff);
367      if (den == 0) {      if (den == 0) {
         EIP = PARAM1;  
368          raise_exception(EXCP00_DIVZ);          raise_exception(EXCP00_DIVZ);
369      }      }
370      q = (num / den) & 0xffff;      q = (num / den) & 0xffff;
371      r = (num % den) & 0xffff;      r = (num % den) & 0xffff;
372      EAX = (EAX & 0xffff0000) | q;      EAX = (EAX & ~0xffff) | q;
373      EDX = (EDX & 0xffff0000) | r;      EDX = (EDX & ~0xffff) | r;
374  }  }
375    
376  void OPPROTO op_idivw_AX_T0(void)  void OPPROTO op_idivw_AX_T0(void)
# Line 307  void OPPROTO op_idivw_AX_T0(void) Line 380  void OPPROTO op_idivw_AX_T0(void)
380      num = (EAX & 0xffff) | ((EDX & 0xffff) << 16);      num = (EAX & 0xffff) | ((EDX & 0xffff) << 16);
381      den = (int16_t)T0;      den = (int16_t)T0;
382      if (den == 0) {      if (den == 0) {
         EIP = PARAM1;  
383          raise_exception(EXCP00_DIVZ);          raise_exception(EXCP00_DIVZ);
384      }      }
385      q = (num / den) & 0xffff;      q = (num / den) & 0xffff;
386      r = (num % den) & 0xffff;      r = (num % den) & 0xffff;
387      EAX = (EAX & 0xffff0000) | q;      EAX = (EAX & ~0xffff) | q;
388      EDX = (EDX & 0xffff0000) | r;      EDX = (EDX & ~0xffff) | r;
389  }  }
390    
391  void OPPROTO op_divl_EAX_T0(void)  void OPPROTO op_divl_EAX_T0(void)
392  {  {
393      helper_divl_EAX_T0(PARAM1);      helper_divl_EAX_T0();
394  }  }
395    
396  void OPPROTO op_idivl_EAX_T0(void)  void OPPROTO op_idivl_EAX_T0(void)
397  {  {
398      helper_idivl_EAX_T0(PARAM1);      helper_idivl_EAX_T0();
399  }  }
400    
401    #ifdef TARGET_X86_64
402    void OPPROTO op_divq_EAX_T0(void)
403    {
404        helper_divq_EAX_T0();
405    }
406    
407    void OPPROTO op_idivq_EAX_T0(void)
408    {
409        helper_idivq_EAX_T0();
410    }
411    #endif
412    
413  /* constant load & misc op */  /* constant load & misc op */
414    
415    /* XXX: consistent names */
416    void OPPROTO op_movl_T0_imu(void)
417    {
418        T0 = (uint32_t)PARAM1;
419    }
420    
421  void OPPROTO op_movl_T0_im(void)  void OPPROTO op_movl_T0_im(void)
422  {  {
423      T0 = PARAM1;      T0 = (int32_t)PARAM1;
424  }  }
425    
426  void OPPROTO op_addl_T0_im(void)  void OPPROTO op_addl_T0_im(void)
# Line 353  void OPPROTO op_movl_T0_T1(void) Line 443  void OPPROTO op_movl_T0_T1(void)
443      T0 = T1;      T0 = T1;
444  }  }
445    
446    void OPPROTO op_movl_T1_imu(void)
447    {
448        T1 = (uint32_t)PARAM1;
449    }
450    
451  void OPPROTO op_movl_T1_im(void)  void OPPROTO op_movl_T1_im(void)
452  {  {
453      T1 = PARAM1;      T1 = (int32_t)PARAM1;
454  }  }
455    
456  void OPPROTO op_addl_T1_im(void)  void OPPROTO op_addl_T1_im(void)
# Line 370  void OPPROTO op_movl_T1_A0(void) Line 465  void OPPROTO op_movl_T1_A0(void)
465    
466  void OPPROTO op_movl_A0_im(void)  void OPPROTO op_movl_A0_im(void)
467  {  {
468      A0 = PARAM1;      A0 = (uint32_t)PARAM1;
469  }  }
470    
471  void OPPROTO op_addl_A0_im(void)  void OPPROTO op_addl_A0_im(void)
472  {  {
473      A0 += PARAM1;      A0 = (uint32_t)(A0 + PARAM1);
474    }
475    
476    void OPPROTO op_movl_A0_seg(void)
477    {
478        A0 = (uint32_t)*(target_ulong *)((char *)env + PARAM1);
479    }
480    
481    void OPPROTO op_addl_A0_seg(void)
482    {
483        A0 = (uint32_t)(A0 + *(target_ulong *)((char *)env + PARAM1));
484  }  }
485    
486  void OPPROTO op_addl_A0_AL(void)  void OPPROTO op_addl_A0_AL(void)
487  {  {
488      A0 += (EAX & 0xff);      A0 = (uint32_t)(A0 + (EAX & 0xff));
489    }
490    
491    #ifdef WORDS_BIGENDIAN
492    typedef union UREG64 {
493        struct { uint16_t v3, v2, v1, v0; } w;
494        struct { uint32_t v1, v0; } l;
495        uint64_t q;
496    } UREG64;
497    #else
498    typedef union UREG64 {
499        struct { uint16_t v0, v1, v2, v3; } w;
500        struct { uint32_t v0, v1; } l;
501        uint64_t q;
502    } UREG64;
503    #endif
504    
505    #ifdef TARGET_X86_64
506    
507    #define PARAMQ1 \
508    ({\
509        UREG64 __p;\
510        __p.l.v1 = PARAM1;\
511        __p.l.v0 = PARAM2;\
512        __p.q;\
513    })
514    
515    void OPPROTO op_movq_T0_im64(void)
516    {
517        T0 = PARAMQ1;
518  }  }
519    
520    void OPPROTO op_movq_A0_im(void)
521    {
522        A0 = (int32_t)PARAM1;
523    }
524    
525    void OPPROTO op_movq_A0_im64(void)
526    {
527        A0 = PARAMQ1;
528    }
529    
530    void OPPROTO op_addq_A0_im(void)
531    {
532        A0 = (A0 + (int32_t)PARAM1);
533    }
534    
535    void OPPROTO op_addq_A0_im64(void)
536    {
537        A0 = (A0 + PARAMQ1);
538    }
539    
540    void OPPROTO op_movq_A0_seg(void)
541    {
542        A0 = *(target_ulong *)((char *)env + PARAM1);
543    }
544    
545    void OPPROTO op_addq_A0_seg(void)
546    {
547        A0 += *(target_ulong *)((char *)env + PARAM1);
548    }
549    
550    void OPPROTO op_addq_A0_AL(void)
551    {
552        A0 = (A0 + (EAX & 0xff));
553    }
554    
555    #endif
556    
557  void OPPROTO op_andl_A0_ffff(void)  void OPPROTO op_andl_A0_ffff(void)
558  {  {
559      A0 = A0 & 0xffff;      A0 = A0 & 0xffff;
# Line 401  void OPPROTO op_andl_A0_ffff(void) Line 572  void OPPROTO op_andl_A0_ffff(void)
572  #include "ops_mem.h"  #include "ops_mem.h"
573  #endif  #endif
574    
575  /* used for bit operations */  /* indirect jump */
576    
577  void OPPROTO op_add_bitw_A0_T1(void)  void OPPROTO op_jmp_T0(void)
578  {  {
579      A0 += ((int16_t)T1 >> 4) << 1;      EIP = T0;
580  }  }
581    
582  void OPPROTO op_add_bitl_A0_T1(void)  void OPPROTO op_movl_eip_im(void)
583  {  {
584      A0 += ((int32_t)T1 >> 5) << 2;      EIP = (uint32_t)PARAM1;
585  }  }
586    
587  /* indirect jump */  #ifdef TARGET_X86_64
588    void OPPROTO op_movq_eip_im(void)
 void OPPROTO op_jmp_T0(void)  
589  {  {
590      EIP = T0;      EIP = (int32_t)PARAM1;
591  }  }
592    
593  void OPPROTO op_jmp_im(void)  void OPPROTO op_movq_eip_im64(void)
594  {  {
595      EIP = PARAM1;      EIP = PARAMQ1;
596  }  }
597    #endif
598    
599  void OPPROTO op_hlt(void)  void OPPROTO op_hlt(void)
600  {  {
# Line 505  void OPPROTO op_sti_vm(void) Line 676  void OPPROTO op_sti_vm(void)
676  void OPPROTO op_boundw(void)  void OPPROTO op_boundw(void)
677  {  {
678      int low, high, v;      int low, high, v;
679      low = ldsw((uint8_t *)A0);      low = ldsw(A0);
680      high = ldsw((uint8_t *)A0 + 2);      high = ldsw(A0 + 2);
681      v = (int16_t)T0;      v = (int16_t)T0;
682      if (v < low || v > high) {      if (v < low || v > high) {
         EIP = PARAM1;  
683          raise_exception(EXCP05_BOUND);          raise_exception(EXCP05_BOUND);
684      }      }
685      FORCE_RET();      FORCE_RET();
# Line 518  void OPPROTO op_boundw(void) Line 688  void OPPROTO op_boundw(void)
688  void OPPROTO op_boundl(void)  void OPPROTO op_boundl(void)
689  {  {
690      int low, high, v;      int low, high, v;
691      low = ldl((uint8_t *)A0);      low = ldl(A0);
692      high = ldl((uint8_t *)A0 + 4);      high = ldl(A0 + 4);
693      v = T0;      v = T0;
694      if (v < low || v > high) {      if (v < low || v > high) {
         EIP = PARAM1;  
695          raise_exception(EXCP05_BOUND);          raise_exception(EXCP05_BOUND);
696      }      }
697      FORCE_RET();      FORCE_RET();
# Line 533  void OPPROTO op_cmpxchg8b(void) Line 702  void OPPROTO op_cmpxchg8b(void)
702      helper_cmpxchg8b();      helper_cmpxchg8b();
703  }  }
704    
 void OPPROTO op_jmp(void)  
 {  
     JUMP_TB(op_jmp, PARAM1, 0, PARAM2);  
 }  
   
705  void OPPROTO op_movl_T0_0(void)  void OPPROTO op_movl_T0_0(void)
706  {  {
707      T0 = 0;      T0 = 0;
# Line 564  void OPPROTO op_exit_tb(void) Line 728  void OPPROTO op_exit_tb(void)
728  #include "ops_template.h"  #include "ops_template.h"
729  #undef SHIFT  #undef SHIFT
730    
731    #ifdef TARGET_X86_64
732    
733    #define SHIFT 3
734    #include "ops_template.h"
735    #undef SHIFT
736    
737    #endif
738    
739  /* sign extend */  /* sign extend */
740    
741  void OPPROTO op_movsbl_T0_T0(void)  void OPPROTO op_movsbl_T0_T0(void)
# Line 581  void OPPROTO op_movswl_T0_T0(void) Line 753  void OPPROTO op_movswl_T0_T0(void)
753      T0 = (int16_t)T0;      T0 = (int16_t)T0;
754  }  }
755    
756    void OPPROTO op_movslq_T0_T0(void)
757    {
758        T0 = (int32_t)T0;
759    }
760    
761  void OPPROTO op_movzwl_T0_T0(void)  void OPPROTO op_movzwl_T0_T0(void)
762  {  {
763      T0 = (uint16_t)T0;      T0 = (uint16_t)T0;
# Line 591  void OPPROTO op_movswl_EAX_AX(void) Line 768  void OPPROTO op_movswl_EAX_AX(void)
768      EAX = (int16_t)EAX;      EAX = (int16_t)EAX;
769  }  }
770    
771    #ifdef TARGET_X86_64
772    void OPPROTO op_movslq_RAX_EAX(void)
773    {
774        EAX = (int32_t)EAX;
775    }
776    #endif
777    
778  void OPPROTO op_movsbw_AX_AL(void)  void OPPROTO op_movsbw_AX_AL(void)
779  {  {
780      EAX = (EAX & 0xffff0000) | ((int8_t)EAX & 0xffff);      EAX = (EAX & ~0xffff) | ((int8_t)EAX & 0xffff);
781  }  }
782    
783  void OPPROTO op_movslq_EDX_EAX(void)  void OPPROTO op_movslq_EDX_EAX(void)
# Line 603  void OPPROTO op_movslq_EDX_EAX(void) Line 787  void OPPROTO op_movslq_EDX_EAX(void)
787    
788  void OPPROTO op_movswl_DX_AX(void)  void OPPROTO op_movswl_DX_AX(void)
789  {  {
790      EDX = (EDX & 0xffff0000) | (((int16_t)EAX >> 15) & 0xffff);      EDX = (EDX & ~0xffff) | (((int16_t)EAX >> 15) & 0xffff);
791    }
792    
793    #ifdef TARGET_X86_64
794    void OPPROTO op_movsqo_RDX_RAX(void)
795    {
796        EDX = (int64_t)EAX >> 63;
797  }  }
798    #endif
799    
800  /* string ops helpers */  /* string ops helpers */
801    
802  void OPPROTO op_addl_ESI_T0(void)  void OPPROTO op_addl_ESI_T0(void)
803  {  {
804      ESI += T0;      ESI = (uint32_t)(ESI + T0);
805  }  }
806    
807  void OPPROTO op_addw_ESI_T0(void)  void OPPROTO op_addw_ESI_T0(void)
# Line 620  void OPPROTO op_addw_ESI_T0(void) Line 811  void OPPROTO op_addw_ESI_T0(void)
811    
812  void OPPROTO op_addl_EDI_T0(void)  void OPPROTO op_addl_EDI_T0(void)
813  {  {
814      EDI += T0;      EDI = (uint32_t)(EDI + T0);
815  }  }
816    
817  void OPPROTO op_addw_EDI_T0(void)  void OPPROTO op_addw_EDI_T0(void)
# Line 630  void OPPROTO op_addw_EDI_T0(void) Line 821  void OPPROTO op_addw_EDI_T0(void)
821    
822  void OPPROTO op_decl_ECX(void)  void OPPROTO op_decl_ECX(void)
823  {  {
824      ECX--;      ECX = (uint32_t)(ECX - 1);
825  }  }
826    
827  void OPPROTO op_decw_ECX(void)  void OPPROTO op_decw_ECX(void)
# Line 638  void OPPROTO op_decw_ECX(void) Line 829  void OPPROTO op_decw_ECX(void)
829      ECX = (ECX & ~0xffff) | ((ECX - 1) & 0xffff);      ECX = (ECX & ~0xffff) | ((ECX - 1) & 0xffff);
830  }  }
831    
832    #ifdef TARGET_X86_64
833    void OPPROTO op_addq_ESI_T0(void)
834    {
835        ESI = (ESI + T0);
836    }
837    
838    void OPPROTO op_addq_EDI_T0(void)
839    {
840        EDI = (EDI + T0);
841    }
842    
843    void OPPROTO op_decq_ECX(void)
844    {
845        ECX--;
846    }
847    #endif
848    
849  /* push/pop utils */  /* push/pop utils */
850    
851  void op_addl_A0_SS(void)  void op_addl_A0_SS(void)
# Line 647  void op_addl_A0_SS(void) Line 855  void op_addl_A0_SS(void)
855    
856  void op_subl_A0_2(void)  void op_subl_A0_2(void)
857  {  {
858      A0 -= 2;      A0 = (uint32_t)(A0 - 2);
859  }  }
860    
861  void op_subl_A0_4(void)  void op_subl_A0_4(void)
862  {  {
863      A0 -= 4;      A0 = (uint32_t)(A0 - 4);
864  }  }
865    
866  void op_addl_ESP_4(void)  void op_addl_ESP_4(void)
867  {  {
868      ESP += 4;      ESP = (uint32_t)(ESP + 4);
869  }  }
870    
871  void op_addl_ESP_2(void)  void op_addl_ESP_2(void)
872  {  {
873      ESP += 2;      ESP = (uint32_t)(ESP + 2);
874  }  }
875    
876  void op_addw_ESP_4(void)  void op_addw_ESP_4(void)
# Line 677  void op_addw_ESP_2(void) Line 885  void op_addw_ESP_2(void)
885    
886  void op_addl_ESP_im(void)  void op_addl_ESP_im(void)
887  {  {
888      ESP += PARAM1;      ESP = (uint32_t)(ESP + PARAM1);
889  }  }
890    
891  void op_addw_ESP_im(void)  void op_addw_ESP_im(void)
# Line 685  void op_addw_ESP_im(void) Line 893  void op_addw_ESP_im(void)
893      ESP = (ESP & ~0xffff) | ((ESP + PARAM1) & 0xffff);      ESP = (ESP & ~0xffff) | ((ESP + PARAM1) & 0xffff);
894  }  }
895    
896    #ifdef TARGET_X86_64
897    void op_subq_A0_8(void)
898    {
899        A0 -= 8;
900    }
901    
902    void op_addq_ESP_8(void)
903    {
904        ESP += 8;
905    }
906    
907    void op_addq_ESP_im(void)
908    {
909        ESP += PARAM1;
910    }
911    #endif
912    
913  void OPPROTO op_rdtsc(void)  void OPPROTO op_rdtsc(void)
914  {  {
915      helper_rdtsc();      helper_rdtsc();
# Line 710  void OPPROTO op_sysexit(void) Line 935  void OPPROTO op_sysexit(void)
935      helper_sysexit();      helper_sysexit();
936  }  }
937    
938    #ifdef TARGET_X86_64
939    void OPPROTO op_syscall(void)
940    {
941        helper_syscall();
942    }
943    
944    void OPPROTO op_sysret(void)
945    {
946        helper_sysret(PARAM1);
947    }
948    #endif
949    
950  void OPPROTO op_rdmsr(void)  void OPPROTO op_rdmsr(void)
951  {  {
952      helper_rdmsr();      helper_rdmsr();
# Line 868  void OPPROTO op_movl_seg_T0_vm(void) Line 1105  void OPPROTO op_movl_seg_T0_vm(void)
1105      /* env->segs[] access */      /* env->segs[] access */
1106      sc = (SegmentCache *)((char *)env + PARAM1);      sc = (SegmentCache *)((char *)env + PARAM1);
1107      sc->selector = selector;      sc->selector = selector;
1108      sc->base = (void *)(selector << 4);      sc->base = (selector << 4);
1109  }  }
1110    
1111  void OPPROTO op_movl_T0_seg(void)  void OPPROTO op_movl_T0_seg(void)
# Line 876  void OPPROTO op_movl_T0_seg(void) Line 1113  void OPPROTO op_movl_T0_seg(void)
1113      T0 = env->segs[PARAM1].selector;      T0 = env->segs[PARAM1].selector;
1114  }  }
1115    
 void OPPROTO op_movl_A0_seg(void)  
 {  
     A0 = *(unsigned long *)((char *)env + PARAM1);  
 }  
   
 void OPPROTO op_addl_A0_seg(void)  
 {  
     A0 += *(unsigned long *)((char *)env + PARAM1);  
 }  
   
1116  void OPPROTO op_lsl(void)  void OPPROTO op_lsl(void)
1117  {  {
1118      helper_lsl();      helper_lsl();
# Line 1006  void OPPROTO op_movl_env_T1(void) Line 1233  void OPPROTO op_movl_env_T1(void)
1233      *(uint32_t *)((char *)env + PARAM1) = T1;      *(uint32_t *)((char *)env + PARAM1) = T1;
1234  }  }
1235    
1236    void OPPROTO op_movtl_T0_env(void)
1237    {
1238        T0 = *(target_ulong *)((char *)env + PARAM1);
1239    }
1240    
1241    void OPPROTO op_movtl_env_T0(void)
1242    {
1243        *(target_ulong *)((char *)env + PARAM1) = T0;
1244    }
1245    
1246    void OPPROTO op_movtl_T1_env(void)
1247    {
1248        T1 = *(target_ulong *)((char *)env + PARAM1);
1249    }
1250    
1251    void OPPROTO op_movtl_env_T1(void)
1252    {
1253        *(target_ulong *)((char *)env + PARAM1) = T1;
1254    }
1255    
1256  void OPPROTO op_clts(void)  void OPPROTO op_clts(void)
1257  {  {
1258      env->cr[0] &= ~CR0_TS_MASK;      env->cr[0] &= ~CR0_TS_MASK;
# Line 1014  void OPPROTO op_clts(void) Line 1261  void OPPROTO op_clts(void)
1261    
1262  /* flags handling */  /* flags handling */
1263    
1264  /* slow jumps cases : in order to avoid calling a function with a  void OPPROTO op_goto_tb0(void)
    pointer (which can generate a stack frame on PowerPC), we use  
    op_setcc to set T0 and then call op_jcc. */  
 void OPPROTO op_jcc(void)  
1265  {  {
1266      if (T0)      GOTO_TB(op_goto_tb0, 0);
1267          JUMP_TB(op_jcc, PARAM1, 0, PARAM2);  }
1268      else  
1269          JUMP_TB(op_jcc, PARAM1, 1, PARAM3);  void OPPROTO op_goto_tb1(void)
1270      FORCE_RET();  {
1271        GOTO_TB(op_goto_tb1, 1);
1272    }
1273    
1274    void OPPROTO op_jmp_label(void)
1275    {
1276        GOTO_LABEL_PARAM(1);
1277  }  }
1278    
1279  void OPPROTO op_jcc_im(void)  void OPPROTO op_jnz_T0_label(void)
1280  {  {
1281      if (T0)      if (T0)
1282          EIP = PARAM1;          GOTO_LABEL_PARAM(1);
1283      else  }
1284          EIP = PARAM2;  
1285      FORCE_RET();  void OPPROTO op_jz_T0_label(void)
1286    {
1287        if (!T0)
1288            GOTO_LABEL_PARAM(1);
1289  }  }
1290    
1291  /* slow set cases (compute x86 flags) */  /* slow set cases (compute x86 flags) */
# Line 1299  CCTable cc_table[CC_OP_NB] = { Line 1552  CCTable cc_table[CC_OP_NB] = {
1552      [CC_OP_SARB] = { compute_all_sarb, compute_c_sarl },      [CC_OP_SARB] = { compute_all_sarb, compute_c_sarl },
1553      [CC_OP_SARW] = { compute_all_sarw, compute_c_sarl },      [CC_OP_SARW] = { compute_all_sarw, compute_c_sarl },
1554      [CC_OP_SARL] = { compute_all_sarl, compute_c_sarl },      [CC_OP_SARL] = { compute_all_sarl, compute_c_sarl },
1555    
1556    #ifdef TARGET_X86_64
1557        [CC_OP_MULQ] = { compute_all_mulq, compute_c_mull },
1558    
1559        [CC_OP_ADDQ] = { compute_all_addq, compute_c_addq  },
1560    
1561        [CC_OP_ADCQ] = { compute_all_adcq, compute_c_adcq  },
1562    
1563        [CC_OP_SUBQ] = { compute_all_subq, compute_c_subq  },
1564        
1565        [CC_OP_SBBQ] = { compute_all_sbbq, compute_c_sbbq  },
1566        
1567        [CC_OP_LOGICQ] = { compute_all_logicq, compute_c_logicq },
1568        
1569        [CC_OP_INCQ] = { compute_all_incq, compute_c_incl },
1570    
1571        [CC_OP_DECQ] = { compute_all_decq, compute_c_incl },
1572    
1573        [CC_OP_SHLQ] = { compute_all_shlq, compute_c_shlq },
1574    
1575        [CC_OP_SARQ] = { compute_all_sarq, compute_c_sarl },
1576    #endif
1577  };  };
1578    
1579  /* floating point support. Some of the code for complicated x87  /* floating point support. Some of the code for complicated x87
# Line 1330  double qemu_rint(double x) Line 1605  double qemu_rint(double x)
1605  void OPPROTO op_flds_FT0_A0(void)  void OPPROTO op_flds_FT0_A0(void)
1606  {  {
1607  #ifdef USE_FP_CONVERT  #ifdef USE_FP_CONVERT
1608      FP_CONVERT.i32 = ldl((void *)A0);      FP_CONVERT.i32 = ldl(A0);
1609      FT0 = FP_CONVERT.f;      FT0 = FP_CONVERT.f;
1610  #else  #else
1611      FT0 = ldfl((void *)A0);      FT0 = ldfl(A0);
1612  #endif  #endif
1613  }  }
1614    
1615  void OPPROTO op_fldl_FT0_A0(void)  void OPPROTO op_fldl_FT0_A0(void)
1616  {  {
1617  #ifdef USE_FP_CONVERT  #ifdef USE_FP_CONVERT
1618      FP_CONVERT.i64 = ldq((void *)A0);      FP_CONVERT.i64 = ldq(A0);
1619      FT0 = FP_CONVERT.d;      FT0 = FP_CONVERT.d;
1620  #else  #else
1621      FT0 = ldfq((void *)A0);      FT0 = ldfq(A0);
1622  #endif  #endif
1623  }  }
1624    
# Line 1352  void OPPROTO op_fldl_FT0_A0(void) Line 1627  void OPPROTO op_fldl_FT0_A0(void)
1627    
1628  void helper_fild_FT0_A0(void)  void helper_fild_FT0_A0(void)
1629  {  {
1630      FT0 = (CPU86_LDouble)ldsw((void *)A0);      FT0 = (CPU86_LDouble)ldsw(A0);
1631  }  }
1632    
1633  void helper_fildl_FT0_A0(void)  void helper_fildl_FT0_A0(void)
1634  {  {
1635      FT0 = (CPU86_LDouble)((int32_t)ldl((void *)A0));      FT0 = (CPU86_LDouble)((int32_t)ldl(A0));
1636  }  }
1637    
1638  void helper_fildll_FT0_A0(void)  void helper_fildll_FT0_A0(void)
1639  {  {
1640      FT0 = (CPU86_LDouble)((int64_t)ldq((void *)A0));      FT0 = (CPU86_LDouble)((int64_t)ldq(A0));
1641  }  }
1642    
1643  void OPPROTO op_fild_FT0_A0(void)  void OPPROTO op_fild_FT0_A0(void)
# Line 1385  void OPPROTO op_fildll_FT0_A0(void) Line 1660  void OPPROTO op_fildll_FT0_A0(void)
1660  void OPPROTO op_fild_FT0_A0(void)  void OPPROTO op_fild_FT0_A0(void)
1661  {  {
1662  #ifdef USE_FP_CONVERT  #ifdef USE_FP_CONVERT
1663      FP_CONVERT.i32 = ldsw((void *)A0);      FP_CONVERT.i32 = ldsw(A0);
1664      FT0 = (CPU86_LDouble)FP_CONVERT.i32;      FT0 = (CPU86_LDouble)FP_CONVERT.i32;
1665  #else  #else
1666      FT0 = (CPU86_LDouble)ldsw((void *)A0);      FT0 = (CPU86_LDouble)ldsw(A0);
1667  #endif  #endif
1668  }  }
1669    
1670  void OPPROTO op_fildl_FT0_A0(void)  void OPPROTO op_fildl_FT0_A0(void)
1671  {  {
1672  #ifdef USE_FP_CONVERT  #ifdef USE_FP_CONVERT
1673      FP_CONVERT.i32 = (int32_t) ldl((void *)A0);      FP_CONVERT.i32 = (int32_t) ldl(A0);
1674      FT0 = (CPU86_LDouble)FP_CONVERT.i32;      FT0 = (CPU86_LDouble)FP_CONVERT.i32;
1675  #else  #else
1676      FT0 = (CPU86_LDouble)((int32_t)ldl((void *)A0));      FT0 = (CPU86_LDouble)((int32_t)ldl(A0));
1677  #endif  #endif
1678  }  }
1679    
1680  void OPPROTO op_fildll_FT0_A0(void)  void OPPROTO op_fildll_FT0_A0(void)
1681  {  {
1682  #ifdef USE_FP_CONVERT  #ifdef USE_FP_CONVERT
1683      FP_CONVERT.i64 = (int64_t) ldq((void *)A0);      FP_CONVERT.i64 = (int64_t) ldq(A0);
1684      FT0 = (CPU86_LDouble)FP_CONVERT.i64;      FT0 = (CPU86_LDouble)FP_CONVERT.i64;
1685  #else  #else
1686      FT0 = (CPU86_LDouble)((int64_t)ldq((void *)A0));      FT0 = (CPU86_LDouble)((int64_t)ldq(A0));
1687  #endif  #endif
1688  }  }
1689  #endif  #endif
# Line 1420  void OPPROTO op_flds_ST0_A0(void) Line 1695  void OPPROTO op_flds_ST0_A0(void)
1695      int new_fpstt;      int new_fpstt;
1696      new_fpstt = (env->fpstt - 1) & 7;      new_fpstt = (env->fpstt - 1) & 7;
1697  #ifdef USE_FP_CONVERT  #ifdef USE_FP_CONVERT
1698      FP_CONVERT.i32 = ldl((void *)A0);      FP_CONVERT.i32 = ldl(A0);
1699      env->fpregs[new_fpstt] = FP_CONVERT.f;      env->fpregs[new_fpstt] = FP_CONVERT.f;
1700  #else  #else
1701      env->fpregs[new_fpstt] = ldfl((void *)A0);      env->fpregs[new_fpstt] = ldfl(A0);
1702  #endif  #endif
1703      env->fpstt = new_fpstt;      env->fpstt = new_fpstt;
1704      env->fptags[new_fpstt] = 0; /* validate stack entry */      env->fptags[new_fpstt] = 0; /* validate stack entry */
# Line 1434  void OPPROTO op_fldl_ST0_A0(void) Line 1709  void OPPROTO op_fldl_ST0_A0(void)
1709      int new_fpstt;      int new_fpstt;
1710      new_fpstt = (env->fpstt - 1) & 7;      new_fpstt = (env->fpstt - 1) & 7;
1711  #ifdef USE_FP_CONVERT  #ifdef USE_FP_CONVERT
1712      FP_CONVERT.i64 = ldq((void *)A0);      FP_CONVERT.i64 = ldq(A0);
1713      env->fpregs[new_fpstt] = FP_CONVERT.d;      env->fpregs[new_fpstt] = FP_CONVERT.d;
1714  #else  #else
1715      env->fpregs[new_fpstt] = ldfq((void *)A0);      env->fpregs[new_fpstt] = ldfq(A0);
1716  #endif  #endif
1717      env->fpstt = new_fpstt;      env->fpstt = new_fpstt;
1718      env->fptags[new_fpstt] = 0; /* validate stack entry */      env->fptags[new_fpstt] = 0; /* validate stack entry */
# Line 1455  void helper_fild_ST0_A0(void) Line 1730  void helper_fild_ST0_A0(void)
1730  {  {
1731      int new_fpstt;      int new_fpstt;
1732      new_fpstt = (env->fpstt - 1) & 7;      new_fpstt = (env->fpstt - 1) & 7;
1733      env->fpregs[new_fpstt] = (CPU86_LDouble)ldsw((void *)A0);      env->fpregs[new_fpstt] = (CPU86_LDouble)ldsw(A0);
1734      env->fpstt = new_fpstt;      env->fpstt = new_fpstt;
1735      env->fptags[new_fpstt] = 0; /* validate stack entry */      env->fptags[new_fpstt] = 0; /* validate stack entry */
1736  }  }
# Line 1464  void helper_fildl_ST0_A0(void) Line 1739  void helper_fildl_ST0_A0(void)
1739  {  {
1740      int new_fpstt;      int new_fpstt;
1741      new_fpstt = (env->fpstt - 1) & 7;      new_fpstt = (env->fpstt - 1) & 7;
1742      env->fpregs[new_fpstt] = (CPU86_LDouble)((int32_t)ldl((void *)A0));      env->fpregs[new_fpstt] = (CPU86_LDouble)((int32_t)ldl(A0));
1743      env->fpstt = new_fpstt;      env->fpstt = new_fpstt;
1744      env->fptags[new_fpstt] = 0; /* validate stack entry */      env->fptags[new_fpstt] = 0; /* validate stack entry */
1745  }  }
# Line 1473  void helper_fildll_ST0_A0(void) Line 1748  void helper_fildll_ST0_A0(void)
1748  {  {
1749      int new_fpstt;      int new_fpstt;
1750      new_fpstt = (env->fpstt - 1) & 7;      new_fpstt = (env->fpstt - 1) & 7;
1751      env->fpregs[new_fpstt] = (CPU86_LDouble)((int64_t)ldq((void *)A0));      env->fpregs[new_fpstt] = (CPU86_LDouble)((int64_t)ldq(A0));
1752      env->fpstt = new_fpstt;      env->fpstt = new_fpstt;
1753      env->fptags[new_fpstt] = 0; /* validate stack entry */      env->fptags[new_fpstt] = 0; /* validate stack entry */
1754  }  }
# Line 1500  void OPPROTO op_fild_ST0_A0(void) Line 1775  void OPPROTO op_fild_ST0_A0(void)
1775      int new_fpstt;      int new_fpstt;
1776      new_fpstt = (env->fpstt - 1) & 7;      new_fpstt = (env->fpstt - 1) & 7;
1777  #ifdef USE_FP_CONVERT  #ifdef USE_FP_CONVERT
1778      FP_CONVERT.i32 = ldsw((void *)A0);      FP_CONVERT.i32 = ldsw(A0);
1779      env->fpregs[new_fpstt] = (CPU86_LDouble)FP_CONVERT.i32;      env->fpregs[new_fpstt] = (CPU86_LDouble)FP_CONVERT.i32;
1780  #else  #else
1781      env->fpregs[new_fpstt] = (CPU86_LDouble)ldsw((void *)A0);      env->fpregs[new_fpstt] = (CPU86_LDouble)ldsw(A0);
1782  #endif  #endif
1783      env->fpstt = new_fpstt;      env->fpstt = new_fpstt;
1784      env->fptags[new_fpstt] = 0; /* validate stack entry */      env->fptags[new_fpstt] = 0; /* validate stack entry */
# Line 1514  void OPPROTO op_fildl_ST0_A0(void) Line 1789  void OPPROTO op_fildl_ST0_A0(void)
1789      int new_fpstt;      int new_fpstt;
1790      new_fpstt = (env->fpstt - 1) & 7;      new_fpstt = (env->fpstt - 1) & 7;
1791  #ifdef USE_FP_CONVERT  #ifdef USE_FP_CONVERT
1792      FP_CONVERT.i32 = (int32_t) ldl((void *)A0);      FP_CONVERT.i32 = (int32_t) ldl(A0);
1793      env->fpregs[new_fpstt] = (CPU86_LDouble)FP_CONVERT.i32;      env->fpregs[new_fpstt] = (CPU86_LDouble)FP_CONVERT.i32;
1794  #else  #else
1795      env->fpregs[new_fpstt] = (CPU86_LDouble)((int32_t)ldl((void *)A0));      env->fpregs[new_fpstt] = (CPU86_LDouble)((int32_t)ldl(A0));
1796  #endif  #endif
1797      env->fpstt = new_fpstt;      env->fpstt = new_fpstt;
1798      env->fptags[new_fpstt] = 0; /* validate stack entry */      env->fptags[new_fpstt] = 0; /* validate stack entry */
# Line 1528  void OPPROTO op_fildll_ST0_A0(void) Line 1803  void OPPROTO op_fildll_ST0_A0(void)
1803      int new_fpstt;      int new_fpstt;
1804      new_fpstt = (env->fpstt - 1) & 7;      new_fpstt = (env->fpstt - 1) & 7;
1805  #ifdef USE_FP_CONVERT  #ifdef USE_FP_CONVERT
1806      FP_CONVERT.i64 = (int64_t) ldq((void *)A0);      FP_CONVERT.i64 = (int64_t) ldq(A0);
1807      env->fpregs[new_fpstt] = (CPU86_LDouble)FP_CONVERT.i64;      env->fpregs[new_fpstt] = (CPU86_LDouble)FP_CONVERT.i64;
1808  #else  #else
1809      env->fpregs[new_fpstt] = (CPU86_LDouble)((int64_t)ldq((void *)A0));      env->fpregs[new_fpstt] = (CPU86_LDouble)((int64_t)ldq(A0));
1810  #endif  #endif
1811      env->fpstt = new_fpstt;      env->fpstt = new_fpstt;
1812      env->fptags[new_fpstt] = 0; /* validate stack entry */      env->fptags[new_fpstt] = 0; /* validate stack entry */
# Line 1545  void OPPROTO op_fsts_ST0_A0(void) Line 1820  void OPPROTO op_fsts_ST0_A0(void)
1820  {  {
1821  #ifdef USE_FP_CONVERT  #ifdef USE_FP_CONVERT
1822      FP_CONVERT.f = (float)ST0;      FP_CONVERT.f = (float)ST0;
1823      stfl((void *)A0, FP_CONVERT.f);      stfl(A0, FP_CONVERT.f);
1824  #else  #else
1825      stfl((void *)A0, (float)ST0);      stfl(A0, (float)ST0);
1826  #endif  #endif
1827  }  }
1828    
1829  void OPPROTO op_fstl_ST0_A0(void)  void OPPROTO op_fstl_ST0_A0(void)
1830  {  {
1831      stfq((void *)A0, (double)ST0);      stfq(A0, (double)ST0);
1832  }  }
1833    
1834  void OPPROTO op_fstt_ST0_A0(void)  void OPPROTO op_fstt_ST0_A0(void)
# Line 1574  void OPPROTO op_fist_ST0_A0(void) Line 1849  void OPPROTO op_fist_ST0_A0(void)
1849      val = lrint(d);      val = lrint(d);
1850      if (val != (int16_t)val)      if (val != (int16_t)val)
1851          val = -32768;          val = -32768;
1852      stw((void *)A0, val);      stw(A0, val);
1853  }  }
1854    
1855  void OPPROTO op_fistl_ST0_A0(void)  void OPPROTO op_fistl_ST0_A0(void)
# Line 1588  void OPPROTO op_fistl_ST0_A0(void) Line 1863  void OPPROTO op_fistl_ST0_A0(void)
1863    
1864      d = ST0;      d = ST0;
1865      val = lrint(d);      val = lrint(d);
1866      stl((void *)A0, val);      stl(A0, val);
1867  }  }
1868    
1869  void OPPROTO op_fistll_ST0_A0(void)  void OPPROTO op_fistll_ST0_A0(void)
# Line 1602  void OPPROTO op_fistll_ST0_A0(void) Line 1877  void OPPROTO op_fistll_ST0_A0(void)
1877    
1878      d = ST0;      d = ST0;
1879      val = llrint(d);      val = llrint(d);
1880      stq((void *)A0, val);      stq(A0, val);
1881  }  }
1882    
1883  void OPPROTO op_fbld_ST0_A0(void)  void OPPROTO op_fbld_ST0_A0(void)
# Line 1934  void OPPROTO op_fnstsw_A0(void) Line 2209  void OPPROTO op_fnstsw_A0(void)
2209  {  {
2210      int fpus;      int fpus;
2211      fpus = (env->fpus & ~0x3800) | (env->fpstt & 0x7) << 11;      fpus = (env->fpus & ~0x3800) | (env->fpstt & 0x7) << 11;
2212      stw((void *)A0, fpus);      stw(A0, fpus);
2213  }  }
2214    
2215  void OPPROTO op_fnstsw_EAX(void)  void OPPROTO op_fnstsw_EAX(void)
2216  {  {
2217      int fpus;      int fpus;
2218      fpus = (env->fpus & ~0x3800) | (env->fpstt & 0x7) << 11;      fpus = (env->fpus & ~0x3800) | (env->fpstt & 0x7) << 11;
2219      EAX = (EAX & 0xffff0000) | fpus;      EAX = (EAX & ~0xffff) | fpus;
2220  }  }
2221    
2222  void OPPROTO op_fnstcw_A0(void)  void OPPROTO op_fnstcw_A0(void)
2223  {  {
2224      stw((void *)A0, env->fpuc);      stw(A0, env->fpuc);
2225  }  }
2226    
2227  void OPPROTO op_fldcw_A0(void)  void OPPROTO op_fldcw_A0(void)
2228  {  {
2229      int rnd_type;      int rnd_type;
2230      env->fpuc = lduw((void *)A0);      env->fpuc = lduw(A0);
2231      /* set rounding mode */      /* set rounding mode */
2232      switch(env->fpuc & RC_MASK) {      switch(env->fpuc & RC_MASK) {
2233      default:      default:
# Line 2001  void OPPROTO op_fninit(void) Line 2276  void OPPROTO op_fninit(void)
2276    
2277  void OPPROTO op_fnstenv_A0(void)  void OPPROTO op_fnstenv_A0(void)
2278  {  {
2279      helper_fstenv((uint8_t *)A0, PARAM1);      helper_fstenv(A0, PARAM1);
2280  }  }
2281    
2282  void OPPROTO op_fldenv_A0(void)  void OPPROTO op_fldenv_A0(void)
2283  {  {
2284      helper_fldenv((uint8_t *)A0, PARAM1);      helper_fldenv(A0, PARAM1);
2285  }  }
2286    
2287  void OPPROTO op_fnsave_A0(void)  void OPPROTO op_fnsave_A0(void)
2288  {  {
2289      helper_fsave((uint8_t *)A0, PARAM1);      helper_fsave(A0, PARAM1);
2290  }  }
2291    
2292  void OPPROTO op_frstor_A0(void)  void OPPROTO op_frstor_A0(void)
2293  {  {
2294      helper_frstor((uint8_t *)A0, PARAM1);      helper_frstor(A0, PARAM1);
2295  }  }
2296    
2297  /* threading support */  /* threading support */
# Line 2030  void OPPROTO op_unlock(void) Line 2305  void OPPROTO op_unlock(void)
2305      cpu_unlock();      cpu_unlock();
2306  }  }
2307    
2308    /* SSE support */
2309    static inline void memcpy16(void *d, void *s)
2310    {
2311        ((uint32_t *)d)[0] = ((uint32_t *)s)[0];
2312        ((uint32_t *)d)[1] = ((uint32_t *)s)[1];
2313        ((uint32_t *)d)[2] = ((uint32_t *)s)[2];
2314        ((uint32_t *)d)[3] = ((uint32_t *)s)[3];
2315    }
2316    
2317    void OPPROTO op_movo(void)
2318    {
2319        /* XXX: badly generated code */
2320        XMMReg *d, *s;
2321        d = (XMMReg *)((char *)env + PARAM1);
2322        s = (XMMReg *)((char *)env + PARAM2);
2323        memcpy16(d, s);
2324    }
2325    
2326    void OPPROTO op_fxsave_A0(void)
2327    {
2328        helper_fxsave(A0, PARAM1);
2329    }
2330    
2331    void OPPROTO op_fxrstor_A0(void)
2332    {
2333        helper_fxrstor(A0, PARAM1);
2334    }

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.24

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26