diff --git a/src/sys/include/net/sys.h b/src/sys/include/net/sys.h index 62302bf..f453ded 100644 --- a/src/sys/include/net/sys.h +++ b/src/sys/include/net/sys.h @@ -83,7 +83,8 @@ void sys_mbox_fetch(sys_mbox_t mbox, void **msg); /* Thread functions. */ -void sys_thread_new(void (* thread)(void *arg), void *arg); +//void sys_thread_new(void (* thread)(void *arg), void *arg); +void sys_thread_new(void (* function)(void), void *arg); /* The following functions are used only in Unix code, and can be omitted when porting the stack. */ diff --git a/src/sys/include/ubixos/init.h b/src/sys/include/ubixos/init.h index 2ad3fc3..0272333 100644 --- a/src/sys/include/ubixos/init.h +++ b/src/sys/include/ubixos/init.h @@ -59,8 +59,8 @@ pit_init, atkbd_init, time_init, - /* net_init, */ - /* ne2k_init, */ + net_init, + ne2k_init, devfs_init, pci_init, ubixfs_init, @@ -74,6 +74,9 @@ /*** $Log$ + Revision 1.28 2004/08/20 16:49:11 reddawg + PCI Updates - More to follow as PCI system gets revamped + Revision 1.27 2004/08/03 18:31:18 reddawg virtual terms diff --git a/src/sys/include/ubixos/ubthread.h b/src/sys/include/ubixos/ubthread.h index ed570f9..85ef83e 100644 --- a/src/sys/include/ubixos/ubthread.h +++ b/src/sys/include/ubixos/ubthread.h @@ -79,7 +79,7 @@ int ubthread_mutex_init(ubthread_mutex_t *mutex,const uInt32 attr); int ubthread_cond_destroy(ubthread_cond_t *cond); int ubthread_mutex_destroy(ubthread_mutex_t *mutex); -int ubthread_create(kTask_t **thread,const uInt32 *attr,void *start_routine, void *arg); +int ubthread_create(kTask_t **thread,const uInt32 *attr,void (* tproc)(void), void *arg); int ubthread_mutex_lock(ubthread_mutex_t *mutex); int ubthread_mutex_unlock(ubthread_mutex_t *mutex); int ubthread_cond_timedwait(ubthread_cond_t *cond, ubthread_mutex_t *mutex, const struct timespec *abstime); @@ -90,6 +90,9 @@ /*** $Log$ + Revision 1.2 2004/05/21 15:20:00 reddawg + Cleaned up + END ***/ diff --git a/src/sys/init/main.c b/src/sys/init/main.c index 3e2ea66..1659d1c 100644 --- a/src/sys/init/main.c +++ b/src/sys/init/main.c @@ -109,17 +109,17 @@ /* initHardDisk(); */ /* Initialize the system */ - execThread(systemTask,(uInt32)(kmalloc(0x2000)+0x2000),0x0); + execThread(systemTask,0x0,0x0); - execFile("sys:/init",0x0,0x0,0x1); + //execFile("sys:/init",0x0,0x0,0x1); /* execFile("sys:/login",0x0,0x0,0x1); */ - execFile("sys:/login",0x0,0x0,0x2); - execFile("sys:/login",0x0,0x0,0x3); - execFile("sys:/login",0x0,0x0,0x4); + //execFile("sys:/login",0x0,0x0,0x2); + //execFile("sys:/login",0x0,0x0,0x3); + //execFile("sys:/login",0x0,0x0,0x4); kprintf("Free Pages: [%i]\n",systemVitals->freePages); kprintf("MemoryMap: [0x%X]\n",vmmMemoryMap); @@ -134,6 +134,9 @@ /*** $Log$ + Revision 1.80 2004/09/06 15:13:25 reddawg + Last commit before FreeBSD 6.0 + Revision 1.79 2004/08/25 22:02:41 reddawg task switching - We now are using software switching to be consistant with the rest of the world because all of this open source freaks gave me a hard time about something I liked. There doesn't seem to be any gain in performance but it is working fine and flawlessly diff --git a/src/sys/kernel/exec.c b/src/sys/kernel/exec.c index a42dfc3..ec4ddf3 100644 --- a/src/sys/kernel/exec.c +++ b/src/sys/kernel/exec.c @@ -54,45 +54,15 @@ /* Find A New Thread */ newProcess = schedNewTask(); assert(newProcess); - if (stack < 0x100000) - kpanic("exec: stack not in valid area: [0x%X]\n",stack); /* Set All The Correct Thread Attributes */ - /* Old - newProcess->tss.back_link = 0x0; - newProcess->tss.esp0 = 0x0; - newProcess->tss.ss0 = 0x0; - newProcess->tss.esp1 = 0x0; - newProcess->tss.ss1 = 0x0; - newProcess->tss.esp2 = 0x0; - newProcess->tss.ss2 = 0x0; - newProcess->tss.cr3 = (unsigned int)kernelPageDirectory; - newProcess->tss.eip = (unsigned int)tproc; - newProcess->tss.eflags = 0x206; - newProcess->tss.esp = stack; - newProcess->tss.ebp = stack; - newProcess->tss.esi = 0x0; - newProcess->tss.edi = 0x0; - - newProcess->tss.es = 0x10; - newProcess->tss.cs = 0x08; - newProcess->tss.ss = 0x10; - newProcess->tss.ds = 0x10; - newProcess->tss.fs = 0x10; - newProcess->tss.gs = 0x10; - newProcess->tss.ldt = 0x18; - - newProcess->tss.trace_bitmap = 0x0000; - newProcess->tss.io_map = 0x8000; - newProcess->oInfo.vmStart = 0x6400000; - */ newProcess->cr3 = (uInt32)kernelPageDirectory; newProcess->iframe->eip = (uInt32)tproc; newProcess->iframe->flags = 0x206; newProcess->iframe->esp = (uInt32)&newProcess->kernelStack + 0x2000 - sizeof(struct i386_frame); - newProcess->iframe->ebp = stack; - newProcess->iframe->user_esp = stack; + newProcess->iframe->ebp = newProcess->iframe->esp;//stack; + newProcess->iframe->user_esp = newProcess->iframe->esp;//stack; newProcess->iframe->user_ss = 0x10; newProcess->iframe->cs = 0x08; newProcess->iframe->es = 0x10; @@ -100,24 +70,27 @@ newProcess->iframe->ds = 0x10; newProcess->iframe->fs = 0x10; newProcess->iframe->gs = 0x10; - + kprintf("ESP: [0x%X:0x%X]\n", newProcess->iframe->user_esp, newProcess->iframe); /* Set up default stack for thread here filled with arg list 3 times */ asm volatile( "pusha \n" "movl %%esp,%%ecx \n" "movl %1,%%eax \n" "movl %%eax,%%esp \n" - "pushl %%ebx \n" - "pushl %%ebx \n" - "pushl %%ebx \n" + "pushl %0 \n" + "pushl %0 \n" + "pushl %0 \n" "movl %%esp,%%eax \n" "movl %%eax,%1 \n" "movl %%ecx,%%esp \n" "popa \n" : : "b" (arg),"m" (newProcess->iframe->user_esp) + : "eax" ); + newProcess->iframe->esp = newProcess->iframe->user_esp; + kprintf("ESP: [0x%X:0x%X]\n", newProcess->iframe->esp, newProcess->iframe); /* Put new thread into the READY state */ sched_setStatus(newProcess->id,READY); @@ -495,6 +468,24 @@ /*** $Log$ + Revision 1.69 2004/08/26 22:51:18 reddawg + TCA touched me :( i think he likes men.... + + + sched.h: kTask_t added parentPid + endtask.c: fixed term back to parentPid + exec.c: cleaned warnings + fork.c: fixed term to childPid + sched.c: clean up for dead tasks + systemtask.c: clean up dead tasks + kmalloc.c: cleaned up warnings + udp.c: cleaned up warnings + bot.c: cleaned up warnings + shell.c: cleaned up warnings + tcpdump.c: took a dump + hd.c: cleaned up warnings + ubixfs.c: stopped prning debug info + Revision 1.68 2004/08/25 22:02:41 reddawg task switching - We now are using software switching to be consistant with the rest of the world because all of this open source freaks gave me a hard time about something I liked. There doesn't seem to be any gain in performance but it is working fine and flawlessly diff --git a/src/sys/kernel/ubthread.c b/src/sys/kernel/ubthread.c index 9200f40..b052312 100644 --- a/src/sys/kernel/ubthread.c +++ b/src/sys/kernel/ubthread.c @@ -72,8 +72,8 @@ return(0x0); } -int ubthread_create(kTask_t **thread,const uInt32 *attr,void *start_routine, void *arg) { - *thread = (void *)execThread((void *)start_routine,(uInt32)(kmalloc(0x2000)+0x2000),arg); +int ubthread_create(kTask_t **thread,const uInt32 *attr,void (* tproc)(void), void *arg) { + *thread = (void *)execThread(tproc,0x0,arg); return(0x0); } @@ -129,6 +129,9 @@ /*** $Log$ + Revision 1.10 2004/08/06 22:43:04 reddawg + ok + Revision 1.9 2004/08/06 22:32:16 reddawg Ubix Works Again diff --git a/src/sys/net/net/init.c b/src/sys/net/net/init.c index 3698bd6..a3027cf 100644 --- a/src/sys/net/net/init.c +++ b/src/sys/net/net/init.c @@ -53,7 +53,13 @@ memp_init(); pbuf_init(); - sys_thread_new((void *)(netMainThread), NULL); + /* + *thread = (void *)execThread((void *)start_routine,0x0,arg); + */ + + sys_thread_new((void *)(netMainThread), 0x0); + + //execThread((void *)(netMainThread),0x0,0x0); return(0x0); } @@ -62,12 +68,13 @@ void netMainThread() { struct ip_addr ipaddr, netmask, gw; sys_sem_t sem; - + /* netif_init(); sem = sys_sem_new(0); tcpip_init(tcpip_init_done, &sem); sys_sem_wait(sem); sys_sem_free(sem); + */ kprintf("TCP/IP initialized.\n"); IP4_ADDR(&gw, 10,4,0,1); @@ -83,6 +90,7 @@ //udpecho_init(); //shell_init(); //bot_init(); + while (1); endTask(_current->id); } diff --git a/src/sys/net/net/sys_arch.c b/src/sys/net/net/sys_arch.c index cc8b472..850750e 100644 --- a/src/sys/net/net/sys_arch.c +++ b/src/sys/net/net/sys_arch.c @@ -35,6 +35,9 @@ * Modified to work with the ubix operating system * * $Log$ + * Revision 1.4 2004/05/25 22:49:29 reddawg + * Stupid Old CODE!!! + * * Revision 1.3 2004/05/19 04:07:43 reddawg * kmalloc(size,pid) no more it is no kmalloc(size); the way it should of been * @@ -75,7 +78,7 @@ #define UMAX(a, b) ((a) > (b) ? (a) : (b)) -static struct sys_thread *threads = NULL; +static struct sys_thread *threads = 0x0; struct sys_mbox_msg { struct sys_mbox_msg *next; @@ -145,25 +148,34 @@ } */ -void sys_thread_new(void (* function)(void *arg), void *arg) { - struct sys_thread *thread; - struct thread_start_param *thread_param; - +void sys_thread_new(void (* function)(void), void *arg) { + struct sys_thread *thread = 0x0; + //struct thread_start_param *thread_param; + kprintf("sys_thread: [0x%X]\n",sizeof(struct sys_thread)); + thread = kmalloc(sizeof(struct sys_thread)); + kprintf("THREAD: [0x%X]\n",thread); thread->next = threads; thread->timeouts.next = NULL; - thread->ubthread = 0; + thread->ubthread = 0x0; threads = thread; + + /* thread_param = kmalloc(sizeof(struct thread_start_param)); thread_param->function = function; thread_param->arg = arg; thread_param->thread = thread; - - if(ubthread_create(&(thread->ubthread), NULL, function, arg) != 0) { + */ + //execThread((void *)function,0x0,0x0); + + kprintf("thread->ubthread: [0x%X]\n",thread->ubthread); + if(ubthread_create(&thread->ubthread, 0x0,(void *)(function), arg) != 0x0) { kpanic("sys_thread_new: ubthread_create"); } + kprintf("thread->ubthread: [0x%X]\n",thread->ubthread); + } struct sys_mbox *sys_mbox_new() { diff --git a/src/sys/net/netif/ethernetif.c b/src/sys/net/netif/ethernetif.c index 85c8937..b70bc32 100644 --- a/src/sys/net/netif/ethernetif.c +++ b/src/sys/net/netif/ethernetif.c @@ -95,7 +95,7 @@ ethernetif->ethaddr->addr[5] = 0x93; /* Do whatever else is needed to initialize interface. */ - + kprintf("NETIF: [0x%X:0x%X]\n",netif,ethernetif_thread); sys_thread_new(ethernetif_thread, netif); } @@ -273,10 +273,12 @@ */ /*-----------------------------------------------------------------------------------*/ static void ethernetif_input(struct netif *netif) { - struct ethernetif *ethernetif; - struct eth_hdr *ethhdr; - struct pbuf *p; + struct ethernetif *ethernetif = 0x0; + struct eth_hdr *ethhdr = 0x0; + struct pbuf *p = 0x0; + kprintf("netif: [0x%X]\n",netif); + while (1); ethernetif = netif->state;