2000-06-12 20:50:37 +00:00
|
|
|
/* Machine-dependent pthreads configuration and inline functions.
|
|
|
|
SuperH version.
|
Update.
2003-01-30 Jakub Jelinek <jakub@redhat.com>
* sysdeps/alpha/tls.h (THREAD_GETMEM, THREAD_GETMEM_NC,
THREAD_SETMEM, THREAD_SETMEM_NC): Avoid warnings about unused self
variable.
* sysdeps/ia64/pt-machine.h (THREAD_GETMEM, THREAD_GETMEM_NC,
THREAD_SETMEM, THREAD_SETMEM_NC): Likewise.
* sysdeps/s390/s390-32/pt-machine.h (THREAD_GETMEM, THREAD_GETMEM_NC,
THREAD_SETMEM, THREAD_SETMEM_NC): Likewise.
* sysdeps/s390/s390-64/pt-machine.h (THREAD_GETMEM, THREAD_GETMEM_NC,
THREAD_SETMEM, THREAD_SETMEM_NC): Likewise.
* sysdeps/sh/pt-machine.h (THREAD_GETMEM, THREAD_GETMEM_NC,
THREAD_SETMEM, THREAD_SETMEM_NC): Likewise.
* sysdeps/sparc/sparc32/pt-machine.h (THREAD_GETMEM, THREAD_GETMEM_NC,
THREAD_SETMEM, THREAD_SETMEM_NC): Likewise.
* sysdeps/sparc/sparc64/pt-machine.h (THREAD_GETMEM, THREAD_GETMEM_NC,
THREAD_SETMEM, THREAD_SETMEM_NC): Likewise.
2003-01-30 18:04:01 +00:00
|
|
|
Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
2000-06-12 20:50:37 +00:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
Contributed by Niibe Yutaka <gniibe@m17n.org>.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
2002-08-26 22:40:48 +00:00
|
|
|
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
|
2000-06-12 20:50:37 +00:00
|
|
|
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
|
2002-08-26 22:40:48 +00:00
|
|
|
Lesser General Public License for more details.
|
2000-06-12 20:50:37 +00:00
|
|
|
|
2002-08-26 22:40:48 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2000-06-12 20:50:37 +00:00
|
|
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
|
|
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA. */
|
|
|
|
|
2002-04-06 04:05:41 +00:00
|
|
|
#ifndef _PT_MACHINE_H
|
|
|
|
#define _PT_MACHINE_H 1
|
|
|
|
|
2002-10-02 06:22:02 +00:00
|
|
|
#ifndef __ASSEMBLER__
|
2000-06-12 20:50:37 +00:00
|
|
|
#ifndef PT_EI
|
2003-07-31 19:26:38 +00:00
|
|
|
# define PT_EI extern inline __attribute__ ((always_inline))
|
2000-06-12 20:50:37 +00:00
|
|
|
#endif
|
|
|
|
|
2002-03-17 12:10:08 +00:00
|
|
|
extern long int testandset (int *spinlock);
|
|
|
|
extern int __compare_and_swap (long int *p, long int oldval, long int newval);
|
|
|
|
|
2000-06-12 20:50:37 +00:00
|
|
|
/* Spinlock implementation; required. */
|
2000-12-18 05:55:14 +00:00
|
|
|
PT_EI long int
|
2000-06-12 20:50:37 +00:00
|
|
|
testandset (int *spinlock)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
__asm__ __volatile__(
|
Update.
2000-10-26 Kazumoto Kojima <kkojima@rr.iij4u.or.jp>
Yutaka Niibe <gniibe@chroot.org>
* sysdeps/sh/dl-machine.h (elf_machine_rela): Handle in place
relocation which is generated by new ld.
* sysdeps/sh/elf/initfini.c (_init): Preseted __fpscr_values.
(_fini): Delete an obsolete register prefix.
* sysdeps/unix/sysv/linux/sh/Versions: Add __xstat64, __fxstat64,
__lxstat64, alphasort64, glob64, readdir64, readdir64_r, scandir64
and versionsort64 as the 2.2-versioned symbols.
* sysdeps/unix/sysv/linux/sh/bits/fcntl.h: New file.
* sysdeps/unix/sysv/linux/sh/brk.c: Changes for the new system call
calling convention of the kernel.
* sysdeps/unix/sysv/linux/sh/pipe.S: Likewise.
* sysdeps/unix/sysv/linux/sh/socket.S: Likewise.
* sysdeps/unix/sysv/linux/sh/clone.S: Likewise.
* sysdeps/unix/sysv/linux/sh/vfork.S: Likewise.
* sysdeps/unix/sysv/linux/sh/sysdep.h: Likewise.
* sysdeps/unix/sysv/linux/sh/fcntl.c: New file.
* sysdeps/unix/sysv/linux/sh/lockf64.c: New file.
* sysdeps/unix/sysv/linux/sh/sys/user.h: Include the kernel header
file and delete the definitions of struct user and user_fp.
* sysdeps/unix/sysv/linux/sh/syscall.S: New file.
* sysdeps/unix/sysv/linux/sh/syscalls.list: Remove entries for
s_ioctl, s_ipc, s_llseek, s_chown, s_fchown, s_lchown, s_execve,
rt_sigaction, rt_sigpending, rt_sigprocmask, rt_sigqueueinfo,
rt_sigsuspend, rt_sigtimedwait, s_getcwd, s_getdents, s_getgroups,
s_getpriority, s_getegid, s_geteuid, s_getuid, getresgid, getresuid,
s_getrlimit, s_poll, s_pread64, s_ptrace, s_pwrite64, s_reboot,
s_setrlimit, s_sigaction, s_sigpending, s_sigprocmask, s_sigsuspend,
s_setfsgid, s_setfsuid, s_setgid, s_setgroups, s_setregid,
s_setresgid, s_setresuid, s_setreuid, s_setuid, s_sysctl,
s_ugetrlimit, s_ustat, sys_fstat, sys_lstat, sys_mknod, sys_readv,
sys_stat, sys_writev and syscall.
2000-10-26 02:34:17 +00:00
|
|
|
"tas.b @%1\n\t"
|
2000-06-12 20:50:37 +00:00
|
|
|
"movt %0"
|
2001-04-11 03:00:52 +00:00
|
|
|
: "=r" (ret)
|
Update.
2000-10-26 Kazumoto Kojima <kkojima@rr.iij4u.or.jp>
Yutaka Niibe <gniibe@chroot.org>
* sysdeps/sh/dl-machine.h (elf_machine_rela): Handle in place
relocation which is generated by new ld.
* sysdeps/sh/elf/initfini.c (_init): Preseted __fpscr_values.
(_fini): Delete an obsolete register prefix.
* sysdeps/unix/sysv/linux/sh/Versions: Add __xstat64, __fxstat64,
__lxstat64, alphasort64, glob64, readdir64, readdir64_r, scandir64
and versionsort64 as the 2.2-versioned symbols.
* sysdeps/unix/sysv/linux/sh/bits/fcntl.h: New file.
* sysdeps/unix/sysv/linux/sh/brk.c: Changes for the new system call
calling convention of the kernel.
* sysdeps/unix/sysv/linux/sh/pipe.S: Likewise.
* sysdeps/unix/sysv/linux/sh/socket.S: Likewise.
* sysdeps/unix/sysv/linux/sh/clone.S: Likewise.
* sysdeps/unix/sysv/linux/sh/vfork.S: Likewise.
* sysdeps/unix/sysv/linux/sh/sysdep.h: Likewise.
* sysdeps/unix/sysv/linux/sh/fcntl.c: New file.
* sysdeps/unix/sysv/linux/sh/lockf64.c: New file.
* sysdeps/unix/sysv/linux/sh/sys/user.h: Include the kernel header
file and delete the definitions of struct user and user_fp.
* sysdeps/unix/sysv/linux/sh/syscall.S: New file.
* sysdeps/unix/sysv/linux/sh/syscalls.list: Remove entries for
s_ioctl, s_ipc, s_llseek, s_chown, s_fchown, s_lchown, s_execve,
rt_sigaction, rt_sigpending, rt_sigprocmask, rt_sigqueueinfo,
rt_sigsuspend, rt_sigtimedwait, s_getcwd, s_getdents, s_getgroups,
s_getpriority, s_getegid, s_geteuid, s_getuid, getresgid, getresuid,
s_getrlimit, s_poll, s_pread64, s_ptrace, s_pwrite64, s_reboot,
s_setrlimit, s_sigaction, s_sigpending, s_sigprocmask, s_sigsuspend,
s_setfsgid, s_setfsuid, s_setgid, s_setgroups, s_setregid,
s_setresgid, s_setresuid, s_setreuid, s_setuid, s_sysctl,
s_ugetrlimit, s_ustat, sys_fstat, sys_lstat, sys_mknod, sys_readv,
sys_stat, sys_writev and syscall.
2000-10-26 02:34:17 +00:00
|
|
|
: "r" (spinlock)
|
2000-06-12 20:50:37 +00:00
|
|
|
: "memory", "cc");
|
|
|
|
|
2001-04-11 03:00:52 +00:00
|
|
|
return (ret == 0);
|
2000-06-12 20:50:37 +00:00
|
|
|
}
|
|
|
|
|
2002-04-08 21:05:48 +00:00
|
|
|
/* We want the OS to assign stack addresses. */
|
|
|
|
#define FLOATING_STACKS 1
|
|
|
|
|
|
|
|
/* Maximum size of the stack if the rlimit is unlimited. */
|
|
|
|
#define ARCH_STACK_MAX_SIZE 32*1024*1024
|
2000-06-12 20:50:37 +00:00
|
|
|
|
|
|
|
/* Get some notion of the current stack. Need not be exactly the top
|
|
|
|
of the stack, just something somewhere in the current frame. */
|
|
|
|
#define CURRENT_STACK_FRAME stack_pointer
|
|
|
|
register char * stack_pointer __asm__ ("r15");
|
2001-07-26 01:39:53 +00:00
|
|
|
|
|
|
|
/* Return the thread descriptor for the current thread. */
|
|
|
|
struct _pthread_descr_struct;
|
|
|
|
#define THREAD_SELF \
|
|
|
|
({ struct _pthread_descr_struct *self; \
|
|
|
|
__asm__("stc gbr,%0" : "=r" (self)); self;})
|
|
|
|
|
|
|
|
/* Initialize the thread-unique value. */
|
|
|
|
#define INIT_THREAD_SELF(descr, nr) \
|
2001-12-12 18:01:23 +00:00
|
|
|
({ __asm__ __volatile__("ldc %0,gbr" : : "r" (descr));})
|
2002-04-06 04:05:41 +00:00
|
|
|
|
2002-04-08 21:05:48 +00:00
|
|
|
/* Access to data in the thread descriptor is easy. */
|
2003-01-30 21:03:40 +00:00
|
|
|
#define THREAD_GETMEM(descr, member) \
|
|
|
|
((void) sizeof (descr), THREAD_SELF->member)
|
|
|
|
#define THREAD_GETMEM_NC(descr, member) \
|
|
|
|
((void) sizeof (descr), THREAD_SELF->member)
|
Update.
2003-01-30 Jakub Jelinek <jakub@redhat.com>
* sysdeps/alpha/tls.h (THREAD_GETMEM, THREAD_GETMEM_NC,
THREAD_SETMEM, THREAD_SETMEM_NC): Avoid warnings about unused self
variable.
* sysdeps/ia64/pt-machine.h (THREAD_GETMEM, THREAD_GETMEM_NC,
THREAD_SETMEM, THREAD_SETMEM_NC): Likewise.
* sysdeps/s390/s390-32/pt-machine.h (THREAD_GETMEM, THREAD_GETMEM_NC,
THREAD_SETMEM, THREAD_SETMEM_NC): Likewise.
* sysdeps/s390/s390-64/pt-machine.h (THREAD_GETMEM, THREAD_GETMEM_NC,
THREAD_SETMEM, THREAD_SETMEM_NC): Likewise.
* sysdeps/sh/pt-machine.h (THREAD_GETMEM, THREAD_GETMEM_NC,
THREAD_SETMEM, THREAD_SETMEM_NC): Likewise.
* sysdeps/sparc/sparc32/pt-machine.h (THREAD_GETMEM, THREAD_GETMEM_NC,
THREAD_SETMEM, THREAD_SETMEM_NC): Likewise.
* sysdeps/sparc/sparc64/pt-machine.h (THREAD_GETMEM, THREAD_GETMEM_NC,
THREAD_SETMEM, THREAD_SETMEM_NC): Likewise.
2003-01-30 18:04:01 +00:00
|
|
|
#define THREAD_SETMEM(descr, member, value) \
|
2003-01-30 21:03:40 +00:00
|
|
|
((void) sizeof (descr), THREAD_SELF->member = (value))
|
Update.
2003-01-30 Jakub Jelinek <jakub@redhat.com>
* sysdeps/alpha/tls.h (THREAD_GETMEM, THREAD_GETMEM_NC,
THREAD_SETMEM, THREAD_SETMEM_NC): Avoid warnings about unused self
variable.
* sysdeps/ia64/pt-machine.h (THREAD_GETMEM, THREAD_GETMEM_NC,
THREAD_SETMEM, THREAD_SETMEM_NC): Likewise.
* sysdeps/s390/s390-32/pt-machine.h (THREAD_GETMEM, THREAD_GETMEM_NC,
THREAD_SETMEM, THREAD_SETMEM_NC): Likewise.
* sysdeps/s390/s390-64/pt-machine.h (THREAD_GETMEM, THREAD_GETMEM_NC,
THREAD_SETMEM, THREAD_SETMEM_NC): Likewise.
* sysdeps/sh/pt-machine.h (THREAD_GETMEM, THREAD_GETMEM_NC,
THREAD_SETMEM, THREAD_SETMEM_NC): Likewise.
* sysdeps/sparc/sparc32/pt-machine.h (THREAD_GETMEM, THREAD_GETMEM_NC,
THREAD_SETMEM, THREAD_SETMEM_NC): Likewise.
* sysdeps/sparc/sparc64/pt-machine.h (THREAD_GETMEM, THREAD_GETMEM_NC,
THREAD_SETMEM, THREAD_SETMEM_NC): Likewise.
2003-01-30 18:04:01 +00:00
|
|
|
#define THREAD_SETMEM_NC(descr, member, value) \
|
2003-01-30 21:03:40 +00:00
|
|
|
((void) sizeof (descr), THREAD_SELF->member = (value))
|
2002-10-02 06:22:02 +00:00
|
|
|
#endif /* __ASSEMBLER__ */
|
2002-04-08 21:05:48 +00:00
|
|
|
|
2002-04-06 04:05:41 +00:00
|
|
|
#endif /* pt-machine.h */
|