From: David Given Date: Sat, 23 Jun 2018 13:57:57 +0000 (+0200) Subject: Get em22 working. Remove the leading-underscore system calls from its libsys. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=538eefb57395cdae64bd49dd44b09dd6c53db682;p=ack.git Get em22 working. Remove the leading-underscore system calls from its libsys. --- diff --git a/build.lua b/build.lua index 8175af520..9bce99f90 100644 --- a/build.lua +++ b/build.lua @@ -16,7 +16,7 @@ vars.plats = { "pc86", "rpi", "pdpv7", --- "em22", + "em22", } vars.plats_with_tests = { "linux68k", diff --git a/lang/cem/libcc.ansi/build.lua b/lang/cem/libcc.ansi/build.lua index d5e33a6e2..4c89867af 100644 --- a/lang/cem/libcc.ansi/build.lua +++ b/lang/cem/libcc.ansi/build.lua @@ -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 = { diff --git a/lang/cem/libcc.ansi/headers/ack/config.h b/lang/cem/libcc.ansi/headers/ack/config.h index 84174a11d..ae397dbfe 100644 --- a/lang/cem/libcc.ansi/headers/ack/config.h +++ b/lang/cem/libcc.ansi/headers/ack/config.h @@ -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 diff --git a/lang/cem/libcc.ansi/headers/sys/times.h b/lang/cem/libcc.ansi/headers/sys/times.h new file mode 100644 index 000000000..8311a807d --- /dev/null +++ b/lang/cem/libcc.ansi/headers/sys/times.h @@ -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 diff --git a/lang/cem/libcc.ansi/headers/unistd.h b/lang/cem/libcc.ansi/headers/unistd.h index b088f9559..ef3b81689 100644 --- a/lang/cem/libcc.ansi/headers/unistd.h +++ b/lang/cem/libcc.ansi/headers/unistd.h @@ -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); diff --git a/lang/cem/libcc.ansi/misc/getpass.c b/lang/cem/libcc.ansi/misc/getpass.c index 4b21512ee..a24c65dfd 100644 --- a/lang/cem/libcc.ansi/misc/getpass.c +++ b/lang/cem/libcc.ansi/misc/getpass.c @@ -6,41 +6,67 @@ #include #include #include -#include #include -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 +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 diff --git a/lang/cem/libcc.ansi/misc/isatty.c b/lang/cem/libcc.ansi/misc/isatty.c index cda06f4dc..a2d3f78e2 100644 --- a/lang/cem/libcc.ansi/misc/isatty.c +++ b/lang/cem/libcc.ansi/misc/isatty.c @@ -3,9 +3,16 @@ */ /* $Id$ */ -int _isatty(int d); +#include -int isatty(int d) +#if ACKCONF_WANT_TERMIOS + +#include +int isatty(int fd) { - return _isatty(d); + struct termios dummy; + + return(tcgetattr(fd, &dummy) == 0); } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/isatty.c b/lang/cem/libcc.ansi/stdio/isatty.c deleted file mode 100644 index 97d7ca442..000000000 --- a/lang/cem/libcc.ansi/stdio/isatty.c +++ /dev/null @@ -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; -} diff --git a/lang/cem/libcc.ansi/stdlib/system.c b/lang/cem/libcc.ansi/stdlib/system.c index ba31b0477..49dba6318 100644 --- a/lang/cem/libcc.ansi/stdlib/system.c +++ b/lang/cem/libcc.ansi/stdlib/system.c @@ -4,19 +4,10 @@ */ /* $Id$ */ -#if defined(_POSIX_SOURCE) #include -#endif #include #include - -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 #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; diff --git a/lang/cem/libcc.ansi/time/clock.c b/lang/cem/libcc.ansi/time/clock.c index e5d25779f..f41e12dd4 100644 --- a/lang/cem/libcc.ansi/time/clock.c +++ b/lang/cem/libcc.ansi/time/clock.c @@ -4,80 +4,14 @@ /* $Id$ */ #include - -#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 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 } diff --git a/lang/cem/libcc.ansi/time/misc.c b/lang/cem/libcc.ansi/time/misc.c index 8a21fb561..6a182307f 100644 --- a/lang/cem/libcc.ansi/time/misc.c +++ b/lang/cem/libcc.ansi/time/misc.c @@ -8,23 +8,6 @@ #include #include -#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 diff --git a/plat/em22/include/ack/plat.h b/plat/em/include/ack/plat.h similarity index 66% rename from plat/em22/include/ack/plat.h rename to plat/em/include/ack/plat.h index 87be3d0ec..585a6abf7 100644 --- a/plat/em22/include/ack/plat.h +++ b/plat/em/include/ack/plat.h @@ -3,4 +3,6 @@ #define ACKCONF_TIME_IS_A_SYSCALL +#define ACKCONF_WANT_STANDARD_SIGNALS 0 + #endif diff --git a/plat/em22/include/unistd.h b/plat/em/include/ack/signal.h similarity index 51% rename from plat/em22/include/unistd.h rename to plat/em/include/ack/signal.h index 7b455738f..6b8edd85d 100644 --- a/plat/em22/include/unistd.h +++ b/plat/em/include/ack/signal.h @@ -1,59 +1,9 @@ -/* - * unistd.h - standard system calls - */ - -#ifndef _UNISTD_H -#define _UNISTD_H - -#include - -/* 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 diff --git a/plat/em/include/build.lua b/plat/em/include/build.lua new file mode 100644 index 000000000..b59e64dea --- /dev/null +++ b/plat/em/include/build.lua @@ -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 +} + + diff --git a/plat/em22/include/sgtty.h b/plat/em/include/sgtty.h similarity index 100% rename from plat/em22/include/sgtty.h rename to plat/em/include/sgtty.h diff --git a/plat/em22/include/sys/timeb.h b/plat/em/include/sys/timeb.h similarity index 83% rename from plat/em22/include/sys/timeb.h rename to plat/em/include/sys/timeb.h index 92f48ed9d..5a8286a69 100644 --- a/plat/em22/include/sys/timeb.h +++ b/plat/em/include/sys/timeb.h @@ -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 diff --git a/plat/em22/include/sys/types.h b/plat/em/include/sys/types.h similarity index 86% rename from plat/em22/include/sys/types.h rename to plat/em/include/sys/types.h index 8d431b051..e1330271f 100644 --- a/plat/em22/include/sys/types.h +++ b/plat/em/include/sys/types.h @@ -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 diff --git a/plat/em/libsys/_alarm.e b/plat/em/libsys/_alarm.e deleted file mode 100644 index dc530b2bd..000000000 --- a/plat/em/libsys/_alarm.e +++ /dev/null @@ -1,9 +0,0 @@ -# - mes 2,EM_WSIZE,EM_PSIZE - exp $_alarm - pro $_alarm,0 - lol 0 - loc 27 - mon - ret EM_WSIZE - end diff --git a/plat/em/libsys/_brk.e b/plat/em/libsys/_brk.e deleted file mode 100644 index d7dd6e470..000000000 --- a/plat/em/libsys/_brk.e +++ /dev/null @@ -1,54 +0,0 @@ -# -#include - - 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 diff --git a/plat/em/libsys/_close.e b/plat/em/libsys/_close.e deleted file mode 100644 index e22c98245..000000000 --- a/plat/em/libsys/_close.e +++ /dev/null @@ -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 diff --git a/plat/em/libsys/_creat.e b/plat/em/libsys/_creat.e deleted file mode 100644 index 0d883dd78..000000000 --- a/plat/em/libsys/_creat.e +++ /dev/null @@ -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 diff --git a/plat/em/libsys/_dup.e b/plat/em/libsys/_dup.e deleted file mode 100644 index 9d117000a..000000000 --- a/plat/em/libsys/_dup.e +++ /dev/null @@ -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 diff --git a/plat/em/libsys/_dup2.e b/plat/em/libsys/_dup2.e deleted file mode 100644 index 719e3a158..000000000 --- a/plat/em/libsys/_dup2.e +++ /dev/null @@ -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 diff --git a/plat/em/libsys/_execl.e b/plat/em/libsys/_execl.e deleted file mode 100644 index 3ce7ed5c8..000000000 --- a/plat/em/libsys/_execl.e +++ /dev/null @@ -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 diff --git a/plat/em/libsys/_execve.e b/plat/em/libsys/_execve.e deleted file mode 100644 index 023a5b8ba..000000000 --- a/plat/em/libsys/_execve.e +++ /dev/null @@ -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 diff --git a/plat/em/libsys/_fork.e b/plat/em/libsys/_fork.e deleted file mode 100644 index 610414009..000000000 --- a/plat/em/libsys/_fork.e +++ /dev/null @@ -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 diff --git a/plat/em/libsys/_fstat.e b/plat/em/libsys/_fstat.e deleted file mode 100644 index 336e1c833..000000000 --- a/plat/em/libsys/_fstat.e +++ /dev/null @@ -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 diff --git a/plat/em/libsys/_ftime.e b/plat/em/libsys/_ftime.e deleted file mode 100644 index 46190b6b3..000000000 --- a/plat/em/libsys/_ftime.e +++ /dev/null @@ -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 diff --git a/plat/em/libsys/_getpid.e b/plat/em/libsys/_getpid.e deleted file mode 100644 index c4527b9c6..000000000 --- a/plat/em/libsys/_getpid.e +++ /dev/null @@ -1,8 +0,0 @@ -# - mes 2,EM_WSIZE,EM_PSIZE - exp $_getpid - pro $_getpid,0 - loc 20 - mon - ret EM_WSIZE - end diff --git a/plat/em/libsys/_gtty.c b/plat/em/libsys/_gtty.c deleted file mode 100644 index 7b7cf08c2..000000000 --- a/plat/em/libsys/_gtty.c +++ /dev/null @@ -1,6 +0,0 @@ -/* $Id$ */ -#include -int -_gtty(fildes,argp) int fildes ; struct sgttyb *argp ; { - return _ioctl(fildes,TIOCGETP,argp) ; -} diff --git a/plat/em/libsys/_ioctl.e b/plat/em/libsys/_ioctl.e deleted file mode 100644 index ce4126269..000000000 --- a/plat/em/libsys/_ioctl.e +++ /dev/null @@ -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 diff --git a/plat/em/libsys/_kill.e b/plat/em/libsys/_kill.e deleted file mode 100644 index fed5ec776..000000000 --- a/plat/em/libsys/_kill.e +++ /dev/null @@ -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 diff --git a/plat/em/libsys/_link.e b/plat/em/libsys/_link.e deleted file mode 100644 index 21d3a86bc..000000000 --- a/plat/em/libsys/_link.e +++ /dev/null @@ -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 diff --git a/plat/em/libsys/_lseek.e b/plat/em/libsys/_lseek.e deleted file mode 100644 index a2b160a9b..000000000 --- a/plat/em/libsys/_lseek.e +++ /dev/null @@ -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 diff --git a/plat/em/libsys/_open.e b/plat/em/libsys/_open.e deleted file mode 100644 index 0f3d511fc..000000000 --- a/plat/em/libsys/_open.e +++ /dev/null @@ -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 diff --git a/plat/em/libsys/_pause.e b/plat/em/libsys/_pause.e deleted file mode 100644 index 81a9cabf1..000000000 --- a/plat/em/libsys/_pause.e +++ /dev/null @@ -1,8 +0,0 @@ -# - mes 2,EM_WSIZE,EM_PSIZE - exp $_pause - pro $_pause,0 - loc 29 - mon - ret 0 - end diff --git a/plat/em/libsys/_pipe.e b/plat/em/libsys/_pipe.e deleted file mode 100644 index faed4f683..000000000 --- a/plat/em/libsys/_pipe.e +++ /dev/null @@ -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 diff --git a/plat/em/libsys/_read.e b/plat/em/libsys/_read.e deleted file mode 100644 index 0c47d271f..000000000 --- a/plat/em/libsys/_read.e +++ /dev/null @@ -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 diff --git a/plat/em/libsys/_sbrk.e b/plat/em/libsys/_sbrk.e deleted file mode 100644 index cd59228f1..000000000 --- a/plat/em/libsys/_sbrk.e +++ /dev/null @@ -1,60 +0,0 @@ -# -#include - - 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 diff --git a/plat/em/libsys/_stty.c b/plat/em/libsys/_stty.c deleted file mode 100644 index b5d1f9a6f..000000000 --- a/plat/em/libsys/_stty.c +++ /dev/null @@ -1,6 +0,0 @@ -/* $Id$ */ -#include -int -_stty(fildes,argp) int fildes ; struct sgttyb *argp ; { - return _ioctl(fildes,TIOCSETP,argp) ; -} diff --git a/plat/em/libsys/_times.e b/plat/em/libsys/_times.e deleted file mode 100644 index a94fa4f45..000000000 --- a/plat/em/libsys/_times.e +++ /dev/null @@ -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 diff --git a/plat/em/libsys/_unlink.e b/plat/em/libsys/_unlink.e deleted file mode 100644 index 7a72b3e02..000000000 --- a/plat/em/libsys/_unlink.e +++ /dev/null @@ -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 diff --git a/plat/em/libsys/_wait.e b/plat/em/libsys/_wait.e deleted file mode 100644 index 3ed01f040..000000000 --- a/plat/em/libsys/_wait.e +++ /dev/null @@ -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 diff --git a/plat/em/libsys/_write.e b/plat/em/libsys/_write.e deleted file mode 100644 index f83775d60..000000000 --- a/plat/em/libsys/_write.e +++ /dev/null @@ -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 diff --git a/plat/em22/descr b/plat/em22/descr index 27e0c0f6c..c8610ddaf 100644 --- a/plat/em22/descr +++ b/plat/em22/descr @@ -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 diff --git a/plat/em22/include/build.lua b/plat/em22/include/build.lua index ab7564b5c..0a2c69de1 100644 --- a/plat/em22/include/build.lua +++ b/plat/em22/include/build.lua @@ -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" } } - -