Back to index

glibc  2.9
intr-msg.h
Go to the documentation of this file.
00001 /* Machine-dependent details of interruptible RPC messaging.  Alpha version.
00002    Copyright (C) 2002 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        "                           mov %1, $16\n"                     \
00026        "                           mov %2, $17\n"                     \
00027        "                           mov %3, $18\n"                     \
00028        "                           mov %4, $19\n"                     \
00029        "                           mov %5, $20\n"                     \
00030        "                           mov %6, $21\n"                     \
00031        "                           mov %7, $1\n"               \
00032        "                           lda $0, -25\n"                     \
00033        "_hurd_intr_rpc_msg_do_trap:       callsys\n"                  \
00034        "_hurd_intr_rpc_msg_in_trap:       ret\n"                      \
00035        : "=r" (err)                                            \
00036        : "r" (msg), "r" (option), "r" (send_size), "r" (rcv_size),    \
00037         "r" (rcv_name), "r" (timeout), "r" (notify)                   \
00038        : "16", "17", "18", "19", "20", "21", "1", "0");               \
00039   err;                                                         \
00040 })
00041 
00042 static void inline
00043 INTR_MSG_BACK_OUT (struct alpha_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)->pc - 4);                              \
00054   int result;                                                      \
00055   _hurdsig_catch_memory_fault (p) ? 0 :                                   \
00056   ({                                                               \
00057     result = (*p == 0x00000083);                                   \
00058     _hurdsig_end_catch_fault ();                                   \
00059     if (result)                                                           \
00060       /* The PC is just after a `callsys' instruction.                    \
00061          This is a system call in progress; v0 holds the call number.  */   \
00062       *(callno) = (state)->r0;                                            \
00063     result;                                                        \
00064   });                                                              \
00065 })
00066 
00067 struct mach_msg_trap_args
00068   {
00069     /* This is the order of arguments to mach_msg_trap.  */
00070     mach_msg_header_t *msg;
00071     mach_msg_option_t option;
00072     mach_msg_size_t send_size;
00073     mach_msg_size_t rcv_size;
00074     mach_port_t rcv_name;
00075     mach_msg_timeout_t timeout;
00076     mach_port_t notify;
00077   };
00078 
00079 /* This cannot be an inline function because it calls setjmp.  */
00080 #define MSG_EXAMINE(state, msgid, rcv_name, send_name, option, timeout)   \
00081 ({                                                               \
00082   mach_msg_header_t *msg = (mach_msg_header_t *) (state)->r16;          \
00083   *(option) = (mach_msg_option_t) (state)->r17;                         \
00084   *(rcv_name) = (mach_port_t) (state)->r18;                             \
00085   *(timeout) = (mach_msg_timeout_t) (state)->r19;                       \
00086   (msg == 0) ?                                                          \
00087     ({                                                           \
00088       *(send_name) = MACH_PORT_NULL;                                    \
00089       *(msgid) = 0;                                              \
00090       0;                                                         \
00091     }) :                                                         \
00092     (_hurdsig_catch_memory_fault (msg) ? -1 :                           \
00093        ({                                                        \
00094          *(send_name) = msg->msgh_remote_port;                          \
00095          *(msgid) = msg->msgh_id;                                \
00096          _hurdsig_end_catch_fault ();                                   \
00097          0;                                                      \
00098        })                                                        \
00099     );                                                           \
00100 })