2.9
[glibc/nacl-glibc.git] / sysdeps / mach / hurd / alpha / intr-msg.h
blob4f172124e36d2dea7d7c39e8525551b8dbedf0b7
1 /* Machine-dependent details of interruptible RPC messaging. Alpha version.
2 Copyright (C) 2002 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
20 #define INTR_MSG_TRAP(msg, option, send_size, rcv_size, rcv_name, timeout, notify) \
21 ({ \
22 error_t err; \
23 asm (".globl _hurd_intr_rpc_msg_do_trap\n" \
24 ".globl _hurd_intr_rpc_msg_in_trap\n" \
25 " mov %1, $16\n" \
26 " mov %2, $17\n" \
27 " mov %3, $18\n" \
28 " mov %4, $19\n" \
29 " mov %5, $20\n" \
30 " mov %6, $21\n" \
31 " mov %7, $1\n" \
32 " lda $0, -25\n" \
33 "_hurd_intr_rpc_msg_do_trap: callsys\n" \
34 "_hurd_intr_rpc_msg_in_trap: ret\n" \
35 : "=r" (err) \
36 : "r" (msg), "r" (option), "r" (send_size), "r" (rcv_size), \
37 "r" (rcv_name), "r" (timeout), "r" (notify) \
38 : "16", "17", "18", "19", "20", "21", "1", "0"); \
39 err; \
42 static void inline
43 INTR_MSG_BACK_OUT (struct alpha_thread_state *state)
45 return;
48 #include "hurdfault.h"
50 /* This cannot be an inline function because it calls setjmp. */
51 #define SYSCALL_EXAMINE(state, callno) \
52 ({ \
53 u_int32_t *p = (void *) ((state)->pc - 4); \
54 int result; \
55 _hurdsig_catch_memory_fault (p) ? 0 : \
56 ({ \
57 result = (*p == 0x00000083); \
58 _hurdsig_end_catch_fault (); \
59 if (result) \
60 /* The PC is just after a `callsys' instruction. \
61 This is a system call in progress; v0 holds the call number. */ \
62 *(callno) = (state)->r0; \
63 result; \
64 }); \
67 struct mach_msg_trap_args
69 /* This is the order of arguments to mach_msg_trap. */
70 mach_msg_header_t *msg;
71 mach_msg_option_t option;
72 mach_msg_size_t send_size;
73 mach_msg_size_t rcv_size;
74 mach_port_t rcv_name;
75 mach_msg_timeout_t timeout;
76 mach_port_t notify;
79 /* This cannot be an inline function because it calls setjmp. */
80 #define MSG_EXAMINE(state, msgid, rcv_name, send_name, option, timeout) \
81 ({ \
82 mach_msg_header_t *msg = (mach_msg_header_t *) (state)->r16; \
83 *(option) = (mach_msg_option_t) (state)->r17; \
84 *(rcv_name) = (mach_port_t) (state)->r18; \
85 *(timeout) = (mach_msg_timeout_t) (state)->r19; \
86 (msg == 0) ? \
87 ({ \
88 *(send_name) = MACH_PORT_NULL; \
89 *(msgid) = 0; \
90 0; \
91 }) : \
92 (_hurdsig_catch_memory_fault (msg) ? -1 : \
93 ({ \
94 *(send_name) = msg->msgh_remote_port; \
95 *(msgid) = msg->msgh_id; \
96 _hurdsig_end_catch_fault (); \
97 0; \
98 }) \
99 ); \