Pointer type

pull/38/head
E. Almqvist 3 years ago
parent f9a48a35df
commit dd4e773b81
  1. 8
      kernel/memory.c
  2. 4
      kernel/memory.h
  3. 1
      lib/types.h

@ -15,7 +15,7 @@
#define CHECK_BITMAP(map, idx) ((map) & (1<<(idx)))
#define BLOCK_TO_MEMP(idx) (int*)(PM_MEM_START + (idx*BLOCK_SIZE))
#define BLOCK_TO_MEMP(idx) (pointer)(PM_MEM_START + (idx*BLOCK_SIZE))
static int bitmap = 0;
@ -30,7 +30,7 @@ void mod_bitmap(uint bit, uint bflag) {
}
int* block_alloc(uint blockidx) {
pointer block_alloc(uint blockidx) {
int block_bflag;
block_bflag = CHECK_BITMAP(bitmap, blockidx);
@ -40,7 +40,7 @@ int* block_alloc(uint blockidx) {
mod_bitmap(blockidx, 1);
last_block = blockidx;
return BLOCK_TO_MEMP(blockidx); // placeholder
return BLOCK_TO_MEMP(blockidx);
} else {
println("ERROR! Attemped to allocate non-free block.", 0x0c);
@ -64,7 +64,7 @@ void pm_alloc_range(uint start, uint end, bool force) {
}
/*
int* pm_malloc(uint block_count) {
pointer pm_malloc(uint block_count) {
}
*/

@ -13,10 +13,10 @@
void mod_bitmap(uint bit, uint flag);
int* block_alloc(uint blockidx); // allocate a block
pointer block_alloc(uint blockidx); // allocate a block
void block_free(uint blockidx); // free a block
void pm_alloc_range(uint start, uint end, bool force); // allocate a range of memory
int* pm_malloc(uint block_count); // allocate some blocks
pointer pm_malloc(uint block_count); // allocate some blocks
void pm_free(int* p); // free a var (if allocated with pm_malloc)

@ -1,4 +1,5 @@
typedef unsigned int uint;
typedef unsigned long* pointer;
typedef int bool;
#define true 1
#define false 0

Loading…
Cancel
Save