~ubuntu-branches/ubuntu/precise/eglibc/precise

« back to all changes in this revision

Viewing changes to ports/sysdeps/mach/hurd/alpha/intr-msg.h

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2011-10-04 17:48:26 UTC
  • mfrom: (216.1.23 oneiric)
  • Revision ID: package-import@ubuntu.com-20111004174826-2cyb9ewn3ucymlsx
Tags: 2.13-20ubuntu5
libc6-dev: Don't break the current {gnat,gcj}-4.4-base versons. LP: #853688.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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.
 
4
 
 
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.
 
9
 
 
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.
 
14
 
 
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.  */
 
19
 
 
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;                                                                  \
 
40
})
 
41
 
 
42
static void inline
 
43
INTR_MSG_BACK_OUT (struct alpha_thread_state *state)
 
44
{
 
45
  return;
 
46
}
 
47
 
 
48
#include "hurdfault.h"
 
49
 
 
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
  });                                                                       \
 
65
})
 
66
 
 
67
struct mach_msg_trap_args
 
68
  {
 
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;
 
77
  };
 
78
 
 
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
    );                                                                    \
 
100
})