From 1f9fc8e6ef52e6ff6f007ae0b96108f719c24f05 Mon Sep 17 00:00:00 2001 From: sof Date: Thu, 9 Oct 1997 10:06:33 +0000 Subject: [PATCH] [project @ 1997-10-09 10:05:05 by sof] Added SET_RETADDR macro for MIPSes --- ghc/includes/COptWraps.lh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ghc/includes/COptWraps.lh b/ghc/includes/COptWraps.lh index 409693b..81c266b 100644 --- a/ghc/includes/COptWraps.lh +++ b/ghc/includes/COptWraps.lh @@ -232,7 +232,8 @@ in the end. Getting this right requires three extremely @MAGIC@ macros, no doubt chock full of assembly gook for the current platform. These are -@MAGIC_CALL_SETUP@, which gets ready for one of these magic calls, +@MAGIC_CALL_SET +UP@, which gets ready for one of these magic calls, @MAGIC_CALL@, which performs the call and stashes away all possible results, and @MAGIC_RETURN@, which collects all possible results back up again. @@ -533,6 +534,7 @@ gets whatever it's after. "\ts.d $f0, -8($sp)\n" \ "\tsw $2, -12($sp)"); + #define MAGIC_RETURN \ __asm__ volatile ( \ "l.d $f0, -8($sp)\n" \ @@ -540,6 +542,13 @@ gets whatever it's after. #define WRAPPER_NAME(f) /* nothing */ +/* + Threaded code needs to be able to grab the return address, in case we have + an intervening context switch. + */ + +#define SET_RETADDR(loc) { register StgFunPtrFunPtr ra __asm__ ("$31"); loc = ra; } + #define WRAPPER_SETUP(f,ignore1,ignore2) SaveAllStgContext(); #define WRAPPER_RETURN(x) \ -- 1.7.10.4