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