asm.m4 1.52 KB
Newer Older
1
changequote(<,>)dnl
2
dnl (progn (modify-syntax-entry ?< "(>") (modify-syntax-entry ?> ")<") )
Niels Möller's avatar
Niels Möller committed
3
4

dnl FORTRAN style comment character
5
6
define(<C>, <
dnl>)dnl
Niels Möller's avatar
Niels Möller committed
7

Niels Möller's avatar
Niels Möller committed
8
dnl Including files from the srcdir
9
define(<include_src>, <include(srcdir/$1)>)dnl
Niels Möller's avatar
Niels Möller committed
10

11
12
13
14
15
dnl Pseudo ops

define(<PROLOGUE>,
<ifelse(ELF_STYLE,yes,
<.globl C_NAME($1)
Niels Möller's avatar
Niels Möller committed
16
.type C_NAME($1),TYPE_FUNCTION
17
18
19
20
21
22
C_NAME($1):>,
<.globl C_NAME($1)
C_NAME($1):>)>)

define(<EPILOGUE>,
<ifelse(ELF_STYLE,yes,
23
<.size C_NAME($1), . - C_NAME($1)>,<>)>)
24

25
dnl Argument to ALIGN is always logarithmic
26
27
28

dnl Need changequote to be able to use the << operator (using **
dnl instead is not portable, and is not supported by openbsd m4).
29
define(<ALIGN>,
30
31
32
33
<changequote([,])dnl
.align ifelse(ALIGN_LOG,yes,$1,eval(1 << $1))dnl >> balance
changequote(<,>)dnl
>)
34

35
36
37
dnl Struct defining macros

dnl STRUCTURE(prefix) 
38
define(<STRUCTURE>, <define(<SOFFSET>, 0)define(<SPREFIX>, <$1>)>)dnl
39
40

dnl STRUCT(name, size)
41
define(<STRUCT>,
42
<define(SPREFIX<_>$1, SOFFSET)dnl
43
 define(<SOFFSET>, eval(SOFFSET + ($2)))>)dnl
44

45
46
47
dnl UCHAR(name)
define(<UCHAR>, <STRUCT(<$1>, 1)>)dnl

48
dnl UNSIGNED(name)
49
define(<UNSIGNED>, <STRUCT(<$1>, 4)>)dnl
50

51
52
53
54
55
56
dnl Offsets in arcfour_ctx
STRUCTURE(ARCFOUR)
  STRUCT(S, 256)
  UCHAR(I)
  UCHAR(J)

57
dnl Offsets in aes_ctx and aes_table
58
59
60
STRUCTURE(AES)
  STRUCT(KEYS, 4*60)
  UNSIGNED(NROUNDS)
61

62
63
64
define(AES_SBOX_SIZE,	256)dnl
define(AES_TABLE_SIZE,	1024)dnl

Niels Möller's avatar
Niels Möller committed
65
STRUCTURE(AES)
66
67
68
69
70
  STRUCT(SBOX, AES_SBOX_SIZE)
  STRUCT(TABLE0, AES_TABLE_SIZE)
  STRUCT(TABLE1, AES_TABLE_SIZE)
  STRUCT(TABLE2, AES_TABLE_SIZE)
  STRUCT(TABLE3, AES_TABLE_SIZE)