Mercurial > pub > dyncall > dyncall
diff dyncallback/dyncall_thunk_arm32_arm.c @ 38:fb416abb2059
- armhf callback support (not all working, yet)
author | cslag |
---|---|
date | Fri, 18 Dec 2015 19:07:17 +0100 |
parents | 3e629dc19168 |
children |
line wrap: on
line diff
--- a/dyncallback/dyncall_thunk_arm32_arm.c Fri Dec 18 01:08:14 2015 +0100 +++ b/dyncallback/dyncall_thunk_arm32_arm.c Fri Dec 18 19:07:17 2015 +0100 @@ -35,12 +35,11 @@ ldr %r15, [%r15, #-4] */ - /* This code loads 'entry+8' into r15. The -4 is needed, because r15 as */ - /* program counter points to the current instruction+8, but the pointer */ - /* to the code to execute follows the ldr instruction directly. Add 8 to */ - /* entry for similar reasons. NOTE: Latter seems to be implicit with */ - /* latest update of arm-eabi tools. */ + /* This code stores a ptr to DCCallback in r12 (equals ptr to thunk, */ + /* which is PC (r15) minus 8, as PC points to current instruction+8. */ + /* Then it loads the callback 'entry' into PC. The -4 is needed, also bc */ + /* of the PC pointing ahead. */ p->code[0] = 0xe24fc008UL; /* sub %r12, %r15, #8 */ p->code[1] = 0xe51ff004UL; /* ldr %r15, [%r15, #-4] */ - p->entry = entry/*+8*/; + p->entry = entry; }