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