[PATCH 5/5] aarch64: Enable building the aarch64 cipher assembly for windows

Jussi Kivilinna jussi.kivilinna at iki.fi
Thu Mar 22 20:18:29 CET 2018


Hello,

On 22.03.2018 10:56, Martin Storsjö wrote:
> Don't require .type and .size in configure; we can make
> them optional via a preprocessor macro.
> 
> This is mostly a mechanical change, wrapping the .type and .size
> directives in an ELF() macro, with two actual manual changes
> (when targeting windows):
> - Don't load global symbols via a GOT (in chacha20)
> - Don't use the x18 register (in camellia); back up and restore x19
>   in the prologue/epilogue and use that instead (on windows only).
> 
> x18 is a platform specific register; on linux, it's free to be used
> by user code, while it's reserved for platform use on windows and
> darwin.
> 
...snip...
>  
> +#ifdef _WIN32
> +# define WIN(...) __VA_ARGS__
> +#else
> +# define WIN(...) /*_*/
> +#endif
> +
>  .text
>  
>  /* struct camellia_ctx: */
> @@ -55,12 +61,21 @@
>  #define RT0 w15
>  #define RT1 w16
>  #define RT2 w17
> +#ifdef _WIN32
> +#define RT3 w19
> +#else
>  #define RT3 w18
> +#endif
>  
>  #define xRT0 x15
>  #define xRT1 x16
>  #define xRT2 x17
> +#ifdef _WIN32
> +/* w18/x18 is reserved and can't be used on windows. */
> +#define xRT3 x19
> +#else
>  #define xRT3 x18
> +#endif
>  
Now that I know x18 is reserved for special purpose, I'd actually prefer
if x18 would be switched to x19 on linux too. So, no need for _WIN32 
ifdefs and WIN() macro.

-Jussi



More information about the Gcrypt-devel mailing list