You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since there is no division instruction in ARM, the compiler tries to resolve it with a function, but when the function is defined with a function pointer, the compiler issues bl to the address of the function pointer in the data address. so it crashes by Prefetch abort excption.
// 0x81000000 for text addressuint64_ttest_div(uint64_ta, uint64_tb){
returna / b;
}
// 0x81001000 for text address// __aeabi_uldivmod was get function pointer by somehowuint64_t (*__aeabi_uldivmod)(uint64_ta, uint64_tb);
Compiling this (^) code will give you the following assembly
test_div:
push {lr}
bl #0x81001000
// and some...
pop {pc}
But the correct code is:
test_div:
push {ip, lr}
movw ip, #:lower16:__aeabi_uldivmod
movt ip, #:upper16:__aeabi_uldivmod
ldr ip, [ip]
blx ip
// and some...
pop {pc}
So for some reason we have to devise a definition for the compiler function.
Since there is no division instruction in ARM, the compiler tries to resolve it with a function, but when the function is defined with a function pointer, the compiler issues bl to the address of the function pointer in the data address. so it crashes by Prefetch abort excption.
Compile environment
example
Compiling this (^) code will give you the following assembly
But the correct code is:
So for some reason we have to devise a definition for the compiler function.
Like
The text was updated successfully, but these errors were encountered: