Skip to content

Commit

Permalink
x86: avoid clobbering ebx register during CPU detection (zherczeg#217)
Browse files Browse the repository at this point in the history
When building with PIC enabled the following error is observed:
sljit_src/sljitNativeX86_common.c:424:2: error: PIC register clobbered by ‘ebx’ in ‘asm’
  • Loading branch information
carenas committed Nov 13, 2023
1 parent 62c9160 commit c1cbaf0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sljit_src/sljitNativeX86_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,11 @@ static void execute_cpu_id(sljit_u32 info[4])
"movl %0, %%esi\n"
"movl (%%esi), %%eax\n"
"movl 8(%%esi), %%ecx\n"
"pushl %%ebx\n"
"cpuid\n"
"movl %%eax, (%%esi)\n"
"movl %%ebx, 4(%%esi)\n"
"popl %%ebx\n"
"movl %%ecx, 8(%%esi)\n"
"movl %%edx, 12(%%esi)\n"
#else /* !SLJIT_CONFIG_X86_32 */
Expand All @@ -444,7 +446,7 @@ static void execute_cpu_id(sljit_u32 info[4])
:
: "r" (info)
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
: "memory", "eax", "ebx", "ecx", "edx", "esi"
: "memory", "eax", "ecx", "edx", "esi"
#else /* !SLJIT_CONFIG_X86_32 */
: "memory", "rax", "rbx", "rcx", "rdx", "rsi"
#endif /* SLJIT_CONFIG_X86_32 */
Expand Down

0 comments on commit c1cbaf0

Please sign in to comment.