aboutsummaryrefslogtreecommitdiffstats
path: root/roms/QemuMacDrivers/shared/MakeFunction.s
diff options
context:
space:
mode:
authorAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
committerAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
commitaf1a266670d040d2f4083ff309d732d648afba2a (patch)
tree2fc46203448ddcc6f81546d379abfaeb323575e9 /roms/QemuMacDrivers/shared/MakeFunction.s
parente02cda008591317b1625707ff8e115a4841aa889 (diff)
Add submodule dependency filesHEADmaster
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'roms/QemuMacDrivers/shared/MakeFunction.s')
-rw-r--r--roms/QemuMacDrivers/shared/MakeFunction.s29
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