void timer_interrupt(HIDDT_IRQ_Handler *irq, HIDDT_IRQ_HwInfo *hw) { struct IntVector *iv = irq->h_Data; if (iv->iv_Code) { /* Call it. I call with all these parameters for a reason. In my `Amiga ROM Kernel Reference Manual: Libraries and Devices' (the 1.3 version), interrupt servers are called with the following 5 parameters. D1 - Mask of INTENAR and INTREQR A0 - 0xDFF000 (base of custom chips) A1 - Interrupt Data A5 - Interrupt Code vector A6 - SysBase It is quite possible that some code uses all of these, so I must supply them here. Obviously I will dummy some of these though. */ AROS_UFC5(void, iv->iv_Code, AROS_UFCA(ULONG, 0, D1), AROS_UFCA(ULONG, 0, A0), AROS_UFCA(APTR, iv->iv_Data, A1), AROS_UFCA(APTR, iv->iv_Code, A5), AROS_UFCA(struct ExecBase *, hw->sysBase, A6) ); }
/* * This entry code is used by CreateNewProc(). It supposes that it calls * normal C code and follows AROS ABI conventions by putting SysBase into A6. * Note that it still needs to set pr_ReturnAddr. * pr_ReturnAddr value is used by AROS libc as program identifier (it is * supposed to contain a unique value per program). */ ULONG CallEntry(STRPTR argptr, ULONG argsize, LONG_FUNC entry, struct Process *me) { return AROS_UFC6(ULONG, AOS_CallEntry, AROS_UFCA(ULONG, argsize, D0), AROS_UFCA(STRPTR, argptr, A0), AROS_UFCA(APTR, me->pr_Task.tc_SPLower, A1), AROS_UFCA(APTR, me->pr_GlobVec, A2), AROS_UFCA(APTR, &me->pr_ReturnAddr, A3), AROS_UFCA(LONG_FUNC, entry, A4)); }
/************************************************************************** NAME */ LONG AROS_SLIB_ENTRY(RunProcess,Dos) ( /* SYNOPSIS */ struct Process * proc, struct StackSwapStruct * sss, STRPTR argptr, ULONG argsize, LONG_FUNC entry, struct DosLibrary * DOSBase) /* FUNCTION Sets the stack as specified and calls the routine with the given arguments. INPUTS proc - Process context sss - New Stack argptr - Pointer to argument string argsize - Size of the argument string entry - The entry point of the function DOSBase - Pointer to dos.library structure RESULT The return value of (*entry)(); NOTES EXAMPLE BUGS SEE ALSO INTERNALS **************************************************************************/ { ULONG * retptr; ULONG ret; APTR oldReturnAddr; register ULONG real_sp asm("r1"); ULONG *sp; ULONG *src; ULONG *dst; void *tmp; /* Get the real stack pointer */ asm volatile ("mr %0,%1":"=r"(sp):"r"(real_sp)); /* Go one stack frame upper - now src points to the stackframe of caller */ src = (ULONG*)*sp; /* Go one more stack frame up. Now you may copy from src to dst (src - sp) IPTR's */ src = (ULONG*)*src; dst = (ULONG*)((IPTR)sss->stk_Upper - SP_OFFSET); /* Rewind the dst pointer too. */ //dst += (src - sp); /* Copy the two stack frames */ while (src != sp) { *--dst = *--src; } sss->stk_Pointer = dst; retptr = &ret; oldReturnAddr = proc->pr_ReturnAddr; /* Compute argsize automatically */ if (argsize == -1) { argsize = strlen(argptr); } D(bug("In RunProcess() entry=%lx, *entry=%lx\n", (IPTR)entry, (IPTR)*entry)); D(bug("[sss] %08x %08x %08x\n", sss->stk_Lower, sss->stk_Pointer, sss->stk_Upper)); StackSwap(sss); D(bug("[sss] %08x %08x %08x\n", sss->stk_Lower, sss->stk_Pointer, sss->stk_Upper)); /* Call the function with the new stack */ /* We have to set the pr_ReturnAddr pointer to the correct value before we call the entry() otherwise some startup code will not work. This can be done rather more easily on the m68k than elsewhere. */ *retptr = AROS_UFC3R(ULONG, entry, AROS_UFCA(STRPTR, argptr, A0), AROS_UFCA(ULONG, argsize, D0), AROS_UFCA(struct ExecBase *, SysBase, A6), &proc->pr_ReturnAddr, (sss->stk_Upper - (ULONG)sss->stk_Lower) ); StackSwap(sss); D(bug("[sss] %08x %08x %08x\n", sss->stk_Lower, sss->stk_Pointer, sss->stk_Upper)); proc->pr_ReturnAddr = oldReturnAddr; return ret; }
string2, length, type)); DEBUG_STRNCMP(dprintf("StrnCmp: Function 0x%lx\n", IntL(locale)->il_LanguageFunctions[16])); #ifdef AROS_CALL4 Result = AROS_CALL4(ULONG, IntL(locale)->il_LanguageFunctions[16], AROS_LCA(CONST_STRPTR, string1, A1), AROS_LCA(CONST_STRPTR, string2, A2), AROS_LCA(ULONG, length, D0), AROS_LCA(ULONG, type, D1), struct LocaleBase *, LocaleBase); #else Result = AROS_UFC4(ULONG, IntL(locale)->il_LanguageFunctions[16], AROS_UFCA(CONST_STRPTR, string1, A1), AROS_UFCA(CONST_STRPTR, string2, A2), AROS_UFCA(ULONG, length, D0), AROS_UFCA(ULONG, type, D1)); #endif DEBUG_STRNCMP(dprintf("StrnCmp: retval %ld\n", Result)); return(Result); AROS_LIBFUNC_EXIT } /* StrnCmp */