|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH for-4.19] x86/altcall: fix clang code-gen when using altcall in loop constructs
On 24.07.2024 10:28, Roger Pau Monné wrote:
> The only way I've found to cope with this is to use something like:
>
> #define ALT_CALL_ARG(arg, n) \
> union { \
> typeof(arg) e[(sizeof(long) + sizeof(arg) - 1) / sizeof(arg)]; \
> unsigned long r; \
> } a ## n ## __ = { \
> .e[0] = ({ BUILD_BUG_ON(sizeof(arg) > sizeof(void *)); (arg); })\
> }; \
> register unsigned long a ## n ## _ asm ( ALT_CALL_arg ## n ) = \
> a ## n ## __.r
>
> An oversized array that ensures all the space of the long is covered
> by the array, but then we need an extra variable, as we would
> otherwise require modifying ALT_CALL{0..6}_OUT to use aX_.r instead of
> aX_.
I don't think we need to over-size the array. It just gets yet a little
more complex then:
#define ALT_CALL_ARG(arg, n) \
register union { \
struct { \
typeof(arg) e; \
char pad[sizeof(long) - sizeof(arg)]; \
} s; \
unsigned long r; \
} a ## n ## _ asm ( ALT_CALL_arg ## n ) = { \
.s.e = ({ BUILD_BUG_ON(sizeof(arg) > sizeof(void *)); (arg); }) \
}
Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |