Module Name: src
Committed By: matt
Date: Fri Mar 16 08:51:47 UTC 2012
Modified Files:
src/tests/lib/libc/arch/powerpc: exec_prot_support.c return_one.S
Log Message:
Allow testing of exec pages on PowerPC BookE.
Make return_one actually do the right thing.
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/arch/powerpc/exec_prot_support.c \
src/tests/lib/libc/arch/powerpc/return_one.S
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/lib/libc/arch/powerpc/exec_prot_support.c
diff -u src/tests/lib/libc/arch/powerpc/exec_prot_support.c:1.1 src/tests/lib/libc/arch/powerpc/exec_prot_support.c:1.2
--- src/tests/lib/libc/arch/powerpc/exec_prot_support.c:1.1 Mon Jul 18 23:16:10 2011
+++ src/tests/lib/libc/arch/powerpc/exec_prot_support.c Fri Mar 16 08:51:47 2012
@@ -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;
}
Index: src/tests/lib/libc/arch/powerpc/return_one.S
diff -u src/tests/lib/libc/arch/powerpc/return_one.S:1.1 src/tests/lib/libc/arch/powerpc/return_one.S:1.2
--- src/tests/lib/libc/arch/powerpc/return_one.S:1.1 Mon Jul 18 23:16:10 2011
+++ src/tests/lib/libc/arch/powerpc/return_one.S Fri Mar 16 08:51:47 2012
@@ -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)