* mach/setup-thread.c (__mach_setup_thread): int -> natural_t

* sysdeps/mach/hurd/dl-sysdep.c: Use ElfW(TYPE) in place of Elf32_TYPE.
	(__mmap): Use MAP_FAILED instead of widening __hurd_fail value.

	* sysdeps/mach/hurd/bind.c: Use prototype definition.
	* sysdeps/mach/hurd/connect.c: Likewise.
	* sysdeps/mach/hurd/getsockopt.c: Likewise.
	* sysdeps/mach/hurd/setsockopt.c: Likewise.

	* sysdeps/mach/hurd/alpha/sigreturn.c: Pass missing argument to
	__msg_sig_post RPC.

	* hurd/catch-exc.c: Use integer_t instead of int.
	* hurd/hurdfault.c: Likewise.

	* sysdeps/mach/hurd/alpha/exc2signal.c
	(_hurd_exception2signal): Rewritten.
	* sysdeps/mach/hurd/alpha/longjmp-ts.c
	(_hurd_longjmp_thread_state): Rewritten.
This commit is contained in:
Roland McGrath 2002-04-08 02:16:43 +00:00
parent 14906e37fe
commit 7ce93726fb
10 changed files with 83 additions and 61 deletions

View File

@ -1,3 +1,26 @@
2002-04-06 Roland McGrath <roland@frob.com>
* mach/setup-thread.c (__mach_setup_thread): int -> natural_t
* sysdeps/mach/hurd/dl-sysdep.c: Use ElfW(TYPE) in place of Elf32_TYPE.
(__mmap): Use MAP_FAILED instead of widening __hurd_fail value.
* sysdeps/mach/hurd/bind.c: Use prototype definition.
* sysdeps/mach/hurd/connect.c: Likewise.
* sysdeps/mach/hurd/getsockopt.c: Likewise.
* sysdeps/mach/hurd/setsockopt.c: Likewise.
* sysdeps/mach/hurd/alpha/sigreturn.c: Pass missing argument to
__msg_sig_post RPC.
* hurd/catch-exc.c: Use integer_t instead of int.
* hurd/hurdfault.c: Likewise.
* sysdeps/mach/hurd/alpha/exc2signal.c
(_hurd_exception2signal): Rewritten.
* sysdeps/mach/hurd/alpha/longjmp-ts.c
(_hurd_longjmp_thread_state): Rewritten.
2002-04-07 Ulrich Drepper <drepper@redhat.com> 2002-04-07 Ulrich Drepper <drepper@redhat.com>
* nss/getXXbyYY_r.c: If NSS_attribute_hidden is defined use it with the * nss/getXXbyYY_r.c: If NSS_attribute_hidden is defined use it with the

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1994, 1995, 1997 Free Software Foundation, Inc. /* Copyright (C) 1991,94,95,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
@ -74,7 +74,7 @@ __mach_setup_thread (task_t task, thread_t thread, void *pc,
return error; return error;
return __thread_set_state (thread, MACHINE_THREAD_STATE_FLAVOR, return __thread_set_state (thread, MACHINE_THREAD_STATE_FLAVOR,
(int *) &ts, tssize); (natural_t *) &ts, tssize);
} }
weak_alias (__mach_setup_thread, mach_setup_thread) weak_alias (__mach_setup_thread, mach_setup_thread)

View File

@ -1,5 +1,5 @@
/* Translate Mach exception codes into signal numbers. Alpha version. /* Translate Mach exception codes into signal numbers. Alpha version.
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
@ -25,52 +25,51 @@
into a signal number and signal subcode. */ into a signal number and signal subcode. */
void void
_hurd_exception2signal (int exception, int code, int subcode, _hurd_exception2signal (struct hurd_signal_detail *detail, int *signo)
int *signo, long int *sigcode, int *error)
{ {
*error = 0; detail->error = 0;
switch (exception) switch (detail->exc)
{ {
default: default:
*signo = SIGIOT; *signo = SIGIOT;
*sigcode = exception; detail->code = detail->exc;
break; break;
case EXC_BAD_ACCESS: case EXC_BAD_ACCESS:
if (code == KERN_PROTECTION_FAILURE) if (detail->exc_code == KERN_PROTECTION_FAILURE)
*signo = SIGSEGV; *signo = SIGSEGV;
else else
*signo = SIGBUS; *signo = SIGBUS;
*sigcode = subcode; detail->code = detail->exc_subcode;
*error = code; detail->error = detail->exc_code;
break; break;
case EXC_BAD_INSTRUCTION: case EXC_BAD_INSTRUCTION:
*signo = SIGILL; *signo = SIGILL;
*sigcode = code; detail->code = detail->exc_code;
break; break;
case EXC_ARITHMETIC: case EXC_ARITHMETIC:
*signo = SIGFPE; *signo = SIGFPE;
*sigcode = code; detail->code = detail->exc_code;
break; break;
break; break;
case EXC_EMULATION: case EXC_EMULATION:
/* 3.0 doesn't give this one, why, I don't know. */ /* 3.0 doesn't give this one, why, I don't know. */
*signo = SIGEMT; *signo = SIGEMT;
*sigcode = code; detail->code = detail->exc_code;
break; break;
case EXC_SOFTWARE: case EXC_SOFTWARE:
*signo = SIGEMT; *signo = SIGEMT;
*sigcode = code; detail->code = detail->exc_code;
break; break;
case EXC_BREAKPOINT: case EXC_BREAKPOINT:
*signo = SIGTRAP; *signo = SIGTRAP;
*sigcode = code; detail->code = detail->exc_code;
break; break;
} }
} }

View File

@ -1,5 +1,5 @@
/* Perform a `longjmp' on a Mach thread_state. Alpha version. /* Perform a `longjmp' on a Mach thread_state. Alpha version.
Copyright (C) 1991, 1994, 1997 Free Software Foundation, Inc. Copyright (C) 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
@ -27,15 +27,22 @@
void void
_hurd_longjmp_thread_state (void *state, jmp_buf env, int val) _hurd_longjmp_thread_state (void *state, jmp_buf env, int val)
{ {
struct alpha_thread_state *ts = state; struct alpha_thread_state *const ts = state;
ts->r9 = env[0].__jmpbuf[0].__9; ts->r9 = env[0].__jmpbuf[JB_S0];
ts->r11 = env[0].__jmpbuf[0].__11; ts->r10 = env[0].__jmpbuf[JB_S1];
ts->r12 = env[0].__jmpbuf[0].__12; ts->r11 = env[0].__jmpbuf[JB_S2];
ts->r13 = env[0].__jmpbuf[0].__13; ts->r12 = env[0].__jmpbuf[JB_S3];
ts->r14 = env[0].__jmpbuf[0].__14; ts->r13 = env[0].__jmpbuf[JB_S4];
ts->r15 = (long int) env[0].__jmpbuf[0].__fp; ts->r13 = env[0].__jmpbuf[JB_S5];
ts->r30 = (long int) env[0].__jmpbuf[0].__sp; ts->pc = env[0].__jmpbuf[JB_PC];
ts->pc = (long int) env[0].__jmpbuf[0].__pc; ts->r15 = env[0].__jmpbuf[JB_FP];
ts->r30 = env[0].__jmpbuf[JB_SP];
ts->r0 = val ?: 1; ts->r0 = val ?: 1;
/* XXX
To mimic longjmp we ought to restore some fp registers too.
But those registers are in struct alpha_float_state.
The only use of this is in fork, and it probably won't matter.
*/
} }

View File

@ -1,5 +1,5 @@
/* Return from signal handler in GNU C library for Hurd. Alpha version. /* Return from signal handler in GNU C library for Hurd. 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
@ -23,7 +23,6 @@
#include <hurd/msg.h> #include <hurd/msg.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <mach/machine/alpha_instruction.h>
int int
__sigreturn (struct sigcontext *scp) __sigreturn (struct sigcontext *scp)
@ -58,7 +57,7 @@ __sigreturn (struct sigcontext *scp)
thread will examine us while we are blocked in the sig_post RPC. */ thread will examine us while we are blocked in the sig_post RPC. */
ss->intr_port = MACH_PORT_NULL; ss->intr_port = MACH_PORT_NULL;
__spin_unlock (&ss->lock); __spin_unlock (&ss->lock);
__msg_sig_post (_hurd_msgport, 0, __mach_task_self ()); __msg_sig_post (_hurd_msgport, 0, 0, __mach_task_self ());
/* If a pending signal was handled, sig_post never returned. */ /* If a pending signal was handled, sig_post never returned. */
__spin_lock (&ss->lock); __spin_lock (&ss->lock);
} }
@ -200,9 +199,9 @@ __sigreturn (struct sigcontext *scp)
the user stack and do the magical `rei' PAL call. */ the user stack and do the magical `rei' PAL call. */
asm volatile ("mov %0, $30\n" asm volatile ("mov %0, $30\n"
"call_pal %1" "call_pal %1"
: : "r" (rei_frame), "i" (op_rei)); : : "r" (rei_frame), "i" (63)); /* PAL_rti */
/* Firewall. */ /* Firewall. */
asm volatile ("call_pal %0" : : "i" (op_halt)); asm volatile ("halt");
} }
/* NOTREACHED */ /* NOTREACHED */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1992,94,95,96,97,98,2001 Free Software Foundation, Inc. /* Copyright (C) 1992,94,95,96,97,98,2001,02 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
@ -30,10 +30,7 @@
/* Give the socket FD the local address ADDR (which is LEN bytes long). */ /* Give the socket FD the local address ADDR (which is LEN bytes long). */
int int
bind (fd, addrarg, len) bind (int fd, __CONST_SOCKADDR_ARG addrarg, socklen_t len)
int fd;
__CONST_SOCKADDR_ARG addrarg;
size_t len;
{ {
addr_port_t aport; addr_port_t aport;
error_t err; error_t err;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1992, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. /* Copyright (C) 1992,94,95,96,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
@ -29,10 +29,7 @@
and the only address from which to accept transmissions. and the only address from which to accept transmissions.
Return 0 on success, -1 for errors. */ Return 0 on success, -1 for errors. */
int int
__connect (fd, addrarg, len) __connect (int fd, __CONST_SOCKADDR_ARG addrarg, socklen_t len)
int fd;
__CONST_SOCKADDR_ARG addrarg;
size_t len;
{ {
error_t err; error_t err;
addr_port_t aport; addr_port_t aport;

View File

@ -104,10 +104,10 @@ static void fmh(void) {
#endif #endif
Elf32_Addr ElfW(Addr)
_dl_sysdep_start (void **start_argptr, _dl_sysdep_start (void **start_argptr,
void (*dl_main) (const Elf32_Phdr *phdr, Elf32_Word phent, void (*dl_main) (const ElfW(Phdr) *phdr, ElfW(Word) phent,
Elf32_Addr *user_entry)) ElfW(Addr) *user_entry))
{ {
void go (int *argdata) void go (int *argdata)
{ {
@ -186,8 +186,8 @@ unfmh(); /* XXX */
/* Call elf/rtld.c's main program. It will set everything /* Call elf/rtld.c's main program. It will set everything
up and leave us to transfer control to USER_ENTRY. */ up and leave us to transfer control to USER_ENTRY. */
(*dl_main) ((const Elf32_Phdr *) _dl_hurd_data->phdr, (*dl_main) ((const ElfW(Phdr) *) _dl_hurd_data->phdr,
_dl_hurd_data->phdrsz / sizeof (Elf32_Phdr), _dl_hurd_data->phdrsz / sizeof (ElfW(Phdr)),
&_dl_hurd_data->user_entry); &_dl_hurd_data->user_entry);
/* The call above might screw a few things up. /* The call above might screw a few things up.
@ -481,7 +481,9 @@ __mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
if ((flags & MAP_ANON) == 0) if ((flags & MAP_ANON) == 0)
__mach_port_deallocate (__mach_task_self (), memobj_rd); __mach_port_deallocate (__mach_task_self (), memobj_rd);
return err ? (__ptr_t) __hurd_fail (err) : (__ptr_t) mapaddr; if (err)
return __hurd_fail (err), MAP_FAILED;
return (__ptr_t) mapaddr;
} }
int weak_function int weak_function

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1992,94,97,2001 Free Software Foundation, Inc. /* Copyright (C) 1992,94,97,2001,02 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
@ -29,12 +29,11 @@
/* XXX should be __getsockopt ? */ /* XXX should be __getsockopt ? */
int int
getsockopt (fd, level, optname, optval, optlen) getsockopt (int fd,
int fd; int level,
int level; int optname,
int optname; void *optval,
void *optval; socklen_t *optlen)
size_t *optlen;
{ {
error_t err; error_t err;
char *buf = optval; char *buf = optval;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1992, 1994, 1997, 1998 Free Software Foundation, Inc. /* Copyright (C) 1992,94,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
@ -27,12 +27,11 @@
Returns 0 on success, -1 for errors. */ Returns 0 on success, -1 for errors. */
/* XXX __setsockopt ? */ /* XXX __setsockopt ? */
int int
setsockopt (fd, level, optname, optval, optlen) setsockopt (int fd,
int fd; int level,
int level; int optname,
int optname; const void *optval,
const void *optval; socklen_t optlen)
size_t optlen;
{ {
error_t err = HURD_DPORT_USE (fd, __socket_setopt (port, error_t err = HURD_DPORT_USE (fd, __socket_setopt (port,
level, optname, level, optname,