win_helper.c (2a1905c79e1009600e96e7d1d0c592d573e94dbd) win_helper.c (b597eedcce0de84ff573a6be2cd6a89c7fa0fd8e)
1/*
2 * Helpers for CWP and PSTATE handling
3 *
4 * Copyright (c) 2003-2005 Fabrice Bellard
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either

--- 41 unchanged lines hidden (view full) ---

50 }
51 env->regwptr = env->regbase + (new_cwp * 16);
52}
53
54target_ulong cpu_get_psr(CPUSPARCState *env)
55{
56 target_ulong icc = 0;
57
1/*
2 * Helpers for CWP and PSTATE handling
3 *
4 * Copyright (c) 2003-2005 Fabrice Bellard
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either

--- 41 unchanged lines hidden (view full) ---

50 }
51 env->regwptr = env->regbase + (new_cwp * 16);
52}
53
54target_ulong cpu_get_psr(CPUSPARCState *env)
55{
56 target_ulong icc = 0;
57
58 helper_compute_psr(env);
59
60 icc |= ((int32_t)env->cc_N < 0) << PSR_NEG_SHIFT;
61 icc |= ((int32_t)env->cc_V < 0) << PSR_OVF_SHIFT;
62 icc |= ((int32_t)env->icc_Z == 0) << PSR_ZERO_SHIFT;
63 if (TARGET_LONG_BITS == 64) {
64 icc |= extract64(env->icc_C, 32, 1) << PSR_CARRY_SHIFT;
65 } else {
66 icc |= env->icc_C << PSR_CARRY_SHIFT;
67 }

--- 30 unchanged lines hidden (view full) ---

98 cpu_put_psr_icc(env, val);
99#if !defined(TARGET_SPARC64)
100 env->psref = (val & PSR_EF) ? 1 : 0;
101 env->psrpil = (val & PSR_PIL) >> 8;
102 env->psrs = (val & PSR_S) ? 1 : 0;
103 env->psrps = (val & PSR_PS) ? 1 : 0;
104 env->psret = (val & PSR_ET) ? 1 : 0;
105#endif
58 icc |= ((int32_t)env->cc_N < 0) << PSR_NEG_SHIFT;
59 icc |= ((int32_t)env->cc_V < 0) << PSR_OVF_SHIFT;
60 icc |= ((int32_t)env->icc_Z == 0) << PSR_ZERO_SHIFT;
61 if (TARGET_LONG_BITS == 64) {
62 icc |= extract64(env->icc_C, 32, 1) << PSR_CARRY_SHIFT;
63 } else {
64 icc |= env->icc_C << PSR_CARRY_SHIFT;
65 }

--- 30 unchanged lines hidden (view full) ---

96 cpu_put_psr_icc(env, val);
97#if !defined(TARGET_SPARC64)
98 env->psref = (val & PSR_EF) ? 1 : 0;
99 env->psrpil = (val & PSR_PIL) >> 8;
100 env->psrs = (val & PSR_S) ? 1 : 0;
101 env->psrps = (val & PSR_PS) ? 1 : 0;
102 env->psret = (val & PSR_ET) ? 1 : 0;
103#endif
106 env->cc_op = CC_OP_FLAGS;
107#if !defined(TARGET_SPARC64)
108 cpu_set_cwp(env, val & PSR_CWP);
109#endif
110}
111
112/* Called with BQL held */
113void cpu_put_psr(CPUSPARCState *env, target_ulong val)
114{

--- 152 unchanged lines hidden (view full) ---

267 env->otherwin--;
268 }
269}
270
271target_ulong cpu_get_ccr(CPUSPARCState *env)
272{
273 target_ulong ccr = 0;
274
104#if !defined(TARGET_SPARC64)
105 cpu_set_cwp(env, val & PSR_CWP);
106#endif
107}
108
109/* Called with BQL held */
110void cpu_put_psr(CPUSPARCState *env, target_ulong val)
111{

--- 152 unchanged lines hidden (view full) ---

264 env->otherwin--;
265 }
266}
267
268target_ulong cpu_get_ccr(CPUSPARCState *env)
269{
270 target_ulong ccr = 0;
271
275 helper_compute_psr(env);
276
277 ccr |= (env->icc_C >> 32) & 1;
278 ccr |= ((int32_t)env->cc_V < 0) << 1;
279 ccr |= ((int32_t)env->icc_Z == 0) << 2;
280 ccr |= ((int32_t)env->cc_N < 0) << 3;
281
282 ccr |= env->xcc_C << 4;
283 ccr |= (env->cc_V < 0) << 5;
284 ccr |= (env->xcc_Z == 0) << 6;

--- 5 unchanged lines hidden (view full) ---

290void cpu_put_ccr(CPUSPARCState *env, target_ulong val)
291{
292 env->cc_N = deposit64(-(val & 0x08), 32, 32, -(val & 0x80));
293 env->cc_V = deposit64(-(val & 0x02), 32, 32, -(val & 0x20));
294 env->icc_C = (uint64_t)val << 32;
295 env->xcc_C = (val >> 4) & 1;
296 env->icc_Z = ~val & 0x04;
297 env->xcc_Z = ~val & 0x40;
272 ccr |= (env->icc_C >> 32) & 1;
273 ccr |= ((int32_t)env->cc_V < 0) << 1;
274 ccr |= ((int32_t)env->icc_Z == 0) << 2;
275 ccr |= ((int32_t)env->cc_N < 0) << 3;
276
277 ccr |= env->xcc_C << 4;
278 ccr |= (env->cc_V < 0) << 5;
279 ccr |= (env->xcc_Z == 0) << 6;

--- 5 unchanged lines hidden (view full) ---

285void cpu_put_ccr(CPUSPARCState *env, target_ulong val)
286{
287 env->cc_N = deposit64(-(val & 0x08), 32, 32, -(val & 0x80));
288 env->cc_V = deposit64(-(val & 0x02), 32, 32, -(val & 0x20));
289 env->icc_C = (uint64_t)val << 32;
290 env->xcc_C = (val >> 4) & 1;
291 env->icc_Z = ~val & 0x04;
292 env->xcc_Z = ~val & 0x40;
298
299 CC_OP = CC_OP_FLAGS;
300}
301
302target_ulong cpu_get_cwp64(CPUSPARCState *env)
303{
304 return env->nwindows - 1 - env->cwp;
305}
306
307void cpu_put_cwp64(CPUSPARCState *env, int cwp)

--- 189 unchanged lines hidden ---
293}
294
295target_ulong cpu_get_cwp64(CPUSPARCState *env)
296{
297 return env->nwindows - 1 - env->cwp;
298}
299
300void cpu_put_cwp64(CPUSPARCState *env, int cwp)

--- 189 unchanged lines hidden ---