On 20/04/16 01:36, AKASHI Takahiro wrote: > On Tue, Apr 19, 2016 at 09:44:37AM +0300, Alexander Monakov wrote: >> On Tue, 19 Apr 2016, AKASHI Takahiro wrote: >>>> looking at [2] i don't see why >>>> >>>> func: >>>> mov x9, x30 >>>> bl _tracefunc >>>> <function body> >>> >>> Actually, >>> mov x9, x30 >>> bl _tracefunc >>> mov x30, x9 >>> <function body> >> >> I think here Szabolcs' point was that the last instruction can be eliminated: >> _tracefunc can be responsible for restoring x30, and can use x9 to return to >> its caller. It has a non-standard calling convention and needs to be >> implemented in assembly anyway. > > OK, but in _tracefunc, x30 has been updated, and so we should > return as follows: > mov xTMP, x30 > mov x30, x9 > ret xTMP > > We need one more temp register here... >
you have to save/restore x9 and x30 around the ftrace callback that is written in c anyway, so i think you don't need more registers, just restore from the stack differently. and the instrumentation code sequence should be optimized, not the trace function. > Thanks, > -Takahiro AKASHI > >> Alexander >