Hi. I'm reading up on soft interrupts and in particular those generated by Cause(). In the wiki there is a soft interrupt example using timer.device to generate a repeating software interrupt. However, the Interrupt structure contains a code as well as data pointer. As can also be given when allocating an Interrupt structure using ASOT_INTERRUPT.
But how to do you access this from within the interrupt and what is the prototype here? To add to the confusion there are other Interrupt structures that can be passed to other Exec routines, such as a low memory handler, which uses another specified prototype.
In particular IExec->Cause() lists no prototype for a soft interrupt. It is to my understanding this routine would be used internally by timer.device when used with a soft interrupt.
The example below demonstrates the use of a software interrupt. But it sets up a data pointer in the Interrupt structure and then doesn't even use it! It voids all parameters and doesn't return any flag. And then makes access to global variables in the main program. Though this looks convenient, even though I would avoid it, where does one find the data pointer?
http://wiki.amigaos.net/wiki/Exec_Interrupts
Is it the same prototype as from SetIntVector()? A lower level interrupt type but one that must have a return value. With that in mind this is all confusing! Can it be cleared up? Thanks.
For reference here but it looks like it operates at a lower level than a soft interrupt:
void interruptHandler(struct ExceptionContext *Context,
struct ExecBase *SysBase, void *UserData);
Prototype definition for soft interrupt is not specified
- colinw
- AmigaOS Core Developer
- Posts: 207
- Joined: Mon Aug 15, 2011 9:20 am
- Location: Brisbane, QLD. Australia.
Re: Prototype definition for soft interrupt is not specified
The softint is_Code() native function prototype is the same as shown in the AddIntServer() autodoc;
ULONG interruptHandler(struct ExceptionContext *Context, struct ExecBase *SysBase, void *UserData);
The "UserData" is the value from is_Data.
The "Context" is always NULL for a softint as far as I can tell.
The function is typed as ULONG but the returncode is unused.
ULONG interruptHandler(struct ExceptionContext *Context, struct ExecBase *SysBase, void *UserData);
The "UserData" is the value from is_Data.
The "Context" is always NULL for a softint as far as I can tell.
The function is typed as ULONG but the returncode is unused.
Re: Prototype definition for soft interrupt is not specified
Thanks colinw. I thought this might be the case that it followed the interruptHandler() prototype. Adding this information to Exec autodoc for Cause() would be beneficial. And other references to soft interrupts in general.