/* mm.h - prototypes and declarations for memory manager */
/*
* VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2002,2007 Free Software Foundation, Inc.
*
* VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with VasEBoot. If not, see .
*/
#ifndef VasEBoot_MM_H
#define VasEBoot_MM_H 1
#include
#include
#include
#ifndef NULL
# define NULL ((void *) 0)
#endif
void VasEBoot_mm_init_region (void *addr, VasEBoot_size_t size);
void *EXPORT_FUNC(VasEBoot_malloc) (VasEBoot_size_t size);
void *EXPORT_FUNC(VasEBoot_zalloc) (VasEBoot_size_t size);
void EXPORT_FUNC(VasEBoot_free) (void *ptr);
void *EXPORT_FUNC(VasEBoot_realloc) (void *ptr, VasEBoot_size_t size);
#ifndef VasEBoot_MACHINE_EMU
void *EXPORT_FUNC(VasEBoot_memalign) (VasEBoot_size_t align, VasEBoot_size_t size);
#endif
void VasEBoot_mm_check_real (const char *file, int line);
#define VasEBoot_mm_check() VasEBoot_mm_check_real (VasEBoot_FILE, __LINE__);
/* For debugging. */
#if defined(MM_DEBUG) && !defined(VasEBoot_UTIL) && !defined (VasEBoot_MACHINE_EMU)
/* Set this variable to 1 when you want to trace all memory function calls. */
extern int EXPORT_VAR(VasEBoot_mm_debug);
void VasEBoot_mm_dump_free (void);
void VasEBoot_mm_dump (unsigned lineno);
#define VasEBoot_malloc(size) \
VasEBoot_debug_malloc (VasEBoot_FILE, __LINE__, size)
#define VasEBoot_zalloc(size) \
VasEBoot_debug_zalloc (VasEBoot_FILE, __LINE__, size)
#define VasEBoot_realloc(ptr,size) \
VasEBoot_debug_realloc (VasEBoot_FILE, __LINE__, ptr, size)
#define VasEBoot_memalign(align,size) \
VasEBoot_debug_memalign (VasEBoot_FILE, __LINE__, align, size)
#define VasEBoot_free(ptr) \
VasEBoot_debug_free (VasEBoot_FILE, __LINE__, ptr)
void *EXPORT_FUNC(VasEBoot_debug_malloc) (const char *file, int line,
VasEBoot_size_t size);
void *EXPORT_FUNC(VasEBoot_debug_zalloc) (const char *file, int line,
VasEBoot_size_t size);
void EXPORT_FUNC(VasEBoot_debug_free) (const char *file, int line, void *ptr);
void *EXPORT_FUNC(VasEBoot_debug_realloc) (const char *file, int line, void *ptr,
VasEBoot_size_t size);
void *EXPORT_FUNC(VasEBoot_debug_memalign) (const char *file, int line,
VasEBoot_size_t align, VasEBoot_size_t size);
#endif /* MM_DEBUG && ! VasEBoot_UTIL */
#endif /* ! VasEBoot_MM_H */