diff --git a/.cproject b/.cproject
new file mode 100644
index 0000000..2d69f48
--- /dev/null
+++ b/.cproject
@@ -0,0 +1,209 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.project b/.project
new file mode 100644
index 0000000..36cd27c
--- /dev/null
+++ b/.project
@@ -0,0 +1,77 @@
+
+
+ ubixos-kernel
+
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.genmakebuilder
+ clean,full,incremental,
+
+
+ ?name?
+
+
+
+ org.eclipse.cdt.make.core.append_environment
+ true
+
+
+ org.eclipse.cdt.make.core.autoBuildTarget
+ all
+
+
+ org.eclipse.cdt.make.core.buildArguments
+
+
+
+ org.eclipse.cdt.make.core.buildCommand
+ make
+
+
+ org.eclipse.cdt.make.core.cleanBuildTarget
+ clean
+
+
+ org.eclipse.cdt.make.core.contents
+ org.eclipse.cdt.make.core.activeConfigSettings
+
+
+ org.eclipse.cdt.make.core.enableAutoBuild
+ false
+
+
+ org.eclipse.cdt.make.core.enableCleanBuild
+ true
+
+
+ org.eclipse.cdt.make.core.enableFullBuild
+ true
+
+
+ org.eclipse.cdt.make.core.fullBuildTarget
+ all
+
+
+ org.eclipse.cdt.make.core.stopOnError
+ true
+
+
+ org.eclipse.cdt.make.core.useDefaultBuildCmd
+ true
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
+
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
+ org.eclipse.cdt.managedbuilder.core.managedBuildNature
+ org.eclipse.cdt.core.cnature
+
+
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..dac72ca
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,90 @@
+# $Id$
+# Kernel Makefile (C) 2002 The UbixOS Project
+
+all: pci-code ufs-code vfs-code isa-code kernel-code lib-code vmm-code sys-code init-code devfs-code mpi-code kmods-code kernel-img
+
+generic-code: generic
+ (cd generic;make)
+
+init-code: init
+ (cd init;make)
+
+kernel-code: kernel
+ (cd kernel;make)
+
+isa-code: isa
+ (cd isa;make)
+
+pci-code: pci
+ (cd pci;make)
+
+sys-code: sys
+ (cd sys;make)
+
+vmm-code: vmm
+ (cd vmm;make)
+
+ubixfs-code: ubixfs
+ (cd ubixfs;make)
+
+devfs-code: devfs
+ (cd devfs;make)
+
+graphics-code: graphics
+ (cd graphics;make)
+
+ld-code: ld
+ (cd ld;make)
+
+lib-code: lib
+ (cd lib;make)
+
+sde-code: sde
+ (cd sde;make)
+
+vfs-code: vfs
+ (cd vfs;make)
+
+net-code: net
+ (cd net;make)
+
+mpi-code: mpi
+ (cd mpi;make)
+
+ufs-code: ufs
+ (cd ufs;make)
+
+kmods-code: kmods
+ (cd kmods;make)
+
+kernel-img: compile
+ (/bin/echo "/* " > ./compile/null.c)
+ (date >> ./compile/null.c)
+ (echo $user >> ./compile/null.c)
+ (/bin/echo " */" >> ./compile/null.c)
+ (cd compile;make)
+
+install:
+# (cd compile;cp ./ubix.elf /mnts/ubix/boot/loader)
+# (cd boot;make install)
+# (cd ../tools/;make format-dsk)
+ (cd ../tools/;make install-ubix)
+
+clean:
+ (cd init;make clean)
+ (cd compile;make clean)
+ (cd sys;make clean)
+ (cd vmm;make clean)
+ (cd lib;make clean)
+ (cd kernel;make clean)
+ (cd isa;make clean)
+ (cd vfs;make clean)
+ (cd ubixfs;make clean)
+ (cd pci;make clean)
+ (cd sde;make clean)
+ (cd devfs;make clean)
+ #(cd net;make clean)
+ (cd mpi;make clean)
+ (cd kmods;make clean)
+ (cd ufs;make clean)
+ (cd ../tools/;make clean)
diff --git a/Makefile.inc b/Makefile.inc
new file mode 100644
index 0000000..882e13f
--- /dev/null
+++ b/Makefile.inc
@@ -0,0 +1,6 @@
+# $Id$
+# global 'sys' options
+
+INCLUDES = -I../include
+CFLAGS = -Wall -nostdlib -nostdinc -fno-builtin -fno-exceptions -O -DNOTIMP #-DVFSDEBUG -DDEBUG #-DVMMDEBUG #-DVFSDEBUG
+KERNEL = ubix.elf
diff --git a/README b/README
new file mode 100644
index 0000000..8e48707
--- /dev/null
+++ b/README
@@ -0,0 +1,18 @@
+Directory Structure:
+
+ boot - Contains boot strapping code
+ compile - Contains Information to build UbixOS kernel
+ devfs - Contains the devfs code
+ include - All of the kernel include files
+ init - Initialization code for kernel
+ isa - ISA drivers
+ kernel - Kernel code (things not directly connected with the system)
+ lib - Kernel library
+ mpi - Message passing interface code
+ net - Networking subsystem code (LwIP)
+ pci - PCI drivers and subsystem
+ sde - Screen drawing engine code
+ sys - System related code IDT etc.
+ ubixfs - UbixFS code
+ vfs - VFS subsystem code
+ vmm - VMM subsystem code
diff --git a/compile/Makefile b/compile/Makefile
new file mode 100644
index 0000000..1277ec6
--- /dev/null
+++ b/compile/Makefile
@@ -0,0 +1,39 @@
+# $Id$
+# Kernel Makefile (C) 2002 The UbixOS Project
+
+# Include Global 'Source' Options
+include ../../Makefile.inc
+include ../Makefile.inc
+
+#Objects
+OBJS = null.o
+
+#Kernel Parts
+KPARTS = ../init/*.o ../sys/*.o ../vmm/*.o ../lib/*.o ../kernel/*.o ../isa/*.o ../vfs/*.o ../pci/*.o ../devfs/*.o ../mpi/*.o ../ufs/*.o
+# ../sde/*.o ../graphics/*.o ../ld/*.o -Ttext 0x30000 -Tdata 0x34000 ../ubixfs/*.o
+
+# Link the kernel statically with fixed text+data address @1M
+$(KERNEL) : $(OBJS)
+ #$(LD) -nostdlib -nostdinc --warn-section-align -o $@ $(OBJS) $(KPARTS) -Ttext 0x30000 -Tdata 0x20000
+ $(LD) -T ./ldscript.i386 -o $@ $(OBJS) $(KPARTS)
+ #/usr/bin/strip $@
+
+# Compile the source files
+.cc.o:
+ $(CXX) -${CFLAGS} $(INCLUDES) -c -o $@ $<
+
+.cc.s:
+ $(CXX) ${CFLAGS} $(INCLUDES) -S -o $@ $<
+
+.c.o:
+ $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
+
+.c.s:
+ $(CC) $(CFLAGS) $(INCLUDES) -S -o $@ $<
+
+.S.o:
+ $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
+
+# Clean up the junk
+clean:
+ $(REMOVE) $(OBJS) $(KERNEL) null.c
diff --git a/compile/ldscript.i386 b/compile/ldscript.i386
new file mode 100644
index 0000000..3cbcda8
--- /dev/null
+++ b/compile/ldscript.i386
@@ -0,0 +1,77 @@
+OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
+OUTPUT_ARCH(i386)
+
+ENTRY(_start)
+SEARCH_DIR("libgcc");
+SECTIONS
+{
+ . = 0x30000 + SIZEOF_HEADERS;
+
+ .interp : { *(.interp) }
+ .hash : { *(.hash) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
+ .rel.text : { *(.rel.text) *(.rel.gnu.linkonce.t*) }
+ .rela.text : { *(.rela.text) *(.rela.gnu.linkonce.t*) }
+ .rel.data : { *(.rel.data) *(.rel.gnu.linkonce.d*) }
+ .rela.data : { *(.rela.data) *(.rela.gnu.linkonce.d*) }
+ .rel.rodata : { *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
+ .rela.rodata : { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
+ .rel.got : { *(.rel.got) }
+ .rela.got : { *(.rela.got) }
+ .rel.ctors : { *(.rel.ctors) }
+ .rela.ctors : { *(.rela.ctors) }
+ .rel.dtors : { *(.rel.dtors) }
+ .rela.dtors : { *(.rela.dtors) }
+ .rel.init : { *(.rel.init) }
+ .rela.init : { *(.rela.init) }
+ .rel.fini : { *(.rel.fini) }
+ .rela.fini : { *(.rela.fini) }
+ .rel.bss : { *(.rel.bss) }
+ .rela.bss : { *(.rela.bss) }
+ .rel.plt : { *(.rel.plt) }
+ .rela.plt : { *(.rela.plt) }
+ .init : { *(.init) } =0x9090
+ .plt : { *(.plt) }
+
+ /* text/read-only data */
+ .text : { *(.text .gnu.linkonce.t.*) } =0x9090
+
+ .rodata : { *(.rodata) .rodata.* .gnu.linkonce.r.* }
+
+ /* writable data */
+ . = ALIGN(0x1000);
+ __data_start = .;
+ .data : { *(.data .gnu.linkonce.d.*) }
+
+ __ctor_list = .;
+ .ctors :
+ {
+ LONG((__ctor_end - __ctor_list) / 4 - 2)
+ *(.ctors)
+ LONG(0)
+ }
+ __ctor_end = .;
+
+ __dtor_list = .;
+ .dtors :
+ {
+ LONG((__dtor_end - __dtor_list) / 4 - 2)
+ *(.dtors)
+ LONG(0)
+ }
+ __dtor_end = .;
+
+ .got : { *(.got.plt) *(.got) }
+ .dynamic : { *(.dynamic) }
+
+ /* unintialized data (in same segment as writable data) */
+ __bss_start = .;
+ .bss : { *(.bss) }
+
+ . = ALIGN(0x1000);
+ _end = . ;
+
+ /* Strip unnecessary stuff */
+ /DISCARD/ : { *(.comment .note .eh_frame) }
+}
diff --git a/devfs/Makefile b/devfs/Makefile
new file mode 100644
index 0000000..2e6a497
--- /dev/null
+++ b/devfs/Makefile
@@ -0,0 +1,33 @@
+# (C) 2002 The UbixOS Project
+# $Id$
+
+# Include Global 'Source' Options
+include ../../Makefile.inc
+include ../Makefile.inc
+
+# Linker
+LINKER = ld
+
+# Remove
+REMOVE = rm -fr
+
+# Objects
+OBJS = devfs.o
+
+all: $(OBJS)
+
+# Compile Types
+.cc.o:
+ $(CXX) $(CFLAGS) $(INCLUDES) -c -o $@ $<
+.cc.s:
+ $(CXX) $(CFLAGS) $(INCLUDES) -S -o $@ $<
+.c.o:
+ $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
+.c.s:
+ $(CC) $(CFLAGS) $(INCLUDES) -S -o $@ $<
+.S.o:
+ $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
+
+# Clean up the junk
+clean:
+ $(REMOVE) $(OBJS)
diff --git a/devfs/devfs.c b/devfs/devfs.c
new file mode 100644
index 0000000..19ab909
--- /dev/null
+++ b/devfs/devfs.c
@@ -0,0 +1,260 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+/* Spinlock for devfs we should start converting to sem/mutex */
+static spinLock_t devfsSpinLock = SPIN_LOCK_INITIALIZER;
+
+/* Length of dev list */
+static int devfs_len = 0x0;
+
+/**
+ This is the initialized called by the vfs system when enabling devfs
+ basically it allocates memory for the devfs module
+*/
+static void devfs_initialize(struct vfs_mountPoint *mp) {
+ struct devfs_info *fsInfo = 0x0;
+
+ /* Allocate memory for the fsInfo */
+ if ((mp->fsInfo = (struct devfs_info *)kmalloc(sizeof(struct devfs_info))) == 0x0)
+ K_PANIC("devfs: failed to allocate memor\n");
+
+ fsInfo = mp->fsInfo;
+ fsInfo->deviceList = 0x0;
+
+ /* Return */
+ return;
+ }
+
+/**
+ This is the open routine called by the vfs when a fopen or open is called within the user or kernel space
+ file - this is the file node
+ fd - this is the file descriptor
+
+ This format will be changing down the road
+*/
+static int devfs_open(char *file,struct file *fd) {
+ struct devfs_info *fsInfo = fd->mp->fsInfo;
+ struct devfs_devices *tmpDev = 0x0;
+ struct device_node *device = 0x0;
+ struct devfs_obj *devfsObj = 0x0;
+
+ spinLock(&devfsSpinLock);
+
+ if (strcmp(file,"/") == 0x0) {
+ devfsObj->start = -1;
+ fd->size = devfs_len;
+ spinUnlock(&devfsSpinLock);
+ return(0x1);
+ }
+ if (file[0] == '/')
+ file++;
+ for (tmpDev = fsInfo->deviceList;tmpDev != 0x0;tmpDev = tmpDev->next) {
+ if (strcmp(tmpDev->devName,file) == 0x0) {
+ switch ((fd->mode & 0x3)) {
+ case 0:
+ case 1:
+ devfsObj = (struct devfs_obj *)kmalloc(sizeof(struct devfs_obj));
+ fd->fsObj = devfsObj;
+ device = device_find(tmpDev->devMajor,tmpDev->devMinor);
+ devfsObj->start = (int)tmpDev;
+ fd->size = device->devInfo->size;
+ break;
+ default:
+ kprintf("Invalid File Mode\n");
+ spinUnlock(&devfsSpinLock);
+ return(-1);
+ break;
+ }
+ spinUnlock(&devfsSpinLock);
+ return(0x1);
+ }
+ }
+ spinUnlock(&devfsSpinLock);
+ return(0x0);
+ }
+
+/**
+ Function: int readDevFS(fileDescriptor *fd,char *data,long offset,long size)
+ Description: Read File Into Data
+ Notes:
+*/
+static int devfs_read(struct file *fd,char *data,long offset,long size) {
+ int i = 0x0,x = 0x0;
+ uInt32 sectors = 0x0;
+ uInt16 diff = 0x0;
+ struct device_node *device = 0x0;
+ struct devfs_obj *devfsObj = fd->fsObj;
+ struct devfs_devices *tmpDev = 0x0;
+
+ tmpDev = (void *)devfsObj->start;
+
+ if ((u_int32_t)tmpDev == -1) {
+ kprintf("Hi Ubie [%i]!!!\n", size);
+ for (i = 0;i < size;i++) {
+ data[i] = 'a';
+ fd->buffer[i] = 'a';
+ }
+ data[size - 1] = '\n';
+ return(size);
+ }
+
+ device = device_find(tmpDev->devMajor,tmpDev->devMinor);
+
+ sectors = ((size+511)/512);
+ diff = (offset - ((offset/512)*512));
+
+ for (i=0x0;idevInfo->read(device->devInfo->info,fd->buffer,i + (offset/512),1);
+ for (x=0x0;x<(size - (i*512));x++) {
+ if (diff > 0) {
+ data[x] = fd->buffer[x + diff];
+ }
+ else {
+ data[x] = fd->buffer[x];
+ }
+ }
+ diff = 0x0;
+ data += 512;
+ }
+
+ return(size);
+ }
+
+/************************************************************************
+
+Function: int writeDevFS(fileDescriptor *fd,char *data,long offset,long size)
+Description: Write Data Into File
+Notes:
+
+************************************************************************/
+static int devfs_write(struct file *fd,char *data,long offset,long size) {
+ int i = 0x0,x = 0x0;
+ struct device_node *device = 0x0;
+ struct devfs_devices *tmpDev = 0x0;
+ struct devfs_obj *devfsObj = fd->fsObj;
+ tmpDev = (void *)devfsObj->start;
+
+ 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++) {
+ fd->buffer[x] = data[x];
+ }
+ device->devInfo->write(device->devInfo->info,fd->buffer,i + (offset/512),1);
+ data += 512;
+ }
+ return(size);
+ }
+
+
+int devfs_makeNode(char *name,uInt8 type,uInt16 major,uInt16 minor) {
+ struct vfs_mountPoint *mp = 0x0;
+ struct devfs_info *fsInfo = 0x0;
+ struct devfs_devices *tmpDev = 0x0;
+
+ spinLock(&devfsSpinLock);
+
+ mp = vfs_findMount("devfs");
+
+ if (mp == 0x0) {
+ kprintf("Error: Can't Find Mount Point\n");
+ spinUnlock(&devfsSpinLock);
+ return(-1);
+ }
+
+ fsInfo = mp->fsInfo;
+
+ tmpDev = (struct devfs_devices *)kmalloc(sizeof(struct devfs_devices));
+
+ tmpDev->devType = type;
+ tmpDev->devMajor = major;
+ tmpDev->devMinor = minor;
+ sprintf(tmpDev->devName,name);
+ devfs_len += strlen(name) + 1;
+
+ tmpDev->next = fsInfo->deviceList;
+ tmpDev->prev = 0x0;
+ if (fsInfo->deviceList != 0x0) {
+ fsInfo->deviceList->prev = tmpDev;
+ }
+
+ fsInfo->deviceList = tmpDev;
+
+ spinUnlock(&devfsSpinLock);
+ return(0x0);
+ }
+
+int devfs_dummy() {
+ kprintf("PLACE HOLDER\n");
+ 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 */
+ devfs_dummy, /* vfsCloseFile */
+ devfs_dummy, /* vfsUnlink */
+ devfs_dummy, /* vfsMakeDir */
+ devfs_dummy, /* vfsRemDir */
+ devfs_dummy, /* vfsSync */
+ 0x1 /* vfsType */
+ }; /* devFS */
+
+ if (vfsRegisterFS(devFS) != 0x0) {
+ //sysErr(systemErr,"Unable To Enable DevFS");
+ return(0x1);
+ }
+ /* Mount our devfs this will build the devfs container node */
+ vfs_mount(-1,0x0,0x0,0x1,"devfs","rw"); // Mount Device File System
+
+ kprintf("Devfs\n");
+
+ /* Return */
+ return(0x0);
+ }
+
+/***
+ END
+ ***/
diff --git a/devfs/major.txt b/devfs/major.txt
new file mode 100644
index 0000000..27e323d
--- /dev/null
+++ b/devfs/major.txt
@@ -0,0 +1 @@
+TTY - 0x10
diff --git a/include/assert.h b/include/assert.h
new file mode 100644
index 0000000..e6c3f51
--- /dev/null
+++ b/include/assert.h
@@ -0,0 +1,70 @@
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * 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. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
+ *
+ * @(#)assert.h 8.2 (Berkeley) 1/21/94
+ * $FreeBSD: src/include/assert.h,v 1.4 2002/03/23 17:24:53 imp Exp $
+ */
+
+#if defined(__cplusplus)
+#define __BEGIN_DECLS extern "C" {
+#define __END_DECLS }
+#else
+#define __BEGIN_DECLS
+#define __END_DECLS
+#endif
+
+/*
+ * Unlike other ANSI header files, may usefully be included
+ * multiple times, with and without NDEBUG defined.
+ */
+
+#undef assert
+#undef _assert
+
+#ifdef NDEBUG
+#define assert(e) ((void)0)
+#define _assert(e) ((void)0)
+#else
+#define _assert(e) assert(e)
+
+#define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \
+ __LINE__, #e))
+#endif /* NDEBUG */
+
+__BEGIN_DECLS
+void __assert(const char *, const char *, int, const char *);
+__END_DECLS
diff --git a/include/devfs/devfs.h b/include/devfs/devfs.h
new file mode 100644
index 0000000..9fddaf0
--- /dev/null
+++ b/include/devfs/devfs.h
@@ -0,0 +1,103 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _DEVFS_H
+#define _DEVFS_H
+
+#include
+#include
+
+struct devfs_devices {
+ struct devfs_devices *next;
+ struct devfs_devices *prev;
+ uInt8 devType;
+ uInt16 devMajor;
+ uInt16 devMinor;
+ char devName[32];
+ };
+
+struct devfs_info {
+ struct devfs_devices *deviceList;
+ };
+
+struct devfs_obj {
+ uInt16 length;
+ uInt32 start;
+ };
+
+int devfs_init();
+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.2 2007/01/26 19:33:19 reddawg
+ More vfs fixes
+
+ Revision 1.1.1.1 2007/01/17 03:31:52 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:13 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:36 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:38 reddawg
+ no message
+
+ Revision 1.5 2004/07/21 10:02:09 reddawg
+ devfs: renamed functions
+ device system: renamed functions
+ fdc: fixed a few potential bugs and cleaned up some unused variables
+ strol: fixed definition
+ endtask: made it print out freepage debug info
+ kmalloc: fixed a huge memory leak we had some unhandled descriptor insertion so some descriptors were lost
+ ld: fixed a pointer conversion
+ file: cleaned up a few unused variables
+ sched: broke task deletion
+ kprintf: fixed ogPrintf definition
+
+ 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
+
+
+ END
+ ***/
diff --git a/include/isa/8259.h b/include/isa/8259.h
new file mode 100644
index 0000000..41158ed
--- /dev/null
+++ b/include/isa/8259.h
@@ -0,0 +1,78 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _8259_H
+#define _8259_H
+
+#include
+
+#define mPic 0x20 // I/O for master PIC
+#define mImr 0x21 // I/O for master IMR
+#define sPic 0xA0 // I/O for slave PIC
+#define sImr 0xA1 // I/O for slace IMR
+#define eoi 0x20 // EOI command
+#define icw1 0x11 // Cascade, Edge triggered
+#define icw4 0x01 // 8088 mode
+#define mVec 0x68 // Vector for master
+#define sVec 0x70 // Vector for slave
+#define ocw3Irr 0x0A // Read IRR
+#define ocw3Isr 0x0B // Read ISR
+
+int i8259_init();
+void irqEnable(uInt16 irqNo);
+void irqDisable(uInt16 irqNo);
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:52 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:14 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:36 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:39 reddawg
+ no message
+
+ Revision 1.4 2004/07/09 13:20:08 reddawg
+ Oh yeah duh you can not name functions with numbers
+
+ Revision 1.3 2004/07/09 13:14:29 reddawg
+ 8259: changed init8259 to 8259_init
+ Adjusted Startup Routines
+
+ Revision 1.2 2004/05/21 14:57:16 reddawg
+ Cleaned up
+
+ END
+ ***/
diff --git a/include/isa/atkbd.h b/include/isa/atkbd.h
new file mode 100644
index 0000000..d3d2105
--- /dev/null
+++ b/include/isa/atkbd.h
@@ -0,0 +1,73 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _ATKBD_H
+#define _ATKBD_H
+
+#define shiftKey 1
+#define controlKey 2
+#define altKey 4
+#define ledNumlock 2
+#define ledScrolllock 1
+#define ledCapslock 4
+
+int atkbd_init();
+void atkbd_isr();
+
+void keyboardHandler();
+void setLED();
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:52 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:14 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:36 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:39 reddawg
+ no message
+
+ Revision 1.4 2004/07/29 21:32:16 reddawg
+ My quick lunchs breaks worth of updates....
+
+ Revision 1.3 2004/07/09 13:34:51 reddawg
+ keyboard: keyboardInit to atkbd_init
+ Adjusted initialization routines
+
+ Revision 1.2 2004/05/21 14:57:16 reddawg
+ Cleaned up
+
+ END
+ ***/
diff --git a/include/isa/fdc.h b/include/isa/fdc.h
new file mode 100644
index 0000000..2a56ff2
--- /dev/null
+++ b/include/isa/fdc.h
@@ -0,0 +1,111 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _FDC_H
+#define _FDC_H
+
+#include
+
+typedef struct DrvGeom {
+ Int8 heads;
+ Int8 tracks;
+ Int8 spt;
+} drvGeom;
+
+
+#define fdcMsr (0x3f4)
+#define fdcData (0x3f5)
+#define fdcDir (0x3f7)
+#define fdcCcr (0x3f7)
+#define fdcDor (0x3f2)
+#define fdcDrs (0x3f4)
+
+#define cmdWrite (0xc5)
+#define cmdRead (0xe6)
+#define cmdSeek (0x0f)
+#define cmdSensei (0x08)
+#define cmdRecal (0x07)
+#define cmdSpecify (0x03)
+
+#define dg144Heads 2 /* heads per drive (1.44M) */
+#define dg144Tracks 80
+#define dg144Spt 18
+#define dg144Gap3rw 0x1b
+#define dg168Gap3rw 0x1c
+
+
+
+int fdc_init();
+void floppyIsr();
+void floppyIsrhndlr();
+void sendByte(int Int8);
+int getByte();
+bool fdcRw(int block,Int8 *blockBuffer,bool read,unsigned long numSectors);
+void block2Hts(int block,int *head,int *track,int *sector);
+void motorOn(void);
+void motorOff(void);
+bool seek(int track);
+bool waitFdc(bool sensei);
+int getByte();
+void sendByte(int Int8);
+void recalibrate(void);
+void reset(void);
+bool writeBlock(int block,Int8 *blockBuffer, unsigned long numSectors);
+bool readBlock(int block,Int8 *blockBuffer, unsigned long numSectors);
+void fdcWrite(void *info,void *,uInt32 startSector,uInt32 sectorCount);
+void fdcRead(void *info,void *,uInt32 startSector,uInt32 sectorCount);
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:52 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:14 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:36 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:39 reddawg
+ no message
+
+ Revision 1.6 2004/07/17 02:38:31 reddawg
+ Fixed a few problems
+
+ Revision 1.5 2004/07/14 12:42:46 reddawg
+ fdc: fdcInit to fdc_init
+ Changed Startup Routines
+
+ Revision 1.4 2004/05/21 14:57:16 reddawg
+ Cleaned up
+
+ END
+ ***/
diff --git a/include/isa/mouse.h b/include/isa/mouse.h
new file mode 100644
index 0000000..596b6fa
--- /dev/null
+++ b/include/isa/mouse.h
@@ -0,0 +1,57 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _MOUE_H
+#define _MOUSE_H
+
+int mouseInit();
+void mouseISR();
+void mouseHandler();
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:52 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:14 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:36 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:39 reddawg
+ no message
+
+ Revision 1.1 2004/06/04 10:20:53 reddawg
+ mouse drive: fixed a few bugs works a bit better now
+
+ END
+ ***/
diff --git a/include/isa/ne2k.h b/include/isa/ne2k.h
new file mode 100644
index 0000000..b408360
--- /dev/null
+++ b/include/isa/ne2k.h
@@ -0,0 +1,200 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _NE2K_H
+#define _NE2K_H
+
+#include
+#include
+
+#define ether_addr ether_addr_t
+typedef struct dp_rcvhdr
+{
+ uInt8 dr_status; /* Copy of rsr */
+ uInt8 dr_next; /* Pointer to next packet */
+ uInt8 dr_rbcl; /* Receive Byte Count Low */
+ uInt8 dr_rbch; /* Receive Byte Count High */
+} dp_rcvhdr_t;
+
+typedef union etheraddr {
+ unsigned char bytes[6]; /* byteorder safe initialization */
+ unsigned short shorts[3]; /* force 2-byte alignment */
+} ether_addr;
+
+
+struct nicBuffer {
+ struct nicBuffer *next;
+ int length;
+ char *buffer;
+ };
+
+#define RSR_FO 0x08
+#define RSR_PRX 0x01
+#define DEF_ENABLED 0x200
+
+#define OK 0
+
+
+#define startPage 0x4C
+#define stopPage 0x80
+
+
+#define NE_CMD 0x00
+#define NE_PSTART 0x01
+#define NE_PSTOP 0x02
+#define NE_BNRY 0x03
+#define NE_TPSR 0x04
+#define NE_ISR 0x07
+#define NE_CURRENT 0x07
+#define NE_RBCR0 0x0A
+#define NE_RBCR1 0x0B
+#define NE_RCR 0x0C
+#define NE_TCR 0x0D
+#define NE_DCR 0x0E
+#define NE_IMR 0x0F
+
+
+#define NE_DCR_WTS 0x01
+#define NE_DCR_LS 0x08
+#define NE_DCR_AR 0x10
+#define NE_DCR_FT1 0x40
+#define NE_DCR_FT0 0x20
+
+
+
+#define E8390_STOP 0x01
+#define E8390_NODMA 0x20
+#define E8390_PAGE0 0x00
+#define E8390_PAGE1 0x40
+#define E8390_CMD 0x00
+#define E8390_START 0x02
+#define E8390_RREAD 0x08
+#define E8390_RWRITE 0x10
+#define E8390_RXOFF 0x20
+#define E8390_TXOFF 0x00
+#define E8390_RXCONFIG 0x04
+#define E8390_TXCONFIG 0x00
+
+#define EN0_COUNTER0 0x0d
+#define EN0_DCFG 0x0e
+#define EN0_RCNTLO 0x0a
+#define EN0_RCNTHI 0x0b
+#define EN0_ISR 0x07
+#define EN0_IMR 0x0f
+#define EN0_RSARLO 0x08
+#define EN0_RSARHI 0x09
+#define EN0_TPSR 0x04
+#define EN0_RXCR 0x0c
+#define EN0_TXCR 0x0D
+#define EN0_STARTPG 0x01
+#define EN0_STOPPG 0x02
+#define EN0_BOUNDARY 0x03
+
+#define EN1_PHYS 0x01
+#define EN1_CURPAG 0x07
+#define EN1_MULT 0x08
+
+#define NE1SM_START_PG 0x20
+#define NE1SM_STOP_PG 0x40
+#define NESM_START_PG 0x40
+#define NESM_STOP_PG 0x80
+
+#define ENISR_ALL 0x3f
+
+#define ENDCFG_WTS 0x01
+
+#define NE_DATAPORT 0x10
+
+#define TX_2X_PAGES 12
+#define TX_1X_PAGES 6
+#define TX_PAGES (dev->priv->pingPong ? TX_2X_PAGES : TX_1X_PAGES)
+
+
+#define DP_CURR 0x7 /* Current Page Register */
+#define DP_MAR0 0x8 /* Multicast Address Register 0 */
+#define DP_MAR1 0x9 /* Multicast Address Register 1 */
+#define DP_MAR2 0xA /* Multicast Address Register 2 */
+#define DP_MAR3 0xB /* Multicast Address Register 3 */
+#define DP_MAR4 0xC /* Multicast Address Register 4 */
+#define DP_MAR5 0xD /* Multicast Address Register 5 */
+#define DP_MAR6 0xE /* Multicast Address Register 6 */
+#define DP_MAR7 0xF /* Multicast Address Register 7 */
+
+#define DP_CNTR0 0xD /* Tally Counter 0 */
+#define DP_CNTR1 0xE /* Tally Counter 1 */
+#define DP_CNTR2 0xF /* Tally Counter 2 */
+
+
+#define DP_PAGESIZE 256
+
+extern char *nicPacket;
+extern uInt32 packetLength;
+
+
+int ne2k_init();
+int ne2kProbe(int,struct device *);
+int ne2kDevInit(struct device *);
+void NS8390_init(struct device *dev,int startp);
+
+void ne2kISR();
+void ne2kHandler();
+
+int NICtoPC(struct device *dev,void *packet,int length,int nic_addr);
+int PCtoNIC(struct device *dev,void *packet,int length);
+
+struct nicBuffer *ne2kAllocBuffer(int);
+struct nicBuffer *ne2kGetBuffer();
+void ne2kFreeBuffer(struct nicBuffer *);
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:52 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:14 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:36 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:39 reddawg
+ no message
+
+ Revision 1.6 2004/07/14 12:03:49 reddawg
+ ne2k: ne2kInit to ne2k_init
+ Changed Startup Routines
+
+ Revision 1.5 2004/05/21 14:57:16 reddawg
+ Cleaned up
+
+
+ END
+ ***/
diff --git a/include/isa/pit.h b/include/isa/pit.h
new file mode 100644
index 0000000..23a6a2f
--- /dev/null
+++ b/include/isa/pit.h
@@ -0,0 +1,71 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _PIT_H
+#define _PIT_H
+
+#define PIT_TIMER 200
+
+int pit_init();
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:52 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:14 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:36 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:40 reddawg
+ no message
+
+ Revision 1.6 2004/08/14 11:23:02 reddawg
+ Changes
+
+ Revision 1.5 2004/07/16 04:06:32 reddawg
+ Tune ups this stuff should of been taken care of months ago
+
+ Revision 1.4 2004/07/16 01:08:58 reddawg
+ Whew we work once again
+
+ Revision 1.3 2004/07/09 13:29:15 reddawg
+ pit: pitInit to pit_init
+ Adjusted initialization routines
+
+ Revision 1.2 2004/05/21 14:57:16 reddawg
+ Cleaned up
+
+ END
+ ***/
+
diff --git a/include/lib/bioscall.h b/include/lib/bioscall.h
new file mode 100644
index 0000000..ca3aa11
--- /dev/null
+++ b/include/lib/bioscall.h
@@ -0,0 +1,64 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _BIOSCALL_H
+#define _BIOSCALL_H
+
+#include
+
+#define EFLAG_TF 0x100
+#define EFLAG_IF 0x200
+#define EFLAG_IOPL3 0x3000
+#define EFLAG_VM 0x20000
+
+void biosCall(int biosInt,int eax,int ebx,int ecx,int edx,int esi,int edi,int es,int ds);
+void bios16Code();
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:51 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:13 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:36 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:40 reddawg
+ no message
+
+ Revision 1.2 2004/05/21 15:00:27 reddawg
+ Cleaned up
+
+
+ END
+ ***/
diff --git a/include/lib/kmalloc.h b/include/lib/kmalloc.h
new file mode 100644
index 0000000..aba34c1
--- /dev/null
+++ b/include/lib/kmalloc.h
@@ -0,0 +1,100 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _KMALLOC_H
+#define _KMALLOC_H
+
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#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 */
+ };
+
+void kfree(void *baseAddr);
+void *kmalloc(uInt32 len);
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:51 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:13 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:36 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:40 reddawg
+ no message
+
+ Revision 1.7 2004/09/14 20:57:01 reddawg
+ Bug fixes: macro problem over opt a multiply
+
+ Revision 1.6 2004/07/21 10:02:09 reddawg
+ devfs: renamed functions
+ device system: renamed functions
+ fdc: fixed a few potential bugs and cleaned up some unused variables
+ strol: fixed definition
+ endtask: made it print out freepage debug info
+ kmalloc: fixed a huge memory leak we had some unhandled descriptor insertion so some descriptors were lost
+ ld: fixed a pointer conversion
+ file: cleaned up a few unused variables
+ sched: broke task deletion
+ kprintf: fixed ogPrintf definition
+
+ 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
+
+ Revision 1.3 2004/05/21 15:00:27 reddawg
+ Cleaned up
+
+ END
+ ***/
diff --git a/include/lib/kprint.h b/include/lib/kprint.h
new file mode 100644
index 0000000..51a18b0
--- /dev/null
+++ b/include/lib/kprint.h
@@ -0,0 +1,60 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _KPRINT_H
+#define _KPRINT_H
+
+#include
+
+int kprintf(const char *fmt, ...);
+
+extern int printOff;
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:52 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:13 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:36 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:40 reddawg
+ no message
+
+ Revision 1.2 2004/05/21 15:00:27 reddawg
+ Cleaned up
+
+
+ END
+ ***/
diff --git a/include/lib/kprintf.h b/include/lib/kprintf.h
new file mode 100644
index 0000000..f957dda
--- /dev/null
+++ b/include/lib/kprintf.h
@@ -0,0 +1,62 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _KPRINTF_H
+#define _KPRINTF_H
+
+#include
+
+int kprintf(const char *fmt, ...);
+int ogPrintf(char *);
+
+extern int printOff;
+extern int ogprintOff;
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:51 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:13 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:36 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:40 reddawg
+ no message
+
+ Revision 1.2 2004/05/21 15:00:27 reddawg
+ Cleaned up
+
+
+ END
+ ***/
diff --git a/include/lib/libcpp.h b/include/lib/libcpp.h
new file mode 100644
index 0000000..6fbb726
--- /dev/null
+++ b/include/lib/libcpp.h
@@ -0,0 +1,61 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef __LIBCPP_H
+#define __LIBCPP_H
+
+#include
+
+void * operator new(unsigned size);
+void operator delete(void * ptr);
+void * operator new[](unsigned size);
+void operator delete[](void * ptr);
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:51 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:13 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:36 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:40 reddawg
+ no message
+
+ Revision 1.2 2004/05/21 15:00:27 reddawg
+ Cleaned up
+
+
+ END
+ ***/
diff --git a/include/lib/string.h b/include/lib/string.h
new file mode 100644
index 0000000..1d6008e
--- /dev/null
+++ b/include/lib/string.h
@@ -0,0 +1,89 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _STRING_H
+#define _STRING_H
+
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+char * strcpy(char *, const char *);
+int strcmp(const char *str1,const char *str2);
+int strncmp(const char * a, const char * b, size_t c);
+void *memcpy(const void *dst, const void * src, size_t length);
+void *memset(void * dst, int c, size_t length);
+int strlen(const char * string);
+int memcmp(const void * dst, const void * src, size_t length);
+void strncpy(char * dest, const char * src, size_t size);
+char *strtok(char *str, const char *sep);
+char *strtok_r(char *str, const char *sep, char **last);
+char *strstr(const char *s,char *find);
+
+int sprintf(char *buf,const char *fmt, ...);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:52 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:13 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:36 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:41 reddawg
+ no message
+
+ Revision 1.5 2004/07/20 19:09:40 flameshadow
+ chg: put strcpy() declaration in the right .h file
+ add: prototypes for the dirCaching functions in dirCache.h
+ chg: renamed dirCaching functions
+
+ Revision 1.4 2004/07/06 23:26:12 reddawg
+ Fixed A Compilation Error
+
+ Revision 1.3 2004/06/28 23:12:58 reddawg
+ file format now container:/path/to/file
+
+ Revision 1.2 2004/05/21 15:00:27 reddawg
+ Cleaned up
+
+
+ END
+ ***/
diff --git a/include/math.h b/include/math.h
new file mode 100644
index 0000000..bce9c5f
--- /dev/null
+++ b/include/math.h
@@ -0,0 +1,67 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef __MATH_H
+#define __MATH_H
+
+#include
+
+//typedef long long int quad_t;
+typedef unsigned long long int u_quad_t;
+
+double atan(double x);
+double sqrt(double x);
+u_quad_t __udivdi3(u_quad_t a,u_quad_t b);
+quad_t __divdi3(quad_t a,quad_t b);
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:51 reddawg
+ UbixOS
+
+ Revision 1.2 2006/10/31 20:41:16 reddawg
+ Includes
+
+ Revision 1.1.1.1 2006/06/01 12:46:13 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:36 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:38 reddawg
+ no message
+
+ Revision 1.2 2004/05/21 15:22:35 reddawg
+ Cleaned up
+
+
+ END
+ ***/
diff --git a/include/mpi/mpi.h b/include/mpi/mpi.h
new file mode 100644
index 0000000..51add8f
--- /dev/null
+++ b/include/mpi/mpi.h
@@ -0,0 +1,106 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _MPI_H
+#define _MPI_H
+
+#include
+#include
+
+#define MESSAGE_LENGTH 248
+
+struct mpi_message {
+ char data[MESSAGE_LENGTH];
+ uInt32 header;
+ pidType pid;
+ struct mpi_message *next;
+ };
+
+struct mpi_mbox {
+ struct mpi_mbox *next;
+ struct mpi_mbox *prev;
+ struct mpi_message *msg;
+ struct mpi_message *msgLast;
+ char name[64];
+ pidType pid;
+ };
+
+typedef struct mpi_mbox mpi_mbox_t;
+typedef struct mpi_message mpi_message_t;
+
+
+int mpi_createMbox(char *);
+int mpi_destroyMbox(char *);
+int mpi_postMessage(char *,uInt32,mpi_message_t *);
+int mpi_fetchMessage(char *,mpi_message_t *);
+int mpi_spam(uInt32,void *);
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:52 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:14 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:36 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:42 reddawg
+ no message
+
+ Revision 1.8 2004/08/14 11:23:02 reddawg
+ Changes
+
+ Revision 1.7 2004/05/28 03:52:56 reddawg
+ mpi: took a few suggestions from TCA
+
+ Revision 1.6 2004/05/25 18:33:11 reddawg
+ We now use 128byte messages I can increase later
+
+ Revision 1.5 2004/05/25 18:29:57 reddawg
+ We now lock onto a pid
+
+ Revision 1.4 2004/05/25 16:52:22 reddawg
+ We now have mpiDestroyMbox(char *) This will of course destroy a mail box
+
+ Revision 1.3 2004/05/25 16:28:21 reddawg
+ Made mpiFindMbox() static
+
+ Revision 1.2 2004/05/25 15:42:19 reddawg
+ Enabled mpiSpam();
+
+ Revision 1.1 2004/05/25 14:07:01 reddawg
+ Sorry we can't forget the headers files
+
+ END
+ ***/
+
diff --git a/include/net/api.h b/include/net/api.h
new file mode 100644
index 0000000..1d97411
--- /dev/null
+++ b/include/net/api.h
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __LWIP_API_H__
+#define __LWIP_API_H__
+
+#include "net/opt.h"
+#include "net/pbuf.h"
+#include "net/sys.h"
+
+#include "net/ipv4/ip.h"
+
+#include "net/udp.h"
+#include "net/tcp.h"
+
+#include "net/err.h"
+
+#define NETCONN_NOCOPY 0x00
+#define NETCONN_COPY 0x01
+
+enum netconn_type {
+ NETCONN_TCP,
+ NETCONN_UDP,
+ NETCONN_UDPLITE,
+ NETCONN_UDPNOCHKSUM
+};
+
+enum netconn_state {
+ NETCONN_NONE,
+ NETCONN_WRITE,
+ NETCONN_ACCEPT,
+ NETCONN_RECV,
+ NETCONN_CONNECT,
+ NETCONN_CLOSE
+};
+
+struct netbuf {
+ struct pbuf *p, *ptr;
+ struct ip_addr *fromaddr;
+ uInt16 fromport;
+ err_t err;
+};
+
+struct netconn {
+ enum netconn_type type;
+ enum netconn_state state;
+ union {
+ struct tcp_pcb *tcp;
+ struct udp_pcb *udp;
+ } pcb;
+ err_t err;
+ sys_mbox_t mbox;
+ sys_mbox_t recvmbox;
+ sys_mbox_t acceptmbox;
+ sys_sem_t sem;
+};
+
+/* Network buffer functions: */
+struct netbuf * netbuf_new (void);
+void netbuf_delete (struct netbuf *buf);
+void * netbuf_alloc (struct netbuf *buf, uInt16 size);
+void netbuf_free (struct netbuf *buf);
+void netbuf_ref (struct netbuf *buf,
+ void *dataptr, uInt16 size);
+void netbuf_chain (struct netbuf *head,
+ struct netbuf *tail);
+
+uInt16 netbuf_len (struct netbuf *buf);
+err_t netbuf_data (struct netbuf *buf,
+ void **dataptr, uInt16 *len);
+Int8 netbuf_next (struct netbuf *buf);
+void netbuf_first (struct netbuf *buf);
+
+void netbuf_copy (struct netbuf *buf,
+ void *dataptr, uInt16 len);
+struct ip_addr * netbuf_fromaddr (struct netbuf *buf);
+uInt16 netbuf_fromport (struct netbuf *buf);
+
+/* Network connection functions: */
+struct netconn * netconn_new (enum netconn_type type);
+err_t netconn_delete (struct netconn *conn);
+enum netconn_type netconn_type (struct netconn *conn);
+err_t netconn_peer (struct netconn *conn,
+ struct ip_addr **addr,
+ uInt16 *port);
+err_t netconn_addr (struct netconn *conn,
+ struct ip_addr **addr,
+ uInt16 *port);
+err_t netconn_bind (struct netconn *conn,
+ struct ip_addr *addr,
+ uInt16 port);
+err_t netconn_connect (struct netconn *conn,
+ struct ip_addr *addr,
+ uInt16 port);
+err_t netconn_listen (struct netconn *conn);
+struct netconn * netconn_accept (struct netconn *conn);
+struct netbuf * netconn_recv (struct netconn *conn);
+err_t netconn_send (struct netconn *conn,
+ struct netbuf *buf);
+err_t netconn_write (struct netconn *conn,
+ void *dataptr, uInt16 size,
+ uInt8 copy);
+err_t netconn_close (struct netconn *conn);
+
+err_t netconn_err (struct netconn *conn);
+
+void netbuf_copy_partial(struct netbuf *buf, void *dataptr, uInt16 len, uInt16 offset);
+
+#endif /* __LWIP_API_H__ */
+
+
diff --git a/include/net/api_msg.h b/include/net/api_msg.h
new file mode 100644
index 0000000..2728f5f
--- /dev/null
+++ b/include/net/api_msg.h
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __LWIP_API_MSG_H__
+#define __LWIP_API_MSG_H__
+
+#include "net/opt.h"
+#include "net/pbuf.h"
+#include "net/sys.h"
+
+#include "net/ipv4/ip.h"
+
+#include "net/udp.h"
+#include "net/tcp.h"
+
+#include "net/api.h"
+
+enum api_msg_type {
+ API_MSG_NEWCONN,
+ API_MSG_DELCONN,
+
+ API_MSG_BIND,
+ API_MSG_CONNECT,
+
+ API_MSG_LISTEN,
+ API_MSG_ACCEPT,
+
+ API_MSG_SEND,
+ API_MSG_RECV,
+ API_MSG_WRITE,
+
+ API_MSG_CLOSE,
+
+ API_MSG_MAX
+};
+
+struct api_msg_msg {
+ struct netconn *conn;
+ enum netconn_type conntype;
+ union {
+ struct pbuf *p;
+ struct {
+ struct ip_addr *ipaddr;
+ uInt16 port;
+ } bc;
+ struct {
+ void *dataptr;
+ uInt16 len;
+ unsigned char copy;
+ } w;
+ sys_mbox_t mbox;
+ uInt16 len;
+ } msg;
+};
+
+struct api_msg {
+ enum api_msg_type type;
+ struct api_msg_msg msg;
+};
+
+void api_msg_input(struct api_msg *msg);
+void api_msg_post(struct api_msg *msg);
+
+#endif /* __LWIP_API_MSG_H__ */
+
diff --git a/include/net/arch.h b/include/net/arch.h
new file mode 100644
index 0000000..8be38c0
--- /dev/null
+++ b/include/net/arch.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __LWIP_ARCH_H__
+#define __LWIP_ARCH_H__
+
+#ifndef LITTLE_ENDIAN
+#define LITTLE_ENDIAN 1234
+#endif
+
+#ifndef BIG_ENDIAN
+#define BIG_ENDIAN 4321
+#endif
+
+#include "arch/cpu.h"
+#include "arch/cc.h"
+
+#ifndef PACK_STRUCT_BEGIN
+#define PACK_STRUCT_BEGIN
+#endif /* PACK_STRUCT_BEGIN */
+
+#ifndef PACK_STRUCT_END
+#define PACK_STRUCT_END
+#endif /* PACK_STRUCT_END */
+
+#ifndef PACK_STRUCT_FIELD
+#define PACK_STRUCT_FIELD(x) x
+#endif /* PACK_STRUCT_FIELD */
+
+#endif /* __LWIP_ARCH_H__ */
diff --git a/include/net/arch/cc.h b/include/net/arch/cc.h
new file mode 100644
index 0000000..a2f83a5
--- /dev/null
+++ b/include/net/arch/cc.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __ARCH_CC_H__
+#define __ARCH_CC_H__
+
+#define PACK_STRUCT_FIELD(x) x __attribute__((packed))
+#define PACK_STRUCT_STRUCT __attribute__((packed))
+#define PACK_STRUCT_BEGIN
+#define PACK_STRUCT_END
+
+#endif /* __ARCH_CC_H__ */
diff --git a/include/net/arch/cpu.h b/include/net/arch/cpu.h
new file mode 100644
index 0000000..0a6d531
--- /dev/null
+++ b/include/net/arch/cpu.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __ARCH_CPU_H__
+#define __ARCH_CPU_H__
+
+#ifndef BYTE_ORDER
+#define BYTE_ORDER LITTLE_ENDIAN
+#endif /* BYTE_ORDER */
+
+#endif /* __ARCH_CPU_H__ */
diff --git a/include/net/arch/init.h b/include/net/arch/init.h
new file mode 100644
index 0000000..0b5409d
--- /dev/null
+++ b/include/net/arch/init.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __ARCH_INIT_H__
+#define __ARCH_INIT_H__
+
+#define TCPIP_INIT_DONE(arg) sys_sem_signal(*(sys_sem_t *)arg)
+
+#endif /* __ARCH_INIT_H__ */
+
+
+
+
diff --git a/include/net/arch/lib.h b/include/net/arch/lib.h
new file mode 100644
index 0000000..13d5446
--- /dev/null
+++ b/include/net/arch/lib.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __ARCH_LIB_H__
+#define __ARCH_LIB_H__
+
+#ifndef _STRING_H_
+#ifndef _STRING_H
+int strlen(const char *str);
+int strncmp(const char *str1, const char *str2, int len);
+void bcopy(const void *src, void *dest, int len);
+void bzero(void *data, int n);
+#endif /* _STRING_H */
+#endif /* _STRING_H_ */
+
+#endif /* __ARCH_LIB_H__ */
diff --git a/include/net/arch/perf.h b/include/net/arch/perf.h
new file mode 100644
index 0000000..9b47e5b
--- /dev/null
+++ b/include/net/arch/perf.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __ARCH_PERF_H__
+#define __ARCH_PERF_H__
+
+#include
+
+#ifdef PERF
+#define PERF_START { \
+ unsigned long __c1l, __c1h, __c2l, __c2h; \
+ __asm__(".byte 0x0f, 0x31" : "=a" (__c1l), "=d" (__c1h))
+#define PERF_STOP(x) __asm__(".byte 0x0f, 0x31" : "=a" (__c2l), "=d" (__c2h)); \
+ perf_print(__c1l, __c1h, __c2l, __c2h, x);}
+
+/*#define PERF_START do { \
+ struct tms __perf_start, __perf_end; \
+ times(&__perf_start)
+#define PERF_STOP(x) times(&__perf_end); \
+ perf_print_times(&__perf_start, &__perf_end, x);\
+ } while(0)*/
+#else /* PERF */
+#define PERF_START /* null definition */
+#define PERF_STOP(x) /* null definition */
+#endif /* PERF */
+
+void perf_print(unsigned long c1l, unsigned long c1h,
+ unsigned long c2l, unsigned long c2h,
+ char *key);
+
+void perf_print_times(struct tms *start, struct tms *end, char *key);
+
+void perf_init(char *fname);
+
+#endif /* __ARCH_PERF_H__ */
diff --git a/include/net/arch/sys_arch.h b/include/net/arch/sys_arch.h
new file mode 100644
index 0000000..9ef598f
--- /dev/null
+++ b/include/net/arch/sys_arch.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __ARCH_SYS_ARCH_H__
+#define __ARCH_SYS_ARCH_H__
+
+#define SYS_MBOX_NULL NULL
+#define SYS_SEM_NULL NULL
+
+struct sys_sem;
+typedef struct sys_sem * sys_sem_t;
+
+struct sys_mbox;
+typedef struct sys_mbox *sys_mbox_t;
+
+struct sys_thread;
+typedef struct sys_thread * sys_thread_t;
+
+#endif /* __ARCH_SYS_ARCH_H__ */
+
diff --git a/include/net/debug.h b/include/net/debug.h
new file mode 100644
index 0000000..3d9899f
--- /dev/null
+++ b/include/net/debug.h
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __LWIP_DEBUG_H__
+#define __LWIP_DEBUG_H__
+
+#ifdef LWIP_DEBUG
+
+#define ASSERT(x,y) if(!(y)) {printf("Assertion \"%s\" failed at line %d in %s\n", \
+ x, __LINE__, __FILE__); fflush(NULL); abort();}
+
+/* These defines control the amount of debugging output: */
+#define MEM_TRACKING
+
+#define DEMO_DEBUG 1
+
+#define ARP_DEBUG 0
+
+#define NETIF_DEBUG 1
+#define PBUF_DEBUG 0
+#define DELIF_DEBUG 0
+#define DROPIF_DEBUG 0
+#define TUNIF_DEBUG 0
+#define UNIXIF_DEBUG 0
+#define TAPIF_DEBUG 0
+
+#define API_LIB_DEBUG 0
+#define API_MSG_DEBUG 0
+#define SOCKETS_DEBUG 1
+#define ICMP_DEBUG 0
+#define INET_DEBUG 0
+#define IP_DEBUG 0
+#define IP_REASS_DEBUG 1
+#define MEM_DEBUG 0
+#define MEMP_DEBUG 0
+#define SYS_DEBUG 0
+#define TCP_DEBUG 0
+#define TCP_INPUT_DEBUG 0
+#define TCP_FR_DEBUG 0
+#define TCP_RTO_DEBUG 0
+#define TCP_REXMIT_DEBUG 0
+#define TCP_CWND_DEBUG 0
+#define TCP_WND_DEBUG 0
+#define TCP_OUTPUT_DEBUG 0
+#define TCP_RST_DEBUG 0
+#define TCP_QLEN_DEBUG 0
+#define UDP_DEBUG 0
+#define TCPIP_DEBUG 0
+#define TCPDUMP_DEBUG 0
+#define DHCP_DEBUG 1
+
+#include
+#define DEBUGF(debug, x) do { if(debug){ printf x; } } while(0)
+
+
+#else /* LWIP_DEBUG */
+
+/* DEBUG is not defined, so we define null macros for ASSERT and DEBUGF */
+
+#define ASSERT(x,y)
+#define DEBUGF(debug, x)
+
+/* And we define those to be zero: */
+
+#define DEMO_DEBUG 0
+#define ARP_DEBUG 0
+#define NETIF_DEBUG 0
+#define PBUF_DEBUG 0
+#define DELIF_DEBUG 0
+#define DROPIF_DEBUG 0
+#define TUNIF_DEBUG 0
+#define UNIXIF_DEBUG 0
+#define TAPIF_DEBUG 0
+#define API_LIB_DEBUG 0
+#define API_MSG_DEBUG 0
+#define SOCKETS_DEBUG 0
+#define ICMP_DEBUG 0
+#define INET_DEBUG 0
+#define IP_DEBUG 0
+#define IP_REASS_DEBUG 0
+#define MEM_DEBUG 0
+#define MEMP_DEBUG 0
+#define SYS_DEBUG 0
+#define TCP_DEBUG 0
+#define TCP_INPUT_DEBUG 0
+#define TCP_FR_DEBUG 0
+#define TCP_RTO_DEBUG 0
+#define TCP_REXMIT_DEBUG 0
+#define TCP_CWND_DEBUG 0
+#define TCP_WND_DEBUG 0
+#define TCP_OUTPUT_DEBUG 0
+#define TCP_RST_DEBUG 0
+#define TCP_QLEN_DEBUG 0
+#define UDP_DEBUG 0
+#define TCPIP_DEBUG 0
+#define TCPDUMP_DEBUG 0
+#define DHCP_DEBUG 0
+
+#endif /* LWIP_DEBUG */
+
+
+#endif /* __LWIP_DEBUG_H__ */
+
+
+
+
+
+
diff --git a/include/net/def.h b/include/net/def.h
new file mode 100644
index 0000000..19e2289
--- /dev/null
+++ b/include/net/def.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __LWIP_DEF_H__
+#define __LWIP_DEF_H__
+
+#define UMAX(a, b) ((a) > (b) ? (a) : (b))
+
+#ifndef NULL
+#define NULL ((void *)0)
+#endif
+
+#include "arch/lib.h"
+
+#endif /* __LWIP_DEF_H__ */
+
diff --git a/include/net/err.h b/include/net/err.h
new file mode 100644
index 0000000..ddaba06
--- /dev/null
+++ b/include/net/err.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __LWIP_ERR_H__
+#define __LWIP_ERR_H__
+
+#include
+
+#include "net/debug.h"
+
+#include "net/arch/cc.h"
+
+typedef Int8 err_t;
+
+/* Definitions for error constants. */
+
+#define ERR_OK 0 /* No error, everything OK. */
+#define ERR_MEM -1 /* Out of memory error. */
+#define ERR_BUF -2 /* Buffer error. */
+
+
+#define ERR_ABRT -3 /* Connection aborted. */
+#define ERR_RST -4 /* Connection reset. */
+#define ERR_CLSD -5 /* Connection closed. */
+#define ERR_CONN -6 /* Not connected. */
+
+#define ERR_VAL -7 /* Illegal value. */
+
+#define ERR_ARG -8 /* Illegal argument. */
+
+#define ERR_RTE -9 /* Routing problem. */
+
+#define ERR_USE -10 /* Address in use. */
+
+
+
+#ifdef LWIP_DEBUG
+extern char *lwip_strerr(err_t err);
+#else
+#define lwip_strerr(x) ""
+#endif /* LWIP_DEBUG */
+#endif /* __LWIP_ERR_H__ */
diff --git a/include/net/ipv4/icmp.h b/include/net/ipv4/icmp.h
new file mode 100644
index 0000000..0a12aeb
--- /dev/null
+++ b/include/net/ipv4/icmp.h
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __LWIP_ICMP_H__
+#define __LWIP_ICMP_H__
+
+#include "net/arch.h"
+
+#include "net/opt.h"
+#include "net/pbuf.h"
+
+#include "net/netif.h"
+
+#define ICMP_ER 0 /* echo reply */
+#define ICMP_DUR 3 /* destination unreachable */
+#define ICMP_SQ 4 /* source quench */
+#define ICMP_RD 5 /* redirect */
+#define ICMP_ECHO 8 /* echo */
+#define ICMP_TE 11 /* time exceeded */
+#define ICMP_PP 12 /* parameter problem */
+#define ICMP_TS 13 /* timestamp */
+#define ICMP_TSR 14 /* timestamp reply */
+#define ICMP_IRQ 15 /* information request */
+#define ICMP_IR 16 /* information reply */
+
+enum icmp_dur_type {
+ ICMP_DUR_NET = 0, /* net unreachable */
+ ICMP_DUR_HOST = 1, /* host unreachable */
+ ICMP_DUR_PROTO = 2, /* protocol unreachable */
+ ICMP_DUR_PORT = 3, /* port unreachable */
+ ICMP_DUR_FRAG = 4, /* fragmentation needed and DF set */
+ ICMP_DUR_SR = 5 /* source route failed */
+};
+
+enum icmp_te_type {
+ ICMP_TE_TTL = 0, /* time to live exceeded in transit */
+ ICMP_TE_FRAG = 1 /* fragment reassembly time exceeded */
+};
+
+void icmp_input(struct pbuf *p, struct netif *inp);
+
+void icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t);
+void icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t);
+
+struct icmp_echo_hdr {
+ PACK_STRUCT_FIELD(uInt16 _type_code);
+ PACK_STRUCT_FIELD(uInt16 chksum);
+ PACK_STRUCT_FIELD(uInt16 id);
+ PACK_STRUCT_FIELD(uInt16 seqno);
+} PACK_STRUCT_STRUCT;
+
+
+
+struct icmp_dur_hdr {
+ PACK_STRUCT_FIELD(uInt16 _type_code);
+ PACK_STRUCT_FIELD(uInt16 chksum);
+ PACK_STRUCT_FIELD(uInt32 unused);
+} PACK_STRUCT_STRUCT;
+
+struct icmp_te_hdr {
+ PACK_STRUCT_FIELD(uInt16 _type_code);
+ PACK_STRUCT_FIELD(uInt16 chksum);
+ PACK_STRUCT_FIELD(uInt32 unused);
+} PACK_STRUCT_STRUCT;
+
+#define ICMPH_TYPE(hdr) (NTOHS((hdr)->_type_code) >> 8)
+#define ICMPH_CODE(hdr) (NTOHS((hdr)->_type_code) & 0xff)
+
+#define ICMPH_TYPE_SET(hdr, type) ((hdr)->_type_code = HTONS(ICMPH_CODE(hdr) | ((type) << 8)))
+#define ICMPH_CODE_SET(hdr, code) ((hdr)->_type_code = HTONS((code) | (ICMPH_TYPE(hdr) << 8)))
+
+#endif /* __LWIP_ICMP_H__ */
+
diff --git a/include/net/ipv4/inet.h b/include/net/ipv4/inet.h
new file mode 100644
index 0000000..7752f4e
--- /dev/null
+++ b/include/net/ipv4/inet.h
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __LWIP_INET_H__
+#define __LWIP_INET_H__
+
+#include "net/arch.h"
+
+#include "net/opt.h"
+#include "net/pbuf.h"
+#include "net/ipv4/ip_addr.h"
+
+uInt16 inet_chksum(void *dataptr, uInt16 len);
+uInt16 inet_chksum_pbuf(struct pbuf *p);
+uInt16 inet_chksum_pseudo(struct pbuf *p,
+ struct ip_addr *src, struct ip_addr *dest,
+ uInt8 proto, uInt16 proto_len);
+
+#ifdef HTONS
+#undef HTONS
+#endif /* HTONS */
+#ifdef NTOHS
+#undef NTOHS
+#endif /* NTOHS */
+#ifdef HTONL
+#undef HTONL
+#endif /* HTONL */
+#ifdef NTOHL
+#undef NTOHL
+#endif /* NTOHL */
+
+#ifndef HTONS
+# if BYTE_ORDER == BIG_ENDIAN
+# define HTONS(n) (n)
+# define htons(n) HTONS(n)
+# else /* BYTE_ORDER == BIG_ENDIAN */
+# define HTONS(n) (((((uInt16)(n) & 0xff)) << 8) | (((uInt16)(n) & 0xff00) >> 8))
+# endif /* BYTE_ORDER == BIG_ENDIAN */
+#endif /* HTONS */
+
+#ifdef NTOHS
+#undef NTOHS
+#endif /* NTOHS */
+
+#ifdef ntohs
+#undef ntohs
+#endif /* ntohs */
+
+#define NTOHS HTONS
+#define ntohs htons
+
+
+#ifndef HTONL
+# if BYTE_ORDER == BIG_ENDIAN
+# define HTONL(n) (n)
+# define htonl(n) HTONL(n)
+# else /* BYTE_ORDER == BIG_ENDIAN */
+# define HTONL(n) (((((uInt32)(n) & 0xff)) << 24) | \
+ ((((uInt32)(n) & 0xff00)) << 8) | \
+ ((((uInt32)(n) & 0xff0000)) >> 8) | \
+ ((((uInt32)(n) & 0xff000000)) >> 24))
+# endif /* BYTE_ORDER == BIG_ENDIAN */
+#endif /* HTONL */
+
+#ifdef ntohl
+#undef ntohl
+#endif /* ntohl */
+
+#ifdef NTOHL
+#undef NTOHL
+#endif /* NTOHL */
+
+#define NTOHL HTONL
+#define ntohl htonl
+
+#ifndef _MACHINE_ENDIAN_H_
+#ifndef _NETINET_IN_H
+#ifndef _LINUX_BYTEORDER_GENERIC_H
+
+#if BYTE_ORDER == LITTLE_ENDIAN
+uInt16 htons(uInt16 n);
+uInt32 htonl(uInt32 n);
+#else
+#endif /* BYTE_ORDER == LITTLE_ENDIAN */
+
+#endif /* _LINUX_BYTEORDER_GENERIC_H */
+#endif /* _NETINET_IN_H */
+#endif /* _MACHINE_ENDIAN_H_ */
+
+#endif /* __LWIP_INET_H__ */
+
diff --git a/include/net/ipv4/ip.h b/include/net/ipv4/ip.h
new file mode 100644
index 0000000..fcef881
--- /dev/null
+++ b/include/net/ipv4/ip.h
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __LWIP_IP_H__
+#define __LWIP_IP_H__
+
+#include "net/arch.h"
+
+#include "net/def.h"
+#include "net/pbuf.h"
+#include "net/ipv4/ip_addr.h"
+#include "net/netif.h"
+
+#include "net/err.h"
+
+void ip_init(void);
+uInt8 ip_lookup(void *header, struct netif *inp);
+struct netif *ip_route(struct ip_addr *dest);
+err_t ip_input(struct pbuf *p, struct netif *inp);
+err_t ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
+ uInt8 ttl, uInt8 proto);
+err_t ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
+ uInt8 ttl, uInt8 proto,
+ struct netif *netif);
+
+#define IP_HLEN 20
+
+#define IP_PROTO_ICMP 1
+#define IP_PROTO_UDP 17
+#define IP_PROTO_UDPLITE 170
+#define IP_PROTO_TCP 6
+
+/* This is passed as the destination address to ip_output_if (not
+ to ip_output), meaning that an IP header already is constructed
+ in the pbuf. This is used when TCP retransmits. */
+#ifdef IP_HDRINCL
+#undef IP_HDRINCL
+#endif /* IP_HDRINCL */
+#define IP_HDRINCL NULL
+
+struct ip_hdr {
+ /* version / header length / type of service */
+ PACK_STRUCT_FIELD(uInt16 _v_hl_tos);
+ /* total length */
+ PACK_STRUCT_FIELD(uInt16 _len);
+ /* identification */
+ PACK_STRUCT_FIELD(uInt16 _id);
+ /* fragment offset field */
+ PACK_STRUCT_FIELD(uInt16 _offset);
+#define IP_RF 0x8000 /* reserved fragment flag */
+#define IP_DF 0x4000 /* dont fragment flag */
+#define IP_MF 0x2000 /* more fragments flag */
+#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
+ /* time to live / protocol*/
+ PACK_STRUCT_FIELD(uInt16 _ttl_proto);
+ /* checksum */
+ PACK_STRUCT_FIELD(uInt16 _chksum);
+ /* source and destination IP addresses */
+ PACK_STRUCT_FIELD(struct ip_addr src);
+ PACK_STRUCT_FIELD(struct ip_addr dest);
+} PACK_STRUCT_STRUCT;
+
+#define IPH_V(hdr) (NTOHS((hdr)->_v_hl_tos) >> 12)
+#define IPH_HL(hdr) ((NTOHS((hdr)->_v_hl_tos) >> 8) & 0x0f)
+#define IPH_TOS(hdr) HTONS((NTOHS((hdr)->_v_hl_tos) & 0xff))
+#define IPH_LEN(hdr) ((hdr)->_len)
+#define IPH_ID(hdr) ((hdr)->_id)
+#define IPH_OFFSET(hdr) ((hdr)->_offset)
+#define IPH_TTL(hdr) (NTOHS((hdr)->_ttl_proto) >> 8)
+#define IPH_PROTO(hdr) (NTOHS((hdr)->_ttl_proto) & 0xff)
+#define IPH_CHKSUM(hdr) ((hdr)->_chksum)
+
+#define IPH_VHLTOS_SET(hdr, v, hl, tos) (hdr)->_v_hl_tos = HTONS(((v) << 12) | ((hl) << 8) | (tos))
+#define IPH_LEN_SET(hdr, len) (hdr)->_len = (len)
+#define IPH_ID_SET(hdr, id) (hdr)->_id = (id)
+#define IPH_OFFSET_SET(hdr, off) (hdr)->_offset = (off)
+#define IPH_TTL_SET(hdr, ttl) (hdr)->_ttl_proto = HTONS(IPH_PROTO(hdr) | ((ttl) << 8))
+#define IPH_PROTO_SET(hdr, proto) (hdr)->_ttl_proto = HTONS((proto) | (IPH_TTL(hdr) << 8))
+#define IPH_CHKSUM_SET(hdr, chksum) (hdr)->_chksum = (chksum)
+
+
+
+#if IP_DEBUG
+void ip_debug_print(struct pbuf *p);
+#endif /* IP_DEBUG */
+
+#endif /* __LWIP_IP_H__ */
+
+
diff --git a/include/net/ipv4/ip_addr.h b/include/net/ipv4/ip_addr.h
new file mode 100644
index 0000000..2fb5168
--- /dev/null
+++ b/include/net/ipv4/ip_addr.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __LWIP_IP_ADDR_H__
+#define __LWIP_IP_ADDR_H__
+
+#include "net/arch.h"
+
+#define IP_ADDR_ANY 0
+
+#define IP_ADDR_BROADCAST (&ip_addr_broadcast)
+
+PACK_STRUCT_BEGIN
+struct ip_addr {
+ PACK_STRUCT_FIELD(uInt32 addr);
+} PACK_STRUCT_STRUCT;
+PACK_STRUCT_END
+
+extern struct ip_addr ip_addr_broadcast;
+
+#define IP4_ADDR(ipaddr, a,b,c,d) (ipaddr)->addr = htonl(((uInt32)(a & 0xff) << 24) | ((uInt32)(b & 0xff) << 16) | \
+ ((uInt32)(c & 0xff) << 8) | (uInt32)(d & 0xff))
+
+#define ip_addr_set(dest, src) (dest)->addr = \
+ ((src) == IP_ADDR_ANY? IP_ADDR_ANY:\
+ ((struct ip_addr *)src)->addr)
+#define ip_addr_maskcmp(addr1, addr2, mask) (((addr1)->addr & \
+ (mask)->addr) == \
+ ((addr2)->addr & \
+ (mask)->addr))
+#define ip_addr_cmp(addr1, addr2) ((addr1)->addr == (addr2)->addr)
+
+#define ip_addr_isany(addr1) ((addr1) == NULL || (addr1)->addr == 0)
+
+#define ip_addr_isbroadcast(addr1, mask) (((((addr1)->addr) & ~((mask)->addr)) == \
+ (0xffffffff & ~((mask)->addr))) || \
+ ((addr1)->addr == 0xffffffff) || \
+ ((addr1)->addr == 0x00000000))
+
+
+#define ip_addr_ismulticast(addr1) (((addr1)->addr & ntohl(0xf0000000)) == ntohl(0xe0000000))
+
+
+#define ip_addr_debug_print(ipaddr) kprintf("%d.%d.%d.%d", \
+ (uInt8)(ntohl((ipaddr)->addr) >> 24) & 0xff, \
+ (uInt8)(ntohl((ipaddr)->addr) >> 16) & 0xff, \
+ (uInt8)(ntohl((ipaddr)->addr) >> 8) & 0xff, \
+ (uInt8)ntohl((ipaddr)->addr) & 0xff)
+
+
+#define ip4_addr1(ipaddr) ((uInt8)(ntohl((ipaddr)->addr) >> 24) & 0xff)
+#define ip4_addr2(ipaddr) ((uInt8)(ntohl((ipaddr)->addr) >> 16) & 0xff)
+#define ip4_addr3(ipaddr) ((uInt8)(ntohl((ipaddr)->addr) >> 8) & 0xff)
+#define ip4_addr4(ipaddr) ((uInt8)(ntohl((ipaddr)->addr)) & 0xff)
+#endif /* __LWIP_IP_ADDR_H__ */
+
+
+
+
+
+
diff --git a/include/net/ipv6/icmp.h b/include/net/ipv6/icmp.h
new file mode 100644
index 0000000..ac428e9
--- /dev/null
+++ b/include/net/ipv6/icmp.h
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __LWIP_ICMP_H__
+#define __LWIP_ICMP_H__
+
+#include "lwip/arch.h"
+
+#include "lwip/opt.h"
+#include "lwip/pbuf.h"
+
+#include "lwip/netif.h"
+
+#define ICMP6_DUR 1
+#define ICMP6_TE 3
+#define ICMP6_ECHO 128 /* echo */
+#define ICMP6_ER 129 /* echo reply */
+
+
+enum icmp_dur_type {
+ ICMP_DUR_NET = 0, /* net unreachable */
+ ICMP_DUR_HOST = 1, /* host unreachable */
+ ICMP_DUR_PROTO = 2, /* protocol unreachable */
+ ICMP_DUR_PORT = 3, /* port unreachable */
+ ICMP_DUR_FRAG = 4, /* fragmentation needed and DF set */
+ ICMP_DUR_SR = 5 /* source route failed */
+};
+
+enum icmp_te_type {
+ ICMP_TE_TTL = 0, /* time to live exceeded in transit */
+ ICMP_TE_FRAG = 1 /* fragment reassembly time exceeded */
+};
+
+void icmp_input(struct pbuf *p, struct netif *inp);
+
+void icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t);
+void icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t);
+
+struct icmp_echo_hdr {
+ u8_t type;
+ u8_t icode;
+ u16_t chksum;
+ u16_t id;
+ u16_t seqno;
+};
+
+struct icmp_dur_hdr {
+ u8_t type;
+ u8_t icode;
+ u16_t chksum;
+ u32_t unused;
+};
+
+struct icmp_te_hdr {
+ u8_t type;
+ u8_t icode;
+ u16_t chksum;
+ u32_t unused;
+};
+
+#endif /* __LWIP_ICMP_H__ */
+
diff --git a/include/net/ipv6/inet.h b/include/net/ipv6/inet.h
new file mode 100644
index 0000000..8f1f203
--- /dev/null
+++ b/include/net/ipv6/inet.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __LWIP_INET_H__
+#define __LWIP_INET_H__
+
+#include "net/arch.h"
+
+#include "net/opt.h"
+#include "net/pbuf.h"
+#include "net/ipv6/ip_addr.h"
+
+u16_t inet_chksum(void *data, u16_t len);
+u16_t inet_chksum_pbuf(struct pbuf *p);
+u16_t inet_chksum_pseudo(struct pbuf *p,
+ struct ip_addr *src, struct ip_addr *dest,
+ u8_t proto, u32_t proto_len);
+
+
+#ifndef _MACHINE_ENDIAN_H_
+#ifndef _NETINET_IN_H
+#ifndef _LINUX_BYTEORDER_GENERIC_H
+u16_t htons(u16_t n);
+u16_t ntohs(u16_t n);
+u32_t htonl(u32_t n);
+u32_t ntohl(u32_t n);
+#endif /* _LINUX_BYTEORDER_GENERIC_H */
+#endif /* _NETINET_IN_H */
+#endif /* _MACHINE_ENDIAN_H_ */
+
+#endif /* __LWIP_INET_H__ */
+
diff --git a/include/net/ipv6/ip.h b/include/net/ipv6/ip.h
new file mode 100644
index 0000000..82ca272
--- /dev/null
+++ b/include/net/ipv6/ip.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __LWIP_IP_H__
+#define __LWIP_IP_H__
+
+#include "lwip/debug.h"
+#include "lwip/def.h"
+#include "lwip/pbuf.h"
+#include "lwip/ip_addr.h"
+
+#include "lwip/err.h"
+
+#define IP_HLEN 40
+
+#define IP_PROTO_ICMP 58
+#define IP_PROTO_UDP 17
+#define IP_PROTO_UDPLITE 170
+#define IP_PROTO_TCP 6
+
+/* This is passed as the destination address to ip_output_if (not
+ to ip_output), meaning that an IP header already is constructed
+ in the pbuf. This is used when TCP retransmits. */
+#ifdef IP_HDRINCL
+#undef IP_HDRINCL
+#endif /* IP_HDRINCL */
+#define IP_HDRINCL NULL
+
+
+/* The IPv6 header. */
+struct ip_hdr {
+#if BYTE_ORDER == LITTLE_ENDIAN
+ u8_t tclass1:4, v:4;
+ u8_t flow1:4, tclass2:4;
+#else
+ u8_t v:4, tclass1:4;
+ u8_t tclass2:8, flow1:4;
+#endif
+ u16_t flow2;
+ u16_t len; /* payload length */
+ u8_t nexthdr; /* next header */
+ u8_t hoplim; /* hop limit (TTL) */
+ struct ip_addr src, dest; /* source and destination IP addresses */
+};
+
+void ip_init(void);
+
+#include "lwip/netif.h"
+
+struct netif *ip_route(struct ip_addr *dest);
+
+void ip_input(struct pbuf *p, struct netif *inp);
+
+/* source and destination addresses in network byte order, please */
+err_t ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
+ unsigned char ttl, unsigned char proto);
+
+err_t ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
+ unsigned char ttl, unsigned char proto,
+ struct netif *netif);
+
+#if IP_DEBUG
+void ip_debug_print(struct pbuf *p);
+#endif /* IP_DEBUG */
+
+#endif /* __LWIP_IP_H__ */
+
+
diff --git a/include/net/ipv6/ip_addr.h b/include/net/ipv6/ip_addr.h
new file mode 100644
index 0000000..a082805
--- /dev/null
+++ b/include/net/ipv6/ip_addr.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __LWIP_IP_ADDR_H__
+#define __LWIP_IP_ADDR_H__
+
+#include "net/arch.h"
+
+#define IP_ADDR_ANY 0
+
+struct ip_addr {
+ u32_t addr[4];
+};
+
+#define IP6_ADDR(ipaddr, a,b,c,d,e,f,g,h) do { (ipaddr)->addr[0] = htonl((u32_t)((a & 0xffff) << 16) | (b & 0xffff)); \
+ (ipaddr)->addr[1] = htonl(((c & 0xffff) << 16) | (d & 0xffff)); \
+ (ipaddr)->addr[2] = htonl(((e & 0xffff) << 16) | (f & 0xffff)); \
+ (ipaddr)->addr[3] = htonl(((g & 0xffff) << 16) | (h & 0xffff)); } while(0)
+
+int ip_addr_maskcmp(struct ip_addr *addr1, struct ip_addr *addr2,
+ struct ip_addr *mask);
+int ip_addr_cmp(struct ip_addr *addr1, struct ip_addr *addr2);
+void ip_addr_set(struct ip_addr *dest, struct ip_addr *src);
+int ip_addr_isany(struct ip_addr *addr);
+
+
+#if IP_DEBUG
+void ip_addr_debug_print(struct ip_addr *addr);
+#endif /* IP_DEBUG */
+
+#endif /* __LWIP_IP_ADDR_H__ */
diff --git a/include/net/list.h b/include/net/list.h
new file mode 100644
index 0000000..f2afc5f
--- /dev/null
+++ b/include/net/list.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __LWIP_LIST_H__
+#define __LWIP_LIST_H__
+
+struct list;
+
+struct list *list_new(int size);
+int list_push(struct list *list, void *elem);
+void *list_pop(struct list *list);
+int list_remove(struct list *list, void *elem);
+void *list_first(struct list *list);
+int list_elems(struct list *list);
+void list_delete(struct list *list);
+
+void list_map(struct list *list, void (* func)(void *arg));
+
+#endif /* __LWIP_LIST_H__ */
diff --git a/include/net/lwipopts.h b/include/net/lwipopts.h
new file mode 100644
index 0000000..1499b27
--- /dev/null
+++ b/include/net/lwipopts.h
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __LWIPOPTS_H__
+#define __LWIPOPTS_H__
+
+/* ---------- Memory options ---------- */
+/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
+ lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
+ byte alignment -> define MEM_ALIGNMENT to 2. */
+#define MEM_ALIGNMENT 2
+
+/* MEM_SIZE: the size of the heap memory. If the application will send
+a lot of data that needs to be copied, this should be set high. */
+#define MEM_SIZE 1000
+
+/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
+ sends a lot of data out of ROM (or other static memory), this
+ should be set high. */
+#define MEMP_NUM_PBUF 8
+/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
+ per active UDP "connection". */
+#define MEMP_NUM_UDP_PCB 4
+/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
+ connections. */
+#define MEMP_NUM_TCP_PCB 5
+/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
+ connections. */
+#define MEMP_NUM_TCP_PCB_LISTEN 8
+/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
+ segments. */
+#define MEMP_NUM_TCP_SEG 8
+/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
+ timeouts. */
+#define MEMP_NUM_SYS_TIMEOUT 3
+
+
+/* The following four are used only with the sequential API and can be
+ set to 0 if the application only will use the raw API. */
+/* MEMP_NUM_NETBUF: the number of struct netbufs. */
+#define MEMP_NUM_NETBUF 2
+/* MEMP_NUM_NETCONN: the number of struct netconns. */
+#define MEMP_NUM_NETCONN 4
+/* MEMP_NUM_APIMSG: the number of struct api_msg, used for
+ communication between the TCP/IP stack and the sequential
+ programs. */
+#define MEMP_NUM_API_MSG 8
+/* MEMP_NUM_TCPIPMSG: the number of struct tcpip_msg, which is used
+ for sequential API communication and incoming packets. Used in
+ src/api/tcpip.c. */
+#define MEMP_NUM_TCPIP_MSG 8
+
+/* These two control is reclaimer functions should be compiled
+ in. Should always be turned on (1). */
+#define MEM_RECLAIM 1
+#define MEMP_RECLAIM 1
+
+/* ---------- Pbuf options ---------- */
+/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
+#define PBUF_POOL_SIZE 6
+
+/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
+#define PBUF_POOL_BUFSIZE 128
+
+/* PBUF_LINK_HLEN: the number of bytes that should be allocated for a
+ link level header. */
+#define PBUF_LINK_HLEN 16
+
+/* ---------- TCP options ---------- */
+#define LWIP_TCP 1
+#define TCP_TTL 255
+
+/* Controls if TCP should queue segments that arrive out of
+ order. Define to 0 if your device is low on memory. */
+#define TCP_QUEUE_OOSEQ 1
+
+/* TCP Maximum segment size. */
+#define TCP_MSS 128
+
+/* TCP sender buffer space (bytes). */
+#define TCP_SND_BUF 256
+
+/* TCP sender buffer space (pbufs). This must be at least = 2 *
+ TCP_SND_BUF/TCP_MSS for things to work. */
+#define TCP_SND_QUEUELEN 4 * TCP_SND_BUF/TCP_MSS
+
+/* TCP receive window. */
+#define TCP_WND 1024
+
+/* Maximum number of retransmissions of data segments. */
+#define TCP_MAXRTX 12
+
+/* Maximum number of retransmissions of SYN segments. */
+#define TCP_SYNMAXRTX 4
+
+/* ---------- ARP options ---------- */
+#define ARP_TABLE_SIZE 10
+
+/* ---------- IP options ---------- */
+/* Define IP_FORWARD to 1 if you wish to have the ability to forward
+ IP packets across network interfaces. If you are going to run lwIP
+ on a device with only one network interface, define this to 0. */
+#define IP_FORWARD 1
+
+/* If defined to 1, IP options are allowed (but not parsed). If
+ defined to 0, all packets with IP options are dropped. */
+#define IP_OPTIONS 1
+
+/* ---------- ICMP options ---------- */
+#define ICMP_TTL 255
+
+
+/* ---------- DHCP options ---------- */
+/* Define LWIP_DHCP to 1 if you want DHCP configuration of
+ interfaces. DHCP is not implemented in lwIP 0.5.1, however, so
+ turning this on does currently not work. */
+#define LWIP_DHCP 0
+
+/* 1 if you want to do an ARP check on the offered address
+ (recommended). */
+#define DHCP_DOES_ARP_CHECK 1
+
+/* ---------- UDP options ---------- */
+#define LWIP_UDP 1
+#define UDP_TTL 255
+
+
+/* ---------- Statistics options ---------- */
+#define STATS
+
+#ifdef STATS
+#define LINK_STATS
+#define IP_STATS
+#define ICMP_STATS
+#define UDP_STATS
+#define TCP_STATS
+#define MEM_STATS
+#define MEMP_STATS
+#define PBUF_STATS
+#define SYS_STATS
+#endif /* STATS */
+
+#endif /* __LWIPOPTS_H__ */
diff --git a/include/net/mem.h b/include/net/mem.h
new file mode 100644
index 0000000..342c208
--- /dev/null
+++ b/include/net/mem.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __LWIP_MEM_H__
+#define __LWIP_MEM_H__
+
+#include
+
+#include "net/debug.h"
+#include "net/opt.h"
+#include "net/arch.h"
+
+#if MEM_SIZE > 64000l
+typedef uInt32 mem_size_t;
+#else
+typedef uInt16 mem_size_t;
+#endif /* MEM_SIZE > 64000 */
+
+
+void mem_init(void);
+
+void *mem_malloc(mem_size_t size);
+void *mem_malloc2(mem_size_t size);
+void mem_free(void *mem);
+void *mem_realloc(void *mem, mem_size_t size);
+void *mem_reallocm(void *mem, mem_size_t size);
+
+#ifdef MEM_PERF
+void mem_perf_start(void);
+void mem_perf_init(char *fname);
+#endif /* MEM_PERF */
+
+#ifdef MEM_RECLAIM
+typedef mem_size_t (*mem_reclaim_func)(void *arg, mem_size_t size);
+void mem_register_reclaim(mem_reclaim_func f, void *arg);
+void mem_reclaim(unsigned int size);
+#else
+#define mem_register_reclaim(f, arg)
+#endif /* MEM_RECLAIM */
+
+
+#define MEM_ALIGN_SIZE(size) (size + \
+ ((((size) % (MEM_ALIGNMENT)) == 0)? 0 : \
+ ((MEM_ALIGNMENT) - ((size) % (MEM_ALIGNMENT)))))
+
+#define MEM_ALIGN(addr) (void *)MEM_ALIGN_SIZE((uInt32)addr)
+
+#endif /* __LWIP_MEM_H__ */
+
diff --git a/include/net/memp.h b/include/net/memp.h
new file mode 100644
index 0000000..3e0b849
--- /dev/null
+++ b/include/net/memp.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+
+#ifndef __LWIP_MEMP_H__
+#define __LWIP_MEMP_H__
+
+#include
+
+#include "net/debug.h"
+#include "net/arch/cc.h"
+#include "net/lwipopts.h"
+
+typedef enum {
+ MEMP_PBUF,
+ MEMP_UDP_PCB,
+ MEMP_TCP_PCB,
+ MEMP_TCP_PCB_LISTEN,
+ MEMP_TCP_SEG,
+
+ MEMP_NETBUF,
+ MEMP_NETCONN,
+ MEMP_API_MSG,
+ MEMP_TCPIP_MSG,
+
+ MEMP_SYS_TIMEOUT,
+
+ MEMP_MAX
+} memp_t;
+
+void memp_init(void);
+
+void *memp_malloc(memp_t type);
+void *memp_mallocp(memp_t type);
+void *memp_malloc2(memp_t type);
+void *memp_realloc(memp_t fromtype, memp_t totype, void *mem);
+void memp_free(memp_t type, void *mem);
+void memp_freep(memp_t type, void *mem);
+
+#if MEMP_RECLAIM
+typedef uInt8 (*memp_reclaim_func)(void *arg, memp_t type);
+void memp_register_reclaim(memp_t type, memp_reclaim_func f, void *arg);
+#else
+#define memp_register_reclaim(t, f, arg)
+#endif /* MEMP_RECLAIM */
+
+#endif /* __LWIP_MEMP_H__ */
+
diff --git a/include/net/net.h b/include/net/net.h
new file mode 100644
index 0000000..b1fa875
--- /dev/null
+++ b/include/net/net.h
@@ -0,0 +1,36 @@
+/**************************************************************************************
+ Copyright (c) 2002 The UbixOS Project
+ All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list of conditions, the following disclaimer and the list of authors.
+Redistributions in binary form must reproduce the above copyright notice, this list of conditions, the following disclaimer and the list of authors
+in the documentation and/or other materials provided with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+**************************************************************************************/
+
+#ifndef _NET_H
+#define _NET_H
+
+#include
+
+int net_init();
+
+#endif
+
+/***
+ END
+ ***/
+
diff --git a/include/net/netif.h b/include/net/netif.h
new file mode 100644
index 0000000..545ec7e
--- /dev/null
+++ b/include/net/netif.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __LWIP_NETIF_H__
+#define __LWIP_NETIF_H__
+
+#include "net/opt.h"
+
+#include "net/err.h"
+
+#include "net/ipv4/ip_addr.h"
+#include "net/ipv4/inet.h"
+
+#include "net/pbuf.h"
+
+
+struct netif {
+ struct netif *next;
+ uInt8 num;
+ struct ip_addr ip_addr;
+ struct ip_addr netmask; /* netmask in network byte order */
+ struct ip_addr gw;
+ char hwaddr[6];
+
+ /* This function is called by the network device driver
+ when it wants to pass a packet to the TCP/IP stack. */
+ err_t (* input)(struct pbuf *p, struct netif *inp);
+
+ /* The following two fields should be filled in by the
+ initialization function for the device driver. */
+
+ char name[2];
+ /* This function is called by the IP module when it wants
+ to send a packet on the interface. */
+ err_t (* output)(struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr);
+ err_t (* linkoutput)(struct netif *netif, struct pbuf *p);
+
+ /* This field can be set bu the device driver and could point
+ to state information for the device. */
+ void *state;
+};
+
+/* The list of network interfaces. */
+extern struct netif *netif_list;
+extern struct netif *netif_default;
+
+
+/* netif_init() must be called first. */
+void netif_init();
+
+struct netif *netif_add(struct ip_addr *ipaddr, struct ip_addr *netmask,
+ struct ip_addr *gw,
+ void (* init)(struct netif *netif),
+ err_t (* input)(struct pbuf *p, struct netif *netif));
+
+/* Returns a network interface given its name. The name is of the form
+ "et0", where the first two letters are the "name" field in the
+ netif structure, and the digit is in the num field in the same
+ structure. */
+struct netif *netif_find(char *name);
+
+void netif_set_default(struct netif *netif);
+
+void netif_set_ipaddr(struct netif *netif, struct ip_addr *ipaddr);
+void netif_set_netmask(struct netif *netif, struct ip_addr *netmast);
+void netif_set_gw(struct netif *netif, struct ip_addr *gw);
+
+#endif /* __LWIP_NETIF_H__ */
diff --git a/include/net/opt.h b/include/net/opt.h
new file mode 100644
index 0000000..71d42c3
--- /dev/null
+++ b/include/net/opt.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __LWIP_OPT_H__
+#define __LWIP_OPT_H__
+
+#include "net/lwipopts.h"
+
+/* Define some handy default values for configuration parameters. */
+
+#ifndef ICMP_TTL
+#define ICMP_TTL 255
+#endif
+
+#ifndef UDP_TTL
+#define UDP_TTL 255
+#endif
+
+#ifndef TCP_TTL
+#define TCP_TTL 255
+#endif
+
+#ifndef TCP_MSS
+#define TCP_MSS 128 /* A *very* conservative default. */
+#endif
+
+#ifndef TCP_WND
+#define TCP_WND 2048
+#endif
+
+#ifndef TCP_MAXRTX
+#define TCP_MAXRTX 12
+#endif
+
+#ifndef TCP_SYNMAXRTX
+#define TCP_SYNMAXRTX 6
+#endif
+
+#ifndef MEM_ALIGNMENT
+#define MEM_ALIGNMENT 1
+#endif
+
+#ifndef PBUF_POOL_SIZE
+#define PBUF_POOL_SIZE 16
+#endif
+
+#ifndef PBUF_POOL_BUFSIZE
+#define PBUF_POOL_BUFSIZE 128
+#endif
+
+#ifndef PBUF_LINK_HLEN
+#define PBUF_LINK_HLEN 0
+#endif
+
+#ifndef LWIP_UDP
+#define LWIP_UDP 1
+#endif
+
+#ifndef LWIP_TCP
+#define LWIP_TCP 1
+#endif
+
+#endif /* __LWIP_OPT_H__ */
+
+
+
diff --git a/include/net/pbuf.h b/include/net/pbuf.h
new file mode 100644
index 0000000..293ac35
--- /dev/null
+++ b/include/net/pbuf.h
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+/*-----------------------------------------------------------------------------------*/
+#ifndef __LWIP_PBUF_H__
+#define __LWIP_PBUF_H__
+
+#include "net/debug.h"
+#include "net/arch.h"
+
+
+#define PBUF_TRANSPORT_HLEN 20
+#define PBUF_IP_HLEN 20
+
+typedef enum {
+ PBUF_TRANSPORT,
+ PBUF_IP,
+ PBUF_LINK,
+ PBUF_RAW
+} pbuf_layer;
+
+typedef enum {
+ PBUF_RAM,
+ PBUF_ROM,
+ PBUF_POOL
+} pbuf_flag;
+
+/* Definitions for the pbuf flag field (these are not the flags that
+ are passed to pbuf_alloc()). */
+#define PBUF_FLAG_RAM 0x00 /* Flags that pbuf data is stored in RAM. */
+#define PBUF_FLAG_ROM 0x01 /* Flags that pbuf data is stored in ROM. */
+#define PBUF_FLAG_POOL 0x02 /* Flags that the pbuf comes from the
+ pbuf pool. */
+
+struct pbuf {
+ struct pbuf *next;
+
+ /* high 4 bits, flags, low 4 bits reference count */
+ uInt8 flags, ref;
+ void *payload;
+
+ /* Total length of buffer + additionally chained buffers. */
+ uInt16 tot_len;
+ /* Length of this buffer. */
+ uInt16 len;
+
+};
+
+/* pbuf_init():
+
+ Initializes the pbuf module. The num parameter determines how many
+ pbufs that should be allocated to the pbuf pool, and the size
+ parameter specifies the size of the data allocated to those. */
+void pbuf_init(void);
+
+/* pbuf_alloc():
+
+ Allocates a pbuf at protocol layer l. The actual memory allocated
+ for the pbuf is determined by the layer at which the pbuf is
+ allocated and the requested size (from the size parameter). The
+ flag parameter decides how and where the pbuf should be allocated
+ as follows:
+
+ * PBUF_RAM: buffer memory for pbuf is allocated as one large
+ chunk. This includesprotocol headers as well.
+
+ * RBUF_ROM: no buffer memory is allocated for the pbuf, even for
+ protocol headers. Additional headers must be
+ prepended by allocating another pbuf and chain in to
+ the front of the ROM pbuf.
+
+ * PBUF_ROOL: the pbuf is allocated as a pbuf chain, with pbufs from
+ the pbuf pool that is allocated during pbuf_init(). */
+struct pbuf *pbuf_alloc(pbuf_layer l, uInt16 size, pbuf_flag flag);
+
+/* pbuf_realloc():
+
+ Shrinks the pbuf to the size given by the size parameter.
+ */
+void pbuf_realloc(struct pbuf *p, uInt16 size);
+
+/* pbuf_header():
+
+ Tries to move the p->payload pointer header_size number of bytes
+ upward within the pbuf. The return value is non-zero if it
+ fails. If so, an additional pbuf should be allocated for the header
+ and it should be chained to the front. */
+uInt8 pbuf_header(struct pbuf *p, Int16 header_size);
+
+/* pbuf_ref():
+
+ Increments the reference count of the pbuf p.
+ */
+void pbuf_ref(struct pbuf *p);
+
+/* pbuf_free():
+
+ Decrements the reference count and deallocates the pbuf if the
+ reference count is zero. If the pbuf is a chain all pbufs in the
+ chain are deallocated. */
+uInt8 pbuf_free(struct pbuf *p);
+
+/* pbuf_clen():
+
+ Returns the length of the pbuf chain. */
+uInt8 pbuf_clen(struct pbuf *p);
+
+/* pbuf_chain():
+
+ Chains pbuf t on the end of pbuf h. Pbuf h will have it's tot_len
+ field adjusted accordingly. Pbuf t should no be used any more after
+ a call to this function, since pbuf t is now a part of pbuf h. */
+void pbuf_chain(struct pbuf *h, struct pbuf *t);
+
+/* pbuf_dechain():
+
+ Picks off the first pbuf from the pbuf chain p. Returns the tail of
+ the pbuf chain or NULL if the pbuf p was not chained. */
+struct pbuf *pbuf_dechain(struct pbuf *p);
+
+#endif /* __LWIP_PBUF_H__ */
diff --git a/include/net/sockets.h b/include/net/sockets.h
new file mode 100644
index 0000000..577a2eb
--- /dev/null
+++ b/include/net/sockets.h
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+
+
+#ifndef __LWIP_SOCKETS_H__
+#define __LWIP_SOCKETS_H__
+
+#include
+
+struct in_addr {
+ uInt32 s_addr;
+};
+
+
+struct sockaddr_in {
+ uInt8 sin_len;
+ uInt8 sin_family;
+ uInt16 sin_port;
+ struct in_addr sin_addr;
+ char sin_zero[8];
+};
+
+struct sockaddr {
+ uInt8 sa_len;
+ uInt8 sa_family;
+ char sa_data[14];
+};
+
+#define SOCK_STREAM 1
+#define SOCK_DGRAM 2
+
+#define AF_INET 2
+#define PF_INET AF_INET
+
+#define IPPROTO_TCP 6
+#define IPPROTO_UDP 17
+
+#define INADDR_ANY 0
+#define INADDR_BROADCAST 0xffffffff
+
+int lwip_accept(int s, struct sockaddr *addr, int *addrlen);
+int lwip_bind(int s, struct sockaddr *name, int namelen);
+int lwip_close(int s);
+int lwip_connect(int s, struct sockaddr *name, int namelen);
+int lwip_listen(int s, int backlog);
+int lwip_recv(int s, void *mem, int len, unsigned int flags);
+int lwip_read(int s, void *mem, int len);
+int lwip_recvfrom(int s, void *mem, int len, unsigned int flags,
+ struct sockaddr *from, int *fromlen);
+int lwip_send(int s, void *dataptr, int size, unsigned int flags);
+int lwip_sendto(int s, void *dataptr, int size, unsigned int flags,
+ struct sockaddr *to, int tolen);
+int lwip_socket(int domain, int type, int protocol);
+int lwip_write(int s, void *dataptr, int size);
+
+#ifdef LWIP_COMPAT_SOCKETS
+#define accept(a,b,c) lwip_accept(a,b,c)
+#define bind(a,b,c) lwip_bind(a,b,c)
+#define close(s) lwip_close(s)
+#define connect(a,b,c) lwip_connect(a,b,c)
+#define listen(a,b) lwip_listen(a,b)
+#define recv(a,b,c,d) lwip_recv(a,b,c,d)
+#define read(a,b,c) lwip_read(a,b,c)
+#define recvfrom(a,b,c,d,e,f) lwip_recvfrom(a,b,c,d,e,f)
+#define send(a,b,c,d) lwip_send(a,b,c,d)
+#define sendto(a,b,c,d,e,f) lwip_sendto(a,b,c,d,e,f)
+#define socket(a,b,c) lwip_socket(a,b,c)
+#define write(a,b,c) lwip_write(a,b,c)
+#endif /* LWIP_NO_COMPAT_SOCKETS */
+
+#endif /* __LWIP_SOCKETS_H__ */
+
diff --git a/include/net/stats.h b/include/net/stats.h
new file mode 100644
index 0000000..bea1a61
--- /dev/null
+++ b/include/net/stats.h
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __LWIP_STATS_H__
+#define __LWIP_STATS_H__
+
+#include "net/opt.h"
+#include "net/arch/cc.h"
+
+#include "net/memp.h"
+
+#ifdef STATS
+
+struct stats_proto {
+ uInt16 xmit; /* Transmitted packets. */
+ uInt16 rexmit; /* Retransmitted packets. */
+ uInt16 recv; /* Received packets. */
+ uInt16 fw; /* Forwarded packets. */
+ uInt16 drop; /* Dropped packets. */
+ uInt16 chkerr; /* Checksum error. */
+ uInt16 lenerr; /* Invalid length error. */
+ uInt16 memerr; /* Out of memory error. */
+ uInt16 rterr; /* Routing error. */
+ uInt16 proterr; /* Protocol error. */
+ uInt16 opterr; /* Error in options. */
+ uInt16 err; /* Misc error. */
+ uInt16 cachehit;
+};
+
+struct stats_mem {
+ uInt16 avail;
+ uInt16 used;
+ uInt16 max;
+ uInt16 err;
+ uInt16 reclaimed;
+};
+
+struct stats_pbuf {
+ uInt16 avail;
+ uInt16 used;
+ uInt16 max;
+ uInt16 err;
+ uInt16 reclaimed;
+
+ uInt16 alloc_locked;
+ uInt16 refresh_locked;
+};
+
+struct stats_syselem {
+ uInt16 used;
+ uInt16 max;
+ uInt16 err;
+};
+
+struct stats_sys {
+ struct stats_syselem sem;
+ struct stats_syselem mbox;
+};
+
+struct stats_ {
+ struct stats_proto link;
+ struct stats_proto ip;
+ struct stats_proto icmp;
+ struct stats_proto udp;
+ struct stats_proto tcp;
+ struct stats_pbuf pbuf;
+ struct stats_mem mem;
+ struct stats_mem memp[MEMP_MAX];
+ struct stats_sys sys;
+};
+
+extern struct stats_ stats;
+
+#endif /* STATS */
+
+void stats_init(void);
+#endif /* __LWIP_STATS_H__ */
+
+
+
+
diff --git a/include/net/sys.h b/include/net/sys.h
new file mode 100644
index 0000000..f453ded
--- /dev/null
+++ b/include/net/sys.h
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __LWIP_SYS_H__
+#define __LWIP_SYS_H__
+
+#include "arch/cc.h"
+#include "arch/sys_arch.h"
+
+typedef void (* sys_timeout_handler)(void *arg);
+
+struct sys_timeout {
+ struct sys_timeout *next;
+ uInt16 time;
+ sys_timeout_handler h;
+ void *arg;
+};
+
+struct sys_timeouts {
+ struct sys_timeout *next;
+};
+
+/* sys_init() must be called before anthing else. */
+void sys_init(void);
+
+/*
+ * sys_timeout():
+ *
+ * Schedule a timeout a specified amount of milliseconds in the
+ * future. When the timeout occurs, the specified timeout handler will
+ * be called. The handler will be passed the "arg" argument when
+ * called.
+ *
+ */
+void sys_timeout(uInt16 msecs, sys_timeout_handler h, void *arg);
+struct sys_timeouts *sys_arch_timeouts(void);
+
+/* Semaphore functions. */
+sys_sem_t sys_sem_new(uInt8 count);
+void sys_sem_signal(sys_sem_t sem);
+uInt16 sys_arch_sem_wait(sys_sem_t sem, uInt16 timeout);
+void sys_sem_free(sys_sem_t sem);
+
+void sys_sem_wait(sys_sem_t sem);
+
+/* Mailbox functions. */
+sys_mbox_t sys_mbox_new(void);
+void sys_mbox_post(sys_mbox_t mbox, void *msg);
+uInt16 sys_arch_mbox_fetch(sys_mbox_t mbox, void **msg, uInt16 timeout);
+void sys_mbox_free(sys_mbox_t mbox);
+
+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 (* function)(void), void *arg);
+
+/* The following functions are used only in Unix code, and
+ can be omitted when porting the stack. */
+/* Returns the current time in microseconds. */
+unsigned long sys_now(void);
+
+#endif /* __LWIP_SYS_H__ */
diff --git a/include/net/tcp.h b/include/net/tcp.h
new file mode 100644
index 0000000..ee58616
--- /dev/null
+++ b/include/net/tcp.h
@@ -0,0 +1,401 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __LWIP_TCP_H__
+#define __LWIP_TCP_H__
+
+#include "net/sys.h"
+#include "net/mem.h"
+
+#include "net/pbuf.h"
+#include "net/opt.h"
+//UBU
+#include "net/ipv4/ip.h"
+//UBU
+#include "net/ipv4/icmp.h"
+
+#include "net/sys.h"
+
+#include "net/err.h"
+
+struct tcp_pcb;
+
+/* Functions for interfacing with TCP: */
+
+/* Lower layer interface to TCP: */
+void tcp_init (void); /* Must be called first to
+ initialize TCP. */
+void tcp_tmr (void); /* Must be called every
+ TCP_TMR_INTERVAL
+ ms. (Typically 100 ms). */
+/* Application program's interface: */
+struct tcp_pcb * tcp_new (void);
+
+void tcp_arg (struct tcp_pcb *pcb, void *arg);
+void tcp_accept (struct tcp_pcb *pcb,
+ err_t (* accept)(void *arg, struct tcp_pcb *newpcb,
+ err_t err));
+void tcp_recv (struct tcp_pcb *pcb,
+ err_t (* recv)(void *arg, struct tcp_pcb *tpcb,
+ struct pbuf *p, err_t err));
+void tcp_sent (struct tcp_pcb *pcb,
+ err_t (* sent)(void *arg, struct tcp_pcb *tpcb,
+ uInt16 len));
+void tcp_poll (struct tcp_pcb *pcb,
+ err_t (* poll)(void *arg, struct tcp_pcb *tpcb),
+ uInt8 interval);
+void tcp_err (struct tcp_pcb *pcb,
+ void (* err)(void *arg, err_t err));
+
+#define tcp_sndbuf(pcb) ((pcb)->snd_buf)
+
+void tcp_recved (struct tcp_pcb *pcb, uInt16 len);
+err_t tcp_bind (struct tcp_pcb *pcb, struct ip_addr *ipaddr,
+ uInt16 port);
+err_t tcp_connect (struct tcp_pcb *pcb, struct ip_addr *ipaddr,
+ uInt16 port, err_t (* connected)(void *arg,
+ struct tcp_pcb *tpcb,
+ err_t err));
+struct tcp_pcb * tcp_listen (struct tcp_pcb *pcb);
+void tcp_abort (struct tcp_pcb *pcb);
+err_t tcp_close (struct tcp_pcb *pcb);
+err_t tcp_write (struct tcp_pcb *pcb, const void *dataptr, uInt16 len,
+ uInt8 copy);
+
+/* It is also possible to call these two functions at the right
+ intervals (instead of calling tcp_tmr()). */
+void tcp_slowtmr (void);
+void tcp_fasttmr (void);
+
+
+/* Only used by IP to pass a TCP segment to TCP: */
+void tcp_input (struct pbuf *p, struct netif *inp);
+/* Used within the TCP code only: */
+err_t tcp_output (struct tcp_pcb *pcb);
+
+
+
+
+#define TCP_SEQ_LT(a,b) ((Int32)((a)-(b)) < 0)
+#define TCP_SEQ_LEQ(a,b) ((Int32)((a)-(b)) <= 0)
+#define TCP_SEQ_GT(a,b) ((Int32)((a)-(b)) > 0)
+#define TCP_SEQ_GEQ(a,b) ((Int32)((a)-(b)) >= 0)
+
+#define TCP_FIN 0x01
+#define TCP_SYN 0x02
+#define TCP_RST 0x04
+#define TCP_PSH 0x08
+#define TCP_ACK 0x10
+#define TCP_URG 0x20
+
+/* Length of the TCP header, excluding options. */
+#define TCP_HLEN 20
+
+#define TCP_TMR_INTERVAL 100 /* The TCP timer interval in
+ milliseconds. */
+
+#define TCP_FAST_INTERVAL 200 /* the fine grained timeout in
+ milliseconds */
+#define TCP_SLOW_INTERVAL 500 /* the coarse grained timeout in
+ milliseconds */
+#define TCP_FIN_WAIT_TIMEOUT 20000 /* milliseconds */
+#define TCP_SYN_RCVD_TIMEOUT 20000 /* milliseconds */
+
+#define TCP_OOSEQ_TIMEOUT 6 /* x RTO */
+
+#define TCP_MSL 60000 /* The maximum segment lifetime in microseconds */
+
+struct tcp_hdr {
+ PACK_STRUCT_FIELD(uInt16 src);
+ PACK_STRUCT_FIELD(uInt16 dest);
+ PACK_STRUCT_FIELD(uInt32 seqno);
+ PACK_STRUCT_FIELD(uInt32 ackno);
+ PACK_STRUCT_FIELD(uInt16 _offset_flags);
+ PACK_STRUCT_FIELD(uInt16 wnd);
+ PACK_STRUCT_FIELD(uInt16 chksum);
+ PACK_STRUCT_FIELD(uInt16 urgp);
+} PACK_STRUCT_STRUCT;
+
+#define TCPH_OFFSET(hdr) (NTOHS((hdr)->_offset_flags) >> 8)
+#define TCPH_FLAGS(hdr) (NTOHS((hdr)->_offset_flags) & 0xff)
+
+#define TCPH_OFFSET_SET(hdr, offset) (hdr)->_offset_flags = HTONS(((offset) << 8) | TCPH_FLAGS(hdr))
+#define TCPH_FLAGS_SET(hdr, flags) (hdr)->_offset_flags = HTONS((TCPH_OFFSET(hdr) << 8) | (flags))
+
+#define TCP_TCPLEN(seg) ((seg)->len + ((TCPH_FLAGS((seg)->tcphdr) & TCP_FIN || \
+ TCPH_FLAGS((seg)->tcphdr) & TCP_SYN)? 1: 0))
+
+enum tcp_state {
+ CLOSED = 0,
+ LISTEN = 1,
+ SYN_SENT = 2,
+ SYN_RCVD = 3,
+ ESTABLISHED = 4,
+ FIN_WAIT_1 = 5,
+ FIN_WAIT_2 = 6,
+ CLOSE_WAIT = 7,
+ CLOSING = 8,
+ LAST_ACK = 9,
+ TIME_WAIT = 10
+};
+
+
+/* the TCP protocol control block */
+struct tcp_pcb {
+ struct tcp_pcb *next; /* for the linked list */
+
+ enum tcp_state state; /* TCP state */
+
+ void *callback_arg;
+
+ /* Function to call when a listener has been connected. */
+ err_t (* accept)(void *arg, struct tcp_pcb *newpcb, err_t err);
+
+ struct ip_addr local_ip;
+ uInt16 local_port;
+
+ struct ip_addr remote_ip;
+ uInt16 remote_port;
+
+ /* receiver varables */
+ uInt32 rcv_nxt; /* next seqno expected */
+ uInt16 rcv_wnd; /* receiver window */
+
+ /* Timers */
+ uInt16 tmr;
+
+ /* Retransmission timer. */
+ uInt8 rtime;
+
+ uInt16 mss; /* maximum segment size */
+
+ uInt8 flags;
+#define TF_ACK_DELAY 0x01 /* Delayed ACK. */
+#define TF_ACK_NOW 0x02 /* Immediate ACK. */
+#define TF_INFR 0x04 /* In fast recovery. */
+#define TF_RESET 0x08 /* Connection was reset. */
+#define TF_CLOSED 0x10 /* Connection was sucessfully closed. */
+#define TF_GOT_FIN 0x20 /* Connection was closed by the remote end. */
+
+ /* RTT estimation variables. */
+ uInt16 rttest; /* RTT estimate in 500ms ticks */
+ uInt32 rtseq; /* sequence number being timed */
+ Int32 sa, sv;
+
+ uInt16 rto; /* retransmission time-out */
+ uInt8 nrtx; /* number of retransmissions */
+
+ /* fast retransmit/recovery */
+ uInt32 lastack; /* Highest acknowledged seqno. */
+ uInt8 dupacks;
+
+ /* congestion avoidance/control variables */
+ uInt16 cwnd;
+ uInt16 ssthresh;
+
+ /* sender variables */
+ uInt32 snd_nxt, /* next seqno to be sent */
+ snd_max, /* Highest seqno sent. */
+ snd_wnd, /* sender window */
+ snd_wl1, snd_wl2,
+ snd_lbb;
+
+ uInt16 snd_buf; /* Avaliable buffer space for sending. */
+ uInt8 snd_queuelen;
+
+ /* Function to be called when more send buffer space is avaliable. */
+ err_t (* sent)(void *arg, struct tcp_pcb *pcb, uInt16 space);
+ uInt16 acked;
+
+ /* Function to be called when (in-sequence) data has arrived. */
+ err_t (* recv)(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err);
+ struct pbuf *recv_data;
+
+ /* Function to be called when a connection has been set up. */
+ err_t (* connected)(void *arg, struct tcp_pcb *pcb, err_t err);
+
+ /* Function which is called periodically. */
+ err_t (* poll)(void *arg, struct tcp_pcb *pcb);
+
+ /* Function to be called whenever a fatal error occurs. */
+ void (* errf)(void *arg, err_t err);
+
+ uInt8 polltmr, pollinterval;
+
+ /* These are ordered by sequence number: */
+ struct tcp_seg *unsent; /* Unsent (queued) segments. */
+ struct tcp_seg *unacked; /* Sent but unacknowledged segments. */
+#if TCP_QUEUE_OOSEQ
+ struct tcp_seg *ooseq; /* Received out of sequence segments. */
+#endif /* TCP_QUEUE_OOSEQ */
+
+};
+
+struct tcp_pcb_listen {
+ struct tcp_pcb_listen *next; /* for the linked list */
+
+ enum tcp_state state; /* TCP state */
+
+ void *callback_arg;
+
+ /* Function to call when a listener has been connected. */
+ void (* accept)(void *arg, struct tcp_pcb *newpcb);
+
+ struct ip_addr local_ip;
+ uInt16 local_port;
+};
+
+/* This structure is used to repressent TCP segments. */
+struct tcp_seg {
+ struct tcp_seg *next; /* used when putting segements on a queue */
+ struct pbuf *p; /* buffer containing data + TCP header */
+ void *dataptr; /* pointer to the TCP data in the pbuf */
+ uInt16 len; /* the TCP length of this segment */
+ struct tcp_hdr *tcphdr; /* the TCP header */
+};
+
+/* Internal functions and global variables: */
+struct tcp_pcb *tcp_pcb_copy(struct tcp_pcb *pcb);
+void tcp_pcb_purge(struct tcp_pcb *pcb);
+void tcp_pcb_remove(struct tcp_pcb **pcblist, struct tcp_pcb *pcb);
+
+uInt8 tcp_segs_free(struct tcp_seg *seg);
+uInt8 tcp_seg_free(struct tcp_seg *seg);
+struct tcp_seg *tcp_seg_copy(struct tcp_seg *seg);
+
+#define tcp_ack(pcb) if((pcb)->flags & TF_ACK_DELAY) { \
+ (pcb)->flags |= TF_ACK_NOW; \
+ tcp_output(pcb); \
+ } else { \
+ (pcb)->flags |= TF_ACK_DELAY; \
+ }
+
+#define tcp_ack_now(pcb) (pcb)->flags |= TF_ACK_NOW; \
+ tcp_output(pcb)
+
+err_t tcp_send_ctrl(struct tcp_pcb *pcb, uInt8 flags);
+err_t tcp_enqueue(struct tcp_pcb *pcb, void *dataptr, uInt16 len,
+ uInt8 flags, uInt8 copy,
+ uInt8 *optdata, uInt8 optlen);
+
+void tcp_rexmit_seg(struct tcp_pcb *pcb, struct tcp_seg *seg);
+
+void tcp_rst(uInt32 seqno, uInt32 ackno,
+ struct ip_addr *local_ip, struct ip_addr *remote_ip,
+ uInt16 local_port, uInt16 remote_port);
+
+uInt32 tcp_next_iss(void);
+
+extern uInt32 tcp_ticks;
+
+#if TCP_DEBUG || TCP_INPUT_DEBUG || TCP_OUTPUT_DEBUG
+void tcp_debug_print(struct tcp_hdr *tcphdr);
+void tcp_debug_print_flags(uInt8 flags);
+void tcp_debug_print_state(enum tcp_state s);
+void tcp_debug_print_pcbs(void);
+int tcp_pcbs_sane(void);
+#else
+#define tcp_pcbs_sane() 1
+#endif /* TCP_DEBUG */
+
+
+/* The TCP PCB lists. */
+extern struct tcp_pcb_listen *tcp_listen_pcbs; /* List of all TCP PCBs in LISTEN state. */
+extern struct tcp_pcb *tcp_active_pcbs; /* List of all TCP PCBs that are in a
+ state in which they accept or send
+ data. */
+extern struct tcp_pcb *tcp_tw_pcbs; /* List of all TCP PCBs in TIME-WAIT. */
+
+extern struct tcp_pcb *tcp_tmp_pcb; /* Only used for temporary storage. */
+
+/* Axoims about the above lists:
+ 1) Every TCP PCB that is not CLOSED is in one of the lists.
+ 2) A PCB is only in one of the lists.
+ 3) All PCBs in the tcp_listen_pcbs list is in LISTEN state.
+ 4) All PCBs in the tcp_tw_pcbs list is in TIME-WAIT state.
+*/
+
+/* Define two macros, TCP_REG and TCP_RMV that registers a TCP PCB
+ with a PCB list or removes a PCB from a list, respectively. */
+#ifdef LWIP_DEBUG
+#define TCP_REG(pcbs, npcb) do {\
+ DEBUGF(TCP_DEBUG, ("TCP_REG %p local port %d\n", npcb, npcb->local_port)); \
+ for(tcp_tmp_pcb = *pcbs; \
+ tcp_tmp_pcb != NULL; \
+ tcp_tmp_pcb = tcp_tmp_pcb->next) { \
+ ASSERT("TCP_REG: already registered\n", tcp_tmp_pcb != npcb); \
+ } \
+ ASSERT("TCP_REG: pcb->state != CLOSED", npcb->state != CLOSED); \
+ npcb->next = *pcbs; \
+ ASSERT("TCP_REG: npcb->next != npcb", npcb->next != npcb); \
+ *pcbs = npcb; \
+ ASSERT("TCP_RMV: tcp_pcbs sane", tcp_pcbs_sane()); \
+ } while(0)
+#define TCP_RMV(pcbs, npcb) do { \
+ ASSERT("TCP_RMV: pcbs != NULL", *pcbs != NULL); \
+ DEBUGF(TCP_DEBUG, ("TCP_RMV: removing %p from %p\n", npcb, *pcbs)); \
+ if(*pcbs == npcb) { \
+ *pcbs = (*pcbs)->next; \
+ } else for(tcp_tmp_pcb = *pcbs; tcp_tmp_pcb != NULL; tcp_tmp_pcb = tcp_tmp_pcb->next) { \
+ if(tcp_tmp_pcb->next != NULL && tcp_tmp_pcb->next == npcb) { \
+ tcp_tmp_pcb->next = npcb->next; \
+ break; \
+ } \
+ } \
+ npcb->next = NULL; \
+ ASSERT("TCP_RMV: tcp_pcbs sane", tcp_pcbs_sane()); \
+ DEBUGF(TCP_DEBUG, ("TCP_RMV: removed %p from %p\n", npcb, *pcbs)); \
+ } while(0)
+
+#else /* LWIP_DEBUG */
+#define TCP_REG(pcbs, npcb) do { \
+ npcb->next = *pcbs; \
+ *pcbs = npcb; \
+ } while(0)
+#define TCP_RMV(pcbs, npcb) do { \
+ if(*pcbs == npcb) { \
+ *pcbs = (*pcbs)->next; \
+ } else for(tcp_tmp_pcb = *pcbs; tcp_tmp_pcb != NULL; tcp_tmp_pcb = tcp_tmp_pcb->next) { \
+ if(tcp_tmp_pcb->next != NULL && tcp_tmp_pcb->next == npcb) { \
+ tcp_tmp_pcb->next = npcb->next; \
+ break; \
+ } \
+ } \
+ npcb->next = NULL; \
+ } while(0)
+#endif /* LWIP_DEBUG */
+#endif /* __LWIP_TCP_H__ */
+
+
+
diff --git a/include/net/tcpip.h b/include/net/tcpip.h
new file mode 100644
index 0000000..1b74d57
--- /dev/null
+++ b/include/net/tcpip.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __LWIP_TCPIP_H__
+#define __LWIP_TCPIP_H__
+
+#include "net/api_msg.h"
+#include "net/pbuf.h"
+
+void tcpip_init(void (* tcpip_init_done)(void *), void *arg);
+void tcpip_apimsg(struct api_msg *apimsg);
+err_t tcpip_input(struct pbuf *p, struct netif *inp);
+
+enum tcpip_msg_type {
+ TCPIP_MSG_API,
+ TCPIP_MSG_INPUT
+};
+
+struct tcpip_msg {
+ enum tcpip_msg_type type;
+ sys_sem_t *sem;
+ union {
+ struct api_msg *apimsg;
+ struct {
+ struct pbuf *p;
+ struct netif *netif;
+ } inp;
+ } msg;
+};
+
+
+#endif /* __LWIP_TCPIP_H__ */
diff --git a/include/net/udp.h b/include/net/udp.h
new file mode 100644
index 0000000..c4c8693
--- /dev/null
+++ b/include/net/udp.h
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __LWIP_UDP_H__
+#define __LWIP_UDP_H__
+
+#include "net/arch.h"
+
+#include "net/pbuf.h"
+//UBU
+#include "net/ipv4/inet.h"
+//UBU
+#include "net/ipv4/ip.h"
+
+#include "net/err.h"
+
+#define UDP_HLEN 8
+
+struct udp_hdr {
+ PACK_STRUCT_FIELD(uInt16 src);
+ PACK_STRUCT_FIELD(uInt16 dest); /* src/dest UDP ports */
+ PACK_STRUCT_FIELD(uInt16 len);
+ PACK_STRUCT_FIELD(uInt16 chksum);
+} PACK_STRUCT_STRUCT;
+
+#define UDP_FLAGS_NOCHKSUM 0x01
+#define UDP_FLAGS_UDPLITE 0x02
+
+struct udp_pcb {
+ struct udp_pcb *next;
+
+ struct ip_addr local_ip, remote_ip;
+ uInt16 local_port, remote_port;
+
+ uInt8 flags;
+ uInt16 chksum_len;
+
+ void (* recv)(void *arg, struct udp_pcb *pcb, struct pbuf *p,
+ struct ip_addr *addr, uInt16 port);
+ void *recv_arg;
+};
+
+/* The following functions is the application layer interface to the
+ UDP code. */
+struct udp_pcb * udp_new (void);
+void udp_remove (struct udp_pcb *pcb);
+err_t udp_bind (struct udp_pcb *pcb, struct ip_addr *ipaddr,
+ uInt16 port);
+err_t udp_connect (struct udp_pcb *pcb, struct ip_addr *ipaddr,
+ uInt16 port);
+void udp_recv (struct udp_pcb *pcb,
+ void (* recv)(void *arg, struct udp_pcb *upcb,
+ struct pbuf *p,
+ struct ip_addr *addr,
+ uInt16 port),
+ void *recv_arg);
+err_t udp_send (struct udp_pcb *pcb, struct pbuf *p);
+
+#define udp_flags(pcb) ((pcb)->flags)
+#define udp_setflags(pcb, f) ((pcb)->flags = (f))
+
+
+/* The following functions is the lower layer interface to UDP. */
+uInt8 udp_lookup (struct ip_hdr *iphdr, struct netif *inp);
+void udp_input (struct pbuf *p, struct netif *inp);
+void udp_init (void);
+
+
+#endif /* __LWIP_UDP_H__ */
+
+
diff --git a/include/netif/arp.h b/include/netif/arp.h
new file mode 100644
index 0000000..d799678
--- /dev/null
+++ b/include/netif/arp.h
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the Swedish Institute
+ * of Computer Science and its contributors.
+ * 4. 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 file is part of the lwIP TCP/IP stack.
+ *
+ * Author: Adam Dunkels
+ *
+ * $Id$
+ *
+ */
+
+#ifndef __NETIF_ARP_H__
+#define __NETIF_ARP_H__
+
+#include "net/pbuf.h"
+#include "net/ipv4/ip_addr.h"
+#include "net/netif.h"
+
+struct eth_addr {
+ PACK_STRUCT_FIELD(uInt8 addr[6]);
+} PACK_STRUCT_STRUCT;
+
+struct eth_hdr {
+ PACK_STRUCT_FIELD(struct eth_addr dest);
+ PACK_STRUCT_FIELD(struct eth_addr src);
+ PACK_STRUCT_FIELD(uInt16 type);
+} PACK_STRUCT_STRUCT;
+
+#define ARP_TMR_INTERVAL 10000
+
+#define ETHTYPE_ARP 0x0806
+#define ETHTYPE_IP 0x0800
+
+/* Initializes ARP. */
+void arp_init(void);
+
+/* The arp_tmr() function should be called every ARP_TMR_INTERVAL
+ microseconds (10 seconds). This function is responsible for
+ expiring old entries in the ARP table. */
+void arp_tmr(void);
+
+/* Should be called for all incoming packets of IP kind. The function
+ does not alter the packet in any way, it just updates the ARP
+ table. After this function has been called, the normal TCP/IP stack
+ input function should be called. */
+void arp_ip_input(struct netif *netif, struct pbuf *p);
+
+/* Should be called for incoming ARP packets. The pbuf in the argument
+ is freed by this function. If the function returns a pbuf (i.e.,
+ returns non-NULL), that pbuf constitutes an ARP reply and should be
+ sent out on the Ethernet. */
+struct pbuf *arp_arp_input(struct netif *netif, struct eth_addr *ethaddr,
+ struct pbuf *p);
+
+/* arp_loopup() is called to do an IP address -> Ethernet address
+ translation. If the function returns NULL, there is no mapping and
+ the arp_query() function should be called. */
+struct eth_addr *arp_lookup(struct ip_addr *ipaddr);
+
+/* Constructs an ARP query packet for the given IP address. The
+ function returns a pbuf that contains the reply and that should be
+ sent out on the Ethernet. */
+struct pbuf *arp_query(struct netif *netif, struct eth_addr *ethaddr,
+ struct ip_addr *ipaddr);
+
+#endif /* __NETIF_ARP_H__ */
diff --git a/include/netif/ethernetif.h b/include/netif/ethernetif.h
new file mode 100644
index 0000000..5ea4e5d
--- /dev/null
+++ b/include/netif/ethernetif.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __NETIF_ETHERNETIF_H__
+#define __NETIF_ETHERNETIF_H__
+
+#include "net/netif.h"
+
+void ethernetif_init(struct netif *netif);
+
+#endif /* __NETIF_ETHERNETIF_H__ */
diff --git a/include/netif/loopif.h b/include/netif/loopif.h
new file mode 100644
index 0000000..fbbf744
--- /dev/null
+++ b/include/netif/loopif.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __NETIF_LOOPIF_H__
+#define __NETIF_LOOPIF_H__
+
+#include "net/netif.h"
+
+void loopif_init(struct netif *netif);
+
+#endif /* __NETIF_LOOPIF_H__ */
diff --git a/include/netif/tcpdump.h b/include/netif/tcpdump.h
new file mode 100644
index 0000000..d2d6afc
--- /dev/null
+++ b/include/netif/tcpdump.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2001, Swedish Institute of Computer Science.
+ * 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.
+ *
+ * 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
+ *
+ * $Id$
+ */
+#ifndef __NETIF_TCPDUMP_H__
+#define __NETIF_TCPDUMP_H__
+
+#include "net/pbuf.h"
+
+void tcpdump_init(void);
+void tcpdump(struct pbuf *p);
+
+#endif /* __NETIF_TCPDUMP_H__ */
diff --git a/include/objgfx/ogDisplay_VESA.h b/include/objgfx/ogDisplay_VESA.h
new file mode 100644
index 0000000..8c05fc1
--- /dev/null
+++ b/include/objgfx/ogDisplay_VESA.h
@@ -0,0 +1,95 @@
+#ifndef OGDISPLAY_VESA_H
+#define OGDISPLAY_VESA_H
+
+#include "objgfx30.h"
+
+struct TMode_Rec {
+ uInt16 ModeAttributes __attribute__((packed));
+ uInt8 WindowAFlags __attribute__((packed));
+ uInt8 WindowBFlags __attribute__((packed));
+ uInt16 Granularity __attribute__((packed));
+ uInt16 WindowSize __attribute__((packed));
+ uInt16 WindowASeg __attribute__((packed));
+ uInt16 WindowBSeg __attribute__((packed));
+ void* BankSwitch __attribute__((packed));
+ uInt16 BytesPerLine __attribute__((packed));
+ uInt16 xRes __attribute__((packed));
+ uInt16 yRes __attribute__((packed));
+ uInt8 CharWidth __attribute__((packed));
+ uInt8 CharHeight __attribute__((packed));
+ uInt8 NumBitPlanes __attribute__((packed));
+ uInt8 BitsPerPixel __attribute__((packed));
+ uInt8 NumberOfBanks __attribute__((packed));
+ uInt8 MemoryModel __attribute__((packed));
+ uInt8 BankSize __attribute__((packed));
+ uInt8 NumOfImagePages __attribute__((packed));
+ uInt8 Reserved __attribute__((packed));
+ // Direct colour fields (required for Direct/6 and YUV/7 memory models
+ uInt8 RedMaskSize __attribute__((packed));
+ uInt8 RedFieldPosition __attribute__((packed));
+ uInt8 GreenMaskSize __attribute__((packed));
+ uInt8 GreenFieldPosition __attribute__((packed));
+ uInt8 BlueMaskSize __attribute__((packed));
+ uInt8 BlueFieldPosition __attribute__((packed));
+ uInt8 AlphaMaskSize __attribute__((packed));
+ uInt8 AlphaFieldPosition __attribute__((packed));
+ uInt8 DirectColourMode __attribute__((packed));
+ // VESA 2.0 specific fields
+ uInt32 physBasePtr __attribute__((packed));
+ void* OffScreenMemOffset __attribute__((packed));
+ uInt16 OffScreenMemSize __attribute__((packed));
+ uInt8 paddington[461] __attribute__((packed));
+};
+
+struct TVESA_Rec {
+ char VBESignature[4] __attribute__((packed));
+ uInt8 minVersion __attribute__((packed));
+ uInt8 majVersion __attribute__((packed));
+ uInt32 OEMStringPtr __attribute__((packed));
+ uInt32 Capabilities __attribute__((packed));
+ uInt32 VideoModePtr __attribute__((packed));
+ uInt16 TotalMemory __attribute__((packed));
+ // VESA 2.0 specific fields
+ uInt16 OEMSoftwareRev __attribute__((packed));
+ uInt32 OEMVendorNamePtr __attribute__((packed));
+ uInt32 OEMProductNamePtr __attribute__((packed));
+ uInt32 OEMProductRevPtr __attribute__((packed));
+ uInt8 paddington[474] __attribute__((packed));
+};
+
+class ogDisplay_VESA : public ogSurface {
+ protected:
+ uInt16 ScreenSelector;
+ TVESA_Rec* VESARec;
+ TMode_Rec* ModeRec;
+ bool InGraphics;
+ uInt16 findMode(uInt32, uInt32, uInt32);
+ void getModeInfo(uInt16);
+ void getVESAInfo(void);
+ void setMode(uInt16);
+ virtual uInt32 rawGetPixel(uInt32, uInt32);
+ virtual void rawSetPixel(uInt32, uInt32, uInt32);
+ virtual void rawLine(uInt32, uInt32, uInt32, uInt32, uInt32);
+ void setPal(void);
+ public:
+ ogDisplay_VESA(void);
+ virtual bool ogAvail(void);
+ virtual bool ogAlias(ogSurface&, uInt32, uInt32, uInt32, uInt32);
+ virtual void ogClear(uInt32);
+ virtual bool ogClone(ogSurface&);
+ virtual void ogCopyLineTo(uInt32, uInt32, const void *, uInt32);
+ virtual void ogCopyLineFrom(uInt32, uInt32, void *, uInt32);
+ virtual void ogCopyPal(ogSurface&);
+ virtual bool ogCreate(uInt32, uInt32, ogPixelFmt);
+ virtual uInt32 ogGetPixel(int32, int32);
+ virtual void * ogGetPtr(uInt32, uInt32);
+ virtual void ogHLine(int32, int32, int32, uInt32);
+ virtual bool ogLoadPal(const char *);
+ virtual void ogSetPixel(int32, int32, uInt32);
+ virtual void ogSetRGBPalette(uInt8, uInt8, uInt8, uInt8);
+ virtual void ogVFlip(void);
+ virtual void ogVLine(int32, int32, int32, uInt32);
+ virtual ~ogDisplay_VESA(void);
+}; // ogDisplay_VESA
+
+#endif
diff --git a/include/pci/hd.h b/include/pci/hd.h
new file mode 100644
index 0000000..7d6e3a8
--- /dev/null
+++ b/include/pci/hd.h
@@ -0,0 +1,225 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _HD_H
+#define _HD_H
+
+#include
+
+#define hdData 0x0
+#define hdError 0x1
+#define hdSecCount 0x2
+#define hdSecNum 0x3
+#define hdCylLow 0x4
+#define hdCylHi 0x5
+#define hdHead 0x6
+#define hdStat 0x7
+#define hdCmd 0x7
+
+
+struct driveInfo {
+ struct driveDiskLabel *diskLabel;
+ char hdSector[512];
+ char hdEnable;
+ char hdDev;
+ char hdFlags;
+ char hdShift;
+ long hdMask;
+ long hdMulti;
+ long hdPort;
+ long hdSize;
+ long hdCalc;
+ long parOffset;
+ };
+
+int initHardDisk();
+void hdWrite(struct driveInfo *hdd,void *,uInt32,uInt32);
+void hdRead(struct driveInfo *hdd,void *,uInt32,uInt32);
+int hdReset();
+int hdIoctl();
+int hdStart();
+int hdStop();
+int hdStandby();
+int hdInit(struct device_node *dev);
+
+struct dos_partition {
+ unsigned char dp_flag; /* bootstrap flags */
+ unsigned char dp_shd; /* starting head */
+ unsigned char dp_ssect; /* starting sector */
+ unsigned char dp_scyl; /* starting cylinder */
+ unsigned char dp_type; /* partition type */
+ unsigned char dp_ehd; /* end head */
+ unsigned char dp_esect; /* end sector */
+ unsigned char dp_ecyl; /* end cylinder */
+ uInt32 dp_start; /* absolute starting sector number */
+ uInt32 dp_size; /* partition size in sectors */
+ };
+
+#define MAXPARTITIONS 8
+
+struct bsd_disklabel {
+ u_int32_t d_magic; /* the magic number */
+ u_int16_t d_type; /* drive type */
+ u_int16_t d_subtype; /* controller/d_type specific */
+ char d_typename[16]; /* type name, e.g. "eagle" */
+
+ char d_packname[16]; /* pack identifier */
+
+ /* disk geometry: */
+ u_int32_t d_secsize; /* # of bytes per sector */
+ u_int32_t d_nsectors; /* # of data sectors per track */
+ u_int32_t d_ntracks; /* # of tracks per cylinder */
+ u_int32_t d_ncylinders; /* # of data cylinders per unit */
+ u_int32_t d_secpercyl; /* # of data sectors per cylinder */
+ u_int32_t d_secperunit; /* # of data sectors per unit */
+
+ /*
+ * Spares (bad sector replacements) below are not counted in
+ * d_nsectors or d_secpercyl. Spare sectors are assumed to
+ * be physical sectors which occupy space at the end of each
+ * track and/or cylinder.
+ */
+ u_int16_t d_sparespertrack; /* # of spare sectors per track */
+ u_int16_t d_sparespercyl; /* # of spare sectors per cylinder */
+ /*
+ * Alternate cylinders include maintenance, replacement, configuration
+ * description areas, etc.
+ */
+ u_int32_t d_acylinders; /* # of alt. cylinders per unit */
+
+ /* hardware characteristics: */
+ /*
+ * d_interleave, d_trackskew and d_cylskew describe perturbations
+ * in the media format used to compensate for a slow controller.
+ * Interleave is physical sector interleave, set up by the
+ * formatter or controller when formatting. When interleaving is
+ * in use, logically adjacent sectors are not physically
+ * contiguous, but instead are separated by some number of
+ * sectors. It is specified as the ratio of physical sectors
+ * traversed per logical sector. Thus an interleave of 1:1
+ * implies contiguous layout, while 2:1 implies that logical
+ * sector 0 is separated by one sector from logical sector 1.
+ * d_trackskew is the offset of sector 0 on track N relative to
+ * sector 0 on track N-1 on the same cylinder. Finally, d_cylskew
+ * is the offset of sector 0 on cylinder N relative to sector 0
+ * on cylinder N-1.
+ */
+ u_int16_t d_rpm; /* rotational speed */
+ u_int16_t d_interleave; /* hardware sector interleave */
+ u_int16_t d_trackskew; /* sector 0 skew, per track */
+ u_int16_t d_cylskew; /* sector 0 skew, per cylinder */
+ u_int32_t d_headswitch; /* head switch time, usec */
+ u_int32_t d_trkseek; /* track-to-track seek, usec */
+ u_int32_t d_flags; /* generic flags */
+#define NDDATA 5
+ u_int32_t d_drivedata[NDDATA]; /* drive-type specific information */
+#define NSPARE 5
+ u_int32_t d_spare[NSPARE]; /* reserved for future use */
+ u_int32_t d_magic2; /* the magic number (again) */
+ u_int16_t d_checksum; /* xor of data incl. partitions */
+
+ /* filesystem and partition information: */
+ u_int16_t d_npartitions; /* number of partitions in following */
+ u_int32_t d_bbsize; /* size of boot area at sn0, bytes */
+ u_int32_t d_sbsize; /* max size of fs superblock, bytes */
+ struct partition { /* the partition table */
+ u_int32_t p_size; /* number of sectors in partition */
+ u_int32_t p_offset; /* starting sector */
+ u_int32_t p_fsize; /* filesystem basic fragment size */
+ u_int8_t p_fstype; /* filesystem type, see below */
+ u_int8_t p_frag; /* filesystem fragments per block */
+ u_int16_t p_cpg; /* filesystem cylinders per group */
+ } d_partitions[MAXPARTITIONS]; /* actually may be more */
+};
+
+static const char *fstypenames[] = {
+ "unused",
+ "swap",
+ "Version 6",
+ "Version 7",
+ "System V",
+ "4.1BSD",
+ "Eighth Edition",
+ "4.2BSD",
+ "MSDOS",
+ "4.4LFS",
+ "unknown",
+ "HPFS",
+ "ISO9660",
+ "boot",
+ "vinum",
+ "raid",
+ "?",
+ "?",
+ "?",
+ "?",
+ "jfs",
+ NULL
+};
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:53 reddawg
+ UbixOS
+
+ Revision 1.2 2006/10/09 02:58:05 reddawg
+ Fixing UFS
+
+ Revision 1.1.1.1 2006/06/01 12:46:14 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:37 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:50 reddawg
+ no message
+
+ Revision 1.7 2004/08/15 00:33:02 reddawg
+ Wow the ide driver works again
+
+ Revision 1.6 2004/07/21 10:02:09 reddawg
+ devfs: renamed functions
+ device system: renamed functions
+ fdc: fixed a few potential bugs and cleaned up some unused variables
+ strol: fixed definition
+ endtask: made it print out freepage debug info
+ kmalloc: fixed a huge memory leak we had some unhandled descriptor insertion so some descriptors were lost
+ ld: fixed a pointer conversion
+ file: cleaned up a few unused variables
+ sched: broke task deletion
+ kprintf: fixed ogPrintf definition
+
+ Revision 1.5 2004/05/21 15:05:07 reddawg
+ Cleaned up
+
+
+ END
+ ***/
diff --git a/include/pci/lnc.h b/include/pci/lnc.h
new file mode 100644
index 0000000..adba770
--- /dev/null
+++ b/include/pci/lnc.h
@@ -0,0 +1,206 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _LNC_H
+#define _LNC_H
+
+#include
+
+#define NDESC(len2) (1 << len2)
+#define NORMAL 0
+#define MEM_SLEW 8
+#define TRANSBUFSIZE 1518
+#define RECVBUFSIZE 1518
+#define NRDRE 3
+#define NTDRE 3
+#define ETHER_ADDR_LEN 6
+#define NE2100_IOSIZE 24
+#define PCNET_RDP 0x10 /* Register Data Port */
+#define PCNET_RAP 0x12 /* Register Address Port */
+#define PCNET_RESET 0x14
+#define PCNET_BDP 0x16
+#define PCNET_VSW 0x18
+#define NE2100 2
+
+/* mem_mode values */
+#define DMA_FIXED 1
+#define DMA_MBUF 2
+#define SHMEM 4
+
+
+/********** Chip Types **********/
+#define UNKNOWN 0 /* Unknown */
+#define LANCE 1 /* Am7990 */
+#define C_LANCE 2 /* Am79C90 */
+#define PCnet_ISA 3 /* Am79C960 */
+#define PCnet_ISAplus 4 /* Am79C961 */
+#define PCnet_ISA_II 5 /* Am79C961A */
+#define PCnet_32 6 /* Am79C965 */
+#define PCnet_PCI 7 /* Am79C970 */
+#define PCnet_PCI_II 8 /* Am79C970A */
+#define PCnet_FAST 9 /* Am79C971 */
+#define PCnet_FASTplus 10 /* Am79C972 */
+#define PCnet_Home 11 /* Am79C978 */
+
+/******** AM7990 Specifics **************/
+#define CSR0 0x0000
+#define CSR1 1
+#define CSR2 2
+#define CSR3 3
+#define CSR88 88
+#define CSR89 89
+
+#define ERR 0x8000
+#define BABL 0x4000
+#define CERR 0x2000
+#define MISS 0x1000
+#define MERR 0x0800
+#define RINT 0x0400
+#define TINT 0x0200
+#define IDON 0x0100
+#define INTR 0x0080
+#define INEA 0x0040
+#define RXON 0x0020
+#define TXON 0x0010
+#define TDMD 0x0008
+#define STOP 0x0004
+#define STRT 0x0002
+#define INIT 0x0001
+
+
+/* CSR88-89: Chip ID masks */
+#define AMD_MASK 0x003
+#define PART_MASK 0xffff
+#define Am79C960 0x0003
+#define Am79C961 0x2260
+#define Am79C961A 0x2261
+#define Am79C965 0x2430
+#define Am79C970 0x0242
+#define Am79C970A 0x2621
+#define Am79C971 0x2623
+#define Am79C972 0x2624
+#define Am79C973 0x2625
+#define Am79C978 0x2626
+
+/********** Structs **********/
+
+
+
+
+struct initBlock {
+ uInt16 mode; /* Mode register */
+ uInt8 padr[6]; /* Ethernet address */
+ uInt8 ladrf[8]; /* Logical address filter (multicast) */
+ uInt16 rdra; /* Low order pointer to receive ring */
+ uInt16 rlen; /* High order pointer and no. rings */
+ uInt16 tdra; /* Low order pointer to transmit ring */
+ uInt16 tlen; /* High order pointer and no rings */
+ };
+
+struct mds {
+ uInt16 md0;
+ uInt16 md1;
+ short md2;
+ uInt16 md3;
+ };
+
+struct hostRingEntry {
+ struct mds *md;
+ union {
+ //struct mbuf *mbuf;
+ char *data;
+ }buff;
+ };
+
+struct arpcom {
+ //struct ifnet ac_if; /* network-visible interface */
+ uInt8 ac_enaddr[6]; /* ethernet hardware address */
+ int ac_multicnt; /* length of ac_multiaddrs list */
+ void *ac_netgraph; /* ng_ether(4) netgraph node info */
+ };
+
+struct nicInfo {
+ int ident; /* Type of card */
+ int ic; /* Type of ic, Am7990, Am79C960 etc. */
+ int memMode;
+ int iobase;
+ int mode; /* Mode setting at initialization */
+ };
+
+struct lncInfo {
+ struct arpcom arpcom;
+ struct nicInfo nic;
+ struct hostRingEntry *recvRing;
+ struct hostRingEntry *transRings;
+ struct initBlock *initBloack;
+ int rap;
+ int rdp;
+ int bdp;
+ int nrdre;
+ int ntdre;
+ };
+
+extern struct lncInfo *lnc;
+
+void writeCsr(struct lncInfo *lnc, uInt16 port, uInt16 val);
+uInt16 readCsr(struct lncInfo *lnc, uInt16 port);
+void writeBcr(struct lncInfo *lnc, uInt16 port, uInt16 val);
+uInt16 readBcr(struct lncInfo *lnc, uInt16 port);
+
+void initLNC();
+int probe(struct lncInfo *lnc);
+int lanceProbe(struct lncInfo *lnc);
+int lncAttach(struct lncInfo *lnc,int unit);
+
+
+void lncInt();
+void _lncInt();
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:53 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:14 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:37 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:50 reddawg
+ no message
+
+ Revision 1.2 2004/05/21 15:05:07 reddawg
+ Cleaned up
+
+
+ END
+ ***/
diff --git a/include/pci/pci.h b/include/pci/pci.h
new file mode 100644
index 0000000..df25540
--- /dev/null
+++ b/include/pci/pci.h
@@ -0,0 +1,110 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _PCI_H
+#define _PCI_H
+
+#include
+
+
+struct pciConfig {
+ uInt16 vendorId;
+ uInt16 deviceId;
+
+ uInt16 command;
+ uInt16 status;
+
+ uInt8 revisionId;
+ uInt8 interface;
+ uInt8 subClass;
+ uInt8 baseClass;
+
+ uInt8 cacheLineSize;
+ uInt8 latencyTimer;
+ uInt8 headerType;
+ uInt8 bist;
+
+ /* device info */
+ uInt8 bus;
+ uInt8 dev;
+ uInt8 func;
+ uInt8 irq;
+
+ /* base registers */
+ uInt32 base[6];
+ uInt32 size[6];
+
+ uInt16 subsysVendor;
+ uInt16 subsys;
+
+ };
+
+struct confadd {
+ uInt8 reg:8;
+ uInt8 func:3;
+ uInt8 dev:5;
+ uInt8 bus:8;
+ uInt8 rsvd:7;
+ uInt8 enable:1;
+ };
+
+#define countof(a) (sizeof(a) / sizeof(a[0]))
+
+int pci_init();
+
+
+bool pciProbe(int bus,int dev,int func,struct pciConfig *cfg);
+uInt32 pciRead(int bus, int dev, int func, int reg, int bytes);
+void pciWrite(int bus,int dev,int func,int reg,uInt32 v,int bytes);
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:53 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:14 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:37 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:51 reddawg
+ no message
+
+ Revision 1.3 2004/08/20 16:49:11 reddawg
+ PCI Updates - More to follow as PCI system gets revamped
+
+ Revision 1.2 2004/05/21 15:05:07 reddawg
+ Cleaned up
+
+
+ END
+ ***/
diff --git a/include/sde/ogDisplay_UbixOS.h b/include/sde/ogDisplay_UbixOS.h
new file mode 100644
index 0000000..fa8022a
--- /dev/null
+++ b/include/sde/ogDisplay_UbixOS.h
@@ -0,0 +1,87 @@
+#ifndef OGDISPLAY_UBIXOS_H
+#define OGDISPLAY_UBIXOS_H
+
+#include
+
+struct ogModeInfo {
+ uInt16 modeAttributes __attribute__((packed));
+ uInt8 windowAFlags __attribute__((packed));
+ uInt8 windowBFlags __attribute__((packed));
+ uInt16 granularity __attribute__((packed));
+ uInt16 windowSize __attribute__((packed));
+ uInt16 windowASeg __attribute__((packed));
+ uInt16 windowBSeg __attribute__((packed));
+ void* bankSwitch __attribute__((packed));
+ uInt16 bytesPerLine __attribute__((packed));
+ uInt16 xRes __attribute__((packed));
+ uInt16 yRes __attribute__((packed));
+ uInt8 charWidth __attribute__((packed));
+ uInt8 charHeight __attribute__((packed));
+ uInt8 numBitPlanes __attribute__((packed));
+ uInt8 bitsPerPixel __attribute__((packed));
+ uInt8 numberOfBanks __attribute__((packed));
+ uInt8 memoryModel __attribute__((packed));
+ uInt8 bankSize __attribute__((packed));
+ uInt8 numOfImagePages __attribute__((packed));
+ uInt8 reserved __attribute__((packed));
+ // Direct colour fields (required for Direct/6 and YUV/7 memory models
+ uInt8 redMaskSize __attribute__((packed));
+ uInt8 redFieldPosition __attribute__((packed));
+ uInt8 greenMaskSize __attribute__((packed));
+ uInt8 greenFieldPosition __attribute__((packed));
+ uInt8 blueMaskSize __attribute__((packed));
+ uInt8 blueFieldPosition __attribute__((packed));
+ uInt8 alphaMaskSize __attribute__((packed));
+ uInt8 alphaFieldPosition __attribute__((packed));
+ uInt8 directColourMode __attribute__((packed));
+ // VESA 2.0 specific fields
+ uInt32 physBasePtr __attribute__((packed));
+ void* offScreenMemOffset __attribute__((packed));
+ uInt16 offScreenMemSize __attribute__((packed));
+ uInt8 paddington[461] __attribute__((packed));
+};
+
+struct ogVESAInfo {
+ char VBESignature[4] __attribute__((packed));
+ uInt8 minVersion __attribute__((packed));
+ uInt8 majVersion __attribute__((packed));
+ uInt32 OEMStringPtr __attribute__((packed));
+ uInt32 capabilities __attribute__((packed));
+ uInt32 videoModePtr __attribute__((packed));
+ uInt16 totalMemory __attribute__((packed));
+ // VESA 2.0 specific fields
+ uInt16 OEMSoftwareRev __attribute__((packed));
+ uInt32 OEMVendorNamePtr __attribute__((packed));
+ uInt32 OEMProductNamePtr __attribute__((packed));
+ uInt32 OEMProductRevPtr __attribute__((packed));
+ uInt8 paddington[474] __attribute__((packed));
+};
+
+
+class ogDisplay_UbixOS : public ogSurface {
+ protected:
+ void * pages[2];
+ uInt32 activePage;
+ uInt32 visualPage;
+ ogVESAInfo * VESAInfo;
+ ogModeInfo * modeInfo;
+
+ uInt16 FindMode(uInt32, uInt32, uInt32);
+ void GetModeInfo(uInt16);
+ void GetVESAInfo(void);
+ void SetMode(uInt16);
+ void SetPal(void);
+ public:
+ ogDisplay_UbixOS(void);
+ virtual bool ogAlias(ogSurface&, uInt32, uInt32, uInt32, uInt32);
+ virtual bool ogClone(ogSurface&);
+ virtual void ogCopyPalette(ogSurface&);
+ virtual bool ogCreate(uInt32, uInt32, ogPixelFmt);
+ virtual bool ogLoadPalette(const char *);
+ virtual void ogSetPalette(const ogRGBA8[]);
+ virtual void ogSetPalette(uInt8, uInt8, uInt8, uInt8);
+ virtual void ogSetPalette(uInt8, uInt8, uInt8, uInt8, uInt8);
+ virtual ~ogDisplay_UbixOS(void);
+}; // ogDisplay_UbixOS
+
+#endif
diff --git a/include/sde/sde.h b/include/sde/sde.h
new file mode 100644
index 0000000..0b27d5d
--- /dev/null
+++ b/include/sde/sde.h
@@ -0,0 +1,55 @@
+/**************************************************************************************
+ Copyright (c) 2002 The UbixOS Project
+ All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list of conditions, the following disclaimer and the list of authors.
+Redistributions in binary form must reproduce the above copyright notice, this list of conditions, the following disclaimer and the list of authors
+in the documentation and/or other materials provided with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+**************************************************************************************/
+
+#ifndef _SDE_H
+#define _SDE_H
+
+#include
+
+#define registerWindow 1
+#define windowReady 2
+#define drawWindow 3
+#define killWindow 4
+
+#ifdef __cplusplus
+extern "C"
+#endif
+void sdeThread();
+
+#ifdef __cplusplus
+extern "C"
+#endif
+void sysSDE(uInt32 cmd,void *ptr);
+
+struct sdeWindows {
+ struct sdeWindows *next;
+ struct sdeWindows *prev;
+ void *buf;
+ pidType pid;
+ uInt8 status;
+ };
+
+extern struct sdeWindows *windows;
+
+#endif
+
diff --git a/include/stdarg.h b/include/stdarg.h
new file mode 100644
index 0000000..ef3804a
--- /dev/null
+++ b/include/stdarg.h
@@ -0,0 +1,69 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _STDARG_H
+#define _STDARG_H
+
+typedef char *vaList[1];
+
+#define vaStart(ap, parm) ((ap)[0] = (char *) &parm \
+ + ((sizeof(parm) + sizeof(int) - 1) & ~(sizeof(int) - 1)), (void) 0)
+
+#define vaArg(ap, type) ((ap)[0] += \
+ ((sizeof(type) + sizeof(int) - 1) & ~(sizeof(int) - 1)), \
+ (*(type *) ((ap)[0] \
+ - ((sizeof(type) + sizeof(int) - 1) & ~(sizeof(int) - 1)) )))
+
+#define vaEnd(ap) ((ap)[0] = 0, (void) 0)
+
+
+int vsprintf(char *buf, const char *fmt, vaList args);
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:51 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:13 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:36 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:38 reddawg
+ no message
+
+ Revision 1.2 2004/05/21 15:22:35 reddawg
+ Cleaned up
+
+
+ END
+ ***/
diff --git a/include/string.h b/include/string.h
new file mode 100644
index 0000000..2f52ea3
--- /dev/null
+++ b/include/string.h
@@ -0,0 +1,50 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _STRING_H
+#define _STRING_H
+
+#include
+
+char *strcpy(char *dst,const char *src);
+
+void *memcpy(void * dst, const void * src, size_t length);
+void *memset(void * dst, int c, size_t length);
+int strlen(const char * string);
+int strcmp(const char *,const char *);
+
+int sprintf(char * str, const char * format, ...);
+
+long strtol(const char * __restrict nptr, char ** __restrict endptr, int base);
+
+#endif
+
+/***
+ END
+ ***/
diff --git a/include/sys/_types.h b/include/sys/_types.h
new file mode 100644
index 0000000..9d4f3ae
--- /dev/null
+++ b/include/sys/_types.h
@@ -0,0 +1,66 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef __TYPES_H
+#define __TYPES_H
+
+//#include
+
+typedef __signed char __int8_t;
+typedef unsigned char __uint8_t;
+typedef short __int16_t;
+typedef unsigned short __uint16_t;
+typedef int __int32_t;
+typedef unsigned int __uint32_t;
+typedef long long __int64_t;
+typedef unsigned long long __uint64_t;
+
+
+typedef unsigned long __clock_t;
+//typedef long __time_t;
+typedef __uint32_t __ino_t;
+typedef __int32_t __ssize_t;
+
+/* stat types */
+typedef __uint32_t __dev_t; /* device number */
+typedef __uint16_t __mode_t;
+typedef __uint16_t __nlink_t; /* link count */
+typedef __uint32_t __uid_t;
+typedef __uint32_t __gid_t;
+typedef __int32_t __time_t;
+typedef __int64_t __blkcnt_t; /* file block count */
+typedef __uint32_t __blksize_t; /* file block size */
+typedef __uint32_t __fflags_t; /* file flags */
+
+#endif
+
+/***
+ END
+ ***/
+
diff --git a/include/sys/buf.h b/include/sys/buf.h
new file mode 100644
index 0000000..7fa841e
--- /dev/null
+++ b/include/sys/buf.h
@@ -0,0 +1,46 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _BUF_H
+#define _BUF_H
+
+#include
+#include
+#include
+
+struct buf {
+ };
+
+
+#endif
+
+/***
+ END
+ ***/
+
diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h
new file mode 100644
index 0000000..77634c6
--- /dev/null
+++ b/include/sys/cdefs.h
@@ -0,0 +1,59 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _CDEFS_H
+#define _CDRES_H
+
+#include
+
+#define __dead2 __attribute__((__noreturn__))
+
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:53 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:15 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:37 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:51 reddawg
+ no message
+
+ Revision 1.2 2004/05/21 15:12:17 reddawg
+ Cleaned up
+
+
+ END
+ ***/
diff --git a/include/sys/device.h b/include/sys/device.h
new file mode 100644
index 0000000..1c4dc53
--- /dev/null
+++ b/include/sys/device.h
@@ -0,0 +1,117 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _DEVICE_H
+#define _DEVICE_H
+
+#include
+
+struct device_node {
+ struct device_node *prev;
+ struct device_node *next;
+ struct device_interface *devInfo;
+ struct device_resource *devRec;
+ char type;
+ int minor;
+ };
+
+struct device_resource {
+ uInt8 irq;
+ };
+
+struct device_interface {
+ uInt8 initialized;
+ uInt32 size;
+ int major;
+ void *info;
+ void (*read)(void *,void *,uInt32,uInt32);
+ void (*write)(void *,void *,uInt32,uInt32);
+ void (*reset)(void *);
+ int (*init)(void *);
+ void (*ioctl)(void *);
+ void (*stop)(void *);
+ void (*start)(void *);
+ void (*standby)(void *);
+ };
+
+
+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.1.1.1 2007/01/17 03:31:53 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:15 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:37 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:51 reddawg
+ no message
+
+ Revision 1.14 2004/08/15 00:33:02 reddawg
+ Wow the ide driver works again
+
+ Revision 1.13 2004/08/14 21:56:44 reddawg
+ Added initialized byte to the device system to make it easy to add child devices which use parent hardware.
+
+ Revision 1.12 2004/07/21 10:02:09 reddawg
+ devfs: renamed functions
+ device system: renamed functions
+ fdc: fixed a few potential bugs and cleaned up some unused variables
+ strol: fixed definition
+ endtask: made it print out freepage debug info
+ kmalloc: fixed a huge memory leak we had some unhandled descriptor insertion so some descriptors were lost
+ ld: fixed a pointer conversion
+ file: cleaned up a few unused variables
+ sched: broke task deletion
+ kprintf: fixed ogPrintf definition
+
+ 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
+
+
+ Added proto
+
+ Revision 1.9 2004/05/21 15:12:17 reddawg
+ Cleaned up
+
+
+ END
+ ***/
+
diff --git a/include/sys/device.old.h b/include/sys/device.old.h
new file mode 100644
index 0000000..ecd8cb2
--- /dev/null
+++ b/include/sys/device.old.h
@@ -0,0 +1,58 @@
+/**************************************************************************************
+ Copyright (c) 2002 The UbixOS Project
+ All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list of conditions, the following disclaimer and the list of authors.
+Redistributions in binary form must reproduce the above copyright notice, this list of conditions, the following disclaimer and the list of authors
+in the documentation and/or other materials provided with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+**************************************************************************************/
+
+#ifndef _DEVICE_H
+#define _DEVICE_H
+
+#include
+
+struct device {
+ struct net *net;
+ uInt16 ioAddr;
+ uInt32 irq;
+ struct ei_device *priv;
+ uInt32 mtu;
+ };
+
+struct net {
+ char mac[6];
+ char broadcast[6];
+ };
+
+struct ei_device {
+ int txStartPage;
+ int rxStartPage;
+ int stopPage;
+ int currentPage;
+ uInt16 word16;
+ uInt32 pingPong;
+ int tx1;
+ int tx2;
+ };
+
+#endif
+
+/***
+ END
+ ***/
+
diff --git a/include/sys/dma.h b/include/sys/dma.h
new file mode 100644
index 0000000..974e99a
--- /dev/null
+++ b/include/sys/dma.h
@@ -0,0 +1,59 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _DMA_H
+#define _DMA_H
+
+#include
+
+void dmaXfer(uInt8 channel,uInt32 address,uInt length,uInt8 read);
+void _dmaXfer(uInt8 dmaChannel,uInt8 page,uInt offset,uInt length,uInt8 mode);
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:53 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:15 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:37 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:52 reddawg
+ no message
+
+ Revision 1.3 2004/05/21 15:12:17 reddawg
+ Cleaned up
+
+
+ END
+ ***/
diff --git a/include/sys/driver.h b/include/sys/driver.h
new file mode 100644
index 0000000..28995d8
--- /dev/null
+++ b/include/sys/driver.h
@@ -0,0 +1,70 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _DRIVER_H
+#define _DRIVER_H
+
+#include
+
+
+typedef struct devMethodType devMethod;
+
+struct devMethodType {
+ };
+
+struct driverType {
+ const char *devName;
+ devMethod *methods;
+ }
+
+
+
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:53 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:15 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:37 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:52 reddawg
+ no message
+
+ Revision 1.2 2004/05/21 15:12:17 reddawg
+ Cleaned up
+
+
+ END
+ ***/
diff --git a/include/sys/gdt.h b/include/sys/gdt.h
new file mode 100644
index 0000000..6e51312
--- /dev/null
+++ b/include/sys/gdt.h
@@ -0,0 +1,125 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _GDT_H
+#define _GDT_H
+
+/* Descriptor Definitions */
+#define dCall 0x0C00 /* 386 Call Gate */
+#define dCode 0x1800 /* Code Segment */
+#define dData 0x1000 /* Data Segment */
+#define dInt 0x0E00 /* 386 Interrupt Gate */
+#define dLdt 0x200 /* Local Descriptor Table (LDT) */
+#define dTask 0x500 /* Task gate */
+#define dTrap 0x0F00 /* 386 Trap Gate */
+#define dTss 0x900 /* Task State Segment (TSS) */
+
+/* Descriptor Options */
+#define dDpl3 0x6000 /* DPL3 or mask for DPL */
+#define dDpl2 0x4000 /* DPL2 or mask for DPL */
+#define dDpl1 0x2000 /* DPL1 or mask for DPL */
+#define dDpl0 0x0000 /* DPL0 or mask for DPL */
+#define dPresent 0x8000 /* Present */
+#define dNpresent 0x8000 /* Not Present */
+#define dAcc 0x100 /* Accessed (Data or Code) */
+#define dWrite 0x200 /* Writable (Data segments only) */
+#define dRead 0x200 /* Readable (Code segments only) */
+#define dBusy 0xB00 /* Busy (TSS only) was 200 */
+#define dEexdown 0x400 /* Expand down (Data segments only) */
+#define dConform 0x400 /* Conforming (Code segments only) */
+#define dBig 0x40 /* Default to 32 bit mode */
+#define dBiglim 0x80 /* Limit is in 4K units */
+
+/* GDT Descriptor */
+struct gdtDescriptor {
+ unsigned short limitLow; /* Limit 0..15 */
+ unsigned short baseLow; /* Base 0..15 */
+ unsigned char baseMed; /* Base 16..23 */
+ unsigned char access; /* Access Byte */
+ unsigned int limitHigh:4; /* Limit 16..19 */
+ unsigned int granularity:4; /* Granularity */
+ unsigned char baseHigh; /* Base 24..31 */
+ } __attribute__ ((packed));
+
+struct gdtGate {
+ unsigned short offsetLow; /* Offset 0..15 */
+ unsigned short selector; /* Selector */
+ unsigned short access; /* Access Flags */
+ unsigned short offsetHigh; /* Offset 16..31 */
+ } __attribute__ ((packed));
+
+union descriptorTableUnion {
+ struct gdtDescriptor descriptor; /* Normal descriptor */
+ struct gdtGate gate; /* Gate descriptor */
+ unsigned long dummy; /* Any other info */
+ };
+
+
+#define ubixDescriptorTable(name,length) union descriptorTableUnion name[length] =
+#define ubixStandardDescriptor(base, limit, control) {descriptor: \
+ {(limit & 0xffff), \
+ (base & 0xffff), \
+ ((base >> 16) & 0xff), \
+ ((control+dPresent) >> 8), \
+ (limit >> 16), \
+ ((control & 0xff) >> 4), \
+ (base >> 24)}}
+#define ubixGateDescriptor(offset, selector, control) {gate: {(offset & 0xffff), selector, \
+ (control+dPresent), (offset >> 16) }}
+
+extern union descriptorTableUnion ubixGDT[9];
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:53 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:15 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:37 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:52 reddawg
+ no message
+
+ Revision 1.5 2004/08/15 16:47:49 reddawg
+ Fixed
+
+ Revision 1.4 2004/07/22 20:53:07 reddawg
+ atkbd: fixed problem
+
+ Revision 1.3 2004/05/21 15:12:17 reddawg
+ Cleaned up
+
+
+ END
+ ***/
diff --git a/include/sys/gen_calls.h b/include/sys/gen_calls.h
new file mode 100644
index 0000000..c8e827b
--- /dev/null
+++ b/include/sys/gen_calls.h
@@ -0,0 +1,50 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _GEN_CALLS_H
+#define _GEN_CALLS_H
+
+#include
+#include
+
+int read(struct thread *td,struct read_args *uap);
+
+int getpid(struct thread *, struct getpid_args *);
+int issetugid(register struct thread *, struct issetugid_args *);
+int readlink(struct thread *,struct readlink_args *);
+int getuid(struct thread *, struct getuid_args *);
+int getgid(struct thread *, struct getgid_args *);
+int gettimeofday_new(struct thread *, struct gettimeofday_args *);
+
+#endif
+
+/***
+ END
+ ***/
+
diff --git a/include/sys/idt.h b/include/sys/idt.h
new file mode 100644
index 0000000..11906b1
--- /dev/null
+++ b/include/sys/idt.h
@@ -0,0 +1,90 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _IDT_H
+#define _IDT_H
+
+#include
+#include
+
+#define EFLAG_TF 0x100
+#define EFLAG_IF 0x200
+#define EFLAG_IOPL3 0x3000
+#define EFLAG_VM 0x20000
+
+int idt_init();
+void setVector(void *handler, unsigned char interrupt, unsigned short controlMajor);
+void setTaskVector(uInt8 interrupt,uInt16 controlMajor,uInt8 selector);
+void intNull();
+
+void _int0();
+void _int1();
+void _int2();
+void _int3();
+void _int4();
+void _int5();
+void _int6();
+void _int7();
+void _int8();
+void _int9();
+void _int10();
+void _int11();
+void _int12();
+void _int13();
+void timerInt();
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:53 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:15 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:37 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:52 reddawg
+ no message
+
+ Revision 1.5 2004/09/07 21:54:38 reddawg
+ ok reverted back to old scheduling for now....
+
+ Revision 1.3 2004/07/09 13:16:41 reddawg
+ idt: idtInit to idt_init
+ Adjusted Startup Routines
+
+ Revision 1.2 2004/05/21 15:12:17 reddawg
+ Cleaned up
+
+
+ END
+ ***/
diff --git a/include/sys/io.h b/include/sys/io.h
new file mode 100644
index 0000000..c475707
--- /dev/null
+++ b/include/sys/io.h
@@ -0,0 +1,65 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _IO_H
+#define _IO_H
+
+unsigned char inportByte(unsigned int);
+unsigned short inportWord(unsigned int);
+unsigned long inportDWord(unsigned int);
+void outportByte(unsigned int,unsigned char);
+void outportByteP(unsigned int port,unsigned char value);
+void outportWord(unsigned int,unsigned short);
+void outportDWord(unsigned int port,unsigned long value);
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:53 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:15 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:37 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:52 reddawg
+ no message
+
+ Revision 1.3 2004/07/22 20:14:34 reddawg
+ still working here
+
+ Revision 1.2 2004/05/21 15:12:17 reddawg
+ Cleaned up
+
+
+ END
+ ***/
diff --git a/include/sys/kern_descrip.h b/include/sys/kern_descrip.h
new file mode 100644
index 0000000..4c9e92a
--- /dev/null
+++ b/include/sys/kern_descrip.h
@@ -0,0 +1,174 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _KERN_DESCRIP_H
+#define _KERN_DESCRIP_H
+
+#include
+#include
+
+#include
+
+typedef __mode_t mode_t;
+typedef __nlink_t nlink_t;
+
+/* command values */
+#define F_DUPFD 0 /* duplicate file descriptor */
+#define F_GETFD 1 /* get file descriptor flags */
+#define F_SETFD 2 /* set file descriptor flags */
+#define F_GETFL 3 /* get file status flags */
+#define F_SETFL 4 /* set file status flags */
+#define F_GETOWN 5 /* get SIGIO/SIGURG proc/pgrp */
+#define F_SETOWN 6 /* set SIGIO/SIGURG proc/pgrp */
+#define F_GETLK 7 /* get record locking information */
+#define F_SETLK 8 /* set record locking information */
+#define F_SETLKW 9 /* F_SETLK; wait if blocked */
+
+/* Flag Values */
+#define FREAD 0x0001
+#define FWRITE 0x0002
+#define O_NONBLOCK 0x0004 /* no delay */
+#define O_APPEND 0x0008 /* set append mode */
+#define O_SHLOCK 0x0010 /* open with shared file lock */
+#define O_EXLOCK 0x0020 /* open with exclusive file lock */
+#define O_ASYNC 0x0040 /* signal pgrp when data ready */
+#define O_FSYNC 0x0080 /* synchronous writes */
+#define O_SYNC 0x0080 /* POSIX synonym for O_FSYNC */
+#define O_NOFOLLOW 0x0100 /* don't follow symlinks */
+#define O_CREAT 0x0200 /* create if nonexistent */
+#define O_TRUNC 0x0400 /* truncate to zero length */
+#define O_EXCL 0x0800 /* error if already exists */
+#define O_DIRECT 0x00010000
+#define O_RDONLY 0x0000 /* open for reading only */
+#define O_WRONLY 0x0001 /* open for writing only */
+#define O_RDWR 0x0002 /* open for reading and writing */
+#define O_ACCMODE 0x0003 /* mask for above modes */
+
+
+#define FHASLOCK 0x4000 /* descriptor holds advisory lock */
+
+
+/* F MAPPERS */
+#define FAPPEND O_APPEND /* kernel/compat */
+#define FASYNC O_ASYNC /* kernel/compat */
+#define FFSYNC O_FSYNC /* kernel */
+#define FNONBLOCK O_NONBLOCK /* kernel */
+#define FNDELAY O_NONBLOCK /* compat */
+#define O_NDELAY O_NONBLOCK /* compat */
+#define FPOSIXSHM O_NOFOLLOW
+
+
+
+#define FCNTLFLAGS (FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FPOSIXSHM|O_DIRECT)
+
+#define FFLAGS(oflags) ((oflags) + 1)
+#define OFLAGS(fflags) ((fflags) - 1)
+
+struct file {
+ struct vfs_mountPoint *mp;
+ u_int16_t status;
+ u_int16_t mode;
+ u_int32_t offset;
+ u_int32_t size;
+ u_int32_t perms;
+ int f_flag;
+ char *buffer;
+ char path[1024];
+ void *fsObj;
+ };
+
+/* TEMP */
+struct __timespec {
+ __time_t tv_sec; /* seconds */
+ long tv_nsec; /* and nanoseconds */
+};
+
+struct stat {
+ __dev_t st_dev; /* inode's device */
+ ino_t st_ino; /* inode's number */
+ mode_t st_mode; /* inode protection mode */
+ nlink_t st_nlink; /* number of hard links */
+ uid_t st_uid; /* user ID of the file's owner */
+ gid_t st_gid; /* group ID of the file's group */
+ __dev_t st_rdev; /* device type */
+#if __BSD_VISIBLE
+ struct timespec st_atimespec; /* time of last access */
+ struct timespec st_mtimespec; /* time of last data modification */
+ struct timespec st_ctimespec; /* time of last file status change */
+#else
+ time_t st_atime; /* time of last access */
+ long __st_atimensec; /* nsec of last access */
+ time_t st_mtime; /* time of last data modification */
+ long __st_mtimensec; /* nsec of last data modification */
+ time_t st_ctime; /* time of last file status change */
+ long __st_ctimensec; /* nsec of last file status change */
+#endif
+ off_t st_size; /* file size, in bytes */
+ blkcnt_t st_blocks; /* blocks allocated for file */
+ blksize_t st_blksize; /* optimal blocksize for I/O */
+ fflags_t st_flags; /* user defined flags for file */
+ __uint32_t st_gen; /* file generation number */
+ __int32_t st_lspare;
+#if __BSD_VISIBLE
+ struct timespec st_birthtimespec; /* time of file creation */
+ /*
+ * Explicitly pad st_birthtimespec to 16 bytes so that the size of
+ * struct stat is backwards compatible. We use bitfields instead
+ * of an array of chars so that this doesn't require a C99 compiler
+ * to compile if the size of the padding is 0. We use 2 bitfields
+ * to cover up to 64 bits on 32-bit machines. We assume that
+ * CHAR_BIT is 8...
+ */
+ unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));
+ unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));
+#else
+ time_t st_birthtime; /* time of file creation */
+ long st_birthtimensec; /* nsec of file creation */
+ unsigned int :(8 / 2) * (16 - (int)sizeof(struct __timespec));
+ unsigned int :(8 / 2) * (16 - (int)sizeof(struct __timespec));
+#endif
+};
+
+
+int fcntl(struct thread *, struct fcntl_args *);
+int close(struct thread *,struct close_args *);
+int falloc(struct thread *, struct file **, int *);
+int getdtablesize(struct thread *, struct getdtablesize_args *);
+int stat(struct thread *, struct stat_args *);
+int fstat(struct thread *, struct fstat_args *);
+int lstat(struct thread *, struct lstat_args *);
+int ioctl(struct thread *, struct ioctl_args *);
+int getfd(struct thread *td,struct file **fp,int fd);
+
+
+#endif
+
+/***
+ END
+ ***/
diff --git a/include/sys/kern_sig.h b/include/sys/kern_sig.h
new file mode 100644
index 0000000..914f5c9
--- /dev/null
+++ b/include/sys/kern_sig.h
@@ -0,0 +1,44 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _KERN_SIG_H
+#define _KERN_SIG_H
+
+#include
+#include
+
+int sigaction(struct thread *,struct sigaction_args *);
+int sigprocmask(struct thread *, struct sigprocmask_args *);
+
+#endif
+
+/***
+ END
+ ***/
+
diff --git a/include/sys/kern_sysctl.h b/include/sys/kern_sysctl.h
new file mode 100644
index 0000000..3df8cae
--- /dev/null
+++ b/include/sys/kern_sysctl.h
@@ -0,0 +1,77 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _KERNSYSCTL_H
+#define _KERNSYSCTL_H
+
+#include
+#include
+
+#define CTL_MAXNAME 24 /* largest number of components supported */
+
+/*
+ * Top-level identifiers
+ */
+#define CTL_UNSPEC 0 /* unused */
+#define CTL_KERN 1 /* "high kernel": proc, limits */
+#define CTL_VM 2 /* virtual memory */
+#define CTL_VFS 3 /* filesystem, mount type is next */
+#define CTL_NET 4 /* network, see socket.h */
+#define CTL_DEBUG 5 /* debugging parameters */
+#define CTL_HW 6 /* generic cpu/io */
+#define CTL_MACHDEP 7 /* machine dependent */
+#define CTL_USER 8 /* user-level */
+#define CTL_P1003_1B 9 /* POSIX 1003.1B */
+#define CTL_UBIX 10 /* ubixos */
+
+#define CTL_KERN_OPENFILES 1 /* kernel openfiles */
+
+#define EINVAL -1 /* */
+
+struct sysctl_entry {
+ struct sysctl_entry *prev;
+ struct sysctl_entry *next;
+ struct sysctl_entry *children;
+ char name[32];
+ int id;
+ void *value;
+ int val_len;
+ };
+
+int kern_sysctl(int *name,u_int namelen,void *old,size_t *oldlenp,void *new,size_t newlen,size_t *retval,int flags);
+int sysctl_add(int *,int,char *,void *,int);
+int sysctl_init();
+
+extern bool sysctl_enabled;
+#endif
+
+/***
+ END
+ ***/
+
diff --git a/include/sys/pipe.h b/include/sys/pipe.h
new file mode 100644
index 0000000..fb9f7d6
--- /dev/null
+++ b/include/sys/pipe.h
@@ -0,0 +1,43 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _PIPE_H
+#define _PIPE_H
+
+#include
+#include
+
+int pipe(struct thread *, struct pipe_args *);
+
+#endif
+
+/***
+ END
+ ***/
+
diff --git a/include/sys/signal.h b/include/sys/signal.h
new file mode 100644
index 0000000..3dc692d
--- /dev/null
+++ b/include/sys/signal.h
@@ -0,0 +1,53 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _SIGNAL_H
+#define _SIGNALL_H
+
+#include
+
+#define _SIG_WORDS 4
+#define _SIG_MAXSIG 128
+#define _SIG_IDX(sig) ((sig) - 1)
+#define _SIG_WORD(sig) (_SIG_IDX(sig) >> 5)
+#define _SIG_BIT(sig) (1 << (_SIG_IDX(sig) & 31))
+#define _SIG_VALID(sig) ((sig) <= _SIG_MAXSIG && (sig) > 0)
+
+typedef struct __sigset {
+ __uint32_t __bits[_SIG_WORDS];
+ } __sigset_t;
+
+typedef __sigset_t sigset_t;
+
+#endif
+
+/***
+ END
+ ***/
+
diff --git a/include/sys/sysproto.h b/include/sys/sysproto.h
new file mode 100644
index 0000000..b50e60d
--- /dev/null
+++ b/include/sys/sysproto.h
@@ -0,0 +1,219 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _SYSPROTO_H
+#define _SYSPROTO_H
+
+#include
+#include
+
+typedef int register_t;
+
+#define PAD_(t) (sizeof(register_t) <= sizeof(t) ? \
+ 0 : sizeof(register_t) - sizeof(t))
+
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define PADL_(t) 0
+#define PADR_(t) PAD_(t)
+#else
+#define PADL_(t) PAD_(t)
+#define PADR_(t) 0
+#endif
+
+//Protos
+struct fork_args {
+ register_t dummy;
+ };
+struct read_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char buf_l_[PADL_(void *)]; void * buf; char buf_r_[PADR_(void *)];
+ char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)];
+ };
+struct write_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char buf_l_[PADL_(const void *)]; const void * buf; char buf_r_[PADR_(const void *)];
+ char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)];
+ };
+struct open_args {
+ char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
+ char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
+ char mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)];
+ };
+struct close_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ };
+
+struct setitimer_args {
+ char which_l_[PADL_(u_int)]; u_int which; char which_r_[PADR_(u_int)];
+ char itv_l_[PADL_(struct itimerval *)]; struct itimerval * itv; char itv_r_[PADR_(struct itimerval *)];
+ char oitv_l_[PADL_(struct itimerval *)]; struct itimerval * oitv; char oitv_r_[PADR_(struct itimerval *)];
+ };
+
+struct access_args {
+ char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
+ char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
+ };
+struct fstatfs_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char buf_l_[PADL_(struct statfs *)]; struct statfs * buf; char buf_r_[PADR_(struct statfs *)];
+ };
+struct mprotect_args {
+ char addr_l_[PADL_(const void *)]; const void * addr; char addr_r_[PADR_(const void *)];
+ char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)];
+ char prot_l_[PADL_(int)]; int prot; char prot_r_[PADR_(int)];
+ };
+struct lseek_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
+ char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)];
+ char whence_l_[PADL_(int)]; int whence; char whence_r_[PADR_(int)];
+ };
+
+
+
+
+//Old
+
+struct sysctl_args {
+ char name_l_[PADL_(int *)]; int * name; char name_r_[PADR_(int *)];
+ char namelen_l_[PADL_(u_int)]; u_int namelen; char namelen_r_[PADR_(u_int)];
+ char old_l_[PADL_(void *)]; void * old; char old_r_[PADR_(void *)];
+ char oldlenp_l_[PADL_(size_t *)]; size_t * oldlenp; char oldlenp_r_[PADR_(size_t *)];
+ char new_l_[PADL_(void *)]; void * new; char new_r_[PADR_(void *)];
+ char newlen_l_[PADL_(size_t)]; size_t newlen; char newlen_r_[PADR_(size_t)];
+};
+
+struct getpid_args {
+ register_t dummy;
+};
+struct issetugid_args {
+ register_t dummy;
+};
+struct fcntl_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)];
+ char arg_l_[PADL_(long)]; long arg; char arg_r_[PADR_(long)];
+};
+
+struct pipe_args {
+ register_t dummy;
+ };
+
+struct readlink_args {
+ char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
+ char buf_l_[PADL_(char *)]; char * buf; char buf_r_[PADR_(char *)];
+ char count_l_[PADL_(int)]; int count; char count_r_[PADR_(int)];
+};
+
+struct getuid_args {
+ register_t dummy;
+};
+
+struct getgid_args {
+ register_t dummy;
+};
+
+struct mmap_args {
+ char addr_l_[PADL_(caddr_t)]; caddr_t addr; char addr_r_[PADR_(caddr_t)];
+ char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)];
+ char prot_l_[PADL_(int)]; int prot; char prot_r_[PADR_(int)];
+ char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
+ char pos_l_[PADL_(off_t)]; off_t pos; char pos_r_[PADR_(off_t)];
+ };
+
+struct obreak_args {
+ char nsize_l_[PADL_(char *)];char * nsize;char nsize_r_[PADR_(char *)];
+ };
+
+struct sigaction_args {
+ char sig_l_[PADL_(int)]; int sig; char sig_r_[PADR_(int)];
+ char act_l_[PADL_(const struct sigaction *)]; const struct sigaction * act; char act_r_[PADR_(const struct sigaction *)];
+ char oact_l_[PADL_(struct sigaction *)]; struct sigaction * oact; char oact_r_[PADR_(struct sigaction *)];
+ };
+
+struct getdtablesize_args {
+ register_t dummy;
+};
+
+struct munmap_args {
+ char addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)];
+ char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)];
+};
+
+struct sigprocmask_args {
+ char how_l_[PADL_(int)]; int how; char how_r_[PADR_(int)];
+ char set_l_[PADL_(const sigset_t *)]; const sigset_t * set; char set_r_[PADR_(const sigset_t *)];
+ char oset_l_[PADL_(sigset_t *)]; sigset_t * oset; char oset_r_[PADR_(sigset_t *)];
+ };
+struct gettimeofday_args {
+ char tp_l_[PADL_(struct timeval *)]; struct timeval * tp; char tp_r_[PADR_(struct timeval *)];
+ char tzp_l_[PADL_(struct timezone *)]; struct timezone * tzp; char tzp_r_[PADR_(struct timezone *)];
+ };
+
+struct stat_args {
+ char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
+ char ub_l_[PADL_(struct stat *)]; struct stat * ub; char ub_r_[PADR_(struct stat *)];
+};
+
+struct fstat_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char sb_l_[PADL_(struct stat *)]; struct stat * sb; char sb_r_[PADR_(struct stat *)];
+};
+
+struct lstat_args {
+ char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
+ char ub_l_[PADL_(struct stat *)]; struct stat * ub; char ub_r_[PADR_(struct stat *)];
+};
+
+struct ioctl_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char com_l_[PADL_(u_long)]; u_long com; char com_r_[PADR_(u_long)];
+ char data_l_[PADL_(caddr_t)]; caddr_t data; char data_r_[PADR_(caddr_t)];
+};
+
+//Func Defs
+int fork(struct thread *td,struct fork_args *uap);
+int read(struct thread *td,struct read_args *uap);
+int write(struct thread *td, struct write_args *uap);
+int open(struct thread *td, struct open_args *uap);
+int close(struct thread *td, struct close_args *uap);
+int setitimer(struct thread *td, struct setitimer_args *uap);
+int access(struct thread *td, struct access_args *uap);
+int fstatfs(struct thread *td, struct fstatfs_args *uap);
+int mprotect(struct thread *td, struct mprotect_args *uap);
+int lseek(struct thread *td, struct lseek_args *uap);
+
+#endif
+
+/***
+ END
+ ***/
+
diff --git a/include/sys/thread.h b/include/sys/thread.h
new file mode 100644
index 0000000..376457f
--- /dev/null
+++ b/include/sys/thread.h
@@ -0,0 +1,52 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _THREAD_H
+#define _THREAD_H
+
+#include
+
+#define O_FILES 64
+#define S_GID 0x1
+#define S_UID 0x3
+
+struct thread {
+ int td_retval[2];
+ u_int32_t o_files[O_FILES];
+ char * vm_daddr;
+ int32_t vm_dsize;
+ u_int8_t mode;
+ };
+
+#endif
+
+/***
+ END
+ ***/
+
diff --git a/include/sys/trap.h b/include/sys/trap.h
new file mode 100644
index 0000000..ee145d6
--- /dev/null
+++ b/include/sys/trap.h
@@ -0,0 +1,62 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _TRAP_H
+#define _TRAP_H
+
+struct trapframe {
+ int tf_fs;
+ int tf_es;
+ int tf_ds;
+ int tf_edi;
+ int tf_esi;
+ int tf_ebp;
+ int tf_isp;
+ int tf_ebx;
+ int tf_edx;
+ int tf_ecx;
+ int tf_eax;
+ int tf_trapno;
+ /* below portion defined in 386 hardware */
+ int tf_err;
+ int tf_eip;
+ int tf_cs;
+ int tf_eflags;
+ /* below only when crossing rings (e.g. user to kernel) */
+ int tf_esp;
+ int tf_ss;
+};
+
+
+#endif
+
+/***
+ END
+ ***/
+
diff --git a/include/sys/tss.h b/include/sys/tss.h
new file mode 100644
index 0000000..8393c26
--- /dev/null
+++ b/include/sys/tss.h
@@ -0,0 +1,143 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _TSS_H
+#define _TSS_H
+
+#include
+
+struct tssStruct {
+ short back_link;
+ short back_link_reserved;
+ long esp0;
+ short ss0;
+ short ss0_reserved;
+ long esp1;
+ short ss1;
+ short ss1_reserved;
+ long esp2;
+ short ss2;
+ short ss2_reserved;
+ long cr3;
+ long eip;
+ long eflags;
+ long eax,ecx,edx,ebx;
+ long esp;
+ long ebp;
+ long esi;
+ long edi;
+ short es;
+ short es_reserved;
+ short cs;
+ short cs_reserved;
+ short ss;
+ short ss_reserved;
+ short ds;
+ short ds_reserved;
+ short fs;
+ short fs_reserved;
+ short gs;
+ short gs_reserved;
+ short ldt;
+ short ldt_reserved;
+ short trace_bitmap;
+ short io_map;
+ char io_space[8192];
+ };
+
+struct i387Struct {
+ long cwd;
+ long swd;
+ long twd;
+ long fip;
+ long fcs;
+ long foo;
+ long fos;
+ long st_space[20]; /* 8*10 bytes for each FP-reg = 80 bytes */
+ };
+
+struct i386_frame {
+ uInt32 gs;
+ uInt32 fs;
+ uInt32 es;
+ uInt32 ds;
+ uInt32 ss;
+ uInt32 edi;
+ uInt32 esi;
+ uInt32 ebp;
+ uInt32 esp;
+ uInt32 ebx;
+ uInt32 edx;
+ uInt32 ecx;
+ uInt32 eax;
+ /*
+ uInt32 vector;
+ uInt32 error_code;
+ */
+ uInt32 eip;
+ uInt32 cs;
+ uInt32 flags;
+ uInt32 user_esp;
+ uInt32 user_ss;
+ };
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:53 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:15 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:37 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:53 reddawg
+ no message
+
+ Revision 1.6 2004/07/27 07:42:29 reddawg
+ *burp*
+
+ Revision 1.5 2004/07/27 07:40:41 reddawg
+ does it compile now?
+
+ Revision 1.4 2004/07/27 07:27:50 reddawg
+ chg: I was fooled thought we failed but it was a casting issue
+
+ Revision 1.3 2004/07/22 20:53:07 reddawg
+ atkbd: fixed problem
+
+ Revision 1.2 2004/05/21 15:12:17 reddawg
+ Cleaned up
+
+
+ END
+ ***/
diff --git a/include/sys/video.h b/include/sys/video.h
new file mode 100644
index 0000000..37f0237
--- /dev/null
+++ b/include/sys/video.h
@@ -0,0 +1,67 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _VIDEO_H
+#define _VIDEO_H
+
+#include
+
+#define defaultColor 0x0F
+
+extern int printColor;
+
+void screenClear();
+void kprint(char *string);
+void backSpace();
+
+#endif
+
+/***
+ $Log$
+ Revision 1.2 2008/02/29 14:56:31 reddawg
+ Sync - Working On Getting It To Boot Again
+
+ Revision 1.1.1.1 2007/01/17 03:31:53 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:15 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:37 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:53 reddawg
+ no message
+
+ Revision 1.2 2004/05/21 15:12:17 reddawg
+ Cleaned up
+
+
+ END
+ ***/
diff --git a/include/ubixfs/dirCache.h b/include/ubixfs/dirCache.h
new file mode 100644
index 0000000..195b035
--- /dev/null
+++ b/include/ubixfs/dirCache.h
@@ -0,0 +1,28 @@
+#ifndef DIRCACHE_H
+#define DIRCACHE_H
+
+/* #include "ubixfs.h" */
+#include
+
+struct cacheNode {
+ char * name;
+ struct cacheNode * prev;
+ struct cacheNode * next;
+ struct cacheNode * parent;
+ struct cacheNode * fileListHead;
+ struct cacheNode * fileListTail;
+ void * info;
+ int * size;
+ int present;
+ int dirty;
+ uInt32 * startCluster;
+ uInt16 * attributes;
+ uInt16 * permissions;
+}; /* cacheNode */
+
+struct cacheNode * ubixfs_cacheFind(struct cacheNode *, char *);
+struct cacheNode * ubixfs_cacheNew(const char *);
+void ubixfs_cacheDelete(struct cacheNode **);
+struct cacheNode * ubixfs_cacheAdd(struct cacheNode *, struct cacheNode *);
+
+#endif /* !DIRCACHE_H */
diff --git a/include/ubixfs/ubixfs.h b/include/ubixfs/ubixfs.h
new file mode 100644
index 0000000..1cd6031
--- /dev/null
+++ b/include/ubixfs/ubixfs.h
@@ -0,0 +1,206 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _UBIXFS_H
+#define _UBIXFS_H
+
+#include
+#include
+#include
+#include
+#include
+
+
+#define UBIXFS_BLOCKSIZE_BYTES blockSize*512
+#define UBIXFS_ALIGN(size) (size + ((((size) % (UBIXFS_BLOCKSIZE_BYTES)) == 0)? 0 : ((UBIXFS_BLOCKSIZE_BYTES) - ((size) % (UBIXFS_BLOCKSIZE_BYTES)))))
+
+#define UBIXDISKMAGIC ((uInt32)0x45) /* The disk magic number */
+#define MAXUBIXPARTITIONS 16
+#define blockSize 8
+
+
+#define EOBC -1
+
+
+#define typeFile 1
+#define typeContainer 2
+#define typeDirectory 4
+#define typeDeleted 8
+
+/* Start */
+struct directoryList {
+ char dirName[256];
+ char *dirCache;
+ uInt32 dirBlock;
+ struct directoryList *next;
+ struct directoryList *prev;
+ };
+
+typedef struct directoryList * dirList_t;
+
+dirList_t ubixFSLoadDir(char *);
+/* End */
+
+//Partition Information
+struct ubixDiskLabel {
+ uInt32 magicNum;
+ uInt32 magicNum2;
+ uInt16 driveType;
+ uInt16 numPartitions;
+ struct ubixPartitions { //the partition table
+ uInt32 pSize; //number of sectors in partition
+ uInt32 pOffset; //starting sector
+ uInt32 pFsSize; //filesystem basic fragment size
+ uInt32 pBatSize; //BAT size
+ uInt8 pFsType; //filesystem type, see below
+ uInt8 pFrag; //filesystem fragments per block
+ } partitions[MAXUBIXPARTITIONS];
+ };
+
+
+struct partitionInformation {
+ uInt32 size; //Size In Sectors
+ uInt32 startSector; //Base Sector Of Partition
+ uInt32 blockAllocationTable; //Base Sector Of BAT
+ uInt32 rootDirectory; //Base Sector Of Root Directory
+ };
+
+//Block Allocation Table Entry
+struct blockAllocationTableEntry {
+ long attributes; //Block Attributes
+ long realSector; //Real Sector
+ long nextBlock; //Sector Of Next Block
+ long reserved; //Reserved
+ };
+
+//UbixFS Directory Entry
+struct directoryEntry {
+ uInt32 startCluster; //Starting Cluster Of File
+ uInt32 size; //Size Of File
+ uInt32 creationDate; //Date Created
+ uInt32 lastModified; //Date Last Modified
+ uInt32 uid; //UID Of Owner
+ uInt32 gid; //GID Of Owner
+ uInt16 attributes; //Files Attributes
+ uInt16 permissions; //Files Permissions
+ char fileName[256]; //File Name
+ };
+
+struct bootSect {
+ uInt8 jmp[4];
+ uInt8 id[6];
+ uInt16 version;
+ uInt16 tmp;
+ uInt16 fsStart;
+ uInt16 tmp2;
+ uInt32 krnl_start;
+ uInt BytesPerSector;
+ uInt SectersPerTrack;
+ uInt TotalHeads;
+ uInt32 TotalSectors;
+ uInt8 code[479];
+ };
+
+struct ubixFSInfo {
+ struct blockAllocationTableEntry *blockAllocationTable;
+ struct cacheNode * dirCache;
+ uInt32 batEntries;
+ uInt32 rootDir;
+}; /* 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);
+//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);
+void syncBat(struct vfs_mountPoint *mp);
+int freeBlocks(int block,fileDescriptor *fd);
+int addDirEntry(struct directoryEntry *dir,fileDescriptor *fd);
+void ubixFSUnlink(char *path,struct vfs_mountPoint *mp);
+int ubixFSmkDir(char *dir,fileDescriptor *fd);
+
+int ubixfs_init();
+int ubixfs_initialize();
+void ubixfs_thread();
+
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:52 reddawg
+ UbixOS
+
+ Revision 1.2 2006/12/05 14:10:21 reddawg
+ Workign Distro
+
+ Revision 1.1.1.1 2006/06/01 12:46:14 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:37 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:53 reddawg
+ no message
+
+ Revision 1.21 2004/09/14 20:57:01 reddawg
+ Bug fixes: macro problem over opt a multiply
+
+ Revision 1.20 2004/08/01 17:58:39 flameshadow
+ chg: fixed string allocation bug in ubixfs_cacheNew()
+
+ Revision 1.19 2004/07/27 12:02:01 reddawg
+ chg: fixed marks bug readFile did a lookup which is why it looked like it was loopping so much
+
+ Revision 1.18 2004/07/23 09:10:06 reddawg
+ ubixfs: cleaned up some functions played with the caching a bit
+ vfs: renamed a bunch of functions
+ cleaned up a few misc bugs
+
+ Revision 1.17 2004/07/22 22:37:03 reddawg
+ Caching is working now the FS is extremely fast but needs to be optimized to do 32bit copies over 8bit
+
+ Revision 1.16 2004/07/20 21:28:16 flameshadow
+ oops
+
+ Revision 1.14 2004/07/20 19:36:49 reddawg
+ UBU Tags
+
+ Revision 1.13 2004/07/14 12:21:49 reddawg
+ ubixfs: enableUbixFs to ubixfs_init
+ Changed Startup Routines
+
+ END
+ ***/
diff --git a/include/ubixos/elf.h b/include/ubixos/elf.h
new file mode 100644
index 0000000..bbe5864
--- /dev/null
+++ b/include/ubixos/elf.h
@@ -0,0 +1,212 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _ELF_H
+#define _ELF_H
+
+#include
+#include
+
+#define elfExecutable 0x002
+#define elfLibrary 0x003
+
+#define R_386_NONE 0 /* none none */
+#define R_386_32 1 /* word32 S + A */
+#define R_386_PC32 2 /* word32 S + A - P */
+#define R_386_GOT32 3 /* word32 G + A - P */
+#define R_386_PLT32 4 /* word32 L + A - P */
+#define R_386_COPY 5 /* none none */
+#define R_386_GLOB_DAT 6 /* word32 S */
+#define R_386_JMP_SLOT 7 /* word32 S */
+#define R_386_RELATIVE 8 /* word32 B + A */
+#define R_386_GOTOFF 9 /* word32 S + A - GOT */
+#define R_386_GOTPC 10 /* word32 GOT + A - P */
+
+
+/* Elf Types */
+#define ET_NONE 0 // No file type
+#define ET_REL 1 // Relocatable file
+#define ET_EXEC 2 // Executable file
+#define ET_DYN 3 // Shared object file
+#define ET_CORE 4 // Core file
+#define ET_LOPROC 0xff00 // Processor-specific
+#define ET_HIPROC 0xffff
+/* End Elf Types */
+
+/* Elf Machine Types */
+#define EM_NONE 0 // No machine
+#define EM_M32 1 // AT&T WE 32100
+#define EM_SPARC 2 // SPARC
+#define EM_386 3 // Intel 80386
+#define EM_68K 4 // Motorola 68000
+#define EM_88K 5 // Motorola 88000
+#define EM_860 7 // Intel 80860
+#define EM_MIPS 8 // MIPS RS3000
+/* End Elf Machines Types */
+
+/* Elf Version */
+#define EV_NONE 0 // Invalid version
+#define EV_CURRENT 1 // Current version
+/* End Elf Version */
+
+/* Elf Program Header Types */
+#define PT_NULL 0
+#define PT_LOAD 1
+#define PT_DYNAMIC 2
+#define PT_INTERP 3
+#define PT_NOTE 4
+#define PT_SHLIB 5
+#define PT_PHDR 6
+#define PT_LOOS 0x60000000
+#define PT_HIOS 0x6fffffff
+#define PT_LOPROC 0x70000000
+#define PT_HIPROC 0x7fffffff
+#define PT_GNU_EH_FRAME 0x6474e550
+#define PT_GNU_STACK (PT_LOOS + 0x474e551)
+#define PT_GNU_RELRO (PT_LOOS + 0x474e552)
+#define PT_PAX_FLAGS (PT_LOOS + 0x5041580)
+
+/* End Elf Program Header Types */
+
+typedef struct {
+ uInt8 eIdent[16]; /* File identification. */
+ uInt16 eType; /* File type. */
+ uInt16 eMachine; /* Machine architecture. */
+ uInt32 eVersion; /* ELF format version. */
+ uInt32 eEntry; /* Entry point. */
+ uInt32 ePhoff; /* Program header file offset. */
+ uInt32 eShoff; /* Section header file offset. */
+ uInt32 eFlags; /* Architecture-specific flags. */
+ uInt16 eEhsize; /* Size of ELF header in bytes. */
+ uInt16 ePhentsize; /* Size of program header entry. */
+ uInt16 ePhnum; /* Number of program header entries. */
+ uInt16 eShentsize; /* Size of section header entry. */
+ uInt16 eShnum; /* Number of section header entries. */
+ uInt16 eShstrndx; /* Section name strings section. */
+ } elfHeader;
+
+typedef struct {
+ uInt32 phType; /* Entry type. */
+ uInt32 phOffset; /* File offset of contents. */
+ uInt32 phVaddr; /* Virtual address in memory image. */
+ uInt32 phPaddr; /* Physical address (not used). */
+ uInt32 phFilesz; /* Size of contents in file. */
+ uInt32 phMemsz; /* Size of contents in memory. */
+ uInt32 phFlags; /* Access permission flags. */
+ uInt32 phAlign; /* Alignment in memory and file. */
+ } elfProgramHeader;
+
+typedef struct {
+ uInt32 shName; /* Section name (index into the section header string table). */
+ uInt32 shType; /* Section type. */
+ uInt32 shFlags; /* Section flags. */
+ uInt32 shAddr; /* Address in memory image. */
+ uInt32 shOffset; /* Offset in file. */
+ uInt32 shSize; /* Size in bytes. */
+ uInt32 shLink; /* Index of a related section. */
+ uInt32 shInfo; /* Depends on section type. */
+ uInt32 shAddralign; /* Alignment in bytes. */
+ uInt32 shEntsize; /* Size of each entry in section. */
+ } elfSectionHeader;
+
+typedef struct {
+ uInt32 pltOffset;
+ uInt32 pltInfo;
+ } elfPltInfo;
+
+typedef struct {
+ uInt32 dynName;
+ uInt32 dynValue;
+ uInt32 dynSize;
+ uInt32 dynInfo;
+ } elfDynSym;
+
+typedef struct {
+ uInt32 dynVal;
+ uInt32 dynPtr;
+ } elfDynamic;
+
+typedef struct {
+ int32_t execfd;
+ u_int32_t phdr;
+ u_int32_t phent;
+ u_int32_t phnum;
+ u_int32_t pagesz;
+ u_int32_t base;
+ u_int32_t flags;
+ u_int32_t entry;
+ u_int32_t trace;
+} Elf_Auxargs;
+
+char *elfGetShType(int);
+char *elfGetPhType(int);
+char *elfGetRelType(int);
+int elf_loadfile(kTask_t *p,const char *file,u_int32_t *addr,u_int32_t *entry);
+
+#define ELF32_R_SYM(i) ((i)>>8)
+#define ELF32_R_TYPE(i) ((unsigned char)(i))
+#define ELF32_R_INFO(s, t) ((s)<<8+(unsigned char)(t))
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:52 reddawg
+ UbixOS
+
+ Revision 1.2 2006/12/15 15:43:46 reddawg
+ Changes
+
+ Revision 1.1.1.1 2006/06/01 12:46:13 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:37 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:54 reddawg
+ no message
+
+ Revision 1.7 2004/09/11 01:20:08 apwillia
+ Clean up 'Unhandled Header' printfs when compiled in linux
+
+ Revision 1.6 2004/06/16 14:04:51 reddawg
+ Renamed a typedef
+
+ Revision 1.5 2004/06/14 12:20:54 reddawg
+ notes: many bugs repaired and ld works 100% now.
+
+ Revision 1.4 2004/06/12 01:27:26 reddawg
+ shared objects: yes we almost fully support shared objects
+
+ Revision 1.3 2004/05/21 15:20:00 reddawg
+ Cleaned up
+
+
+ END
+ ***/
diff --git a/include/ubixos/endtask.h b/include/ubixos/endtask.h
new file mode 100644
index 0000000..9777ff9
--- /dev/null
+++ b/include/ubixos/endtask.h
@@ -0,0 +1,62 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _ENDTASK_H
+#define _ENDTASK_H
+
+#include
+#include
+
+void endTask(pidType);
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:52 reddawg
+ UbixOS
+
+ Revision 1.2 2006/10/31 20:41:16 reddawg
+ Includes
+
+ Revision 1.1.1.1 2006/06/01 12:46:13 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:37 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:54 reddawg
+ no message
+
+ Revision 1.2 2004/05/21 15:20:00 reddawg
+ Cleaned up
+
+
+ END
+ ***/
diff --git a/include/ubixos/exec.h b/include/ubixos/exec.h
new file mode 100644
index 0000000..a3600a8
--- /dev/null
+++ b/include/ubixos/exec.h
@@ -0,0 +1,44 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _EXEC_H
+#define _EXEC_H
+
+#include
+#include
+
+uInt32 execThread(void (* tproc)(void),uInt32,char *);
+void execFile(char *file,int argc,char **argv,int console);
+int sys_exec(char *file,char *ap);
+
+#endif
+
+/***
+ END
+ ***/
diff --git a/include/ubixos/fork.h b/include/ubixos/fork.h
new file mode 100644
index 0000000..2d1a0e9
--- /dev/null
+++ b/include/ubixos/fork.h
@@ -0,0 +1,62 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _FORK_H
+#define _FORK_H
+
+#include
+#include
+
+void sysFork();
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:52 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:14 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:37 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:54 reddawg
+ no message
+
+ Revision 1.3 2004/09/11 13:06:39 reddawg
+ fork: cleaned up comments in fork and made fork_copyProcess static
+
+ Revision 1.2 2004/05/21 15:20:00 reddawg
+ Cleaned up
+
+
+ END
+ ***/
diff --git a/include/ubixos/init.h b/include/ubixos/init.h
new file mode 100644
index 0000000..ebe94f2
--- /dev/null
+++ b/include/ubixos/init.h
@@ -0,0 +1,85 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _INIT_H
+#define _INIT_H
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+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,
+ //net_init,
+ //ne2k_init,
+ devfs_init,
+ //pci_init,
+ //ubixfs_init,
+ //fdc_init,
+ tty_init,
+ ufs_init,
+ initHardDisk,
+ };
+
+int init_tasksTotal = sizeof(init_tasks)/sizeof(intFunctionPTR);
+
+#endif
+
+/***
+ END
+ ***/
diff --git a/include/ubixos/kmod.h b/include/ubixos/kmod.h
new file mode 100644
index 0000000..d1e19ce
--- /dev/null
+++ b/include/ubixos/kmod.h
@@ -0,0 +1,83 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _KMOD_H
+#define _KMOD_H
+
+#include
+
+#define LD_START 0x1000000
+
+typedef struct kmod_struct {
+ struct kmod_struct *next;
+ struct kmod_struct *prev;
+ uInt16 id;
+ uInt16 refs;
+ uInt32 address;
+ char name[128];
+} kmod_t;
+
+
+uInt32 kmod_load(const char *);
+uInt32 kmod_add(const char *, const char *name);
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:52 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:14 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:37 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:55 reddawg
+ no message
+
+ Revision 1.5 2005/08/04 20:35:19 fsdfs
+
+ various updates. mostly kprints, tabbing code to look cleaner
+
+ Revision 1.4 2004/09/26 20:46:13 reddawg
+ ok time for bed added kmod_add keeps modules listed now
+
+ Revision 1.3 2004/09/26 20:40:51 reddawg
+ Added baseAddr to the kmod_t
+
+ Revision 1.2 2004/09/26 20:39:19 reddawg
+ Added kmod struct type kmod_t
+
+ Revision 1.1 2004/09/20 07:33:10 reddawg
+ Start of kernel modules will make it much more flexable - These modules can be either in kernel threads or system services...
+
+ END
+ ***/
diff --git a/include/ubixos/kpanic.h b/include/ubixos/kpanic.h
new file mode 100644
index 0000000..7905951
--- /dev/null
+++ b/include/ubixos/kpanic.h
@@ -0,0 +1,42 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _KPANIC_H
+#define _KPANIC_H
+
+#define K_PANIC(msg) kpanic("\nKernel Panic!!!!\nError: (%s), File: %s, Function: %s, Line: %i\n",msg ,__FILE__,__FUNCTION__,__LINE__);
+
+void kpanic(const char *fmt, ...);
+
+#endif
+
+/***
+ END
+ ***/
+
diff --git a/include/ubixos/ld.h b/include/ubixos/ld.h
new file mode 100644
index 0000000..b0c634a
--- /dev/null
+++ b/include/ubixos/ld.h
@@ -0,0 +1,77 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _LD_H
+#define _LD_H
+
+#include
+
+#define LD_START 0x1000000
+
+uInt32 ldEnable();
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:52 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:14 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:37 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:55 reddawg
+ no message
+
+ Revision 1.10 2004/06/17 12:20:32 reddawg
+ Try this now solarwind
+
+ Revision 1.9 2004/06/17 02:19:29 reddawg
+ Cleaning out dead code
+
+ Revision 1.8 2004/06/16 17:32:14 reddawg
+ Removed Dead LD Code now part of ld.so
+
+ Revision 1.7 2004/06/16 17:04:13 reddawg
+ ld.so: rest of the commit
+
+ Revision 1.4 2004/06/13 03:05:15 reddawg
+ we now have a dynamic linker
+
+ Revision 1.3 2004/06/12 01:27:26 reddawg
+ shared objects: yes we almost fully support shared objects
+
+ Revision 1.2 2004/05/21 15:20:00 reddawg
+ Cleaned up
+
+ END
+ ***/
diff --git a/include/ubixos/lists.h b/include/ubixos/lists.h
new file mode 100644
index 0000000..ab3dedd
--- /dev/null
+++ b/include/ubixos/lists.h
@@ -0,0 +1,51 @@
+#define IN
+#define STATUS_FAILURE -1
+#define STATUS_SUCCESS 0
+
+typedef struct _item_t Item_t;
+typedef struct _list_t List_t;
+struct _item_t
+{
+ Item_t *Previous;
+ Item_t *Next;
+ void *data;
+};
+
+struct _list_t
+{
+ Item_t *First;
+ Item_t *Last;
+};
+
+List_t *
+InitializeList();
+Item_t *
+CreateItem();
+int
+InsertItemAtFront( IN List_t * TList,
+ IN Item_t * kItem);
+int
+InsertItemBetweenItems( IN List_t * TList,
+ IN Item_t * Previous,
+ IN Item_t * Next,
+ IN Item_t * Insert);
+int
+RemoveItem( IN List_t * TList,
+ IN Item_t * kItem);
+int
+DestroyItemsInList(IN List_t * ItemList);
+int
+DestroyItemList(IN List_t * ItemList);
+Item_t *
+GetFirstItem(IN List_t * kItem);
+
+Item_t *
+GetLastItem(IN List_t * kItem);
+List_t *
+RemoveItemListBetweenItems( IN Item_t * Previous,
+ IN Item_t * Next);
+
+void
+InsertItemListBetweenItems( IN Item_t * Previous,
+ IN Item_t * Next,
+ IN List_t * Insert);
diff --git a/include/ubixos/sched.h b/include/ubixos/sched.h
new file mode 100644
index 0000000..8fe7625
--- /dev/null
+++ b/include/ubixos/sched.h
@@ -0,0 +1,186 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _SCHED_H
+#define _SCHED_H
+
+#include
+//#include
+#include
+#include
+#include
+#include
+
+
+typedef enum { PLACEHOLDER=-2,DEAD=-1,NEW=0,READY=1,RUNNING=2,IDLE=3,FORK=4,WAIT=5 } tState;
+
+struct osInfo {
+ uInt8 timer;
+ uInt8 v86Task;
+ bool v86If;
+ uInt32 vmStart;
+ uInt32 stdinSize;
+ uInt32 controlKeys;
+ char *stdin;
+ char cwd[1024]; /* current working dir */
+ };
+
+typedef struct taskStruct {
+ pidType id;
+ struct taskStruct *prev;
+ struct taskStruct *next;
+ struct tssStruct tss;
+ struct i387Struct i387;
+ struct osInfo oInfo;
+ struct file *imageFd;
+ tState state;
+ uInt32 gid;
+ uInt32 uid;
+ uInt16 usedMath;
+ tty_term *term;
+ struct thread td;
+ } kTask_t;
+
+
+int sched_init();
+int sched_setStatus(pidType,tState);
+int sched_deleteTask(pidType);
+int sched_addDelTask(kTask_t *);
+kTask_t *sched_getDelTask();
+void sched_yield();
+void sched();
+
+void schedEndTask(pidType pid);
+kTask_t *schedNewTask();
+kTask_t *schedFindTask(uInt32 id);
+
+extern kTask_t *_current;
+extern kTask_t *_usedMath;
+
+
+#endif
+
+/***
+ $Log$
+ Revision 1.2 2007/01/26 18:29:41 reddawg
+ Functional changes to vfs not yet 100% complete also need to impliment kopen in kernel
+
+ Revision 1.1.1.1 2007/01/17 03:31:52 reddawg
+ UbixOS
+
+ Revision 1.3 2006/12/15 15:43:46 reddawg
+ Changes
+
+ Revision 1.2 2006/10/27 16:42:42 reddawg
+ Testing
+
+ Revision 1.1.1.1 2006/06/01 12:46:14 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:37 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:55 reddawg
+ no message
+
+ Revision 1.30 2004/09/11 22:21:11 reddawg
+ oInfo.cwd is now an array no longer a pointer..
+
+ Revision 1.29 2004/09/08 23:19:58 reddawg
+ hmm
+
+ Revision 1.28 2004/09/08 22:16:02 reddawg
+ Fixens
+
+ Revision 1.27 2004/09/08 21:19:32 reddawg
+ All good now
+
+ Revision 1.26 2004/09/07 21:54:38 reddawg
+ ok reverted back to old scheduling for now....
+
+ Revision 1.20 2004/08/09 12:58:05 reddawg
+ let me know when you got the surce
+
+ Revision 1.19 2004/08/06 22:43:04 reddawg
+ ok
+
+ Revision 1.18 2004/08/06 22:32:16 reddawg
+ Ubix Works Again
+
+ Revision 1.16 2004/08/04 08:17:57 reddawg
+ tty: we have primative ttys try f1-f5 so it is easier to use and debug
+ ubixos
+
+ Revision 1.15 2004/07/29 21:32:16 reddawg
+ My quick lunchs breaks worth of updates....
+
+ Revision 1.14 2004/07/21 17:15:02 reddawg
+ removed garbage
+
+ Revision 1.13 2004/07/21 14:43:14 flameshadow
+ add: added cwc (current working container) to the osInfo strut
+
+ Revision 1.12 2004/07/19 02:32:21 reddawg
+ sched: we now set task status to dead which then makes the scheduler do some clean it could be some minor overhead but i feel this is our most efficient approach right now to prevent corruption of the queues
+
+ Revision 1.11 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.10 2004/07/18 05:24:15 reddawg
+ Fixens
+
+ Revision 1.9 2004/07/09 13:23:20 reddawg
+ sched: schedInit to sched_init
+ Adjusted initialization routines
+
+ Revision 1.8 2004/06/22 14:02:14 solar
+ Added the PLACEHOLDER state for a task
+
+ Revision 1.7 2004/06/18 13:01:47 solar
+ Added nice and timeSlice members to the kTask_t type
+
+ Revision 1.6 2004/06/17 02:12:57 reddawg
+ Cleaned Out Dead Code
+
+ Revision 1.5 2004/06/16 14:04:51 reddawg
+ Renamed a typedef
+
+ Revision 1.4 2004/06/14 12:20:54 reddawg
+ notes: many bugs repaired and ld works 100% now.
+
+ Revision 1.3 2004/05/21 15:49:13 reddawg
+ The os does better housekeeping now when a task is exited
+
+ Revision 1.2 2004/05/21 15:20:00 reddawg
+ Cleaned up
+
+
+ END
+ ***/
+
diff --git a/include/ubixos/sem.h b/include/ubixos/sem.h
new file mode 100644
index 0000000..19525b8
--- /dev/null
+++ b/include/ubixos/sem.h
@@ -0,0 +1,54 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _SEM_H
+#define _SEM_H
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:52 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:14 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:37 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:55 reddawg
+ no message
+
+ Revision 1.1 2004/07/20 18:58:24 reddawg
+ Few fixes
+
+ END
+ ***/
+
diff --git a/include/ubixos/smp.h b/include/ubixos/smp.h
new file mode 100644
index 0000000..9877f0d
--- /dev/null
+++ b/include/ubixos/smp.h
@@ -0,0 +1,76 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _SMP_H
+#define _SMP_H
+
+#include
+
+struct cpuinfo_t {
+ uInt8 id;
+ uInt8 ok; // 1=Ok, 0=Bad
+ uInt8 apic_id,apic_ver;
+ uInt32 signature; // Family, Model, Stepping
+ uInt32 feature;
+ uInt32 max;
+ char brand[49]; // Brand name
+ char ident[17];
+ };
+
+
+void smpInit();
+void cpuidDetect();
+uInt8 cpuInfo();
+uInt32 getEflags();
+void setEflags(uInt32);
+void cpuid(uInt32,uInt32 *);
+void apicMagic();
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:52 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:14 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:37 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:56 reddawg
+ no message
+
+ Revision 1.2 2004/05/21 15:20:00 reddawg
+ Cleaned up
+
+
+ END
+ ***/
diff --git a/include/ubixos/spinlock.h b/include/ubixos/spinlock.h
new file mode 100644
index 0000000..a7b4ba6
--- /dev/null
+++ b/include/ubixos/spinlock.h
@@ -0,0 +1,55 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _SPINLOCK_H
+#define _SPINLOCK_H
+
+#include
+
+#define SPIN_LOCK_INITIALIZER 0
+
+typedef volatile int spinLock_t;
+
+extern spinLock_t Master;
+
+void spinLockInit(spinLock_t *);
+void spinUnlock(spinLock_t *);
+int spinTryLock(spinLock_t *);
+void spinLock(spinLock_t *);
+
+void spinLock_scheduler(spinLock_t *); /* Only use this spinlock in the sched. */
+
+int spinLockLocked(spinLock_t *);
+
+#endif
+
+/***
+ END
+ ***/
+
diff --git a/include/ubixos/static.h b/include/ubixos/static.h
new file mode 100644
index 0000000..94fe513
--- /dev/null
+++ b/include/ubixos/static.h
@@ -0,0 +1,6 @@
+#ifndef _UBIXOS_STATIC_H
+#define _UBIXOS_STATIC_H
+
+int static_constructors(void);
+
+#endif
diff --git a/include/ubixos/syscall.h b/include/ubixos/syscall.h
new file mode 100644
index 0000000..0766b0d
--- /dev/null
+++ b/include/ubixos/syscall.h
@@ -0,0 +1,66 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _SYSCALL_H
+#define _SYSCALL_H
+
+#include
+
+void _sysCall();
+void _sysCall_new();
+void invalidCall();
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:52 reddawg
+ UbixOS
+
+ Revision 1.2 2006/10/26 23:52:02 reddawg
+ Cleaned
+
+ Revision 1.1.1.1 2006/06/01 12:46:14 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:37 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:56 reddawg
+ no message
+
+ Revision 1.3 2004/07/05 23:06:32 reddawg
+ Fixens
+
+ Revision 1.2 2004/05/21 15:20:00 reddawg
+ Cleaned up
+
+
+ END
+ ***/
diff --git a/include/ubixos/syscalls.h b/include/ubixos/syscalls.h
new file mode 100644
index 0000000..5619338
--- /dev/null
+++ b/include/ubixos/syscalls.h
@@ -0,0 +1,178 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _SYSCALLS_H
+#define _SYSCALLS_H
+
+#include
+#include
+
+void sysAuth();
+void sysPasswd();
+void sysAddModule();
+void sysRmModule();
+void sysGetpid();
+void sysExit();
+void sysExec();
+int sys_exec();
+void sysFork();
+void sysCheckPid();
+void sysGetFreePage();
+
+void sysFwrite();
+void sysFgetc();
+void sysFopen();
+void sysFread();
+void sysFclose();
+void sysSchedYield();
+void sysFseek();
+void sysMkDir();
+void sysRmDir();
+void sysGetUid();
+void sysGetGid();
+void sysSetUid();
+void sysSetGid();
+void sysSDE();
+void sysGetDrives();
+void sysGetCwd();
+void sysChDir();
+void sysGetUptime();
+void sysGetTime();
+void sysStartSDE();
+void sysUnlink();
+void sysMpiCreateMbox();
+void sysMpiDestroyMbox();
+void sysMpiPostMessage();
+void sysMpiFetchMessage();
+void sysMpiSpam();
+
+typedef void (*functionPTR)();
+
+functionPTR systemCalls[] = {
+ invalidCall, /** 0 **/
+ sysGetpid, /** 1 **/
+ sysExit, /** 2 **/
+ sysExec, /** 3 **/
+ sysFork, /** 4 **/
+ sysFgetc, /** 5 **/
+ sysCheckPid, /** 6 **/
+ sysGetFreePage, /** 7 **/
+ sysFopen, /** 8 **/
+ invalidCall, /** 9 **/
+ sysFclose, /** 10 **/
+ sysSchedYield, /** 11 **/
+ invalidCall, /** 12 **/
+ invalidCall, /** 13 **/
+ invalidCall, /** 14 **/
+ sys_exec, /** 15 **/
+ invalidCall, /** 16 **/
+ invalidCall, /** 17 **/
+ invalidCall, /** 18 **/
+ invalidCall, /** 19 **/
+ sysFopen, /** 20 Opens A File Node **/
+ sysFclose, /** 21 Closes A File Node **/
+ sysFread, /** 22 File Read **/
+ sysFwrite, /** 23 File Write **/
+ sysMkDir, /** 24 Make Directory **/
+ sysRmDir, /** 25 Remove Directory **/
+ sysGetCwd, /** 26 Get Current Working Dir **/
+ sysFseek, /** 27 Set FD Position **/
+ sysChDir, /** 28 Change Dir **/
+ sysMkDir, /** 29 Create Directory **/
+ sysUnlink, /** 30 Unlink **/
+ sysGetUid, /** 31 Get User Id **/
+ sysGetGid, /** 32 Get Group Id **/
+ sysSetUid, /** 33 Set User Id **/
+ sysSetGid, /** 34 Set Group Id **/
+ sysAuth, /** 35 Authenticates the user **/
+ sysPasswd, /** 36 Change user password **/
+ sysAddModule, /** 37 Add Kernel Module **/
+ sysRmModule, /** 38 Remove Kernel Module **/
+ invalidCall, /** 39 **/
+ //sysSDE, /** 40 SDE Kernel Interface **/
+ invalidCall, /** 40 **/
+ invalidCall, /** 41 **/
+ invalidCall, /** 42 **/
+ invalidCall, /** 43 **/
+ invalidCall, /** 44 **/
+ sysGetDrives, /** 45 Get Drives **/
+ sysGetUptime, /** 46 Get Uptime **/
+ sysGetTime, /** 47 Get Time **/
+ sysStartSDE, /** 48 start SDE **/
+ invalidCall, /** 49 **/
+ sysMpiCreateMbox, /** 50 mpiCreateMbox **/
+ sysMpiDestroyMbox, /** 51 mpiDestroyMbox **/
+ sysMpiPostMessage, /** 52 mpiPostMessage **/
+ sysMpiFetchMessage, /** 53 mpiFetchMessage **/
+ sysMpiSpam, /** 54 mpiSpam **/
+ };
+
+int totalCalls = sizeof(systemCalls)/sizeof(functionPTR);
+
+#endif
+
+/***
+ $Log$
+ Revision 1.2 2008/02/29 14:56:31 reddawg
+ Sync - Working On Getting It To Boot Again
+
+ Revision 1.1.1.1 2007/01/17 03:31:52 reddawg
+ UbixOS
+
+ Revision 1.3 2006/12/19 14:12:54 reddawg
+ rtld-elf almost workign
+
+ Revision 1.2 2006/10/12 17:05:44 reddawg
+ Removing SDE
+
+ Revision 1.1.1.1 2006/06/01 12:46:14 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:37 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:56 reddawg
+ no message
+
+ Revision 1.5 2005/08/04 22:48:39 fsdfs
+
+ added 4 new syscalls: sysAuth(), sysPasswd(), sysAddModule(), sysRmModule()
+
+ Revision 1.4 2004/05/26 15:39:22 reddawg
+ mpi: brought mpiDestroyMbox(char *name) in to the userland
+
+ Revision 1.3 2004/05/25 15:42:19 reddawg
+ Enabled mpiSpam();
+
+ Revision 1.2 2004/05/21 15:20:00 reddawg
+ Cleaned up
+
+
+ END
+ ***/
diff --git a/include/ubixos/syscalls_new.h b/include/ubixos/syscalls_new.h
new file mode 100644
index 0000000..9008e43
--- /dev/null
+++ b/include/ubixos/syscalls_new.h
@@ -0,0 +1,532 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _SYSCALLS_NEW_H
+#define _SYSCALLS_NEW_H
+
+#include
+
+int sysExit();
+int getpid();
+int fcntl();
+int issetugid();
+int __sysctl();
+int pipe();
+int readlink();
+int getuid();
+int getgid();
+int mmap();
+int obreak();
+int sigaction();
+int getdtablesize();
+int munmap();
+int sigprocmask();
+int gettimeofday_new();
+int stat();
+int fstat();
+int lstat();
+int ioctl();
+
+#define invalid_call 0x0
+#define PSL_C 0x00000001 /* carry bit */
+#define EJUSTRETURN (-2) /* don't modify regs, just return */
+#define ERESTART (-1) /* restart syscall */
+
+typedef int (*functionPTR)();
+
+/*!
+ * \brief Mast System Call List
+ */
+functionPTR systemCalls_new[] = {
+ invalid_call, /** 0 **/
+ sysExit, /** 1 **/
+ fork, /** 2 **/
+ read, /** 3 **/
+ write, /** 4 **/
+ open, /** 5 **/
+ close, /** 6 **/
+ invalid_call, /** 7 **/
+ invalid_call, /** 8 **/
+ invalid_call, /** 9 **/
+ invalid_call, /** 10 **/
+ invalid_call, /** 11 **/
+ invalid_call, /** 12 **/
+ invalid_call, /** 13 **/
+ invalid_call, /** 14 **/
+ invalid_call, /** 15 **/
+ invalid_call, /** 16 **/
+ obreak, /** 17 **/
+ invalid_call, /** 18 **/
+ invalid_call, /** 19 **/
+ getpid, /** 20 **/
+ invalid_call, /** 21 **/
+ invalid_call, /** 22 **/
+ invalid_call, /** 23 **/
+ getuid, /** 24 **/
+ invalid_call, /** 25 **/
+ invalid_call, /** 26 **/
+ invalid_call, /** 27 **/
+ invalid_call, /** 28 **/
+ invalid_call, /** 29 **/
+ invalid_call, /** 30 **/
+ invalid_call, /** 31 **/
+ invalid_call, /** 32 **/
+ access, /** 33 **/
+ invalid_call, /** 34 **/
+ invalid_call, /** 35 **/
+ invalid_call, /** 36 **/
+ invalid_call, /** 37 **/
+ invalid_call, /** 38 **/
+ invalid_call, /** 39 **/
+ invalid_call, /** 40 **/
+ invalid_call, /** 41 **/
+ pipe, /** 42 **/
+ invalid_call, /** 43 **/
+ invalid_call, /** 44 **/
+ invalid_call, /** 45 **/
+ invalid_call, /** 46 **/
+ getgid, /** 47 **/
+ invalid_call, /** 48 **/
+ invalid_call, /** 49 **/
+ invalid_call, /** 50 **/
+ invalid_call, /** 51 **/
+ invalid_call, /** 52 **/
+ invalid_call, /** 53 **/
+ ioctl, /** 54 **/
+ invalid_call, /** 55 **/
+ invalid_call, /** 56 **/
+ invalid_call, /** 57 **/
+ readlink, /** 58 **/
+ invalid_call, /** 59 **/
+ invalid_call, /** 60 **/
+ invalid_call, /** 61 **/
+ invalid_call, /** 62 **/
+ invalid_call, /** 63 **/
+ invalid_call, /** 64 **/
+ invalid_call, /** 65 **/
+ invalid_call, /** 66 **/
+ invalid_call, /** 67 **/
+ invalid_call, /** 68 **/
+ invalid_call, /** 69 **/
+ invalid_call, /** 70 **/
+ invalid_call, /** 71 **/
+ invalid_call, /** 72 **/
+ munmap, /** 73 **/
+ mprotect, /** 74 **/
+ invalid_call, /** 75 **/
+ invalid_call, /** 76 **/
+ invalid_call, /** 77 **/
+ invalid_call, /** 78 **/
+ invalid_call, /** 79 **/
+ invalid_call, /** 80 **/
+ invalid_call, /** 81 **/
+ invalid_call, /** 82 **/
+ setitimer, /** 83 **/
+ invalid_call, /** 84 **/
+ invalid_call, /** 85 **/
+ invalid_call, /** 86 **/
+ invalid_call, /** 87 **/
+ invalid_call, /** 88 **/
+ getdtablesize, /** 89 **/
+ invalid_call, /** 90 **/
+ invalid_call, /** 91 **/
+ fcntl, /** 92 **/
+ invalid_call, /** 93 **/
+ invalid_call, /** 94 **/
+ invalid_call, /** 95 **/
+ invalid_call, /** 96 **/
+ invalid_call, /** 97 **/
+ invalid_call, /** 98 **/
+ invalid_call, /** 99 **/
+ invalid_call, /** 100 **/
+ invalid_call, /** 101 **/
+ invalid_call, /** 102 **/
+ invalid_call, /** 103 **/
+ invalid_call, /** 104 **/
+ invalid_call, /** 105 **/
+ invalid_call, /** 106 **/
+ invalid_call, /** 107 **/
+ invalid_call, /** 108 **/
+ invalid_call, /** 109 **/
+ invalid_call, /** 110 **/
+ invalid_call, /** 111 **/
+ invalid_call, /** 112 **/
+ invalid_call, /** 113 **/
+ invalid_call, /** 114 **/
+ invalid_call, /** 115 **/
+ gettimeofday_new, /** 116 **/
+ invalid_call, /** 117 **/
+ invalid_call, /** 118 **/
+ invalid_call, /** 119 **/
+ invalid_call, /** 120 **/
+ invalid_call, /** 121 **/
+ invalid_call, /** 122 **/
+ invalid_call, /** 123 **/
+ invalid_call, /** 124 **/
+ invalid_call, /** 125 **/
+ invalid_call, /** 126 **/
+ invalid_call, /** 127 **/
+ invalid_call, /** 128 **/
+ invalid_call, /** 129 **/
+ invalid_call, /** 130 **/
+ invalid_call, /** 131 **/
+ invalid_call, /** 132 **/
+ invalid_call, /** 133 **/
+ invalid_call, /** 134 **/
+ invalid_call, /** 135 **/
+ invalid_call, /** 136 **/
+ invalid_call, /** 137 **/
+ invalid_call, /** 138 **/
+ invalid_call, /** 139 **/
+ invalid_call, /** 140 **/
+ invalid_call, /** 141 **/
+ invalid_call, /** 142 **/
+ invalid_call, /** 143 **/
+ invalid_call, /** 144 **/
+ invalid_call, /** 145 **/
+ invalid_call, /** 146 **/
+ invalid_call, /** 147 **/
+ invalid_call, /** 148 **/
+ invalid_call, /** 149 **/
+ invalid_call, /** 150 **/
+ invalid_call, /** 151 **/
+ invalid_call, /** 152 **/
+ invalid_call, /** 153 **/
+ invalid_call, /** 154 **/
+ invalid_call, /** 155 **/
+ invalid_call, /** 156 **/
+ invalid_call, /** 157 **/
+ invalid_call, /** 158 **/
+ invalid_call, /** 159 **/
+ invalid_call, /** 160 **/
+ invalid_call, /** 161 **/
+ invalid_call, /** 162 **/
+ invalid_call, /** 163 **/
+ invalid_call, /** 164 **/
+ invalid_call, /** 165 **/
+ invalid_call, /** 166 **/
+ invalid_call, /** 167 **/
+ invalid_call, /** 168 **/
+ invalid_call, /** 169 **/
+ invalid_call, /** 170 **/
+ invalid_call, /** 171 **/
+ invalid_call, /** 172 **/
+ invalid_call, /** 173 **/
+ invalid_call, /** 174 **/
+ invalid_call, /** 175 **/
+ invalid_call, /** 176 **/
+ invalid_call, /** 177 **/
+ invalid_call, /** 178 **/
+ invalid_call, /** 179 **/
+ invalid_call, /** 180 **/
+ invalid_call, /** 181 **/
+ invalid_call, /** 182 **/
+ invalid_call, /** 183 **/
+ invalid_call, /** 184 **/
+ invalid_call, /** 185 **/
+ invalid_call, /** 186 **/
+ invalid_call, /** 187 **/
+ stat, /** 188 **/
+ fstat, /** 189 **/
+ lstat, /** 190 **/
+ invalid_call, /** 191 **/
+ invalid_call, /** 192 **/
+ invalid_call, /** 193 **/
+ invalid_call, /** 194 **/
+ invalid_call, /** 195 **/
+ invalid_call, /** 196 **/
+ mmap, /** 197 **/
+ invalid_call, /** 198 **/
+ lseek, /** 199 **/
+ invalid_call, /** 200 **/
+ invalid_call, /** 201 **/
+ __sysctl, /** 202 **/
+ invalid_call, /** 203 **/
+ invalid_call, /** 204 **/
+ invalid_call, /** 205 **/
+ invalid_call, /** 206 **/
+ invalid_call, /** 207 **/
+ invalid_call, /** 208 **/
+ invalid_call, /** 209 **/
+ invalid_call, /** 210 **/
+ invalid_call, /** 211 **/
+ invalid_call, /** 212 **/
+ invalid_call, /** 213 **/
+ invalid_call, /** 214 **/
+ invalid_call, /** 215 **/
+ invalid_call, /** 216 **/
+ invalid_call, /** 217 **/
+ invalid_call, /** 218 **/
+ invalid_call, /** 219 **/
+ invalid_call, /** 220 **/
+ invalid_call, /** 221 **/
+ invalid_call, /** 222 **/
+ invalid_call, /** 223 **/
+ invalid_call, /** 224 **/
+ invalid_call, /** 225 **/
+ invalid_call, /** 226 **/
+ invalid_call, /** 227 **/
+ invalid_call, /** 228 **/
+ invalid_call, /** 229 **/
+ invalid_call, /** 230 **/
+ invalid_call, /** 231 **/
+ invalid_call, /** 232 **/
+ invalid_call, /** 233 **/
+ invalid_call, /** 234 **/
+ invalid_call, /** 235 **/
+ invalid_call, /** 236 **/
+ invalid_call, /** 237 **/
+ invalid_call, /** 238 **/
+ invalid_call, /** 239 **/
+ invalid_call, /** 240 **/
+ invalid_call, /** 241 **/
+ invalid_call, /** 242 **/
+ invalid_call, /** 243 **/
+ invalid_call, /** 244 **/
+ invalid_call, /** 245 **/
+ invalid_call, /** 246 **/
+ invalid_call, /** 247 **/
+ invalid_call, /** 248 **/
+ invalid_call, /** 249 **/
+ invalid_call, /** 250 **/
+ invalid_call, /** 251 **/
+ invalid_call, /** 252 **/
+ issetugid, /** 253 **/
+ invalid_call, /** 254 **/
+ invalid_call, /** 255 **/
+ invalid_call, /** 256 **/
+ invalid_call, /** 257 **/
+ invalid_call, /** 258 **/
+ invalid_call, /** 259 **/
+ invalid_call, /** 260 **/
+ invalid_call, /** 261 **/
+ invalid_call, /** 262 **/
+ invalid_call, /** 263 **/
+ invalid_call, /** 264 **/
+ invalid_call, /** 265 **/
+ invalid_call, /** 266 **/
+ invalid_call, /** 267 **/
+ invalid_call, /** 268 **/
+ invalid_call, /** 269 **/
+ invalid_call, /** 270 **/
+ invalid_call, /** 271 **/
+ invalid_call, /** 272 **/
+ invalid_call, /** 273 **/
+ invalid_call, /** 274 **/
+ invalid_call, /** 275 **/
+ invalid_call, /** 276 **/
+ invalid_call, /** 277 **/
+ invalid_call, /** 278 **/
+ invalid_call, /** 279 **/
+ invalid_call, /** 280 **/
+ invalid_call, /** 281 **/
+ invalid_call, /** 282 **/
+ invalid_call, /** 283 **/
+ invalid_call, /** 284 **/
+ invalid_call, /** 285 **/
+ invalid_call, /** 286 **/
+ invalid_call, /** 287 **/
+ invalid_call, /** 288 **/
+ invalid_call, /** 289 **/
+ invalid_call, /** 290 **/
+ invalid_call, /** 291 **/
+ invalid_call, /** 292 **/
+ invalid_call, /** 293 **/
+ invalid_call, /** 294 **/
+ invalid_call, /** 295 **/
+ invalid_call, /** 296 **/
+ invalid_call, /** 297 **/
+ invalid_call, /** 298 **/
+ invalid_call, /** 299 **/
+ invalid_call, /** 300 **/
+ invalid_call, /** 301 **/
+ invalid_call, /** 302 **/
+ invalid_call, /** 303 **/
+ invalid_call, /** 304 **/
+ invalid_call, /** 305 **/
+ invalid_call, /** 306 **/
+ invalid_call, /** 307 **/
+ invalid_call, /** 308 **/
+ invalid_call, /** 309 **/
+ invalid_call, /** 310 **/
+ invalid_call, /** 311 **/
+ invalid_call, /** 312 **/
+ invalid_call, /** 313 **/
+ invalid_call, /** 314 **/
+ invalid_call, /** 315 **/
+ invalid_call, /** 316 **/
+ invalid_call, /** 317 **/
+ invalid_call, /** 318 **/
+ invalid_call, /** 319 **/
+ invalid_call, /** 320 **/
+ invalid_call, /** 321 **/
+ invalid_call, /** 322 **/
+ invalid_call, /** 323 **/
+ invalid_call, /** 324 **/
+ invalid_call, /** 325 **/
+ invalid_call, /** 326 **/
+ invalid_call, /** 327 **/
+ invalid_call, /** 328 **/
+ invalid_call, /** 329 **/
+ invalid_call, /** 330 **/
+ invalid_call, /** 331 **/
+ invalid_call, /** 332 **/
+ invalid_call, /** 333 **/
+ invalid_call, /** 334 **/
+ invalid_call, /** 335 **/
+ invalid_call, /** 336 **/
+ invalid_call, /** 337 **/
+ invalid_call, /** 338 **/
+ invalid_call, /** 339 **/
+ sigprocmask, /** 340 **/
+ invalid_call, /** 341 **/
+ invalid_call, /** 342 **/
+ invalid_call, /** 343 **/
+ invalid_call, /** 344 **/
+ invalid_call, /** 345 **/
+ invalid_call, /** 346 **/
+ invalid_call, /** 347 **/
+ invalid_call, /** 348 **/
+ invalid_call, /** 349 **/
+ invalid_call, /** 350 **/
+ invalid_call, /** 351 **/
+ invalid_call, /** 352 **/
+ invalid_call, /** 353 **/
+ invalid_call, /** 354 **/
+ invalid_call, /** 355 **/
+ invalid_call, /** 356 **/
+ invalid_call, /** 357 **/
+ invalid_call, /** 358 **/
+ invalid_call, /** 359 **/
+ invalid_call, /** 360 **/
+ invalid_call, /** 361 **/
+ invalid_call, /** 362 **/
+ invalid_call, /** 363 **/
+ invalid_call, /** 364 **/
+ invalid_call, /** 365 **/
+ invalid_call, /** 366 **/
+ invalid_call, /** 367 **/
+ invalid_call, /** 368 **/
+ invalid_call, /** 369 **/
+ invalid_call, /** 370 **/
+ invalid_call, /** 371 **/
+ invalid_call, /** 372 **/
+ invalid_call, /** 373 **/
+ invalid_call, /** 374 **/
+ invalid_call, /** 375 **/
+ invalid_call, /** 376 **/
+ invalid_call, /** 377 **/
+ invalid_call, /** 378 **/
+ invalid_call, /** 379 **/
+ invalid_call, /** 380 **/
+ invalid_call, /** 381 **/
+ invalid_call, /** 382 **/
+ invalid_call, /** 383 **/
+ invalid_call, /** 384 **/
+ invalid_call, /** 385 **/
+ invalid_call, /** 386 **/
+ invalid_call, /** 387 **/
+ invalid_call, /** 388 **/
+ invalid_call, /** 389 **/
+ invalid_call, /** 390 **/
+ invalid_call, /** 391 **/
+ invalid_call, /** 392 **/
+ invalid_call, /** 393 **/
+ invalid_call, /** 394 **/
+ invalid_call, /** 395 **/
+ invalid_call, /** 396 **/
+ fstatfs, /** 397 **/
+ invalid_call, /** 398 **/
+ invalid_call, /** 399 **/
+ invalid_call, /** 400 **/
+ invalid_call, /** 401 **/
+ invalid_call, /** 402 **/
+ invalid_call, /** 403 **/
+ invalid_call, /** 404 **/
+ invalid_call, /** 405 **/
+ invalid_call, /** 406 **/
+ invalid_call, /** 407 **/
+ invalid_call, /** 408 **/
+ invalid_call, /** 409 **/
+ invalid_call, /** 410 **/
+ invalid_call, /** 411 **/
+ invalid_call, /** 412 **/
+ invalid_call, /** 413 **/
+ invalid_call, /** 414 **/
+ invalid_call, /** 415 **/
+ sigaction, /** 416 **/
+ invalid_call, /** 417 **/
+ invalid_call, /** 418 **/
+ invalid_call, /** 419 **/
+ invalid_call, /** 420 **/
+ invalid_call, /** 421 **/
+ invalid_call, /** 422 **/
+ invalid_call, /** 423 **/
+ invalid_call, /** 424 **/
+ invalid_call, /** 425 **/
+ invalid_call, /** 426 **/
+ invalid_call, /** 427 **/
+ invalid_call, /** 428 **/
+ invalid_call, /** 429 **/
+ invalid_call, /** 430 **/
+ invalid_call, /** 431 **/
+ invalid_call, /** 432 **/
+ invalid_call, /** 433 **/
+ invalid_call, /** 434 **/
+ invalid_call, /** 435 **/
+ invalid_call, /** 436 **/
+ invalid_call, /** 437 **/
+ invalid_call, /** 438 **/
+ invalid_call, /** 439 **/
+ invalid_call, /** 440 **/
+ invalid_call, /** 441 **/
+ invalid_call, /** 442 **/
+ invalid_call, /** 443 **/
+ invalid_call, /** 444 **/
+ invalid_call, /** 445 **/
+ invalid_call, /** 446 **/
+ invalid_call, /** 447 **/
+ invalid_call, /** 448 **/
+ invalid_call, /** 449 **/
+ invalid_call, /** 450 **/
+ invalid_call, /** 451 **/
+ invalid_call, /** 452 **/
+ invalid_call, /** 453 **/
+ invalid_call, /** 454 **/
+ invalid_call, /** 455 **/
+ };
+
+int totalCalls_new = sizeof(systemCalls_new)/sizeof(functionPTR);
+
+#endif
+
+/***
+ END
+ ***/
+
diff --git a/include/ubixos/systemtask.h b/include/ubixos/systemtask.h
new file mode 100644
index 0000000..1ab2778
--- /dev/null
+++ b/include/ubixos/systemtask.h
@@ -0,0 +1,64 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _SYSTEMTASK_H
+#define _SYSTEMTASK_H
+
+#include
+
+void systemTask();
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:52 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:14 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:37 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:56 reddawg
+ no message
+
+ Revision 1.2 2004/06/04 17:49:32 reddawg
+ Wont work with out the makefile updated
+
+ Revision 1.1 2004/06/04 17:33:33 reddawg
+ Changed idle task to system task
+
+ Revision 1.2 2004/05/21 15:20:00 reddawg
+ Cleaned up
+
+
+ END
+ ***/
diff --git a/include/ubixos/time.h b/include/ubixos/time.h
new file mode 100644
index 0000000..7762767
--- /dev/null
+++ b/include/ubixos/time.h
@@ -0,0 +1,111 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _TIME_H
+#define _TIME_H
+
+#include
+#include
+
+typedef long suseconds_t;
+
+#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
+
+#define MINUTE 60
+#define HOUR (60*MINUTE)
+#define DAY (24*HOUR)
+#define YEAR (365*DAY)
+
+#ifndef _TIME_T_DECLARED
+typedef __time_t time_t;
+#define _TIME_T_DECLARED
+#endif
+
+struct timespec {
+ time_t tv_sec; /* seconds */
+ long tv_nsec; /* and nanoseconds */
+};
+
+
+
+struct timeStruct {
+ int sec;
+ int min;
+ int hour;
+ int day;
+ int mon;
+ int year;
+ };
+
+
+struct timezone {
+ int tz_minuteswest; /* minutes west of Greenwich */
+ int tz_dsttime; /* type of dst correction */
+ };
+
+struct timeval {
+ long tv_sec; /* seconds (XXX should be time_t) */
+ suseconds_t tv_usec; /* and microseconds */
+ };
+
+int gettimeofday(struct timeval *tp,struct timezone *tzp);
+
+
+
+int time_init();
+uInt32 timeMake(struct timeStruct *time);
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:52 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:14 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:37 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:56 reddawg
+ no message
+
+ Revision 1.4 2004/07/09 13:37:30 reddawg
+ time: timeInit to time_init
+ Adjusted initialization routines
+
+ Revision 1.3 2004/06/29 11:41:44 reddawg
+ Fixed some global variables
+
+ Revision 1.2 2004/05/21 15:20:00 reddawg
+ Cleaned up
+
+ END
+ ***/
diff --git a/include/ubixos/times.h b/include/ubixos/times.h
new file mode 100644
index 0000000..9360513
--- /dev/null
+++ b/include/ubixos/times.h
@@ -0,0 +1,69 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _TIMES_H
+#define _TIMES_H
+
+#include
+#include
+
+#ifndef _CLOCK_T_DECLARED
+typedef __clock_t clock_t;
+#define _CLOCK_T_DECLARED
+#endif
+
+struct tms {
+ clock_t tms_utime; /* User CPU time */
+ clock_t tms_stime; /* System CPU time */
+ clock_t tms_cutime; /* User CPU time of terminated child procs */
+ clock_t tms_cstime; /* System CPU time of terminated child procs */
+};
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:52 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:14 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:37 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:57 reddawg
+ no message
+
+ Revision 1.2 2004/05/21 15:20:00 reddawg
+ Cleaned up
+
+
+ END
+ ***/
diff --git a/include/ubixos/tty.h b/include/ubixos/tty.h
new file mode 100644
index 0000000..178a999
--- /dev/null
+++ b/include/ubixos/tty.h
@@ -0,0 +1,59 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _TTY_H
+#define _TTY_H
+
+#include
+
+#define TTY_MAX_TERMS 12
+
+typedef struct tty_termNode {
+ char *tty_buffer;
+ char *tty_pointer;
+ uInt8 tty_colour;
+ uInt16 tty_x;
+ uInt16 tty_y;
+ pidType owner;
+ char stdin[512];
+ int stdinSize;
+ } tty_term;
+
+int tty_init();
+int tty_change(uInt16);
+tty_term *tty_find(u_int16_t tty);
+int tty_print(char *,tty_term *);
+
+extern tty_term *tty_foreground;
+
+#endif
+
+/***
+ END
+ ***/
diff --git a/include/ubixos/types.h b/include/ubixos/types.h
new file mode 100644
index 0000000..f5a7344
--- /dev/null
+++ b/include/ubixos/types.h
@@ -0,0 +1,118 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _TYPES_H
+#define _TYPES_H
+
+#include
+
+#ifndef NULL
+#define NULL 0x0
+#endif
+
+typedef unsigned char uInt8;
+typedef unsigned short uInt16;
+typedef unsigned int uInt32;
+typedef unsigned int uInt;
+typedef char Int8;
+typedef short Int16;
+typedef long Int32;
+
+typedef __uint8_t u_int8_t; /* unsigned integrals (deprecated) */
+typedef __uint16_t u_int16_t;
+typedef __uint32_t u_int32_t;
+typedef __uint64_t u_int64_t;
+//typedef long long int quad_t;
+typedef __uint64_t quad_t;
+
+typedef unsigned char u_char;
+typedef unsigned short u_short;
+typedef unsigned int u_int;
+typedef unsigned long u_long;
+
+
+typedef int pidType;
+
+typedef int pid_t;
+typedef int size_t; /* standart */
+
+#ifndef NOBOOL
+#ifndef __cplusplus
+typedef enum { FALSE=0,TRUE=1 } bool;
+#endif
+#endif
+
+#ifndef _INO_T_DECLARED
+typedef __ino_t ino_t; /* inode number */
+#define _INO_T_DECLARED
+#endif
+
+#ifndef _INT8_T_DECLARED
+typedef __int8_t int8_t;
+#define _INT8_T_DECLARED
+#endif
+
+#ifndef _INT16_T_DECLARED
+typedef __int16_t int16_t;
+#define _INT16_T_DECLARED
+#endif
+
+#ifndef _INT32_T_DECLARED
+typedef __int32_t int32_t;
+#define _INT32_T_DECLARED
+#endif
+
+#ifndef _INT64_T_DECLARED
+typedef __int64_t int64_t;
+#define _INT64_T_DECLARED
+#endif
+
+typedef __ssize_t ssize_t;
+typedef char * caddr_t;
+typedef __int64_t off_t;
+typedef __uint32_t vm_offset_t;
+
+typedef __uid_t uid_t; /* user id */
+typedef __gid_t gid_t; /* group id */
+typedef __blkcnt_t blkcnt_t;
+typedef __blksize_t blksize_t;
+typedef __fflags_t fflags_t;
+
+#ifndef _TIME_T_DECLARED
+typedef __time_t time_t;
+#define _TIME_T_DECLARED
+#endif
+
+
+#endif
+
+/***
+ END
+ ***/
+
diff --git a/include/ubixos/ubthread.h b/include/ubixos/ubthread.h
new file mode 100644
index 0000000..dc24b17
--- /dev/null
+++ b/include/ubixos/ubthread.h
@@ -0,0 +1,113 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _UBTHREAD_H
+#define _UBTHREAD_H
+
+#include
+#include
+#include
+
+#define ETIMEDOUT -1
+
+#define LOCKED 1
+#define UNLOCKED 0
+
+typedef struct ubthread *ubthread_t;
+typedef struct ubthread_cond *ubthread_cond_t;
+typedef struct ubthread_mutex *ubthread_mutex_t;
+
+struct ubthread {
+ kTask_t *task;
+ };
+
+struct ubthread_cond {
+ int id;
+ uInt8 locked;
+ };
+
+struct ubthread_mutex {
+ int id;
+ uInt8 locked;
+ pidType pid;
+ };
+
+struct ubthread_list {
+ struct ubthread_list *next;
+ ubthread_t thread;
+ };
+
+struct ubthread_cond_list {
+ struct ubthread_cond_list *next;
+ ubthread_cond_t *cond;
+ };
+
+struct ubthread_mutex_list {
+ struct ubthread_mutex_list *next;
+ ubthread_mutex_t *mutex;
+ };
+
+
+kTask_t *ubthread_self();
+int ubthread_cond_init(ubthread_cond_t *cond,const uInt32 attr);
+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 (* 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);
+int ubthread_cond_wait(ubthread_cond_t *cond, ubthread_mutex_t *mutex);
+int ubthread_cond_signal(ubthread_cond_t *cond);
+
+#endif
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:52 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:14 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:37 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:23:57 reddawg
+ no message
+
+ Revision 1.3 2004/09/07 20:58:35 reddawg
+ time to roll back i can't think straight by friday
+
+ Revision 1.2 2004/05/21 15:20:00 reddawg
+ Cleaned up
+
+
+ END
+ ***/
diff --git a/include/ubixos/vitals.h b/include/ubixos/vitals.h
new file mode 100644
index 0000000..dae04f0
--- /dev/null
+++ b/include/ubixos/vitals.h
@@ -0,0 +1,62 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _VITALS_H
+#define _VITALS_H
+
+//#include
+#include
+//#include
+#include
+
+typedef struct vitalsStruct {
+ uInt32 openFiles;
+ uInt32 sysTicks;
+ uInt32 sysUptime;
+ uInt32 quantum;
+ uInt32 dQuantum;
+ uInt32 freePages;
+ struct fileSystem *fileSystems;
+ struct vfs_mountPoint *mountPoints;
+ uInt32 timeStart;
+ void *screen;
+ void *font;
+ char *packet;
+ uInt32 packetLength;
+ } vitalsNode;
+
+extern vitalsNode *systemVitals;
+
+int vitals_init();
+
+#endif
+
+/***
+ END
+ ***/
diff --git a/include/ufs/ffs.h b/include/ufs/ffs.h
new file mode 100644
index 0000000..bb14acf
--- /dev/null
+++ b/include/ufs/ffs.h
@@ -0,0 +1,45 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _FFS_H
+#define _FFS_H
+
+#include
+#include
+#include
+#include
+
+int ffs_read(struct file *,char *,uInt32,long);
+
+#endif
+
+/***
+ END
+ ***/
+
diff --git a/include/ufs/ufs.h b/include/ufs/ufs.h
new file mode 100644
index 0000000..4a409f2
--- /dev/null
+++ b/include/ufs/ufs.h
@@ -0,0 +1,309 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _UFS_H
+#define _UFS_H
+
+#include
+#include
+#include
+#include
+
+
+#define DT_REG 8
+#define MAXNAMLEN 255
+#define ROOTINO ((ino_t)2)
+#define DT_DIR 4
+#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
+#define DEV_BSIZE (1<fs_nindir)
+
+/*
+ * Cylinder group macros to locate things in cylinder groups.
+ * They calc filesystem addresses of cylinder group data structures.
+ */
+#define cgbase(fs, c) (((ufs2_daddr_t)(fs)->fs_fpg) * (c))
+#define cgdmin(fs, c) (cgstart(fs, c) + (fs)->fs_dblkno) /* 1st data */
+#define cgimin(fs, c) (cgstart(fs, c) + (fs)->fs_iblkno) /* inode blk */
+#define cgsblock(fs, c) (cgstart(fs, c) + (fs)->fs_sblkno) /* super blk */
+#define cgtod(fs, c) (cgstart(fs, c) + (fs)->fs_cblkno) /* cg block */
+#define cgstart(fs, c) \
+ ((fs)->fs_magic == FS_UFS2_MAGIC ? cgbase(fs, c) : \
+ (cgbase(fs, c) + (fs)->fs_old_cgoffset * ((c) & ~((fs)->fs_old_cgmask))))
+
+
+#define fsbtodb(fs, b) ((daddr_t)(b) << (fs)->fs_fsbtodb)
+#define dbtofsb(fs, b) ((b) >> (fs)->fs_fsbtodb)
+
+/*
+ * Macros for handling inode numbers:
+ * inode number to filesystem block offset.
+ * inode number to cylinder group number.
+ * inode number to filesystem block address.
+ */
+#define ino_to_cg(fs, x) ((x) / (fs)->fs_ipg)
+#define ino_to_fsba(fs, x) \
+ ((ufs2_daddr_t)(cgimin(fs, ino_to_cg(fs, x)) + \
+ (blkstofrags((fs), (((x) % (fs)->fs_ipg) / INOPB(fs))))))
+#define ino_to_fsbo(fs, x) ((x) % INOPB(fs))
+
+
+#define blkoff(fs, loc) /* calculates (loc % fs->fs_bsize) */ \
+ ((loc) & (fs)->fs_qbmask)
+#define lblkno(fs, loc) /* calculates (loc / fs->fs_bsize) */ \
+ ((loc) >> (fs)->fs_bshift)
+#define fragroundup(fs, size) /* calculates roundup(size, fs->fs_fsize) */ \
+ (((size) + (fs)->fs_qfmask) & (fs)->fs_fmask)
+
+
+#define sblksize(fs, size, lbn) \
+ (((lbn) >= NDADDR || (size) >= ((lbn) + 1) << (fs)->fs_bshift) \
+ ? (fs)->fs_bsize \
+ : (fragroundup(fs, blkoff(fs, (size)))))
+
+
+
+
+typedef int32_t ufs1_daddr_t;
+typedef int64_t ufs2_daddr_t;
+typedef int64_t ufs_lbn_t;
+typedef int64_t ufs_time_t;
+typedef __int64_t daddr_t;
+
+struct dirent {
+ __uint32_t d_fileno; /* file number of entry */
+ __uint16_t d_reclen; /* length of this record */
+ __uint8_t d_type; /* file type, see below */
+ __uint8_t d_namlen; /* length of string in d_name */
+ char d_name[MAXNAMLEN + 1]; /* name must be no longer than this */
+ };
+
+#define NXADDR 2 /* External addresses in inode. */
+#define NDADDR 12 /* Direct addresses in inode. */
+#define NIADDR 3 /* Indirect addresses in inode. */
+
+struct ufs2_dinode {
+ u_int16_t di_mode; /* 0: IFMT, permissions; see below. */
+ int16_t di_nlink; /* 2: File link count. */
+ u_int32_t di_uid; /* 4: File owner. */
+ u_int32_t di_gid; /* 8: File group. */
+ u_int32_t di_blksize; /* 12: Inode blocksize. */
+ u_int64_t di_size; /* 16: File byte count. */
+ u_int64_t di_blocks; /* 24: Bytes actually held. */
+ ufs_time_t di_atime; /* 32: Last access time. */
+ ufs_time_t di_mtime; /* 40: Last modified time. */
+ ufs_time_t di_ctime; /* 48: Last inode change time. */
+ ufs_time_t di_birthtime; /* 56: Inode creation time. */
+ int32_t di_mtimensec; /* 64: Last modified time. */
+ int32_t di_atimensec; /* 68: Last access time. */
+ int32_t di_ctimensec; /* 72: Last inode change time. */
+ int32_t di_birthnsec; /* 76: Inode creation time. */
+ int32_t di_gen; /* 80: Generation number. */
+ u_int32_t di_kernflags; /* 84: Kernel flags. */
+ u_int32_t di_flags; /* 88: Status flags (chflags). */
+ int32_t di_extsize; /* 92: External attributes block. */
+ ufs2_daddr_t di_extb[NXADDR];/* 96: External attributes block. */
+ ufs2_daddr_t di_db[NDADDR]; /* 112: Direct disk blocks. */
+ ufs2_daddr_t di_ib[NIADDR]; /* 208: Indirect disk blocks. */
+ int64_t di_spare[3]; /* 232: Reserved; currently unused */
+ };
+
+struct ufs1_dinode {
+ u_int16_t di_mode; /* 0: IFMT, permissions; see below. */
+ int16_t di_nlink; /* 2: File link count. */
+ union {
+ u_int16_t oldids[2]; /* 4: Ffs: old user and group ids. */
+ } di_u;
+ u_int64_t di_size; /* 8: File byte count. */
+ int32_t di_atime; /* 16: Last access time. */
+ int32_t di_atimensec; /* 20: Last access time. */
+ int32_t di_mtime; /* 24: Last modified time. */
+ int32_t di_mtimensec; /* 28: Last modified time. */
+ int32_t di_ctime; /* 32: Last inode change time. */
+ int32_t di_ctimensec; /* 36: Last inode change time. */
+ ufs1_daddr_t di_db[NDADDR]; /* 40: Direct disk blocks. */
+ ufs1_daddr_t di_ib[NIADDR]; /* 88: Indirect disk blocks. */
+ u_int32_t di_flags; /* 100: Status flags (chflags). */
+ int32_t di_blocks; /* 104: Blocks actually held. */
+ int32_t di_gen; /* 108: Generation number. */
+ u_int32_t di_uid; /* 112: File owner. */
+ u_int32_t di_gid; /* 116: File group. */
+ int32_t di_spare[2]; /* 120: Reserved; currently unused */
+ };
+
+struct csum {
+ int32_t cs_ndir; /* number of directories */
+ int32_t cs_nbfree; /* number of free blocks */
+ int32_t cs_nifree; /* number of free inodes */
+ int32_t cs_nffree; /* number of free frags */
+};
+struct csum_total {
+ int64_t cs_ndir; /* number of directories */
+ int64_t cs_nbfree; /* number of free blocks */
+ int64_t cs_nifree; /* number of free inodes */
+ int64_t cs_nffree; /* number of free frags */
+ int64_t cs_numclusters; /* number of free clusters */
+ int64_t cs_spare[3]; /* future expansion */
+};
+
+
+struct fs {
+ int32_t fs_firstfield; /* historic filesystem linked list, */
+ int32_t fs_unused_1; /* used for incore super blocks */
+ int32_t fs_sblkno; /* offset of super-block in filesys */
+ int32_t fs_cblkno; /* offset of cyl-block in filesys */
+ int32_t fs_iblkno; /* offset of inode-blocks in filesys */
+ int32_t fs_dblkno; /* offset of first data after cg */
+ int32_t fs_old_cgoffset; /* cylinder group offset in cylinder */
+ int32_t fs_old_cgmask; /* used to calc mod fs_ntrak */
+ int32_t fs_old_time; /* last time written */
+ int32_t fs_old_size; /* number of blocks in fs */
+ int32_t fs_old_dsize; /* number of data blocks in fs */
+ int32_t fs_ncg; /* number of cylinder groups */
+ int32_t fs_bsize; /* size of basic blocks in fs */
+ int32_t fs_fsize; /* size of frag blocks in fs */
+ int32_t fs_frag; /* number of frags in a block in fs */
+/* these are configuration parameters */
+ int32_t fs_minfree; /* minimum percentage of free blocks */
+ int32_t fs_old_rotdelay; /* num of ms for optimal next block */
+ int32_t fs_old_rps; /* disk revolutions per second */
+/* these fields can be computed from the others */
+ int32_t fs_bmask; /* ``blkoff'' calc of blk offsets */
+ int32_t fs_fmask; /* ``fragoff'' calc of frag offsets */
+ int32_t fs_bshift; /* ``lblkno'' calc of logical blkno */
+ int32_t fs_fshift; /* ``numfrags'' calc number of frags */
+/* these are configuration parameters */
+ int32_t fs_maxcontig; /* max number of contiguous blks */
+ int32_t fs_maxbpg; /* max number of blks per cyl group */
+/* these fields can be computed from the others */
+ int32_t fs_fragshift; /* block to frag shift */
+ int32_t fs_fsbtodb; /* fsbtodb and dbtofsb shift constant */
+ int32_t fs_sbsize; /* actual size of super block */
+ int32_t fs_spare1[2]; /* old fs_csmask */
+ /* old fs_csshift */
+ int32_t fs_nindir; /* value of NINDIR */
+ int32_t fs_inopb; /* value of INOPB */
+ int32_t fs_old_nspf; /* value of NSPF */
+/* yet another configuration parameter */
+ int32_t fs_optim; /* optimization preference, see below */
+ int32_t fs_old_npsect; /* # sectors/track including spares */
+ int32_t fs_old_interleave; /* hardware sector interleave */
+ int32_t fs_old_trackskew; /* sector 0 skew, per track */
+ int32_t fs_id[2]; /* unique filesystem id */
+/* sizes determined by number of cylinder groups and their sizes */
+ int32_t fs_old_csaddr; /* blk addr of cyl grp summary area */
+ int32_t fs_cssize; /* size of cyl grp summary area */
+ int32_t fs_cgsize; /* cylinder group size */
+ int32_t fs_spare2; /* old fs_ntrak */
+ int32_t fs_old_nsect; /* sectors per track */
+ int32_t fs_old_spc; /* sectors per cylinder */
+ int32_t fs_old_ncyl; /* cylinders in filesystem */
+ int32_t fs_old_cpg; /* cylinders per group */
+ int32_t fs_ipg; /* inodes per group */
+ int32_t fs_fpg; /* blocks per group * fs_frag */
+/* this data must be re-computed after crashes */
+ struct csum fs_old_cstotal; /* cylinder summary information */
+/* these fields are cleared at mount time */
+ int8_t fs_fmod; /* super block modified flag */
+ int8_t fs_clean; /* filesystem is clean flag */
+ int8_t fs_ronly; /* mounted read-only flag */
+ int8_t fs_old_flags; /* old FS_ flags */
+ u_char fs_fsmnt[MAXMNTLEN]; /* name mounted on */
+ u_char fs_volname[MAXVOLLEN]; /* volume name */
+ u_int64_t fs_swuid; /* system-wide uid */
+ int32_t fs_pad; /* due to alignment of fs_swuid */
+/* these fields retain the current block allocation info */
+ int32_t fs_cgrotor; /* last cg searched */
+ void *fs_ocsp[NOCSPTRS]; /* padding; was list of fs_cs buffers */
+ u_int8_t *fs_contigdirs; /* (u) # of contig. allocated dirs */
+ struct csum *fs_csp; /* (u) cg summary info buffer */
+ int32_t *fs_maxcluster; /* (u) max cluster in each cyl group */
+ u_int *fs_active; /* (u) used by snapshots to track fs */
+ int32_t fs_old_cpc; /* cyl per cycle in postbl */
+ int32_t fs_maxbsize; /* maximum blocking factor permitted */
+ int64_t fs_sparecon64[17]; /* old rotation block list head */
+ int64_t fs_sblockloc; /* byte offset of standard superblock */
+ struct csum_total fs_cstotal; /* (u) cylinder summary information */
+ ufs_time_t fs_time; /* last time written */
+ int64_t fs_size; /* number of blocks in fs */
+ int64_t fs_dsize; /* number of data blocks in fs */
+ ufs2_daddr_t fs_csaddr; /* blk addr of cyl grp summary area */
+ int64_t fs_pendingblocks; /* (u) blocks being freed */
+ int32_t fs_pendinginodes; /* (u) inodes being freed */
+ int32_t fs_snapinum[FSMAXSNAP];/* list of snapshot inode numbers */
+ int32_t fs_avgfilesize; /* expected average file size */
+ int32_t fs_avgfpdir; /* expected # of files per directory */
+ int32_t fs_save_cgsize; /* save real cg size to use fs_bsize */
+ int32_t fs_sparecon32[26]; /* reserved for future constants */
+ int32_t fs_flags; /* see FS_ flags below */
+ int32_t fs_contigsumsize; /* size of cluster summary array */
+ int32_t fs_maxsymlinklen; /* max length of an internal symlink */
+ int32_t fs_old_inodefmt; /* format of on-disk inodes */
+ u_int64_t fs_maxfilesize; /* maximum representable file size */
+ int64_t fs_qbmask; /* ~fs_bmask for use with 64-bit size */
+ int64_t fs_qfmask; /* ~fs_fmask for use with 64-bit size */
+ int32_t fs_state; /* validate fs_clean field */
+ int32_t fs_old_postblformat; /* format of positional layout tables */
+ int32_t fs_old_nrpos; /* number of rotational positions */
+ int32_t fs_spare5[2]; /* old fs_postbloff */
+ /* old fs_rotbloff */
+ int32_t fs_magic; /* magic number */
+};
+
+struct ufs_obj {
+ u_int32_t ino;
+ struct cacheNode *cacheNode;
+ struct dmadat *dmadat;
+ int dsk_meta;
+ u_int32_t resid;
+ };
+
+int ufs_init();
+int ufs_initialize();
+
+#endif
+
+/***
+ END
+ ***/
+
diff --git a/include/vfs/file.h b/include/vfs/file.h
new file mode 100644
index 0000000..e18a1a5
--- /dev/null
+++ b/include/vfs/file.h
@@ -0,0 +1,85 @@
+/**************************************************************************************
+ Copyright (c) 2002 The UbixOS Project
+ All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list of conditions, the following disclaimer and the list of authors.
+Redistributions in binary form must reproduce the above copyright notice, this list of conditions, the following disclaimer and the list of authors
+in the documentation and/or other materials provided with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+**************************************************************************************/
+
+#ifndef _FILE_H
+#define _FILE_H
+
+#include
+#include
+#include
+
+#define VBLKSHIFT 12
+#define VBLKSIZE (1 << VBLKSHIFT)
+#define SBLOCKSIZE 8192
+#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
+#define DEV_BSIZE (1<
+
+typedef struct userFileDescriptorStruct {
+ struct file *fd;
+ uInt32 fdSize;
+ } userFileDescriptor;
+
+extern fileDescriptor *fdTable;
+
+struct file *fopen(struct file *,const char *,const char *);
+int fclose(struct file *);
+
+/* UBU */
+
+
+int unlink(const char *path);
+int feof(struct file *fd);
+int fgetc(struct file *fd);
+size_t fread(void *ptr,size_t size,size_t nmemb,struct file *fd);
+size_t fwrite(void *ptr,int size,int nmemb,struct file *fd);
+int fseek(struct file *,long,int);
+
+void sysFseek(userFileDescriptor *,long,int);
+
+//Good
+void sysChDir(const char *path);
+void chDir(const char *path);
+char *verifyDir(const char *path);
+
+#endif
diff --git a/include/vfs/mount.h b/include/vfs/mount.h
new file mode 100644
index 0000000..eede504
--- /dev/null
+++ b/include/vfs/mount.h
@@ -0,0 +1,85 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _MOUNT_H
+#define _MOUNT_H
+
+#include
+
+#define MFSNAMELEN 16 /* length of type name including null */
+#define MNAMELEN 88 /* size of on/from name bufs */
+
+typedef struct fsid { int32_t val[2]; } fsid_t; /* filesystem id type */
+
+struct statfs {
+ u_int32_t f_version; /* structure version number */
+ u_int32_t f_type; /* type of filesystem */
+ u_int64_t f_flags; /* copy of mount exported flags */
+ u_int64_t f_bsize; /* filesystem fragment size */
+ u_int64_t f_iosize; /* optimal transfer block size */
+ u_int64_t f_blocks; /* total data blocks in filesystem */
+ u_int64_t f_bfree; /* free blocks in filesystem */
+ int64_t f_bavail; /* free blocks avail to non-superuser */
+ u_int64_t f_files; /* total file nodes in filesystem */
+ int64_t f_ffree; /* free nodes avail to non-superuser */
+ u_int64_t f_syncwrites; /* count of sync writes since mount */
+ u_int64_t f_asyncwrites; /* count of async writes since mount */
+ u_int64_t f_syncreads; /* count of sync reads since mount */
+ u_int64_t f_asyncreads; /* count of async reads since mount */
+ u_int64_t f_spare[10]; /* unused spare */
+ u_int32_t f_namemax; /* maximum filename length */
+ uid_t f_owner; /* user that mounted the filesystem */
+ fsid_t f_fsid; /* filesystem id */
+ char f_charspare[80]; /* spare string space */
+ char f_fstypename[MFSNAMELEN]; /* filesystem type name */
+ char f_mntfromname[MNAMELEN]; /* mounted filesystem */
+ char f_mntonname[MNAMELEN]; /* directory on which mounted */
+ };
+
+struct vfs_mountPoint {
+ struct vfs_mountPoint *prev;
+ struct vfs_mountPoint *next;
+ struct fileSystem *fs;
+ struct device_node *device;
+ struct ubixDiskLabel *diskLabel;
+ void *fsInfo;
+ int partition;
+ char mountPoint[1024];
+ char perms;
+ };
+
+int vfs_mount(int major,int minor,int partition,int fsType,char *mountPoint,char *perms);
+int vfs_addMount(struct vfs_mountPoint *mp);
+struct vfs_mountPoint *vfs_findMount(char *mountPoint);
+
+#endif
+
+/***
+ END
+ ***/
diff --git a/include/vfs/vfs.h b/include/vfs/vfs.h
new file mode 100644
index 0000000..082fc33
--- /dev/null
+++ b/include/vfs/vfs.h
@@ -0,0 +1,93 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _VFS_H
+#define _VFS_H
+
+#include
+#include
+#include
+#include
+#include
+
+#define maxFd 32
+#define fdAvail 1
+#define fdOpen 2
+#define fdRead 3
+#define fdEof 4
+
+
+#define fileRead 0x0001
+#define fileWrite 0x0002
+#define fileBinary 0x0004
+#define fileAppend 0x0008
+
+/* New Stuff */
+
+/* whence values for lseek(2) */
+#ifndef SEEK_SET
+#define SEEK_SET 0 /* set file offset to offset */
+#define SEEK_CUR 1 /* set file offset to current plus offset */
+#define SEEK_END 2 /* set file offset to EOF plus offset */
+#endif
+
+
+/*!
+ \brief filesSystem Structure
+
+ not sure if we should allow function to point to NULL
+
+ We don't as of 1/28/07
+*/
+struct fileSystem {
+ struct fileSystem *prev;
+ struct fileSystem *next;
+ int (*vfsInitFS)(void *); /*!< pointer to inialization routine */
+ int (*vfsRead)(void *,char *,long,long); /*!< pointer to read routine */
+ int (*vfsWrite)(void *,char *,long,long); /*!< pointer to write routine */
+ int (*vfsOpenFile)(void *,void *); /*!< pointer to openfile routine */
+ int (*vfsCloseFile)(void *); /*!< pointer to closefile routine */
+ int (*vfsUnlink)(char *,void *); /*!< pointer to unlink routine */
+ int (*vfsMakeDir)(char *,void *); /*!< pointer to makedir routine */
+ int (*vfsRemDir)(char *); /*!< pointer to remdir routine */
+ int (*vfsSync)(void); /*!< pointer to sync routine */
+ int vfsType; /*!< vfs type id */
+ };
+
+
+/* VFS Functions */
+int vfs_init();
+int vfsRegisterFS(struct fileSystem);
+struct fileSystem *vfs_findFS(int);
+
+#endif
+
+/***
+ END
+ ***/
diff --git a/include/vmm/paging.h b/include/vmm/paging.h
new file mode 100644
index 0000000..3eb6643
--- /dev/null
+++ b/include/vmm/paging.h
@@ -0,0 +1,96 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _PAGING_H
+#define _PAGING_H
+
+#include
+#include
+#include
+
+#define VM_THRD 0
+#define VM_TASK 1
+
+#define pageLength 0x00000400
+#define pageSize 4096
+#define pageEntries (pageSize/4)
+#define tablesBaseAddress 0xBFC00000
+#define parentPageDirAddr 0x100000
+#define PARENT_PAGEDIR_ADDR 0x100000 /* Address at which the page directory is stored */
+
+#define PAGE_COW 0x00000200
+#define PAGE_STACK 0x00000400
+#define PAGE_WIRED 0x00000600
+#define PAGE_PRESENT 0x00000001
+#define PAGE_WRITE 0x00000002
+#define PAGE_USER 0x00000004
+#define PAGE_DEFAULT (PAGE_PRESENT|PAGE_WRITE|PAGE_USER)
+#define KERNEL_PAGE_DEFAULT (PAGE_PRESENT|PAGE_WRITE)
+
+#define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */
+#define PAGE_SIZE (1<>PAGE_SHIFT)
+
+
+int vmmClearVirtualPage(uInt32 pageAddr);
+
+void vmmUnmapPage(uInt32,int);
+void vmmUnmapPages(void *,uInt32);
+void *vmmMapFromTask(pidType,void *,uInt32);
+void *vmmCopyVirtualSpace(pidType);
+void *vmmGetFreeKernelPage(pidType);
+void *vmmGetFreeKernelPage(pidType pid,uInt16 count);
+void *vmmCreateVirtualSpace(pidType);
+void *vmmGetFreeVirtualPage(pidType,int,int);
+
+uInt32 vmm_getPhysicalAddr(uInt32);
+int vmm_setPageAttributes(uInt32,uInt16);
+int vmm_remapPage(uInt32,uInt32,uInt16);
+int vmm_pagingInit();
+void *vmm_getFreeMallocPage(uInt16 count);
+void vmm_pageFault(uInt32,uInt32,uInt32);
+void _vmm_pageFault();
+int mmap(struct thread *,struct mmap_args *);
+int obreak(struct thread *,struct obreak_args *);
+int munmap(struct thread *,struct munmap_args *);
+
+
+extern uInt32 *kernelPageDirectory;
+
+#endif
+
+/***
+ END
+ ***/
+
diff --git a/include/vmm/vmm.h b/include/vmm/vmm.h
new file mode 100644
index 0000000..dfc8a00
--- /dev/null
+++ b/include/vmm/vmm.h
@@ -0,0 +1,64 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#ifndef _VMM_H
+#define _VMM_H
+
+#include
+#include
+
+#define memAvail 1
+#define memNotavail 2
+#define vmmID -3
+#define vmmMemoryMapAddr 0xE6667000
+
+typedef struct {
+ uInt32 pageAddr;
+ uInt16 status;
+ uInt16 reserved;
+ pid_t pid;
+ int cowCounter;
+ } mMap;
+
+extern int numPages;
+extern mMap *vmmMemoryMap;
+
+int vmm_init();
+int vmmMemMapInit();
+int countMemory();
+u_int32_t vmmFindFreePage(pidType pid);
+int freePage(uInt32 pageAddr);
+int adjustCowCounter(uInt32 baseAddr,int adjustment);
+void vmmFreeProcessPages(pidType pid);
+
+#endif
+
+/***
+ END
+ ***/
diff --git a/init/Makefile b/init/Makefile
new file mode 100644
index 0000000..c3c2d99
--- /dev/null
+++ b/init/Makefile
@@ -0,0 +1,27 @@
+# (C) 2002-2004 The UbixOS Project
+# $Id$
+
+# Include Global 'Source' Options
+include ../../Makefile.inc
+include ../Makefile.inc
+
+# Objects
+OBJS = start.o main.o static.o
+
+all: $(OBJS)
+
+# Compile Types
+.cc.o:
+ $(CXX) $(CFLAGS) $(INCLUDES) -c -o $@ $<
+.cc.s:
+ $(CXX) $(CFLAGS) $(INCLUDES) -S -o $@ $<
+.c.o:
+ $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
+.c.s:
+ $(CC) $(CFLAGS) $(INCLUDES) -S -o $@ $<
+.S.o:
+ $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
+
+# Clean up the junk
+clean:
+ $(REMOVE) $(OBJS)
diff --git a/init/main.c b/init/main.c
new file mode 100644
index 0000000..95b40f0
--- /dev/null
+++ b/init/main.c
@@ -0,0 +1,160 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004, 2005, 2007, 2008 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#define B_ADAPTORSHIFT 24
+#define B_ADAPTORMASK 0x0f
+#define B_ADAPTOR(val) (((val) >> B_ADAPTORSHIFT) & B_ADAPTORMASK)
+#define B_CONTROLLERSHIFT 20
+#define B_CONTROLLERMASK 0xf
+#define B_CONTROLLER(val) (((val)>>B_CONTROLLERSHIFT) & B_CONTROLLERMASK)
+#define B_SLICESHIFT 20
+#define B_SLICEMASK 0xff
+#define B_SLICE(val) (((val)>>B_SLICESHIFT) & B_SLICEMASK)
+#define B_UNITSHIFT 16
+#define B_UNITMASK 0xf
+#define B_UNIT(val) (((val) >> B_UNITSHIFT) & B_UNITMASK)
+#define B_PARTITIONSHIFT 8
+#define B_PARTITIONMASK 0xff
+#define B_PARTITION(val) (((val) >> B_PARTITIONSHIFT) & B_PARTITIONMASK)
+#define B_TYPESHIFT 0
+#define B_TYPEMASK 0xff
+#define B_TYPE(val) (((val) >> B_TYPESHIFT) & B_TYPEMASK)
+
+
+/*****************************************************************************************
+ Desc: The Kernels Descriptor table:
+ 0x00 - Dummy Entry
+ 0x08 - Ring 0 CS
+ 0x10 - Ring 0 DS
+ 0x18 - Dummy LDT
+ 0x20 - Scheduler TSS
+ 0x28 - Ring 3 CS
+ 0x30 - Ring 3 DS
+ 0x38 - GPF TSS
+ 0x40 - Stack Fault TSS
+
+ Notes:
+
+*****************************************************************************************/
+ubixDescriptorTable(ubixGDT,9) {
+ {dummy:0},
+ ubixStandardDescriptor(0x0000, 0xFFFFF, (dCode + dRead + dBig + dBiglim)),
+ ubixStandardDescriptor(0x0000, 0xFFFFF, (dData + dWrite + dBig + dBiglim)),
+ ubixStandardDescriptor(0x0000, 0xFFFFF, (dLdt)),
+ ubixStandardDescriptor(0x4200, (sizeof(struct tssStruct)), (dTss + dDpl3)),
+ ubixStandardDescriptor(0x0000, 0xFFFFF, (dCode + dWrite + dBig + dBiglim + dDpl3)),
+ ubixStandardDescriptor(0x0000, 0xFFFFF, (dData + dWrite + dBig + dBiglim + dDpl3)),
+ ubixStandardDescriptor(0x4200, (sizeof(struct tssStruct)), (dTss)),
+ ubixStandardDescriptor(0x6200, (sizeof(struct tssStruct)), (dTss)),
+ };
+struct {
+ unsigned short limit __attribute__ ((packed));
+ union descriptorTableUnion *gdt __attribute__ ((packed));
+ } loadGDT = { (9 * sizeof(union descriptorTableUnion) - 1), ubixGDT };
+
+/**
+ * \brief This is the entry point into the os where all of the kernels sub systems are started up.
+ *
+ * \param rootdev address of root device structure
+ */
+int kmain(uInt32 rootdev) {
+ /* Set up counter for startup routine */
+ int i = 0x0;
+ uInt32 *sysTask = 0x0;
+
+ /* We preform a clearScreen to make the TEXT buffer nice and empty */
+ screenClear();
+
+ /* Modify src/sys/include/ubixos/init.h to add a startup routine */
+ for (i=0x0;ifreePages);
+
+ kprintf("MemoryMap: [0x%X]\n",vmmMemoryMap);
+ kprintf("Starting UbixOS\n");
+
+ sysTask = kmalloc(0x2000);
+ if(sysTask == NULL)
+ kprintf("OS: Unable to allocate memory\n");
+
+ execThread(systemTask, (uInt32)sysTask+0x2000,0x0);
+
+ execFile("sys:/bin/init",0x0,0x0,0x0); /* OS Initializer */
+// execFile("sys:/bin/login",0x0,0x0,0x1);
+// execFile("sys:/bin/login",0x0,0x0,0x2);
+
+ irqEnable(0x0);
+
+ while (0x1)
+ asm("hlt"); /* Keep haulting until the scheduler reacts */
+
+ /* Return to start however we should never get this far */
+ return(0x0);
+}
+
+/***
+ END
+ ***/
diff --git a/init/start.S b/init/start.S
new file mode 100644
index 0000000..1ea5fe0
--- /dev/null
+++ b/init/start.S
@@ -0,0 +1,75 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+.globl _start
+.text
+.code32
+_start:
+ movw $0x1234,0x472
+ pushl %ebp
+ movl %esp,%ebp
+ pushl $0x00000002
+ popfl
+ /* Clear the BSS */
+ movl $(_end),%ecx
+ movl $(__bss_start),%edi
+ subl %edi,%ecx
+ xorl %eax,%eax
+ cld
+ rep
+ stosb
+
+ /* Load GDT */
+ lgdtl (loadGDT)
+ mov $0x10,%eax
+ mov %eax,%ds
+ mov %eax,%es
+ mov %eax,%fs
+ mov %eax,%gs
+ mov %eax,%ss
+ mov $kStack,%eax
+ addl $0x2000,%eax
+ mov %esp,%edx
+ mov %eax,%esp
+ mov %eax,%ebp
+ mov $0x18,%ax
+ lldt %ax
+ mov $0x20,%ax
+ ltr %ax
+ ljmp $0x08,$start_next
+start_next:
+ push 8(%edx)
+ call kmain
+
+.data
+.comm kStack,0x2000
+
+/***
+ END
+ ***/
diff --git a/init/static.c b/init/static.c
new file mode 100644
index 0000000..266e42a
--- /dev/null
+++ b/init/static.c
@@ -0,0 +1,51 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004, 2007 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+/**
+ * \brief Sets up the ctors
+ */
+
+int static_constructors(void) {
+
+ extern void (* __ctor_list)();
+ void (** l_ctor)() = &__ctor_list;
+ int l_ctorCount = *(int *)l_ctor;
+
+ l_ctor++;
+ while(l_ctorCount) {
+ (*l_ctor)();
+ l_ctorCount--;
+ l_ctor++;
+ }
+ return(0x0);
+ }
+
+/***
+ END
+ ***/
diff --git a/isa/8259.c b/isa/8259.c
new file mode 100644
index 0000000..483bd5d
--- /dev/null
+++ b/isa/8259.c
@@ -0,0 +1,92 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#include
+#include
+#include
+
+static unsigned int irqMask = 0xFFFF;
+
+/*!
+ * \brief initialize the 8259 PIC
+ *
+ * This will initialize both PICs for all of our IRQs
+ *
+ */
+int i8259_init() {
+ outportByte(mPic, icw1); /* Initialize Master PIC */
+ outportByte(sPic, icw1); /* Initialize Seconary PIC */
+ outportByte(mPic+1, mVec); /* Master Interrup Vector */
+ outportByte(sPic+1, sVec); /* Secondary Interrupt Vector */
+ outportByte(mPic+1, 1<<2); /* Bitmask for cascade on IRQ 2 */
+ outportByte(sPic+1, 2); /* Cascade on IRQ 2 */
+ outportByte(mPic+1, icw4); /* Finish Primary Initialization */
+ outportByte(sPic+1, icw4); /* Finish Seconary Initialization */
+ outportByte(mImr, 0xff); /* Mask All Primary Interrupts */
+ outportByte(sImr, 0xff); /* Mask All Seconary Interrupts */
+
+ /* Print out the system info for this */
+ kprintf("pic0 - Port: [0x%X]\n",mPic);
+ kprintf("pic1 - Port: [0x%X]\n",sPic);
+
+ /* Return so the system knows it went well */
+ return(0x0);
+ }
+
+/*!
+ * \brief enable specified IRQ
+ *
+ * \param irqNo IRQ to enable
+ */
+void irqEnable(u_int16_t irqNo) {
+ irqMask &= ~(1 << irqNo);
+ if (irqNo >= 8) {
+ irqMask &= ~(1 << 2);
+ }
+ outportByte(mPic+1, irqMask & 0xFF);
+ outportByte(sPic+1, (irqMask >> 8) & 0xFF);
+ }
+
+/*!
+ * \brief disable specified IRQ
+ *
+ * \param irqNo IRQ to disable
+ */
+void irqDisable(u_int16_t irqNo) {
+ irqMask |= (1 << irqNo);
+ if ((irqMask & 0xFF00)==0xFF00) {
+ irqMask |= (1 << 2);
+ }
+ outportByte(mPic+1, irqMask & 0xFF);
+ outportByte(sPic+1, (irqMask >> 8) & 0xFF);
+ }
+
+/***
+ END
+ ***/
diff --git a/isa/Makefile b/isa/Makefile
new file mode 100644
index 0000000..b289aec
--- /dev/null
+++ b/isa/Makefile
@@ -0,0 +1,28 @@
+# (C) 2002 The UbixOS Project
+# $Id$
+
+# Include Global 'Source' Options
+include ../../Makefile.inc
+include ../Makefile.inc
+
+# Objects
+OBJS = mouse.o atkbd.o fdc.o 8259.o pit.o
+#ne2k.o
+
+all: $(OBJS)
+
+# Compile Types
+.cc.o:
+ $(CXX) $(CFLAGS) $(INCLUDES) -c -o $@ $<
+.cc.s:
+ $(CXX) $(CFLAGS) $(INCLUDES) -S -o $@ $<
+.c.o:
+ $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
+.c.s:
+ $(CC) $(CFLAGS) $(INCLUDES) -S -o $@ $<
+.S.o:
+ $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
+
+# Clean up the junk
+clean:
+ $(REMOVE) $(OBJS)
diff --git a/isa/atkbd.c b/isa/atkbd.c
new file mode 100644
index 0000000..0607761
--- /dev/null
+++ b/isa/atkbd.c
@@ -0,0 +1,383 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+static int atkbd_scan();
+
+static unsigned int keyMap = 0x0;
+static unsigned int ledStatus = 0x0;
+static char stdinBuffer[512];
+static uInt16 stdinSize;
+static uInt32 controlKeys = 0x0;
+
+static spinLock_t atkbdSpinLock = SPIN_LOCK_INITIALIZER;
+
+static unsigned int keyboardMap[255][8] = {
+/* Ascii, Shift, Ctrl, Alt, Num, Caps, Shift Caps, Shift Num */
+ { 0, 0, 0, 0, 0, 0, 0, 0},
+/* ESC */ { 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B},
+/* 1,! */ { 0x31, 0x21, 0, 0, 0x31, 0x31, 0x21, 0x21},
+/* 2,@ */ { 0x32, 0x40, 0, 0, 0x32, 0x32, 0x40, 0x40},
+/* 3,# */ { 0x33, 0x23, 0, 0, 0x33, 0x33, 0x23, 0x23},
+/* 4,$ */ { 0x34, 0x24, 0, 0, 0x34, 0x34, 0x24, 0x24},
+/* 5,% */ { 0x35, 0x25, 0, 0, 0x35, 0x35, 0x25, 0x25},
+/* 6,^ */ { 0x36, 0x5E, 0, 0, 0x36, 0x36, 0x5E, 0x5E},
+/* 7,& */ { 0x37, 0x26, 0, 0, 0x37, 0x37, 0x26, 0x26},
+/* 8,* */ { 0x38, 0x2A, 0, 0, 0x38, 0x38, 0x2A, 0x2A},
+/* 9.( */ { 0x39, 0x28, 0, 0, 0x39, 0x39, 0x28, 0x28},
+/* 0,) */ { 0x30, 0x29, 0, 0, 0x30, 0x30, 0x29, 0x29},
+/* -,_ */ { 0x2D, 0x5F, 0, 0, 0x2D, 0x2D, 0x5F, 0x5F},
+/* =,+ */ { 0x3D, 0x2B, 0, 0, 0x3D, 0x3D, 0x2B, 0x2B},
+/* 14 */ { 0x08, 0x08, 0x8, 0x8, 0x08, 0x08, 0x08, 0x08},
+/* 15 */ { 0x09, 0, 0, 0, 0, 0, 0, 0},
+/* */ { 0x71, 0x51, 0, 0, 0, 0, 0, 0},
+/* */ { 0x77, 0x57, 0, 0, 0, 0, 0, 0},
+/* */ { 0x65, 0x45, 0, 0, 0, 0, 0, 0},
+/* */ { 0x72, 0x52, 0, 0, 0, 0, 0, 0},
+/* */ { 0x74, 0x54, 0, 0, 0, 0, 0, 0},
+/* */ { 0x79, 0x59, 0, 0, 0, 0, 0, 0},
+/* */ { 0x75, 0x55, 0, 0, 0, 0, 0, 0},
+/* */ { 0x69, 0x49, 0, 0, 0, 0, 0, 0},
+/* */ { 0x6F, 0x4F, 0, 0, 0, 0, 0, 0},
+/* */ { 0x70, 0x50, 0, 0, 0, 0, 0, 0},
+/* */ { 0x5B, 0x7B, 0, 0, 0, 0, 0, 0},
+/* */ { 0x5D, 0x7D, 0, 0, 0, 0, 0, 0},
+/* */ { 0x0A, 0, 0, 0, 0, 0, 0, 0},
+/* */ { 0, 0, 0, 0, 0, 0, 0, 0},
+/* a,A */ { 0x61, 0x41, 0x41, 0, 0, 0, 0, 0},
+/* */ { 0x73, 0x53, 0, 0, 0, 0, 0, 0},
+/* */ { 0x64, 0x44, 0, 0, 0, 0, 0, 0},
+/* */ { 0x66, 0x46, 0, 0, 0, 0, 0, 0},
+/* */ { 0x67, 0x47, 0, 0, 0, 0, 0, 0},
+/* */ { 0x68, 0x48, 0, 0, 0, 0, 0, 0},
+/* */ { 0x6A, 0x4A, 0, 0, 0, 0, 0, 0},
+/* */ { 0x6B, 0x4B, 0, 0, 0, 0, 0, 0},
+/* */ { 0x6C, 0x4C, 0, 0, 0, 0, 0, 0},
+/* */ { 0x3B, 0x3A, 0, 0, 0, 0, 0, 0},
+/* */ { 0x27, 0x22, 0, 0, 0, 0, 0, 0},
+/* */ { 0x60, 0x7E, 0, 0, 0, 0, 0, 0},
+/* */ { 0x2A, 0x0, 0, 0, 0, 0, 0, 0},
+/* */ { 0x5C, 0x3C, 0, 0, 0, 0, 0, 0},
+/* */ { 0x7A, 0x5A, 0, 0, 0, 0, 0, 0},
+/* */ { 0x78, 0x58, 0, 0, 0, 0, 0, 0},
+/* c,C */ { 0x63, 0x43, 0x3, 0x9, 0, 0, 0, 0},
+/* */ { 0x76, 0x56, 0, 0, 0, 0, 0, 0},
+/* */ { 0x62, 0x42, 0, 0, 0, 0, 0, 0},
+/* */ { 0x6E, 0x4E, 0, 0, 0, 0, 0, 0},
+/* */ { 0x6D, 0x4D, 0, 0, 0, 0, 0, 0},
+/* */ { 0x2C, 0x3C, 0, 0, 0, 0, 0, 0},
+/* */ { 0x2E, 0x3E, 0, 0, 0, 0, 0, 0},
+/* */ { 0x2F, 0x3F, 0, 0, 0, 0, 0, 0},
+/* */ { 0, 0, 0, 0, 0, 0, 0, 0},
+/* */ { 0, 0, 0, 0, 0, 0, 0, 0},
+/* */ { 0, 0, 0, 0, 0, 0, 0, 0},
+/* */ { 0x20, 0, 0, 0, 0, 0, 0, 0},
+/* */ { 0, 0, 0, 0, 0, 0, 0, 0},
+/* F1 */ { 0x3000, 0, 0, 0x3000, 0, 0, 0, 0},
+/* */ { 0x3001, 0, 0, 0x3001, 0, 0, 0, 0},
+/* */ { 0x3002, 0, 0, 0x3002, 0, 0, 0, 0},
+/* */ { 0x3003, 0, 0, 0x3003, 0, 0, 0, 0},
+/* */ { 0x3004, 0, 0, 0x3004, 0, 0, 0, 0},
+/* */ { 0x4000, 0, 0, 0x3005, 0, 0, 0, 0},
+/* */ { 0x4100, 0, 0, 0x3006, 0, 0, 0, 0},
+/* */ { 0x4200, 0, 0, 0x3007, 0, 0, 0, 0},
+/* */ { 0x4300, 0, 0, 0x3008, 0, 0, 0, 0},
+/* */ { 0x4400, 0, 0, 0x3009, 0, 0, 0, 0},
+/* */ { 0, 0, 0, 0x3010, 0, 0, 0, 0},
+/* */ { 0, 0, 0, 0x3011, 0, 0, 0, 0},
+/* */ { 0x4700, 0, 0, 0, 0, 0, 0, 0},
+/* */ { 0x4800, 0, 0, 0, 0, 0, 0, 0},
+/* */ { 0x4900, 0, 0, 0, 0, 0, 0, 0},
+/* */ { 0x2D, 0, 0, 0, 0, 0, 0, 0},
+/* */ { 0x4B00, 0, 0, 0, 0, 0, 0, 0},
+/* */ { 0x4C00, 0, 0, 0, 0, 0, 0, 0},
+/* */ { 0x4D00, 0, 0, 0, 0, 0, 0, 0},
+/* */ { 0x2B, 0, 0, 0, 0, 0, 0, 0},
+/* */ { 0x4F00, 0, 0, 0, 0, 0, 0, 0},
+/* */ { 0x5000, 0, 0, 0, 0, 0, 0, 0},
+/* */ { 0x5100, 0, 0, 0, 0, 0, 0, 0},
+/* */ { 0x5200, 0, 0, 0, 0, 0, 0, 0},
+/* */ { 0x5300, 0, 0, 0, 0, 0, 0, 0},
+/* */ { 0, 0, 0, 0, 0, 0, 0, 0},
+/* */ { 0, 0, 0, 0, 0, 0, 0, 0}
+ };
+
+/************************************************************************
+
+Function: int atkbd_init
+
+Description: This function is used to turn on the keyboard
+
+Notes:
+
+02/20/2004 - Approved for quality
+
+************************************************************************/
+int atkbd_init() {
+ /* Insert the IDT vector for the keyboard handler */
+ setVector(&atkbd_isr, mVec+0x1, dPresent + dInt + dDpl0);
+
+ /* Set the LEDS to their defaults */
+ setLED();
+
+ /* Clear Keyboard */
+ atkbd_scan();
+
+ /* Turn on the keyboard vector */
+ irqEnable(0x1);
+
+ /* Print out information on keyboard */
+ kprintf("atkbd0 - Address: [0x%X], Keyboard Buffer: [0x%X], Buffer Size [%i]\n",&atkbd_isr,&stdinBuffer,512);
+
+ /* Return so we know everything went well */
+ return(0x0);
+ }
+
+/*
+ * 2-23-2004 mji I think the pusha/popa should be pushal/popal
+ */
+
+asm(
+ ".globl atkbd_isr \n"
+ "atkbd_isr: \n"
+ " pusha \n" /* Save all registers */
+ " push %ss \n"
+ " push %ds \n"
+ " push %es \n"
+ " push %fs \n"
+ " push %gs \n"
+ " call keyboardHandler \n"
+ " mov $0x20,%dx \n"
+ " mov $0x20,%ax \n"
+ " outb %al,%dx \n"
+ " pop %gs \n"
+ " pop %fs \n"
+ " pop %es \n"
+ " pop %ds \n"
+ " pop %ss \n"
+ " popa \n"
+ " iret \n" /* Exit interrupt */
+ );
+
+static int atkbd_scan() {
+ int code = 0x0;
+ int val = 0x0;
+
+ code = inportByte(0x60);
+ val = inportByte(0x61);
+
+ outportByte(0x61,val | 0x80);
+ outportByte(0x61,val);
+
+ return(code);
+ }
+
+void keyboardHandler() {
+ int key = 0x0;
+
+ if (!spinTryLock(&atkbdSpinLock))
+ return;
+
+ key = atkbd_scan();
+
+ if (key > 255)
+ return;
+
+ /* Control Key */
+ if (key == 0x1D && !(controlKeys & controlKey)) {
+ controlKeys |= controlKey;
+ }
+ if (key == 0x80 + 0x1D) {
+ controlKeys &= (0xFF - controlKey);
+ }
+ /* ALT Key */
+ if (key == 0x38 && !(controlKeys & altKey)) {
+ controlKeys |= altKey;
+ }
+ if (key == 0x80 + 0x38) {
+ controlKeys &= (0xFF - altKey);
+ }
+ /* Shift Key */
+ if ((key == 0x2A || key == 0x36) && !(controlKeys & shiftKey)) {
+ controlKeys |= shiftKey;
+ }
+ if ((key == 0x80 + 0x2A) || (key == 0x80 + 0x36)) {
+ controlKeys &= (0xFF - shiftKey);
+ }
+ /* Caps Lock */
+ if (key == 0x3A) {
+ ledStatus ^= ledCapslock;
+ setLED();
+ }
+ /* Num Lock */
+ if (key == 0x45) {
+ ledStatus ^= ledNumlock;
+ setLED();
+ }
+ /* Scroll Lock */
+ if (key == 0x46) {
+ ledStatus ^= ledScrolllock;
+ setLED();
+ }
+ /* Pick Which Key Map */
+ if (controlKeys == 0) { keyMap = 0; }
+ else if (controlKeys == 1) { keyMap = 1; }
+ else if (controlKeys == 2) { keyMap = 2; }
+ else if (controlKeys == 4) { keyMap = 3; }
+ /* If Key Is Not Null Add It To Handler */
+ if (((uInt)(keyboardMap[key][keyMap]) > 0) && ((uInt32)(keyboardMap[key][keyMap]) < 0xFF)) {
+ switch ((uInt32)keyboardMap[key][keyMap]) {
+ case 8:
+ backSpace();
+ if (tty_foreground == 0x0) {
+ stdinBuffer[stdinSize] = keyboardMap[key][keyMap];
+ stdinSize++;
+ }
+ else {
+ tty_foreground->stdin[tty_foreground->stdinSize] = keyboardMap[key][keyMap];
+ tty_foreground->stdinSize++;
+ }
+ break;
+ case 0x3:
+ //if (tty_foreground != 0x0)
+ // endTask(tty_foreground->owner);
+ //K_PANIC("CTRL-C pressed\n");
+ kprintf("CTRL-C pressed\n");
+ kprintf("FreePages: [0x%X]\n",systemVitals->freePages);
+ break;
+ case 0x9:
+ kprintf("REBOOTING");
+ while(inportByte(0x64) & 0x02);
+ outportByte(0x64, 0xFE);
+ break;
+ default:
+ if (tty_foreground == 0x0) {
+ stdinBuffer[stdinSize] = keyboardMap[key][keyMap];
+ stdinSize++;
+ }
+ else {
+ tty_foreground->stdin[tty_foreground->stdinSize] = keyboardMap[key][keyMap];
+ tty_foreground->stdinSize++;
+ }
+ break;
+ }
+ }
+ else {
+ switch ((keyboardMap[key][keyMap] >> 8)) {
+ case 0x30:
+ #ifdef DEBUG
+ kprintf("Changing Consoles[0x%X:0x%X]\n",_current->id,_current);
+ #endif
+ tty_change(keyboardMap[key][keyMap] & 0xFF);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /* Return */
+ spinUnlock(&atkbdSpinLock);
+ return;
+ }
+
+void setLED() {
+ outportByte(0x60, 0xED);
+ while(inportByte(0x64) & 2);
+ outportByte(0x60, ledStatus);
+ while(inportByte(0x64) & 2);
+ }
+
+/* Temp */
+unsigned char getch() {
+ uInt8 retKey = 0x0;
+ uInt32 i = 0x0;
+
+ /*
+ if ((stdinSize <= 0) && (tty_foreground == 0x0)) {
+ sched_yield();
+ }
+ if ((tty_foreground != 0x0) && (tty_foreground->stdinSize <= 0x0)) {
+ sched_yield();
+ }
+ */
+
+ /*
+ if (!spinTryLock(&atkbdSpinLock))
+ return(0x0);
+*/
+
+ if (tty_foreground == 0x0) {
+ if (stdinSize == 0x0) {
+ // spinUnlock(&atkbdSpinLock);
+ return(0x0);
+ }
+
+ retKey = stdinBuffer[0];
+ stdinSize--;
+
+ for (i=0x0;istdinSize == 0x0) {
+ // spinUnlock(&atkbdSpinLock);
+ return(0x0);
+ }
+
+ retKey = tty_foreground->stdin[0];
+ tty_foreground->stdinSize--;
+
+ for (i=0x0;istdinSize;i++) {
+ tty_foreground->stdin[i] = tty_foreground->stdin[i+0x1];
+ }
+ }
+ //spinUnlock(&atkbdSpinLock);
+ return(retKey);
+ }
+
+/***
+ END
+ ***/
+
diff --git a/isa/fdc.c b/isa/fdc.c
new file mode 100644
index 0000000..874d4af
--- /dev/null
+++ b/isa/fdc.c
@@ -0,0 +1,420 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+static spinLock_t fdcSpinLock = SPIN_LOCK_INITIALIZER;
+
+static volatile bool done = FALSE;
+static drvGeom geometry = { dg144Heads,dg144Tracks,dg144Spt };
+static bool diskChange = FALSE;
+static bool motor = FALSE;
+static volatile Int8 fdcTrack = 0xff;
+static Int8 sr0 = 0;
+static volatile int timeOut = 0;
+static Int8 statSize = 0;
+static Int8 status[7] = { 0 };
+
+unsigned long tbaddr = 0x80000L;
+
+int fdcInit2(struct device_node *dev) {
+ dev->devInfo->size = (1024 * 1450);
+ return(0x0);
+ }
+
+int fdc_init() {
+ struct device_interface *devInfo = (struct device_interface *)kmalloc(sizeof(struct device_interface));
+ setVector(floppyIsr, mVec+6, (dInt+dPresent));
+ irqEnable(6);
+ reset();
+ devInfo->major = 0x0;
+ devInfo->init = (void *)&fdcInit2;
+ devInfo->read = fdcRead;
+ devInfo->write = fdcWrite;
+ devInfo->reset = (void *)reset;
+
+ device_add(0,'c',devInfo);
+ devfs_makeNode("fd0",'b',0x0,0x0);
+ return(0x0);
+ }
+
+asm(
+ ".globl floppyIsr \n"
+ "floppyIsr: \n"
+ " pusha \n"
+ " push %ss \n"
+ " push %ds \n"
+ " push %es \n"
+ " push %fs \n"
+ " push %gs \n"
+ " call floppyIsrhndlr \n"
+ " pop %gs \n"
+ " pop %fs \n"
+ " pop %es \n"
+ " pop %ds \n"
+ " pop %ss \n"
+ " popa \n"
+ " iret \n"
+ );
+
+void floppyIsrhndlr() {
+ done = TRUE;
+ outportByte(0x20,0x20);
+ }
+
+void sendByte(int Int8) {
+ volatile int msr;
+ int tmo;
+ for (tmo=0;tmo<128;tmo++) {
+ msr = inportByte(fdcMsr);
+ if ((msr & 0xc0) == 0x80) {
+ outportByte(fdcData,Int8);
+ return;
+ }
+ inportByte(0x80);
+ }
+ }
+
+int getByte() {
+ volatile int msr;
+ int tmo;
+ for (tmo=0;tmo<128;tmo++) {
+ msr = inportByte(fdcMsr);
+ if ((msr & 0xd0) == 0xd0) {
+ return inportByte(fdcData);
+ }
+ inportByte(0x80);
+ }
+ return(-1);
+ }
+
+bool fdcRw(int block,Int8 *blockBuffer,bool read,unsigned long numSectors) {
+ int head = 0x0,track = 0x0,sector = 0x0,tries= 0x0, copyCount = 0x0;
+ unsigned char *p_tbaddr = (unsigned char *)0x80000;
+ unsigned char *p_blockbuff = (unsigned char *)blockBuffer;
+ //kprintf("Block: [%i]\n",block);
+ block2Hts(block,&head,&track,§or);
+ motorOn();
+ if (!read && blockBuffer) {
+ /* copy data from data buffer into track buffer */
+ for (copyCount=0; copyCount<(numSectors*512); copyCount++) {
+ *p_tbaddr = *p_blockbuff;
+ p_blockbuff++;
+ p_tbaddr++;
+ }
+ }
+ for (tries = 0;tries < 3;tries++) {
+ if (inportByte(fdcDir) & 0x80) {
+ diskChange = TRUE;
+ seek(1); /* clear "disk change" status */
+ recalibrate();
+ motorOff();
+ kprint("FDC: Disk change detected. Trying again.\n");
+ return fdcRw(block, blockBuffer, read, numSectors);
+ }
+ if (!seek(track)) {
+ motorOff();
+ kprintf("FDC: Error seeking to track [%i]\n",block);
+ return FALSE;
+ }
+ outportByte(fdcCcr,0);
+ if (read) {
+ dmaXfer(2,tbaddr,numSectors*512,FALSE);
+ sendByte(cmdRead);
+ }
+ else {
+ dmaXfer(2,tbaddr,numSectors*512,TRUE);
+ sendByte(cmdWrite);
+ }
+ sendByte(head << 2);
+ sendByte(track);
+ sendByte(head);
+ sendByte(sector);
+ sendByte(2); /* 512 Int8s/sector */
+ sendByte(geometry.spt);
+ if (geometry.spt == dg144Spt) {
+ sendByte(dg144Gap3rw); /* gap 3 size for 1.44M read/write */
+ }
+ else {
+ sendByte(dg168Gap3rw); /* gap 3 size for 1.68M read/write */
+ }
+ sendByte(0xff); /* DTL = unused */
+ if (!waitFdc(TRUE)) {
+ kprint("Timed out, trying operation again after reset()\n");
+ reset();
+ return fdcRw(block, blockBuffer, read, numSectors);
+ }
+ if ((status[0] & 0xc0) == 0) break; /* worked! outta here! */
+ recalibrate(); /* oops, try again... */
+ }
+ motorOff();
+ if (read && blockBuffer) {
+ p_blockbuff = (unsigned char *)blockBuffer;
+ p_tbaddr = (unsigned char *) 0x80000;
+ for (copyCount=0x0; copyCount<(numSectors*512); copyCount++) {
+ *p_blockbuff = *p_tbaddr;
+ p_blockbuff++;
+ p_tbaddr++;
+ }
+ }
+ return (tries != 3);
+ }
+
+void block2Hts(int block,int *head,int *track,int *sector) {
+ *head = (block % (geometry.spt * geometry.heads)) / (geometry.spt);
+ *track = block / (geometry.spt * geometry.heads);
+ *sector = block % geometry.spt + 1;
+ }
+
+void motorOn(void) {
+ if (motor == FALSE) {
+ outportByte(fdcDor,0x1c);
+ motor = TRUE;
+ }
+ }
+
+void motorOff(void) {
+ if (motor == TRUE) {
+ //outportByte(fdcDor,0x0);
+ //outportByte(fdcDor,0x0C);
+ motor = FALSE;
+ }
+ }
+
+bool seek(int track) {
+ if (fdcTrack == track) {
+ return(TRUE);
+ }
+ sendByte(cmdSeek);
+ sendByte(0);
+ sendByte(track);
+ if (!waitFdc(TRUE)) {
+ kprintf("wait fdc failed\n");
+ return(FALSE);
+ }
+ if ((sr0 != 0x20) || (fdcTrack != track)) {
+ return(FALSE);
+ }
+ else {
+ return(TRUE);
+ }
+ }
+
+bool readBlock(int block,Int8 *blockBuffer, unsigned long numSectors) {
+ int result = 0x0,loop = 0x0;
+ if (numSectors > 1) {
+ for (loop=0; loop
+#include
+#include
+#include
+#include
+#include
+#include
+
+static uInt8 kbdRead() {
+ unsigned long Timeout;
+ uInt8 Stat, Data;
+
+ for (Timeout = 50000L; Timeout != 0; Timeout--) {
+ Stat = inportByte(0x64);
+
+ /* loop until 8042 output buffer full */
+ if ((Stat & 0x01) != 0)
+ {
+ Data = inportByte(0x60);
+
+ /* loop if parity error or receive timeout */
+ if((Stat & 0xC0) == 0)
+ return Data;
+ }
+ }
+
+ return -1;
+}
+
+static void kbdWrite(uInt16 port,uInt8 data) {
+ uInt32 timeout;
+ uInt8 stat;
+
+ for (timeout = 500000L; timeout != 0; timeout--)
+ {
+ stat = inportByte(0x64);
+
+ if ((stat & 0x02) == 0)
+ break;
+ }
+
+ if (timeout != 0)
+ outportByte(port, data);
+ }
+
+static uInt8 kbdWriteRead(uInt16 port,uInt8 data, const char* expect)
+{
+ int RetVal;
+
+ kbdWrite(port, data);
+ for (; *expect; expect++)
+ {
+ RetVal = kbdRead();
+ if ((uInt8) *expect != RetVal)
+ {
+ return RetVal;
+ }
+ }
+
+ return 0;
+}
+
+
+
+int mouseInit() {
+ static uInt8 s1[] = { 0xF3, 0xC8, 0xF3, 0x64, 0xF3, 0x50, 0 };
+ static uInt8 s2[] = { 0xF6, 0xE6, 0xF4, 0xF3, 0x64, 0xE8, 0x03, 0 };
+ const uInt8* ch;
+ Int8 cmd = 0x0;
+
+ kbdWrite(0x64,0xA8);
+ for (ch = s1; *ch; ch++) {
+ kbdWrite(0x64, 0xD4);
+ kbdWriteRead(0x60, *ch,"\xFA");
+ }
+ for (ch = s2; *ch; ch++) {
+ kbdWrite(0x64, 0xD4);
+ kbdWriteRead(0x60, *ch,"\xFA");
+ }
+ kbdWrite(0x64,0xD4);
+ if (kbdWriteRead(0x60,0xF2,"\xFA") != 0x0) {
+ kprintf("Error With Mouse\n");
+ }
+ cmd = kbdRead();
+ kprintf("CMD: [0x%X]\n",cmd);
+ kbdWrite(0x64, 0xD4);
+ kbdWriteRead(0x60, 0xF4,"\xFA");
+
+ setVector(&mouseISR, mVec+12, dPresent + dInt + dDpl3);
+
+ outportByte(mPic, eoi);
+ outportByte(sPic, eoi);
+ irqEnable(12);
+ outportByte(mPic, eoi);
+ outportByte(sPic, eoi);
+
+ kprintf("psm0 - Address: [0x%X]\n",&mouseISR);
+
+ /* Return so we know everything went well */
+ return(0x0);
+ }
+
+asm(
+ ".globl mouseISR \n"
+ "mouseISR: \n"
+ " pusha \n" /* Save all registers */
+ " call mouseHandler \n"
+ " popa \n"
+ " iret \n" /* Exit interrupt */
+ );
+
+void mouseHandler() {
+ kprintf("MOUSE!!!\n");
+
+ outportByte(mPic, eoi);
+ outportByte(sPic, eoi);
+ /* Return */
+ return;
+ }
+
+/***
+ $Log$
+ Revision 1.1.1.1 2007/01/17 03:31:51 reddawg
+ UbixOS
+
+ Revision 1.1.1.1 2006/06/01 12:46:12 reddawg
+ ubix2
+
+ Revision 1.2 2005/10/12 00:13:37 reddawg
+ Removed
+
+ Revision 1.1.1.1 2005/09/26 17:24:02 reddawg
+ no message
+
+ Revision 1.3 2004/09/07 21:54:38 reddawg
+ ok reverted back to old scheduling for now....
+
+ Revision 1.2 2004/09/06 15:13:25 reddawg
+ Last commit before FreeBSD 6.0
+
+ Revision 1.1 2004/06/04 10:20:53 reddawg
+ mouse drive: fixed a few bugs works a bit better now
+
+ END
+ ***/
+
diff --git a/isa/ne2k.c b/isa/ne2k.c
new file mode 100644
index 0000000..9a4ecbe
--- /dev/null
+++ b/isa/ne2k.c
@@ -0,0 +1,361 @@
+/*****************************************************************************************
+ Copyright (c) 2002-2004 The UbixOS Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of
+ conditions, the following disclaimer and the list of authors. Redistributions in binary
+ form must reproduce the above copyright notice, this list of conditions, the following
+ disclaimer and the list of authors in the documentation and/or other materials provided
+ with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+
+ $Id$
+
+*****************************************************************************************/
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+static spinLock_t ne2k_spinLock = SPIN_LOCK_INITIALIZER;
+
+static int dp_pkt2user(struct device *dev,int page,int length);
+static void getblock(struct device *dev,int page,size_t offset,size_t size,void *dst);
+static int dp_recv(struct device *);
+
+static struct nicBuffer *ne2kBuffer = 0x0;
+static struct device *mDev = 0x0;
+
+asm(
+ ".globl ne2kISR \n"
+ "ne2kISR: \n"
+ " pusha \n" /* Save all registers */
+ " call ne2kHandler \n"
+ " popa \n"
+ " iret \n" /* Exit interrupt */
+ );
+
+/************************************************************************
+
+Function: int ne2kInit(uInt32 ioAddr)
+Description: This Function Will Initialize The Programmable Timer
+
+Notes:
+
+************************************************************************/
+int ne2k_init() {
+ mDev = (struct device *)kmalloc(sizeof(struct device));
+ mDev->ioAddr = 0x280;
+ mDev->irq = 10;
+ setVector(&ne2kISR, mVec+10, dPresent + dInt + dDpl0);
+ irqEnable(10);
+// kprintf("ne0 - irq: %i, ioAddr: 0x%X MAC: %X:%X:%X:%X:%X:%X\n",dev->irq,dev->ioAddr,dev->net->mac[0] & 0xFF,dev->net->mac[1] & 0xFF,dev->net->mac[2] & 0xFF,dev->net->mac[3] & 0xFF,dev->net->mac[4] & 0xFF,dev->net->mac[5] & 0xFF);
+
+ outportByte(mDev->ioAddr + NE_CMD, 0x21); // stop mode
+ outportByte(mDev->ioAddr + NE_DCR,0x29); // 0x29 data config reg
+ outportByte(mDev->ioAddr + NE_RBCR0,0x00); // LOW byte count (remote)
+ outportByte(mDev->ioAddr + NE_RBCR1,0x00); // HIGH byte count (remote)
+ outportByte(mDev->ioAddr + NE_RCR,0x3C); // receive config reg
+ outportByte(mDev->ioAddr + NE_TCR,0x02); // LOOP mode (temp)
+ outportByte(mDev->ioAddr + NE_PSTART,startPage); // 0x26 PAGE start
+ outportByte(mDev->ioAddr + NE_BNRY,startPage); // 0x26 BOUNDARY
+ outportByte(mDev->ioAddr + NE_PSTOP,stopPage); // 0x40 PAGE stop
+ outportByte(mDev->ioAddr + NE_ISR,0xFF); // interrupt status reg
+ outportByte(mDev->ioAddr + NE_IMR,0x0B);
+ outportByte(mDev->ioAddr + NE_CMD,0x61); // PAGE 1 regs
+
+ outportByte(mDev->ioAddr + DP_MAR0, 0xFF);
+ outportByte(mDev->ioAddr + DP_MAR1, 0xFF);
+ outportByte(mDev->ioAddr + DP_MAR2, 0xFF);
+ outportByte(mDev->ioAddr + DP_MAR3, 0xFF);
+ outportByte(mDev->ioAddr + DP_MAR4, 0xFF);
+ outportByte(mDev->ioAddr + DP_MAR5, 0xFF);
+ outportByte(mDev->ioAddr + DP_MAR6, 0xFF);
+ outportByte(mDev->ioAddr + DP_MAR7, 0xFF);
+ outportByte(mDev->ioAddr + DP_CURR, startPage + 1);
+ outportByte(mDev->ioAddr + NE_CMD, 0x20);
+ inportByte(mDev->ioAddr + DP_CNTR0); /* reset counters by reading */
+ inportByte(mDev->ioAddr + DP_CNTR1);
+ inportByte(mDev->ioAddr + DP_CNTR2);
+
+ outportByte(mDev->ioAddr + NE_TCR, 0x00);
+
+ outportByte(mDev->ioAddr + NE_CMD, 0x0);
+ outportByte(mDev->ioAddr + NE_DCR, 0x29);
+
+ kprintf("Initialized");
+ /* Return so we know everything went well */
+ return(0x0);
+ } /* ne2k_init */
+
+int PCtoNIC(struct device *dev,void *packet,int length) {
+ int i = 0x0;
+ uInt16 *packet16 = (uInt16 *)packet;
+ uInt8 *packet8 = (uInt8 *)packet;
+ uInt8 word16 = 0x1;
+
+ if ((inportByte(dev->ioAddr) & 0x04) == 0x04) {
+ kpanic("Device Not Ready\n");
+ }
+
+ assert(length);
+ if ((word16 == 1) && (length & 0x01)) {
+ length++;
+ }
+
+ outportByte(dev->ioAddr+EN0_RCNTLO,(length & 0xFF));
+ outportByte(dev->ioAddr+EN0_RCNTHI,(length >> 8));
+
+ outportByte(dev->ioAddr+EN0_RSARLO,0x0);
+ outportByte(dev->ioAddr+EN0_RSARHI,0x41);
+
+ outportByte(dev->ioAddr,E8390_RWRITE+E8390_START);
+
+ if (word16 != 0x0) {
+ for(i=0;i