diff --git a/bin/init/main.c b/bin/init/main.c index 9d7fbf7..6356377 100644 --- a/bin/init/main.c +++ b/bin/init/main.c @@ -40,8 +40,6 @@ int i=0x0; mpi_message_t myMsg; - - /* Create a mailbox for this task */ /* if (mpi_createMbox("init") != 0x0) { diff --git a/sys/fs/devfs/devfs.c b/sys/fs/devfs/devfs.c index 4bc603c..ffb764e 100644 --- a/sys/fs/devfs/devfs.c +++ b/sys/fs/devfs/devfs.c @@ -66,7 +66,7 @@ This format will be changing down the road */ -static int devfs_open(char *file, fileDescriptor *fd) { +static int devfs_open(char *file, fileDescriptor_t *fd) { struct devfs_info *fsInfo = fd->mp->fsInfo; struct devfs_devices *tmpDev = 0x0; struct device_node *device = 0x0; @@ -105,11 +105,11 @@ } /** - Function: int readDevFS(fileDescriptor *fd,char *data,long offset,long size) + Function: int readDevFS(fileDescriptor_t *fd,char *data,long offset,long size) Description: Read File Into Data Notes: */ -static int devfs_read(fileDescriptor *fd, char *data, long offset, long size) { +static int devfs_read(fileDescriptor_t *fd, char *data, long offset, long size) { int i = 0x0, x = 0x0; uInt32 sectors = 0x0; uInt16 diff = 0x0; @@ -150,12 +150,12 @@ /************************************************************************ - Function: int writeDevFS(fileDescriptor *fd,char *data,long offset,long size) + Function: int writeDevFS(fileDescriptor_t *fd,char *data,long offset,long size) Description: Write Data Into File Notes: ************************************************************************/ -static int devfs_write(fileDescriptor *fd, char *data, long offset, long size) { +static int devfs_write(fileDescriptor_t *fd, char *data, long offset, long size) { int i = 0x0, x = 0x0; struct device_node *device = 0x0; struct devfs_devices *tmpDev = (void *) fd->start; diff --git a/sys/fs/ubixfs/block.c b/sys/fs/ubixfs/block.c index 266f891..8be4d23 100644 --- a/sys/fs/ubixfs/block.c +++ b/sys/fs/ubixfs/block.c @@ -76,7 +76,7 @@ mp->device->devInfo->write(mp->device->devInfo->info,fsInfo->blockAllocationTable,mp->diskLabel->partitions[mp->partition].pOffset,mp->diskLabel->partitions[mp->partition].pBatSize); } -int freeBlocks(int block,fileDescriptor *fd) { +int freeBlocks(int block,fileDescriptor_t *fd) { int i = block; struct ubixFSInfo *fsInfo = fd->mp->fsInfo; @@ -93,7 +93,7 @@ return(i); } -int getFreeBlocks(int count,fileDescriptor *fd) { +int getFreeBlocks(int count,fileDescriptor_t *fd) { uInt32 i = 0x0; uInt32 x = 0x0; diff --git a/sys/fs/ubixfs/directory.c b/sys/fs/ubixfs/directory.c index 179c8fa..52cd70d 100644 --- a/sys/fs/ubixfs/directory.c +++ b/sys/fs/ubixfs/directory.c @@ -62,7 +62,7 @@ } int -addDirEntry(struct directoryEntry *dir,fileDescriptor *fd) { +addDirEntry(struct directoryEntry *dir,fileDescriptor_t *fd) { uInt32 i = 0x0; uInt32 entries = 0x0; struct directoryEntry *tmp = 0x0; @@ -90,7 +90,7 @@ } int -ubixFSmkDir(char *directory,fileDescriptor *fd) { +ubixFSmkDir(char *directory,fileDescriptor_t *fd) { int block = 0x0; struct directoryEntry *dir = 0x0; diff --git a/sys/fs/ubixfs/ubixfs.c b/sys/fs/ubixfs/ubixfs.c index bddfc30..56a5ecb 100644 --- a/sys/fs/ubixfs/ubixfs.c +++ b/sys/fs/ubixfs/ubixfs.c @@ -39,10 +39,10 @@ #include /* Static defines */ -static int ubixfs_loadData(fileDescriptor *fd,char *data,uInt32 size,uInt32 batIndex); +static int ubixfs_loadData(fileDescriptor_t *fd,char *data,uInt32 size,uInt32 batIndex); -static int openFileUbixFS(const char *file, fileDescriptor *fd) { +static int openFileUbixFS(const char *file, fileDescriptor_t *fd) { //int x = 0; /* mji struct directoryEntry *dirEntry = (struct directoryEntry *)kmalloc(0x4000); */ struct cacheNode * cacheNode = NULL; @@ -114,7 +114,7 @@ } -int writeFileByte(int ch, fileDescriptor *fd, long offset) { +int writeFileByte(int ch, fileDescriptor_t *fd, long offset) { int blockCount = 0x0,batIndex = 0x0,batIndexPrev = 0x0; uInt32 i = 0x0; @@ -190,7 +190,7 @@ /* Verified Functions */ -int readUbixFS(fileDescriptor *fd,char *data,uInt32 offset,long size) { +int readUbixFS(fileDescriptor_t *fd,char *data,uInt32 offset,long size) { int i = 0x0; char *buffer = 0x0; struct ubixFSInfo *fsInfo = NULL; @@ -223,12 +223,12 @@ /************************************************************************ -Function: int writeUbixFS(fileDescriptor *fd,char *data,long offset,long size) +Function: int writeUbixFS(fileDescriptor_t *fd,char *data,long offset,long size) Description: Write Data Into File Notes: ************************************************************************/ -int writeUbixFS(fileDescriptor *fd,char *data,long offset,long size) { +int writeUbixFS(fileDescriptor_t *fd,char *data,long offset,long size) { uInt32 blockOffset = 0x0; uInt32 blockIndex; uInt32 blockIndexPrev; @@ -328,7 +328,7 @@ /***************************************************************************************** Function: static - int ubixfs_loadData(fileDescriptor *fd,char *data,uInt32 size,uInt32 batIndex) + int ubixfs_loadData(fileDescriptor_t *fd,char *data,uInt32 size,uInt32 batIndex) Description: This will load the node data in from the disk @@ -337,7 +337,7 @@ actual file size *****************************************************************************************/ -static int ubixfs_loadData(fileDescriptor *fd,char *data,uInt32 size,uInt32 batIndex) { +static int ubixfs_loadData(fileDescriptor_t *fd,char *data,uInt32 size,uInt32 batIndex) { uInt32 i = 0x0; struct ubixFSInfo *fsInfo = NULL; diff --git a/sys/fs/ufs/ffs.c b/sys/fs/ufs/ffs.c index 500a4c5..c9b8721 100644 --- a/sys/fs/ufs/ffs.c +++ b/sys/fs/ufs/ffs.c @@ -8,7 +8,7 @@ #include -int ffs_read(fileDescriptor *fd,char *data,uInt32 offset,long size) { +int ffs_read(fileDescriptor_t *fd,char *data,uInt32 offset,long size) { struct fs *fs; fs = (struct fs *)fd->dmadat->sbbuf; diff --git a/sys/fs/ufs/ufs.c b/sys/fs/ufs/ufs.c index fe72a95..6521ea1 100644 --- a/sys/fs/ufs/ufs.c +++ b/sys/fs/ufs/ufs.c @@ -49,7 +49,7 @@ (((x) % (fs)->fs_ipg) / (ipervblk) * DBPERVBLK)) #define INO_TO_VBO(ipervblk, x) ((x) % ipervblk) -static int dskread(void *buf, uint64_t block, size_t count, fileDescriptor *fd) { +static int dskread(void *buf, uint64_t block, size_t count, fileDescriptor_t *fd) { fd->mp->device->devInfo->read(fd->mp->device->devInfo->info, buf, block, count); return (0x0); } @@ -74,7 +74,7 @@ #define DIP(field) fs->fs_magic == FS_UFS1_MAGIC ? dp1.field : dp2.field #endif -static ssize_t fsread(ino_t inode, void *buf, size_t nbyte, fileDescriptor *fd) { +static ssize_t fsread(ino_t inode, void *buf, size_t nbyte, fileDescriptor_t *fd) { #ifndef UFS2_ONLY static struct ufs1_dinode dp1; #endif @@ -209,7 +209,7 @@ return nbyte; } -static __inline int fsfind(const char *name, ino_t * ino, fileDescriptor *fd) { +static __inline int fsfind(const char *name, ino_t * ino, fileDescriptor_t *fd) { char buf[DEV_BSIZE]; struct dirent *d; char *s; @@ -229,7 +229,7 @@ return 0; } -static ino_t lookup(const char *path, fileDescriptor *fd) { +static ino_t lookup(const char *path, fileDescriptor_t *fd) { char name[MAXNAMLEN + 1]; const char *s; ino_t ino; @@ -264,7 +264,7 @@ return dt == DT_REG ? ino : 0; } -static int ufs_openFile(const char *file, fileDescriptor *fd) { +static int ufs_openFile(const char *file, fileDescriptor_t *fd) { char tmp[2]; int ino = 0; fd->dmadat = (struct dmadat *) kmalloc(sizeof(struct dmadat)); @@ -283,11 +283,11 @@ return (0x1); } -int ufs_readFile(fileDescriptor *fd, char *data, uInt32 offset, long size) { +int ufs_readFile(fileDescriptor_t *fd, char *data, uInt32 offset, long size) { return (fsread(fd->ino, data, size, fd)); } -int ufs_writeFile(fileDescriptor *fd, char *data, uInt32 offset, long size) { +int ufs_writeFile(fileDescriptor_t *fd, char *data, uInt32 offset, long size) { kprintf("Writing :)\n"); return (0x0); } diff --git a/sys/fs/vfs/file.c b/sys/fs/vfs/file.c index f13ee0c..6c0042a 100644 --- a/sys/fs/vfs/file.c +++ b/sys/fs/vfs/file.c @@ -39,9 +39,9 @@ static struct spinLock fdTable_lock = SPIN_LOCK_INITIALIZER; -fileDescriptor *fdTable = 0x0; +fileDescriptor_t *fdTable = 0x0; -fileDescriptor *vfs_fileTable = 0x0; +fileDescriptor_t *vfs_fileTable = 0x0; int sys_fwrite( struct thread *td, struct sys_fwrite_args *uap ) { char *t = uap->buf; @@ -208,7 +208,7 @@ /* KERNEL */ -size_t fread( void *ptr, size_t size, size_t nmemb, fileDescriptor *fd ) { +size_t fread( void *ptr, size_t size, size_t nmemb, fileDescriptor_t *fd ) { size_t i = 0x0; @@ -243,7 +243,7 @@ return (i); } -size_t fwrite( void *ptr, int size, int nmemb, fileDescriptor *fd ) { +size_t fwrite( void *ptr, int size, int nmemb, fileDescriptor_t *fd ) { if ( fd != 0x0 ) { fd->mp->fs->vfsWrite( fd, ptr, fd->offset, size * nmemb ); fd->offset += size * nmemb; @@ -251,19 +251,19 @@ return (0x0); } -int fseek( fileDescriptor *tmpFd, long offset, int whence ) { +int fseek( fileDescriptor_t *tmpFd, long offset, int whence ) { tmpFd->offset = offset + whence; return (tmpFd->offset); } /************************************************************************ - Function: int feof(fileDescriptor *fd) + Function: int feof(fileDescriptor_t *fd) Description: Check A File Descriptor For EOF And Return Result Notes: ************************************************************************/ -int feof( fileDescriptor *fd ) { +int feof( fileDescriptor_t *fd ) { if ( fd->status == fdEof ) { return (-1); } @@ -272,12 +272,12 @@ /************************************************************************ - Function: int fputc(int ch,fileDescriptor *fd) + Function: int fputc(int ch,fileDescriptor_t *fd) Description: This Will Write Character To FD Notes: ************************************************************************/ -int fputc( int ch, fileDescriptor *fd ) { +int fputc( int ch, fileDescriptor_t *fd ) { if ( fd != 0x0 ) { ch = fd->mp->fs->vfsWrite( fd, (char *) ch, fd->offset, 1 ); fd->offset++; @@ -289,12 +289,12 @@ /************************************************************************ - Function: int fgetc(fileDescriptor *fd) + Function: int fgetc(fileDescriptor_T *fd) Description: This Will Return The Next Character In A FD Stream Notes: ************************************************************************/ -int fgetc( fileDescriptor *fd ) { +int fgetc( fileDescriptor_t *fd ) { int ch = 0x0; /* If Found Return Next Char */ if ( fd != 0x0 ) { @@ -309,7 +309,7 @@ /************************************************************************ - Function: fileDescriptor *fopen(const char *file,cont char *flags) + Function: fileDescriptor_t *fopen(const char *file,cont char *flags) Description: This Will Open A File And Return A File Descriptor Notes: @@ -317,15 +317,15 @@ ************************************************************************/ -fileDescriptor *fopen( const char *file, const char *flags ) { +fileDescriptor_t *fopen( const char *file, const char *flags ) { int i = 0x0; char *path = 0x0; char *mountPoint = 0x0; char fileName[1024]; - fileDescriptor *tmpFd = 0x0; + fileDescriptor_t *tmpFd = 0x0; /* Allocate Memory For File Descriptor */ - if ( (tmpFd = (fileDescriptor *) kmalloc( sizeof(fileDescriptor) )) == 0x0 ) { + if ( (tmpFd = (fileDescriptor_t *) kmalloc( sizeof(fileDescriptor_t) )) == 0x0 ) { kprintf( "Error: tmpFd == NULL, File: %s, Line: %i\n", __FILE__, __LINE__ ); return (NULL); } @@ -435,13 +435,13 @@ /************************************************************************ - Function: int fclose(fileDescriptor *fd); + Function: int fclose(fileDescriptor_t *fd); Description: This Will Close And Free A File Descriptor Notes: ************************************************************************/ -int fclose( fileDescriptor *fd ) { - fileDescriptor *tmpFd = 0x0; +int fclose( fileDescriptor_t *fd ) { + fileDescriptor_t *tmpFd = 0x0; assert( fd ); spinLock( &fdTable_lock ); @@ -479,7 +479,7 @@ ************************************************************************/ void sysMkDir( const char *path ) { - fileDescriptor *tmpFD = 0x0; + fileDescriptor_t *tmpFD = 0x0; char tmpDir[1024]; char rootPath[256]; char *dir = 0x0; //UBU*mountPoint = 0x0; diff --git a/sys/fs/vfs/stat.c b/sys/fs/vfs/stat.c index d60192b..94714d5 100644 --- a/sys/fs/vfs/stat.c +++ b/sys/fs/vfs/stat.c @@ -63,7 +63,7 @@ } */ - fileDescriptor *fd = fopen(path, "rb"); + fileDescriptor_t *fd = fopen(path, "rb"); //MrOlsen kprintf("FD=0x%X", fd); if (fd == 0) { @@ -93,7 +93,7 @@ int error = 0; struct file *fdd = 0x0; - fileDescriptor *fd = 0x0; + fileDescriptor_t *fd = 0x0; getfd(td, &fdd, args->fd); diff --git a/sys/fs/vfs/vfs.c b/sys/fs/vfs/vfs.c index dec38e7..716a78f 100644 --- a/sys/fs/vfs/vfs.c +++ b/sys/fs/vfs/vfs.c @@ -148,7 +148,7 @@ if (error) return(error); - strcpy(nfp->path, args->path); + //strcpy(nfp->path, args->path); nfp->fd = fopen(args->path,"r"); @@ -168,7 +168,7 @@ } } - kprintf("path: %s:%i ", args->path, index); + //kprintf("path: %s:%i ", args->path, index); return (error); } diff --git a/sys/i386/i386_exec.c b/sys/i386/i386_exec.c index d5fbe72..fc27290 100644 --- a/sys/i386/i386_exec.c +++ b/sys/i386/i386_exec.c @@ -369,6 +369,7 @@ //MrOlsen (2016-01-14) FIX: is the stack start supposed to be addressable xhcnage x= 1 to x=0 for (x = 0; x < 100; x++) { vmm_remapPage(vmm_findFreePage(newProcess->id), STACK_ADDR - (x * 0x1000), PAGE_DEFAULT | PAGE_STACK, newProcess->id); + bzero(STACK_ADDR - (x * 0x1000), 0x1000); } /* Kernel Stack 0x2000 bytes long */ @@ -408,6 +409,7 @@ kfree(binaryHeader); kfree(programHeader); fclose(newProcess->files[0]); + newProcess->files[0] = 0x0; tmp = (uInt32 *) newProcess->tss.esp0 - 5; @@ -430,6 +432,7 @@ tmp[i++] = 0x0; sp = 0; + for (int x = 0; x < envc; x++) { tmp[x + i] = STACK_ADDR - ARGV_PAGE - ENVP_PAGE + sp; strcpy((char *) tmp[x + i], envp[x]); @@ -437,19 +440,6 @@ } tmp[i + x] = 0x0; - //*tmp++ = 0x1; // ARGC - //*tmp++ = 0x100; // ARGV - //*tmp++ = 0x0; // ARGV TERM - //*tmp++ = 0x0; // ENV - //*tmp++ = 0x0; // ENV TERM - /* - *tmp++ = 0xDEAD; // AUX 1.A - *tmp++ = 0xBEEF; // AUX 1.B - *tmp++ = 0x0; // AUX TERM - *tmp++ = 0x0; // AUX TERM - *tmp++ = 0x1; // TERM - */ - /* Switch Back To The Kernels VM Space */ asm volatile( "movl %0,%%eax \n" @@ -486,7 +476,7 @@ char *interp = 0x0; uint32_t ldAddr = 0x0; - fileDescriptor *fd = 0x0; + fileDescriptor_t *fd = 0x0; Elf_Ehdr *binaryHeader = 0x0; Elf_Phdr *programHeader = 0x0; @@ -771,7 +761,7 @@ tmp[i++] = 0x1000; tmp[i++] = 7; - tmp[i++] = 0x0; //LD_START; + tmp[i++] = 0x0;//LD_START; kprintf("AT_BASE: [0x%X]", tmp[i - 1]); tmp[i++] = 8; diff --git a/sys/i386/timer.S b/sys/i386/timer.S index c7aa642..556bb5b 100644 --- a/sys/i386/timer.S +++ b/sys/i386/timer.S @@ -35,17 +35,17 @@ mov $0x20,%ax outb %al,%dx movl systemVitals,%ecx /* Put Location Of System Vitals Into ECX */ - incl 4(%ecx) /* Increment sysTicks our 1000ms counter */ - movl 4(%ecx),%eax /* Increment our sysUptime by 1S if 1000MS */ + incl (%ecx) /* Increment sysTicks our 1000ms counter */ + movl (%ecx),%eax /* Increment our sysUptime by 1S if 1000MS */ movl $200,%ebx /* Have Passed */ xor %edx,%edx div %ebx test %edx,%edx jnz next - incl 8(%ecx) + incl 4(%ecx) next: - movl 4(%ecx),%eax /* Test If quantum Has Passed If So Then */ - movl 12(%ecx),%ebx /* We Can CALL sched */ + movl (%ecx),%eax /* Test If quantum Has Passed If So Then */ + movl 8(%ecx),%ebx /* We Can CALL sched */ xor %edx,%edx div %ebx test %edx,%edx diff --git a/sys/include/sys/descrip.h b/sys/include/sys/descrip.h index 4718d61..2cfc903 100644 --- a/sys/include/sys/descrip.h +++ b/sys/include/sys/descrip.h @@ -89,18 +89,20 @@ #define FFLAGS(oflags) ((oflags) + 1) #define OFLAGS(fflags) ((fflags) - 1) +struct fileOps; +struct file; + /* Function Protos */ typedef int fo_rdwr_t(struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, struct thread *td); typedef int fo_stat_t(struct file *fp, struct stat *sb, struct ucred *active_cred, struct thread *td); typedef int fo_close_t(struct file *fp, struct thread *td); -struct fileOps; struct file { uint32_t f_flag; uint16_t f_type; struct fileOps *f_ops; - fileDescriptor *fd; + fileDescriptor_t *fd; }; struct fileOps { diff --git a/sys/include/ubixfs/ubixfs.h b/sys/include/ubixfs/ubixfs.h index 6e18062..877c9cb 100644 --- a/sys/include/ubixfs/ubixfs.h +++ b/sys/include/ubixfs/ubixfs.h @@ -131,21 +131,21 @@ /* ubixFSInfo */ int readFile(char *file); -int writeFileByte(int ch, fileDescriptor *fd, long offset); -//int openFileUbixFS(char *file,fileDescriptor *fd); -int getFreeBlocks(int count, fileDescriptor *fd); +int writeFileByte(int ch, fileDescriptor_t *fd, long offset); +//int openFileUbixFS(char *file,fileDescriptor_t *fd); +int getFreeBlocks(int count, fileDescriptor_t *fd); //extern struct ubixDiskLabel *diskLabel; //Good Functions //void initUbixFS(struct mountPoints *mp); -int readUbixFS(fileDescriptor *fd, char *data, uInt32, long size); -int writeUbixFS(fileDescriptor *fd, char *data, long offset, long size); +int readUbixFS(fileDescriptor_t *fd, char *data, uInt32, long size); +int writeUbixFS(fileDescriptor_t *fd, char *data, long offset, long size); void syncBat(struct vfs_mountPoint *mp); -int freeBlocks(int block, fileDescriptor *fd); -int addDirEntry(struct directoryEntry *dir, fileDescriptor *fd); +int freeBlocks(int block, fileDescriptor_t *fd); +int addDirEntry(struct directoryEntry *dir, fileDescriptor_t *fd); void ubixFSUnlink(char *path, struct vfs_mountPoint *mp); -int ubixFSmkDir(char *dir, fileDescriptor *fd); +int ubixFSmkDir(char *dir, fileDescriptor_t *fd); int ubixfs_init(); int ubixfs_initialize(); diff --git a/sys/include/ubixos/sched.h b/sys/include/ubixos/sched.h index f9d7a2d..e49721e 100644 --- a/sys/include/ubixos/sched.h +++ b/sys/include/ubixos/sched.h @@ -63,7 +63,7 @@ struct i387Struct i387; struct osInfo oInfo; //fileDescriptor *imageFd; - fileDescriptor *files[MAX_OFILES]; + fileDescriptor_t *files[MAX_OFILES]; tState state; uint32_t uid, gid; uint16_t euid, suid; diff --git a/sys/include/ufs/ffs.h b/sys/include/ufs/ffs.h index 76790c7..77463f6 100644 --- a/sys/include/ufs/ffs.h +++ b/sys/include/ufs/ffs.h @@ -34,7 +34,7 @@ #include #include -int ffs_read(fileDescriptor *,char *,uInt32,long); +int ffs_read(fileDescriptor_t *,char *,uint32_t,long); #endif diff --git a/sys/include/vfs/file.h b/sys/include/vfs/file.h index 47af809..5812344 100644 --- a/sys/include/vfs/file.h +++ b/sys/include/vfs/file.h @@ -58,8 +58,8 @@ }; typedef struct fileDescriptor { - //struct fileDescriptorStruct *prev; - //struct fileDescriptorStruct *next; + struct fileDescriptor *prev; + struct fileDescriptor *next; struct vfs_mountPoint *mp; uint32_t ino; uint16_t status; @@ -76,7 +76,6 @@ int dsk_meta; uint32_t resid; struct inode inode; - uint32_t size; //Temp for sys_fopen once thats gone i can remove } fileDescriptor_t; typedef struct userFileDescriptorStruct { diff --git a/sys/include/vmm/paging.h b/sys/include/vmm/paging.h index 91e8d9c..61f9a28 100644 --- a/sys/include/vmm/paging.h +++ b/sys/include/vmm/paging.h @@ -96,7 +96,7 @@ void _vmm_pageFault(); int mmap(struct thread *, struct sys_mmap_args *); int obreak(struct thread *, struct obreak_args *); -int munmap(struct thread *, struct munmap_args *); +int munmap(struct thread *, struct sys_munmap_args *); int vmm_cleanVirtualSpace(uint32_t); void *vmm_getFreeVirtualPage(pidType pid, int count, int type); diff --git a/sys/init/main.c b/sys/init/main.c index c004bf8..c670c6e 100644 --- a/sys/init/main.c +++ b/sys/init/main.c @@ -149,7 +149,6 @@ execFile("sys:/bin/init", argv_init, envp_init, 0x0); /* OS Initializer */ kprintf("File Start!\n"); - //execFile( "sys:/bin/login", 0x0, 0x0, 0x0 ); /* OS Initializer */ irqEnable(0x0); diff --git a/sys/kernel/elf.c b/sys/kernel/elf.c index 627814e..3eb6160 100644 --- a/sys/kernel/elf.c +++ b/sys/kernel/elf.c @@ -47,7 +47,7 @@ Elf32_Ehdr *binaryHeader = 0x0; Elf32_Phdr *programHeader = 0x0; - fileDescriptor *exec_fd = 0x0; + fileDescriptor_t *exec_fd = 0x0; exec_fd = fopen(file, "r"); diff --git a/sys/kernel/ld.c b/sys/kernel/ld.c index 42c915e..841ca6d 100644 --- a/sys/kernel/ld.c +++ b/sys/kernel/ld.c @@ -46,12 +46,14 @@ char *shStr = 0x0; char *dynStr = 0x0; uint32_t *reMap = 0x0; - fileDescriptor *ldFd = 0x0; + fileDescriptor_t *ldFd = 0x0; Elf_Ehdr *binaryHeader = 0x0; Elf_Phdr *programHeader = 0x0; Elf_Shdr *sectionHeader = 0x0; Elf_Sym *relSymTab = 0x0; Elf_Rel *elfRel = 0x0; + Elf_Rela *elfRela = 0x0; + Elf_Addr addr; /* Open our dynamic linker */ ldFd = fopen("sys:/libexec/ld.so", "rb"); @@ -156,6 +158,9 @@ fread(relSymTab, sectionHeader[i].sh_size, 1, ldFd); sym = i; break; + default: + kprintf("INvalid: %i]", sectionHeader[i].sh_type); + break; } } diff --git a/sys/kernel/syscalls.c b/sys/kernel/syscalls.c index 74c9854..ab9f4e6 100644 --- a/sys/kernel/syscalls.c +++ b/sys/kernel/syscalls.c @@ -36,9 +36,9 @@ { ARG_COUNT(sys_fork_args), "fork", (sys_call_t *) sys_fork, SYSCALL_VALID }, // 2 - fork { ARG_COUNT(sys_read_args), "read", (sys_call_t *) sys_read, SYSCALL_VALID }, // 3 - read { ARG_COUNT(sys_write_args), "write", (sys_call_t *) sys_write, SYSCALL_VALID }, // 4 - write - { ARG_COUNT(sys_open_args), "open", (sys_call_t *) sys_open, SYSCALL_DUMMY }, // 5 - open + { ARG_COUNT(sys_open_args), "open", (sys_call_t *) sys_open, SYSCALL_VALID }, // 5 - open { ARG_COUNT(sys_close_args), "close", (sys_call_t *) sys_close, SYSCALL_VALID }, // 6 - close - { ARG_COUNT(sys_wait4_args), "wiat4", (sys_call_t *) sys_wait4, SYSCALL_DUMMY }, + { ARG_COUNT(sys_wait4_args), "wiat4", (sys_call_t *) sys_wait4, SYSCALL_VALID }, // 7 - wait4 { 0, "No Call", sys_invalid, SYSCALL_VALID }, { 0, "No Call", sys_invalid, SYSCALL_VALID }, { 0, "No Call", sys_invalid, SYSCALL_VALID }, diff --git a/sys/sys/idt.c b/sys/sys/idt.c index c50fb36..5d77250 100644 --- a/sys/sys/idt.c +++ b/sys/sys/idt.c @@ -187,7 +187,28 @@ */ } -void _int0() { +asm volatile( + ".globl _int0 \n" + "_int0: \n" + " pushl $0x0 \n" + " pushl $0x6 \n" + " pushal \n" /* Save all registers */ + " push %ds \n" + " push %es \n" + " push %fs \n" + " push %gs \n" + " push %esp \n" + " call __int0 \n" + " pop %gs \n" + " pop %fs \n" + " pop %es \n" + " pop %ds \n" + " popal \n" + " iret \n" /* Exit interrupt */ +); + +void __int0(struct trapframe *frame) { + die_if_kernel("Divid-by-Zer0", frame, 0); kpanic("int0: Divide-by-Zero [%i]\n", _current->id); endTask(_current->id); sched_yield(); diff --git a/sys/vmm/getfreevirtualpage.c b/sys/vmm/getfreevirtualpage.c index ac3975a..ec2eda5 100644 --- a/sys/vmm/getfreevirtualpage.c +++ b/sys/vmm/getfreevirtualpage.c @@ -59,7 +59,7 @@ if (_current->oInfo.vmStart <= 0x100000) kpanic("Invalid vmStart\n"); - kprintf("type: %i ", type); + //MrOlsen kprintf("type: %i ", type); /* Get Our Starting Address */ if (type == VM_THRD) { diff --git a/sys/vmm/vmm_mmap.c b/sys/vmm/vmm_mmap.c index 3d649d4..cf245b7 100644 --- a/sys/vmm/vmm_mmap.c +++ b/sys/vmm/vmm_mmap.c @@ -177,23 +177,25 @@ } tmp = uap->addr; + bzero(tmp, uap->len); td->td_retval[0] = (uint32_t)tmp; return (0x0); } //td->td_retval[0] = (int) vmm_getFreeVirtualPage( _current->id, uap->len / 0x1000, VM_TASK ); //td->td_retval[0] = (int) td->td_retval[0] = vmm_getFreeVirtualPage(_current->id, round_page( uap->len ) / 0x1000, VM_TASK); + bzero(td->td_retval[0], uap->len); + kprintf("mm: 0x%X\n", uap->len); return (0x0); //vmm_getFreeVirtualPage(_current->id, round_page( uap->len ) / 0x1000, VM_THRD)); } else { //kprintf("uap->flags: [0x%X]\n", uap->flags); - kprintf("uap->addr: [0x%X]\n", uap->addr); - kprintf("uap->len: [0x%X]\n", uap->len); - //kprintf("uap->prot: [0x%X]\n", uap->prot); + kprintf("uap->addr: [0x%X]", uap->addr); + kprintf("uap->len: [0x%X]", uap->len); + //kprintf("uap->prot: [0x%X]", uap->prot); kprintf("uap->fd: [%i]\n", uap->fd); - //kprintf("uap->pad: [0x%X]\n", uap->pad); - //kprintf("uap->pos: [0x%X]\n", uap->pos); - //K_PANIC("NOT YET\n"); + //kprintf("uap->pad: [0x%X]", uap->pad); + //kprintf("uap->pos: [0x%X]", uap->pos); getfd(td, &fd, uap->fd); if (uap->addr == 0x0) tmp = (char *) vmm_getFreeVirtualPage(_current->id, round_page(uap->len) / 0x1000, VM_TASK); @@ -209,16 +211,10 @@ } fseek(fd->fd, uap->pos, 0x0); - kprintf("FREAD: %i", fread(tmp, uap->len, 0x1, fd->fd)); + kprintf("FREAD: 0x%X\n", fread(tmp, uap->len, 0x1, fd->fd)); td->td_retval[0] = (uint32_t) tmp; - //MrOlsen kprintf("tmp: %i. ", td->td_retval[0]); if (td->td_retval[0] == (caddr_t)-1) kpanic("BALLS"); } return (0x0); } - -/*** - END - ***/ -