gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gm2] Some Confirmation Of Recent Bug Fixes


From: Gaius Mulley
Subject: Re: [Gm2] Some Confirmation Of Recent Bug Fixes
Date: 29 Sep 2004 17:08:19 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

"John B. Wallace, Jr." <address@hidden> writes:

> I would like to report that with the recent bug fixes to gm2, I can now 
> successfully build and run most of the modules (unaltered) from the ulm 
> std directory on my system (after converting the required ulm sys modules 
> from UNIXCALL to libc calls).

Thanks for the post, John. Good news! 

> I am using the cvs sources from 20 September 2004 attached to and built
> with gcc-3.3.3 (all tests passed) and, as before, my system is
> Red Hat 9 Linux / i586(AMD K6-2).
> 
> Also, a question for the future: Will the ulm UNIXCALL procedure be 
> implemented in gm2?

yes, thanks for asking about it as I forgot to cvs add this file.
Here is the start of SYSTEM.c - which needs the rest of the system
calls to be initialized. It would be great if this could be done
during configure (or perhaps during the library build) by a script
(python?) reading the sys/syscall.h. Then we need to modify the
gm2 front end to automatically include the appropriate search path
and include SYSTEM.o during linking.

Gaius

---------------------------
#include <sys/syscall.h>
#include <stdarg.h>
#include <errno.h>

#if !defined(TRUE)
#   define TRUE (1==1)
#endif

#if !defined(FALSE)
#   define FALSE (1==0)
#endif

extern int read (int, void *, int);
extern int write (int, void *, int);

static int (*syscalls[200])();
static int initialized = 0;

int mywrite (int fd, void *buf, int len)
{
  return write (fd, buf, len);
}

int
SYSTEM_UNIXCALL (int syscall, int *r0, int *r1, ...)
{
  va_list ap;
  int p1, p2, p3;

  if (! initialized)
    _M2_SYSTEM_init();

  va_start (ap, r1);
  p1 = va_arg (ap, int);
  p2 = va_arg (ap, int);
  p3 = va_arg (ap, int);
  *r0 = (*syscalls[syscall]) (p1, p2, p3);
  va_end (ap);
  return (*r0) >= 0;
}

/*
 *  UNIXFORK - returns TRUE if successful and pid is set to the son pid
 *             if the parent is returning. If the child is returning pid=0.
 *             UNIXFORK returns FALSE if an error occurs and errno is held in 
pid.
 */

int
SYSTEM_UNIXFORK (unsigned int *pid)
{
  int p = fork();

  if (p == -1) {
    *pid = errno;
    return FALSE;
  }
  *pid = p;

  return TRUE;
}

_M2_SYSTEM_init ()
{
  syscalls[__NR_write] = (void *)mywrite;
  syscalls[__NR_read]  = (void *)read;
  initialized = 1;
}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]