mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-25 17:25:37 +01:00
Fix build errors on x32 by using the generic 'add' instruction
On x32 systems, pointers are 4-bytes wide and are therefore stored in %e?x registers (instead of %r?x registers). These registers must be accessed using "addl" instead of "addq", however the GNU assembler will acccept the generic "add" instruction and determine the correct opcode based on the registers passed to it.
This commit is contained in:
parent
207990dcf5
commit
6c8edca2d4
@ -100,7 +100,7 @@ int mbedtls_aesni_crypt_ecb( mbedtls_aes_context *ctx,
|
|||||||
asm( "movdqu (%3), %%xmm0 \n\t" // load input
|
asm( "movdqu (%3), %%xmm0 \n\t" // load input
|
||||||
"movdqu (%1), %%xmm1 \n\t" // load round key 0
|
"movdqu (%1), %%xmm1 \n\t" // load round key 0
|
||||||
"pxor %%xmm1, %%xmm0 \n\t" // round 0
|
"pxor %%xmm1, %%xmm0 \n\t" // round 0
|
||||||
"addq $16, %1 \n\t" // point to next round key
|
"add $16, %1 \n\t" // point to next round key
|
||||||
"subl $1, %0 \n\t" // normal rounds = nr - 1
|
"subl $1, %0 \n\t" // normal rounds = nr - 1
|
||||||
"test %2, %2 \n\t" // mode?
|
"test %2, %2 \n\t" // mode?
|
||||||
"jz 2f \n\t" // 0 = decrypt
|
"jz 2f \n\t" // 0 = decrypt
|
||||||
@ -108,7 +108,7 @@ int mbedtls_aesni_crypt_ecb( mbedtls_aes_context *ctx,
|
|||||||
"1: \n\t" // encryption loop
|
"1: \n\t" // encryption loop
|
||||||
"movdqu (%1), %%xmm1 \n\t" // load round key
|
"movdqu (%1), %%xmm1 \n\t" // load round key
|
||||||
AESENC xmm1_xmm0 "\n\t" // do round
|
AESENC xmm1_xmm0 "\n\t" // do round
|
||||||
"addq $16, %1 \n\t" // point to next round key
|
"add $16, %1 \n\t" // point to next round key
|
||||||
"subl $1, %0 \n\t" // loop
|
"subl $1, %0 \n\t" // loop
|
||||||
"jnz 1b \n\t"
|
"jnz 1b \n\t"
|
||||||
"movdqu (%1), %%xmm1 \n\t" // load round key
|
"movdqu (%1), %%xmm1 \n\t" // load round key
|
||||||
@ -118,7 +118,7 @@ int mbedtls_aesni_crypt_ecb( mbedtls_aes_context *ctx,
|
|||||||
"2: \n\t" // decryption loop
|
"2: \n\t" // decryption loop
|
||||||
"movdqu (%1), %%xmm1 \n\t"
|
"movdqu (%1), %%xmm1 \n\t"
|
||||||
AESDEC xmm1_xmm0 "\n\t" // do round
|
AESDEC xmm1_xmm0 "\n\t" // do round
|
||||||
"addq $16, %1 \n\t"
|
"add $16, %1 \n\t"
|
||||||
"subl $1, %0 \n\t"
|
"subl $1, %0 \n\t"
|
||||||
"jnz 2b \n\t"
|
"jnz 2b \n\t"
|
||||||
"movdqu (%1), %%xmm1 \n\t" // load round key
|
"movdqu (%1), %%xmm1 \n\t" // load round key
|
||||||
|
Loading…
Reference in New Issue
Block a user