|
|
1.1 root 1: /*
2: Copyright (c) 2008 TrueCrypt Foundation. All rights reserved.
3:
1.1.1.6 ! root 4: Governed by the TrueCrypt License 2.7 the full text of which is contained
1.1 root 5: in the file License.txt included in TrueCrypt binary and source code
6: distribution packages.
7: */
8:
9: #ifndef TC_HEADER_Boot_Platform
10: #define TC_HEADER_Boot_Platform
11:
12: #pragma warning ( disable : 4769 )
13:
14: #include "TCdefs.h"
15: #include <memory.h>
16:
17: typedef int bool;
18: #define false 0
19: #define true 1
20:
21: #define nullptr 0
1.1.1.5 root 22: #define NULL 0
1.1 root 23:
24: typedef UINT64_STRUCT uint64;
25:
26: #define array_capacity(arr) (sizeof (arr) / sizeof ((arr)[0]))
27:
28: #define TC_TO_STRING2(n) #n
29: #define TC_TO_STRING(n) TC_TO_STRING2(n)
30:
31:
32: #define TC_X86_CARRY_FLAG 0x1
33:
34: #define TC_ASM_EMIT(A,B) __asm _emit 0x##A __asm _emit 0x##B
35: #define TC_ASM_EMIT3(A,B,C) __asm _emit 0x##A __asm _emit 0x##B __asm _emit 0x##C
36: #define TC_ASM_EMIT4(A,B,C,D) __asm _emit 0x##A __asm _emit 0x##B __asm _emit 0x##C __asm _emit 0x##D
37:
1.1.1.2 root 38: #define TC_ASM_MOV_EAX_DI TC_ASM_EMIT3 (66, 8B, 05)
39: #define TC_ASM_MOV_EBX_DI TC_ASM_EMIT3 (66, 8B, 1D)
40: #define TC_ASM_MOV_ECX_DI TC_ASM_EMIT3 (66, 8B, 0D)
41: #define TC_ASM_MOV_EDX_DI TC_ASM_EMIT3 (66, 8B, 15)
42:
43: #define TC_ASM_MOV_DI_EAX TC_ASM_EMIT3 (66, 89, 05)
44: #define TC_ASM_MOV_DI_EBX TC_ASM_EMIT3 (66, 89, 1D)
45: #define TC_ASM_MOV_DI_ECX TC_ASM_EMIT3 (66, 89, 0D)
46: #define TC_ASM_MOV_DI_EDX TC_ASM_EMIT3 (66, 89, 15)
47:
1.1 root 48:
49: #pragma pack(1)
50:
51: struct Registers
52: {
53: uint16 Flags;
54:
55: union
56: {
57: uint32 EAX;
58: struct { uint16 AX; uint16 EAXH; };
59: };
60:
61: union
62: {
63: uint32 EBX;
64: struct { uint16 BX; uint16 EBXH; };
65: };
66:
67: union
68: {
69: uint32 ECX;
70: struct { uint16 CX; uint16 ECXH; };
71: };
72:
73: union
74: {
75: uint32 EDX;
76: struct { uint16 DX; uint16 EDXH; };
77: };
78:
79: uint16 DI;
80: uint16 SI;
81: uint16 DS;
82: uint16 ES;
83: uint16 SS;
84: };
85:
86: #pragma pack()
87:
88:
89: uint64 operator+ (const uint64 &a, const uint64 &b);
90: uint64 operator+ (const uint64 &a, uint32 b);
1.1.1.4 root 91: uint64 &operator+= (uint64 &a, const uint64 &b);
1.1 root 92: uint64 operator- (const uint64 &a, const uint64 &b);
93: uint64 operator- (const uint64 &a, uint32 b);
1.1.1.4 root 94: uint64 &operator-= (uint64 &a, const uint64 &b);
1.1 root 95: uint64 operator>> (const uint64 &a, int shiftCount);
96: uint64 operator<< (const uint64 &a, int shiftCount);
97: uint64 &operator++ (uint64 &a);
98: bool operator== (const uint64 &a, const uint64 &b);
99: bool operator> (const uint64 &a, const uint64 &b);
100: bool operator< (const uint64 &a, const uint64 &b);
101: bool operator>= (const uint64 &a, const uint64 &b);
102: bool operator<= (const uint64 &a, const uint64 &b);
103:
1.1.1.5 root 104: void CopyMemory (void *source, uint16 destSegment, uint16 destOffset, uint16 blockSize);
105: void CopyMemory (uint16 sourceSegment, uint16 sourceOffset, void *destination, uint16 blockSize);
1.1.1.3 root 106: extern "C" void EraseMemory (void *memory, int size);
1.1 root 107: uint32 GetLinearAddress (uint16 segment, uint16 offset);
1.1.1.2 root 108: bool RegionsIntersect (const uint64 &start1, uint32 length1, const uint64 &start2, const uint64 &end2);
1.1 root 109: bool TestInt64 ();
1.1.1.4 root 110: extern "C" void ThrowFatalException (int line);
1.1 root 111:
112: #endif // TC_HEADER_Boot_Platform
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.