tlds
Transactional Operations for Linked Data Structures
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
StackProtection.h
Go to the documentation of this file.
1 /**
2  * Copyright (C) 2011
3  * University of Rochester Department of Computer Science
4  * and
5  * Lehigh University Department of Computer Science and Engineering
6  *
7  * License: Modified BSD
8  * Please see the file LICENSE.RSTM for licensing information
9  */
10 
11 #ifndef STM_ITM2STM_ARCH_X86_STACK_PROTECTION_H
12 #define STM_ITM2STM_ARCH_X86_STACK_PROTECTION_H
13 
14 /// This macro is meant to compute the first stack address that it is safe to
15 /// write to during rollback or commit. Essentially, it forms the second half of
16 /// a [TOP_OF_STACK, END_OF_STACK) range for filtering writes. It is
17 /// calling-convention and architecture specific.
18 ///
19 /// The "+ 2" protects the two words corresponding to the saved caller's frame
20 /// address and the return address.
21 ///
22 /// This particular version is for ITM's calling convention.
23 #define COMPUTE_PROTECTED_STACK_ADDRESS_ITM_FASTCALL(N) \
24  ((void**)__builtin_frame_address(0) + 2 + ((N - 2) >= 0) ? : 0)
25 
26 /// This macro is meant to compute the first stack address that it is safe to
27 /// write to during rollback or commit. Essentially, it forms the second half of
28 /// a [TOP_OF_STACK, END_OF_STACK) range for filtering writes. It is
29 /// calling-convention and architecture specific.
30 ///
31 /// The "+ 2" protects the two words corresponding to the saved caller's frame
32 /// address and the return address.
33 ///
34 /// This particular version is for the default calling convention.
35 #define COMPUTE_PROTECTED_STACK_ADDRESS_DEFAULT(N) \
36  ((void**)__builtin_frame_address(0) + 2 + N)
37 
38 #endif // STM_ITM2STM_ARCH_X86_STACK_PROTECTION_H