News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

asm("int3"); /*trap*/ query

Started by Wkerry, February 01, 2025, 02:20:32 AM

Previous topic - Next topic

Wkerry

In the code there are a few of the following calls:
asm("int3"); /*trap*/

This works for x86 based CPU's, but when I use google to check what the arm equivalent it is not the same.

I have seen some historical posts of people building C::B on a RPi. As such it may be an idea to add protection around the asm("int3"); for x86 CPU's only and add support for ARM so that in the future when/if C::B does officially support running on RPi or other ARM SBC's/PC's then the code should hopefully then require less changes.

Pecan

Quote from: Wkerry on February 01, 2025, 02:20:32 AM
In the code there are a few of the following calls:
asm("int3"); /*trap*/

This works for x86 based CPU's, but when I use google to check what the arm equivalent it is not the same.

I have seen some historical posts of people building C::B on a RPi. As such it may be an idea to add protection around the asm("int3"); for x86 CPU's only and add support for ARM so that in the future when/if C::B does officially support running on RPi or other ARM SBC's/PC's then the code should hopefully then require less changes.

Which code do you see the int3's in that are unprotected?

ollydbg

Hi, Pecan, my guess is that your recent to commits have some code change related to the "int3" instruction.

Maybe, we can find a way for both X86 based CPU and ARM based CPU.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Wkerry

It was in the latest SVN change, but I am 1000% confident the same int 3 is in other places as I have included it in apps I have done where I enable it in a debug build.

This is some thing to thin about when you see an "int 3".

Pecan

Quote from: Wkerry on February 01, 2025, 10:42:31 AM
It was in the latest SVN change, but I am 1000% confident the same int 3 is in other places as I have included it in apps I have done where I enable it in a debug build.

This is some thing to thin about when you see an "int 3".

All use of "int3" has been commented out. SVN revision 13608

Wkerry


reckless

#if defined(__i386__) || defined(__x86_64__)
  __asm__ __volatile__("int {$}3":);
#elif defined(__arm__)
  __asm__ __volatile__("udf #0xfe");
#elif defined(__aarch64__)
  __asm__ __volatile__("brk #0xf000");
#else
  __asm__ __volatile__("unimplemented");
#endif


this should cover it if you need it again.