Nugget
|
#include "psyqo/alloc.h"
#include <stddef.h>
#include <stdint.h>
#include "common/hardware/pcsxhw.h"
#include "psyqo/xprintf.h"
Classes | |
struct | empty_block_ |
struct | allocated_block_ |
Macros | |
#define | ALIGN_MASK ((2 * sizeof(void *)) - 1) |
#define | ALIGN_TO(x) (((uintptr_t)(x) + ALIGN_MASK) & ~ALIGN_MASK) |
#define | dprintf(...) |
#define | print_block(x) |
#define | check_integrity() |
Typedefs | |
typedef struct empty_block_ | empty_block |
typedef struct allocated_block_ | allocated_block |
Functions | |
void * | psyqo_malloc (size_t size_) |
Allocates memory from the heap. | |
void | psyqo_free (void *ptr_) |
Frees memory from the heap. | |
void * | psyqo_realloc (void *ptr_, size_t size_) |
Re-allocates memory from the heap. | |
void * | __builtin_new (size_t size) |
void | __builtin_delete (void *ptr) |
void * | _Znwj (unsigned int size) |
void * | _Znaj (unsigned int size) |
void | _ZdlPv (void *ptr) |
void | _ZdaPv (void *ptr) |
void | _ZdlPvj (void *ptr, unsigned int size) |
void | _ZdaPvj (void *ptr, unsigned int size) |
void * | psyqo_heap_start () |
Returns the pointer to the beginning of the heap. | |
void * | psyqo_heap_end () |
Returns the pointer to the end of the heap. | |
Variables | |
char | __heap_start |
char | __stack_start |
#define ALIGN_MASK ((2 * sizeof(void *)) - 1) |
#define ALIGN_TO | ( | x | ) | (((uintptr_t)(x) + ALIGN_MASK) & ~ALIGN_MASK) |
#define check_integrity | ( | ) |
#define dprintf | ( | ... | ) |
#define print_block | ( | x | ) |
typedef struct allocated_block_ allocated_block |
typedef struct empty_block_ empty_block |
void * __builtin_new | ( | size_t | size | ) |
Frees memory from the heap.
This function behaves as you'd expect from typical free. Calling this function with a NULL pointer is a no-op.
ptr | The pointer to the memory to free. |
void * psyqo_heap_end | ( | ) |
Returns the pointer to the end of the heap.
This function will return the pointer to the end of the heap. The heap works lazily, and this function may return a NULL pointer. Once it returns a non-NULL pointer, it will approximately correspond to the current end of the heap. The heap may actually be larger than this pointer on occasion. The heap will always grow, and never shrink.
void * psyqo_heap_start | ( | ) |
Returns the pointer to the beginning of the heap.
This function will return the pointer to the beginning of the heap. The heap works lazily, and this function may return a NULL pointer, but once it returns a non-NULL pointer, it will always return the same pointer.
void * psyqo_malloc | ( | size_t | size | ) |
Allocates memory from the heap.
This function behaves as you'd expect from typical malloc. Allocating 0 bytes will return a valid pointer, which can be freed. Guarantees to align the memory to 8 bytes.
size | The amount of bytes to allocate. |
Re-allocates memory from the heap.
This function behaves as you'd expect from typical realloc. Allocating 0 bytes with a NULL pointer will return a valid pointer, which can be freed. Allocating 0 bytes with a valid pointer will behave as if free was called. Re-allocating a pointer to a smaller size is always guaranteed to succeed and to return the same pointer. Re-allocating a pointer to a larger size may fail, in which case, it will return NULL. Passing a NULL pointer will behave like a call to malloc.
ptr | The pointer to the memory to re-allocate. |
size | The amount of bytes to allocate. |
|
extern |
|
extern |