Hello,
I'm attempting to make ARM registerised build reality just for own fun
(and thanks to help and encouragement provided by David Terei) and for
this I'm writing platform specific StgRun/StgReturn functions as
required in rts/StgCRun.c. I'm not sure I've got right all the
information about what's required by those two functions. I've found the
comments on top of the file not so clear so I tried to make them a
little bit more clear even for complete novice as me. The question is:
have I got all this right or have I made foot fault with this? Please
correct me if I'm wrong. The diff is attached. Also I wonder if the last
note:
* GCC will have assumed that pushing/popping of C-stack frames is
* going on when it generated its code, and used stack space
* accordingly. However, we actually {\em post-process away} all
* such stack-framery (see \tr{ghc/driver/ghc-asm.lprl}). Things will
* be OK however, if we initially make sure there are
* @RESERVED_C_STACK_BYTES@ on the C-stack to begin with, for local
* variables.
is still valid since it looks like coming from the days of -fvia-C
registerised builds, at least evil mangler note suggest it to me...
Thanks!
Karel
diff --git a/rts/StgCRun.c b/rts/StgCRun.c
index e28353c..d62dd24 100644
--- a/rts/StgCRun.c
+++ b/rts/StgCRun.c
@@ -10,17 +10,22 @@
*
* where "f" is the STG function to call, and BaseReg is the address of the
* RegTable for this run (we might have separate RegTables if we're running
- * multiple threads on an SMP machine).
+ * multiple threads on an SMP machine). StgRun implementation is
+ * responsible for saving all callee-save registers and setting STG
+ * Base register (or more precisely machine register to which STG Base
+ * register is mapped) to BaseReg value and then for straight jump into
+ * function f.
*
- * In the end, "f" must JMP to StgReturn (defined below),
- * passing the return-value "rv" in R1,
- * to return to the caller of StgRun returning "rv" in
- * the whatever way C returns a value.
+ * In the end, "f" must JMP to StgReturn function (defined below),
+ * passing the return-value "rv" in the STG R1 register.
+ * StgReturn function implementation is responsible for returning to
+ * the caller of StgRun. It is also responsible for returning "rv" aka
+ * STG R1 in the whatever way C ABI returns a value.
*
- * NOTE: StgRun/StgReturn do *NOT* load or store Hp or any
- * other registers (other than saving the C callee-saves
- * registers). Instead, the called function "f" must do that
- * in STG land.
+ * NOTE: StgRun/StgReturn do *NOT* load or store STG Hp register or any
+ * other STG registers (other than saving the C callee-saves
+ * registers and setting STG Base register above). Instead, the
+ * called function "f" must do that in STG land.
*
* GCC will have assumed that pushing/popping of C-stack frames is
* going on when it generated its code, and used stack space
_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc