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 */
32 #ifdef CONFIG_GCC_FP_A6
36 #define CALLER_FRAME NULL
46 /* __builtin_frame_address(1) returns LR value. Perhaps not AAPCS-compatible. */
47 #define CALLER_FRAME ({void * _fp; asm volatile("ldr %0, [%%fp, #-4]":"=r"(_fp)); _fp;})
51 #error unsupported CPU type
55 #define CALLER_FRAME __builtin_frame_address(1)
75 #define CURRENT_LOCATION(name) {name, __builtin_return_address(0), CALLER_FRAME}
80 BOOL
PrepareContext(struct Task
*task
, APTR entryPoint
, APTR fallBack
,
81 const struct TagItem
*tagList
, struct ExecBase
*SysBase
);
83 BOOL
Exec_InitETask(struct Task
*task
, struct ExecBase
*SysBase
);
84 void Exec_CleanupETask(struct Task
*task
, struct ExecBase
*SysBase
);
85 void Exec_ExpungeETask(struct ETask
*et
, struct ExecBase
*SysBase
);
86 BOOL
Exec_ExpandTS(struct Task
*task
, struct ExecBase
*SysBase
);
87 struct ETask
*Exec_FindChild(ULONG id
, struct ExecBase
*SysBase
);
88 struct IntETask
*FindETask(struct List
*, ULONG id
, struct ExecBase
*SysBase
);
90 BOOL
Exec_CheckTask(struct Task
*task
, struct ExecBase
*SysBase
);
92 STRPTR
Alert_AddString(STRPTR dest
, CONST_STRPTR src
);
93 STRPTR
Alert_GetTitle(ULONG alertNum
);
94 STRPTR
Alert_GetString(ULONG alertnum
, STRPTR buf
);
95 STRPTR
FormatAlert(char *buffer
, ULONG alertNum
, struct Task
*task
, APTR location
, UBYTE type
, struct ExecBase
*SysBase
);
96 STRPTR
FormatTask(STRPTR buffer
, const char *text
, struct Task
*, struct ExecBase
*SysBase
);
97 STRPTR
FormatLocation(STRPTR buf
, const char *text
, APTR location
, struct ExecBase
*SysBase
);
99 void FormatAlertExtra(char *buffer
, APTR stack
, UBYTE type
, APTR data
, struct ExecBase
*SysBase
);
100 char *FormatCPUContext(char *buffer
, struct ExceptionContext
*ctx
, struct ExecBase
*SysBase
);
101 APTR
UnwindFrame(APTR fp
, APTR
*caller
);
103 void Exec_ExtAlert(ULONG alertNum
, APTR location
, APTR stack
, UBYTE type
, APTR data
, struct ExecBase
*SysBase
);
104 ULONG
Exec_UserAlert(ULONG alertNum
, struct ExecBase
*SysBase
);
105 void Exec_SystemAlert(ULONG alertNum
, APTR location
, APTR stack
, UBYTE type
, APTR data
, struct ExecBase
*SysBase
);
106 void Exec_DoResetCallbacks(struct IntExecBase
*SysBase
, UBYTE action
);
108 APTR
InternalRawDoFmt(CONST_STRPTR FormatString
, APTR DataStream
, VOID_FUNC PutChProc
,
109 APTR PutChData
, va_list VaListStream
);
111 IPTR
*InternalFindResident(const UBYTE
*name
, IPTR
*list
);
113 void FastPutMsg(struct MsgPort
*port
, struct Message
*message
, struct ExecBase
*SysBase
);
114 void InternalPutMsg(struct MsgPort
*port
, struct Message
*message
, struct ExecBase
*SysBase
);
116 LONG
AllocTaskSignal(struct Task
*ThisTask
, LONG signalNum
, struct ExecBase
*SysBase
);
118 static inline void InitMsgPort(struct MsgPort
*ret
)
120 /* Set port to type 'signalling' */
121 ret
->mp_Flags
= PA_SIGNAL
;
122 /* Set port to type MsgPort */
123 ret
->mp_Node
.ln_Type
= NT_MSGPORT
;
124 /* Clear the list of messages */
125 NEWLIST(&ret
->mp_MsgList
);
128 /* Pseudo-functions, including SysBase for nicer calling */
129 #define FindChild(i) Exec_FindChild(i,SysBase)
130 #define FindETask(l,i) Exec_FindETask(l,i,SysBase)
131 #define InitETask(t) Exec_InitETask(t,SysBase)
132 #define CleanupETask(t) Exec_CleanupETask(t,SysBase)
133 #define ExpungeETask(e) Exec_ExpungeETask(e,SysBase)
135 #endif /* _EXEC_UTIL_H */