2.9
[glibc/nacl-glibc.git] / sysdeps / mach / hurd / powerpc / intr-msg.h
bloba3cb6ef7eab76cf70beb38bda27150a39178113b
1 /* Machine-dependent details of interruptible RPC messaging. PowerPC version.
2 Copyright (C) 1995,96,97,99,2001 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 " mr 3, %1\n" \
26 " mr 4, %2\n" \
27 " mr 5, %3\n" \
28 " mr 6, %4\n" \
29 " mr 7, %5\n" \
30 " mr 8, %6\n" \
31 " mr 9, %7\n" \
32 " li 0, -25\n" \
33 "_hurd_intr_rpc_msg_do_trap: sc\n" \
34 "_hurd_intr_rpc_msg_in_trap: mr 3, %0\n" \
35 : "=r" (err) \
36 : "r" (msg), "r" (option), "r" (send_size), "r" (rcv_size), \
37 "r" (rcv_name), "r" (timeout), "r" (notify) \
38 : "0", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"); \
39 err; \
42 static void inline
43 INTR_MSG_BACK_OUT (struct ppc_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)->srr0 - 4); \
54 int result; \
55 _hurdsig_catch_memory_fault (p) ? 0 : \
56 ({ \
57 if (result = (*p == 0x44000002)) \
58 /* The PC is just after an `sc' instruction. \
59 This is a system call in progress; %r0 holds the call number. */ \
60 *(callno) = (state)->r0; \
61 _hurdsig_end_catch_fault (); \
62 result; \
63 }); \
66 struct mach_msg_trap_args
68 /* This is the order of arguments to mach_msg_trap. */
69 mach_msg_header_t *msg;
70 mach_msg_option_t option;
71 mach_msg_size_t send_size;
72 mach_msg_size_t rcv_size;
73 mach_port_t rcv_name;
74 mach_msg_timeout_t timeout;
75 mach_port_t notify;
78 /* This cannot be an inline function because it calls setjmp. */
79 #define MSG_EXAMINE(state, msgid, rcv_name, send_name, option, timeout) \
80 ({ \
81 mach_msg_header_t *msg = (mach_msg_header_t *) (state)->r3; \
82 *(option) = (mach_msg_option_t) (state)->r4; \
83 *(rcv_name) = (mach_port_t) (state)->r7; \
84 *(timeout) = (mach_msg_timeout_t) (state)->r8; \
85 (msg == 0) ? \
86 ({ \
87 *(send_name) = MACH_PORT_NULL; \
88 *(msgid) = 0; \
89 0; \
90 }) : \
91 (_hurdsig_catch_memory_fault (msg) ? -1 : \
92 ({ \
93 *(send_name) = msg->msgh_remote_port; \
94 *(msgid) = msg->msgh_id; \
95 _hurdsig_end_catch_fault (); \
96 0; \
97 }) \
98 ); \