1234567891011121314151617181920212223242526272829303132333435 |
- /*
- Simple malloc function. 2013.09.01, Gaia
- */
- #include <Asmdef.h>
- #include <rom_def.h>
- #include <stdio.h>
- #include <asm/types.h>
- struct slob_block {
- int units;
- struct slob_block *next;
- #if PATCH_CACHE_LINE_ALIGNMENT //dual cpu cache wb issue, fix 4k alignment
- #if (CONFIG_DRAMSIZE == 64)
- int stuff[254]; //2014.01.24, 1k alignment for 64M tight memory
- #else
- int stuff[1022];
- #endif
- #endif
- };
- typedef struct slob_block slob_t;
- #define SLOB_UNIT sizeof(slob_t)
- #define SLOB_UNITS(size) (((size) + SLOB_UNIT - 1)/SLOB_UNIT)
- extern void slob_free(const void *block, int size);
- #define free(block) slob_free(block, 0)
- extern void *smalloc(size_t size, int align);
- #define malloc(size) smalloc(size, 0)
- #define memalign(align, size) smalloc(size, align)
- #define uncached(addr) (void *)(((u32)addr & 0x1ffffff)|0xa0000000)
|