#define RTLD_START asm ("\
.text
.globl _start
- .globl _dl_start_user
+ .ent _start
_start:
- br $gp,0f
+ br $gp, 0f
0: ldgp $gp, 0($gp)
/* Pass pointer to argument block to _dl_start. */
mov $sp, $16
bsr $26, _dl_start..ng
+ .end _start
+ /* FALLTHRU */
+ .globl _dl_start_user
+ .ent _dl_start_user
_dl_start_user:
/* Save the user entry point address in s0. */
mov $0, $9
lda $0, _dl_fini
/* Jump to the user's entry point. */
mov $9, $27
- jmp ($9)");
+ jmp ($9)
+ .end _dl_start_user");
/* Nonzero iff TYPE describes relocation of a PLT entry, so
PLT entries should not be allowed to define the value. */
sym_value += reloc->r_addend;
*reloc_addr = sym_value;
}
- else if (r_info == R_ALPHA_COPY)
- memcpy (reloc_addr, (void *) sym_value, sym->st_size);
else
assert (! "unexpected dynamic reloc type");
}
#include <sysdep.h>
.text
- .globl _start /* what ELF wants */
- .globl __start /* for backwards (ECOFF) comatibility */
.align 3
- .ent __start, 0
+ .ent _start, 0
_start:
-__start:
.frame fp, 0, zero
mov zero, fp
br gp, 1f
mov a1, s1
mov a2, s2
-#ifdef HAVE_INITFINI
/* Call _init, the entry point to our own .init section. */
jsr ra, _init
ldgp gp, 0(ra)
lda a0, _fini
jsr ra, atexit
ldgp gp, 0(ra)
-#else
- /* initialize constructors: */
- jsr ra, __main
- ldgp gp, 0(ra)
-#endif
+
+ /* Call the user's main and exit with its return value. */
mov s0, a0
mov s1, a1
mov s2, a2
- /* Call the user's main and exit with its return value. */
jsr ra, main
ldgp gp, 0(ra)
/* Die very horribly if exit returns. Call_pal hlt is callable from
kernel mode only; this will result in an illegal instruction trap. */
call_pal 0
-END(__start)
+ .end _start
+
+/* For ECOFF backwards compatibility. */
+weak_alias(_start, __start)
/* Define a symbol for the first piece of initialized data. */
.data
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
-#include <ansidecl.h>
#include <math.h>
#ifndef FUNC
#define __CONCATX(a,b) __CONCAT(a,b)
float_type
-DEFUN(__CONCATX(__kernel_,FUNC), (x, y), float_type x AND float_type y)
+__CONCATX(__kernel_,FUNC) (x, y)
+ float_type x;
+ float_type y;
{
- return __CONCATX(__,FUNC) (x + y);
+ float_type sin_x, cos_x, sin_y, cos_y;
+ __asm__ __volatile__ ("fsincosx %2,%0:%1" : "=f" (cos_x), "=f" (sin_x)
+ : "f" (x));
+ __asm__ __volatile__ ("fsincosx %2,%0:%1" : "=f" (cos_y), "=f" (sin_y)
+ : "f" (y));
+ return cos_x * cos_y - sin_x * sin_y;
}
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
-#include <ansidecl.h>
#include <math.h>
#ifndef FUNC
#define __CONCATX(a,b) __CONCAT(a,b)
float_type
-DEFUN(__CONCATX(__kernel_,FUNC), (x, y, iy),
- float_type x AND float_type y AND int iy)
+__CONCATX(__kernel_,FUNC) (x, y, iy)
+ float_type x;
+ float_type y;
+ int iy;
{
- return __CONCATX(__,FUNC) (x + y);
+ float_type sin_x, cos_x, sin_y, cos_y;
+ if (iy == 0)
+ return __m81_u_(__CONCATX(__,FUNC)) (x);
+ __asm__ __volatile__ ("fsincosx %2,%0:%1" : "=f" (cos_x), "=f" (sin_x)
+ : "f" (x));
+ __asm__ __volatile__ ("fsincosx %2,%0:%1" : "=f" (cos_y), "=f" (sin_y)
+ : "f" (y));
+ return sin_x * cos_y + cos_x * sin_y;
}
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
-#include <ansidecl.h>
#include <math.h>
#ifndef FUNC
#define __CONCATX(a,b) __CONCAT(a,b)
float_type
-DEFUN(__CONCATX(__kernel_,FUNC), (x, y, iy),
- float_type x AND float_type y AND int iy)
+__CONCATX(__kernel_,FUNC) (x, y, iy)
+ float_type x;
+ float_type y;
+ int iy;
{
- if (iy == 1)
- return __CONCATX(__,FUNC) (x + y);
+ float_type tan_x, tan_y;
+ tan_x = __m81_u_(__CONCATX(__,FUNC)) (x);
+ tan_y = __m81_u_(__CONCATX(__,FUNC)) (y);
+ if (iy > 0)
+ return (tan_x + tan_y) / (1 - tan_x * tan_y);
else
- return ((float_type) -1.0) / __CONCATX(__,FUNC) (x + y);
+ return (tan_x * tan_y - 1) / (tan_x + tan_y);
}
-/* Copyright (C) 1993 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1996 Free Software Foundation, Inc.
Contributed by Brendan Kehoe (brendan@zen.org).
The GNU C Library is free software; you can redistribute it and/or
.section .bss
.globl errno
+ .align 2
errno: .space 4
#ifdef __ELF__
.type errno, @object
-alpha/ptrace.halpha/regdef.h
+alpha/ptrace.h alpha/regdef.h
ieee_get_fp_control.S ieee_set_fp_control.S
ioperm.c
init-first.h
clone.S
+sys/io.h
ifeq ($(subdir), misc)
-sysdep_headers += alpha/ptrace.h alpha/regdef.h
+sysdep_headers += alpha/ptrace.h alpha/regdef.h sys/io.h
sysdep_routines += ieee_get_fp_control ieee_set_fp_control \
sethae ioperm osf_sigprocmask fstatfs statfs llseek
-/* This fragment is invoked in the stack context of program start.
- Its job is to set up a pointer to argc as an argument, pass
- control to `INIT', and, if necessary, clean up after the call
- to leave the stack in the same condition it was found in. */
+/* The job of this fragment it to find argc and friends for INIT.
+ This is done in one of two ways: either in the stack context
+ of program start, or having dlopen pass them in. */
-#define SYSDEP_CALL_INIT(NAME, INIT) \
- asm(".globl " #NAME "\n" \
- #NAME ":\n\t" \
- "ldgp $29, 0($27)\n\t" \
- ".prologue 1\n\t" \
- "mov $30, $16\n\t" \
- "br $31, " #INIT "..ng");
+#define SYSDEP_CALL_INIT(NAME, INIT) \
+ asm(".weak _dl_starting_up\n\t" \
+ ".globl " #NAME "\n\t" \
+ ".ent " #NAME "\n" \
+ #NAME ":\n\t" \
+ "ldgp $29, 0($27)\n\t" \
+ ".prologue 1\n\t" \
+ ".set at\n\t" \
+ /* Are we a dynamic libc being loaded into a static program? */ \
+ "lda $0, _dl_starting_up\n\t" \
+ "beq $0, 1f\n\t" \
+ "ldl $0, 0($0)\n" \
+ "cmpeq $31, $0, $0\n" \
+ "1:\t" \
+ "stl $0, __libc_multiple_libcs\n\t" \
+ /* If so, argc et al are in a0-a2 already. Otherwise, load them. */ \
+ "bne $0, 2f\n\t" \
+ "ldl $16, 0($30)\n\t" \
+ "lda $17, 8($30)\n\t" \
+ "s8addq $16, $17, $18\n\t" \
+ "addq $18, 8, $18\n" \
+ "2:\t" \
+ "br $31, " #INIT "..ng\n\t" \
+ ".set noat\n\t" \
+ ".end " #NAME);
static struct platform {
const char *name;
int io_sys;
+ int hae_shift;
unsigned long bus_memory_base;
unsigned long sparse_bus_memory_base;
} platform[] = {
- {"Alcor", IOSYS_CIA, CIA_DENSE_MEM, CIA_SPARSE_MEM},
- {"Avanti", IOSYS_APECS, APECS_DENSE_MEM, APECS_SPARSE_MEM},
- {"Cabriolet", IOSYS_APECS, APECS_DENSE_MEM, APECS_SPARSE_MEM},
- {"EB164", IOSYS_CIA, CIA_DENSE_MEM, CIA_SPARSE_MEM},
- {"EB64+", IOSYS_APECS, APECS_DENSE_MEM, APECS_SPARSE_MEM},
- {"EB66", IOSYS_APECS, APECS_DENSE_MEM, APECS_SPARSE_MEM},
- {"EB66P", IOSYS_APECS, APECS_DENSE_MEM, APECS_SPARSE_MEM},
- {"Jensen", IOSYS_JENSEN, 0, JENSEN_SPARSE_MEM},
- {"Mikasa", IOSYS_APECS, APECS_DENSE_MEM, APECS_SPARSE_MEM},
- {"Mustang", IOSYS_APECS, APECS_DENSE_MEM, APECS_SPARSE_MEM},
- {"Noname", IOSYS_APECS, APECS_DENSE_MEM, APECS_SPARSE_MEM},
+ {"Alcor", IOSYS_CIA, 5, CIA_DENSE_MEM, CIA_SPARSE_MEM},
+ {"Avanti", IOSYS_APECS, 5, APECS_DENSE_MEM, APECS_SPARSE_MEM},
+ {"Cabriolet", IOSYS_APECS, 5, APECS_DENSE_MEM, APECS_SPARSE_MEM},
+ {"EB164", IOSYS_CIA, 5, CIA_DENSE_MEM, CIA_SPARSE_MEM},
+ {"EB64+", IOSYS_APECS, 5, APECS_DENSE_MEM, APECS_SPARSE_MEM},
+ {"EB66", IOSYS_APECS, 5, APECS_DENSE_MEM, APECS_SPARSE_MEM},
+ {"EB66P", IOSYS_APECS, 5, APECS_DENSE_MEM, APECS_SPARSE_MEM},
+ {"Jensen", IOSYS_JENSEN, 7, 0, JENSEN_SPARSE_MEM},
+ {"Mikasa", IOSYS_APECS, 5, APECS_DENSE_MEM, APECS_SPARSE_MEM},
+ {"Mustang", IOSYS_APECS, 5, APECS_DENSE_MEM, APECS_SPARSE_MEM},
+ {"Noname", IOSYS_APECS, 5, APECS_DENSE_MEM, APECS_SPARSE_MEM},
};
unsigned long base;
struct ioswtch * swp;
int sys;
+ int hae_shift;
+ unsigned long bus_memory_base;
+ unsigned long sparse_bus_memory_base;
} io;
-static unsigned long bus_memory_base = -1;
-static unsigned long sparse_bus_memory_base = -1;
-
extern void __sethae (unsigned long); /* we can't use asm/io.h */
{
if (strcmp (platform[i].name, systype) == 0)
{
- bus_memory_base = platform[i].bus_memory_base;
- sparse_bus_memory_base = platform[i].sparse_bus_memory_base;
+ io.hae_shift = platform[i].hae_shift;
+ io.bus_memory_base = platform[i].bus_memory_base;
+ io.sparse_bus_memory_base = platform[i].sparse_bus_memory_base;
io.sys = platform[i].io_sys;
if (io.sys == IOSYS_JENSEN)
io.swp = &ioswtch[0];
{
if (!io.swp && init_iosys () < 0)
return -1;
- return bus_memory_base;
+ return io.bus_memory_base;
}
unsigned long
{
if (!io.swp && init_iosys () < 0)
return -1;
- return sparse_bus_memory_base;
+ return io.sparse_bus_memory_base;
+}
+
+int
+_hae_shift(void)
+{
+ if (!io.swp && init_iosys () < 0)
+ return -1;
+ return io.hae_shift;
}
weak_alias (_sethae, sethae);
weak_alias (_outl, outl);
weak_alias (_bus_base, bus_base);
weak_alias (_bus_base_sparse, bus_base_sparse);
+weak_alias (_hae_shift, hae_shift);
--- /dev/null
+/* Copyright (C) 1996 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 Library General Public License as
+published by the Free Software Foundation; either version 2 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#ifndef _SYS_IO_H
+
+#define _SYS_IO_H 1
+#include <features.h>
+
+__BEGIN_DECLS
+
+/* Get constants from kernel header files. */
+#include <asm/io.h>
+
+/* If TURN_ON is TRUE, request for permission to do direct i/o on the
+ port numbers in the range [FROM,FROM+NUM-1]. Otherwise, turn I/O
+ permission off for that range. This call requires root privileges.
+
+ Portability note: not all Linux platforms support this call. Most
+ platforms based on the PC I/O architecture probably will, however.
+ E.g., Linux/Alpha for Alpha PCs supports this. */
+extern int ioperm __P ((unsigned long int __from, unsigned long int __num,
+ int __turn_on));
+
+/* Set the I/O privilege level to LEVEL. If LEVEL>3, permission to
+ access any I/O port is granted. This call requires root
+ privileges. */
+extern int iopl __P ((int __level));
+
+/* Return the physical address of the DENSE I/O memory or NULL if none
+ is available (e.g. on a jensen). */
+extern unsigned long _bus_base __P ((void)) __attribute__ ((const));
+extern unsigned long bus_base __P ((void)) __attribute__ ((const));
+
+/* Return the physical address of the SPARSE I/O memory. */
+extern unsigned long _bus_base_sparse __P ((void)) __attribute__ ((const));
+extern unsigned long bus_base_sparse __P ((void)) __attribute__ ((const));
+
+/* Return the HAE shift used by the SPARSE I/O memory. */
+extern int _hae_shift __P ((void)) __attribute__ ((const));
+extern int hae_shift __P ((void)) __attribute__ ((const));
+
+__END_DECLS
+
+#endif /* _SYS_IO_H */