# kmalloc.h File Reference

`#include <ubixos/types.h>`

Include dependency graph for kmalloc.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures

struct | memDescriptor

## Defines

#define | MALLOC_ALIGN(size) (size + ((((size) % (MALLOC_ALIGN_SIZE)) == 0)? 0 : ((MALLOC_ALIGN_SIZE) - ((size) % (MALLOC_ALIGN_SIZE)))))
#define | MALLOC_ALIGN_SIZE 32
#define | sysID -2

## Functions

void | kfree (void *baseAddr)
void * | kmalloc (uInt32 len)

## Define Documentation

#define MALLOC_ALIGN | ( | size |  | ) | (size + ((((size) % (MALLOC_ALIGN_SIZE)) == 0)? 0 : ((MALLOC_ALIGN_SIZE) - ((size) % (MALLOC_ALIGN_SIZE)))))

Definition at line 41 of file kmalloc.h.

Referenced by kmalloc().

#define MALLOC_ALIGN_SIZE 32

Definition at line 40 of file kmalloc.h.

#define sysID -2

Definition at line 39 of file kmalloc.h.

Referenced by vmm_getFreeMallocPage(), vmm_pagingInit(), and vmmFindFreePage().

## Function Documentation

void kfree | ( | void * | baseAddr | ) |

Definition at line 351 of file kmalloc.c.

References assert, memDescriptor::baseAddr, insertFreeDesc(), kprintf(), memDescriptor::limit, mallocSpinLock, memset(), memDescriptor::next, memDescriptor::prev, spinLock(), spinUnlock(), and usedKernDesc.

Referenced by close(), device_remove(), elf_loadfile(), execFile(), fclose(), fopen(), kmod_load(), ldEnable(), mpi_destroyMbox(), mpi_fetchMessage(), ne2kFreeBuffer(), operator delete(), operator delete[](), sys_exec(), sys_write(), sysExec(), systemTask(), ubixfs_cacheDelete(), ubixFSmkDir(), ubthread_cond_destroy(), ubthread_mutex_destroy(), vfs_mount(), and writeUbixFS().

Here is the call graph for this function:

void* kmalloc | ( | uInt32 | len | ) |

Definition at line 247 of file kmalloc.c.

References assert, memDescriptor::baseAddr, freeKernDesc, getEmptyDesc(), insertFreeDesc(), kprintf(), memDescriptor::limit, MALLOC_ALIGN, mallocSpinLock, memDescriptor::next, memDescriptor::prev, spinLock(), spinUnlock(), and usedKernDesc.

Referenced by addDirEntry(), biosCall(), devfs_initialize(), devfs_makeNode(), device_add(), elf_loadfile(), execFile(), falloc(), fdc_init(), fopen(), initHardDisk(), initLNC(), kmain(), kmod_add(), kmod_load(), ldEnable(), lncAttach(), mpi_createMbox(), mpi_postMessage(), mpi_spam(), ne2k_init(), ne2kAllocBuffer(), openFileUbixFS(), operator new(), operator new[](), sched_init(), schedNewTask(), sys_exec(), sys_write(), sysctl_add(), sysctl_init(), sysExec(), tty_init(), ubixfs_cacheNew(), ubixfs_initialize(), ubixFSLoadDir(), ubixFSmkDir(), ubixFSUnlink(), ubthread_cond_init(), ubthread_create(), ubthread_mutex_init(), ufs_openFile(), vfs_mount(), vfsRegisterFS(), vitals_init(), and writeUbixFS().

Here is the call graph for this function: