-
Notifications
You must be signed in to change notification settings - Fork 8
Add #[entry]
, #[irq]
and #[exception(...)]
macros.
#33
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
Conversation
OK, I guess we can't set a default target for the whole repository. rebased without that. |
Uh, my re-entrant interrupt test is failing in CI, so I dropped that commit. It was unrelated to these changes anyway, so I'll fix it here and add it in another PR. |
Maybe |
Yeah, I take your point. But Arm doesn't distinguish between handling an IRQ and handling an Abort. They are all just jumps from the vector table, and they have the same banked register state. Is it worth creating a whole new macro just for the interrupt handler? |
I fixed the re-entrant interrupt handling. We need to preserve LR across the call to |
I added |
Force pushed with formatting fixed |
I tested the interrupt macro on the Zynq7000, seems to work fine. One more question: #[cortex_a_rt::exception(UndefinedHandler)]
fn my_handler(addr: usize) -> ! {
todo!();
} Is it possibly problematic to return the address like in the extern C function signature? |
Uh, the interrupt handler doesn't take an argument and also returns nothing - unlike the exception handlers (which take and return an address) and the SVCall handler (which takes the SVCall number and returns an empty tuple). I should check the documentation is clear on this. |
It provides the #[entry] and #[exception(FooHandler)] macros.
It can now handle a hi-prio SGI whilst in the middle of handling a low-prio SGI. This shows we got the asm interrupt handler's stacking code right (probably).
Now the re-entrant test works correctly.
* AbortHandler is now DataAbort * PrefetchHandler is now PrefetchAbort * UndefinedHandler is now Undefined * SvcHandler is now SupervisorCall I also renamed the asm handlers for abort and prefetch to data_abort and prefetch_abort, which makes it clearer that both are aborts and both are handled in abort mode. I also added links to the relevant part of the Arm Armv7 ARM. This patch also causes `#[exception(Nonsense)` to correctly identify 'Nonense' as the thing that is wrong, rather than the function that comes after the attribute.
#[entry]
and #[exception]
macros.#[entry]
, #[irq]
and #[exception(...)]
macros.
Rebased, and then revised again - hopefully adding clarity and readability. In particular, I now make clear there are "Prefetch Aborts" and "Data Aborts", both handled in ABT mode. I've left the handlers as safe functions, but I could be persuaded that the handlers that |
They should follow normal rules.
OK, here's what it's like if you require I think I prefer it this way? |
You shouldn't call them, so don't list them. Now the exception handlers match the main function.
Good to go? |
Yes, LGTM 👍 |
Adds:
#[entry]
#[exception(Undefined)]
#[exception(SupervisorCall)]
#[exception(PrefetchAbort)]
#[exception(DataAbort)]
#[irq]
(or#[exception(Irq)]
)You previously had to write:
Now you can write: