-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Xtensa (OpenOCD Semihosting)
- Loading branch information
Showing
12 changed files
with
118 additions
and
14 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
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
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,39 @@ | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
use core::arch::asm; | ||
|
||
use super::{OperationNumber, ParamRegR, ParamRegW, RetReg}; | ||
|
||
/// Raw semihosting call with a parameter that will be read + modified by the host | ||
#[inline] | ||
pub unsafe fn syscall(number: OperationNumber, parameter: ParamRegW<'_>) -> RetReg { | ||
unsafe { | ||
let r; | ||
asm!( | ||
"break 1, 14", | ||
inout("a2") number.0 as usize => r, // OPERATION NUMBER REGISTER => RETURN REGISTER | ||
// Use inout because operation such as SYS_ELAPSED suggest that | ||
// PARAMETER REGISTER may be changed. | ||
inout("a3") parameter.0 => _, // PARAMETER REGISTER | ||
options(nostack, preserves_flags), | ||
); | ||
RetReg(r) | ||
} | ||
} | ||
|
||
/// Raw semihosting call with a parameter that will be read (but not modified) by the host | ||
#[inline] | ||
pub unsafe fn syscall_readonly(number: OperationNumber, parameter: ParamRegR<'_>) -> RetReg { | ||
unsafe { | ||
let r; | ||
asm!( | ||
"break 1, 14", | ||
inout("a2") number.0 as usize => r, // OPERATION NUMBER REGISTER => RETURN REGISTER | ||
// Use inout because operation such as SYS_ELAPSED suggest that | ||
// PARAMETER REGISTER may be changed. | ||
inout("a3") parameter.0 => _, // PARAMETER REGISTER | ||
options(nostack, preserves_flags, readonly), | ||
); | ||
RetReg(r) | ||
} | ||
} |
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