• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 Google Inc. All rights reserved
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining
5  * a copy of this software and associated documentation files
6  * (the "Software"), to deal in the Software without restriction,
7  * including without limitation the rights to use, copy, modify, merge,
8  * publish, distribute, sublicense, and/or sell copies of the Software,
9  * and to permit persons to whom the Software is furnished to do so,
10  * subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be
13  * included in all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22  */
23 
24 #include <spinlock.h>
25 
lk_interrupt_save(spin_lock_saved_state_t * statep,spin_lock_save_flags_t flags)26 void lk_interrupt_save(spin_lock_saved_state_t *statep, spin_lock_save_flags_t flags) {
27     arch_interrupt_save(statep, flags);
28 }
29 
lk_interrupt_restore(spin_lock_saved_state_t old_state,spin_lock_save_flags_t flags)30 void lk_interrupt_restore(spin_lock_saved_state_t old_state, spin_lock_save_flags_t flags) {
31     arch_interrupt_restore(old_state, flags);
32 }
33 
lk_ints_disabled(void)34 bool lk_ints_disabled(void) {
35     return arch_ints_disabled();
36 }
37 
38 #if defined(__arm__) || defined(__aarch64__)
lk_fiqs_disabled(void)39 bool lk_fiqs_disabled(void) {
40     return arch_fiqs_disabled();
41 }
42 #endif
43 
lk_spin_lock(spin_lock_t * lock)44 void lk_spin_lock(spin_lock_t *lock) {
45     spin_lock(lock);
46 }
47 
lk_spin_trylock(spin_lock_t * lock)48 int lk_spin_trylock(spin_lock_t *lock) {
49     return spin_trylock(lock);
50 }
51 
lk_spin_unlock(spin_lock_t * lock)52 void lk_spin_unlock(spin_lock_t *lock) {
53     spin_unlock(lock);
54 }
55