summaryrefslogtreecommitdiff
path: root/Kernel/kmalloc.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-11-17 00:11:08 +0100
committerAndreas Kling <awesomekling@gmail.com>2018-11-17 00:14:07 +0100
commit9d05f6b7a797ed3424bc5d0024d21e496bb4c87b (patch)
tree03369d115ecb7e6dce30a98091cb56172e9be31a /Kernel/kmalloc.cpp
parent2cf477a1512a1ca3f0571cb6de42b7a89a3a4565 (diff)
downloadserenity-9d05f6b7a797ed3424bc5d0024d21e496bb4c87b.zip
Make bash-2.05b build with minimal changes.
This is really neat. :^)
Diffstat (limited to 'Kernel/kmalloc.cpp')
-rw-r--r--Kernel/kmalloc.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/Kernel/kmalloc.cpp b/Kernel/kmalloc.cpp
index e946920818..3ae0060594 100644
--- a/Kernel/kmalloc.cpp
+++ b/Kernel/kmalloc.cpp
@@ -14,8 +14,8 @@
typedef struct
{
- DWORD start;
- DWORD nchunk;
+ dword start;
+ dword nchunk;
} PACKED allocation_t;
#define CHUNK_SIZE 128
@@ -29,8 +29,8 @@ typedef struct
static byte alloc_map[POOL_SIZE / CHUNK_SIZE / 8];
-volatile DWORD sum_alloc = 0;
-volatile DWORD sum_free = POOL_SIZE;
+volatile dword sum_alloc = 0;
+volatile dword sum_free = POOL_SIZE;
volatile size_t kmalloc_sum_eternal = 0;
volatile size_t kmalloc_sum_page_aligned = 0;
@@ -90,9 +90,9 @@ void* kmalloc(dword size)
{
InterruptDisabler disabler;
- DWORD chunks_needed, chunks_here, first_chunk;
- DWORD real_size;
- DWORD i, j, k;
+ dword chunks_needed, chunks_here, first_chunk;
+ dword real_size;
+ dword i, j, k;
/* We need space for the allocation_t structure at the head of the block. */
real_size = size + sizeof(allocation_t);
@@ -133,7 +133,7 @@ void* kmalloc(dword size)
if( chunks_here == chunks_needed )
{
auto* a = (allocation_t *)(BASE_PHYS + (first_chunk * CHUNK_SIZE));
- BYTE *ptr = (BYTE *)a;
+ byte *ptr = (byte *)a;
ptr += sizeof(allocation_t);
a->nchunk = chunks_needed;
a->start = first_chunk;
@@ -172,16 +172,16 @@ void kfree(void *ptr)
InterruptDisabler disabler;
- allocation_t *a = (allocation_t *)((((BYTE *)ptr) - sizeof(allocation_t)));
+ allocation_t *a = (allocation_t *)((((byte *)ptr) - sizeof(allocation_t)));
#if 0
- DWORD hdr = (DWORD)a;
- DWORD mhdr = hdr & ~0x7;
+ dword hdr = (dword)a;
+ dword mhdr = hdr & ~0x7;
kprintf("hdr / mhdr %p / %p\n", hdr, mhdr);
ASSERT(hdr == mhdr);
#endif
- for (DWORD k = a->start; k < (a->start + a->nchunk); ++k) {
+ for (dword k = a->start; k < (a->start + a->nchunk); ++k) {
alloc_map[k / 8] &= ~(1 << (k % 8));
}