mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-23 05:45:27 +00:00
Fixed assembly code for ARM (Thumb and regular) for some compilers
This commit is contained in:
parent
e81beda60f
commit
fb1cbd3cea
|
@ -7,6 +7,7 @@ Bugfix
|
||||||
128-bits (found by Yawning Angel)
|
128-bits (found by Yawning Angel)
|
||||||
* Fixes for 64-bit compilation with MS Visual Studio
|
* Fixes for 64-bit compilation with MS Visual Studio
|
||||||
* Fixed net_bind() for specified IP addresses on little endian systems
|
* Fixed net_bind() for specified IP addresses on little endian systems
|
||||||
|
* Fixed assembly code for ARM (Thumb and regular) for some compilers
|
||||||
|
|
||||||
Changes
|
Changes
|
||||||
* Internally split up rsa_pkcs1_encrypt(), rsa_pkcs1_decrypt(),
|
* Internally split up rsa_pkcs1_encrypt(), rsa_pkcs1_decrypt(),
|
||||||
|
|
|
@ -551,75 +551,97 @@
|
||||||
#if defined(__thumb__)
|
#if defined(__thumb__)
|
||||||
|
|
||||||
#define MULADDC_INIT \
|
#define MULADDC_INIT \
|
||||||
asm( "ldr r0, %0 " :: "m" (s)); \
|
asm( \
|
||||||
asm( "ldr r1, %0 " :: "m" (d)); \
|
" \
|
||||||
asm( "ldr r2, %0 " :: "m" (c)); \
|
ldr r0, %3; \
|
||||||
asm( "ldr r3, %0 " :: "m" (b)); \
|
ldr r1, %4; \
|
||||||
asm( "lsr r7, r3, #16 " ); \
|
ldr r2, %5; \
|
||||||
asm( "mov r9, r7 " ); \
|
ldr r3, %6; \
|
||||||
asm( "lsl r7, r3, #16 " ); \
|
lsr r7, r3, #16; \
|
||||||
asm( "lsr r7, r7, #16 " ); \
|
mov r9, r7; \
|
||||||
asm( "mov r8, r7 " );
|
lsl r7, r3, #16; \
|
||||||
|
lsr r7, r7, #16; \
|
||||||
|
mov r8, r7; \
|
||||||
|
"
|
||||||
|
|
||||||
#define MULADDC_CORE \
|
#define MULADDC_CORE \
|
||||||
asm( "ldmia r0!, {r6} " ); \
|
" \
|
||||||
asm( "lsr r7, r6, #16 " ); \
|
ldmia r0!, {r6}; \
|
||||||
asm( "lsl r6, r6, #16 " ); \
|
lsr r7, r6, #16; \
|
||||||
asm( "lsr r6, r6, #16 " ); \
|
lsl r6, r6, #16; \
|
||||||
asm( "mov r4, r8 " ); \
|
lsr r6, r6, #16; \
|
||||||
asm( "mul r4, r6 " ); \
|
mov r4, r8; \
|
||||||
asm( "mov r3, r9 " ); \
|
mul r4, r6; \
|
||||||
asm( "mul r6, r3 " ); \
|
mov r3, r9; \
|
||||||
asm( "mov r5, r9 " ); \
|
mul r6, r3; \
|
||||||
asm( "mul r5, r7 " ); \
|
mov r5, r9; \
|
||||||
asm( "mov r3, r8 " ); \
|
mul r5, r7; \
|
||||||
asm( "mul r7, r3 " ); \
|
mov r3, r8; \
|
||||||
asm( "lsr r3, r6, #16 " ); \
|
mul r7, r3; \
|
||||||
asm( "add r5, r5, r3 " ); \
|
lsr r3, r6, #16; \
|
||||||
asm( "lsr r3, r7, #16 " ); \
|
add r5, r5, r3; \
|
||||||
asm( "add r5, r5, r3 " ); \
|
lsr r3, r7, #16; \
|
||||||
asm( "add r4, r4, r2 " ); \
|
add r5, r5, r3; \
|
||||||
asm( "mov r2, #0 " ); \
|
add r4, r4, r2; \
|
||||||
asm( "adc r5, r2 " ); \
|
mov r2, #0; \
|
||||||
asm( "lsl r3, r6, #16 " ); \
|
adc r5, r2; \
|
||||||
asm( "add r4, r4, r3 " ); \
|
lsl r3, r6, #16; \
|
||||||
asm( "adc r5, r2 " ); \
|
add r4, r4, r3; \
|
||||||
asm( "lsl r3, r7, #16 " ); \
|
adc r5, r2; \
|
||||||
asm( "add r4, r4, r3 " ); \
|
lsl r3, r7, #16; \
|
||||||
asm( "adc r5, r2 " ); \
|
add r4, r4, r3; \
|
||||||
asm( "ldr r3, [r1] " ); \
|
adc r5, r2; \
|
||||||
asm( "add r4, r4, r3 " ); \
|
ldr r3, [r1]; \
|
||||||
asm( "adc r2, r5 " ); \
|
add r4, r4, r3; \
|
||||||
asm( "stmia r1!, {r4} " );
|
adc r2, r5; \
|
||||||
|
stmia r1!, {r4}; \
|
||||||
|
"
|
||||||
|
|
||||||
#define MULADDC_STOP \
|
#define MULADDC_STOP \
|
||||||
asm( "str r2, %0 " : "=m" (c)); \
|
" \
|
||||||
asm( "str r1, %0 " : "=m" (d)); \
|
str r2, %0; \
|
||||||
asm( "str r0, %0 " : "=m" (s) :: \
|
str r1, %1; \
|
||||||
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9" );
|
str r0, %2; \
|
||||||
|
" \
|
||||||
|
: "=m" (c), "=m" (d), "=m" (s) \
|
||||||
|
: "m" (s), "m" (d), "m" (c), "m" (b) \
|
||||||
|
: "r0", "r1", "r2", "r3", "r4", "r5", \
|
||||||
|
"r6", "r7", "r8", "r9" \
|
||||||
|
);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define MULADDC_INIT \
|
#define MULADDC_INIT \
|
||||||
asm( "ldr r0, %0 " :: "m" (s)); \
|
asm( \
|
||||||
asm( "ldr r1, %0 " :: "m" (d)); \
|
" \
|
||||||
asm( "ldr r2, %0 " :: "m" (c)); \
|
ldr r0, %3; \
|
||||||
asm( "ldr r3, %0 " :: "m" (b));
|
ldr r1, %4; \
|
||||||
|
ldr r2, %5; \
|
||||||
|
ldr r3, %6; \
|
||||||
|
"
|
||||||
|
|
||||||
#define MULADDC_CORE \
|
#define MULADDC_CORE \
|
||||||
asm( "ldr r4, [r0], #4 " ); \
|
" \
|
||||||
asm( "mov r5, #0 " ); \
|
ldr r4, [r0], #4; \
|
||||||
asm( "ldr r6, [r1] " ); \
|
mov r5, #0; \
|
||||||
asm( "umlal r2, r5, r3, r4 " ); \
|
ldr r6, [r1]; \
|
||||||
asm( "adds r7, r6, r2 " ); \
|
umlal r2, r5, r3, r4; \
|
||||||
asm( "adc r2, r5, #0 " ); \
|
adds r7, r6, r2; \
|
||||||
asm( "str r7, [r1], #4 " );
|
adc r2, r5, #0; \
|
||||||
|
str r7, [r1], #4; \
|
||||||
|
"
|
||||||
|
|
||||||
#define MULADDC_STOP \
|
#define MULADDC_STOP \
|
||||||
asm( "str r2, %0 " : "=m" (c)); \
|
" \
|
||||||
asm( "str r1, %0 " : "=m" (d)); \
|
str r2, %0; \
|
||||||
asm( "str r0, %0 " : "=m" (s) :: \
|
str r1, %1; \
|
||||||
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7" );
|
str r0, %2; \
|
||||||
|
" \
|
||||||
|
: "=m" (c), "=m" (d), "=m" (s) \
|
||||||
|
: "m" (s), "m" (d), "m" (c), "m" (b) \
|
||||||
|
: "r0", "r1", "r2", "r3", "r4", "r5", \
|
||||||
|
"r6", "r7" \
|
||||||
|
);
|
||||||
|
|
||||||
#endif /* Thumb */
|
#endif /* Thumb */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue