Get em22 working. Remove the leading-underscore system calls from its libsys.
This commit is contained in:
parent
74d166ef9a
commit
538eefb573
|
@ -16,7 +16,7 @@ vars.plats = {
|
|||
"pc86",
|
||||
"rpi",
|
||||
"pdpv7",
|
||||
-- "em22",
|
||||
"em22",
|
||||
}
|
||||
vars.plats_with_tests = {
|
||||
"linux68k",
|
||||
|
|
|
@ -50,6 +50,8 @@ for _, plat in ipairs(vars.plats) do
|
|||
"./stdlib/*.c",
|
||||
"./string/*.c",
|
||||
"./time/*.c",
|
||||
"./misc/getpass.c",
|
||||
"./misc/isatty.c",
|
||||
},
|
||||
hdrs = {}, -- must be empty
|
||||
deps = {
|
||||
|
|
|
@ -19,4 +19,9 @@
|
|||
#define ACKCONF_WANT_STANDARD_SIGNALS 1
|
||||
#endif
|
||||
|
||||
#ifndef ACKCONF_WANT_TERMIOS
|
||||
/* Don't compile termios-using functions unless the plat explicitly asks for it. */
|
||||
#define ACKCONF_WANT_TERMIOS 0
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
13
lang/cem/libcc.ansi/headers/sys/times.h
Normal file
13
lang/cem/libcc.ansi/headers/sys/times.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
#ifndef _SYS_TIMES_H
|
||||
#define _SYS_TIMES_H
|
||||
|
||||
struct tms {
|
||||
clock_t tms_utime; /* user time */
|
||||
clock_t tms_stime; /* system time */
|
||||
clock_t tms_cutime; /* user time of children */
|
||||
clock_t tms_cstime; /* system time of children */
|
||||
};
|
||||
|
||||
extern clock_t times(struct tms* buf);
|
||||
|
||||
#endif
|
|
@ -92,7 +92,9 @@ extern int sigaction(int, const struct sigaction *, struct sigaction *);
|
|||
extern int sigprocmask(int, const sigset_t *, sigset_t *);
|
||||
extern int unlink(const char* path);
|
||||
extern off_t lseek(int fildes, off_t offset, int whence);
|
||||
extern pid_t fork(void);
|
||||
extern pid_t getpid(void);
|
||||
extern pid_t wait(int* wstatus);
|
||||
extern sighandler_t signal(int signum, sighandler_t handler);
|
||||
extern ssize_t read(int fd, void* buffer, size_t count);
|
||||
extern ssize_t write(int fd, void* buffer, size_t count);
|
||||
|
|
|
@ -6,41 +6,67 @@
|
|||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#include <sgtty.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
int _open(const char* path, int flags);
|
||||
int _write(int d, const char* buf, int nbytes);
|
||||
int _read(int d, char* buf, int nbytes);
|
||||
int _close(int d);
|
||||
#if ACKCONF_WANT_TERMIOS
|
||||
|
||||
int _stty(int, struct sgttyb*);
|
||||
int _gtty(int, struct sgttyb*);
|
||||
#include <termios.h>
|
||||
static int intr;
|
||||
|
||||
char* getpass(const char* prompt)
|
||||
static void catch(int sig)
|
||||
{
|
||||
int i = 0;
|
||||
struct sgttyb tty, ttysave;
|
||||
static char pwdbuf[9];
|
||||
int fd;
|
||||
void (*savesig)(int);
|
||||
|
||||
if ((fd = _open("/dev/tty", O_RDONLY)) < 0)
|
||||
fd = 0;
|
||||
savesig = signal(SIGINT, SIG_IGN);
|
||||
_write(2, prompt, strlen(prompt));
|
||||
_gtty(fd, &tty);
|
||||
ttysave = tty;
|
||||
tty.sg_flags &= ~ECHO;
|
||||
_stty(fd, &tty);
|
||||
i = _read(fd, pwdbuf, 9);
|
||||
while (pwdbuf[i - 1] != '\n')
|
||||
_read(fd, &pwdbuf[i - 1], 1);
|
||||
pwdbuf[i - 1] = '\0';
|
||||
_stty(fd, &ttysave);
|
||||
_write(2, "\n", 1);
|
||||
if (fd != 0)
|
||||
_close(fd);
|
||||
signal(SIGINT, savesig);
|
||||
return (pwdbuf);
|
||||
intr= 1;
|
||||
}
|
||||
|
||||
char *getpass(const char *prompt)
|
||||
{
|
||||
struct sigaction osa, sa;
|
||||
struct termios cooked, raw;
|
||||
static char password[32+1];
|
||||
int fd, n= 0;
|
||||
|
||||
/* Try to open the controlling terminal. */
|
||||
if ((fd= open("/dev/tty", O_RDONLY)) < 0) return NULL;
|
||||
|
||||
/* Trap interrupts unless ignored. */
|
||||
intr= 0;
|
||||
sigaction(SIGINT, NULL, &osa);
|
||||
if (osa.sa_handler != SIG_IGN) {
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sa.sa_flags= 0;
|
||||
sa.sa_handler= catch;
|
||||
sigaction(SIGINT, &sa, &osa);
|
||||
}
|
||||
|
||||
/* Set the terminal to non-echo mode. */
|
||||
tcgetattr(fd, &cooked);
|
||||
raw= cooked;
|
||||
raw.c_iflag|= ICRNL;
|
||||
raw.c_lflag&= ~ECHO;
|
||||
raw.c_lflag|= ECHONL;
|
||||
raw.c_oflag|= OPOST | ONLCR;
|
||||
tcsetattr(fd, TCSANOW, &raw);
|
||||
|
||||
/* Print the prompt. (After setting non-echo!) */
|
||||
write(2, prompt, strlen(prompt));
|
||||
|
||||
/* Read the password, 32 characters max. */
|
||||
while (read(fd, password+n, 1) > 0) {
|
||||
if (password[n] == '\n') break;
|
||||
if (n < 32) n++;
|
||||
}
|
||||
password[n]= 0;
|
||||
|
||||
/* Terminal back to cooked mode. */
|
||||
tcsetattr(fd, TCSANOW, &cooked);
|
||||
|
||||
close(fd);
|
||||
|
||||
/* Interrupt? */
|
||||
sigaction(SIGINT, &osa, NULL);
|
||||
if (intr) raise(SIGINT);
|
||||
|
||||
return password;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3,9 +3,16 @@
|
|||
*/
|
||||
/* $Id$ */
|
||||
|
||||
int _isatty(int d);
|
||||
#include <stdlib.h>
|
||||
|
||||
int isatty(int d)
|
||||
#if ACKCONF_WANT_TERMIOS
|
||||
|
||||
#include <termios.h>
|
||||
int isatty(int fd)
|
||||
{
|
||||
return _isatty(d);
|
||||
struct termios dummy;
|
||||
|
||||
return(tcgetattr(fd, &dummy) == 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
/*
|
||||
* _isatty - check if a file descriptor is associated with a terminal
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
int _gtty(int d, char* buf);
|
||||
|
||||
int _isatty(int d)
|
||||
{
|
||||
char buf[128];
|
||||
/* not a sgttyb struct; it might not be large enough;
|
||||
I know for a fact that it isn't large enough on PC/IX,
|
||||
where gtty is an ioctl(..., TCGETA, ...)
|
||||
*/
|
||||
|
||||
return _gtty(d, buf) >= 0;
|
||||
}
|
|
@ -4,19 +4,10 @@
|
|||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#if defined(_POSIX_SOURCE)
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
|
||||
extern char** environ;
|
||||
|
||||
extern int _fork(void);
|
||||
extern int _wait(int*);
|
||||
extern void _exit(int);
|
||||
extern void _execve(const char* path, const char** argv, const char** envp);
|
||||
extern void _close(int);
|
||||
#include <unistd.h>
|
||||
|
||||
#define FAIL 127
|
||||
|
||||
|
@ -32,21 +23,21 @@ int system(const char* str)
|
|||
int pid, exitstatus, waitval;
|
||||
int i;
|
||||
|
||||
if ((pid = _fork()) < 0)
|
||||
if ((pid = fork()) < 0)
|
||||
return str ? -1 : 0;
|
||||
|
||||
if (pid == 0)
|
||||
{
|
||||
for (i = 3; i <= 20; i++)
|
||||
_close(i);
|
||||
close(i);
|
||||
if (!str)
|
||||
str = "cd ."; /* just testing for a shell */
|
||||
exec_tab[2] = str; /* fill in command */
|
||||
_execve("/bin/sh", exec_tab, (char const**)environ);
|
||||
execve("/bin/sh", (char* const*)exec_tab, (char* const*)environ);
|
||||
/* get here if execve fails ... */
|
||||
_exit(FAIL); /* see manual page */
|
||||
}
|
||||
while ((waitval = _wait(&exitstatus)) != pid)
|
||||
while ((waitval = wait(&exitstatus)) != pid)
|
||||
{
|
||||
if (waitval == -1)
|
||||
break;
|
||||
|
|
|
@ -4,80 +4,14 @@
|
|||
/* $Id$ */
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#if defined(__BSD4_2)
|
||||
|
||||
#define RUSAGE_SELF 0
|
||||
#define RUSAGE_CHILDREN -1
|
||||
|
||||
struct rusage
|
||||
{
|
||||
struct timeval ru_utime; /* user time used */
|
||||
struct timeval ru_stime; /* system time used */
|
||||
long ru_maxrss;
|
||||
long ru_ixrss; /* integral shared memory size */
|
||||
long ru_idrss; /* integral unshared data size */
|
||||
long ru_isrss; /* integral unshared stack size */
|
||||
long ru_minflt; /* page reclaims */
|
||||
long ru_majflt; /* page faults */
|
||||
long ru_nswap; /* swaps */
|
||||
long ru_inblock; /* block input operations */
|
||||
long ru_oublock; /* block output operations */
|
||||
long ru_msgsnd; /* messages sent */
|
||||
long ru_msgrcv; /* messages received */
|
||||
long ru_nsignals; /* signals received */
|
||||
long ru_nvcsw; /* voluntary context switches */
|
||||
long ru_nivcsw; /* involuntary context switches */
|
||||
};
|
||||
|
||||
void _getrusage(int who, struct rusage* rusage);
|
||||
|
||||
#elif defined(_POSIX_SOURCE) || defined(__USG)
|
||||
|
||||
struct tms
|
||||
{
|
||||
time_t tms_utime; /* user time */
|
||||
time_t tms_stime; /* system time */
|
||||
time_t tms_cutime; /* user time, children */
|
||||
time_t tms_cstime; /* system time, children */
|
||||
};
|
||||
|
||||
long _times(struct tms* buffer);
|
||||
|
||||
#else /* Version 7 UNIX */
|
||||
|
||||
struct tbuffer
|
||||
{
|
||||
long proc_user_time;
|
||||
long proc_system_time;
|
||||
long child_user_time;
|
||||
long child_system_time;
|
||||
};
|
||||
|
||||
long _times(struct tbuffer* buffer);
|
||||
|
||||
#endif
|
||||
#include <sys/times.h>
|
||||
|
||||
clock_t
|
||||
clock(void)
|
||||
{
|
||||
#if defined(__BSD4_2)
|
||||
struct rusage rusage;
|
||||
|
||||
_getrusage(RUSAGE_SELF, &rusage);
|
||||
|
||||
return (((unsigned long)rusage.ru_utime.tv_sec * CLOCKS_PER_SEC)
|
||||
+ rusage.ru_utime.tv_usec);
|
||||
#elif defined(_POSIX_SOURCE) || defined(__USG)
|
||||
struct tms tms;
|
||||
|
||||
_times(&tms);
|
||||
times(&tms);
|
||||
/* Assume that time_t can be converted to clock_t for Sys5 */
|
||||
return tms.tms_utime;
|
||||
#else
|
||||
struct tbuffer tbuffer;
|
||||
|
||||
_times(&tbuffer);
|
||||
return tbuffer.proc_user_time;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -8,23 +8,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(__BSD4_2)
|
||||
|
||||
extern int _gettimeofday(struct timeval* tp, struct timezone* tzp);
|
||||
|
||||
#elif !defined(_POSIX_SOURCE) && !defined(__USG)
|
||||
#if !defined(_MINIX) /* MINIX has no ftime() */
|
||||
struct timeb
|
||||
{
|
||||
long time;
|
||||
unsigned short millitm;
|
||||
short timezone;
|
||||
short dstflag;
|
||||
};
|
||||
void _ftime(struct timeb* bp);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "loc_time.h"
|
||||
|
||||
#define RULE_LEN 120
|
||||
|
@ -42,15 +25,8 @@ long _dst_off = 60 * 60;
|
|||
int _daylight = 0;
|
||||
char* _tzname[2] = { ntstr, dststr };
|
||||
|
||||
#if defined(__USG) || defined(_POSIX_SOURCE)
|
||||
char* tzname[2] = { ntstr, dststr };
|
||||
|
||||
#if defined(__USG)
|
||||
long timezone = 0;
|
||||
int daylight = 0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static struct dsttype
|
||||
{
|
||||
char ds_type; /* Unknown, Julian, Zero-based or M */
|
||||
|
@ -427,37 +403,10 @@ parseTZ(const char* p)
|
|||
|
||||
void _tzset(void)
|
||||
{
|
||||
#if defined(__BSD4_2)
|
||||
|
||||
struct timeval tv;
|
||||
struct timezone tz;
|
||||
|
||||
_gettimeofday(&tv, &tz);
|
||||
_daylight = tz.tz_dsttime;
|
||||
_timezone = tz.tz_minuteswest * 60L;
|
||||
|
||||
#elif !defined(_POSIX_SOURCE) && !defined(__USG)
|
||||
|
||||
#if !defined(_MINIX) /* MINIX has no ftime() */
|
||||
struct timeb tim;
|
||||
|
||||
_ftime(&tim);
|
||||
_timezone = tim.timezone * 60L;
|
||||
_daylight = tim.dstflag;
|
||||
#endif
|
||||
|
||||
#endif /* !_POSIX_SOURCE && !__USG */
|
||||
|
||||
parseTZ(getenv("TZ")); /* should go inside #if */
|
||||
|
||||
#if defined(__USG) || defined(_POSIX_SOURCE)
|
||||
tzname[0] = _tzname[0];
|
||||
tzname[1] = _tzname[1];
|
||||
#if defined(__USG)
|
||||
timezone = _timezone;
|
||||
daylight = _daylight;
|
||||
#endif
|
||||
#endif /* __USG || _POSIX_SOURCE */
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
@ -3,4 +3,6 @@
|
|||
|
||||
#define ACKCONF_TIME_IS_A_SYSCALL
|
||||
|
||||
#define ACKCONF_WANT_STANDARD_SIGNALS 0
|
||||
|
||||
#endif
|
|
@ -1,59 +1,9 @@
|
|||
/*
|
||||
* unistd.h - standard system calls
|
||||
*/
|
||||
|
||||
#ifndef _UNISTD_H
|
||||
#define _UNISTD_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/* Types */
|
||||
|
||||
typedef int pid_t;
|
||||
typedef int mode_t;
|
||||
|
||||
/* Constants for file access (open and friends) */
|
||||
|
||||
enum
|
||||
{
|
||||
O_ACCMODE = 0x3,
|
||||
|
||||
O_RDONLY = 0,
|
||||
O_WRONLY = 1,
|
||||
O_RDWR = 2,
|
||||
|
||||
O_CREAT = 0100,
|
||||
O_TRUNC = 01000,
|
||||
O_APPEND = 02000,
|
||||
O_NONBLOCK = 04000
|
||||
};
|
||||
|
||||
/* Special variables */
|
||||
|
||||
extern char** environ;
|
||||
|
||||
/* Implemented system calls */
|
||||
|
||||
extern void _exit(int);
|
||||
extern pid_t getpid(void);
|
||||
extern int brk(void* addr);
|
||||
extern void* sbrk(int increment);
|
||||
extern int isatty(int d);
|
||||
extern off_t lseek(int fildes, off_t offset, int whence);
|
||||
extern int close(int d);
|
||||
extern int open(const char* path, int access, ...);
|
||||
extern int creat(const char* path, mode_t mode);
|
||||
extern int read(int fd, void* buffer, size_t count);
|
||||
extern int write(int fd, void* buffer, size_t count);
|
||||
|
||||
/* Unimplemented system calls (these are just prototypes to let the library
|
||||
* compile). */
|
||||
|
||||
extern int fcntl(int fd, int op, ...);
|
||||
|
||||
/* Signal handling */
|
||||
#ifndef _ACK_SIGNAL_H
|
||||
#define _ACK_SIGNAL_H
|
||||
|
||||
typedef int sig_atomic_t;
|
||||
struct sigaction;
|
||||
typedef unsigned short sigset_t;
|
||||
|
||||
#define SIG_ERR ((sighandler_t) -1) /* Error return. */
|
||||
#define SIG_DFL ((sighandler_t) 0) /* Default action. */
|
||||
|
@ -78,8 +28,4 @@ typedef int sig_atomic_t;
|
|||
#define SIGALRM 14 /* alarm clock */
|
||||
#define SIGTERM 15 /* software termination signal from kill */
|
||||
|
||||
typedef void (*sighandler_t)(int);
|
||||
extern sighandler_t signal(int signum, sighandler_t handler);
|
||||
extern int raise(int signum);
|
||||
|
||||
#endif
|
27
plat/em/include/build.lua
Normal file
27
plat/em/include/build.lua
Normal file
|
@ -0,0 +1,27 @@
|
|||
include("plat/build.lua")
|
||||
|
||||
headermap = {}
|
||||
packagemap = {}
|
||||
|
||||
local function addheader(h)
|
||||
headermap[h] = "./"..h
|
||||
packagemap["$(PLATIND)/em/include/"..h] = "./"..h
|
||||
end
|
||||
|
||||
addheader("ack/plat.h")
|
||||
addheader("sys/types.h")
|
||||
addheader("sys/timeb.h")
|
||||
addheader("ack/signal.h")
|
||||
addheader("sgtty.h")
|
||||
|
||||
acklibrary {
|
||||
name = "headers",
|
||||
hdrs = headermap
|
||||
}
|
||||
|
||||
installable {
|
||||
name = "pkg",
|
||||
map = packagemap
|
||||
}
|
||||
|
||||
|
|
@ -3,9 +3,14 @@
|
|||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*/
|
||||
#ifndef _SYS_TIMEB_H
|
||||
#define _SYS_TIMEB_H
|
||||
|
||||
struct timeb {
|
||||
time_t time;
|
||||
unsigned short millitm;
|
||||
short timezone;
|
||||
short dstflag;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -11,8 +11,8 @@ typedef unsigned int ino_t;
|
|||
typedef unsigned short mode_t;
|
||||
typedef unsigned short nlink_t;
|
||||
typedef int pid_t;
|
||||
typedef ptrdiff_t ssize_t;
|
||||
typedef unsigned int uid_t;
|
||||
typedef unsigned long time_t;
|
||||
typedef long time_t;
|
||||
typedef int suseconds_t;
|
||||
|
||||
#endif
|
|
@ -1,9 +0,0 @@
|
|||
#
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
exp $_alarm
|
||||
pro $_alarm,0
|
||||
lol 0
|
||||
loc 27
|
||||
mon
|
||||
ret EM_WSIZE
|
||||
end
|
|
@ -1,54 +0,0 @@
|
|||
#
|
||||
#include <em_abs.h>
|
||||
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
|
||||
.1
|
||||
bss EM_PSIZE,0,0
|
||||
.2
|
||||
bss EM_WSIZE,0,0
|
||||
|
||||
pro $ctch,0
|
||||
lol 0
|
||||
loc EHEAP
|
||||
beq *1
|
||||
lae .1
|
||||
loi EM_PSIZE
|
||||
sig
|
||||
asp EM_PSIZE
|
||||
lol 0
|
||||
trp
|
||||
rtt
|
||||
1
|
||||
loc 1
|
||||
ste .2
|
||||
rtt
|
||||
end
|
||||
|
||||
|
||||
exp $_brk
|
||||
pro $_brk,0
|
||||
lpi $ctch
|
||||
sig
|
||||
lae .1
|
||||
sti EM_PSIZE
|
||||
loc 0
|
||||
ste .2
|
||||
lal 0
|
||||
loi EM_PSIZE
|
||||
str 2 ; The - possibly - occurring trap is caught
|
||||
lae .1
|
||||
loi EM_PSIZE
|
||||
sig
|
||||
asp EM_PSIZE
|
||||
loe .2
|
||||
zgt *1
|
||||
zer EM_PSIZE
|
||||
ret EM_PSIZE
|
||||
1
|
||||
loc -1
|
||||
loc EM_WSIZE
|
||||
loc EM_PSIZE
|
||||
cii
|
||||
ret EM_PSIZE
|
||||
end
|
|
@ -1,15 +0,0 @@
|
|||
#
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
exp $_close
|
||||
pro $_close,0
|
||||
lol 0
|
||||
loc 6
|
||||
mon
|
||||
zne *1
|
||||
loc 0
|
||||
ret EM_WSIZE
|
||||
1
|
||||
ste errno
|
||||
loc -1
|
||||
ret EM_WSIZE
|
||||
end
|
|
@ -1,14 +0,0 @@
|
|||
#
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
exp $_creat
|
||||
pro $_creat,0
|
||||
lal 0
|
||||
loi EM_WSIZE+EM_PSIZE
|
||||
loc 8
|
||||
mon
|
||||
zeq *1
|
||||
ste errno ; since e==r0
|
||||
loc -1
|
||||
1
|
||||
ret EM_WSIZE
|
||||
end
|
|
@ -1,14 +0,0 @@
|
|||
#
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
exp $_dup
|
||||
pro $_dup,0
|
||||
lol 0
|
||||
dup EM_WSIZE
|
||||
loc 41
|
||||
mon
|
||||
zeq *1
|
||||
ste errno
|
||||
loc -1
|
||||
1
|
||||
ret EM_WSIZE
|
||||
end
|
|
@ -1,16 +0,0 @@
|
|||
#
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
exp $_dup2
|
||||
pro $_dup2,0
|
||||
lal 0
|
||||
loi 2*EM_WSIZE
|
||||
loc 64
|
||||
ior EM_WSIZE
|
||||
loc 41
|
||||
mon
|
||||
zeq *1
|
||||
ste errno
|
||||
loc -1
|
||||
1
|
||||
ret EM_WSIZE
|
||||
end
|
|
@ -1,15 +0,0 @@
|
|||
#
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
exp $_execl
|
||||
pro $_execl,0
|
||||
lae environ
|
||||
loi EM_PSIZE
|
||||
lal EM_PSIZE
|
||||
lal 0
|
||||
loi EM_PSIZE
|
||||
loc 59
|
||||
mon
|
||||
ste errno
|
||||
loc -1
|
||||
ret EM_WSIZE
|
||||
end
|
|
@ -1,12 +0,0 @@
|
|||
#
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
exp $_execve
|
||||
pro $_execve,0
|
||||
lal 0
|
||||
loi 3*EM_PSIZE
|
||||
loc 59
|
||||
mon
|
||||
ste errno
|
||||
loc -1
|
||||
ret EM_WSIZE
|
||||
end
|
|
@ -1,18 +0,0 @@
|
|||
#
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
|
||||
exp $_fork
|
||||
pro $_fork,0
|
||||
loc 2
|
||||
mon
|
||||
zeq *1
|
||||
ste errno
|
||||
loc -1
|
||||
ret EM_WSIZE
|
||||
1
|
||||
zeq *2
|
||||
asp EM_WSIZE
|
||||
loc 0
|
||||
2
|
||||
ret EM_WSIZE
|
||||
end
|
|
@ -1,16 +0,0 @@
|
|||
#
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
exp $_fstat
|
||||
pro $_fstat,0
|
||||
lal 0
|
||||
loi EM_WSIZE+EM_PSIZE
|
||||
loc 28
|
||||
mon
|
||||
zne *1
|
||||
loc 0
|
||||
ret EM_WSIZE
|
||||
1
|
||||
ste errno
|
||||
loc -1
|
||||
ret EM_WSIZE
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
#
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
exp $_ftime
|
||||
pro $_ftime,0
|
||||
lal 0
|
||||
loi EM_PSIZE
|
||||
loc 35
|
||||
mon
|
||||
zne *1
|
||||
loc 0
|
||||
bra *2
|
||||
1
|
||||
ste errno
|
||||
loc -1
|
||||
2
|
||||
ret EM_WSIZE
|
||||
end
|
|
@ -1,8 +0,0 @@
|
|||
#
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
exp $_getpid
|
||||
pro $_getpid,0
|
||||
loc 20
|
||||
mon
|
||||
ret EM_WSIZE
|
||||
end
|
|
@ -1,6 +0,0 @@
|
|||
/* $Id$ */
|
||||
#include <sgtty.h>
|
||||
int
|
||||
_gtty(fildes,argp) int fildes ; struct sgttyb *argp ; {
|
||||
return _ioctl(fildes,TIOCGETP,argp) ;
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
#
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
exp $_ioctl
|
||||
pro $_ioctl,0
|
||||
lal 0
|
||||
loi EM_PSIZE+2*EM_WSIZE
|
||||
loc 54
|
||||
mon
|
||||
zne *1
|
||||
loc 0
|
||||
ret EM_WSIZE
|
||||
1
|
||||
ste errno
|
||||
loc -1
|
||||
ret EM_WSIZE
|
||||
end
|
|
@ -1,15 +0,0 @@
|
|||
#
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
exp $_kill
|
||||
pro $_kill,0
|
||||
ldl 0
|
||||
loc 37
|
||||
mon
|
||||
zne *1
|
||||
loc 0
|
||||
ret EM_WSIZE
|
||||
1
|
||||
ste errno
|
||||
loc -1
|
||||
ret EM_WSIZE
|
||||
end
|
|
@ -1,16 +0,0 @@
|
|||
#
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
exp $_link
|
||||
pro $_link,0
|
||||
lal 0
|
||||
loi 2*EM_PSIZE
|
||||
loc 9
|
||||
mon
|
||||
zne *1
|
||||
loc 0
|
||||
ret EM_WSIZE
|
||||
1
|
||||
ste errno
|
||||
loc -1
|
||||
ret EM_WSIZE
|
||||
end
|
|
@ -1,33 +0,0 @@
|
|||
#
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
exp $_lseek
|
||||
pro $_lseek,0
|
||||
lal 0
|
||||
loi 4*EM_WSIZE
|
||||
loc 19
|
||||
mon
|
||||
zeq *1
|
||||
ste errno
|
||||
#if EM_WSIZE==1
|
||||
ldc -1
|
||||
loc 2
|
||||
loc 4
|
||||
cii
|
||||
#endif
|
||||
#if EM_WSIZE==2
|
||||
ldc -1
|
||||
#endif
|
||||
#if EM_WSIZE==4
|
||||
loc -1
|
||||
#endif
|
||||
1
|
||||
#if EM_WSIZE==1
|
||||
ret 4*EM_WSIZE
|
||||
#endif
|
||||
#if EM_WSIZE==2
|
||||
ret 2*EM_WSIZE
|
||||
#endif
|
||||
#if EM_WSIZE==4
|
||||
ret EM_WSIZE
|
||||
#endif
|
||||
end
|
|
@ -1,14 +0,0 @@
|
|||
#
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
exp $_open
|
||||
pro $_open,0
|
||||
lal 0
|
||||
loi EM_WSIZE+EM_PSIZE
|
||||
loc 5
|
||||
mon
|
||||
zeq *1
|
||||
ste errno
|
||||
loc -1
|
||||
1
|
||||
ret EM_WSIZE
|
||||
end
|
|
@ -1,8 +0,0 @@
|
|||
#
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
exp $_pause
|
||||
pro $_pause,0
|
||||
loc 29
|
||||
mon
|
||||
ret 0
|
||||
end
|
|
@ -1,18 +0,0 @@
|
|||
#
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
exp $_pipe
|
||||
pro $_pipe,0
|
||||
loc 42
|
||||
mon
|
||||
zeq *1
|
||||
ste errno
|
||||
loc -1
|
||||
ret EM_WSIZE
|
||||
1
|
||||
lal 0
|
||||
loi EM_PSIZE
|
||||
stf EM_WSIZE
|
||||
sil 0
|
||||
loc 0
|
||||
ret EM_WSIZE
|
||||
end
|
|
@ -1,23 +0,0 @@
|
|||
#
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
exp $_read
|
||||
pro $_read,0
|
||||
lol EM_WSIZE+EM_PSIZE
|
||||
loc EM_WSIZE
|
||||
loc EM_PSIZE
|
||||
ciu
|
||||
lal 0
|
||||
loi EM_WSIZE+EM_PSIZE
|
||||
loc 3
|
||||
mon
|
||||
zne *1
|
||||
loc EM_PSIZE
|
||||
loc EM_WSIZE
|
||||
cui
|
||||
bra *2
|
||||
1
|
||||
ste errno
|
||||
loc -1
|
||||
2
|
||||
ret EM_WSIZE
|
||||
end
|
|
@ -1,60 +0,0 @@
|
|||
#
|
||||
#include <em_abs.h>
|
||||
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
|
||||
.1
|
||||
bss EM_PSIZE,0,0
|
||||
.2
|
||||
bss EM_WSIZE,0,0
|
||||
|
||||
pro $ctch,0
|
||||
lol 0
|
||||
loc EHEAP
|
||||
beq *1
|
||||
lae .1
|
||||
loi EM_PSIZE
|
||||
sig
|
||||
asp EM_PSIZE
|
||||
lol 0
|
||||
trp
|
||||
rtt
|
||||
1
|
||||
loc 1
|
||||
ste .2
|
||||
rtt
|
||||
end
|
||||
|
||||
|
||||
exp $_sbrk
|
||||
pro $_sbrk,0
|
||||
lor 2
|
||||
lor 2
|
||||
lpi $ctch
|
||||
sig
|
||||
lae .1
|
||||
sti EM_PSIZE
|
||||
loc 0
|
||||
ste .2
|
||||
lol 0
|
||||
ads EM_WSIZE ; this is the new heap pointer, but watch out for overflow!
|
||||
dup EM_PSIZE
|
||||
lor 2
|
||||
cmp ; compare with old heap pointer
|
||||
zlt *1
|
||||
str 2 ; The - possibly - occurring trap is caught
|
||||
lae .1
|
||||
loi EM_PSIZE
|
||||
sig
|
||||
asp EM_PSIZE
|
||||
loe .2
|
||||
zgt *1
|
||||
ret EM_PSIZE
|
||||
1
|
||||
asp EM_PSIZE
|
||||
loc -1
|
||||
loc EM_WSIZE
|
||||
loc EM_PSIZE
|
||||
cii
|
||||
ret EM_PSIZE
|
||||
end
|
|
@ -1,6 +0,0 @@
|
|||
/* $Id$ */
|
||||
#include <sgtty.h>
|
||||
int
|
||||
_stty(fildes,argp) int fildes ; struct sgttyb *argp ; {
|
||||
return _ioctl(fildes,TIOCSETP,argp) ;
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
#
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
exp $_times
|
||||
pro $_times,0
|
||||
lal 0
|
||||
loi EM_PSIZE
|
||||
loc 43
|
||||
mon
|
||||
ret 0
|
||||
end
|
|
@ -1,16 +0,0 @@
|
|||
#
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
exp $_unlink
|
||||
pro $_unlink,0
|
||||
lal 0
|
||||
loi EM_PSIZE
|
||||
loc 10
|
||||
mon
|
||||
zne *1
|
||||
loc 0
|
||||
ret EM_WSIZE
|
||||
1
|
||||
ste errno
|
||||
loc -1
|
||||
ret EM_WSIZE
|
||||
end
|
|
@ -1,33 +0,0 @@
|
|||
#
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
#if EM_WSIZE<4
|
||||
#define STATUS_SIZE 2
|
||||
#else
|
||||
#define STATUS_SIZE EM_WSIZE
|
||||
#endif
|
||||
exp $_wait
|
||||
pro $_wait,0
|
||||
loc 7
|
||||
mon
|
||||
zne *1
|
||||
lal 0
|
||||
loi EM_PSIZE
|
||||
zer EM_PSIZE
|
||||
cms EM_PSIZE
|
||||
zeq *2
|
||||
#if EM_WSIZE==1
|
||||
lal 0
|
||||
loi EM_PSIZE
|
||||
sti 2 ; 2 bytes, not one int!
|
||||
#else
|
||||
sil 0
|
||||
#endif
|
||||
ret EM_WSIZE
|
||||
2
|
||||
asp STATUS_SIZE
|
||||
ret EM_WSIZE
|
||||
1
|
||||
ste errno
|
||||
loc -1
|
||||
ret EM_WSIZE
|
||||
end
|
|
@ -1,23 +0,0 @@
|
|||
#
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
exp $_write
|
||||
pro $_write,0
|
||||
lol EM_WSIZE+EM_PSIZE
|
||||
loc EM_WSIZE
|
||||
loc EM_PSIZE
|
||||
ciu
|
||||
lal 0
|
||||
loi EM_WSIZE+EM_PSIZE
|
||||
loc 4
|
||||
mon
|
||||
zne *1
|
||||
loc EM_PSIZE
|
||||
loc EM_WSIZE
|
||||
cui
|
||||
bra *2
|
||||
1
|
||||
ste errno
|
||||
loc -1
|
||||
2
|
||||
ret EM_WSIZE
|
||||
end
|
|
@ -24,7 +24,7 @@ var SIZE_FLAG=-sx
|
|||
# Override the setting in fe so that files compiled for this platform can see
|
||||
# the platform-specific headers.
|
||||
|
||||
var C_INCLUDES=-I{PLATFORMDIR}/include -I{EM}/share/ack/include/ansi
|
||||
var C_INCLUDES=-I{EM}/share/ack/em/include -I{EM}/share/ack/include/ansi
|
||||
|
||||
name asld
|
||||
from .k.m.a.g
|
||||
|
|
|
@ -1,27 +1,4 @@
|
|||
include("plat/build.lua")
|
||||
|
||||
headermap = {}
|
||||
packagemap = {}
|
||||
|
||||
local function addheader(h)
|
||||
headermap[h] = "./"..h
|
||||
packagemap["$(PLATIND)/em22/include/"..h] = "./"..h
|
||||
end
|
||||
|
||||
addheader("ack/plat.h")
|
||||
addheader("sys/types.h")
|
||||
addheader("sys/timeb.h")
|
||||
addheader("unistd.h")
|
||||
addheader("sgtty.h")
|
||||
|
||||
acklibrary {
|
||||
name = "headers",
|
||||
hdrs = headermap
|
||||
}
|
||||
|
||||
installable {
|
||||
name = "pkg",
|
||||
map = packagemap
|
||||
map = { "plat/em/include+pkg" }
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue