diff options
Diffstat (limited to 'roms/QemuMacDrivers/shared/MakeFunction.s')
-rw-r--r-- | roms/QemuMacDrivers/shared/MakeFunction.s | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/roms/QemuMacDrivers/shared/MakeFunction.s b/roms/QemuMacDrivers/shared/MakeFunction.s new file mode 100644 index 000000000..7d3820ff9 --- /dev/null +++ b/roms/QemuMacDrivers/shared/MakeFunction.s @@ -0,0 +1,29 @@ +; MakeFunction sets up everything you need to make an assembly function +; callable from C and debuggable with a symbolic debugger. It does the following: +; - export the function's transition vector +; - export the function name +; - create a toc entry for the function's transition vector +; - create the transition vector, which must contain +; - the function entry point (the name of the function) +; - the TOC anchor (the predefined variable TOC[tc0]) +; - tell PPCAsm to create a function entry point symbol for symbolic debuggers +; - create a csect for the function (one csect per function lets the +; linker do dead code stripping, resulting in smaller executables) + + MACRO + MakeFunction &fnName + EXPORT &fnName[DS] + EXPORT .&fnName[PR] + + TC &fnName[TC], &fnName[DS] + + CSECT &fnName[DS] + DC.L .&fnName[PR] + DC.L TOC[tc0] + + CSECT .&fnName[PR] + FUNCTION .&fnName[PR] + + ENDM + +
\ No newline at end of file |