diff --git a/src/sys/devfs/devfs.c b/src/sys/devfs/devfs.c index 4405da8..85ae750 100644 --- a/src/sys/devfs/devfs.c +++ b/src/sys/devfs/devfs.c @@ -41,38 +41,11 @@ /* Spinlock for devfs we should start converting to sem/mutex */ static spinLock_t devfsSpinLock = SPIN_LOCK_INITIALIZER; -int devfs_init() { - /* Build our devfs struct */ - struct fileSystem devFS = - {NULL, /* prev */ - NULL, /* next */ - (void *)devFSInit, /* vfsInitFS */ - (void *)devFSRead, /* vfsRead */ - (void *)devFSWrite, /* vfsWrite */ - (void *)devFSOpen, /* vfsOpenFile */ - NULL, /* vfsUnlink */ - NULL, /* vfsMakeDir */ - NULL, /* vfsRemDir */ - NULL, /* vfsSync */ - 1 /* vfsType */ - }; /* devFS */ - - if (vfsRegisterFS(devFS) != 0x0) { - //sysErr(systemErr,"Unable To Enable DevFS"); - return(0x1); - } - /* Mount our devfs this will build the devfs container node */ - mount(0x0,0x0,0x0,0x1,"devfs","rw"); // Mount Device File System - - /* Return */ - return(0x0); - } - -void devFSInit(struct mountPoints *mp) { - struct devFsInfo *fsInfo = 0x0; +static void devfs_initialize(struct mountPoints *mp) { + struct devfs_info *fsInfo = 0x0; /* Allocate memory for the fsInfo */ - mp->fsInfo = (struct devFsInfo *)kmalloc(sizeof(struct devFsInfo)); + mp->fsInfo = (struct devfs_info *)kmalloc(sizeof(struct devfs_info)); assert(mp->fsInfo); fsInfo = mp->fsInfo; @@ -83,10 +56,10 @@ return; } -int devFSOpen(char *file,fileDescriptor *fd) { - struct devFsInfo *fsInfo = fd->mp->fsInfo; - struct devFsDevices *tmpDev = 0x0; - struct deviceNode *device = 0x0; +static int devfs_open(char *file,fileDescriptor *fd) { + struct devfs_info *fsInfo = fd->mp->fsInfo; + struct devfs_devices *tmpDev = 0x0; + struct device_node *device = 0x0; spinLock(&devfsSpinLock); @@ -95,7 +68,7 @@ switch ((fd->mode & 0x3)) { case 0: case 1: - device = deviceFind(tmpDev->devMajor,tmpDev->devMinor); + device = device_find(tmpDev->devMajor,tmpDev->devMinor); (void *)fd->start = tmpDev; fd->size = device->size; break; @@ -120,14 +93,14 @@ Notes: ************************************************************************/ -int devFSRead(fileDescriptor *fd,char *data,long offset,long size) { +static int devfs_read(fileDescriptor *fd,char *data,long offset,long size) { int i = 0x0,x = 0x0; uInt32 sectors = 0x0; uInt16 diff = 0x0; - struct deviceNode *device = 0x0; - struct devFsDevices *tmpDev = (void *)fd->start; + struct device_node *device = 0x0; + struct devfs_devices *tmpDev = (void *)fd->start; - device = deviceFind(tmpDev->devMajor,tmpDev->devMinor); + device = device_find(tmpDev->devMajor,tmpDev->devMinor); sectors = ((size+511)/512); @@ -157,12 +130,12 @@ Notes: ************************************************************************/ -int devFSWrite(fileDescriptor *fd,char *data,long offset,long size) { +static int devfs_write(fileDescriptor *fd,char *data,long offset,long size) { int i = 0x0,x = 0x0; - struct deviceNode *device = 0x0; - struct devFsDevices *tmpDev = (void *)fd->start; + struct device_node *device = 0x0; + struct devfs_devices *tmpDev = (void *)fd->start; - device = deviceFind(tmpDev->devMajor,tmpDev->devMinor); + device = device_find(tmpDev->devMajor,tmpDev->devMinor); for (i=0x0;i<((size+511)/512);i++) { device->devInfo->read(device->devInfo->info,fd->buffer,i + (offset/512),1); for (x=0x0;((x < 512) && ((x + (i * 512)) < size));x++) { @@ -175,10 +148,10 @@ } -int devFsMkNod(char *name,uInt8 type,uInt16 major,uInt16 minor) { +int devfs_makeNode(char *name,uInt8 type,uInt16 major,uInt16 minor) { struct mountPoints *mp = 0x0; - struct devFsInfo *fsInfo = 0x0; - struct devFsDevices *tmpDev = 0x0; + struct devfs_info *fsInfo = 0x0; + struct devfs_devices *tmpDev = 0x0; spinLock(&devfsSpinLock); @@ -192,7 +165,7 @@ fsInfo = mp->fsInfo; - tmpDev = (struct devFsDevices *)kmalloc(sizeof(struct devFsDevices)); + tmpDev = (struct devfs_devices *)kmalloc(sizeof(struct devfs_devices)); tmpDev->devType = type; tmpDev->devMajor = major; @@ -210,9 +183,39 @@ spinUnlock(&devfsSpinLock); return(0x0); } + +int devfs_init() { + /* Build our devfs struct */ + struct fileSystem devFS = + {NULL, /* prev */ + NULL, /* next */ + (void *)devfs_initialize, /* vfsInitFS */ + (void *)devfs_read, /* vfsRead */ + (void *)devfs_write, /* vfsWrite */ + (void *)devfs_open, /* vfsOpenFile */ + NULL, /* vfsUnlink */ + NULL, /* vfsMakeDir */ + NULL, /* vfsRemDir */ + NULL, /* vfsSync */ + 1 /* vfsType */ + }; /* devFS */ + + if (vfsRegisterFS(devFS) != 0x0) { + //sysErr(systemErr,"Unable To Enable DevFS"); + return(0x1); + } + /* Mount our devfs this will build the devfs container node */ + mount(0x0,0x0,0x0,0x1,"devfs","rw"); // Mount Device File System + + /* Return */ + return(0x0); + } /*** $Log$ + Revision 1.13 2004/07/20 22:42:34 reddawg + Fixed up any bugs I could find now to move onto bigger things + Revision 1.12 2004/07/16 20:17:29 flameshadow chg: broke the ufs stuff chg: changed vfsRegisterFS() to accept a fileSystem struct diff --git a/src/sys/include/devfs/devfs.h b/src/sys/include/devfs/devfs.h index 41293b2..e71f7e1 100644 --- a/src/sys/include/devfs/devfs.h +++ b/src/sys/include/devfs/devfs.h @@ -33,30 +33,36 @@ #include #include -struct devFsDevices { - struct devFsDevices *next; - struct devFsDevices *prev; +struct devfs_devices { + struct devfs_devices *next; + struct devfs_devices *prev; uInt8 devType; uInt16 devMajor; uInt16 devMinor; char devName[32]; }; -struct devFsInfo { - struct devFsDevices *deviceList; +struct devfs_info { + struct devfs_devices *deviceList; }; -int devFSOpen(char *file,fileDescriptor *fd); -void devFSInit(struct mountPoints *mp); int devfs_init(); -int devFSRead(fileDescriptor *fd,char *data,long offset,long size); -int devFSWrite(fileDescriptor *fd,char *data,long offset,long size); -int devFsMkNod(char *name,uInt8 type,uInt16 major,uInt16 minor); +int devfs_makeNode(char *name,uInt8 type,uInt16 major,uInt16 minor); +/* +int devfs_open(char *file,fileDescriptor *fd); +void devFSInit(struct mountPoints *mp); +int devfs_read(fileDescriptor *fd,char *data,long offset,long size); +int devfs_write(fileDescriptor *fd,char *data,long offset,long size); +*/ #endif /*** $Log$ + Revision 1.4 2004/07/14 12:17:52 reddawg + devfs: devFSEnable to devfs_init + Changed Startup Routines + Revision 1.3 2004/05/21 14:54:41 reddawg Cleaned up diff --git a/src/sys/include/lib/kmalloc.h b/src/sys/include/lib/kmalloc.h index dd34844..139941e 100644 --- a/src/sys/include/lib/kmalloc.h +++ b/src/sys/include/lib/kmalloc.h @@ -37,14 +37,16 @@ #endif #define sysID -2 +#define MALLOC_ALIGN_SIZE 32 +#define MALLOC_ALIGN(size) (size + ((((size) % MALLOC_ALIGN_SIZE) == 0)? 0 : (MALLOC_ALIGN_SIZE - ((size) % MALLOC_ALIGN_SIZE)))) struct memDescriptor { struct memDescriptor *prev; //4 struct memDescriptor *next; //4 void *baseAddr; //4 uInt32 limit; //4 - uInt8 status; //1 - char reserved[11]; //11 + /*uInt8 status; //1 */ + /*char reserved[11]; //11 */ }; void kfree(void *baseAddr); @@ -58,6 +60,9 @@ /*** $Log$ + Revision 1.5 2004/07/19 02:08:27 reddawg + Cleaned out the rest of debuging code also temporarily disabled the ip stack to improve boot time + Revision 1.4 2004/07/18 05:24:15 reddawg Fixens diff --git a/src/sys/include/pci/hd.h b/src/sys/include/pci/hd.h index ad250c2..3786026 100644 --- a/src/sys/include/pci/hd.h +++ b/src/sys/include/pci/hd.h @@ -66,7 +66,7 @@ int hdStart(); int hdStop(); int hdStandby(); -int hdInit(struct deviceNode *dev); +int hdInit(struct device_node *dev); extern struct driveInfo *hdd0; extern struct driveInfo *hdd1; @@ -77,6 +77,9 @@ /*** $Log$ + Revision 1.5 2004/05/21 15:05:07 reddawg + Cleaned up + END ***/ diff --git a/src/sys/include/string.h b/src/sys/include/string.h index e8f54c8..d55a2fc 100644 --- a/src/sys/include/string.h +++ b/src/sys/include/string.h @@ -39,10 +39,15 @@ int sprintf(char * str, const char * format, ...); +long strtol(const char * __restrict nptr, char ** __restrict endptr, int base); + #endif /*** $Log$ + Revision 1.4 2004/07/05 23:06:32 reddawg + Fixens + Revision 1.3 2004/06/04 13:29:56 reddawg libc: modified mkdir(); interface kpanic: kPanic(); now says kPanic: %s diff --git a/src/sys/include/sys/device.h b/src/sys/include/sys/device.h index b2b2bd6..b2e82a5 100644 --- a/src/sys/include/sys/device.h +++ b/src/sys/include/sys/device.h @@ -32,16 +32,21 @@ #include -struct deviceNode { - struct deviceNode *prev; - struct deviceNode *next; - struct deviceInterface *devInfo; - char type;; - int minor; - uInt32 size; +struct device_node { + struct device_node *prev; + struct device_node *next; + struct device_interface *devInfo; + struct device_resource *devRec; + char type; + int minor; + uInt32 size; + }; + +struct device_resource { + uInt8 irq; }; -struct deviceInterface { +struct device_interface { int major; void *info; void (*read)(void *,void *,uInt32,uInt32); @@ -55,13 +60,18 @@ }; -int deviceAdd(int,char,struct deviceInterface *); -struct deviceNode *deviceFind(int major,int minor); -int deviceRemove(struct deviceNode *); +int device_add(int,char,struct device_interface *); +struct device_node *device_find(int major,int minor); +int device_remove(struct device_node *); #endif /*** $Log$ + Revision 1.11 2004/05/22 02:40:04 ionix + + + fixed typo in device.h and initialized previous in device.c :) + Revision 1.10 2004/05/22 02:34:03 ionix diff --git a/src/sys/include/vfs/mount.h b/src/sys/include/vfs/mount.h index 6bdbeb0..05dc3e7 100644 --- a/src/sys/include/vfs/mount.h +++ b/src/sys/include/vfs/mount.h @@ -36,7 +36,7 @@ struct mountPoints *prev; struct mountPoints *next; struct fileSystem *fs; - struct deviceNode *device; + struct device_node *device; struct ubixDiskLabel *diskLabel; void *fsInfo; int partition; diff --git a/src/sys/isa/Makefile b/src/sys/isa/Makefile index dd0ae7f..586b0f5 100644 --- a/src/sys/isa/Makefile +++ b/src/sys/isa/Makefile @@ -16,7 +16,7 @@ .cc.s: $(CXX) $(CFLAGS) $(INCLUDES) -S -o $@ $< .c.o: - $(CC) $(CLFAGS) $(INCLUDES) -c -o $@ $< + $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< .c.s: $(CC) $(CFLAGS) $(INCLUDES) -S -o $@ $< .S.o: diff --git a/src/sys/isa/fdc.c b/src/sys/isa/fdc.c index 62d74ac..fe210fd 100644 --- a/src/sys/isa/fdc.c +++ b/src/sys/isa/fdc.c @@ -44,7 +44,7 @@ static drvGeom geometry = { dg144Heads,dg144Tracks,dg144Spt }; static bool diskChange = FALSE; static bool motor = FALSE; -static Int8 fdcTrack = 0xff; +static volatile Int8 fdcTrack = 0xff; static Int8 sr0 = 0; static volatile int timeOut = 0; static Int8 statSize = 0; @@ -52,13 +52,13 @@ unsigned long tbaddr = 0x80000L; -int fdcInit2(struct deviceNode *dev) { +int fdcInit2(struct device_node *dev) { dev->size = (1024 * 1450); return(0x0); } int fdc_init() { - struct deviceInterface *devInfo = (struct deviceInterface *)kmalloc(sizeof(struct deviceInterface)); + struct device_interface *devInfo = (struct device_interface *)kmalloc(sizeof(struct device_interface)); setVector(floppyIsr, mVec+6, (dInt+dPresent)); irqEnable(6); reset(); @@ -68,8 +68,8 @@ devInfo->write = fdcWrite; devInfo->reset = (void *)reset; - deviceAdd(0,'c',devInfo); - devFsMkNod("fd0",'b',0x0,0x0); + device_add(0,'c',devInfo); + devfs_makeNode("fd0",'b',0x0,0x0); return(0x0); } @@ -123,9 +123,10 @@ } bool fdcRw(int block,Int8 *blockBuffer,bool read,unsigned long numSectors) { - int head,track,sector,tries, copyCount = 0; + int head = 0x0,track = 0x0,sector = 0x0,tries= 0x0, copyCount = 0x0; unsigned char *p_tbaddr = (char *)0x80000; unsigned char *p_blockbuff = blockBuffer; + //kprintf("Block: [%i]\n",block); block2Hts(block,&head,&track,§or); motorOn(); if (!read && blockBuffer) { @@ -221,6 +222,7 @@ sendByte(0); sendByte(track); if (!waitFdc(TRUE)) { + kprintf("wait fdc failed\n"); return(FALSE); } if ((sr0 != 0x20) || (fdcTrack != track)) { @@ -232,10 +234,8 @@ } bool readBlock(int block,Int8 *blockBuffer, unsigned long numSectors) { - int track=0, sector=0, head=0, track2=0, result=0, loop=0; - block2Hts(block, &head, &track, §or); - block2Hts(block+numSectors, &head, &track2, §or); - if (track!=track2) { + int result = 0x0,loop = 0x0; + if (numSectors > 1) { for (loop=0; loopimageFd) fclose(_current->imageFd); + kprintf("FreePage: [0x%X]\n",systemVitals->freePages); sched_setStatus(_current->id,DEAD); schedYield(); return; @@ -53,6 +54,9 @@ /*** $Log$ + Revision 1.8 2004/07/19 02:31:17 reddawg + We do some propper task cleanup now when they exit... such as close open FD for LD and delete task from the task list + Revision 1.7 2004/07/19 02:08:28 reddawg Cleaned out the rest of debuging code also temporarily disabled the ip stack to improve boot time diff --git a/src/sys/kernel/ld.c b/src/sys/kernel/ld.c index 844cfab..67933a6 100644 --- a/src/sys/kernel/ld.c +++ b/src/sys/kernel/ld.c @@ -90,7 +90,7 @@ */ for (x=0;x < ((programHeader[i].phMemsz)+4095);x += 0x1000) { vmmRemapPage(vmmFindFreePage(_current->id),((programHeader[i].phVaddr & 0xFFFFF000) + x + LD_START)); - memset((uInt32)((programHeader[i].phVaddr & 0xFFFFF000) + x + LD_START),0x0,0x1000); + memset((void *)((programHeader[i].phVaddr & 0xFFFFF000) + x + LD_START),0x0,0x1000); } /* Now Load Section To Memory */ fseek(ldFd,programHeader[i].phOffset,0x0); @@ -161,6 +161,9 @@ /*** $Log$ + Revision 1.29 2004/07/20 22:29:55 reddawg + assert: remade assert + Revision 1.28 2004/07/17 03:10:18 reddawg Added asserts no problems thusfar diff --git a/src/sys/kernel/sched.c b/src/sys/kernel/sched.c index dd643b9..839047d 100644 --- a/src/sys/kernel/sched.c +++ b/src/sys/kernel/sched.c @@ -163,11 +163,11 @@ else if (tmpTask->state == DEAD) { if (tmpTask == _current) kpanic("unhandled situation"); - //if (schedDeleteTask(tmpTask->id) != 0x0) { - // kpanic("Error: schedDeleteTask");; - // } - //goto schedStart; - } + if (schedDeleteTask(tmpTask->id) != 0x0) { + kpanic("Error: schedDeleteTask");; + } + goto schedStart; + } */ } @@ -259,8 +259,10 @@ kpanic("you can not delete yourself!!!\n"); if (tmpTask == taskList) kpanic("Whoa"); - tmpTask->prev->next = tmpTask->next; - tmpTask->next->prev = tmpTask->prev; + if (tmpTask->prev) + tmpTask->prev->next = tmpTask->next; + if (tmpTask->next) + tmpTask->next->prev = tmpTask->prev; kfree(tmpTask->oInfo.cwd); kfree(tmpTask); return(0x0); @@ -336,6 +338,9 @@ /*** $Log$ + Revision 1.17 2004/07/20 18:58:24 reddawg + Few fixes + Revision 1.16 2004/07/20 18:51:00 reddawg sched: hold that was my error diff --git a/src/sys/lib/kmalloc.c b/src/sys/lib/kmalloc.c index 7128751..3ba4f2b 100644 --- a/src/sys/lib/kmalloc.c +++ b/src/sys/lib/kmalloc.c @@ -36,22 +36,37 @@ #include #include +/* + Set up three descriptor tables: + + kernDesc - The inuse descriptor table + freeKernDesc - The free descriptor table (descriptors with memory backing just not in use) + emptyKernDesc - The empty descriptor table (descriptors with out a memory backing) + +*/ static struct memDescriptor *kernDesc = 0x0; static struct memDescriptor *freeKernDesc = 0x0; static struct memDescriptor *emptyKernDesc = 0x0; +/* + Set up our spinlocks so we do not corrupt linked lists if we have re-entrancy +*/ static spinLock_t mallocSpinLock = SPIN_LOCK_INITIALIZER; static spinLock_t emptyDescSpinLock = SPIN_LOCK_INITIALIZER; static void initMalloc() { int i = 0x0; - emptyKernDesc = (struct memDescriptor *)vmmGetFreeKernelPage(sysID,4); + /* allocate out 4 pages of memory for our descriptor table this gives us 170 Entries */ + if ((emptyKernDesc = (struct memDescriptor *)vmmGetFreeKernelPage(sysID,4)) == 0x0) + kpanic("Error: vmmGetFreeKernelPage returned NULL\n"); + + /* zero out the memory so we know there is no garbage */ memset(emptyKernDesc,0x0,0x4000); emptyKernDesc[0].next = &emptyKernDesc[1]; - for (i = 0x1;i < ((0x1000/sizeof(struct memDescriptor))*4);i++) { + for (i = 0x1;i < ((0x4000/sizeof(struct memDescriptor)));i++) { emptyKernDesc[i].next = &emptyKernDesc[i+1]; emptyKernDesc[i].prev = &emptyKernDesc[i-1]; } @@ -84,16 +99,22 @@ spinUnlock(&emptyDescSpinLock); return(tmpDesc); } - emptyKernDesc = (struct memDescriptor *)vmmGetFreeKernelPage(sysID,1); + + if ((emptyKernDesc = (struct memDescriptor *)vmmGetFreeKernelPage(sysID,4)) == 0x0) + kpanic("Error: vmmGetFreeKernelPage returned NULL\n"); + + /* zero out the memory so we know there is no garbage */ memset(emptyKernDesc,0x0,0x4000); emptyKernDesc[0].next = &emptyKernDesc[1]; - for (i = 0x1;i < ((0x1000/sizeof(struct memDescriptor))*4);i++) { + for (i = 0x1;i < ((0x4000/sizeof(struct memDescriptor)));i++) { emptyKernDesc[i].next = &emptyKernDesc[i+1]; emptyKernDesc[i].prev = &emptyKernDesc[i-1]; } + tmpDesc = emptyKernDesc; + emptyKernDesc = tmpDesc->next; emptyKernDesc->prev = 0x0; tmpDesc->next = 0x0; @@ -114,26 +135,34 @@ "[20:20:59] You should just insert it in order" ************************************************************************/ -static void insertFreeDesc(struct memDescriptor *freeDesc) { +static int insertFreeDesc(struct memDescriptor *freeDesc) { struct memDescriptor *tmpDesc; assert(freeDesc); - freeDesc->status = 0x0; + if (freeDesc->limit <= 0x0) + kpanic("Inserting Descriptor with no limit\n"); + if (freeKernDesc != 0x0) { for (tmpDesc=freeKernDesc;tmpDesc;tmpDesc=tmpDesc->next) { - if ((freeDesc->limit >= tmpDesc->limit) && (!tmpDesc->next)) { + if (freeDesc->limit >= tmpDesc->limit) { + freeDesc->next = tmpDesc->next; tmpDesc->next = freeDesc; - freeDesc->prev = tmpDesc; - freeDesc->next = 0x0; - return; + if (freeDesc->next != 0x0) + freeDesc->next->prev = freeDesc; + return(0x0); } - else if ((freeDesc->limit >= tmpDesc->limit) && (freeDesc->limit <= tmpDesc->next->limit)) { - freeDesc->next = tmpDesc->next; - freeDesc->prev = tmpDesc; - tmpDesc->next->prev = freeDesc; - tmpDesc->next = freeDesc; - return; + else if (freeDesc->limit <= tmpDesc->limit) { + freeDesc->prev = tmpDesc->prev; + freeDesc->next = tmpDesc; + tmpDesc->prev = freeDesc; + if (freeKernDesc == tmpDesc) + freeKernDesc = freeDesc; + return(0x0); + } + else { + + kpanic("unhandled insert? [%i:%i]\n",freeDesc->limit,tmpDesc->limit); } } } @@ -141,10 +170,10 @@ freeDesc->prev = 0x0; freeDesc->next = 0x0; freeKernDesc = freeDesc; - return; + return(0x0); } //sysErr("Error With Freeing Blocks"); - return; + return(0x1); } /************************************************************************ @@ -177,7 +206,6 @@ tmpDesc1->limit += tmpDesc2->limit; tmpDesc2->baseAddr = 0x0; tmpDesc2->limit = 0x0; - tmpDesc2->status = 0x0; if (tmpDesc2->prev) { tmpDesc2->prev->next = tmpDesc2->next; } @@ -196,6 +224,7 @@ } tmpDesc1->prev = 0x0; tmpDesc1->next = 0x0; + kprintf("mergememBlocks: [%i]\n",tmpDesc1->limit); insertFreeDesc(tmpDesc1); tmpDesc1 = freeKernDesc; break; @@ -228,7 +257,9 @@ if (emptyKernDesc == 0x0) { initMalloc(); } - len = (len + 15) & 0xFFFFFFF0; + + len = MALLOC_ALIGN(len); + if (len == 0x0) { kpanic("Malloc of Size 0 Requested\n"); spinUnlock(&mallocSpinLock); @@ -236,7 +267,6 @@ } for (tmpDesc1 = freeKernDesc;tmpDesc1;tmpDesc1=tmpDesc1->next) { if (tmpDesc1->limit >= len) { - tmpDesc1->status = 0x1; if (tmpDesc1->prev != 0x0) { tmpDesc1->prev->next = tmpDesc1->next; tmpDesc1->next->prev = tmpDesc1->prev; @@ -255,9 +285,10 @@ tmpDesc2->limit = tmpDesc1->limit - len; tmpDesc1->limit = len; tmpDesc2->baseAddr = tmpDesc1->baseAddr + len; - tmpDesc2->status = 0x0; tmpDesc2->next = 0x0; tmpDesc2->prev = 0x0; + if (tmpDesc2->limit <= 0x0) + kprintf("kmalloc-1 tmpDesc2: [%i]\n",tmpDesc2->limit); insertFreeDesc(tmpDesc2); } buf = (char *)tmpDesc1->baseAddr; @@ -272,19 +303,19 @@ if (tmpDesc1 != 0x0) { tmpDesc1->baseAddr = (struct memDescriptor *)vmmGetFreeKernelPage(sysID,((len + 4095)/4096)); tmpDesc1->limit = len; - tmpDesc1->status = 0x1; tmpDesc1->next = kernDesc; tmpDesc1->prev = 0x0; kernDesc = tmpDesc1; kernDesc->next->prev = tmpDesc1; - if ((len-4096) > 0) { + if ((len%0x1000) > 0) { tmpDesc2 = getEmptyDesc(); assert(tmpDesc2); - tmpDesc2->status = 0x0; tmpDesc2->baseAddr = tmpDesc1->baseAddr + tmpDesc1->limit; tmpDesc2->limit = ((len + 4095)/4096)*4096 - tmpDesc1->limit; tmpDesc2->prev = 0x0; tmpDesc2->next = 0x0; + if (tmpDesc2->limit <= 0x0) + kprintf("kmalloc-2 tmpDesc2: [%i]\n",tmpDesc2->limit); insertFreeDesc(tmpDesc2); } buf = (char *)tmpDesc1->baseAddr; @@ -319,7 +350,6 @@ for (tmpDesc1=kernDesc;tmpDesc1;tmpDesc1=tmpDesc1->next) { if (tmpDesc1->baseAddr == baseAddr) { - tmpDesc1->status = 0x0; if (tmpDesc1->prev != 0x0) { tmpDesc2 = tmpDesc1->prev; tmpDesc2->next = tmpDesc1->next; @@ -333,6 +363,8 @@ } tmpDesc1->next = 0x0; tmpDesc1->prev = 0x0; + if (tmpDesc1->limit <= 0x0) + kprintf("kfree tmpDesc1: [%i]\n",tmpDesc1->limit); insertFreeDesc(tmpDesc1); data = (uInt32 *)baseAddr; for (i=0;i < (tmpDesc1->limit/4);i++) { @@ -350,6 +382,9 @@ /*** $Log$ + Revision 1.15 2004/07/20 23:20:50 reddawg + kmalloc: forgot to remove an assert + Revision 1.14 2004/07/20 23:18:11 reddawg Made malloc a little more robust but we have a serious memory leak somewhere diff --git a/src/sys/lib/kprintf.c b/src/sys/lib/kprintf.c index 204a657..122c970 100644 --- a/src/sys/lib/kprintf.c +++ b/src/sys/lib/kprintf.c @@ -27,6 +27,7 @@ *****************************************************************************************/ +#include #include #include #include @@ -61,6 +62,9 @@ /*** $Log$ + Revision 1.6 2004/07/20 22:58:33 reddawg + retiring to the laptop for the night must sync in work to resume from there + Revision 1.5 2004/07/20 22:29:55 reddawg assert: remade assert diff --git a/src/sys/lib/net.c b/src/sys/lib/net.c index ef76884..8617613 100644 --- a/src/sys/lib/net.c +++ b/src/sys/lib/net.c @@ -24,6 +24,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $Log$ + Revision 1.5 2004/06/28 23:12:58 reddawg + file format now container:/path/to/file + Revision 1.4 2004/06/17 03:14:59 flameshadow chg: added missing #include for kprintf() @@ -51,8 +54,8 @@ *****************************************************************************************/ #include -#include #include +#include #include "lib/kprintf.h" diff --git a/src/sys/lib/strtol.c b/src/sys/lib/strtol.c index 2314ad4..becd0b7 100644 --- a/src/sys/lib/strtol.c +++ b/src/sys/lib/strtol.c @@ -94,6 +94,7 @@ } else if (!any) { noconv: //errno = EINVAL; + cutoff = 0x0;//UBU } else if (neg) acc = -acc; if (endptr != NULL) diff --git a/src/sys/pci/hd.c b/src/sys/pci/hd.c index 9647958..98e3f14 100644 --- a/src/sys/pci/hd.c +++ b/src/sys/pci/hd.c @@ -42,7 +42,7 @@ struct driveInfo *hdd3; void initHardDisk() { - struct deviceInterface *devInfo = 0x0; + struct device_interface *devInfo = 0x0; hdd0 = (struct driveInfo *)kmalloc(sizeof(struct driveInfo)); hdd0s1 = (struct driveInfo *)kmalloc(sizeof(struct driveInfo)); hdd1 = (struct driveInfo *)kmalloc(sizeof(struct driveInfo)); @@ -62,7 +62,7 @@ hdd3->hdDev = 0x50; /* Alloc memory for device structure and set it up correctly */ - devInfo = (struct deviceInterface *)kmalloc(sizeof(struct deviceInterface)); + devInfo = (struct device_interface *)kmalloc(sizeof(struct device_interface)); devInfo->read = (void *)&hdRead; devInfo->write = (void *)&hdWrite; devInfo->reset = (void *)&hdReset; @@ -73,12 +73,12 @@ devInfo->standby = (void *)&hdStandby; devInfo->info = hdd0; devInfo->major = 1; - deviceAdd(0,'c',devInfo); + device_add(0,'c',devInfo); //deviceAdd(1,0,'c',hdRead,hdWrite,hdReset,hdInit,hdIoctl,hdStop,hdStart,hdStandby,hdd0); //deviceAdd(1,1,'c',hdRead,hdWrite,hdReset,hdInit,hdIoctl,hdStop,hdStart,hdStandby,hdd0s1); - devFsMkNod("ad0",'c',0x1,0x0); - devFsMkNod("ad0s1",'c',0x1,0x1); + devfs_makeNode("ad0",'c',0x1,0x0); + devfs_makeNode("ad0s1",'c',0x1,0x1); /* if (!initDrive(hdd1)) { addDrive(2,1,hdd1,hdRead,hdWrite,0x0); @@ -113,7 +113,7 @@ return(0x0); } -int hdInit(struct deviceNode *dev) { +int hdInit(struct device_node *dev) { char retVal = 0x0; long counter = 0x0; short *tmp = 0x0; @@ -315,6 +315,9 @@ /*** $Log$ + Revision 1.11 2004/05/19 23:36:52 reddawg + Bug Fixes + Revision 1.10 2004/05/19 15:20:06 reddawg Fixed reference problems due to changes in drive subsystem diff --git a/src/sys/sys/device.c b/src/sys/sys/device.c index 9a83b71..b456f2e 100644 --- a/src/sys/sys/device.c +++ b/src/sys/sys/device.c @@ -33,12 +33,12 @@ #include /* Linked list of drivers loaded in the system accessable by the subsystem only */ -static struct deviceNode *devices = 0x0; +static struct device_node *devices = 0x0; static spinLock_t deviceSpinLock = SPIN_LOCK_INITIALIZER; /***************************************************************************************** - Function: int deviceAdd(int minor,char type,struct deviceInterface *devInfo); + Function: int deviceAdd(int minor,char type,struct device_interface *devInfo); Description: This will add a device to the system @@ -47,12 +47,12 @@ 05/19/2004 - Improving Upon the spec *****************************************************************************************/ -int deviceAdd(int minor,char type,struct deviceInterface *devInfo) { - struct deviceNode *tmpDev = 0x0; +int device_add(int minor,char type,struct device_interface *devInfo) { + struct device_node *tmpDev = 0x0; spinLock(&deviceSpinLock); - tmpDev = (struct deviceNode *)kmalloc(sizeof(struct deviceNode)); + tmpDev = (struct device_node *)kmalloc(sizeof(struct device_node)); assert(tmpDev); tmpDev->prev = 0x0; @@ -69,7 +69,7 @@ /***************************************************************************************** - Function: struct deviceNode *deviceFind(int major,int minor); + Function: struct device_node *deviceFind(int major,int minor); Description: This will find a device based on major minor @@ -78,8 +78,8 @@ 05/19/2004 - Improving Upon the spec *****************************************************************************************/ -struct deviceNode *deviceFind(int major,int minor) { - struct deviceNode *tmpDev = 0x0; +struct device_node *device_find(int major,int minor) { + struct device_node *tmpDev = 0x0; spinLock(&deviceSpinLock); @@ -97,14 +97,14 @@ /******************************************************************************************** -Function: int deviceRemove(struct *deviceNode); +Function: int deviceRemove(struct *device_node); Description: This will remove a device based on it's pointer *********************************************************************************************/ -int deviceRemove(struct deviceNode *deviceToDelete) +int device_remove(struct device_node *deviceToDelete) { -struct deviceNode *current, *previous; +struct device_node *current, *previous; spinLock(&deviceSpinLock); @@ -136,6 +136,9 @@ /*** $Log$ + Revision 1.12 2004/07/17 03:32:22 reddawg + assert() + Revision 1.11 2004/06/15 12:14:38 reddawg Cleaned Up diff --git a/src/sys/vfs/file.c b/src/sys/vfs/file.c index 1376c96..400b413 100644 --- a/src/sys/vfs/file.c +++ b/src/sys/vfs/file.c @@ -87,7 +87,7 @@ fileDescriptor *tmpFD = 0x0; char tmpDir[1024]; char rootPath[256]; - char *dir = 0x0,*mountPoint = 0x0; + char *dir = 0x0;//UBU*mountPoint = 0x0; char *tmp = 0x0; rootPath[0] = '\0'; dir = (char *)path; @@ -255,6 +255,9 @@ /*** $Log$ + Revision 1.9 2004/07/18 05:24:15 reddawg + Fixens + Revision 1.8 2004/06/29 03:59:48 reddawg Fixed a few issues with subdirectories they are working much better now diff --git a/src/sys/vfs/mount.c b/src/sys/vfs/mount.c index 51bf273..3284946 100644 --- a/src/sys/vfs/mount.c +++ b/src/sys/vfs/mount.c @@ -45,7 +45,7 @@ ************************************************************************/ int mount(int major,int minor,int partition,int vfsType,char *mountPoint,char *perms) { struct mountPoints *mp = 0x0; - struct deviceNode *device = 0x0; + struct device_node *device = 0x0; /* Allocate Memory For Mount Point */ mp = (struct mountPoints *)kmalloc(sizeof(struct mountPoints)); @@ -54,7 +54,7 @@ sprintf(mp->mountPoint,mountPoint); /* Set Pointer To Physical Drive */ - device = deviceFind(major,minor); + device = device_find(major,minor); /* Set Up Mp Defaults */ mp->device = device; @@ -136,6 +136,9 @@ /*** $Log$ + Revision 1.7 2004/06/28 23:12:58 reddawg + file format now container:/path/to/file + Revision 1.6 2004/05/19 15:22:50 reddawg Fixed reference issues due to changes in driver subsystem