Get the pdp7 plat working; remove the leading-underscore syscalls.
This commit is contained in:
parent
3e40374297
commit
74d166ef9a
|
@ -15,7 +15,7 @@ vars.plats = {
|
|||
-- --"qemuppc",
|
||||
"pc86",
|
||||
"rpi",
|
||||
-- "pdpv7",
|
||||
"pdpv7",
|
||||
-- "em22",
|
||||
}
|
||||
vars.plats_with_tests = {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -8,6 +8,14 @@
|
|||
#ifndef _SYS_SELECT_H
|
||||
#define _SYS_SELECT_H
|
||||
|
||||
#include <unistd.h>
|
||||
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<<fd); } while (0);
|
||||
#define FD_CLR(fd, set) do { *set &= ~(1<<fd); } while (0);
|
||||
#define FD_ISSET(fd, set) (*set | (1<<fd))
|
||||
|
||||
#endif
|
||||
|
|
9
plat/pdpv7/include/sys/types.h
Normal file
9
plat/pdpv7/include/sys/types.h
Normal file
|
@ -0,0 +1,9 @@
|
|||
#ifndef _SYS_TYPES_H
|
||||
#define _SYS_TYPES_H
|
||||
|
||||
typedef int pid_t;
|
||||
typedef int mode_t;
|
||||
typedef long time_t;
|
||||
typedef long suseconds_t;
|
||||
|
||||
#endif
|
|
@ -1,106 +0,0 @@
|
|||
/*
|
||||
* Raspberry Pi support library for the PDP/11
|
||||
* © 2013 David Given
|
||||
* This file is redistributable under the terms of the 3-clause BSD license.
|
||||
* See the file 'Copying' in the root of the distribution for the full text.
|
||||
*/
|
||||
|
||||
#ifndef _UNISTD_H
|
||||
#define _UNISTD_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <time.h>
|
||||
|
||||
/* 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<<fd); } while (0);
|
||||
#define FD_CLR(fd, set) do { *set &= ~(1<<fd); } while (0);
|
||||
#define FD_ISSET(fd, set) (*set | (1<<fd))
|
||||
|
||||
#endif
|
|
@ -1,12 +0,0 @@
|
|||
#include "sys.h"
|
||||
.define __alarm
|
||||
.extern _errno
|
||||
|
||||
__alarm:
|
||||
mov 2(sp),r0
|
||||
sys alarm
|
||||
bcc 1f
|
||||
mov r0,_errno
|
||||
mov $-1,r0
|
||||
1:
|
||||
rts pc
|
|
@ -1,14 +0,0 @@
|
|||
#include "sys.h"
|
||||
.define __close
|
||||
.extern _errno
|
||||
|
||||
__close:
|
||||
mov 2(sp),r0
|
||||
sys close
|
||||
bcc 1f
|
||||
mov r0,_errno
|
||||
mov $-1,r0
|
||||
rts pc
|
||||
1:
|
||||
clr r0
|
||||
rts pc
|
|
@ -1,17 +0,0 @@
|
|||
#include "sys.h"
|
||||
.define __creat
|
||||
.extern _errno
|
||||
|
||||
__creat:
|
||||
mov 2(sp),0f+2
|
||||
mov 4(sp),0f+4
|
||||
sys indir; .data2 0f
|
||||
bcc 1f
|
||||
mov r0,_errno
|
||||
mov $-1,r0
|
||||
1:
|
||||
rts pc
|
||||
.sect .data
|
||||
0:
|
||||
sys creat
|
||||
.data2 0, 0
|
|
@ -1,20 +0,0 @@
|
|||
#include "sys.h"
|
||||
.define __dup
|
||||
.define __dup2
|
||||
.extern _errno
|
||||
|
||||
__dup2:
|
||||
mov 2(sp),r0
|
||||
bis $100,r0
|
||||
br 1f
|
||||
|
||||
__dup:
|
||||
mov 2(sp),r0
|
||||
1:
|
||||
mov 4(sp),r1
|
||||
sys dup
|
||||
bcc 1f
|
||||
mov r0,_errno
|
||||
mov $-1,r0
|
||||
1:
|
||||
rts pc
|
|
@ -1,19 +0,0 @@
|
|||
#include "sys.h"
|
||||
.define __execl
|
||||
.extern _environ
|
||||
.extern _errno
|
||||
|
||||
__execl:
|
||||
mov 2(sp),0f+2
|
||||
mov sp,r0
|
||||
add $4,r0
|
||||
mov r0,0f+4
|
||||
mov _environ,0f+6
|
||||
sys indir; .data2 0f
|
||||
mov r0,_errno
|
||||
mov $-1,r0
|
||||
rts pc
|
||||
.sect .data
|
||||
0:
|
||||
sys exece
|
||||
.data2 0, 0, 0
|
|
@ -1,15 +0,0 @@
|
|||
#include "sys.h"
|
||||
.define __fork
|
||||
.extern _errno
|
||||
|
||||
__fork:
|
||||
sys fork
|
||||
br 1f
|
||||
bcc 2f
|
||||
mov r0,_errno
|
||||
mov $-1,r0
|
||||
2:
|
||||
rts pc
|
||||
1:
|
||||
clr r0
|
||||
rts pc
|
|
@ -1,19 +0,0 @@
|
|||
#include "sys.h"
|
||||
.define __fstat
|
||||
.extern _errno
|
||||
|
||||
__fstat:
|
||||
mov 2(sp),r0
|
||||
mov 4(sp),0f+2
|
||||
sys indir; .data2 0f
|
||||
bcc 1f
|
||||
mov r0,_errno
|
||||
mov $-1,r0
|
||||
rts pc
|
||||
1:
|
||||
clr r0
|
||||
rts pc
|
||||
.sect .data
|
||||
0:
|
||||
sys fstat
|
||||
.data2 0
|
|
@ -1,12 +0,0 @@
|
|||
#include "sys.h"
|
||||
.define __ftime
|
||||
|
||||
__ftime:
|
||||
mov 2(sp),0f+2
|
||||
sys indir; .data2 0f
|
||||
rts pc
|
||||
|
||||
.sect .data
|
||||
0:
|
||||
sys ftime
|
||||
.data2 0
|
|
@ -1,6 +0,0 @@
|
|||
#include "sys.h"
|
||||
.define __getpid
|
||||
|
||||
__getpid:
|
||||
sys getpid
|
||||
rts pc
|
|
@ -1,7 +0,0 @@
|
|||
int
|
||||
_gtty(fildes,argp)
|
||||
int fildes ;
|
||||
char *argp ;
|
||||
{
|
||||
return _ioctl(fildes,/*TIOCGETP*/(('t'<<8)|8),argp) ;
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
#include "sys.h"
|
||||
.define __ioctl
|
||||
.extern _errno
|
||||
|
||||
__ioctl:
|
||||
mov 2(sp),0f+2
|
||||
mov 4(sp),0f+4
|
||||
mov 6(sp),0f+6
|
||||
sys indir; .data2 0f
|
||||
bcc 1f
|
||||
mov r0,_errno
|
||||
mov $-1,r0
|
||||
rts pc
|
||||
1:
|
||||
clr r0
|
||||
rts pc
|
||||
.sect .data
|
||||
0:
|
||||
sys ioctl
|
||||
.data2 0, 0, 0
|
|
@ -1,20 +0,0 @@
|
|||
#include "sys.h"
|
||||
.define __kill
|
||||
.extern _errno
|
||||
|
||||
__kill:
|
||||
mov 2(sp),r0
|
||||
mov 4(sp),0f+2
|
||||
sys indir; .data2 0f
|
||||
bcc 1f
|
||||
mov r0,_errno
|
||||
mov $-1,r0
|
||||
rts pc
|
||||
1:
|
||||
clr r0
|
||||
rts pc
|
||||
|
||||
.sect .data
|
||||
0:
|
||||
sys kill
|
||||
.data2 0
|
|
@ -1,19 +0,0 @@
|
|||
#include "sys.h"
|
||||
.define __link
|
||||
.extern _errno
|
||||
|
||||
__link:
|
||||
mov 2(sp),0f+2
|
||||
mov 4(sp),0f+4
|
||||
sys indir; .data2 0f
|
||||
bcc 1f
|
||||
mov r0,_errno
|
||||
mov $-1,r0
|
||||
rts pc
|
||||
1:
|
||||
clr r0
|
||||
rts pc
|
||||
.sect .data
|
||||
0:
|
||||
sys link
|
||||
.data2 0, 0
|
|
@ -1,20 +0,0 @@
|
|||
#include "sys.h"
|
||||
.define __lseek
|
||||
.extern _errno
|
||||
|
||||
__lseek:
|
||||
mov 2(sp),r0
|
||||
mov 4(sp),0f+2
|
||||
mov 6(sp),0f+4
|
||||
mov 010(sp),0f+6
|
||||
sys indir; .data2 0f
|
||||
bcc 1f
|
||||
mov $-1,r1
|
||||
mov r0,_errno
|
||||
mov $-1,r0
|
||||
1:
|
||||
rts pc
|
||||
.sect .data
|
||||
0:
|
||||
sys lseek
|
||||
.data2 0, 0, 0
|
|
@ -1,17 +0,0 @@
|
|||
#include "sys.h"
|
||||
.define __open
|
||||
.extern _errno
|
||||
|
||||
__open:
|
||||
mov 2(sp),0f+2
|
||||
mov 4(sp),0f+4
|
||||
sys indir; .data2 0f
|
||||
bcc 1f
|
||||
mov r0,_errno
|
||||
mov $-1,r0
|
||||
1:
|
||||
rts pc
|
||||
.sect .data
|
||||
0:
|
||||
sys open
|
||||
.data2 0, 0
|
|
@ -1,6 +0,0 @@
|
|||
#include "sys.h"
|
||||
.define __pause
|
||||
|
||||
__pause:
|
||||
sys pause
|
||||
rts pc
|
|
@ -1,18 +0,0 @@
|
|||
#include "sys.h"
|
||||
.define __pipe
|
||||
.extern _errno
|
||||
|
||||
__pipe:
|
||||
sys pipe
|
||||
bcc 1f
|
||||
mov r0,_errno
|
||||
mov $-1,r0
|
||||
rts pc
|
||||
1:
|
||||
mov r5,-(sp)
|
||||
mov 4(sp),r5
|
||||
mov r0,(r5)+
|
||||
mov r1,(r5)
|
||||
mov (sp)+,r5
|
||||
clr r0
|
||||
rts pc
|
|
@ -1,18 +0,0 @@
|
|||
#include "sys.h"
|
||||
.define __read
|
||||
.extern _errno
|
||||
|
||||
__read:
|
||||
mov 2(sp),r0
|
||||
mov 4(sp),0f+2
|
||||
mov 6(sp),0f+4
|
||||
sys indir; .data2 0f
|
||||
bcc 1f
|
||||
mov r0,_errno
|
||||
mov $-1,r0
|
||||
1:
|
||||
rts pc
|
||||
.sect .data
|
||||
0:
|
||||
sys read
|
||||
.data2 0, 0
|
|
@ -1,38 +0,0 @@
|
|||
#include "sys.h"
|
||||
.define __sbrk
|
||||
.define __brk
|
||||
.extern _end
|
||||
.extern _errno
|
||||
|
||||
__sbrk:
|
||||
mov 2(sp),0f+2
|
||||
beq 1f
|
||||
add .limhp,0f+2
|
||||
bcs 2f
|
||||
sys indir; .data2 0f
|
||||
bcc 1f
|
||||
2:
|
||||
mov r0,_errno
|
||||
mov $-1,r0
|
||||
rts pc
|
||||
1:
|
||||
mov .limhp,r0
|
||||
add 2(sp),.limhp
|
||||
rts pc
|
||||
|
||||
__brk:
|
||||
mov 2(sp),0f+2
|
||||
sys indir; .data2 0f
|
||||
bcc 1f
|
||||
mov r0,_errno
|
||||
mov $-1,r0
|
||||
rts pc
|
||||
1:
|
||||
mov 2(sp),.limhp
|
||||
clr r0
|
||||
rts pc
|
||||
|
||||
.sect .data
|
||||
0:
|
||||
sys break
|
||||
.data2 0
|
|
@ -1,18 +0,0 @@
|
|||
#include "sys.h"
|
||||
.define __unlink
|
||||
.extern _errno
|
||||
|
||||
__unlink:
|
||||
mov 2(sp),0f+2
|
||||
sys indir; .data2 0f
|
||||
bcc 1f
|
||||
mov r0,_errno
|
||||
mov $-1,r0
|
||||
rts pc
|
||||
1:
|
||||
clr r0
|
||||
rts pc
|
||||
.sect .data
|
||||
0:
|
||||
sys unlink
|
||||
.data2 0
|
|
@ -1,16 +0,0 @@
|
|||
#include "sys.h"
|
||||
.define __wait
|
||||
.extern _errno
|
||||
|
||||
__wait:
|
||||
sys wait
|
||||
bcc 1f
|
||||
mov r0,_errno
|
||||
mov $-1,r0
|
||||
rts pc
|
||||
1:
|
||||
tst 2(sp)
|
||||
beq 1f
|
||||
mov r1,*2(sp)
|
||||
1:
|
||||
rts pc
|
|
@ -1,18 +0,0 @@
|
|||
#include "sys.h"
|
||||
.define __write
|
||||
.extern _errno
|
||||
|
||||
__write:
|
||||
mov 2(sp),r0
|
||||
mov 4(sp),0f+2
|
||||
mov 6(sp),0f+4
|
||||
sys indir; .data2 0f
|
||||
bcc 1f
|
||||
mov r0,_errno
|
||||
mov $-1,r0
|
||||
1:
|
||||
rts pc
|
||||
.sect .data
|
||||
0:
|
||||
sys write
|
||||
.data2 0, 0
|
Loading…
Reference in a new issue