summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/i386/shared/irq/irq_asm.S
diff options
context:
space:
mode:
authorTill Straumann <strauman@slac.stanford.edu>2009-11-10 06:51:52 +0000
committerTill Straumann <strauman@slac.stanford.edu>2009-11-10 06:51:52 +0000
commit4a4201cb410c4d3816fc1e0123982b90046ea19c (patch)
tree492f5a507ef61f8e138dad8e124f8ac4b8af8e59 /c/src/lib/libbsp/i386/shared/irq/irq_asm.S
parent2009-11-09 Till Straumann <strauman@slac.stanford.edu> (diff)
downloadrtems-4a4201cb410c4d3816fc1e0123982b90046ea19c.tar.bz2
2009-11-10 Till Straumann <strauman@slac.stanford.edu>
* pc386/make/custom/pc586-sse.cfg, pc386/start/start.S, shared/irq/irq_asm.S: Added experimental SSE support.
Diffstat (limited to 'c/src/lib/libbsp/i386/shared/irq/irq_asm.S')
-rw-r--r--c/src/lib/libbsp/i386/shared/irq/irq_asm.S32
1 files changed, 32 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/i386/shared/irq/irq_asm.S b/c/src/lib/libbsp/i386/shared/irq/irq_asm.S
index 1335bd749d..be0bcbb859 100644
--- a/c/src/lib/libbsp/i386/shared/irq/irq_asm.S
+++ b/c/src/lib/libbsp/i386/shared/irq/irq_asm.S
@@ -24,7 +24,12 @@
#define MSK_OFF 4
#define EBP_OFF 8 /* code restoring ebp/esp relies on */
#define ESP_OFF 12 /* esp being on top of ebp! */
+#ifdef __SSE__
+#define FRM_SIZ (16+512)
+#define SSE_OFF 16
+#else
#define FRM_SIZ 16
+#endif
BEGIN_CODE
@@ -70,6 +75,27 @@ SYM (_ISR_Handler):
movl eax, ESP_OFF(esp)
movl ebp, EBP_OFF(esp)
+#ifdef __SSE__
+ /* NOTE: SSE only is supported if the BSP enables fxsave/fxrstor
+ * to save/restore SSE context! This is so far only implemented
+ * for pc386!.
+ */
+
+ /* We save SSE here (on the task stack) because we possibly
+ * call other C-code (besides the ISR, namely _Thread_Dispatch()
+ * or _ThreadProcessSignalsFromIrq()).
+ */
+ /* don't wait here; a possible exception condition will eventually be
+ * detected when the task resumes control and executes a FP instruction
+ fwait
+ */
+ fxsave SSE_OFF(esp)
+ fninit /* clean-slate FPU */
+ movl $0x1f80, ARG_OFF(esp) /* use ARG_OFF as scratch space */
+ ldmxcsr ARG_OFF(esp) /* clean-slate MXCSR */
+#endif
+
+
/*
* acknowledge the interrupt
*
@@ -197,6 +223,12 @@ nested:
* eip, CS, Flags).
*/
.exit:
+
+#ifdef __SSE__
+ fwait
+ fxrstor SSE_OFF(esp)
+#endif
+
/* restore ebp and original esp */
addl $EBP_OFF, esp
popl ebp