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

Separate Interrupts and Callbacks. Make mouse CALL instruction explicit in memory #370

Merged
merged 1 commit into from
Jul 7, 2023

Conversation

kevinferrare
Copy link
Contributor

@kevinferrare kevinferrare commented Jul 7, 2023

Mistakenly merged #359 so here it is again.

Description of Changes

Make a clear distinction between Callbacks and Interrupt handlers:

  • Callbacks are C# code behind a custom ASM instruction
  • Interrupt handlers are C# classes that install themselves in memory as ASM, and that can rely on Callbacks to ensure their C# code is called from emulated ASM

Mouse interrupt handler now works like this:

// Responsible for Regs storage and setup. Does not change stack and CS:IP anymore.
CALLBACK 0x74
// User function address is written by CALLBACK 0x74
CALLF <User Function Address>
// Responsible for regs cleanup as before
CALLBACK 0x90
IRET
// Default user function, does nothing
RETF 

Had to change dumped json library because Newtonsoft one did not like SegmentedAddress having 2 constructors and was ignoring [JsonConstructor]

Example of the mouse handler int in ghidra (callback replaced by int because ghidra wouldnt understand):
image

@kevinferrare kevinferrare force-pushed the breakpoints_cleanup_and_speedup branch 2 times, most recently from 6ca631b to c45adc2 Compare July 7, 2023 17:02
@maximilien-noal maximilien-noal added refactoring Involves refactoring existing code callback Related to assembly callbacks into the emulator input Emulator input method support reverse engineering Related to reverse enginneering (features, APIs, ...) hardware hardware device (can be virtual) emulation code generation Related to generation of low level C# overrides of ASM code bugfix fixes a bug labels Jul 7, 2023
@maximilien-noal maximilien-noal removed the reverse engineering Related to reverse enginneering (features, APIs, ...) label Jul 7, 2023
@kevinferrare kevinferrare force-pushed the breakpoints_cleanup_and_speedup branch 3 times, most recently from 407c0cf to 74decbd Compare July 7, 2023 20:36
…emory and can put callback instructions. Callbacks are handled separately. Apply that to mouse driver to do a real far call instead of having the callback jump to the user handler. This will be useful for code generation, less magic. (#359)
@kevinferrare kevinferrare force-pushed the breakpoints_cleanup_and_speedup branch from 74decbd to 9ef241b Compare July 7, 2023 20:56
@kevinferrare kevinferrare merged commit 5b4ab19 into master Jul 7, 2023
@kevinferrare kevinferrare deleted the breakpoints_cleanup_and_speedup branch July 25, 2023 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix fixes a bug callback Related to assembly callbacks into the emulator code generation Related to generation of low level C# overrides of ASM code hardware hardware device (can be virtual) emulation input Emulator input method support refactoring Involves refactoring existing code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants