* sysdeps/mach/hurd/alpha/trampoline.c: Don't include
<mach/machine/alpha_instruction.h>. (_hurd_setup_sighandler): Take proper arguments for current decls. Update code to use _hurdsig_catch_fault. Use `callsys' instruction instead of `call_pal'. * sysdeps/mach/hurd/alpha/intr-msg.h: New file. * sysdeps/mach/alpha/sysdep.h: Include <mach/alpha/asm.h>. (ALIGN, at, AT, fp): New macros.
This commit is contained in:
parent
7ce93726fb
commit
f899db6094
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
2002-04-07 Roland McGrath <roland@frob.com>
|
||||||
|
|
||||||
|
* sysdeps/mach/hurd/alpha/trampoline.c: Don't include
|
||||||
|
<mach/machine/alpha_instruction.h>.
|
||||||
|
(_hurd_setup_sighandler): Take proper arguments for current decls.
|
||||||
|
Update code to use _hurdsig_catch_fault.
|
||||||
|
Use `callsys' instruction instead of `call_pal'.
|
||||||
|
* sysdeps/mach/hurd/alpha/intr-msg.h: New file.
|
||||||
|
|
||||||
|
* sysdeps/mach/alpha/sysdep.h: Include <mach/alpha/asm.h>.
|
||||||
|
(ALIGN, at, AT, fp): New macros.
|
||||||
|
|
||||||
2002-04-06 Roland McGrath <roland@frob.com>
|
2002-04-06 Roland McGrath <roland@frob.com>
|
||||||
|
|
||||||
* mach/setup-thread.c (__mach_setup_thread): int -> natural_t
|
* mach/setup-thread.c (__mach_setup_thread): int -> natural_t
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
|
/* Copyright (C) 1994,97,2002 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
@ -34,8 +34,17 @@
|
||||||
asm volatile ("mov %0,$30; jmp $31, (%1); ldgp $29, 0(%1)" \
|
asm volatile ("mov %0,$30; jmp $31, (%1); ldgp $29, 0(%1)" \
|
||||||
: : "r" (__sp), "r" (__fn)); })
|
: : "r" (__sp), "r" (__fn)); })
|
||||||
|
|
||||||
#define ENTRY(name) LEAF(name, ***loser no arg count***)
|
|
||||||
|
|
||||||
#define STACK_GROWTH_DOWN
|
#define STACK_GROWTH_DOWN
|
||||||
|
|
||||||
|
#define RETURN_TO(sp, pc, retval) \
|
||||||
|
asm volatile ("mov %0,$30; jmp $31, (%1); mov %2,$0" \
|
||||||
|
: : "r" (sp), "r" (pc), "r" ((long int) (retval)));
|
||||||
|
|
||||||
|
#define ALIGN 3
|
||||||
#include <sysdeps/mach/sysdep.h>
|
#include <sysdeps/mach/sysdep.h>
|
||||||
|
|
||||||
|
#include <mach/alpha/asm.h>
|
||||||
|
#undef at
|
||||||
|
#define at 28
|
||||||
|
#define AT $28
|
||||||
|
#define fp s6
|
||||||
|
|
|
@ -0,0 +1,100 @@
|
||||||
|
/* Machine-dependent details of interruptible RPC messaging. Alpha version.
|
||||||
|
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with the GNU C Library; if not, write to the Free
|
||||||
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||||
|
02111-1307 USA. */
|
||||||
|
|
||||||
|
#define INTR_MSG_TRAP(msg, option, send_size, rcv_size, rcv_name, timeout, notify) \
|
||||||
|
({ \
|
||||||
|
error_t err; \
|
||||||
|
asm (".globl _hurd_intr_rpc_msg_do_trap\n" \
|
||||||
|
".globl _hurd_intr_rpc_msg_in_trap\n" \
|
||||||
|
" mov %1, $16\n" \
|
||||||
|
" mov %2, $17\n" \
|
||||||
|
" mov %3, $18\n" \
|
||||||
|
" mov %4, $19\n" \
|
||||||
|
" mov %5, $20\n" \
|
||||||
|
" mov %6, $21\n" \
|
||||||
|
" mov %7, $1\n" \
|
||||||
|
" lda $0, -25\n" \
|
||||||
|
"_hurd_intr_rpc_msg_do_trap: callsys\n" \
|
||||||
|
"_hurd_intr_rpc_msg_in_trap: ret\n" \
|
||||||
|
: "=r" (err) \
|
||||||
|
: "r" (msg), "r" (option), "r" (send_size), "r" (rcv_size), \
|
||||||
|
"r" (rcv_name), "r" (timeout), "r" (notify) \
|
||||||
|
: "16", "17", "18", "19", "20", "21", "1", "0"); \
|
||||||
|
err; \
|
||||||
|
})
|
||||||
|
|
||||||
|
static void inline
|
||||||
|
INTR_MSG_BACK_OUT (struct alpha_thread_state *state)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "hurdfault.h"
|
||||||
|
|
||||||
|
/* This cannot be an inline function because it calls setjmp. */
|
||||||
|
#define SYSCALL_EXAMINE(state, callno) \
|
||||||
|
({ \
|
||||||
|
u_int32_t *p = (void *) ((state)->pc - 4); \
|
||||||
|
int result; \
|
||||||
|
_hurdsig_catch_memory_fault (p) ? 0 : \
|
||||||
|
({ \
|
||||||
|
result = (*p == 0x00000083); \
|
||||||
|
_hurdsig_end_catch_fault (); \
|
||||||
|
if (result) \
|
||||||
|
/* The PC is just after a `callsys' instruction. \
|
||||||
|
This is a system call in progress; v0 holds the call number. */ \
|
||||||
|
*(callno) = (state)->r0; \
|
||||||
|
result; \
|
||||||
|
}); \
|
||||||
|
})
|
||||||
|
|
||||||
|
struct mach_msg_trap_args
|
||||||
|
{
|
||||||
|
/* This is the order of arguments to mach_msg_trap. */
|
||||||
|
mach_msg_header_t *msg;
|
||||||
|
mach_msg_option_t option;
|
||||||
|
mach_msg_size_t send_size;
|
||||||
|
mach_msg_size_t rcv_size;
|
||||||
|
mach_port_t rcv_name;
|
||||||
|
mach_msg_timeout_t timeout;
|
||||||
|
mach_port_t notify;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* This cannot be an inline function because it calls setjmp. */
|
||||||
|
#define MSG_EXAMINE(state, msgid, rcv_name, send_name, option, timeout) \
|
||||||
|
({ \
|
||||||
|
mach_msg_header_t *msg = (mach_msg_header_t *) (state)->r16; \
|
||||||
|
*(option) = (mach_msg_option_t) (state)->r17; \
|
||||||
|
*(rcv_name) = (mach_port_t) (state)->r18; \
|
||||||
|
*(timeout) = (mach_msg_timeout_t) (state)->r19; \
|
||||||
|
(msg == 0) ? \
|
||||||
|
({ \
|
||||||
|
*(send_name) = MACH_PORT_NULL; \
|
||||||
|
*(msgid) = 0; \
|
||||||
|
0; \
|
||||||
|
}) : \
|
||||||
|
(_hurdsig_catch_memory_fault (msg) ? -1 : \
|
||||||
|
({ \
|
||||||
|
*(send_name) = msg->msgh_remote_port; \
|
||||||
|
*(msgid) = msg->msgh_id; \
|
||||||
|
_hurdsig_end_catch_fault (); \
|
||||||
|
0; \
|
||||||
|
}) \
|
||||||
|
); \
|
||||||
|
})
|
|
@ -1,5 +1,5 @@
|
||||||
/* Set thread_state for sighandler, and sigcontext to recover. Alpha version.
|
/* Set thread_state for sighandler, and sigcontext to recover. Alpha version.
|
||||||
Copyright (C) 1994, 1995, 1997, 1998 Free Software Foundation, Inc.
|
Copyright (C) 1994,95,97,98,2002 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
#include <hurd/signal.h>
|
#include <hurd/signal.h>
|
||||||
#include "thread_state.h"
|
#include "thread_state.h"
|
||||||
#include <mach/machine/alpha_instruction.h>
|
|
||||||
#include "hurdfault.h"
|
#include "hurdfault.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
@ -38,9 +37,8 @@ struct mach_msg_trap_args
|
||||||
|
|
||||||
struct sigcontext *
|
struct sigcontext *
|
||||||
_hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
|
_hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
|
||||||
int signo, long int sigcode,
|
int signo, struct hurd_signal_detail *detail,
|
||||||
int rpc_wait,
|
int rpc_wait, struct machine_thread_all_state *state)
|
||||||
struct machine_thread_all_state *state)
|
|
||||||
{
|
{
|
||||||
__label__ trampoline, rpc_wait_trampoline;
|
__label__ trampoline, rpc_wait_trampoline;
|
||||||
void *sigsp;
|
void *sigsp;
|
||||||
|
@ -51,10 +49,7 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
|
||||||
/* We have a previous sigcontext that sigreturn was about
|
/* We have a previous sigcontext that sigreturn was about
|
||||||
to restore when another signal arrived. We will just base
|
to restore when another signal arrived. We will just base
|
||||||
our setup on that. */
|
our setup on that. */
|
||||||
if (_hurdsig_catch_fault (SIGSEGV))
|
if (! _hurdsig_catch_memory_fault (ss->context))
|
||||||
assert (_hurdsig_fault_sigcode >= (long int) ss->context &&
|
|
||||||
_hurdsig_fault_sigcode < (long int) (ss->context + 1));
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
memcpy (&state->basic, &ss->context->sc_alpha_thread_state,
|
memcpy (&state->basic, &ss->context->sc_alpha_thread_state,
|
||||||
sizeof (state->basic));
|
sizeof (state->basic));
|
||||||
|
@ -79,6 +74,8 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
|
||||||
later. */
|
later. */
|
||||||
ss->intr_port = ss->context->sc_intr_port;
|
ss->intr_port = ss->context->sc_intr_port;
|
||||||
}
|
}
|
||||||
|
_hurdsig_end_catch_fault ();
|
||||||
|
|
||||||
/* If the sigreturn context was bogus, just ignore it. */
|
/* If the sigreturn context was bogus, just ignore it. */
|
||||||
ss->context = NULL;
|
ss->context = NULL;
|
||||||
}
|
}
|
||||||
|
@ -101,10 +98,8 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
|
||||||
sigsp -= sizeof (*scp);
|
sigsp -= sizeof (*scp);
|
||||||
scp = sigsp;
|
scp = sigsp;
|
||||||
|
|
||||||
if (_hurdsig_catch_fault (SIGSEGV))
|
if (_hurdsig_catch_memory_fault (scp))
|
||||||
{
|
{
|
||||||
assert (_hurdsig_fault_sigcode >= (long int) scp &&
|
|
||||||
_hurdsig_fault_sigcode < (long int) (scp + 1));
|
|
||||||
/* We got a fault trying to write the stack frame.
|
/* We got a fault trying to write the stack frame.
|
||||||
We cannot set up the signal handler.
|
We cannot set up the signal handler.
|
||||||
Returning NULL tells our caller, who will nuke us with a SIGILL. */
|
Returning NULL tells our caller, who will nuke us with a SIGILL. */
|
||||||
|
@ -137,6 +132,8 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
|
||||||
&scp->sc_alpha_float_state,
|
&scp->sc_alpha_float_state,
|
||||||
sizeof (state->fpu)))
|
sizeof (state->fpu)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
_hurdsig_end_catch_fault ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Modify the thread state to call the trampoline code on the new stack. */
|
/* Modify the thread state to call the trampoline code on the new stack. */
|
||||||
|
@ -176,14 +173,14 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
|
||||||
($16..$21, $1). Pass the handler args to the trampoline code in
|
($16..$21, $1). Pass the handler args to the trampoline code in
|
||||||
t8..t10 ($22.$24). */
|
t8..t10 ($22.$24). */
|
||||||
state->basic.r22 = signo;
|
state->basic.r22 = signo;
|
||||||
state->basic.r23 = sigcode;
|
state->basic.r23 = detail->code;
|
||||||
state->basic.r24 = (long int) scp;
|
state->basic.r24 = (long int) scp;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
state->basic.pc = (long int) &&trampoline;
|
state->basic.pc = (long int) &&trampoline;
|
||||||
state->basic.r16 = signo;
|
state->basic.r16 = signo;
|
||||||
state->basic.r17 = sigcode;
|
state->basic.r17 = detail->code;
|
||||||
state->basic.r18 = (long int) scp;
|
state->basic.r18 = (long int) scp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +209,7 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
|
||||||
asm volatile
|
asm volatile
|
||||||
(/* Retry the interrupted mach_msg system call. */
|
(/* Retry the interrupted mach_msg system call. */
|
||||||
"lda $0, -25($31)\n" /* mach_msg_trap */
|
"lda $0, -25($31)\n" /* mach_msg_trap */
|
||||||
"call_pal %0\n" /* Magic system call instruction. */
|
"callsys\n" /* Magic system call instruction. */
|
||||||
/* When the sigcontext was saved, v0 was MACH_RCV_INTERRUPTED. But
|
/* When the sigcontext was saved, v0 was MACH_RCV_INTERRUPTED. But
|
||||||
now the message receive has completed and the original caller of
|
now the message receive has completed and the original caller of
|
||||||
the RPC (i.e. the code running when the signal arrived) needs to
|
the RPC (i.e. the code running when the signal arrived) needs to
|
||||||
|
@ -225,8 +222,7 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
|
||||||
in registers t8..t10 ($22..$24). */
|
in registers t8..t10 ($22..$24). */
|
||||||
"mov $22, $16\n"
|
"mov $22, $16\n"
|
||||||
"mov $23, $17\n"
|
"mov $23, $17\n"
|
||||||
"mov $24, $18\n"
|
"mov $24, $18\n");
|
||||||
: : "i" (op_chmk));
|
|
||||||
|
|
||||||
trampoline:
|
trampoline:
|
||||||
/* Entry point for running the handler normally. The arguments to the
|
/* Entry point for running the handler normally. The arguments to the
|
||||||
|
|
Loading…
Reference in New Issue