pintos/src/threads/malloc.c File Reference

#include "threads/malloc.h"
#include <debug.h>
#include <list.h>
#include <round.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "threads/palloc.h"
#include "threads/synch.h"
#include "threads/vaddr.h"

Go to the source code of this file.

Data Structures

struct  desc
struct  arena
struct  block

Defines

#define ARENA_MAGIC   0x9a548eed

Functions

static struct arenablock_to_arena (struct block *)
static struct blockarena_to_block (struct arena *, size_t idx)
void malloc_init (void)
void * malloc (size_t size)
void * calloc (size_t a, size_t b)
static size_t block_size (void *block)
void * realloc (void *old_block, size_t new_size)
void free (void *p)

Variables

static struct desc descs [10]
static size_t desc_cnt


Define Documentation

#define ARENA_MAGIC   0x9a548eed

Definition at line 48 of file malloc.c.

Referenced by arena_to_block(), block_to_arena(), and malloc().


Function Documentation

static struct block * arena_to_block ( struct arena a,
size_t  idx 
) [static, read]

Definition at line 287 of file malloc.c.

References ARENA_MAGIC, ASSERT, desc::block_size, arena::desc, arena::magic, and NULL.

Referenced by free(), and malloc().

static size_t block_size ( void *  block  )  [static]

Definition at line 180 of file malloc.c.

References desc::block_size, block_to_arena(), arena::desc, arena::free_cnt, NULL, pg_ofs(), and PGSIZE.

static struct arena * block_to_arena ( struct block b  )  [static, read]

Definition at line 269 of file malloc.c.

References ARENA_MAGIC, ASSERT, desc::block_size, arena::desc, arena::magic, NULL, pg_ofs(), and pg_round_down().

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

void* calloc ( size_t  a,
size_t  b 
)

Definition at line 160 of file malloc.c.

References malloc(), memset(), NULL, and block::size.

Referenced by dir_open(), file_open(), and inode_create().

void free ( void *  p  ) 

void* malloc ( size_t  size  ) 

void malloc_init ( void   ) 

void* realloc ( void *  old_block,
size_t  new_size 
)

Definition at line 196 of file malloc.c.

References block_size(), free(), malloc(), memcpy(), and NULL.


Variable Documentation

size_t desc_cnt [static]

Definition at line 66 of file malloc.c.

Referenced by malloc(), and malloc_init().

struct desc descs[10] [static]

Definition at line 65 of file malloc.c.

Referenced by malloc(), and malloc_init().


Generated on Mon Jan 10 16:43:58 2011 for Pintos by  doxygen 1.5.6