flat assembler
Message board for the users of flat assembler.

Index > Projects and Ideas > Transparent CPU instruction set emulation

Author
Thread Post new topic Reply to topic
Matrix



Joined: 04 Sep 2004
Posts: 1168
Location: Overflow
Matrix 14 Dec 2025, 03:29
Hello friends!

I have stumbled upon a new problem nowadays:
Question Let's say that you have a specific CPU from 2012 that lacks the specific AVX instruction set that a new program requires to run,

Idea Your options:

    Find another program
    Buy a new CPU
    Recompile the program if you have the source
    Emulate the missing instruction, using for example: INTEL SDE
    Cry in the corner
Post 14 Dec 2025, 03:29
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20792
Location: In your JS exploiting you and your system
revolution 14 Dec 2025, 03:49
This is what a lot of old software would do when the FPU was absent.

Catch illegal instruction exceptions, emulate them, continue execution.

It isn't hard, but it is tedious to get it all working correctly and seamlessly.
Post 14 Dec 2025, 03:49
View user's profile Send private message Visit poster's website Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1168
Location: Overflow
Matrix 14 Dec 2025, 04:12
Hey revolution!

Yeah, And it would be very cool if the kernel could do this automatically, for missing instructions if required.

I would also like to show a very cool opensource project related:
The Open-source PlayStation 3 Emulator

It has evolved over the recent years significantly.
Post 14 Dec 2025, 04:12
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20792
Location: In your JS exploiting you and your system
revolution 14 Dec 2025, 04:53
Matrix wrote:
Yeah, And it would be very cool if the kernel could do this automatically, for missing instructions if required.
Which kernel, which OS, is this intended for? I don't know of any existing kernel of any OS that will do this.

The most likely existing solution is a library that can be linked to. Maybe Linux has a library that can be injected with LD_PRELOAD? But that would require that the code uses the "standard" C interpreter and libraries.
Post 14 Dec 2025, 04:53
View user's profile Send private message Visit poster's website Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1168
Location: Overflow
Matrix 14 Dec 2025, 16:09
I was thinking about linux.

But right now it should be possible to start a cmd.exe or terminal using sde (as root) that will "emulate" instruction sets for the programs started within.

And decompile/recompile type emulation should be very fast, especially if it only replaces less than 1% of the program code, AVX for example with compatible instructions...
Post 14 Dec 2025, 16:09
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20792
Location: In your JS exploiting you and your system
revolution 14 Dec 2025, 19:25
Emulation code doesn't need to be root. An emulator program could start the target as a child process and "debug" it to catch illegal instruction exceptions.
Post 14 Dec 2025, 19:25
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.