mirror of
https://github.com/ringtailsoftware/uvm32.git
synced 2026-06-05 22:43:39 +00:00
Test memory read outside of memory and extram regions.
This commit is contained in:
parent
179466eae4
commit
2037f6e575
3 changed files with 24 additions and 0 deletions
|
|
@ -47,6 +47,11 @@ void syscall_i_test(void) {
|
|||
syscall((uint32_t)SYSCALL_I, (uint32_t)p, 0);
|
||||
}
|
||||
|
||||
void syscall_j_test(void) {
|
||||
uint32_t *p = (uint32_t *)0xF0000000;
|
||||
syscall((uint32_t)SYSCALL_I, (uint32_t)p[0], 0); // try to read from beyond memory and not in MMIO region
|
||||
}
|
||||
|
||||
void main(void) {
|
||||
switch(syscall(SYSCALL_PICKTEST, 0, 0)) {
|
||||
case SYSCALL_A:
|
||||
|
|
@ -70,6 +75,9 @@ void main(void) {
|
|||
case SYSCALL_I:
|
||||
syscall_i_test();
|
||||
break;
|
||||
case SYSCALL_J:
|
||||
syscall_j_test();
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,4 +14,5 @@
|
|||
#define SYSCALL_G SYSCALL_BASE+7
|
||||
#define SYSCALL_H SYSCALL_BASE+8
|
||||
#define SYSCALL_I SYSCALL_BASE+9
|
||||
#define SYSCALL_J SYSCALL_BASE+10
|
||||
|
||||
|
|
|
|||
|
|
@ -211,3 +211,18 @@ void test_syscall_args_bufrd_toolarge(void) {
|
|||
TEST_ASSERT_EQUAL(evt.data.err.errcode, UVM32_ERR_MEM_RD);
|
||||
}
|
||||
|
||||
void test_syscall_args_read_badram(void) {
|
||||
// run the vm
|
||||
uvm32_run(&vmst, &evt, 1000);
|
||||
// check for picktest syscall
|
||||
TEST_ASSERT_EQUAL(evt.typ, UVM32_EVT_SYSCALL);
|
||||
TEST_ASSERT_EQUAL(evt.data.syscall.code, SYSCALL_PICKTEST);
|
||||
uvm32_arg_setval(&vmst, &evt, RET, SYSCALL_J);
|
||||
|
||||
uvm32_run(&vmst, &evt, 1000);
|
||||
// check for error state
|
||||
uvm32_run(&vmst, &evt, 100);
|
||||
TEST_ASSERT_EQUAL(evt.typ, UVM32_EVT_ERR);
|
||||
TEST_ASSERT_EQUAL(evt.data.err.errcode, UVM32_ERR_MEM_RD);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue