All pastes #458924 Raw Edit

Miscellany

public text v1 · immutable
#458924 ·published 2007-04-26 05:31 UTC
rendered paste body
/**** ucode.c file *************
*syscalls to MTX kernel; consult 
*last notes for syscall numbers
/*******************************/

/*define ulong and ushort types:*/
typedef unsigned long  ulong;
typedef unsigned short ushort;

#include "ubios.c" 

/*0 - 10*/
int getpid()
{
   return int80(0,0,0);
}/*end int getpid()*/

int kps()
{
   /*return int80(43,0,0);*/
   return int80(1,0,0);
}/*end int kps()*/

int ufork()
{  
   return int80(5, 0, 0);
}/*end int ufork()*/

int exec(char* file)
{
   return int80(6, file, 0);
}/*end int exec(char* file)*/




/*20-40*/
int wait(int* status)
{
  return (int80(20, status, 0));
}/*end int wait(int *status)*/

int mkdir(char* filename)
{
    int80(21, filename, 0);
}/*end int mkdir(char* name)*/

int rmdir(char* name)
{
    return int80(22, name, 0);
}/*end int rmdir(char* name)*/

int creat(char* name)
{
    return int80(23, name, 0);
}/*end int creat(char* name)*/

int rm(char* name)
{
    return int80(24, name, 0);
}/*end int rm(char* name)*/

/*int kls(char* name)
{
    int80(25, name, 0);
}/*end int kls(char* name)
int chuid(int gid, int uid)int kls(char* name)
{
    int80(25, name, 0);
}/*end int kls(char* name)*/

int cd(char* name)
{
    return int80(26, name, 0);
}/*end int cd(char* name)*/

int open(char* file, int mode)
{
    return int80(28, file, mode);
}/*end int open(char* file, int mode)*/

int close(int fd)
{
    return int80(29, fd);
}/*end int close(int fd)*/

long lseek(int fd, long offset, int ww)
{
    return int80(30, fd, (long)offset, ww);
}/*end long lseek(int fd, long offset, int ww)*/

int chmod(char* s, int val)
{
	return int80(33, s, val);
}/*end int chmod(char* s, int val)*/

int chown(char* s, int uid)
{
	return int80(34, s, uid);
}/*end int chown*/

int read(int fd, char* buf, int nbytes)
{
    return int80(35, fd, buf, nbytes);
}/*end int read(int fd, int nbytes, char* buf)*/

int write(int fd, char* buf, int nbytes)
{
    return int80(36, fd, buf, nbytes);
}/*end int write(int fd, int nbytes, char *buf)*/

int stat(char *filename, struct stat* sPtr)
{   
   return int80(38, filename, sPtr);
}/*end int stat(char* filename, struct stat* sPtr)*/

int getcwd(char* cwdname)
{
    int80(39, cwdname, 0);
}/*end int getcwd(char* cwdname)*/

int pipe(int* pd)
{
    return int80(40, pd, 0);
}/*end int pipe(int* pd)*/

int dup(int fd)
{
   return int80(41, fd, 0);
}/*end int dup(int fd)*/

int dup2(int fd,int gd)
{
   return int80(42, fd, gd);
}/*end int dup2(int fd, int gd)*/

int getuid()
{
  return int80(44, 0);
}/*end int getuid()*/

int setuid(int uid)
{
  return int80(45, uid, 0);
}/*end int getuid()*/

int gettty(char* s)
{
  int80(46, s, 0,0);
}/*end int gettty(char* s)*/

int settty(char* s)
{
  int80(47, s, 0);
}/*end int gettty(char* s)*/

int fdtype(char* s)
{
	int80(48, s, 0);
}

/*50-60*/
int kill(int sig, int pid)
{
  return int80(50, sig, pid);
}/*end int kill(int sig,int pid)*/

int signal(ushort sig, ushort catcher)
{
  return int80(51, sig, catcher);
}/*end int signale(ushort sig, ushort catcher)*/

int sleep(ushort t)
{
  return int80(52, t);
}/*end int sleep(ushort t)*/

int timer(ushort t)
{
  return int80(53, t);
}/*end int timer(ushort t)*/


/*80-99*/
int fixtty(char* s)
{
  int80(80, s, 0,0);
}/*end int fixtty(char* s)*/

int sync()
{
	return int80(90,0,0);
}/*end int sync()*/

int exit()
{
   int80(99, 0, 0);
}/*end int exit()*/