5 Copyright © 1995-2013, 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/arossupport.h>
19 #include "exec_intern.h"
21 /* PC and FP registers for various CPUs */
26 (__GNUC__ == 4 && (__GNUC_MINOR__ > 6 ))
27 #define CALLER_FRAME NULL
34 (__GNUC__ == 4 && (__GNUC_MINOR__ > 6 ))
35 #define CALLER_FRAME NULL
40 #ifdef CONFIG_GCC_FP_A6
44 #define CALLER_FRAME NULL
54 /* __builtin_frame_address(1) returns LR value. Perhaps not AAPCS-compatible. */
55 //#define CALLER_FRAME ({void * _fp; asm volatile("ldr %0, [%%fp, #-4]":"=r"(_fp)); _fp;})
56 #define CALLER_FRAME NULL
60 #error unsupported CPU type
64 #define CALLER_FRAME __builtin_frame_address(1)
84 #define CURRENT_LOCATION(name) {name, __builtin_return_address(0), CALLER_FRAME}
89 BOOL
PrepareContext(struct Task
*task
, APTR entryPoint
, APTR fallBack
,
90 const struct TagItem
*tagList
, struct ExecBase
*SysBase
);
92 BOOL
Exec_InitETask(struct Task
*task
, struct ExecBase
*SysBase
);
93 void Exec_CleanupETask(struct Task
*task
, struct ExecBase
*SysBase
);
94 void Exec_ExpungeETask(struct ETask
*et
, struct ExecBase
*SysBase
);
95 BOOL
Exec_ExpandTS(struct Task
*task
, struct ExecBase
*SysBase
);
96 struct ETask
*Exec_FindChild(ULONG id
, struct ExecBase
*SysBase
);
97 struct IntETask
*FindETask(struct List
*, ULONG id
, struct ExecBase
*SysBase
);
99 BOOL
Exec_CheckTask(struct Task
*task
, struct ExecBase
*SysBase
);
101 STRPTR
Alert_AddString(STRPTR dest
, CONST_STRPTR src
);
102 STRPTR
Alert_GetTitle(ULONG alertNum
);
103 STRPTR
Alert_GetString(ULONG alertnum
, STRPTR buf
);
104 STRPTR
FormatAlert(char *buffer
, ULONG alertNum
, struct Task
*task
, APTR location
, UBYTE type
, struct ExecBase
*SysBase
);
105 STRPTR
FormatTask(STRPTR buffer
, const char *text
, struct Task
*, struct ExecBase
*SysBase
);
106 STRPTR
FormatLocation(STRPTR buf
, const char *text
, APTR location
, struct ExecBase
*SysBase
);
108 void FormatAlertExtra(char *buffer
, APTR stack
, UBYTE type
, APTR data
, struct ExecBase
*SysBase
);
109 char *FormatCPUContext(char *buffer
, struct ExceptionContext
*ctx
, struct ExecBase
*SysBase
);
110 APTR
UnwindFrame(APTR fp
, APTR
*caller
);
112 void Exec_ExtAlert(ULONG alertNum
, APTR location
, APTR stack
, UBYTE type
, APTR data
, struct ExecBase
*SysBase
);
113 ULONG
Exec_UserAlert(ULONG alertNum
, struct ExecBase
*SysBase
);
114 void Exec_SystemAlert(ULONG alertNum
, APTR location
, APTR stack
, UBYTE type
, APTR data
, struct ExecBase
*SysBase
);
115 void Exec_DoResetCallbacks(struct IntExecBase
*SysBase
, UBYTE action
);
117 APTR
InternalRawDoFmt(CONST_STRPTR FormatString
, APTR DataStream
, VOID_FUNC PutChProc
,
118 APTR PutChData
, va_list VaListStream
);
120 IPTR
*InternalFindResident(const UBYTE
*name
, IPTR
*list
);
122 void FastPutMsg(struct MsgPort
*port
, struct Message
*message
, struct ExecBase
*SysBase
);
123 void InternalPutMsg(struct MsgPort
*port
, struct Message
*message
, struct ExecBase
*SysBase
);
125 LONG
AllocTaskSignal(struct Task
*ThisTask
, LONG signalNum
, struct ExecBase
*SysBase
);
127 static inline void InitMsgPort(struct MsgPort
*ret
)
129 /* Set port to type 'signalling' */
130 ret
->mp_Flags
= PA_SIGNAL
;
131 /* Set port to type MsgPort */
132 ret
->mp_Node
.ln_Type
= NT_MSGPORT
;
133 /* Clear the list of messages */
134 NEWLIST(&ret
->mp_MsgList
);
137 /* Pseudo-functions, including SysBase for nicer calling */
138 #define FindChild(i) Exec_FindChild(i,SysBase)
139 #define FindETask(l,i) Exec_FindETask(l,i,SysBase)
140 #define InitETask(t) Exec_InitETask(t,SysBase)
141 #define CleanupETask(t) Exec_CleanupETask(t,SysBase)
142 #define ExpungeETask(e) Exec_ExpungeETask(e,SysBase)
144 #endif /* _EXEC_UTIL_H */