OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [libgloss/] [cris/] [gensyscalls] - Diff between revs 158 and 816

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 158 Rev 816
#! /bin/sh
#! /bin/sh
#  Copyright (C) 2005 Axis Communications.
#  Copyright (C) 2005 Axis Communications.
#  All rights reserved.
#  All rights reserved.
#
#
#  Redistribution and use in source and binary forms, with or without
#  Redistribution and use in source and binary forms, with or without
#  modification, are permitted provided that the following conditions
#  modification, are permitted provided that the following conditions
#  are met:
#  are met:
#
#
#  1. Redistributions of source code must retain the above copyright
#  1. Redistributions of source code must retain the above copyright
#     notice, this list of conditions and the following disclaimer.
#     notice, this list of conditions and the following disclaimer.
#
#
#  2. Neither the name of Axis Communications nor the names of its
#  2. Neither the name of Axis Communications nor the names of its
#     contributors may be used to endorse or promote products derived
#     contributors may be used to endorse or promote products derived
#     from this software without specific prior written permission.
#     from this software without specific prior written permission.
#
#
#  THIS SOFTWARE IS PROVIDED BY AXIS COMMUNICATIONS AND ITS CONTRIBUTORS
#  THIS SOFTWARE IS PROVIDED BY AXIS COMMUNICATIONS AND ITS CONTRIBUTORS
#  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
#  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AXIS
#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AXIS
#  COMMUNICATIONS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
#  COMMUNICATIONS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
#  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
#  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
#  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
#  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
#  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
#  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
#  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
#  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
#  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
#  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
#  IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
#  IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
#  POSSIBILITY OF SUCH DAMAGE.
#  POSSIBILITY OF SUCH DAMAGE.
# To avoid an abundance of copyright/license messages for boilerplate
# To avoid an abundance of copyright/license messages for boilerplate
# code, we instead generate them from this file.  Generating the
# code, we instead generate them from this file.  Generating the
# function code could also be done automatically, but at the cost of
# function code could also be done automatically, but at the cost of
# slightly more intricate build machinery and/or scattered syscall
# slightly more intricate build machinery and/or scattered syscall
# information.  Beware that the cat-lines must match the sed regexp
# information.  Beware that the cat-lines must match the sed regexp
# "^cat > \([^ ]*\).*".
# "^cat > \([^ ]*\).*".
lu='/* -*- buffer-read-only: t -*-
lu='/* -*- buffer-read-only: t -*-
   THIS FILE IS AUTOMATICALLY GENERATED
   THIS FILE IS AUTOMATICALLY GENERATED
   FROM "'$0'".  */
   FROM "'$0'".  */
#include "linunistd.h"
#include "linunistd.h"
#define R(x) return (x); }
#define R(x) return (x); }
'
'
lui="$lu int"
lui="$lu int"
r=") { R (_Sys_"
r=") { R (_Sys_"
cat > close.c <
cat > close.c <
$lui _close (int fd${r}close (fd))
$lui _close (int fd${r}close (fd))
EOF
EOF
cat > execve.c <
cat > execve.c <
$lui _execve (char *path, char **argv, char **env${r}execve (path, argv, env))
$lui _execve (char *path, char **argv, char **env${r}execve (path, argv, env))
EOF
EOF
cat > exit.c <
cat > exit.c <
$lu void _exit (int val) { _Sys_exit (val); /* Appease GCC: */ while (1) ; }
$lu void _exit (int val) { _Sys_exit (val); /* Appease GCC: */ while (1) ; }
EOF
EOF
cat > fcntl.c <
cat > fcntl.c <
$lui _fcntl (int fd, int cmd, long arg${r}fcntl (fd, cmd, arg))
$lui _fcntl (int fd, int cmd, long arg${r}fcntl (fd, cmd, arg))
EOF
EOF
cat > fork.c <
cat > fork.c <
$lui _fork (void${r}fork ())
$lui _fork (void${r}fork ())
EOF
EOF
cat > fstat.c <
cat > fstat.c <
$lu#include 
$lu#include 
#include 
#include 
int
int
_fstat (int fd, struct stat *buf)
_fstat (int fd, struct stat *buf)
{
{
  struct new_stat ks;
  struct new_stat ks;
  int retval = _Sys_fstat (fd, &ks);
  int retval = _Sys_fstat (fd, &ks);
  /* Blank before filling it in.  */
  /* Blank before filling it in.  */
  memset (buf, 0, sizeof (*buf));
  memset (buf, 0, sizeof (*buf));
  /* We have to translate from the linux struct new_stat.
  /* We have to translate from the linux struct new_stat.
     It seems we don't have to translate the contents, though.  */
     It seems we don't have to translate the contents, though.  */
  buf->st_dev = ks.st_dev;
  buf->st_dev = ks.st_dev;
  buf->st_ino = ks.st_ino;
  buf->st_ino = ks.st_ino;
  buf->st_mode = ks.st_mode;
  buf->st_mode = ks.st_mode;
  buf->st_nlink = ks.st_nlink;
  buf->st_nlink = ks.st_nlink;
  buf->st_uid = ks.st_uid;
  buf->st_uid = ks.st_uid;
  buf->st_gid = ks.st_gid;
  buf->st_gid = ks.st_gid;
  buf->st_rdev = ks.st_rdev;
  buf->st_rdev = ks.st_rdev;
  buf->st_size = ks.st_size;
  buf->st_size = ks.st_size;
  buf->st_blksize = ks.st_blksize;
  buf->st_blksize = ks.st_blksize;
  buf->st_blocks = ks.st_blocks;
  buf->st_blocks = ks.st_blocks;
  buf->st_atime = ks.st_atime;
  buf->st_atime = ks.st_atime;
  buf->st_mtime = ks.st_mtime;
  buf->st_mtime = ks.st_mtime;
  buf->st_ctime = ks.st_ctime;
  buf->st_ctime = ks.st_ctime;
  R (retval)
  R (retval)
EOF
EOF
cat > getpid.c <
cat > getpid.c <
$lui _getpid (void${r}getpid ())
$lui _getpid (void${r}getpid ())
EOF
EOF
cat > gettod.c <
cat > gettod.c <
$lu#include 
$lu#include 
#include 
#include 
int
int
_gettimeofday (struct timeval *tp, void *tzp
_gettimeofday (struct timeval *tp, void *tzp
${r}gettimeofday (tp, tzp))
${r}gettimeofday (tp, tzp))
EOF
EOF
cat > isatty.c <
cat > isatty.c <
$lu
$lu
typedef unsigned int tcflag_t;
typedef unsigned int tcflag_t;
typedef unsigned char cc_t;
typedef unsigned char cc_t;
#define NCCS 19
#define NCCS 19
struct termios {
struct termios {
        tcflag_t c_iflag;               /* input mode flags */
        tcflag_t c_iflag;               /* input mode flags */
        tcflag_t c_oflag;               /* output mode flags */
        tcflag_t c_oflag;               /* output mode flags */
        tcflag_t c_cflag;               /* control mode flags */
        tcflag_t c_cflag;               /* control mode flags */
        tcflag_t c_lflag;               /* local mode flags */
        tcflag_t c_lflag;               /* local mode flags */
        cc_t c_line;                    /* line discipline */
        cc_t c_line;                    /* line discipline */
        cc_t c_cc[NCCS];                /* control characters */
        cc_t c_cc[NCCS];                /* control characters */
};
};
/* From asm-etrax100/ioctls.h: beware of updates.  */
/* From asm-etrax100/ioctls.h: beware of updates.  */
#define TCGETS          0x5401
#define TCGETS          0x5401
int
int
_isatty (int fd)
_isatty (int fd)
{
{
  struct termios dummy;
  struct termios dummy;
  int save_errno = errno;
  int save_errno = errno;
  int ret = _Sys_ioctl (fd, TCGETS, (unsigned long) &dummy);
  int ret = _Sys_ioctl (fd, TCGETS, (unsigned long) &dummy);
  errno = save_errno;
  errno = save_errno;
  R (ret == 0)
  R (ret == 0)
EOF
EOF
cat > kill.c <
cat > kill.c <
$lui _kill (int pid, int sig${r}kill (pid, sig))
$lui _kill (int pid, int sig${r}kill (pid, sig))
EOF
EOF
cat > link.c <
cat > link.c <
$lui _link (const char *old, const char *new${r}link (old, new))
$lui _link (const char *old, const char *new${r}link (old, new))
EOF
EOF
cat > lseek.c <
cat > lseek.c <
$lui _lseek (int fd, int offset, int whence${r}lseek (fd, offset, whence))
$lui _lseek (int fd, int offset, int whence${r}lseek (fd, offset, whence))
EOF
EOF
cat > open.c <
cat > open.c <
$lui _open (const char *fnam, int flags, int mode${r}open (fnam, flags, mode))
$lui _open (const char *fnam, int flags, int mode${r}open (fnam, flags, mode))
EOF
EOF
cat > read.c <
cat > read.c <
$lui _read (int fd, char *buf, int nbytes${r}read (fd, buf, nbytes))
$lui _read (int fd, char *buf, int nbytes${r}read (fd, buf, nbytes))
EOF
EOF
cat > rename.c <
cat > rename.c <
$lui _rename (const char *old, const char *new${r}rename (old, new))
$lui _rename (const char *old, const char *new${r}rename (old, new))
EOF
EOF
cat > sbrk.c <
cat > sbrk.c <
$lu
$lu
/* From asm-etrax100/mman.h: beware of updates.  */
/* From asm-etrax100/mman.h: beware of updates.  */
#define PROT_READ       0x1             /* page can be read */
#define PROT_READ       0x1             /* page can be read */
#define PROT_WRITE      0x2             /* page can be written */
#define PROT_WRITE      0x2             /* page can be written */
#define MAP_ANONYMOUS   0x20            /* don't use a file */
#define MAP_ANONYMOUS   0x20            /* don't use a file */
char *
char *
_sbrk (int d)
_sbrk (int d)
{
{
  static long last_alloc = 0;
  static long last_alloc = 0;
  /* FIXME: Things are a whole lot different than elinux.  */
  /* FIXME: Things are a whole lot different than elinux.  */
#ifdef __elinux__
#ifdef __elinux__
  /* We can't promise linear memory from a predetermined location.
  /* We can't promise linear memory from a predetermined location.
     We're NO_MM.  We're paria.  We have to rely on tweaks and unclean
     We're NO_MM.  We're paria.  We have to rely on tweaks and unclean
     behavior.  We abuse the fact that the malloc function in newlib
     behavior.  We abuse the fact that the malloc function in newlib
     accepts nonlinear chunks in return to its sbrk calls (with a minor
     accepts nonlinear chunks in return to its sbrk calls (with a minor
     patch).  */
     patch).  */
  /* We use an "old" type mmap, which takes a pointer to a vector of 6
  /* We use an "old" type mmap, which takes a pointer to a vector of 6
     longs where the parameters are stored.  */
     longs where the parameters are stored.  */
  long buffer[6];
  long buffer[6];
  /* We can't return memory.  Well we could, but we would have to keep a
  /* We can't return memory.  Well we could, but we would have to keep a
     list of previous allocations.  FIXME:  Seems reasonable to do that
     list of previous allocations.  FIXME:  Seems reasonable to do that
     later.  */
     later.  */
  if (d < 0)
  if (d < 0)
    return (char *) last_alloc;
    return (char *) last_alloc;
  buffer[3] = MAP_ANONYMOUS;    /* Not associated with a file.  */
  buffer[3] = MAP_ANONYMOUS;    /* Not associated with a file.  */
  buffer[4] = -1;               /* No file.  */
  buffer[4] = -1;               /* No file.  */
  buffer[0] = 0;                /* Address 0: let mmap pick one.  */
  buffer[0] = 0;                /* Address 0: let mmap pick one.  */
  buffer[1] = d;                /* Length.  */
  buffer[1] = d;                /* Length.  */
  buffer[2] = (PROT_READ | PROT_WRITE); /* Protection flags.  */
  buffer[2] = (PROT_READ | PROT_WRITE); /* Protection flags.  */
  buffer[5] = 0;                /* Offset into file.  */
  buffer[5] = 0;                /* Offset into file.  */
  last_alloc = _Sys_mmap (buffer);
  last_alloc = _Sys_mmap (buffer);
  return (char *) last_alloc;
  return (char *) last_alloc;
#else /* not __elinux__ */
#else /* not __elinux__ */
  long prev_brk;
  long prev_brk;
  if (last_alloc == 0)
  if (last_alloc == 0)
  {
  {
    last_alloc = _Sys_brk (0);
    last_alloc = _Sys_brk (0);
    if (last_alloc < 0)
    if (last_alloc < 0)
      return (char *) -1;
      return (char *) -1;
  }
  }
  prev_brk = last_alloc;
  prev_brk = last_alloc;
  if (_Sys_brk (last_alloc + d) < last_alloc + d)
  if (_Sys_brk (last_alloc + d) < last_alloc + d)
    return (char *) -1;
    return (char *) -1;
  last_alloc += d;
  last_alloc += d;
  return (char *) prev_brk;
  return (char *) prev_brk;
#endif
#endif
}
}
EOF
EOF
cat > stat.c <
cat > stat.c <
$lu#include 
$lu#include 
#include 
#include 
int
int
_stat (const char *path, struct stat *buf)
_stat (const char *path, struct stat *buf)
{
{
  struct new_stat ks;
  struct new_stat ks;
  int retval = _Sys_stat (path, &ks);
  int retval = _Sys_stat (path, &ks);
  /* Blank before filling it in.  */
  /* Blank before filling it in.  */
  memset (buf, 0, sizeof (*buf));
  memset (buf, 0, sizeof (*buf));
  /* We have to translate from the linux struct new_stat.
  /* We have to translate from the linux struct new_stat.
     It seems we don't have to translate the contents, though.  */
     It seems we don't have to translate the contents, though.  */
  buf->st_dev = ks.st_dev;
  buf->st_dev = ks.st_dev;
  buf->st_ino = ks.st_ino;
  buf->st_ino = ks.st_ino;
  buf->st_mode = ks.st_mode;
  buf->st_mode = ks.st_mode;
  buf->st_nlink = ks.st_nlink;
  buf->st_nlink = ks.st_nlink;
  buf->st_uid = ks.st_uid;
  buf->st_uid = ks.st_uid;
  buf->st_gid = ks.st_gid;
  buf->st_gid = ks.st_gid;
  buf->st_rdev = ks.st_rdev;
  buf->st_rdev = ks.st_rdev;
  buf->st_size = ks.st_size;
  buf->st_size = ks.st_size;
  buf->st_blksize = ks.st_blksize;
  buf->st_blksize = ks.st_blksize;
  buf->st_blocks = ks.st_blocks;
  buf->st_blocks = ks.st_blocks;
  buf->st_atime = ks.st_atime;
  buf->st_atime = ks.st_atime;
  buf->st_mtime = ks.st_mtime;
  buf->st_mtime = ks.st_mtime;
  buf->st_ctime = ks.st_ctime;
  buf->st_ctime = ks.st_ctime;
  R (retval)
  R (retval)
EOF
EOF
cat > times.c <
cat > times.c <
$lu#include 
$lu#include 
clock_t
clock_t
_times (struct tms * tp${r}times (tp))
_times (struct tms * tp${r}times (tp))
EOF
EOF
cat > unlink.c <
cat > unlink.c <
$lui _unlink (const char *f${r}unlink (f))
$lui _unlink (const char *f${r}unlink (f))
EOF
EOF
cat > wait.c <
cat > wait.c <
$lui _wait (int *status${r}wait4 (_getpid(), status, 0, 0))
$lui _wait (int *status${r}wait4 (_getpid(), status, 0, 0))
EOF
EOF
cat > write.c <
cat > write.c <
$lui _write (int fd, char *buf, int nbytes${r}write (fd, buf, nbytes))
$lui _write (int fd, char *buf, int nbytes${r}write (fd, buf, nbytes))
EOF
EOF
exit 0
exit 0
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.