diff options
author | Alexis211 <alexis211@gmail.com> | 2009-10-26 14:56:28 +0100 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2009-10-26 14:56:28 +0100 |
commit | 4cab9cdad95aba4934b22872c94e44fab759250c (patch) | |
tree | b45cf1ba9b196c41b7580ded72a8cbc6a6fd7764 | |
parent | d68a064819deaaa8e01eca3c7809050b25cedfbd (diff) | |
download | Melon-4cab9cdad95aba4934b22872c94e44fab759250c.tar.gz Melon-4cab9cdad95aba4934b22872c94e44fab759250c.zip |
Some changes...
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | Source/Kernel/MemoryManager/Mem.ns.cpp | 8 | ||||
-rw-r--r-- | Source/Kernel/MemoryManager/Mem.ns.h | 6 | ||||
-rw-r--r-- | Source/Library/Common/Heap.class.cpp | 2 | ||||
-rw-r--r-- | Source/Library/Common/Heap.class.h | 6 | ||||
-rw-r--r-- | Source/Library/Common/types.h | 2 | ||||
-rw-r--r-- | Source/Library/Userland/Start.cpp | 4 | ||||
-rw-r--r-- | Source/Library/Userland/common.h | 4 |
8 files changed, 18 insertions, 16 deletions
@@ -1,6 +1,7 @@ Welcome ! It seems you are intrested in my Melon OS... ** HOW TO BUILD MELON : ** +This is supposed to work in a Linux environment. Maybee it could work on *BSD, or Cygwin, but that wasn't tested. If you haven't yet downloaded the source code, then commit the GIT repository : $ git clone git://github.com/Alexis211/Melon.git @@ -11,6 +12,7 @@ $ make Create the floppy image : $ make floppy +You will probably be prompted for your password. We need it to mount the floppy image as a loopback device. And run it with Qemu : $ make qemu diff --git a/Source/Kernel/MemoryManager/Mem.ns.cpp b/Source/Kernel/MemoryManager/Mem.ns.cpp index 144b9f3..a0809b0 100644 --- a/Source/Kernel/MemoryManager/Mem.ns.cpp +++ b/Source/Kernel/MemoryManager/Mem.ns.cpp @@ -6,12 +6,12 @@ namespace Mem { bool pagingEnabled = false; -u32int placementAddress; +size_t placementAddress; Heap kheap; //Placement malloc, used while heap is not initialized -void *kallocInternal(u32int sz, bool align) { +void *kallocInternal(size_t sz, bool align) { if (kheap.usable()) return 0; if (align && (placementAddress & 0xFFFFF000)) { placementAddress &= 0xFFFFF000; @@ -40,7 +40,7 @@ void createHeap() { kheap.create(heapStart, heapSize, heapIndexSize, kernelPageDirectory, false, false); } -void *alloc(u32int sz, bool align) { +void *alloc(size_t sz, bool align) { if (!kheap.usable()) return kallocInternal(sz, align); if (align) return 0; @@ -51,7 +51,7 @@ void free(void *ptr) { kheap.free(ptr); } -void* mkXchgSpace(u32int sz) { +void* mkXchgSpace(size_t sz) { return Task::currThread()->mkXchgSpace(sz); } diff --git a/Source/Kernel/MemoryManager/Mem.ns.h b/Source/Kernel/MemoryManager/Mem.ns.h index b06ab79..f6094cc 100644 --- a/Source/Kernel/MemoryManager/Mem.ns.h +++ b/Source/Kernel/MemoryManager/Mem.ns.h @@ -5,13 +5,13 @@ namespace Mem { extern bool pagingEnabled; - extern u32int placementAddress; + extern size_t placementAddress; void createHeap(); - void *alloc(u32int sz, bool align = false); + void *alloc(size_t sz, bool align = false); void free(void *ptr); - void* mkXchgSpace(u32int sz); //This creates a space between userland and kernel land where data can be exchanged + void* mkXchgSpace(size_t sz); //This creates a space between userland and kernel land where data can be exchanged u32int kheapSize(), kheapFree(); } diff --git a/Source/Library/Common/Heap.class.cpp b/Source/Library/Common/Heap.class.cpp index 34e4dc4..45a3669 100644 --- a/Source/Library/Common/Heap.class.cpp +++ b/Source/Library/Common/Heap.class.cpp @@ -137,7 +137,7 @@ void Heap::contract() { //Automatically work out how much we can contract m_end = newEnd; } -void *Heap::alloc(u32int sz, bool no_expand) { +void *Heap::alloc(size_t sz, bool no_expand) { m_mutex.waitLock(); u32int newsize = sz + sizeof(heap_header_t) + sizeof(heap_footer_t); diff --git a/Source/Library/Common/Heap.class.h b/Source/Library/Common/Heap.class.h index f5895c7..131aef3 100644 --- a/Source/Library/Common/Heap.class.h +++ b/Source/Library/Common/Heap.class.h @@ -12,7 +12,7 @@ struct heap_header_t { u32int magic; bool is_hole; - u32int size; + size_t size; }; struct heap_footer_t { @@ -22,7 +22,7 @@ struct heap_footer_t { struct heap_index_t { heap_header_t **data; - u32int size; + size_t size; }; #ifdef THIS_IS_MELON_KERNEL @@ -63,7 +63,7 @@ class Heap { void create(u32int start, u32int size, u32int idxsize); #endif - void* alloc(u32int sz, bool no_expand = false); + void* alloc(size_t sz, bool no_expand = false); void free(void* ptr); bool usable() { diff --git a/Source/Library/Common/types.h b/Source/Library/Common/types.h index de3be24..843a8ca 100644 --- a/Source/Library/Common/types.h +++ b/Source/Library/Common/types.h @@ -12,7 +12,7 @@ typedef long long s64int; typedef int s32int; typedef short s16int; typedef char s8int; -typedef unsigned long size_t; +typedef unsigned int size_t; #define U64 unsigned long long #define S64 long long diff --git a/Source/Library/Userland/Start.cpp b/Source/Library/Userland/Start.cpp index 930c4dd..4c5c559 100644 --- a/Source/Library/Userland/Start.cpp +++ b/Source/Library/Userland/Start.cpp @@ -47,7 +47,7 @@ extern "C" void start() { } namespace Mem { - void* alloc (u32int sz) { return heap.alloc(sz); } + void* alloc (size_t sz) { return heap.alloc(sz); } void free(void* ptr) { heap.free(ptr); } - void* mkXchgSpace (u32int sz) { return alloc(sz); } + void* mkXchgSpace (size_t sz) { return alloc(sz); } } diff --git a/Source/Library/Userland/common.h b/Source/Library/Userland/common.h index 679afd0..5569009 100644 --- a/Source/Library/Userland/common.h +++ b/Source/Library/Userland/common.h @@ -8,9 +8,9 @@ #include <CMem.ns.h> namespace Mem { - void* alloc(u32int); + void* alloc(size_t); void free(void*); - void* mkXchgSpace(u32int sz); + void* mkXchgSpace(size_t sz); } //Standard implemenations of operator new/delete |