blob: d4cec32083d827ce5309f3936173b06da153be51 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _ASM_IA64_ASMMACRO_H
2#define _ASM_IA64_ASMMACRO_H
3
4/*
5 * Copyright (C) 2000-2001, 2003-2004 Hewlett-Packard Co
6 * David Mosberger-Tang <davidm@hpl.hp.com>
7 */
8
9#include <linux/config.h>
10
11#define ENTRY(name) \
12 .align 32; \
13 .proc name; \
14name:
15
16#define ENTRY_MIN_ALIGN(name) \
17 .align 16; \
18 .proc name; \
19name:
20
21#define GLOBAL_ENTRY(name) \
22 .global name; \
23 ENTRY(name)
24
25#define END(name) \
26 .endp name
27
28/*
29 * Helper macros to make unwind directives more readable:
30 */
31
32/* prologue_gr: */
33#define ASM_UNW_PRLG_RP 0x8
34#define ASM_UNW_PRLG_PFS 0x4
35#define ASM_UNW_PRLG_PSP 0x2
36#define ASM_UNW_PRLG_PR 0x1
37#define ASM_UNW_PRLG_GRSAVE(ninputs) (32+(ninputs))
38
39/*
40 * Helper macros for accessing user memory.
41 */
42
43 .section "__ex_table", "a" // declare section & section attributes
44 .previous
45
46# define EX(y,x...) \
47 .xdata4 "__ex_table", 99f-., y-.; \
48 [99:] x
49# define EXCLR(y,x...) \
50 .xdata4 "__ex_table", 99f-., y-.+4; \
51 [99:] x
52
53/*
Russ Andersond2a28ad2006-03-24 09:49:52 -080054 * Tag MCA recoverable instruction ranges.
55 */
56
57 .section "__mca_table", "a" // declare section & section attributes
58 .previous
59
60# define MCA_RECOVER_RANGE(y) \
61 .xdata4 "__mca_table", y-., 99f-.; \
62 [99:]
63
64/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070065 * Mark instructions that need a load of a virtual address patched to be
66 * a load of a physical address. We use this either in critical performance
67 * path (ivt.S - TLB miss processing) or in places where it might not be
68 * safe to use a "tpa" instruction (mca_asm.S - error recovery).
69 */
70 .section ".data.patch.vtop", "a" // declare section & section attributes
71 .previous
72
73#define LOAD_PHYSICAL(pr, reg, obj) \
74[1:](pr)movl reg = obj; \
75 .xdata4 ".data.patch.vtop", 1b-.
76
77/*
78 * For now, we always put in the McKinley E9 workaround. On CPUs that don't need it,
79 * we'll patch out the work-around bundles with NOPs, so their impact is minimal.
80 */
81#define DO_MCKINLEY_E9_WORKAROUND
82
83#ifdef DO_MCKINLEY_E9_WORKAROUND
84 .section ".data.patch.mckinley_e9", "a"
85 .previous
86/* workaround for Itanium 2 Errata 9: */
87# define FSYS_RETURN \
88 .xdata4 ".data.patch.mckinley_e9", 1f-.; \
891:{ .mib; \
90 nop.m 0; \
91 mov r16=ar.pfs; \
92 br.call.sptk.many b7=2f;; \
93 }; \
942:{ .mib; \
95 nop.m 0; \
96 mov ar.pfs=r16; \
97 br.ret.sptk.many b6;; \
98 }
99#else
100# define FSYS_RETURN br.ret.sptk.many b6
101#endif
102
103/*
104 * Up until early 2004, use of .align within a function caused bad unwind info.
105 * TEXT_ALIGN(n) expands into ".align n" if a fixed GAS is available or into nothing
106 * otherwise.
107 */
108#ifdef HAVE_WORKING_TEXT_ALIGN
109# define TEXT_ALIGN(n) .align n
110#else
111# define TEXT_ALIGN(n)
112#endif
113
114#ifdef HAVE_SERIALIZE_DIRECTIVE
115# define dv_serialize_data .serialize.data
116# define dv_serialize_instruction .serialize.instruction
117#else
118# define dv_serialize_data
119# define dv_serialize_instruction
120#endif
121
122#endif /* _ASM_IA64_ASMMACRO_H */