Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

get_thread_id() implementation throws SIGILL on my ARM CPU #326

Open
12932 opened this issue Feb 19, 2024 · 1 comment
Open

get_thread_id() implementation throws SIGILL on my ARM CPU #326

12932 opened this issue Feb 19, 2024 · 1 comment
Assignees

Comments

@12932
Copy link

12932 commented Feb 19, 2024

Hi, i've discovered that the implementation of get_thread_id() here https://github.com/mjansson/rpmalloc/blob/develop/rpmalloc/rpmalloc.c#L787-L818 doesn't appear to work on my hardware and I get SIGILL when using it:

# cat /proc/cpuinfo
Processor       : ARM926EJ-S rev 4 (v5l)
BogoMIPS        : 199.06
Features        : swp half thumb fastmult edsp java
CPU implementer : 0x41
CPU architecture: 5TEJ
CPU variant     : 0x0
CPU part        : 0x926
CPU revision    : 4

Using this implementation from another piece of software I get the following error, caught by GDB:

Program received signal SIGILL, Illegal instruction.
0x000f232c in tracy::get_thread_id() ()
(gdb)

And the offending asm appears to be:

0xf232c <_ZN5tracyL13get_thread_idEv+12>                mrc    15, 0, r3, cr13, cr0, {3}

Is it possible the problematic assembly isn't supported on my version of ARM?

@mjansson mjansson self-assigned this Mar 31, 2024
@mjansson
Copy link
Owner

Could you try changing the implementation of get_thread_id to return (uintptr_t)__builtin_thread_pointer(); instead and see if that compiles and work for your platform/arch?

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants