Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
2.7 KiB

  1. /**
  2. *** Copyright (C) 1996-97 Intel Corporation. All rights reserved.
  3. ***
  4. *** The information and source code contained herein is the exclusive
  5. *** property of Intel Corporation and may not be disclosed, examined
  6. *** or reproduced in whole or in part without explicit written authorization
  7. *** from the company.
  8. **/
  9. /*++
  10. Copyright (c) 1996 Intel Corporation
  11. Module Name:
  12. floatem.c
  13. Abstract:
  14. This module implements IA64 machine dependent floating point emulation
  15. functions to support the IEEE floating point standard.
  16. Author:
  17. Marius Cornea-Hasegan Sep-96
  18. Environment:
  19. Kernel mode only.
  20. Revision History:
  21. Modfied Jan. 97, Jan 98, Jun 98 (new API)
  22. --*/
  23. #include "ki.h"
  24. #include "ntfpia64.h"
  25. #include "floatem.h"
  26. extern LONG
  27. HalFpEmulate (
  28. ULONG trap_type,
  29. BUNDLE *pBundle,
  30. ULONGLONG *pipsr,
  31. ULONGLONG *pfpsr,
  32. ULONGLONG *pisr,
  33. ULONGLONG *ppreds,
  34. ULONGLONG *pifs,
  35. FP_STATE *fp_state
  36. );
  37. #define ALL_FP_REGISTERS_SAVED 0xFFFFFFFFFFFFFFFFi64
  38. int
  39. fp_emulate (
  40. int trap_type,
  41. BUNDLE *pbundle,
  42. ULONGLONG *pipsr,
  43. ULONGLONG *pfpsr,
  44. ULONGLONG *pisr,
  45. ULONGLONG *ppreds,
  46. ULONGLONG *pifs,
  47. void *fp_state
  48. )
  49. {
  50. //
  51. // Pointer to old Floating point state FLOATING_POINT_STATE
  52. //
  53. FLOATING_POINT_STATE *Ptr0FPState;
  54. PKEXCEPTION_FRAME LocalExceptionFramePtr;
  55. PKTRAP_FRAME LocalTrapFramePtr;
  56. FP_STATE FpState;
  57. int Status;
  58. ASSERT( KeGetCurrentIrql() >= APC_LEVEL);
  59. Ptr0FPState = (PFLOATING_POINT_STATE) fp_state;
  60. LocalExceptionFramePtr = (PKEXCEPTION_FRAME) (Ptr0FPState->ExceptionFrame);
  61. LocalTrapFramePtr = (PKTRAP_FRAME) (Ptr0FPState->TrapFrame);
  62. FpState.bitmask_low64 = ALL_FP_REGISTERS_SAVED;
  63. FpState.bitmask_high64 = ALL_FP_REGISTERS_SAVED;
  64. FpState.fp_state_low_preserved =(FP_STATE_LOW_PRESERVED *) &(LocalExceptionFramePtr->FltS0);
  65. FpState.fp_state_low_volatile = (FP_STATE_LOW_VOLATILE *) &(LocalTrapFramePtr->FltT0);
  66. FpState.fp_state_high_preserved = (FP_STATE_HIGH_PRESERVED *) &(LocalExceptionFramePtr->FltS4);
  67. FpState.fp_state_high_volatile = (FP_STATE_HIGH_VOLATILE *)GET_HIGH_FLOATING_POINT_REGISTER_SAVEAREA(KeGetCurrentThread()->StackBase);
  68. Status = HalFpEmulate(trap_type,
  69. pbundle,
  70. (PULONGLONG)pipsr,
  71. (PULONGLONG)pfpsr,
  72. (PULONGLONG)pisr,
  73. (PULONGLONG)ppreds,
  74. (PULONGLONG)pifs,
  75. &FpState
  76. );
  77. return Status;
  78. }