Last change
on this file was
e16e8f2,
checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago
|
bootstuff
|
-
Property mode set to
100644
|
File size:
1.5 KB
|
Rev | Line | |
---|
[e16e8f2] | 1 | /*++ |
---|
| 2 | |
---|
| 3 | Copyright (c) 1998 Intel Corporation |
---|
| 4 | |
---|
| 5 | Module Name: |
---|
| 6 | |
---|
| 7 | lock.c |
---|
| 8 | |
---|
| 9 | Abstract: |
---|
| 10 | |
---|
| 11 | Implements FLOCK |
---|
| 12 | |
---|
| 13 | |
---|
| 14 | |
---|
| 15 | Revision History |
---|
| 16 | |
---|
| 17 | --*/ |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | #include "lib.h" |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | #ifndef __GNUC__ |
---|
| 25 | #pragma RUNTIME_CODE(RtAcquireLock) |
---|
| 26 | #endif |
---|
| 27 | VOID |
---|
| 28 | RtAcquireLock ( |
---|
| 29 | IN FLOCK *Lock |
---|
| 30 | ) |
---|
| 31 | /*++ |
---|
| 32 | |
---|
| 33 | Routine Description: |
---|
| 34 | |
---|
| 35 | Raising to the task priority level of the mutual exclusion |
---|
| 36 | lock, and then acquires ownership of the lock. |
---|
| 37 | |
---|
| 38 | Arguments: |
---|
| 39 | |
---|
| 40 | Lock - The lock to acquire |
---|
| 41 | |
---|
| 42 | Returns: |
---|
| 43 | |
---|
| 44 | Lock owned |
---|
| 45 | |
---|
| 46 | --*/ |
---|
| 47 | { |
---|
| 48 | if (BS) { |
---|
| 49 | if (BS->RaiseTPL != NULL) { |
---|
| 50 | Lock->OwnerTpl = uefi_call_wrapper(BS->RaiseTPL, 1, Lock->Tpl); |
---|
| 51 | } |
---|
| 52 | } |
---|
| 53 | else { |
---|
| 54 | if (LibRuntimeRaiseTPL != NULL) { |
---|
| 55 | Lock->OwnerTpl = LibRuntimeRaiseTPL(Lock->Tpl); |
---|
| 56 | } |
---|
| 57 | } |
---|
| 58 | Lock->Lock += 1; |
---|
| 59 | ASSERT (Lock->Lock == 1); |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | |
---|
| 63 | #ifndef __GNUC__ |
---|
| 64 | #pragma RUNTIME_CODE(RtAcquireLock) |
---|
| 65 | #endif |
---|
| 66 | VOID |
---|
| 67 | RtReleaseLock ( |
---|
| 68 | IN FLOCK *Lock |
---|
| 69 | ) |
---|
| 70 | /*++ |
---|
| 71 | |
---|
| 72 | Routine Description: |
---|
| 73 | |
---|
| 74 | Releases ownership of the mutual exclusion lock, and |
---|
| 75 | restores the previous task priority level. |
---|
| 76 | |
---|
| 77 | Arguments: |
---|
| 78 | |
---|
| 79 | Lock - The lock to release |
---|
| 80 | |
---|
| 81 | Returns: |
---|
| 82 | |
---|
| 83 | Lock unowned |
---|
| 84 | |
---|
| 85 | --*/ |
---|
| 86 | { |
---|
| 87 | EFI_TPL Tpl; |
---|
| 88 | |
---|
| 89 | Tpl = Lock->OwnerTpl; |
---|
| 90 | ASSERT(Lock->Lock == 1); |
---|
| 91 | Lock->Lock -= 1; |
---|
| 92 | if (BS) { |
---|
| 93 | if (BS->RestoreTPL != NULL) { |
---|
| 94 | uefi_call_wrapper(BS->RestoreTPL, 1, Tpl); |
---|
| 95 | } |
---|
| 96 | } |
---|
| 97 | else { |
---|
| 98 | if (LibRuntimeRestoreTPL != NULL) { |
---|
| 99 | LibRuntimeRestoreTPL(Tpl); |
---|
| 100 | } |
---|
| 101 | } |
---|
| 102 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.