LibXenon
Bare-metal Xbox 360 homebrew library
Loading...
Searching...
No Matches
Data Structures | Macros | Enumerations | Functions | Variables
mf-simplecheck.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "mf-runtime.h"
Include dependency graph for mf-simplecheck.c:

Go to the source code of this file.

Data Structures

struct  __mf_options
 
struct  check_s
 

Macros

#define mode_nop   0 /* Do nothing. */
 
#define mode_populate   1 /* Populate tree but do not check for violations. */
 
#define mode_check   2 /* Populate and check for violations (normal). */
 
#define mode_violate   3 /* Trigger a violation on every call (diagnostic). */
 
#define viol_nop   0 /* Return control to application. */
 
#define viol_segv   1 /* Signal self with segv. */
 
#define viol_abort   2 /* Call abort (). */
 
#define viol_gdb   3 /* Fork a debugger on self */
 
#define LOOKUP_CACHE_MASK_DFL   1023
 
#define LOOKUP_CACHE_SIZE_MAX   65536 /* Allows max CACHE_MASK 0xFFFF */
 
#define LOOKUP_CACHE_SHIFT_DFL   2
 
#define LOOKUP_CACHE_SIZE   (__mf_lc_mask + 1)
 
#define MAX_CHECKS   256
 

Enumerations

enum  __mf_state_enum { active , reentrant , in_malloc }
 

Functions

void mf_check (void *addr, int size, int check_reads, int check_writes, int halt_on_access)
 
void __mf_init ()
 
void __mf_check (void *ptr, size_t sz, int type, const char *location)
 
void __mf_register (void *ptr, size_t sz, int type, const char *name)
 
void __mf_unregister (void *ptr, size_t sz, int type)
 

Variables

struct __mf_cache __mf_lookup_cache [LOOKUP_CACHE_SIZE_MAX]
 
uintptr_t __mf_lc_mask = LOOKUP_CACHE_MASK_DFL
 
unsigned char __mf_lc_shift = LOOKUP_CACHE_SHIFT_DFL
 
struct __mf_options __mf_opts
 
int __mf_starting_p = 1
 
enum __mf_state_enum __mf_state_1 = reentrant
 

Macro Definition Documentation

◆ LOOKUP_CACHE_MASK_DFL

#define LOOKUP_CACHE_MASK_DFL   1023

Definition at line 101 of file mf-simplecheck.c.

◆ LOOKUP_CACHE_SHIFT_DFL

#define LOOKUP_CACHE_SHIFT_DFL   2

Definition at line 103 of file mf-simplecheck.c.

◆ LOOKUP_CACHE_SIZE

#define LOOKUP_CACHE_SIZE   (__mf_lc_mask + 1)

Definition at line 108 of file mf-simplecheck.c.

◆ LOOKUP_CACHE_SIZE_MAX

#define LOOKUP_CACHE_SIZE_MAX   65536 /* Allows max CACHE_MASK 0xFFFF */

Definition at line 102 of file mf-simplecheck.c.

◆ MAX_CHECKS

#define MAX_CHECKS   256

Definition at line 117 of file mf-simplecheck.c.

◆ mode_check

#define mode_check   2 /* Populate and check for violations (normal). */

Definition at line 78 of file mf-simplecheck.c.

◆ mode_nop

#define mode_nop   0 /* Do nothing. */

Definition at line 76 of file mf-simplecheck.c.

◆ mode_populate

#define mode_populate   1 /* Populate tree but do not check for violations. */

Definition at line 77 of file mf-simplecheck.c.

◆ mode_violate

#define mode_violate   3 /* Trigger a violation on every call (diagnostic). */

Definition at line 79 of file mf-simplecheck.c.

◆ viol_abort

#define viol_abort   2 /* Call abort (). */

Definition at line 85 of file mf-simplecheck.c.

◆ viol_gdb

#define viol_gdb   3 /* Fork a debugger on self */

Definition at line 86 of file mf-simplecheck.c.

◆ viol_nop

#define viol_nop   0 /* Return control to application. */

Definition at line 83 of file mf-simplecheck.c.

◆ viol_segv

#define viol_segv   1 /* Signal self with segv. */

Definition at line 84 of file mf-simplecheck.c.

Enumeration Type Documentation

◆ __mf_state_enum

Enumerator
active 
reentrant 
in_malloc 

Definition at line 96 of file mf-simplecheck.c.

Function Documentation

◆ __mf_check()

void __mf_check ( void *  ptr,
size_t  sz,
int  type,
const char *  location 
)

Definition at line 154 of file mf-simplecheck.c.

◆ __mf_init()

void __mf_init ( )

Definition at line 149 of file mf-simplecheck.c.

◆ __mf_register()

void __mf_register ( void *  ptr,
size_t  sz,
int  type,
const char *  name 
)

Definition at line 174 of file mf-simplecheck.c.

◆ __mf_unregister()

void __mf_unregister ( void *  ptr,
size_t  sz,
int  type 
)

Definition at line 179 of file mf-simplecheck.c.

◆ mf_check()

void mf_check ( void *  addr,
int  size,
int  check_reads,
int  check_writes,
int  halt_on_access 
)

Definition at line 130 of file mf-simplecheck.c.

Variable Documentation

◆ __mf_lc_mask

Definition at line 106 of file mf-simplecheck.c.

◆ __mf_lc_shift

unsigned char __mf_lc_shift = LOOKUP_CACHE_SHIFT_DFL

Definition at line 107 of file mf-simplecheck.c.

◆ __mf_lookup_cache

struct __mf_cache __mf_lookup_cache[LOOKUP_CACHE_SIZE_MAX]

Definition at line 105 of file mf-simplecheck.c.

◆ __mf_opts

struct __mf_options __mf_opts

Definition at line 110 of file mf-simplecheck.c.

◆ __mf_starting_p

int __mf_starting_p = 1

Definition at line 111 of file mf-simplecheck.c.

◆ __mf_state_1

enum __mf_state_enum __mf_state_1 = reentrant

Definition at line 113 of file mf-simplecheck.c.