From 2c5c78425516590e894c9c334182073fcc56a10b Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Mon, 17 Feb 2014 13:25:24 +0100 Subject: 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. --- sys/src/libc/mips/main9p.s | 1 + 1 file changed, 1 insertion(+) (limited to 'sys/src/libc/mips') diff --git a/sys/src/libc/mips/main9p.s b/sys/src/libc/mips/main9p.s index 135d07522..f70c649b8 100644 --- a/sys/src/libc/mips/main9p.s +++ b/sys/src/libc/mips/main9p.s @@ -25,6 +25,7 @@ loop: MOVW $_profin(SB), R0 /* force loading of profile */ JMP loop +TEXT _saveret(SB), 1, $0 TEXT _savearg(SB), 1, $0 RET -- cgit v1.2.3