diff options
Diffstat (limited to 'src/memory.h')
-rw-r--r-- | src/memory.h | 45 |
1 files changed, 1 insertions, 44 deletions
diff --git a/src/memory.h b/src/memory.h index f780034..30cce75 100644 --- a/src/memory.h +++ b/src/memory.h @@ -4,52 +4,9 @@ #include <stdint.h> #include "multiboot.h" -enum cell_type { - FREE_CELL, - CONS_CELL, - INT_CELL, - BIGINT_CELL, - CHAR_CELL, - FLOAT_CELL, - VIRTUAL_CELL, - SYMBOL_CELL, - ARRAY_CELL, - ARRAY_MEMBER, - SYS_ARRAY, - APIOFORM -}; - -struct cell { - int car : 29; - int cdr : 29; - int type : 4; - int gc_mark : 1; -} __attribute((packed)); - uint32_t memory_available; +uint32_t total_memory; void init_memory(multiboot_info_t *mb); -struct cell *alloc_cell(enum cell_type t); -enum cell_type get_cell_type(const struct cell *c); -void set_cell_type(struct cell *c, enum cell_type t); - -static inline uint32_t car(struct cell *c) { - return c->car << 3; -} -static inline uint32_t cdr(struct cell *c) { - return c->cdr << 3; -} -static inline struct cell *car_cell(struct cell *c) { - return (struct cell *) car(c); -} -static inline struct cell *cdr_cell(struct cell *c) { - return (struct cell *) cdr(c); -} -static inline void set_car(struct cell *c, uint32_t val) { - c->car = val >> 3; -} -static inline void set_cdr(struct cell *c, uint32_t val) { - c->cdr = val >> 3; -} #endif |