Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix emits killing lua on emitted interrupt #28

Merged

Conversation

DerelictDrone
Copy link
Member

@DerelictDrone DerelictDrone commented Dec 3, 2023

Currently from the main branch after #27, attempting to use the INT, SPG, CPG, SPP, CPP, SRL, and SMAP instructions may cause a lua error, relating to string.format of Dyn_EmitInterrupt expecting both arguments to be numbers(how naive of me)

In the case of INT, because it passes the string $1(macro for first operand of the instruction, which hasn't been replaced with the final name yet) to Dyn_EmitInterrupt()

In the case of the paging instructions listed, because they pass the string IDX as second argument to Dyn_EmitInterrupt().

@DerelictDrone
Copy link
Member Author

Still, this is an error we have right now that's affecting 7 instructions, it would be nice if we can get this merged since it's an issue that's user-facing.

@thegrb93
Copy link
Contributor

thegrb93 commented Dec 6, 2023

Is it possible to get a test that shows what all the possible values of intNo,intParam can be? To prove that injecting code into them isn't possible?

@DerelictDrone
Copy link
Member Author

DerelictDrone commented Dec 6, 2023

Is it possible to get a test that shows what all the possible values of intNo,intParam can be? To prove that injecting code into them isn't possible?

I don't know if this was necessarily what you were asking for, but see the written test here

Results I got:
image

Note that the last emitted interrupt has a $1 because that's the macro for operand 1, the CPU seems to be emitting interrupt 2 afterward because it ran out of instructions

@thegrb93
Copy link
Contributor

thegrb93 commented Dec 6, 2023

Can you add a comment stating that 'intNo' can only be numeric or '$1' and intParam can only be numeric or 'IDX'?

@DerelictDrone DerelictDrone merged commit ac69f02 into wiremod:master Dec 11, 2023
1 check failed
@DerelictDrone DerelictDrone deleted the fix-for-interrupts-post-emit branch January 1, 2024 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants