Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libc/arch/powerpc Allow testing of exec pages on P...



details:   https://anonhg.NetBSD.org/src/rev/bd954d6b5ca3
branches:  trunk
changeset: 778104:bd954d6b5ca3
user:      matt <matt%NetBSD.org@localhost>
date:      Fri Mar 16 08:51:47 2012 +0000

description:
Allow testing of exec pages on PowerPC BookE.
Make return_one actually do the right thing.

diffstat:

 tests/lib/libc/arch/powerpc/exec_prot_support.c |  21 ++++++++++++++++-----
 tests/lib/libc/arch/powerpc/return_one.S        |  11 +++++++----
 2 files changed, 23 insertions(+), 9 deletions(-)

diffs (63 lines):

diff -r 41a3c430bf37 -r bd954d6b5ca3 tests/lib/libc/arch/powerpc/exec_prot_support.c
--- a/tests/lib/libc/arch/powerpc/exec_prot_support.c   Fri Mar 16 08:39:54 2012 +0000
+++ b/tests/lib/libc/arch/powerpc/exec_prot_support.c   Fri Mar 16 08:51:47 2012 +0000
@@ -1,11 +1,11 @@
-/*      $NetBSD: exec_prot_support.c,v 1.1 2011/07/18 23:16:10 jym Exp $ */
+/*      $NetBSD: exec_prot_support.c,v 1.2 2012/03/16 08:51:47 matt Exp $ */
 
 /*-
- * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
- * by Jean-Yves Migeon.
+ * by Matt Thomas of 3am Software Foundry.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -30,12 +30,23 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: exec_prot_support.c,v 1.1 2011/07/18 23:16:10 jym Exp $");
+__RCSID("$NetBSD: exec_prot_support.c,v 1.2 2012/03/16 08:51:47 matt Exp $");
 
 #include "../../common/exec_prot.h"
 
+#include <sys/sysctl.h>
+
 int
 exec_prot_support(void)
 {
-       return NOTIMPL;
+       int execprot = 0;
+       size_t len = sizeof(execprot);
+
+       if (sysctlbyname("machdep.execprot", &execprot, &len, NULL, 0) < 0)
+               return NOTIMPL;
+
+       if (execprot)
+               return PERPAGE_XP;
+
+       return NO_XP;
 }
diff -r 41a3c430bf37 -r bd954d6b5ca3 tests/lib/libc/arch/powerpc/return_one.S
--- a/tests/lib/libc/arch/powerpc/return_one.S  Fri Mar 16 08:39:54 2012 +0000
+++ b/tests/lib/libc/arch/powerpc/return_one.S  Fri Mar 16 08:51:47 2012 +0000
@@ -1,8 +1,11 @@
-/*     $NetBSD: return_one.S,v 1.1 2011/07/18 23:16:10 jym Exp $ */
+/*     $NetBSD: return_one.S,v 1.2 2012/03/16 08:51:47 matt Exp $ */
 
 #include <machine/asm.h>
 
-.globl return_one, return_one_end;
+.globl return_one, return_one_end
 
-return_one: return_one_end:
-       nop
+_ENTRY(return_one)
+       li      %r3, 1
+       blr
+return_one_end:
+END(return_one)



Home | Main Index | Thread Index | Old Index