aboutsummaryrefslogtreecommitdiffstats
path: root/modules/sha_x86/asm_macr.h
blob: fb51cdbb5b7f480831fa81b30a646e78e4880fd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*************************************************
* Assembly Macros Header File                    *
* (C) 1999-2006 The Botan Project                *
*************************************************/

#ifndef BOTAN_EXT_ASM_MACROS_H__
#define BOTAN_EXT_ASM_MACROS_H__

#define ALIGN .p2align 4,,15

#define START_LISTING(FILENAME) \
   .file #FILENAME;             \
   .text;                       \
   .p2align 4,,15;

#define FUNCTION(func_name)      \
   .align   8;                   \
   ALIGN;                        \
   .global  func_name;           \
   .type    func_name,@function; \
func_name:

#define LOOP_UNTIL(REG, NUM, LABEL) \
   cmpl NUM, REG; \
   jne LABEL##_LOOP

#define START_LOOP(LABEL) \
   ALIGN; \
   LABEL##_LOOP:

#define EAX %eax
#define EBX %ebx
#define ECX %ecx
#define EDX %edx
#define EBP %ebp
#define EDI %edi
#define ESI %esi

#define PUSH(REG) pushl REG
#define POP(REG) popl REG
#define MOV(FROM, TO) movl FROM, TO


#define ADD(FROM, TO) addl FROM, TO
#define XOR(FROM, TO) xorl FROM, TO
#define ROTL(NUM, REG) roll NUM, REG


#define ARRAY(REG, NUM) 4*NUM(REG)

#define BSWAP(REG) bswapl REG

#define IMM(VAL) $VAL

#define ZEROIZE(REG) xorl REG, REG

#define ARG(NUM) 4*PUSHED+4*NUM(%esp)

#endif