1
10
13
14
20
21
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
107
108
109
110
116
117
118
119
120
121
127
128
129
130
131
132
133
134
135
136
137
138
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
...
...
...
#define TX_SOURCE_CODE
#include "tx_api.h"
#include "tx_initialize.h"
#include "tx_mutex.h"
#include "tx_thread.h"
#include "tx_byte_pool.h"
#include "txm_module.h"
#include "txm_module_manager_util.h"
7 includes
...
...
UINT _txm_module_manager_memory_load(TXM_MODULE_INSTANCE *module_instance, CHAR *module_name, VOID *module_location)
{
TXM_MODULE_PREAMBLE *module_preamble;
ALIGN_TYPE code_start;
ULONG code_size;
ULONG code_alignment;
ULONG code_allocation_size;
CHAR *code_memory_ptr;
UCHAR *source_ptr;
UCHAR *destination_ptr;
ULONG copy_size;
ULONG i;
UINT status;
module_preamble = (TXM_MODULE_PREAMBLE *) module_location;
code_size = module_preamble -> txm_module_preamble_code_size;
if (code_size == 0)
{
return(TXM_MODULE_INVALID);
}if (code_size == 0) { ... }
status = _txm_module_manager_util_code_allocation_size_and_alignment_get(module_preamble, &code_alignment, &code_allocation_size);
if (status != TX_SUCCESS)
{
return(status);
}if (status != TX_SUCCESS) { ... }
status = _tx_byte_allocate(&_txm_module_manager_byte_pool, (VOID **) &code_memory_ptr, code_allocation_size, TX_NO_WAIT);
if (status != TX_SUCCESS)
{
return(TX_NO_MEMORY);
}if (status != TX_SUCCESS) { ... }
source_ptr = (UCHAR *) module_location;
code_start = (ALIGN_TYPE) code_memory_ptr;
code_start = (code_start + (code_alignment - 1)) & ~(code_alignment - 1);
destination_ptr = (UCHAR *) code_start;
copy_size = module_preamble -> txm_module_preamble_code_size;
for (i = 0; i < copy_size; i++)
{
*destination_ptr++ = *source_ptr++;
}for (i = 0; i < copy_size; i++) { ... }
status = _txm_module_manager_internal_load(module_instance, module_name, (VOID *) code_start,
code_size, code_memory_ptr, code_allocation_size);
if (status != TX_SUCCESS)
{
_tx_byte_release(code_memory_ptr);
return(status);
}if (status != TX_SUCCESS) { ... }
return(TX_SUCCESS);
}{ ... }