From 74d166ef9aea04be49abb9fc5284d9e99cf6a6a9 Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 23 Jun 2018 15:18:26 +0200 Subject: [PATCH] Get the pdp7 plat working; remove the leading-underscore syscalls. --- build.lua | 2 +- plat/pdpv7/boot.s | 4 +- plat/pdpv7/include/build.lua | 2 +- plat/pdpv7/include/sys/select.h | 10 ++- plat/pdpv7/include/sys/types.h | 9 +++ plat/pdpv7/include/unistd.h | 106 -------------------------------- plat/pdpv7/libsys/_alarm.s | 12 ---- plat/pdpv7/libsys/_close.s | 14 ----- plat/pdpv7/libsys/_creat.s | 17 ----- plat/pdpv7/libsys/_dup.s | 20 ------ plat/pdpv7/libsys/_execl.s | 19 ------ plat/pdpv7/libsys/_fork.s | 15 ----- plat/pdpv7/libsys/_fstat.s | 19 ------ plat/pdpv7/libsys/_ftime.s | 12 ---- plat/pdpv7/libsys/_getpid.s | 6 -- plat/pdpv7/libsys/_gtty.c | 7 --- plat/pdpv7/libsys/_ioctl.s | 20 ------ plat/pdpv7/libsys/_kill.s | 20 ------ plat/pdpv7/libsys/_link.s | 19 ------ plat/pdpv7/libsys/_lseek.s | 20 ------ plat/pdpv7/libsys/_open.s | 17 ----- plat/pdpv7/libsys/_pause.s | 6 -- plat/pdpv7/libsys/_pipe.s | 18 ------ plat/pdpv7/libsys/_read.s | 18 ------ plat/pdpv7/libsys/_sbrk.s | 38 ------------ plat/pdpv7/libsys/_unlink.s | 18 ------ plat/pdpv7/libsys/_wait.s | 16 ----- plat/pdpv7/libsys/_write.s | 18 ------ 28 files changed, 22 insertions(+), 480 deletions(-) create mode 100644 plat/pdpv7/include/sys/types.h delete mode 100644 plat/pdpv7/include/unistd.h delete mode 100644 plat/pdpv7/libsys/_alarm.s delete mode 100644 plat/pdpv7/libsys/_close.s delete mode 100644 plat/pdpv7/libsys/_creat.s delete mode 100644 plat/pdpv7/libsys/_dup.s delete mode 100644 plat/pdpv7/libsys/_execl.s delete mode 100644 plat/pdpv7/libsys/_fork.s delete mode 100644 plat/pdpv7/libsys/_fstat.s delete mode 100644 plat/pdpv7/libsys/_ftime.s delete mode 100644 plat/pdpv7/libsys/_getpid.s delete mode 100644 plat/pdpv7/libsys/_gtty.c delete mode 100644 plat/pdpv7/libsys/_ioctl.s delete mode 100644 plat/pdpv7/libsys/_kill.s delete mode 100644 plat/pdpv7/libsys/_link.s delete mode 100644 plat/pdpv7/libsys/_lseek.s delete mode 100644 plat/pdpv7/libsys/_open.s delete mode 100644 plat/pdpv7/libsys/_pause.s delete mode 100644 plat/pdpv7/libsys/_pipe.s delete mode 100644 plat/pdpv7/libsys/_read.s delete mode 100644 plat/pdpv7/libsys/_sbrk.s delete mode 100644 plat/pdpv7/libsys/_unlink.s delete mode 100644 plat/pdpv7/libsys/_wait.s delete mode 100644 plat/pdpv7/libsys/_write.s diff --git a/build.lua b/build.lua index 09142dbd1..8175af520 100644 --- a/build.lua +++ b/build.lua @@ -15,7 +15,7 @@ vars.plats = { -- --"qemuppc", "pc86", "rpi", --- "pdpv7", + "pdpv7", -- "em22", } vars.plats_with_tests = { diff --git a/plat/pdpv7/boot.s b/plat/pdpv7/boot.s index a51c8d80b..a684fdb6a 100644 --- a/plat/pdpv7/boot.s +++ b/plat/pdpv7/boot.s @@ -51,9 +51,9 @@ EXIT: jsr pc,__exit sys 1 -WRITE: jmp __write +WRITE: jmp _write -BRK: jmp __brk +BRK: jmp _brk .sect .data hol0: .data2 0,0 ! line no diff --git a/plat/pdpv7/include/build.lua b/plat/pdpv7/include/build.lua index 70d9666c6..f785644b4 100644 --- a/plat/pdpv7/include/build.lua +++ b/plat/pdpv7/include/build.lua @@ -10,8 +10,8 @@ end addheader("ack/plat.h") addheader("sys/select.h") +addheader("sys/types.h") addheader("termios.h") -addheader("unistd.h") acklibrary { name = "headers", diff --git a/plat/pdpv7/include/sys/select.h b/plat/pdpv7/include/sys/select.h index 33525587f..f1841994f 100644 --- a/plat/pdpv7/include/sys/select.h +++ b/plat/pdpv7/include/sys/select.h @@ -8,6 +8,14 @@ #ifndef _SYS_SELECT_H #define _SYS_SELECT_H -#include +typedef uint32_t fd_set; + +extern int select(int nfds, fd_set *readfds, fd_set *writefds, + fd_set *exceptfds, struct timeval *timeout); + +#define FD_ZERO(set) do { *set = 0; } while (0) +#define FD_SET(fd, set) do { *set |= (1< -#include - -/* Types */ - -typedef int pid_t; -typedef int mode_t; - -typedef long suseconds_t; - -/* Time handling. */ - -struct timeval -{ - time_t tv_sec; - suseconds_t tv_usec; -}; - -struct timezone -{ - int tz_minuteswest; - int tz_dsttime; -}; /* obsolete, unused */ - -extern int gettimeofday(struct timeval* tv, struct timezone* tz); -extern int settimeofday(const struct timeval* tv, const struct timezone* tz); - -/* 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 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); -extern int unlink(const char* path); - -/* Unimplemented system calls (these are just prototypes to let the library - * compile). */ - -extern int fcntl(int fd, int op, ...); - -/* Signal handling */ - -typedef int sig_atomic_t; - -#define SIG_ERR ((sighandler_t) -1) /* Error return. */ -#define SIG_DFL ((sighandler_t) 0) /* Default action. */ -#define SIG_IGN ((sighandler_t) 1) /* Ignore signal. */ - -#define SIGABRT 6 /* Abort (ANSI) */ -#define SIGILL 11 /* Illegal instruction */ - -#define _NSIG 32 /* Biggest signal number + 1 - (not including real-time signals). */ -typedef void (*sighandler_t)(int); -extern sighandler_t signal(int signum, sighandler_t handler); -extern int raise(int signum); - -/* Select */ - -typedef uint32_t fd_set; - -extern int select(int nfds, fd_set *readfds, fd_set *writefds, - fd_set *exceptfds, struct timeval *timeout); - -#define FD_ZERO(set) do { *set = 0; } while (0) -#define FD_SET(fd, set) do { *set |= (1<