aboutsummaryrefslogtreecommitdiff
path: root/src/gen-defs.h
blob: dabf64cd9981f605845dd04edf7486a4fb4aa6c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Tool for building defintions accessible from assembler code.  This
// is based on code from the Linux Kernel.
#ifndef __GEN_DEFS_H
#define __GEN_DEFS_H


#define DEFINE(sym, val) \
    asm volatile("\n->" #sym " %0 " #val : : "i" (val))

#define BLANK() \
    asm volatile("\n->" : : )

#define OFFSET(sym, str, mem) \
    DEFINE(sym, offsetof(struct str, mem))

#define COMMENT(x) \
    asm volatile("\n->#" x)

#endif // gen-defs.h