5 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
8 Desc: Utility functions for exec.
12 #include <aros/asmcall.h>
13 #include <exec/types.h>
14 #include <utility/tagitem.h>
15 #include <proto/alib.h>
16 #include <proto/arossupport.h>
20 #include "exec_intern.h"
22 /* PC and FP registers for various CPUs */
33 #ifdef CONFIG_GCC_FP_A6
37 #define CALLER_FRAME NULL
47 /* __builtin_frame_address(1) returns LR value. Perhaps not AAPCS-compatible. */
48 #define CALLER_FRAME ({void * _fp; asm volatile("ldr %0, [%%fp, #-4]":"=r"(_fp)); _fp;})
52 #error unsupported CPU type
56 #define CALLER_FRAME __builtin_frame_address(1)
72 APTR
Exec_AllocTaskMem (struct Task
* task
, ULONG size
, ULONG flags
, struct ExecBase
*SysBase
);
73 void Exec_FreeTaskMem (struct Task
* task
, APTR mem
, struct ExecBase
*SysBase
);
75 void Exec_InitETask(struct Task
*task
, struct ETask
*etask
, struct ExecBase
*SysBase
);
76 void Exec_CleanupETask(struct Task
*task
, struct ETask
*et
, struct ExecBase
*SysBase
);
77 struct ETask
*Exec_FindChild(ULONG id
, struct ExecBase
*SysBase
);
78 struct IntETask
*FindETask(struct List
*, ULONG id
, struct ExecBase
*SysBase
);
80 BOOL
Exec_CheckTask(struct Task
*task
, struct ExecBase
*SysBase
);
82 STRPTR
Alert_AddString(STRPTR dest
, CONST_STRPTR src
);
83 STRPTR
Alert_GetTitle(ULONG alertNum
);
84 STRPTR
Alert_GetString(ULONG alertnum
, STRPTR buf
);
85 STRPTR
FormatAlert(char *buffer
, ULONG alertNum
, struct Task
*task
, APTR location
, UBYTE type
, struct ExecBase
*SysBase
);
86 STRPTR
FormatTask(STRPTR buffer
, const char *text
, struct Task
*, struct ExecBase
*SysBase
);
87 STRPTR
FormatLocation(STRPTR buf
, const char *text
, APTR location
, struct ExecBase
*SysBase
);
89 void FormatAlertExtra(char *buffer
, APTR stack
, UBYTE type
, APTR data
, struct ExecBase
*SysBase
);
90 char *FormatCPUContext(char *buffer
, struct ExceptionContext
*ctx
, struct ExecBase
*SysBase
);
91 APTR
UnwindFrame(APTR fp
, APTR
*caller
);
93 void Exec_ExtAlert(ULONG alertNum
, APTR location
, APTR stack
, UBYTE type
, APTR data
, struct ExecBase
*SysBase
);
94 ULONG
Exec_UserAlert(ULONG alertNum
, struct ExecBase
*SysBase
);
95 void Exec_SystemAlert(ULONG alertNum
, APTR location
, APTR stack
, UBYTE type
, APTR data
, struct ExecBase
*SysBase
);
96 void Exec_DoResetCallbacks(struct IntExecBase
*SysBase
);
98 APTR
InternalRawDoFmt(CONST_STRPTR FormatString
, APTR DataStream
, VOID_FUNC PutChProc
,
99 APTR PutChData
, va_list VaListStream
);
101 IPTR
*InternalFindResident(const UBYTE
*name
, IPTR
*list
);
103 void FastPutMsg(struct MsgPort
*port
, struct Message
*message
, struct ExecBase
*SysBase
);
104 void InternalPutMsg(struct MsgPort
*port
, struct Message
*message
, struct ExecBase
*SysBase
);
106 LONG
AllocTaskSignal(struct Task
*ThisTask
, LONG signalNum
, struct ExecBase
*SysBase
);
108 static inline void InitMsgPort(struct MsgPort
*ret
)
110 /* Set port to type 'signalling' */
111 ret
->mp_Flags
= PA_SIGNAL
;
112 /* Set port to type MsgPort */
113 ret
->mp_Node
.ln_Type
= NT_MSGPORT
;
114 /* Clear the list of messages */
115 NEWLIST(&ret
->mp_MsgList
);
119 * Pseudo-functions, including SysBase for nicer calling...
121 #define AllocTaskMem(t,s,f) Exec_AllocTaskMem(t,s,f,SysBase)
122 #define FreeTaskMem(t,m) Exec_FreeTaskMem(t,m,SysBase)
123 #define FindChild(i) Exec_FindChild(i,SysBase)
124 #define FindETask(l,i) Exec_FindETask(l,i,SysBase)
125 #define InitETask(t,e) Exec_InitETask(t,e,SysBase)
126 #define CleanupETask(t,e) Exec_CleanupETask(t,e,SysBase)
128 #endif /* _EXEC_UTIL_H */