added working cheri assembly
This commit is contained in:
@@ -92,7 +92,7 @@ vm_boot:
|
||||
|
||||
# l1_pt[0] -> l0_pt
|
||||
la t0, l0_pt
|
||||
srli t0, t0, 12
|
||||
srli t0, t0, 12
|
||||
slli t0, t0, 10
|
||||
ori t0, t0, 0x1 # V
|
||||
la t1, l1_pt
|
||||
|
||||
41
Tests/isa/cheri.S
Normal file
41
Tests/isa/cheri.S
Normal file
@@ -0,0 +1,41 @@
|
||||
.section .text
|
||||
.globl _start
|
||||
.align 4
|
||||
_start:
|
||||
cspecialr ct0, pcc
|
||||
|
||||
# Use csetaddr to build a stack capability
|
||||
li t0, 0x80001000 # fixed top-of-stack address
|
||||
csetaddr csp, ct0, t0
|
||||
|
||||
# la t0, tohost
|
||||
li t1, 1
|
||||
csd t1, 0(c1)
|
||||
|
||||
halt:
|
||||
wfi
|
||||
j halt
|
||||
|
||||
.globl exit
|
||||
exit:
|
||||
j exit
|
||||
|
||||
.section .bss
|
||||
.align 16
|
||||
stack_bottom:
|
||||
.space 2048
|
||||
stack_top: # address = 0x80001000 (for csetaddr)
|
||||
|
||||
# --------------------------------------------------
|
||||
# Data section (NO .bss)
|
||||
# --------------------------------------------------
|
||||
|
||||
# .section .data
|
||||
# .align 3
|
||||
|
||||
# .globl tohost
|
||||
# .globl fromhost
|
||||
# tohost:
|
||||
# .dword 0
|
||||
#fromhost:
|
||||
# .dword 0
|
||||
BIN
Tests/isa/testC
Executable file
BIN
Tests/isa/testC
Executable file
Binary file not shown.
@@ -9,10 +9,11 @@ BSC_COMPILATION_FLAGS += -verbose
|
||||
# Default ISA test
|
||||
|
||||
# TEST ?= rv64ui-p-add
|
||||
TEST ?= rv64um-v-mulw
|
||||
# TEST ?= rv64um-v-mulw
|
||||
# TEST ?= Page
|
||||
# TEST ?= PageReadWrite
|
||||
# TEST ?= CheriPage
|
||||
TEST ?= testC
|
||||
|
||||
#================================================================
|
||||
# Parameter settings for MIT RISCY, setup paths etc. for Include_Common
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -241,6 +241,7 @@ function CapPipe capModify(CapPipe a, CapPipe b, CapModifyFunc func);
|
||||
new_hard_perms.global = new_hard_perms.global && getHardPerms(b).global;
|
||||
Bool unsealIllegal = !isValidCap(b) || getKind(b) != UNSEALED || getKind(a) == UNSEALED || a_res || getAddr(b) != a_type || !getHardPerms(b).permitUnseal || !isInBounds(b, False);
|
||||
Bool buildCapIllegal = !isValidCap(b) || getKind(b) != UNSEALED || !isDerivable(a) || (getPerms(a) & getPerms(b)) != getPerms(a) || getBase(a) < getBase(b) || getTop(a) > getTop(b); // XXX needs optimisation
|
||||
// TODO: Delta handler function
|
||||
CapPipe res = (case(func) matches
|
||||
tagged ModifyOffset .offsetOp :
|
||||
modifyOffset(a_mut, getAddr(b), offsetOp == IncOffset).value;
|
||||
@@ -274,6 +275,8 @@ function CapPipe capModify(CapPipe a, CapPipe b, CapModifyFunc func);
|
||||
(getAddr(a) == 0 ? nullCap : setAddr(b_mut, getAddr(a)).value);
|
||||
tagged SetHigh:
|
||||
fromMem(tuple2(False, {getAddr(b), getAddr(a)}));
|
||||
// capFromAddrs(a,b);
|
||||
// getTruncatedTuple(getAddr(b))
|
||||
tagged BuildCap :
|
||||
setKind(setValidCap(a_mut, !buildCapIllegal), getKind(a)==SENTRY ? SENTRY : UNSEALED);
|
||||
tagged Move :
|
||||
@@ -285,6 +288,38 @@ function CapPipe capModify(CapPipe a, CapPipe b, CapModifyFunc func);
|
||||
return res;
|
||||
endfunction
|
||||
|
||||
// function CapPipe capFromAddrs (CapPipe a, CapPipe b)
|
||||
// provisos (
|
||||
// CHERICap#(CapPipe, o, f, addrW, CapW, m, d)
|
||||
// );
|
||||
|
||||
// // Get full serialized capability of 'a'
|
||||
// match {.tag, .rawA} = toMem(a); // rawA : Bit#(inMemW)
|
||||
|
||||
// // Replace low addrW bits with address from b
|
||||
// Bit#(addrW) newAddr = getAddr(b);
|
||||
|
||||
// Bit#(inMemW) newRaw =
|
||||
// { rawA[CapW-1 : addrW] // keep upper metadata
|
||||
// , newAddr // replace address field
|
||||
// };
|
||||
|
||||
// return fromMem(tuple2(tag, newRaw));
|
||||
|
||||
// endfunction
|
||||
// function CapPipe capFromAddrs(capT a, capT b)
|
||||
// // Extract addresses
|
||||
// Bit#(64) addrA = getAddr(a);
|
||||
// Bit#(64) addrB = getAddr(b);
|
||||
// // Extra bits to reach inMemW = 180
|
||||
// Bit#(52) extra = 0; // can be zeros or delta bits if needed
|
||||
|
||||
// // Concatenate explicitly typed
|
||||
// Bit#(180) rawBits = {addrB, addrA, extra};
|
||||
|
||||
// return fromMem(tuple2(False, rawBits));
|
||||
// endfunction
|
||||
|
||||
(* noinline *)
|
||||
function Data capInspect(CapPipe a, CapPipe b, CapInspectFunc func);
|
||||
Data res = (case(func) matches
|
||||
@@ -323,6 +358,17 @@ function Data capInspect(CapPipe a, CapPipe b, CapInspectFunc func);
|
||||
return res;
|
||||
endfunction
|
||||
|
||||
// function CapPipe getTruncatedTuple(AddrType a, AddrType b)
|
||||
// provisos (
|
||||
// Add#(a__, b__, 180) // Defines that a__ + b__ must equal 180
|
||||
// );
|
||||
|
||||
// // Use a list literal or a Tuple constructor
|
||||
// let address_bits = { getAddr(b), getAddr(a) };
|
||||
|
||||
// return fromMem(tuple2(False, address_bits));
|
||||
// endfunction
|
||||
|
||||
function CapPipe capALU(CapPipe a, CapPipe b, CapFunc func);
|
||||
CapPipe res = (case (func) matches
|
||||
tagged CapInspect .x:
|
||||
|
||||
Reference in New Issue
Block a user