return NULL;
/* Add the obligatory arena header, and round up */
- size = (size+2*sizeof(struct arena_header)-1) & ARENA_SIZE_MASK;
+ size = (size+2*sizeof(struct arena_header)-1) & ~ARENA_SIZE_MASK;
for ( fp = __malloc_head.next_free ; fp->a.type != ARENA_TYPE_HEAD ;
fp = fp->next_free ) {
#define ARENA_TYPE_HEAD 2
#endif
-#define ARENA_SIZE_MASK (~(sizeof(struct arena_header)-1))
+#define ARENA_SIZE_MASK (sizeof(struct arena_header)-1)
-#define ARENA_ALIGN_UP(p) ((char *)(((uintptr_t)(p) + ARENA_SIZE_MASK) & ARENA_SIZE_MASK))
-#define ARENA_ALIGN_DOWN(p) ((char *)((uintptr_t)(p) & ARENA_SIZE_MASK))
+#define ARENA_ALIGN_UP(p) ((char *)(((uintptr_t)(p) + ARENA_SIZE_MASK) & ~ARENA_SIZE_MASK))
+#define ARENA_ALIGN_DOWN(p) ((char *)((uintptr_t)(p) & ~ARENA_SIZE_MASK))
/*
* This structure should be no more than twice the size of the
INCDIR = /usr/include
COM32DIR = $(AUXDIR)/com32
-MODULES = chain.c32
+MODULES = chain.c32 menu.c32 menu.lnx
all: $(MODULES)
static inline size_t sp(void)
{
- uint16_t sp;
- asm volatile("movw %%sp,%0" : "=rm" (sp));
+ uint32_t sp;
+ asm volatile("movl %%esp,%0" : "=rm" (sp));
return sp;
}
return NULL;
/* Add the obligatory arena header, and round up */
- size = (size+2*sizeof(struct arena_header)-1) & ARENA_SIZE_MASK;
+ size = (size+2*sizeof(struct arena_header)-1) & ~ARENA_SIZE_MASK;
for ( fp = __malloc_head.next_free ; fp->a.type != ARENA_TYPE_HEAD ;
fp = fp->next_free ) {
#define ARENA_TYPE_HEAD 2
#endif
-#define ARENA_SIZE_MASK (~(sizeof(struct arena_header)-1))
+#define ARENA_SIZE_MASK (sizeof(struct arena_header)-1)
-#define ARENA_ALIGN_UP(p) ((char *)(((uintptr_t)(p) + ARENA_SIZE_MASK) & ARENA_SIZE_MASK))
-#define ARENA_ALIGN_DOWN(p) ((char *)((uintptr_t)(p) & ARENA_SIZE_MASK))
+#define ARENA_ALIGN_UP(p) ((char *)(((uintptr_t)(p) + ARENA_SIZE_MASK) & ~ARENA_SIZE_MASK))
+#define ARENA_ALIGN_DOWN(p) ((char *)((uintptr_t)(p) & ~ARENA_SIZE_MASK))
/*
* This structure should be no more than twice the size of the