diff --git a/src/sys/include/net/arch/sys_arch.h b/src/sys/include/net/arch/sys_arch.h index e99d802..80128da 100644 --- a/src/sys/include/net/arch/sys_arch.h +++ b/src/sys/include/net/arch/sys_arch.h @@ -19,4 +19,6 @@ struct sys_timeout *next; }; +void sys_thread_new(void (*)(void), void *); + #endif diff --git a/src/sys/include/ubixos/init.h b/src/sys/include/ubixos/init.h index 6c220a7..50dc6c7 100644 --- a/src/sys/include/ubixos/init.h +++ b/src/sys/include/ubixos/init.h @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include #include @@ -56,7 +56,7 @@ typedef int (*intFunctionPTR)( void ); intFunctionPTR init_tasks[] = { vmm_init, static_constructors, i8259_init, idt_init, vitals_init, sysctl_init, vfs_init, sched_init, pit_init, atkbd_init, time_init, - pci_init, devfs_init, tty_init, ufs_init, initHardDisk, initLNC, net_init }; + pci_init, devfs_init, tty_init, ufs_init, initHardDisk, initLNC, tcpip_init }; //ne2k_init, //ubixfs_init, diff --git a/src/sys/net/net/sys_arch.c b/src/sys/net/net/sys_arch.c index 1e764d7..f99c436 100644 --- a/src/sys/net/net/sys_arch.c +++ b/src/sys/net/net/sys_arch.c @@ -1,33 +1,33 @@ /* * Copyright (c) 2001, Swedish Institute of Computer Science. - * All rights reserved. + * All rights reserved. * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * Sub Author: Christopher Olsen * @@ -104,6 +104,39 @@ kTask_t *ubthread; }; +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)); + memset(thread, 0x0, sizeof(struct sys_thread)); + kprintf("THREAD: [0x%X]\n", thread); + + spinLock(&netThreadSpinlock); + thread->next = threads; + thread->timeouts.next = NULL; + thread->ubthread = 0x0; + threads = thread; + spinUnlock(&netThreadSpinlock); + + /* + thread_param = kmalloc(sizeof(struct thread_start_param)); + + thread_param->function = function; + thread_param->arg = arg; + thread_param->thread = thread; + */ + //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); + +} + #ifdef _BALLS #define UMAX(a, b) ((a) > (b) ? (a) : (b)) @@ -153,39 +186,7 @@ } */ -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)); - memset(thread, 0x0, sizeof(struct sys_thread)); - kprintf("THREAD: [0x%X]\n", thread); - - - spinLock(&netThreadSpinlock); - thread->next = threads; - thread->timeouts.next = NULL; - thread->ubthread = 0x0; - threads = thread; - spinUnlock(&netThreadSpinlock); - - /* - thread_param = kmalloc(sizeof(struct thread_start_param)); - - thread_param->function = function; - thread_param->arg = arg; - thread_param->thread = thread; - */ - //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() { struct sys_mbox *mbox;