(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
[glibc.git] / sysdeps / mach / hurd / mips / intr-msg.h
blob16c78972aca513ecfb8aaab668dff0f63da19398
1 /* Machine-dependent details of interruptible RPC messaging. Mips version.
2 Copyright (C) 1996, 1997 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. */
21 #ifdef __mips64
22 #define INTR_MSG_TRAP(msg, option, send_size, rcv_size, rcv_name, timeout, notify) \
23 ({ \
24 error_t err; \
25 mach_port_t __rcv_name = (rcv_name); \
26 mach_msg_timeout_t __timeout = (timeout); \
27 mach_port_t __notify = (notify); \
28 asm (".globl _hurd_intr_rpc_msg_do_trap\n" \
29 ".globl _hurd_intr_rpc_msg_in_trap\n" \
30 " move $4, %1\n" \
31 " move $5, %2\n" \
32 " move $6, %3\n" \
33 " move $7, %4\n" \
34 " move $8, %5\n" \
35 " move $9, %6\n" \
36 " move $10, %7\n" \
37 " dli $2, -25\n" \
38 "_hurd_intr_rpc_msg_do_trap: syscall\n" \
39 "_hurd_intr_rpc_msg_in_trap: move %0, $2\n" \
40 : "=r" (err) \
41 : "r" (msg), "r" (option), "r" (send_size), "r" (rcv_size), \
42 "r" (__rcv_name), "r" (__timeout), "r" (__notify) \
43 : "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10", \
44 "$11", "$12", "$13", "$14", "$15", "$24", "$25", "$28"); \
45 err; \
47 #else
48 #define INTR_MSG_TRAP(msg, option, send_size, rcv_size, rcv_name, timeout, notify) \
49 ({ \
50 error_t err; \
51 mach_port_t __rcv_name = (rcv_name); \
52 mach_msg_timeout_t __timeout = (timeout); \
53 mach_port_t __notify = (notify); \
54 asm (".globl _hurd_intr_rpc_msg_do_trap\n" \
55 ".globl _hurd_intr_rpc_msg_in_trap\n" \
56 " move $4, %1\n" \
57 " move $5, %2\n" \
58 " move $6, %3\n" \
59 " move $7, %4\n" \
60 " move $8, %5\n" \
61 " move $9, %6\n" \
62 " move $10, %7\n" \
63 " li $2, -25\n" \
64 "_hurd_intr_rpc_msg_do_trap: syscall\n" \
65 "_hurd_intr_rpc_msg_in_trap: move %0, $2\n" \
66 : "=r" (err) \
67 : "r" (msg), "r" (option), "r" (send_size), "r" (rcv_size), \
68 "r" (__rcv_name), "r" (__timeout), "r" (__notify) \
69 : "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10", \
70 "$11", "$12", "$13", "$14", "$15", "$24", "$25", "$28"); \
71 err; \
73 #endif
75 static inline void
76 INTR_MSG_BACK_OUT (struct mips_thread_state *state)
78 return;
81 #include "hurdfault.h"
83 static inline int
84 SYSCALL_EXAMINE (struct mips_thread_state *state, int *callno)
86 u_int32_t *p = (void *) (state->pc - 4);
87 int result;
88 if (_hurdsig_catch_memory_fault (p))
89 return 0;
90 if (result = (*p == 0x0000000c))
91 /* The PC is just after a `syscall' instruction.
92 This is a system call in progress; v0($2) holds the call number. */
93 *callno = state->r2;
94 _hurdsig_end_catch_fault ();
95 return result;
99 struct mach_msg_trap_args
101 /* This is the order of arguments to mach_msg_trap. */
102 mach_msg_header_t *msg;
103 mach_msg_option_t option;
104 mach_msg_size_t send_size;
105 mach_msg_size_t rcv_size;
106 mach_port_t rcv_name;
107 mach_msg_timeout_t timeout;
108 mach_port_t notify;
112 static inline mach_port_t
113 MSG_EXAMINE (struct mips_thread_state *state, int *msgid)
115 mach_msg_header_t *msg;
116 mach_port_t send_port;
118 msg = (mach_msg_header_t *) state->r4;
120 if (_hurdsig_catch_memory_fault (msg))
121 return MACH_PORT_NULL;
122 send_port = msg->msgh_remote_port;
123 *msgid = msg->msgh_id;
124 _hurdsig_end_catch_fault ();
126 return send_port;