sparc: Avoid new window for FP save/restore

Update #2270.
This commit is contained in:
Sebastian Huber
2015-05-29 15:54:28 +02:00
parent 18d18e1c4b
commit 8a1dc71b8e

View File

@@ -44,38 +44,35 @@
.align 4 .align 4
PUBLIC(_CPU_Context_save_fp) PUBLIC(_CPU_Context_save_fp)
SYM(_CPU_Context_save_fp): SYM(_CPU_Context_save_fp):
save %sp, -CPU_MINIMUM_STACK_FRAME_SIZE, %sp
/* /*
* The following enables the floating point unit. * The following enables the floating point unit.
*/ */
mov %psr, %l0 mov %psr, %o1
sethi %hi(SPARC_PSR_EF_MASK), %l1 sethi %hi(SPARC_PSR_EF_MASK), %o2
or %l1, %lo(SPARC_PSR_EF_MASK), %l1 or %o2, %lo(SPARC_PSR_EF_MASK), %o2
or %l0, %l1, %l0 or %o1, %o2, %o1
mov %l0, %psr ! **** ENABLE FLOAT ACCESS **** mov %o1, %psr ! **** ENABLE FLOAT ACCESS ****
nop; nop; nop; ! Need three nops before EF is nop; nop; nop; ! Need three nops before EF is
ld [%i0], %l0 ! active due to pipeline delay!!! ld [%o0], %o1 ! active due to pipeline delay!!!
std %f0, [%l0 + FO_F1_OFFSET] std %f0, [%o1 + FO_F1_OFFSET]
std %f2, [%l0 + F2_F3_OFFSET] std %f2, [%o1 + F2_F3_OFFSET]
std %f4, [%l0 + F4_F5_OFFSET] std %f4, [%o1 + F4_F5_OFFSET]
std %f6, [%l0 + F6_F7_OFFSET] std %f6, [%o1 + F6_F7_OFFSET]
std %f8, [%l0 + F8_F9_OFFSET] std %f8, [%o1 + F8_F9_OFFSET]
std %f10, [%l0 + F1O_F11_OFFSET] std %f10, [%o1 + F1O_F11_OFFSET]
std %f12, [%l0 + F12_F13_OFFSET] std %f12, [%o1 + F12_F13_OFFSET]
std %f14, [%l0 + F14_F15_OFFSET] std %f14, [%o1 + F14_F15_OFFSET]
std %f16, [%l0 + F16_F17_OFFSET] std %f16, [%o1 + F16_F17_OFFSET]
std %f18, [%l0 + F18_F19_OFFSET] std %f18, [%o1 + F18_F19_OFFSET]
std %f20, [%l0 + F2O_F21_OFFSET] std %f20, [%o1 + F2O_F21_OFFSET]
std %f22, [%l0 + F22_F23_OFFSET] std %f22, [%o1 + F22_F23_OFFSET]
std %f24, [%l0 + F24_F25_OFFSET] std %f24, [%o1 + F24_F25_OFFSET]
std %f26, [%l0 + F26_F27_OFFSET] std %f26, [%o1 + F26_F27_OFFSET]
std %f28, [%l0 + F28_F29_OFFSET] std %f28, [%o1 + F28_F29_OFFSET]
std %f30, [%l0 + F3O_F31_OFFSET] std %f30, [%o1 + F3O_F31_OFFSET]
st %fsr, [%l0 + FSR_OFFSET] jmp %o7 + 8
ret st %fsr, [%o1 + FSR_OFFSET]
restore
/* /*
* void _CPU_Context_restore_fp( * void _CPU_Context_restore_fp(
@@ -93,38 +90,35 @@ SYM(_CPU_Context_save_fp):
.align 4 .align 4
PUBLIC(_CPU_Context_restore_fp) PUBLIC(_CPU_Context_restore_fp)
SYM(_CPU_Context_restore_fp): SYM(_CPU_Context_restore_fp):
save %sp, -CPU_MINIMUM_STACK_FRAME_SIZE , %sp
/* /*
* The following enables the floating point unit. * The following enables the floating point unit.
*/ */
mov %psr, %l0 mov %psr, %o1
sethi %hi(SPARC_PSR_EF_MASK), %l1 sethi %hi(SPARC_PSR_EF_MASK), %o2
or %l1, %lo(SPARC_PSR_EF_MASK), %l1 or %o2, %lo(SPARC_PSR_EF_MASK), %o2
or %l0, %l1, %l0 or %o1, %o2, %o1
mov %l0, %psr ! **** ENABLE FLOAT ACCESS **** mov %o1, %psr ! **** ENABLE FLOAT ACCESS ****
nop; nop; nop; ! Need three nops before EF is nop; nop; nop; ! Need three nops before EF is
ld [%i0], %l0 ! active due to pipeline delay!!! ld [%o0], %o1 ! active due to pipeline delay!!!
ldd [%l0 + FO_F1_OFFSET], %f0 ldd [%o1 + FO_F1_OFFSET], %f0
ldd [%l0 + F2_F3_OFFSET], %f2 ldd [%o1 + F2_F3_OFFSET], %f2
ldd [%l0 + F4_F5_OFFSET], %f4 ldd [%o1 + F4_F5_OFFSET], %f4
ldd [%l0 + F6_F7_OFFSET], %f6 ldd [%o1 + F6_F7_OFFSET], %f6
ldd [%l0 + F8_F9_OFFSET], %f8 ldd [%o1 + F8_F9_OFFSET], %f8
ldd [%l0 + F1O_F11_OFFSET], %f10 ldd [%o1 + F1O_F11_OFFSET], %f10
ldd [%l0 + F12_F13_OFFSET], %f12 ldd [%o1 + F12_F13_OFFSET], %f12
ldd [%l0 + F14_F15_OFFSET], %f14 ldd [%o1 + F14_F15_OFFSET], %f14
ldd [%l0 + F16_F17_OFFSET], %f16 ldd [%o1 + F16_F17_OFFSET], %f16
ldd [%l0 + F18_F19_OFFSET], %f18 ldd [%o1 + F18_F19_OFFSET], %f18
ldd [%l0 + F2O_F21_OFFSET], %f20 ldd [%o1 + F2O_F21_OFFSET], %f20
ldd [%l0 + F22_F23_OFFSET], %f22 ldd [%o1 + F22_F23_OFFSET], %f22
ldd [%l0 + F24_F25_OFFSET], %f24 ldd [%o1 + F24_F25_OFFSET], %f24
ldd [%l0 + F26_F27_OFFSET], %f26 ldd [%o1 + F26_F27_OFFSET], %f26
ldd [%l0 + F28_F29_OFFSET], %f28 ldd [%o1 + F28_F29_OFFSET], %f28
ldd [%l0 + F3O_F31_OFFSET], %f30 ldd [%o1 + F3O_F31_OFFSET], %f30
ld [%l0 + FSR_OFFSET], %fsr jmp %o7 + 8
ret ld [%o1 + FSR_OFFSET], %fsr
restore
#endif /* SPARC_HAS_FPU */ #endif /* SPARC_HAS_FPU */