Back to index

glibc  2.9
intr-msg.h
Go to the documentation of this file.
00001 /* Machine-dependent details of interruptible RPC messaging.  PowerPC version.
00002    Copyright (C) 1995,96,97,99,2001 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #define INTR_MSG_TRAP(msg, option, send_size, rcv_size, rcv_name, timeout, notify) \
00021 ({                                                             \
00022   error_t err;                                                        \
00023   asm (".globl _hurd_intr_rpc_msg_do_trap\n"                          \
00024        ".globl _hurd_intr_rpc_msg_in_trap\n"                          \
00025        "                           mr 3, %1\n"                 \
00026        "                           mr 4, %2\n"                 \
00027        "                           mr 5, %3\n"                 \
00028        "                           mr 6, %4\n"                 \
00029        "                           mr 7, %5\n"                 \
00030        "                           mr 8, %6\n"                 \
00031        "                           mr 9, %7\n"                 \
00032        "                           li 0, -25\n"                \
00033        "_hurd_intr_rpc_msg_do_trap:       sc\n"                       \
00034        "_hurd_intr_rpc_msg_in_trap:       mr 3, %0\n"                 \
00035        : "=r" (err)                                            \
00036        : "r" (msg), "r" (option), "r" (send_size), "r" (rcv_size),    \
00037         "r" (rcv_name), "r" (timeout), "r" (notify)                   \
00038        : "0", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12");   \
00039   err;                                                         \
00040 })
00041 
00042 static void inline
00043 INTR_MSG_BACK_OUT (struct ppc_thread_state *state)
00044 {
00045   return;
00046 }
00047 
00048 #include "hurdfault.h"
00049 
00050 /* This cannot be an inline function because it calls setjmp.  */
00051 #define SYSCALL_EXAMINE(state, callno)                                    \
00052 ({                                                                 \
00053   u_int32_t *p = (void *) ((state)->srr0 - 4);                            \
00054   int result;                                                      \
00055   _hurdsig_catch_memory_fault (p) ? 0 :                                   \
00056   ({                                                               \
00057     if (result = (*p == 0x44000002))                                      \
00058       /* The PC is just after an `sc' instruction.                        \
00059          This is a system call in progress; %r0 holds the call number.  */  \
00060       *(callno) = (state)->r0;                                            \
00061     _hurdsig_end_catch_fault ();                                   \
00062     result;                                                        \
00063   });                                                              \
00064 })
00065 
00066 struct mach_msg_trap_args
00067   {
00068     /* This is the order of arguments to mach_msg_trap.  */
00069     mach_msg_header_t *msg;
00070     mach_msg_option_t option;
00071     mach_msg_size_t send_size;
00072     mach_msg_size_t rcv_size;
00073     mach_port_t rcv_name;
00074     mach_msg_timeout_t timeout;
00075     mach_port_t notify;
00076   };
00077 
00078 /* This cannot be an inline function because it calls setjmp.  */
00079 #define MSG_EXAMINE(state, msgid, rcv_name, send_name, option, timeout)   \
00080 ({                                                               \
00081   mach_msg_header_t *msg = (mach_msg_header_t *) (state)->r3;           \
00082   *(option) = (mach_msg_option_t) (state)->r4;                          \
00083   *(rcv_name) = (mach_port_t) (state)->r7;                              \
00084   *(timeout) = (mach_msg_timeout_t) (state)->r8;                 \
00085   (msg == 0) ?                                                          \
00086     ({                                                           \
00087       *(send_name) = MACH_PORT_NULL;                                    \
00088       *(msgid) = 0;                                              \
00089       0;                                                         \
00090     }) :                                                         \
00091     (_hurdsig_catch_memory_fault (msg) ? -1 :                           \
00092        ({                                                        \
00093          *(send_name) = msg->msgh_remote_port;                          \
00094          *(msgid) = msg->msgh_id;                                \
00095          _hurdsig_end_catch_fault ();                                   \
00096          0;                                                      \
00097        })                                                        \
00098     );                                                           \
00099 })