Thread View: comp.sys.acorn.tech
2 messages
2 total messages
Started by Clive Jones
Sun, 27 Sep 1992 23:47
Disrupting program flow of control from interrupts
Author: Clive Jones
Date: Sun, 27 Sep 1992 23:47
Date: Sun, 27 Sep 1992 23:47
37 lines
2220 bytes
2220 bytes
I want to write a *safe* *tidy* routine that can, from interrupts, schedule a given procedure to be called instantly in a foreground program. The only assumptions I want to make are: My program is still the current Wimp task. My program adheres to ARM Procedure Call Standard. In other words, I can't guarantee that the interrupt that is triggering my code was raised while the processor was in user mode, not supervisor mode - if it happens while in supervisor mode, I want to wait for the operating system to become unthreaded before calling the routine. Basically, therefore, I want to: Store usr_LR onto the user mode stack Move the value the PC would otherwise have held immediately on user mode re-entry into usr_LR Ensure that the PC instead holds a value of my choosing immediately on re-entry. The tricky bit in this is getting at the PC value! The rest (stack R0-R3,LR, F0-F3, jump to the real routine I want to call, and on return unstack R0-R3, F0-F3 then simultaneously restore the old PC and LR) is comparatively easy. So far, the only way I can think of of doing this is for my interrupt routine to temporarily patch the IRQ and SWI hardware vectors to include a small veneer that does what I want. This ensures that I know the *precise* state of the registers for the various modes (the elusive PC value has just been moved to svc_LR for me by the ARM). I can't think of any way of getting the operating system to divulge the information - even the TaskWindow module seems to just save off the supervisor stack in its entirety rather than getting information such as this out of it! --Clive.
Re: Disrupting program flow of control from interrupts
Author: Brian Brunswick
Date: Tue, 06 Oct 1992 01:05
Date: Tue, 06 Oct 1992 01:05
9 lines
1173 bytes
1173 bytes
In article <1992Sep27.234759.24911@infodev.cam.ac.uk> crj10@phx.cam.ac.uk (Clive Jones) writes: >I want to write a *safe* *tidy* routine that can, from interrupts, >schedule a given procedure to be called instantly in a foreground >program. The only assumptions I want to make are: > My program is still the current Wimp task. > My program adheres to ARM Procedure Call Standard. Isn't this precisely what callbacks are for? Use OS=SetCallBack, presumably. Brian.Brunswick@cl.cam.ac.uk Disclaimer. Short sig rules!
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads