diff options
author | Patrick Williams <iawillia@us.ibm.com> | 2011-07-08 19:33:40 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2011-07-20 14:58:43 -0500 |
commit | 471f09f1a9bcc46fc385fa8aca776cb682075c0b (patch) | |
tree | e0a4969825799dcc4c28a71975cb68439f507390 /src/usr | |
parent | 3ecf7085ccc55eb4f815a62f47ea09f55bb6688e (diff) | |
download | talos-hostboot-471f09f1a9bcc46fc385fa8aca776cb682075c0b.tar.gz talos-hostboot-471f09f1a9bcc46fc385fa8aca776cb682075c0b.zip |
VMM Improvements.
- Segment Manager
- Base / Device Segments
- Block for Base image.
Change-Id: Ic0c058e5c5b210ec1c48d30f6ed9f9837d74a3c8
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/193
Tested-by: Jenkins Server
Reviewed-by: MATTHEW S. BARTH <msbarth@us.ibm.com>
Diffstat (limited to 'src/usr')
-rw-r--r-- | src/usr/testcore/kernel/slbtest.H | 19 | ||||
-rw-r--r-- | src/usr/testcore/kernel/vmmbasetest.H | 97 |
2 files changed, 97 insertions, 19 deletions
diff --git a/src/usr/testcore/kernel/slbtest.H b/src/usr/testcore/kernel/slbtest.H index 8784458d0..f773efe2d 100644 --- a/src/usr/testcore/kernel/slbtest.H +++ b/src/usr/testcore/kernel/slbtest.H @@ -26,15 +26,6 @@ class slbtest: public CxxTest::TestSuite { TS_FAIL("Data Segment exception expected in 1TB segment\n"); } - - rc = 0; - task_create(writeEA2TB, this); - while (rc == 0) task_yield(); - task_yield(); - if (rc == -1) - { - TS_FAIL("Data Storage exception expected in 2TB segment\n"); - } } private: @@ -48,16 +39,6 @@ class slbtest: public CxxTest::TestSuite rc = -1; task_end(); } - - static void writeEA2TB(void *i_p) - { - rc = 1; - sync(); - *(int *)0x20000000000 = 1; - sync(); - rc = -1; - task_end(); - } }; volatile int slbtest::rc = 0; diff --git a/src/usr/testcore/kernel/vmmbasetest.H b/src/usr/testcore/kernel/vmmbasetest.H new file mode 100644 index 000000000..df9d320a4 --- /dev/null +++ b/src/usr/testcore/kernel/vmmbasetest.H @@ -0,0 +1,97 @@ +/** @file vmmbasetest.H + * @brief Test cases for permission settings on the base block of the VMM. + */ +#ifndef __KERNEL_VMMBASETEST_H +#define __KERNEL_VMMBASETEST_H + +#include <cxxtest/TestSuite.H> +#include <sys/task.h> +#include <kernel/console.H> +#include <arch/ppc.H> + +class VmmBaseTest : public CxxTest::TestSuite +{ + public: + static volatile int rc; + + void testNullAccess() + { + rc = 0; sync(); + printk("Test case: Expect to see uncaught exception! "); + task_create(readFromNULL, NULL); + while (rc == 0) task_yield(); + task_yield(); + if (rc == -1) + { + TS_FAIL("Write to NULL not caught."); + } + + rc = 0; sync(); + printk("Test case: Expect to see uncaught exception! "); + task_create(writeToNULL, NULL); + while (rc == 0) task_yield(); + task_yield(); + if (rc == -1) + { + TS_FAIL("Write to NULL not caught."); + } + } + + void testWriteToKernelCode() + { + rc = 0; sync(); + printk("Test case: Expect to see uncaught exception! "); + task_create(writeToKernelCode, NULL); + while (rc == 0) task_yield(); + task_yield(); + if (rc == -1) + { + TS_FAIL("Write to kernel code not caught."); + } + } + + void testExecuteKernelDataSpace() + { + // @TODO. VMM not ready. + } + + void testWriteModuleText() + { + // @TODO. VMM not ready. + } + + void testExecuteModuleDataSpace() + { + // @TODO. VMM not ready. + } + + private: + + static void readFromNULL(void* unused) + { + rc = 1; sync(); + printk("%lx", (*(uint64_t*)NULL)); sync(); + rc = -1; sync(); + task_end(); + } + + static void writeToNULL(void* unused) + { + rc = 1; sync(); + (*(uint64_t*)NULL) = 0x12345678; sync(); + rc = -1; sync(); + task_end(); + } + + static void writeToKernelCode(void* unused) + { + rc = 1; sync(); + (*(*(uint64_t**)&printk)) = 0x12345678; sync(); + rc = -1; sync(); + task_end(); + } + +}; +volatile int VmmBaseTest::rc = 0; + +#endif |