PageRenderTime 51ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/base/Kernel/Singularity/V1/Services/PlatformService.cs

#
C# | 90 lines | 71 code | 9 blank | 10 comment | 0 complexity | d6382e412a5a9cb40ee6d78db7bffcfa MD5 | raw file
  1. ////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Microsoft Research Singularity - Singularity ABI
  4. //
  5. // Copyright (c) Microsoft Corporation. All rights reserved.
  6. //
  7. // File: DebugService.cs
  8. //
  9. // Note:
  10. //
  11. using System;
  12. using System.Runtime.CompilerServices;
  13. using System.Threading;
  14. using Microsoft.Singularity;
  15. using Microsoft.Singularity.Hal;
  16. using Microsoft.Singularity.Memory;
  17. using Microsoft.Singularity.Isal;
  18. namespace Microsoft.Singularity.V1.Services
  19. {
  20. [AccessedByRuntime("Method called from HAL.cpp")]
  21. public struct PlatformService
  22. {
  23. [ExternalEntryPoint]
  24. [AccessedByRuntime("Called from HAL.cpp")]
  25. public static bool DisableInterrupts()
  26. {
  27. return PrivilegedGate.DisableInterrupts();
  28. }
  29. [ExternalEntryPoint]
  30. [AccessedByRuntime("Called from HAL.cpp")]
  31. public static void RestoreInterrupts(bool enabled)
  32. {
  33. PrivilegedGate.RestoreInterrupts(enabled);
  34. }
  35. [ExternalEntryPoint]
  36. [AccessedByRuntime("Called from HAL.cpp")]
  37. public static bool InterruptsDisabled()
  38. {
  39. return PrivilegedGate.InterruptsDisabled();
  40. }
  41. [ExternalEntryPoint]
  42. [AccessedByRuntime("Called from HAL.cpp")]
  43. [CLSCompliant(false)]
  44. public static void CleanAndInvalidateDCache(UIntPtr address, UIntPtr length)
  45. {
  46. #if ISA_ARM
  47. Microsoft.Singularity.Isal.Arm.XScale.Mmu.CleanInvalidateDCacheLines(address, length);
  48. #endif
  49. }
  50. [ExternalEntryPoint]
  51. [AccessedByRuntime("Called from HAL.cpp")]
  52. [CLSCompliant(false)]
  53. public static void InvalidateDCache(UIntPtr address, UIntPtr length)
  54. {
  55. #if ISA_ARM
  56. Microsoft.Singularity.Isal.Arm.XScale.Mmu.InvalidateDCacheLines(address, length);
  57. #endif
  58. }
  59. [ExternalEntryPoint]
  60. [AccessedByRuntime("Called from HAL.cpp")]
  61. [CLSCompliant(false)]
  62. public static void SetCacheAttributes(UIntPtr address, UIntPtr length, bool cacheable, bool bufferable)
  63. {
  64. #if ISA_ARM
  65. Microsoft.Singularity.Isal.Arm.XScale.Mmu.SetCacheAttributes(address, length, cacheable, bufferable);
  66. #endif
  67. }
  68. [ExternalEntryPoint]
  69. [AccessedByRuntime("Called from HAL.cpp")]
  70. public static int GetProcessorContextOffset()
  71. {
  72. return Platform.ThePlatform.CpuRecordPointerOffset;
  73. }
  74. [ExternalEntryPoint]
  75. [AccessedByRuntime("Called from HAL.cpp")]
  76. public static int GetThreadContextOffset()
  77. {
  78. return Platform.ThePlatform.ThreadRecordPointerOffset;
  79. }
  80. }
  81. }