commit 3f5c3cc04b6ddfad477a47ce25281cfd0286468c parent 7f7df2235551ec2a52bae913aa10f25afefe7078 Author: Roberto Vargas <roberto.vargas@arm.com> Date: Fri, 19 Oct 2018 14:59:23 +0100 Merge branch 'master' of ssh://gerrit.oss.arm.com/trusted-firmware/rcode Change-Id: Iab9bdbc67e4c253ee2af29ce112f29ccf593817d Diffstat:
164 files changed, 1132 insertions(+), 248 deletions(-)
diff --git a/arch/arm64/arch.s b/arch/arm64/arch.s @@ -115,20 +115,19 @@ exception: stp x25,x24,[sp,#-16]! stp x27,x26,[sp,#-16]! stp x29,x28,[sp,#-16]! - stp xzr,x30,[sp,#-16]! - mrs x1,S3_6_C4_C0_6 /* SPSR_R */ mrs x0,S3_6_C4_C0_3 /* ELR_R */ - stp x1,x0,[sp,#-16]! + stp x0,x30,[sp,#-16]! - mrs x1,S3_6_C6_C0_6 /* FAR_R */ - mrs x0,S3_6_C5_C2_6 /* ESR_R */ + mrs x1,S3_6_C5_C2_6 /* ESR_R */ + mrs x0,S3_6_C4_C0_6 /* SPSR_R */ stp x1,x0,[sp,#-16]! msr spsel,#0 - mov x0,sp + mov x1,sp msr spsel,#1 - stp xzr,x0,[sp,#-16]! /* SP_EL0 */ + mrs x0,S3_6_C6_C0_6 /* FAR_R */ + stp x1,x0,[sp,#-16]! mov x0,sp /* x0 = trapframe */ msr spsel,#0 @@ -145,20 +144,20 @@ outsync: .text swtch: - ldp xzr,x1,[x0],#16 - mov sp,x1 + ldp x2,x1,[x0],#16 + mov sp,x2 msr spsel,#1 mov sp,x0 - ldp x1,x0,[sp],#16 msr S3_6_C6_C0_6,x1 /* FAR_R */ - msr S3_6_C5_C2_6,x0 /* ESR_R */ ldp x1,x0,[sp],#16 - msr S3_6_C4_C0_6,x1 /* SPSR_R */ + msr S3_6_C5_C2_6,x1 /* ESR_R */ + msr S3_6_C4_C0_6,x0 /* SPSR_R */ + + ldp x0,x30,[sp],#16 msr S3_6_C4_C0_3,x0 /* ELR_R */ - ldp xzr,x30,[sp],#16 ldp x29,x28,[sp],#16 ldp x27,x26,[sp],#16 ldp x25,x24,[sp],#16 @@ -201,4 +200,3 @@ vectbl: b exception; nop /* IRQ/vIRQ */ b exception; nop /* FIQ/vFIQ */ b exception; nop /* SError/VSError */ - diff --git a/include/rcode.h b/include/rcode.h @@ -70,6 +70,9 @@ struct bssmap { void *uartbase; const char *errstr; Rmucmd *cmd; + + unsigned char enable; /* System realm enablement */ + unsigned char hascrypto; /* System-wide memory encryption */ }; struct rowidx { @@ -78,20 +81,29 @@ struct rowidx { }; struct trapframe { - unsigned long long xzr1; void *sp; unsigned long long far; - unsigned long long esr; - unsigned long long spsr; + + unsigned long long esr, spsr; + void *elr; - unsigned long long xzr0,x30,x29,x28,x27; - unsigned long long x26,x25,x24,x23; - unsigned long long x22,x21,x20,x19; - unsigned long long x18,x17,x16,x15; - unsigned long long x14,x13,x12,x11; - unsigned long long x10,x9,x8,x7; - unsigned long long x6,x5,x4,x3; - unsigned long long x2,x1,x0; + unsigned long long x30; + + unsigned long long x29,x28; + unsigned long long x27,x26; + unsigned long long x25,x24; + unsigned long long x23,x22; + unsigned long long x21,x20; + unsigned long long x19,x18; + unsigned long long x17,x16; + unsigned long long x15,x14; + unsigned long long x13,x12; + unsigned long long x11,x10; + unsigned long long x9, x8; + unsigned long long x7, x6; + unsigned long long x5, x4; + unsigned long long x3, x2; + unsigned long long x1, x0; }; struct rmucmd { @@ -111,7 +123,7 @@ bss(void) #define bss bss() extern void trap(struct trapframe *fp); -extern void badrmc(int error); +extern void badcmd(int error); extern void dopanic(void); extern void panic(const char *msg); extern void printk(const char * restrict fmt, ...); diff --git a/include/rmu.h b/include/rmu.h @@ -1,5 +1,28 @@ #define RMU_MAJ_VER 0 #define RMU_MIN_VER 1 +enum rmcerr { + SUCCESS = 0, /* Command completed successfully */ + NOTCOMPLETE = 1, /* Interruptible command did not complete */ + EPARAMETER = 2, /* Invalid input param provided */ + ERESOURCESTATE = 3, /* RMU object state pre-cond violation */ + ERESOURCEINUSE = 4, /* RMU object busy */ + EREALMSTATE = 5, /* Realm state pre-cond violation */ + EGRANULEOWNER = 6, /* RPG owner pre-cond violation */ + EGRANULESTATE = 7, /* RPG state pre-cond violation */ + EGRANULEVISIB = 8, /* RPG visibility pre-cond violation */ + EGRANULEINTEG = 9, /* RPG integrity pre-cond violation */ + ECRYPTO = 10, /* Crypto check failed */ + EGRANULEACCESS = 11, /* Mapped addr not within PAR */ + FGRANULEPINNED = 12, /* RPG is RMU pinned */ + FRETRY = 13, /* Caller should retry the command */ + FFAULT = 14, /* Input address translation fault */ + EDEBUGSTATE = 15, /* Realm debug is not allowed */ + FGRANULEFUSED = 16, /* RPG is fused */ + NR_RMCERRS +}; + extern void RMU_System_InterfaceVersion(unsigned long *maj, unsigned long *min); +extern void RMU_System_Status(int *enabled); +extern void RMU_System_Enable(void); diff --git a/include/types.h b/include/types.h @@ -91,6 +91,43 @@ struct rscb { struct rscb_event_ctx event_ctx; //#64 }; +struct crgte { + unsigned char props; //#2 +}; + +struct l0rgte { + unsigned char valid; //#1 + unsigned char l1rgt_en; //#1 + unsigned char crgt_en; //#1 + unsigned char type; //#5 + unsigned char res0_0; //#4 + unsigned long long baddr; //#40 + unsigned int res0_1; //#12 + unsigned int start; //#12 + unsigned long long cbaddr; //#40 + unsigned int end; //#12 +}; + +struct rgte { + unsigned char state; //#4 + unsigned char owner_perms; //#3 + unsigned char visibility; //#1 + unsigned char global_perms; //#2 + unsigned char secure_access; //#2 + unsigned long long owner; //#40 + unsigned char res0_0; //#8 + unsigned char fuse_level; //#4 + unsigned char lock; //#1 + unsigned char lock_ext; //#3 + unsigned char pin; //#1 + unsigned char integ; //#1 + unsigned char res0_1; //#1 + unsigned char export_depth; //#2 + unsigned char res0_2; //#3 + unsigned long long mapped_addr; //#44 + unsigned char res0_3; //#8 +}; + /* prototypes */ extern int pack_rscb_state(uint64_t buf[], struct rscb_state *sp); extern int unpack_rscb_state(uint64_t buf[], struct rscb_state *sp); @@ -113,3 +150,11 @@ extern int unpack_rscb_rpu_cfg(uint64_t buf[], struct rscb_rpu_cfg *sp); extern int pack_rscb_ctrl(uint64_t buf[], struct rscb_ctrl *sp); extern int unpack_rscb_ctrl(uint64_t buf[], struct rscb_ctrl *sp); +extern int pack_crgte(uint64_t buf[], struct crgte *sp); +extern int unpack_crgte(uint64_t buf[], struct crgte *sp); + +extern int pack_l0rgte(uint64_t buf[], struct l0rgte *sp); +extern int unpack_l0rgte(uint64_t buf[], struct l0rgte *sp); + +extern int pack_rgte(uint64_t buf[], struct rgte *sp); +extern int unpack_rgte(uint64_t buf[], struct rgte *sp); diff --git a/scripts/rmu.cmd b/scripts/rmu.cmd @@ -41,3 +41,28 @@ 9 7 RMU.REC.WriteVectorRegister 9 8 RMU.REC.ReadSystemRegister 9 9 RMU.REC.WriteSystemRegister +10 0 RMU.MDT.BufferSize +10 1 RMU.MDT.Register +10 2 RMU.MDT.Release +10 3 RMU.MDT.Info +10 4 RMU.MDT.WriteStorage +10 5 RMU.MDT.ReadStorage +10 6 RMU.MDT.Move +11 0 RMU.Granule.Invalidate +11 1 RMU.Granule.Clean +11 2 RMU.Granule.Info +11 3 RMU.Granule.Detail +11 4 RMU.Granule.SetPermissions +11 5 RMU.Granule.Sync +12 0 RMU.Granule.Claim +12 1 RMU.Granule.Release +13 0 RMU.Granule.AddInit +13 1 RMU.Granule.Add +13 2 RMU.Granule.Reclaim +14 0 RMU.Granule.Fuse +14 1 RMU.Granule.Shatter +15 0 RMU.Granule.SetGlobalVisibility +16 0 RMU.Granule.ExportInit +16 1 RMU.Granule.Export +16 2 RMU.Granule.ImportInit +16 3 RMU.Granule.Import diff --git a/src/libc/Makefile b/src/libc/Makefile @@ -4,7 +4,7 @@ include arch/$(ARCH)/$(SYS)/objlst.mk LIBSYS = arch/$(ARCH)/$(SYS) LIBARCH = arch/$(ARCH) -MORECFLAGS = -I. +MORECFLAGS = -I. -w COBJ = abort.o \ __assert.o \ diff --git a/src/libc/__getc.c b/src/libc/__getc.c @@ -1,5 +1,6 @@ #include <errno.h> #include <stdio.h> +#include <stdlib.h> #include "syscall.h" #undef getc diff --git a/src/libc/arch/amd64/bsd/gensys.sh b/src/libc/arch/amd64/bsd/gensys.sh @@ -20,7 +20,7 @@ $name: retq 1: movl %eax,(errno) - movl $-1,%eax + movl \$-1,%eax retq EOF done diff --git a/src/libhdl/Makefile b/src/libhdl/Makefile @@ -1,49 +1,74 @@ PROJECTDIR=../.. include $(PROJECTDIR)/scripts/rules.mk -OBJS = hdl_RMU_Crypto_Random.o \ - hdl_RMU_Local_Load.o \ +OBJS = hdl_RMU_System_InterfaceVersion.o \ + hdl_RMU_System_Status.o \ + hdl_RMU_System_Enable.o \ hdl_RMU_Local_Status.o \ + hdl_RMU_Local_Load.o \ hdl_RMU_Local_Validate.o \ - hdl_RMU_REC_Prepare.o \ - hdl_RMU_REC_ReadGeneralPurposeRegister.o \ - hdl_RMU_REC_ReadSystemRegister.o \ - hdl_RMU_REC_ReadVectorRegister.o \ - hdl_RMU_REC_Register.o \ - hdl_RMU_REC_Release.o \ - hdl_RMU_REC_Size.o \ - hdl_RMU_REC_WriteGeneralPurposeRegister.o \ - hdl_RMU_REC_WriteSystemRegister.o \ - hdl_RMU_REC_WriteVectorRegister.o \ - hdl_RMU_Realm_Activate.o \ - hdl_RMU_Realm_AttestationReport.o \ - hdl_RMU_Realm_AttestationReportInit.o \ - hdl_RMU_Realm_AttestationReportSize.o \ - hdl_RMU_Realm_CreateZeroMetadata.o \ - hdl_RMU_Realm_DeriveBindingKey.o \ - hdl_RMU_Realm_ExtendBindingKeySeedValue.o \ - hdl_RMU_Realm_GetBindingKeySeedValue.o \ - hdl_RMU_Realm_GetMetadata.o \ - hdl_RMU_Realm_GetParameterInheritance.o \ + hdl_RMU_Crypto_Random.o \ + hdl_RMU_Realm_Register.o \ + hdl_RMU_Realm_Release.o \ + hdl_RMU_Realm_InvalidateCurrent.o \ + hdl_RMU_Realm_Invalidate.o \ hdl_RMU_Realm_GetParameterValue.o \ - hdl_RMU_Realm_Info.o \ + hdl_RMU_Realm_SetParameterValue.o \ + hdl_RMU_Realm_GetParameterInheritance.o \ + hdl_RMU_Realm_SetParameterInheritance.o \ hdl_RMU_Realm_Initialize.o \ - hdl_RMU_Realm_Invalidate.o \ - hdl_RMU_Realm_InvalidateCurrent.o \ - hdl_RMU_Realm_Populate.o \ hdl_RMU_Realm_Prepare.o \ + hdl_RMU_Realm_Populate.o \ + hdl_RMU_Realm_Activate.o \ + hdl_RMU_Realm_Info.o \ hdl_RMU_Realm_ReadMemory.o \ - hdl_RMU_Realm_Register.o \ - hdl_RMU_Realm_Release.o \ - hdl_RMU_Realm_SetBindingKeySeedLock.o \ - hdl_RMU_Realm_SetCommandTrap.o \ - hdl_RMU_Realm_SetMetadata.o \ - hdl_RMU_Realm_SetParameterInheritance.o \ - hdl_RMU_Realm_SetParameterValue.o \ hdl_RMU_Realm_WriteMemory.o \ - hdl_RMU_System_Enable.o \ - hdl_RMU_System_InterfaceVersion.o \ - hdl_RMU_System_Status.o \ + hdl_RMU_Realm_SetMetadata.o \ + hdl_RMU_Realm_GetMetadata.o \ + hdl_RMU_Realm_CreateZeroMetadata.o \ + hdl_RMU_Realm_SetCommandTrap.o \ + hdl_RMU_Realm_AttestationReportSize.o \ + hdl_RMU_Realm_AttestationReportInit.o \ + hdl_RMU_Realm_AttestationReport.o \ + hdl_RMU_Realm_ExtendBindingKeySeedValue.o \ + hdl_RMU_Realm_SetBindingKeySeedLock.o \ + hdl_RMU_Realm_DeriveBindingKey.o \ + hdl_RMU_Realm_GetBindingKeySeedValue.o \ + hdl_RMU_REC_Size.o \ + hdl_RMU_REC_Register.o \ + hdl_RMU_REC_Prepare.o \ + hdl_RMU_REC_Release.o \ + hdl_RMU_REC_ReadGeneralPurposeRegister.o \ + hdl_RMU_REC_WriteGeneralPurposeRegister.o \ + hdl_RMU_REC_ReadVectorRegister.o \ + hdl_RMU_REC_WriteVectorRegister.o \ + hdl_RMU_REC_ReadSystemRegister.o \ + hdl_RMU_REC_WriteSystemRegister.o \ + hdl_RMU_MDT_BufferSize.o \ + hdl_RMU_MDT_Register.o \ + hdl_RMU_MDT_Release.o \ + hdl_RMU_MDT_Info.o \ + hdl_RMU_MDT_WriteStorage.o \ + hdl_RMU_MDT_ReadStorage.o \ + hdl_RMU_MDT_Move.o \ + hdl_RMU_Granule_Invalidate.o \ + hdl_RMU_Granule_Clean.o \ + hdl_RMU_Granule_Info.o \ + hdl_RMU_Granule_Detail.o \ + hdl_RMU_Granule_SetPermissions.o \ + hdl_RMU_Granule_Sync.o \ + hdl_RMU_Granule_Claim.o \ + hdl_RMU_Granule_Release.o \ + hdl_RMU_Granule_AddInit.o \ + hdl_RMU_Granule_Add.o \ + hdl_RMU_Granule_Reclaim.o \ + hdl_RMU_Granule_Fuse.o \ + hdl_RMU_Granule_Shatter.o \ + hdl_RMU_Granule_SetGlobalVisibility.o \ + hdl_RMU_Granule_ExportInit.o \ + hdl_RMU_Granule_Export.o \ + hdl_RMU_Granule_ImportInit.o \ + hdl_RMU_Granule_Import.o \ TARGET = $(LIBDIR)/libhdl.a diff --git a/src/libhdl/hdl_RMU_Crypto_Random.c b/src/libhdl/hdl_RMU_Crypto_Random.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_Crypto_Random(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Crypto_Random"); } diff --git a/src/libhdl/hdl_RMU_Granule_Add.c b/src/libhdl/hdl_RMU_Granule_Add.c @@ -0,0 +1,8 @@ +#include <rmu.h> +#include <rcode.h> + +void +hdl_RMU_Granule_Add(Rmucmd *cmd) +{ + panic("hdl_RMU_Granule_Add"); +} diff --git a/src/libhdl/hdl_RMU_Granule_AddInit.c b/src/libhdl/hdl_RMU_Granule_AddInit.c @@ -0,0 +1,8 @@ +#include <rmu.h> +#include <rcode.h> + +void +hdl_RMU_Granule_AddInit(Rmucmd *cmd) +{ + panic("hdl_RMU_Granule_AddInit"); +} diff --git a/src/libhdl/hdl_RMU_Granule_Claim.c b/src/libhdl/hdl_RMU_Granule_Claim.c @@ -0,0 +1,8 @@ +#include <rmu.h> +#include <rcode.h> + +void +hdl_RMU_Granule_Claim(Rmucmd *cmd) +{ + panic("hdl_RMU_Granule_Claim"); +} diff --git a/src/libhdl/hdl_RMU_Granule_Clean.c b/src/libhdl/hdl_RMU_Granule_Clean.c @@ -0,0 +1,8 @@ +#include <rmu.h> +#include <rcode.h> + +void +hdl_RMU_Granule_Clean(Rmucmd *cmd) +{ + panic("hdl_RMU_Granule_Clean"); +} diff --git a/src/libhdl/hdl_RMU_Granule_Detail.c b/src/libhdl/hdl_RMU_Granule_Detail.c @@ -0,0 +1,8 @@ +#include <rmu.h> +#include <rcode.h> + +void +hdl_RMU_Granule_Detail(Rmucmd *cmd) +{ + panic("hdl_RMU_Granule_Detail"); +} diff --git a/src/libhdl/hdl_RMU_Granule_Export.c b/src/libhdl/hdl_RMU_Granule_Export.c @@ -0,0 +1,8 @@ +#include <rmu.h> +#include <rcode.h> + +void +hdl_RMU_Granule_Export(Rmucmd *cmd) +{ + panic("hdl_RMU_Granule_Export"); +} diff --git a/src/libhdl/hdl_RMU_Granule_ExportInit.c b/src/libhdl/hdl_RMU_Granule_ExportInit.c @@ -0,0 +1,8 @@ +#include <rmu.h> +#include <rcode.h> + +void +hdl_RMU_Granule_ExportInit(Rmucmd *cmd) +{ + panic("hdl_RMU_Granule_ExportInit"); +} diff --git a/src/libhdl/hdl_RMU_Granule_Fuse.c b/src/libhdl/hdl_RMU_Granule_Fuse.c @@ -0,0 +1,8 @@ +#include <rmu.h> +#include <rcode.h> + +void +hdl_RMU_Granule_Fuse(Rmucmd *cmd) +{ + panic("hdl_RMU_Granule_Fuse"); +} diff --git a/src/libhdl/hdl_RMU_Granule_Import.c b/src/libhdl/hdl_RMU_Granule_Import.c @@ -0,0 +1,8 @@ +#include <rmu.h> +#include <rcode.h> + +void +hdl_RMU_Granule_Import(Rmucmd *cmd) +{ + panic("hdl_RMU_Granule_Import"); +} diff --git a/src/libhdl/hdl_RMU_Granule_ImportInit.c b/src/libhdl/hdl_RMU_Granule_ImportInit.c @@ -0,0 +1,8 @@ +#include <rmu.h> +#include <rcode.h> + +void +hdl_RMU_Granule_ImportInit(Rmucmd *cmd) +{ + panic("hdl_RMU_Granule_ImportInit"); +} diff --git a/src/libhdl/hdl_RMU_Granule_Info.c b/src/libhdl/hdl_RMU_Granule_Info.c @@ -0,0 +1,8 @@ +#include <rmu.h> +#include <rcode.h> + +void +hdl_RMU_Granule_Info(Rmucmd *cmd) +{ + panic("hdl_RMU_Granule_Info"); +} diff --git a/src/libhdl/hdl_RMU_Granule_Invalidate.c b/src/libhdl/hdl_RMU_Granule_Invalidate.c @@ -0,0 +1,8 @@ +#include <rmu.h> +#include <rcode.h> + +void +hdl_RMU_Granule_Invalidate(Rmucmd *cmd) +{ + panic("hdl_RMU_Granule_Invalidate"); +} diff --git a/src/libhdl/hdl_RMU_Granule_Reclaim.c b/src/libhdl/hdl_RMU_Granule_Reclaim.c @@ -0,0 +1,8 @@ +#include <rmu.h> +#include <rcode.h> + +void +hdl_RMU_Granule_Reclaim(Rmucmd *cmd) +{ + panic("hdl_RMU_Granule_Reclaim"); +} diff --git a/src/libhdl/hdl_RMU_Granule_Release.c b/src/libhdl/hdl_RMU_Granule_Release.c @@ -0,0 +1,8 @@ +#include <rmu.h> +#include <rcode.h> + +void +hdl_RMU_Granule_Release(Rmucmd *cmd) +{ + panic("hdl_RMU_Granule_Release"); +} diff --git a/src/libhdl/hdl_RMU_Granule_SetGlobalVisibility.c b/src/libhdl/hdl_RMU_Granule_SetGlobalVisibility.c @@ -0,0 +1,8 @@ +#include <rmu.h> +#include <rcode.h> + +void +hdl_RMU_Granule_SetGlobalVisibility(Rmucmd *cmd) +{ + panic("hdl_RMU_Granule_SetGlobalVisibility"); +} diff --git a/src/libhdl/hdl_RMU_Granule_SetPermissions.c b/src/libhdl/hdl_RMU_Granule_SetPermissions.c @@ -0,0 +1,8 @@ +#include <rmu.h> +#include <rcode.h> + +void +hdl_RMU_Granule_SetPermissions(Rmucmd *cmd) +{ + panic("hdl_RMU_Granule_SetPermissions"); +} diff --git a/src/libhdl/hdl_RMU_Granule_Shatter.c b/src/libhdl/hdl_RMU_Granule_Shatter.c @@ -0,0 +1,8 @@ +#include <rmu.h> +#include <rcode.h> + +void +hdl_RMU_Granule_Shatter(Rmucmd *cmd) +{ + panic("hdl_RMU_Granule_Shatter"); +} diff --git a/src/libhdl/hdl_RMU_Granule_Sync.c b/src/libhdl/hdl_RMU_Granule_Sync.c @@ -0,0 +1,8 @@ +#include <rmu.h> +#include <rcode.h> + +void +hdl_RMU_Granule_Sync(Rmucmd *cmd) +{ + panic("hdl_RMU_Granule_Sync"); +} diff --git a/src/libhdl/hdl_RMU_Local_Load.c b/src/libhdl/hdl_RMU_Local_Load.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_Local_Load(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Local_Load"); } diff --git a/src/libhdl/hdl_RMU_Local_Status.c b/src/libhdl/hdl_RMU_Local_Status.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_Local_Status(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Local_Status"); } diff --git a/src/libhdl/hdl_RMU_Local_Validate.c b/src/libhdl/hdl_RMU_Local_Validate.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_Local_Validate(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Local_Validate"); } diff --git a/src/libhdl/hdl_RMU_MDT_BufferSize.c b/src/libhdl/hdl_RMU_MDT_BufferSize.c @@ -0,0 +1,8 @@ +#include <rmu.h> +#include <rcode.h> + +void +hdl_RMU_MDT_BufferSize(Rmucmd *cmd) +{ + panic("hdl_RMU_MDT_BufferSize"); +} diff --git a/src/libhdl/hdl_RMU_MDT_Info.c b/src/libhdl/hdl_RMU_MDT_Info.c @@ -0,0 +1,8 @@ +#include <rmu.h> +#include <rcode.h> + +void +hdl_RMU_MDT_Info(Rmucmd *cmd) +{ + panic("hdl_RMU_MDT_Info"); +} diff --git a/src/libhdl/hdl_RMU_MDT_Move.c b/src/libhdl/hdl_RMU_MDT_Move.c @@ -0,0 +1,8 @@ +#include <rmu.h> +#include <rcode.h> + +void +hdl_RMU_MDT_Move(Rmucmd *cmd) +{ + panic("hdl_RMU_MDT_Move"); +} diff --git a/src/libhdl/hdl_RMU_MDT_ReadStorage.c b/src/libhdl/hdl_RMU_MDT_ReadStorage.c @@ -0,0 +1,8 @@ +#include <rmu.h> +#include <rcode.h> + +void +hdl_RMU_MDT_ReadStorage(Rmucmd *cmd) +{ + panic("hdl_RMU_MDT_ReadStorage"); +} diff --git a/src/libhdl/hdl_RMU_MDT_Register.c b/src/libhdl/hdl_RMU_MDT_Register.c @@ -0,0 +1,8 @@ +#include <rmu.h> +#include <rcode.h> + +void +hdl_RMU_MDT_Register(Rmucmd *cmd) +{ + panic("hdl_RMU_MDT_Register"); +} diff --git a/src/libhdl/hdl_RMU_MDT_Release.c b/src/libhdl/hdl_RMU_MDT_Release.c @@ -0,0 +1,8 @@ +#include <rmu.h> +#include <rcode.h> + +void +hdl_RMU_MDT_Release(Rmucmd *cmd) +{ + panic("hdl_RMU_MDT_Release"); +} diff --git a/src/libhdl/hdl_RMU_MDT_WriteStorage.c b/src/libhdl/hdl_RMU_MDT_WriteStorage.c @@ -0,0 +1,8 @@ +#include <rmu.h> +#include <rcode.h> + +void +hdl_RMU_MDT_WriteStorage(Rmucmd *cmd) +{ + panic("hdl_RMU_MDT_WriteStorage"); +} diff --git a/src/libhdl/hdl_RMU_REC_Prepare.c b/src/libhdl/hdl_RMU_REC_Prepare.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_REC_Prepare(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_REC_Prepare"); } diff --git a/src/libhdl/hdl_RMU_REC_ReadGeneralPurposeRegister.c b/src/libhdl/hdl_RMU_REC_ReadGeneralPurposeRegister.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_REC_ReadGeneralPurposeRegister(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_REC_ReadGeneralPurposeRegister"); } diff --git a/src/libhdl/hdl_RMU_REC_ReadSystemRegister.c b/src/libhdl/hdl_RMU_REC_ReadSystemRegister.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_REC_ReadSystemRegister(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_REC_ReadSystemRegister"); } diff --git a/src/libhdl/hdl_RMU_REC_ReadVectorRegister.c b/src/libhdl/hdl_RMU_REC_ReadVectorRegister.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_REC_ReadVectorRegister(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_REC_ReadVectorRegister"); } diff --git a/src/libhdl/hdl_RMU_REC_Register.c b/src/libhdl/hdl_RMU_REC_Register.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_REC_Register(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_REC_Register"); } diff --git a/src/libhdl/hdl_RMU_REC_Release.c b/src/libhdl/hdl_RMU_REC_Release.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_REC_Release(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_REC_Release"); } diff --git a/src/libhdl/hdl_RMU_REC_Size.c b/src/libhdl/hdl_RMU_REC_Size.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_REC_Size(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_REC_Size"); } diff --git a/src/libhdl/hdl_RMU_REC_WriteGeneralPurposeRegister.c b/src/libhdl/hdl_RMU_REC_WriteGeneralPurposeRegister.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_REC_WriteGeneralPurposeRegister(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_REC_WriteGeneralPurposeRegister"); } diff --git a/src/libhdl/hdl_RMU_REC_WriteSystemRegister.c b/src/libhdl/hdl_RMU_REC_WriteSystemRegister.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_REC_WriteSystemRegister(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_REC_WriteSystemRegister"); } diff --git a/src/libhdl/hdl_RMU_REC_WriteVectorRegister.c b/src/libhdl/hdl_RMU_REC_WriteVectorRegister.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_REC_WriteVectorRegister(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_REC_WriteVectorRegister"); } diff --git a/src/libhdl/hdl_RMU_Realm_Activate.c b/src/libhdl/hdl_RMU_Realm_Activate.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_Realm_Activate(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Realm_Activate"); } diff --git a/src/libhdl/hdl_RMU_Realm_AttestationReport.c b/src/libhdl/hdl_RMU_Realm_AttestationReport.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_Realm_AttestationReport(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Realm_AttestationReport"); } diff --git a/src/libhdl/hdl_RMU_Realm_AttestationReportInit.c b/src/libhdl/hdl_RMU_Realm_AttestationReportInit.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_Realm_AttestationReportInit(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Realm_AttestationReportInit"); } diff --git a/src/libhdl/hdl_RMU_Realm_AttestationReportSize.c b/src/libhdl/hdl_RMU_Realm_AttestationReportSize.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_Realm_AttestationReportSize(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Realm_AttestationReportSize"); } diff --git a/src/libhdl/hdl_RMU_Realm_CreateZeroMetadata.c b/src/libhdl/hdl_RMU_Realm_CreateZeroMetadata.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_Realm_CreateZeroMetadata(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Realm_CreateZeroMetadata"); } diff --git a/src/libhdl/hdl_RMU_Realm_DeriveBindingKey.c b/src/libhdl/hdl_RMU_Realm_DeriveBindingKey.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_Realm_DeriveBindingKey(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Realm_DeriveBindingKey"); } diff --git a/src/libhdl/hdl_RMU_Realm_ExtendBindingKeySeedValue.c b/src/libhdl/hdl_RMU_Realm_ExtendBindingKeySeedValue.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_Realm_ExtendBindingKeySeedValue(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Realm_ExtendBindingKeySeedValue"); } diff --git a/src/libhdl/hdl_RMU_Realm_GetBindingKeySeedValue.c b/src/libhdl/hdl_RMU_Realm_GetBindingKeySeedValue.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_Realm_GetBindingKeySeedValue(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Realm_GetBindingKeySeedValue"); } diff --git a/src/libhdl/hdl_RMU_Realm_GetMetadata.c b/src/libhdl/hdl_RMU_Realm_GetMetadata.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_Realm_GetMetadata(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Realm_GetMetadata"); } diff --git a/src/libhdl/hdl_RMU_Realm_GetParameterInheritance.c b/src/libhdl/hdl_RMU_Realm_GetParameterInheritance.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_Realm_GetParameterInheritance(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Realm_GetParameterInheritance"); } diff --git a/src/libhdl/hdl_RMU_Realm_GetParameterValue.c b/src/libhdl/hdl_RMU_Realm_GetParameterValue.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_Realm_GetParameterValue(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Realm_GetParameterValue"); } diff --git a/src/libhdl/hdl_RMU_Realm_Info.c b/src/libhdl/hdl_RMU_Realm_Info.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_Realm_Info(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Realm_Info"); } diff --git a/src/libhdl/hdl_RMU_Realm_Initialize.c b/src/libhdl/hdl_RMU_Realm_Initialize.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_Realm_Initialize(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Realm_Initialize"); } diff --git a/src/libhdl/hdl_RMU_Realm_Invalidate.c b/src/libhdl/hdl_RMU_Realm_Invalidate.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_Realm_Invalidate(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Realm_Invalidate"); } diff --git a/src/libhdl/hdl_RMU_Realm_InvalidateCurrent.c b/src/libhdl/hdl_RMU_Realm_InvalidateCurrent.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_Realm_InvalidateCurrent(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Realm_InvalidateCurrent"); } diff --git a/src/libhdl/hdl_RMU_Realm_Populate.c b/src/libhdl/hdl_RMU_Realm_Populate.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_Realm_Populate(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Realm_Populate"); } diff --git a/src/libhdl/hdl_RMU_Realm_Prepare.c b/src/libhdl/hdl_RMU_Realm_Prepare.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_Realm_Prepare(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Realm_Prepare"); } diff --git a/src/libhdl/hdl_RMU_Realm_ReadMemory.c b/src/libhdl/hdl_RMU_Realm_ReadMemory.c @@ -1,7 +1,8 @@ -#include <rcode.h> +#include <rmu.h> +#include <rcode.h> void hdl_RMU_Realm_ReadMemory(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Realm_ReadMemory"); } diff --git a/src/libhdl/hdl_RMU_Realm_Register.c b/src/libhdl/hdl_RMU_Realm_Register.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_Realm_Register(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Realm_Register"); } diff --git a/src/libhdl/hdl_RMU_Realm_Release.c b/src/libhdl/hdl_RMU_Realm_Release.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_Realm_Release(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Realm_Release"); } diff --git a/src/libhdl/hdl_RMU_Realm_SetBindingKeySeedLock.c b/src/libhdl/hdl_RMU_Realm_SetBindingKeySeedLock.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_Realm_SetBindingKeySeedLock(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Realm_SetBindingKeySeedLock"); } diff --git a/src/libhdl/hdl_RMU_Realm_SetCommandTrap.c b/src/libhdl/hdl_RMU_Realm_SetCommandTrap.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_Realm_SetCommandTrap(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Realm_SetCommandTrap"); } diff --git a/src/libhdl/hdl_RMU_Realm_SetMetadata.c b/src/libhdl/hdl_RMU_Realm_SetMetadata.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_Realm_SetMetadata(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Realm_SetMetadata"); } diff --git a/src/libhdl/hdl_RMU_Realm_SetParameterInheritance.c b/src/libhdl/hdl_RMU_Realm_SetParameterInheritance.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_Realm_SetParameterInheritance(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Realm_SetParameterInheritance"); } diff --git a/src/libhdl/hdl_RMU_Realm_SetParameterValue.c b/src/libhdl/hdl_RMU_Realm_SetParameterValue.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_Realm_SetParameterValue(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Realm_SetParameterValue"); } diff --git a/src/libhdl/hdl_RMU_Realm_WriteMemory.c b/src/libhdl/hdl_RMU_Realm_WriteMemory.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_Realm_WriteMemory(Rmucmd *cmd) { - panic("not implemented"); + panic("hdl_RMU_Realm_WriteMemory"); } diff --git a/src/libhdl/hdl_RMU_System_Enable.c b/src/libhdl/hdl_RMU_System_Enable.c @@ -1,7 +1,8 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_System_Enable(Rmucmd *cmd) { - panic("not implemented"); + RMU_System_Enable(); } diff --git a/src/libhdl/hdl_RMU_System_Status.c b/src/libhdl/hdl_RMU_System_Status.c @@ -1,7 +1,11 @@ +#include <rmu.h> #include <rcode.h> void hdl_RMU_System_Status(Rmucmd *cmd) { - panic("not implemented"); + int enabled; + + RMU_System_Status(&enabled); + cmd->fp->x1 = enabled; } diff --git a/src/librmu/Makefile b/src/librmu/Makefile @@ -1,49 +1,74 @@ PROJECTDIR=../.. include $(PROJECTDIR)/scripts/rules.mk -OBJS = RMU_Crypto_Random.o \ - RMU_Local_Load.o \ +OBJS = RMU_System_InterfaceVersion.o \ + RMU_System_Status.o \ + RMU_System_Enable.o \ RMU_Local_Status.o \ + RMU_Local_Load.o \ RMU_Local_Validate.o \ - RMU_REC_Prepare.o \ - RMU_REC_ReadGeneralPurposeRegister.o \ - RMU_REC_ReadSystemRegister.o \ - RMU_REC_ReadVectorRegister.o \ - RMU_REC_Register.o \ - RMU_REC_Release.o \ - RMU_REC_Size.o \ - RMU_REC_WriteGeneralPurposeRegister.o \ - RMU_REC_WriteSystemRegister.o \ - RMU_REC_WriteVectorRegister.o \ - RMU_Realm_Activate.o \ - RMU_Realm_AttestationReport.o \ - RMU_Realm_AttestationReportInit.o \ - RMU_Realm_AttestationReportSize.o \ - RMU_Realm_CreateZeroMetadata.o \ - RMU_Realm_DeriveBindingKey.o \ - RMU_Realm_ExtendBindingKeySeedValue.o \ - RMU_Realm_GetBindingKeySeedValue.o \ - RMU_Realm_GetMetadata.o \ - RMU_Realm_GetParameterInheritance.o \ + RMU_Crypto_Random.o \ + RMU_Realm_Register.o \ + RMU_Realm_Release.o \ + RMU_Realm_InvalidateCurrent.o \ + RMU_Realm_Invalidate.o \ RMU_Realm_GetParameterValue.o \ - RMU_Realm_Info.o \ + RMU_Realm_SetParameterValue.o \ + RMU_Realm_GetParameterInheritance.o \ + RMU_Realm_SetParameterInheritance.o \ RMU_Realm_Initialize.o \ - RMU_Realm_Invalidate.o \ - RMU_Realm_InvalidateCurrent.o \ - RMU_Realm_Populate.o \ RMU_Realm_Prepare.o \ + RMU_Realm_Populate.o \ + RMU_Realm_Activate.o \ + RMU_Realm_Info.o \ RMU_Realm_ReadMemory.o \ - RMU_Realm_Register.o \ - RMU_Realm_Release.o \ - RMU_Realm_SetBindingKeySeedLock.o \ - RMU_Realm_SetCommandTrap.o \ - RMU_Realm_SetMetadata.o \ - RMU_Realm_SetParameterInheritance.o \ - RMU_Realm_SetParameterValue.o \ RMU_Realm_WriteMemory.o \ - RMU_System_Enable.o \ - RMU_System_InterfaceVersion.o \ - RMU_System_Status.o \ + RMU_Realm_SetMetadata.o \ + RMU_Realm_GetMetadata.o \ + RMU_Realm_CreateZeroMetadata.o \ + RMU_Realm_SetCommandTrap.o \ + RMU_Realm_AttestationReportSize.o \ + RMU_Realm_AttestationReportInit.o \ + RMU_Realm_AttestationReport.o \ + RMU_Realm_ExtendBindingKeySeedValue.o \ + RMU_Realm_SetBindingKeySeedLock.o \ + RMU_Realm_DeriveBindingKey.o \ + RMU_Realm_GetBindingKeySeedValue.o \ + RMU_REC_Size.o \ + RMU_REC_Register.o \ + RMU_REC_Prepare.o \ + RMU_REC_Release.o \ + RMU_REC_ReadGeneralPurposeRegister.o \ + RMU_REC_WriteGeneralPurposeRegister.o \ + RMU_REC_ReadVectorRegister.o \ + RMU_REC_WriteVectorRegister.o \ + RMU_REC_ReadSystemRegister.o \ + RMU_REC_WriteSystemRegister.o \ + RMU_MDT_BufferSize.o \ + RMU_MDT_Register.o \ + RMU_MDT_Release.o \ + RMU_MDT_Info.o \ + RMU_MDT_WriteStorage.o \ + RMU_MDT_ReadStorage.o \ + RMU_MDT_Move.o \ + RMU_Granule_Invalidate.o \ + RMU_Granule_Clean.o \ + RMU_Granule_Info.o \ + RMU_Granule_Detail.o \ + RMU_Granule_SetPermissions.o \ + RMU_Granule_Sync.o \ + RMU_Granule_Claim.o \ + RMU_Granule_Release.o \ + RMU_Granule_AddInit.o \ + RMU_Granule_Add.o \ + RMU_Granule_Reclaim.o \ + RMU_Granule_Fuse.o \ + RMU_Granule_Shatter.o \ + RMU_Granule_SetGlobalVisibility.o \ + RMU_Granule_ExportInit.o \ + RMU_Granule_Export.o \ + RMU_Granule_ImportInit.o \ + RMU_Granule_Import.o \ TARGET = $(LIBDIR)/librmu.a diff --git a/src/librmu/RMU_Crypto_Random.c b/src/librmu/RMU_Crypto_Random.c @@ -3,5 +3,5 @@ void RMU_Crypto_Random(void) { - panic("not implemented"); + panic("RMU_Crypto_Random"); } diff --git a/src/librmu/RMU_Granule_Add.c b/src/librmu/RMU_Granule_Add.c @@ -0,0 +1,7 @@ +#include <rcode.h> + +void +RMU_Granule_Add(void) +{ + panic("RMU_Granule_Add"); +} diff --git a/src/librmu/RMU_Granule_AddInit.c b/src/librmu/RMU_Granule_AddInit.c @@ -0,0 +1,7 @@ +#include <rcode.h> + +void +RMU_Granule_AddInit(void) +{ + panic("RMU_Granule_AddInit"); +} diff --git a/src/librmu/RMU_Granule_Claim.c b/src/librmu/RMU_Granule_Claim.c @@ -0,0 +1,7 @@ +#include <rcode.h> + +void +RMU_Granule_Claim(void) +{ + panic("RMU_Granule_Claim"); +} diff --git a/src/librmu/RMU_Granule_Clean.c b/src/librmu/RMU_Granule_Clean.c @@ -0,0 +1,7 @@ +#include <rcode.h> + +void +RMU_Granule_Clean(void) +{ + panic("RMU_Granule_Clean"); +} diff --git a/src/librmu/RMU_Granule_Detail.c b/src/librmu/RMU_Granule_Detail.c @@ -0,0 +1,7 @@ +#include <rcode.h> + +void +RMU_Granule_Detail(void) +{ + panic("RMU_Granule_Detail"); +} diff --git a/src/librmu/RMU_Granule_Export.c b/src/librmu/RMU_Granule_Export.c @@ -0,0 +1,7 @@ +#include <rcode.h> + +void +RMU_Granule_Export(void) +{ + panic("RMU_Granule_Export"); +} diff --git a/src/librmu/RMU_Granule_ExportInit.c b/src/librmu/RMU_Granule_ExportInit.c @@ -0,0 +1,7 @@ +#include <rcode.h> + +void +RMU_Granule_ExportInit(void) +{ + panic("RMU_Granule_ExportInit"); +} diff --git a/src/librmu/RMU_Granule_Fuse.c b/src/librmu/RMU_Granule_Fuse.c @@ -0,0 +1,7 @@ +#include <rcode.h> + +void +RMU_Granule_Fuse(void) +{ + panic("RMU_Granule_Fuse"); +} diff --git a/src/librmu/RMU_Granule_Import.c b/src/librmu/RMU_Granule_Import.c @@ -0,0 +1,7 @@ +#include <rcode.h> + +void +RMU_Granule_Import(void) +{ + panic("RMU_Granule_Import"); +} diff --git a/src/librmu/RMU_Granule_ImportInit.c b/src/librmu/RMU_Granule_ImportInit.c @@ -0,0 +1,7 @@ +#include <rcode.h> + +void +RMU_Granule_ImportInit(void) +{ + panic("RMU_Granule_ImportInit"); +} diff --git a/src/librmu/RMU_Granule_Info.c b/src/librmu/RMU_Granule_Info.c @@ -0,0 +1,7 @@ +#include <rcode.h> + +void +RMU_Granule_Info(void) +{ + panic("RMU_Granule_Info"); +} diff --git a/src/librmu/RMU_Granule_Invalidate.c b/src/librmu/RMU_Granule_Invalidate.c @@ -0,0 +1,7 @@ +#include <rcode.h> + +void +RMU_Granule_Invalidate(void) +{ + panic("RMU_Granule_Invalidate"); +} diff --git a/src/librmu/RMU_Granule_Reclaim.c b/src/librmu/RMU_Granule_Reclaim.c @@ -0,0 +1,7 @@ +#include <rcode.h> + +void +RMU_Granule_Reclaim(void) +{ + panic("RMU_Granule_Reclaim"); +} diff --git a/src/librmu/RMU_Granule_Release.c b/src/librmu/RMU_Granule_Release.c @@ -0,0 +1,7 @@ +#include <rcode.h> + +void +RMU_Granule_Release(void) +{ + panic("RMU_Granule_Release"); +} diff --git a/src/librmu/RMU_Granule_SetGlobalVisibility.c b/src/librmu/RMU_Granule_SetGlobalVisibility.c @@ -0,0 +1,7 @@ +#include <rcode.h> + +void +RMU_Granule_SetGlobalVisibility(void) +{ + panic("RMU_Granule_SetGlobalVisibility"); +} diff --git a/src/librmu/RMU_Granule_SetPermissions.c b/src/librmu/RMU_Granule_SetPermissions.c @@ -0,0 +1,7 @@ +#include <rcode.h> + +void +RMU_Granule_SetPermissions(void) +{ + panic("RMU_Granule_SetPermissions"); +} diff --git a/src/librmu/RMU_Granule_Shatter.c b/src/librmu/RMU_Granule_Shatter.c @@ -0,0 +1,7 @@ +#include <rcode.h> + +void +RMU_Granule_Shatter(void) +{ + panic("RMU_Granule_Shatter"); +} diff --git a/src/librmu/RMU_Granule_Sync.c b/src/librmu/RMU_Granule_Sync.c @@ -0,0 +1,7 @@ +#include <rcode.h> + +void +RMU_Granule_Sync(void) +{ + panic("RMU_Granule_Sync"); +} diff --git a/src/librmu/RMU_Local_Load.c b/src/librmu/RMU_Local_Load.c @@ -3,5 +3,5 @@ void RMU_Local_Load(void) { - panic("not implemented"); + panic("RMU_Local_Load"); } diff --git a/src/librmu/RMU_Local_Status.c b/src/librmu/RMU_Local_Status.c @@ -3,5 +3,5 @@ void RMU_Local_Status(void) { - panic("not implemented"); + panic("RMU_Local_Status"); } diff --git a/src/librmu/RMU_Local_Validate.c b/src/librmu/RMU_Local_Validate.c @@ -3,5 +3,5 @@ void RMU_Local_Validate(void) { - panic("not implemented"); + panic("RMU_Local_Validate"); } diff --git a/src/librmu/RMU_MDT_BufferSize.c b/src/librmu/RMU_MDT_BufferSize.c @@ -0,0 +1,7 @@ +#include <rcode.h> + +void +RMU_MDT_BufferSize(void) +{ + panic("RMU_MDT_BufferSize"); +} diff --git a/src/librmu/RMU_MDT_Info.c b/src/librmu/RMU_MDT_Info.c @@ -0,0 +1,7 @@ +#include <rcode.h> + +void +RMU_MDT_Info(void) +{ + panic("RMU_MDT_Info"); +} diff --git a/src/librmu/RMU_MDT_Move.c b/src/librmu/RMU_MDT_Move.c @@ -0,0 +1,7 @@ +#include <rcode.h> + +void +RMU_MDT_Move(void) +{ + panic("RMU_MDT_Move"); +} diff --git a/src/librmu/RMU_MDT_ReadStorage.c b/src/librmu/RMU_MDT_ReadStorage.c @@ -0,0 +1,7 @@ +#include <rcode.h> + +void +RMU_MDT_ReadStorage(void) +{ + panic("RMU_MDT_ReadStorage"); +} diff --git a/src/librmu/RMU_MDT_Register.c b/src/librmu/RMU_MDT_Register.c @@ -0,0 +1,7 @@ +#include <rcode.h> + +void +RMU_MDT_Register(void) +{ + panic("RMU_MDT_Register"); +} diff --git a/src/librmu/RMU_MDT_Release.c b/src/librmu/RMU_MDT_Release.c @@ -0,0 +1,7 @@ +#include <rcode.h> + +void +RMU_MDT_Release(void) +{ + panic("RMU_MDT_Release"); +} diff --git a/src/librmu/RMU_MDT_WriteStorage.c b/src/librmu/RMU_MDT_WriteStorage.c @@ -0,0 +1,7 @@ +#include <rcode.h> + +void +RMU_MDT_WriteStorage(void) +{ + panic("RMU_MDT_WriteStorage"); +} diff --git a/src/librmu/RMU_REC_Prepare.c b/src/librmu/RMU_REC_Prepare.c @@ -3,5 +3,5 @@ void RMU_REC_Prepare(void) { - panic("not implemented"); + panic("RMU_REC_Prepare"); } diff --git a/src/librmu/RMU_REC_ReadGeneralPurposeRegister.c b/src/librmu/RMU_REC_ReadGeneralPurposeRegister.c @@ -3,5 +3,5 @@ void RMU_REC_ReadGeneralPurposeRegister(void) { - panic("not implemented"); + panic("RMU_REC_ReadGeneralPurposeRegister"); } diff --git a/src/librmu/RMU_REC_ReadSystemRegister.c b/src/librmu/RMU_REC_ReadSystemRegister.c @@ -3,5 +3,5 @@ void RMU_REC_ReadSystemRegister(void) { - panic("not implemented"); + panic("RMU_REC_ReadSystemRegister"); } diff --git a/src/librmu/RMU_REC_ReadVectorRegister.c b/src/librmu/RMU_REC_ReadVectorRegister.c @@ -3,5 +3,5 @@ void RMU_REC_ReadVectorRegister(void) { - panic("not implemented"); + panic("RMU_REC_ReadVectorRegister"); } diff --git a/src/librmu/RMU_REC_Register.c b/src/librmu/RMU_REC_Register.c @@ -3,5 +3,5 @@ void RMU_REC_Register(void) { - panic("not implemented"); + panic("RMU_REC_Register"); } diff --git a/src/librmu/RMU_REC_Release.c b/src/librmu/RMU_REC_Release.c @@ -3,5 +3,5 @@ void RMU_REC_Release(void) { - panic("not implemented"); + panic("RMU_REC_Release"); } diff --git a/src/librmu/RMU_REC_Size.c b/src/librmu/RMU_REC_Size.c @@ -3,5 +3,5 @@ void RMU_REC_Size(void) { - panic("not implemented"); + panic("RMU_REC_Size"); } diff --git a/src/librmu/RMU_REC_WriteGeneralPurposeRegister.c b/src/librmu/RMU_REC_WriteGeneralPurposeRegister.c @@ -3,5 +3,5 @@ void RMU_REC_WriteGeneralPurposeRegister(void) { - panic("not implemented"); + panic("RMU_REC_WriteGeneralPurposeRegister"); } diff --git a/src/librmu/RMU_REC_WriteSystemRegister.c b/src/librmu/RMU_REC_WriteSystemRegister.c @@ -3,5 +3,5 @@ void RMU_REC_WriteSystemRegister(void) { - panic("not implemented"); + panic("RMU_REC_WriteSystemRegister"); } diff --git a/src/librmu/RMU_REC_WriteVectorRegister.c b/src/librmu/RMU_REC_WriteVectorRegister.c @@ -3,5 +3,5 @@ void RMU_REC_WriteVectorRegister(void) { - panic("not implemented"); + panic("RMU_REC_WriteVectorRegister"); } diff --git a/src/librmu/RMU_Realm_Activate.c b/src/librmu/RMU_Realm_Activate.c @@ -3,5 +3,5 @@ void RMU_Realm_Activate(void) { - panic("not implemented"); + panic("RMU_Realm_Activate"); } diff --git a/src/librmu/RMU_Realm_AttestationReport.c b/src/librmu/RMU_Realm_AttestationReport.c @@ -3,5 +3,5 @@ void RMU_Realm_AttestationReport(void) { - panic("not implemented"); + panic("RMU_Realm_AttestationReport"); } diff --git a/src/librmu/RMU_Realm_AttestationReportInit.c b/src/librmu/RMU_Realm_AttestationReportInit.c @@ -3,5 +3,5 @@ void RMU_Realm_AttestationReportInit(void) { - panic("not implemented"); + panic("RMU_Realm_AttestationReportInit"); } diff --git a/src/librmu/RMU_Realm_AttestationReportSize.c b/src/librmu/RMU_Realm_AttestationReportSize.c @@ -3,5 +3,5 @@ void RMU_Realm_AttestationReportSize(void) { - panic("not implemented"); + panic("RMU_Realm_AttestationReportSize"); } diff --git a/src/librmu/RMU_Realm_CreateZeroMetadata.c b/src/librmu/RMU_Realm_CreateZeroMetadata.c @@ -3,5 +3,5 @@ void RMU_Realm_CreateZeroMetadata(void) { - panic("not implemented"); + panic("RMU_Realm_CreateZeroMetadata"); } diff --git a/src/librmu/RMU_Realm_DeriveBindingKey.c b/src/librmu/RMU_Realm_DeriveBindingKey.c @@ -3,5 +3,5 @@ void RMU_Realm_DeriveBindingKey(void) { - panic("not implemented"); + panic("RMU_Realm_DeriveBindingKey"); } diff --git a/src/librmu/RMU_Realm_ExtendBindingKeySeedValue.c b/src/librmu/RMU_Realm_ExtendBindingKeySeedValue.c @@ -3,5 +3,5 @@ void RMU_Realm_ExtendBindingKeySeedValue(void) { - panic("not implemented"); + panic("RMU_Realm_ExtendBindingKeySeedValue"); } diff --git a/src/librmu/RMU_Realm_GetBindingKeySeedValue.c b/src/librmu/RMU_Realm_GetBindingKeySeedValue.c @@ -3,5 +3,5 @@ void RMU_Realm_GetBindingKeySeedValue(void) { - panic("not implemented"); + panic("RMU_Realm_GetBindingKeySeedValue"); } diff --git a/src/librmu/RMU_Realm_GetMetadata.c b/src/librmu/RMU_Realm_GetMetadata.c @@ -3,5 +3,5 @@ void RMU_Realm_GetMetadata(void) { - panic("not implemented"); + panic("RMU_Realm_GetMetadata"); } diff --git a/src/librmu/RMU_Realm_GetParameterInheritance.c b/src/librmu/RMU_Realm_GetParameterInheritance.c @@ -3,5 +3,5 @@ void RMU_Realm_GetParameterInheritance(void) { - panic("not implemented"); + panic("RMU_Realm_GetParameterInheritance"); } diff --git a/src/librmu/RMU_Realm_GetParameterValue.c b/src/librmu/RMU_Realm_GetParameterValue.c @@ -3,5 +3,5 @@ void RMU_Realm_GetParameterValue(void) { - panic("not implemented"); + panic("RMU_Realm_GetParameterValue"); } diff --git a/src/librmu/RMU_Realm_Info.c b/src/librmu/RMU_Realm_Info.c @@ -3,5 +3,5 @@ void RMU_Realm_Info(void) { - panic("not implemented"); + panic("RMU_Realm_Info"); } diff --git a/src/librmu/RMU_Realm_Initialize.c b/src/librmu/RMU_Realm_Initialize.c @@ -3,5 +3,5 @@ void RMU_Realm_Initialize(void) { - panic("not implemented"); + panic("RMU_Realm_Initialize"); } diff --git a/src/librmu/RMU_Realm_Invalidate.c b/src/librmu/RMU_Realm_Invalidate.c @@ -3,5 +3,5 @@ void RMU_Realm_Invalidate(void) { - panic("not implemented"); + panic("RMU_Realm_Invalidate"); } diff --git a/src/librmu/RMU_Realm_InvalidateCurrent.c b/src/librmu/RMU_Realm_InvalidateCurrent.c @@ -3,5 +3,5 @@ void RMU_Realm_InvalidateCurrent(void) { - panic("not implemented"); + panic("RMU_Realm_InvalidateCurrent"); } diff --git a/src/librmu/RMU_Realm_Populate.c b/src/librmu/RMU_Realm_Populate.c @@ -3,5 +3,5 @@ void RMU_Realm_Populate(void) { - panic("not implemented"); + panic("RMU_Realm_Populate"); } diff --git a/src/librmu/RMU_Realm_Prepare.c b/src/librmu/RMU_Realm_Prepare.c @@ -3,5 +3,5 @@ void RMU_Realm_Prepare(void) { - panic("not implemented"); + panic("RMU_Realm_Prepare"); } diff --git a/src/librmu/RMU_Realm_ReadMemory.c b/src/librmu/RMU_Realm_ReadMemory.c @@ -1,7 +1,7 @@ -#include <rcode.h> +#include <rcode.h> void RMU_Realm_ReadMemory(void) { - panic("not implemented"); + panic("RMU_Realm_ReadMemory"); } diff --git a/src/librmu/RMU_Realm_Register.c b/src/librmu/RMU_Realm_Register.c @@ -3,5 +3,5 @@ void RMU_Realm_Register(void) { - panic("not implemented"); + panic("RMU_Realm_Register"); } diff --git a/src/librmu/RMU_Realm_Release.c b/src/librmu/RMU_Realm_Release.c @@ -3,5 +3,5 @@ void RMU_Realm_Release(void) { - panic("not implemented"); + panic("RMU_Realm_Release"); } diff --git a/src/librmu/RMU_Realm_SetBindingKeySeedLock.c b/src/librmu/RMU_Realm_SetBindingKeySeedLock.c @@ -3,5 +3,5 @@ void RMU_Realm_SetBindingKeySeedLock(void) { - panic("not implemented"); + panic("RMU_Realm_SetBindingKeySeedLock"); } diff --git a/src/librmu/RMU_Realm_SetCommandTrap.c b/src/librmu/RMU_Realm_SetCommandTrap.c @@ -3,5 +3,5 @@ void RMU_Realm_SetCommandTrap(void) { - panic("not implemented"); + panic("RMU_Realm_SetCommandTrap"); } diff --git a/src/librmu/RMU_Realm_SetMetadata.c b/src/librmu/RMU_Realm_SetMetadata.c @@ -3,5 +3,5 @@ void RMU_Realm_SetMetadata(void) { - panic("not implemented"); + panic("RMU_Realm_SetMetadata"); } diff --git a/src/librmu/RMU_Realm_SetParameterInheritance.c b/src/librmu/RMU_Realm_SetParameterInheritance.c @@ -3,5 +3,5 @@ void RMU_Realm_SetParameterInheritance(void) { - panic("not implemented"); + panic("RMU_Realm_SetParameterInheritance"); } diff --git a/src/librmu/RMU_Realm_SetParameterValue.c b/src/librmu/RMU_Realm_SetParameterValue.c @@ -3,5 +3,5 @@ void RMU_Realm_SetParameterValue(void) { - panic("not implemented"); + panic("RMU_Realm_SetParameterValue"); } diff --git a/src/librmu/RMU_Realm_WriteMemory.c b/src/librmu/RMU_Realm_WriteMemory.c @@ -3,5 +3,5 @@ void RMU_Realm_WriteMemory(void) { - panic("not implemented"); + panic("RMU_Realm_WriteMemory"); } diff --git a/src/librmu/RMU_System_Enable.c b/src/librmu/RMU_System_Enable.c @@ -1,7 +1,12 @@ +#include <rmu.h> #include <rcode.h> void RMU_System_Enable(void) { - panic("not implemented"); + if (bss->enable) + badcmd(ERESOURCESTATE); + if (bss->hascrypto) + badcmd(ECRYPTO); + bss->enable = 1; } diff --git a/src/librmu/RMU_System_Status.c b/src/librmu/RMU_System_Status.c @@ -1,7 +1,7 @@ #include <rcode.h> void -RMU_System_Status(void) +RMU_System_Status(int *enabled) { - panic("not implemented"); + *enabled = bss->enable; } diff --git a/src/libtypes/Makefile b/src/libtypes/Makefile @@ -16,6 +16,12 @@ OBJS = pack.o unpack.o \ unpack_rscb_rpu_cfg.o \ pack_rscb_ctrl.o \ unpack_rscb_ctrl.o \ + pack_crgte.o \ + unpack_crgte.o \ + pack_l0rgte.o \ + unpack_l0rgte.o \ + pack_rgte.o \ + unpack_rgte.o \ RMSA = $(JSONDIR)/RMSA.json # gendep.sh expects this var after OBJS TARGET = $(LIBDIR)/libtypes.a diff --git a/src/libtypes/pack_crgte.c b/src/libtypes/pack_crgte.c @@ -0,0 +1,18 @@ +#include <assert.h> +#include <stdint.h> + +#include <types.h> + +int +pack_crgte(uint64_t buf[], struct crgte *sp) +{ + int n; + + n = pack(buf, + "%2c", + sp->props); + + assert(n == 2); + + return n; +} diff --git a/src/libtypes/pack_l0rgte.c b/src/libtypes/pack_l0rgte.c @@ -0,0 +1,28 @@ +#include <assert.h> +#include <stdint.h> + +#include <types.h> + +int +pack_l0rgte(uint64_t buf[], struct l0rgte *sp) +{ + int n; + + n = pack(buf, + "%1c %1c %1c %5c %4c %40llu" + "%12u %12u %40llu %12u", + sp->valid, + sp->l1rgt_en, + sp->crgt_en, + sp->type, + sp->res0_0, + sp->baddr, + sp->res0_1, + sp->start, + sp->cbaddr, + sp->end); + + assert(n == 128); + + return n; +} diff --git a/src/libtypes/pack_rgte.c b/src/libtypes/pack_rgte.c @@ -0,0 +1,36 @@ +#include <assert.h> +#include <stdint.h> + +#include <types.h> + +int +pack_rgte(uint64_t buf[], struct rgte *sp) +{ + int n; + + n = pack(buf, + "%4c %3c %1c %2c %2c %40llu" + "%8c %4c %1c %3c %1c %1c %1c" + "%2c %3c %44llu %8c", + sp->state, + sp->owner_perms, + sp->visibility, + sp->global_perms, + sp->secure_access, + sp->owner, + sp->res0_0, + sp->fuse_level, + sp->lock, + sp->lock_ext, + sp->pin, + sp->integ, + sp->res0_1, + sp->export_depth, + sp->res0_2, + sp->mapped_addr, + sp->res0_3); + + assert(n == 128); + + return n; +} diff --git a/src/libtypes/unpack_crgte.c b/src/libtypes/unpack_crgte.c @@ -0,0 +1,18 @@ +#include <assert.h> +#include <stdint.h> + +#include <types.h> + +int +unpack_crgte(uint64_t buf[], struct crgte *sp) +{ + int n; + + n = unpack(buf, + "%2c", + &sp->props); + + assert(n == 2); + + return n; +} diff --git a/src/libtypes/unpack_l0rgte.c b/src/libtypes/unpack_l0rgte.c @@ -0,0 +1,28 @@ +#include <assert.h> +#include <stdint.h> + +#include <types.h> + +int +unpack_l0rgte(uint64_t buf[], struct l0rgte *sp) +{ + int n; + + n = unpack(buf, + "%1c %1c %1c %5c %4c %40llu" + "%12u %12u %40llu %12u", + &sp->valid, + &sp->l1rgt_en, + &sp->crgt_en, + &sp->type, + &sp->res0_0, + &sp->baddr, + &sp->res0_1, + &sp->start, + &sp->cbaddr, + &sp->end); + + assert(n == 128); + + return n; +} diff --git a/src/libtypes/unpack_rgte.c b/src/libtypes/unpack_rgte.c @@ -0,0 +1,36 @@ +#include <assert.h> +#include <stdint.h> + +#include <types.h> + +int +unpack_rgte(uint64_t buf[], struct rgte *sp) +{ + int n; + + n = unpack(buf, + "%4c %3c %1c %2c %2c %40llu" + "%8c %4c %1c %3c %1c %1c %1c" + "%2c %3c %44llu %8c", + &sp->state, + &sp->owner_perms, + &sp->visibility, + &sp->global_perms, + &sp->secure_access, + &sp->owner, + &sp->res0_0, + &sp->fuse_level, + &sp->lock, + &sp->lock_ext, + &sp->pin, + &sp->integ, + &sp->res0_1, + &sp->export_depth, + &sp->res0_2, + &sp->mapped_addr, + &sp->res0_3); + + assert(n == 128); + + return n; +} diff --git a/src/rmc.c b/src/rmc.c @@ -1,3 +1,4 @@ +#include <rmu.h> #include <rcode.h> static void @@ -110,7 +111,7 @@ trap(struct trapframe *fp) } void -badrmc(int error) +badcmd(int error) { Rmucmd *cmd = bss->cmd; @@ -151,7 +152,7 @@ rmc(Rmucmd *cmd) idx = &rowidx[cmd->imm1]; if (cmd->imm2 >= idx->cnt) - badrmc(1); /* TODO: put the correct code */ + badcmd(-1); /* TODO: put the correct code */ /* * and now we have to reallocate the function pointer, @@ -163,5 +164,5 @@ rmc(Rmucmd *cmd) fp = (void (*)(Rmucmd *)) bp; (*fp)(cmd); - cmd->fp->x0 = 0; /* TODO: 0 means success */ + cmd->fp->x0 = SUCCESS; } diff --git a/test/Makefile b/test/Makefile @@ -1,7 +1,7 @@ PROJECTDIR = .. include $(PROJECTDIR)/scripts/rules.mk -DIRS = test1 test2 test3 +DIRS = test1 test2 test3 test4 all: $(DIRS) diff --git a/test/chktest.sh b/test/chktest.sh @@ -8,6 +8,6 @@ do cd $i && $MAKE run_test >> ../test.log 2>&1 && printf '[PASS]' || printf '[FAIL]' - printf "\t%s\n" $i + printf "\t%s - $(cat descr)\n" $i cd $pwd done diff --git a/test/test1/Makefile b/test/test1/Makefile @@ -1,49 +1,74 @@ PROJECTDIR = ../.. include $(PROJECTDIR)/scripts/rules.mk -LIBOBJ = hdl_RMU_Crypto_Random.o \ - hdl_RMU_Local_Load.o \ +LIBOBJ = hdl_RMU_System_InterfaceVersion.o \ + hdl_RMU_System_Status.o \ + hdl_RMU_System_Enable.o \ hdl_RMU_Local_Status.o \ + hdl_RMU_Local_Load.o \ hdl_RMU_Local_Validate.o \ - hdl_RMU_REC_Prepare.o \ - hdl_RMU_REC_ReadGeneralPurposeRegister.o \ - hdl_RMU_REC_ReadSystemRegister.o \ - hdl_RMU_REC_ReadVectorRegister.o \ - hdl_RMU_REC_Register.o \ - hdl_RMU_REC_Release.o \ - hdl_RMU_REC_Size.o \ - hdl_RMU_REC_WriteGeneralPurposeRegister.o \ - hdl_RMU_REC_WriteSystemRegister.o \ - hdl_RMU_REC_WriteVectorRegister.o \ - hdl_RMU_Realm_Activate.o \ - hdl_RMU_Realm_AttestationReport.o \ - hdl_RMU_Realm_AttestationReportInit.o \ - hdl_RMU_Realm_AttestationReportSize.o \ - hdl_RMU_Realm_CreateZeroMetadata.o \ - hdl_RMU_Realm_DeriveBindingKey.o \ - hdl_RMU_Realm_ExtendBindingKeySeedValue.o \ - hdl_RMU_Realm_GetBindingKeySeedValue.o \ - hdl_RMU_Realm_GetMetadata.o \ - hdl_RMU_Realm_GetParameterInheritance.o \ + hdl_RMU_Crypto_Random.o \ + hdl_RMU_Realm_Register.o \ + hdl_RMU_Realm_Release.o \ + hdl_RMU_Realm_InvalidateCurrent.o \ + hdl_RMU_Realm_Invalidate.o \ hdl_RMU_Realm_GetParameterValue.o \ - hdl_RMU_Realm_Info.o \ + hdl_RMU_Realm_SetParameterValue.o \ + hdl_RMU_Realm_GetParameterInheritance.o \ + hdl_RMU_Realm_SetParameterInheritance.o \ hdl_RMU_Realm_Initialize.o \ - hdl_RMU_Realm_Invalidate.o \ - hdl_RMU_Realm_InvalidateCurrent.o \ - hdl_RMU_Realm_Populate.o \ hdl_RMU_Realm_Prepare.o \ + hdl_RMU_Realm_Populate.o \ + hdl_RMU_Realm_Activate.o \ + hdl_RMU_Realm_Info.o \ hdl_RMU_Realm_ReadMemory.o \ - hdl_RMU_Realm_Register.o \ - hdl_RMU_Realm_Release.o \ - hdl_RMU_Realm_SetBindingKeySeedLock.o \ - hdl_RMU_Realm_SetCommandTrap.o \ - hdl_RMU_Realm_SetMetadata.o \ - hdl_RMU_Realm_SetParameterInheritance.o \ - hdl_RMU_Realm_SetParameterValue.o \ hdl_RMU_Realm_WriteMemory.o \ - hdl_RMU_System_Enable.o \ - hdl_RMU_System_InterfaceVersion.o \ - hdl_RMU_System_Status.o \ + hdl_RMU_Realm_SetMetadata.o \ + hdl_RMU_Realm_GetMetadata.o \ + hdl_RMU_Realm_CreateZeroMetadata.o \ + hdl_RMU_Realm_SetCommandTrap.o \ + hdl_RMU_Realm_AttestationReportSize.o \ + hdl_RMU_Realm_AttestationReportInit.o \ + hdl_RMU_Realm_AttestationReport.o \ + hdl_RMU_Realm_ExtendBindingKeySeedValue.o \ + hdl_RMU_Realm_SetBindingKeySeedLock.o \ + hdl_RMU_Realm_DeriveBindingKey.o \ + hdl_RMU_Realm_GetBindingKeySeedValue.o \ + hdl_RMU_REC_Size.o \ + hdl_RMU_REC_Register.o \ + hdl_RMU_REC_Prepare.o \ + hdl_RMU_REC_Release.o \ + hdl_RMU_REC_ReadGeneralPurposeRegister.o \ + hdl_RMU_REC_WriteGeneralPurposeRegister.o \ + hdl_RMU_REC_ReadVectorRegister.o \ + hdl_RMU_REC_WriteVectorRegister.o \ + hdl_RMU_REC_ReadSystemRegister.o \ + hdl_RMU_REC_WriteSystemRegister.o \ + hdl_RMU_MDT_BufferSize.o \ + hdl_RMU_MDT_Register.o \ + hdl_RMU_MDT_Release.o \ + hdl_RMU_MDT_Info.o \ + hdl_RMU_MDT_WriteStorage.o \ + hdl_RMU_MDT_ReadStorage.o \ + hdl_RMU_MDT_Move.o \ + hdl_RMU_Granule_Invalidate.o \ + hdl_RMU_Granule_Clean.o \ + hdl_RMU_Granule_Info.o \ + hdl_RMU_Granule_Detail.o \ + hdl_RMU_Granule_SetPermissions.o \ + hdl_RMU_Granule_Sync.o \ + hdl_RMU_Granule_Claim.o \ + hdl_RMU_Granule_Release.o \ + hdl_RMU_Granule_AddInit.o \ + hdl_RMU_Granule_Add.o \ + hdl_RMU_Granule_Reclaim.o \ + hdl_RMU_Granule_Fuse.o \ + hdl_RMU_Granule_Shatter.o \ + hdl_RMU_Granule_SetGlobalVisibility.o \ + hdl_RMU_Granule_ExportInit.o \ + hdl_RMU_Granule_Export.o \ + hdl_RMU_Granule_ImportInit.o \ + hdl_RMU_Granule_Import.o \ OBJS = $(ARCHDIR)/crt-$(SYS).o $(SRCDIR)/romfw/builtin.o test.o LIBS = -lhdl -lc diff --git a/test/test1/descr b/test/test1/descr @@ -0,0 +1 @@ +Test dispatcher by feeding into it all possible 16-bit RMC encodings diff --git a/test/test1/genrmu.sh b/test/test1/genrmu.sh @@ -8,7 +8,7 @@ genfile() #include <rcode.h> void -$1(void) +$1(Rmucmd *cmd) { puts("$1"); } @@ -17,47 +17,72 @@ FILE cat <<EOF | while read i; do genfile $i; done -hdl_RMU_REC_WriteVectorRegister -hdl_RMU_Realm_SetMetadata +hdl_RMU_System_InterfaceVersion +hdl_RMU_System_Status +hdl_RMU_System_Enable +hdl_RMU_Local_Status +hdl_RMU_Local_Load +hdl_RMU_Local_Validate +hdl_RMU_Crypto_Random +hdl_RMU_Realm_Register +hdl_RMU_Realm_Release +hdl_RMU_Realm_InvalidateCurrent +hdl_RMU_Realm_Invalidate hdl_RMU_Realm_GetParameterValue -hdl_RMU_REC_ReadSystemRegister -hdl_RMU_Realm_GetMetadata hdl_RMU_Realm_SetParameterValue -hdl_RMU_REC_WriteSystemRegister -hdl_RMU_Realm_CreateZeroMetadata hdl_RMU_Realm_GetParameterInheritance hdl_RMU_Realm_SetParameterInheritance hdl_RMU_Realm_Initialize hdl_RMU_Realm_Prepare -hdl_RMU_Local_Status hdl_RMU_Realm_Populate -hdl_RMU_Local_Load hdl_RMU_Realm_Activate -hdl_RMU_Local_Validate hdl_RMU_Realm_Info +hdl_RMU_Realm_ReadMemory +hdl_RMU_Realm_WriteMemory +hdl_RMU_Realm_SetMetadata +hdl_RMU_Realm_GetMetadata +hdl_RMU_Realm_CreateZeroMetadata hdl_RMU_Realm_SetCommandTrap -hdl_RMU_Crypto_Random hdl_RMU_Realm_AttestationReportSize hdl_RMU_Realm_AttestationReportInit hdl_RMU_Realm_AttestationReport -hdl_RMU_Realm_Register -hdl_RMU_Realm_Release hdl_RMU_Realm_ExtendBindingKeySeedValue hdl_RMU_Realm_SetBindingKeySeedLock hdl_RMU_Realm_DeriveBindingKey hdl_RMU_Realm_GetBindingKeySeedValue -hdl_RMU_Realm_InvalidateCurrent hdl_RMU_REC_Size hdl_RMU_REC_Register -hdl_RMU_System_InterfaceVersion hdl_RMU_REC_Prepare -hdl_RMU_System_Status hdl_RMU_REC_Release -hdl_RMU_System_Enable hdl_RMU_REC_ReadGeneralPurposeRegister hdl_RMU_REC_WriteGeneralPurposeRegister -hdl_RMU_Realm_ReadMemory hdl_RMU_REC_ReadVectorRegister -hdl_RMU_Realm_WriteMemory -hdl_RMU_Realm_Invalidate +hdl_RMU_REC_WriteVectorRegister +hdl_RMU_REC_ReadSystemRegister +hdl_RMU_REC_WriteSystemRegister +hdl_RMU_MDT_BufferSize +hdl_RMU_MDT_Register +hdl_RMU_MDT_Release +hdl_RMU_MDT_Info +hdl_RMU_MDT_WriteStorage +hdl_RMU_MDT_ReadStorage +hdl_RMU_MDT_Move +hdl_RMU_Granule_Invalidate +hdl_RMU_Granule_Clean +hdl_RMU_Granule_Info +hdl_RMU_Granule_Detail +hdl_RMU_Granule_SetPermissions +hdl_RMU_Granule_Sync +hdl_RMU_Granule_Claim +hdl_RMU_Granule_Release +hdl_RMU_Granule_AddInit +hdl_RMU_Granule_Add +hdl_RMU_Granule_Reclaim +hdl_RMU_Granule_Fuse +hdl_RMU_Granule_Shatter +hdl_RMU_Granule_SetGlobalVisibility +hdl_RMU_Granule_ExportInit +hdl_RMU_Granule_Export +hdl_RMU_Granule_ImportInit +hdl_RMU_Granule_Import EOF diff --git a/test/test2/descr b/test/test2/descr @@ -0,0 +1 @@ +Test various combinations of pack/unpack functions diff --git a/test/test3/descr b/test/test3/descr @@ -0,0 +1 @@ +Test RMU_System_InterfaceVersion() diff --git a/test/test4/Makefile b/test/test4/Makefile @@ -0,0 +1,13 @@ +PROJECTDIR = ../.. +include $(PROJECTDIR)/scripts/rules.mk + +OBJS = $(ARCHDIR)/crt-$(SYS).o $(SRCDIR)/romfw/builtin.o test.o +LIBS = -lhdl -lrmu -lc +LIBDEP = $(LIBDIR)/libhdl.a $(LIBDIR)/librmu.a $(LIBDIR)/libc.a + +TARGET = run + +all: $(TARGET) + +$(TARGET): $(OBJS) $(LIBDEP) + $(LD) $(RCODE_LDFLAGS) $(OBJS) $(LIBS) -o $@ diff --git a/test/test4/descr b/test/test4/descr @@ -0,0 +1 @@ +Test panic() diff --git a/test/test4/test.c b/test/test4/test.c @@ -0,0 +1,48 @@ +#include <stdlib.h> +#include <rcode.h> + +int +main(void) +{ + panic("oops"); + return 0; +} + +void +halt(void) +{ + exit(0); +} + +void +dopanic(void) +{ + struct trapframe frame; + + frame.x0 = 0, frame.x1 = 1; + frame.x2 = 2, frame.x3 = 3; + frame.x4 = 4, frame.x5 = 5; + frame.x6 = 6, frame.x7 = 7; + frame.x8 = 8, frame.x9 = 9; + frame.x10 = 10, frame.x11 = 11; + frame.x12 = 12, frame.x12 = 12; + frame.x13 = 13, frame.x14 = 14; + frame.x15 = 15, frame.x16 = 16; + frame.x17 = 17, frame.x18 = 18; + frame.x19 = 19, frame.x20 = 20; + frame.x21 = 21, frame.x22 = 22; + frame.x23 = 23, frame.x24 = 24; + frame.x25 = 25, frame.x26 = 26; + frame.x27 = 27, frame.x28 = 28; + frame.x29 = 29, frame.x30 = 30; + frame.elr = (void *)0xdeadbeef, frame.spsr = 32; + frame.esr = 33, frame.far = 34; + frame.sp = (void *)0xdeadbabe; + trap(&frame); +} + +void +swtch(struct trapframe *fp) +{ + panic("swtch() not implemented"); +} diff --git a/test/test4/test.exp b/test/test4/test.exp @@ -0,0 +1,12 @@ +exception handler +panic: oops +x0=0 x1=1 x2=2 x3=3 +x4=4 x5=5 x6=6 x7=7 +x8=8 x9=9 x10=A x11=B +x12=C x13=D x14=E x15=F +x16=10 x17=11 x18=12 x19=13 +x20=14 x21=15 x22=16 x23=17 +x24=18 x25=19 x26=1A x27=1B +x28=1C x29=1D x30=1E elr=DEADBEEF +spsr=20 esr=21 far=22 +sp=DEADBABE diff --git a/test/test4/test.sh b/test/test4/test.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +tmp1=tmp.$$ +trap 'r=$?;rm -f $tmp1;exit $r' EXIT HUP INT QUIT TERM + +$EMUCMD ./run > $tmp1 +diff -u $tmp1 test.exp