Scripts

Both scripts are to be placed in the parent directory, where asst2-src and root are subdirectories

Build Script

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
#!/bin/bash

cd "$(dirname "$0")/asst2-src"

echo "Building User Files..."
bmake > /dev/null && bmake install > /dev/null

cd kern/compile/ASST2
echo "Building Kernel..."
bmake > /dev/null && bmake install > /dev/null

Run Script

1
2
3
4
5
#!/bin/bash

cd "$(dirname "$0")/root"

sys161 kernel $@

Syscall Table

Warning: There's alot.

FunctionID
fork0
vfork1
execv2
_exit3
waitpid4
getpid5
getppid6
sbrk7
mmap8
munmap9
mprotect10
umask17
issetugid18
getresuid19
setresuid20
getresgid21
setresgid22
getgroups23
setgroups24
__getlogin25
__setlogin26
kill27
sigaction28
sigpending29
sigprocmask30
sigsuspend31
sigreturn32
open45
pipe46
dup47
dup248
close49
read50
pread51
getdirentry54
write55
pwrite56
lseek59
flock60
ftruncate61
fsync62
fcntl63
ioctl64
select65
poll66
link67
remove68
mkdir69
rmdir70
mkfifo71
rename72
access73
chdir74
fchdir75
__getcwd76
symlink77
readlink78
mount79
unmount80
stat81
fstat82
lstat83
utimes84
futimes85
lutimes86
chmod87
chown88
fchmod89
fchown90
lchmod91
lchown92
socket98
bind99
connect100
listen101
accept102
shutdown104
getsockname105
getpeername106
getsockopt107
setsockopt108
__time113
__settime114
nanosleep115
sync118
reboot119

Found in asst2-src/kern/include/kern/syscall.h

Error Numbers

Click to open

NameIDDescription
ENOSYS1Function not implemented
-2unused
ENOMEM3Out of memory
EAGAIN4Operation would block
EINTR5Interrupted system call
EFAULT6Bad memory reference
ENAMETOOLONG7String too long
EINVAL8Invalid argument
EPERM9Operation not permitted
EACCES10Permission denied
EMPROC11Too many processes
ENPROC12Too many processes in system
ENOEXEC13File is not executable
E2BIG14Argument list too long
ESRCH15No such process
ECHILD16No child processes
ENOTDIR17Not a directory
EISDIR18Is a directory
ENOENT19No such file or directory
ELOOP20Too many levels of symbolic links
ENOTEMPTY21Directory not empty
EEXIST22File or object exists
EMLINK23Too many hard links
EXDEV24Cross-device link
ENODEV25No such device
ENXIO26Device not available
EBUSY27Device or resource busy
EMFILE28Too many open files
ENFILE29Too many open files in system
EBADF30Bad file number
EIOCTL31Invalid or inappropriate ioctl
EIO32Input/output error
ESPIPE33Illegal seek
EPIPE34Broken pipe
EROFS35Read-only file system
ENOSPC36No space left on device
EDQUOT37Disc quota exceeded
EFBIG38File too large
EFTYPE39Invalid file type or format
EDOM40Argument out of range
ERANGE41Result out of range
EILSEQ42Invalid multibyte character sequence
ENOTSOCK43Not a socket
EISSOCK44Is a socket
EISCONN45Socket is already connected
ENOTCONN46Socket is not connected
ESHUTDOWN47Socket has been shut down
EPFNOSUPPORT48Protocol family not supported
ESOCKTNOSUPPORT49Socket type not supported
EPROTONOSUPPORT50Protocol not supported
EPROTOTYPE51Protocol wrong type for socket
EAFNOSUPPORT52Address family not supported by protocol family
ENOPROTOOPT53Protocol option not available
EADDRINUSE54Address already in use
EADDRNOTAVAIL55Cannot assign requested address
ENETDOWN56Network is down
ENETUNREACH57Network is unreachable
EHOSTDOWN58Host is down
EHOSTUNREACH59Host is unreachable
ECONNREFUSED60Connection refused
ETIMEDOUT61Connection timed out
ECONNRESET62Connection reset by peer
EMSGSIZE63Message too large
ENOTSUP64Threads operation not supported

Found in asst2-src/kern/include/kern/errno.h

MIPS Exception Codes

Click to open

NameIDDescription
EX_IRQ0Interrupt
EX_MOD1TLB Modify (write to read-only page)
EX_TLBL2TLB miss on load
EX_TLBS3TLB miss on store
EX_ADEL4Address error on load
EX_ADES5Address error on store
EX_IBE6Bus error on instruction fetch
EX_DBE7Bus error on data load or store
EX_SYS8Syscall
EX_BP9Breakpoint
EX_RI10Reserved (illegal) instruction
EX_CPU11Coprocessor unusable
EX_OVF12Arithmetic overflow

Found in asst2-src/kern/arch/mips/include/trapframe.h

Design Questions / Considerations

What is the difference between UIO_USERISPACE and UIO_USERSPACE?

  • UIO_USERISPACE - User Code
  • UIO_USERSPACE - User Data

When should one use UIO_SYSSPACE instead?

Kernel related stuff. Doesn't require validity checks - as the kernel is trusted to be safe.