Prototype definition for soft interrupt is not specified

Report errors, omissions, etc. regarding the AmigaOS Documentation Wiki here.

Prototype definition for soft interrupt is not specified

Postby Hypex » Tue Jun 26, 2018 12:03 pm

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. :-D

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);
User avatar
Hypex
Beta Tester
Beta Tester
 
Posts: 366
Joined: Mon Dec 20, 2010 3:23 pm
Location: Vic. Australia.

Re: Prototype definition for soft interrupt is not specified

Postby colinw » Wed Jun 27, 2018 1:43 am

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.
User avatar
colinw
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 169
Joined: Mon Aug 15, 2011 10:20 am
Location: Brisbane, QLD. Australia.

Re: Prototype definition for soft interrupt is not specified

Postby Hypex » Wed Jun 27, 2018 7:42 am

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.
User avatar
Hypex
Beta Tester
Beta Tester
 
Posts: 366
Joined: Mon Dec 20, 2010 3:23 pm
Location: Vic. Australia.


Return to AmigaOS Documentation Wiki

Who is online

Users browsing this forum: No registered users and 1 guest