36,9 → 36,9 |
#include <stdio.h> |
#include <stdlib.h> |
#include <string.h> |
#include <sys/ksys.h> |
|
|
|
struct malloc_chunk { |
size_t prev_foot; /* Size of previous chunk (if free). */ |
size_t head; /* Size and inuse bits. */ |
60,34 → 60,9 |
/* The maximum possible size_t value has all bits set */ |
#define MAX_SIZE_T (~(size_t)0) |
|
void *user_alloc(size_t size) |
{ |
void *val; |
#define user_alloc(s) _ksys_alloc(s) |
#define user_free _ksys_free |
|
// __asm__("int3"); |
|
__asm__ __volatile__( |
"int $0x40" |
:"=a"(val) |
:"a"(68),"b"(12),"c"(size)); |
return val; |
} |
|
static inline |
int user_free(void *mem) |
{ |
int val; |
|
// __asm__("int3"); |
|
__asm__ __volatile__( |
"int $0x40" |
:"=a"(val) |
:"a"(68),"b"(13),"c"(mem)); |
return val; |
} |
|
|
/* ------------------- size_t and alignment properties -------------------- */ |
|
/* The byte and bit size of a size_t */ |