-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This required a new callback to be added to the vm_arch struct for ARM. The old handle_smc function gets registered as the smc handler by default. The callback allows a user to register a custom smc handler instead. This is especially useful to allow SMC forwarding in the user's custom handler. Signed-off-by: Robbie VanVossen <[email protected]>
- Loading branch information
Showing
10 changed files
with
169 additions
and
37 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
34 changes: 34 additions & 0 deletions
34
libsel4vmmplatsupport/arch_include/arm/sel4vmmplatsupport/arch/smc.h
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,34 @@ | ||
/* | ||
* Copyright 2023, DornerWorks | ||
* | ||
* SPDX-License-Identifier: BSD-2-Clause | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <sel4vm/guest_vm.h> | ||
|
||
/* SMC Helpers */ | ||
seL4_Word smc_get_function_id(seL4_UserContext *u); | ||
seL4_Word smc_set_return_value(seL4_UserContext *u, seL4_Word val); | ||
seL4_Word smc_get_arg(seL4_UserContext *u, seL4_Word arg); | ||
void smc_set_arg(seL4_UserContext *u, seL4_Word arg, seL4_Word val); | ||
|
||
/*** | ||
* @function smc_forward(vm_vcpu_t *vcpu, seL4_UserContext *regs, seL4_ARM_SMC smc_cap) | ||
* Forward an SMC call using the appropriate capability | ||
* @param {vm_vcpu_t *} vcpu A handle to the VCPU | ||
* @param {seL4_UserContext *} regs A handle to the registers from the calling thread that want to make an SMC call | ||
* @param {seL4_ARM_SMC} smc_cap The SMC capability for the requested call | ||
* @return 0 on success, -1 on error | ||
*/ | ||
int smc_forward(vm_vcpu_t *vcpu, seL4_UserContext *regs, seL4_ARM_SMC smc_cap); | ||
|
||
/*** | ||
* @function vm_smc_handle_default(vm_vcpu_t *vcpu, seL4_UserContext *regs) | ||
* The default handler SMC faults. Will be called if a custom handler is not set for any given VM. | ||
* @param {vm_vcpu_t *} vcpu A handle to the VCPU | ||
* @param {seL4_UserContext *} regs A handle to the registers from the calling thread that want to make an SMC call | ||
* @return 0 on success, -1 on error | ||
*/ | ||
int vm_smc_handle_default(vm_vcpu_t *vcpu, seL4_UserContext *regs); |
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