Commit 4d6b6c0aec20e78c966b857c520fe0d242d64b30

Authored by bellard
1 parent 79f91c27

more fpu functions - x86_64 fixes


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1234 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 29 additions and 1 deletions
target-i386/helper.c
... ... @@ -1454,7 +1454,11 @@ void load_seg(int seg_reg, int selector)
1454 1454 selector &= 0xffff;
1455 1455 if ((selector & 0xfffc) == 0) {
1456 1456 /* null selector case */
1457   - if (seg_reg == R_SS)
  1457 + if (seg_reg == R_SS
  1458 +#ifdef TARGET_X86_64
  1459 + && !(env->hflags & HF_CS64_MASK)
  1460 +#endif
  1461 + )
1458 1462 raise_exception_err(EXCP0D_GPF, 0);
1459 1463 cpu_x86_load_seg_cache(env, seg_reg, selector, 0, 0, 0);
1460 1464 } else {
... ... @@ -2146,6 +2150,7 @@ void helper_sysexit(void)
2146 2150  
2147 2151 void helper_movl_crN_T0(int reg)
2148 2152 {
  2153 +#if !defined(CONFIG_USER_ONLY)
2149 2154 switch(reg) {
2150 2155 case 0:
2151 2156 cpu_x86_update_cr0(env, T0);
... ... @@ -2156,10 +2161,14 @@ void helper_movl_crN_T0(int reg)
2156 2161 case 4:
2157 2162 cpu_x86_update_cr4(env, T0);
2158 2163 break;
  2164 + case 8:
  2165 + cpu_set_apic_tpr(env, T0);
  2166 + break;
2159 2167 default:
2160 2168 env->cr[reg] = T0;
2161 2169 break;
2162 2170 }
  2171 +#endif
2163 2172 }
2164 2173  
2165 2174 /* XXX: do more */
... ... @@ -3227,6 +3236,25 @@ float approx_rcp(float a)
3227 3236 return 1.0 / a;
3228 3237 }
3229 3238  
  3239 +/* XXX: find a better solution */
  3240 +double helper_sqrt(double a)
  3241 +{
  3242 + return sqrt(a);
  3243 +}
  3244 +
  3245 +/* XXX: move that to another file */
  3246 +#if defined(__powerpc__)
  3247 +/* better to call an helper on ppc */
  3248 +float int32_to_float32(int32_t a)
  3249 +{
  3250 + return (float)a;
  3251 +}
  3252 +
  3253 +double int32_to_float64(int32_t a)
  3254 +{
  3255 + return (double)a;
  3256 +}
  3257 +#endif
3230 3258  
3231 3259 #if !defined(CONFIG_USER_ONLY)
3232 3260  
... ...