feat(vm): add deterministic gameplay math and domain coverage gates
Intrepid/Prometeu/Runtime/pipeline/pr-master There was a failure building this commit
Intrepid/Prometeu/Runtime/pipeline/pr-master There was a failure building this commit
This commit is contained in:
@@ -32,6 +32,12 @@ pub const TRAP_INVALID_HANDLE: u32 = 0x0000_000F;
|
||||
pub const TRAP_RESOURCE_LIMIT: u32 = 0x0000_0010;
|
||||
/// Known input query unavailable on this platform.
|
||||
pub const TRAP_UNAVAILABLE: u32 = 0x0000_0011;
|
||||
/// Mathematical domain is invalid for the supplied finite arguments.
|
||||
pub const TRAP_NUMERIC_DOMAIN: u32 = 0x0000_0012;
|
||||
/// Finite input produces an unrepresentable result or integer destination.
|
||||
pub const TRAP_NUMERIC_RANGE: u32 = 0x0000_0013;
|
||||
/// A NaN or infinite input cannot enter guest numeric computation.
|
||||
pub const TRAP_NON_FINITE: u32 = 0x0000_0014;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
||||
@@ -13,8 +13,9 @@ mod value;
|
||||
pub use abi::{
|
||||
SourceSpan, TrapInfo, TRAP_BAD_RET_SLOTS, TRAP_DIV_ZERO, TRAP_EXPLICIT,
|
||||
TRAP_ILLEGAL_INSTRUCTION, TRAP_INVALID_FUNC, TRAP_INVALID_HANDLE, TRAP_INVALID_INTRINSIC,
|
||||
TRAP_INVALID_LOCAL, TRAP_INVALID_SYSCALL, TRAP_NULL_REFERENCE, TRAP_OOB, TRAP_RESOURCE_LIMIT,
|
||||
TRAP_STACK_UNDERFLOW, TRAP_TYPE, TRAP_UNAVAILABLE,
|
||||
TRAP_INVALID_LOCAL, TRAP_INVALID_SYSCALL, TRAP_NON_FINITE, TRAP_NULL_REFERENCE,
|
||||
TRAP_NUMERIC_DOMAIN, TRAP_NUMERIC_RANGE, TRAP_OOB, TRAP_RESOURCE_LIMIT, TRAP_STACK_UNDERFLOW,
|
||||
TRAP_TYPE, TRAP_UNAVAILABLE,
|
||||
};
|
||||
pub use assembler::{assemble, AsmError};
|
||||
pub use decoder::{decode_next, DecodeError, DecodedInstr};
|
||||
|
||||
@@ -74,6 +74,7 @@ pub enum LoadReason {
|
||||
Limit,
|
||||
Allocation,
|
||||
ConstantTag,
|
||||
NonFiniteValue,
|
||||
DebugRange,
|
||||
DuplicateSyscall,
|
||||
UnknownOpcode,
|
||||
|
||||
@@ -229,9 +229,17 @@ impl<'a> Reader<'a, '_> {
|
||||
(|| {
|
||||
match self.byte()? {
|
||||
0 => {}
|
||||
1 | 2 => {
|
||||
1 => {
|
||||
self.take(8)?;
|
||||
}
|
||||
2 => {
|
||||
let at = self.pos;
|
||||
let bits = u64::from_le_bytes(self.take(8)?.try_into().unwrap());
|
||||
if bits & 0x7ff0_0000_0000_0000 == 0x7ff0_0000_0000_0000 {
|
||||
return Err(E::new(C::InvalidFormat, R::NonFiniteValue)
|
||||
.at(self.section.kind, self.section.offset + at));
|
||||
}
|
||||
}
|
||||
3 => {
|
||||
if self.byte()? > 1 {
|
||||
return Err(self.error(C::InvalidFormat, R::InvalidFlag));
|
||||
|
||||
Reference in New Issue
Block a user