Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

lpcmove.c

Go to the documentation of this file.
00001 00010 /*++ 00011 00012 Copyright (c) 1995 Intel Corporation 00013 00014 Module Name: 00015 00016 lpcmove.c 00017 00018 Abstract: 00019 00020 This module implements functions to support the efficient movement 00021 of LPC message blocks. 00022 00023 There is a corresponding .s version that is hand optimized. 00024 Need to evaluate and install one or the other. 00025 00026 Author: 00027 00028 Roy D'Souza (rdsouza) 5-May-96 00029 00030 Revision History: 00031 00032 --*/ 00033 00034 #include "lpcp.h" 00035 00036 00037 VOID 00038 LpcpMoveMessage ( 00039 OUT PPORT_MESSAGE DstMsg, 00040 IN PPORT_MESSAGE SrcMsg, 00041 IN PUCHAR SrcMsgData, 00042 IN ULONG MsgType OPTIONAL, 00043 IN PCLIENT_ID ClientId OPTIONAL 00044 ) 00045 00046 /*++ 00047 00048 Routine Description: 00049 00050 This function moves an LPC message block and optionally sets the message 00051 type and client id to the specified values. 00052 00053 Arguments: 00054 00055 DstMsg - Supplies a pointer to the destination message. 00056 00057 SrcMsg - Supplies a pointer to the source message. 00058 00059 SrcMsgData - Supplies a pointer to the source message data to 00060 copy to destination. 00061 00062 MsgType - If non-zero, then store in type field of the 00063 destination message. 00064 00065 ClientId - If non-NULL, then points to a ClientId to copy to 00066 the destination message. 00067 00068 Return Value: 00069 00070 None 00071 00072 --*/ 00073 00074 { 00075 ULONG NumberDwords; 00076 ULONGLONG Temp1, Temp2, Temp3; 00077 00078 // 00079 // Extract the data length and copy over the first dword 00080 // 00081 00082 *((PULONG)DstMsg)++ = NumberDwords = *((PULONG)SrcMsg)++; 00083 NumberDwords = ((0x0000FFFF & NumberDwords) + 3) >> 2; 00084 00085 // 00086 // Set the message type properly and update the second dword 00087 // 00088 00089 *((PULONG)DstMsg)++ = MsgType == 0 ? *((PULONG)SrcMsg)++ : 00090 *((PULONG)SrcMsg)++ & 0xFFFF0000 | MsgType & 0xFFFF; 00091 00092 // 00093 // Set the ClientId appropriately and update the third dword 00094 // 00095 00096 *((PULONG_PTR)DstMsg)++ = ClientId == NULL ? *((PULONG_PTR)SrcMsg) : 00097 *((PULONG_PTR)ClientId)++; 00098 ((PULONG_PTR)SrcMsg)++; 00099 00100 *((PULONG_PTR)DstMsg)++ = ClientId == NULL ? *((PULONG_PTR)SrcMsg) : 00101 *((PULONG_PTR)ClientId); 00102 ((PULONG_PTR)SrcMsg)++; 00103 00104 // 00105 // Update the final two longwords in the header 00106 // 00107 00108 *((PULONG_PTR)DstMsg)++ = *((PULONG_PTR)SrcMsg)++; 00109 *((PULONG_PTR)DstMsg)++ = *((PULONG_PTR)SrcMsg)++; 00110 00111 // 00112 // Copy the data 00113 // 00114 00115 if (NumberDwords > 0) { 00116 00117 if ((ULONG_PTR) SrcMsgData & (sizeof(ULONGLONG)-1)) { 00118 00119 // 00120 // SrcMsgData is 4-byte aligned while DstMsg is 8-byte aligned. 00121 // 00122 00123 Temp1 = *((PULONG) SrcMsgData)++; 00124 00125 while (NumberDwords >= 3) { 00126 00127 Temp2 = *((PULONGLONG)SrcMsgData)++; 00128 *((PULONGLONG)DstMsg)++ = (Temp2 << 32) | Temp1; 00129 Temp1 = Temp2 & 0x0000FFFF; 00130 NumberDwords -= sizeof(ULONGLONG) / sizeof(ULONG); 00131 } 00132 00133 *(PULONG)DstMsg = (ULONG)Temp1; 00134 NumberDwords--; 00135 00136 } else { 00137 00138 // 00139 // Both DstMsg and SrcMsgData are 8-byte aligned; 00140 // copy 2 dwords (1 qword) at a time. 00141 // 00142 00143 while (NumberDwords >= sizeof(ULONGLONG) / sizeof(ULONG)) { 00144 00145 *((PULONGLONG)DstMsg)++ = *((PULONGLONG)SrcMsgData)++; 00146 NumberDwords -= sizeof(ULONGLONG) / sizeof(ULONG); 00147 } 00148 } 00149 00150 // 00151 // copy the remaining dwords, if any 00152 // 00153 00154 while (NumberDwords--) { 00155 *((PULONG)DstMsg)++ = *((PULONG)SrcMsgData)++; 00156 } 00157 } 00158 } 00159 00160

Generated on Sat May 15 19:40:39 2004 for test by doxygen 1.3.7