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

ARM SVC instruction hook for armv4/netbsd emulation #376

Closed
lunixbochs opened this issue Jan 16, 2016 · 3 comments
Closed

ARM SVC instruction hook for armv4/netbsd emulation #376

lunixbochs opened this issue Jan 16, 2016 · 3 comments

Comments

@lunixbochs
Copy link
Contributor

The alternative is unconditionally decoding SVC in the interrupt 2 handler, but it's different between arm and thumb mode and I don't think there's even a good way to check that.

I partially implemented this and I might finish it as part of #375

This is what it looks like to decode yourself (without thumb support)

https://github.com/lunixbochs/usercorn/blob/5b69c01938609a217f2033755f5af0310e5786dc/go/arch/arm/linux.go#L81

@aquynh
Copy link
Member

aquynh commented Jan 16, 2016

but why NetBSD has anything to do here with our low-level OS-neutral hooking system?

currently UC_HOOK_INTR only supports X86, and we need to extend this to other archs.

@lunixbochs
Copy link
Contributor Author

I have NetBSD binaries which use this SVC form, as well as Linux at armv4l.

syscalls are working via the interrupt hook for Usercorn on ARM, MIPS, and x86, so I'm not sure what you mean by "UC_HOOK_INTR only supports X86"

The problem isn't the missing interrupt hook. SVC on ARM with any immediate value currently generates an INT 2, so I need to decode the value manually. The solution is adding a HOOK_INSN for SVC that passes the value for you.

@aquynh
Copy link
Member

aquynh commented Jan 16, 2016

oh yes sorry for the confusion, i mean UC_HOOK_INSN is still dependent on arch. UC_HOOK_INTR is fine because interrupts are handled in the same way, regardless of the arch.

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

No branches or pull requests

4 participants