arcs.c 1.92 KB
#include "arcs.h"
#include "romloader.h"

static char *arcsErrors[] = {
	"no error",				/* ESUCCESS */
	"argument list too long",		/* E2BIG */
	"permission denied",			/* EACCESS */
	"resource temporarily unavailable",	/* EAGAIN */
	"bad file descriptor",			/* EBADF */
	"resource busy",			/* EBUSY */
	"bad addresss",				/* EFAULT */
	"invalid argument",			/* EINVAL */
	"IO error",				/* EIO */
	"is a directory",			/* EISDIR */
	"too many open files",			/* EMFILE */
	"too many links",			/* EMLINK */
	"filename too long",			/* ENAMETOOLONG */
	"no such device",			/* ENODEV */
	"no such file or directory",		/* ENOENT */
	"execute format error",			/* ENOEXEC */
	"not enough space",			/* ENOMEM */
	"no space left on device",		/* ENOSPC */
	"not a directory",			/* ENOTDIR */
	"no a tty",				/* ENOTTY */
	"media not loaded",			/* ENXIO */
	"read only filesystem",			/* EROFS */
	0,					/* 22 */
	0,					/* 23 */
	0,					/* 24 */
	0,					/* 25 */
	0,					/* 26 */
	0,					/* 27 */
	0,					/* 28 */
	0,					/* 29 */
	0,					/* 30 */
	"address not available",		/* EADDRNOTAVAIL */
	"timed out",				/* ETIMEDOUT */
	"connection closed",			/* ECONNABORTED */
	"could not connect to server",		/* ENOCONNECT */
	0
};

/*
 * ARCS stubs for calling through the SPB firmware switch.
 */

long
_ArcsOpen(char *filename, _OpenMode mode, unsigned long *fd)
{
	return(__TV->Open(filename, mode, fd));
}

long
_ArcsClose(unsigned long fd)
{
	return(__TV->Close(fd));
}

long
_ArcsRead(unsigned long fd, void *buf, unsigned long n, unsigned long *cnt)
{
	return(__TV->Read(fd, buf, n, cnt));
}

long
_ArcsWrite(unsigned long fd, void *buf, unsigned long n, unsigned long *cnt)
{
	return(__TV->Write(fd, buf, n, cnt));
}

long
_ArcsLoad(char *path, unsigned long topaddr, unsigned long *execaddr, 
	  unsigned long *lowaddr)
{
	return(__TV->Load(path,topaddr,execaddr,lowaddr));
}

void
_ArcsPerror(long error, char *string)
{
	printf("%s: %s\n", string, arcsErrors[error]);
}