Skip to content
This project involved the development of a x86 64 bit operating system (SBUnix). It was developed in C and Assembly language. System was tested on QEMU which is a hosted hypervisor that performs hardware virtualization.The developed OS support for Context Switching, Memory management, File System, Terminal and Shell. System calls: COW fork, exec…
Branch: master
Clone or download
Latest commit 441268c Feb 9, 2014
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Final commit...almost everything working including File systems :) Dec 10, 2013
crt Final commit...almost everything working including File systems :) Dec 10, 2013
include Final commit...almost everything working including File systems :) Dec 10, 2013
ld
libc Final commit...almost everything working including File systems :) Dec 10, 2013
obj
rootfs
sys Delete ' Dec 10, 2013
upload
LICENSE Final commit...almost everything working including File systems :) Dec 10, 2013
Makefile Final commit...almost everything working including File systems :) Dec 10, 2013
README
_curs
core tarfs and ring0 to ring3 working Nov 21, 2013
cscope.out tarfs working and hdd initialization Nov 23, 2013
cse506-pubkey.txt Final commit...almost everything working including File systems :) Dec 10, 2013
file Final commit...almost everything working including File systems :) Dec 10, 2013
fork Final commit...almost everything working including File systems :) Dec 10, 2013
fs.c.bac Final commit...almost everything working including File systems :) Dec 10, 2013
go_gdb Pagging and video memory remapping completed. Oct 17, 2013
hdd.img
initiate_superblock
initiate_superblock.c
kernel ring 0 to ring 3 working without tarfs Nov 23, 2013
linker.script Final commit...almost everything working including File systems :) Dec 10, 2013
qemu
qemu.log Final commit...almost everything working including File systems :) Dec 10, 2013
qemud Final commit...almost everything working including File systems :) Dec 10, 2013
qemuhdd Final commit...almost everything working including File systems :) Dec 10, 2013
rajesh.img adding entire project Oct 13, 2013
rajesh.iso ring 0 to ring 3 working without tarfs Nov 23, 2013
rgolani.img adding entire project Oct 13, 2013
rgolani.iso Final commit...almost everything working including File systems :) Dec 10, 2013
rgolani.tgz
rgolani.tgz.gpg Final commit...almost everything working including File systems :) Dec 10, 2013
superblock
tags tarfs working and hdd initialization Nov 23, 2013
tarfs

README

=====70 POINT PROJECT=====

==USEFUL TIPS==

For filesystem, use the disk named "hdd.img" in cse506 folder. Disk Image size is 20 MB

If new disk is to created, here are the following steps:

    1. Run the qemu command to create a 1 MB disk named "hdd.img" : qemu-img create hdd.img 20M 

    2. Insert superblock to that image using command : dd if=superblock of=hdd.img seek=1 conv=notrunc (superblock file is provided in the home directory, which is being generated using initialize_superblock.c)

    3. Now, the hdd.img is ready to be used by our OS. Run Qemu with following command : qemu-system-x86_64 -curses -cdrom $USER.iso -drive id=disk,file=hdd.img,if=none -device ahci,id=ahci -device ide-drive,drive=disk,bus=ahci.0 -gdb tcp::$1

    
For Shutdown : type shutdown on shell.
                            
For any queries, please contact SBUnix developers.

==SYSTEM CALLS==
/* File System Commands  */    
    READ()
    Syntax       :  read(file *file, uint64_t addr, char *buf )
    Description  :  Whenever called  this function reads the file in to the buffer 'buf'.
    Dependencies :  To open a file always use OPEN system call before reading and after the read is completed, close the file. This call returns -1 for the files whose WRONLY flag is set.
    return       :  This call returns the length of bytes read into the buffer or -1 if there is an error


    WRITE() 
    Syntax       :  int write(file *fd, char * buf, int size)
    Description  :  Whenever called it writes up to 'size' number of bytes into the file descriptor 'fd' from the buffer starting at 'addr'.
    Dependencies :  To open a file always use OPEN system call before reading and after the read is completed, close the file.
                    This call returns -1 for the files opened with O_RDONLY flag set. It cannot do any write operations on tarfs.
    return       :  This function retruns length of bytes written into the buffer or -1 on error
    
    MALLOC()
    Syntax       :  void *malloc(uint64_t size)
    Description  :  Whenever called the size of vma is increased by 'size'.
    return       :  This call returns the virtual address in heap
    
    FORK()
    Syntax       :  pid_t fork (void); 
    Description  :  Whenever called a child process is created. It returns pid = 0 for child process and non zero for parent process.
    return       :  This call returns the pid for parent process or 0 for the child  process.
    
    EXECVPE()
    Syntax       :  execvpe(char *file, char *argv[], char *envp[])
    Description  :  Whenever called a file along with any necessary arguments argv[] in the environment envp[] is executed.
    return       :  This call returns -1 on failure, and doesnot return anything on success
    
    WAIT()
    Syntax       :  wait(uint64_t status)
    Description  :  Whenever called, the parent waits for a child process to exit.
    return       :  This call returns -1 if the parent has no children.
    
    EXIT()
    Syntax       :  exit(int status)
    Description  :  Whenever called the calling process is terminated immediately.

    GETPID()
    Syntax       :  getpid()
    Description  :  Whenever called the process id of currently running process is returned.
    
    GETPPID()
    Syntax       :  getppid()
    Description  :  Whenever called the parent's process id of currently running process is returned.
    
    PS()
    Syntax       :  ps()
    Description  :  Whenever called the list of all currently running processes is returned.
    
    OPENDIR()
    Syntax       :  opendir(uint64_t* entry, uint64_t* directory)
    Description  :  Whenever called,a directory struct with list of all inode/files in it is returned.
    return       :  If an error occurs it will return directory struct with the values set to NULL.   
   
    READDIR()
    Syntax       :  readdir(DIR* node)
    Description  :  Whenver called iteratively, it will list contents in directory. 
    Dependencies :  Read directory system call is always followed after open directory system call.
    return       :  It will return the pointer to dirent structure .If end of directory is reached or an error occurs then it returns NULL.
 
    OPEN()
    Syntax       :  open(char* dir_path, uint64_t flags)
    Description  :  Whenever called, a file is opened and a file descriptor is returned. It opens files from 'tarfs' and disk depending on 'dir_path'.
    Dependencies :  The flags can be one of the following: 'O_CREAT', 'O_RDONLY', 'O_WRONLY', 'O_APPEND', 'O_TRUNC', 'O_RDWR'.
    return       :  This call returns file descriptor number open on a directory returns -1 as file descriptor.
    
    SLEEP()
    Syntax       :  sleep(int msec)
    Description  :  The state of the current task is changed to 'sleep' for 'msec' milliseconds.
    
    CLEAR()
    Syntax       :  clear()
    Description  :  Clears the screen.
    
    SEEK()
    Syntax       :  seek(uint64_t fd_type, int offset, int whence) 
    Description  :  When used it will move the current file pointer by offset number of bytes that is in the file.
    Dependencies :  whence can be SEEK_SET, SEEK_CUR, SEEK_END. Using this will provide the offset from start , current pointer or end of file.

    SHUTDOWN()
    Syntax       :  shutdown() 
    Description  :  This function is used to exit from all the processes. 

You can’t perform that action at this time.