NOVA User-Level Environment  Version testbox/changed-memory-timing-317-g320d8b5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
helper.h File Reference

Helper functions. More...

Macros

#define do_string2(x)   do_string(x)
 Assert.
#define do_string(x)   #x
#define assert(X)   do { if (!(X)) do_exit("assertion '" #X "' failed in " __FILE__ ":" do_string2(__LINE__) ); } while (0)
#define check0(X,...)   ({ unsigned __res; if ((__res = (X))) { Logging::printf("%s() line %d: '" #X "' error = %x", __func__, __LINE__, __res); Logging::printf(" " __VA_ARGS__); Logging::printf("\n"); return; }})
 Check whether X is true, output an error and return.
#define check1(RET, X,...)   ({ unsigned __res; if ((__res = (X))) { Logging::printf("%s() line %d: '" #X "' error = %x", __func__, __LINE__, __res); Logging::printf(" " __VA_ARGS__); Logging::printf("\n"); return RET; }})
 Check whether X is true, output an error and return RET.
#define check2(GOTO, X,...)   ({ if ((res = (X))) { Logging::printf("%s() line %d: '" #X "' error = %x", __func__, __LINE__, res); Logging::printf(" " __VA_ARGS__); Logging::printf("\n"); goto GOTO; }})
 Check whether X is true, output an error and goto RET.
#define asmlinkage_protect(...)   __asm__ __volatile__ ("" : : __VA_ARGS__);
 Make a dependency on the argument, to avoid that the compiler will touch them.

Functions

void * operator new[] (unsigned size, unsigned alignment)
void * operator new (unsigned size, unsigned alignment)
void do_exit (const char *msg) __attribute__((noreturn))
void * memalloc_mempool (unsigned long size, unsigned long align)
 Alloc memory from a mempool defined in the linker script.
void memfree_mempool (void *ptr)
unsigned alloc_cap_region (unsigned count, unsigned align)
void dealloc_cap_region (unsigned base, unsigned count)

Variables

void *(* memalloc )(unsigned long size, unsigned long align)
void(* memfree )(void *ptr)

Detailed Description

Helper functions.

Copyright (C) 2010, Bernhard Kauer bk@vm.nosp@m.mon..nosp@m.org Economic rights: Technische Universitaet Dresden (Germany)

This file is part of Vancouver.

Vancouver is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

Vancouver 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 version 2 for more details.

Macro Definition Documentation

#define asmlinkage_protect (   ...)    __asm__ __volatile__ ("" : : __VA_ARGS__);

Make a dependency on the argument, to avoid that the compiler will touch them.

#define assert (   X)    do { if (!(X)) do_exit("assertion '" #X "' failed in " __FILE__ ":" do_string2(__LINE__) ); } while (0)
#define check0 (   X,
  ... 
)    ({ unsigned __res; if ((__res = (X))) { Logging::printf("%s() line %d: '" #X "' error = %x", __func__, __LINE__, __res); Logging::printf(" " __VA_ARGS__); Logging::printf("\n"); return; }})

Check whether X is true, output an error and return.

#define check1 (   RET,
  X,
  ... 
)    ({ unsigned __res; if ((__res = (X))) { Logging::printf("%s() line %d: '" #X "' error = %x", __func__, __LINE__, __res); Logging::printf(" " __VA_ARGS__); Logging::printf("\n"); return RET; }})

Check whether X is true, output an error and return RET.

#define check2 (   GOTO,
  X,
  ... 
)    ({ if ((res = (X))) { Logging::printf("%s() line %d: '" #X "' error = %x", __func__, __LINE__, res); Logging::printf(" " __VA_ARGS__); Logging::printf("\n"); goto GOTO; }})

Check whether X is true, output an error and goto RET.

#define do_string (   x)    #x
#define do_string2 (   x)    do_string(x)

Assert.

Function Documentation

unsigned alloc_cap_region ( unsigned  count,
unsigned  align 
)
void dealloc_cap_region ( unsigned  base,
unsigned  count 
)
void do_exit ( const char *  msg)
void* memalloc_mempool ( unsigned long  size,
unsigned long  align 
)

Alloc memory from a mempool defined in the linker script.

void memfree_mempool ( void *  ptr)
void* operator new ( unsigned  size,
unsigned  alignment 
)
void* operator new[] ( unsigned  size,
unsigned  alignment 
)

Variable Documentation

void*(* memalloc)(unsigned long size, unsigned long align)
void(* memfree)(void *ptr)