summaryrefslogtreecommitdiff
path: root/sys/src/libc/power
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2014-02-17 13:25:24 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2014-02-17 13:25:24 +0100
commit2c5c78425516590e894c9c334182073fcc56a10b (patch)
treeec4c8b58ec1d8144936bf8111382a6e7141d55c0 /sys/src/libc/power
parent87fcb107ef333f5dce7618e0f4c73d69ebc75eb5 (diff)
prof: properly save and restore RARG for amd64
amd64 passes first argument in RARG (BP) register which has the be preserved duing _profin() and _profout() calls. to handle this we introduce _saveret() and _savearg(). _saveret() returns AX, _savearg() returns RARG (BP). for archs other and amd64, _saveret() and _savearg() are the same function, doing nothing. restoing works with dummy function: uintptr _restore(uintptr, uintptr ret) { return ret; } ... ret = _saveret(); arg = _savearg(); ... return _restore(arg, ret); as we pass arg as the first argument, RARG (BP) is restored.
Diffstat (limited to 'sys/src/libc/power')
-rw-r--r--sys/src/libc/power/main9p.s1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/src/libc/power/main9p.s b/sys/src/libc/power/main9p.s
index 76723cc10..c3dbcf125 100644
--- a/sys/src/libc/power/main9p.s
+++ b/sys/src/libc/power/main9p.s
@@ -26,6 +26,7 @@ loop:
MOVW $_profin(SB), R3 /* force loading of profile */
BR loop
+TEXT _saveret(SB), 1, $0
TEXT _savearg(SB), 1, $0
RETURN