Add wrappers for new SMC extensions

This commit is contained in:
Michael Scire 2019-01-24 08:10:18 -08:00
parent de4c2ddae1
commit 9bf228de3e

View File

@ -20,7 +20,35 @@
static inline void RebootToRcm() {
SecmonArgs args = {0};
args.X[0] = 0xC3000401; /* smcSetConfig */
args.X[1] = 65001; /* Exosphere reboot to rcm */
args.X[3] = 1; /* Perform reboot. */
args.X[1] = 65001; /* Exosphere reboot */
args.X[3] = 1; /* Perform reboot to RCM. */
svcCallSecureMonitor(&args);
}
static inline void RebootToIramPayload() {
SecmonArgs args = {0};
args.X[0] = 0xC3000401; /* smcSetConfig */
args.X[1] = 65001; /* Exosphere reboot */
args.X[3] = 2; /* Perform reboot to payload at 0x40010000 in IRAM. */
svcCallSecureMonitor(&args);
}
static inline void CopyToIram(uintptr_t iram_addr, void *src_addr, size_t size) {
SecmonArgs args = {0};
args.X[0] = 0xF0000201; /* smcAmsIramCopy */
args.X[1] = (u64)src_addr; /* DRAM address */
args.X[2] = (u64)iram_addr; /* IRAM address */
args.X[3] = size; /* Amount to copy */
args.X[4] = 1; /* 1 = Write */
svcCallSecureMonitor(&args);
}
static inline void CopyFromIram(void *dst_addr, uintptr_t iram_addr, size_t size) {
SecmonArgs args = {0};
args.X[0] = 0xF0000201; /* smcAmsIramCopy */
args.X[1] = (u64)dst_addr; /* DRAM address */
args.X[2] = (u64)iram_addr; /* IRAM address */
args.X[3] = size; /* Amount to copy */
args.X[4] = 0; /* 0 = Read */
svcCallSecureMonitor(&args);
}