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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [standalone.c] - Diff between revs 105 and 1765

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

Rev 105 Rev 1765
/* Interface to bare machine for GDB running as kernel debugger.
/* Interface to bare machine for GDB running as kernel debugger.
   Copyright (C) 1986, 1989, 1991 Free Software Foundation, Inc.
   Copyright (C) 1986, 1989, 1991 Free Software Foundation, Inc.
 
 
   This file is part of GDB.
   This file is part of GDB.
 
 
   This program is free software; you can redistribute it and/or modify
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
   (at your option) any later version.
 
 
   This program is distributed in the hope that it will be useful,
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   GNU General Public License for more details.
 
 
   You should have received a copy of the GNU General Public License
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330,
   Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.  */
   Boston, MA 02111-1307, USA.  */
 
 
#include <stdio.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/types.h>
#include "gdb_stat.h"
#include "gdb_stat.h"
 
 
#if defined (SIGTSTP) && defined (SIGIO)
#if defined (SIGTSTP) && defined (SIGIO)
#include <sys/time.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/resource.h>
#endif /* SIGTSTP and SIGIO defined (must be 4.2) */
#endif /* SIGTSTP and SIGIO defined (must be 4.2) */
 
 
#include "defs.h"
#include "defs.h"
#include "signals.h"
#include "signals.h"
#include "symtab.h"
#include "symtab.h"
#include "frame.h"
#include "frame.h"
#include "inferior.h"
#include "inferior.h"
#include "gdb_wait.h"
#include "gdb_wait.h"


 
 
/* Random system calls, mostly no-ops to prevent link problems  */
/* Random system calls, mostly no-ops to prevent link problems  */
 
 
ioctl (desc, code, arg)
ioctl (desc, code, arg)
{
{
}
}
 
 
int (*signal ()) ()
int (*signal ()) ()
{
{
}
}
 
 
kill ()
kill ()
{
{
}
}
 
 
getpid ()
getpid ()
{
{
  return 0;
  return 0;
}
}
 
 
sigsetmask ()
sigsetmask ()
{
{
}
}
 
 
chdir ()
chdir ()
{
{
}
}
 
 
char *
char *
getcwd (buf, len)
getcwd (buf, len)
     char *buf;
     char *buf;
     unsigned int len;
     unsigned int len;
{
{
  buf[0] = '/';
  buf[0] = '/';
  buf[1] = 0;
  buf[1] = 0;
  return buf;
  return buf;
}
}
 
 
/* Used to check for existence of .gdbinit.  Say no.  */
/* Used to check for existence of .gdbinit.  Say no.  */
 
 
access ()
access ()
{
{
  return -1;
  return -1;
}
}
 
 
exit ()
exit ()
{
{
  error ("Fatal error; restarting.");
  error ("Fatal error; restarting.");
}
}


/* Reading "files".  The contents of some files are written into kdb's
/* Reading "files".  The contents of some files are written into kdb's
   data area before it is run.  These files are used to contain the
   data area before it is run.  These files are used to contain the
   symbol table for kdb to load, and the source files (in case the
   symbol table for kdb to load, and the source files (in case the
   kdb user wants to print them).  The symbols are stored in a file
   kdb user wants to print them).  The symbols are stored in a file
   named "kdb-symbols" in a.out format (except that all the text and
   named "kdb-symbols" in a.out format (except that all the text and
   data have been stripped to save room).
   data have been stripped to save room).
 
 
   The files are stored in the following format:
   The files are stored in the following format:
   int     number of bytes of data for this file, including these four.
   int     number of bytes of data for this file, including these four.
   char[]  name of the file, ending with a null.
   char[]  name of the file, ending with a null.
   padding to multiple of 4 boundary.
   padding to multiple of 4 boundary.
   char[]  file contents.  The length can be deduced from what was
   char[]  file contents.  The length can be deduced from what was
   specified before.  There is no terminating null here.
   specified before.  There is no terminating null here.
 
 
   If the int at the front is zero, it means there are no more files.
   If the int at the front is zero, it means there are no more files.
 
 
   Opening a file in kdb returns a nonzero value to indicate success,
   Opening a file in kdb returns a nonzero value to indicate success,
   but the value does not matter.  Only one file can be open, and only
   but the value does not matter.  Only one file can be open, and only
   for reading.  All the primitives for input from the file know
   for reading.  All the primitives for input from the file know
   which file is open and ignore what is specified for the descriptor
   which file is open and ignore what is specified for the descriptor
   or for the stdio stream.
   or for the stdio stream.
 
 
   Input with fgetc can be done either on the file that is open
   Input with fgetc can be done either on the file that is open
   or on stdin (which reads from the terminal through tty_input ()  */
   or on stdin (which reads from the terminal through tty_input ()  */
 
 
/* Address of data for the files stored in format described above.  */
/* Address of data for the files stored in format described above.  */
char *files_start;
char *files_start;
 
 
/* The file stream currently open:  */
/* The file stream currently open:  */
 
 
char *sourcebeg;                /* beginning of contents */
char *sourcebeg;                /* beginning of contents */
int sourcesize;                 /* size of contents */
int sourcesize;                 /* size of contents */
char *sourceptr;                /* current read pointer */
char *sourceptr;                /* current read pointer */
int sourceleft;                 /* number of bytes to eof */
int sourceleft;                 /* number of bytes to eof */
 
 
/* "descriptor" for the file now open.
/* "descriptor" for the file now open.
   Incremented at each close.
   Incremented at each close.
   If specified descriptor does not match this,
   If specified descriptor does not match this,
   it means the program is trying to use a closed descriptor.
   it means the program is trying to use a closed descriptor.
   We report an error for that.  */
   We report an error for that.  */
 
 
int sourcedesc;
int sourcedesc;
 
 
open (filename, modes)
open (filename, modes)
     char *filename;
     char *filename;
     int modes;
     int modes;
{
{
  register char *next;
  register char *next;
 
 
  if (modes)
  if (modes)
    {
    {
      errno = EROFS;
      errno = EROFS;
      return -1;
      return -1;
    }
    }
 
 
  if (sourceptr)
  if (sourceptr)
    {
    {
      errno = EMFILE;
      errno = EMFILE;
      return -1;
      return -1;
    }
    }
 
 
  for (next = files_start; *(int *) next; next += *(int *) next)
  for (next = files_start; *(int *) next; next += *(int *) next)
    {
    {
      if (!STRCMP (next + 4, filename))
      if (!STRCMP (next + 4, filename))
        {
        {
          sourcebeg = next + 4 + strlen (next + 4) + 1;
          sourcebeg = next + 4 + strlen (next + 4) + 1;
          sourcebeg = (char *) (((int) sourcebeg + 3) & (-4));
          sourcebeg = (char *) (((int) sourcebeg + 3) & (-4));
          sourceptr = sourcebeg;
          sourceptr = sourcebeg;
          sourcesize = next + *(int *) next - sourceptr;
          sourcesize = next + *(int *) next - sourceptr;
          sourceleft = sourcesize;
          sourceleft = sourcesize;
          return sourcedesc;
          return sourcedesc;
        }
        }
    }
    }
  return 0;
  return 0;
}
}
 
 
close (desc)
close (desc)
     int desc;
     int desc;
{
{
  sourceptr = 0;
  sourceptr = 0;
  sourcedesc++;
  sourcedesc++;
  /* Don't let sourcedesc get big enough to be confused with stdin.  */
  /* Don't let sourcedesc get big enough to be confused with stdin.  */
  if (sourcedesc == 100)
  if (sourcedesc == 100)
    sourcedesc = 5;
    sourcedesc = 5;
}
}
 
 
FILE *
FILE *
fopen (filename, modes)
fopen (filename, modes)
     char *filename;
     char *filename;
     char *modes;
     char *modes;
{
{
  return (FILE *) open (filename, *modes == 'w');
  return (FILE *) open (filename, *modes == 'w');
}
}
 
 
FILE *
FILE *
fdopen (desc)
fdopen (desc)
     int desc;
     int desc;
{
{
  return (FILE *) desc;
  return (FILE *) desc;
}
}
 
 
fclose (desc)
fclose (desc)
     int desc;
     int desc;
{
{
  close (desc);
  close (desc);
}
}
 
 
fstat (desc, statbuf)
fstat (desc, statbuf)
     struct stat *statbuf;
     struct stat *statbuf;
{
{
  if (desc != sourcedesc)
  if (desc != sourcedesc)
    {
    {
      errno = EBADF;
      errno = EBADF;
      return -1;
      return -1;
    }
    }
  statbuf->st_size = sourcesize;
  statbuf->st_size = sourcesize;
}
}
 
 
myread (desc, destptr, size, filename)
myread (desc, destptr, size, filename)
     int desc;
     int desc;
     char *destptr;
     char *destptr;
     int size;
     int size;
     char *filename;
     char *filename;
{
{
  int len = min (sourceleft, size);
  int len = min (sourceleft, size);
 
 
  if (desc != sourcedesc)
  if (desc != sourcedesc)
    {
    {
      errno = EBADF;
      errno = EBADF;
      return -1;
      return -1;
    }
    }
 
 
  memcpy (destptr, sourceptr, len);
  memcpy (destptr, sourceptr, len);
  sourceleft -= len;
  sourceleft -= len;
  return len;
  return len;
}
}
 
 
int
int
fread (bufp, numelts, eltsize, stream)
fread (bufp, numelts, eltsize, stream)
{
{
  register int elts = min (numelts, sourceleft / eltsize);
  register int elts = min (numelts, sourceleft / eltsize);
  register int len = elts * eltsize;
  register int len = elts * eltsize;
 
 
  if (stream != sourcedesc)
  if (stream != sourcedesc)
    {
    {
      errno = EBADF;
      errno = EBADF;
      return -1;
      return -1;
    }
    }
 
 
  memcpy (bufp, sourceptr, len);
  memcpy (bufp, sourceptr, len);
  sourceleft -= len;
  sourceleft -= len;
  return elts;
  return elts;
}
}
 
 
int
int
fgetc (desc)
fgetc (desc)
     int desc;
     int desc;
{
{
 
 
  if (desc == (int) stdin)
  if (desc == (int) stdin)
    return tty_input ();
    return tty_input ();
 
 
  if (desc != sourcedesc)
  if (desc != sourcedesc)
    {
    {
      errno = EBADF;
      errno = EBADF;
      return -1;
      return -1;
    }
    }
 
 
  if (sourceleft-- <= 0)
  if (sourceleft-- <= 0)
    return EOF;
    return EOF;
  return *sourceptr++;
  return *sourceptr++;
}
}
 
 
lseek (desc, pos)
lseek (desc, pos)
     int desc;
     int desc;
     int pos;
     int pos;
{
{
 
 
  if (desc != sourcedesc)
  if (desc != sourcedesc)
    {
    {
      errno = EBADF;
      errno = EBADF;
      return -1;
      return -1;
    }
    }
 
 
  if (pos < 0 || pos > sourcesize)
  if (pos < 0 || pos > sourcesize)
    {
    {
      errno = EINVAL;
      errno = EINVAL;
      return -1;
      return -1;
    }
    }
 
 
  sourceptr = sourcebeg + pos;
  sourceptr = sourcebeg + pos;
  sourceleft = sourcesize - pos;
  sourceleft = sourcesize - pos;
}
}


/* Output in kdb can go only to the terminal, so the stream
/* Output in kdb can go only to the terminal, so the stream
   specified may be ignored.  */
   specified may be ignored.  */
 
 
printf (a1, a2, a3, a4, a5, a6, a7, a8, a9)
printf (a1, a2, a3, a4, a5, a6, a7, a8, a9)
{
{
  char buffer[1024];
  char buffer[1024];
  sprintf (buffer, a1, a2, a3, a4, a5, a6, a7, a8, a9);
  sprintf (buffer, a1, a2, a3, a4, a5, a6, a7, a8, a9);
  display_string (buffer);
  display_string (buffer);
}
}
 
 
fprintf (ign, a1, a2, a3, a4, a5, a6, a7, a8, a9)
fprintf (ign, a1, a2, a3, a4, a5, a6, a7, a8, a9)
{
{
  char buffer[1024];
  char buffer[1024];
  sprintf (buffer, a1, a2, a3, a4, a5, a6, a7, a8, a9);
  sprintf (buffer, a1, a2, a3, a4, a5, a6, a7, a8, a9);
  display_string (buffer);
  display_string (buffer);
}
}
 
 
fwrite (buf, numelts, size, stream)
fwrite (buf, numelts, size, stream)
     register char *buf;
     register char *buf;
     int numelts, size;
     int numelts, size;
{
{
  register int i = numelts * size;
  register int i = numelts * size;
  while (i-- > 0)
  while (i-- > 0)
    fputc (*buf++, stream);
    fputc (*buf++, stream);
}
}
 
 
fputc (c, ign)
fputc (c, ign)
{
{
  char buf[2];
  char buf[2];
  buf[0] = c;
  buf[0] = c;
  buf[1] = 0;
  buf[1] = 0;
  display_string (buf);
  display_string (buf);
}
}
 
 
/* sprintf refers to this, but loading this from the
/* sprintf refers to this, but loading this from the
   library would cause fflush to be loaded from it too.
   library would cause fflush to be loaded from it too.
   In fact there should be no need to call this (I hope).  */
   In fact there should be no need to call this (I hope).  */
 
 
_flsbuf ()
_flsbuf ()
{
{
  error ("_flsbuf was actually called.");
  error ("_flsbuf was actually called.");
}
}
 
 
fflush (ign)
fflush (ign)
{
{
}
}


/* Entries into core and inflow, needed only to make things link ok.  */
/* Entries into core and inflow, needed only to make things link ok.  */
 
 
exec_file_command ()
exec_file_command ()
{
{
}
}
 
 
core_file_command ()
core_file_command ()
{
{
}
}
 
 
char *
char *
get_exec_file (err)
get_exec_file (err)
     int err;
     int err;
{
{
  /* Makes one printout look reasonable; value does not matter otherwise.  */
  /* Makes one printout look reasonable; value does not matter otherwise.  */
  return "run";
  return "run";
}
}
 
 
/* Nonzero if there is a core file.  */
/* Nonzero if there is a core file.  */
 
 
have_core_file_p ()
have_core_file_p ()
{
{
  return 0;
  return 0;
}
}
 
 
kill_command ()
kill_command ()
{
{
  inferior_pid = 0;
  inferior_pid = 0;
}
}
 
 
terminal_inferior ()
terminal_inferior ()
{
{
}
}
 
 
terminal_ours ()
terminal_ours ()
{
{
}
}
 
 
terminal_init_inferior ()
terminal_init_inferior ()
{
{
}
}
 
 
write_inferior_register ()
write_inferior_register ()
{
{
}
}
 
 
read_inferior_register ()
read_inferior_register ()
{
{
}
}
 
 
read_memory (memaddr, myaddr, len)
read_memory (memaddr, myaddr, len)
     CORE_ADDR memaddr;
     CORE_ADDR memaddr;
     char *myaddr;
     char *myaddr;
     int len;
     int len;
{
{
  memcpy (myaddr, memaddr, len);
  memcpy (myaddr, memaddr, len);
}
}
 
 
/* Always return 0 indicating success.  */
/* Always return 0 indicating success.  */
 
 
write_memory (memaddr, myaddr, len)
write_memory (memaddr, myaddr, len)
     CORE_ADDR memaddr;
     CORE_ADDR memaddr;
     char *myaddr;
     char *myaddr;
     int len;
     int len;
{
{
  memcpy (memaddr, myaddr, len);
  memcpy (memaddr, myaddr, len);
  return 0;
  return 0;
}
}
 
 
static REGISTER_TYPE saved_regs[NUM_REGS];
static REGISTER_TYPE saved_regs[NUM_REGS];
 
 
REGISTER_TYPE
REGISTER_TYPE
read_register (regno)
read_register (regno)
     int regno;
     int regno;
{
{
  if (regno < 0 || regno >= NUM_REGS)
  if (regno < 0 || regno >= NUM_REGS)
    error ("Register number %d out of range.", regno);
    error ("Register number %d out of range.", regno);
  return saved_regs[regno];
  return saved_regs[regno];
}
}
 
 
void
void
write_register (regno, value)
write_register (regno, value)
     int regno;
     int regno;
     REGISTER_TYPE value;
     REGISTER_TYPE value;
{
{
  if (regno < 0 || regno >= NUM_REGS)
  if (regno < 0 || regno >= NUM_REGS)
    error ("Register number %d out of range.", regno);
    error ("Register number %d out of range.", regno);
  saved_regs[regno] = value;
  saved_regs[regno] = value;
}
}


/* System calls needed in relation to running the "inferior".  */
/* System calls needed in relation to running the "inferior".  */
 
 
vfork ()
vfork ()
{
{
  /* Just appear to "succeed".  Say the inferior's pid is 1.  */
  /* Just appear to "succeed".  Say the inferior's pid is 1.  */
  return 1;
  return 1;
}
}
 
 
/* These are called by code that normally runs in the inferior
/* These are called by code that normally runs in the inferior
   that has just been forked.  That code never runs, when standalone,
   that has just been forked.  That code never runs, when standalone,
   and these definitions are so it will link without errors.  */
   and these definitions are so it will link without errors.  */
 
 
ptrace ()
ptrace ()
{
{
}
}
 
 
setpgrp ()
setpgrp ()
{
{
}
}
 
 
execle ()
execle ()
{
{
}
}
 
 
_exit ()
_exit ()
{
{
}
}


/* Malloc calls these.  */
/* Malloc calls these.  */
 
 
malloc_warning (str)
malloc_warning (str)
     char *str;
     char *str;
{
{
  printf ("\n%s.\n\n", str);
  printf ("\n%s.\n\n", str);
}
}
 
 
char *next_free;
char *next_free;
char *memory_limit;
char *memory_limit;
 
 
char *
char *
sbrk (amount)
sbrk (amount)
     int amount;
     int amount;
{
{
  if (next_free + amount > memory_limit)
  if (next_free + amount > memory_limit)
    return (char *) -1;
    return (char *) -1;
  next_free += amount;
  next_free += amount;
  return next_free - amount;
  return next_free - amount;
}
}
 
 
/* Various ways malloc might ask where end of memory is.  */
/* Various ways malloc might ask where end of memory is.  */
 
 
char *
char *
ulimit ()
ulimit ()
{
{
  return memory_limit;
  return memory_limit;
}
}
 
 
int
int
vlimit ()
vlimit ()
{
{
  return memory_limit - next_free;
  return memory_limit - next_free;
}
}
 
 
getrlimit (addr)
getrlimit (addr)
     struct rlimit *addr;
     struct rlimit *addr;
{
{
  addr->rlim_cur = memory_limit - next_free;
  addr->rlim_cur = memory_limit - next_free;
}
}


/* Context switching to and from program being debugged.  */
/* Context switching to and from program being debugged.  */
 
 
/* GDB calls here to run the user program.
/* GDB calls here to run the user program.
   The frame pointer for this function is saved in
   The frame pointer for this function is saved in
   gdb_stack by save_frame_pointer; then we restore
   gdb_stack by save_frame_pointer; then we restore
   all of the user program's registers, including PC and PS.  */
   all of the user program's registers, including PC and PS.  */
 
 
static int fault_code;
static int fault_code;
static REGISTER_TYPE gdb_stack;
static REGISTER_TYPE gdb_stack;
 
 
resume ()
resume ()
{
{
  REGISTER_TYPE restore[NUM_REGS];
  REGISTER_TYPE restore[NUM_REGS];
 
 
  PUSH_FRAME_PTR;
  PUSH_FRAME_PTR;
  save_frame_pointer ();
  save_frame_pointer ();
 
 
  memcpy (restore, saved_regs, sizeof restore);
  memcpy (restore, saved_regs, sizeof restore);
  POP_REGISTERS;
  POP_REGISTERS;
  /* Control does not drop through here!  */
  /* Control does not drop through here!  */
}
}
 
 
save_frame_pointer (val)
save_frame_pointer (val)
     CORE_ADDR val;
     CORE_ADDR val;
{
{
  gdb_stack = val;
  gdb_stack = val;
}
}
 
 
/* Fault handlers call here, running in the user program stack.
/* Fault handlers call here, running in the user program stack.
   They must first push a fault code,
   They must first push a fault code,
   old PC, old PS, and any other info about the fault.
   old PC, old PS, and any other info about the fault.
   The exact format is machine-dependent and is known only
   The exact format is machine-dependent and is known only
   in the definition of PUSH_REGISTERS.  */
   in the definition of PUSH_REGISTERS.  */
 
 
fault ()
fault ()
{
{
  /* Transfer all registers and fault code to the stack
  /* Transfer all registers and fault code to the stack
     in canonical order: registers in order of GDB register number,
     in canonical order: registers in order of GDB register number,
     followed by fault code.  */
     followed by fault code.  */
  PUSH_REGISTERS;
  PUSH_REGISTERS;
 
 
  /* Transfer them to saved_regs and fault_code.  */
  /* Transfer them to saved_regs and fault_code.  */
  save_registers ();
  save_registers ();
 
 
  restore_gdb ();
  restore_gdb ();
  /* Control does not reach here */
  /* Control does not reach here */
}
}
 
 
restore_gdb ()
restore_gdb ()
{
{
  CORE_ADDR new_fp = gdb_stack;
  CORE_ADDR new_fp = gdb_stack;
  /* Switch to GDB's stack  */
  /* Switch to GDB's stack  */
  POP_FRAME_PTR;
  POP_FRAME_PTR;
  /* Return from the function `resume'.  */
  /* Return from the function `resume'.  */
}
}
 
 
/* Assuming register contents and fault code have been pushed on the stack as
/* Assuming register contents and fault code have been pushed on the stack as
   arguments to this function, copy them into the standard place
   arguments to this function, copy them into the standard place
   for the program's registers while GDB is running.  */
   for the program's registers while GDB is running.  */
 
 
save_registers (firstreg)
save_registers (firstreg)
     int firstreg;
     int firstreg;
{
{
  memcpy (saved_regs, &firstreg, sizeof saved_regs);
  memcpy (saved_regs, &firstreg, sizeof saved_regs);
  fault_code = (&firstreg)[NUM_REGS];
  fault_code = (&firstreg)[NUM_REGS];
}
}
 
 
/* Store into the structure such as `wait' would return
/* Store into the structure such as `wait' would return
   the information on why the program faulted,
   the information on why the program faulted,
   converted into a machine-independent signal number.  */
   converted into a machine-independent signal number.  */
 
 
static int fault_table[] = FAULT_TABLE;
static int fault_table[] = FAULT_TABLE;
 
 
int
int
wait (w)
wait (w)
     WAITTYPE *w;
     WAITTYPE *w;
{
{
  WSETSTOP (*w, fault_table[fault_code / FAULT_CODE_UNITS]);
  WSETSTOP (*w, fault_table[fault_code / FAULT_CODE_UNITS]);
  return inferior_pid;
  return inferior_pid;
}
}


/* Allocate a big space in which files for kdb to read will be stored.
/* Allocate a big space in which files for kdb to read will be stored.
   Whatever is left is where malloc can allocate storage.
   Whatever is left is where malloc can allocate storage.
 
 
   Initialize it, so that there will be space in the executable file
   Initialize it, so that there will be space in the executable file
   for it.  Then the files can be put into kdb by writing them into
   for it.  Then the files can be put into kdb by writing them into
   kdb's executable file.  */
   kdb's executable file.  */
 
 
/* The default size is as much space as we expect to be available
/* The default size is as much space as we expect to be available
   for kdb to use!  */
   for kdb to use!  */
 
 
#ifndef HEAP_SIZE
#ifndef HEAP_SIZE
#define HEAP_SIZE 400000
#define HEAP_SIZE 400000
#endif
#endif
 
 
char heap[HEAP_SIZE] =
char heap[HEAP_SIZE] =
{0};
{0};
 
 
#ifndef STACK_SIZE
#ifndef STACK_SIZE
#define STACK_SIZE 100000
#define STACK_SIZE 100000
#endif
#endif
 
 
int kdb_stack_beg[STACK_SIZE / sizeof (int)];
int kdb_stack_beg[STACK_SIZE / sizeof (int)];
int kdb_stack_end;
int kdb_stack_end;
 
 
_initialize_standalone ()
_initialize_standalone ()
{
{
  register char *next;
  register char *next;
 
 
  /* Find start of data on files.  */
  /* Find start of data on files.  */
 
 
  files_start = heap;
  files_start = heap;
 
 
  /* Find the end of the data on files.  */
  /* Find the end of the data on files.  */
 
 
  for (next = files_start; *(int *) next; next += *(int *) next)
  for (next = files_start; *(int *) next; next += *(int *) next)
    {
    {
    }
    }
 
 
  /* That is where free storage starts for sbrk to give out.  */
  /* That is where free storage starts for sbrk to give out.  */
  next_free = next;
  next_free = next;
 
 
  memory_limit = heap + sizeof heap;
  memory_limit = heap + sizeof heap;
}
}
 
 

powered by: WebSVN 2.1.0

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