nckernel  0.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
malloc.c File Reference
#include <sys/types.h>
#include <stdio.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <malloc.h>
#include <list.h>
#include <debug.h>
#include <interrupt.h>
Include dependency graph for malloc.c:

Go to the source code of this file.

Data Structures

struct  chunk
 할당되는 메모리 청크 정보를 가지는 header More...
 
struct  chunk_stat
 

Macros

#define ALIGNED(align, size)   ((uint32_t)((uint32_t)(size) + ((align) - ((uint32_t)(size) & ((align) - 1)))))
 
#define CAN_BE_MERGED(prev, next)   ((struct chunk*)(((struct chunk*)(prev))->ptr + ((struct chunk*)(prev))->size) == next)
 두 노드의 공간이 병합 가능 한지 판단한다. More...
 

Functions

int brk (void *ptr)
 
void * calloc (size_t nmemb, size_t size)
 
void free (void *ptr)
 
void * malloc (size_t size)
 
void malloc_init (uint32_t base, uint32_t size)
 
void * memalign (size_t boundary, size_t size)
 
int posix_memalign (void **memptr, size_t align, size_t size)
 
void * sbrk (intptr_t increment)
 
void * valloc (size_t size)
 

Variables

struct chunk __PACKED
 

Macro Definition Documentation

#define ALIGNED (   align,
  size 
)    ((uint32_t)((uint32_t)(size) + ((align) - ((uint32_t)(size) & ((align) - 1)))))

Definition at line 26 of file malloc.c.

Referenced by free(), malloc(), and posix_memalign().

#define CAN_BE_MERGED (   prev,
  next 
)    ((struct chunk*)(((struct chunk*)(prev))->ptr + ((struct chunk*)(prev))->size) == next)

두 노드의 공간이 병합 가능 한지 판단한다.

Parameters
[in]prev낮은 주소에 위치한 노드
[in]next높은 주소에 위치한 노드
Returns
int 병합 가능하면 1, 그렇지 않으면 0
See Also
free()

Definition at line 23 of file malloc.c.

Referenced by free().

Function Documentation

void malloc_init ( uint32_t  base,
uint32_t  size 
)

Definition at line 65 of file malloc.c.

References chunk::size.

Variable Documentation

struct chunk __PACKED