2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
8 #include "exec_intern.h"
9 #include <aros/libcall.h>
10 #include <exec/ports.h>
11 #include <proto/exec.h>
13 /*****************************************************************************
17 AROS_LH1(void, ReplyMsg
,
20 AROS_LHA(struct Message
*, message
, A1
),
23 struct ExecBase
*, SysBase
, 63, Exec
)
26 Send a message back to where it came from. It's generally not
27 wise to access the fields of a message after it has been replied.
30 message - a message got with GetMsg().
41 WaitPort(), GetMsg(), PutMsg()
45 ******************************************************************************/
51 /* handle FASTCALL before doing locking or anything else. yes, there's a
52 * potential race here if some task was to change mn_ReplyPort before/as
53 * we read it. thats why we fetch it again further down, after Disable().
54 * all bets are of when using FASTCALL */
55 port
= message
->mn_ReplyPort
;
57 if (port
!= NULL
&& port
->mp_Flags
& PA_FASTCALL
)
59 if (port
->mp_SoftInt
== NULL
|| ((struct Interrupt
*) port
->mp_SoftInt
)->is_Code
== NULL
)
62 ASSERT_VALID_PTR(port
->mp_SoftInt
);
63 ASSERT_VALID_PTR(((struct Interrupt
*) port
->mp_SoftInt
)->is_Code
);
65 message
->mn_Node
.ln_Type
= NT_REPLYMSG
;
67 /* call the "interrupt" with the message as an argument */
68 AROS_UFC4(void, ((struct Interrupt
*) port
->mp_SoftInt
)->is_Code
,
69 AROS_UFCA(APTR
, ((struct Interrupt
*) port
->mp_SoftInt
)->is_Data
, A1
),
70 AROS_UFCA(ULONG_FUNC
, ((struct Interrupt
*) port
->mp_SoftInt
)->is_Code
, A5
),
71 AROS_UFCA(struct Message
*, message
, D0
),
72 AROS_UFCA(struct ExecBase
*, SysBase
, A6
));
77 /* Protect the message against access by other tasks. */
81 port
=message
->mn_ReplyPort
;
83 /* Not set? Only mark the message as no longer sent. */
85 message
->mn_Node
.ln_Type
=NT_FREEMSG
;
88 /* Mark the message as replied */
89 message
->mn_Node
.ln_Type
=NT_REPLYMSG
;
91 /* Add it to the replyport's list */
92 AddTail(&port
->mp_MsgList
,&message
->mn_Node
);
96 /* And trigger the arrival action. */
97 switch(port
->mp_Flags
&PF_ACTION
)
101 Signal((struct Task
*)port
->mp_SigTask
,1<<port
->mp_SigBit
);
105 /* Raise a software interrupt */
106 Cause((struct Interrupt
*)port
->mp_SoftInt
);
114 /* Call the function in mp_SigTask. */
115 AROS_UFC2(void, port
->mp_SigTask
,
116 AROS_UFCA(struct MsgPort
*, port
, D0
),
117 AROS_UFCA(struct ExecBase
*, SysBase
, A6
));