[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/2] Löschen von src/kernel/



Signed-off-by: Nico Mayer <mayerNico@xxxxxxxxxx>
---
 src/kernel/.nobuild            |   0
 src/kernel/include/bitops.h    |  22 -
 src/kernel/include/console.h   |  10 -
 src/kernel/include/cpu.h       |  29 --
 src/kernel/include/debug.h     |  31 --
 src/kernel/include/gdt.h       |  26 --
 src/kernel/include/intr.h      |  80 ----
 src/kernel/include/io.h        |  51 ---
 src/kernel/include/kernel.h    |  27 --
 src/kernel/include/kmm.h       |  10 -
 src/kernel/include/kprintf.h   |   7 -
 src/kernel/include/modules.h   |   9 -
 src/kernel/include/multiboot.h | 189 --------
 src/kernel/include/paging.h    |  24 -
 src/kernel/include/phys.h      |  13 -
 src/kernel/include/rpc.h       |  17 -
 src/kernel/include/shm.h       |  61 ---
 src/kernel/include/syscall.h   |  22 -
 src/kernel/include/tasks.h     |  82 ----
 src/kernel/include/timer.h     |  48 --
 src/kernel/include/tss.h       |  49 --
 src/kernel/include/vm86.h      |  53 ---
 src/kernel/include/vmm.h       |  53 ---
 src/kernel/src/Makefile.all    |   6 -
 src/kernel/src/console.c       | 618 --------------------------
 src/kernel/src/debug.c         | 263 -----------
 src/kernel/src/gdt.c           | 137 ------
 src/kernel/src/header.asm      |  90 ----
 src/kernel/src/init.c          | 183 --------
 src/kernel/src/intr.c          | 584 ------------------------
 src/kernel/src/io.c            | 232 ----------
 src/kernel/src/kernel.ld       |  37 --
 src/kernel/src/kprintf.c       | 207 ---------
 src/kernel/src/liballoc.c      |  37 --
 src/kernel/src/mm/Makefile.all |   1 -
 src/kernel/src/mm/kmm.c        | 348 ---------------
 src/kernel/src/mm/paging.c     | 476 --------------------
 src/kernel/src/mm/phys.c       | 599 -------------------------
 src/kernel/src/mm/shm.c        | 129 ------
 src/kernel/src/modules.c       | 371 ----------------
 src/kernel/src/rpc.c           | 343 --------------
 src/kernel/src/schedule.c      | 195 --------
 src/kernel/src/stubs.asm       | 145 ------
 src/kernel/src/syscall.c       | 785 ---------------------------------
 src/kernel/src/task.c          | 422 ------------------
 src/kernel/src/timer.c         | 130 ------
 src/kernel/src/tss.c           |  44 --
 src/kernel/src/vm86.c          | 392 ----------------
 48 files changed, 7687 deletions(-)
 delete mode 100644 src/kernel/.nobuild
 delete mode 100644 src/kernel/include/bitops.h
 delete mode 100644 src/kernel/include/console.h
 delete mode 100644 src/kernel/include/cpu.h
 delete mode 100644 src/kernel/include/debug.h
 delete mode 100644 src/kernel/include/gdt.h
 delete mode 100644 src/kernel/include/intr.h
 delete mode 100644 src/kernel/include/io.h
 delete mode 100644 src/kernel/include/kernel.h
 delete mode 100644 src/kernel/include/kmm.h
 delete mode 100644 src/kernel/include/kprintf.h
 delete mode 100644 src/kernel/include/modules.h
 delete mode 100644 src/kernel/include/multiboot.h
 delete mode 100644 src/kernel/include/paging.h
 delete mode 100644 src/kernel/include/phys.h
 delete mode 100644 src/kernel/include/rpc.h
 delete mode 100644 src/kernel/include/shm.h
 delete mode 100644 src/kernel/include/syscall.h
 delete mode 100644 src/kernel/include/tasks.h
 delete mode 100644 src/kernel/include/timer.h
 delete mode 100644 src/kernel/include/tss.h
 delete mode 100644 src/kernel/include/vm86.h
 delete mode 100644 src/kernel/include/vmm.h
 delete mode 100644 src/kernel/src/Makefile.all
 delete mode 100644 src/kernel/src/console.c
 delete mode 100644 src/kernel/src/debug.c
 delete mode 100644 src/kernel/src/gdt.c
 delete mode 100644 src/kernel/src/header.asm
 delete mode 100644 src/kernel/src/init.c
 delete mode 100644 src/kernel/src/intr.c
 delete mode 100644 src/kernel/src/io.c
 delete mode 100644 src/kernel/src/kernel.ld
 delete mode 100644 src/kernel/src/kprintf.c
 delete mode 100644 src/kernel/src/liballoc.c
 delete mode 100644 src/kernel/src/mm/Makefile.all
 delete mode 100644 src/kernel/src/mm/kmm.c
 delete mode 100644 src/kernel/src/mm/paging.c
 delete mode 100644 src/kernel/src/mm/phys.c
 delete mode 100644 src/kernel/src/mm/shm.c
 delete mode 100644 src/kernel/src/modules.c
 delete mode 100644 src/kernel/src/rpc.c
 delete mode 100644 src/kernel/src/schedule.c
 delete mode 100644 src/kernel/src/stubs.asm
 delete mode 100644 src/kernel/src/syscall.c
 delete mode 100644 src/kernel/src/task.c
 delete mode 100644 src/kernel/src/timer.c
 delete mode 100644 src/kernel/src/tss.c
 delete mode 100644 src/kernel/src/vm86.c

diff --git a/src/kernel/.nobuild b/src/kernel/.nobuild
deleted file mode 100644
index e69de29b..00000000
diff --git a/src/kernel/include/bitops.h b/src/kernel/include/bitops.h
deleted file mode 100644
index 5f3e4e18..00000000
--- a/src/kernel/include/bitops.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef BITOPS_H

-#define BITOPS_H

-

-/* Voraussetzung: Mindestens ein Bit von i muss gesetzt sein. */

-static inline unsigned int bit_scan_forward(unsigned int i)

-{

-    unsigned int j;

-#if 0

-    for(j = 0; j < 32; j++)

-    {

-        if(i & (1 << j))

-        {

-            return j;

-        }

-    }

-#else

-    __asm__("bsfl %1, %0\n\t" : "=r"(j) : "g"(i));

-    return j;

-#endif

-}

-

-#endif /* ndef BITOPS_H */

diff --git a/src/kernel/include/console.h b/src/kernel/include/console.h
deleted file mode 100644
index 146e749d..00000000
--- a/src/kernel/include/console.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef CONSOLE_H

-#define CONSOLE_H

-

-extern void con_putc(const char c); // Zeichen ausgeben ohne Auswertung der ANSI-Codes

-extern void con_putc_ansi(const char c); // Zeichen ausgeben mit Auswertung der ANSI-Codes

-extern void con_puts(const char * s); // Zeichenkette ausgeben mit Auswertung der ANSI-Codes

-extern void con_putsn(unsigned int n, const char * s); // wie con_puts, allerdings werden maximal n Bytes ausgewertet

-extern void con_flush_ansi_escape_code_sequence(void); // Zwischenspeicher leeren

-

-#endif /* ndef CONSOLE_H */

diff --git a/src/kernel/include/cpu.h b/src/kernel/include/cpu.h
deleted file mode 100644
index 7e02c047..00000000
--- a/src/kernel/include/cpu.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef CPU_H

-#define CPU_H

-

-#include <stdint.h>

-

-#define CR0_PE		0x00000001 // Protection Enable

-#define CR0_PG		0x80000000 // Paging

-

-#define CR4_PSE		0x00000010 // Page Size Extensions

-

-// eflags register

-#define FL_TF		0x00000100 // Trap Flag

-#define FL_IF		0x00000200 // Interrupt Flag

-#define FL_IOPL0	0x00000000 // I/O Privilege Level 0

-#define FL_IOPL1	0x00001000 // I/O Privilege Level 1

-#define FL_IOPL2	0x00002000 // I/O Privilege Level 2

-#define FL_IOPL3	0x00003000 // I/O Privilege Level 3

-#define FL_NT		0x00004000 // Nested Task

-#define FL_RF		0x00010000 // Resume Flag

-#define FL_VM		0x00020000 // Virtual 8086 mode

-

-static inline uint32_t read_cr2(void)

-{

-    uint32_t ret;

-    __asm volatile ("mov %%cr2, %0" : "=r"(ret));

-    return ret;

-}

-

-#endif /* ndef CPU_H */

diff --git a/src/kernel/include/debug.h b/src/kernel/include/debug.h
deleted file mode 100644
index ce53df58..00000000
--- a/src/kernel/include/debug.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <stdint.h>

-#include <stdbool.h>

-

-/* Debug-Funktionen und Helferlein */

-

-#define DEBUG_FLAG_INIT 1

-#define DEBUG_FLAG_STACK_BACKTRACE 2

-#define DEBUG_FLAG_PEDANTIC 4

-#define DEBUG_FLAG_SYSCALL 8

-#define DEBUG_FLAG_NO_KCONSOLE 16

-

-/* Int2Str , Wandelt signed ints in Strings um */

-char* int2str(signed int value,char *result);

-

-/* Einfache Print-Funktion f�r grundlegende Ausgaben */

-void print(char *string,const int len);

-

-///Setzt die richtigen Debug-Flags anhand der Commandline vom bootloader

-void debug_parse_cmdline(char* cmdline);

-

-///Ueberprueft ob ein bestimmtes Debug-Flag gesetzt ist

-bool debug_test_flag(uint32_t flag);

-

-///Gibt die Debug-Meldung aus, wenn das Flag gesetzt ist

-void debug_print(uint32_t flag, const char* message);

-

-/* 

- * Gibt einen Stack Backtrace aus, beginnend an den �bergebenen Werten

- * f�r ebp und eip

- */

-void stack_backtrace_ebp(uint32_t start_ebp, uint32_t start_eip);

diff --git a/src/kernel/include/gdt.h b/src/kernel/include/gdt.h
deleted file mode 100644
index 12e78794..00000000
--- a/src/kernel/include/gdt.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef GDT_H
-#define GDT_H
-
-#include <stdint.h>
-
-#define GDT_SIZE 6
-
-#define GDT_CODESEG 0x0A
-#define GDT_DATASEG 0x02
-#define GDT_TSS 0x09
-#define GDT_PRESENT 0x80
-#define GDT_SEGMENT 0x10
-
-#define SYS_CODE_SEL 0x08
-#define SYS_DATA_SEL 0x10
-#define USER_CODE_SEL 0x18
-#define USER_DATA_SEL 0x20
-#define TSS_SEL 0x28
-
-void init_gdt(void);
-void gdt_set_descriptor(int segment, uint32_t size, uint32_t base,
-    uint8_t access, int dpl);
-void gdt_set_descriptor_byte_granularity(int segment, uint32_t size,
-    uint32_t base, uint8_t access, int dpl);
-
-#endif
diff --git a/src/kernel/include/intr.h b/src/kernel/include/intr.h
deleted file mode 100644
index 99305021..00000000
--- a/src/kernel/include/intr.h
+++ /dev/null
@@ -1,80 +0,0 @@
-#ifndef INTR_H
-#define INTR_H
-
-#include <stdint.h>
-
-#include "tasks.h"
-
-#define SYSCALL_INTERRUPT 0x30
-
-#define IDT_SIZE 256
-
-#define IDT_TASK_GATE 0x9
-#define IDT_INTERRUPT_GATE 0xe
-#define IDT_TRAP_GATE 0xf
-
-#define IDT_DESC_PRESENT 0x80
-
-void init_idt(void);
-void set_intr(int intr, uint16_t selector, void* handler, int dpl, int type);
-void set_intr_handling_task(uint8_t intr, struct task * task);
-void remove_intr_handling_task(struct task* task);
-
-typedef void(*pfIrqHandler)(int, uint32_t*);
-
-#define IRQ_BASE 0x20
-
-#define PIC1            0x20           /* IO base address for master PIC */
-#define PIC2            0xA0           /* IO base address for slave PIC */
-#define PIC1_COMMAND    PIC1
-#define PIC1_DATA       (PIC1+1)
-#define PIC2_COMMAND    PIC2
-#define PIC2_DATA       (PIC2+1)
-#define PIC_EOI         0x20            /* End - of - interrupt command code */
-
-#define ICW1_ICW4       0x01            /* ICW4 (not) needed */
-#define ICW1_SINGLE     0x02            /* Single (cascade) mode */
-#define ICW1_INTERVAL4  0x04            /* Call address interval 4 (8) */
-#define ICW1_LEVEL      0x08            /* Level triggered (edge) mode */
-#define ICW1_INIT       0x10            /* Initialization - required! */
-
-#define ICW4_8086       0x01            /* 8086/88 (MCS-80/85) mode */
-#define ICW4_AUTO       0x02            /* Auto (normal) EOI */
-#define ICW4_BUF_SLAVE  0x08            /* Buffered mode/slave */
-#define ICW4_BUF_MASTER 0x0C            /* Buffered mode/master */
-#define ICW4_SFNM       0x10            /* Special fully nested (not) */
-
-int request_irq(int irq, void * handler);
-int release_irq(int irq);
-
-inline static void enable_interrupts(void) { __asm__ __volatile__("sti"); }
-inline static void disable_interrupts(void) { __asm__ __volatile__("cli"); }
-
-void disable_irq(uint8_t irq);
-void enable_irq(uint8_t irq);
-
-struct int_stack_frame
-{
-    uint16_t gs  __attribute__((aligned(4)));
-    uint16_t fs  __attribute__((aligned(4)));
-    uint16_t es  __attribute__((aligned(4)));
-    uint16_t ds  __attribute__((aligned(4)));
-    uint32_t edi;
-    uint32_t esi;
-    uint32_t ebp;
-    uint32_t esp_;
-    uint32_t ebx;
-    uint32_t edx;
-    uint32_t ecx;
-    uint32_t eax;
-    uint32_t interrupt_number;
-    uint32_t error_code;
-    uint32_t eip;
-    uint32_t cs;
-    uint32_t eflags;
-    uint32_t esp;
-    uint32_t ss;
-};
-
-
-#endif
diff --git a/src/kernel/include/io.h b/src/kernel/include/io.h
deleted file mode 100644
index bf22d8db..00000000
--- a/src/kernel/include/io.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*  
- * Copyright (c) 2007 The tyndur Project. All rights reserved.
- *
- * This code is derived from software contributed to the tyndur Project
- * by Kevin Wolf.
- *
- * 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 tyndur Project
- *     and its contributors.
- * 4. Neither the name of the tyndur 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 HOLDERS 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.
- */  
-
-#ifndef _IO_H_
-#define _IO_H_
-
-#include <stdint.h>
-
-#include "tasks.h"
-
-void init_io_ports(void);
-bool io_ports_request(struct task* task, uint32_t port, uint32_t length);
-bool io_ports_release(struct task* task, uint32_t port, uint32_t length);
-void io_ports_release_all(struct task* task);
-
-//Nur fuer Debugen einsetzen!
-void io_ports_check(struct task* task);
-
-#endif
diff --git a/src/kernel/include/kernel.h b/src/kernel/include/kernel.h
deleted file mode 100644
index e5ba427c..00000000
--- a/src/kernel/include/kernel.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef KERNEL_H

-#define KERNEL_H

-    

-//#define COOPERATIVE_MULTITASKING
-
-#include <stdint.h>
-#include <types.h>
-
-__attribute__((noreturn)) void panic(char * message, ...);
-
-paddr_t phys_alloc_page(void);
-paddr_t phys_alloc_page_range(unsigned int num);
-
-paddr_t phys_alloc_dma_page(void);
-paddr_t phys_alloc_dma_page_range(unsigned int num);
-
-paddr_t phys_alloc_page_limit(uint32_t lower_limit);
-
-void phys_free_page(paddr_t page);
-void phys_free_page_range(paddr_t page, unsigned int num);
-
-extern void kernel_start(void);
-extern void kernel_phys_start(void);
-extern void kernel_end(void);

-extern void kernel_phys_end(void);

-

-#endif /* ndef KERNEL_H */

diff --git a/src/kernel/include/kmm.h b/src/kernel/include/kmm.h
deleted file mode 100644
index a895fd07..00000000
--- a/src/kernel/include/kmm.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef KMM_H
-#define KMM_H
-
-#include "types.h"
-
-vaddr_t find_contiguous_kernel_pages(int num);
-vaddr_t map_phys_addr(paddr_t paddr, size_t size);
-void free_phys_addr(vaddr_t vaddr, size_t size);
-
-#endif
diff --git a/src/kernel/include/kprintf.h b/src/kernel/include/kprintf.h
deleted file mode 100644
index c33ba814..00000000
--- a/src/kernel/include/kprintf.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef KPRINTF_H

-#define KPRINTF_H

-

-extern void kprintf(char * format, ...);

-extern void kaprintf(char * format, int ** args);

-

-#endif /* ndef KPRINTF_H */

diff --git a/src/kernel/include/modules.h b/src/kernel/include/modules.h
deleted file mode 100644
index 1b0da44a..00000000
--- a/src/kernel/include/modules.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef MODULES_H
-#define MODULES_H
-
-#include "multiboot.h"
-
-void load_init_module(struct multiboot_info * multiboot_info);
-void load_multiboot_modules(struct multiboot_info * multiboot_info);
-
-#endif
diff --git a/src/kernel/include/multiboot.h b/src/kernel/include/multiboot.h
deleted file mode 100644
index 696679a7..00000000
--- a/src/kernel/include/multiboot.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/*-

- * Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.

- * All rights reserved.

- *

- * This code is derived from software contributed to The NetBSD Foundation

- * by Julio M. Merino Vidal.

- *

- * 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 NetBSD

- *	Foundation, Inc. and its contributors.

- * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.

- */

-

-

-#ifndef MULTIBOOT_H

-#define MULTIBOOT_H

-

-#include <stdint.h>

-#include <types.h>

-

-/* --------------------------------------------------------------------- */

-

-/*

- * Multiboot header structure.

- */

-#define MULTIBOOT_HEADER_MAGIC		    0x1BADB002

-#define MULTIBOOT_HEADER_MODS_ALIGNED	0x00000001

-#define MULTIBOOT_HEADER_WANT_MEMORY	0x00000002

-#define MULTIBOOT_HEADER_HAS_VBE	    0x00000004

-#define MULTIBOOT_HEADER_HAS_ADDR   	0x00010000

-

-struct multiboot_header {

-	uint32_t   mh_magic;

-	uint32_t   mh_flags;

-	uint32_t   mh_checksum;

-

-	/* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_ADDR. */

-	paddr_t mh_header_addr;

-	paddr_t mh_load_addr;

-	paddr_t mh_load_end_addr;

-	paddr_t mh_bss_end_addr;

-	paddr_t mh_entry_addr;

-

-	/* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_VBE. */

-	uint32_t   mh_mode_type;

-	uint32_t   mh_width;

-	uint32_t   mh_height;

-	uint32_t   mh_depth;

-};

-

-/* --------------------------------------------------------------------- */

-

-/*

- * Multiboot information structure.

- */

-#define MULTIBOOT_INFO_MAGIC		    0x2BADB002

-#define MULTIBOOT_INFO_HAS_MEMORY	    0x00000001

-#define MULTIBOOT_INFO_HAS_BOOT_DEVICE	0x00000002

-#define MULTIBOOT_INFO_HAS_CMDLINE	    0x00000004

-#define MULTIBOOT_INFO_HAS_MODS		    0x00000008

-#define MULTIBOOT_INFO_HAS_AOUT_SYMS	0x00000010

-#define MULTIBOOT_INFO_HAS_ELF_SYMS	    0x00000020

-#define MULTIBOOT_INFO_HAS_MMAP		    0x00000040

-#define MULTIBOOT_INFO_HAS_DRIVES	    0x00000080

-#define MULTIBOOT_INFO_HAS_CONFIG_TABLE	0x00000100

-#define MULTIBOOT_INFO_HAS_LOADER_NAME	0x00000200

-#define MULTIBOOT_INFO_HAS_APM_TABLE	0x00000400

-#define MULTIBOOT_INFO_HAS_VBE		    0x00000800

-

-struct multiboot_info {

-	uint32_t	mi_flags;

-

-	/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MEMORY. */

-	uint32_t	mi_mem_lower;

-	uint32_t	mi_mem_upper;

-

-	/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_BOOT_DEVICE. */

-	uint8_t	mi_boot_device_part3;

-	uint8_t	mi_boot_device_part2;

-	uint8_t	mi_boot_device_part1;

-	uint8_t	mi_boot_device_drive;

-

-	/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_CMDLINE. */

-	char *	mi_cmdline;

-

-	/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MODS. */

-	uint32_t	mi_mods_count;

-	struct multiboot_module * mi_mods_addr;

-

-	/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_{AOUT,ELF}_SYMS. */

-	uint32_t	mi_elfshdr_num;

-	uint32_t	mi_elfshdr_size;

-	vaddr_t	mi_elfshdr_addr;

-	uint32_t	mi_elfshdr_shndx;

-

-	/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MMAP. */

-	uint32_t	mi_mmap_length;

-	vaddr_t	mi_mmap_addr;

-

-	/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_DRIVES. */

-	uint32_t	mi_drives_length;

-	vaddr_t	mi_drives_addr;

-

-	/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_CONFIG_TABLE. */

-	void *	unused_mi_config_table;

-

-	/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_LOADER_NAME. */

-	char *	mi_loader_name;

-

-	/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_APM. */

-	void *	unused_mi_apm_table;

-

-	/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_VBE. */

-	void *	unused_mi_vbe_control_info;

-	void *	unused_mi_vbe_mode_info;

-	paddr_t	unused_mi_vbe_interface_seg;

-	paddr_t	unused_mi_vbe_interface_off;

-	uint32_t	unused_mi_vbe_interface_len;

-};

-

-extern struct multiboot_info multiboot_info;

-

-/* --------------------------------------------------------------------- */

-

-/*

- * Drive information.  This describes an entry in the drives table as

- * pointed to by mi_drives_addr.

- */

-struct multiboot_drive {

-	uint32_t	md_length;

-	uint8_t	md_number;

-	uint8_t	md_mode;

-	uint16_t	md_cylinders;

-	uint8_t	md_heads;

-	uint8_t	md_sectors;

-

-	/* The variable-sized 'ports' field comes here, so this structure

-	 * can be longer. */

-};

-

-/* --------------------------------------------------------------------- */

-

-/*

- * Memory mapping.  This describes an entry in the memory mappings table

- * as pointed to by mi_mmap_addr.

- *

- * Be aware that mm_size specifies the size of all other fields *except*

- * for mm_size.  In order to jump between two different entries, you

- * have to count mm_size + 4 bytes.

- */

-struct multiboot_mmap {

-	uint32_t	mm_size;

-	uint64_t	mm_base_addr;

-	uint64_t	mm_length;

-	uint32_t	mm_type;

-};

-

-

-struct multiboot_module {

-  vaddr_t start;

-  vaddr_t end;

-  char* cmdline;

-  uint32_t reserved;

-};

-

-#endif

diff --git a/src/kernel/include/paging.h b/src/kernel/include/paging.h
deleted file mode 100644
index 2c81cd21..00000000
--- a/src/kernel/include/paging.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef PAGING_H
-#define PAGING_H
-
-#include <types.h>
-#include <stdint.h>
-
-#include "vmm.h"
-#include "tasks.h"
-
-extern page_directory_t kernel_page_directory;
-
-bool map_page_range(page_directory_t page_directory, vaddr_t vaddr, paddr_t paddr, int flags, int num_pages);
-bool map_page(page_directory_t page_directory, vaddr_t vaddr, paddr_t paddr, int flags);
-bool unmap_page(page_directory_t page_directory, vaddr_t vaddr);
-paddr_t resolve_vaddr(page_directory_t page_directory, vaddr_t vaddr);
-bool is_userspace(vaddr_t start, uint32_t len);
-
-vaddr_t find_contiguous_pages(page_directory_t page_directory, int num,
-    uint32_t lower_limit, uint32_t upper_limit);
-void increase_user_stack_size(struct task * task_ptr, int pages);
-
-extern bool kernel_identity_map(paddr_t paddr, uint32_t bytes);
-
-#endif
diff --git a/src/kernel/include/phys.h b/src/kernel/include/phys.h
deleted file mode 100644
index 7d8e54fa..00000000
--- a/src/kernel/include/phys.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef _PHYS_H_
-#define _PHYS_H_
-
-#include <types.h>
-
-void phys_mark_page_as_free(paddr_t page);
-unsigned long phys_count_free_pages(void);
-unsigned long phys_count_pages(void);
-
-paddr_t phys_alloc_dma_page_range_64k(unsigned int num);
-
-#endif
-
diff --git a/src/kernel/include/rpc.h b/src/kernel/include/rpc.h
deleted file mode 100644
index 11adc234..00000000
--- a/src/kernel/include/rpc.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef _RPC_H_
-#define _RPC_H_
-
-#include <stdint.h>
-#include <stdbool.h>
-
-#include "tasks.h"
-#include "intr.h"
-
-bool fastrpc(struct task * callee, uint32_t metadata_size, void* metadata, uint32_t data_size, void* data);
-bool fastrpc_irq(struct task * callee, uint32_t metadata_size, void* metadata, 
-    uint32_t data_size, void* data, uint8_t irq);
-
-void return_from_rpc(struct int_stack_frame ** esp);
-void rpc_destroy_task_backlinks(struct task* destroyed_task);
-
-#endif
diff --git a/src/kernel/include/shm.h b/src/kernel/include/shm.h
deleted file mode 100644
index 1dc253ca..00000000
--- a/src/kernel/include/shm.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*  
- * Copyright (c) 2007 The tyndur Project. All rights reserved.
- *
- * This code is derived from software contributed to the tyndur Project
- * by Mathias Gottschlag.
- *
- * 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 tyndur Project
- *     and its contributors.
- * 4. Neither the name of the tyndur 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 HOLDERS 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.
- */  
-
-#ifndef SHM_H
-#define SHN_H
-
-#include <stdint.h>
-#include <types.h>
-#include <collections.h>
-
-#include "tasks.h"
-
-typedef struct shm_table_entry_t
-{
-    paddr_t *addresses;
-    uint32_t pagecount;
-    uint32_t id;
-    uint32_t usecount; //Anzahl der angefügten Prozesse
-} shm_table_entry_t;
-
-//Tabelle aller shm-Bereiche
-extern list_t *shm_table;
-
-void init_shared_memory(void);
-uint32_t create_shared_memory(uint32_t size);
-vaddr_t attach_task_to_shm(struct task *task, uint32_t id);
-void detach_task_from_shm(struct task *task, uint32_t id);
-
-#endif
diff --git a/src/kernel/include/syscall.h b/src/kernel/include/syscall.h
deleted file mode 100644
index 9359ac24..00000000
--- a/src/kernel/include/syscall.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef SYSCALL_H
-#define SYSCALL_H
-
-#include <stdint.h>
-#include <stdbool.h>
-
-#include "intr.h"
-#include "syscallno.h"
-#include <lost/config.h>
-
-#ifdef CONFIG_DEBUG_LAST_SYSCALL
-#define DEBUG_LAST_SYSCALL_DATA_SIZE 4
-extern uint32_t debug_last_syscall_no;
-extern pid_t debug_last_syscall_pid;
-extern uint32_t debug_last_syscall_data[DEBUG_LAST_SYSCALL_DATA_SIZE];
-#endif
-
-void syscall(struct int_stack_frame ** esp);
-
-bool syscall_rpc(uint32_t callee_pid, uint32_t data_size, char* data);
-
-#endif
diff --git a/src/kernel/include/tasks.h b/src/kernel/include/tasks.h
deleted file mode 100644
index f943e48a..00000000
--- a/src/kernel/include/tasks.h
+++ /dev/null
@@ -1,82 +0,0 @@
-#ifndef TASKS_H
-#define TASKS_H
-
-#include <types.h>
-#include <stdint.h>
-#include <stdbool.h>
-
-#include "vmm.h"
-#include "collections.h"
-#include "syscall_structs.h"
-
-#define TS_RUNNING 0
-#define TS_WAIT_FOR_RPC 1
-
-typedef struct
-{
-    uint32_t *meminfo;
-    vm86_regs_t *regs;
-} vm86_info_t;
-
-struct task
-{
-    pid_t pid;
-    uint32_t esp;
-    uint32_t kernel_stack;
-    uint32_t type;
-    vaddr_t rpc_handler;
-    list_t* rpcs;
-    page_directory_t cr3;
-    uint32_t pd_id;
-    uint32_t slices;
-    uint32_t blocked_by_pid;
-    uint32_t blocked_count;
-    vaddr_t user_stack_bottom;
-    uint32_t status;
-    
-    struct task* parent_task;
-
-    const char* cmdline;
-    
-    void* io_bitmap;
-
-    struct task* next_task;
-
-//Scheduling-Infos
-    ///Das Maximum der Zeit, die der Task die CPU benutzen darf
-    uint8_t schedule_ticks_max;
-    ///Verbleibende Zeit
-    int schedule_ticks_left;
-    
-    //Shared Memory
-    list_t *shmids;
-    list_t *shmaddresses;
-
-    // Benutzter speicher
-    uint32_t memory_used;
-    
-    // VM86-Info
-    bool vm86;
-    vm86_info_t *vm86_info;
-};
-
-extern struct task* current_task;
-extern struct task* first_task;
-
-void schedule(uint32_t* esp);
-void schedule_to_task(struct task* target_task, uint32_t* esp);
-void set_io_bitmap(void);
-
-// TODO: Nur wegen vm86.c hier
-pid_t generate_pid(void);
-struct task * create_task(void * entry, const char* cmdline, pid_t parent);
-void destroy_task(struct task* task);
-struct task * get_task(pid_t pid);
-
-
-bool block_task(struct task* task, pid_t blocked_by);
-bool unblock_task(struct task* task, pid_t blocked_by);
-
-void abort_task(char* format, ...);
-
-#endif
diff --git a/src/kernel/include/timer.h b/src/kernel/include/timer.h
deleted file mode 100644
index c4ef741c..00000000
--- a/src/kernel/include/timer.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2006-2007 The tyndur Project. All rights reserved.
- *
- * This code is derived from software contributed to the tyndur Project
- * by Kevin Wolf.
- *
- * 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 tyndur Project
- *     and its contributors.
- * 4. Neither the name of the tyndur 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 HOLDERS 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.
- */
-
-#ifndef _TIMER_H_
-#define _TIMER_H_
-
-#include <stdint.h>
-
-#include "tasks.h"
-
-void timer_init(void);
-void timer_register(struct task* task, uint32_t timer_id, uint32_t usec);
-void timer_notify(uint64_t microtime);
-void timer_cancel_all(struct task* task);
-
-#endif
diff --git a/src/kernel/include/tss.h b/src/kernel/include/tss.h
deleted file mode 100644
index fb256205..00000000
--- a/src/kernel/include/tss.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef TSS_H

-#define TSS_H

-

-#include <stdint.h>

-#include <stddef.h>

-

-#define IO_BITMAP_LENGTH 0xffff

-

-// Dieser Wert muss ausserhalb des in der GDT definierten Limits

-// fuer das TSS liegen

-#define TSS_IO_BITMAP_NOT_LOADED (sizeof(tss) + 0x100)

-#define TSS_IO_BITMAP_OFFSET offsetof(tss_t, io_bit_map)

-

-typedef struct tss_s

-{

-	uint32_t backlink;

-	uint32_t esp0;

-	uint32_t ss0;

-	uint32_t esp1;

-	uint32_t ss1;

-	uint32_t esp2;

-	uint32_t ss2;

-	uint32_t cr3;

-	uint32_t eip;

-	uint32_t eflags;

-	uint32_t eax;

-	uint32_t ecx;

-	uint32_t edx;

-	uint32_t ebx;

-	uint32_t esp;

-	uint32_t ebp;

-	uint32_t esi;

-	uint32_t edi;

-	uint32_t es;

-	uint32_t cs;

-	uint32_t ss;

-	uint32_t ds;

-	uint32_t fs;

-	uint32_t gs;

-	uint32_t ldt;

-	uint16_t trace_trap;

-	uint16_t io_bit_map_offset;

-    uint8_t io_bit_map[IO_BITMAP_LENGTH / 8];

-    uint8_t io_bit_map_end;

-} __attribute__((packed)) tss_t;

-

-extern tss_t tss;

-

-#endif /* ndef TSS_H */

diff --git a/src/kernel/include/vm86.h b/src/kernel/include/vm86.h
deleted file mode 100644
index 0c0dee0e..00000000
--- a/src/kernel/include/vm86.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*  
- * Copyright (c) 2007 The tyndur Project. All rights reserved.
- *
- * This code is derived from software contributed to the tyndur Project
- * by Mathias Gottschlag.
- *
- * 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 tyndur Project
- *     and its contributors.
- * 4. Neither the name of the tyndur 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 HOLDERS 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.
- */
-
-#ifndef VM86_H
-#define VM86_h
-
-#include <stdint.h>
-#include <stdbool.h>
-
-#include "tasks.h"
-
-void save_bios_data(void);
-uint16_t *get_ivt_entry(uint16_t interrupt);
-
-struct task * create_vm86_task(uint16_t interrupt, vm86_regs_t *regs,
-    uint32_t *meminfo, struct task *parent);
-
-bool vm86_exception(uint32_t *esp);
-
-#endif
-
diff --git a/src/kernel/include/vmm.h b/src/kernel/include/vmm.h
deleted file mode 100644
index fefa1dbf..00000000
--- a/src/kernel/include/vmm.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef VMM_H

-#define VMM_H

-

-#define PAGE_DIRECTORY_LENGTH 1024

-#define PAGE_TABLE_LENGTH 1024

-

-#define PAGE_SHIFT 12

-#define PAGE_SIZE (1 << PAGE_SHIFT)

-#define PAGE_MASK (~(PAGE_SIZE - 1))

-

-// Die Anzahl der Pages, die von n Bytes belegt werden.

-#define NUM_PAGES(n) ((((n) + ~PAGE_MASK) & PAGE_MASK) / PAGE_SIZE)

-

-// Rundet eine Adresse auf das kleinste Vielfache von PAGE_SIZE > n auf

-#define PAGE_ALIGN_ROUND_UP(n) (((n) + ~PAGE_MASK) & PAGE_MASK)

-

-// Rundet eine Adresse auf das gr��te Vielfache von PAGE_SIZE < n ab

-#define PAGE_ALIGN_ROUND_DOWN(n) ((n) & PAGE_MASK)

-

-#define PGDIR_SHIFT 22

-

-#define PTE_P       0x001 // present

-#define PTE_W       0x002 // writable

-#define PTE_U       0x004 // user

-#define PTE_PWT     0x008 // write-through

-#define PTE_PCT     0x010 // cache-disable

-#define PTE_A       0x020 // accessed

-#define PTE_D       0x040 // dirty

-#define PTE_PS      0x080 // page size

-

-#define PTE_AVAIL1  0x200 // available for software use

-#define PTE_AVAIL2  0x400 // available for software use

-#define PTE_AVAIL3  0x800 // available for software use

-

-typedef unsigned long * page_directory_t;

-typedef unsigned long * page_table_t;

-

-typedef enum { page_4K, page_4M } page_size_t;

-

-// Die Adresse, an der der Kernel-Adressraum beginnt

-#define KERNEL_BASE 0x00000000

-

-// Die Anzahl der Page Tables, die f�r den Kerneladressraum ben�tigt werden

-#define NUM_KERNEL_PAGE_TABLES (PAGE_DIRECTORY_LENGTH - (KERNEL_BASE >> PGDIR_SHIFT))

-

-// Alle Kernel Page Tables werden nach KERNEL_PAGE_TABLES_VADDR gemappt

-#define KERNEL_PAGE_TABLES_VADDR 0x3fc00000

-

-

-#define USER_MEM_START 0x40000000

-#define USER_MEM_END   0xffffffff

-

-#endif /* ndef VMM_H */

diff --git a/src/kernel/src/Makefile.all b/src/kernel/src/Makefile.all
deleted file mode 100644
index bf927398..00000000
--- a/src/kernel/src/Makefile.all
+++ /dev/null
@@ -1,6 +0,0 @@
-shopt -s extglob
-source $LOST_BUILDMK_ROOT/config.sh
-
-echo "LD   $1/kernel/tyndur"
-$LOST_TOOLS_LD -otyndur.krn -Tkernel.ld *.o $2
-mv tyndur.krn $1/kernel/tyndur
diff --git a/src/kernel/src/console.c b/src/kernel/src/console.c
deleted file mode 100644
index 383afb10..00000000
--- a/src/kernel/src/console.c
+++ /dev/null
@@ -1,618 +0,0 @@
-/*
- * Copyright (c) 2006 The tyndur Project. All rights reserved.
- *
- * This code is derived from software contributed to the tyndur Project
- * by Burkhard Weseloh.
- *
- * 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 tyndur Project
- *     and its contributors.
- * 4. Neither the name of the tyndur 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 HOLDERS 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.
- */
-
-#include <stdint.h>
-
-#include "string.h"
-#include "ports.h"
-#include <debug.h>
-
-/*
- * Das hier ist eine sehr beschr�nkte Untermenge der ANSI Escape Codes. Alle
- * Sequenzen werden mit dem ASCII Zeichen ESC (Wert 0x1b) eingeleitet. ESC
- * soll im folgenden dieses Zeichen darstellen. Wir k�nnen folgende Escape 
- * Sequenzen behandeln:
- *
- * ESC[#A - Cursor um # Zeilen nach oben bewegen
- * ESC[#B - Cursor um # Zeilen nach unten bewegen
- * ESC[#C - Cursor um # Zeilen nach rechts bewegen
- * ESC[#D - Cursor um # Zeilen nach links bewegen
- * ESC[2J - Bildschirm leeren
- * ESC[K - Bis Zeile von der Cursor-Position zum Ende leeren
- * ESC[#m oder ESC[#;#m - Vorder- und Hintergrundfarbe �ndern, Fettschrift, Blinken
- * ESC[s - Cursor-Position speichern
- * ESC[u - Cursor-Position wiederherstellen
- *
- * Folgende Farbcodes werden bei und ESC[#m oder ESC[#;#m unterst�tzt:
- * - Attribute:
- *  0 - Normale Schrift
- *  1 - Fett
- *  5 - Blinken
- * - Vordergrundfarben:
- *  30 - Schwarz
- *  31 - Rot
- *  32 - Gr�n
- *  33 - Gelb
- *  34 - Blau
- *  35 - Magenta
- *  36 - Cyan
- *  37 - Weiss
- * - Hintergrundfarben:
- *  40 - Schwarz
- *  41 - Rot
- *  42 - Gr�n
- *  43 - Gelb
- *  44 - Blau
- *  45 - Magenta
- *  46 - Cyan
- *  47 - Weiss
- *
- * Es k�nnen nur 1 oder 2 Farbcodes pro Escape-Sequenz angewendet werden.
- *
- * Ung�ltige und nicht erkannte Sequenzen werden einfach ausgegeben.
- */
-
-#define ASCII_ESC 0x1b
-
-#define SCREEN_WIDTH 80
-#define SCREEN_HEIGHT 25
-
-static void con_set_hw_cursor(void);
-
-static unsigned short * vidmem = (unsigned short*)0xb8000;
-
-// Aktuelle Cursor-Position
-static unsigned int cursor_x;
-static unsigned int cursor_y;
-
-typedef enum ansi_esc_seq_status
-{
-    INVALID = 0,
-    SUCCESS,
-    NEED_MORE,
-} ansi_esc_seq_status_t;
-
-// Puffer f�r die ANSI-Sequenzen
-static char ansi_buf[16];
-static unsigned int ansi_buf_ofs = 0;
-
-// Aufschl�sselung des Attribut-Bytes vom Text Modus
-static union
-{
-    unsigned char _color;
-    struct 
-    {
-        unsigned char foreground : 3;
-        unsigned char bold : 1;
-        unsigned char background : 3;
-        unsigned char blink : 1;
-    };
-} con_color;
-
-/**
- * Setzt die Cursor-Position
- */
-static void con_set_cursor_pos(unsigned int x, unsigned int y)
-{
-    if(x >= SCREEN_WIDTH)
-    {
-        cursor_x = SCREEN_WIDTH - 1;
-    }
-    else
-    {
-        cursor_x = x;
-    }
-
-    if(y >= SCREEN_HEIGHT)
-    {
-        cursor_y = SCREEN_HEIGHT - 1;
-    }
-    else
-    {
-        cursor_y = y;
-    }
-
-    con_set_hw_cursor();
-}
-
-/**
- * Leert den Bildschirm
- */
-static void con_clear_screen(void)
-{
-    int i;
-
-    for(i = 0; i < SCREEN_WIDTH * SCREEN_HEIGHT; i++)
-    {
-        vidmem[i] = con_color._color << 8;
-    }
-    
-    con_set_cursor_pos(0, 0);
-}
-
-/**
- * Scrollt eine Zeile nach unten
- */
-static void scroll_down(void)
-{
-    int i;
-    
-    memmove(vidmem, vidmem + SCREEN_WIDTH, SCREEN_WIDTH * (SCREEN_HEIGHT - 1) * 2);
-
-    for(i = SCREEN_WIDTH * (SCREEN_HEIGHT - 1); i < SCREEN_WIDTH * SCREEN_HEIGHT; i++)
-    {
-        vidmem[i] = con_color._color << 8;
-    }
-
-    con_set_cursor_pos(cursor_x, cursor_y - 1);
-}
-
-/**
- * Setzt die Attribute f�r die folgenden Ausgabe entsprechend der obigen Liste.
- */
-static ansi_esc_seq_status_t handle_ansi_formatting_sequence_number(int n)
-{
-    static char colors[8] = { 0, 4, 2, 6, 1, 5, 3, 7 }; /* Zum Umrechnen der ANSI Farbcodes in die VGA Palette. */
-
-    switch(n)
-    {
-        case 0: // Normal
-            con_color.bold = 0;
-            con_color.blink = 0;
-            break;
-        
-        case 1: // Fett
-            con_color.bold = 1;
-            break;
-
-        case 5: // Blinken
-            con_color.blink = 1;
-            break;
-
-        case 30 ... 37: // Vordergrundfarbe
-            con_color.foreground = colors[n - 30];
-            break;
-
-        case 40 ... 47: // Hintergrundfarbe
-            con_color.background = colors[n - 40];
-            break;
-
-        default:
-            return INVALID;
-    }
-
-    return SUCCESS;
-}
-
-/**
- * L�scht den Bildschirm von der aktuellen Cursor Position bis zur
- * angegebenen Spalte
- *
- * @return Die Spalte bis zu der gel�scht wurde
- */
-static unsigned int con_clear_to(unsigned int column)
-{
-    int i;
-
-    for(i = cursor_x; i < column; i++)
-    {
-        vidmem[cursor_y * SCREEN_WIDTH + i] = con_color._color << 8;
-    }
-
-    return column;
-}
-
-/**
- * Versucht eine ANSI-Escape-Code-Sequenz zu parsen. 
- *
- * @param ansi_buf Sequenz die ausgewertet werden soll
- * @param ansi_buf_len Anzahl der auszuwertenden Bytes
- * 
- * @return INVALID, wenn die ANSI-Code-Sequenz ung�ltig ist, SUCCESS, wenn die
- *    ANSI-Code-Sequenz erfolgreich ausgewertet wurde, NEED_MORE, wenn die 
- *    Sequenz unvollst�ndig ist, und noch weitere Zeichen zur Auswertung 
- *    eingelesen werden m�ssen.
- */
-static ansi_esc_seq_status_t con_ansi_parse(const char * ansi_buf, unsigned int ansi_buf_len)
-{
-    static unsigned int save_cursor_x;
-    static unsigned int save_cursor_y;
-
-    int i;
-    int n1 = 0, n2 = 0;
-    int have_n1 = 0, have_n2 = 0, have_delimiter = 0;
-    
-    if(ansi_buf_len == 0)
-    {
-        return NEED_MORE;
-    }
-
-    if(ansi_buf[0] != ASCII_ESC)
-    {
-        return INVALID;
-    }
-
-    if(ansi_buf_len == 1)
-    {
-        return NEED_MORE;
-    }
-
-    if(ansi_buf[1] != '[')
-    {
-        return INVALID;
-    }
-
-    if(ansi_buf_len == 2)
-    {
-        return NEED_MORE;
-    }
-
-    for(i = 2; i < ansi_buf_len; i++)
-    {
-        switch(ansi_buf[i])
-        {
-            case '0' ... '9':
-                if(!have_delimiter)
-                {
-                    n1 = n1 * 10 + (ansi_buf[i] - '0');
-                    have_n1 = 1;
-                }
-                else
-                {
-                    n2 = n2 * 10 + (ansi_buf[i] - '0');
-                    have_n2 = 1;
-                }
-                break; // n�chstes Zeichen auswerten
-
-            case ';':
-                if(have_delimiter)
-                {
-                    return INVALID;
-                }
-                have_delimiter = 1;
-                break; // n�chstes Zeichen auswerten
-
-
-            case 'A': // ESC[#A - Cursor um # Zeilen nach oben bewegen
-                if(have_delimiter || !have_n1 || have_n2)
-                {
-                    return INVALID;
-                }
-                con_set_cursor_pos(cursor_x, cursor_y - n1);
-                return SUCCESS;
-
-            case 'B': // ESC[#B - Cursor um # Zeilen nach unten bewegen
-                if(have_delimiter || !have_n1 || have_n2)
-                {
-                    return INVALID;
-                }
-                con_set_cursor_pos(cursor_x, cursor_y + n1);
-                return SUCCESS;
-
-            case 'C': // ESC[#C - Cursor um # Zeilen nach rechts bewegen
-                if(have_delimiter || !have_n1 || have_n2)
-                {
-                    return INVALID;
-                }
-                con_set_cursor_pos(cursor_x + n1, cursor_y);
-                return SUCCESS;
-                
-            case 'D': // ESC[#D - Cursor um # Zeilen nach links bewegen
-                if(have_delimiter || !have_n1 || have_n2)
-                {
-                    return INVALID;
-                }
-                con_set_cursor_pos(cursor_x - n1, cursor_y);
-                return SUCCESS;
-
-            case 'H': // ESC[#;#H - Cursor zur Zeile # und Spalte # bewegen
-            case 'f':
-                if(!have_n1 || !have_n2)
-                {
-                    return INVALID;
-                }
-                
-                con_set_cursor_pos(n1, n2);
-                return SUCCESS;
-
-            case 'J': // ESC[2J - Bildschirm leeren
-                if(have_delimiter || !have_n1 || have_n2 || n1 != 2)
-                {
-                    return INVALID;
-                }
-                con_clear_screen();
-                return SUCCESS;
-
-            case 'K': // ESC[K - Bis Zeile von der Cursor Position zum Ende leeren
-                if(have_delimiter || have_n1 || have_n2)
-                {
-                    return INVALID;
-                }
-                
-                con_clear_to(SCREEN_WIDTH);
-
-                return SUCCESS;
-
-            case 'm': // ESC[#m oder ESC[#;#m - Vorder- und Hintergrundfarbe �ndern, Fettschrift, Blinken
-            {
-                // Attribute sichern
-                unsigned char attr = con_color._color;
-
-                if(!have_n1)
-                {
-                    return INVALID;
-                }
-
-                if(handle_ansi_formatting_sequence_number(n1) != SUCCESS)
-                {
-                    return INVALID;
-                }
-
-                if(have_n2)
-                {
-                    if(handle_ansi_formatting_sequence_number(n2) != SUCCESS)
-                    {
-                        // Bereits uebernommene Aenderungen rueckgaengig machen
-                        con_color._color = attr;
-                        return INVALID;
-                    }
-                }
-
-                return SUCCESS;
-            }
-
-            case 's': // ESC[s - Cursor-Position speichern
-                if(have_delimiter || have_n1 || have_n2)
-                {
-                    return INVALID;
-                }
-                save_cursor_x = cursor_x;
-                save_cursor_y = cursor_y;
-
-                return SUCCESS;
-
-            case 'u': // ESC[u - Cursor-Position wiederherstellen
-                if(have_delimiter || have_n1 || have_n2)
-                {
-                    return INVALID;
-                }
-                cursor_x = save_cursor_x;
-                cursor_y = save_cursor_y;
-
-                return SUCCESS;
-
-            default:
-                return INVALID;
-        }
-    }
-
-    return NEED_MORE;
-}
-
-/**
- * Gibt ein Zeichen auf der Konsole aus.
- */
-void con_putc(const char c)
-{
-    static char last_char = 0;
-
-    outb(0xe9, c);
-    outb(0x3f8, c);
-    while ((inb(0x3fd) & 0x20) == 0) asm("nop");
-    
-    if (debug_test_flag(DEBUG_FLAG_NO_KCONSOLE)) {
-        return;
-    }
-
-    switch(c)
-    {
-        case '\n':
-            if (last_char != '\r') {
-                con_clear_to(SCREEN_WIDTH);
-            }
-            cursor_x = 0;
-            cursor_y++;
-            break;
-        
-        case '\r':
-            cursor_x = 0;
-            break;
-        
-        case '\t':
-            cursor_x = con_clear_to((cursor_x & ~7) + 8);
-            break;
-
-        default:
-            vidmem[cursor_x + cursor_y * SCREEN_WIDTH] = c | (con_color._color << 8);
-            cursor_x++;
-            break;
-    }
-    
-    if(cursor_x >= SCREEN_WIDTH)
-    {
-        cursor_y += cursor_x / SCREEN_WIDTH;
-        cursor_x %= SCREEN_WIDTH;
-    }
-    
-
-    while(cursor_y >= SCREEN_HEIGHT)
-    {
-        scroll_down();
-    }
-    con_set_hw_cursor();
-
-    last_char = c;
-}
-
-/**
- * Gibt ein Zeichen auf der Konsole aus. Wenn das Zeichen ein Escape-Zeichen
- * ist, wird es und die folgenden Zeichen in einem Puffer zwischen gespeichert,
- * bis entweder diese Zeichenfolge erfolgreich als ANSI-Escape-Code-Sequenz
- * ausgewertet wurde, oder feststeht, dass diese Sequenz ung�ltig ist. In 
- * diesem Fall werden alle Zeichen einschlie�lich des Escape-Zeichens auf der 
- * Konsole ausgegeben.
- */
-void con_putc_ansi(const char c)
-{
-    ansi_esc_seq_status_t status;
-    int i;
-
-    if(c == ASCII_ESC || ansi_buf_ofs > 0)
-    {
-        ansi_buf[ansi_buf_ofs++] = c;
-
-        status = con_ansi_parse(ansi_buf, ansi_buf_ofs);
-
-        switch(status)
-        {
-            case NEED_MORE:
-                if(ansi_buf_ofs <= sizeof(ansi_buf))
-                {
-                    break;
-                }
-                // fall through
-
-            case INVALID:
-                for(i = 0; i < ansi_buf_ofs; i++)
-                {
-                    con_putc(ansi_buf[i]);
-                }
-                ansi_buf_ofs = 0;
-                break;
-            
-            case SUCCESS:
-                ansi_buf_ofs = 0;
-                break;
-        }
-    }
-    else
-    {
-        con_putc(c);
-    }
-}
-
-/**
- * Leert den Puffer, in dem die Zeichen einer m�glichen ANSI-Escape-Code-
- * Sequenz zwischengespeichert werden. Diese Funktion muss aufgerufen werden,
- * wenn sichergestellt werden soll, dass s�mtliche Zeichen, die via 
- * con_putc_ansi ausgegeben werden sollen, tats�chlich ausgegeben werden.
- */
-void con_flush_ansi_escape_code_sequence(void)
-{
-    int i;
-    
-    if(ansi_buf_ofs > 0)
-    {
-        for(i = 0; i < ansi_buf_ofs; i++)
-        {
-            con_putc(ansi_buf[i]);
-        }
-        ansi_buf_ofs = 0;
-    }
-}
-
-/**
- * Gibt eine Zeichenkette auf der Konsole aus. Diese Zeichenkette kann
- * ANSI-Steuercodes enthalten. 
- * Unvollst�ndige und fehlerhafte Sequenzen werden einfach ausgegeben.
- */
-void con_puts(const char * s)
-{
-    while(*s)
-    {
-        con_putc_ansi(*s);
-        s++;
-    }
-
-    con_flush_ansi_escape_code_sequence();
-}
-
-/**
- * Gibt eine Zeichenkette auf der Konsole aus. Diese Zeichenkette kann
- * ANSI-Steuercodes enthalten. Die Ausgabe terminiert bei Erreichen eines
- * Null-Bytes oder wenn n Bytes ausgewertet wurden.
- * Unvollst�ndige und fehlerhafte Sequenzen werden einfach ausgegeben.
- */
-void con_putsn(unsigned int n, const char * s)
-{
-    while(*s && n--)
-    {
-        con_putc_ansi(*s);
-        s++;
-    }
-
-    con_flush_ansi_escape_code_sequence();
-}
-
-/**
- * Initialisiert die Console, in dem der Bildschirm geleert wird.
- */
-void init_console(void)
-{
-    con_color._color = 0x07;
-    con_clear_screen();
-    
-    /* Initialisiert die serielle Schnittstelle */
-    /* 9600 Baud, 8 Datenbits, 1 Stopbit, keine Parit�t */
-    
-    /* COM1 -> 0x3F8 */
-    outb(0x3FB, 0x83); /* DLAB = 1 */
-    outb(0x3F8, 0x0C); /* 9600 Baud */
-    outb(0x3F9, 0x00);
-    outb(0x3FB, 0x03); /* DLAB = 0 */
-    outb(0x3F9, 0x00); /* keine Interrupts ausl�sen */
-    outb(0x3FA, 0x00); /* FIFOs deaktiviert (8250, 16450) */
-    outb(0x3FC, 0x00); /* Loopback deaktivieren, Aux1 & Aux2 deaktivieren */
-}
-
-/**
- * Aktualisiert die Postition des Hardware Cursors
- */
-static void con_set_hw_cursor(void)
-{
-    //Hardware Cursor verschieben
-    uint16_t hw_cursor_pos = cursor_x + cursor_y * SCREEN_WIDTH;
-    outb(0x3D4, 15);
-    outb(0x3D5, hw_cursor_pos);
-    outb(0x3D4, 14);
-    outb(0x3D5, hw_cursor_pos >> 8);
-}
-
-int puts(char * s)
-{
-    con_puts(s);
-    return 0;
-}
-
diff --git a/src/kernel/src/debug.c b/src/kernel/src/debug.c
deleted file mode 100644
index 34b51c0d..00000000
--- a/src/kernel/src/debug.c
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Copyright (c) 2006 The tyndur Project. All rights reserved.
- *
- * This code is derived from software contributed to the tyndur Project
- * by Burkhard Weseloh.
- *
- * 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 tyndur Project
- *     and its contributors.
- * 4. Neither the name of the tyndur 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 HOLDERS 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.
- */
-
-#include <stdint.h>
-#include <stdbool.h>
-
-#include "elf32.h"
-#include "kprintf.h"
-#include "multiboot.h"
-#include "paging.h"
-#include "debug.h"
-#include "string.h"
-#include "intr.h"
-#include "tasks.h"
-
-static Elf32_Shdr * symtab = 0; // Zeiger auf den ELF-Header-Eintrag der Symbol Tabelle ...
-static Elf32_Shdr * strtab = 0; // ... und der String Tabelle
-
-static uint32_t debug_flags = 0;
-
-/**
- * Gibt einen Zeiger auf das Symbol mit der gr��ten Adresse kleiner als addr 
- * zur�ck. Wenn kein Symbol bestimmt werden kann, wird 0 zur�ck gegeben.
- */
-static Elf32_Sym * elf_find_sym(uint32_t addr)
-{
-    Elf32_Sym * sym;
-    int i;
-
-    if(symtab == 0)
-    {
-        return 0;
-    }
-
-    sym = (Elf32_Sym *)symtab->sh_addr;
-
-    for(i = 0; i < symtab->sh_size / sizeof(Elf32_Sym); i++)
-    {
-        if(addr >= (uint32_t)sym[i].st_value && addr < (uint32_t)sym[i].st_value + sym[i].st_size)
-        {
-            return sym + i;
-        }
-    }
-
-    return 0;
-}
-
-/**
- * Gibt den String zum Index in die String Tabelle des Kernels zur�ck.
- */
-static char * elf_get_str(Elf32_Word index)
-{
-    if(strtab == 0)
-    {
-        return "";
-    }
-
-    return (char*)strtab->sh_addr + index;
-}
-
-/**
- * Mappt den ELF-Header, sowie die ELF-Symbol-Tabelle und die dazugeh�rige
- * String-Tabelle, wenn sie vorhanden sind.
- */
-void init_stack_backtrace(void)
-{
-    Elf32_Shdr * elfshdr = (Elf32_Shdr *)multiboot_info.mi_elfshdr_addr;
-    int i;
-
-    /* ELF Header mappen */
-    map_page_range(kernel_page_directory, elfshdr, (paddr_t) elfshdr,
-        PTE_W | PTE_P /*| PTE_U*/,
-        NUM_PAGES(multiboot_info.mi_elfshdr_num * sizeof(Elf32_Shdr)));
-
-    if(multiboot_info.mi_flags & MULTIBOOT_INFO_HAS_ELF_SYMS)
-    {
-        /* Symbol Table und String Table suchen */
-        for (i = 0; i < multiboot_info.mi_elfshdr_num; i++)
-        {
-            if(elfshdr[i].sh_type == SHT_SYMTAB)
-            {
-                symtab = &elfshdr[i];
-                strtab = &elfshdr[symtab->sh_link];
-                
-                break;
-            }
-        }
-    }
-
-    if(symtab != 0 && strtab != 0)
-    {
-        /* Symbol Tabelle und String Tabelle mappen */
-
-        kernel_identity_map((paddr_t)symtab->sh_addr, symtab->sh_size);
-        kernel_identity_map((paddr_t)strtab->sh_addr, strtab->sh_size);
-    }
-}
-
-void stack_backtrace_ebp(uint32_t start_ebp, uint32_t start_eip)
-{
-    struct stack_frame
-    {
-        struct stack_frame * ebp;
-        uint32_t eip;
-       /* uint32_t args[0];*/
-    } * stack_frame;
-    Elf32_Sym * sym;
-
-    kprintf("stack backtrace:\n");
-
-    if (start_ebp != 0)
-    {
-        kprintf("ebp %08x eip %08x", start_ebp, start_eip);
-        if((sym = elf_find_sym(start_eip)))
-        {
-            kprintf(" <%s + 0x%x>", elf_get_str(sym->st_name), start_eip - sym->st_value);
-        }
-        kprintf("\n");
-
-        stack_frame = (struct stack_frame*) start_ebp;
-    }
-    else
-    {
-        __asm volatile ("mov %%ebp, %0" : "=r"(stack_frame));
-    }
-
-    for( ; is_userspace(stack_frame, sizeof(*stack_frame)) && stack_frame->ebp != 0; stack_frame = stack_frame->ebp)
-    {
-        kprintf("ebp %08x eip %08x", stack_frame->ebp, stack_frame->eip);
-
-        if((sym = elf_find_sym(stack_frame->eip)))
-        {
-            kprintf(" <%s + 0x%x>", elf_get_str(sym->st_name), stack_frame->eip - sym->st_value);
-        }
-
-        kprintf("\n");
-    }
-
-    if (stack_frame && !is_userspace(stack_frame, sizeof(*stack_frame))) {
-        kprintf("Stack kaputt.\n");
-    }
-}
-
-void stack_backtrace(void)
-{
-    stack_backtrace_ebp(0, 0);
-}
-
-///Setzt die richtigen Debug-Flags anhand der Commandline vom bootloader
-void debug_parse_cmdline(char* cmdline)
-{
-    char* pos = strstr(cmdline, "debug=");
-    debug_flags = 0;
-
-    if(pos == NULL) return;
-    
-    //Debug= ueberspringen
-    pos += 6;
-    while((*pos != 0) && (*pos != ' '))
-    {
-        switch(*pos)
-        {
-            case 'i':
-                debug_flags |= DEBUG_FLAG_INIT;
-                break;
-
-            case 'p':
-                debug_flags |= DEBUG_FLAG_PEDANTIC;
-                break;
-
-            case 's':
-                debug_flags |= DEBUG_FLAG_STACK_BACKTRACE;
-                break;
-
-            case 'c':
-                debug_flags |= DEBUG_FLAG_SYSCALL;
-                break;
-
-            case 'n':
-                debug_flags |= DEBUG_FLAG_NO_KCONSOLE;
-                break;
-        }
-        pos++;
-    }
-}
-
-///Ueberprueft ob ein bestimmtes Debug-Flag gesetzt ist
-bool debug_test_flag(uint32_t flag)
-{
-    return ((debug_flags & flag) != 0);
-}
-
-///Gibt die Debug-Meldung aus, wenn das Flag gesetzt ist
-void debug_print(uint32_t flag, const char* message)
-{
-    if(debug_test_flag(flag))
-    {
-        kprintf("DEBUG: %s\n", message);
-    }
-}
-
-
-void print_tasks_backtrace(void)
-{
-    struct task* task = first_task;
-    struct int_stack_frame* isf;
-
-    while (task != NULL)
-    {
-        kprintf("\n\nPID %d: %s\n"
-            "Status %d, blocked_by_pid %d, blocked_count %d\n",
-            task->pid, 
-
-            (task == 0 
-                ? "Kernel-Initialisierung"
-                : (task->cmdline != NULL 
-                    ? task->cmdline 
-                    : "Unbekannter Task")),
-
-            task->status, task->blocked_by_pid, task->blocked_count);
-        
-        __asm("mov %0, %%cr3" : : "r"(resolve_vaddr(kernel_page_directory, task->cr3)));
-        
-        isf = (struct int_stack_frame*) task->esp;
-        stack_backtrace_ebp(isf->ebp, isf->eip);
-
-        task = task->next_task;
-    }
-        
-    __asm("mov %0, %%cr3" : : "r"(resolve_vaddr(kernel_page_directory, current_task->cr3)));
-}
diff --git a/src/kernel/src/gdt.c b/src/kernel/src/gdt.c
deleted file mode 100644
index fe837c76..00000000
--- a/src/kernel/src/gdt.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (c) 2006 The tyndur Project. All rights reserved.
- *
- * This code is derived from software contributed to the tyndur Project
- * by Kevin Wolf.
- *
- * 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 tyndur Project
- *	    and its contributors.
- * 4. Neither the name of the tyndur 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 tyndur PROJECT 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 tyndur PROJECT 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.
- */
-
-/*
- * Vorl�ufige Funktionen zur Verwaltung der GDT
- *
- * Aenderungen:
- *
- * 2006-04-09: taljeth
- *   + Erste Version erstellta
- */
-
-#include <stdint.h>
-
-#include "gdt.h"
-#include "tss.h"
-
-typedef struct {
-  uint16_t size;
-  uint16_t base;
-  uint8_t base2;
-  uint8_t access;
-  uint8_t size2;
-  uint8_t base3;
-} segment_descriptor;
-
-segment_descriptor gdt[GDT_SIZE];
-
-/**
- * Legt eine GDT an und initialisiert sie mit mit jeweils einem Code- und
- * Datendeskriptor f�r Ring 0 und Ring 3 und einem Deskriptor f�r die TSS.
- * Anschlie�end wird sie geladen.
- */
-void init_gdt()
-{
-  // Ring-0-Code- und Datenselektoren eintragen
-  gdt_set_descriptor(1, 0x000FFFFF, 0x00000000, GDT_SEGMENT | GDT_PRESENT | GDT_CODESEG, 0);
-  gdt_set_descriptor(2, 0x000FFFFF, 0x00000000, GDT_SEGMENT | GDT_PRESENT | GDT_DATASEG, 0);
-
-  // Ring-3-Code- und Datenselektoren eintragen
-  gdt_set_descriptor(3, 0x000FFFFF, 0x00000000, GDT_SEGMENT | GDT_PRESENT | GDT_CODESEG, 3);
-  gdt_set_descriptor(4, 0x000FFFFF, 0x00000000, GDT_SEGMENT | GDT_PRESENT | GDT_DATASEG, 3);
-
-  // Task irgendwas
-  gdt_set_descriptor_byte_granularity(5, sizeof(tss) - 1,
-    (uint32_t)&tss, GDT_PRESENT | GDT_TSS, 3);
-
-  // GDTR laden
-  struct {
-    uint16_t size;
-    uint32_t base;
-  }  __attribute__((packed)) gdt_ptr = {
-    .size  = GDT_SIZE*8 - 1,
-    .base  = (uint32_t)gdt,
-  };
-
-  __asm__("lgdtl %0\n\t"
-    "ljmpl $0x08, $1f\n\t"
-    "1:\n\t"
-    "mov $0x10, %%eax\n\t"
-    "mov %%eax, %%ds\n\t"
-    "mov %%eax, %%es\n\t"
-    "mov %%eax, %%fs\n\t"
-    "mov %%eax, %%gs\n\t"
-    "mov %%eax, %%ss\n\t" : : "m" (gdt_ptr) : "eax");
-
-  __asm__("ltr %%ax\n\t" : : "a" (TSS_SEL));
-}
-
-/**
- * Setzt einen Deskriptor in der GDT.
- *
- * \param segment Nummer des Deskriptors
- * \param size Gr��e des Segments in Pages
- * \param base Basisadresse des Segments
- * \param access Access-Byte des Deskriptors
- * \param dpl Descriptor Privilege Level
- */
-void gdt_set_descriptor(int segment, uint32_t size, uint32_t base, uint8_t access,
-    int dpl)
-{
-  gdt[segment].size   = size & 0xFFFF;
-  gdt[segment].size2  = ((size >> 16) & 0x0F) | 0xC0;
-  gdt[segment].base   = base & 0xFFFF;
-  gdt[segment].base2  = (base >> 16) & 0xFF;
-  gdt[segment].base3  = ((base >> 24) & 0xFF);
-  gdt[segment].access = access | ((dpl & 3) << 5);
-}
-
-/**
- * Setzt einen Deskriptor in der GDT, wobei die Gr��e als Byteangabe
- * interpretiert wird.
- *
- * \param segment Nummer des Deskriptors
- * \param size Gr��e des Segments in Bytes
- * \param base Basisadresse des Segments
- * \param access Access-Byte des Deskriptors
- * \param dpl Descriptor Privilege Level
- */
-void gdt_set_descriptor_byte_granularity(int segment, uint32_t size,
-    uint32_t base, uint8_t access, int dpl)
-{
-  gdt_set_descriptor(segment, size, base, access, dpl);
-  gdt[segment].size2  = ((size >> 16) & 0x0F) | 0x40;
-}
diff --git a/src/kernel/src/header.asm b/src/kernel/src/header.asm
deleted file mode 100644
index a3a8d2d9..00000000
--- a/src/kernel/src/header.asm
+++ /dev/null
@@ -1,90 +0,0 @@
-;
-; Copyright (c) 2006 The tyndur Project. All rights reserved.
-;
-; This code is derived from software contributed to the tyndur Project
-; by Kevin Wolf.
-;
-; 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 tyndur Project
-;     and its contributors.
-; 4. Neither the name of the tyndur 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 HOLDERS 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.
-;
-
-; Initialisiert esp und ruft main() auf
-;
-; Aenderungen:
-;
-; 2006-04-09: taljeth
-;   + Erste Version erstellt
-;
-; 2006-04-09: Golum
-;   + Uebergabe der von GRUB bereitgestellten Informationen
-;
-; 2006-04-13: nore
-;   ! falsch gesetztes "kernelstack" Label an die richtige Stelle gesetzt
-;
-; 2006-07-12: Jidder
-;   ! via Paging (statt Segmentation) den Kernel nach 0xc0000000 mappen
-;   ! das log wird mir zu lang, deswegen hab ich mein Zeug mal zensiert ;)
-;
-
-extern init
-global _start
-
-section .text
-_start:
-
-	; Stack initalisieren
-	mov esp, kernelstack
-
-	; Damit die Stack Traces hier enden ein Stack Frame mit Nullwerten f�r die R�cksprungadresse und den alten Stack Frame erstellen
-	push 0
-	push 0
-	mov ebp, esp
-
-	; Die vom Multiboot Loader �bergebenen Informationen auf den Stack legen (init ben�tigt sie)
-	push ebx
-	push eax
-
-	mov eax, init
-	call eax
-	cli
-	hlt
-
-section multiboot
-multiboot_header:
-align 4
-  MULTIBOOT_MAGIC     equ 0x1BADB002
-  MULTIBOOT_FLAGS     equ 0x03
-  MULTIBOOT_CHECKSUM  equ -MULTIBOOT_MAGIC-MULTIBOOT_FLAGS
-
-  dd MULTIBOOT_MAGIC
-  dd MULTIBOOT_FLAGS
-  dd MULTIBOOT_CHECKSUM
-
-section .bss
-  resb  16384
-kernelstack:
diff --git a/src/kernel/src/init.c b/src/kernel/src/init.c
deleted file mode 100644
index 5ec14bb2..00000000
--- a/src/kernel/src/init.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*  
- * Copyright (c) 2006 The tyndur Project. All rights reserved.
- *
- * This code is derived from software contributed to the tyndur Project
- * by Andreas Klebinger.
- *
- * 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 tyndur Project
- *     and its contributors.
- * 4. Neither the name of the tyndur 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 HOLDERS 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.
- */  
-
- /** 
-  * Kernel-Initialisierung erfolgt hier,
-  * die Funktion init wird von header.asm aufgerufen 
-  */
-
-#include <stdint.h>
-
-#include "kernel.h"
-#include "gdt.h"
-#include "intr.h"
-#include "kprintf.h"
-#include "ports.h"
-#include "multiboot.h"
-#include "string.h"
-#include "tss.h"
-#include "kprintf.h"
-#include "paging.h"
-#include "modules.h"
-#include "stdlib.h"
-#include <lost/config.h>
-#include "syscall.h"
-#include "debug.h"
-#include "io.h"
-#include "timer.h"
-#include "shm.h"
-#include "vm86.h"
-
-struct multiboot_info multiboot_info;
-
-extern void init_phys_mem(vaddr_t mmap_addr, uint32_t mmap_length,
-    uint32_t upper_mem);
-extern void init_paging(void);
-extern void init_console(void);
-extern void init_scheduler(void);
-extern void init_stack_backtrace(void);
-
-void keyboard_handler(int irq)
-{
-    //kprintf("[KEYB]\n");
-}
-
-void init(int multiboot_magic, struct multiboot_info *boot_info)
-{
-    init_console();
-
-    memcpy(&multiboot_info, boot_info, sizeof(struct multiboot_info));
-
-    
-    //Debugparameter verarbeiten
-    if((multiboot_info.mi_flags & MULTIBOOT_INFO_HAS_CMDLINE) != 0)
-    {
-        debug_parse_cmdline(multiboot_info.mi_cmdline);
-    }
-    
-    save_bios_data();
-    
-    debug_print(DEBUG_FLAG_INIT, "Initialisiere physikalische Speicherverwaltung");
-    init_phys_mem(multiboot_info.mi_mmap_addr, multiboot_info.mi_mmap_length, multiboot_info.mi_mem_upper);
-
-    debug_print(DEBUG_FLAG_INIT, "Initialisiere Paging");
-    init_paging();
-
-    debug_print(DEBUG_FLAG_INIT, "Initialisiere Speicherverwaltung");
-    init_memory_manager();
-    init_shared_memory();
-    
-    debug_print(DEBUG_FLAG_INIT, "Initialisiere GDT");
-    init_gdt();
-    
-    debug_print(DEBUG_FLAG_INIT, "Initialisiere Kernel Stack-Backtraces");
-    init_stack_backtrace();
-    
-    debug_print(DEBUG_FLAG_INIT, "Initialisiere IDT");
-    init_idt();
-
-    debug_print(DEBUG_FLAG_INIT, "Initialisiere Scheduler");
-    init_scheduler();
-    
-    debug_print(DEBUG_FLAG_INIT, "Initialisiere Timer");
-    timer_init();
-    
-    debug_print(DEBUG_FLAG_INIT, "Initialisiere IO-Ports");
-    init_io_ports();
-    
-    
-    //Erst das Init-Modul laden, danach Multitasking starten und erst dann die
-    //Module an init weiter geben
-    debug_print(DEBUG_FLAG_INIT, "Lade Init-Modul");
-    load_init_module(&multiboot_info);
-
-    debug_print(DEBUG_FLAG_INIT, "Uebergebe die restlichen Module an das Init-Modul");
-    load_multiboot_modules(&multiboot_info);
-
-    request_irq(1, &keyboard_handler);
-
-    
-    debug_print(DEBUG_FLAG_INIT, "Aktiviere Interrupts");
-    enable_interrupts();
-
-    // An dieser Stelle sofort einen Interrupt auszuf�hren, ist aus zwei 
-    // Gr�nden notwendig:
-    //
-    // 1. Kooperatives Multitasking startet sonst nicht
-    // 2. current_task sollte m�glichst schnell initialisiert werden, da
-    //    es nur an wenigen Stellen auf NULL �berpr�ft wird
-    asm volatile ("int $0x20");   
-    
-    while(1)
-    {
-        __asm__ __volatile__("hlt");
-    }
-}
-
-extern void stack_backtrace(void);
-
-__attribute__((noreturn)) void panic(char * message, ...)
-{
-    int * args = ((int*)&message) + 1;
-    disable_interrupts();
-
-    kprintf("\n"
-      "\033[1;37m\033[41m" // weiss auf rot
-      "PANIC: ");
-    kaprintf(message, &args);
-    kprintf("\n");
-
-    #ifdef CONFIG_DEBUG_LAST_SYSCALL
-    {
-        uint32_t i;
-
-        kprintf("Letzter Syscall (von PID %d): %d ", debug_last_syscall_pid,
-            debug_last_syscall_no);
-        for (i = 0; i < DEBUG_LAST_SYSCALL_DATA_SIZE; i++) {
-            kprintf("0x%08x ", debug_last_syscall_data[i]);
-        }
-        kprintf("\n");
-    }
-    #endif 
-
-    stack_backtrace();
-
-    while(1) {
-      __asm__ __volatile__("hlt");
-    }
-}
-
-void syscall_p(void) {}
-void syscall_v(void) {}
diff --git a/src/kernel/src/intr.c b/src/kernel/src/intr.c
deleted file mode 100644
index bab6e5a5..00000000
--- a/src/kernel/src/intr.c
+++ /dev/null
@@ -1,584 +0,0 @@
-/*  
- * Copyright (c) 2006 The tyndur Project. All rights reserved.
- *
- * This code is derived from software contributed to the tyndur Project
- * by Kevin Wolf.
- *
- * 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 tyndur Project
- *     and its contributors.
- * 4. Neither the name of the tyndur 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 HOLDERS 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.
- */  
-
-/*
- * Funktionen zur Verwaltung von Interrupts
- */
-
-#include <stdint.h>
-
-#include "cpu.h"
-#include "ports.h"
-#include "types.h"
-#include "kernel.h"
-#include "intr.h"
-#include "tss.h"
-#include "kprintf.h"
-#include "paging.h"
-#include "string.h"
-#include "syscall.h"
-#include "tasks.h"
-#include "vmm.h"
-#include <lost/config.h>
-#include "debug.h"
-#include "rpc.h"
-#include "vm86.h"
-#include "tss.h"
-
-#define MAX_INTERRUPTS 4
-
-typedef struct {
-  uint16_t lsb_handler;
-  uint16_t selector;
-  uint8_t reserved;
-  uint8_t access;
-  uint16_t msb_handler;
-} gate_descriptor;
-
-gate_descriptor idt[IDT_SIZE];
-
-/**
- * Fuer jeden IRQ genau ein Handler. Wenn es keinen Handler gibt, ist der
- * entsprechende Wert 0.
- */
-pfIrqHandler irq_handlers[16] = { 0 };
-
-static struct task * intr_handling_task[256][MAX_INTERRUPTS] = { { NULL } };
-
-void handle_irq(int irq, uint32_t* esp);
-
-extern void null_handler(void);
-
-extern void exception_stub_0(void);
-extern void exception_stub_1(void);
-extern void exception_stub_2(void);
-extern void exception_stub_3(void);
-extern void exception_stub_4(void);
-extern void exception_stub_5(void);
-extern void exception_stub_6(void);
-extern void exception_stub_7(void);
-extern void exception_stub_8(void);
-extern void exception_stub_9(void);
-extern void exception_stub_10(void);
-extern void exception_stub_11(void);
-extern void exception_stub_12(void);
-extern void exception_stub_13(void);
-extern void exception_stub_14(void);
-extern void exception_stub_16(void);
-extern void exception_stub_17(void);
-extern void exception_stub_18(void);
-extern void exception_stub_19(void);
-
-extern void irq_stub_0(void);
-extern void irq_stub_1(void);
-extern void irq_stub_2(void);
-extern void irq_stub_3(void);
-extern void irq_stub_4(void);
-extern void irq_stub_5(void);
-extern void irq_stub_6(void);
-extern void irq_stub_7(void);
-extern void irq_stub_8(void);
-extern void irq_stub_9(void);
-extern void irq_stub_10(void);
-extern void irq_stub_11(void);
-extern void irq_stub_12(void);
-extern void irq_stub_13(void);
-extern void irq_stub_14(void);
-extern void irq_stub_15(void);
-
-extern void syscall_stub(void);
-
-extern void stack_backtrace_ebp(uint32_t start_ebp, uint32_t start_eip);
-
-void handle_exception(uint32_t* esp);
-
-void send_irqs(uint32_t* esp);
-static uint32_t irqs_to_send[16][MAX_INTERRUPTS];
-extern uint32_t kernel_pd_id;
-
-/*
- * gibt einen neuen Wert fuer esp zurck
- */
-uint32_t handle_int(uint32_t esp)
-{
-    struct int_stack_frame * isf = (struct int_stack_frame *)esp;
-    struct task* old_task = current_task;
-
-//	kprintf("\nTask switch!  esp alter Task:0x%08x", isf->esp);
-	
-	if(isf->interrupt_number <= 31)
-    {
-        handle_exception(&esp);
-    }
-    else if(isf->interrupt_number <= 47)
-    {
-        // Ein IRQ
-        handle_irq(isf->interrupt_number - IRQ_BASE, &esp);
-		isf = (struct int_stack_frame *)esp;
-    }
-    else if(isf->interrupt_number == 48)
-    {
-        // Ein Syscall
-        syscall((struct int_stack_frame **) &esp);
-    }
-    else
-    {
-        // TODO: Abstuerzen, denn diese Interrupts duerften nicht aufgerufen werden
-    }
-
-    send_irqs(&esp);
-    //current_task = schedule();
-
-   // for(;;);
-
-    if ((current_task != NULL) && (old_task != current_task)) {
-        //tss.esp = current_task->kernel_stack;
-        isf = (struct int_stack_frame *)esp;
-        //kprintf("  esp neuer Task:0x%08x", isf->esp);
-
-        tss.esp0 = current_task->kernel_stack;
-        // sicherstellen, dass der Kernel Adressraum im Page Directory des Tasks korrekt gemappt ist
-        //kprintf("PID=%d  cr3=0x%08x  kernel_pd=0x%08x eip=0x%08x\n", 
-        //  current_task->pid, current_task->cr3, (uint32_t)kernel_page_directory, isf->eip);
-        //memcpy((void*)current_task->cr3, kernel_page_directory, 1024);
-
-        // Aktuelles Kernel-PD kopieren, wenn noetig
-        if (kernel_pd_id != current_task->pd_id) {
-            memcpy((void*) current_task->cr3, kernel_page_directory, 1020);
-            current_task->pd_id = kernel_pd_id;
-        }
-
-        // Page Directory des neuen Tasks laden
-        __asm("mov %0, %%cr3" : : "r"(resolve_vaddr(kernel_page_directory, current_task->cr3)));
-    }
-
-    if (current_task && (current_task->status == TS_WAIT_FOR_RPC)) {
-        current_task->status = TS_RUNNING;
-    }
-
-    //kprintf("int_handler: return %08x\n", esp);
-    //kprintf("int_handler: eip=%08x\n", isf->eip);
-    return esp;
-}
-
-/**
- * Legt eine IDT an und installiert die Exception Handler. Nicht genutzte
- * Eintraege werden mit Verweisen auf den Null-Handler initalisiert.
- * Anschliessend wird die IDT geladen.
- */
-void init_idt() {
-  int i;
-
-  // Tabelle initialisieren
-  for (i = 0; i < IDT_SIZE; i++)
-  {
-    set_intr(i, 0x08, &null_handler, 0, IDT_INTERRUPT_GATE);
-  }
-
-  // Register befuellen
-  struct {
-    uint16_t size;
-    uint32_t base;
-  }  __attribute__((packed)) idt_ptr = {
-    .size  = IDT_SIZE*8 - 1,
-    .base  = (uint32_t)idt,
-  };
-
-  // Exception Handler installieren
-  set_intr(0, 0x08, exception_stub_0, 0, IDT_INTERRUPT_GATE);
-  set_intr(1, 0x08, exception_stub_1, 0, IDT_INTERRUPT_GATE);
-  set_intr(2, 0x08, exception_stub_2, 0, IDT_INTERRUPT_GATE);
-  set_intr(3, 0x08, exception_stub_3, 0, IDT_INTERRUPT_GATE);
-  set_intr(4, 0x08, exception_stub_4, 0, IDT_INTERRUPT_GATE);
-  set_intr(5, 0x08, exception_stub_5, 0, IDT_INTERRUPT_GATE);
-  set_intr(6, 0x08, exception_stub_6, 0, IDT_INTERRUPT_GATE);
-  set_intr(7, 0x08, exception_stub_7, 0, IDT_INTERRUPT_GATE);
-  set_intr(8, 0x08, exception_stub_8, 0, IDT_INTERRUPT_GATE);
-  set_intr(9, 0x08, exception_stub_9, 0, IDT_INTERRUPT_GATE);
-  set_intr(10, 0x08, exception_stub_10, 0, IDT_INTERRUPT_GATE);
-  set_intr(11, 0x08, exception_stub_11, 0, IDT_INTERRUPT_GATE);
-  set_intr(12, 0x08, exception_stub_12, 0, IDT_INTERRUPT_GATE);
-  set_intr(13, 0x08, exception_stub_13, 0, IDT_INTERRUPT_GATE);
-  set_intr(14, 0x08, exception_stub_14, 0, IDT_INTERRUPT_GATE);
-  set_intr(16, 0x08, exception_stub_16, 0, IDT_INTERRUPT_GATE);
-  set_intr(17, 0x08, exception_stub_17, 0, IDT_INTERRUPT_GATE);
-  set_intr(18, 0x08, exception_stub_18, 0, IDT_INTERRUPT_GATE);
-  set_intr(19, 0x08, exception_stub_19, 0, IDT_INTERRUPT_GATE);
-
-  set_intr(IRQ_BASE + 0, 0x08, irq_stub_0, 0, IDT_INTERRUPT_GATE);
-  set_intr(IRQ_BASE + 1, 0x08, irq_stub_1, 0, IDT_INTERRUPT_GATE);
-  set_intr(IRQ_BASE + 2, 0x08, irq_stub_2, 0, IDT_INTERRUPT_GATE);
-  set_intr(IRQ_BASE + 3, 0x08, irq_stub_3, 0, IDT_INTERRUPT_GATE);
-  set_intr(IRQ_BASE + 4, 0x08, irq_stub_4, 0, IDT_INTERRUPT_GATE);
-  set_intr(IRQ_BASE + 5, 0x08, irq_stub_5, 0, IDT_INTERRUPT_GATE);
-  set_intr(IRQ_BASE + 6, 0x08, irq_stub_6, 0, IDT_INTERRUPT_GATE);
-  set_intr(IRQ_BASE + 7, 0x08, irq_stub_7, 0, IDT_INTERRUPT_GATE);
-  set_intr(IRQ_BASE + 8, 0x08, irq_stub_8, 0, IDT_INTERRUPT_GATE);
-  set_intr(IRQ_BASE + 9, 0x08, irq_stub_9, 0, IDT_INTERRUPT_GATE);
-  set_intr(IRQ_BASE + 10, 0x08, irq_stub_10, 0, IDT_INTERRUPT_GATE);
-  set_intr(IRQ_BASE + 11, 0x08, irq_stub_11, 0, IDT_INTERRUPT_GATE);
-  set_intr(IRQ_BASE + 12, 0x08, irq_stub_12, 0, IDT_INTERRUPT_GATE);
-  set_intr(IRQ_BASE + 13, 0x08, irq_stub_13, 0, IDT_INTERRUPT_GATE);
-  set_intr(IRQ_BASE + 14, 0x08, irq_stub_14, 0, IDT_INTERRUPT_GATE);
-  set_intr(IRQ_BASE + 15, 0x08, irq_stub_15, 0, IDT_INTERRUPT_GATE);
-
-
-  // PIC initalisieren
-  outb_wait(PIC1_COMMAND, ICW1_INIT + ICW1_ICW4);
-  outb_wait(PIC2_COMMAND, ICW1_INIT + ICW1_ICW4);
-
-  // nach IRQ_BASE bis IRQ_BASE + 0xf remappen
-  outb_wait(PIC1_DATA, IRQ_BASE);
-  outb_wait(PIC2_DATA, IRQ_BASE + 8);
-
-  // den Slave auf IRQ 2 setzen
-  outb_wait(PIC1_DATA, 4);
-  outb_wait(PIC2_DATA, 2);
-
-  outb_wait(PIC1_DATA, ICW4_8086);
-  outb_wait(PIC2_DATA, ICW4_8086);
-
-  // alle irqs aktivieren
-  outb_wait(PIC1_DATA, 0x00);
-  outb_wait(PIC2_DATA, 0x00);
-
-  // Handler fuer den System Call installieren
-  // TODO: Sollte eigentlich ein IDT_TRAP_GATE sein, aber irgendwo ist da
-  // noch ein Problem, das dann fuer einen Page Fault sorgt, wenn ich zu
-  // schnell tippe...
-  set_intr(SYSCALL_INTERRUPT, 0x08, syscall_stub, 3, IDT_INTERRUPT_GATE);
-  //set_intr(SYSCALL_INTERRUPT, 0x08, syscall_stub, 3, IDT_TRAP_GATE);
-
-  // IDT laden
-  asm("lidt %0" : : "m" (idt_ptr));
-}
-
-void disable_irq(uint8_t irq)
-{
-    if (irq < 8) {
-        outb(PIC1_DATA, inb(PIC1_DATA) | (1 << irq));
-    } else if (irq < 16) {
-        outb(PIC2_DATA, inb(PIC2_DATA) | (1 << (irq - 8)));
-    } else {
-        panic("Ungueltiger IRQ %d", irq);
-    }
-}
-
-void enable_irq(uint8_t irq)
-{
-    if (irq < 8) {
-        outb(PIC1_DATA, inb(PIC1_DATA) & ~(1 << irq));
-    } else if (irq < 16) {
-        outb(PIC2_DATA, inb(PIC2_DATA) & ~(1 << (irq - 8)));
-    } else {
-        panic("Ungueltiger IRQ %d", irq);
-    }
-}
-
-/**
- * Setzt einen Eintrag in der IDT.
- *
- * \param intr Nummer des Interrupts
- * \param selector Code-Selektor
- * \param handler Funktionspointer auf den Interrupthandler
- * \param dpl Descriptor Privilege Level
- * \param type Deskriptor Typ
- */
-void set_intr(int intr, uint16_t selector, void* handler, int dpl, int type)
-{
-  idt[intr].lsb_handler = ((uint32_t) handler) & 0xFFFF;
-  idt[intr].msb_handler = (((uint32_t) handler) >> 16) & 0xFFFF;
-  idt[intr].access = IDT_DESC_PRESENT | ((dpl & 3) << 5) | type;
-  idt[intr].selector = selector;
-  idt[intr].reserved = 0;
-}
-
-int request_irq(int irq, void * handler)
-{
-    if(irq < 0 || irq > 15)
-    {
-        return 1;
-    }
-
-    if(irq_handlers[irq] != 0)
-    {
-        return 1;
-    }
-
-    irq_handlers[irq] = handler;
-
-    return 0;
-}
-
-int release_irq(int irq)
-{
-    if(irq < 0 || irq > 15)
-    {
-        return 1;
-    }
-
-    irq_handlers[irq] = 0;
-
-    return 0;
-}
-
-
-void handle_irq(int irq, uint32_t* esp)
-{
-    int i;
-
-    //if (irq > 0) {
-    //    kprintf("Interrupt 0x%x\n", irq + IRQ_BASE);
-    //}
-
-    /*if (irq > 0)
-    {
-        uint8_t pic = (irq < 8 ? PIC1 : PIC2);
-        outb(pic + 3, 0x03);
-        if ((inb(pic) & (1 << (irq % 8))) == 0) {
-            kprintf("Spurious IRQ %d\n", irq);
-        }
-    }*/
-
-    // IRQs 7 und 15 koennen unabsichtlich aufgerufen werden
-    // In diesem Fall beim PIC nachschauen, ob wirklich was zu verarbeiten 
-    // ist, ansonsten gleich wieder abbrechen.
-    if ((irq == 7) || (irq == 15))
-    {
-        uint8_t pic = (irq < 8 ? PIC1 : PIC2);
-
-        outb(pic, 0x0B);
-        if ((inb(pic) & 0x80) == 0) {
-            kprintf("Spurious IRQ %d\n", irq);
-
-            // TODO Eigentlich sollte man hier keinen EOI brauchen, aber qemu
-            // scheint ihn zu brauchen
-            goto send_eoi;
-        }
-    }
-
-    for (i = 0; i < MAX_INTERRUPTS; i++) {
-        if (intr_handling_task[irq + IRQ_BASE][i] != NULL) {
-            i = -1;
-            break;
-        }
-    }
-    if (i == -1)
-    {
-        //kprintf("IRQ-Verarbeitung durch ein Modul\n");
-        for (i = 0; i < MAX_INTERRUPTS; i++) {
-            if (intr_handling_task[irq + IRQ_BASE][i] != NULL) {
-                irqs_to_send[irq][i]++;
-            }
-        }
-
-        //printf("disable IRQ %d\n", irq);
-        disable_irq(irq);
-    } 
-    else if (irq_handlers[irq] != 0)
-    {
-        irq_handlers[irq](irq, esp);
-    }
-
-send_eoi:
-    if(irq >= 8)
-    {
-        outb(PIC2_COMMAND, PIC_EOI);
-    }
-    outb(PIC1_COMMAND, PIC_EOI);
-}
-
-void set_intr_handling_task(uint8_t intr, struct task * task)
-{
-    int i;
-
-    //kprintf("Interrupt %d wird jetzt von Task %d behandelt\n", intr, task->pid);
-    for (i = 0; i < MAX_INTERRUPTS; i++) {
-        if ((intr_handling_task[intr][i] == NULL) ||
-            (i == MAX_INTERRUPTS - 1))
-        {
-            intr_handling_task[intr][i] = task;
-            if (intr >= IRQ_BASE && intr < IRQ_BASE + 16) {
-                irqs_to_send[intr - IRQ_BASE][i] = 0;
-            }
-            break;
-        }
-    }
-}
-
-void remove_intr_handling_task(struct task* task)
-{
-    int i, intr;
-
-    for (intr = 0; intr < 256; intr++) {
-        for (i = 0; i < MAX_INTERRUPTS; i++) {
-            if (intr_handling_task[intr][i] == task) {
-                intr_handling_task[intr][i] = NULL;
-            }
-        }
-    }
-}
-
-void handle_exception(uint32_t* esp)
-{
-    struct int_stack_frame * isf = *((struct int_stack_frame **)esp);
-
-    uint32_t cr2;
-    intptr_t diff;
-
-    switch(isf->interrupt_number)
-    {
-        case 13:
-            // Falls der Task seine IO-Bitmap noch nicht bekommen hat,
-            // erledigen wir das jetzt und lassen ihn dann nochmal versuchen.
-            if (tss.io_bit_map_offset == TSS_IO_BITMAP_NOT_LOADED) {
-                set_io_bitmap();
-                return;
-            }
-            break;
-
-        case 14:
-            cr2 = read_cr2();
-            diff = (cr2 >> PAGE_SHIFT) - (isf->esp >> PAGE_SHIFT);
-            // Ueberpruefen ob der Pagefault durch einen Stackoverflow
-            // hervorgerufen wurde
-            if ((diff >= -2) && (diff <= 2)
-                && (current_task != NULL)
-                && ((void*)cr2 >= current_task->user_stack_bottom - 0x1000000))
-            {
-                increase_user_stack_size(current_task, 1);
-                return;
-            }
-
-            kprintf("\033[1;37m\033[41mPage Fault: 0x%x\033[0;37m\033[40m", cr2);
-            break;
-    }
-
-    // Pruefen, ob ein VM86-Task die Exception ausgeloest hat, und evtl reagieren
-    if (isf->eflags & 0x20000) {
-        if (vm86_exception(esp)) {
-            return;
-        }
-    }
-    // Eine Exception. Fehlermeldung ausgeben und weg.
-    // Falls die Exception im Kernel aufgetreten ist, richtig weg, sonst nur
-    // den schuldigen Task beenden.
-    if (((isf->cs & 0x03) == 0) && !(isf->eflags & 0x20000)) {
-        kprintf("\n");
-        kprintf("\033[1;37m\033[41m"); // weiss auf rot
-        kprintf("Es wurde ein Problem festgestellt. tyndur wurde heruntergefahren, damit der\n"
-                "Computer nicht beschaedigt wird.\n"
-                "\n"
-                "Exception #%02d, int: #%d @ 0x%04x:0x%08x, PID %d, %s\n", 
-                isf->interrupt_number, isf->interrupt_number, isf->cs, isf->eip, current_task ? current_task->pid : 0, "(deaktiviert)" /*current_task ? current_task->cmdline : "(kernel)"*/);
-        kprintf("ss:esp= 0x%04x:0x%08x error code: 0x%08x\n", isf->ss, isf->esp, isf->error_code);
-        kprintf("eax:0x%08x, ebx:0x%08x, ecx:0x%08x, edx:0x%08x\n", isf->eax, isf->ebx, isf->ecx, isf->edx);
-        kprintf("ebp:0x%08x, esp:0x%08x, esi:0x%08x, edi:0x%08x\n", isf->ebp, isf->esp, isf->esi, isf->edi);
-        kprintf("eflags:0x%08x, ds:0x%04x, es:0x%04x, fs:0x%04x, gs:0x%04x\n", isf->eflags, isf->ds, isf->es, isf->fs, isf->gs);
-        #ifdef CONFIG_DEBUG_LAST_SYSCALL
-        {
-            uint32_t i;
-
-            kprintf("Letzter Syscall: %d ", debug_last_syscall_no);
-            for (i = 0; i < DEBUG_LAST_SYSCALL_DATA_SIZE; i++) {
-                kprintf("0x%08x ", debug_last_syscall_data[i]);
-            }
-            kprintf("\n");
-        }
-        #endif 
-
-        if(debug_test_flag(DEBUG_FLAG_STACK_BACKTRACE))
-        {
-            stack_backtrace_ebp(isf->ebp, isf->eip);
-        }
-
-        while(1) {
-          asm("cli; hlt");
-        }
-    } else {
-        kprintf(
-            "\n\033[1;37m\033[41mDer folgende Task wurde aufgrund einer "
-            "unbehandelten Ausnahme abgebrochen:\n%s\n\n"
-            "Exception #%02d, int: #%d @ 0x%04x:0x%08x, PID %d\n"
-            "ss:esp= 0x%04x:0x%08x error code: 0x%08x\n"
-            "eax:0x%08x, ebx:0x%08x, ecx:0x%08x, edx:0x%08x\n"
-            "ebp:0x%08x, esp:0x%08x, esi:0x%08x, edi:0x%08x\n"
-            "eflags:0x%08x, ds:0x%04x, es:0x%04x, fs:0x%04x, gs:0x%04x\n"
-            "\033[0;37m\033[40m",
-            
-            (current_task == 0 
-                ? "Kernel-Initialisierung"
-                : (current_task->cmdline != NULL 
-                    ? current_task->cmdline 
-                    : "Unbekannter Task")),
-
-            isf->interrupt_number, isf->interrupt_number, isf->cs, isf->eip, 
-            current_task ? current_task->pid : 0,
-            isf->ss, isf->esp, isf->error_code, 
-            isf->eax, isf->ebx, isf->ecx, isf->edx, 
-            isf->ebp, isf->esp, isf->esi, isf->edi, 
-            isf->eflags, isf->ds, isf->es, isf->fs, isf->gs
-        );
-
-        abort_task("Unbehandelte Ausnahme.");
-    }
-}
-
-void send_irqs(uint32_t* esp) 
-{
-    uint32_t irq;
-    int task;
-
-    for (irq = 0; irq < 16; irq++)
-    {
-        uint32_t rpc_data = irq + IRQ_BASE;
-        for (task = 0; task < MAX_INTERRUPTS; task++) {
-            if (intr_handling_task[irq + IRQ_BASE][task] == NULL) {
-                continue;
-            }
-            while (irqs_to_send[irq][task] > 0) {
-                schedule_to_task(intr_handling_task[irq + IRQ_BASE][task], esp);
-                if (!fastrpc_irq(intr_handling_task[irq + IRQ_BASE][task], 0, 0, 4,
-                    (char*) &rpc_data, irq))
-                {
-                    //kprintf("SYSCALL_RPC = FALSE");
-                    break;
-                }
-                //kprintf("IRQ-Handler aufgerufen");
-                irqs_to_send[irq][task]--;
-            }
-        }
-    }
-}
diff --git a/src/kernel/src/io.c b/src/kernel/src/io.c
deleted file mode 100644
index de701c87..00000000
--- a/src/kernel/src/io.c
+++ /dev/null
@@ -1,232 +0,0 @@
-/*  
- * Copyright (c) 2007 The tyndur Project. All rights reserved.
- *
- * This code is derived from software contributed to the tyndur Project
- * by Kevin Wolf.
- *
- * 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 tyndur Project
- *     and its contributors.
- * 4. Neither the name of the tyndur 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 HOLDERS 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.
- */  
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-#include <stdbool.h>
-
-#include "types.h"
-#include "tasks.h"
-#include "tss.h"
-#include "kernel.h"
-
-/* Gesetztes Bit: Port wird benutzt */
-uint8_t global_port_bitmap[IO_BITMAP_LENGTH / 8] = { 0 };
-
-void init_io_ports(void)
-{
-    // Setze IO-Privilege-Level auf 0
-    asm volatile(
-        "pushf;"
-        "pop %eax;"
-        "andl $0xFFFFCFFF, %eax;"
-        "push %eax;"
-        "popf;"
-    );
-}
-
-/**
- * Reserviert einen einzelnen IO-Port f�r einen Task
- *
- * @param task Task, dem der Port zugeordnet werden soll
- * @param port Nummer des zuzuordnenden IO-Ports
- *
- * @return Gibt true zur�ck, wenn der Task auf den Port zugreifen kann
- * (erfolgreiche oder bereits vorhandene Reservierung f�r denselben Task),
- * ansonsten false.
- */
-static bool io_port_request(struct task* task, uint32_t port)
-{
-    uint32_t index = port / 8;
-    uint8_t bit = 1 << (port % 8);
-    uint8_t* io_bitmap = task->io_bitmap;
-
-    // Pr�fen, ob der Port �berhaupt von der Bitmap abgedeckt wird
-    if (port >= IO_BITMAP_LENGTH) {
-        return false;
-    }
-
-    // Ist der Port noch frei?
-    // Wenn der Port f�r denselben Task schon einmal reserviert wurde,
-    // abbrechen, aber true zur�ckgeben
-    if (global_port_bitmap[index] & bit) {
-        return (io_bitmap && ((io_bitmap[index] & bit) == 0));
-    }
-
-    // Falls der Task noch keine zugeordnete Bitmap hat, wird es jetzt
-    // Zeit, eine anzulegen
-    if (io_bitmap == NULL) {
-        io_bitmap = task->io_bitmap = malloc(IO_BITMAP_LENGTH / 8);
-        memset(io_bitmap, 0xFF, IO_BITMAP_LENGTH / 8);
-    }
-
-    // Die eigentliche Reservierung
-    global_port_bitmap[index] |= bit;
-    io_bitmap[index] &= ~bit;
-
-    return true;
-}
-
-/**
- * Gibt einen einzelnen IO-Port frei.
- *
- * @param task Task, der die Freigabe anfordert
- * @param port Freizugebender Port
- *
- * @return true, wenn der Port freigegeben werden konnte, false wenn der
- * Port nicht f�r den Task reserviert war.
- */
-static bool io_port_release(struct task* task, uint32_t port)
-{
-    uint32_t index = port / 8;
-    uint8_t bit = 1 << (port % 8);
-    uint8_t* io_bitmap = task->io_bitmap;
-
-    // Wenn der Port gar nicht f�r den Task reserviert ist, false zur�ckgeben
-    if ((!io_bitmap) || (io_bitmap[index] & bit)) {
-        return false;
-    }
-
-    // Wenn der Port zwar f�r den Task reserviert ist, aber in der globalen
-    // Tabelle als frei markiert, haben wir einen Kernel-Bug.
-    if ((global_port_bitmap[index] & bit) == 0) {
-        panic("IO-Port-Bitmaps sind beschaedigt (Port %d, PID %d)", port, task->pid);
-    }
-    
-    // Die eigentliche Freigabe
-    global_port_bitmap[index] &= ~bit;
-    io_bitmap[index] |= bit;
-
-    return true;
-}
-
-/**
- * Reserviert einen Bereich von IO-Ports f�r einen Task.
- * Es werden entweder alle angeforderten oder im Fehlerfall gar keine Ports 
- * reserviert. Eine teilweise Reservierung tritt nicht auf.
- *
- * @param task Task, f�r den die Ports reserviert werden sollen
- * @param port Nummer des niedrigsten zu reservierenden Ports
- * @param length Anzahl der Ports, die zu reservieren sind
- */
-bool io_ports_request(struct task* task, uint32_t port, uint32_t length)
-{
-    uint32_t n = length;
-    while (n--) 
-    {
-        if (!io_port_request(task, port++)) 
-        {
-            // Bereits reservierte Ports wieder freigeben
-            while (++n != length) {
-                io_port_release(task, --port);
-            }
-            return false;
-        }
-    }
-
-    return true;
-}
-
-/**
- * Gibt einen Bereich von Ports frei.
- *
- * @param task Task, der die Freigabe anfordert
- * @param port Niedrigster freizugebender Port
- * @param length Anzahl der freizugebenden Ports
- *
- * @return true, wenn alle Ports freigegeben werden konnten. Wenn ein Port
- * nicht freigegeben werden konnte (war nicht f�r den Task reserviert),
- * wird false zur�ckgegeben, die Bearbeitung allerdings nicht abgebrochen,
- * sondern die weiteren Ports versucht freizugeben.
- */
-bool io_ports_release(struct task* task, uint32_t port, uint32_t length)
-{
-    bool success = true;
-
-    while (length--) 
-    {
-        if (!io_port_release(task, port++)) {
-            success = false;
-        }
-    }
-
-    return success;
-}
-
-/**
- * Gibt alle von einem Task reservierten Ports frei
- *
- * @param task Task, dessen Ports freigegeben werden sollen
- */
-void io_ports_release_all(struct task* task)
-{
-    uint32_t i;
-    uint8_t* io_bitmap = task->io_bitmap;
-
-    if (io_bitmap == NULL) {
-        return;
-    }
-
-    for (i = 0; i < IO_BITMAP_LENGTH / 8; i++)
-    {
-        if (io_bitmap[i] != (uint8_t) -1) {
-            io_ports_release(task, 8*i, 8);
-        }
-    }
-}
-
-void io_ports_check(struct task* task)
-{
-    uint32_t i, j;
-    uint8_t* io_bitmap = task->io_bitmap;
-    uint8_t bit;
-
-    if (io_bitmap == NULL) {
-        return;
-    }
-
-    for (i = 0; i < IO_BITMAP_LENGTH / 8; i++) {
-        for (j = 0; j < 8; j++) {
-            bit = 1 << j;
-            if (((io_bitmap[i] & bit) == 0) && ((global_port_bitmap[i] & bit)
-                == 0))
-            {
-                panic("IO-Port-Bitmaps sind beschaedigt (Port %d, PID %d)",
-                    i * 8 + j, task->pid);
-            }
-        }
-    }
-}
diff --git a/src/kernel/src/kernel.ld b/src/kernel/src/kernel.ld
deleted file mode 100644
index 9efbcb07..00000000
--- a/src/kernel/src/kernel.ld
+++ /dev/null
@@ -1,37 +0,0 @@
-LOAD_ADDR = 0x100000;

-LINK_ADDR = 0x100000;

-VIRT_TO_PHYS = LINK_ADDR - LOAD_ADDR;

-

-ENTRY(_start)

-SECTIONS

-{

-	. = LINK_ADDR;

-

-	kernel_start = .;

-	kernel_phys_start = . - VIRT_TO_PHYS;

-

-	.text : AT(ADDR(.text) - VIRT_TO_PHYS)

-	{

-        *(multiboot)

-		*(.text)

-	}

-	.rodata ALIGN(4096) : AT(ADDR(.rodata) - VIRT_TO_PHYS)

-	{

-		*(.rodata)

-	}

-	.data ALIGN(4096) : AT(ADDR(.data) - VIRT_TO_PHYS)

-	{

-		*(.data)

-	}

-	.bss ALIGN(4096) : AT(ADDR(.bss) - VIRT_TO_PHYS)

-	{

-		*(.bss)

-	}

-

-	. = ALIGN(4096);

-

-	kernel_end = .;

-	kernel_phys_end = . - VIRT_TO_PHYS;

-

-	kernel_size = kernel_end - kernel_start;

-}

diff --git a/src/kernel/src/kprintf.c b/src/kernel/src/kprintf.c
deleted file mode 100644
index 1f19541c..00000000
--- a/src/kernel/src/kprintf.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Copyright (c) 2006 The tyndur Project. All rights reserved.
- *
- * This code is derived from software contributed to the tyndur Project
- * by Burkhard Weseloh.
- *
- * 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 tyndur Project
- *     and its contributors.
- * 4. Neither the name of the tyndur 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 HOLDERS 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.
- */
- 
-#include "console.h"
-
-/* Dividiert ein uint64 durch einen uint32 und gibt das Ergebnis zur�ck */
-unsigned long long divmod(unsigned long long dividend, unsigned int divisor, unsigned int * remainder)
-{
-    unsigned int highword = dividend >> 32;
-    unsigned int lowword = dividend & 0xffffffff;
-    unsigned long long quotient;
-    unsigned int rem;
-
-    __asm__("div %%ecx\n\t"
-        "xchg %%ebx, %%eax\n\t"
-        "div %%ecx\n\t"
-        "xchg %%edx, %%ebx"
-        : "=A"(quotient), "=b"(rem)
-        : "a"(highword), "b"(lowword), "c"(divisor), "d"(0)
-        );
-
-    if(remainder)
-    {
-        *remainder = rem;
-    }
-
-    return quotient;
-}
-
-/* Gibt eine unsigned 64-bit Zahl mit beliebiger Basis zwischen 2 und 36 aus */
-static void kputn(unsigned long long x, int radix, int pad, char padchar)
-{
-    char b[65];
-    char * r = b + 64; // r zeig auf das letzte Zeichen von b[]
-    char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz";
-    unsigned int remainder;
-
-    if(radix < 2 || radix > 36)
-    {
-        return;
-    }
-
-    *r-- = 0;
-
-    do
-    {
-        x = divmod(x, radix, &remainder);
-        *r-- = digits[remainder];
-        pad--;
-    }
-    while(x > 0);
-
-    while(pad-- > 0)
-    {
-        con_putc_ansi(padchar);
-    }
-
-    con_puts(r + 1);
-}
-
-/* Hilfsfunktion f�r kprintf() */
-void kaprintf(const char * format, int ** args)
-{
-    int pad;
-    char padfill;
-    signed long long value = 0;
-
-    while(*format)
-    {
-        if(*format == '%')
-        {
-            format++;
-
-            pad = 0;
-            if(*format == '0')
-            {
-                padfill = '0';
-                format++;
-            }
-            else
-            {
-                padfill = ' ';
-            }
-
-            while(*format >= '0' && *format <= '9')
-            {
-                pad = pad * 10 + *format++ - '0';
-            }
-
-            if(format[0] == 'l' && format[1] == 'l' && (format[2] == 'd' || format[2] == 'i' || format[2] == 'o' || format[2] == 'u' || format[2] == 'x'))
-            {
-                value = *(unsigned long long*)(*args);
-                *args += 2;
-
-                format += 2;
-            }
-            else if(format[0] == 'd' || format[0] == 'u')
-            {
-                value = *(*args)++;
-                if(value < 0)
-                {
-                    con_putc_ansi('-');
-                    pad--;
-                    value = -value;
-                }
-            }
-            else if(format[0] == 'i' || format[0] == 'o' || format[0] == 'p' || format[0] == 'x')
-            {
-                value = *(*args)++;
-                value = value & 0xffffffff;
-            }
-
-            switch(*format)
-            {
-                case 0:
-                    return;
-                case '%':
-                    con_putc_ansi('%');
-                    break;
-                case 'c':
-                    con_putc_ansi(*(*args)++);
-                    break;
-                case 'd':
-                case 'i':
-                case 'u':
-                    kputn(value, 10, pad, padfill);
-                    break;
-                case 'o':
-                    kputn(value, 8, pad, padfill);
-                    break;
-                case 'p':
-                case 'x':
-                    kputn(value, 16, pad, padfill);
-                    break;
-                /* Folgendes wieder einkommentieren um das extrem coole
-                   Feature "rekursives printf" auszuprobieren */
-                /*case 'r':
-                    format2 = (char*)*(*args)++;
-                    kaprintf(format2, args);
-                    break;*/
-                case 's':
-                    con_puts((char*)*(*args)++);
-                    break;
-                default:
-                    con_putc_ansi('%');
-                    con_putc_ansi(*format);
-                    break;
-            }
-            format++;
-        }
-        else
-        {
-            con_putc_ansi(*format++);
-        }
-    }
-    
-    con_flush_ansi_escape_code_sequence();
-}
-
-/* printf für den Kernel. Nur für Testzwecke gedacht.
- Unterstützt %c, %d, %i, %o, %p, %u, %s, %x und %lld, %lli, %llo, %llu, %llx. */
-void kprintf(char * format, ...)
-{
-    int * args = ((int*)&format) + 1;
-    kaprintf(format, &args);
-}
-
-int printf(const char * format, ...)
-{
-    int * args = ((int*)&format) + 1;
-    kaprintf(format, &args);
-
-    return 0; // TODO Korrekte printf-R�ckgabe
-}
-
diff --git a/src/kernel/src/liballoc.c b/src/kernel/src/liballoc.c
deleted file mode 100644
index 50300b23..00000000
--- a/src/kernel/src/liballoc.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2013 The tyndur Project. All rights reserved.
- *
- * This code is derived from software contributed to the tyndur Project
- * by Kevin Wolf.
- *
- * 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.
- *
- * 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 HOLDERS 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.
- */
-
-int __liballoc_lock(void)
-{
-	return 0;
-}
-
-int __liballoc_unlock(void)
-{
-	return 0;
-}
diff --git a/src/kernel/src/mm/Makefile.all b/src/kernel/src/mm/Makefile.all
deleted file mode 100644
index e9b03f45..00000000
--- a/src/kernel/src/mm/Makefile.all
+++ /dev/null
@@ -1 +0,0 @@
-cp *.o ..
diff --git a/src/kernel/src/mm/kmm.c b/src/kernel/src/mm/kmm.c
deleted file mode 100644
index 365df7a2..00000000
--- a/src/kernel/src/mm/kmm.c
+++ /dev/null
@@ -1,348 +0,0 @@
-/*

- * Copyright (c) 2006 The tyndur Project. All rights reserved.

- *

- * This code is derived from software contributed to the tyndur Project

- * by Burkhard Weseloh.

- *

- * 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 tyndur Project

- *     and its contributors.

- * 4. Neither the name of the tyndur 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 HOLDERS 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.

- */

-

-#include "kernel.h"

-#include "paging.h"

-#include "string.h"

-#include "types.h"

-

-

-/**

- * Mappt Speicher 1:1 in den Kernel Adressraum. Kein page alignment erforderlich.

- */

-bool kernel_identity_map(paddr_t paddr, uint32_t bytes)

-{

-    uint32_t aligned_addr = (uint32_t)paddr - ((uint32_t)paddr & ~PAGE_MASK);

-    uint32_t aligned_bytes = bytes + (uint32_t)paddr -

-        ((uint32_t)paddr & PAGE_MASK);

-

-    return map_page_range(kernel_page_directory, (vaddr_t)aligned_addr, (paddr_t)aligned_addr, PTE_W | PTE_P /*| PTE_U*/, NUM_PAGES(aligned_bytes));

-}

-

-// Der Teil des Page Directorys, der den Kernelraum mappt und f�r alle Prozesse gleich ist

-#define kernel_page_tables \

-    ((uint32_t*)(kernel_page_directory + (KERNEL_BASE >> PGDIR_SHIFT)))

-extern page_directory_t kernel_page_directory;

-extern uint32_t kernel_pd_id;

-

-/**

- * Errechnet die virtuelle Adresse der Page Table, die zur Adresse addr geh�rt.

- */

-static page_table_t get_kernel_page_table_addr(uint32_t addr)

-{

-    if(addr < KERNEL_BASE)

-    {

-        /* TODO: Ein panic mit (einem noch zu schreibenden) BUG()-Makro k�nnte hier angebrachter sein */

-        panic("addr(%x) < KERNEL_BASE", addr);

-    }

-

-    return (page_table_t)(KERNEL_PAGE_TABLES_VADDR + (((addr - KERNEL_BASE) >> PGDIR_SHIFT) << PAGE_SHIFT));

-}

-

-/**

- * Mappt eine Page Table in die Kernel Page Tables

- *

- * @param pgdir_index Index in das Page Directory. Die 4 MB an der virtuellen

- *    Adresse (pgdir_index << PGDIR_SHIFT) werden von dieser Page Table gemappt.

- * @param addr Physische Adresse der Page Table, die gemappt werden soll

- */

-static void map_kernel_page_table(int pgdir_index, uint32_t addr)

-{

-    // Da alle Page Tables mit (pgdir_index << PGDIR_SHIFT) >= KERNEL_BASE in

-    // die Gegend nach KERNEL_PAGE_TABLES_VADDR gemappt werden, m�ssen wir die

-    // dazugeh�rige Page Table finden.

-    page_table_t page_table = get_kernel_page_table_addr(KERNEL_PAGE_TABLES_VADDR);

-

-    // Jede Page Table ist genau 4KB gro�, also wird sie mit genau einem Eintrag

-    // in der Page Table der Kernel Page Tables gemappt.

-    page_table[pgdir_index] = (addr & PAGE_MASK) | PTE_W | PTE_P;

-

-    asm volatile("invlpg %0" : : "m" (*page_table));

-}

-

-/**

- * Wandelt eine virtuelle Adresse >= KERNEL_BASE in eine physische

- * Adresse um.

- */

-/*static*/ paddr_t kernel_virt_to_phys(uint32_t vaddr)

-{

-    // Die Page Table f�r diese virtuelle Adresse ermitteln ...

-    page_table_t page_table = get_kernel_page_table_addr(vaddr);

-

-    // ... und auslesen.

-    return (paddr_t)(page_table[(vaddr >> PAGE_SHIFT) & 0x3ff] & PAGE_MASK);

-}

-

-/**

- * Gibt eine Seite (4 KBytes) im Kernel-Adressraum frei.

- */

-void free_kernel_page(vaddr_t page)

-{

-    uint32_t addr = (uint32_t)page;

-    page_table_t page_table;

-    

-    if(addr < KERNEL_BASE)

-    {

-        /* TODO: Ein panic mit (einem noch zu schreibenden) BUG()-Makro k�nnte hier angebrachter sein */

-        panic("Es wurde versucht eine Seite ausserhalb des Kernelraums freizugeben.");

-    }

-

-    // Die physische Seite vor der virtuellen freigeben, weil sonst kernel_virt_to_phys() nicht mehr funktioniert.

-    phys_free_page(kernel_virt_to_phys(addr));

-

-    // Das Mapping aufheben, und die virtuelle Seite somit freigeben.

-    page_table = get_kernel_page_table_addr(addr);

-    page_table[(addr >> PAGE_SHIFT) & 0x3ff] = 0;

-}

-

-/**

- * Findet einen freien Bereich mit num freien Seiten im Kernel-Adressraum.

- *

- * @return Die erste Seite dieses Bereiches

- */

-vaddr_t find_contiguous_kernel_pages(int num)

-{

-    int i, j;

-    int pgdir_index, pgtbl_index;

-    int num_free_pages;

-    page_table_t page_table;

-    

-    num_free_pages = 0;

-    pgdir_index = 0;

-    pgtbl_index = 0;

-

-    for(i = 0; i < NUM_KERNEL_PAGE_TABLES; i++)

-    {

-        if(num_free_pages == 0)

-        {

-            // Dieser Eintrag im Page Directory w�re der erste von unseren Pages

-            pgdir_index = i;

-        }

-

-        if(kernel_page_tables[i] & PTE_P)

-        {

-            // Die virtuelle Adresse der passenden Page Table errechnen

-            page_table = (page_table_t)(KERNEL_PAGE_TABLES_VADDR + (i << PAGE_SHIFT));

-           

-            // Die NULL-Page bleibt grunds�tzlich ungemappt, daher wird bei der ersten

-            // Page Table erst beim zweiten Eintrag mit Suchen angefangen

-            for(j = (i == 0 ? 1 : 0); j < PAGE_TABLE_LENGTH; j++)

-            {

-                if(!(page_table[j] & PTE_P))

-                {

-            

-                    if(num_free_pages == 0)

-                    {

-                        pgtbl_index = j;

-                    }

-

-                    num_free_pages++;

-

-                    if(num_free_pages >= num)

-                    {

-                        // Wenn wir genug freie Seiten gefunden haben, die Suche beenden

-                        break;

-                    }

-                }

-                else

-                {

-                    // Eine belegte Page ist uns dazwischen gekommen, und wir m�ssen mit unserer Suche von vorne anfangen

-                    num_free_pages = 0;

-                }

-            }

-        }

-        else

-        {

-            // Diese Page Table ist zwar nicht vorhanden, aber wir k�nnen trotzdem mit ihr rechnen

-

-            if(i == 0)

-            {

-                // Die NULL-Page wird freigehalten, daher muss hier

-                // eins von der theoretischen Maximalzahl abgezogen

-                // werden

-                pgtbl_index = 1;

-                num_free_pages += PAGE_TABLE_LENGTH - 1;

-            }

-            else

-            {

-                if(num_free_pages == 0)

-                {

-                    // Diese Page w�re die erste von unseren Pages.

-                    pgtbl_index = 0;

-                }

-

-                num_free_pages += PAGE_TABLE_LENGTH;

-            }

-        }

-

-        if(num_free_pages >= num)

-        {

-            // Wenn wir genug freie Seiten gefunden haben, die Suche beenden

-            break;

-        }

-    }

-    

-    if(num_free_pages == 0)

-    {

-        panic("Nicht genug Speicher.");

-    }

-

-    return (vaddr_t)(KERNEL_BASE + (pgdir_index << PGDIR_SHIFT) + (pgtbl_index << PAGE_SHIFT));

-}

-

-/**

- * Allokiert num_pages Seiten im Kernel-Adressraum. 

- *

- * @return Die Adresse der ersten Seite

- */

-vaddr_t alloc_kernel_pages(int num)

-{

-    int i, j;

-    int pgdir_index, pgtbl_index;

-    page_table_t page_table;

-    vaddr_t vaddr;

-    

-    vaddr = find_contiguous_kernel_pages(num);

-    

-    pgdir_index = ((uint32_t)vaddr - KERNEL_BASE) >> PGDIR_SHIFT;

-    pgtbl_index = (((uint32_t)vaddr - KERNEL_BASE) >> PAGE_SHIFT) % PAGE_TABLE_LENGTH;

-

-    for(i = pgdir_index; num; i++)

-    {

-        if(!(kernel_page_tables[i] & PTE_P))
-        {
-            // Eine neue Page Table muss angelegt werden
-            kernel_page_tables[i] = phys_alloc_page() | PTE_W | PTE_P;
-            map_kernel_page_table(i, kernel_page_tables[i]);
-            page_table = (page_table_t)(KERNEL_PAGE_TABLES_VADDR + (i << PAGE_SHIFT));
-
-            // Page Table mit Nullen initialisieren

-            memset(page_table, 0, PAGE_SIZE);
-

-            kernel_pd_id++;

-        }

-        else

-        {

-            // Wir verwenden eine bereits vorhandene Page Table

-            page_table = (page_table_t)(KERNEL_PAGE_TABLES_VADDR + (i << PAGE_SHIFT)); 

-        }

-
-        for(j = (i == pgdir_index) ? pgtbl_index : 0; j < PAGE_TABLE_LENGTH && num; j++, num--)
-        {
-            page_table[j] = phys_alloc_page() | PTE_W | PTE_P;
-            asm volatile("invlpg %0"
-                : : "m" (*(char*)((i * PAGE_TABLE_LENGTH + j) * PAGE_SIZE))
-                : "memory");
-        }

-    }

-

-    return vaddr;

-}

-

-/**

- * Gibt num_pages Seiten beginnend mit der Adresse first_page im

- * Kernel-Adressraum frei.

- */

-void free_kernel_pages(vaddr_t first_page, int num_pages)

-{

-    int i;

-    

-    for(i = 0; i < num_pages; i++)

-    {

-        free_kernel_page((vaddr_t)((uint32_t)first_page + i * PAGE_SIZE));

-    }

-}

-

-

-/**

- * Mapt den physikalische Adressbereich irgendwo hin, und gibt einen Pointer 

- * darauf zurueck.

- * @param addr Adresse

- * @param size Groesse des Speicherbereichs

- * @return Pointer auf gemapte stelle

- */

-vaddr_t map_phys_addr(paddr_t paddr, size_t size)

-{

-    // FIXME Diese Funktion sollte nicht auf kernel_page_directory arbeiten, 

-    // sondern auf dem aktuellen PD.

-    uint32_t aligned_addr = (uint32_t)paddr - ((uint32_t)paddr & ~PAGE_MASK);

-    uint32_t aligned_bytes = size + (uint32_t)paddr -

-        ((uint32_t)paddr & PAGE_MASK);

-    

-    vaddr_t vaddr = find_contiguous_kernel_pages(NUM_PAGES(aligned_bytes));

-    if (vaddr == NULL) {

-        panic("map_phys_addr(0x%08x, 0x%x): vaddr == NULL\n", paddr, size);

-        return NULL;

-    }

-    

-    if(!map_page_range(kernel_page_directory, vaddr, (paddr_t)aligned_addr, PTE_W | PTE_P /*| PTE_U*/, NUM_PAGES(aligned_bytes))) {

-        panic("map_phys_addr(0x%08x, 0x%x): map_page_rang fehlgeschlagen\n", paddr, size);

-        return NULL;

-    }

-    

-    return (vaddr_t)((uint32_t)vaddr + ((uint32_t)paddr & ~PAGE_MASK));

-}

-

-

-/**

- * Free dem physikalische Adressbereich

- * @param addr Adresse

- * @param size Groesse des Speicherbereichs

- */

-void free_phys_addr(vaddr_t vaddr, size_t size)

-{

-    uint32_t aligned_addr = (uint32_t)vaddr - ((uint32_t)vaddr & ~PAGE_MASK);

-    uint32_t aligned_bytes = size + (uint32_t)vaddr -

-        ((uint32_t)vaddr & PAGE_MASK);

-    

-    

-    map_page_range(kernel_page_directory, (vaddr_t) aligned_addr, (paddr_t)0, 0, NUM_PAGES(aligned_bytes));

-}

-

-/**

- * Dient nur als Wrapper fuer malloc()

- */

-void* mem_allocate(uint32_t size, uint32_t flags)

-{

-    return alloc_kernel_pages(PAGE_ALIGN_ROUND_UP(size) >> 12);

-}

-

-/**

- * Dient nur als Wrapper fuer malloc()

- */

-void mem_free(void* address, uint32_t size)

-{

-    free_kernel_pages(address, PAGE_ALIGN_ROUND_UP(size) >> 12);

-}

diff --git a/src/kernel/src/mm/paging.c b/src/kernel/src/mm/paging.c
deleted file mode 100644
index 48f9b7ee..00000000
--- a/src/kernel/src/mm/paging.c
+++ /dev/null
@@ -1,476 +0,0 @@
-/*  
- * Copyright (c) 2006 The tyndur Project. All rights reserved.
- *
- * This code is derived from software contributed to the tyndur Project
- * by Kevin Wolf.
- *
- * 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 tyndur Project
- *     and its contributors.
- * 4. Neither the name of the tyndur 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 HOLDERS 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.
- */  
-
-#include <stdint.h>
-#include <stdbool.h>
-
-#include "kernel.h"
-#include "string.h"
-#include "vmm.h"
-#include "paging.h"
-#include "kmm.h"
-#include "tasks.h"
-#include "kprintf.h"
-
-
-extern unsigned long * phys_mmap;
-extern unsigned long phys_mmap_size;
-
-bool map_page(page_directory_t page_directory, vaddr_t vaddr, paddr_t paddr, int flags);
-bool map_page_range(page_directory_t page_directory, vaddr_t vaddr, paddr_t paddr, int flags, int num_pages);
-
-page_directory_t kernel_page_directory;
-uint32_t kernel_pd_id = 0;
-
-/**
- * Wenn true, werden Page Tables nicht �ber ihre virtuelle Adresse
- * angesprochen, sondern �ber die physische. In diesem Fall mu� daf�r
- * gesorgt sein, da� die Page Table auch unter dieser Adresse zugreifbar
- * ist (z.B. solange Paging nicht aktiviert ist oder per Identity Mapping)
- *
- * Im normalen Betrieb sollte use_phys_page_tables false sein.
- */
-bool use_phys_page_tables;
-
-
-// TODO: PTE_U wird momentan sehr gro�z�gig vergeben, das sollte sich
-// irgendwann noch �ndern.
-    
-/**
- * Initialisiert die virtuelle Speicherverwaltung. Insbesondere wird ein
- * Page Directory fuer den Kernel angelegt und geladen.
- *
- * Die physische Speicherverwaltung muss dazu bereits initialisiert sein.
- */
-void init_paging(void)
-{
-    use_phys_page_tables = true;
-
-
-    // Ein Page Directory anlegen und initialisieren
-    kernel_page_directory = (unsigned long*) phys_alloc_page_limit(0x1000);
-    memset(kernel_page_directory, 0, PAGE_SIZE);
-
-
-    /* Kernel Page Tables mappen */
-    kernel_page_directory[KERNEL_PAGE_TABLES_VADDR >> PGDIR_SHIFT] = 
-        (uint32_t) kernel_page_directory | PTE_W | PTE_P;
-
-    // Den Kernel mappen
-    map_page_range(kernel_page_directory, kernel_start, (paddr_t) kernel_phys_start,
-        PTE_W | PTE_P /*| PTE_U*/, ((uint32_t)kernel_end - (uint32_t)kernel_start) / PAGE_SIZE);
-
-    // Videospeicher mappen
-    map_page_range(kernel_page_directory, (vaddr_t) 0xB8000, (paddr_t)0xB8000, PTE_W | PTE_P /*| PTE_U*/, ((25*80*2) / PAGE_SIZE) + 1);
-    
-    /* Das Page Directory mappen */
-    map_page(kernel_page_directory, kernel_page_directory, (paddr_t)kernel_page_directory, PTE_P | PTE_W);
-    
-    // Bitmap mit dem physischen Speicher mappen.
-    map_page_range(kernel_page_directory, phys_mmap, (paddr_t)phys_mmap, PTE_W | PTE_P,
-        (sizeof(uint32_t) * phys_mmap_size + PAGE_SIZE - 1) / PAGE_SIZE);
-
-    __asm__(
-        
-        // Page directory laden
-        "movl %0, %%cr3\n\t"
-
-        // Paging aktivieren
-        "mov %%cr0, %%eax\n\t"
-        "or $0x80000000, %%eax\n\t"
-        "mov %%eax, %%cr0\n\t"
-        
-    : : "r"(kernel_page_directory) : "eax");
-    
-    use_phys_page_tables = false;
-}
-
-
-/**
- * Mappt mehrere zusammenh�ngende virtuelle Seiten auf einen physischen
- * Speicherbereich. Beide Adressen muessen dazu 4K-aligned sein.
- *
- * @param page_directory Page Directory, auf das sich die virtuelle 
- *    Adresse bezieht
- *
- * @param vaddr Virtuelle Speicheradresse der ersten Page
- * @param paddr Physische Speicheradresse der ersten Page
- * @param flags Flags, die in der Page Table gesetzt werden sollen
- * @param num Anzahl der Seiten
- * 
- * @return true, wenn der bereich erfolgreich gemappt werden konnte, 
- *    false sonst
- */
-bool map_page_range(page_directory_t page_directory, vaddr_t vaddr, paddr_t paddr, int flags, int num_pages) 
-{
-    int i;
-    vaddr_t va;
-    paddr_t pa;
-
-    for(i = 0; i < num_pages; i++)
-    {
-        va = (vaddr_t)((uint32_t)vaddr + i * PAGE_SIZE);
-        pa = (paddr_t)((uint32_t)paddr + i * PAGE_SIZE);
-
-        if(map_page(page_directory, va, pa, flags) != true)
-        {
-            /* TODO: Das bereits geschehene Mapping r�ckg�ngig machen */
-            return false;
-        }
-    }
-
-    return true;
-}
-
-/**
- * Mappt eine virtuelle Adresse auf eine physische.
- * Beide Adressen muessen dazu 4K-aligned sein.
- *
- * @param page_directory Page Directory, auf das sich die virtuelle 
- *    Adresse bezieht
- *
- * @param vaddr Virtuelle Speicheradresse
- * @param paddr Physische Speicheradresse
- * @param flags Flags, die in der Page Table gesetzt werden sollen
- * 
- * @return true, wenn die virtuelle Seite erfolgreich gemappt werden konnte, 
- *    false sonst
- */
-bool map_page(page_directory_t page_directory, vaddr_t vaddr, paddr_t paddr, int flags) 
-{
-    page_table_t page_table;
-    
-    uint32_t vpage = (uint32_t) vaddr / PAGE_SIZE;
-
-    //kprintf("map_page %x => %x\n", vaddr, paddr);
-
-    // Die NULL-Page bleibt ungemappt
-    if (vaddr == NULL) {
-        panic("Versuchtes Mapping nach virtuell NULL");
-        return false;
-    }
-  
-    if (flags & ~0x01F) {
-        // Boese Flags wollen die Adresse manipulieren.
-        // Fliegt das entsprechende Programm eben beim naechsten Zugriff
-        // auf die Schnauze.
-        
-        return false;
-    }
-
-    if (((uint32_t) vaddr | (uint32_t) paddr) & 0xfff) {
-        panic("Adressen sind nicht 4K-aligned (virt = %x, phys = %x)", vaddr, paddr);
-    }
-
-    // Wenn es noch keine passende Pagetable gibt, muss eine neue her,
-    // ansonsten nehmen wir diese. Und wenn es sich bei dem Eintrag
-    // um eine 4M-Seite handelt, laeuft was schief.
-    if ((page_directory[vpage / PAGE_TABLE_LENGTH] & PTE_P) == 0) {
-        page_table = (page_table_t) phys_alloc_page();
-        
-        page_directory[vpage / PAGE_TABLE_LENGTH] = ((uint32_t) page_table) | flags | PTE_U;
-        
-        if (page_directory == kernel_page_directory) {
-            if (!use_phys_page_tables) {
-                page_table = (page_table_t) (KERNEL_PAGE_TABLES_VADDR + ((sizeof(uint32_t)*vpage) & ~0xfff));
-            }
-        } else {
-            // Die Page Table geh�rt nicht zum Kernel - folglich sollte man nicht direkt auf
-            // ihre Adresse zugreifen, wenn man nicht gerade einen Page Fault ausl�sen will.
-            // Die Page Table muss daher zun�chst in den Kerneladressraum gemappt werden.
-            vaddr_t kernel_page_table = find_contiguous_kernel_pages(1);
-            map_page(kernel_page_directory, kernel_page_table, (paddr_t) page_table, PTE_P | PTE_W);
-            
-            /* 
-            kprintf("Mappe PT in Kerneladressraum; neue PT\n");
-            kprintf("PD = %x\n", page_directory);
-            kprintf("PT Kernel vaddr = %x, paddr = %x\n", kernel_page_table, page_table);
-            */
-
-            page_table = kernel_page_table;
-        }
-
-        if (vaddr < (vaddr_t) 0x40000000) {
-            kernel_pd_id++;
-        }
-        
-        memset(page_table, 0, PAGE_SIZE);
-        
-    } else if (page_directory[vpage / PAGE_TABLE_LENGTH] & PTE_PS) {
-        panic("Doppelbelegung im Page Directory.");
-    } else {
-        if (page_directory == kernel_page_directory) {
-            if (use_phys_page_tables) {
-                page_table = (page_table_t) (page_directory[vpage / PAGE_TABLE_LENGTH] & ~0xFFF);
-            } else {
-                page_table = (page_table_t) (KERNEL_PAGE_TABLES_VADDR + ((sizeof(uint32_t)*vpage) & ~0xfff));
-            }
-        } else {
-            page_table = (page_table_t) (page_directory[vpage / PAGE_TABLE_LENGTH] & ~0xFFF);
-            
-            // Die Page Table geh�rt nicht zum Kernel - folglich sollte man nicht direkt auf
-            // ihre Adresse zugreifen, wenn man nicht gerade einen Page Fault ausl�sen will.
-            // Die Page Table muss daher zun�chst in den Kerneladressraum gemappt werden.
-            
-            vaddr_t kernel_page_table = find_contiguous_kernel_pages(1);
-            map_page(kernel_page_directory, kernel_page_table, (paddr_t) page_table, PTE_P | PTE_W);
-            page_table = kernel_page_table;
-        }
-    }
-    
-    // Wenn der Eintrag in der Pagetable noch nicht gesetzt ist, setzen.
-    // Ansonsten stehen wir vor einer Doppelbelegung.
-    //
-    // Wenn genau dasselbe Mapping doppelt gemacht wird, wird dar�ber hinweggesehen
-    //
-    // Und wenn das Mapping aufgehoben werden soll, sollte man sich auch nicht dar�ber
-    // beschweren, dass der Eintrag schon besteht.
-    if ((page_table[vpage % PAGE_TABLE_LENGTH] & PTE_P) && ((page_table[vpage % PAGE_TABLE_LENGTH] & ~(PTE_A | PTE_D)) != (((uint32_t) paddr) | flags)) && (flags & PTE_P)) {
-        panic("Doppelbelegung in einer Page Table.");
-        return false;
-    } else {
-        page_table[vpage % PAGE_TABLE_LENGTH] = ((uint32_t) paddr) | flags;
-
-        if (page_directory != kernel_page_directory) {
-            // Falls wir die Page Table extra in den Kerneladressraum gemappt haben,
-            // den Speicher wieder freigeben
-            unmap_page(kernel_page_directory, page_table);
-        }
-        // Und falls es um das aktive Page Directory geht, w�re jetzt ein
-        // guter Zeitpunkt, den TLB zu invalidieren.
-        // FIXME: Im moment auch wenn es sich nicht um das aktuelle PD handelt,
-        // aber das sauber zu machen ist zu aufwaendig, da kernel eh ersetzt
-        // wird.
-        __asm__ __volatile__("invlpg %0" : : "m" (* (char*) vaddr));
-
-        return true;
-    }
-    
-}
-
-/**
- * Entfernt das Mapping einer virtuellen Adresse.
- *
- * @param page_directory Page Directory, auf das sich die virtuelle 
- *    Adresse bezieht
- * @param vaddr Virtuelle Speicheradresse
- * 
- * @return true, wenn die virtuelle Seite erfolgreich ungemappt werden konnte, 
- *    false sonst
- */
-bool unmap_page(page_directory_t page_directory, vaddr_t vaddr) 
-{
-    return map_page(page_directory, vaddr, (paddr_t) NULL, 0);
-}
-
-/**
- * Gibt den Pagetable-Eintrag zu einer gegebenen virtuellen Speicheradresse
- * zurueck.
- *
- * @param page_directory Page Directory, auf das sich die Adresse bezieht
- * @param vaddr Aufzuloesende virtuelle Adresse
- *
- * @return Pagetable-Eintrag der 4K-Seite, zu der die gegebene virtuelle
- * Adresse gehoert. 0, wenn die Adresse nicht in einer Seite liegt, die
- * present ist.
- */
-static uint32_t get_pagetable_entry
-    (page_directory_t page_directory, vaddr_t vaddr)
-{
-    page_table_t page_table;
-    paddr_t phys_page_table;
-    uint32_t result;
-    
-    uint32_t vpage = (uint32_t) vaddr / PAGE_SIZE;
-    //kprintf("[Resolv: %x in PD %x]", vaddr, page_directory);
-
-    // Passende Page Table suchen
-    // Bei einer 4M-Page sind wir eigentlich schon am Ziel
-    if ((page_directory[vpage / PAGE_TABLE_LENGTH] & PTE_P) == 0) {
-        return 0;
-    } else if (page_directory[vpage / PAGE_TABLE_LENGTH] & PTE_PS) {
-        return page_directory[vpage / PAGE_TABLE_LENGTH];
-    } else {
-        phys_page_table = (paddr_t)
-            (page_directory[vpage / PAGE_TABLE_LENGTH] & ~0xFFF);
-    }
-        
-    // Die Page-Table-Adresse ist eine physische Adresse. Am sichersten ist es,
-    // die Adresse einfach noch einmal zu mappen.
-    page_table = map_phys_addr(phys_page_table, PAGE_SIZE);
-    
-    // Adresse zusammenbasteln und fertig
-    if (page_table[vpage % PAGE_TABLE_LENGTH] & PTE_P) {
-        result = page_table[vpage % PAGE_TABLE_LENGTH]; 
-    } else {
-        result = 0;
-    }
-        
-    // Falls wir die Page Table extra in den Kerneladressraum gemappt haben,
-    // den Speicher wieder freigeben
-    unmap_page(kernel_page_directory, page_table);
-
-    return result;
-}
-
-/**
- * Loest eine virtuelle Adresse bezueglich eines Page Directory
- * in eine physische Adresse auf.
- *
- * @return Physische Adresse oder NULL, wenn die Page nicht vorhanden ist
- */
-paddr_t resolve_vaddr(page_directory_t page_directory, vaddr_t vaddr)
-{
-    uint32_t pte = get_pagetable_entry(page_directory, vaddr);
-    
-    if ((pte & PTE_P) == 0) {
-        return (paddr_t) NULL;
-    }
-
-    if ((pte & PTE_PS) == 0) {
-        return (paddr_t) ((pte & ~0xFFF) | ((uint32_t) vaddr & 0xFFF));
-    } else {
-        return (paddr_t) ((pte & ~0x3FFFFF) | ((uint32_t) vaddr & 0x3FFFFF));
-    }
-}
-
-/**
- * Prueft, ob ein Speicherbereich im Page Directory des aktuellen Tasks
- * komplett gemappt ist und PTE_U (Zugriffsrecht fuer Usermode) gesetzt hat.
- */
-bool is_userspace(vaddr_t start, uint32_t len)
-{
-    vaddr_t cur;
-
-    if (start + len < start) {
-        return false;
-    }    
-    
-    for (cur = start; 
-        (cur < start + len) && (cur > (vaddr_t) 0xFFF); 
-        cur += PAGE_SIZE) 
-    {
-        uint32_t pte = get_pagetable_entry(current_task->cr3, cur);
-        if ((pte == 0) || !(pte & PTE_U)) {
-            return false;
-        }
-    }
-
-    return true;
-}
-
-
-/**
- * Findet einen freien Bereich mit num freien Seiten
- *
- * @return Die Anfangsadresse der ersten Seite dieses Bereiches
- */
-vaddr_t find_contiguous_pages(page_directory_t page_directory, int num, uint32_t lower_limit, uint32_t upper_limit)
-{
-    uint32_t free_pages = 0;
-    uint32_t cur_page;
-    uint32_t cur_page_table;
-
-    // Die NULL-Page bleibt ungemappt
-    if (lower_limit < PAGE_SIZE) {
-        lower_limit = PAGE_SIZE;
-    }
-
-    cur_page = (lower_limit >> PAGE_SHIFT) % PAGE_TABLE_LENGTH;
-    cur_page_table = (lower_limit >> PGDIR_SHIFT);
-
-    while ((free_pages < num) && ((cur_page_table << PGDIR_SHIFT) < upper_limit)) {
-        if (page_directory[cur_page_table] & PTE_P) {
-
-            page_table_t page_table;
-            vaddr_t kernel_page_table = find_contiguous_kernel_pages(1);
-
-            map_page(kernel_page_directory, kernel_page_table, page_directory[cur_page_table] & PAGE_MASK, PTE_P | PTE_W);
-            page_table = kernel_page_table;
-
-            while (cur_page < PAGE_TABLE_LENGTH) {
-                if ((page_table[cur_page++] & PTE_P) == 0) {
-                    free_pages++;
-                } else {
-                    free_pages = 0;
-                    lower_limit = (cur_page_table << PGDIR_SHIFT) + (cur_page << PAGE_SHIFT);
-                }
-//                kprintf("{%d-%d-%x}", free_pages, cur_page, lower_limit);
-            }
-
-            unmap_page(kernel_page_directory, kernel_page_table);
-            
-        } else {
-            free_pages += PAGE_TABLE_LENGTH;
-        }
-
-        cur_page = 0;
-        cur_page_table++;
-    }
-
-    if ((free_pages >= num) && (lower_limit + (num * PAGE_SIZE) < upper_limit)) {
-        return (vaddr_t) lower_limit;
-    } else {
-        return NULL;
-    }
-}
-
-
-/**
- * Vergr�ssert den Userspace-Stack eines Tasks um pages Seiten
- *
- * @param task_ptr Pointer zur Task-Struktur
- * @param pages Anzahl der zu mappenden Seiten
- */
-void increase_user_stack_size(struct task * task_ptr, int pages)
-{
-	int i;
-	for(i = 0; i < pages; i++)
-	{
-		task_ptr->user_stack_bottom -= PAGE_SIZE;
-		if(resolve_vaddr((page_directory_t) task_ptr->cr3, (vaddr_t) task_ptr->user_stack_bottom) != (paddr_t) NULL)
-		{
-			kprintf("\n"
-                "\033[1;37m\033[41m" // weiss auf rot
-                "Task gestoppt: Konnte den Stack nicht weiter vergroessern\n"
-                "\033[0;37m\033[40m");
-            while(1) { asm("hlt"); }
-		}
-
-        map_page((page_directory_t) task_ptr->cr3, task_ptr->user_stack_bottom, phys_alloc_page(), PTE_P | PTE_W | PTE_U);
-	}
-	
-}
-
diff --git a/src/kernel/src/mm/phys.c b/src/kernel/src/mm/phys.c
deleted file mode 100644
index f0154da1..00000000
--- a/src/kernel/src/mm/phys.c
+++ /dev/null
@@ -1,599 +0,0 @@
-/*
- * Copyright (c) 2006 The tyndur Project. All rights reserved.
- *
- * This code is derived from software contributed to the tyndur Project
- * by Burkhard Weseloh.
- *
- * 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 tyndur Project
- *     and its contributors.
- * 4. Neither the name of the tyndur 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 HOLDERS 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.
- */
-
-/*
- * 2006-23-9: malu
- * Dokumentation hinzugef�gt
- */
-
-#include <stdint.h>
-
-#include "bitops.h"
-#include "kernel.h"
-#include "multiboot.h"
-#include "vmm.h"
-#include "phys.h"
-#include "string.h"
-
-extern struct multiboot_info multiboot_info;
-
-/* Diese beiden werden in kernel.ld definiert. */
-extern void kernel_phys_start(void);
-extern void kernel_phys_end(void);
-
-unsigned long * phys_mmap;
-unsigned long phys_mmap_size;
-unsigned long phys_mmap_usable_pages;
-
-/**
- * Gibt die Anzahl der freien Pages zurueck
- *
- * @return Anzahl freie Pages
- */
-unsigned long phys_count_free_pages()
-{
-    unsigned long free_pages = 0;
-    unsigned long i, j;
-    
-    for(i = 0; i < phys_mmap_size; i++)
-    {
-        for(j = 0; j < 32; j++)
-        {
-            if((phys_mmap[i] & (1 << j)) != 0)
-            {
-                free_pages++;
-            }
-        }
-    }
-
-    return free_pages;
-}
-
-/**
- * Gibt die Anzahl der Pages zurueck
- */
-unsigned long phys_count_pages()
-{
-    return phys_mmap_usable_pages;//ys_mmap_size * 32;
-}
-
-/**
- * Markiert eine Page als frei/unbenutzt.
- *
- * @param page Zeiger auf den Anfang der Page die als frei markiert werden soll.
- */
-
-void phys_mark_page_as_free(paddr_t page)
-{
-//    kprintf("[Free %08x]", page);
-    phys_mmap[page / PAGE_SIZE / 32] |= 1 << ((page / PAGE_SIZE) & 31);
-}
-
-/**
- * Markiert num Pages als frei/unbenutzt.
- *
-  @param page Zeiger auf den Anfang der ersten Page.
- * @param num Anzahl der Pages die als frei markiert werden sollen.
- */
-
-void phys_mark_page_range_as_free(paddr_t page, unsigned int num)
-{
-    int i;
-
-    for(i = 0; i < num; i++)
-    {
-        phys_mark_page_as_free(page + i * PAGE_SIZE);
-    }
-}
-
-/**
- * Markiert eine Page als benutzt.
- *
- * @param page Zeiger auf den Anfang der Page die als benutzt markiert werden soll.
- */
-
-void phys_mark_page_as_used(paddr_t page)
-{
-    phys_mmap[page / PAGE_SIZE / 32] &= ~(1 << ((page / PAGE_SIZE) & 31));
-}
-
-/**
- * Markiert num Pages als benutzt.
- *
- * @param page Zeiger auf den Anfang der ersten Page.
- * @param num Anzahl der Pages die als benutzt markiert werden sollen.
- */
-
-void phys_mark_page_range_as_used(paddr_t page, unsigned int num)
-{
-    int i;
-
-    for(i = 0; i < num; i++)
-    {
-        phys_mark_page_as_used(page + i * PAGE_SIZE);
-    }
-}
-
-/**
- * Sucht eine freie Page und gibt einen Zeiger auf den Anfang zur�ck.
- *
- * @param lower_limit Mindestgr��e der Page.
- *
- * @return Im Erfolgsfall wird ein Zeiger auf den Anfang der Page 
- *      zur�ckgegeben (Bei Erfolg ist der R�ckgabewert immer
- *      durch PAGE_SIZE teilbar). Im Fehlerfall wird 1 zur�ckgegeben.
- */
-
-paddr_t find_free_page(unsigned long lower_limit)
-{
-    unsigned int i, j;
-    paddr_t page = 0;
-
-    i = lower_limit / PAGE_SIZE / 32;
-    if(phys_mmap[i] & (0xffffffff << ((lower_limit / PAGE_SIZE) % 32)))
-    {
-        j = bit_scan_forward(phys_mmap[i] & (0xffffffff << ((lower_limit / PAGE_SIZE) % 32)));
-        page = (i * 32 + j) * PAGE_SIZE;
-        return page;
-    }
-
-    for(i++; i < phys_mmap_size; i++)
-    {
-        if(phys_mmap[i])
-        {
-            j = bit_scan_forward(phys_mmap[i]);
-            page = (i * 32 + j) * PAGE_SIZE;
-            return page;
-        }
-    }
-
-    return 1;
-}
-
-/**
- * Sucht num freie Pages und gibt einen Zeiger auf den Anfang der ersten Page 
- * zur�ck.
- *
- * @param lower_limit Mindestgr��e jeder Page.
- * @param num Anzahl der Pages.
- *
- * @return Zeiger auf den Anfang der ersten Page.
- * @return Im Erfolgsfall wird ein Zeiger auf den Anfang der ersten 
- *      Page zur�ckgegeben (Bei Erfolg ist der R�ckgabewert immer
- *      durch PAGE_SIZE teilbar). Im Fehlerfall wird 1 zur�ckgegeben.
- */
-
-/* TODO: unbedingt testen */
-paddr_t find_free_page_range(unsigned long lower_limit, unsigned int num)
-{
-    unsigned int i, j;
-    unsigned int found = 0;
-    paddr_t page = 0;
-
-    for(i = lower_limit / PAGE_SIZE / 32; i < phys_mmap_size; i++)
-    {
-        if(phys_mmap[i] == 0)
-        {
-            found = 0;
-            continue;
-        }
-
-        if(phys_mmap[i] == 0xffffffff)
-        {
-            if(found == 0)
-            {
-                page = i * 32 * PAGE_SIZE;
-            }
-            found += 32;
-        }
-        else
-        {
-            for(j = 0; j < 32; j++)
-            {
-                if(phys_mmap[i] & (1 << j))
-                {
-                    if(found == 0)
-                    {
-                        page = (i * 32 + j) * PAGE_SIZE;
-                    }
-                    found++;
-
-                    if(found > num)
-                    {
-                        return page;
-                    }
-                }
-                else
-                {
-                    found = 0;
-                }
-            }
-        }
-
-        if(found > num)
-        {
-            return page;
-        }
-    }
-
-    return 1;
-}
-
-/**
- * Markiert eine Page als frei/unbenutzt.
- *
- * @param page Zeiger auf den Anfang der Page die als frei markiert werden soll.
- */
-
-void phys_free_page(paddr_t page)
-{
-    phys_mark_page_as_free(page);
-}
-
-/**
- * Markiert num Pages als frei/unbenutzt.
- *Startp
- * @param page Zeiger auf den Anfang der ersten Page.
- * @param num Anzahl der Pages die als frei markiert werden sollen.
- */
-
-void phys_free_page_range(paddr_t page, unsigned int num)
-{
-    phys_mark_page_range_as_free(page, num);
-}
-
-/**
- * Reserviert eine DMA-Page und markiert sie gleichteitig als benutzt.
- *
- * @return Zeiger auf den Anfang der DMA-Page.
- */
-
-paddr_t phys_alloc_dma_page()
-{
-    paddr_t page = find_free_page(0);
-    if(page & (PAGE_SIZE - 1))
-    {
-        panic("Kein freier Speicher mehr da.");
-    }
-    phys_mark_page_as_used(page);
-    return page;
-}
-
-/**
- * Reserviert eine Page.
- *
- * @return Zeiger auf den Anfang der Page.
- */
-
-paddr_t phys_alloc_page()
-{
-    paddr_t page = find_free_page(16 * 1024 * 1024);
-    if(page & (PAGE_SIZE - 1))
-    {
-        return phys_alloc_dma_page();
-    }
-    phys_mark_page_as_used(page);
-    return page;
-}
-   
-/**
- * Reserviert eine Page nicht unterhalb einer gegebenen Adresse
- */
-paddr_t phys_alloc_page_limit(uint32_t lower_limit)
-{
-    paddr_t page = find_free_page(16 * 1024 * 1024 > lower_limit ? 16 * 1024 * 1024 : lower_limit);
-
-    if(page & (PAGE_SIZE - 1)) {
-        page = find_free_page(lower_limit);
-    }
-
-    if(page & (PAGE_SIZE - 1)) {
-        panic("Konnte Speicher nicht reservieren");
-    }
-    phys_mark_page_as_used(page);
-    return page;
-}
-
-
-/**
- * Reserviert num DMA-Pages.
- *
- * @return Zeiger auf den Anfang der ersten Page.
- */
-
-paddr_t phys_alloc_dma_page_range(unsigned int num)
-{
-    paddr_t page = find_free_page_range(0, num);
-    if((uint32_t) page & (PAGE_SIZE - 1))
-    {
-        panic("Keine freier Speicher mehr da.");
-    }
-    phys_mark_page_range_as_used(page, num);
-    return page;
-}
-
-/**
- * Reserviert num Pages.
- *
- * @return Zeiger auf den Anfang der ersten Page.
- */
-
-paddr_t phys_alloc_page_range(unsigned int num)
-{
-    paddr_t page = find_free_page_range(16 * 1024 * 1024, num);
-    if((uint32_t) page & (PAGE_SIZE - 1))
-    {
-        return phys_alloc_dma_page_range(num);
-    }
-    phys_mark_page_range_as_used(page, num);
-    return page;
-}
-
-/**
- * Reserviert num DMA-Pages, die keine 64k-Grenzen enthalten
- *
- * @return Zeiger auf den Anfang der ersten Page.
- */
-
-paddr_t phys_alloc_dma_page_range_64k(unsigned int num)
-{
-    uint32_t pos = 0;
-    paddr_t page;
-
-    while(1)
-    {
-        page = find_free_page_range(pos, num);
-
-        if(page & (PAGE_SIZE - 1))
-        {
-            panic("Keine freier Speicher mehr da.");
-        }
-
-        pos = (uint32_t) page;
-        if ((pos % 65536) + (num * PAGE_SIZE) > 65536) {
-            //printf("Kernel: dma_64k: %x + %x ueberschreitet 64k-Grenze\n",
-            //    pos, num);
-            pos = (pos + 32 * PAGE_SIZE);
-        } else {
-            break;
-        }
-    } 
-
-    phys_mark_page_range_as_used(page, num);
-    return page;
-}
-
-/**
- * Initialisiert den physischen Speicher.
- *
- * @param mmap_addr Adresse der Memorymap.
- * @param mmap_length L�nge der Memorymap.
- * @param upper_mem Gr��e des upper_mem in Kilobyte, wie in der Multboot-Info
- *      �bergeben.
- */
-
-void init_phys_mem(vaddr_t mmap_addr, uint32_t mmap_length, uint32_t upper_mem)
-{
-    /* freien physischen speicher ermitteln */
-    struct multiboot_mmap * mmap;
-    struct {
-        uint32_t start;
-        uint32_t end;
-    } available_memory[16 + (3 * multiboot_info.mi_mods_count)];
-    int memblocks_count = 0;
-    int i, j;
-    uint32_t upper_end = 0;
-    phys_mmap_usable_pages = 0;
-    /* Die von GRUB gelieferte memory map in unser Format umwandeln. */
-    if (mmap_length) {
-        for(mmap = (struct multiboot_mmap*)mmap_addr;
-            mmap < (struct multiboot_mmap*)(mmap_addr + mmap_length);
-            mmap = (struct multiboot_mmap*)((char*)mmap + mmap->mm_size + 4))
-        {
-            if(mmap->mm_type == 1)
-            {
-                available_memory[memblocks_count].start = PAGE_ALIGN_ROUND_UP(mmap->mm_base_addr);
-                available_memory[memblocks_count].end = PAGE_ALIGN_ROUND_DOWN(mmap->mm_base_addr + mmap->mm_length);
-
-                phys_mmap_usable_pages += (available_memory[memblocks_count].end - available_memory[memblocks_count].start) / PAGE_SIZE;
-
-                memblocks_count++;
-            }
-        }
-    }
-    else
-    {
-        // Wenn GRUB keine Memory Map �bergibt, Defaultwerte annehmen
-        // Dabei vertrauen wir darauf, da� zumindest upper_mem korrekt
-        // gesetzt ist.
-        available_memory[0].start = 0x0;
-        available_memory[0].end = 0x9fc00;
-        
-        available_memory[1].start = 0x100000;
-        available_memory[1].end = 0x100000 + (1024 * upper_mem);
-        
-        phys_mmap_usable_pages += (available_memory[0].end - available_memory[0].start) / PAGE_SIZE;
-        phys_mmap_usable_pages += (available_memory[1].end - available_memory[1].start) / PAGE_SIZE;
-        
-        memblocks_count = 2;
-    }
-
-    /* In der Liste der physischen Speicherbl�cke (im folgenden einfach
-       Bl�cke bzw. Block) einen Bereich, der von start und end angegeben wird,
-       als nicht verf�gbar definieren.
-
-       Diese Funktion wird durch die Annahmen vereinfacht, dass GRUB den
-       Anfang und das Ende eines Moduls immer in genau einen Speicherblock l�dt.
-       Au�erdem dadurch, dass die Liste der verf�gbaren Speicherbl�cke nicht
-       sortiert sein muss.
-     */
-    void carve(uint32_t start, uint32_t end)
-    {
-        uint32_t i;
-
-        start = PAGE_ALIGN_ROUND_DOWN(start);
-        end = PAGE_ALIGN_ROUND_UP(end);
-
-        //printf("carve: %x bis %x\n", start, end);
-        
-        for(i = 0; i < memblocks_count; i++)
-        {
-            if(start == available_memory[i].start)
-            {
-                /* Der Bereich beginnt genau an einem Blockanfang */
-
-                if(end < available_memory[i].end)
-                {
-                    /* Der Bereich endet mittem im Block */
-
-                    /* Den Beginn des Blocks hinter den Bereich verschieben */
-                    available_memory[i].start = end;
-                    break;
-                }
-                else if(end == available_memory[i].end)
-                {
-                    /* Der Bereich nimmt den ganzen Block ein */
-
-                    /* Den Block aus der Liste entfernen */
-                    memblocks_count--;
-                    for(j = i; j < memblocks_count; j++)
-                    {
-                        available_memory[j].start = available_memory[j + 1].start;
-                        available_memory[j].end = available_memory[j + 1].end;
-                    }
-                    break;
-                }
-            }
-            else if(start > available_memory[i].start)
-            {
-                /* Der Bereich beginnt irgendwo im Block */
-
-                if(end < available_memory[i].end)
-                {
-                    /* Der Bereich endet irgendwo mitten im Block. Das bedeutet
-                       ein Block muss in der Mitte zerteilt werden. Dazu muss
-                       ein weiterer Eintrag in der Liste angelegt werden. */
-
-                    /* Einen neuen Eintrag am Ende anlegen */
-                    available_memory[memblocks_count].start = end;
-                    available_memory[memblocks_count].end = available_memory[i].end;
-
-                    /* Den Eintrag verkleinern */
-                    // available_memory[i].start bleibt unver�ndert
-                    available_memory[i].end = start;
-
-                    memblocks_count++;
-                    break;
-                }
-                else if(end == available_memory[i].end)
-                {
-                    /* Der Bereich endet genau mit dem Block */
-
-                    /* Das Ende des Bereichs auf den Anfang des Blocks setzen. */
-                    available_memory[i].end = start;
-                    break;
-                }
-
-                /* Wenn sowohl start als auch end hinter dem Speicherblock
-                   liegen, wird nichts gemacht. */
-            }
-
-            /* Wenn der start vor dem Speicherblock liegt, wird nichts gemacht,
-               denn wir gehen davon aus, dass GRUB kein Modul in einen Bereich
-               l�dt, der kein verf�gbarer Speicher ist. */
-        }
-    }
-
-    carve((uint32_t)kernel_phys_start, (uint32_t)kernel_phys_end);
-
-    /* foreach(modul in module) { carve(modul.start, module.end); } // pseudocode btw ;) */    
-    {
-        uint32_t i;
-        struct multiboot_module * multiboot_module;
-        multiboot_module = multiboot_info.mi_mods_addr;
-
-        for (i = 0; i < multiboot_info.mi_mods_count; i++) {
-            carve((uint32_t) multiboot_module, ((uint32_t) multiboot_module) + sizeof(multiboot_module));
-            carve((uint32_t) multiboot_module->start, (uint32_t) multiboot_module->end);
-            if (multiboot_module->cmdline) {
-                carve((uint32_t) multiboot_module->cmdline, (uint32_t) multiboot_module->cmdline + strlen(multiboot_module->cmdline));
-            }
-
-            multiboot_module++;
-        }
-    }
-
-    /* Die obere Grenze des physischen Speichers ermitteln. */
-    for(i = 0; i < memblocks_count; i++)
-    {
-        if(available_memory[i].end > upper_end)
-        {
-            upper_end = available_memory[i].end;
-        }
-    }
-    
-    /* einen ort f�r die tabelle mit den physischen seiten suchen */
-    phys_mmap_size = upper_end / PAGE_SIZE / 32;
-    for(i = 0; i < memblocks_count; i++)
-    {
-        if((available_memory[i].start) && (available_memory[i].start + phys_mmap_size * 4 < available_memory[i].end))
-        {
-            phys_mmap = (unsigned long*)available_memory[i].start;
-            available_memory[i].start = PAGE_ALIGN_ROUND_UP(available_memory[i].start + phys_mmap_size * 4);
-            break;
-        }
-        else if (available_memory[i].start + PAGE_SIZE + phys_mmap_size * 4 < available_memory[i].end)
-        {
-            phys_mmap = (unsigned long*)(available_memory[i].start + PAGE_SIZE);
-                    
-            available_memory[memblocks_count].start = available_memory[i].start;
-            available_memory[memblocks_count].end = available_memory[i].start + PAGE_SIZE;
-            memblocks_count++;
-            
-            available_memory[i].start = PAGE_ALIGN_ROUND_UP(available_memory[i].start + PAGE_SIZE + phys_mmap_size * 4);
-            break;
-        }
-    }
-    
-    /* alle seiten als belegt markieren */
-    phys_mark_page_range_as_used(0, upper_end / PAGE_SIZE);
-
-    /* freie seiten als frei markieren */
-    for(i = 0; i < memblocks_count; i++)
-    {
-        //kprintf("Mark as free: %x, %d Pages\n", available_memory[i].start, (available_memory[i].end - available_memory[i].start) / PAGE_SIZE);
-        phys_mark_page_range_as_free(available_memory[i].start, (available_memory[i].end - available_memory[i].start) / PAGE_SIZE);
-    }
-}
diff --git a/src/kernel/src/mm/shm.c b/src/kernel/src/mm/shm.c
deleted file mode 100644
index 0fdb6fea..00000000
--- a/src/kernel/src/mm/shm.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/*  
- * Copyright (c) 2007 The tyndur Project. All rights reserved.
- *
- * This code is derived from software contributed to the tyndur Project
- * by Mathias Gottschlag.
- *
- * 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 tyndur Project
- *     and its contributors.
- * 4. Neither the name of the tyndur 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 HOLDERS 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.
- */  
-
-#include <stdint.h>
-
-#include "shm.h"
-#include "phys.h"
-#include "stdlib.h"
-#include "kernel.h"
-#include "paging.h"
-
-list_t *shm_table = 0;
-
-uint32_t lastid = 0;
-
-void init_shared_memory(void)
-{
-	shm_table = list_create();
-}
-
-uint32_t create_shared_memory(uint32_t size)
-{
-    shm_table_entry_t *entry = malloc(sizeof(shm_table_entry_t));
-    
-    entry->pagecount = size / PAGE_SIZE;
-    if (size%PAGE_SIZE) {
-        entry->pagecount++;
-    }
-    entry->addresses = malloc(entry->pagecount * sizeof(paddr_t));
-    int i;
-    for (i = 0; i < entry->pagecount; i++) {
-        entry->addresses[i] = phys_alloc_page();
-    }
-    entry->usecount = 0;
-    entry->id = ++lastid;
-    list_push(shm_table, entry);
-    return entry->id;
-}
-vaddr_t attach_task_to_shm(struct task *task, uint32_t id)
-{
-    int i, j;
-    //Nach id suchen
-    for (i = 0; i < list_size(shm_table); i++) {
-        if (((shm_table_entry_t *)list_get_element_at(shm_table, i))->id == id) {
-            shm_table_entry_t *shmem = (shm_table_entry_t *)list_get_element_at(shm_table, i);
-            //Pages suchen
-            vaddr_t vaddr = find_contiguous_pages(task->cr3, shmem->pagecount,
-                USER_MEM_START, USER_MEM_END);
-            //Pages mappen
-            for (j = 0; j < shmem->pagecount; j++) {
-                map_page(task->cr3, vaddr + j * PAGE_SIZE, shmem->addresses[j],
-                    PTE_P | PTE_U | PTE_W);
-                
-            }
-            shmem->usecount++;
-            list_push(task->shmids, (void*)id);
-            list_push(task->shmaddresses, vaddr);
-            return vaddr;
-        }
-    }
-    return 0;
-}
-void detach_task_from_shm(struct task *task, uint32_t id)
-{
-    //kprintf("Loese Task von shm %d.\n", id);
-    int i, j, k;
-    //Einträge suchen
-    for (i = 0; i < list_size(task->shmids); i++) {
-        if ((uint32_t)list_get_element_at(task->shmids, i) == id) {
-            vaddr_t vaddr = list_get_element_at(task->shmaddresses, i);
-            for (j = 0; j < list_size(shm_table); j++) {
-                if (((shm_table_entry_t *)list_get_element_at(shm_table, j))->id == id) {
-                    shm_table_entry_t *shmem = (shm_table_entry_t *)list_get_element_at(shm_table, j);
-                    //Pages des Tasks freimachen
-                    for (k = 0; k < shmem->pagecount; k++) {
-                        unmap_page(task->cr3, vaddr + k * PAGE_SIZE);
-                    }
-                    list_remove(task->shmids, i);
-                    list_remove(task->shmaddresses, i);
-                    shmem->usecount--;
-                    if (!shmem->usecount) {
-                        //kprintf("Shared Memory wird nicht mehr benoetigt.\n");
-                        //Shared Memory wird nicht mehr benötigt
-                        for (k = 0; k < shmem->pagecount; k++) {
-                            phys_mark_page_as_free(shmem->addresses[k]);
-                        }
-                        free(shmem->addresses);
-                        free(shmem);
-                        list_remove(shm_table, j);
-                    }
-                    return;
-                }
-            }
-            return;
-        }
-    }
-}
diff --git a/src/kernel/src/modules.c b/src/kernel/src/modules.c
deleted file mode 100644
index d05b10ba..00000000
--- a/src/kernel/src/modules.c
+++ /dev/null
@@ -1,371 +0,0 @@
-/*  
- * Copyright (c) 2006 The tyndur Project. All rights reserved.
- *
- * This code is derived from software contributed to the tyndur Project
- * by Kevin Wolf.
- *
- * 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 tyndur Project
- *     and its contributors.
- * 4. Neither the name of the tyndur 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 HOLDERS 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.
- */  
-
-#include <stdint.h>
-
-#include "modules.h"
-#include "multiboot.h"
-#include "kprintf.h"
-#include "elf32.h"
-#include "vmm.h"
-#include "kernel.h"
-#include "string.h"
-#include "paging.h"
-#include "types.h"
-#include "intr.h"
-#include "tasks.h"
-#include "kmm.h"
-#include "paging.h"
-
-#define ELF_MAGIC 0x464C457F
-#define MODULE_ENTRY ((vaddr_t) 0x40000000)
-
-#undef DEBUG
-
-//Wird in schedule.c definiert und hier verwendet, um auf die Task-Struct
-// des Init-Moduls zuzugreifen
-extern struct task* first_task;
-
-//Laed ein ELF-Dateiimage (wird nur noch fuer init verwendet)
-void load_single_module(Elf32_Ehdr* elf_header, const char* cmdline);
-
-
-
-
-/**
- * Laed nur das erste Modul, das in der Multiboot-Modulliste eingetragen
- * ist, das Init-Modul. Es wird im Moment nur ELF 
- * unterstuetzt.
- *
- * @param elf_header Pointer auf den ELF-Header
- */
-void load_init_module(struct multiboot_info * multiboot_info)
-{
-    struct multiboot_module * multiboot_module;
-    
-    //Ueberpruefen, ob ueberhaupt module in der Liste sind
-    if (multiboot_info->mi_mods_count == 0)
-    {
-        panic("Keine Multiboot-Module zu laden.");
-    }
-    
-    
-    //Multiboot-Modulliste in den Kerneladressraum mappen
-    multiboot_module = map_phys_addr((paddr_t)multiboot_info->mi_mods_addr, sizeof(multiboot_module));
-    if (multiboot_module == NULL)    
-    {
-        panic("Konnte Multiboot-Modulliste nicht in den Kernelspeicher mappen.");
-    }
-    
-    //Befehlszeile des Moduls mappen
-    char* cmdline = map_phys_addr((paddr_t) multiboot_module->cmdline, 4096);
-
-    //Das Modul dem ELF-Loader uebergeben
-    void* elf_image = map_phys_addr((paddr_t) multiboot_module->start,
-        multiboot_module->end - multiboot_module->start);
-    load_single_module(elf_image, cmdline);
-    free_phys_addr(elf_image, multiboot_module->end - multiboot_module->start);
-    
-    //Modulbefehlszeile wieder freigeben
-    free_phys_addr(cmdline, 4096);
-
-    //Multiboot-Modulliste wieder aus dem Kerneladressraum freigeben
-    free_phys_addr((vaddr_t)multiboot_module, sizeof(multiboot_module));
-    
-    //In der Multiboot Struct den Pointer und die anzahl der Module anpassen,
-    // da Init nun geladen ist.
-    multiboot_info->mi_mods_addr++;
-    multiboot_info->mi_mods_count--;
-}
-
-
-/**
- * Hier werden die anderen Module Module an Init weiter geleitet
-  *
- * @param elf_header Pointer auf den ELF-Header
- */
-void load_multiboot_modules(struct multiboot_info * multiboot_info)
-{
-    int i;
-    struct multiboot_module * multiboot_module_phys;
-    struct multiboot_module * multiboot_module;
-    
-    //Ueberpruefen, ausser dem 
-    if (multiboot_info->mi_mods_count == 0)
-    {
-        //Ist hier ein Panic wirklich das richtige?
-        panic("Keine Multiboot-Module zu laden.");
-    }
-    else
-    {
-        multiboot_module_phys = multiboot_info->mi_mods_addr;
-        
-        // Speicher f�r die Modulparameter
-        paddr_t mod_cmdline_page_phys = phys_alloc_page();
-        void* mod_cmdline_task = find_contiguous_pages((page_directory_t)first_task->cr3, 1, USER_MEM_START, USER_MEM_END);
-        map_page((page_directory_t)first_task->cr3, mod_cmdline_task, mod_cmdline_page_phys, PTE_P | PTE_U | PTE_W);
-        
-        char* mod_cmdline_page = map_phys_addr(mod_cmdline_page_phys, PAGE_SIZE);
-        char* mod_cmdline = mod_cmdline_page;
-        size_t mod_cmdline_free = PAGE_SIZE;
-
-        //Speicher f�r die Modulliste allokieren und 
-        void* mod_list_task = find_contiguous_pages((page_directory_t)first_task->cr3, 1, USER_MEM_START, USER_MEM_END);
-        paddr_t mod_list_phys = phys_alloc_page();
-        map_page((page_directory_t)first_task->cr3, mod_list_task, mod_list_phys, PTE_P | PTE_U | PTE_W);
-        
-        
-        //Stack von Init mappen um ein Pointer auf die Modulliste zu uebergeben
-        uint32_t* stack = (uint32_t*) ((uint32_t)map_phys_addr(resolve_vaddr((page_directory_t)first_task->cr3, first_task->user_stack_bottom), 0x1000) - 0);
-        stack[255] = (uint32_t)mod_list_task;
-        free_phys_addr((vaddr_t)stack, 0x1000);
-        
-        //Modulliste temporaer mappen
-        uint32_t* modulelist = (uint32_t*) map_phys_addr(mod_list_phys, 0x1000);
-        
-        //Das unterste dword auf der Page mit der Liste beinhaltet die Anzahl der Module
-        modulelist[0] = multiboot_info->mi_mods_count;
-        
-        //Module in den Adressraum von Init mapen
-        for (i = 0; i < multiboot_info->mi_mods_count; i++)
-        {
-            //Die multiboot_module Struct des aktuellen Moduls mappen
-            multiboot_module = map_phys_addr((paddr_t)multiboot_module_phys, sizeof(multiboot_module));
-            
-            //Anzahl der benoetigten Pages berechnen
-            size_t pages = (PAGE_ALIGN_ROUND_UP((uint32_t)multiboot_module->end) -PAGE_ALIGN_ROUND_DOWN((uint32_t)multiboot_module->start)) / 0x1000;
-            
-            //Freie virtuelle Adresse suchen um das Modul dort hin zu mappen.
-            void* dest = find_contiguous_pages((page_directory_t)first_task->cr3, pages, USER_MEM_START, USER_MEM_END);
-            map_page_range((page_directory_t)first_task->cr3, dest, (paddr_t) multiboot_module->start, PTE_P | PTE_U | PTE_W, pages);
-            first_task->memory_used += pages * 0x1000;
-
-            //TODO: Den Speicher aus dem Kerneladressraum unmappen
-           
-            //Die Adresse in die Modulliste von Init schreiben
-            modulelist[1 + (3*i)] = (uint32_t) dest;
-            modulelist[2 + (3*i)] = multiboot_module->end - multiboot_module->start;
-            modulelist[3 + (3*i)] = (uint32_t) mod_cmdline_task + (mod_cmdline - mod_cmdline_page);
-
-            // Modellbefehlszeile kopieren
-            char* cmdline = map_phys_addr((paddr_t) multiboot_module->cmdline, 4096);
-            size_t length = strlen(cmdline);
-            if (mod_cmdline_free > length) {
-                strncpy(mod_cmdline, cmdline, length);
-                mod_cmdline[length] = '\0';
-                mod_cmdline += (length + 1);
-                mod_cmdline_free -= (length + 1);
-            }
-            free_phys_addr(cmdline, 4096);
-            
-            //multiboot_module Struct wieder freigeben
-            free_phys_addr((vaddr_t)multiboot_module, sizeof(multiboot_module));
-            
-            //Physikalische Adresse der  multiboot_module Struct auf die naechste setzen
-            multiboot_module_phys++;
-        }
-        
-        //Die temporaer gemapte Modulliste wieder freigeben(nur hier im Kernel freigeben)
-        free_phys_addr((vaddr_t)modulelist, 0x1000);
-        free_phys_addr(mod_cmdline_page, 0x1000);
-    }
-    
-    //TODO: Muessen noch irgendwelche Multiboot-Structs physikalisch freigegeben werden?
-}  
-
-
-/**
- * Ein einzelnes ELF-Image laden und den Prozess erstellen.
- *
- * @param elf_header Pointer auf den ELF-Header. Es wird erwartet, dass das
- * gesamte ELF-Image gemappt ist.
- */
-void load_single_module(Elf32_Ehdr * elf_header, const char* cmdline) 
-{
-    Elf32_Phdr * program_header;
-    uint32_t i, j;
-    uint32_t pages;
-
-    struct task * task = NULL;
-    vaddr_t address, base, dst;
-    paddr_t phys_dst;
-
-    //kprintf("[ehdr: %x]", elf_header);
-
-    if (elf_header->e_magic == ELF_MAGIC) {
-        
-        program_header = (Elf32_Phdr *) ((uint32_t) elf_header + elf_header->e_phoff);
-
-#ifdef DEBUG
-        kprintf("    EntryCount: %d", elf_header->e_phnum);
-        kprintf("    Offset: 0x%x\n", elf_header->e_phoff);
-#endif
-
-        for (i = 0; i < elf_header->e_phnum; i++, program_header++) {
-
-#ifdef DEBUG
-            kprintf(" ph @ %x, type=%d\n", program_header, program_header->p_type);
-#endif
-            if (program_header->p_type == 1) {
-                
-              	if ((elf_header->e_entry >= program_header->p_vaddr) && (elf_header->e_entry <= program_header->p_vaddr + program_header->p_memsz)) {
-#ifdef DEBUG
-                    kprintf("Neuen Task erstellen\n");
-#endif
-                    task = create_task((vaddr_t) elf_header->e_entry, cmdline, 0);
-                } else if (task == NULL) {
-					// FIXME
-					kprintf("Kein Task: phdr->vaddr = %x, ehdr->entry = %x\nDas Modul ist entweder beschaedigt oder wird von diesem Kernel nicht unterstuetzt (Entry Point muss im ersten Program Header liegen)\n", program_header->p_vaddr, elf_header->e_entry);
-                    continue;
-                }
-                
-                // Pages erstellen
-                pages = 1 + ((program_header->p_offset + program_header->p_memsz) / 0x1000) - (program_header->p_offset / 0x1000);
-                
-#ifdef DEBUG
-                kprintf("Mapping von %d Pages\n", pages);
-#endif
-                base = (vaddr_t) PAGE_ALIGN_ROUND_DOWN(program_header->p_vaddr);
-                if (base < MODULE_ENTRY) {
-                    base = MODULE_ENTRY;
-                }
-
-                for (j = 0; j < pages; j++) {
-                    paddr_t curPage = phys_alloc_page();
-#ifdef DEBUG
-                    kprintf("  %x => %x", (vaddr_t) (base + 0x1000 * j), curPage);
-#endif
-                    map_page((page_directory_t) task->cr3, (vaddr_t) (base + 0x1000 * j), curPage, PTE_P | PTE_U | PTE_W);
-                }
-
-                // Programm kopieren
-#ifdef DEBUG
-                kprintf("Programm kopieren\n");
-#endif
-                pages = 1 + ((program_header->p_offset + program_header->p_filesz) / 0x1000) - (program_header->p_offset / 0x1000);
-#ifdef DEBUG
-                kprintf("%d Pages zu kopieren\n", pages);
-#endif
-                
-                
-                uint32_t bytes_on_first_page;
-                if (program_header->p_filesz > 0x1000 - (program_header->p_vaddr % 0x1000)) {
-                    bytes_on_first_page = 0x1000 - (program_header->p_vaddr % 0x1000);
-                } else {
-                    bytes_on_first_page = program_header->p_filesz;
-                }
-
-                uint32_t zero_bytes_on_last_page = 0x1000 - (
-                    (program_header->p_offset + program_header->p_filesz) 
-                    % 0x1000);
-
-#ifdef DEBUG
-                kprintf("bytes_on_first_page: 0x%x\n", bytes_on_first_page);
-                kprintf("zero_bytes_on_last_page: 0x%x\n", zero_bytes_on_last_page);
-#endif
-
-                // Erste Page kopieren (m�glicherweise fangen die Daten mitten in der
-                // Page an)
-                address = (vaddr_t) ((uint32_t) elf_header + program_header->p_offset);
-                phys_dst = resolve_vaddr((page_directory_t) task->cr3, (vaddr_t) program_header->p_vaddr);
-                dst = map_phys_addr(phys_dst, bytes_on_first_page);
-#ifdef DEBUG
-                kprintf("  Kopiere 0x%x Bytes nach %x von %x [1]\n", bytes_on_first_page, program_header->p_vaddr, address);
-#endif
-                memcpy(dst, address, bytes_on_first_page);
-                free_phys_addr(dst, bytes_on_first_page);
-
-
-                address += bytes_on_first_page;
-                for (j = 1; j < pages; j++) {
-                    //address = map_phys_addr(phys_address, 0x1000);
-
-                    phys_dst = resolve_vaddr((page_directory_t) task->cr3, (vaddr_t) (base + 0x1000 * j));
-                    dst = map_phys_addr(phys_dst, 0x1000);
-#ifdef DEBUG
-                    kprintf("  Kopiere 4K nach %x von %x\n", (base + 0x1000 * j), address);
-#endif
-                    memcpy(dst, address, 0x1000);
-
-                    free_phys_addr(dst, 0x1000);
-                    //free_phys_addr(address, 0x1000);
-
-                    address += 0x1000;                
-                }
-
-                if (zero_bytes_on_last_page) {
-                    // Es ist ein Teilst�ck einer Page �brig, das mit Nullen gef�llt wird
-#ifdef DEBUG
-                    kprintf("  Setze Nullen in 0x%x (0x%x Stueck)\n", 
-                            (vaddr_t) (base + 0x1000 * (j - 1)) + (0x1000 - zero_bytes_on_last_page), 
-                            zero_bytes_on_last_page);
-#endif
-
-                    phys_dst = resolve_vaddr(
-                        (page_directory_t) task->cr3, 
-                        (vaddr_t) (base + 0x1000 * (j - 1)) + (0x1000 - zero_bytes_on_last_page)
-                    ) /*(bytes_on_last_page)*/;
-
-                    dst = map_phys_addr(phys_dst, zero_bytes_on_last_page);
-                    memset(dst, 0, zero_bytes_on_last_page);
-                    free_phys_addr(dst, zero_bytes_on_last_page);
-                }
-                
-                // Wenn memsz > filesz. mu� mit Nullen aufgef�llt werden
-                pages = program_header->p_memsz / 0x1000;
-                if (program_header->p_memsz % 0x1000) {
-                    pages++;
-                }
-                for (; j < pages; j++) {
-                    phys_dst = resolve_vaddr((page_directory_t) task->cr3, (vaddr_t) (base + 0x1000 * j));
-                    dst = map_phys_addr(phys_dst, 0x1000);
-
-#ifdef DEBUG
-                    kprintf("  Setze Nullen in %x\n", (base + 0x1000 * j));
-#endif
-                    memset(dst, 0, 0x1000);
-
-                    free_phys_addr((vaddr_t)phys_dst, 0x1000);
-                }
-                
-#ifdef DEBUG
-                kprintf("    Modul geladen.\n");
-#endif
-            }
-        }
-    } else {
-        kprintf("ELF-Magic ungueltig (0x%x)\n",elf_header->e_magic);
-    }
-}
diff --git a/src/kernel/src/rpc.c b/src/kernel/src/rpc.c
deleted file mode 100644
index 45887e13..00000000
--- a/src/kernel/src/rpc.c
+++ /dev/null
@@ -1,343 +0,0 @@
-/*  
- * Copyright (c) 2007 The tyndur Project. All rights reserved.
- *
- * This code is derived from software contributed to the tyndur Project
- * by Kevin Wolf.
- *
- * 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 tyndur Project
- *     and its contributors.
- * 4. Neither the name of the tyndur 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 HOLDERS 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.
- */  
-
-#include <stdint.h>
-
-#include "rpc.h"
-#include "tasks.h"
-#include "paging.h"
-#include "vmm.h"
-#include "kmm.h"
-#include "intr.h"
-#include "string.h"
-#include "stdlib.h"
-#include "debug.h"
-
-typedef struct {
-    uint32_t   old_eip;
-    uint32_t   old_esp;
-    uint32_t   eflags;
-    uint32_t   eax;
-
-    uint32_t   reenable_irq;
-
-    struct task* caller;
-} rpc_t;
-
-/**
- * F�hrt einen RPC durch.
- *
- * Der Aufruf einer RPC-Funktion besteht im allgemeinen aus Metadaten (z.B.
- * die Funktionsnummer der aufzurufenden Funktion, Nachrichten-ID usw.)
- * und Nutzdaten.
- *
- * Die Daten werden dem aufgerufenen Task so auf den Stack gelegt, da� von
- * esp bis esp + metadata_size die Metadaten liegen, von esp + metadata_size
- * bis esp + metadata_size + data_size die Nutzdaten. Daraus ergibt sich
- * insbesondere, da� sich die Grenze zwischen Metadaten und Daten beliebig 
- * ziehen l��t, wie sie f�r den Aufrufer am g�nstigsten ist. Unter anderem ist
- * es m�glich, alle Daten an einem Ort zu �bergeben und metadata_size = 0 zu
- * setzen.
- *
- * Im Allgemeinen liegen allerdings die Metadaten auf dem Stack des Aufrufers,
- * w�hrend die Nutzdaten oft ein Pointer in den Heap des Aufrufers sind.
- *
- * Zur Durchf�hrung eines RPC werden zun�chst einige Register des aufgerufenen
- * Tasks gesichtert (eax, eip, esp, eflags; die �brigen Register hat der
- * aufgerufene Task selbst zu sichern). Anschlie�end werden die Daten auf den
- * Stack des aufgerufenen Tasks gelegt, eip auf den RPc-Handler gesetzt und der
- * Scheduler angewiesen, zum aufgerufenen Task umzuschalten.
- *
- * Der RPC-Handler mu� als letzte Aktion den Syscall FASTRPC_RET aufrufen, der
- * die Register wiederherstellt und dadurch den R�cksprung vornimmt.
- *
- * @param callee        Aufzurufender Task
- * @param metadata_size L�nge der Metadaten in Bytes
- * @param metadata      Pointer auf die Metadaten
- * @param data_size     L�nger der Daten in Bytes
- * @param data          Pointer auf die Daten
- *
- * @return true, wenn der Aufruf erfolgreich durchgef�hrt wurde, false
- * sonst. Bei false als R�ckgabe sollte der aufrufende Task den RPC-Syscall
- * wiederholen.
- */
-bool fastrpc(struct task * callee, uint32_t metadata_size, void* metadata,
-    uint32_t data_size, void* data)
-{
-    int i;
-
-    //kprintf("[%d => %d, 0x%x + 0x%x]\n", current_task->pid, callee->pid, 
-    //    metadata_size, data_size);
-    //kprintf("<%08x = %08x %08x>\n", metadata, 0, 0);
-    
-    if (!callee) {
-        abort_task("RPC zu nicht vorhandenem Prozess");
-        return false;
-    }
-
-    if (metadata_size + data_size > 9 * PAGE_SIZE) {
-        abort_task("RPC-Datenblock zu gross: %d Bytes", data_size);
-        return false;
-    }
-    
-    if (callee->rpc_handler == NULL) {
-        return false;
-    }
-
-    // Gesamtgr��e, um die der Stack des aufgerufenen Prozesses vergr��ert
-    // wird (zus�tzlich 4 Bytes f�r die R�cksprungadresse)
-    uint32_t total_data_size = metadata_size + data_size
-        + sizeof(data_size) + sizeof(pid_t);
-    
-    // Datengr��e auf ganze vier Bytes aufrunden
-    uint32_t rounded_data_size = (total_data_size + 3) & ~0x3;
-
-    // Wenn es sich um eine Antwort im Rahmen von asynchronem RPC handelt,
-    // durchlassen, auch wenn der Proze� nicht blockiert werden kann
-    bool ignore_blocked = false;
-    if ((callee->status == TS_WAIT_FOR_RPC) && (
-                ((metadata_size >= 4) 
-            &&  (((uint32_t*)metadata)[0] == 513))
-
-        ||      ((metadata_size == 0) 
-            &&  (data_size >= 4) 
-            &&  (((uint32_t*)data)[0] == 513))
-        ))
-    {
-        ignore_blocked = true;
-    }
-
-    // W�hrend wir am Stack rumbasteln, sollte niemand dazwischenfunken und
-    // erst recht nicht der Task weiterlaufen (momentan unn�tig, da im Kernel
-    // keine Interrupts erlaubt sind). Au�erdem wird damit sichergestellt, da�
-    // ein Task, der p() aufgerufen hat, keinen RPC bekommt.
-    //
-    // Wenn der Task nicht blockiert werden kann, soll der Aufrufer es sp�ter
-    // nochmal versuchen.
-    if (!ignore_blocked && 
-        ((callee->blocked_by_pid) || !block_task(callee, current_task->pid)))
-    {
-        //kprintf("Task %d ist blockiert.\n", callee->pid);
-        return false;
-    }
-    
-    // Falls der Stack nicht ausreicht, vergr��ern
-    paddr_t callee_isf_phys = 
-        resolve_vaddr((page_directory_t) callee->cr3, (vaddr_t) callee->esp);
-
-    struct int_stack_frame* callee_isf = (struct int_stack_frame*) 
-        map_phys_addr(callee_isf_phys, sizeof(callee_isf));
-    
-    uint32_t pages_count = ((rounded_data_size + PAGE_SIZE - 1) / PAGE_SIZE);
-    if ((rounded_data_size % PAGE_SIZE) > (callee_isf->esp % PAGE_SIZE)) {
-        pages_count++;
-    }
-
-	if(resolve_vaddr((page_directory_t) callee->cr3,
-        (vaddr_t) callee_isf->esp - rounded_data_size) == (paddr_t) NULL)
-	{
-        // TODO Das k�nnte bis zu (pages_count - 1) Pages zu viel reservieren
-		increase_user_stack_size(callee, pages_count);
-	}
-    
-    // Den Stack des aufgerufenen Tasks in den Kernelspeicher mappen
-    uint32_t callee_esp_phys = (uint32_t) resolve_vaddr(
-        (page_directory_t) callee->cr3, (vaddr_t) callee_isf->esp);
-   
-    // TODO Funktion, um komplette Bereiche eines anderen Tasks zu mappen
-    vaddr_t callee_esp_kernel_pages = 
-        find_contiguous_kernel_pages(pages_count);
-
-    for (i = 0; i < pages_count; i++) {
-        map_page(
-            kernel_page_directory, 
-            (vaddr_t) ((uint32_t) callee_esp_kernel_pages + (PAGE_SIZE * i)),
-            (paddr_t) PAGE_ALIGN_ROUND_DOWN((uint32_t) resolve_vaddr(
-                (page_directory_t) callee->cr3, 
-                (vaddr_t) callee_isf->esp - (PAGE_SIZE * (pages_count - i - 1))
-            )),
-            PTE_P | PTE_W
-        );
-    }
-
-    // RPC-Backlinkinformation anlegen
-    rpc_t* rpc = malloc(sizeof(rpc_t));
-    
-    rpc->old_eip = callee_isf->eip;
-    rpc->old_esp = callee_isf->esp;
-    rpc->eax     = callee_isf->eax;
-    rpc->eflags  = callee_isf->eflags;
-    rpc->caller  = current_task;
-
-    rpc->reenable_irq = 0;
-
-    list_push(callee->rpcs, rpc);
-    
-    // Adresse des neuen Stackendes im Kernelspeicher berechnen. Diese Adresse
-    // liegt irgendwo in der Mitte der ersten gemappten Stackpage. Das Offset
-    // von der Pagegrenze ist also in der Rechnung zu ber�cksichtigen.
-    //
-    // Auf den Stack kommen neue Daten der Gr��e rounded_data_size.
-    vaddr_t callee_esp = callee_esp_kernel_pages
-        + (callee_esp_phys % PAGE_SIZE) + ((pages_count - 1) * PAGE_SIZE);
-
-    callee_esp -= rounded_data_size;
-
-    // Kopieren der Datengr��e, der Aufrufer-PID und der Daten auf den Stack
-    *((uint32_t *) callee_esp) = data_size + metadata_size;
-    *((uint32_t *) (callee_esp + 4)) = current_task->pid;
-    memcpy(callee_esp + 8, metadata, metadata_size);
-    memcpy(callee_esp + 8 + metadata_size, data, data_size);
-    
-    // Den Stackpointer des aufgerufenen Tasks anpassen, so da� er auf den 
-    // Anfang der kopierten Daten zeigt, und in den RPC-Handler springen
-    callee_isf->esp -= rounded_data_size;
-    callee_isf->eip = (uint32_t) callee->rpc_handler;
-
-    // Gemappte Seiten wieder freigeben
-    for (i = 0; i < pages_count; i++) {
-        unmap_page(kernel_page_directory, 
-            (vaddr_t) ((uint32_t) callee_esp_kernel_pages + (PAGE_SIZE * i)));
-    }
-
-    unmap_page(kernel_page_directory, 
-        (vaddr_t) PAGE_ALIGN_ROUND_DOWN((uint32_t) callee_isf));
-   
-    // Der Task darf wieder laufen
-    if (callee->status == TS_WAIT_FOR_RPC) {
-        callee->status = TS_RUNNING;
-    }
-
-    if (!ignore_blocked) {
-        //kprintf("PID %d darf wieder laufen.\n", callee->pid);
-        unblock_task(callee, current_task->pid);
-    }
-
-    return true;
-}
-
-/**
- * F�hrt einen RPC zur Behandlung eines IRQ durch. Der IRQ wird dabei
- * deaktiviert, solange der Handler arbeitet und erst anschlie�end 
- * wieder freigegeben. Im sonstigen Verhalten gleicht diese Funktion
- * fastrpc.
- *
- * @see fastrpc
- */
-bool fastrpc_irq(struct task * callee, uint32_t metadata_size, void* metadata,
-    uint32_t data_size, void* data, uint8_t irq)
-{
-    if (callee->blocked_by_pid && (callee->status != TS_WAIT_FOR_RPC)) {
-        return false;
-    }
-
-    if (fastrpc(callee, metadata_size, metadata, data_size, data)) {
-        rpc_t* rpc = list_get_element_at(current_task->rpcs, 0);
-        rpc->reenable_irq = irq;
-        return true;
-    } else {
-        return false;
-    }
-}
-
-/**
- * Wird nach der Ausf�hrung eines RPC-Handlers aufgerufen.
- *
- * Nach der R�ckkehr vom RPC-Handler wird der neueste Zustand vom RPC-Stack
- * gepopt und zur Wiederherstellung des urspr�nglichen Prozessorzustands
- * benutzt.
- *
- * Dies betrifft eip, esp, eax und eflags. Die �brigen Register sind vom
- * RPC-Handler zu sicher und vor dem Aufruf von SYSCALL_FASTRPC_RET
- * wiederherzustellen. eax ist davon ausgenommen, da es die Funktionsnummer
- * des Syscalls enthalten mu�.
- *
- * @param esp Interrupt-Stackframe des vom RPC-Handler zur�ckkehrenden Tasks
- */
-void return_from_rpc(struct int_stack_frame ** esp)
-{
-    rpc_t* rpc = list_pop(current_task->rpcs);
-    struct int_stack_frame* callee_isf = *esp;
-
-    // Wenn der Task vom RPC-Handler zur�ckkehrt, obwohl der Handler
-    // gar nicht aufgerufen wurde, l�uft was schief
-    if (rpc == NULL) {
-        if(debug_test_flag(DEBUG_FLAG_STACK_BACKTRACE)) {
-            stack_backtrace_ebp(callee_isf->ebp, callee_isf->eip);
-        }
-        abort_task("Unerwartete Rueckkehr vom RPC-Handler");
-    }
-    
-    // Wiederherstellen der Register
-    callee_isf->eip = rpc->old_eip; 
-    callee_isf->esp = rpc->old_esp;
-    callee_isf->eax = rpc->eax; 
-    callee_isf->eflags = rpc->eflags;
-
-    // Wechsel zum aufrufenden Task
-    if (rpc->caller) {
-        schedule_to_task(rpc->caller, (uint32_t*) esp);
-    }
-
-    // Wenn es ein IRQ-verarbeitender RPC war, den Interrupt jetzt
-    // wieder aktivieren
-    if (rpc->reenable_irq) {
-        //printf("reenable IRQ %d\n", rpc->reenable_irq);
-        enable_irq(rpc->reenable_irq);
-    }
-
-    free(rpc);
-}
-
-/**
- * Entfernt den gegebenen Task aus allen RPC-Backlinks.
- *
- * Diese Funktion wird benoetigt, wenn ein Task einen RPC aufruft und beendet
- * wird, bevor der RPC fertig ist. Ansonsten zeigt rpc->caller ins Leere,
- * was in return_from_rpc() zur Katastrophe f�hrt.
- */
-void rpc_destroy_task_backlinks(struct task* destroyed_task)
-{
-    struct task* task;
-    for (task = first_task; task != NULL; task = task->next_task) {
-        int i;
-        rpc_t* rpc;
-        for (i = 0; (rpc = list_get_element_at(task->rpcs, i)); i++) {
-            if (rpc->caller == destroyed_task) {
-                rpc->caller = NULL;
-            }
-        }
-    }
-}
diff --git a/src/kernel/src/schedule.c b/src/kernel/src/schedule.c
deleted file mode 100644
index 725dd9a6..00000000
--- a/src/kernel/src/schedule.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Copyright (c) 2006-2007 The tyndur Project. All rights reserved.
- *
- * This code is derived from software contributed to the tyndur Project
- * by Burkhard Weseloh.
- *
- * 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 tyndur Project
- *     and its contributors.
- * 4. Neither the name of the tyndur 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 HOLDERS 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.
- */
-
-#include <lost/config.h>
-#include "types.h"
-#include "string.h"
-#include "stdlib.h"
-#include <stdint.h>
-
-#include "kernel.h"
-#include "intr.h"
-#include "tasks.h"
-#include "tss.h"
-#include "kprintf.h"
-#include "timer.h"
-
-struct task* first_task = NULL;
-struct task* current_task = NULL;
-int num_tasks;
-int current_task_num;
-
-/** Einheit: Mikrosekunden */
-uint64_t timer_ticks = 0;
-
-
-void set_io_bitmap(void);
-
-/**
- * Wird bei Kooperativem Multitasking benutzt zum handeln des Timers
- */
-void do_nothing(void) {}
-
-
-/**
- * Timer interrupt
- * @param irq IRQ-Nummer
- * @param esp Pointer auf Stackpointer
- */
-void timer_irq(int irq, uint32_t* esp)
-{
-    timer_ticks += 1000000 / CONFIG_TIMER_HZ;
-
-    //Ueberpruefen, ob der aktuelle Task alle seine Zeit verbraucht hat. Wenn
-    // ja, wird ein neuer Task ausgewaehlt
-    #ifndef CONFIG_COOPERATIVE_MULTITASKING
-    if ((current_task == NULL) ||
-        (--(current_task->schedule_ticks_left) >= 0))
-    {
-        schedule(esp);
-    }
-    #else
-    if (current_task == NULL) {
-        schedule(esp);
-    }
-    #endif
-
-
-    // Ueberpruefen, ob ein Timer abgelaufen ist.
-    // Dies muss nach dem schedule() kommen, da der Timer mit current_task ==
-    // NULL nicht zurechtkommt.
-    timer_notify(timer_ticks);
-}
-
-
-/**
- * Naechsten Task auswaehlen der ausgefuehrt werden soll
- * @param esp Pointer auf Stackpointer
- */
-void schedule(uint32_t* esp)
-{
-    if(first_task == NULL) {
-        panic("Taskliste leer!");
-    }
-
-    if (current_task != NULL) {
-        //kprintf("\nSwitch from %d", current_task->pid);
-        current_task->esp = *esp;
-    } else {
-        current_task = first_task;
-    }
-
-    struct task* old_task = current_task;
-
-    do {
-        current_task = current_task->next_task;
-        
-        if(current_task == NULL) {
-            current_task = first_task;
-        }
-
-        if (current_task == old_task) {
-            kprintf("%");
-            break;
-        }
-
-    } while(((current_task->blocked_by_pid) 
-        && (current_task->blocked_by_pid != current_task->pid))
-        || (current_task->status != TS_RUNNING)
-    );
-    
-    // Damit der Task die Zeit nicht beliebig hochspielen kann
-    if (current_task->schedule_ticks_left > current_task->schedule_ticks_max) {
-        current_task->schedule_ticks_left = current_task->schedule_ticks_max;
-    }
-
-    // Hier wird die CPU-Zeit berechnet, die der Task benutzen darf
-    // Diese wird folgendermassen berechnet:
-    // Benutzbare Ticks = Maximale Ticks + (Uebrige Ticks vom letzten Mal) / 2
-    current_task->schedule_ticks_left = current_task->schedule_ticks_max +
-        current_task->schedule_ticks_left / 2;
-
-    //kprintf("\nSwitch to %d", current_task->pid);
-    *esp = current_task->esp;
-
-    // Wenn der Task auf einen Port zugreift, fliegt ein GPF.
-    // Wir haben dann immer noch Zeit, die IO-Bitmap zu kopieren.
-    tss.io_bit_map_offset = TSS_IO_BITMAP_NOT_LOADED;
-}
-
-void schedule_to_task(struct task* target_task, uint32_t* esp)
-{
-    if ((target_task != NULL) && ((!target_task->blocked_by_pid) || (target_task->blocked_by_pid == target_task->pid))) {
-        current_task->esp = *esp;
-        current_task = target_task;
-        *esp = current_task->esp;
-        
-        tss.io_bit_map_offset = TSS_IO_BITMAP_NOT_LOADED;
-    }
-}
-
-void set_io_bitmap()
-{
-    tss.io_bit_map_offset = TSS_IO_BITMAP_OFFSET;
-
-    if (current_task->io_bitmap) {
-        memcpy(tss.io_bit_map, current_task->io_bitmap, IO_BITMAP_LENGTH / 8);
-    } else {
-        memset(tss.io_bit_map, 0xff, IO_BITMAP_LENGTH / 8);
-    }
-}
-
-/**
- * Initialisiert das Multitasking
- */
-void init_scheduler(void)
-{
-    request_irq(0, timer_irq);
-    
-    num_tasks = 0;
-    current_task = NULL;
-    first_task = NULL;
-    
-    uint16_t reload_value = 1193182 / CONFIG_TIMER_HZ;
-    // Timer umprogrammieren
-    asm(
-        "movb $0x34, %%al;"
-        "outb %%al, $0x43;"
-        "movw %0, %%ax;"
-        "outb %%al, $0x40;"
-        "movb %%ah, %%al;"
-        "outb %%al, $0x40"
-        : : "b" (reload_value) : "eax");
-}
diff --git a/src/kernel/src/stubs.asm b/src/kernel/src/stubs.asm
deleted file mode 100644
index 681baee5..00000000
--- a/src/kernel/src/stubs.asm
+++ /dev/null
@@ -1,145 +0,0 @@
-;

-; Copyright (c) 2006 The tyndur Project. All rights reserved.

-;

-; This code is derived from software contributed to the tyndur Project

-; by Burkhard Weseloh.

-;

-; 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 tyndur Project

-;     and its contributors.

-; 4. Neither the name of the tyndur 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 HOLDERS 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.

-;

-

-section .text

-

-%define IRQ_BASE 0x20

-

-extern handle_int

-

-%macro exception_stub 1

-global exception_stub_%1

-exception_stub_%1:

-	push dword 0

-	push dword %1

-	jmp int_bottom

-%endmacro

-

-%macro exception_stub_error_code 1

-global exception_stub_%1

-exception_stub_%1:

-	push dword %1

-	jmp int_bottom

-%endmacro

-

-%macro irq_stub 1

-global irq_stub_%1

-irq_stub_%1:

-	push dword 0

-	push dword %1 + IRQ_BASE

-	jmp int_bottom

-%endmacro

-

-global null_handler

-null_handler:

-	push dword 0

-	push dword 0x1337

-	jmp int_bottom

-

-global syscall_stub

-syscall_stub:

-  push dword 0

-  push dword 0x30

-	jmp int_bottom

-

-exception_stub 0

-exception_stub 1

-exception_stub 2

-exception_stub 3

-exception_stub 4

-exception_stub 5

-exception_stub 6

-exception_stub 7

-exception_stub_error_code 8

-exception_stub 9

-exception_stub_error_code 10

-exception_stub_error_code 11

-exception_stub_error_code 12

-exception_stub_error_code 13

-exception_stub_error_code 14

-exception_stub 16

-exception_stub_error_code 17

-exception_stub 18

-exception_stub 19

-

-irq_stub 0

-irq_stub 1

-irq_stub 2

-irq_stub 3

-irq_stub 4

-irq_stub 5

-irq_stub 6

-irq_stub 7

-irq_stub 8

-irq_stub 9

-irq_stub 10

-irq_stub 11

-irq_stub 12

-irq_stub 13

-irq_stub 14

-irq_stub 15

-

-int_bottom:

-	; register sichern

-	pusha

-	push ds

-	push es

-	push fs

-	push gs

-

-	; ring 0 segment register laden

-	cld

-	mov ax, 0x10

-	mov ds, ax

-	mov es, ax

-

-	; c-handler aufrufen

-	push esp

-	call handle_int

-	add esp, 4

-

-	; den stack wechseln

-	mov esp, eax

-	

-	; register laden

-	pop gs

-	pop fs

-	pop es

-	pop ds

-	popa

-

-	add esp, 8 ; fehlercode und interrupt nummer �berspringen

-

-	iret

diff --git a/src/kernel/src/syscall.c b/src/kernel/src/syscall.c
deleted file mode 100644
index 5a69af10..00000000
--- a/src/kernel/src/syscall.c
+++ /dev/null
@@ -1,785 +0,0 @@
-/*  
- * Copyright (c) 2006 The tyndur Project. All rights reserved.
- *
- * This code is derived from software contributed to the tyndur Project
- * by Kevin Wolf.
- *
- * 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 tyndur Project
- *     and its contributors.
- * 4. Neither the name of the tyndur 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 HOLDERS 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.
- */  
-
-#include <stdint.h>
-#include <stdbool.h>
-#include <errno.h>
-
-#include "console.h"
-#include "syscall.h"
-#include "kprintf.h"
-#include "vmm.h"
-#include "paging.h"
-#include "phys.h"
-#include "kernel.h"
-#include "string.h"
-#include "kmm.h"
-#include "tasks.h"
-#include "stdlib.h"
-#include "intr.h"
-#include <lost/config.h>
-#include "rpc.h"
-#include "io.h"
-#include "debug.h"
-#include "syscall_structs.h"
-#include "timer.h"
-#include "shm.h"
-#include "vm86.h"
-
-extern void timer_irq(int irq, uint32_t* esp);
-extern uint64_t timer_ticks;
-
-extern void set_io_bitmap(void);
-
-#ifdef CONFIG_DEBUG_LAST_SYSCALL
-uint32_t debug_last_syscall_no = 0;
-pid_t debug_last_syscall_pid = 0;
-uint32_t debug_last_syscall_data[DEBUG_LAST_SYSCALL_DATA_SIZE] = { 0 };
-#endif 
-
-void syscall(struct int_stack_frame ** esp) 
-{
-    struct int_stack_frame * isf = *esp;
-
-    #ifdef CONFIG_DEBUG_LAST_SYSCALL
-    {
-        uint32_t i;
-        debug_last_syscall_no = isf->eax;
-        debug_last_syscall_pid = current_task->pid;
-        for (i = 0; i < DEBUG_LAST_SYSCALL_DATA_SIZE; i++) {
-            debug_last_syscall_data[i] = *(((uint32_t*)isf->esp) + i);
-        }
-    }
-    #endif 
-
-    
-    if (debug_test_flag(DEBUG_FLAG_SYSCALL)) {
-        kprintf("[PID %d] Syscall:%d\n", current_task->pid, isf->eax);
-        io_ports_check(current_task);
-    }
-        
-    // FIXME: Adressen, die vom aufrufenden Programm kommen, 
-    // vor der Verwendung pr�fen
-    switch (isf->eax) {
-        case SYSCALL_PUTSN:
-        {
-            unsigned int n = *((int*) isf->esp);
-            char * s = *((char**) (isf->esp + 4));
-
-            if(n == -1)
-            {
-                con_puts(s);
-            }
-            else
-            {
-                con_putsn(n, s);
-            }
-            break;
-        }
-
-        case SYSCALL_MEM_ALLOCATE:
-        {
-            uint32_t num;
-            uint32_t flags;
-
-            paddr_t paddr;
-            vaddr_t vaddr;
-
-            num = PAGE_ALIGN_ROUND_UP(*((size_t*) isf->esp)) >> 12;
-            flags = *((uint32_t*) (isf->esp + 4));
-            paddr_t* phys = *((paddr_t**) (isf->esp + 8));
-            (void) flags;
-            //kprintf("\nMEM_ALLOCATE: PID %d: alloc %d Pages, flags %x\n", current_task->pid, num, flags);
-            //stack_backtrace_ebp(isf->ebp, isf->eip);
-            
-            // TODO: Flags ber�cksichtigen
-            vaddr = find_contiguous_pages((page_directory_t) current_task->cr3, num, USER_MEM_START, USER_MEM_END);
-            isf->eax = (uint32_t) vaddr;
-            
-            current_task->memory_used += num << 12;
-
-            //DMA-Page
-            if((flags & 0x80) != 0)
-            {
-                paddr = phys_alloc_dma_page_range_64k(num);
-               
-                //Bei DMA-Pages die phys. Adresse in ebx speichern
-                *phys = paddr;
-                if (!map_page_range((page_directory_t) current_task->cr3, vaddr, paddr, PTE_P | PTE_U | PTE_W, num))
-                {
-                    panic("Fehler beim Zuweisen der reservierten DMA-Speicherseite %x", vaddr);
-                }
-
-                //kprintf("DMA-Adresse: phys 0x%08x, virt %08x\n", isf->ebx, isf->eax);
-            }
-            else
-            {
-                while(num--)
-                {
-                    paddr = phys_alloc_page();
-                    *phys = (paddr_t) NULL;
-                    
-                    if (!map_page((page_directory_t) current_task->cr3, vaddr, paddr, PTE_P | PTE_U | PTE_W))
-                    {
-                        panic("Fehler beim Zuweisen der reservierten Speicherseite %x", vaddr);
-                    }
-                    vaddr += PAGE_SIZE;
-                }
-            }
-            
-            break;
-        }
-
-        case SYSCALL_MEM_ALLOCATE_PHYSICAL:
-        {
-            uint32_t num;
-            paddr_t position;
-            uint32_t flags;
-
-            vaddr_t vaddr;
-            num = PAGE_ALIGN_ROUND_UP(*((size_t*) isf->esp)) >> 12;
-            //TODO: Position entsprechend den Pages abrunden
-            position = *((paddr_t*) (isf->esp + 4));
-            flags = *((uint32_t*) (isf->esp + 8));
-            (void) flags;
-            // Speicher an der physikalischen Position einfach an eine freie
-            // Position mappen
-            vaddr = find_contiguous_pages((page_directory_t) current_task->cr3,
-                num, USER_MEM_START, USER_MEM_END);
-            isf->eax = (uint32_t) vaddr;
-
-            current_task->memory_used += num << 12;
-            
-            //TODO: Speicher als benutzt markieren?
-            //Nur nicht freien (=unnereichbaren) Speicher benutzen?
-            if (!map_page_range((page_directory_t) current_task->cr3, vaddr,
-                position, PTE_P | PTE_U | PTE_W, num)) {
-                panic("Fehler beim Zuweisen des Speichers %x", vaddr);
-            }
-            break;
-        }
-
-        
-        case SYSCALL_MEM_FREE:
-        {
-            vaddr_t address = *((vaddr_t*) isf->esp);
-            uint32_t pages = PAGE_ALIGN_ROUND_UP(*((size_t*) (isf->esp + 4))) >> PAGE_SHIFT;
-            
-            //kprintf("\nMEM_FREE: PID %d: free  %x Pages @ 0x%x\n", current_task->pid, pages, address);
-            
-            current_task->memory_used -= pages << 12;
-
-            if((uint32_t)address % PAGE_SIZE != 0)
-            {
-                if (debug_test_flag(DEBUG_FLAG_PEDANTIC)) {
-                    abort_task("SYSCALL_MEM_FREE: Der Task versucht eine "
-                        "nicht ausgerichtete Adresse freizugeben: 0x%08x", 
-                        address);
-                }
-                isf->eax = false;
-                break;
-            }
-
-            if (!is_userspace(address, pages * PAGE_SIZE)) 
-            {
-                if (debug_test_flag(DEBUG_FLAG_PEDANTIC)) {
-                    abort_task("SYSCALL_MEM_FREE: Der Task versucht eine "
-                        "Adresse freizugeben, die nicht fuer ihn reserviert "
-                        "ist: 0x%08x (+0x%x)", address, pages * PAGE_SIZE);
-                }
-                isf->eax = false;
-                break;
-            }
-
-            for (; pages; pages--) {
-                paddr_t paddress = resolve_vaddr((page_directory_t) current_task->cr3, address);
-
-                if(unmap_page((page_directory_t) current_task->cr3, address) != true)
-                {
-                    abort_task("SYSCALL_MEM_FREE: Die Speicherseite konnte nicht freigegeben werden: 0x%08x", address);
-                }
-                else
-                {
-                    phys_mark_page_as_free(paddress);
-                }
-
-                address += PAGE_SIZE;
-            }
-
-            isf->eax = true;
-            break;
-        }
-        
-        case SYSCALL_MEM_FREE_PHYSICAL:
-        {
-            vaddr_t address = *((vaddr_t*) isf->esp);
-            uint32_t pages = PAGE_ALIGN_ROUND_UP(*((size_t*) (isf->esp + 4))) >> PAGE_SHIFT;
-            current_task->memory_used -= pages << 12;
-            if((uint32_t)address % PAGE_SIZE != 0)
-            {
-                abort_task("SYSCALL_MEM_FREE_PHYSICAL: Der Task versucht eine nicht ausgerichtete Adresse freizugeben: 0x%08x", address);
-            }
-
-            for (; pages; pages--) {
-                //paddr_t paddress = resolve_vaddr((page_directory_t) current_task->cr3, address);
-
-                if(unmap_page((page_directory_t) current_task->cr3, address) != true)
-                {
-                    abort_task("SYSCALL_MEM_FREE_PHYSICAL: Die Speicherseite konnte nicht freigegeben werden: 0x%08x", address);
-                }
-                //FIXME: Speicher freigeben?
-
-                address += PAGE_SIZE;
-            }
-
-            break;
-        }
-        
-        case SYSCALL_MEM_RESOLVE_VADDR:
-        {
-            vaddr_t address = *((vaddr_t*) isf->esp);
-            if (is_userspace(address, 1)) {
-                isf->eax = (uint32_t) resolve_vaddr(current_task->cr3, address);
-            } else {
-                isf->eax = 0;
-            }
-
-            break;
-        }
-
-        
-        case SYSCALL_MEM_INFO:
-        {
-            isf->eax = phys_count_pages() * PAGE_SIZE;
-            isf->edx = phys_count_free_pages() *PAGE_SIZE;
-
-            break;
-        }
-        
-        case SYSCALL_SHM_CREATE:
-        {
-            uint32_t size = *((uint32_t*) isf->esp);
-            isf->eax = create_shared_memory(size);
-            break;
-        }
-
-        case SYSCALL_SHM_ATTACH:
-        {
-            uint32_t id = *((uint32_t*) isf->esp);
-            isf->eax = (uint32_t)attach_task_to_shm(current_task, id);
-            break;
-        }
-
-        case SYSCALL_SHM_DETACH:
-        {
-            uint32_t id = *((uint32_t*) isf->esp);
-            detach_task_from_shm(current_task, id);
-            break;
-        }
-
-        case SYSCALL_PM_REQUEST_PORT:
-        {
-            uint32_t port = *((uint32_t*) isf->esp);
-            uint32_t length = *((uint32_t*) (isf->esp + 4));
-
-            isf->eax = io_ports_request(current_task, port, length);
-
-            set_io_bitmap();
-            break;
-        }
-
-        case SYSCALL_PM_RELEASE_PORT:
-        {
-            uint32_t port = *((uint32_t*) isf->esp);
-            uint32_t length = *((uint32_t*) (isf->esp + 4));
-
-            isf->eax = true;
-            if (!io_ports_release(current_task, port, length)) 
-            {
-                if (debug_test_flag(DEBUG_FLAG_PEDANTIC)) {
-                    abort_task("Freigab eines nicht reservierten Ports (port: 0x%x, Laenge 0x%x)", port, length);
-                }
-
-                isf->eax = false;
-            }
-
-            set_io_bitmap();
-            break;
-        }
-
-        case SYSCALL_PM_CREATE_PROCESS:
-        {
-            //TODO: Die UID irgendwie verwerten
-            //uid_t uid = *((uid_t*) isf->esp + 4);
-            
-            pid_t parent_pid = *((pid_t*)((uint32_t)isf->esp + 12));
-            void* eip = *((void**) isf->esp);
-            const char* cmdline = *((const char**) ((uint32_t)isf->esp + 8));
-
-            struct task* new_task = create_task(eip, cmdline, parent_pid);
-
-            new_task->blocked_by_pid = current_task->pid;
-            isf->eax = new_task->pid;
-            break;
-        }
-        case SYSCALL_PM_INIT_PAGE:
-        {
-            struct task* new_task = get_task(*((pid_t*) isf->esp));
-            
-            if((new_task == NULL) || (new_task->blocked_by_pid != current_task->pid)) 
-            {
-                abort_task("SYSCALL_PM_INIT_PAGE: Der Aufrufer hat eine ungueltige PID angegeben: %d", *((pid_t*) isf->esp));
-            }
-
-            int num = PAGE_ALIGN_ROUND_UP(*((size_t*) (isf->esp + 12))) >> 12;
-            vaddr_t dest = (vaddr_t) PAGE_ALIGN_ROUND_DOWN(*((size_t*) (isf->esp + 4)));
-            vaddr_t src = (vaddr_t) PAGE_ALIGN_ROUND_DOWN(*((size_t*) (isf->esp + 8)));
-            
-            if (dest == NULL) {
-                abort_task("SYSCALL_PM_INIT_PAGE: Versuchtes NULL-Mapping: src = 0x%08x", src);
-            }
-            
-            current_task->memory_used -= num * PAGE_SIZE;
-            //kprintf("Map psrc:%x    src:%x    dest:%x   size:%x\n", resolve_vaddr((page_directory_t) current_task->cr3, src), src, dest, num << 12);
-            
-            /*{
-                uint32_t i;
-                for (i = 0; i < num; i++)
-                    kprintf("[%08x %08x]\n", *((uint32_t*) (src + 0x1000*i)), *((uint32_t*) (src + 0x1000*i + 4)));
-            }*/
-
-            // Das PD-des neuen tasks mappen
-            page_directory_t new_task_pd = new_task->cr3;
-            
-            // An dieser Stelle kann kein map_page_range benutzt werden, da
-            // der Speicher nur virtuell, aber nicht unbedingt physisch
-            // zusammenh�ngend sein mu�.
-            while(num--) {
-                if (!resolve_vaddr(new_task_pd, dest)) {
-                    if (!map_page(new_task_pd, dest, resolve_vaddr((page_directory_t) current_task->cr3, src), PTE_P | PTE_U | PTE_W)) {
-                        abort_task("SYSCALL_PM_INIT_PAGE: Fehler beim Zuweisen der reservierten Speicherseite %x  =>  %x", src, dest);
-                    }
-                } else {
-                    // FIXME: Hier muss was passieren. Kopieren?
-                }
-                
-                src += 0x1000;
-                dest += 0x1000;
-            }
-            
-            //free_phys_addr((vaddr_t)new_task_pd, PAGE_DIRECTORY_LENGTH);
-            break;
-        }
-        case SYSCALL_PM_INIT_PAGE_COPY:
-        {
-            struct task* new_task = get_task(*((pid_t*) isf->esp));
-            
-            if((new_task == NULL) || (new_task->blocked_by_pid != current_task->pid)) 
-            {
-                abort_task("SYSCALL_PM_INIT_PAGE_COPY: Der Aufrufer hat eine ungueltige PID angegeben: %d", *((pid_t*) isf->esp));
-            }
-
-            int num = PAGE_ALIGN_ROUND_UP(*((size_t*) (isf->esp + 12))) >> 12;
-            vaddr_t dest = (vaddr_t) PAGE_ALIGN_ROUND_DOWN(*((size_t*) (isf->esp + 4)));
-            vaddr_t src = (vaddr_t) PAGE_ALIGN_ROUND_DOWN(*((size_t*) (isf->esp + 8)));
-            
-            if (dest == NULL) {
-                abort_task("SYSCALL_PM_INIT_PAGE_COPY: Versuchtes Kopieren nach NULL: src = 0x%08x", src);
-            }
-            
-            // Das PD-des neuen tasks mappen
-            page_directory_t new_task_pd = new_task->cr3;
-            
-            // Speicher wird kopiert, nicht gemappt.
-            while(num--) {
-                if (!resolve_vaddr(new_task_pd, dest)) {
-                    map_page(new_task_pd, dest, phys_alloc_page(), PTE_P | PTE_U | PTE_W);
-                }
-                
-                paddr_t phys_addr = resolve_vaddr(new_task_pd, dest);
-                char *destmem = find_contiguous_kernel_pages(1);
-                map_page(kernel_page_directory, destmem, phys_addr, PTE_P | PTE_W);
-                memcpy(destmem, src, 0x1000);
-                unmap_page(kernel_page_directory, destmem);
-                
-                src += 0x1000;
-                dest += 0x1000;
-            }
-            
-            break;
-        }
-        case SYSCALL_PM_EXIT_PROCESS:
-        {
-            struct task* old_task = current_task;
-            schedule((uint32_t*)esp);
-            destroy_task(old_task);
-            break;
-        }
-        
-        case SYSCALL_PM_SLEEP:
-            schedule((uint32_t*)esp);
-            break;
-        
-        case SYSCALL_PM_WAIT_FOR_RPC:
-            /*kprintf("Kernel: wait_for_rpc: PID %d an %08x\n", 
-                current_task->pid, 
-                isf->ebp >= 0x1000 ? *((uint32_t*) (isf->ebp  + 4)) : 0
-            );*/
-            current_task->status = TS_WAIT_FOR_RPC;
-            schedule((uint32_t*)esp);
-            break;
-                    
-        case SYSCALL_PM_V_AND_WAIT_FOR_RPC:
-            if(unblock_task(current_task, current_task->pid) == false)
-            {
-                abort_task("SYSCALL_PM_V_AND_WAIT_FOR_RPC: "
-                    "Der Task konnte nicht fortgesetzt werden");
-            }
-            /*kprintf("Kernel: v_and_wait_for_rpc: PID %d an %08x, blocked: %d\n",
-                current_task->pid, 
-                isf->ebp >= 0x1000 ? *((uint32_t*) (isf->ebp  + 4)) : 0,
-                current_task->blocked_count
-            );*/
-            current_task->status = TS_WAIT_FOR_RPC;
-            schedule((uint32_t*)esp);
-            break;
-
-        case SYSCALL_PM_GET_UID:
-            isf->eax = 0;
-            break;
-        
-        case SYSCALL_PM_GET_PID:
-            isf->eax = current_task->pid;
-            break;
-        
-        case SYSCALL_PM_GET_CMDLINE:
-        {   
-            vaddr_t vaddr = find_contiguous_pages((page_directory_t) current_task->cr3, 1, USER_MEM_START, USER_MEM_END);
-            paddr_t paddr = phys_alloc_page();
-            
-            if (!map_page((page_directory_t) current_task->cr3, vaddr, paddr, PTE_P | PTE_U | PTE_W))
-            {
-                panic("Fehler beim Zuweisen der reservierten Speicherseite %x", vaddr);
-            }
-
-            isf->eax = (uint32_t) vaddr;
-
-            memcpy((void*) vaddr, (void*)(current_task->cmdline), strlen(current_task->cmdline) + 1);
-            //kprintf("KERNEL return commmandline %s\n", current_task->cmdline);
-
-            break;
-        }
-
-        case SYSCALL_PM_GET_PARENT_PID:
-            // Eltern PID vom aktuellen Task
-            if (*((pid_t*) isf->esp) == 0) {
-                if (current_task->parent_task != NULL) {
-                    isf->eax = current_task->parent_task->pid;
-                } else {
-                    isf->eax = 0;
-                }
-            } else {
-                struct task* task = get_task(*((pid_t*) isf->esp));
-
-                if (task == NULL) {
-                    isf->eax = 0;
-                } else {
-                    if (task->parent_task == NULL) {
-                        isf->eax = 0;
-                    } else {
-                        isf->eax = task->parent_task->pid;
-                    }
-                }
-            }
-            break;
-        case SYSCALL_PM_ENUMERATE_TASKS:
-        {
-            // Erst werden die Tasks gezaehlt, und die Groesse der
-            // Informationen mit den Kommandozeilen wird errechnet.
-            size_t task_count = 0;
-            size_t result_size = sizeof(task_info_t);
-            struct task* task = first_task;
-            uint32_t i;
-
-            while (task != NULL) {
-                task_count++;
-                result_size += sizeof(task_info_task_t) + strlen(task->cmdline)
-                    + 1;
-                task = task->next_task;
-            }
-            
-            // Anzahl der Seiten berechnen, die die Informationen benoetigen.
-            size_t result_page_count = PAGE_ALIGN_ROUND_UP(result_size) /
-                PAGE_SIZE;
-
-            // Jetzt wird eine freie Stelle im Adressraum des Prozesses
-            // gesucht, wo die Task-Infos hingemappt werden koennen
-            task_info_t* task_info = find_contiguous_pages((page_directory_t)
-                current_task->cr3, result_page_count, USER_MEM_START,
-                USER_MEM_END);
-
-            // Ein paar Seite an die Stelle mappen
-            for (i = 0; i < result_page_count; i++) {
-                if (!map_page((page_directory_t) current_task->cr3, (void*)
-                    ((uint32_t)task_info + i * PAGE_SIZE), phys_alloc_page(), 
-                    PTE_P | PTE_U | PTE_W))
-                {
-                    panic("Fehler beim Zuweisen der reservierten "
-                        "Speicherseite %x", (uint32_t)task_info + i * PAGE_SIZE);
-                }
-            }
-            
-            // Der groessen-Eintrag ist nur da, damit der Tasks die Pages
-            // freigeben koennte.
-            task_info->info_size = result_size;
-
-            task_info->task_count = task_count;
-
-            // Dieser Pointer zeigt direkt hinter das Array mit den
-            // Task-Informationen. Dort werden die Kommandozeilen
-            // hintereinander gespeichert, und aus den Task-Strukturen wird auf
-            // sie verwiesen.
-            char* cmdlines = (char*) task_info->tasks;
-            cmdlines += task_count * sizeof(task_info_task_t);
-            
-            task = first_task;
-            // Jetzt werden die Infos eingefuellt.
-            for (i = 0; i < task_count; i++) {
-                task_info->tasks[i].pid = task->pid;
-                task_info->tasks[i].status = task->status;
-                task_info->tasks[i].eip = 
-                    ((struct int_stack_frame*) task->esp)->eip;
-
-                // Wenn der Task keinen Eltern-Task hat muessen wir aufpassen,
-                // damit wir keinen Pagefault produzieren.
-                if (task->parent_task == NULL) {
-                    task_info->tasks[i].parent_pid = 0;
-                } else {
-                    task_info->tasks[i].parent_pid = task->parent_task->pid;
-                }
-                
-                // Die Kommandozeile inklusive Nullbyte kopieren
-                size_t cmdline_size = strlen(task->cmdline) + 1;
-                memcpy(cmdlines, task->cmdline, cmdline_size);
-
-                // Den Pointer fuer die Kommandozeile setzen
-                task_info->tasks[i].cmdline = cmdlines;
-
-                // Den Zielpointer fuer die naechste Kommandozeile direkt
-                // hinter die aktuelle setzen.
-                cmdlines += cmdline_size;
-                
-                task_info->tasks[i].memory_used = task->memory_used;
-                task = task->next_task;
-            }
-            
-            // In eax wird ein Pointer auf die Daten zurueck gegeben
-            isf->eax = (uint32_t) task_info;
-
-            break;
-        }
-
-        case SYSCALL_PM_P:
-            /*kprintf("Kernel: p: PID %d an %08x => %d\n", 
-                current_task->pid, 
-                isf->ebp >= 0x1000 ? *((uint32_t*) (isf->ebp  + 4)) : 0,
-                current_task->blocked_count
-            );*/
-            if (!block_task(current_task, current_task->pid)) {
-                panic("Konnte Task nicht blockieren");
-            }
-            break;
-        
-        case SYSCALL_PM_V:
-        {
-            pid_t pid = *((pid_t*) isf->esp);
-            struct task* task_ptr = get_task(pid);
-            if(pid == 0)
-            {
-                unblock_task(current_task, current_task->pid);
-            }
-            else
-            {
-                if(task_ptr == NULL)
-                    abort_task("SYSCALL_PM_V: Der Aufrufer hat eine ungueltige PID angegeben: %d", pid);
-                
-                if(task_ptr->blocked_by_pid == current_task->pid)
-                {
-                    if(unblock_task(task_ptr, current_task->pid) == false)
-                    {
-                        panic("SYSCALL_PM_V: Der Task konnte nicht fortgesetzt werden");
-                    }
-                }
-                else
-                {
-                    abort_task("SYSCALL_PM_V: Der Aufrufer hat einen Prozess(PID=%d) angegeben, der nicht von ihm blockiert ist", pid);
-                }
-            }
-            /*kprintf("Kernel: v: PID %d an %08x => %d\n", 
-                current_task->pid, 
-                isf->ebp >= 0x1000 ? *((uint32_t*) (isf->ebp  + 4)) : 0,
-                current_task->blocked_count
-            );*/
-            break;
-        }
-
-        case SYSCALL_SET_RPC_HANDLER:
-        {
-            current_task->rpc_handler = *((vaddr_t*) isf->esp);
-            break;
-        }
-
-        case SYSCALL_FASTRPC:
-        {
-            uint32_t metadata_size = *((uint32_t*) (isf->esp + 4));
-            void* metadata = *((void**) (isf->esp + 8));
-            uint32_t data_size = *((uint32_t*) (isf->esp + 12));
-            void* data = *((void**) (isf->esp + 16));
-
-            uint32_t callee_pid = *((uint32_t*) isf->esp);
-            struct task* callee = get_task(callee_pid);
-
-            if (!callee) {
-                isf->eax = -ESRCH;
-                break;
-            }
-
-            if (!is_userspace(metadata, metadata_size)) {
-                abort_task("SYSCALL_FASTRPC: Ungueltige Metadaten (%08x)",
-                    (uint32_t) metadata);
-                break;
-            }
-            
-            if (!is_userspace(data, data_size)) {
-                abort_task("SYSCALL_FASTRPC: Ungueltige Daten (%08x)",
-                    (uint32_t) data);
-                break;
-            }
-
-            isf->eax = 0;
-            if (fastrpc(
-                callee,
-                metadata_size, metadata,
-                data_size, data    
-            )) {
-                schedule_to_task(callee, (uint32_t*) esp);
-            } else {
-                isf->eax = -EAGAIN;
-                schedule((uint32_t*)esp);
-            }
-            break;
-        }
-
-        case SYSCALL_FASTRPC_RET:
-        {
-            return_from_rpc(esp);
-            break;
-        }
-
-        case SYSCALL_ADD_INTERRUPT_HANDLER:
-        {
-            set_intr_handling_task(*((uint32_t*) isf->esp), current_task);
-            break;
-        }
-        
-        case SYSCALL_GET_TICK_COUNT:
-        {
-            isf->eax = (uint32_t)timer_ticks;
-            isf->edx = (uint32_t)(timer_ticks >> 32);
-            break;
-        }
-
-        case SYSCALL_ADD_TIMER:
-        {
-            timer_register(
-                current_task,
-                *((uint32_t*) (isf->esp)),
-                *((uint32_t*) (isf->esp + 4))
-            );
-            break;
-        }
-        
-        case SYSCALL_VM86:
-        {
-            vm86_regs_t *regs = *((vm86_regs_t **) (isf->esp));
-            uint32_t *mem = *((uint32_t **) (isf->esp + 4));
-            if (!regs) {
-                isf->eax = 0;
-                break;
-            }
-            if (create_vm86_task(0x10, regs, mem, current_task)) {
-                isf->eax = 1;
-            } else {
-                isf->eax = 0;
-            }
-            schedule((uint32_t*)esp);
-            break;
-        }
-
-        case SYSCALL_FORTY_TWO:
-        {
-            asm("int $0x20");
-            char* forty_two = malloc(61);
-            memcpy(forty_two, "\nThe Answer to Life, the Universe, and Everything is ... 42\n", 61);
-            kprintf("%s", forty_two);
-            break;
-        }
-
-        case SYSCALL_DEBUG_STACKTRACE:
-        {
-            pid_t pid = *((uint32_t*) (isf->esp));
-            struct task* task = get_task(pid);
-
-            // FIXME: Was bei einem Fehler
-            if (task != NULL) {
-                // TODO: Irgend ein Gefuehl sagt mir, dass das nicht so einfach
-                //       sein kann *g*
-                // In den Kontext dieses Tasks wechseln
-                __asm("mov %0, %%cr3" : : "r"(resolve_vaddr(kernel_page_directory, task->cr3)));            
-                struct int_stack_frame* isf = (struct int_stack_frame*) task->esp;
-                stack_backtrace_ebp(isf->ebp, isf->eip);
-
-                // Zurueck in den Kontext des aktuellen Tasks wechseln
-                __asm("mov %0, %%cr3" : : "r"(resolve_vaddr(kernel_page_directory, current_task->cr3)));
-            }
-
-            break;
-        }
-
-        default:
-            abort_task("Ungueltige Systemfunktion %d", isf->eax);
-            break;
-    }
-}
diff --git a/src/kernel/src/task.c b/src/kernel/src/task.c
deleted file mode 100644
index eeca57fc..00000000
--- a/src/kernel/src/task.c
+++ /dev/null
@@ -1,422 +0,0 @@
-/*  
- * Copyright (c) 2007 The tyndur Project. All rights reserved.
- *
- * This code is derived from software contributed to the tyndur Project
- * by Kevin Wolf.
- *
- * 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 tyndur Project
- *     and its contributors.
- * 4. Neither the name of the tyndur 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 HOLDERS 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.
- */  
-
-#include <types.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <stdbool.h>
-#include <string.h>
-
-#include "vmm.h"
-#include "kmm.h"
-#include "paging.h"
-#include "kernel.h"
-#include "shm.h"
-
-#include "rpc.h"
-#include "io.h"
-
-#include "tasks.h"
-#include "timer.h"
-#include "kprintf.h"
-#include "debug.h"
-
-#define USER_STACK_VIRT 0xfffff000
-#define USER_STACK_SIZE (1024 - 4)
-
-extern uint64_t timer_ticks;
-extern struct task* first_task;
-extern int num_tasks;
-
-/**
- * Generiert eine neue eindeutige Prozess-ID
- * @return neue Prozess-ID
- */
-pid_t generate_pid()
-{
-    static pid_t next_pid = 1;
-    return next_pid++;
-}
-
-/**
- * Blockiert einen Task. Zu einem blockierten Task k�nnen keine RPC-Aufrufe
- * durchgef�hrt werden. Wenn der Task durch einen anderen Task blockiert ist,
- * wird er au�erdem vom Scheduler nicht mehr aufgerufen, bis der Task 
- * entblockt wird.
- *
- * @param task Zu blockierender Task
- * @param blocked_by PID des blockierenden Tasks
- */
-bool block_task(struct task* task, pid_t blocked_by)
-{
-    if(task->blocked_by_pid == blocked_by) {
-        task->blocked_count++;
-        return true;
-    }
-
-/*    while(task->blocked_by_pid)
-    {
-        kprintf("[block_task() => intr]\n");
-        asm("int $0x20");
-    }*/
-    if (task->blocked_by_pid) {
-        return false;
-    }
-    
-    /*if (blocked_by == 10 || blocked_by == 11) {
-        uint32_t ebp =((struct int_stack_frame*) current_task->esp)->ebp; 
-
-        kprintf("block_task PID %d durch PID %d = %d an %08x\n", 
-            task->pid, 
-            blocked_by,
-            current_task->pid,
-            ebp >= 0x1000 ? *((uint32_t*) (ebp  + 4)) : 0
-        );
-    }*/
-
-    task->blocked_by_pid = blocked_by;
-    task->blocked_count = 1;
-
-    return true;
-}
-
-/**
- * Entblockt einen blockierten Task. Dies ist nur m�glich, wenn der
- * aufrufende Task dem blockierenden Task entspricht
- *
- * @param task Zu entblockender Task
- * @param blocked_by Aufrufender Task
- *
- * @return true, wenn der Task erfolgreich entblockt wurde, false
- * im Fehlerfall.
- */
-bool unblock_task(struct task* task, pid_t blocked_by)
-{
-    if (task->blocked_by_pid == blocked_by) {
-        if(--(task->blocked_count) == 0) {
-            task->blocked_by_pid = 0;
-        }
-        return true;
-    } else {
-        kprintf("\033[41munblock_task nicht erlaubt.\n\n\n");
-        return false;
-    }
-}
-
-
-/**
- * Erstellt einen neuen Task
- *
- * @param entry Einsprungspunkt
- * @param args String der Parameter
- *
- * @return Neuer Task
- */
-struct task * create_task(void* entry, const char* args, pid_t parent_pid)
-{
-    struct task* new_task = malloc(sizeof(struct task));
-    new_task->pid = generate_pid();
-    new_task->rpcs = list_create();
-    new_task->io_bitmap = NULL;
-    new_task->status = TS_RUNNING;
-    
-    new_task->shmids = list_create();
-    new_task->shmaddresses = list_create();
-
-    new_task->vm86 = false;
-    new_task->vm86_info = NULL;
-    
-    new_task->memory_used = 0;
-    // Wenn nicht Init erstellt werden soll, wir der Task mit der PID seines
-    //  Elterntasks blockiert. Damit der Elterntask Zeit hat, die notwendigen
-    //  Pages in den Adressraum des neuen Prozesses zu mappen.
-    if (new_task->pid != 1) {
-        new_task->blocked_count = 1;
-        new_task->blocked_by_pid = parent_pid;
-    } else {
-        new_task->blocked_by_pid = 0;
-        new_task->blocked_count = 0;
-    }
-
-    
-    // Scheduling-Eigenschaften fuer den Task setzen
-    new_task->schedule_ticks_left = 0;
-    new_task->schedule_ticks_max = 50;
-
-    // Haenge den Task an die Liste an
-    // TODO Trennen der Task-Liste von der Scheduling-Liste
-    new_task->next_task = first_task;
-    first_task = new_task;
-    if (parent_pid == 0) {
-        new_task->parent_task = current_task;
-    } else {
-        new_task->parent_task = get_task(parent_pid);
-    }
-    
-    // Kopieren der Kommandozeile
-    new_task->cmdline = malloc(strlen(args) + 1);
-    memcpy((void*) (new_task->cmdline), (void*)args, strlen(args) + 1);
-
-    // Ein neues Page Directory anlegen. Das Page Directory bleibt
-    // gemappt, solange der Task l�uft.
-    //
-    // Der Kernelspeicher wird in allen Tasks gleich gemappt, der
-    // Userspace bekommt erstmal einen komplett leeren Speicher.
-    paddr_t phys_pagedir = phys_alloc_page();
-    page_directory_t pagedir = (page_directory_t) map_phys_addr(phys_pagedir, PAGE_SIZE);
-
-    memset((void*) pagedir, 0, PAGE_SIZE);
-    memcpy((void*) pagedir, kernel_page_directory, 1024);
-    pagedir[0xff] = (uint32_t) phys_pagedir | PTE_W | PTE_P;
-    new_task->cr3 = pagedir;
-
-    // Speicher fuer die Stacks allokieren
-    // Stack im PD des neuen Tasks mappen
-    paddr_t phys_kernel_stack = phys_alloc_page();
-    paddr_t phys_user_stack = phys_alloc_page();
-
-    map_page(pagedir, (vaddr_t)USER_STACK_VIRT, phys_user_stack, PTE_W | PTE_P | PTE_U);
-    new_task->user_stack_bottom = (vaddr_t) USER_STACK_VIRT;
-
-    // Den Kernelstack mappen und initialisieren
-    // Der Stack wird von oben her beschrieben, daher 4K addieren 
-    // (1024 * sizeof(uint32_t))
-    uint32_t * kernel_stack = map_phys_addr(phys_kernel_stack, PAGE_SIZE);
-    kernel_stack += 1024;
-
-    *(--kernel_stack) = 0x23; // ss
-    *(--kernel_stack) = USER_STACK_VIRT + USER_STACK_SIZE - 0x4; // esp FIXME: das + 0x8 ist gehoert hier eigentlich nicht hin, das dient dazu dem Task startparameter mit zu geben und sollte flexibler geloest werden
-    *(--kernel_stack) = 0x0202; // eflags = interrupts aktiviert und iopl = 0
-    *(--kernel_stack) = 0x1b; // cs
-    *(--kernel_stack) = (uint32_t)entry; // eip
-
-    *(--kernel_stack) = 0; // interrupt nummer
-    *(--kernel_stack) = 0; // error code
-
-    // general purpose registers
-    *(--kernel_stack) = 0;
-    *(--kernel_stack) = 0;
-    *(--kernel_stack) = 0;
-    *(--kernel_stack) = 0;
-    *(--kernel_stack) = 0;
-    *(--kernel_stack) = 0;
-    *(--kernel_stack) = 0;
-    *(--kernel_stack) = 0;
-
-    // segment registers
-    *(--kernel_stack) = 0x23;
-    *(--kernel_stack) = 0x23;
-    *(--kernel_stack) = 0x23;
-    *(--kernel_stack) = 0x23;
-    
-    new_task->esp = (uint32_t) kernel_stack;
-    new_task->kernel_stack = (uint32_t) kernel_stack;
-
-    num_tasks++;
-    
-    return new_task;
-}
-
-/**
- * Beendet einen Taks.
- *
- * @param task_ptr Zu beendender Task
- */
-void destroy_task(struct task* task_ptr)
-{
-    task_ptr->blocked_by_pid = -1;
-
-    struct task* previous_task = NULL;
-    struct task* next_task = NULL;
-
-    // Den vorherigen Task in der Liste heraussuchen
-    if(task_ptr == first_task)
-    {
-        first_task = task_ptr->next_task;
-    }
-    else
-    {
-        next_task = first_task;
-        while(next_task != task_ptr)
-        {
-            // Wenn der Task nicht gefunden wuzde verlasse die Funktion
-            if(next_task == NULL)
-                return;
-
-            previous_task = next_task;
-            next_task = next_task->next_task;
-        }
-        previous_task->next_task = task_ptr->next_task;
-    }
-
-    // Alle Kindprozesse an init weitervererben
-    for (next_task = first_task; next_task; next_task = next_task->next_task) {
-        if (next_task->parent_task == task_ptr) {
-            next_task->parent_task = get_task(1);
-        }
-    }
-
-    // Interrupthandler ausschalten
-    remove_intr_handling_task(task_ptr);
-    
-    
-    // Melde das Beenden des Tasks per RPC an init
-    char* rpc_init = "        SERV_SHD    ";
-    *((uint32_t*)rpc_init) = 512;
-    *((pid_t*)((uint32_t) rpc_init + 8 + 8))  = task_ptr->pid;
-    
-    fastrpc(get_task(1), 0, 0, strlen(rpc_init), rpc_init);
-    
-    // Timer freigeben
-    timer_cancel_all(task_ptr);
-    
-    // Alle Ports und die IO-Bitmap des Tasks freigeben
-    if (task_ptr->io_bitmap) {
-        io_ports_release_all(task_ptr);
-        free(task_ptr->io_bitmap);
-    }
-    
-    //Shared Memory-Bereiche von Task l�sen
-    while (list_size(task_ptr->shmids) > 0) {
-        uint32_t id = (uint32_t)list_get_element_at(task_ptr->shmids, list_size(task_ptr->shmids) - 1);
-        detach_task_from_shm(task_ptr, id);
-    }
-    
-    // Evtl. zusatzliche Infos von VM86-Task l�schen
-    if (task_ptr->vm86) {
-        free(task_ptr->vm86_info);
-    }
-
-    // Kommandozeilenparameter freigeben
-    if (task_ptr->cmdline) {
-        free((char*) task_ptr->cmdline);
-    }
-
-    // Wenn der zu beendende Task kurz vorher einen RPC gemacht hat,
-    // hat der aufgerufene Prozess den jetzt beendeten Task in
-    // callee->rpcs und der Ruecksprung wurde im Desaster enden.
-    rpc_destroy_task_backlinks(task_ptr);
-
-    // Pagedir des tasks mappen, um den gesamten Speicher
-    // freigeben zu k�nnen
-    page_directory_t page_dir = task_ptr->cr3;
-    page_table_t page_table;
-    
-    int i;
-    int n;
-    
-    // Alle Pages von 1 GB - 4 GB
-    //
-    // FIXME Physisch freigeben nur, wenn die Seite tats�chlich speziell f�r
-    // den Task reserviert wurde. Das ist beispielsweise bei Shared Memory oder
-    // beim Zugriff auf physischen Speicher (Framebuffer) nicht der Fall.
-    for(i=256; i < 1024; i++)
-    {
-        if(page_dir[i] & PTE_P)
-        {
-            page_table = map_phys_addr((paddr_t)(page_dir[i] & ~0xFFF), PAGE_TABLE_LENGTH);
-            
-            for(n=0; n < 1024; n++)
-            {
-                if(page_table[n] & PTE_P)
-                {
-                    phys_free_page((paddr_t) (page_table[n] & PAGE_MASK));
-                }
-            }
-            
-            free_phys_addr((vaddr_t)page_table, PAGE_TABLE_LENGTH);
-        }
-    }
-   
-    // Page Directory und den Task selbst freigeben
-    // TODO Auch die physische Seite freigeben
-    free_phys_addr((vaddr_t)page_dir, PAGE_DIRECTORY_LENGTH);
-    free(task_ptr);
-}
-
-
-/**
- * Sucht einen Task anhand der PID und gibt einen Pointer darauf zurueck:
- * 
- * @param pid PID des gesuchten Tasks
- * @return Pointer auf den Task oder NULL, falls kein Task mit der passenden
- * PID gefunden wurde
- */
-struct task * get_task(pid_t pid)
-{
-    struct task* curr_task = first_task;
-    
-    while(curr_task != NULL)
-    {
-        if(curr_task->pid == pid) {
-            return curr_task;
-        }
-        
-        curr_task = curr_task->next_task;
-    }
-    
-    return NULL;
-}
-
-/**
- * Bricht den aktuell ausgef�hrten Task mit einer Fehlermeldung ab.
- */
-void abort_task(char* format, ...)
-{
-    int * args = ((int*)&format) + 1;
-
-    kprintf("\n\033[1;37m\033[41m" // weiss auf rot
-        "Task %d beendet: %s\n", 
-        current_task->pid,
-        current_task->cmdline != NULL 
-            ? current_task->cmdline 
-            : "Unbekannter Task"
-        );
-    kaprintf(format, &args);
-    kprintf("\n\033[0;37m\033[40m");
-        
-    if(debug_test_flag(DEBUG_FLAG_STACK_BACKTRACE))
-    {
-        struct int_stack_frame* isf = (struct int_stack_frame*)
-            current_task->esp;
-        stack_backtrace_ebp(isf->ebp, isf->eip);
-    }
-
-    destroy_task(current_task);
-    
-    current_task = NULL;
-    asm("int $0x20");
-}
-
diff --git a/src/kernel/src/timer.c b/src/kernel/src/timer.c
deleted file mode 100644
index 685cbd1b..00000000
--- a/src/kernel/src/timer.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2006-2007 The tyndur Project. All rights reserved.
- *
- * This code is derived from software contributed to the tyndur Project
- * by Kevin Wolf.
- *
- * 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 tyndur Project
- *     and its contributors.
- * 4. Neither the name of the tyndur 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 HOLDERS 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.
- */
-
-#include <types.h>
-#include <collections.h>
-#include <stdlib.h>
-
-#include "timer.h"
-#include "rpc.h"
-
-extern uint64_t timer_ticks;
-
-
-static list_t* timers;
-
-struct timeout {
-    struct task*    task;
-    uint32_t           timer_id;
-    uint64_t           timeout;
-};
-
-void timer_init()
-{
-    timers = list_create();
-}
-
-void timer_register(struct task* task, uint32_t timer_id, uint32_t usec)
-{
-    // Anlegen des Timeout-Objekts
-    struct timeout* timeout = malloc(sizeof(struct timeout));
-
-    timeout->task       = task;
-    timeout->timer_id   = timer_id;
-    timeout->timeout    = timer_ticks + usec;
-
-    // An der richtigen Stelle in der Liste einsortieren, so dass immer nur
-    // das erste Listenelement gepr�ft werden muss
-    struct timeout* item;
-    int i;
-    for (i = 0; (item = list_get_element_at(timers, i)); i++) {
-        if (item->timeout > timeout->timeout) {
-            break;
-        }
-    }
-
-    list_insert(timers, i, timeout);
-}
-
-void timer_notify(uint64_t microtime)
-{
-    static uint64_t last_microtime = 0;
-    static const uint32_t rpc_timer_function = 514;
-    
-    struct timeout* item;
-    for (; (item = list_get_element_at(timers, 0)); free(list_pop(timers))) 
-    {
-        // Die Schleife soll nur so lange laufen, wie die Timeouts in der 
-        // Vergangenheit liegen. Da die Liste sortiert ist, kann beim ersten
-        // Timeout, der in der Zukunft liegt, abgebrochen werden.
-        //
-        // Overflows m�ssen abgefangen werden, da in diesem Spezialfall eine
-        // gr��ere Zahl dennoch Vergangenheit bedeutet. Wie ich grad sehe,
-        // reden wir von einem qword und damit von einer Uptime von ein paar
-        // hunderttausend Jahren, aber LOST ist ja stabil und wir daher
-        // optimistisch.
-        if (((item->timeout > microtime) && (microtime > last_microtime)) 
-            || ((item->timeout < last_microtime) && (microtime < last_microtime)))
-        {
-            break;
-        }
-
-        // Task per RPC informieren, dass der Timer abgelaufen ist
-        // Im Fehlerfall mit der Abarbeitung der Liste aufh�ren und es beim
-        // n�chsten Mal nochmal versuchen.
-        //
-        // FIXME Mit p(); while(1); kann ein Prozess den Timer f�r das ganze
-        // System lahmlegen
-        if (!fastrpc(item->task, 
-                4, (char*) &rpc_timer_function, 
-                4, (char*) &item->timer_id)) 
-        {
-            break;
-        }
-    }
-
-    last_microtime = microtime;
-}
-
-void timer_cancel_all(struct task* task)
-{
-    struct timeout* item;
-    int i;
-    for (i = 0; (item = list_get_element_at(timers, i)); i++) {
-        if (item->task == task) {
-            list_remove(timers, i);
-        }
-    }
-}
diff --git a/src/kernel/src/tss.c b/src/kernel/src/tss.c
deleted file mode 100644
index 8c858176..00000000
--- a/src/kernel/src/tss.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2006-2007 The tyndur Project. All rights reserved.
- *
- * This code is derived from software contributed to the tyndur Project
- * by Burkhard Weseloh.
- *
- * 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 tyndur Project
- *     and its contributors.
- * 4. Neither the name of the tyndur 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 HOLDERS 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.
- */
-
-#include "gdt.h"
-#include "tss.h"
-#include "cdefs.h"
-
-tss_t tss = { 
-    .ss0 = SYS_DATA_SEL, 
-    .io_bit_map_offset = TSS_IO_BITMAP_OFFSET,
-    .io_bit_map_end = 0xFF 
-};
diff --git a/src/kernel/src/vm86.c b/src/kernel/src/vm86.c
deleted file mode 100644
index be50e39d..00000000
--- a/src/kernel/src/vm86.c
+++ /dev/null
@@ -1,392 +0,0 @@
-/*  
- * Copyright (c) 2007 The tyndur Project. All rights reserved.
- *
- * This code is derived from software contributed to the tyndur Project
- * by Mathias Gottschlag.
- *
- * 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 tyndur Project
- *     and its contributors.
- * 4. Neither the name of the tyndur 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 HOLDERS 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.
- */
-
-#include <stdint.h>
-#include <stdbool.h>
-
-#include "vm86.h"
-#include "string.h"
-#include "stdlib.h"
-#include "syscall_structs.h"
-#include "paging.h"
-#include "intr.h"
-#include "kprintf.h"
-#include "kmm.h"
-#include "kernel.h"
-#include <ports.h>
-
-extern int num_tasks;
-
-// Kopie der ersten 4k RAM
-struct
-{
-    uint16_t ivt[256][2];
-    uint8_t data[3072];
-} bios_data __attribute__ ((aligned (4096)));
-
-// TODO: Support f�r mehrere VM86-Tasks
-// Gibt evtl Probleme mit der Platzierung des Kernels.
-bool vm86_task_running = false;
-
-/**
- * Speichert BIOS-Daten, um sie den VM86-Tasks sp�ter bereitstellen zu k�nnen
- */
-void save_bios_data(void)
-{
-    memcpy(&bios_data, 0, 4096);
-}
-
-/**
- * Liefert ein Segment:Offset-Paar aus der IVT zur�ck
- *
- * @param interrupt Nummer des Interrupts
- *
- * @return Pointer auf Segment/Offset
- */
-uint16_t *get_ivt_entry(uint16_t interrupt)
-{
-    return bios_data.ivt[interrupt];
-}
-
-/**
- * Erstellt einen VM86-Task, der einen bestimmten RM-Interrupt aufruft
- *
- * @param interrupt Nummer des Interrupts
- * @param regs Struktur mit Registerinhalt (wird auch zur R�ckgabe der Ergebnisse
- * benutzt.
- * @param meminfo Daten �ber Speicherbereiche, die in den Task gemappt werden.
- * Die erste Zahl steht f�r die Anzahl der Eintr�ge, danach folgen je drei Zahlen
- * f�r Adresse im neuen Task, Adresse in aufrufenden Task und Gr��e.
- *
- * @return Taskstruktur des neuen Tasks oder Null bei Fehlern
- */
-
-struct task * create_vm86_task(uint16_t interrupt, vm86_regs_t *regs, uint32_t *meminfo, struct task *parent)
-{
-    // Nur einen VM86-Task starten
-    if (vm86_task_running) {
-        return 0;
-    }
-    vm86_task_running = true;
-    
-    struct task* new_task = malloc(sizeof(struct task));
-    new_task->pid = generate_pid();
-    
-    // Aufrufender Thread wird geblockt, damit sp�ter Ergebnisse zur�ckgegeben werden k�nnen
-    if (!block_task(parent, new_task->pid)) {
-        //puts("VM86: Konnte aufrufenden Task nicht blockieren!\n");
-        free(new_task);
-        return 0;
-    }
-
-    
-    new_task->rpcs = list_create();
-    new_task->io_bitmap = NULL;
-    new_task->status = TS_RUNNING;
-    new_task->shmids = list_create();
-    new_task->shmaddresses = list_create();
-    new_task->memory_used = 0;
-    // Neuer Task wird nicht geblockt, da er sofort ausgef�hrt werden kann und sollte
-    new_task->blocked_by_pid = 0;
-    new_task->blocked_count = 0;
-    // Info �ber Register/Speicher f�r R�ckgabe von Daten aufbewahren
-    new_task->vm86 = true;
-    new_task->vm86_info = malloc(sizeof(vm86_info_t));
-    new_task->vm86_info->regs = regs;
-    new_task->vm86_info->meminfo = meminfo;
-    //printf("Neuer vm86-Task mit PID %d\n", new_task->pid);
-    
-    // Name des Tasks setzen
-    new_task->cmdline = malloc(strlen("vm86") + 1);
-    memcpy((void*) (new_task->cmdline), "vm86", strlen("vm86") + 1);
-    
-    // Scheduling-Eigenschaften fuer den Task setzen
-    new_task->schedule_ticks_left = 0;
-    new_task->schedule_ticks_max = 50;
-    
-    // Haenge den Task an die Liste an
-    // TODO Trennen der Task-Liste von der Scheduling-Liste
-    new_task->next_task = first_task;
-    first_task = new_task;
-    if (parent->pid == 0) {
-        new_task->parent_task = current_task;
-    } else {
-        new_task->parent_task = get_task(parent->pid);
-    }
-    
-    // Neues Pagedirectory anlegen
-    // TODO: Die erste Pagetable sollte kopiert werden oder der Kernel etwas nach
-    // hinten verschoben werden.
-    paddr_t phys_pagedir = (paddr_t)phys_alloc_page();
-    page_directory_t pagedir = (page_directory_t) map_phys_addr(phys_pagedir, PAGE_SIZE);
-
-    memset((void*) pagedir, 0, PAGE_SIZE);
-    memcpy((void*) pagedir, kernel_page_directory, 1024);
-    new_task->cr3 = pagedir;
-    pagedir[0] |= 0x4;
-    
-    map_page_range(kernel_page_directory, (vaddr_t)0xC0000, (paddr_t)0xC0000, PTE_P | PTE_U, 0x40);
-    map_page_range(kernel_page_directory, (vaddr_t)0xA0000, (paddr_t)0xA0000, PTE_W | PTE_P | PTE_U, 0x10);
-    
-    
-    // Speicher fuer die Stacks allokieren
-    // Stack im PD des neuen Tasks mappen
-    paddr_t phys_kernel_stack = (paddr_t)phys_alloc_page();
-    paddr_t phys_user_stack = (paddr_t)phys_alloc_page();
-
-    // TODO: Dynamisch freien Speicher suchen, bin ich grad zu faul zu -.-
-    map_page(pagedir, (vaddr_t)0x90000, phys_user_stack, PTE_W | PTE_P | PTE_U);
-    new_task->user_stack_bottom = (vaddr_t) 0x90000;
-    
-    // Erste 4k mappen
-    uint32_t *page_table = (uint32_t*)find_contiguous_kernel_pages(1);
-    map_page(kernel_page_directory, page_table, (paddr_t)(pagedir[0] & ~0xFFF), PTE_P | PTE_W);
-    page_table[0] = (uint32_t)&bios_data | 0x7;
-    unmap_page(kernel_page_directory, page_table);
-    
-    // Gew�nschte Speicherbereiche reservieren
-    if (meminfo) {
-        uint32_t infosize = meminfo[0];
-        uint32_t i;
-        for (i = 0; i < infosize; i++) {
-            uint32_t addr = meminfo[1 + i * 3];
-            uint32_t src = meminfo[1 + i * 3 + 1];
-            uint32_t size = meminfo[1 + i * 3 + 2];
-            paddr_t phys_mem = (paddr_t)phys_alloc_page();
-            map_page(pagedir, (vaddr_t)(addr & ~0xFFF), phys_mem, PTE_W | PTE_P | PTE_U);
-            memcpy((void*)addr, (void*)src, size);
-        }
-    }
-    
-    // Userstack mit Nullen f�llen, um bei einem iret den Task zu beenden
-    uint32_t *user_stack = (uint32_t*)find_contiguous_kernel_pages(1);
-    map_page(kernel_page_directory, user_stack, phys_user_stack, PTE_P | PTE_W);
-    user_stack[1023] = 0x0;
-    user_stack[1022] = 0x0;
-    unmap_page(kernel_page_directory, user_stack);
-    
-    // Den Kernelstack mappen und initialisieren
-    // Der Stack wird von oben her beschrieben, daher 4K addieren 
-    // (1024 * sizeof(uint32_t))
-    uint32_t * kernel_stack = (uint32_t*)map_phys_addr(phys_kernel_stack, PAGE_SIZE);
-    kernel_stack += 1024;
-
-    *(--kernel_stack) = 0x00; // gs
-    *(--kernel_stack) = 0x00; // fs
-    *(--kernel_stack) = regs->es; // es
-    *(--kernel_stack) = regs->ds; // ds
-    *(--kernel_stack) = 0x9000; // ss
-    *(--kernel_stack) = 0 + 4096 - 6;
-    *(--kernel_stack) = 0x20202; // eflags = VM-Bit gesetzt, interrupts aktiviert und iopl = 0
-    *(--kernel_stack) = get_ivt_entry(interrupt)[1]; // cs
-    *(--kernel_stack) = get_ivt_entry(interrupt)[0]; // eip
-    //kprintf("Interrupt: %x/%x\n", get_ivt_entry(interrupt)[1], get_ivt_entry(interrupt)[0]);
-
-    *(--kernel_stack) = 0; // interrupt nummer
-    *(--kernel_stack) = 0; // error code
-
-    // general purpose registers
-    *(--kernel_stack) = regs->ax;
-    *(--kernel_stack) = regs->cx;
-    *(--kernel_stack) = regs->dx;
-    *(--kernel_stack) = regs->bx;
-    *(--kernel_stack) = 0;
-    *(--kernel_stack) = 0;
-    *(--kernel_stack) = regs->si;
-    *(--kernel_stack) = regs->di;
-
-    // segment registers
-    *(--kernel_stack) = 0x23;
-    *(--kernel_stack) = 0x23;
-    *(--kernel_stack) = 0x23;
-    *(--kernel_stack) = 0x23;
-    
-    new_task->esp = (uint32_t) kernel_stack;
-    new_task->kernel_stack = (uint32_t) kernel_stack;
-
-    num_tasks++;
-    
-    //puts("vm86-Task erstellt.\n");
-        
-    return new_task;
-
-}
-
-/**
- * Handler f�r Exceptions im VM86-Mode
- *
- * @param esp Pointer auf Stackpointer
- *
- * @return true, wenn die Exception verarbeitet wurde, false, wenn sie nicht
- * verarbeitet werden konnte und der Task beendet werden muss.
- */
-bool vm86_exception(uint32_t *esp)
-{
-    // TODO: Das hier ist noch lange nicht vollst�ndig
-    struct int_stack_frame *isf = *((struct int_stack_frame **)esp);
-    //puts("vm86 Exception.\n");
-    if (isf->interrupt_number == 13) {
-        // GPF, wurde vermutlich durch einen nicht erlaubten Befehl verursacht
-        uint8_t *ops = (uint8_t*)(isf->eip + (isf->cs << 4));
-        if (ops[0] == 0xCD) { // int
-            //kprintf("VM86: int 0x%x\n", ops[1]);
-            // Derzeitige Adresse auf den Stack pushen und neue Codeadresse setzen
-            uint16_t intno = ops[1];
-            isf->esp -= 6;
-            ((uint16_t*)(isf->esp + (isf->ss << 4)))[0] = (uint16_t)isf->eflags;
-            ((uint16_t*)(isf->esp + (isf->ss << 4)))[1] = (uint16_t)isf->cs;
-            ((uint16_t*)(isf->esp + (isf->ss << 4)))[2] = (uint16_t)isf->eip + 2;
-            isf->eip = bios_data.ivt[intno][0];
-            isf->cs = bios_data.ivt[intno][1];
-            return true;
-        } else if (ops[0] == 0xCF) { // iret
-            //puts("VM86: iret.\n");
-            // Alte Adresse von Stack holen
-            isf->eip = ((uint16_t*)(isf->esp + (isf->ss << 4)))[2];
-            isf->cs = ((uint16_t*)(isf->esp + (isf->ss << 4)))[1];
-            isf->esp += 6;
-            // Abbrechen, wenn wir das letzte iret erreicht haben
-            if ((isf->eip == 0) && (isf->cs == 0)) {
-                //puts("Breche VM86-Task ab.\n");
-                struct task *task = current_task;
-                vm86_info_t *info = task->vm86_info;
-                // Speicher kopieren
-                if (info->meminfo) {
-                    paddr_t phys_meminfo = resolve_vaddr(task->parent_task->cr3, (uint32_t*)((uint32_t)info->meminfo & ~0xFFF));
-                    uint32_t *meminfo = (uint32_t*)find_contiguous_kernel_pages(1);
-                    map_page(kernel_page_directory, meminfo, phys_meminfo, PTE_P | PTE_W);
-                    meminfo = (uint32_t*)(((uint32_t)meminfo) + ((uint32_t)info->meminfo & 0xFFF));
-                    uint32_t i;
-                    for (i = 0; i < meminfo[0]; i++) {
-                        paddr_t phys_mem = resolve_vaddr(task->parent_task->cr3, (uint32_t*)((uint32_t)meminfo[1 + i * 3 + 1] & ~0xFFF));
-                        uint32_t *mem = (uint32_t*)find_contiguous_kernel_pages(1);
-                        map_page(kernel_page_directory, mem, phys_mem, PTE_P | PTE_W);
-                        memcpy((void*)((uint32_t)mem + (meminfo[1 + i * 3 + 1] & 0xFFF)), (void*)meminfo[1 + i * 3], meminfo[1 + i * 3 + 2]);
-                        unmap_page(kernel_page_directory, mem);
-                        unmap_page(kernel_page_directory, (uint32_t*)((uint32_t)meminfo[1 + i * 3] & ~0xFFF));
-                    }
-                    unmap_page(kernel_page_directory, (uint32_t*)((uint32_t)meminfo & ~0xFFF));
-                }
-                // Register speichern
-                paddr_t phys_regs = resolve_vaddr(task->parent_task->cr3, (uint32_t*)((uint32_t)info->regs & ~0xFFF));
-                uint32_t regs = (uint32_t) map_phys_addr(phys_regs, PAGE_SIZE);
-                vm86_regs_t * vm86_regs = (vm86_regs_t *)(regs + ((uint32_t)info->regs & 0xFFF));
-                vm86_regs->ax = isf->eax;
-                vm86_regs->bx = isf->ebx;
-                vm86_regs->cx = isf->ecx;
-                vm86_regs->dx = isf->edx;
-                vm86_regs->si = isf->esi;
-                vm86_regs->di = isf->edi;
-                vm86_regs->ds = ((uint32_t*)(isf + 1))[0];
-                vm86_regs->es = ((uint32_t*)(isf + 1))[1];
-                free_phys_addr((vaddr_t) regs, PAGE_SIZE);
-                // Speicher freigeben
-                // - Stack
-                unmap_page(task->cr3, (vaddr_t)0x90000);
-                // - BIOS-Daten
-                uint32_t *page_table = (uint32_t*)find_contiguous_kernel_pages(1);
-                map_page(kernel_page_directory, page_table, (((uint32_t*)task->cr3)[0] & ~0xFFF), PTE_P | PTE_W);
-                page_table[0] = 0;
-                unmap_page(kernel_page_directory, page_table);
-                // - BIOS
-                uint32_t i;
-                for (i = 0; i < 0x40; i++) {
-                    unmap_page(task->cr3, (uint32_t*)(0xC0000 + i * 0x1000));
-                }
-                // - VGA
-                for (i = 0; i < 0x10; i++) {
-                    unmap_page(task->cr3, (uint32_t*)(0xA0000 + i * 0x1000));
-                }
-                // Task beenden
-                if (!unblock_task(task->parent_task, task->pid)) {
-                    panic("VM86: Konnte aufrufenden Task nicht wecken!");
-                }
-                schedule(esp);
-                destroy_task(task);
-                vm86_task_running = false;
-                return true;
-            }
-            return true;
-        } else if (ops[0] == 0x9C) { // pushf
-            // EFLAGS speichern
-            isf->esp -= 2;
-            ((uint16_t*)(isf->esp + (isf->ss << 4)))[0] = (uint16_t)isf->eflags;
-            isf->eip++;
-            return true;
-        } else if (ops[0] == 0x9D) { // popf
-            // So tun, als w�rden wir die EFLAGS wiederherstellen.
-            // Das hier ist wohl alles andere als korrekt, aber funzt erstmal.
-            isf->esp += 2;
-            isf->eip++;
-            return true;
-        } else if (ops[0] == 0xEF) { // outw
-            outw(isf->edx, isf->eax);
-            isf->eip++;
-            return true;
-        } else if (ops[0] == 0xEE) { // outb
-            outb(isf->edx, isf->eax);
-            isf->eip++;
-            return true;
-        } else if (ops[0] == 0xED) { // inw
-            isf->eax = inb(isf->edx);
-            isf->eip++;
-            return true;
-        } else if (ops[0] == 0xEC) { // inb
-            isf->eax = (isf->eax & 0xFF00) + inb(isf->edx);
-            isf->eip++;
-            return true;
-        } else if (ops[0] == 0xFA) { // sti
-            isf->eip++;
-            return true;
-        } else if (ops[0] == 0xFB) { // cli
-            isf->eip++;
-            return true;
-        } else if (ops[0] == 0x66) { // o32
-            // TODO
-            isf->eip++;
-            return true;
-        } else if (ops[0] == 0x67) { // a32
-            // TODO
-            isf->eip++;
-            return true;
-        } else {
-            abort_task("VM86: Unbekannter Opcode: %x\n", ops[0]);
-            return false;
-        }
-    } else {
-        return false;
-    }
-}
-
-- 
2.24.1