diff options
author | Alexis211 <alexis211@gmail.com> | 2009-10-20 19:23:33 +0200 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2009-10-20 19:23:33 +0200 |
commit | 768ada13917aeda373e6ff5fee21faf90c963746 (patch) | |
tree | 9e26d7d65e1693d1a7f9fd93c9fd33b41d175464 /Source/Kernel/Core | |
parent | 6ec4b3d31080f90393e72989d559cfb76eff6f9d (diff) | |
parent | 9836acd720988af30250c2c1ec18d618664dea4e (diff) | |
download | Melon-768ada13917aeda373e6ff5fee21faf90c963746.tar.gz Melon-768ada13917aeda373e6ff5fee21faf90c963746.zip |
Merge branch 'usermode_syscalls'
Conflicts:
Source/Kernel/Makefile
Diffstat (limited to 'Source/Kernel/Core')
-rw-r--r-- | Source/Kernel/Core/CMem.ns.cpp | 35 | ||||
-rw-r--r-- | Source/Kernel/Core/CMem.ns.h | 17 | ||||
-rw-r--r-- | Source/Kernel/Core/Sys.ns.cpp | 11 | ||||
-rw-r--r-- | Source/Kernel/Core/common.wtf.h | 28 | ||||
-rw-r--r-- | Source/Kernel/Core/cppsupport.wtf.cpp | 2 | ||||
-rw-r--r-- | Source/Kernel/Core/kmain.wtf.cpp | 8 | ||||
-rw-r--r-- | Source/Kernel/Core/types.wtf.h | 19 |
7 files changed, 14 insertions, 106 deletions
diff --git a/Source/Kernel/Core/CMem.ns.cpp b/Source/Kernel/Core/CMem.ns.cpp deleted file mode 100644 index c2129ec..0000000 --- a/Source/Kernel/Core/CMem.ns.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include <Core/common.wtf.h> - -namespace CMem { - -//Standard C functions -u8int *memcpy(u8int *dest, const u8int *src, int count) { - for (int i = 0; i < count; i++) { - dest[i] = src[i]; - } - return dest; -} - -u8int *memset(u8int *dest, u8int val, int count) { - for (int i = 0; i < count; i++) { - dest[i] = val; - } - return dest; -} - -u16int *memsetw(u16int *dest, u16int val, int count) { - for (int i = 0; i < count; i++) { - dest[i] = val; - } - return dest; -} - -u32int strlen(const char *str) { - u32int i = 0; - while (str[i]) { - i++; - } - return i; -} - -} diff --git a/Source/Kernel/Core/CMem.ns.h b/Source/Kernel/Core/CMem.ns.h deleted file mode 100644 index f0c15da..0000000 --- a/Source/Kernel/Core/CMem.ns.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifdef DEF_COMMON - -#ifndef DEF_CMEM_NS_H -#define DEF_CMEM_NS_H - -//This namespace contains basic memory managment functions - -namespace CMem { - u8int *memcpy(u8int *dest, const u8int *src, int count); - u8int *memset(u8int *dest, u8int val, int count); - u16int *memsetw(u16int *dest, u16int val, int count); - u32int strlen(const char *str); -} - -#endif - -#endif diff --git a/Source/Kernel/Core/Sys.ns.cpp b/Source/Kernel/Core/Sys.ns.cpp index c0218d8..c99544b 100644 --- a/Source/Kernel/Core/Sys.ns.cpp +++ b/Source/Kernel/Core/Sys.ns.cpp @@ -1,5 +1,5 @@ //This automatically includes Sys.ns.h -#include <Core/common.wtf.h> +#include <common.h> #include <Core/Log.ns.h> #include <VTManager/SimpleVT.class.h> #include <SyscallManager/IDT.ns.h> @@ -93,7 +93,14 @@ void panic(char *message, registers_t *regs, char *file, u32int line) { vt << "eax=" << (u32int)regs->eax << ", ebx=" << (u32int)regs->ebx << ", ecx=" << (u32int)regs->ecx << ", edx=" << (u32int)regs->edx << "\n"; vt << "int_no=" << (s32int)regs->int_no << ", err_code=" << (u32int)regs->err_code << "\n"; - vt << "eflags=" << (u32int)regs->eflags << ", useresp=" << (u32int)regs->useresp << ", ss=" << (u32int)regs->ss << "\n\n"; + vt << "eflags=" << (u32int)regs->eflags << ", useresp=" << (u32int)regs->useresp << ", ss=" << (u32int)regs->ss << "\n"; + if (regs->int_no == 14) { + u32int cr2; + asm volatile("mov %%cr2, %0" : "=r"(cr2)); + vt << "cr2=" << (u32int)cr2 << "\n"; + } + vt << "\n"; + while (1) asm volatile("cli; hlt"); u32int *v = (u32int*)regs->ebp; diff --git a/Source/Kernel/Core/common.wtf.h b/Source/Kernel/Core/common.wtf.h deleted file mode 100644 index 5fb67b4..0000000 --- a/Source/Kernel/Core/common.wtf.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef DEF_COMMON -#define DEF_COMMON - -#include <Config.h> - -//This file is very important : it contains type definitions, macro definitions and new/delete implementations. - -#define NULL 0 - -#include <Core/types.wtf.h> - -#include <Core/CMem.ns.h> -#include <Core/Sys.ns.h> - -#include <MemoryManager/Mem.ns.h> - -//Standard implemenations of operator new/delete -inline void* operator new(u32int, void *p) { return p; } -inline void* operator new[](u32int, void *p) { return p; } -inline void operator delete(void*, void*) { } -inline void operator delete[](void*, void*) { } - -inline void* operator new(u32int sz) { return Mem::kalloc(sz); } -inline void* operator new[](u32int sz) { return Mem::kalloc(sz); } -inline void operator delete(void *ptr) { Mem::kfree(ptr); } -inline void operator delete[](void *ptr) { Mem::kfree(ptr); } - -#endif diff --git a/Source/Kernel/Core/cppsupport.wtf.cpp b/Source/Kernel/Core/cppsupport.wtf.cpp index bad28f2..2cefc39 100644 --- a/Source/Kernel/Core/cppsupport.wtf.cpp +++ b/Source/Kernel/Core/cppsupport.wtf.cpp @@ -1,5 +1,5 @@ //This file just contains a few methods required for some C++ things to work -#include <Core/types.wtf.h> +#include <types.h> extern "C" void __cxa_pure_virtual() {} //Required when using abstract classes diff --git a/Source/Kernel/Core/kmain.wtf.cpp b/Source/Kernel/Core/kmain.wtf.cpp index c7b47e1..a8fb002 100644 --- a/Source/Kernel/Core/kmain.wtf.cpp +++ b/Source/Kernel/Core/kmain.wtf.cpp @@ -1,6 +1,6 @@ //This file contains the kernel's main procedure -#include <Core/common.wtf.h> +#include <common.h> #include <Core/multiboot.wtf.h> #include <Devices/Display/VGATextOutput.class.h> @@ -18,8 +18,8 @@ #include <MemoryManager/GDT.ns.h> #include <TaskManager/Task.ns.h> #include <SyscallManager/IDT.ns.h> -#include <Library/String.class.h> -#include <Library/ByteArray.class.h> +#include <String.class.h> +#include <ByteArray.class.h> #include <VFS/Part.ns.h> #include <FileSystems/RamFS/RamFS.class.h> #include <VFS/FileNode.class.h> @@ -169,7 +169,7 @@ void kmain(multiboot_info_t* mbd, u32int magic) { new KernelShell(cwd); //No need to save that in a var, it is automatically destroyed anyways Log::log(KL_STATUS, "kmain : Kernel shell launched"); - kvt->unmap(); + //kvt->unmap(); while (KernelShell::getInstances() > 0) { Task::currThread()->sleep(100); diff --git a/Source/Kernel/Core/types.wtf.h b/Source/Kernel/Core/types.wtf.h deleted file mode 100644 index ca6f73d..0000000 --- a/Source/Kernel/Core/types.wtf.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef DEF_TYPES_WTF_H -#define DEF_TYPES_WTF_H - -//This file defines base types. It's made to be used also by C programs - -typedef unsigned int addr_t; -typedef unsigned long long u64int; -typedef unsigned int u32int; -typedef unsigned short u16int; -typedef unsigned char u8int; -typedef long long s64int; -typedef int s32int; -typedef short s16int; -typedef char s8int; - -#define U64 unsigned long long -#define S64 long long - -#endif |