We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 541d45d commit db3abd3Copy full SHA for db3abd3
1 file changed
vm/src/vm.rs
@@ -1994,6 +1994,24 @@ mod tests
1994
eval_i64(" push FN; call_fp 0; ret; FN: push_i8 33; ret;", 33);
1995
}
1996
1997
+ #[test]
1998
+ fn test_patch_fp()
1999
+ {
2000
+ // Patch a function's code address into the data segment at runtime,
2001
+ // then load it back and call it via call_fp
2002
+ eval_i64(
2003
+ ".data; FPTR: .u64 0; .code; push FPTR; push FN; store_u64; push FPTR; load_u64; call_fp 0; ret; FN: push_i8 33; ret;",
2004
+ 33
2005
+ );
2006
+
2007
+ // Same, but the code address is assembled into the data segment
2008
+ // statically using the .addr64 directive
2009
2010
+ ".data; FPTR: .addr64 FN; .code; push FPTR; load_u64; call_fp 0; ret; FN: push_i8 33; ret;",
2011
2012
2013
+ }
2014
2015
#[test]
2016
fn test_syscalls()
2017
{
0 commit comments