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

Add interrupt handler registration #9

Open
Yuan-Mao opened this issue Feb 15, 2022 · 1 comment
Open

Add interrupt handler registration #9

Yuan-Mao opened this issue Feb 15, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@Yuan-Mao
Copy link
Contributor

Hi, I wonder if it would be useful if we could add some mechanism for users to register their custom interrupt handlers?

Current implementation has no such flexibility and it only implements interrupt handler for illegal instruction emulation. If users want to add other handlers they will have to touch the perch code, or they will have to rewrite the entire code again.

Maybe we can do the following extension: we add an array of function pointers for different causes of interrupt. They can initially point to some default handler, for example unhandled_trap. The illegal instruction emulation interrupt handler that is already in the repo can continue to be the default handler for the illegal instruction exception.

At least in my use case, I will need both the emulation code already in perch and my own custom S-mode interrupt handler for the Ethernet thing.

Thanks!

@dpetrisko
Copy link
Collaborator

Sounds good to me. At some level, this is better left to something like OpenSBI. But an array of weak handlers initially pointing to unhandled_exception is pretty flexible.

@dpetrisko dpetrisko added the enhancement New feature or request label Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants