This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Functions | |
| int | read_physmem (unsigned long source, void *destination, long bytes) |
| int | write_physmem (unsigned long destination, void *source, long bytes) |
|
||||||||||||||||
|
Definition at line 44 of file _physmem.c. Referenced by physmem_read_local_address_is_null_error_print_count(), and PHYSMEM_HANDLE::read().
00045 {
00046
00047 #ifndef WIN32
00048 #ifdef _WINDOWS
00049
00050 LPBYTE lpDestination;
00051 LPBYTE lpSource;
00052 WORD wSelector;
00053 int i;
00054
00055 lpDestination = (LPBYTE) destination;
00056 lpSource = create_ptr_to_physmem (source, bytes, &wSelector);
00057
00058 if (NULL == lpSource || NULL == lpDestination)
00059 {
00060 return (-1);
00061 }
00062
00063
00064 for (i = 0; i < bytes; i++)
00065 {
00066 lpDestination[i] = lpSource[i];
00067 }
00068 if (wSelector)
00069 {
00070 FreeSelector (wSelector);
00071 }
00072 return (i);
00073 #else
00074 char far *ptr_to_destination;
00075 char far *ptr_to_source;
00076 unsigned long physical_source_address;
00077 unsigned long physical_destination_address;
00078 unsigned long temp_segment, temp_offset;
00079 static char two_bytes[2];
00080 char far *ptr_to_two_bytes;
00081 int i;
00082
00083 if (((unsigned long) destination) < 0x100000UL)
00084 {
00085 ptr_to_source = (char far *)
00086 ((source & 0xf) + ((source & 0xffff0L) << 16));
00087 ptr_to_destination = (char far *) destination;
00088 for (i = 0; i < bytes; i++)
00089 {
00090 ptr_to_destination[i] = ptr_to_source[i];
00091 }
00092 return (i);
00093 }
00094 else
00095 {
00096 physical_source_address = source;
00097 temp_segment = (((unsigned long) destination) & 0xffff0000L) >> 16;
00098 temp_offset = ((unsigned long) destination) & 0x0000ffffL;
00099 physical_destination_address = (temp_segment << 4) + temp_offset;
00100 if (0 == (bytes % 2))
00101 {
00102 return (move_physmem (physical_destination_address,
00103 physical_source_address, bytes));
00104 }
00105 else
00106 {
00107 if (bytes > 1)
00108 {
00109 if (-1 == move_physmem (physical_destination_address,
00110 physical_source_address, bytes))
00111 {
00112 return -1;
00113 }
00114 }
00115 ptr_to_two_bytes = (char far *) two_bytes;
00116 temp_segment =
00117 (((unsigned long) ptr_to_two_bytes) & 0xffff0000L) >> 16;
00118 temp_offset = ((unsigned long) ptr_to_two_bytes) & 0x0000ffffL;
00119 physical_source_address = source + bytes - 1;
00120 physical_destination_address = (temp_segment << 4) + temp_offset;
00121 if (-1 == move_physmem (physical_destination_address,
00122 physical_source_address, 2))
00123 {
00124 return -1;
00125 }
00126 ((char *) destination)[bytes - 1] = (char) two_bytes[0];
00127 return (0);
00128 }
00129 }
00130 #endif
00131 #endif
00132 return (-1); /* No Applicable PLATFORM */
00133 }
|
|
||||||||||||||||
|
Definition at line 136 of file _physmem.c. Referenced by physmem_write_local_address_is_null_error_print_count(), and PHYSMEM_HANDLE::write().
00137 {
00138 #ifndef WIN32
00139 #ifdef _WINDOWS
00140
00141 LPBYTE lpDestination;
00142 LPBYTE lpSource;
00143 WORD wSelector;
00144 DWORD max_size;
00145 int i;
00146
00147 lpDestination = create_ptr_to_physmem (destination, bytes, &wSelector);
00148 lpSource = (LPBYTE) source;
00149
00150 if (NULL == lpSource || NULL == lpDestination)
00151 {
00152 return (-1);
00153 }
00154
00155
00156 for (i = 0; i < bytes; i++)
00157 {
00158 lpDestination[i] = lpSource[i];
00159 }
00160
00161 if (wSelector)
00162 {
00163 FreeSelector (wSelector);
00164 }
00165 return (i);
00166 #else
00167 char far *ptr_to_destination;
00168 char far *ptr_to_source;
00169 unsigned long physical_source_address;
00170 unsigned long physical_destination_address;
00171 unsigned long temp_segment, temp_offset;
00172 int i;
00173 static char two_bytes[2];
00174 char far *ptr_to_two_bytes;
00175
00176 if (destination < 0x100000UL)
00177 {
00178 ptr_to_source = (char far *) source;
00179 ptr_to_destination = (char far *)
00180 ((destination & 0xf) + ((destination & 0xffff0L) << 16));
00181 for (i = 0; i < bytes; i++)
00182 {
00183 ptr_to_destination[i] = ptr_to_source[i];
00184 }
00185 return (i);
00186 }
00187 else
00188 {
00189 temp_segment = (((unsigned long) source) & 0xffff0000L) >> 16;
00190 temp_offset = ((unsigned long) source) & 0x0000ffffL;
00191 physical_source_address = (temp_segment << 4) + temp_offset;
00192 physical_destination_address = destination;
00193 if (0 == (bytes % 2))
00194 {
00195 return (move_physmem (physical_destination_address,
00196 physical_source_address, bytes));
00197 }
00198 else
00199 {
00200 if (bytes > 1)
00201 {
00202 if (-1 == move_physmem (physical_destination_address,
00203 physical_source_address, bytes))
00204 {
00205 return -1;
00206 }
00207 }
00208 two_bytes[0] = ((char *) source)[bytes - 1];
00209 ptr_to_two_bytes = (char far *) two_bytes;
00210 temp_segment =
00211 (((unsigned long) ptr_to_two_bytes) & 0xffff0000L) >> 16;
00212 temp_offset = ((unsigned long) ptr_to_two_bytes) & 0x0000ffffL;
00213 physical_destination_address = destination + bytes - 1;
00214 physical_source_address = (temp_segment << 4) + temp_offset;
00215 if (-1 == move_physmem (physical_destination_address,
00216 physical_source_address, 2))
00217 {
00218 return -1;
00219 }
00220 return (0);
00221 }
00222 }
00223 #endif
00224 #endif
00225 return (-1); /* No Applicable PLATFORM */
00226 }
|
1.2.11.1 written by Dimitri van Heesch,
© 1997-2001