*/
#define STACK_TOP 0x2000
+#define PVR 287
/* Load an immediate 64-bit value into a register */
#define LOAD_IMM64(r, e) \
blr
+/* Test reading the PVR */
+.global test_mfpvr
+test_mfpvr:
+ mflr %r0
+ std %r0, 16(%r1)
+ stdu %r1, -32(%r1)
+
+ /*
+ * If r3 happened to already contain PVR_MICROWATT the test
+ * would succeed even if the PVR is not implemented.
+ */
+ LOAD_IMM64(%r3, 0xdeadbeef)
+ mfpvr %r3
+
+ addi %r1, %r1, 32
+ ld %r0, 16(%r1)
+ mtlr %r0
+
+ blr
+
+/* Test writing the PVR does nothing */
+.global test_mtpvr
+test_mtpvr:
+ mflr %r0
+ std %r0, 16(%r1)
+ stdu %r1, -32(%r1)
+
+ LOAD_IMM64(%r3, 0xdeadbeef)
+ mtspr PVR, %r3
+ mfpvr %r3
+
+ addi %r1, %r1, 32
+ ld %r0, 16(%r1)
+ mtlr %r0
+
+ blr
#define PASS "PASS\n"
#define FAIL "FAIL\n"
+#define PVR_MICROWATT 0x00630000
+
extern long test_addpcis_1(void);
extern long test_addpcis_2(void);
+extern long test_mfpvr(void);
+extern long test_mtpvr(void);
// i < 100
void print_test_number(int i)
} else
puts(PASS);
+ print_test_number(3);
+ if (test_mfpvr() != PVR_MICROWATT) {
+ fail = 1;
+ puts(FAIL);
+ } else
+ puts(PASS);
+
+ print_test_number(4);
+ if (test_mtpvr() != PVR_MICROWATT) {
+ fail = 1;
+ puts(FAIL);
+ } else
+ puts(PASS);
+
return fail;
}
#define SRR1 27
#define PID 48
#define PRTBL 720
+#define PVR 287
static inline unsigned long mfspr(int sprnum)
{
return 0;
}
+int priv_fn_7(unsigned long x)
+{
+ mfspr(PVR);
+ __asm__ volatile("sc");
+ return 0;
+}
+
+int priv_fn_8(unsigned long x)
+{
+ mtspr(PVR, x);
+ __asm__ volatile("sc");
+ return 0;
+}
+
int priv_test(int (*fn)(unsigned long))
{
unsigned long msr;
do_test(4, priv_fn_4);
do_test(5, priv_fn_5);
do_test(6, priv_fn_6);
+ do_test(7, priv_fn_7);
+ do_test(8, priv_fn_8);
return fail;
}
Test 01:PASS\r
Test 02:PASS\r
+Test 03:PASS\r
+Test 04:PASS\r
test 04:PASS\r
test 05:PASS\r
test 06:PASS\r
+test 07:PASS\r
+test 08:PASS\r