-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
464 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,16 @@ | ||
#ifndef _ARCH_REGIONS_H | ||
#define _ARCH_REGIONS_H | ||
|
||
#define DEVICE_REGION (0xF000000000ULL) | ||
#ifndef KERNEL_REGION | ||
#define KERNEL_REGION (0x40000000ULL) | ||
#endif | ||
|
||
#ifndef DEVICE_DESCRIPTOR_REGION | ||
#define DEVICE_DESCRIPTOR_REGION (0x7E000000000ULL) | ||
#endif | ||
|
||
#ifndef DEVICE_REGION | ||
#define DEVICE_REGION (0x7D000000000ULL) | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Acquire lock using Compare and Swap instruction. | ||
* | ||
* Compare for 0 with acquire semantics, and swap 1. If failed to acquire, use | ||
* load exclusive semantics to monitor the address and enter WFE. | ||
* | ||
* void spin_lock(spinlock_t *lock); | ||
*/ | ||
spinlock_acquire: | ||
.globl spinlock_acquire | ||
/* | ||
mov w2, #1 | ||
1: mov w1, wzr | ||
2: casa w1, w2, [x0] | ||
cbz w1, 3f | ||
ldxr w1, [x0] | ||
cbz w1, 2b | ||
wfe | ||
b 1b | ||
3: | ||
ret | ||
*/ | ||
|
||
mov w2, #1 | ||
sevl | ||
l1: wfe | ||
l2: ldaxr w1, [x0] | ||
cbnz w1, l1 | ||
stxr w1, w2, [x0] | ||
cbnz w1, l2 | ||
ret | ||
|
||
/* | ||
* Release lock previously acquired by spin_lock. | ||
* | ||
* Use store-release to unconditionally clear the spinlock variable. | ||
* Store operation generates an event to all cores waiting in WFE | ||
* when address is monitored by the global monitor. | ||
* | ||
* void spin_unlock(spinlock_t *lock); | ||
*/ | ||
spinlock_release: | ||
.globl spinlock_release | ||
stlr wzr, [x0] | ||
ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.