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

getsetrg.c

Go to the documentation of this file.
00001 /*++ 00002 00003 Copyright (c) 1993 IBM Corporation and Microsoft Corporation 00004 00005 Module Name: 00006 00007 getsetrg.c 00008 00009 Abstract: 00010 00011 This module implement the code necessary to get and set register values. 00012 These routines are used during the emulation of unaligned data references 00013 and floating point exceptions. 00014 00015 Author: 00016 00017 Rick Simpson 6-Aug-1993 00018 00019 Based on MIPS version by David N. Cutler (davec) 17-Jun-1991 00020 00021 Environment: 00022 00023 Kernel mode only. 00024 00025 Revision History: 00026 00027 --*/ 00028 00029 #include "ki.h" 00030 00031 ULONG 00032 KiGetRegisterValue ( 00033 IN ULONG Register, 00034 IN PKEXCEPTION_FRAME ExceptionFrame, 00035 IN PKTRAP_FRAME TrapFrame 00036 ) 00037 00038 /*++ 00039 00040 Routine Description: 00041 00042 This function is called to get the value of a register from the specified 00043 exception or trap frame. 00044 00045 Arguments: 00046 00047 Register - Supplies the number of the register whose value is to be 00048 returned. Only GPRs (integer regs) are supported, numbered 0..31. 00049 00050 ExceptionFrame - Supplies a pointer to an exception frame. 00051 00052 TrapFrame - Supplies a pointer to a trap frame. 00053 00054 Return Value: 00055 00056 The value of the specified register is returned as the function value. 00057 00058 --*/ 00059 00060 { 00061 00062 // 00063 // Dispatch on the GP register number. 00064 // 00065 00066 switch (Register) { 00067 case 0: 00068 return TrapFrame->Gpr0; 00069 case 1: 00070 return TrapFrame->Gpr1; 00071 case 2: 00072 return TrapFrame->Gpr2; 00073 case 3: 00074 return TrapFrame->Gpr3; 00075 case 4: 00076 return TrapFrame->Gpr4; 00077 case 5: 00078 return TrapFrame->Gpr5; 00079 case 6: 00080 return TrapFrame->Gpr6; 00081 case 7: 00082 return TrapFrame->Gpr7; 00083 case 8: 00084 return TrapFrame->Gpr8; 00085 case 9: 00086 return TrapFrame->Gpr9; 00087 case 10: 00088 return TrapFrame->Gpr10; 00089 case 11: 00090 return TrapFrame->Gpr11; 00091 case 12: 00092 return TrapFrame->Gpr12; 00093 case 13: 00094 return ExceptionFrame->Gpr13; 00095 case 14: 00096 return ExceptionFrame->Gpr14; 00097 case 15: 00098 return ExceptionFrame->Gpr15; 00099 case 16: 00100 return ExceptionFrame->Gpr16; 00101 case 17: 00102 return ExceptionFrame->Gpr17; 00103 case 18: 00104 return ExceptionFrame->Gpr18; 00105 case 19: 00106 return ExceptionFrame->Gpr19; 00107 case 20: 00108 return ExceptionFrame->Gpr20; 00109 case 21: 00110 return ExceptionFrame->Gpr21; 00111 case 22: 00112 return ExceptionFrame->Gpr22; 00113 case 23: 00114 return ExceptionFrame->Gpr23; 00115 case 24: 00116 return ExceptionFrame->Gpr24; 00117 case 25: 00118 return ExceptionFrame->Gpr25; 00119 case 26: 00120 return ExceptionFrame->Gpr26; 00121 case 27: 00122 return ExceptionFrame->Gpr27; 00123 case 28: 00124 return ExceptionFrame->Gpr28; 00125 case 29: 00126 return ExceptionFrame->Gpr29; 00127 case 30: 00128 return ExceptionFrame->Gpr30; 00129 case 31: 00130 return ExceptionFrame->Gpr31; 00131 } 00132 return(0); // to eliminate a compiler warning 00133 } 00134 00135 VOID 00136 KiSetRegisterValue ( 00137 IN ULONG Register, 00138 IN ULONG Value, 00139 OUT PKEXCEPTION_FRAME ExceptionFrame, 00140 OUT PKTRAP_FRAME TrapFrame 00141 ) 00142 00143 /*++ 00144 00145 Routine Description: 00146 00147 This function is called to set the value of a register in the specified 00148 exception or trap frame. 00149 00150 Arguments: 00151 00152 Register - Supplies the number of the register whose value is to be 00153 stored. This routine handles only GPRs (integer regs), numbered 0..31. 00154 00155 Value - Supplies the value to be stored in the specified register. 00156 00157 ExceptionFrame - Supplies a pointer to an exception frame. 00158 00159 TrapFrame - Supplies a pointer to a trap frame. 00160 00161 Return Value: 00162 00163 None. 00164 00165 --*/ 00166 00167 { 00168 00169 // 00170 // Dispatch on the GP register number. 00171 // 00172 00173 switch (Register) { 00174 00175 case 0: 00176 TrapFrame->Gpr0 = Value; 00177 return; 00178 case 1: 00179 TrapFrame->Gpr1 = Value; 00180 return; 00181 case 2: 00182 TrapFrame->Gpr2 = Value; 00183 return; 00184 case 3: 00185 TrapFrame->Gpr3 = Value; 00186 return; 00187 case 4: 00188 TrapFrame->Gpr4 = Value; 00189 return; 00190 case 5: 00191 TrapFrame->Gpr5 = Value; 00192 return; 00193 case 6: 00194 TrapFrame->Gpr6 = Value; 00195 return; 00196 case 7: 00197 TrapFrame->Gpr7 = Value; 00198 return; 00199 case 8: 00200 TrapFrame->Gpr8 = Value; 00201 return; 00202 case 9: 00203 TrapFrame->Gpr9 = Value; 00204 return; 00205 case 10: 00206 TrapFrame->Gpr10 = Value; 00207 return; 00208 case 11: 00209 TrapFrame->Gpr11 = Value; 00210 return; 00211 case 12: 00212 TrapFrame->Gpr12 = Value; 00213 return; 00214 case 13: 00215 ExceptionFrame->Gpr13 = Value; 00216 return; 00217 case 14: 00218 ExceptionFrame->Gpr14 = Value; 00219 return; 00220 case 15: 00221 ExceptionFrame->Gpr15 = Value; 00222 return; 00223 case 16: 00224 ExceptionFrame->Gpr16 = Value; 00225 return; 00226 case 17: 00227 ExceptionFrame->Gpr17 = Value; 00228 return; 00229 case 18: 00230 ExceptionFrame->Gpr18 = Value; 00231 return; 00232 case 19: 00233 ExceptionFrame->Gpr19 = Value; 00234 return; 00235 case 20: 00236 ExceptionFrame->Gpr20 = Value; 00237 return; 00238 case 21: 00239 ExceptionFrame->Gpr21 = Value; 00240 return; 00241 case 22: 00242 ExceptionFrame->Gpr22 = Value; 00243 return; 00244 case 23: 00245 ExceptionFrame->Gpr23 = Value; 00246 return; 00247 case 24: 00248 ExceptionFrame->Gpr24 = Value; 00249 return; 00250 case 25: 00251 ExceptionFrame->Gpr25 = Value; 00252 return; 00253 case 26: 00254 ExceptionFrame->Gpr26 = Value; 00255 return; 00256 case 27: 00257 ExceptionFrame->Gpr27 = Value; 00258 return; 00259 case 28: 00260 ExceptionFrame->Gpr28 = Value; 00261 return; 00262 case 29: 00263 ExceptionFrame->Gpr29 = Value; 00264 return; 00265 case 30: 00266 ExceptionFrame->Gpr30 = Value; 00267 return; 00268 case 31: 00269 ExceptionFrame->Gpr31 = Value; 00270 return; 00271 00272 } 00273 } 00274 00275 DOUBLE 00276 KiGetFloatRegisterValue ( 00277 IN ULONG Register, 00278 IN PKEXCEPTION_FRAME ExceptionFrame, 00279 IN PKTRAP_FRAME TrapFrame 00280 ) 00281 00282 /*++ 00283 00284 Routine Description: 00285 00286 This function is called to get the value of a floating point register 00287 from the specified exception or trap frame. 00288 00289 Arguments: 00290 00291 Register - Supplies the number of the register whose value is to be 00292 returned. Only FPRs (float regs) are supported, numbered 0..31. 00293 00294 ExceptionFrame - Supplies a pointer to an exception frame. 00295 00296 TrapFrame - Supplies a pointer to a trap frame. 00297 00298 Return Value: 00299 00300 The value of the specified register is returned as the function value. 00301 00302 --*/ 00303 00304 { 00305 00306 // 00307 // Dispatch on the FP register number. 00308 // 00309 00310 switch (Register) { 00311 case 0: 00312 return TrapFrame->Fpr0; 00313 case 1: 00314 return TrapFrame->Fpr1; 00315 case 2: 00316 return TrapFrame->Fpr2; 00317 case 3: 00318 return TrapFrame->Fpr3; 00319 case 4: 00320 return TrapFrame->Fpr4; 00321 case 5: 00322 return TrapFrame->Fpr5; 00323 case 6: 00324 return TrapFrame->Fpr6; 00325 case 7: 00326 return TrapFrame->Fpr7; 00327 case 8: 00328 return TrapFrame->Fpr8; 00329 case 9: 00330 return TrapFrame->Fpr9; 00331 case 10: 00332 return TrapFrame->Fpr10; 00333 case 11: 00334 return TrapFrame->Fpr11; 00335 case 12: 00336 return TrapFrame->Fpr12; 00337 case 13: 00338 return TrapFrame->Fpr13; 00339 case 14: 00340 return ExceptionFrame->Fpr14; 00341 case 15: 00342 return ExceptionFrame->Fpr15; 00343 case 16: 00344 return ExceptionFrame->Fpr16; 00345 case 17: 00346 return ExceptionFrame->Fpr17; 00347 case 18: 00348 return ExceptionFrame->Fpr18; 00349 case 19: 00350 return ExceptionFrame->Fpr19; 00351 case 20: 00352 return ExceptionFrame->Fpr20; 00353 case 21: 00354 return ExceptionFrame->Fpr21; 00355 case 22: 00356 return ExceptionFrame->Fpr22; 00357 case 23: 00358 return ExceptionFrame->Fpr23; 00359 case 24: 00360 return ExceptionFrame->Fpr24; 00361 case 25: 00362 return ExceptionFrame->Fpr25; 00363 case 26: 00364 return ExceptionFrame->Fpr26; 00365 case 27: 00366 return ExceptionFrame->Fpr27; 00367 case 28: 00368 return ExceptionFrame->Fpr28; 00369 case 29: 00370 return ExceptionFrame->Fpr29; 00371 case 30: 00372 return ExceptionFrame->Fpr30; 00373 case 31: 00374 return ExceptionFrame->Fpr31; 00375 } 00376 } 00377 00378 VOID 00379 KiSetFloatRegisterValue ( 00380 IN ULONG Register, 00381 IN DOUBLE Value, 00382 OUT PKEXCEPTION_FRAME ExceptionFrame, 00383 OUT PKTRAP_FRAME TrapFrame 00384 ) 00385 00386 /*++ 00387 00388 Routine Description: 00389 00390 This function is called to set the value of a floating point register 00391 in the specified exception or trap frame. 00392 00393 Arguments: 00394 00395 Register - Supplies the number of the register whose value is to be 00396 stored. This routine handles only Fprs (float regs), numbered 0..31. 00397 00398 Value - Supplies the value to be stored in the specified register. 00399 00400 ExceptionFrame - Supplies a pointer to an exception frame. 00401 00402 TrapFrame - Supplies a pointer to a trap frame. 00403 00404 Return Value: 00405 00406 None. 00407 00408 --*/ 00409 00410 { 00411 00412 // 00413 // Dispatch on the FP register number. 00414 // 00415 00416 switch (Register) { 00417 00418 case 0: 00419 TrapFrame->Fpr0 = Value; 00420 return; 00421 case 1: 00422 TrapFrame->Fpr1 = Value; 00423 return; 00424 case 2: 00425 TrapFrame->Fpr2 = Value; 00426 return; 00427 case 3: 00428 TrapFrame->Fpr3 = Value; 00429 return; 00430 case 4: 00431 TrapFrame->Fpr4 = Value; 00432 return; 00433 case 5: 00434 TrapFrame->Fpr5 = Value; 00435 return; 00436 case 6: 00437 TrapFrame->Fpr6 = Value; 00438 return; 00439 case 7: 00440 TrapFrame->Fpr7 = Value; 00441 return; 00442 case 8: 00443 TrapFrame->Fpr8 = Value; 00444 return; 00445 case 9: 00446 TrapFrame->Fpr9 = Value; 00447 return; 00448 case 10: 00449 TrapFrame->Fpr10 = Value; 00450 return; 00451 case 11: 00452 TrapFrame->Fpr11 = Value; 00453 return; 00454 case 12: 00455 TrapFrame->Fpr12 = Value; 00456 return; 00457 case 13: 00458 TrapFrame->Fpr13 = Value; 00459 return; 00460 case 14: 00461 ExceptionFrame->Fpr14 = Value; 00462 return; 00463 case 15: 00464 ExceptionFrame->Fpr15 = Value; 00465 return; 00466 case 16: 00467 ExceptionFrame->Fpr16 = Value; 00468 return; 00469 case 17: 00470 ExceptionFrame->Fpr17 = Value; 00471 return; 00472 case 18: 00473 ExceptionFrame->Fpr18 = Value; 00474 return; 00475 case 19: 00476 ExceptionFrame->Fpr19 = Value; 00477 return; 00478 case 20: 00479 ExceptionFrame->Fpr20 = Value; 00480 return; 00481 case 21: 00482 ExceptionFrame->Fpr21 = Value; 00483 return; 00484 case 22: 00485 ExceptionFrame->Fpr22 = Value; 00486 return; 00487 case 23: 00488 ExceptionFrame->Fpr23 = Value; 00489 return; 00490 case 24: 00491 ExceptionFrame->Fpr24 = Value; 00492 return; 00493 case 25: 00494 ExceptionFrame->Fpr25 = Value; 00495 return; 00496 case 26: 00497 ExceptionFrame->Fpr26 = Value; 00498 return; 00499 case 27: 00500 ExceptionFrame->Fpr27 = Value; 00501 return; 00502 case 28: 00503 ExceptionFrame->Fpr28 = Value; 00504 return; 00505 case 29: 00506 ExceptionFrame->Fpr29 = Value; 00507 return; 00508 case 30: 00509 ExceptionFrame->Fpr30 = Value; 00510 return; 00511 case 31: 00512 ExceptionFrame->Fpr31 = Value; 00513 return; 00514 00515 } 00516 }

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