mirror of
https://sourceware.org/git/glibc.git
synced 2025-04-26 15:09:05 +03:00
Ancient files moved to ports repository
This commit is contained in:
parent
8aeb5058b6
commit
89c235754c
@ -1,43 +0,0 @@
|
|||||||
/* ffs -- find first set bit in a word, counted from least significant end.
|
|
||||||
For Amd 290x0.
|
|
||||||
Copyright (C) 1991, 1992, 1997, 2004 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Contributed by Torbjorn Granlund (tege@sics.se).
|
|
||||||
|
|
||||||
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. */
|
|
||||||
|
|
||||||
#include <bstring.h>
|
|
||||||
|
|
||||||
#undef ffs
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
|
|
||||||
int
|
|
||||||
__ffs (x)
|
|
||||||
int x;
|
|
||||||
{
|
|
||||||
int cnt;
|
|
||||||
|
|
||||||
asm ("clz %0,%1" : "=r" (cnt) : "r" (x & -x));
|
|
||||||
|
|
||||||
return 32 - cnt;
|
|
||||||
}
|
|
||||||
weak_alias (__ffs, ffs)
|
|
||||||
libc_hidden_builtin_def (ffs)
|
|
||||||
|
|
||||||
#else
|
|
||||||
#include <sysdeps/generic/ffs.c>
|
|
||||||
#endif
|
|
@ -1 +0,0 @@
|
|||||||
_mcount.S
|
|
@ -1,3 +0,0 @@
|
|||||||
wordsize-32
|
|
||||||
ieee754/flt-32
|
|
||||||
ieee754/dbl-64
|
|
@ -1,44 +0,0 @@
|
|||||||
# Copyright (C) 1999, 2000, 2001 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.
|
|
||||||
|
|
||||||
# We don't support long doubles as a distinct type. We don't need to set
|
|
||||||
# this variable; it's here mostly for documentational purposes.
|
|
||||||
|
|
||||||
long-double-fcts = no
|
|
||||||
|
|
||||||
# FIXME: Note that this is a machine-specific stub; profiling is not
|
|
||||||
# implemented.
|
|
||||||
ifeq ($(subdir),gmon)
|
|
||||||
sysdep_routines += _mcount
|
|
||||||
endif
|
|
||||||
|
|
||||||
# FIXME: This test seems generally bogus. Wrong types in function calls
|
|
||||||
# and assumes FE_TONEAREST is defined. Does it work somewhere?
|
|
||||||
# Presumably it does, so let's settle for filtering it out target-wise
|
|
||||||
# until it's agreed what should be done.
|
|
||||||
ifeq ($(subdir),math)
|
|
||||||
tests := $(filter-out test-fenv, $(tests))
|
|
||||||
endif
|
|
||||||
|
|
||||||
# PIC code must be assembled with special options, passed on by gcc when
|
|
||||||
# given the -fpic option.
|
|
||||||
ASFLAGS-.os = -fpic
|
|
||||||
|
|
||||||
# Overflow occurs at 2**15/4 (8192) symbols. Glibc uses about 2000.
|
|
||||||
# So use -fpic: smaller-size relocs; smaller, faster code.
|
|
||||||
pic-ccflag = -fpic
|
|
@ -1,38 +0,0 @@
|
|||||||
/* longjmp for CRIS.
|
|
||||||
Copyright (C) 2001 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. */
|
|
||||||
|
|
||||||
#include <sysdep.h>
|
|
||||||
#define _SETJMP_H
|
|
||||||
#define _ASM
|
|
||||||
#include <bits/setjmp.h>
|
|
||||||
|
|
||||||
.syntax no_register_prefix
|
|
||||||
|
|
||||||
/* Saving and restoring CCR is meaningless, so we don't do it. */
|
|
||||||
ENTRY (__longjmp)
|
|
||||||
/* Note that r10 = jmp_buf, r11 = retval. */
|
|
||||||
move [r10+16*4],srp
|
|
||||||
test.d r11
|
|
||||||
beq 0f /* Already a 1 in place. */
|
|
||||||
nop
|
|
||||||
/* Offset for r9, the return value (see setjmp). */
|
|
||||||
move.d r11,[r10+6*4]
|
|
||||||
0:
|
|
||||||
movem [r10],pc
|
|
||||||
END (__longjmp)
|
|
@ -1,36 +0,0 @@
|
|||||||
/* Machine-specific calling sequence for `mcount' profiling function for CRIS.
|
|
||||||
Copyright (C) 2001 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. */
|
|
||||||
|
|
||||||
/* FIXME: This isn't implemented yet. This is just a machine-specific
|
|
||||||
stub. Perhaps a real implementation can make use of it. */
|
|
||||||
|
|
||||||
#include <sysdep.h>
|
|
||||||
|
|
||||||
#undef CALL_MCOUNT
|
|
||||||
#define CALL_MCOUNT
|
|
||||||
|
|
||||||
ENTRY (_mcount)
|
|
||||||
SETUP_PIC
|
|
||||||
/* Sorry, isn't implemented yet.
|
|
||||||
Can't call abort; that will recurse. Force SEGV instead. */
|
|
||||||
test.d [99]
|
|
||||||
1:
|
|
||||||
ba 1b
|
|
||||||
nop
|
|
||||||
END (_mcount)
|
|
@ -1,7 +0,0 @@
|
|||||||
/* CRIS is little-endian. */
|
|
||||||
|
|
||||||
#ifndef _ENDIAN_H
|
|
||||||
# error "Never use <bits/endian.h> directly; include <endian.h> instead."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
|
@ -1,54 +0,0 @@
|
|||||||
/* Copyright (C) 1997, 1998 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 the machine-dependent type `jmp_buf', CRIS version. */
|
|
||||||
|
|
||||||
/* Note that saving and restoring CCR has no meaning in user mode, so we
|
|
||||||
don't actually do it; the slot is now reserved.
|
|
||||||
|
|
||||||
jmp_buf[0] - PC
|
|
||||||
jmp_buf[1] - SP (R14)
|
|
||||||
jmp_buf[2] - R13
|
|
||||||
jmp_buf[3] - R12
|
|
||||||
jmp_buf[4] - R11
|
|
||||||
jmp_buf[5] - R10
|
|
||||||
jmp_buf[6] - R9
|
|
||||||
jmp_buf[7] - R8
|
|
||||||
jmp_buf[8] - R7
|
|
||||||
jmp_buf[9] - R6
|
|
||||||
jmp_buf[10] - R5
|
|
||||||
jmp_buf[11] - R4
|
|
||||||
jmp_buf[12] - R3
|
|
||||||
jmp_buf[13] - R2
|
|
||||||
jmp_buf[14] - R1
|
|
||||||
jmp_buf[15] - R0
|
|
||||||
jmp_buf[16] - SRP
|
|
||||||
jmp_buf[17] - CCR */
|
|
||||||
|
|
||||||
#ifndef _ASM
|
|
||||||
typedef unsigned long int __jmp_buf[18];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined (__USE_MISC) || defined (_ASM)
|
|
||||||
#define JB_SP 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Test if longjmp to JMPBUF would unwind the frame
|
|
||||||
containing a local variable at ADDRESS. */
|
|
||||||
#define _JMPBUF_UNWINDS(jmpbuf, address) \
|
|
||||||
((unsigned long int) (address) < (jmpbuf)[JB_SP])
|
|
@ -1,26 +0,0 @@
|
|||||||
/* Optimized, inlined string functions. CRIS version.
|
|
||||||
Copyright (C) 1997, 2001 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. */
|
|
||||||
|
|
||||||
#ifndef _STRING_H
|
|
||||||
# error "Never use <bits/string.h> directly; include <string.h> instead."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Currently the only purpose of this file is to tell the generic inline
|
|
||||||
macros that unaligned memory access is possible. */
|
|
||||||
#define _STRING_ARCH_unaligned 1
|
|
@ -1,391 +0,0 @@
|
|||||||
/* Machine-dependent ELF dynamic relocation inline functions. CRIS version.
|
|
||||||
Copyright (C) 1996-2001, 2002, 2003 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. */
|
|
||||||
|
|
||||||
#ifndef dl_machine_h
|
|
||||||
#define dl_machine_h
|
|
||||||
|
|
||||||
#define ELF_MACHINE_NAME "CRIS"
|
|
||||||
|
|
||||||
#include <sys/param.h>
|
|
||||||
|
|
||||||
#ifdef __PIC__
|
|
||||||
# define CALL_FN(x) \
|
|
||||||
"move.d $pc,$r9\n\t" \
|
|
||||||
"add.d " #x " - .,$r9\n\t" \
|
|
||||||
"jsr $r9"
|
|
||||||
#else
|
|
||||||
# define CALL_FN(x) "jsr " #x
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Return nonzero iff ELF header is compatible with the running host. */
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
elf_machine_matches_host (const Elf32_Ehdr *ehdr)
|
|
||||||
{
|
|
||||||
return ehdr->e_machine == EM_CRIS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return the link-time address of _DYNAMIC. Conveniently, this is the
|
|
||||||
first element of the GOT. This must be inlined in a function which
|
|
||||||
uses global data. */
|
|
||||||
|
|
||||||
static inline Elf32_Addr
|
|
||||||
elf_machine_dynamic (void)
|
|
||||||
{
|
|
||||||
/* Don't just set this to an asm variable "r0" since that's not logical
|
|
||||||
(like, the variable is uninitialized and the register is fixed) and
|
|
||||||
may make GCC trip over itself doing register allocation. Yes, I'm
|
|
||||||
paranoid. Why do you ask? */
|
|
||||||
Elf32_Addr *got;
|
|
||||||
|
|
||||||
__asm__ ("move.d $r0,%0" : "=rm" (got));
|
|
||||||
return *got;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return the run-time load address of the shared object. We do it like
|
|
||||||
m68k and i386, by taking an arbitrary local symbol, forcing a GOT entry
|
|
||||||
for it, and peeking into the GOT table, which is set to the link-time
|
|
||||||
file-relative symbol value (regardless of whether the target is REL or
|
|
||||||
RELA). We subtract this link-time file-relative value from the "local"
|
|
||||||
value we calculate from GOT position and GOT offset. FIXME: Perhaps
|
|
||||||
there's some other symbol we could use, that we don't *have* to force a
|
|
||||||
GOT entry for. */
|
|
||||||
|
|
||||||
static inline Elf32_Addr
|
|
||||||
elf_machine_load_address (void)
|
|
||||||
{
|
|
||||||
Elf32_Addr gotaddr_diff;
|
|
||||||
__asm__ ("sub.d [$r0+_dl_start:GOT16],$r0,%0\n\t"
|
|
||||||
"add.d _dl_start:GOTOFF,%0" : "=r" (gotaddr_diff));
|
|
||||||
return gotaddr_diff;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set up the loaded object described by L so its unrelocated PLT
|
|
||||||
entries will jump to the on-demand fixup code in dl-runtime.c. */
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
|
|
||||||
{
|
|
||||||
Elf32_Addr *got;
|
|
||||||
extern void _dl_runtime_resolve (Elf32_Word);
|
|
||||||
extern void _dl_runtime_profile (Elf32_Word);
|
|
||||||
|
|
||||||
if (l->l_info[DT_JMPREL] && lazy)
|
|
||||||
{
|
|
||||||
/* The GOT entries for functions in the PLT have not yet been
|
|
||||||
filled in. Their initial contents will arrange when called
|
|
||||||
to push an offset into the .rela.plt section, push
|
|
||||||
_GLOBAL_OFFSET_TABLE_[1], and then jump to
|
|
||||||
_GLOBAL_OFFSET_TABLE_[2]. */
|
|
||||||
got = (Elf32_Addr *) D_PTR (l, l_info[DT_PLTGOT]);
|
|
||||||
got[1] = (Elf32_Addr) l; /* Identify this shared object. */
|
|
||||||
|
|
||||||
/* The got[2] entry contains the address of a function which gets
|
|
||||||
called to get the address of a so far unresolved function and
|
|
||||||
jump to it. The profiling extension of the dynamic linker allows
|
|
||||||
to intercept the calls to collect information. In this case we
|
|
||||||
don't store the address in the GOT so that all future calls also
|
|
||||||
end in this function. */
|
|
||||||
if (__builtin_expect (profile, 0))
|
|
||||||
{
|
|
||||||
got[2] = (Elf32_Addr) &_dl_runtime_profile;
|
|
||||||
|
|
||||||
if (_dl_name_match_p (GL(dl_profile), l))
|
|
||||||
{
|
|
||||||
/* This is the object we are looking for. Say that we really
|
|
||||||
want profiling and the timers are started. */
|
|
||||||
GL(dl_profile_map) = l;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
/* This function will get called to fix up the GOT entry indicated by
|
|
||||||
the offset on the stack, and then jump to the resolved address. */
|
|
||||||
got[2] = (Elf32_Addr) &_dl_runtime_resolve;
|
|
||||||
}
|
|
||||||
|
|
||||||
return lazy;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This code is used in dl-runtime.c to call the `fixup' function
|
|
||||||
and then redirect to the address it returns.
|
|
||||||
|
|
||||||
We get here with the offset into the relocation table pushed on stack,
|
|
||||||
and the link map in MOF. */
|
|
||||||
|
|
||||||
#define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name) \
|
|
||||||
"; Trampoline for " #fixup_name "\n\
|
|
||||||
.globl " #tramp_name "\n\
|
|
||||||
.type " #tramp_name ", @function\n\
|
|
||||||
" #tramp_name ":\n\
|
|
||||||
push $r13\n\
|
|
||||||
push $r12\n\
|
|
||||||
push $r11\n\
|
|
||||||
push $r10\n\
|
|
||||||
push $r9\n\
|
|
||||||
push $srp\n\
|
|
||||||
move.d [$sp+6*4],$r11\n\
|
|
||||||
move $mof,$r10\n\
|
|
||||||
" CALL_FN (fixup_name) "\n\
|
|
||||||
move.d $r10,[$sp+6*4]\n\
|
|
||||||
pop $srp\n\
|
|
||||||
pop $r9\n\
|
|
||||||
pop $r10\n\
|
|
||||||
pop $r11\n\
|
|
||||||
pop $r12\n\
|
|
||||||
pop $r13\n\
|
|
||||||
jump [$sp+]\n\
|
|
||||||
.size " #tramp_name ", . - " #tramp_name "\n"
|
|
||||||
#ifndef PROF
|
|
||||||
#define ELF_MACHINE_RUNTIME_TRAMPOLINE \
|
|
||||||
asm (TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup) \
|
|
||||||
TRAMPOLINE_TEMPLATE (_dl_runtime_profile, profile_fixup));
|
|
||||||
#else
|
|
||||||
#define ELF_MACHINE_RUNTIME_TRAMPOLINE \
|
|
||||||
asm (TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup) \
|
|
||||||
".globl _dl_runtime_profile\n" \
|
|
||||||
".set _dl_runtime_profile, _dl_runtime_resolve");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Mask identifying addresses reserved for the user program,
|
|
||||||
where the dynamic linker should not map anything. */
|
|
||||||
#define ELF_MACHINE_USER_ADDRESS_MASK 0xf8000000UL
|
|
||||||
|
|
||||||
/* Initial entry point code for the dynamic linker.
|
|
||||||
The C function `_dl_start' is the real entry point;
|
|
||||||
its return value is the user program's entry point. */
|
|
||||||
|
|
||||||
#define RTLD_START asm ("\
|
|
||||||
.text\n\
|
|
||||||
.globl _start\n\
|
|
||||||
.type _start,@function\n\
|
|
||||||
_start:\n\
|
|
||||||
move.d $sp,$r10\n\
|
|
||||||
" CALL_FN (_dl_start) "\n\
|
|
||||||
/* FALLTHRU */\n\
|
|
||||||
\n\
|
|
||||||
.globl _dl_start_user\n\
|
|
||||||
.type _dl_start_user,@function\n\
|
|
||||||
_dl_start_user:\n\
|
|
||||||
; Save the user entry point address in R1.\n\
|
|
||||||
move.d $r10,$r1\n\
|
|
||||||
; Point R0 at the GOT.\n\
|
|
||||||
move.d $pc,$r0\n\
|
|
||||||
sub.d .:GOTOFF,$r0\n\
|
|
||||||
; See if we were run as a command with the executable file\n\
|
|
||||||
; name as an extra leading argument.\n\
|
|
||||||
move.d [$r0+_dl_skip_args:GOT16],$r13\n\
|
|
||||||
move.d [$r13],$r9\n\
|
|
||||||
; Get the original argument count\n\
|
|
||||||
move.d [$sp],$r11\n\
|
|
||||||
; Subtract _dl_skip_args from it.\n\
|
|
||||||
sub.d $r9,$r11\n\
|
|
||||||
; Adjust the stack pointer to skip _dl_skip_args words.\n\
|
|
||||||
addi $r9.d,$sp\n\
|
|
||||||
; Put the new argc in place as expected by the user entry.\n\
|
|
||||||
move.d $r11,[$sp]\n\
|
|
||||||
; Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env)\n\
|
|
||||||
; env: skip scaled argc and skip stored argc and NULL at end of argv[].\n\
|
|
||||||
move.d $sp,$r13\n\
|
|
||||||
addi $r11.d,$r13\n\
|
|
||||||
addq 8,$r13\n\
|
|
||||||
; argv: skip stored argc.\n\
|
|
||||||
move.d $sp,$r12\n\
|
|
||||||
addq 4,$r12\n\
|
|
||||||
; main_map: at _dl_loaded.\n\
|
|
||||||
move.d [$r0+_rtld_local:GOT16],$r9\n\
|
|
||||||
move.d [$r9],$r10\n\
|
|
||||||
move.d _dl_init_internal:PLTG,$r9\n\
|
|
||||||
add.d $r0,$r9\n\
|
|
||||||
jsr $r9\n\
|
|
||||||
; Pass our finalizer function to the user in R10.\n\
|
|
||||||
move.d [$r0+_dl_fini:GOT16],$r10\n\
|
|
||||||
; Terminate the frame-pointer.\n\
|
|
||||||
moveq 0,$r8\n\
|
|
||||||
; Cause SEGV if user entry returns.\n\
|
|
||||||
move $r8,$srp\n\
|
|
||||||
; Jump to the user's entry point.\n\
|
|
||||||
jump $r1\n\
|
|
||||||
.size _dl_start_user, . - _dl_start_user\n\
|
|
||||||
.previous");
|
|
||||||
|
|
||||||
/* The union of reloc-type-classes where the reloc TYPE is a member.
|
|
||||||
|
|
||||||
TYPE is in the class ELF_RTYPE_CLASS_PLT if it can describe a
|
|
||||||
relocation for a PLT entry, that is, for which a PLT entry should not
|
|
||||||
be allowed to define the value. The GNU linker for CRIS can merge a
|
|
||||||
.got.plt entry (R_CRIS_JUMP_SLOT) with a .got entry (R_CRIS_GLOB_DAT),
|
|
||||||
so we need to match both these reloc types.
|
|
||||||
|
|
||||||
TYPE is in the class ELF_RTYPE_CLASS_NOCOPY if it should not be allowed
|
|
||||||
to resolve to one of the main executable's symbols, as for a COPY
|
|
||||||
reloc. */
|
|
||||||
#define elf_machine_type_class(type) \
|
|
||||||
((((((type) == R_CRIS_JUMP_SLOT)) \
|
|
||||||
|| ((type) == R_CRIS_GLOB_DAT)) * ELF_RTYPE_CLASS_PLT) \
|
|
||||||
| (((type) == R_CRIS_COPY) * ELF_RTYPE_CLASS_COPY))
|
|
||||||
|
|
||||||
/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */
|
|
||||||
#define ELF_MACHINE_JMP_SLOT R_CRIS_JUMP_SLOT
|
|
||||||
|
|
||||||
/* CRIS never uses Elf32_Rel relocations. */
|
|
||||||
#define ELF_MACHINE_NO_REL 1
|
|
||||||
|
|
||||||
/* We define an initialization functions. This is called very early in
|
|
||||||
_dl_sysdep_start. */
|
|
||||||
#define DL_PLATFORM_INIT dl_platform_init ()
|
|
||||||
|
|
||||||
static inline void __attribute__ ((unused))
|
|
||||||
dl_platform_init (void)
|
|
||||||
{
|
|
||||||
if (GL(dl_platform) != NULL && *GL(dl_platform) == '\0')
|
|
||||||
/* Avoid an empty string which would disturb us. */
|
|
||||||
GL(dl_platform) = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline Elf32_Addr
|
|
||||||
elf_machine_fixup_plt (struct link_map *map, lookup_t t,
|
|
||||||
const Elf32_Rela *reloc,
|
|
||||||
Elf32_Addr *reloc_addr, Elf32_Addr value)
|
|
||||||
{
|
|
||||||
return *reloc_addr = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return the final value of a plt relocation. */
|
|
||||||
static inline Elf32_Addr
|
|
||||||
elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc,
|
|
||||||
Elf32_Addr value)
|
|
||||||
{
|
|
||||||
return value + reloc->r_addend;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* !dl_machine_h */
|
|
||||||
|
|
||||||
#ifdef RESOLVE
|
|
||||||
|
|
||||||
/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
|
|
||||||
MAP is the object containing the reloc. */
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
|
|
||||||
const Elf32_Sym *sym, const struct r_found_version *version,
|
|
||||||
void *const reloc_addr_arg)
|
|
||||||
{
|
|
||||||
Elf32_Addr *const reloc_addr = reloc_addr_arg;
|
|
||||||
const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
|
|
||||||
|
|
||||||
if (__builtin_expect (r_type == R_CRIS_RELATIVE, 0))
|
|
||||||
*reloc_addr = map->l_addr + reloc->r_addend;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#ifndef RTLD_BOOTSTRAP
|
|
||||||
const Elf32_Sym *const refsym = sym;
|
|
||||||
#endif
|
|
||||||
Elf32_Addr value;
|
|
||||||
if (sym->st_shndx != SHN_UNDEF
|
|
||||||
&& ELF32_ST_BIND (sym->st_info) == STB_LOCAL)
|
|
||||||
value = map->l_addr;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
value = RESOLVE (&sym, version, r_type);
|
|
||||||
if (sym)
|
|
||||||
value += sym->st_value;
|
|
||||||
}
|
|
||||||
value += reloc->r_addend; /* Assume copy relocs have zero addend. */
|
|
||||||
|
|
||||||
switch (r_type)
|
|
||||||
{
|
|
||||||
#ifndef RTLD_BOOTSTRAP
|
|
||||||
case R_CRIS_COPY:
|
|
||||||
if (sym == NULL)
|
|
||||||
/* This can happen in trace mode if an object could not be
|
|
||||||
found. */
|
|
||||||
break;
|
|
||||||
if (sym->st_size > refsym->st_size
|
|
||||||
|| (GL(dl_verbose) && sym->st_size < refsym->st_size))
|
|
||||||
{
|
|
||||||
const char *strtab;
|
|
||||||
|
|
||||||
strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
|
|
||||||
_dl_error_printf ("\
|
|
||||||
%s: Symbol `%s' has different size in shared object, consider re-linking\n",
|
|
||||||
rtld_progname ?: "<program name unknown>",
|
|
||||||
strtab + refsym->st_name);
|
|
||||||
}
|
|
||||||
memcpy (reloc_addr_arg, (void *) value,
|
|
||||||
MIN (sym->st_size, refsym->st_size));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case R_CRIS_32:
|
|
||||||
#endif
|
|
||||||
case R_CRIS_GLOB_DAT:
|
|
||||||
case R_CRIS_JUMP_SLOT:
|
|
||||||
*reloc_addr = value;
|
|
||||||
break;
|
|
||||||
#ifndef RTLD_BOOTSTRAP
|
|
||||||
case R_CRIS_8:
|
|
||||||
*(char *) reloc_addr = value;
|
|
||||||
break;
|
|
||||||
case R_CRIS_16:
|
|
||||||
*(short *) reloc_addr = value;
|
|
||||||
break;
|
|
||||||
case R_CRIS_8_PCREL:
|
|
||||||
*(char *) reloc_addr
|
|
||||||
= value + reloc->r_addend - (Elf32_Addr) reloc_addr - 1;
|
|
||||||
break;
|
|
||||||
case R_CRIS_16_PCREL:
|
|
||||||
*(short *) reloc_addr
|
|
||||||
= value + reloc->r_addend - (Elf32_Addr) reloc_addr - 2;
|
|
||||||
break;
|
|
||||||
case R_CRIS_32_PCREL:
|
|
||||||
*reloc_addr = value + reloc->r_addend - (Elf32_Addr) reloc_addr - 4;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case R_CRIS_NONE:
|
|
||||||
break;
|
|
||||||
#if !defined RTLD_BOOTSTRAP || defined _NDEBUG
|
|
||||||
default:
|
|
||||||
_dl_reloc_bad_type (map, r_type, 0);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
|
|
||||||
void *const reloc_addr_arg)
|
|
||||||
{
|
|
||||||
Elf32_Addr *const reloc_addr = reloc_addr_arg;
|
|
||||||
*reloc_addr = l_addr + reloc->r_addend;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
elf_machine_lazy_rel (struct link_map *map,
|
|
||||||
Elf32_Addr l_addr, const Elf32_Rela *reloc)
|
|
||||||
{
|
|
||||||
Elf32_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset);
|
|
||||||
const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
|
|
||||||
if (__builtin_expect (r_type == R_CRIS_JUMP_SLOT, 1))
|
|
||||||
*reloc_addr += l_addr;
|
|
||||||
else
|
|
||||||
_dl_reloc_bad_type (map, r_type, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* RESOLVE */
|
|
@ -1,141 +0,0 @@
|
|||||||
/* Startup code compliant to the ELF CRIS ABI (to-be-written).
|
|
||||||
Copyright (C) 2001, 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.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU Lesser General Public
|
|
||||||
License, the Free Software Foundation gives you unlimited
|
|
||||||
permission to link the compiled version of this file with other
|
|
||||||
programs, and to distribute those programs without any restriction
|
|
||||||
coming from the use of this file. (The GNU Lesser General Public
|
|
||||||
License restrictions do apply in other respects; for example, they
|
|
||||||
cover modification of the file, and distribution when not linked
|
|
||||||
into another program.)
|
|
||||||
|
|
||||||
Note that people who make modified versions of this file are not
|
|
||||||
obligated to grant this special exception for their modified
|
|
||||||
versions; it is their choice whether to do so. The GNU Lesser
|
|
||||||
General Public License gives permission to release a modified
|
|
||||||
version without this exception; this exception also makes it
|
|
||||||
possible to release a modified version which carries forward this
|
|
||||||
exception.
|
|
||||||
|
|
||||||
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. */
|
|
||||||
|
|
||||||
#include <sysdep.h>
|
|
||||||
|
|
||||||
/* This is the canonical entry point, usually the first thing in the text
|
|
||||||
segment. When the entry point runs, most registers' values are
|
|
||||||
unspecified, except for:
|
|
||||||
|
|
||||||
R10 Contains a function pointer to be registered with `atexit'.
|
|
||||||
This is how the dynamic linker arranges to have DT_FINI
|
|
||||||
functions called for shared libraries that have been loaded
|
|
||||||
before this code runs.
|
|
||||||
|
|
||||||
SP The stack contains the arguments and environment:
|
|
||||||
[SP] argc
|
|
||||||
[SP+4] argv[0]
|
|
||||||
...
|
|
||||||
[SP+4*argc] NULL
|
|
||||||
[SP+4*(argc+1)] envp[0]
|
|
||||||
...
|
|
||||||
NULL
|
|
||||||
*/
|
|
||||||
|
|
||||||
.syntax no_register_prefix
|
|
||||||
|
|
||||||
.text
|
|
||||||
.globl _start
|
|
||||||
.type _start,@function
|
|
||||||
_start:
|
|
||||||
/* Clear the frame pointer, to mark the outermost frame. */
|
|
||||||
moveq 0,r8
|
|
||||||
|
|
||||||
/* Move the shared library termination function to the right place
|
|
||||||
for __libc_main. */
|
|
||||||
move.d r10,r9
|
|
||||||
|
|
||||||
/* Extract the arguments as encoded on the stack and set up the
|
|
||||||
arguments for `main': argc, argv. envp will be determined
|
|
||||||
later in __libc_start_main. */
|
|
||||||
|
|
||||||
/* Get the argument count. */
|
|
||||||
move.d [sp],r11
|
|
||||||
|
|
||||||
/* Store the stack pointer as end of stack. We overwrite
|
|
||||||
the incoming argc. */
|
|
||||||
move.d sp,[sp]
|
|
||||||
|
|
||||||
/* The argument vector starts just after the argument count. */
|
|
||||||
move.d sp,r12
|
|
||||||
addq 4,r12
|
|
||||||
|
|
||||||
/* There are seven arguments to __libc_start_main:
|
|
||||||
r10: main - Address of it.
|
|
||||||
r11: argc
|
|
||||||
r12: argv
|
|
||||||
r13: init - Function to call.
|
|
||||||
|
|
||||||
[sp]: fini - Function to register with atexit.
|
|
||||||
[sp+4]: rtld_fini - Another function to register with atexit.
|
|
||||||
[sp+8]: stack_end - Top of stack (actually same as argv).
|
|
||||||
|
|
||||||
The last two are passed on stack. */
|
|
||||||
|
|
||||||
/* Store the fini function coming from the dynamic loader. */
|
|
||||||
push r9
|
|
||||||
|
|
||||||
/* Get the addresses of our own entry points to `.fini' and
|
|
||||||
`.init'. */
|
|
||||||
|
|
||||||
#ifdef __PIC__
|
|
||||||
/* If for some reason this program is compiled as PIC, set up R0. */
|
|
||||||
move.d pc,r0
|
|
||||||
sub.d .:GOTOFF,r0
|
|
||||||
|
|
||||||
move.d __libc_csu_init:PLTG,r13
|
|
||||||
add.d r0,r13
|
|
||||||
move.d __libc_csu_fini:PLTG,r9
|
|
||||||
add.d r0,r9
|
|
||||||
move.d main:PLTG,r10
|
|
||||||
add.d r0,r10
|
|
||||||
#else
|
|
||||||
move.d __libc_csu_init,r13
|
|
||||||
move.d __libc_csu_fini,r9
|
|
||||||
move.d main,r10
|
|
||||||
#endif
|
|
||||||
push r9
|
|
||||||
|
|
||||||
/* Call the user's main function, and exit with its value. But
|
|
||||||
let the libc call main. */
|
|
||||||
PLTCALL (__libc_start_main)
|
|
||||||
|
|
||||||
/* Crash if somehow `exit' does return. We have at least 8192
|
|
||||||
invalid addresses to choose from. */
|
|
||||||
test.d [6502]
|
|
||||||
|
|
||||||
/* Stop the unstoppable. */
|
|
||||||
0:
|
|
||||||
ba 0b
|
|
||||||
nop
|
|
||||||
|
|
||||||
/* Define a symbol for the first piece of initialized data. */
|
|
||||||
.data
|
|
||||||
.globl __data_start
|
|
||||||
__data_start:
|
|
||||||
.long 0
|
|
||||||
.weak data_start
|
|
||||||
data_start = __data_start
|
|
@ -1,28 +0,0 @@
|
|||||||
/* PowerPC-specific implementation of profiling support.
|
|
||||||
Copyright (C) 1997, 2001 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. */
|
|
||||||
|
|
||||||
void __mcount_internal (unsigned long frompc, unsigned long selfpc);
|
|
||||||
|
|
||||||
#define _MCOUNT_DECL(frompc, selfpc) \
|
|
||||||
void __mcount_internal (unsigned long frompc, unsigned long selfpc)
|
|
||||||
|
|
||||||
|
|
||||||
/* Define MCOUNT as empty since we have the implementation in another
|
|
||||||
file. FIXME: Just stubs, currently. */
|
|
||||||
#define MCOUNT
|
|
@ -1,57 +0,0 @@
|
|||||||
/* Copyright (C) 2001 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. */
|
|
||||||
|
|
||||||
#include <sysdeps/generic/memcopy.h>
|
|
||||||
|
|
||||||
/* We override the word-copying macros, partly because misalignment in one
|
|
||||||
pointer isn't cause for a special function, partly because we want to
|
|
||||||
get rid of wordcopy.c; these macros are only used in memmove.c (and
|
|
||||||
it's sibling bcopy) since we have arch-specific mempcpy, memcpy and
|
|
||||||
memset. */
|
|
||||||
|
|
||||||
#undef OP_T_THRES
|
|
||||||
#define OP_T_THRES OPSIZ
|
|
||||||
|
|
||||||
#define WORD_COPY_FWD(dst_bp, src_bp, nbytes_left, nbytes) \
|
|
||||||
do \
|
|
||||||
{ \
|
|
||||||
unsigned long enddst_bp = dst_bp + nbytes - (nbytes % OPSIZ); \
|
|
||||||
nbytes_left = (nbytes % OPSIZ); \
|
|
||||||
while (dst_bp < (unsigned long) enddst_bp) \
|
|
||||||
{ \
|
|
||||||
op_t x = *(op_t *) src_bp; \
|
|
||||||
src_bp += sizeof x; \
|
|
||||||
*(op_t *) dst_bp = x; \
|
|
||||||
dst_bp += sizeof x; \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define WORD_COPY_BWD(dst_bp, src_bp, nbytes_left, nbytes) \
|
|
||||||
do \
|
|
||||||
{ \
|
|
||||||
unsigned long enddst_bp = dst_bp - nbytes + (nbytes % OPSIZ); \
|
|
||||||
nbytes_left = (nbytes % OPSIZ); \
|
|
||||||
while (dst_bp > enddst_bp) \
|
|
||||||
{ \
|
|
||||||
op_t x; \
|
|
||||||
src_bp -= sizeof x; \
|
|
||||||
x = *(op_t *) src_bp; \
|
|
||||||
dst_bp -= sizeof x; \
|
|
||||||
*(op_t *) dst_bp = x; \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
@ -1,27 +0,0 @@
|
|||||||
/* Copyright (C) 2001 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. */
|
|
||||||
|
|
||||||
/* No asm variables, just for reasons of solid healthy paranoia. */
|
|
||||||
#define GETSP() \
|
|
||||||
({ \
|
|
||||||
uintptr_t stack_ptr; \
|
|
||||||
__asm__ ("move.d $sp,%0" : "=rm" (stack_ptr)); \
|
|
||||||
stack_ptr; \
|
|
||||||
})
|
|
||||||
|
|
||||||
#include <sysdeps/generic/memusage.h>
|
|
@ -1,66 +0,0 @@
|
|||||||
/* setjmp for CRIS.
|
|
||||||
Copyright (C) 2001 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. */
|
|
||||||
|
|
||||||
#include <sysdep.h>
|
|
||||||
#define _SETJMP_H
|
|
||||||
#define _ASM
|
|
||||||
#include <bits/setjmp.h>
|
|
||||||
|
|
||||||
.syntax no_register_prefix
|
|
||||||
|
|
||||||
ENTRY (__sigsetjmp)
|
|
||||||
.Local__sigsetjmp:
|
|
||||||
moveq 1,r9
|
|
||||||
movem sp,[r10+1*4]
|
|
||||||
#ifdef __PIC__
|
|
||||||
move.d pc,r9
|
|
||||||
addq 0f-.,r9
|
|
||||||
#else
|
|
||||||
move.d 0f,r9
|
|
||||||
#endif
|
|
||||||
move.d r9,[r10]
|
|
||||||
move srp,[r10+16*4]
|
|
||||||
move ccr,[r10+17*4]
|
|
||||||
PLTJUMP (__sigjmp_save)
|
|
||||||
0: /* This is where longjmp returns. (Don't use "ret" - it's a macro. */
|
|
||||||
Ret
|
|
||||||
move.d r9,r10
|
|
||||||
END (__sigsetjmp)
|
|
||||||
|
|
||||||
/* Binary compatibility entry points. Having these in separate files
|
|
||||||
is not meaningful and just adds library overhead. */
|
|
||||||
|
|
||||||
ENTRY (__setjmp)
|
|
||||||
ba .Local__sigsetjmp
|
|
||||||
moveq 0,r11
|
|
||||||
END (__setjmp)
|
|
||||||
|
|
||||||
ENTRY (_setjmp)
|
|
||||||
ba .Local__sigsetjmp
|
|
||||||
moveq 0,r11
|
|
||||||
END (_setjmp)
|
|
||||||
|
|
||||||
ENTRY (setjmp)
|
|
||||||
ba .Local__sigsetjmp
|
|
||||||
moveq 1,r11
|
|
||||||
END (setjmp)
|
|
||||||
|
|
||||||
weak_extern (__setjmp)
|
|
||||||
weak_extern (_setjmp)
|
|
||||||
weak_extern (setjmp)
|
|
@ -1,28 +0,0 @@
|
|||||||
/* 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. */
|
|
||||||
|
|
||||||
/* This file contains a bit of information about the stack allocation
|
|
||||||
of the processor. */
|
|
||||||
|
|
||||||
#ifndef _STACKINFO_H
|
|
||||||
#define _STACKINFO_H 1
|
|
||||||
|
|
||||||
/* On cris the stack grows down. */
|
|
||||||
#define _STACK_GROWS_DOWN 1
|
|
||||||
|
|
||||||
#endif /* stackinfo.h */
|
|
@ -1,114 +0,0 @@
|
|||||||
/* Assembler macros for CRIS.
|
|
||||||
Copyright (C) 1999, 2000, 2001 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. */
|
|
||||||
|
|
||||||
#include <sysdeps/generic/sysdep.h>
|
|
||||||
|
|
||||||
#ifndef HAVE_ELF
|
|
||||||
# error ELF is assumed. Generalize the code and retry.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NO_UNDERSCORES
|
|
||||||
# error User-label prefix (underscore) assumed absent. Generalize the code and retry.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __ASSEMBLER__
|
|
||||||
|
|
||||||
/* Syntactic details of assembly-code. */
|
|
||||||
|
|
||||||
/* It is *not* generally true that "ELF uses byte-counts for .align, most
|
|
||||||
others use log2 of count of bytes", like some neighboring configs say.
|
|
||||||
See "align" in gas/read.c which is not overridden by
|
|
||||||
gas/config/obj-elf.c. It takes a log2 argument. *Some* targets
|
|
||||||
override it to take a byte argument. People should read source instead
|
|
||||||
of relying on hearsay. */
|
|
||||||
# define ALIGNARG(log2) log2
|
|
||||||
|
|
||||||
# define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg
|
|
||||||
# define ASM_SIZE_DIRECTIVE(name) .size name,.-name
|
|
||||||
|
|
||||||
/* The non-PIC jump is preferred, since it does not stall, and does not
|
|
||||||
invoke generation of a PLT. These macros assume that $r0 is set up as
|
|
||||||
GOT register. */
|
|
||||||
# ifdef __PIC__
|
|
||||||
# define PLTJUMP(_x) \
|
|
||||||
add.d C_SYMBOL_NAME (_x):PLT,$pc
|
|
||||||
|
|
||||||
# define PLTCALL(_x) \
|
|
||||||
move.d C_SYMBOL_NAME (_x):PLTG,$r9 @ \
|
|
||||||
add.d $r0,$r9 @ \
|
|
||||||
jsr $r9
|
|
||||||
|
|
||||||
# define SETUP_PIC \
|
|
||||||
push $r0 @ \
|
|
||||||
move.d $pc,$r0 @ \
|
|
||||||
sub.d .:GOTOFF,$r0
|
|
||||||
|
|
||||||
# define TEARDOWN_PIC pop $r0
|
|
||||||
# else
|
|
||||||
# define PLTJUMP(_x) jump C_SYMBOL_NAME (_x)
|
|
||||||
# define PLTCALL(_x) jsr C_SYMBOL_NAME (_x)
|
|
||||||
# define SETUP_PIC
|
|
||||||
# define TEARDOWN_PIC
|
|
||||||
# endif
|
|
||||||
|
|
||||||
/* Define an entry point visible from C. */
|
|
||||||
# define ENTRY(name) \
|
|
||||||
.text @ \
|
|
||||||
ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (name) @ \
|
|
||||||
ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME (name), function) @ \
|
|
||||||
.align ALIGNARG (2) @ \
|
|
||||||
C_LABEL(name) @ \
|
|
||||||
CALL_MCOUNT
|
|
||||||
|
|
||||||
# undef END
|
|
||||||
# define END(name) \
|
|
||||||
ASM_SIZE_DIRECTIVE (C_SYMBOL_NAME (name))
|
|
||||||
|
|
||||||
/* If compiled for profiling, call `mcount' at the start of each function.
|
|
||||||
FIXME: Note that profiling is not actually implemented. This is just
|
|
||||||
example code which might not even compile, though it is believed to be
|
|
||||||
correct. */
|
|
||||||
# ifdef PROF
|
|
||||||
# define CALL_MCOUNT \
|
|
||||||
push $srp @ \
|
|
||||||
push $r9 @ \
|
|
||||||
push $r10 @ \
|
|
||||||
push $r11 @ \
|
|
||||||
push $r12 @ \
|
|
||||||
push $r13 @ \
|
|
||||||
SETUP_PIC @ \
|
|
||||||
PLTCALL (mcount) @ \
|
|
||||||
TEARDOWN_PIC @ \
|
|
||||||
pop $r13 @ \
|
|
||||||
pop $r12 @ \
|
|
||||||
pop $r11 @ \
|
|
||||||
pop $r10 @ \
|
|
||||||
pop $r9 @ \
|
|
||||||
pop $srp
|
|
||||||
# else
|
|
||||||
# define CALL_MCOUNT /* Do nothing. */
|
|
||||||
# endif
|
|
||||||
|
|
||||||
/* Since C identifiers are not normally prefixed with an underscore
|
|
||||||
on this system, the asm identifier `syscall_error' intrudes on the
|
|
||||||
C name space. Make sure we use an innocuous name. */
|
|
||||||
# define syscall_error __syscall_error
|
|
||||||
# define mcount _mcount
|
|
||||||
|
|
||||||
#endif /* __ASSEMBLER__ */
|
|
@ -1 +0,0 @@
|
|||||||
/* Empty; not needed. */
|
|
@ -1,33 +0,0 @@
|
|||||||
/* Copyright (C) 1991, 1997 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. */
|
|
||||||
|
|
||||||
#include <sysdeps/generic/memcopy.h>
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
#undef MERGE
|
|
||||||
/* In order to make this work properly, an 's' constraint need to be added
|
|
||||||
to tm-i860.h, to mean the SC register. */
|
|
||||||
#define MERGE(w0, sh_1, w1, sh_2) \
|
|
||||||
({ \
|
|
||||||
unsigned int __merge; \
|
|
||||||
asm("shrd %2,%1,%0" : \
|
|
||||||
"=r" (__merge) : \
|
|
||||||
"r" (w0), "r" (w1), "s" (sh_1)); \
|
|
||||||
__merge; \
|
|
||||||
})
|
|
||||||
#endif
|
|
@ -1,3 +0,0 @@
|
|||||||
# i960 family uses IEEE 754 floating point.
|
|
||||||
ieee754/flt-32
|
|
||||||
ieee754/dbl-64
|
|
@ -1,21 +0,0 @@
|
|||||||
.text
|
|
||||||
.align 4
|
|
||||||
.globl ___mpn_add_n
|
|
||||||
___mpn_add_n:
|
|
||||||
mov 0,g6 # clear carry-save register
|
|
||||||
cmpo 1,0 # clear cy
|
|
||||||
|
|
||||||
Loop: subo 1,g3,g3 # update loop counter
|
|
||||||
ld (g1),g5 # load from s1_ptr
|
|
||||||
addo 4,g1,g1 # s1_ptr++
|
|
||||||
ld (g2),g4 # load from s2_ptr
|
|
||||||
addo 4,g2,g2 # s2_ptr++
|
|
||||||
cmpo g6,1 # restore cy from g6, relies on cy being 0
|
|
||||||
addc g4,g5,g4 # main add
|
|
||||||
subc 0,0,g6 # save cy in g6
|
|
||||||
st g4,(g0) # store result to res_ptr
|
|
||||||
addo 4,g0,g0 # res_ptr++
|
|
||||||
cmpobne 0,g3,Loop # when branch is taken, clears C bit
|
|
||||||
|
|
||||||
mov g6,g0
|
|
||||||
ret
|
|
@ -1,26 +0,0 @@
|
|||||||
.text
|
|
||||||
.align 4
|
|
||||||
.globl ___mpn_mul_1
|
|
||||||
___mpn_mul_1:
|
|
||||||
subo g2,0,g2
|
|
||||||
shlo 2,g2,g4
|
|
||||||
subo g4,g1,g1
|
|
||||||
subo g4,g0,g13
|
|
||||||
mov 0,g0
|
|
||||||
|
|
||||||
cmpo 1,0 # clear C bit on AC.cc
|
|
||||||
|
|
||||||
Loop: ld (g1)[g2*4],g5
|
|
||||||
emul g3,g5,g6
|
|
||||||
ld (g13)[g2*4],g5
|
|
||||||
|
|
||||||
addc g0,g6,g6 # relies on that C bit is clear
|
|
||||||
addc 0,g7,g7
|
|
||||||
addc g5,g6,g6 # relies on that C bit is clear
|
|
||||||
st g6,(g13)[g2*4]
|
|
||||||
addc 0,g7,g0
|
|
||||||
|
|
||||||
addo g2,1,g2
|
|
||||||
cmpobne 0,g2,Loop # when branch is taken, clears C bit
|
|
||||||
|
|
||||||
ret
|
|
@ -1,46 +0,0 @@
|
|||||||
/* ffs -- find first set bit in a word, counted from least significant end.
|
|
||||||
For i960 Core architecture
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Copyright (C) 1994, 1997, 2004 Free Software Foundation, Inc.
|
|
||||||
Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
|
|
||||||
On-Line Applications Research Corporation.
|
|
||||||
|
|
||||||
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. */
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#undef ffs
|
|
||||||
|
|
||||||
#if defined (__GNUC__) && defined (__i960__)
|
|
||||||
|
|
||||||
int
|
|
||||||
__ffs (x)
|
|
||||||
int x;
|
|
||||||
{
|
|
||||||
int cnt;
|
|
||||||
|
|
||||||
asm ("scanbit %1,%0" : "=d" (cnt) : "rm" (x & -x));
|
|
||||||
|
|
||||||
return cnt;
|
|
||||||
}
|
|
||||||
weak_alias (__ffs, ffs)
|
|
||||||
libc_hidden_builtin_def (ffs)
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#include <sysdeps/generic/ffs.c>
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,23 +0,0 @@
|
|||||||
.text
|
|
||||||
.align 4
|
|
||||||
.globl ___mpn_mul_1
|
|
||||||
___mpn_mul_1:
|
|
||||||
subo g2,0,g2
|
|
||||||
shlo 2,g2,g4
|
|
||||||
subo g4,g1,g1
|
|
||||||
subo g4,g0,g13
|
|
||||||
mov 0,g0
|
|
||||||
|
|
||||||
cmpo 1,0 # clear C bit on AC.cc
|
|
||||||
|
|
||||||
Loop: ld (g1)[g2*4],g5
|
|
||||||
emul g3,g5,g6
|
|
||||||
|
|
||||||
addc g0,g6,g6 # relies on that C bit is clear
|
|
||||||
st g6,(g13)[g2*4]
|
|
||||||
addc 0,g7,g0
|
|
||||||
|
|
||||||
addo g2,1,g2
|
|
||||||
cmpobne 0,g2,Loop # when branch is taken, clears C bit
|
|
||||||
|
|
||||||
ret
|
|
@ -1,21 +0,0 @@
|
|||||||
.text
|
|
||||||
.align 4
|
|
||||||
.globl ___mpn_sub_n
|
|
||||||
___mpn_sub_n:
|
|
||||||
mov 1,g6 # set carry-save register
|
|
||||||
cmpo 1,0 # clear cy
|
|
||||||
|
|
||||||
Loop: subo 1,g3,g3 # update loop counter
|
|
||||||
ld (g1),g5 # load from s1_ptr
|
|
||||||
addo 4,g1,g1 # s1_ptr++
|
|
||||||
ld (g2),g4 # load from s2_ptr
|
|
||||||
addo 4,g2,g2 # s2_ptr++
|
|
||||||
cmpo g6,1 # restore cy from g6, relies on cy being 0
|
|
||||||
subc g4,g5,g4 # main subtract
|
|
||||||
subc 0,0,g6 # save cy in g6
|
|
||||||
st g4,(g0) # store result to res_ptr
|
|
||||||
addo 4,g0,g0 # res_ptr++
|
|
||||||
cmpobne 0,g3,Loop # when branch is taken, cy will be 0
|
|
||||||
|
|
||||||
mov g6,g0
|
|
||||||
ret
|
|
@ -1,104 +0,0 @@
|
|||||||
; mc88100 __mpn_add -- Add two limb vectors of the same length > 0 and store
|
|
||||||
; sum in a third limb vector.
|
|
||||||
|
|
||||||
; Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
; This file is part of the GNU MP Library.
|
|
||||||
|
|
||||||
; The GNU MP 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 MP 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 MP 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.
|
|
||||||
|
|
||||||
|
|
||||||
; INPUT PARAMETERS
|
|
||||||
; res_ptr r2
|
|
||||||
; s1_ptr r3
|
|
||||||
; s2_ptr r4
|
|
||||||
; size r5
|
|
||||||
|
|
||||||
; This code has been optimized to run one instruction per clock, avoiding
|
|
||||||
; load stalls and writeback contention. As a result, the instruction
|
|
||||||
; order is not always natural.
|
|
||||||
|
|
||||||
; The speed is about 4.6 clocks/limb + 18 clocks/limb-vector on an 88100,
|
|
||||||
; but on the 88110, it seems to run much slower, 6.6 clocks/limb.
|
|
||||||
|
|
||||||
text
|
|
||||||
align 16
|
|
||||||
global ___mpn_add_n
|
|
||||||
___mpn_add_n:
|
|
||||||
ld r6,r3,0 ; read first limb from s1_ptr
|
|
||||||
extu r10,r5,3
|
|
||||||
ld r7,r4,0 ; read first limb from s2_ptr
|
|
||||||
|
|
||||||
subu.co r5,r0,r5 ; (clear carry as side effect)
|
|
||||||
mak r5,r5,3<4>
|
|
||||||
bcnd eq0,r5,Lzero
|
|
||||||
|
|
||||||
or r12,r0,lo16(Lbase)
|
|
||||||
or.u r12,r12,hi16(Lbase)
|
|
||||||
addu r12,r12,r5 ; r12 is address for entering in loop
|
|
||||||
|
|
||||||
extu r5,r5,2 ; divide by 4
|
|
||||||
subu r2,r2,r5 ; adjust res_ptr
|
|
||||||
subu r3,r3,r5 ; adjust s1_ptr
|
|
||||||
subu r4,r4,r5 ; adjust s2_ptr
|
|
||||||
|
|
||||||
or r8,r6,r0
|
|
||||||
|
|
||||||
jmp.n r12
|
|
||||||
or r9,r7,r0
|
|
||||||
|
|
||||||
Loop: addu r3,r3,32
|
|
||||||
st r8,r2,28
|
|
||||||
addu r4,r4,32
|
|
||||||
ld r6,r3,0
|
|
||||||
addu r2,r2,32
|
|
||||||
ld r7,r4,0
|
|
||||||
Lzero: subu r10,r10,1 ; add 0 + 8r limbs (adj loop cnt)
|
|
||||||
Lbase: ld r8,r3,4
|
|
||||||
addu.cio r6,r6,r7
|
|
||||||
ld r9,r4,4
|
|
||||||
st r6,r2,0
|
|
||||||
ld r6,r3,8 ; add 7 + 8r limbs
|
|
||||||
addu.cio r8,r8,r9
|
|
||||||
ld r7,r4,8
|
|
||||||
st r8,r2,4
|
|
||||||
ld r8,r3,12 ; add 6 + 8r limbs
|
|
||||||
addu.cio r6,r6,r7
|
|
||||||
ld r9,r4,12
|
|
||||||
st r6,r2,8
|
|
||||||
ld r6,r3,16 ; add 5 + 8r limbs
|
|
||||||
addu.cio r8,r8,r9
|
|
||||||
ld r7,r4,16
|
|
||||||
st r8,r2,12
|
|
||||||
ld r8,r3,20 ; add 4 + 8r limbs
|
|
||||||
addu.cio r6,r6,r7
|
|
||||||
ld r9,r4,20
|
|
||||||
st r6,r2,16
|
|
||||||
ld r6,r3,24 ; add 3 + 8r limbs
|
|
||||||
addu.cio r8,r8,r9
|
|
||||||
ld r7,r4,24
|
|
||||||
st r8,r2,20
|
|
||||||
ld r8,r3,28 ; add 2 + 8r limbs
|
|
||||||
addu.cio r6,r6,r7
|
|
||||||
ld r9,r4,28
|
|
||||||
st r6,r2,24
|
|
||||||
bcnd.n ne0,r10,Loop ; add 1 + 8r limbs
|
|
||||||
addu.cio r8,r8,r9
|
|
||||||
|
|
||||||
st r8,r2,28 ; store most significant limb
|
|
||||||
|
|
||||||
jmp.n r1
|
|
||||||
addu.ci r2,r0,r0 ; return carry-out from most sign. limb
|
|
@ -1,45 +0,0 @@
|
|||||||
/* ffs -- find first set bit in a word, counted from least significant end.
|
|
||||||
For Motorola 88000.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Copyright (C) 1991, 1992, 1997, 2004 Free Software Foundation, Inc.
|
|
||||||
Contributed by Torbjorn Granlund (tege@sics.se).
|
|
||||||
|
|
||||||
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. */
|
|
||||||
|
|
||||||
#include <bstring.h>
|
|
||||||
|
|
||||||
#undef ffs
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
|
|
||||||
int
|
|
||||||
__ffs (x)
|
|
||||||
int x;
|
|
||||||
{
|
|
||||||
int cnt;
|
|
||||||
|
|
||||||
if (x == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
asm ("ff1 %0,%1" : "=r" (cnt) : "r" (x & -x));
|
|
||||||
return cnt + 1;
|
|
||||||
}
|
|
||||||
weak_alias (__ffs, ffs)
|
|
||||||
libc_hidden_builtin_def (ffs)
|
|
||||||
|
|
||||||
#else
|
|
||||||
#include <sysdeps/generic/ffs.c>
|
|
||||||
#endif
|
|
@ -1,133 +0,0 @@
|
|||||||
; mc88100 __mpn_add -- Add two limb vectors of the same length > 0 and store
|
|
||||||
; sum in a third limb vector.
|
|
||||||
|
|
||||||
; Copyright (C) 1992, 1994 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
; This file is part of the GNU MP Library.
|
|
||||||
|
|
||||||
; The GNU MP Library is free software; you can redistribute it and/or modify
|
|
||||||
; it under the terms of the GNU General Public License as published by
|
|
||||||
; the Free Software Foundation; either version 2, or (at your option)
|
|
||||||
; any later version.
|
|
||||||
|
|
||||||
; The GNU MP 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 General Public License for more details.
|
|
||||||
|
|
||||||
; You should have received a copy of the GNU General Public License
|
|
||||||
; along with the GNU MP Library; see the file COPYING. If not, write to
|
|
||||||
; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
|
|
||||||
|
|
||||||
; INPUT PARAMETERS
|
|
||||||
; res_ptr r2
|
|
||||||
; s1_ptr r3
|
|
||||||
; s2_ptr r4
|
|
||||||
; size r5
|
|
||||||
|
|
||||||
; This code has been optimized to run one instruction per clock, avoiding
|
|
||||||
; load stalls and writeback contention. As a result, the instruction
|
|
||||||
; order is not always natural.
|
|
||||||
|
|
||||||
; The speed is approximately 4.3 clocks/limb + 18 clocks/limb-vector.
|
|
||||||
|
|
||||||
#include "sysdep.h"
|
|
||||||
|
|
||||||
ENTRY (__mpn_add_n)
|
|
||||||
ld r6,r3,0 ; read first limb from s1_ptr
|
|
||||||
extu r10,r5,4
|
|
||||||
ld r7,r4,0 ; read first limb from s2_ptr
|
|
||||||
|
|
||||||
subu.co r5,r0,r5 ; (clear carry as side effect)
|
|
||||||
mak r5,r5,4<4>
|
|
||||||
bcnd eq0,r5,Lzero
|
|
||||||
|
|
||||||
or r12,r0,lo16(Lbase)
|
|
||||||
or.u r12,r12,hi16(Lbase)
|
|
||||||
addu r12,r12,r5 ; r12 is address for entering in loop
|
|
||||||
|
|
||||||
extu r5,r5,2 ; divide by 4
|
|
||||||
subu r2,r2,r5 ; adjust res_ptr
|
|
||||||
subu r3,r3,r5 ; adjust s1_ptr
|
|
||||||
subu r4,r4,r5 ; adjust s2_ptr
|
|
||||||
|
|
||||||
or r8,r6,r0
|
|
||||||
|
|
||||||
jmp.n r12
|
|
||||||
or r9,r7,r0
|
|
||||||
|
|
||||||
Loop: addu r3,r3,64
|
|
||||||
st r8,r2,60
|
|
||||||
addu r4,r4,64
|
|
||||||
ld r6,r3,0
|
|
||||||
addu r2,r2,64
|
|
||||||
ld r7,r4,0
|
|
||||||
Lzero: subu r10,r10,1 ; add 0 + 16r limbs (adjust loop counter)
|
|
||||||
Lbase: ld r8,r3,4
|
|
||||||
addu.cio r6,r6,r7
|
|
||||||
ld r9,r4,4
|
|
||||||
st r6,r2,0
|
|
||||||
ld r6,r3,8 ; add 15 + 16r limbs
|
|
||||||
addu.cio r8,r8,r9
|
|
||||||
ld r7,r4,8
|
|
||||||
st r8,r2,4
|
|
||||||
ld r8,r3,12 ; add 14 + 16r limbs
|
|
||||||
addu.cio r6,r6,r7
|
|
||||||
ld r9,r4,12
|
|
||||||
st r6,r2,8
|
|
||||||
ld r6,r3,16 ; add 13 + 16r limbs
|
|
||||||
addu.cio r8,r8,r9
|
|
||||||
ld r7,r4,16
|
|
||||||
st r8,r2,12
|
|
||||||
ld r8,r3,20 ; add 12 + 16r limbs
|
|
||||||
addu.cio r6,r6,r7
|
|
||||||
ld r9,r4,20
|
|
||||||
st r6,r2,16
|
|
||||||
ld r6,r3,24 ; add 11 + 16r limbs
|
|
||||||
addu.cio r8,r8,r9
|
|
||||||
ld r7,r4,24
|
|
||||||
st r8,r2,20
|
|
||||||
ld r8,r3,28 ; add 10 + 16r limbs
|
|
||||||
addu.cio r6,r6,r7
|
|
||||||
ld r9,r4,28
|
|
||||||
st r6,r2,24
|
|
||||||
ld r6,r3,32 ; add 9 + 16r limbs
|
|
||||||
addu.cio r8,r8,r9
|
|
||||||
ld r7,r4,32
|
|
||||||
st r8,r2,28
|
|
||||||
ld r8,r3,36 ; add 8 + 16r limbs
|
|
||||||
addu.cio r6,r6,r7
|
|
||||||
ld r9,r4,36
|
|
||||||
st r6,r2,32
|
|
||||||
ld r6,r3,40 ; add 7 + 16r limbs
|
|
||||||
addu.cio r8,r8,r9
|
|
||||||
ld r7,r4,40
|
|
||||||
st r8,r2,36
|
|
||||||
ld r8,r3,44 ; add 6 + 16r limbs
|
|
||||||
addu.cio r6,r6,r7
|
|
||||||
ld r9,r4,44
|
|
||||||
st r6,r2,40
|
|
||||||
ld r6,r3,48 ; add 5 + 16r limbs
|
|
||||||
addu.cio r8,r8,r9
|
|
||||||
ld r7,r4,48
|
|
||||||
st r8,r2,44
|
|
||||||
ld r8,r3,52 ; add 4 + 16r limbs
|
|
||||||
addu.cio r6,r6,r7
|
|
||||||
ld r9,r4,52
|
|
||||||
st r6,r2,48
|
|
||||||
ld r6,r3,56 ; add 3 + 16r limbs
|
|
||||||
addu.cio r8,r8,r9
|
|
||||||
ld r7,r4,56
|
|
||||||
st r8,r2,52
|
|
||||||
ld r8,r3,60 ; add 2 + 16r limbs
|
|
||||||
addu.cio r6,r6,r7
|
|
||||||
ld r9,r4,60
|
|
||||||
st r6,r2,56
|
|
||||||
bcnd.n ne0,r10,Loop ; add 1 + 16r limbs
|
|
||||||
addu.cio r8,r8,r9
|
|
||||||
|
|
||||||
st r8,r2,60 ; store most significant limb
|
|
||||||
|
|
||||||
jmp.n r1
|
|
||||||
addu.ci r2,r0,r0 ; return carry-out from most sign. limb
|
|
@ -1,103 +0,0 @@
|
|||||||
; mc88100 __mpn_add -- Add two limb vectors of the same length > 0 and store
|
|
||||||
; sum in a third limb vector.
|
|
||||||
|
|
||||||
; Copyright (C) 1992, 1994 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
; This file is part of the GNU MP Library.
|
|
||||||
|
|
||||||
; The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB. If not, write to
|
|
||||||
; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
|
|
||||||
|
|
||||||
; INPUT PARAMETERS
|
|
||||||
; res_ptr r2
|
|
||||||
; s1_ptr r3
|
|
||||||
; s2_ptr r4
|
|
||||||
; size r5
|
|
||||||
|
|
||||||
; This code has been optimized to run one instruction per clock, avoiding
|
|
||||||
; load stalls and writeback contention. As a result, the instruction
|
|
||||||
; order is not always natural.
|
|
||||||
|
|
||||||
; The speed is about 4.6 clocks/limb + 18 clocks/limb-vector on an 88100,
|
|
||||||
; but on the 88110, it seems to run much slower, 6.6 clocks/limb.
|
|
||||||
|
|
||||||
text
|
|
||||||
align 16
|
|
||||||
global ___mpn_add_n
|
|
||||||
___mpn_add_n:
|
|
||||||
ld r6,r3,0 ; read first limb from s1_ptr
|
|
||||||
extu r10,r5,3
|
|
||||||
ld r7,r4,0 ; read first limb from s2_ptr
|
|
||||||
|
|
||||||
subu.co r5,r0,r5 ; (clear carry as side effect)
|
|
||||||
mak r5,r5,3<4>
|
|
||||||
bcnd eq0,r5,Lzero
|
|
||||||
|
|
||||||
or r12,r0,lo16(Lbase)
|
|
||||||
or.u r12,r12,hi16(Lbase)
|
|
||||||
addu r12,r12,r5 ; r12 is address for entering in loop
|
|
||||||
|
|
||||||
extu r5,r5,2 ; divide by 4
|
|
||||||
subu r2,r2,r5 ; adjust res_ptr
|
|
||||||
subu r3,r3,r5 ; adjust s1_ptr
|
|
||||||
subu r4,r4,r5 ; adjust s2_ptr
|
|
||||||
|
|
||||||
or r8,r6,r0
|
|
||||||
|
|
||||||
jmp.n r12
|
|
||||||
or r9,r7,r0
|
|
||||||
|
|
||||||
Loop: addu r3,r3,32
|
|
||||||
st r8,r2,28
|
|
||||||
addu r4,r4,32
|
|
||||||
ld r6,r3,0
|
|
||||||
addu r2,r2,32
|
|
||||||
ld r7,r4,0
|
|
||||||
Lzero: subu r10,r10,1 ; add 0 + 8r limbs (adj loop cnt)
|
|
||||||
Lbase: ld r8,r3,4
|
|
||||||
addu.cio r6,r6,r7
|
|
||||||
ld r9,r4,4
|
|
||||||
st r6,r2,0
|
|
||||||
ld r6,r3,8 ; add 7 + 8r limbs
|
|
||||||
addu.cio r8,r8,r9
|
|
||||||
ld r7,r4,8
|
|
||||||
st r8,r2,4
|
|
||||||
ld r8,r3,12 ; add 6 + 8r limbs
|
|
||||||
addu.cio r6,r6,r7
|
|
||||||
ld r9,r4,12
|
|
||||||
st r6,r2,8
|
|
||||||
ld r6,r3,16 ; add 5 + 8r limbs
|
|
||||||
addu.cio r8,r8,r9
|
|
||||||
ld r7,r4,16
|
|
||||||
st r8,r2,12
|
|
||||||
ld r8,r3,20 ; add 4 + 8r limbs
|
|
||||||
addu.cio r6,r6,r7
|
|
||||||
ld r9,r4,20
|
|
||||||
st r6,r2,16
|
|
||||||
ld r6,r3,24 ; add 3 + 8r limbs
|
|
||||||
addu.cio r8,r8,r9
|
|
||||||
ld r7,r4,24
|
|
||||||
st r8,r2,20
|
|
||||||
ld r8,r3,28 ; add 2 + 8r limbs
|
|
||||||
addu.cio r6,r6,r7
|
|
||||||
ld r9,r4,28
|
|
||||||
st r6,r2,24
|
|
||||||
bcnd.n ne0,r10,Loop ; add 1 + 8r limbs
|
|
||||||
addu.cio r8,r8,r9
|
|
||||||
|
|
||||||
st r8,r2,28 ; store most significant limb
|
|
||||||
|
|
||||||
jmp.n r1
|
|
||||||
addu.ci r2,r0,r0 ; return carry-out from most sign. limb
|
|
@ -1,127 +0,0 @@
|
|||||||
; mc88100 __mpn_mul_1 -- Multiply a limb vector with a single limb and
|
|
||||||
; store the product in a second limb vector.
|
|
||||||
|
|
||||||
; Copyright (C) 1992, 1994 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
; This file is part of the GNU MP Library.
|
|
||||||
|
|
||||||
; The GNU MP Library is free software; you can redistribute it and/or modify
|
|
||||||
; it under the terms of the GNU General Public License as published by
|
|
||||||
; the Free Software Foundation; either version 2, or (at your option)
|
|
||||||
; any later version.
|
|
||||||
|
|
||||||
; The GNU MP 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 General Public License for more details.
|
|
||||||
|
|
||||||
; You should have received a copy of the GNU General Public License
|
|
||||||
; along with the GNU MP Library; see the file COPYING. If not, write to
|
|
||||||
; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
|
|
||||||
|
|
||||||
; INPUT PARAMETERS
|
|
||||||
; res_ptr r2
|
|
||||||
; s1_ptr r3
|
|
||||||
; size r4
|
|
||||||
; s2_limb r5
|
|
||||||
|
|
||||||
; Common overhead is about 11 cycles/invocation.
|
|
||||||
|
|
||||||
; The speed for S2_LIMB >= 0x10000 is approximately 21 cycles/limb. (The
|
|
||||||
; pipeline stalls 2 cycles due to WB contention.)
|
|
||||||
|
|
||||||
; The speed for S2_LIMB < 0x10000 is approximately 16 cycles/limb. (The
|
|
||||||
; pipeline stalls 2 cycles due to WB contention and 1 cycle due to latency.)
|
|
||||||
|
|
||||||
; To enhance speed:
|
|
||||||
; 1. Unroll main loop 4-8 times.
|
|
||||||
; 2. Schedule code to avoid WB contention. It might be tempting to move the
|
|
||||||
; ld instruction in the loops down to save 2 cycles (less WB contention),
|
|
||||||
; but that looses because the ultimate value will be read from outside
|
|
||||||
; the allocated space. But if we handle the ultimate multiplication in
|
|
||||||
; the tail, we can do this.
|
|
||||||
; 3. Make the multiplication with less instructions. I think the code for
|
|
||||||
; (S2_LIMB >= 0x10000) is not minimal.
|
|
||||||
; With these techniques the (S2_LIMB >= 0x10000) case would run in 17 or
|
|
||||||
; less cycles/limb; the (S2_LIMB < 0x10000) case would run in 11
|
|
||||||
; cycles/limb. (Assuming infinite unrolling.)
|
|
||||||
|
|
||||||
#include "sysdep.h"
|
|
||||||
|
|
||||||
ENTRY (__mpn_mul_1)
|
|
||||||
|
|
||||||
; Make S1_PTR and RES_PTR point at the end of their blocks
|
|
||||||
; and negate SIZE.
|
|
||||||
lda r3,r3[r4]
|
|
||||||
lda r6,r2[r4] ; RES_PTR in r6 since r2 is retval
|
|
||||||
subu r4,r0,r4
|
|
||||||
|
|
||||||
addu.co r2,r0,r0 ; r2 = cy = 0
|
|
||||||
ld r9,r3[r4]
|
|
||||||
mask r7,r5,0xffff ; r7 = lo(S2_LIMB)
|
|
||||||
extu r8,r5,16 ; r8 = hi(S2_LIMB)
|
|
||||||
bcnd.n eq0,r8,Lsmall ; jump if (hi(S2_LIMB) == 0)
|
|
||||||
subu r6,r6,4
|
|
||||||
|
|
||||||
; General code for any value of S2_LIMB.
|
|
||||||
|
|
||||||
; Make a stack frame and save r25 and r26
|
|
||||||
subu r31,r31,16
|
|
||||||
st.d r25,r31,8
|
|
||||||
|
|
||||||
; Enter the loop in the middle
|
|
||||||
br.n L1
|
|
||||||
addu r4,r4,1
|
|
||||||
|
|
||||||
Loop:
|
|
||||||
ld r9,r3[r4]
|
|
||||||
st r26,r6[r4]
|
|
||||||
; bcnd ne0,r0,0 ; bubble
|
|
||||||
addu r4,r4,1
|
|
||||||
L1: mul r26,r9,r5 ; low word of product mul_1 WB ld
|
|
||||||
mask r12,r9,0xffff ; r12 = lo(s1_limb) mask_1
|
|
||||||
mul r11,r12,r7 ; r11 = prod_0 mul_2 WB mask_1
|
|
||||||
mul r10,r12,r8 ; r10 = prod_1a mul_3
|
|
||||||
extu r13,r9,16 ; r13 = hi(s1_limb) extu_1 WB mul_1
|
|
||||||
mul r12,r13,r7 ; r12 = prod_1b mul_4 WB extu_1
|
|
||||||
mul r25,r13,r8 ; r25 = prod_2 mul_5 WB mul_2
|
|
||||||
extu r11,r11,16 ; r11 = hi(prod_0) extu_2 WB mul_3
|
|
||||||
addu r10,r10,r11 ; addu_1 WB extu_2
|
|
||||||
; bcnd ne0,r0,0 ; bubble WB addu_1
|
|
||||||
addu.co r10,r10,r12 ; WB mul_4
|
|
||||||
mask.u r10,r10,0xffff ; move the 16 most significant bits...
|
|
||||||
addu.ci r10,r10,r0 ; ...to the low half of the word...
|
|
||||||
rot r10,r10,16 ; ...and put carry in pos 16.
|
|
||||||
addu.co r26,r26,r2 ; add old carry limb
|
|
||||||
bcnd.n ne0,r4,Loop
|
|
||||||
addu.ci r2,r25,r10 ; compute new carry limb
|
|
||||||
|
|
||||||
st r26,r6[r4]
|
|
||||||
ld.d r25,r31,8
|
|
||||||
jmp.n r1
|
|
||||||
addu r31,r31,16
|
|
||||||
|
|
||||||
; Fast code for S2_LIMB < 0x10000
|
|
||||||
Lsmall:
|
|
||||||
; Enter the loop in the middle
|
|
||||||
br.n SL1
|
|
||||||
addu r4,r4,1
|
|
||||||
|
|
||||||
SLoop:
|
|
||||||
ld r9,r3[r4] ;
|
|
||||||
st r8,r6[r4] ;
|
|
||||||
addu r4,r4,1 ;
|
|
||||||
SL1: mul r8,r9,r5 ; low word of product
|
|
||||||
mask r12,r9,0xffff ; r12 = lo(s1_limb)
|
|
||||||
extu r13,r9,16 ; r13 = hi(s1_limb)
|
|
||||||
mul r11,r12,r7 ; r11 = prod_0
|
|
||||||
mul r12,r13,r7 ; r12 = prod_1b
|
|
||||||
addu.cio r8,r8,r2 ; add old carry limb
|
|
||||||
extu r10,r11,16 ; r11 = hi(prod_0)
|
|
||||||
addu r10,r10,r12 ;
|
|
||||||
bcnd.n ne0,r4,SLoop
|
|
||||||
extu r2,r10,16 ; r2 = new carry limb
|
|
||||||
|
|
||||||
jmp.n r1
|
|
||||||
st r8,r6[r4]
|
|
@ -1,128 +0,0 @@
|
|||||||
; mc88100 __mpn_mul_1 -- Multiply a limb vector with a single limb and
|
|
||||||
; store the product in a second limb vector.
|
|
||||||
|
|
||||||
; Copyright (C) 1992, 1994 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
; This file is part of the GNU MP Library.
|
|
||||||
|
|
||||||
; The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB. If not, write to
|
|
||||||
; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
|
|
||||||
|
|
||||||
; INPUT PARAMETERS
|
|
||||||
; res_ptr r2
|
|
||||||
; s1_ptr r3
|
|
||||||
; size r4
|
|
||||||
; s2_limb r5
|
|
||||||
|
|
||||||
; Common overhead is about 11 cycles/invocation.
|
|
||||||
|
|
||||||
; The speed for S2_LIMB >= 0x10000 is approximately 21 cycles/limb. (The
|
|
||||||
; pipeline stalls 2 cycles due to WB contention.)
|
|
||||||
|
|
||||||
; The speed for S2_LIMB < 0x10000 is approximately 16 cycles/limb. (The
|
|
||||||
; pipeline stalls 2 cycles due to WB contention and 1 cycle due to latency.)
|
|
||||||
|
|
||||||
; To enhance speed:
|
|
||||||
; 1. Unroll main loop 4-8 times.
|
|
||||||
; 2. Schedule code to avoid WB contention. It might be tempting to move the
|
|
||||||
; ld instruction in the loops down to save 2 cycles (less WB contention),
|
|
||||||
; but that looses because the ultimate value will be read from outside
|
|
||||||
; the allocated space. But if we handle the ultimate multiplication in
|
|
||||||
; the tail, we can do this.
|
|
||||||
; 3. Make the multiplication with less instructions. I think the code for
|
|
||||||
; (S2_LIMB >= 0x10000) is not minimal.
|
|
||||||
; With these techniques the (S2_LIMB >= 0x10000) case would run in 17 or
|
|
||||||
; less cycles/limb; the (S2_LIMB < 0x10000) case would run in 11
|
|
||||||
; cycles/limb. (Assuming infinite unrolling.)
|
|
||||||
|
|
||||||
text
|
|
||||||
align 16
|
|
||||||
global ___mpn_mul_1
|
|
||||||
___mpn_mul_1:
|
|
||||||
|
|
||||||
; Make S1_PTR and RES_PTR point at the end of their blocks
|
|
||||||
; and negate SIZE.
|
|
||||||
lda r3,r3[r4]
|
|
||||||
lda r6,r2[r4] ; RES_PTR in r6 since r2 is retval
|
|
||||||
subu r4,r0,r4
|
|
||||||
|
|
||||||
addu.co r2,r0,r0 ; r2 = cy = 0
|
|
||||||
ld r9,r3[r4]
|
|
||||||
mask r7,r5,0xffff ; r7 = lo(S2_LIMB)
|
|
||||||
extu r8,r5,16 ; r8 = hi(S2_LIMB)
|
|
||||||
bcnd.n eq0,r8,Lsmall ; jump if (hi(S2_LIMB) == 0)
|
|
||||||
subu r6,r6,4
|
|
||||||
|
|
||||||
; General code for any value of S2_LIMB.
|
|
||||||
|
|
||||||
; Make a stack frame and save r25 and r26
|
|
||||||
subu r31,r31,16
|
|
||||||
st.d r25,r31,8
|
|
||||||
|
|
||||||
; Enter the loop in the middle
|
|
||||||
br.n L1
|
|
||||||
addu r4,r4,1
|
|
||||||
|
|
||||||
Loop:
|
|
||||||
ld r9,r3[r4]
|
|
||||||
st r26,r6[r4]
|
|
||||||
; bcnd ne0,r0,0 ; bubble
|
|
||||||
addu r4,r4,1
|
|
||||||
L1: mul r26,r9,r5 ; low word of product mul_1 WB ld
|
|
||||||
mask r12,r9,0xffff ; r12 = lo(s1_limb) mask_1
|
|
||||||
mul r11,r12,r7 ; r11 = prod_0 mul_2 WB mask_1
|
|
||||||
mul r10,r12,r8 ; r10 = prod_1a mul_3
|
|
||||||
extu r13,r9,16 ; r13 = hi(s1_limb) extu_1 WB mul_1
|
|
||||||
mul r12,r13,r7 ; r12 = prod_1b mul_4 WB extu_1
|
|
||||||
mul r25,r13,r8 ; r25 = prod_2 mul_5 WB mul_2
|
|
||||||
extu r11,r11,16 ; r11 = hi(prod_0) extu_2 WB mul_3
|
|
||||||
addu r10,r10,r11 ; addu_1 WB extu_2
|
|
||||||
; bcnd ne0,r0,0 ; bubble WB addu_1
|
|
||||||
addu.co r10,r10,r12 ; WB mul_4
|
|
||||||
mask.u r10,r10,0xffff ; move the 16 most significant bits...
|
|
||||||
addu.ci r10,r10,r0 ; ...to the low half of the word...
|
|
||||||
rot r10,r10,16 ; ...and put carry in pos 16.
|
|
||||||
addu.co r26,r26,r2 ; add old carry limb
|
|
||||||
bcnd.n ne0,r4,Loop
|
|
||||||
addu.ci r2,r25,r10 ; compute new carry limb
|
|
||||||
|
|
||||||
st r26,r6[r4]
|
|
||||||
ld.d r25,r31,8
|
|
||||||
jmp.n r1
|
|
||||||
addu r31,r31,16
|
|
||||||
|
|
||||||
; Fast code for S2_LIMB < 0x10000
|
|
||||||
Lsmall:
|
|
||||||
; Enter the loop in the middle
|
|
||||||
br.n SL1
|
|
||||||
addu r4,r4,1
|
|
||||||
|
|
||||||
SLoop:
|
|
||||||
ld r9,r3[r4] ;
|
|
||||||
st r8,r6[r4] ;
|
|
||||||
addu r4,r4,1 ;
|
|
||||||
SL1: mul r8,r9,r5 ; low word of product
|
|
||||||
mask r12,r9,0xffff ; r12 = lo(s1_limb)
|
|
||||||
extu r13,r9,16 ; r13 = hi(s1_limb)
|
|
||||||
mul r11,r12,r7 ; r11 = prod_0
|
|
||||||
mul r12,r13,r7 ; r12 = prod_1b
|
|
||||||
addu.cio r8,r8,r2 ; add old carry limb
|
|
||||||
extu r10,r11,16 ; r11 = hi(prod_0)
|
|
||||||
addu r10,r10,r12 ;
|
|
||||||
bcnd.n ne0,r4,SLoop
|
|
||||||
extu r2,r10,16 ; r2 = new carry limb
|
|
||||||
|
|
||||||
jmp.n r1
|
|
||||||
st r8,r6[r4]
|
|
@ -1,134 +0,0 @@
|
|||||||
; mc88100 __mpn_sub -- Subtract two limb vectors of the same length > 0 and
|
|
||||||
; store difference in a third limb vector.
|
|
||||||
|
|
||||||
; Copyright (C) 1992, 1994 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
; This file is part of the GNU MP Library.
|
|
||||||
|
|
||||||
; The GNU MP Library is free software; you can redistribute it and/or modify
|
|
||||||
; it under the terms of the GNU General Public License as published by
|
|
||||||
; the Free Software Foundation; either version 2, or (at your option)
|
|
||||||
; any later version.
|
|
||||||
|
|
||||||
; The GNU MP 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 General Public License for more details.
|
|
||||||
|
|
||||||
; You should have received a copy of the GNU General Public License
|
|
||||||
; along with the GNU MP Library; see the file COPYING. If not, write to
|
|
||||||
; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
|
|
||||||
|
|
||||||
; INPUT PARAMETERS
|
|
||||||
; res_ptr r2
|
|
||||||
; s1_ptr r3
|
|
||||||
; s2_ptr r4
|
|
||||||
; size r5
|
|
||||||
|
|
||||||
; This code has been optimized to run one instruction per clock, avoiding
|
|
||||||
; load stalls and writeback contention. As a result, the instruction
|
|
||||||
; order is not always natural.
|
|
||||||
|
|
||||||
; The speed is approximately 4.3 clocks/limb + 18 clocks/limb-vector.
|
|
||||||
|
|
||||||
#include "sysdep.h"
|
|
||||||
|
|
||||||
ENTRY (__mpn_sub_n)
|
|
||||||
ld r6,r3,0 ; read first limb from s1_ptr
|
|
||||||
extu r10,r5,4
|
|
||||||
ld r7,r4,0 ; read first limb from s2_ptr
|
|
||||||
|
|
||||||
subu.co r5,r0,r5 ; (clear carry as side effect)
|
|
||||||
mak r5,r5,4<4>
|
|
||||||
bcnd eq0,r5,Lzero
|
|
||||||
|
|
||||||
or r12,r0,lo16(Lbase)
|
|
||||||
or.u r12,r12,hi16(Lbase)
|
|
||||||
addu r12,r12,r5 ; r12 is address for entering in loop
|
|
||||||
|
|
||||||
extu r5,r5,2 ; divide by 4
|
|
||||||
subu r2,r2,r5 ; adjust res_ptr
|
|
||||||
subu r3,r3,r5 ; adjust s1_ptr
|
|
||||||
subu r4,r4,r5 ; adjust s2_ptr
|
|
||||||
|
|
||||||
or r8,r6,r0
|
|
||||||
|
|
||||||
jmp.n r12
|
|
||||||
or r9,r7,r0
|
|
||||||
|
|
||||||
Loop: addu r3,r3,64
|
|
||||||
st r8,r2,60
|
|
||||||
addu r4,r4,64
|
|
||||||
ld r6,r3,0
|
|
||||||
addu r2,r2,64
|
|
||||||
ld r7,r4,0
|
|
||||||
Lzero: subu r10,r10,1 ; subtract 0 + 16r limbs (adjust loop counter)
|
|
||||||
Lbase: ld r8,r3,4
|
|
||||||
subu.cio r6,r6,r7
|
|
||||||
ld r9,r4,4
|
|
||||||
st r6,r2,0
|
|
||||||
ld r6,r3,8 ; subtract 15 + 16r limbs
|
|
||||||
subu.cio r8,r8,r9
|
|
||||||
ld r7,r4,8
|
|
||||||
st r8,r2,4
|
|
||||||
ld r8,r3,12 ; subtract 14 + 16r limbs
|
|
||||||
subu.cio r6,r6,r7
|
|
||||||
ld r9,r4,12
|
|
||||||
st r6,r2,8
|
|
||||||
ld r6,r3,16 ; subtract 13 + 16r limbs
|
|
||||||
subu.cio r8,r8,r9
|
|
||||||
ld r7,r4,16
|
|
||||||
st r8,r2,12
|
|
||||||
ld r8,r3,20 ; subtract 12 + 16r limbs
|
|
||||||
subu.cio r6,r6,r7
|
|
||||||
ld r9,r4,20
|
|
||||||
st r6,r2,16
|
|
||||||
ld r6,r3,24 ; subtract 11 + 16r limbs
|
|
||||||
subu.cio r8,r8,r9
|
|
||||||
ld r7,r4,24
|
|
||||||
st r8,r2,20
|
|
||||||
ld r8,r3,28 ; subtract 10 + 16r limbs
|
|
||||||
subu.cio r6,r6,r7
|
|
||||||
ld r9,r4,28
|
|
||||||
st r6,r2,24
|
|
||||||
ld r6,r3,32 ; subtract 9 + 16r limbs
|
|
||||||
subu.cio r8,r8,r9
|
|
||||||
ld r7,r4,32
|
|
||||||
st r8,r2,28
|
|
||||||
ld r8,r3,36 ; subtract 8 + 16r limbs
|
|
||||||
subu.cio r6,r6,r7
|
|
||||||
ld r9,r4,36
|
|
||||||
st r6,r2,32
|
|
||||||
ld r6,r3,40 ; subtract 7 + 16r limbs
|
|
||||||
subu.cio r8,r8,r9
|
|
||||||
ld r7,r4,40
|
|
||||||
st r8,r2,36
|
|
||||||
ld r8,r3,44 ; subtract 6 + 16r limbs
|
|
||||||
subu.cio r6,r6,r7
|
|
||||||
ld r9,r4,44
|
|
||||||
st r6,r2,40
|
|
||||||
ld r6,r3,48 ; subtract 5 + 16r limbs
|
|
||||||
subu.cio r8,r8,r9
|
|
||||||
ld r7,r4,48
|
|
||||||
st r8,r2,44
|
|
||||||
ld r8,r3,52 ; subtract 4 + 16r limbs
|
|
||||||
subu.cio r6,r6,r7
|
|
||||||
ld r9,r4,52
|
|
||||||
st r6,r2,48
|
|
||||||
ld r6,r3,56 ; subtract 3 + 16r limbs
|
|
||||||
subu.cio r8,r8,r9
|
|
||||||
ld r7,r4,56
|
|
||||||
st r8,r2,52
|
|
||||||
ld r8,r3,60 ; subtract 2 + 16r limbs
|
|
||||||
subu.cio r6,r6,r7
|
|
||||||
ld r9,r4,60
|
|
||||||
st r6,r2,56
|
|
||||||
bcnd.n ne0,r10,Loop ; subtract 1 + 16r limbs
|
|
||||||
subu.cio r8,r8,r9
|
|
||||||
|
|
||||||
st r8,r2,60 ; store most significant limb
|
|
||||||
|
|
||||||
addu.ci r2,r0,r0 ; return carry-out from most sign. limb
|
|
||||||
jmp.n r1
|
|
||||||
xor r2,r2,1
|
|
@ -1,104 +0,0 @@
|
|||||||
; mc88100 __mpn_sub -- Subtract two limb vectors of the same length > 0 and
|
|
||||||
; store difference in a third limb vector.
|
|
||||||
|
|
||||||
; Copyright (C) 1992, 1994 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
; This file is part of the GNU MP Library.
|
|
||||||
|
|
||||||
; The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB. If not, write to
|
|
||||||
; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
|
|
||||||
|
|
||||||
; INPUT PARAMETERS
|
|
||||||
; res_ptr r2
|
|
||||||
; s1_ptr r3
|
|
||||||
; s2_ptr r4
|
|
||||||
; size r5
|
|
||||||
|
|
||||||
; This code has been optimized to run one instruction per clock, avoiding
|
|
||||||
; load stalls and writeback contention. As a result, the instruction
|
|
||||||
; order is not always natural.
|
|
||||||
|
|
||||||
; The speed is about 4.6 clocks/limb + 18 clocks/limb-vector on an 88100,
|
|
||||||
; but on the 88110, it seems to run much slower, 6.6 clocks/limb.
|
|
||||||
|
|
||||||
text
|
|
||||||
align 16
|
|
||||||
global ___mpn_sub_n
|
|
||||||
___mpn_sub_n:
|
|
||||||
ld r6,r3,0 ; read first limb from s1_ptr
|
|
||||||
extu r10,r5,3
|
|
||||||
ld r7,r4,0 ; read first limb from s2_ptr
|
|
||||||
|
|
||||||
subu.co r5,r0,r5 ; (clear carry as side effect)
|
|
||||||
mak r5,r5,3<4>
|
|
||||||
bcnd eq0,r5,Lzero
|
|
||||||
|
|
||||||
or r12,r0,lo16(Lbase)
|
|
||||||
or.u r12,r12,hi16(Lbase)
|
|
||||||
addu r12,r12,r5 ; r12 is address for entering in loop
|
|
||||||
|
|
||||||
extu r5,r5,2 ; divide by 4
|
|
||||||
subu r2,r2,r5 ; adjust res_ptr
|
|
||||||
subu r3,r3,r5 ; adjust s1_ptr
|
|
||||||
subu r4,r4,r5 ; adjust s2_ptr
|
|
||||||
|
|
||||||
or r8,r6,r0
|
|
||||||
|
|
||||||
jmp.n r12
|
|
||||||
or r9,r7,r0
|
|
||||||
|
|
||||||
Loop: addu r3,r3,32
|
|
||||||
st r8,r2,28
|
|
||||||
addu r4,r4,32
|
|
||||||
ld r6,r3,0
|
|
||||||
addu r2,r2,32
|
|
||||||
ld r7,r4,0
|
|
||||||
Lzero: subu r10,r10,1 ; subtract 0 + 8r limbs (adj loop cnt)
|
|
||||||
Lbase: ld r8,r3,4
|
|
||||||
subu.cio r6,r6,r7
|
|
||||||
ld r9,r4,4
|
|
||||||
st r6,r2,0
|
|
||||||
ld r6,r3,8 ; subtract 7 + 8r limbs
|
|
||||||
subu.cio r8,r8,r9
|
|
||||||
ld r7,r4,8
|
|
||||||
st r8,r2,4
|
|
||||||
ld r8,r3,12 ; subtract 6 + 8r limbs
|
|
||||||
subu.cio r6,r6,r7
|
|
||||||
ld r9,r4,12
|
|
||||||
st r6,r2,8
|
|
||||||
ld r6,r3,16 ; subtract 5 + 8r limbs
|
|
||||||
subu.cio r8,r8,r9
|
|
||||||
ld r7,r4,16
|
|
||||||
st r8,r2,12
|
|
||||||
ld r8,r3,20 ; subtract 4 + 8r limbs
|
|
||||||
subu.cio r6,r6,r7
|
|
||||||
ld r9,r4,20
|
|
||||||
st r6,r2,16
|
|
||||||
ld r6,r3,24 ; subtract 3 + 8r limbs
|
|
||||||
subu.cio r8,r8,r9
|
|
||||||
ld r7,r4,24
|
|
||||||
st r8,r2,20
|
|
||||||
ld r8,r3,28 ; subtract 2 + 8r limbs
|
|
||||||
subu.cio r6,r6,r7
|
|
||||||
ld r9,r4,28
|
|
||||||
st r6,r2,24
|
|
||||||
bcnd.n ne0,r10,Loop ; subtract 1 + 8r limbs
|
|
||||||
subu.cio r8,r8,r9
|
|
||||||
|
|
||||||
st r8,r2,28 ; store most significant limb
|
|
||||||
|
|
||||||
addu.ci r2,r0,r0 ; return carry-out from most sign. limb
|
|
||||||
jmp.n r1
|
|
||||||
xor r2,r2,1
|
|
@ -1,200 +0,0 @@
|
|||||||
; mc88110 __mpn_add_n -- Add two limb vectors of the same length > 0 and store
|
|
||||||
; sum in a third limb vector.
|
|
||||||
|
|
||||||
; Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
; This file is part of the GNU MP Library.
|
|
||||||
|
|
||||||
; The GNU MP 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 MP 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 MP 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.
|
|
||||||
|
|
||||||
|
|
||||||
; INPUT PARAMETERS
|
|
||||||
#define res_ptr r2
|
|
||||||
#define s1_ptr r3
|
|
||||||
#define s2_ptr r4
|
|
||||||
#define size r5
|
|
||||||
|
|
||||||
#include "sysdep.h"
|
|
||||||
|
|
||||||
text
|
|
||||||
align 16
|
|
||||||
global C_SYMBOL_NAME(__mpn_add_n)
|
|
||||||
C_SYMBOL_NAME(__mpn_add_n):
|
|
||||||
addu.co r0,r0,r0 ; clear cy flag
|
|
||||||
xor r12,s2_ptr,res_ptr
|
|
||||||
bb1 2,r12,L1
|
|
||||||
; ** V1a **
|
|
||||||
L0: bb0 2,res_ptr,L_v1 ; branch if res_ptr is aligned?
|
|
||||||
/* Add least significant limb separately to align res_ptr and s2_ptr */
|
|
||||||
ld r10,s1_ptr,0
|
|
||||||
addu s1_ptr,s1_ptr,4
|
|
||||||
ld r8,s2_ptr,0
|
|
||||||
addu s2_ptr,s2_ptr,4
|
|
||||||
subu size,size,1
|
|
||||||
addu.co r6,r10,r8
|
|
||||||
st r6,res_ptr,0
|
|
||||||
addu res_ptr,res_ptr,4
|
|
||||||
L_v1: cmp r12,size,2
|
|
||||||
bb1 lt,r12,Lend2
|
|
||||||
|
|
||||||
ld r10,s1_ptr,0
|
|
||||||
ld r12,s1_ptr,4
|
|
||||||
ld.d r8,s2_ptr,0
|
|
||||||
subu size,size,10
|
|
||||||
bcnd lt0,size,Lfin1
|
|
||||||
/* Add blocks of 8 limbs until less than 8 limbs remain */
|
|
||||||
align 8
|
|
||||||
Loop1: subu size,size,8
|
|
||||||
addu.cio r6,r10,r8
|
|
||||||
ld r10,s1_ptr,8
|
|
||||||
addu.cio r7,r12,r9
|
|
||||||
ld r12,s1_ptr,12
|
|
||||||
ld.d r8,s2_ptr,8
|
|
||||||
st.d r6,res_ptr,0
|
|
||||||
addu.cio r6,r10,r8
|
|
||||||
ld r10,s1_ptr,16
|
|
||||||
addu.cio r7,r12,r9
|
|
||||||
ld r12,s1_ptr,20
|
|
||||||
ld.d r8,s2_ptr,16
|
|
||||||
st.d r6,res_ptr,8
|
|
||||||
addu.cio r6,r10,r8
|
|
||||||
ld r10,s1_ptr,24
|
|
||||||
addu.cio r7,r12,r9
|
|
||||||
ld r12,s1_ptr,28
|
|
||||||
ld.d r8,s2_ptr,24
|
|
||||||
st.d r6,res_ptr,16
|
|
||||||
addu.cio r6,r10,r8
|
|
||||||
ld r10,s1_ptr,32
|
|
||||||
addu.cio r7,r12,r9
|
|
||||||
ld r12,s1_ptr,36
|
|
||||||
addu s1_ptr,s1_ptr,32
|
|
||||||
ld.d r8,s2_ptr,32
|
|
||||||
addu s2_ptr,s2_ptr,32
|
|
||||||
st.d r6,res_ptr,24
|
|
||||||
addu res_ptr,res_ptr,32
|
|
||||||
bcnd ge0,size,Loop1
|
|
||||||
|
|
||||||
Lfin1: addu size,size,8-2
|
|
||||||
bcnd lt0,size,Lend1
|
|
||||||
/* Add blocks of 2 limbs until less than 2 limbs remain */
|
|
||||||
Loope1: addu.cio r6,r10,r8
|
|
||||||
ld r10,s1_ptr,8
|
|
||||||
addu.cio r7,r12,r9
|
|
||||||
ld r12,s1_ptr,12
|
|
||||||
ld.d r8,s2_ptr,8
|
|
||||||
st.d r6,res_ptr,0
|
|
||||||
subu size,size,2
|
|
||||||
addu s1_ptr,s1_ptr,8
|
|
||||||
addu s2_ptr,s2_ptr,8
|
|
||||||
addu res_ptr,res_ptr,8
|
|
||||||
bcnd ge0,size,Loope1
|
|
||||||
Lend1: addu.cio r6,r10,r8
|
|
||||||
addu.cio r7,r12,r9
|
|
||||||
st.d r6,res_ptr,0
|
|
||||||
|
|
||||||
bb0 0,size,Lret1
|
|
||||||
/* Add last limb */
|
|
||||||
ld r10,s1_ptr,8
|
|
||||||
ld r8,s2_ptr,8
|
|
||||||
addu.cio r6,r10,r8
|
|
||||||
st r6,res_ptr,8
|
|
||||||
|
|
||||||
Lret1: jmp.n r1
|
|
||||||
addu.ci r2,r0,r0 ; return carry-out from most sign. limb
|
|
||||||
|
|
||||||
L1: xor r12,s1_ptr,res_ptr
|
|
||||||
bb1 2,r12,L2
|
|
||||||
; ** V1b **
|
|
||||||
or r12,r0,s2_ptr
|
|
||||||
or s2_ptr,r0,s1_ptr
|
|
||||||
or s1_ptr,r0,r12
|
|
||||||
br L0
|
|
||||||
|
|
||||||
; ** V2 **
|
|
||||||
/* If we come here, the alignment of s1_ptr and res_ptr as well as the
|
|
||||||
alignment of s2_ptr and res_ptr differ. Since there are only two ways
|
|
||||||
things can be aligned (that we care about) we now know that the alignment
|
|
||||||
of s1_ptr and s2_ptr are the same. */
|
|
||||||
|
|
||||||
L2: cmp r12,size,1
|
|
||||||
bb1 eq,r12,Ljone
|
|
||||||
bb0 2,s1_ptr,L_v2 ; branch if s1_ptr is aligned
|
|
||||||
/* Add least significant limb separately to align res_ptr and s2_ptr */
|
|
||||||
ld r10,s1_ptr,0
|
|
||||||
addu s1_ptr,s1_ptr,4
|
|
||||||
ld r8,s2_ptr,0
|
|
||||||
addu s2_ptr,s2_ptr,4
|
|
||||||
subu size,size,1
|
|
||||||
addu.co r6,r10,r8
|
|
||||||
st r6,res_ptr,0
|
|
||||||
addu res_ptr,res_ptr,4
|
|
||||||
|
|
||||||
L_v2: subu size,size,8
|
|
||||||
bcnd lt0,size,Lfin2
|
|
||||||
/* Add blocks of 8 limbs until less than 8 limbs remain */
|
|
||||||
align 8
|
|
||||||
Loop2: subu size,size,8
|
|
||||||
ld.d r8,s1_ptr,0
|
|
||||||
ld.d r6,s2_ptr,0
|
|
||||||
addu.cio r8,r8,r6
|
|
||||||
st r8,res_ptr,0
|
|
||||||
addu.cio r9,r9,r7
|
|
||||||
st r9,res_ptr,4
|
|
||||||
ld.d r8,s1_ptr,8
|
|
||||||
ld.d r6,s2_ptr,8
|
|
||||||
addu.cio r8,r8,r6
|
|
||||||
st r8,res_ptr,8
|
|
||||||
addu.cio r9,r9,r7
|
|
||||||
st r9,res_ptr,12
|
|
||||||
ld.d r8,s1_ptr,16
|
|
||||||
ld.d r6,s2_ptr,16
|
|
||||||
addu.cio r8,r8,r6
|
|
||||||
st r8,res_ptr,16
|
|
||||||
addu.cio r9,r9,r7
|
|
||||||
st r9,res_ptr,20
|
|
||||||
ld.d r8,s1_ptr,24
|
|
||||||
ld.d r6,s2_ptr,24
|
|
||||||
addu.cio r8,r8,r6
|
|
||||||
st r8,res_ptr,24
|
|
||||||
addu.cio r9,r9,r7
|
|
||||||
st r9,res_ptr,28
|
|
||||||
addu s1_ptr,s1_ptr,32
|
|
||||||
addu s2_ptr,s2_ptr,32
|
|
||||||
addu res_ptr,res_ptr,32
|
|
||||||
bcnd ge0,size,Loop2
|
|
||||||
|
|
||||||
Lfin2: addu size,size,8-2
|
|
||||||
bcnd lt0,size,Lend2
|
|
||||||
Loope2: ld.d r8,s1_ptr,0
|
|
||||||
ld.d r6,s2_ptr,0
|
|
||||||
addu.cio r8,r8,r6
|
|
||||||
st r8,res_ptr,0
|
|
||||||
addu.cio r9,r9,r7
|
|
||||||
st r9,res_ptr,4
|
|
||||||
subu size,size,2
|
|
||||||
addu s1_ptr,s1_ptr,8
|
|
||||||
addu s2_ptr,s2_ptr,8
|
|
||||||
addu res_ptr,res_ptr,8
|
|
||||||
bcnd ge0,size,Loope2
|
|
||||||
Lend2: bb0 0,size,Lret2
|
|
||||||
/* Add last limb */
|
|
||||||
Ljone: ld r10,s1_ptr,0
|
|
||||||
ld r8,s2_ptr,0
|
|
||||||
addu.cio r6,r10,r8
|
|
||||||
st r6,res_ptr,0
|
|
||||||
|
|
||||||
Lret2: jmp.n r1
|
|
||||||
addu.ci r2,r0,r0 ; return carry-out from most sign. limb
|
|
@ -1,61 +0,0 @@
|
|||||||
; mc88110 __mpn_addmul_1 -- Multiply a limb vector with a single limb and
|
|
||||||
; store the product in a second limb vector.
|
|
||||||
|
|
||||||
; Copyright (C) 1996 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
; This file is part of the GNU MP Library.
|
|
||||||
|
|
||||||
; The GNU MP 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 MP 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 MP 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.
|
|
||||||
|
|
||||||
|
|
||||||
; INPUT PARAMETERS
|
|
||||||
; res_ptr r2
|
|
||||||
; s1_ptr r3
|
|
||||||
; size r4
|
|
||||||
; s2_limb r5
|
|
||||||
|
|
||||||
text
|
|
||||||
align 16
|
|
||||||
global ___mpn_addmul_1
|
|
||||||
___mpn_addmul_1:
|
|
||||||
lda r3,r3[r4]
|
|
||||||
lda r8,r2[r4] ; RES_PTR in r8 since r2 is retval
|
|
||||||
subu r4,r0,r4
|
|
||||||
addu.co r2,r0,r0 ; r2 = cy = 0
|
|
||||||
|
|
||||||
ld r6,r3[r4]
|
|
||||||
addu r4,r4,1
|
|
||||||
subu r8,r8,4
|
|
||||||
bcnd.n eq0,r4,Lend
|
|
||||||
mulu.d r10,r6,r5
|
|
||||||
|
|
||||||
Loop: ld r7,r8[r4]
|
|
||||||
ld r6,r3[r4]
|
|
||||||
addu.cio r9,r11,r2
|
|
||||||
addu.ci r2,r10,r0
|
|
||||||
addu.co r9,r9,r7
|
|
||||||
st r9,r8[r4]
|
|
||||||
addu r4,r4,1
|
|
||||||
mulu.d r10,r6,r5
|
|
||||||
bcnd ne0,r4,Loop
|
|
||||||
|
|
||||||
Lend: ld r7,r8,0
|
|
||||||
addu.cio r9,r11,r2
|
|
||||||
addu.ci r2,r10,r0
|
|
||||||
addu.co r9,r9,r7
|
|
||||||
st r9,r8,0
|
|
||||||
jmp.n r1
|
|
||||||
addu.ci r2,r2,r0
|
|
@ -1,80 +0,0 @@
|
|||||||
; mc88110 __mpn_mul_1 -- Multiply a limb vector with a single limb and
|
|
||||||
; store the product in a second limb vector.
|
|
||||||
|
|
||||||
; Copyright (C) 1992, 1994 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
; This file is part of the GNU MP Library.
|
|
||||||
|
|
||||||
; The GNU MP Library is free software; you can redistribute it and/or modify
|
|
||||||
; it under the terms of the GNU General Public License as published by
|
|
||||||
; the Free Software Foundation; either version 2, or (at your option)
|
|
||||||
; any later version.
|
|
||||||
|
|
||||||
; The GNU MP 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 General Public License for more details.
|
|
||||||
|
|
||||||
; You should have received a copy of the GNU General Public License
|
|
||||||
; along with the GNU MP Library; see the file COPYING. If not, write to
|
|
||||||
; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
|
|
||||||
|
|
||||||
; INPUT PARAMETERS
|
|
||||||
; res_ptr r2
|
|
||||||
; s1_ptr r3
|
|
||||||
; size r4
|
|
||||||
; s2_limb r5
|
|
||||||
|
|
||||||
#include "sysdep.h"
|
|
||||||
|
|
||||||
ENTRY (__mpn_mul_1)
|
|
||||||
ld r6,r3,0
|
|
||||||
sub r4,r0,r4
|
|
||||||
sub r3,r3,r4 ; r3 is offset s1_ptr
|
|
||||||
sub r2,r2,r4
|
|
||||||
sub r8,r2,8 ; r8 is offset res_ptr
|
|
||||||
mulu.d r10,r6,r5
|
|
||||||
|
|
||||||
addu r4,r4,1
|
|
||||||
bcnd eq0,r4,Lend
|
|
||||||
addu.co r2,r0,0 ; clear cy_limb
|
|
||||||
|
|
||||||
Loop: ld r6,r3[r4]
|
|
||||||
addu.cio r9,r11,r2
|
|
||||||
or r2,r10,r0 ; could be avoided if unrolled
|
|
||||||
addu r4,r4,1
|
|
||||||
mulu.d r10,r6,r5
|
|
||||||
bcnd ne0,r4,Loop
|
|
||||||
st r9,r8[r4]
|
|
||||||
|
|
||||||
Lend: addu.cio r9,r11,r2
|
|
||||||
st r9,r8,4
|
|
||||||
jmp.n r1
|
|
||||||
addu.ci r2,r10,r0
|
|
||||||
|
|
||||||
; This is the Right Way to do this on '110. 4 cycles / 64-bit limb.
|
|
||||||
; ld.d r10,
|
|
||||||
; mulu.d
|
|
||||||
; addu.cio
|
|
||||||
; addu.cio
|
|
||||||
; st.d
|
|
||||||
; mulu.d ,r11,r5
|
|
||||||
; ld.d r12,
|
|
||||||
; mulu.d ,r10,r5
|
|
||||||
; addu.cio
|
|
||||||
; addu.cio
|
|
||||||
; st.d
|
|
||||||
; mulu.d
|
|
||||||
; ld.d r10,
|
|
||||||
; mulu.d
|
|
||||||
; addu.cio
|
|
||||||
; addu.cio
|
|
||||||
; st.d
|
|
||||||
; mulu.d
|
|
||||||
; ld.d r10,
|
|
||||||
; mulu.d
|
|
||||||
; addu.cio
|
|
||||||
; addu.cio
|
|
||||||
; st.d
|
|
||||||
; mulu.d
|
|
@ -1,59 +0,0 @@
|
|||||||
; mc88110 __mpn_mul_1 -- Multiply a limb vector with a single limb and
|
|
||||||
; store the product in a second limb vector.
|
|
||||||
|
|
||||||
; Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
; This file is part of the GNU MP Library.
|
|
||||||
|
|
||||||
; The GNU MP 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 MP 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 MP 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.
|
|
||||||
|
|
||||||
|
|
||||||
; INPUT PARAMETERS
|
|
||||||
; res_ptr r2
|
|
||||||
; s1_ptr r3
|
|
||||||
; size r4
|
|
||||||
; s2_limb r5
|
|
||||||
|
|
||||||
text
|
|
||||||
align 16
|
|
||||||
global ___mpn_mul_1
|
|
||||||
___mpn_mul_1:
|
|
||||||
; Make S1_PTR and RES_PTR point at the end of their blocks
|
|
||||||
; and negate SIZE.
|
|
||||||
lda r3,r3[r4]
|
|
||||||
lda r8,r2[r4] ; RES_PTR in r8 since r2 is retval
|
|
||||||
subu r4,r0,r4
|
|
||||||
|
|
||||||
addu.co r2,r0,r0 ; r2 = cy = 0
|
|
||||||
|
|
||||||
ld r6,r3[r4]
|
|
||||||
addu r4,r4,1
|
|
||||||
mulu.d r10,r6,r5
|
|
||||||
bcnd.n eq0,r4,Lend
|
|
||||||
subu r8,r8,8
|
|
||||||
|
|
||||||
Loop: ld r6,r3[r4]
|
|
||||||
addu.cio r9,r11,r2
|
|
||||||
or r2,r10,r0 ; could be avoided if unrolled
|
|
||||||
addu r4,r4,1
|
|
||||||
mulu.d r10,r6,r5
|
|
||||||
bcnd.n ne0,r4,Loop
|
|
||||||
st r9,r8[r4]
|
|
||||||
|
|
||||||
Lend: addu.cio r9,r11,r2
|
|
||||||
st r9,r8,4
|
|
||||||
jmp.n r1
|
|
||||||
addu.ci r2,r10,r0
|
|
@ -1,276 +0,0 @@
|
|||||||
; mc88110 __mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
|
|
||||||
; store difference in a third limb vector.
|
|
||||||
|
|
||||||
; Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
; This file is part of the GNU MP Library.
|
|
||||||
|
|
||||||
; The GNU MP 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 MP 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 MP 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.
|
|
||||||
|
|
||||||
|
|
||||||
; INPUT PARAMETERS
|
|
||||||
#define res_ptr r2
|
|
||||||
#define s1_ptr r3
|
|
||||||
#define s2_ptr r4
|
|
||||||
#define size r5
|
|
||||||
|
|
||||||
#include "sysdep.h"
|
|
||||||
|
|
||||||
text
|
|
||||||
align 16
|
|
||||||
global C_SYMBOL_NAME(__mpn_sub_n)
|
|
||||||
C_SYMBOL_NAME(__mpn_sub_n):
|
|
||||||
subu.co r0,r0,r0 ; set cy flag
|
|
||||||
xor r12,s2_ptr,res_ptr
|
|
||||||
bb1 2,r12,L1
|
|
||||||
; ** V1a **
|
|
||||||
L0: bb0 2,res_ptr,L_v1 ; branch if res_ptr is aligned
|
|
||||||
/* Add least significant limb separately to align res_ptr and s2_ptr */
|
|
||||||
ld r10,s1_ptr,0
|
|
||||||
addu s1_ptr,s1_ptr,4
|
|
||||||
ld r8,s2_ptr,0
|
|
||||||
addu s2_ptr,s2_ptr,4
|
|
||||||
subu size,size,1
|
|
||||||
subu.co r6,r10,r8
|
|
||||||
st r6,res_ptr,0
|
|
||||||
addu res_ptr,res_ptr,4
|
|
||||||
L_v1: cmp r12,size,2
|
|
||||||
bb1 lt,r12,Lend2
|
|
||||||
|
|
||||||
ld r10,s1_ptr,0
|
|
||||||
ld r12,s1_ptr,4
|
|
||||||
ld.d r8,s2_ptr,0
|
|
||||||
subu size,size,10
|
|
||||||
bcnd lt0,size,Lfin1
|
|
||||||
/* Add blocks of 8 limbs until less than 8 limbs remain */
|
|
||||||
align 8
|
|
||||||
Loop1: subu size,size,8
|
|
||||||
subu.cio r6,r10,r8
|
|
||||||
ld r10,s1_ptr,8
|
|
||||||
subu.cio r7,r12,r9
|
|
||||||
ld r12,s1_ptr,12
|
|
||||||
ld.d r8,s2_ptr,8
|
|
||||||
st.d r6,res_ptr,0
|
|
||||||
subu.cio r6,r10,r8
|
|
||||||
ld r10,s1_ptr,16
|
|
||||||
subu.cio r7,r12,r9
|
|
||||||
ld r12,s1_ptr,20
|
|
||||||
ld.d r8,s2_ptr,16
|
|
||||||
st.d r6,res_ptr,8
|
|
||||||
subu.cio r6,r10,r8
|
|
||||||
ld r10,s1_ptr,24
|
|
||||||
subu.cio r7,r12,r9
|
|
||||||
ld r12,s1_ptr,28
|
|
||||||
ld.d r8,s2_ptr,24
|
|
||||||
st.d r6,res_ptr,16
|
|
||||||
subu.cio r6,r10,r8
|
|
||||||
ld r10,s1_ptr,32
|
|
||||||
subu.cio r7,r12,r9
|
|
||||||
ld r12,s1_ptr,36
|
|
||||||
addu s1_ptr,s1_ptr,32
|
|
||||||
ld.d r8,s2_ptr,32
|
|
||||||
addu s2_ptr,s2_ptr,32
|
|
||||||
st.d r6,res_ptr,24
|
|
||||||
addu res_ptr,res_ptr,32
|
|
||||||
bcnd ge0,size,Loop1
|
|
||||||
|
|
||||||
Lfin1: addu size,size,8-2
|
|
||||||
bcnd lt0,size,Lend1
|
|
||||||
/* Add blocks of 2 limbs until less than 2 limbs remain */
|
|
||||||
Loope1: subu.cio r6,r10,r8
|
|
||||||
ld r10,s1_ptr,8
|
|
||||||
subu.cio r7,r12,r9
|
|
||||||
ld r12,s1_ptr,12
|
|
||||||
ld.d r8,s2_ptr,8
|
|
||||||
st.d r6,res_ptr,0
|
|
||||||
subu size,size,2
|
|
||||||
addu s1_ptr,s1_ptr,8
|
|
||||||
addu s2_ptr,s2_ptr,8
|
|
||||||
addu res_ptr,res_ptr,8
|
|
||||||
bcnd ge0,size,Loope1
|
|
||||||
Lend1: subu.cio r6,r10,r8
|
|
||||||
subu.cio r7,r12,r9
|
|
||||||
st.d r6,res_ptr,0
|
|
||||||
|
|
||||||
bb0 0,size,Lret1
|
|
||||||
/* Add last limb */
|
|
||||||
ld r10,s1_ptr,8
|
|
||||||
ld r8,s2_ptr,8
|
|
||||||
subu.cio r6,r10,r8
|
|
||||||
st r6,res_ptr,8
|
|
||||||
|
|
||||||
Lret1: addu.ci r2,r0,r0 ; return carry-out from most sign. limb
|
|
||||||
jmp.n r1
|
|
||||||
xor r2,r2,1
|
|
||||||
|
|
||||||
L1: xor r12,s1_ptr,res_ptr
|
|
||||||
bb1 2,r12,L2
|
|
||||||
; ** V1b **
|
|
||||||
bb0 2,res_ptr,L_v1b ; branch if res_ptr is aligned
|
|
||||||
/* Add least significant limb separately to align res_ptr and s1_ptr */
|
|
||||||
ld r10,s2_ptr,0
|
|
||||||
addu s2_ptr,s2_ptr,4
|
|
||||||
ld r8,s1_ptr,0
|
|
||||||
addu s1_ptr,s1_ptr,4
|
|
||||||
subu size,size,1
|
|
||||||
subu.co r6,r8,r10
|
|
||||||
st r6,res_ptr,0
|
|
||||||
addu res_ptr,res_ptr,4
|
|
||||||
L_v1b: cmp r12,size,2
|
|
||||||
bb1 lt,r12,Lend2
|
|
||||||
|
|
||||||
ld r10,s2_ptr,0
|
|
||||||
ld r12,s2_ptr,4
|
|
||||||
ld.d r8,s1_ptr,0
|
|
||||||
subu size,size,10
|
|
||||||
bcnd lt0,size,Lfin1b
|
|
||||||
/* Add blocks of 8 limbs until less than 8 limbs remain */
|
|
||||||
align 8
|
|
||||||
Loop1b: subu size,size,8
|
|
||||||
subu.cio r6,r8,r10
|
|
||||||
ld r10,s2_ptr,8
|
|
||||||
subu.cio r7,r9,r12
|
|
||||||
ld r12,s2_ptr,12
|
|
||||||
ld.d r8,s1_ptr,8
|
|
||||||
st.d r6,res_ptr,0
|
|
||||||
subu.cio r6,r8,r10
|
|
||||||
ld r10,s2_ptr,16
|
|
||||||
subu.cio r7,r9,r12
|
|
||||||
ld r12,s2_ptr,20
|
|
||||||
ld.d r8,s1_ptr,16
|
|
||||||
st.d r6,res_ptr,8
|
|
||||||
subu.cio r6,r8,r10
|
|
||||||
ld r10,s2_ptr,24
|
|
||||||
subu.cio r7,r9,r12
|
|
||||||
ld r12,s2_ptr,28
|
|
||||||
ld.d r8,s1_ptr,24
|
|
||||||
st.d r6,res_ptr,16
|
|
||||||
subu.cio r6,r8,r10
|
|
||||||
ld r10,s2_ptr,32
|
|
||||||
subu.cio r7,r9,r12
|
|
||||||
ld r12,s2_ptr,36
|
|
||||||
addu s2_ptr,s2_ptr,32
|
|
||||||
ld.d r8,s1_ptr,32
|
|
||||||
addu s1_ptr,s1_ptr,32
|
|
||||||
st.d r6,res_ptr,24
|
|
||||||
addu res_ptr,res_ptr,32
|
|
||||||
bcnd ge0,size,Loop1b
|
|
||||||
|
|
||||||
Lfin1b: addu size,size,8-2
|
|
||||||
bcnd lt0,size,Lend1b
|
|
||||||
/* Add blocks of 2 limbs until less than 2 limbs remain */
|
|
||||||
Loope1b:subu.cio r6,r8,r10
|
|
||||||
ld r10,s2_ptr,8
|
|
||||||
subu.cio r7,r9,r12
|
|
||||||
ld r12,s2_ptr,12
|
|
||||||
ld.d r8,s1_ptr,8
|
|
||||||
st.d r6,res_ptr,0
|
|
||||||
subu size,size,2
|
|
||||||
addu s1_ptr,s1_ptr,8
|
|
||||||
addu s2_ptr,s2_ptr,8
|
|
||||||
addu res_ptr,res_ptr,8
|
|
||||||
bcnd ge0,size,Loope1b
|
|
||||||
Lend1b: subu.cio r6,r8,r10
|
|
||||||
subu.cio r7,r9,r12
|
|
||||||
st.d r6,res_ptr,0
|
|
||||||
|
|
||||||
bb0 0,size,Lret1b
|
|
||||||
/* Add last limb */
|
|
||||||
ld r10,s2_ptr,8
|
|
||||||
ld r8,s1_ptr,8
|
|
||||||
subu.cio r6,r8,r10
|
|
||||||
st r6,res_ptr,8
|
|
||||||
|
|
||||||
Lret1b: addu.ci r2,r0,r0 ; return carry-out from most sign. limb
|
|
||||||
jmp.n r1
|
|
||||||
xor r2,r2,1
|
|
||||||
|
|
||||||
; ** V2 **
|
|
||||||
/* If we come here, the alignment of s1_ptr and res_ptr as well as the
|
|
||||||
alignment of s2_ptr and res_ptr differ. Since there are only two ways
|
|
||||||
things can be aligned (that we care about) we now know that the alignment
|
|
||||||
of s1_ptr and s2_ptr are the same. */
|
|
||||||
|
|
||||||
L2: cmp r12,size,1
|
|
||||||
bb1 eq,r12,Ljone
|
|
||||||
bb0 2,s1_ptr,L_v2 ; branch if s1_ptr is aligned
|
|
||||||
/* Add least significant limb separately to align res_ptr and s2_ptr */
|
|
||||||
ld r10,s1_ptr,0
|
|
||||||
addu s1_ptr,s1_ptr,4
|
|
||||||
ld r8,s2_ptr,0
|
|
||||||
addu s2_ptr,s2_ptr,4
|
|
||||||
subu size,size,1
|
|
||||||
subu.co r6,r10,r8
|
|
||||||
st r6,res_ptr,0
|
|
||||||
addu res_ptr,res_ptr,4
|
|
||||||
|
|
||||||
L_v2: subu size,size,8
|
|
||||||
bcnd lt0,size,Lfin2
|
|
||||||
/* Add blocks of 8 limbs until less than 8 limbs remain */
|
|
||||||
align 8
|
|
||||||
Loop2: subu size,size,8
|
|
||||||
ld.d r8,s1_ptr,0
|
|
||||||
ld.d r6,s2_ptr,0
|
|
||||||
subu.cio r8,r8,r6
|
|
||||||
st r8,res_ptr,0
|
|
||||||
subu.cio r9,r9,r7
|
|
||||||
st r9,res_ptr,4
|
|
||||||
ld.d r8,s1_ptr,8
|
|
||||||
ld.d r6,s2_ptr,8
|
|
||||||
subu.cio r8,r8,r6
|
|
||||||
st r8,res_ptr,8
|
|
||||||
subu.cio r9,r9,r7
|
|
||||||
st r9,res_ptr,12
|
|
||||||
ld.d r8,s1_ptr,16
|
|
||||||
ld.d r6,s2_ptr,16
|
|
||||||
subu.cio r8,r8,r6
|
|
||||||
st r8,res_ptr,16
|
|
||||||
subu.cio r9,r9,r7
|
|
||||||
st r9,res_ptr,20
|
|
||||||
ld.d r8,s1_ptr,24
|
|
||||||
ld.d r6,s2_ptr,24
|
|
||||||
subu.cio r8,r8,r6
|
|
||||||
st r8,res_ptr,24
|
|
||||||
subu.cio r9,r9,r7
|
|
||||||
st r9,res_ptr,28
|
|
||||||
addu s1_ptr,s1_ptr,32
|
|
||||||
addu s2_ptr,s2_ptr,32
|
|
||||||
addu res_ptr,res_ptr,32
|
|
||||||
bcnd ge0,size,Loop2
|
|
||||||
|
|
||||||
Lfin2: addu size,size,8-2
|
|
||||||
bcnd lt0,size,Lend2
|
|
||||||
Loope2: ld.d r8,s1_ptr,0
|
|
||||||
ld.d r6,s2_ptr,0
|
|
||||||
subu.cio r8,r8,r6
|
|
||||||
st r8,res_ptr,0
|
|
||||||
subu.cio r9,r9,r7
|
|
||||||
st r9,res_ptr,4
|
|
||||||
subu size,size,2
|
|
||||||
addu s1_ptr,s1_ptr,8
|
|
||||||
addu s2_ptr,s2_ptr,8
|
|
||||||
addu res_ptr,res_ptr,8
|
|
||||||
bcnd ge0,size,Loope2
|
|
||||||
Lend2: bb0 0,size,Lret2
|
|
||||||
/* Add last limb */
|
|
||||||
Ljone: ld r10,s1_ptr,0
|
|
||||||
ld r8,s2_ptr,0
|
|
||||||
subu.cio r6,r10,r8
|
|
||||||
st r6,res_ptr,0
|
|
||||||
|
|
||||||
Lret2: addu.ci r2,r0,r0 ; return carry-out from most sign. limb
|
|
||||||
jmp.n r1
|
|
||||||
xor r2,r2,1
|
|
@ -1,127 +0,0 @@
|
|||||||
; mc88100 __mpn_mul_1 -- Multiply a limb vector with a single limb and
|
|
||||||
; store the product in a second limb vector.
|
|
||||||
|
|
||||||
; Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
; This file is part of the GNU MP Library.
|
|
||||||
|
|
||||||
; The GNU MP 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 MP 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 MP 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.
|
|
||||||
|
|
||||||
|
|
||||||
; INPUT PARAMETERS
|
|
||||||
; res_ptr r2
|
|
||||||
; s1_ptr r3
|
|
||||||
; size r4
|
|
||||||
; s2_limb r5
|
|
||||||
|
|
||||||
; Common overhead is about 11 cycles/invocation.
|
|
||||||
|
|
||||||
; The speed for S2_LIMB >= 0x10000 is approximately 21 cycles/limb. (The
|
|
||||||
; pipeline stalls 2 cycles due to WB contention.)
|
|
||||||
|
|
||||||
; The speed for S2_LIMB < 0x10000 is approximately 16 cycles/limb. (The
|
|
||||||
; pipeline stalls 2 cycles due to WB contention and 1 cycle due to latency.)
|
|
||||||
|
|
||||||
; To enhance speed:
|
|
||||||
; 1. Unroll main loop 4-8 times.
|
|
||||||
; 2. Schedule code to avoid WB contention. It might be tempting to move the
|
|
||||||
; ld instruction in the loops down to save 2 cycles (less WB contention),
|
|
||||||
; but that looses because the ultimate value will be read from outside
|
|
||||||
; the allocated space. But if we handle the ultimate multiplication in
|
|
||||||
; the tail, we can do this.
|
|
||||||
; 3. Make the multiplication with less instructions. I think the code for
|
|
||||||
; (S2_LIMB >= 0x10000) is not minimal.
|
|
||||||
; With these techniques the (S2_LIMB >= 0x10000) case would run in 17 or
|
|
||||||
; less cycles/limb; the (S2_LIMB < 0x10000) case would run in 11
|
|
||||||
; cycles/limb. (Assuming infinite unrolling.)
|
|
||||||
|
|
||||||
text
|
|
||||||
align 16
|
|
||||||
global ___mpn_mul_1
|
|
||||||
___mpn_mul_1:
|
|
||||||
|
|
||||||
; Make S1_PTR and RES_PTR point at the end of their blocks
|
|
||||||
; and negate SIZE.
|
|
||||||
lda r3,r3[r4]
|
|
||||||
lda r6,r2[r4] ; RES_PTR in r6 since r2 is retval
|
|
||||||
subu r4,r0,r4
|
|
||||||
|
|
||||||
addu.co r2,r0,r0 ; r2 = cy = 0
|
|
||||||
ld r9,r3[r4]
|
|
||||||
mask r7,r5,0xffff ; r7 = lo(S2_LIMB)
|
|
||||||
extu r8,r5,16 ; r8 = hi(S2_LIMB)
|
|
||||||
bcnd.n eq0,r8,Lsmall ; jump if (hi(S2_LIMB) == 0)
|
|
||||||
subu r6,r6,4
|
|
||||||
|
|
||||||
; General code for any value of S2_LIMB.
|
|
||||||
|
|
||||||
; Make a stack frame and save r25 and r26
|
|
||||||
subu r31,r31,16
|
|
||||||
st.d r25,r31,8
|
|
||||||
|
|
||||||
; Enter the loop in the middle
|
|
||||||
br.n L1
|
|
||||||
addu r4,r4,1
|
|
||||||
|
|
||||||
Loop: ld r9,r3[r4]
|
|
||||||
st r26,r6[r4]
|
|
||||||
; bcnd ne0,r0,0 ; bubble
|
|
||||||
addu r4,r4,1
|
|
||||||
L1: mul r26,r9,r5 ; low word of product mul_1 WB ld
|
|
||||||
mask r12,r9,0xffff ; r12 = lo(s1_limb) mask_1
|
|
||||||
mul r11,r12,r7 ; r11 = prod_0 mul_2 WB mask_1
|
|
||||||
mul r10,r12,r8 ; r10 = prod_1a mul_3
|
|
||||||
extu r13,r9,16 ; r13 = hi(s1_limb) extu_1 WB mul_1
|
|
||||||
mul r12,r13,r7 ; r12 = prod_1b mul_4 WB extu_1
|
|
||||||
mul r25,r13,r8 ; r25 = prod_2 mul_5 WB mul_2
|
|
||||||
extu r11,r11,16 ; r11 = hi(prod_0) extu_2 WB mul_3
|
|
||||||
addu r10,r10,r11 ; addu_1 WB extu_2
|
|
||||||
; bcnd ne0,r0,0 ; bubble WB addu_1
|
|
||||||
addu.co r10,r10,r12 ; WB mul_4
|
|
||||||
mask.u r10,r10,0xffff ; move the 16 most significant bits...
|
|
||||||
addu.ci r10,r10,r0 ; ...to the low half of the word...
|
|
||||||
rot r10,r10,16 ; ...and put carry in pos 16.
|
|
||||||
addu.co r26,r26,r2 ; add old carry limb
|
|
||||||
bcnd.n ne0,r4,Loop
|
|
||||||
addu.ci r2,r25,r10 ; compute new carry limb
|
|
||||||
|
|
||||||
st r26,r6[r4]
|
|
||||||
ld.d r25,r31,8
|
|
||||||
jmp.n r1
|
|
||||||
addu r31,r31,16
|
|
||||||
|
|
||||||
; Fast code for S2_LIMB < 0x10000
|
|
||||||
Lsmall:
|
|
||||||
; Enter the loop in the middle
|
|
||||||
br.n SL1
|
|
||||||
addu r4,r4,1
|
|
||||||
|
|
||||||
SLoop: ld r9,r3[r4] ;
|
|
||||||
st r8,r6[r4] ;
|
|
||||||
addu r4,r4,1 ;
|
|
||||||
SL1: mul r8,r9,r5 ; low word of product
|
|
||||||
mask r12,r9,0xffff ; r12 = lo(s1_limb)
|
|
||||||
extu r13,r9,16 ; r13 = hi(s1_limb)
|
|
||||||
mul r11,r12,r7 ; r11 = prod_0
|
|
||||||
mul r12,r13,r7 ; r12 = prod_1b
|
|
||||||
addu.cio r8,r8,r2 ; add old carry limb
|
|
||||||
extu r10,r11,16 ; r11 = hi(prod_0)
|
|
||||||
addu r10,r10,r12 ;
|
|
||||||
bcnd.n ne0,r4,SLoop
|
|
||||||
extu r2,r10,16 ; r2 = new carry limb
|
|
||||||
|
|
||||||
jmp.n r1
|
|
||||||
st r8,r6[r4]
|
|
@ -1,106 +0,0 @@
|
|||||||
; mc88100 __mpn_sub -- Subtract two limb vectors of the same length > 0 and
|
|
||||||
; store difference in a third limb vector.
|
|
||||||
|
|
||||||
; Copyright (C) 1992, 1994, 1996 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
; This file is part of the GNU MP Library.
|
|
||||||
|
|
||||||
; The GNU MP 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 MP 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 MP 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.
|
|
||||||
|
|
||||||
|
|
||||||
; INPUT PARAMETERS
|
|
||||||
; res_ptr r2
|
|
||||||
; s1_ptr r3
|
|
||||||
; s2_ptr r4
|
|
||||||
; size r5
|
|
||||||
|
|
||||||
; This code has been optimized to run one instruction per clock, avoiding
|
|
||||||
; load stalls and writeback contention. As a result, the instruction
|
|
||||||
; order is not always natural.
|
|
||||||
|
|
||||||
; The speed is about 4.6 clocks/limb + 18 clocks/limb-vector on an 88100,
|
|
||||||
; but on the 88110, it seems to run much slower, 6.6 clocks/limb.
|
|
||||||
|
|
||||||
text
|
|
||||||
align 16
|
|
||||||
global ___mpn_sub_n
|
|
||||||
___mpn_sub_n:
|
|
||||||
ld r6,r3,0 ; read first limb from s1_ptr
|
|
||||||
extu r10,r5,3
|
|
||||||
ld r7,r4,0 ; read first limb from s2_ptr
|
|
||||||
|
|
||||||
subu r5,r0,r5
|
|
||||||
mak r5,r5,3<4>
|
|
||||||
bcnd.n eq0,r5,Lzero
|
|
||||||
subu.co r0,r0,r0 ; initialize carry
|
|
||||||
|
|
||||||
or r12,r0,lo16(Lbase)
|
|
||||||
or.u r12,r12,hi16(Lbase)
|
|
||||||
addu r12,r12,r5 ; r12 is address for entering in loop
|
|
||||||
|
|
||||||
extu r5,r5,2 ; divide by 4
|
|
||||||
subu r2,r2,r5 ; adjust res_ptr
|
|
||||||
subu r3,r3,r5 ; adjust s1_ptr
|
|
||||||
subu r4,r4,r5 ; adjust s2_ptr
|
|
||||||
|
|
||||||
or r8,r6,r0
|
|
||||||
|
|
||||||
jmp.n r12
|
|
||||||
or r9,r7,r0
|
|
||||||
|
|
||||||
Loop: addu r3,r3,32
|
|
||||||
st r8,r2,28
|
|
||||||
addu r4,r4,32
|
|
||||||
ld r6,r3,0
|
|
||||||
addu r2,r2,32
|
|
||||||
ld r7,r4,0
|
|
||||||
Lzero: subu r10,r10,1 ; subtract 0 + 8r limbs (adj loop cnt)
|
|
||||||
Lbase: ld r8,r3,4
|
|
||||||
subu.cio r6,r6,r7
|
|
||||||
ld r9,r4,4
|
|
||||||
st r6,r2,0
|
|
||||||
ld r6,r3,8 ; subtract 7 + 8r limbs
|
|
||||||
subu.cio r8,r8,r9
|
|
||||||
ld r7,r4,8
|
|
||||||
st r8,r2,4
|
|
||||||
ld r8,r3,12 ; subtract 6 + 8r limbs
|
|
||||||
subu.cio r6,r6,r7
|
|
||||||
ld r9,r4,12
|
|
||||||
st r6,r2,8
|
|
||||||
ld r6,r3,16 ; subtract 5 + 8r limbs
|
|
||||||
subu.cio r8,r8,r9
|
|
||||||
ld r7,r4,16
|
|
||||||
st r8,r2,12
|
|
||||||
ld r8,r3,20 ; subtract 4 + 8r limbs
|
|
||||||
subu.cio r6,r6,r7
|
|
||||||
ld r9,r4,20
|
|
||||||
st r6,r2,16
|
|
||||||
ld r6,r3,24 ; subtract 3 + 8r limbs
|
|
||||||
subu.cio r8,r8,r9
|
|
||||||
ld r7,r4,24
|
|
||||||
st r8,r2,20
|
|
||||||
ld r8,r3,28 ; subtract 2 + 8r limbs
|
|
||||||
subu.cio r6,r6,r7
|
|
||||||
ld r9,r4,28
|
|
||||||
st r6,r2,24
|
|
||||||
bcnd.n ne0,r10,Loop ; subtract 1 + 8r limbs
|
|
||||||
subu.cio r8,r8,r9
|
|
||||||
|
|
||||||
st r8,r2,28 ; store most significant limb
|
|
||||||
|
|
||||||
addu.ci r2,r0,r0 ; return carry-out from most sign. limb
|
|
||||||
jmp.n r1
|
|
||||||
xor r2,r2,1
|
|
@ -1,2 +0,0 @@
|
|||||||
filedesc.h
|
|
||||||
standalone.h
|
|
@ -1,4 +0,0 @@
|
|||||||
# The `bare' subdirectory defines some structure for a target-specific
|
|
||||||
# library of functions which are actually implemented in
|
|
||||||
# sysdeps/standalone/CPU/TARGET.
|
|
||||||
bare
|
|
@ -1,65 +0,0 @@
|
|||||||
/* Copyright (C) 1991,1994,1996,1997,1998,2004 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. */
|
|
||||||
|
|
||||||
/* This file defines the `errno' constants for standalone ARM machines.
|
|
||||||
These constants are essentially arbitrary. */
|
|
||||||
|
|
||||||
#if !defined __Emath_defined && (defined _ERRNO_H || defined __need_Emath)
|
|
||||||
# undef __need_Emath
|
|
||||||
# define __Emath_defined 1
|
|
||||||
|
|
||||||
# define EDOM 1
|
|
||||||
# define ERANGE 2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _ERRNO_H
|
|
||||||
# define ENOSYS 3
|
|
||||||
# define EINVAL 4
|
|
||||||
# define ESPIPE 5
|
|
||||||
# define EBADF 6
|
|
||||||
# define ENOMEM 7
|
|
||||||
# define EACCES 8
|
|
||||||
# define ENFILE 9
|
|
||||||
# define EMFILE 10
|
|
||||||
# define ENAMETOOLONG 11 /* File name too long */
|
|
||||||
# define ELOOP 12 /* Too many symbolic links encountered */
|
|
||||||
# define ENOMSG 13 /* No message of desired type */
|
|
||||||
# define E2BIG 14 /* Arg list too long */
|
|
||||||
# define EINTR 15
|
|
||||||
# define EILSEQ 16
|
|
||||||
# define ENOEXEC 17
|
|
||||||
# define ENOENT 18
|
|
||||||
# define EPROTOTYPE 19
|
|
||||||
# define ESRCH 20
|
|
||||||
# define EPERM 21
|
|
||||||
# define ENOTDIR 22
|
|
||||||
# define ESTALE 23
|
|
||||||
# define EISDIR 24
|
|
||||||
# define EOPNOTSUPP 25 /* Operation not supported. */
|
|
||||||
# define ENOTTY 26
|
|
||||||
# define EAGAIN 27
|
|
||||||
# define EIO 28
|
|
||||||
# define ENOSPC 29
|
|
||||||
# define EEXIST 30
|
|
||||||
# define EBUSY 31
|
|
||||||
# define EOVERFLOW 32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Function to get address of global `errno' variable. */
|
|
||||||
extern int *__errno_location (void) __THROW __attribute__ ((__const__));
|
|
@ -1,32 +0,0 @@
|
|||||||
/* Copyright (C) 1995, 1996, 1997 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. */
|
|
||||||
|
|
||||||
#include <sysdep.h>
|
|
||||||
|
|
||||||
/* errno has to be defined somewhere, and it might as well be here. */
|
|
||||||
int errno = 0;
|
|
||||||
|
|
||||||
/* The same goes for these magic signal functions. This is a standalone
|
|
||||||
environment so we do nothing. */
|
|
||||||
void _sig_dfl(int sig)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void _sig_ign(int sig)
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,59 +0,0 @@
|
|||||||
/* Copyright (C) 1991, 1994, 1996, 1997, 1998 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. */
|
|
||||||
|
|
||||||
/* This file defines the `errno' constants. */
|
|
||||||
|
|
||||||
#if !defined __Emath_defined && (defined _ERRNO_H || defined __need_Emath)
|
|
||||||
#undef __need_Emath
|
|
||||||
#define __Emath_defined 1
|
|
||||||
|
|
||||||
# define EDOM 1
|
|
||||||
# define EILSEQ 17
|
|
||||||
# define ERANGE 2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _ERRNO_H
|
|
||||||
# define ENOSYS 3
|
|
||||||
# define EINVAL 4
|
|
||||||
# define ESPIPE 5
|
|
||||||
# define EBADF 6
|
|
||||||
# define ENOMEM 7
|
|
||||||
# define EACCES 8
|
|
||||||
# define ENFILE 9
|
|
||||||
# define EMFILE 10
|
|
||||||
# define ENOMSG 11
|
|
||||||
# define ENAMETOOLONG 12
|
|
||||||
# define ELOOP 13
|
|
||||||
# define E2BIG 15
|
|
||||||
# define EINTR 16
|
|
||||||
# define ENOEXEC 18
|
|
||||||
# define ENOENT 19
|
|
||||||
# define EPROTOTYPE 20
|
|
||||||
# define ESRCH 21
|
|
||||||
# define EPERM 22
|
|
||||||
# define EEXIST 23
|
|
||||||
# define ENOTDIR 24
|
|
||||||
# define ESTALE 25
|
|
||||||
# define ENOTTY 26
|
|
||||||
# define EISDIR 27
|
|
||||||
# define EOPNOTSUPP 28
|
|
||||||
# define EAGAIN 29
|
|
||||||
# define EIO 30
|
|
||||||
# define ENOSPC 31
|
|
||||||
# define EBUSY 32
|
|
||||||
#endif
|
|
@ -1,66 +0,0 @@
|
|||||||
/* Copyright (C) 1991, 1994, 1995, 1997 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Ported to standalone by Joel Sherrill jsherril@redstone-emh2.army.mil,
|
|
||||||
On-Line Applications Research Corporation.
|
|
||||||
|
|
||||||
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. */
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
void *__curbrk;
|
|
||||||
void *__rorig;
|
|
||||||
void *__rlimit;
|
|
||||||
|
|
||||||
int
|
|
||||||
__brk (inaddr)
|
|
||||||
void *inaddr;
|
|
||||||
{
|
|
||||||
|
|
||||||
if ( ( (void *)inaddr > (void *)__rlimit ) ||
|
|
||||||
( (void *)inaddr < (void *)__rorig ) )
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
__curbrk = inaddr;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialization Code for Memory Allocation */
|
|
||||||
|
|
||||||
void *__C_heap_start;
|
|
||||||
int __C_heap_size;
|
|
||||||
|
|
||||||
#ifdef HAVE_GNU_LD
|
|
||||||
static
|
|
||||||
#endif
|
|
||||||
void
|
|
||||||
__NONE_set_memvals (argc, argv, envp)
|
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
char **envp;
|
|
||||||
{
|
|
||||||
|
|
||||||
__rorig =
|
|
||||||
__curbrk = __C_heap_start;
|
|
||||||
__rlimit = __curbrk + __C_heap_size;
|
|
||||||
|
|
||||||
(void) &__NONE_set_memvals; /* Avoid "defined but not used" warning. */
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_GNU_LD
|
|
||||||
text_set_element (__libc_subinit, __NONE_set_memvals);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
weak_alias (__brk, brk)
|
|
@ -1,43 +0,0 @@
|
|||||||
/* Copyright (C) 1994, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
|
|
||||||
Ported to standalone by Joel Sherrill jsherril@redstone-emh2.army.mil,
|
|
||||||
On-Line Applications Research Corporation.
|
|
||||||
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. */
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#define _STDIO_H
|
|
||||||
#include <bits/stdio_lim.h>
|
|
||||||
#include "filedesc.h"
|
|
||||||
|
|
||||||
/* Close the file descriptor FD. */
|
|
||||||
int
|
|
||||||
__close (fd)
|
|
||||||
int fd;
|
|
||||||
{
|
|
||||||
if ( !__FD_Is_valid( fd ) || !__FD_Table[ fd ].in_use )
|
|
||||||
{
|
|
||||||
__set_errno (EBADF);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
__FD_Table[ fd ].in_use = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
libc_hidden_def (__close)
|
|
||||||
weak_alias (__close, close)
|
|
@ -1,43 +0,0 @@
|
|||||||
/* Copyright (C) 1993, 1997 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. */
|
|
||||||
|
|
||||||
#ifndef _DIRSTREAM_H
|
|
||||||
|
|
||||||
#define _DIRSTREAM_H 1
|
|
||||||
|
|
||||||
#define __need_size_t
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
/* Directory stream type.
|
|
||||||
|
|
||||||
The miscellaneous Unix `readdir' implementations read directory data
|
|
||||||
into a buffer and fill in a `struct dirent' copy in the `DIR' object. */
|
|
||||||
|
|
||||||
struct __dirstream
|
|
||||||
{
|
|
||||||
int __fd; /* File descriptor. */
|
|
||||||
|
|
||||||
char *__data; /* Directory block. */
|
|
||||||
size_t __allocation; /* Space allocated for the block. */
|
|
||||||
size_t __offset; /* Current offset into the block. */
|
|
||||||
size_t __size; /* Total valid data in the block. */
|
|
||||||
|
|
||||||
struct dirent __entry; /* Returned by `readdir'. */
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* dirstream.h */
|
|
@ -1,48 +0,0 @@
|
|||||||
/* Copyright (C) 1994, 1997, 1998 Free Software Foundation, Inc.
|
|
||||||
Ported to standalone by Joel Sherrill jsherril@redstone-emh2.army.mil,
|
|
||||||
On-Line Applications Research Corporation.
|
|
||||||
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. */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This is the file descriptor used by the no OS implementation
|
|
||||||
* of __open, __read, __write, and __close.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __FILEDESC_h
|
|
||||||
#define __FILEDESC_h
|
|
||||||
|
|
||||||
#define __need_FOPEN_MAX
|
|
||||||
#include <bits/stdio_lim.h>
|
|
||||||
|
|
||||||
#ifndef __DECLARE_FILE_DESCRIPTORS__
|
|
||||||
#define FILEDESC_EXTERN extern
|
|
||||||
#else
|
|
||||||
#define FILEDESC_EXTERN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int in_use; /* 1 if in use, 0 otherwise */
|
|
||||||
int flags; /* Flags from open */
|
|
||||||
} __no_os_file_descriptor;
|
|
||||||
|
|
||||||
#define __FD_Is_valid( _fd ) \
|
|
||||||
( (_fd) >= 0 && (_fd) < FOPEN_MAX )
|
|
||||||
|
|
||||||
FILEDESC_EXTERN __no_os_file_descriptor __FD_Table[ FOPEN_MAX ];
|
|
||||||
|
|
||||||
#endif
|
|
@ -1 +0,0 @@
|
|||||||
i386.h
|
|
@ -1 +0,0 @@
|
|||||||
target.ld
|
|
@ -1,26 +0,0 @@
|
|||||||
# Copyright (C) 1994, 1997 Free Software Foundation, Inc.
|
|
||||||
# This file is part of the GNU C Library.
|
|
||||||
# Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
|
|
||||||
# On-Line Applications Research Corporation.
|
|
||||||
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
ifeq (bare,$(subdir))
|
|
||||||
install-others += $(inst_libdir)/force_cpu386.ld
|
|
||||||
$(inst_libdir)/force_cpu386.ld: $(sysdep_dir)/standalone/i386/target.ld \
|
|
||||||
$(+force)
|
|
||||||
$(do-install)
|
|
||||||
endif
|
|
@ -1,47 +0,0 @@
|
|||||||
/* Copyright (C) 1991, 1997, 1999, 2004 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
|
|
||||||
On-Line Applications Research Corporation.
|
|
||||||
|
|
||||||
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. */
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
/* This returns control to FORCEbug. */
|
|
||||||
|
|
||||||
void Bsp_cleanup (void);
|
|
||||||
|
|
||||||
/* The function `_exit' should take a status argument and simply
|
|
||||||
terminate program execution, using the low-order 8 bits of the
|
|
||||||
given integer as status. */
|
|
||||||
|
|
||||||
__NORETURN void
|
|
||||||
_exit (status)
|
|
||||||
int status;
|
|
||||||
{
|
|
||||||
/* status is ignored */
|
|
||||||
Bsp_cleanup();
|
|
||||||
}
|
|
||||||
weak_alias (_exit, _Exit)
|
|
||||||
|
|
||||||
#ifdef HAVE_GNU_LD
|
|
||||||
|
|
||||||
#include <gnu-stabs.h>
|
|
||||||
|
|
||||||
stub_warning(_exit);
|
|
||||||
|
|
||||||
#endif /* GNU stabs. */
|
|
@ -1,42 +0,0 @@
|
|||||||
/* Copyright (C) 1994, 1997, 2004 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
|
|
||||||
On-Line Applications Research Corporation.
|
|
||||||
|
|
||||||
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. */
|
|
||||||
|
|
||||||
#include <standalone.h>
|
|
||||||
#include "i386.h"
|
|
||||||
|
|
||||||
/* _Board_Initialize()
|
|
||||||
|
|
||||||
This routine initializes the FORCE CPU386 board. */
|
|
||||||
|
|
||||||
void _Console_Initialize (void);
|
|
||||||
|
|
||||||
void
|
|
||||||
_Board_Initialize ()
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* FORCE documentation incorrectly states that the bus request
|
|
||||||
* level is initialized to 3. It is actually initialized by
|
|
||||||
* FORCEbug to 0.
|
|
||||||
*/
|
|
||||||
|
|
||||||
outport_byte (0x00, 0x3f); /* resets VMEbus request level */
|
|
||||||
|
|
||||||
_Console_Initialize ();
|
|
||||||
}
|
|
@ -1,163 +0,0 @@
|
|||||||
/* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
|
|
||||||
On-Line Applications Research Corporation.
|
|
||||||
|
|
||||||
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. */
|
|
||||||
|
|
||||||
#include <standalone.h>
|
|
||||||
#include "i386.h"
|
|
||||||
|
|
||||||
/* Console IO routines for a FORCE CPU386 board. */
|
|
||||||
|
|
||||||
/* Force CPU/386 specific IO addressing
|
|
||||||
*
|
|
||||||
* The following determines whether Port B or the Console should
|
|
||||||
* be used for console I/O. Setting ONE (and only ONE) of these to 1
|
|
||||||
* enables I/O on that port.
|
|
||||||
*
|
|
||||||
* PORT A - DUSCC MC68562 Channel A (*** not supported here ***)
|
|
||||||
* PORT B - DUSCC MC68562 Channel B
|
|
||||||
* PORT C - MFP MC68901 Channel (*** FORCEbug console ***)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define PORTB 1 /* use port b as console */
|
|
||||||
#define PORTC 0 /* use console port as console */
|
|
||||||
|
|
||||||
#if ( PORTB == 1 )
|
|
||||||
#define TX_STATUS 0x1b6 /* DUSCC General Status Register */
|
|
||||||
#define RX_STATUS 0x1b6 /* DUSCC General Status Register */
|
|
||||||
#define TX_BUFFER 0x1e0 /* DUSCC Transmitter Channel B */
|
|
||||||
#define RX_BUFFER 0x1e8 /* DUSCC Receiver Channel B */
|
|
||||||
#define Is_tx_ready( _status ) ( (_status) & 0x20 )
|
|
||||||
#define Is_rx_ready( _status ) ( (_status) & 0x10 )
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ( PORTC == 1 )
|
|
||||||
#define TX_STATUS 0x12c /* MFP Transmit Status Register */
|
|
||||||
#define RX_STATUS 0x12a /* MFP Receive Status Register */
|
|
||||||
#define TX_BUFFER 0x12e /* MFP Transmitter Channel */
|
|
||||||
#define RX_BUFFER 0x12e /* MFP Receiver Channel */
|
|
||||||
#define Is_tx_ready( _status ) ( (_status) & 0x80 )
|
|
||||||
#define Is_rx_ready( _status ) ( (_status) & 0x80 )
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* _Console_Initialize
|
|
||||||
|
|
||||||
On the Force board the console require some initialization. */
|
|
||||||
|
|
||||||
void
|
|
||||||
_Console_Initialize ()
|
|
||||||
{
|
|
||||||
register unsigned8 ignored;
|
|
||||||
|
|
||||||
/* FORCE technical support mentioned that it may be necessary to
|
|
||||||
read the DUSCC RX_BUFFER port four times to remove all junk.
|
|
||||||
This code is a little more paranoid. */
|
|
||||||
|
|
||||||
inport_byte( RX_BUFFER, ignored );
|
|
||||||
inport_byte( RX_BUFFER, ignored );
|
|
||||||
inport_byte( RX_BUFFER, ignored );
|
|
||||||
inport_byte( RX_BUFFER, ignored );
|
|
||||||
inport_byte( RX_BUFFER, ignored );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Miscellaneous support for console IO */
|
|
||||||
|
|
||||||
static inline int _Force386_is_rx_ready ()
|
|
||||||
{
|
|
||||||
register unsigned8 status;
|
|
||||||
|
|
||||||
inport_byte( RX_STATUS, status );
|
|
||||||
|
|
||||||
if ( Is_rx_ready( status ) ) return 1;
|
|
||||||
else return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int _Force386_is_tx_ready ()
|
|
||||||
{
|
|
||||||
register unsigned8 status;
|
|
||||||
|
|
||||||
inport_byte( TX_STATUS, status );
|
|
||||||
|
|
||||||
if ( Is_tx_ready( status ) ) return 1;
|
|
||||||
else return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static inline int _Force386_read_data ()
|
|
||||||
{
|
|
||||||
register unsigned8 ch;
|
|
||||||
|
|
||||||
#if ( PORTB == 1 )
|
|
||||||
/* Force example code resets the Channel B Receiver here.
|
|
||||||
* It appears to cause XON's to be lost.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* outport_byte( RX_STATUS, 0x10 ); */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
inport_byte( RX_BUFFER, ch );
|
|
||||||
|
|
||||||
return ch;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* _Console_Putc
|
|
||||||
|
|
||||||
This routine transmits a character. It supports XON/XOFF flow control. */
|
|
||||||
|
|
||||||
#define XON 0x11 /* control-Q */
|
|
||||||
#define XOFF 0x13 /* control-S */
|
|
||||||
|
|
||||||
int
|
|
||||||
_Console_Putc (ch)
|
|
||||||
char ch;
|
|
||||||
{
|
|
||||||
register unsigned8 inch;
|
|
||||||
|
|
||||||
while ( !_Force386_is_tx_ready() );
|
|
||||||
|
|
||||||
while ( _Force386_is_rx_ready() == 1 ) { /* must be an XOFF */
|
|
||||||
inch = _Force386_read_data();
|
|
||||||
if ( inch == XOFF )
|
|
||||||
do {
|
|
||||||
while ( _Force386_is_rx_ready() == 0 );
|
|
||||||
inch = _Force386_read_data();
|
|
||||||
} while ( inch != XON );
|
|
||||||
}
|
|
||||||
|
|
||||||
outport_byte( TX_BUFFER, ch );
|
|
||||||
return( 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* _Console_Getc
|
|
||||||
|
|
||||||
This routine reads a character from the UART and returns it. */
|
|
||||||
|
|
||||||
int
|
|
||||||
_Console_Getc (poll)
|
|
||||||
int poll;
|
|
||||||
{
|
|
||||||
if ( poll ) {
|
|
||||||
if ( !_Force386_is_rx_ready() )
|
|
||||||
return -1;
|
|
||||||
else
|
|
||||||
return _Force386_read_data();
|
|
||||||
} else {
|
|
||||||
while ( !_Force386_is_rx_ready() );
|
|
||||||
return _Force386_read_data();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,87 +0,0 @@
|
|||||||
/* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
|
|
||||||
Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
|
|
||||||
On-Line Applications Research Corporation.
|
|
||||||
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. */
|
|
||||||
|
|
||||||
/* This file assists the board independent startup code by
|
|
||||||
* loading the proper segment register values. The values
|
|
||||||
* loaded are dependent on the FORCEBUG.
|
|
||||||
*
|
|
||||||
* NOTE: No stack has been established when this routine
|
|
||||||
* is invoked. It returns by jumping back to the start code.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* FORCEBUG loads us into a virtual address space which
|
|
||||||
* really starts at PHYSICAL_ADDRESS_BASE.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
.set PHYSICAL_ADDRESS_BASE, 0x00002000
|
|
||||||
|
|
||||||
/*
|
|
||||||
* At reset time, FORCEBUG normally has the segment selectors preloaded.
|
|
||||||
* If a human resets the instruction pointer, this will not have occurred.
|
|
||||||
* However, no guarantee can be made of the other registers if cs:ip was
|
|
||||||
* modified to restart the program. Because of this, the BSP reloads all
|
|
||||||
* segment registers (except cs) with the values they have following
|
|
||||||
* a reset.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
.set RESET_SS, 0x40 # initial value of stack segment register
|
|
||||||
.set RESET_DS, 0x40 # initial value of data segment register
|
|
||||||
.set RESET_ES, 0x40 # initial value of extra segment register
|
|
||||||
.set RESET_FS, 0x40 # initial value of "f" segment register
|
|
||||||
.set RESET_GS, 0x30 # initial value of "g" segment register
|
|
||||||
|
|
||||||
|
|
||||||
#define LOAD_SEGMENTS(_value,_segreg) \
|
|
||||||
movw $_value##,%ax ; \
|
|
||||||
movw %ax,##_segreg
|
|
||||||
|
|
||||||
|
|
||||||
.global _load_segments
|
|
||||||
|
|
||||||
.global _establish_stack
|
|
||||||
|
|
||||||
_load_segments:
|
|
||||||
|
|
||||||
LOAD_SEGMENTS( RESET_SS, %ss )
|
|
||||||
LOAD_SEGMENTS( RESET_DS, %ds )
|
|
||||||
LOAD_SEGMENTS( RESET_ES, %es )
|
|
||||||
LOAD_SEGMENTS( RESET_FS, %fs )
|
|
||||||
LOAD_SEGMENTS( RESET_GS, %gs )
|
|
||||||
|
|
||||||
jmp _establish_stack # return to the bsp entry code
|
|
||||||
|
|
||||||
.global _return_to_monitor
|
|
||||||
_return_to_monitor:
|
|
||||||
|
|
||||||
movb $0,%al
|
|
||||||
int $0x20 # restart FORCEbug
|
|
||||||
jmp start # FORCEbug does not reset PC
|
|
||||||
|
|
||||||
.data
|
|
||||||
|
|
||||||
.global _Do_Load_IDT
|
|
||||||
_Do_Load_IDT: .byte 1
|
|
||||||
|
|
||||||
.global _Do_Load_GDT
|
|
||||||
_Do_Load_GDT: .byte 0
|
|
@ -1,58 +0,0 @@
|
|||||||
/* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
|
|
||||||
Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
|
|
||||||
On-Line Applications Research Corporation.
|
|
||||||
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. */
|
|
||||||
|
|
||||||
/* This file contains directives for the GNU linker which are specific
|
|
||||||
to the FORCE CPU386 board. */
|
|
||||||
|
|
||||||
MEMORY
|
|
||||||
{
|
|
||||||
ram : org = 0x0, l = 1M
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This value is also when the space is allocated. If you change
|
|
||||||
this one, change the other one!!! */
|
|
||||||
|
|
||||||
heap_size = 0x20000;
|
|
||||||
|
|
||||||
SECTIONS
|
|
||||||
{
|
|
||||||
.text 0x0 :
|
|
||||||
{
|
|
||||||
_text_start = ABSOLUTE(.) ;
|
|
||||||
*(.text)
|
|
||||||
_etext = ALIGN( 0x10 ) ;
|
|
||||||
}
|
|
||||||
.data ADDR( .text ) + SIZEOF( .text ):
|
|
||||||
{
|
|
||||||
_data_start = . ;
|
|
||||||
*(.data)
|
|
||||||
_edata = ALIGN( 0x10 ) ;
|
|
||||||
}
|
|
||||||
.bss ADDR( .data ) + SIZEOF( .data ):
|
|
||||||
{
|
|
||||||
_bss_start = . ;
|
|
||||||
*(.bss)
|
|
||||||
*(COMMON)
|
|
||||||
heap_memory = .;
|
|
||||||
. += 0x20000;
|
|
||||||
_end = . ;
|
|
||||||
__end = . ;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,326 +0,0 @@
|
|||||||
/* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
|
|
||||||
Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
|
|
||||||
On-Line Applications Research Corporation.
|
|
||||||
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. */
|
|
||||||
|
|
||||||
/* i386.h
|
|
||||||
*
|
|
||||||
* This file contains macros which are used to access i80386
|
|
||||||
* registers which are not addressable by C. This file contains
|
|
||||||
* functions which are useful to those developing target
|
|
||||||
* specific support routines.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef i386_h__
|
|
||||||
#define i386_h__
|
|
||||||
|
|
||||||
typedef unsigned char unsigned8;
|
|
||||||
typedef unsigned short unsigned16;
|
|
||||||
typedef unsigned int unsigned32;
|
|
||||||
|
|
||||||
#define disable_intr( isrlevel ) \
|
|
||||||
{ (isrlevel) = 0; \
|
|
||||||
asm volatile ( "pushf ; \
|
|
||||||
pop %0 ; \
|
|
||||||
cli " \
|
|
||||||
: "=r" ((isrlevel)) : "0" ((isrlevel)) ); \
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#define enable_intr( isrlevel ) \
|
|
||||||
{ asm volatile ( "push %0 ; \
|
|
||||||
popf " \
|
|
||||||
: "=r" ((isrlevel)) : "0" ((isrlevel)) ); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define delay( _microseconds ) \
|
|
||||||
{ \
|
|
||||||
unsigned32 _counter; \
|
|
||||||
\
|
|
||||||
_counter = (_microseconds); \
|
|
||||||
\
|
|
||||||
asm volatile ( "0: nop;" \
|
|
||||||
" mov %0,%0 ;" \
|
|
||||||
" loop 0" : "=c" (_counter) \
|
|
||||||
: "0" (_counter) \
|
|
||||||
); \
|
|
||||||
\
|
|
||||||
}
|
|
||||||
|
|
||||||
/* segment access functions */
|
|
||||||
|
|
||||||
static inline unsigned16 get_cs()
|
|
||||||
{
|
|
||||||
register unsigned16 segment = 0;
|
|
||||||
|
|
||||||
asm volatile ( "movw %%cs,%0" : "=r" (segment) : "0" (segment) );
|
|
||||||
|
|
||||||
return segment;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned16 get_ds()
|
|
||||||
{
|
|
||||||
register unsigned16 segment = 0;
|
|
||||||
|
|
||||||
asm volatile ( "movw %%ds,%0" : "=r" (segment) : "0" (segment) );
|
|
||||||
|
|
||||||
return segment;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned16 get_es()
|
|
||||||
{
|
|
||||||
register unsigned16 segment = 0;
|
|
||||||
|
|
||||||
asm volatile ( "movw %%es,%0" : "=r" (segment) : "0" (segment) );
|
|
||||||
|
|
||||||
return segment;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned16 get_ss()
|
|
||||||
{
|
|
||||||
register unsigned16 segment = 0;
|
|
||||||
|
|
||||||
asm volatile ( "movw %%ss,%0" : "=r" (segment) : "0" (segment) );
|
|
||||||
|
|
||||||
return segment;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned16 get_fs()
|
|
||||||
{
|
|
||||||
register unsigned16 segment = 0;
|
|
||||||
|
|
||||||
asm volatile ( "movw %%fs,%0" : "=r" (segment) : "0" (segment) );
|
|
||||||
|
|
||||||
return segment;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned16 get_gs()
|
|
||||||
{
|
|
||||||
register unsigned16 segment = 0;
|
|
||||||
|
|
||||||
asm volatile ( "movw %%gs,%0" : "=r" (segment) : "0" (segment) );
|
|
||||||
|
|
||||||
return segment;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* i80x86 I/O instructions */
|
|
||||||
|
|
||||||
#define outport_byte( _port, _value ) \
|
|
||||||
{ register unsigned16 __port = _port; \
|
|
||||||
register unsigned8 __value = _value; \
|
|
||||||
\
|
|
||||||
asm volatile ( "outb %0,%1" : "=a" (__value), "=d" (__port) \
|
|
||||||
: "0" (__value), "1" (__port) \
|
|
||||||
); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define outport_word( _port, _value ) \
|
|
||||||
{ register unsigned16 __port = _port; \
|
|
||||||
register unsigned16 __value = _value; \
|
|
||||||
\
|
|
||||||
asm volatile ( "outw %0,%1" : "=a" (__value), "=d" (__port) \
|
|
||||||
: "0" (__value), "1" (__port) \
|
|
||||||
); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define outport_long( _port, _value ) \
|
|
||||||
{ register unsigned16 __port = _port; \
|
|
||||||
register unsigned32 __value = _value; \
|
|
||||||
\
|
|
||||||
asm volatile ( "outl %0,%1" : "=a" (__value), "=d" (__port) \
|
|
||||||
: "0" (__value), "1" (__port) \
|
|
||||||
); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define inport_byte( _port, _value ) \
|
|
||||||
{ register unsigned16 __port = _port; \
|
|
||||||
register unsigned8 __value = 0; \
|
|
||||||
\
|
|
||||||
asm volatile ( "inb %1,%0" : "=a" (__value), "=d" (__port) \
|
|
||||||
: "0" (__value), "1" (__port) \
|
|
||||||
); \
|
|
||||||
_value = __value; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define inport_word( _port, _value ) \
|
|
||||||
{ register unsigned16 __port = _port; \
|
|
||||||
register unsigned16 __value = 0; \
|
|
||||||
\
|
|
||||||
asm volatile ( "inw %1,%0" : "=a" (__value), "=d" (__port) \
|
|
||||||
: "0" (__value), "1" (__port) \
|
|
||||||
); \
|
|
||||||
_value = __value; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define inport_long( _port, _value ) \
|
|
||||||
{ register unsigned16 __port = _port; \
|
|
||||||
register unsigned32 __value = 0; \
|
|
||||||
\
|
|
||||||
asm volatile ( "inl %1,%0" : "=a" (__value), "=d" (__port) \
|
|
||||||
: "0" (__value), "1" (__port) \
|
|
||||||
); \
|
|
||||||
_value = __value; \
|
|
||||||
}
|
|
||||||
|
|
||||||
/* structures */
|
|
||||||
|
|
||||||
/* See Chapter 5 - Memory Management in i386 manual */
|
|
||||||
|
|
||||||
struct GDT_slot {
|
|
||||||
unsigned16 limit_0_15;
|
|
||||||
unsigned16 base_0_15;
|
|
||||||
unsigned8 base_16_23;
|
|
||||||
unsigned8 type_dt_dpl_p;
|
|
||||||
unsigned8 limit_16_19_granularity;
|
|
||||||
unsigned8 base_24_31;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* See Chapter 9 - Exceptions and Interrupts in i386 manual
|
|
||||||
*
|
|
||||||
* NOTE: This is the IDT entry for interrupt gates ONLY.
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct IDT_slot {
|
|
||||||
unsigned16 offset_0_15;
|
|
||||||
unsigned16 segment_selector;
|
|
||||||
unsigned8 reserved;
|
|
||||||
unsigned8 p_dpl;
|
|
||||||
unsigned16 offset_16_31;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DTR_load_save_format {
|
|
||||||
unsigned16 limit;
|
|
||||||
unsigned32 physical_address;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* variables */
|
|
||||||
|
|
||||||
extern struct IDT_slot Interrupt_descriptor_table[ 256 ];
|
|
||||||
extern struct GDT_slot Global_descriptor_table[ 8192 ];
|
|
||||||
|
|
||||||
/* functions */
|
|
||||||
|
|
||||||
#ifdef CPU_INITIALIZE
|
|
||||||
#define EXTERN
|
|
||||||
#else
|
|
||||||
#undef EXTERN
|
|
||||||
#define EXTERN extern
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void *Logical_to_physical(
|
|
||||||
unsigned16 segment,
|
|
||||||
void *address
|
|
||||||
);
|
|
||||||
|
|
||||||
void *Physical_to_logical(
|
|
||||||
unsigned16 segment,
|
|
||||||
void *address
|
|
||||||
);
|
|
||||||
|
|
||||||
/* complicated static inline functions */
|
|
||||||
|
|
||||||
#define get_GDTR( _gdtr_address ) \
|
|
||||||
{ \
|
|
||||||
void *_gdtr = (_gdtr_address); \
|
|
||||||
\
|
|
||||||
asm volatile( "sgdt (%0)" : "=r" (_gdtr) : "0" (_gdtr) ); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define get_GDT_slot( _gdtr_base, _segment, _slot_address ) \
|
|
||||||
{ \
|
|
||||||
register unsigned32 _gdt_slot = (_gdtr_base) + (_segment); \
|
|
||||||
register volatile void *_slot = (_slot_address); \
|
|
||||||
register unsigned32 _temporary = 0; \
|
|
||||||
\
|
|
||||||
asm volatile( "movl %%gs:(%0),%1 ; \
|
|
||||||
movl %1,(%2) ; \
|
|
||||||
movl %%gs:4(%0),%1 ; \
|
|
||||||
movl %1,4(%2)" \
|
|
||||||
: "=r" (_gdt_slot), "=r" (_temporary), "=r" (_slot) \
|
|
||||||
: "0" (_gdt_slot), "1" (_temporary), "2" (_slot) \
|
|
||||||
); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define set_GDT_slot( _gdtr_base, _segment, _slot_address ) \
|
|
||||||
{ \
|
|
||||||
register unsigned32 _gdt_slot = (_gdtr_base) + (_segment); \
|
|
||||||
register volatile void *_slot = (_slot_address); \
|
|
||||||
register unsigned32 _temporary = 0; \
|
|
||||||
\
|
|
||||||
asm volatile( "movl (%2),%1 ; \
|
|
||||||
movl %1,%%gs:(%0) ; \
|
|
||||||
movl 4(%2),%1 ; \
|
|
||||||
movl %1,%%gs:4(%0) \
|
|
||||||
" \
|
|
||||||
: "=r" (_gdt_slot), "=r" (_temporary), "=r" (_slot) \
|
|
||||||
: "0" (_gdt_slot), "1" (_temporary), "2" (_slot) \
|
|
||||||
); \
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void set_segment(
|
|
||||||
unsigned16 segment,
|
|
||||||
unsigned32 base,
|
|
||||||
unsigned32 limit
|
|
||||||
)
|
|
||||||
{
|
|
||||||
struct DTR_load_save_format gdtr;
|
|
||||||
volatile struct GDT_slot Gdt_slot;
|
|
||||||
volatile struct GDT_slot *gdt_slot = &Gdt_slot;
|
|
||||||
unsigned16 tmp_segment = 0;
|
|
||||||
unsigned32 limit_adjusted;
|
|
||||||
|
|
||||||
|
|
||||||
/* load physical address of the GDT */
|
|
||||||
|
|
||||||
get_GDTR( &gdtr );
|
|
||||||
|
|
||||||
gdt_slot->type_dt_dpl_p = 0x92; /* present, dpl=0, */
|
|
||||||
/* application=1, */
|
|
||||||
/* type=data read/write */
|
|
||||||
gdt_slot->limit_16_19_granularity = 0x40; /* 32 bit segment */
|
|
||||||
|
|
||||||
limit_adjusted = limit;
|
|
||||||
if ( limit > 4095 ) {
|
|
||||||
gdt_slot->limit_16_19_granularity |= 0x80; /* set granularity bit */
|
|
||||||
limit_adjusted /= 4096;
|
|
||||||
}
|
|
||||||
|
|
||||||
gdt_slot->limit_16_19_granularity |= (limit_adjusted >> 16) & 0xff;
|
|
||||||
gdt_slot->limit_0_15 = limit_adjusted & 0xffff;
|
|
||||||
|
|
||||||
gdt_slot->base_0_15 = base & 0xffff;
|
|
||||||
gdt_slot->base_16_23 = (base >> 16) & 0xff;
|
|
||||||
gdt_slot->base_24_31 = (base >> 24);
|
|
||||||
|
|
||||||
set_GDT_slot( gdtr.physical_address, segment, gdt_slot );
|
|
||||||
|
|
||||||
/* Now, reload all segment registers so the limit takes effect. */
|
|
||||||
|
|
||||||
asm volatile( "movw %%ds,%0 ; movw %0,%%ds\n"
|
|
||||||
"movw %%es,%0 ; movw %0,%%es\n"
|
|
||||||
"movw %%fs,%0 ; movw %0,%%fs\n"
|
|
||||||
"movw %%gs,%0 ; movw %0,%%gs\n"
|
|
||||||
"movw %%ss,%0 ; movw %0,%%ss"
|
|
||||||
: "=r" (tmp_segment)
|
|
||||||
: "0" (tmp_segment)
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
/* end of include file */
|
|
@ -1,338 +0,0 @@
|
|||||||
/* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
|
|
||||||
Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
|
|
||||||
On-Line Applications Research Corporation.
|
|
||||||
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.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU Lesser General Public
|
|
||||||
License, the Free Software Foundation gives you unlimited
|
|
||||||
permission to link the compiled version of this file with other
|
|
||||||
programs, and to distribute those programs without any restriction
|
|
||||||
coming from the use of this file. (The GNU Lesser General Public
|
|
||||||
License restrictions do apply in other respects; for example, they
|
|
||||||
cover modification of the file, and distribution when not linked
|
|
||||||
into another program.)
|
|
||||||
|
|
||||||
Note that people who make modified versions of this file are not
|
|
||||||
obligated to grant this special exception for their modified
|
|
||||||
versions; it is their choice whether to do so. The GNU Lesser
|
|
||||||
General Public License gives permission to release a modified
|
|
||||||
version without this exception; this exception also makes it
|
|
||||||
possible to release a modified version which carries forward this
|
|
||||||
exception.
|
|
||||||
|
|
||||||
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. */
|
|
||||||
|
|
||||||
/* entry.s
|
|
||||||
*
|
|
||||||
* This file contains the entry point for the application.
|
|
||||||
* The name of this entry point is compiler dependent.
|
|
||||||
* It jumps to the BSP which is responsible for performing
|
|
||||||
* all initialization.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
.data
|
|
||||||
.global _Do_Load_IDT
|
|
||||||
.global _Do_Load_GDT
|
|
||||||
|
|
||||||
.text
|
|
||||||
.global start # GNU default entry point
|
|
||||||
.global _establish_stack
|
|
||||||
|
|
||||||
.global _bsp_start
|
|
||||||
.global _load_segments
|
|
||||||
.global __exit
|
|
||||||
|
|
||||||
start:
|
|
||||||
nop
|
|
||||||
cli # DISABLE INTERRUPTS!!!
|
|
||||||
#
|
|
||||||
# Load the segment registers
|
|
||||||
#
|
|
||||||
# NOTE: Upon return, gs will contain the segment descriptor for
|
|
||||||
# a segment which maps directly to all of physical memory.
|
|
||||||
#
|
|
||||||
jmp _load_segments # load board dependent segments
|
|
||||||
|
|
||||||
#
|
|
||||||
# Set up the stack
|
|
||||||
#
|
|
||||||
|
|
||||||
_establish_stack:
|
|
||||||
|
|
||||||
movl $stack_end,%esp # set stack pointer
|
|
||||||
movl $stack_end,%ebp # set base pointer
|
|
||||||
|
|
||||||
#
|
|
||||||
# Zero out the BSS segment
|
|
||||||
#
|
|
||||||
zero_bss:
|
|
||||||
cld # make direction flag count up
|
|
||||||
movl $_end,%ecx # find end of .bss
|
|
||||||
movl $_bss_start,%edi # edi = beginning of .bss
|
|
||||||
subl %edi,%ecx # ecx = size of .bss in bytes
|
|
||||||
shrl $2,%ecx # size of .bss in longs
|
|
||||||
xorl %eax,%eax # value to clear out memory
|
|
||||||
repne # while ecx != 0
|
|
||||||
stosl # clear a long in the bss
|
|
||||||
|
|
||||||
#
|
|
||||||
# Set the C heap information for malloc
|
|
||||||
#
|
|
||||||
movl $heap_size,___C_heap_size # set ___C_heap_size
|
|
||||||
movl $heap_memory,___C_heap_start # set ___C_heap_start
|
|
||||||
|
|
||||||
#
|
|
||||||
# Copy the Global Descriptor Table to our space
|
|
||||||
#
|
|
||||||
|
|
||||||
sgdt _Original_GDTR # save original GDT
|
|
||||||
movzwl _Original_GDTR_limit,%ecx # size of GDT in bytes; limit
|
|
||||||
# is 8192 entries * 8 bytes per
|
|
||||||
|
|
||||||
# make ds:esi point to the original GDT
|
|
||||||
|
|
||||||
movl _Original_GDTR_base,%esi
|
|
||||||
push %ds # save ds
|
|
||||||
movw %gs,%ax
|
|
||||||
movw %ax,%ds
|
|
||||||
|
|
||||||
# make es:edi point to the new (our copy) GDT
|
|
||||||
movl $_Global_descriptor_table,%edi
|
|
||||||
|
|
||||||
rep
|
|
||||||
movsb # copy the GDT (ds:esi -> es:edi)
|
|
||||||
|
|
||||||
pop %ds # restore ds
|
|
||||||
|
|
||||||
# Build and load new contents of GDTR
|
|
||||||
movw _Original_GDTR_limit,%ecx # set new limit
|
|
||||||
movw %cx,_New_GDTR_limit
|
|
||||||
|
|
||||||
push $_Global_descriptor_table
|
|
||||||
push %es
|
|
||||||
call _Logical_to_physical
|
|
||||||
addl $6,%esp
|
|
||||||
movl %eax,_New_GDTR_base # set new base
|
|
||||||
|
|
||||||
cmpb $0,_Do_Load_GDT # Should the new GDT be loaded?
|
|
||||||
je no_gdt_load # NO, then branch
|
|
||||||
lgdt _New_GDTR # load the new GDT
|
|
||||||
no_gdt_load:
|
|
||||||
|
|
||||||
#
|
|
||||||
# Copy the Interrupt Descriptor Table to our space
|
|
||||||
#
|
|
||||||
|
|
||||||
sidt _Original_IDTR # save original IDT
|
|
||||||
movzwl _Original_IDTR_limit,%ecx # size of IDT in bytes; limit
|
|
||||||
# is 256 entries * 8 bytes per
|
|
||||||
|
|
||||||
|
|
||||||
# make ds:esi point to the original IDT
|
|
||||||
movl _Original_IDTR_base,%esi
|
|
||||||
|
|
||||||
push %ds # save ds
|
|
||||||
movw %gs,%ax
|
|
||||||
movw %ax,%ds
|
|
||||||
|
|
||||||
# make es:edi point to the new (our copy) IDT
|
|
||||||
movl $_Interrupt_descriptor_table,%edi
|
|
||||||
|
|
||||||
rep
|
|
||||||
movsb # copy the IDT (ds:esi -> es:edi)
|
|
||||||
pop %ds # restore ds
|
|
||||||
|
|
||||||
# Build and load new contents of IDTR
|
|
||||||
movw _Original_IDTR_limit,%ecx # set new limit
|
|
||||||
movw %cx,_New_IDTR_limit
|
|
||||||
|
|
||||||
push $_Interrupt_descriptor_table
|
|
||||||
push %es
|
|
||||||
call _Logical_to_physical
|
|
||||||
addl $6,%esp
|
|
||||||
movl %eax,_New_IDTR_base # set new base
|
|
||||||
|
|
||||||
cmpb $0,_Do_Load_IDT # Should the new IDT be loaded?
|
|
||||||
je no_idt_load # NO, then branch
|
|
||||||
lidt _New_IDTR # load the new IDT
|
|
||||||
no_idt_load:
|
|
||||||
|
|
||||||
#
|
|
||||||
# Initialize the i387.
|
|
||||||
#
|
|
||||||
# Using the NO WAIT form of the instruction insures that if
|
|
||||||
# it is not present the board will not lock up or get an
|
|
||||||
# exception.
|
|
||||||
#
|
|
||||||
|
|
||||||
fninit # MUST USE NO-WAIT FORM
|
|
||||||
|
|
||||||
call __Board_Initialize # initialize the board
|
|
||||||
|
|
||||||
pushl $0 # envp = NULL
|
|
||||||
pushl $0 # argv = NULL
|
|
||||||
pushl $0 # argc = NULL
|
|
||||||
call ___libc_init # initialize the library and
|
|
||||||
# call main
|
|
||||||
addl $12,%esp
|
|
||||||
|
|
||||||
pushl $0 # argc = NULL
|
|
||||||
call __exit # call the Board specific exit
|
|
||||||
addl $4,%esp
|
|
||||||
|
|
||||||
#
|
|
||||||
# Clean up
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
.global _Bsp_cleanup
|
|
||||||
|
|
||||||
.global _return_to_monitor
|
|
||||||
|
|
||||||
_Bsp_cleanup:
|
|
||||||
cmpb $0,_Do_Load_IDT # Was the new IDT loaded?
|
|
||||||
je no_idt_restore # NO, then branch
|
|
||||||
lidt _Original_IDTR # restore the new IDT
|
|
||||||
no_idt_restore:
|
|
||||||
|
|
||||||
cmpb $0,_Do_Load_GDT # Was the new GDT loaded?
|
|
||||||
je no_gdt_restore # NO, then branch
|
|
||||||
lgdt _Original_GDTR # restore the new GDT
|
|
||||||
no_gdt_restore:
|
|
||||||
jmp _return_to_monitor
|
|
||||||
|
|
||||||
#
|
|
||||||
# void *Logical_to_physical(
|
|
||||||
# rtems_unsigned16 segment,
|
|
||||||
# void *address
|
|
||||||
# );
|
|
||||||
#
|
|
||||||
# Returns thirty-two bit physical address for segment:address.
|
|
||||||
#
|
|
||||||
|
|
||||||
.global _Logical_to_physical
|
|
||||||
|
|
||||||
.set SEGMENT_ARG, 4
|
|
||||||
.set ADDRESS_ARG, 8
|
|
||||||
|
|
||||||
_Logical_to_physical:
|
|
||||||
|
|
||||||
xorl %eax,%eax # clear eax
|
|
||||||
movzwl SEGMENT_ARG(%esp),%ecx # ecx = segment value
|
|
||||||
movl $_Global_descriptor_table,%edx # edx = address of our GDT
|
|
||||||
addl %ecx,%edx # edx = address of desired entry
|
|
||||||
movb 7(%edx),%ah # ah = base 31:24
|
|
||||||
movb 4(%edx),%al # al = base 23:16
|
|
||||||
shll $16,%eax # move ax into correct bits
|
|
||||||
movw 2(%edx),%ax # ax = base 0:15
|
|
||||||
movl ADDRESS_ARG(%esp),%ecx # ecx = address to convert
|
|
||||||
addl %eax,%ecx # ecx = physical address equivalent
|
|
||||||
movl %ecx,%eax # eax = ecx
|
|
||||||
ret
|
|
||||||
|
|
||||||
#
|
|
||||||
# void *Physical_to_logical(
|
|
||||||
# rtems_unsigned16 segment,
|
|
||||||
# void *address
|
|
||||||
# );
|
|
||||||
#
|
|
||||||
# Returns thirty-two bit physical address for segment:address.
|
|
||||||
#
|
|
||||||
|
|
||||||
.global _Physical_to_logical
|
|
||||||
|
|
||||||
#.set SEGMENT_ARG, 4
|
|
||||||
#.set ADDRESS_ARG, 8 -- use sets from above
|
|
||||||
|
|
||||||
_Physical_to_logical:
|
|
||||||
|
|
||||||
xorl %eax,%eax # clear eax
|
|
||||||
movzwl SEGMENT_ARG(%esp),%ecx # ecx = segment value
|
|
||||||
movl $_Global_descriptor_table,%edx # edx = address of our GDT
|
|
||||||
addl %ecx,%edx # edx = address of desired entry
|
|
||||||
movb 7(%edx),%ah # ah = base 31:24
|
|
||||||
movb 4(%edx),%al # al = base 23:16
|
|
||||||
shll $16,%eax # move ax into correct bits
|
|
||||||
movw 2(%edx),%ax # ax = base 0:15
|
|
||||||
movl ADDRESS_ARG(%esp),%ecx # ecx = address to convert
|
|
||||||
subl %eax,%ecx # ecx = logical address equivalent
|
|
||||||
movl %ecx,%eax # eax = ecx
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Data Declarations. Start with a macro which helps declare space.
|
|
||||||
*/
|
|
||||||
|
|
||||||
.bss
|
|
||||||
|
|
||||||
#define DECLARE_SPACE(_name,_space,_align) \
|
|
||||||
.globl _name ; \
|
|
||||||
.align _align ; \
|
|
||||||
_name##: .space _space
|
|
||||||
|
|
||||||
#define DECLARE_LABEL(_name) \
|
|
||||||
.globl _name ; \
|
|
||||||
_name##:
|
|
||||||
|
|
||||||
#define DECLARE_PTR(_name) DECLARE_SPACE(_name,4,2)
|
|
||||||
#define DECLARE_U32(_name) DECLARE_SPACE(_name,4,2)
|
|
||||||
#define DECLARE_U16(_name) DECLARE_SPACE(_name,2,1)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Require environment stuff
|
|
||||||
*/
|
|
||||||
|
|
||||||
DECLARE_LABEL(_environ)
|
|
||||||
DECLARE_PTR(environ)
|
|
||||||
|
|
||||||
DECLARE_LABEL(_errno)
|
|
||||||
DECLARE_U32(errno)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Miscellaneous Variables used to restore the CPU state.
|
|
||||||
*
|
|
||||||
* Start with a macro to declare the space for the contents of
|
|
||||||
* a Descriptor Table register.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define DECLARE_DTR_SPACE(_name) \
|
|
||||||
.global _name ; \
|
|
||||||
.align 4 ; \
|
|
||||||
_name##: ; \
|
|
||||||
_name##_limit: .space 2 ; \
|
|
||||||
_name##_base: .space 4
|
|
||||||
|
|
||||||
DECLARE_SPACE(_Interrupt_descriptor_table,256*8,4)
|
|
||||||
DECLARE_SPACE(_Global_descriptor_table,8192*8,4)
|
|
||||||
|
|
||||||
DECLARE_DTR_SPACE(_Original_IDTR)
|
|
||||||
DECLARE_DTR_SPACE(_New_IDTR)
|
|
||||||
DECLARE_DTR_SPACE(_Original_GDTR)
|
|
||||||
DECLARE_DTR_SPACE(_New_GDTR)
|
|
||||||
|
|
||||||
DECLARE_SPACE(_Physical_base_of_ds,4,4)
|
|
||||||
DECLARE_SPACE(_Physical_base_of_cs,4,4)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Stack Size and Space
|
|
||||||
*/
|
|
||||||
|
|
||||||
.set stack_size, 0x20000
|
|
||||||
|
|
||||||
DECLARE_SPACE(stack_memory,stack_size,4)
|
|
||||||
DECLARE_LABEL(stack_end)
|
|
@ -1 +0,0 @@
|
|||||||
i960ca.h
|
|
@ -1,206 +0,0 @@
|
|||||||
/* Copyright (C) 1994, 1996, 1997 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
|
|
||||||
On-Line Applications Research Corporation.
|
|
||||||
|
|
||||||
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. */
|
|
||||||
|
|
||||||
/* i960ca.h
|
|
||||||
*
|
|
||||||
* This file contains macros which are used to access i80960CA
|
|
||||||
* registers which are not addressable by C. The functions
|
|
||||||
* in this file should be useful to the developer of target
|
|
||||||
* specific code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef i960ca_h__
|
|
||||||
#define i960ca_h__
|
|
||||||
|
|
||||||
typedef unsigned char unsigned8;
|
|
||||||
typedef unsigned short unsigned16;
|
|
||||||
typedef unsigned int unsigned32;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Intel i80960CA Processor Control Block
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct i80960ca_prcb {
|
|
||||||
unsigned32 *fault_tbl; /* fault table base address */
|
|
||||||
struct i80960ca_ctltbl
|
|
||||||
*control_tbl; /* control table base address */
|
|
||||||
unsigned32 initial_ac; /* AC register initial value */
|
|
||||||
unsigned32 fault_config; /* fault configuration word */
|
|
||||||
void *intr_tbl; /* interrupt table base address */
|
|
||||||
void *sys_proc_tbl; /* system procedure table */
|
|
||||||
/* base address */
|
|
||||||
unsigned32 reserved; /* reserved */
|
|
||||||
unsigned32 *intr_stack; /* interrupt stack pointer */
|
|
||||||
unsigned32 ins_cache_cfg; /* instruction cache */
|
|
||||||
/* configuration word */
|
|
||||||
unsigned32 reg_cache_cfg; /* register cache */
|
|
||||||
/* configuration word */
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Intel i80960CA Control Table
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct i80960ca_ctltbl {
|
|
||||||
/* Control Group 0 */
|
|
||||||
unsigned32 ipb0; /* IP breakpoint 0 */
|
|
||||||
unsigned32 ipb1; /* IP breakpoint 1 */
|
|
||||||
unsigned32 dab0; /* data address breakpoint 0 */
|
|
||||||
unsigned32 dab1; /* data address breakpoint 1 */
|
|
||||||
/* Control Group 1 */
|
|
||||||
unsigned32 imap0; /* interrupt map 0 */
|
|
||||||
unsigned32 imap1; /* interrupt map 1 */
|
|
||||||
unsigned32 imap2; /* interrupt map 2 */
|
|
||||||
unsigned32 icon; /* interrupt control */
|
|
||||||
/* Control Group 2 */
|
|
||||||
unsigned32 mcon0; /* memory region 0 configuration */
|
|
||||||
unsigned32 mcon1; /* memory region 1 configuration */
|
|
||||||
unsigned32 mcon2; /* memory region 2 configuration */
|
|
||||||
unsigned32 mcon3; /* memory region 3 configuration */
|
|
||||||
/* Control Group 3 */
|
|
||||||
unsigned32 mcon4; /* memory region 4 configuration */
|
|
||||||
unsigned32 mcon5; /* memory region 5 configuration */
|
|
||||||
unsigned32 mcon6; /* memory region 6 configuration */
|
|
||||||
unsigned32 mcon7; /* memory region 7 configuration */
|
|
||||||
/* Control Group 4 */
|
|
||||||
unsigned32 mcon8; /* memory region 8 configuration */
|
|
||||||
unsigned32 mcon9; /* memory region 9 configuration */
|
|
||||||
unsigned32 mcon10; /* memory region 10 configuration */
|
|
||||||
unsigned32 mcon11; /* memory region 11 configuration */
|
|
||||||
/* Control Group 5 */
|
|
||||||
unsigned32 mcon12; /* memory region 12 configuration */
|
|
||||||
unsigned32 mcon13; /* memory region 13 configuration */
|
|
||||||
unsigned32 mcon14; /* memory region 14 configuration */
|
|
||||||
unsigned32 mcon15; /* memory region 15 configuration */
|
|
||||||
/* Control Group 6 */
|
|
||||||
unsigned32 bpcon; /* breakpoint control */
|
|
||||||
unsigned32 tc; /* trace control */
|
|
||||||
unsigned32 bcon; /* bus configuration control */
|
|
||||||
unsigned32 reserved; /* reserved */
|
|
||||||
};
|
|
||||||
|
|
||||||
#define disable_intr( oldlevel ) \
|
|
||||||
{ (oldlevel) = 0x1f0000; \
|
|
||||||
asm volatile ( "modpc 0,%1,%1" \
|
|
||||||
: "=d" ((oldlevel)) \
|
|
||||||
: "0" ((oldlevel)) ); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define enable_intr( oldlevel ) \
|
|
||||||
{ unsigned32 _mask = 0x1f0000; \
|
|
||||||
asm volatile ( "modpc 0,%0,%1" \
|
|
||||||
: "=d" (_mask), "=d" ((oldlevel)) \
|
|
||||||
: "0" (_mask), "1" ((oldlevel)) ); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define flash_intr( oldlevel ) \
|
|
||||||
{ unsigned32 _mask = 0x1f0000; \
|
|
||||||
asm volatile ( "modpc 0,%0,%1 ; \
|
|
||||||
mov %0,%1 ; \
|
|
||||||
modpc 0,%0,%1" \
|
|
||||||
: "=d" (_mask), "=d" ((oldlevel)) \
|
|
||||||
: "0" (_mask), "1" ((oldlevel)) ); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define atomic_modify( mask, addr, prev ) \
|
|
||||||
{ register unsigned32 _mask = (mask); \
|
|
||||||
register unsigned32 *_addr = (unsigned32 *)(addr); \
|
|
||||||
asm volatile( "atmod %0,%1,%1" \
|
|
||||||
: "=d" (_addr), "=d" (_mask) \
|
|
||||||
: "0" (_addr), "1" (_mask) ); \
|
|
||||||
(prev) = _mask; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define delay( microseconds ) \
|
|
||||||
{ register unsigned32 _delay=(microseconds); \
|
|
||||||
register unsigned32 _tmp; \
|
|
||||||
asm volatile( "delay0: \
|
|
||||||
remo 3,31,%0 ; \
|
|
||||||
cmpo 0,%0 ; \
|
|
||||||
subo 1,%1,%1 ; \
|
|
||||||
cmpobne.t 0,%1,delay0 " \
|
|
||||||
: "=d" (_tmp), "=d" (_delay) \
|
|
||||||
: "0" (_tmp), "1" (_delay) ); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define enable_tracing() \
|
|
||||||
{ register unsigned32 _pc = 0x1; \
|
|
||||||
asm volatile( "modpc 0,%0,%0" : "=d" (_pc) : "0" (_pc) ); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define unmask_intr( xint ) \
|
|
||||||
{ register unsigned32 _mask= (1<<(xint)); \
|
|
||||||
asm volatile( "or sf1,%0,sf1" : "=d" (_mask) : "0" (_mask) ); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define mask_intr( xint ) \
|
|
||||||
{ register unsigned32 _mask= (1<<(xint)); \
|
|
||||||
asm volatile( "andnot %0,sf1,sf1" : "=d" (_mask) : "0" (_mask) ); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define clear_intr( xint ) \
|
|
||||||
{ register unsigned32 _xint=(xint); \
|
|
||||||
asm volatile( "loop_til_cleared:" \
|
|
||||||
" clrbit %0,sf0,sf0 ;" \
|
|
||||||
" bbs %0,sf0,loop_til_cleared" \
|
|
||||||
: "=d" (_xint) : "0" (_xint) ); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define reload_ctl_group( group ) \
|
|
||||||
{ register int _cmd = ((group)|0x400) ; \
|
|
||||||
asm volatile( "sysctl %0,%0,%0" : "=d" (_cmd) : "0" (_cmd) ); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define cause_intr( intr ) \
|
|
||||||
{ register int _intr = (intr); \
|
|
||||||
asm volatile( "sysctl %0,%0,%0" : "=d" (_intr) : "0" (_intr) ); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define soft_reset( prcb ) \
|
|
||||||
{ register struct i80960ca_prcb *_prcb = (prcb); \
|
|
||||||
register unsigned32 *_next=0; \
|
|
||||||
register unsigned32 _cmd = 0x30000; \
|
|
||||||
asm volatile( "lda next,%1; \
|
|
||||||
sysctl %0,%1,%2; \
|
|
||||||
next: mov g0,g0" \
|
|
||||||
: "=d" (_cmd), "=d" (_next), "=d" (_prcb) \
|
|
||||||
: "0" (_cmd), "1" (_next), "2" (_prcb) ); \
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned32 pend_intrs()
|
|
||||||
{ register unsigned32 _intr=0;
|
|
||||||
asm volatile( "mov sf0,%0" : "=d" (_intr) : "0" (_intr) );
|
|
||||||
return ( _intr );
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned32 mask_intrs()
|
|
||||||
{ register unsigned32 _intr=0;
|
|
||||||
asm volatile( "mov sf1,%0" : "=d" (_intr) : "0" (_intr) );
|
|
||||||
return( _intr );
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned32 get_fp()
|
|
||||||
{ register unsigned32 _fp=0;
|
|
||||||
asm volatile( "mov fp,%0" : "=d" (_fp) : "0" (_fp) );
|
|
||||||
return ( _fp );
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
/* end of include file */
|
|
@ -1,24 +0,0 @@
|
|||||||
# Copyright (C) 1993, 1997 Free Software Foundation, Inc.
|
|
||||||
# This file is part of the GNU C Library.
|
|
||||||
# Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
|
|
||||||
# On-Line Applications Research Corporation.
|
|
||||||
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
|
|
||||||
# The nindy960 support has only been tested on the following boards:
|
|
||||||
#
|
|
||||||
# + Cyclone CVME961 VMEbus single board computer.
|
|
@ -1,55 +0,0 @@
|
|||||||
/* Copyright (C) 1991, 1997, 1999 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
|
|
||||||
On-Line Applications Research Corporation.
|
|
||||||
|
|
||||||
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. */
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
/* The function `_exit' should take a status argument and simply
|
|
||||||
terminate program execution, using the low-order 8 bits of the
|
|
||||||
given integer as status. */
|
|
||||||
|
|
||||||
/* This returns control to Nindy. */
|
|
||||||
/* XXX where is __NORETURN ? */
|
|
||||||
__NORETURN void
|
|
||||||
_exit (status)
|
|
||||||
int status;
|
|
||||||
{
|
|
||||||
/* status is ignored */
|
|
||||||
|
|
||||||
asm volatile( "mov 0,g0; \
|
|
||||||
fmark ; \
|
|
||||||
syncf ; \
|
|
||||||
.word 0xfeedface ; \
|
|
||||||
bx start" : : );
|
|
||||||
/* The constant 0xfeedface is a magic word for break which
|
|
||||||
* is defined by NINDY. The branch extended restarts the
|
|
||||||
* application if the user types "go".
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
weak_alias (_exit, _Exit)
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_GNU_LD
|
|
||||||
|
|
||||||
#include <gnu-stabs.h>
|
|
||||||
|
|
||||||
stub_warning(_exit);
|
|
||||||
|
|
||||||
#endif /* GNU stabs. */
|
|
@ -1,64 +0,0 @@
|
|||||||
/* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
|
|
||||||
On-Line Applications Research Corporation.
|
|
||||||
|
|
||||||
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. */
|
|
||||||
|
|
||||||
#include <standalone.h>
|
|
||||||
#include "i960ca.h"
|
|
||||||
|
|
||||||
/* _Board_Initialize()
|
|
||||||
|
|
||||||
This routine initializes the board.
|
|
||||||
|
|
||||||
NOTE: Only tested on a Cyclone CVME961 but should be OK on any i960ca board. */
|
|
||||||
|
|
||||||
void
|
|
||||||
_Board_Initialize ()
|
|
||||||
{
|
|
||||||
struct i80960ca_prcb *prcb; /* ptr to processor control block */
|
|
||||||
struct i80960ca_ctltbl *ctl_tbl; /* ptr to control table */
|
|
||||||
|
|
||||||
static inline struct i80960ca_prcb *get_prcb()
|
|
||||||
{ register struct i80960ca_prcb *_prcb = 0;
|
|
||||||
asm volatile( "calls 5; \
|
|
||||||
mov g0,%0" \
|
|
||||||
: "=d" (_prcb) \
|
|
||||||
: "0" (_prcb) );
|
|
||||||
return ( _prcb );
|
|
||||||
}
|
|
||||||
|
|
||||||
prcb = get_prcb ();
|
|
||||||
ctl_tbl = prcb->control_tbl;
|
|
||||||
|
|
||||||
/* The following configures the data breakpoint (which must be set
|
|
||||||
* before this is executed) to break on writes only.
|
|
||||||
*/
|
|
||||||
|
|
||||||
ctl_tbl->bpcon &= ~0x00cc0000;
|
|
||||||
reload_ctl_group (6);
|
|
||||||
|
|
||||||
/* bit 31 of the Register Cache Control can be set to
|
|
||||||
* enable an alternative caching algorithm. It does
|
|
||||||
* not appear to help our applications.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Configure Number of Register Caches */
|
|
||||||
|
|
||||||
prcb->reg_cache_cfg = 8;
|
|
||||||
soft_reset (prcb);
|
|
||||||
}
|
|
@ -1,76 +0,0 @@
|
|||||||
/* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
|
|
||||||
On-Line Applications Research Corporation.
|
|
||||||
|
|
||||||
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. */
|
|
||||||
|
|
||||||
#include <standalone.h>
|
|
||||||
#include "i960ca.h"
|
|
||||||
|
|
||||||
/* Console IO routines for a NINDY960 board. */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* NINDY_IO( ... )
|
|
||||||
*
|
|
||||||
* Interface to NINDY.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define NINDY_INPUT 0
|
|
||||||
#define NINDY_OUTPUT 1
|
|
||||||
|
|
||||||
void ___NINDY_IO_WRAPPER( void ) /* never called */
|
|
||||||
{
|
|
||||||
asm volatile ( " .text" );
|
|
||||||
asm volatile ( " .align 4" );
|
|
||||||
asm volatile ( " .globl _NINDY_IO" );
|
|
||||||
asm volatile ( "_NINDY_IO:" );
|
|
||||||
asm volatile ( " calls 0 /* call console routines */" );
|
|
||||||
asm volatile ( " ret" );
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** !!!! HOW DO I EXFUN NINDY_IO? !!!! *****/
|
|
||||||
|
|
||||||
/* _Console_Putc
|
|
||||||
|
|
||||||
This routine transmits a character using NINDY. */
|
|
||||||
|
|
||||||
int
|
|
||||||
_Console_Putc (ch)
|
|
||||||
char ch;
|
|
||||||
{
|
|
||||||
NINDY_IO( NINDY_OUTPUT, ch );
|
|
||||||
return( 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* _Console_Getc
|
|
||||||
|
|
||||||
This routine reads a character from NINDY and returns it. */
|
|
||||||
|
|
||||||
int
|
|
||||||
_Console_Getc (poll)
|
|
||||||
int poll;
|
|
||||||
{
|
|
||||||
char ch;
|
|
||||||
|
|
||||||
if ( poll ) {
|
|
||||||
/* I don't know how to poll with NINDY */
|
|
||||||
return -1;
|
|
||||||
} else {
|
|
||||||
NINDY_IO( NINDY_INPUT, &ch );
|
|
||||||
return ch;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,152 +0,0 @@
|
|||||||
/* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
|
|
||||||
Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
|
|
||||||
On-Line Applications Research Corporation.
|
|
||||||
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.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU Lesser General Public
|
|
||||||
License, the Free Software Foundation gives you unlimited
|
|
||||||
permission to link the compiled version of this file with other
|
|
||||||
programs, and to distribute those programs without any restriction
|
|
||||||
coming from the use of this file. (The GNU Lesser General Public
|
|
||||||
License restrictions do apply in other respects; for example, they
|
|
||||||
cover modification of the file, and distribution when not linked
|
|
||||||
into another program.)
|
|
||||||
|
|
||||||
Note that people who make modified versions of this file are not
|
|
||||||
obligated to grant this special exception for their modified
|
|
||||||
versions; it is their choice whether to do so. The GNU Lesser
|
|
||||||
General Public License gives permission to release a modified
|
|
||||||
version without this exception; this exception also makes it
|
|
||||||
possible to release a modified version which carries forward this
|
|
||||||
exception.
|
|
||||||
|
|
||||||
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. */
|
|
||||||
|
|
||||||
/* entry.s
|
|
||||||
*
|
|
||||||
* This file contains the entry point for the application.
|
|
||||||
* The name of this entry point is compiler dependent.
|
|
||||||
* It jumps to the BSP which is responsible for performing
|
|
||||||
* all initialization.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
.text
|
|
||||||
.globl start # GNU960 default entry point
|
|
||||||
|
|
||||||
start:
|
|
||||||
mov 3, r12
|
|
||||||
modpc r12, r12, r12 # enable tracing/trace faults
|
|
||||||
mov g5, g5 # NOP
|
|
||||||
mov 0, g14 # initialize constant for C
|
|
||||||
|
|
||||||
/*
|
|
||||||
* zero out uninitialized data area
|
|
||||||
*/
|
|
||||||
zerobss:
|
|
||||||
lda _end, r4 /* find end of .bss */
|
|
||||||
lda _bss_start, r5 /* find beginning of .bss */
|
|
||||||
ldconst 0, r6
|
|
||||||
|
|
||||||
loop: st r6, (r5) /* to zero out uninitialized */
|
|
||||||
addo 4, r5, r5 /* data area */
|
|
||||||
cmpobl r5, r4, loop /* loop until _end reached */
|
|
||||||
|
|
||||||
|
|
||||||
lda heap_memory, r12 /* tell C lib where heap is */
|
|
||||||
st r12,___C_heap_start
|
|
||||||
lda heap_size, r12 /* tell C lib how big heap is */
|
|
||||||
st r12,___C_heap_size
|
|
||||||
lda stack_memory,r12 /* set up stack pointer: */
|
|
||||||
mov r12, sp
|
|
||||||
mov 0, g14 /* initialize constant for C */
|
|
||||||
|
|
||||||
call init_frames
|
|
||||||
ret /* return to monitor */
|
|
||||||
|
|
||||||
init_frames:
|
|
||||||
ldconst 0x3b001000, g0
|
|
||||||
ldconst 0x00009107, g1
|
|
||||||
modac g1, g0, g0 /* set AC controls */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Call application mainline.
|
|
||||||
* Someday, real values of argc and argv will be set up.
|
|
||||||
* For now, they are set to 0.
|
|
||||||
*/
|
|
||||||
|
|
||||||
callx __Board_Initialize /* Initialize the board */
|
|
||||||
|
|
||||||
ldconst 0,g0
|
|
||||||
ldconst 0,g1
|
|
||||||
ldconst 0,g2
|
|
||||||
callx ___libc_init /* initialize the library and */
|
|
||||||
/* call main */
|
|
||||||
/*
|
|
||||||
* if we return from main, we have "fallen" off the end
|
|
||||||
* of the program, therefore status is 0
|
|
||||||
* so move 0 to g0 (exit parameter)
|
|
||||||
*/
|
|
||||||
|
|
||||||
mov 0, g0
|
|
||||||
callx __exit
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Data Declarations. Start with a macro which helps declare space.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define DECLARE_SPACE(_name,_space,_align) \
|
|
||||||
.globl _name ; \
|
|
||||||
.align _align ; \
|
|
||||||
.comm _name##,_space
|
|
||||||
|
|
||||||
#define DECLARE_LABEL(_name) \
|
|
||||||
.globl _name ; \
|
|
||||||
_name##:
|
|
||||||
|
|
||||||
#define DECLARE_PTR(_name) DECLARE_SPACE(_name,4,2)
|
|
||||||
#define DECLARE_U32(_name) DECLARE_SPACE(_name,4,2)
|
|
||||||
#define DECLARE_U16(_name) DECLARE_SPACE(_name,2,1)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Require environment stuff
|
|
||||||
*/
|
|
||||||
|
|
||||||
DECLARE_LABEL(_environ)
|
|
||||||
DECLARE_PTR(environ)
|
|
||||||
|
|
||||||
DECLARE_LABEL(_errno)
|
|
||||||
DECLARE_U32(errno)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Stack Size and Space
|
|
||||||
*/
|
|
||||||
|
|
||||||
.set stack_size, 0x20000
|
|
||||||
|
|
||||||
DECLARE_SPACE(stack_memory,stack_size,4)
|
|
||||||
DECLARE_LABEL(stack_end)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Heap Size and Space
|
|
||||||
*/
|
|
||||||
|
|
||||||
.set heap_size, 0x20000
|
|
||||||
|
|
||||||
DECLARE_SPACE(heap_memory,heap_size,4)
|
|
||||||
DECLARE_LABEL(heap_end)
|
|
@ -1 +0,0 @@
|
|||||||
m68020.h
|
|
@ -1,87 +0,0 @@
|
|||||||
/* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
|
|
||||||
Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
|
|
||||||
On-Line Applications Research Corporation.
|
|
||||||
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. */
|
|
||||||
|
|
||||||
/* m68020.h
|
|
||||||
*
|
|
||||||
* This file contains macros which are used to access MC68020
|
|
||||||
* registers which are not addressable by C. These are
|
|
||||||
* useful when developing the board specific support.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef m68020_h__
|
|
||||||
#define m68020_h__
|
|
||||||
|
|
||||||
typedef void ( *mc68020_isr )( void );
|
|
||||||
|
|
||||||
#define disable_intr( level ) \
|
|
||||||
{ (level) = 0; \
|
|
||||||
asm volatile ( "movew %%sr,%0 ; \
|
|
||||||
orw #0x0700,%%sr" \
|
|
||||||
: "=d" ((level)) : "0" ((level)) ); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define enable_intr( level ) \
|
|
||||||
{ asm volatile ( "movew %0,%%sr " \
|
|
||||||
: "=d" ((level)) : "0" ((level)) ); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define flash_intr( level ) \
|
|
||||||
{ asm volatile ( "movew %0,%%sr ; \
|
|
||||||
orw #0x0700,%%sr" \
|
|
||||||
: "=d" ((level)) : "0" ((level)) ); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define get_vbr( vbr ) \
|
|
||||||
{ (vbr) = 0; \
|
|
||||||
asm volatile ( "movec %%vbr,%0 " \
|
|
||||||
: "=a" (vbr) : "0" (vbr) ); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define set_vbr( vbr ) \
|
|
||||||
{ register mc68020_isr *_vbr= (mc68020_isr *)(vbr); \
|
|
||||||
asm volatile ( "movec %0,%%vbr " \
|
|
||||||
: "=a" (_vbr) : "0" (_vbr) ); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define enable_caching() \
|
|
||||||
{ register unsigned int _ctl=0x01; \
|
|
||||||
asm volatile ( "movec %0,%%cacr" \
|
|
||||||
: "=d" (_ctl) : "0" (_ctl) ); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define delay( microseconds ) \
|
|
||||||
{ register unsigned int _delay=(microseconds); \
|
|
||||||
register unsigned int _tmp=123; \
|
|
||||||
asm volatile( "0: \
|
|
||||||
nbcd %0 ; \
|
|
||||||
nbcd %0 ; \
|
|
||||||
dbf %1,0 " \
|
|
||||||
: "=d" (_tmp), "=d" (_delay) \
|
|
||||||
: "0" (_tmp), "1" (_delay) ); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define enable_tracing()
|
|
||||||
#define cause_intr( X )
|
|
||||||
#define clear_intr( X )
|
|
||||||
|
|
||||||
extern mc68020_isr M68Kvec[]; /* vector table address */
|
|
||||||
|
|
||||||
#endif
|
|
||||||
/* end of include file */
|
|
@ -1,2 +0,0 @@
|
|||||||
# Motorola MVME135 and MVME136 are compatible.
|
|
||||||
standalone/m68k/m68020/mvme136
|
|
@ -1 +0,0 @@
|
|||||||
mvme136.ld
|
|
@ -1,23 +0,0 @@
|
|||||||
# Copyright (C) 1993, 1997 Free Software Foundation, Inc.
|
|
||||||
# This file is part of the GNU C Library.
|
|
||||||
# Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
|
|
||||||
# On-Line Applications Research Corporation.
|
|
||||||
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
ifeq (bare,$(subdir))
|
|
||||||
install-lib += mvme136.ld
|
|
||||||
endif
|
|
@ -1,50 +0,0 @@
|
|||||||
/* Copyright (C) 1994, 1997, 1999 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
|
|
||||||
On-Line Applications Research Corporation.
|
|
||||||
|
|
||||||
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. */
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include "m68020.h"
|
|
||||||
|
|
||||||
/* Return control to 135Bug */
|
|
||||||
|
|
||||||
void
|
|
||||||
__exit_trap ()
|
|
||||||
{
|
|
||||||
set_vbr( 0 ); /* restore 135Bug vectors */
|
|
||||||
asm volatile( "trap #15" ); /* trap to 135Bug */
|
|
||||||
asm volatile( ".short 0x63" ); /* return to 135Bug (.RETURN) */
|
|
||||||
asm volatile( "jmp main" ); /* restart program */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The function `_exit' should take a status argument and simply
|
|
||||||
terminate program execution, using the low-order 8 bits of the
|
|
||||||
given integer as status. */
|
|
||||||
|
|
||||||
void
|
|
||||||
__attribute__ ((noreturn))
|
|
||||||
_exit (status)
|
|
||||||
int status;
|
|
||||||
{
|
|
||||||
/* status is ignored */
|
|
||||||
|
|
||||||
M68Kvec[ 45 ] = __exit_trap; /* install exit_trap handler */
|
|
||||||
asm volatile( "trap #13" ); /* insures SUPV mode */
|
|
||||||
}
|
|
||||||
weak_alias (_exit, _Exit)
|
|
@ -1,51 +0,0 @@
|
|||||||
/* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
|
|
||||||
On-Line Applications Research Corporation.
|
|
||||||
|
|
||||||
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. */
|
|
||||||
|
|
||||||
#include <standalone.h>
|
|
||||||
#include "m68020.h"
|
|
||||||
|
|
||||||
/* _Board_Initialize()
|
|
||||||
|
|
||||||
This routine initializes the Motorola MVME135/MVME136. */
|
|
||||||
|
|
||||||
void
|
|
||||||
_Board_Initialize ()
|
|
||||||
{
|
|
||||||
mc68020_isr *monitors_vector_table;
|
|
||||||
int index;
|
|
||||||
|
|
||||||
monitors_vector_table = (mc68020_isr *)0; /* 135Bug Vectors are at 0 */
|
|
||||||
set_vbr( monitors_vector_table );
|
|
||||||
|
|
||||||
for ( index=2 ; index<=255 ; index++ )
|
|
||||||
M68Kvec[ index ] = monitors_vector_table[ 32 ];
|
|
||||||
|
|
||||||
M68Kvec[ 2 ] = monitors_vector_table[ 2 ]; /* bus error vector */
|
|
||||||
M68Kvec[ 4 ] = monitors_vector_table[ 4 ]; /* breakpoints vector */
|
|
||||||
M68Kvec[ 9 ] = monitors_vector_table[ 9 ]; /* trace vector */
|
|
||||||
M68Kvec[ 47 ] = monitors_vector_table[ 47 ]; /* system call vector */
|
|
||||||
|
|
||||||
set_vbr( &M68Kvec );
|
|
||||||
|
|
||||||
(*(unsigned char *)0xfffb0067) = 0x7f; /* make VME access round-robin */
|
|
||||||
|
|
||||||
enable_caching ();
|
|
||||||
|
|
||||||
}
|
|
@ -1,101 +0,0 @@
|
|||||||
/* Copyright (C) 1994, 1996 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
|
|
||||||
On-Line Applications Research Corporation.
|
|
||||||
|
|
||||||
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. */
|
|
||||||
|
|
||||||
#include <standalone.h>
|
|
||||||
#include "m68020.h"
|
|
||||||
|
|
||||||
/* Console IO routines for a Motorola MVME135/MVME136 board.
|
|
||||||
|
|
||||||
They currently use the B port. It should be possible to
|
|
||||||
use the A port by filling in the reset of the chip structure,
|
|
||||||
adding an ifdef for PORTA/PORTB, and switching the addresses,
|
|
||||||
and maybe the macros based on the macro. */
|
|
||||||
|
|
||||||
/* M68681 DUART chip register structures and constants */
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
volatile unsigned char fill1[ 5 ]; /* channel A regs ( not used ) */
|
|
||||||
volatile unsigned char isr; /* interrupt status reg */
|
|
||||||
volatile unsigned char fill2[ 2 ]; /* counter regs (not used) */
|
|
||||||
volatile unsigned char mr1mr2b; /* MR1B and MR2B regs */
|
|
||||||
volatile unsigned char srb; /* status reg channel B */
|
|
||||||
volatile unsigned char fill3; /* do not access */
|
|
||||||
volatile unsigned char rbb; /* receive buffer channel B */
|
|
||||||
volatile unsigned char ivr; /* interrupt vector register */
|
|
||||||
} r_m681_info;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
volatile unsigned char fill1[ 4 ]; /* channel A regs (not used) */
|
|
||||||
volatile unsigned char acr; /* auxillary control reg */
|
|
||||||
volatile unsigned char imr; /* interrupt mask reg */
|
|
||||||
volatile unsigned char fill2[ 2 ]; /* counter regs (not used) */
|
|
||||||
volatile unsigned char mr1mr2b; /* MR1B and MR2B regs */
|
|
||||||
volatile unsigned char csrb; /* clock select reg */
|
|
||||||
volatile unsigned char crb; /* command reg */
|
|
||||||
volatile unsigned char tbb; /* transmit buffer channel B */
|
|
||||||
volatile unsigned char ivr; /* interrupt vector register */
|
|
||||||
} w_m681_info;
|
|
||||||
|
|
||||||
#define RD_M68681 ((r_m681_info *)0xfffb0040) /* ptr to the M68681 */
|
|
||||||
#define WR_M68681 ((w_m681_info *)0xfffb0040) /* ptr to the M68681 */
|
|
||||||
#define RXRDYB 0x01 /* status reg recv ready mask */
|
|
||||||
#define TXRDYB 0x04 /* status reg trans ready mask */
|
|
||||||
|
|
||||||
/* _Console_Putc
|
|
||||||
|
|
||||||
This routine transmits a character out the M68681. It supports
|
|
||||||
XON/XOFF flow control. */
|
|
||||||
|
|
||||||
#define XON 0x11 /* control-Q */
|
|
||||||
#define XOFF 0x13 /* control-S */
|
|
||||||
|
|
||||||
int
|
|
||||||
_Console_Putc (ch)
|
|
||||||
char ch;
|
|
||||||
{
|
|
||||||
while ( ! (RD_M68681->srb & TXRDYB) ) ;
|
|
||||||
while ( RD_M68681->srb & RXRDYB ) /* must be an XOFF */
|
|
||||||
if ( RD_M68681->rbb == XOFF )
|
|
||||||
do {
|
|
||||||
while ( ! (RD_M68681->srb & RXRDYB) ) ;
|
|
||||||
} while ( RD_M68681->rbb != XON );
|
|
||||||
|
|
||||||
WR_M68681->tbb = ch;
|
|
||||||
return( 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* _Console_Getc
|
|
||||||
|
|
||||||
This routine reads a character from the UART and returns it. */
|
|
||||||
|
|
||||||
int
|
|
||||||
_Console_Getc (poll)
|
|
||||||
int poll;
|
|
||||||
{
|
|
||||||
if ( poll ) {
|
|
||||||
if ( !(RD_M68681->srb & RXRDYB) )
|
|
||||||
return -1;
|
|
||||||
else
|
|
||||||
return RD_M68681->rbb;
|
|
||||||
} else {
|
|
||||||
while ( !(RD_M68681->srb & RXRDYB) );
|
|
||||||
return RD_M68681->rbb;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,61 +0,0 @@
|
|||||||
/* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
|
|
||||||
Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
|
|
||||||
On-Line Applications Research Corporation.
|
|
||||||
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. */
|
|
||||||
|
|
||||||
/* This file contains directives for the GNU linker which are specific
|
|
||||||
to the Motorola MVME136/MVME135 boards. */
|
|
||||||
|
|
||||||
MEMORY
|
|
||||||
{
|
|
||||||
ram : org = 0x3000, l = 1M
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This value is also when the space is allocated. If you change
|
|
||||||
this one, change the other one!!! */
|
|
||||||
|
|
||||||
heap_size = 0x20000;
|
|
||||||
|
|
||||||
SECTIONS
|
|
||||||
{
|
|
||||||
.text 0x3000 :
|
|
||||||
{
|
|
||||||
text_start = ABSOLUTE(.) ;
|
|
||||||
*(.text)
|
|
||||||
etext = ALIGN( 0x10 ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
.data ADDR( .text ) + SIZEOF( .text ):
|
|
||||||
{
|
|
||||||
data_start = . ;
|
|
||||||
*(.data)
|
|
||||||
edata = ALIGN( 0x10 ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bss ADDR( .data ) + SIZEOF( .data ):
|
|
||||||
{
|
|
||||||
bss_start = . ;
|
|
||||||
_bss_start = . ;
|
|
||||||
*(.bss)
|
|
||||||
*(COMMON)
|
|
||||||
heap_memory = .;
|
|
||||||
. += 0x20000;
|
|
||||||
end = . ;
|
|
||||||
_end = . ;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,172 +0,0 @@
|
|||||||
/* Copyright (C) 1994, 1996, 1997 Free Software Foundation, Inc.
|
|
||||||
Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
|
|
||||||
On-Line Applications Research Corporation.
|
|
||||||
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.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU Lesser General Public
|
|
||||||
License, the Free Software Foundation gives you unlimited
|
|
||||||
permission to link the compiled version of this file with other
|
|
||||||
programs, and to distribute those programs without any restriction
|
|
||||||
coming from the use of this file. (The GNU Lesser General Public
|
|
||||||
License restrictions do apply in other respects; for example, they
|
|
||||||
cover modification of the file, and distribution when not linked
|
|
||||||
into another program.)
|
|
||||||
|
|
||||||
Note that people who make modified versions of this file are not
|
|
||||||
obligated to grant this special exception for their modified
|
|
||||||
versions; it is their choice whether to do so. The GNU Lesser
|
|
||||||
General Public License gives permission to release a modified
|
|
||||||
version without this exception; this exception also makes it
|
|
||||||
possible to release a modified version which carries forward this
|
|
||||||
exception.
|
|
||||||
|
|
||||||
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. */
|
|
||||||
|
|
||||||
/* entry.s
|
|
||||||
*
|
|
||||||
* This file contains the entry point for the application.
|
|
||||||
* The name of this entry point is compiler dependent.
|
|
||||||
* It jumps to the BSP which is responsible for performing
|
|
||||||
* all initialization.
|
|
||||||
*/
|
|
||||||
|
|
||||||
.text
|
|
||||||
.globl start | Default entry point
|
|
||||||
.globl _start | Default entry point
|
|
||||||
.globl M68Kvec | Vector Table
|
|
||||||
.globl _M68Kvec | Vector Table
|
|
||||||
|
|
||||||
start:
|
|
||||||
_start:
|
|
||||||
M68Kvec: | standard location for vectors
|
|
||||||
_M68Kvec: | standard location for vectors
|
|
||||||
nop | for linkers with problem
|
|
||||||
| using location zero as entry
|
|
||||||
jmp around
|
|
||||||
.space 4088 | to avoid initial intr stack
|
|
||||||
| from 135BUG on MVME13? as entry
|
|
||||||
| and start code at 0x4000
|
|
||||||
around:
|
|
||||||
move.w %sr,initial_sr | save initial values
|
|
||||||
movec %isp,%a0
|
|
||||||
movel %a0,initial_isp
|
|
||||||
movec %usp,%a0
|
|
||||||
movel %a0,initial_usp
|
|
||||||
movec %msp,%a0
|
|
||||||
movel %a0,initial_msp
|
|
||||||
oriw #0x0700,%sr | INTERRUPTS OFF!!!
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
| zero out uninitialized data area
|
|
||||||
|
|
|
||||||
zerobss:
|
|
||||||
moveal #end,%a0 | find end of .bss
|
|
||||||
moveal #_bss_start,%a1 | find beginning of .bss
|
|
||||||
movel #0,%d0
|
|
||||||
|
|
||||||
loop: movel #0,%a1@+ | to zero out uninitialized
|
|
||||||
cmpal %a0,%a1
|
|
||||||
jlt loop | loop until _end reached
|
|
||||||
|
|
||||||
movel #heap_size,__C_heap_size | set ___C_heap_size
|
|
||||||
movel #heap_memory,__C_heap_start | set ___C_heap_start
|
|
||||||
moveal #interrupt_stack_end,%a0 | set interrupt stack pointer
|
|
||||||
movec %a0,%isp
|
|
||||||
moveal #stack_end,%a0 | set master stack pointer
|
|
||||||
movec %a0,%msp
|
|
||||||
moveal #stack_end,%a6 | set base pointer
|
|
||||||
movw #0x3000,%sr | SUPV MODE,INTERRUPTS ON!!!
|
|
||||||
|
|
||||||
#ifdef NEED_UNDERSCORES
|
|
||||||
jsr __Board_Initialize | initialize the board
|
|
||||||
#else
|
|
||||||
jsr _Board_Initialize | initialize the board
|
|
||||||
#endif
|
|
||||||
|
|
||||||
move.l #0,%sp@- | envp = NULL
|
|
||||||
move.l #0,%sp@- | argv = NULL
|
|
||||||
move.l #0,%sp@- | argc = NULL
|
|
||||||
#ifdef NEED_UNDERSCORES
|
|
||||||
jsr ___libc_init | initialize the library and
|
|
||||||
| call main
|
|
||||||
#else
|
|
||||||
jsr __libc_init | initialize the library and
|
|
||||||
| call main
|
|
||||||
#endif
|
|
||||||
add.l #12,%sp
|
|
||||||
|
|
||||||
move.l #0,%sp@- | argc = NULL
|
|
||||||
jsr __exit | call the Board specific exit
|
|
||||||
addq.l #4,%sp
|
|
||||||
|
|
||||||
move.l initial_isp,%a0 | if __exit returns then we can
|
|
||||||
movec %a0,%isp | restore the initial values
|
|
||||||
move.l initial_usp,%a0
|
|
||||||
movec %a0,%usp
|
|
||||||
move.l initial_msp,%a0
|
|
||||||
movec %a0,%msp
|
|
||||||
move.w initial_sr,%sr
|
|
||||||
rts
|
|
||||||
|
|
||||||
|
|
||||||
.bss
|
|
||||||
|
|
||||||
/*
|
|
||||||
* So initial stack registers and status register can be saved.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define DECLARE_SPACE(_name,_space,_align) \
|
|
||||||
.globl _name ; \
|
|
||||||
.align _align ; \
|
|
||||||
_name##: .space _space
|
|
||||||
|
|
||||||
#define DECLARE_LABEL(_name) \
|
|
||||||
.globl _name ; \
|
|
||||||
_name##:
|
|
||||||
|
|
||||||
#define DECLARE_PTR(_name) DECLARE_SPACE(_name,4,2)
|
|
||||||
#define DECLARE_U32(_name) DECLARE_SPACE(_name,4,2)
|
|
||||||
#define DECLARE_U16(_name) DECLARE_SPACE(_name,2,1)
|
|
||||||
|
|
||||||
DECLARE_U32(initial_isp)
|
|
||||||
DECLARE_U32(initial_msp)
|
|
||||||
DECLARE_U32(initial_usp)
|
|
||||||
DECLARE_U16(initial_sr)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Require environment stuff
|
|
||||||
*/
|
|
||||||
|
|
||||||
DECLARE_LABEL(_environ)
|
|
||||||
DECLARE_PTR(environ)
|
|
||||||
|
|
||||||
DECLARE_LABEL(__errno)
|
|
||||||
DECLARE_LABEL(_errno)
|
|
||||||
DECLARE_U32(errno)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Stack Size and Space
|
|
||||||
*/
|
|
||||||
|
|
||||||
.set stack_size, 0x20000
|
|
||||||
|
|
||||||
DECLARE_SPACE(stack_memory,stack_size,4)
|
|
||||||
DECLARE_LABEL(stack_end)
|
|
||||||
|
|
||||||
DECLARE_SPACE(interrupt_stack_memory,0x1000,4)
|
|
||||||
DECLARE_LABEL(interrupt_stack_end)
|
|
@ -1,125 +0,0 @@
|
|||||||
/* Copyright (C) 1994, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
|
|
||||||
Ported to standalone by Joel Sherrill jsherril@redstone-emh2.army.mil,
|
|
||||||
On-Line Applications Research Corporation.
|
|
||||||
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. */
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <bits/stdio_lim.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#define __DECLARE_FILE_DESCRIPTORS__
|
|
||||||
|
|
||||||
#include "filedesc.h"
|
|
||||||
|
|
||||||
/* Open FILE with access OFLAG. If OFLAG includes O_CREAT,
|
|
||||||
a third argument is the file protection. */
|
|
||||||
int
|
|
||||||
__open (file, oflag)
|
|
||||||
const char *file;
|
|
||||||
int oflag;
|
|
||||||
{
|
|
||||||
int mode;
|
|
||||||
int newfd;
|
|
||||||
int index;
|
|
||||||
|
|
||||||
if (file == NULL)
|
|
||||||
{
|
|
||||||
__set_errno (EINVAL);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (oflag & O_CREAT)
|
|
||||||
{
|
|
||||||
va_list arg;
|
|
||||||
va_start(arg, oflag);
|
|
||||||
mode = va_arg(arg, int);
|
|
||||||
va_end(arg);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Find an open slot.
|
|
||||||
*/
|
|
||||||
|
|
||||||
newfd = -1;
|
|
||||||
|
|
||||||
for ( index=0 ; index< FOPEN_MAX ; index++ )
|
|
||||||
if ( !__FD_Table[ index ].in_use ) {
|
|
||||||
newfd = index;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( newfd == -1 ) {
|
|
||||||
__set_errno (ENFILE);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Initialize the open slot
|
|
||||||
*/
|
|
||||||
|
|
||||||
__FD_Table[ newfd ].in_use = 1;
|
|
||||||
__FD_Table[ newfd ].flags = oflag;
|
|
||||||
|
|
||||||
return newfd;
|
|
||||||
}
|
|
||||||
libc_hidden_def (__open)
|
|
||||||
|
|
||||||
/* Initialization Code for Console I/O */
|
|
||||||
|
|
||||||
#ifdef HAVE_GNU_LD
|
|
||||||
static
|
|
||||||
#endif
|
|
||||||
void
|
|
||||||
__NONE_init_console_io (argc, argv, envp)
|
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
char **envp;
|
|
||||||
{
|
|
||||||
int index;
|
|
||||||
|
|
||||||
for ( index=0 ; index< FOPEN_MAX ; index++ )
|
|
||||||
__FD_Table[ index ].in_use = 0;
|
|
||||||
|
|
||||||
stdin = fopen( "", "r" );
|
|
||||||
|
|
||||||
stdout = fopen( "", "w" );
|
|
||||||
|
|
||||||
stderr = fopen( "", "w" );
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Line buffer the standard input and output and use no buffering for
|
|
||||||
* standard error.
|
|
||||||
*/
|
|
||||||
|
|
||||||
setvbuf( stdin, NULL, _IOLBF, BUFSIZ );
|
|
||||||
setvbuf( stdout, NULL, _IOLBF, BUFSIZ );
|
|
||||||
setvbuf( stderr, NULL, _IONBF, BUFSIZ );
|
|
||||||
|
|
||||||
(void) &__NONE_init_console_io; /* Avoid "defined but not used" warning. */
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_GNU_LD
|
|
||||||
text_set_element (__libc_subinit, __NONE_init_console_io);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
weak_alias (__open, open)
|
|
@ -1,86 +0,0 @@
|
|||||||
/* Copyright (C) 1994, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
|
|
||||||
Ported to standalone by Joel Sherrill jsherril@redstone-emh2.army.mil,
|
|
||||||
On-Line Applications Research Corporation.
|
|
||||||
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. */
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
#include "filedesc.h"
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <standalone.h>
|
|
||||||
|
|
||||||
/* Read NBYTES into BUF from FD. Return the number read or -1. */
|
|
||||||
ssize_t
|
|
||||||
__libc_read (int fd, void *buf, size_t nbytes)
|
|
||||||
{
|
|
||||||
char *buffer = (char *) buf;
|
|
||||||
int data;
|
|
||||||
int poll;
|
|
||||||
|
|
||||||
__set_errno (0);
|
|
||||||
|
|
||||||
if (nbytes == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if ( !__FD_Is_valid( fd ) || !__FD_Table[ fd ].in_use )
|
|
||||||
{
|
|
||||||
__set_errno (EBADF);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (buf == NULL)
|
|
||||||
{
|
|
||||||
__set_errno (EINVAL);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( __FD_Table[ fd ].flags & O_WRONLY ) /* is it write only? */
|
|
||||||
{
|
|
||||||
__set_errno (EBADF);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If this is a non-blocking fd, then we want to poll the console. */
|
|
||||||
|
|
||||||
poll = ( __FD_Table[ fd ].flags & O_NONBLOCK ) ? 1 : 0;
|
|
||||||
|
|
||||||
/* Read a single character. This is a cheap way to insure that the
|
|
||||||
upper layers get every character because _Console_Getc can't timeout
|
|
||||||
or otherwise know when to stop. */
|
|
||||||
|
|
||||||
|
|
||||||
data = _Console_Getc(poll);
|
|
||||||
|
|
||||||
if ( data == -1 ) /* if no data return */
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
(void) _Console_Putc(data); /* echo the character */
|
|
||||||
|
|
||||||
if ( data == '\r' ) { /* translate CR -> CR/LF */
|
|
||||||
(void) _Console_Putc('\n');
|
|
||||||
data = '\n';
|
|
||||||
}
|
|
||||||
|
|
||||||
*buffer = data;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
libc_hidden_def (__libc_read)
|
|
||||||
weak_alias (__libc_read, __read)
|
|
||||||
libc_hidden_weak (__read)
|
|
||||||
weak_alias (__libc_read, read)
|
|
@ -1,31 +0,0 @@
|
|||||||
/* Copyright (C) 1994, 1997, 2004 Free Software Foundation, Inc.
|
|
||||||
Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
|
|
||||||
On-Line Applications Research Corporation.
|
|
||||||
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. */
|
|
||||||
|
|
||||||
#ifndef _STANDALONE_H
|
|
||||||
#define _STANDALONE_H
|
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
|
||||||
|
|
||||||
extern void _Board_Initialize (void);
|
|
||||||
|
|
||||||
extern int _Console_Putc (char c);
|
|
||||||
extern int _Console_Getc (int poll);
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,73 +0,0 @@
|
|||||||
/* Copyright (C) 1994, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
|
|
||||||
Ported to standalone by Joel Sherrill jsherril@redstone-emh2.army.mil,
|
|
||||||
On-Line Applications Research Corporation.
|
|
||||||
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. */
|
|
||||||
|
|
||||||
#include <sysdep.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
#include "filedesc.h"
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <standalone.h>
|
|
||||||
|
|
||||||
/* Write NBYTES of BUF to FD. Return the number written, or -1. */
|
|
||||||
ssize_t
|
|
||||||
__libc_write (int fd, const void *buf, size_t nbytes)
|
|
||||||
{
|
|
||||||
int count;
|
|
||||||
const char *data = buf;
|
|
||||||
|
|
||||||
if (nbytes == 0)
|
|
||||||
return 0;
|
|
||||||
if ( !__FD_Is_valid( fd ) || !__FD_Table[ fd ].in_use )
|
|
||||||
{
|
|
||||||
__set_errno (EBADF);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (buf == NULL)
|
|
||||||
{
|
|
||||||
__set_errno (EINVAL);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !(__FD_Table[ fd ].flags & (O_WRONLY|O_RDWR)) ) /* is it writeable? */
|
|
||||||
{
|
|
||||||
__set_errno (EBADF);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* All open file descriptors are mapped to the console.
|
|
||||||
*/
|
|
||||||
|
|
||||||
for ( count=0 ; count != nbytes ; count++ ) {
|
|
||||||
if ( _Console_Putc(data[ count ]) == -1 )
|
|
||||||
return -1;
|
|
||||||
if ( data[count] == '\n' && _Console_Putc('\r') == -1 )
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
libc_hidden_def (__libc_write)
|
|
||||||
weak_alias (__libc_write, __write)
|
|
||||||
libc_hidden_weak (__write)
|
|
||||||
weak_alias (__libc_write, write)
|
|
@ -1,5 +0,0 @@
|
|||||||
clone.S
|
|
||||||
setresuid.c
|
|
||||||
setresgid.c
|
|
||||||
setfsuid.c
|
|
||||||
setfsgid.c
|
|
@ -1,106 +0,0 @@
|
|||||||
/* This file is needed by libio to define various configuration parameters.
|
|
||||||
These are always the same in the GNU C library. */
|
|
||||||
|
|
||||||
/* We have to keep a separate copy for CRIS, because we don't use thunks,
|
|
||||||
and libstdc++-v2 (which we currently use) cares. The C++ ABI is
|
|
||||||
changed totally with GCC 3.0, where we should not need a separate file. */
|
|
||||||
|
|
||||||
#ifndef _G_config_h
|
|
||||||
#define _G_config_h 1
|
|
||||||
|
|
||||||
/* Define types for libio in terms of the standard internal type names. */
|
|
||||||
|
|
||||||
#include <bits/types.h>
|
|
||||||
#define __need_size_t
|
|
||||||
#define __need_wchar_t
|
|
||||||
#define __need_wint_t
|
|
||||||
#define __need_NULL
|
|
||||||
#include <stddef.h>
|
|
||||||
#ifndef _WINT_T
|
|
||||||
/* Integral type unchanged by default argument promotions that can
|
|
||||||
hold any value corresponding to members of the extended character
|
|
||||||
set, as well as at least one value that does not correspond to any
|
|
||||||
member of the extended character set. */
|
|
||||||
# define _WINT_T
|
|
||||||
typedef unsigned int wint_t;
|
|
||||||
#endif
|
|
||||||
#define __need_mbstate_t
|
|
||||||
#include <wchar.h>
|
|
||||||
#define _G_size_t size_t
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
__off_t __pos;
|
|
||||||
__mbstate_t __state;
|
|
||||||
} _G_fpos_t;
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
__off64_t __pos;
|
|
||||||
__mbstate_t __state;
|
|
||||||
} _G_fpos64_t;
|
|
||||||
#define _G_ssize_t __ssize_t
|
|
||||||
#define _G_off_t __off_t
|
|
||||||
#define _G_off64_t __off64_t
|
|
||||||
#define _G_pid_t __pid_t
|
|
||||||
#define _G_uid_t __uid_t
|
|
||||||
#define _G_wchar_t wchar_t
|
|
||||||
#define _G_wint_t wint_t
|
|
||||||
#define _G_stat64 stat64
|
|
||||||
#include <gconv.h>
|
|
||||||
typedef union
|
|
||||||
{
|
|
||||||
struct __gconv_info __cd;
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
struct __gconv_info __cd;
|
|
||||||
struct __gconv_step_data __data;
|
|
||||||
} __combined;
|
|
||||||
} _G_iconv_t;
|
|
||||||
|
|
||||||
typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
|
|
||||||
typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
|
|
||||||
typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
|
|
||||||
typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
|
|
||||||
|
|
||||||
#define _G_HAVE_BOOL 1
|
|
||||||
|
|
||||||
|
|
||||||
/* These library features are always available in the GNU C library. */
|
|
||||||
#define _G_HAVE_ATEXIT 1
|
|
||||||
#define _G_HAVE_SYS_CDEFS 1
|
|
||||||
#define _G_HAVE_SYS_WAIT 1
|
|
||||||
#define _G_NEED_STDARG_H 1
|
|
||||||
#define _G_va_list __gnuc_va_list
|
|
||||||
|
|
||||||
#define _G_HAVE_PRINTF_FP 1
|
|
||||||
#define _G_HAVE_MMAP 1
|
|
||||||
#define _G_HAVE_LONG_DOUBLE_IO 1
|
|
||||||
#define _G_HAVE_IO_FILE_OPEN 1
|
|
||||||
#define _G_HAVE_IO_GETLINE_INFO 1
|
|
||||||
|
|
||||||
#define _G_IO_IO_FILE_VERSION 0x20001
|
|
||||||
|
|
||||||
#define _G_OPEN64 __open64
|
|
||||||
#define _G_LSEEK64 __lseek64
|
|
||||||
#define _G_MMAP64 __mmap64
|
|
||||||
#define _G_FSTAT64(fd,buf) __fxstat64 (_STAT_VER, fd, buf)
|
|
||||||
|
|
||||||
/* This is defined by <bits/stat.h> if `st_blksize' exists. */
|
|
||||||
#define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE)
|
|
||||||
|
|
||||||
#define _G_BUFSIZ 8192
|
|
||||||
|
|
||||||
/* These are the vtbl details for ELF. */
|
|
||||||
#define _G_NAMES_HAVE_UNDERSCORE 0
|
|
||||||
#define _G_VTABLE_LABEL_HAS_LENGTH 1
|
|
||||||
#undef _G_USING_THUNKS
|
|
||||||
#define _G_VTABLE_LABEL_PREFIX "_vt."
|
|
||||||
#define _G_VTABLE_LABEL_PREFIX_ID _vt.
|
|
||||||
|
|
||||||
|
|
||||||
#if defined __cplusplus || defined __STDC__
|
|
||||||
# define _G_ARGS(ARGLIST) ARGLIST
|
|
||||||
#else
|
|
||||||
# define _G_ARGS(ARGLIST) ()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _G_config.h */
|
|
@ -1,189 +0,0 @@
|
|||||||
/* O_*, F_*, FD_* bit values for Linux.
|
|
||||||
Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2004
|
|
||||||
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. */
|
|
||||||
|
|
||||||
#ifndef _FCNTL_H
|
|
||||||
# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
|
|
||||||
located on an ext2 file system */
|
|
||||||
#define O_ACCMODE 0003
|
|
||||||
#define O_RDONLY 00
|
|
||||||
#define O_WRONLY 01
|
|
||||||
#define O_RDWR 02
|
|
||||||
#define O_CREAT 0100 /* not fcntl */
|
|
||||||
#define O_EXCL 0200 /* not fcntl */
|
|
||||||
#define O_NOCTTY 0400 /* not fcntl */
|
|
||||||
#define O_TRUNC 01000 /* not fcntl */
|
|
||||||
#define O_APPEND 02000
|
|
||||||
#define O_NONBLOCK 04000
|
|
||||||
#define O_NDELAY O_NONBLOCK
|
|
||||||
#define O_SYNC 010000
|
|
||||||
#define O_FSYNC O_SYNC
|
|
||||||
#define O_ASYNC 020000
|
|
||||||
|
|
||||||
#ifdef __USE_GNU
|
|
||||||
# define O_DIRECT 040000 /* Direct disk access. */
|
|
||||||
# define O_DIRECTORY 0200000 /* Must be a directory. */
|
|
||||||
# define O_NOFOLLOW 0400000 /* Do not follow links. */
|
|
||||||
# define O_NOATIME 01000000 /* Do not set atime. */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* For now Linux has synchronisity options for data and read operations.
|
|
||||||
We define the symbols here but let them do the same as O_SYNC since
|
|
||||||
this is a superset. */
|
|
||||||
#if defined __USE_POSIX199309 || defined __USE_UNIX98
|
|
||||||
# define O_DSYNC O_SYNC /* Synchronize data. */
|
|
||||||
# define O_RSYNC O_SYNC /* Synchronize read operations. */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __USE_LARGEFILE64
|
|
||||||
# define O_LARGEFILE 0100000
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Values for the second argument to `fcntl'. */
|
|
||||||
#define F_DUPFD 0 /* Duplicate file descriptor. */
|
|
||||||
#define F_GETFD 1 /* Get file descriptor flags. */
|
|
||||||
#define F_SETFD 2 /* Set file descriptor flags. */
|
|
||||||
#define F_GETFL 3 /* Get file status flags. */
|
|
||||||
#define F_SETFL 4 /* Set file status flags. */
|
|
||||||
#ifndef __USE_FILE_OFFSET64
|
|
||||||
# define F_GETLK 5 /* Get record locking info. */
|
|
||||||
# define F_SETLK 6 /* Set record locking info (non-blocking). */
|
|
||||||
# define F_SETLKW 7 /* Set record locking info (blocking). */
|
|
||||||
#else
|
|
||||||
# define F_GETLK F_GETLK64 /* Get record locking info. */
|
|
||||||
# define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/
|
|
||||||
# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */
|
|
||||||
#endif
|
|
||||||
#define F_GETLK64 12 /* Get record locking info. */
|
|
||||||
#define F_SETLK64 13 /* Set record locking info (non-blocking). */
|
|
||||||
#define F_SETLKW64 14 /* Set record locking info (blocking). */
|
|
||||||
|
|
||||||
#if defined __USE_BSD || defined __USE_UNIX98
|
|
||||||
# define F_SETOWN 8 /* Get owner of socket (receiver of SIGIO). */
|
|
||||||
# define F_GETOWN 9 /* Set owner of socket (receiver of SIGIO). */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __USE_GNU
|
|
||||||
# define F_SETSIG 10 /* Set number of signal to be sent. */
|
|
||||||
# define F_GETSIG 11 /* Get number of signal to be sent. */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __USE_GNU
|
|
||||||
# define F_SETLEASE 1024 /* Set a lease. */
|
|
||||||
# define F_GETLEASE 1025 /* Enquire what lease is active. */
|
|
||||||
# define F_NOTIFY 1026 /* Request notfications on a directory. */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* For F_[GET|SET]FL. */
|
|
||||||
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
|
|
||||||
|
|
||||||
/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
|
|
||||||
#define F_RDLCK 0 /* Read lock. */
|
|
||||||
#define F_WRLCK 1 /* Write lock. */
|
|
||||||
#define F_UNLCK 2 /* Remove lock. */
|
|
||||||
|
|
||||||
/* For old implementation of bsd flock(). */
|
|
||||||
#define F_EXLCK 4 /* or 3 */
|
|
||||||
#define F_SHLCK 8 /* or 4 */
|
|
||||||
|
|
||||||
#ifdef __USE_BSD
|
|
||||||
/* Operations for bsd flock(), also used by the kernel implementation. */
|
|
||||||
# define LOCK_SH 1 /* shared lock */
|
|
||||||
# define LOCK_EX 2 /* exclusive lock */
|
|
||||||
# define LOCK_NB 4 /* or'd with one of the above to prevent
|
|
||||||
blocking */
|
|
||||||
# define LOCK_UN 8 /* remove lock */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __USE_GNU
|
|
||||||
# define LOCK_MAND 32 /* This is a mandatory flock: */
|
|
||||||
# define LOCK_READ 64 /* ... which allows concurrent read operations. */
|
|
||||||
# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */
|
|
||||||
# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __USE_GNU
|
|
||||||
/* Types of directory notifications that may be requested with F_NOTIFY. */
|
|
||||||
# define DN_ACCESS 0x00000001 /* File accessed. */
|
|
||||||
# define DN_MODIFY 0x00000002 /* File modified. */
|
|
||||||
# define DN_CREATE 0x00000004 /* File created. */
|
|
||||||
# define DN_DELETE 0x00000008 /* File removed. */
|
|
||||||
# define DN_RENAME 0x00000010 /* File renamed. */
|
|
||||||
# define DN_ATTRIB 0x00000020 /* File changed attibutes. */
|
|
||||||
# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct flock
|
|
||||||
{
|
|
||||||
short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
|
|
||||||
short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
|
|
||||||
#ifndef __USE_FILE_OFFSET64
|
|
||||||
__off_t l_start; /* Offset where the lock begins. */
|
|
||||||
__off_t l_len; /* Size of the locked area; zero means until EOF. */
|
|
||||||
#else
|
|
||||||
__off64_t l_start; /* Offset where the lock begins. */
|
|
||||||
__off64_t l_len; /* Size of the locked area; zero means until EOF. */
|
|
||||||
#endif
|
|
||||||
__pid_t l_pid; /* Process holding the lock. */
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef __USE_LARGEFILE64
|
|
||||||
struct flock64
|
|
||||||
{
|
|
||||||
short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
|
|
||||||
short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
|
|
||||||
__off64_t l_start; /* Offset where the lock begins. */
|
|
||||||
__off64_t l_len; /* Size of the locked area; zero means until EOF. */
|
|
||||||
__pid_t l_pid; /* Process holding the lock. */
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Define some more compatibility macros to be backward compatible with
|
|
||||||
BSD systems which did not managed to hide these kernel macros. */
|
|
||||||
#ifdef __USE_BSD
|
|
||||||
# define FAPPEND O_APPEND
|
|
||||||
# define FFSYNC O_FSYNC
|
|
||||||
# define FASYNC O_ASYNC
|
|
||||||
# define FNONBLOCK O_NONBLOCK
|
|
||||||
# define FNDELAY O_NDELAY
|
|
||||||
#endif /* Use BSD. */
|
|
||||||
|
|
||||||
/* Advise to `posix_fadvise'. */
|
|
||||||
#ifdef __USE_XOPEN2K
|
|
||||||
# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
|
|
||||||
# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
|
|
||||||
# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
|
|
||||||
# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
|
|
||||||
# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
|
|
||||||
# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
__BEGIN_DECLS
|
|
||||||
|
|
||||||
/* Provide kernel hint to read ahead. */
|
|
||||||
extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
|
|
||||||
__THROW;
|
|
||||||
|
|
||||||
__END_DECLS
|
|
@ -1,97 +0,0 @@
|
|||||||
/* Definitions for POSIX memory map interface. Linux/CRIS version.
|
|
||||||
Copyright (C) 1997, 2000, 2001, 2003 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. */
|
|
||||||
|
|
||||||
#ifndef _SYS_MMAN_H
|
|
||||||
# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* The following definitions basically come from the kernel headers.
|
|
||||||
But the kernel header is not namespace clean. */
|
|
||||||
|
|
||||||
|
|
||||||
/* Protections are chosen from these bits, OR'd together. The
|
|
||||||
implementation does not necessarily support PROT_EXEC or PROT_WRITE
|
|
||||||
without PROT_READ. The only guarantees are that no writing will be
|
|
||||||
allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
|
|
||||||
|
|
||||||
#define PROT_READ 0x1 /* Page can be read. */
|
|
||||||
#define PROT_WRITE 0x2 /* Page can be written. */
|
|
||||||
#define PROT_EXEC 0x4 /* Page can be executed. */
|
|
||||||
#define PROT_NONE 0x0 /* Page can not be accessed. */
|
|
||||||
#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of
|
|
||||||
growsdown vma (mprotect only). */
|
|
||||||
#define PROT_GROWSUP 0x02000000 /* Extend change to start of
|
|
||||||
growsup vma (mprotect only). */
|
|
||||||
|
|
||||||
/* Sharing types (must choose one and only one of these). */
|
|
||||||
#define MAP_SHARED 0x01 /* Share changes. */
|
|
||||||
#define MAP_PRIVATE 0x02 /* Changes are private. */
|
|
||||||
#ifdef __USE_MISC
|
|
||||||
# define MAP_TYPE 0x0f /* Mask for type of mapping. */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Other flags. */
|
|
||||||
#define MAP_FIXED 0x10 /* Interpret addr exactly. */
|
|
||||||
#ifdef __USE_MISC
|
|
||||||
# define MAP_FILE 0
|
|
||||||
# define MAP_ANONYMOUS 0x20 /* Don't use a file. */
|
|
||||||
# define MAP_ANON MAP_ANONYMOUS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* These are Linux-specific. */
|
|
||||||
#ifdef __USE_MISC
|
|
||||||
# define MAP_GROWSDOWN 0x0100 /* Stack-like segment. */
|
|
||||||
# define MAP_DENYWRITE 0x0800 /* ETXTBSY */
|
|
||||||
# define MAP_EXECUTABLE 0x1000 /* Mark it as an executable. */
|
|
||||||
# define MAP_LOCKED 0x2000 /* Lock the mapping. */
|
|
||||||
# define MAP_NORESERVE 0x4000 /* Don't check for reservations. */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Flags to `msync'. */
|
|
||||||
#define MS_ASYNC 1 /* Sync memory asynchronously. */
|
|
||||||
#define MS_SYNC 4 /* Synchronous memory sync. */
|
|
||||||
#define MS_INVALIDATE 2 /* Invalidate the caches. */
|
|
||||||
|
|
||||||
/* Flags for `mlockall'. */
|
|
||||||
#define MCL_CURRENT 1 /* Lock all currently mapped pages. */
|
|
||||||
#define MCL_FUTURE 2 /* Lock all additions to address
|
|
||||||
space. */
|
|
||||||
|
|
||||||
/* Flags for `mremap'. */
|
|
||||||
#ifdef __USE_GNU
|
|
||||||
# define MREMAP_MAYMOVE 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Advice to `madvise'. */
|
|
||||||
#ifdef __USE_BSD
|
|
||||||
# define MADV_NORMAL 0 /* No further special treatment. */
|
|
||||||
# define MADV_RANDOM 1 /* Expect random page references. */
|
|
||||||
# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
|
|
||||||
# define MADV_WILLNEED 3 /* Will need these pages. */
|
|
||||||
# define MADV_DONTNEED 4 /* Don't need these pages. */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* The POSIX people had to invent similar names for the same things. */
|
|
||||||
#ifdef __USE_XOPEN2K
|
|
||||||
# define POSIX_MADV_NORMAL 0 /* No further special treatment. */
|
|
||||||
# define POSIX_MADV_RANDOM 1 /* Expect random page references. */
|
|
||||||
# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */
|
|
||||||
# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */
|
|
||||||
# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */
|
|
||||||
#endif
|
|
@ -1,44 +0,0 @@
|
|||||||
/* brk system call for Linux/CRIS.
|
|
||||||
Copyright (C) 1995, 1996, 2001 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. */
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <sysdep.h>
|
|
||||||
|
|
||||||
/* This must be initialized data because commons can't have aliases. */
|
|
||||||
void *__curbrk = 0;
|
|
||||||
|
|
||||||
int
|
|
||||||
__brk (void *addr)
|
|
||||||
{
|
|
||||||
unsigned char *newbrk;
|
|
||||||
|
|
||||||
newbrk = (unsigned char *) INLINE_SYSCALL (brk, 1, addr);
|
|
||||||
|
|
||||||
__curbrk = newbrk;
|
|
||||||
|
|
||||||
if (newbrk < (unsigned char *) addr)
|
|
||||||
{
|
|
||||||
__set_errno (ENOMEM);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
weak_alias (__brk, brk)
|
|
@ -1 +0,0 @@
|
|||||||
#include <sysdeps/unix/sysv/linux/m68k/chown.c>
|
|
@ -1,88 +0,0 @@
|
|||||||
/* Copyright (C) 2001 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. */
|
|
||||||
|
|
||||||
#include <sysdep.h>
|
|
||||||
#define _ERRNO_H 1
|
|
||||||
#include <bits/errno.h>
|
|
||||||
|
|
||||||
/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
|
|
||||||
|
|
||||||
.syntax no_register_prefix
|
|
||||||
|
|
||||||
.text
|
|
||||||
ENTRY (__clone)
|
|
||||||
/* Sanity check arguments: No NULL function pointers. Allow a NULL
|
|
||||||
stack pointer though; it makes the kernel allocate stack. */
|
|
||||||
test.d r10
|
|
||||||
beq 1f
|
|
||||||
nop
|
|
||||||
|
|
||||||
/* We need to muck with a few registers. */
|
|
||||||
movem r1,[sp=sp-8]
|
|
||||||
|
|
||||||
/* Save the function pointer and argument. We can't save them
|
|
||||||
onto the new stack since it can be NULL. */
|
|
||||||
move.d r10,r0
|
|
||||||
move.d r13,r1
|
|
||||||
|
|
||||||
/* Move the other arguments into place for the system call. */
|
|
||||||
move.d r11,r10
|
|
||||||
move.d r12,r11
|
|
||||||
|
|
||||||
/* Do the system call. */
|
|
||||||
movu.w SYS_ify (clone),r9
|
|
||||||
break 13
|
|
||||||
test.d r10
|
|
||||||
beq .Lthread_start
|
|
||||||
nop
|
|
||||||
|
|
||||||
/* Jump to error handler if we get (unsigned) -4096 .. 0xffffffff. */
|
|
||||||
cmps.w -4096,r10
|
|
||||||
bhs 0f
|
|
||||||
movem [sp+],r1
|
|
||||||
|
|
||||||
/* In parent, successful return. (Avoid using "ret" - it's a macro.) */
|
|
||||||
Ret
|
|
||||||
nop
|
|
||||||
|
|
||||||
.Lthread_start:
|
|
||||||
/* Terminate frame pointers here. */
|
|
||||||
moveq 0,r8
|
|
||||||
|
|
||||||
/* I've told you once. */
|
|
||||||
move.d r1,r10
|
|
||||||
jsr r0
|
|
||||||
|
|
||||||
SETUP_PIC
|
|
||||||
PLTCALL (_exit)
|
|
||||||
|
|
||||||
/* Die horribly. */
|
|
||||||
test.d [6809]
|
|
||||||
|
|
||||||
/* Stop the unstoppable. */
|
|
||||||
9:
|
|
||||||
ba 9b
|
|
||||||
nop
|
|
||||||
|
|
||||||
/* Local error handler. */
|
|
||||||
1:
|
|
||||||
movs.w -EINVAL,r10
|
|
||||||
/* Drop through into the ordinary error handler. */
|
|
||||||
PSEUDO_END (__clone)
|
|
||||||
|
|
||||||
weak_alias (__clone, clone)
|
|
@ -1 +0,0 @@
|
|||||||
#include <sysdeps/unix/sysv/linux/i386/fchown.c>
|
|
@ -1 +0,0 @@
|
|||||||
#include <sysdeps/unix/sysv/linux/i386/fcntl.c>
|
|
@ -1 +0,0 @@
|
|||||||
#include <sysdeps/unix/sysv/linux/i386/fxstat.c>
|
|
@ -1 +0,0 @@
|
|||||||
#include <sysdeps/unix/sysv/linux/i386/getegid.c>
|
|
@ -1 +0,0 @@
|
|||||||
#include <sysdeps/unix/sysv/linux/i386/geteuid.c>
|
|
@ -1 +0,0 @@
|
|||||||
#include <sysdeps/unix/sysv/linux/i386/getgid.c>
|
|
@ -1,2 +0,0 @@
|
|||||||
/* We also have to rewrite the kernel gid_t to the user land type. */
|
|
||||||
#include <sysdeps/unix/sysv/linux/i386/getgroups.c>
|
|
@ -1 +0,0 @@
|
|||||||
#include <sysdeps/unix/sysv/linux/i386/getresgid.c>
|
|
@ -1 +0,0 @@
|
|||||||
#include <sysdeps/unix/sysv/linux/i386/getresuid.c>
|
|
@ -1 +0,0 @@
|
|||||||
#include <sysdeps/unix/sysv/linux/i386/getrlimit.c>
|
|
@ -1 +0,0 @@
|
|||||||
#include <sysdeps/unix/sysv/linux/i386/getrlimit64.c>
|
|
@ -1 +0,0 @@
|
|||||||
#include <sysdeps/unix/sysv/linux/i386/getuid.c>
|
|
@ -1 +0,0 @@
|
|||||||
#include <sysdeps/unix/sysv/linux/i386/lchown.c>
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user