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.

101 lines
1.5 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. efimisc.cxx
  5. --*/
  6. #include <pch.cxx>
  7. // BUGBUG
  8. // There doesn't seem to be any interlockedexchange compexchg or interlocked decrement/increment.
  9. // so we define some here that work.
  10. //
  11. // Note that these won't work since they aren't really atomic, but my assumption is that
  12. // EFI is a single threaded non-preemptive environment so this won't really matter.
  13. LONG
  14. InterlockedIncrement (
  15. IN OUT LONG* Addend
  16. )
  17. {
  18. *Addend = (*Addend)++;
  19. return *Addend;
  20. }
  21. LONG
  22. InterlockedDecrement (
  23. IN OUT LONG* Addend
  24. )
  25. {
  26. *Addend = (*Addend)--;
  27. return *Addend;
  28. }
  29. LONG
  30. InterlockedExchange (
  31. IN OUT LONG* Target,
  32. LONG Value
  33. )
  34. {
  35. LONG temp;
  36. temp = *Target;
  37. (*Target) = Value;
  38. return temp;
  39. }
  40. LONG
  41. InterlockedCompareExchange (
  42. IN OUT LONG* Destination,
  43. IN LONG ExChange,
  44. IN LONG Comperand
  45. )
  46. {
  47. LONG temp = *Destination;
  48. if (Comperand == *Destination) {
  49. *Destination = ExChange;
  50. }
  51. return temp;
  52. }
  53. NTSTATUS
  54. NtDelayExecution (
  55. IN BOOLEAN Alertable,
  56. IN PLARGE_INTEGER DelayInterval
  57. )
  58. {
  59. BS->Stall(DelayInterval->LowPart);
  60. return STATUS_SUCCESS;
  61. }
  62. void
  63. _chkstk()
  64. {
  65. };
  66. void
  67. _aNchkstk()
  68. {
  69. };
  70. VOID
  71. EfiWaitForKey()
  72. {
  73. EFI_INPUT_KEY Key;
  74. WaitForSingleEvent (ST->ConIn->WaitForKey, 0);
  75. // flush keyboard
  76. ST->ConIn->ReadKeyStroke(ST->ConIn,&Key);
  77. }