diff options
| author | Roland McGrath <roland@gnu.org> | 1995-02-18 01:27:10 +0000 |
|---|---|---|
| committer | Roland McGrath <roland@gnu.org> | 1995-02-18 01:27:10 +0000 |
| commit | 28f540f45bbacd939bfd07f213bcad2bf730b1bf (patch) | |
| tree | 15f07c4c43d635959c6afee96bde71fb1b3614ee /sysdeps/standalone | |
| download | glibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.tar.xz glibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.zip | |
initial import
Diffstat (limited to 'sysdeps/standalone')
38 files changed, 2725 insertions, 0 deletions
diff --git a/sysdeps/standalone/Dist b/sysdeps/standalone/Dist new file mode 100644 index 0000000000..b6b12b709a --- /dev/null +++ b/sysdeps/standalone/Dist @@ -0,0 +1,2 @@ +filedesc.h +standalone.h diff --git a/sysdeps/standalone/Subdirs b/sysdeps/standalone/Subdirs new file mode 100644 index 0000000000..4125ae86db --- /dev/null +++ b/sysdeps/standalone/Subdirs @@ -0,0 +1,4 @@ +# The `bare' subdirectory defines some structure for a target-specific +# library of functions which are actually implemented in +# sysdeps/standalone/CPU/TARGET. +bare diff --git a/sysdeps/standalone/brk.c b/sysdeps/standalone/brk.c new file mode 100644 index 0000000000..67fbf771a0 --- /dev/null +++ b/sysdeps/standalone/brk.c @@ -0,0 +1,65 @@ +/* Copyright (C) 1991, 1994, 1995 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 Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <ansidecl.h> +#include <stdlib.h> + +PTR __curbrk; +PTR __rorig; +PTR __rlimit; + +int +DEFUN(__brk, (inaddr), PTR inaddr) +{ + + if ( ( (void *)inaddr > (void *)__rlimit ) || + ( (void *)inaddr < (void *)__rorig ) ) + return -1; + + __curbrk = inaddr; + return 0; +} + +/* Initialization Code for Memory Allocation */ + +PTR __C_heap_start; +int __C_heap_size; + +#ifdef HAVE_GNU_LD +static +#endif +void +DEFUN(__NONE_set_memvals, (argc, argv, envp), + int argc AND char **argv AND 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) diff --git a/sysdeps/standalone/close.c b/sysdeps/standalone/close.c new file mode 100644 index 0000000000..59b607305f --- /dev/null +++ b/sysdeps/standalone/close.c @@ -0,0 +1,44 @@ +/* Copyright (C) 1994, 1995 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 Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <ansidecl.h> +#include <errno.h> +#include <unistd.h> + +#include <stdio_lim.h> +#include "filedesc.h" + +/* Close the file descriptor FD. */ +int +DEFUN(__close, (fd), int fd) +{ + if ( !__FD_Is_valid( fd ) || !__FD_Table[ fd ].in_use ) + { + errno = EBADF; + return -1; + } + + __FD_Table[ fd ].in_use = 0; + return 0; +} + + +weak_alias (__close, close) diff --git a/sysdeps/standalone/dirstream.h b/sysdeps/standalone/dirstream.h new file mode 100644 index 0000000000..20c4922fb9 --- /dev/null +++ b/sysdeps/standalone/dirstream.h @@ -0,0 +1,43 @@ +/* Copyright (C) 1993 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#ifndef _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. */ + +typedef struct + { + 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'. */ + } DIR; + +#endif /* dirstream.h */ diff --git a/sysdeps/standalone/filedesc.h b/sysdeps/standalone/filedesc.h new file mode 100644 index 0000000000..bf3b6a9f0c --- /dev/null +++ b/sysdeps/standalone/filedesc.h @@ -0,0 +1,48 @@ +/* Copyright (C) 1994 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 Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +/* + * This is the file descriptor used by the no OS implementation + * of __open, __read, __write, and __close. + */ + +#ifndef __FILEDESC_h +#define __FILEDESC_h + +#include <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 diff --git a/sysdeps/standalone/i386/Dist b/sysdeps/standalone/i386/Dist new file mode 100644 index 0000000000..98d13be9af --- /dev/null +++ b/sysdeps/standalone/i386/Dist @@ -0,0 +1 @@ +i386.h diff --git a/sysdeps/standalone/i386/force_cpu386/Dist b/sysdeps/standalone/i386/force_cpu386/Dist new file mode 100644 index 0000000000..8b7b09e10a --- /dev/null +++ b/sysdeps/standalone/i386/force_cpu386/Dist @@ -0,0 +1 @@ +target.ld diff --git a/sysdeps/standalone/i386/force_cpu386/Makefile b/sysdeps/standalone/i386/force_cpu386/Makefile new file mode 100644 index 0000000000..8483724ee3 --- /dev/null +++ b/sysdeps/standalone/i386/force_cpu386/Makefile @@ -0,0 +1,24 @@ +# Copyright (C) 1994 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 Library General Public License +# as published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. + +# You should have received a copy of the GNU Library General Public +# License along with the GNU C Library; see the file COPYING.LIB. If +# not, write to the Free Software Foundation, Inc., 675 Mass Ave, +# Cambridge, MA 02139, USA. + +ifeq (bare,$(subdir)) +install-others += $(libdir)/force_cpu386.ld +$(libdir)/force_cpu386.ld: $(sysdep_dir)/standalone/i386/target.ld + $(do-install) +endif diff --git a/sysdeps/standalone/i386/force_cpu386/_exit.c b/sysdeps/standalone/i386/force_cpu386/_exit.c new file mode 100644 index 0000000000..011bb8bda9 --- /dev/null +++ b/sysdeps/standalone/i386/force_cpu386/_exit.c @@ -0,0 +1,47 @@ +/* Copyright (C) 1991 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 Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <ansidecl.h> +#include <unistd.h> +#include <stdlib.h> + +/* This returns control to FORCEbug. */ + +void DEFUN_VOID(Bsp_cleanup); + +/* 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 +DEFUN(_exit, (status), int status) +{ + /* status is ignored */ + Bsp_cleanup(); +} + +#ifdef HAVE_GNU_LD + +#include <gnu-stabs.h> + +stub_warning(_exit); + +#endif /* GNU stabs. */ diff --git a/sysdeps/standalone/i386/force_cpu386/brdinit.c b/sysdeps/standalone/i386/force_cpu386/brdinit.c new file mode 100644 index 0000000000..0d27218121 --- /dev/null +++ b/sysdeps/standalone/i386/force_cpu386/brdinit.c @@ -0,0 +1,44 @@ +/* Copyright (C) 1994 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 Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <ansidecl.h> +#include <standalone.h> +#include "i386.h" + +/* _Board_Initialize() + +This routine initializes the FORCE CPU386 board. */ + +void DEFUN_VOID(_Console_Initialize); + +void +DEFUN_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(); +} diff --git a/sysdeps/standalone/i386/force_cpu386/console.c b/sysdeps/standalone/i386/force_cpu386/console.c new file mode 100644 index 0000000000..5d56f768ea --- /dev/null +++ b/sysdeps/standalone/i386/force_cpu386/console.c @@ -0,0 +1,163 @@ +/* Copyright (C) 1994 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 Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WA |
