Mercurial > pub > dyncall > dyncall
comparison 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 |
comparison
equal
deleted
inserted
replaced
37:020ef1972d31 | 38:fb416abb2059 |
---|---|
33 .code 32 | 33 .code 32 |
34 sub %r12, %r15, #8 | 34 sub %r12, %r15, #8 |
35 ldr %r15, [%r15, #-4] | 35 ldr %r15, [%r15, #-4] |
36 */ | 36 */ |
37 | 37 |
38 /* This code loads 'entry+8' into r15. The -4 is needed, because r15 as */ | 38 /* This code stores a ptr to DCCallback in r12 (equals ptr to thunk, */ |
39 /* program counter points to the current instruction+8, but the pointer */ | 39 /* which is PC (r15) minus 8, as PC points to current instruction+8. */ |
40 /* to the code to execute follows the ldr instruction directly. Add 8 to */ | 40 /* Then it loads the callback 'entry' into PC. The -4 is needed, also bc */ |
41 /* entry for similar reasons. NOTE: Latter seems to be implicit with */ | 41 /* of the PC pointing ahead. */ |
42 /* latest update of arm-eabi tools. */ | |
43 p->code[0] = 0xe24fc008UL; /* sub %r12, %r15, #8 */ | 42 p->code[0] = 0xe24fc008UL; /* sub %r12, %r15, #8 */ |
44 p->code[1] = 0xe51ff004UL; /* ldr %r15, [%r15, #-4] */ | 43 p->code[1] = 0xe51ff004UL; /* ldr %r15, [%r15, #-4] */ |
45 p->entry = entry/*+8*/; | 44 p->entry = entry; |
46 } | 45 } |