summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortegge <tegge@FreeBSD.org>1997-06-24 17:26:07 +0000
committertegge <tegge@FreeBSD.org>1997-06-24 17:26:07 +0000
commit8cf77a71e3982c03548b2e6e77c662584ce1e97b (patch)
tree8eb7148385f286c465d1f71c6a9a55fed19ea2ab
parentb2e3846eadd59a7863ac846ea169b361b800088a (diff)
downloadFreeBSD-src-8cf77a71e3982c03548b2e6e77c662584ce1e97b.zip
FreeBSD-src-8cf77a71e3982c03548b2e6e77c662584ce1e97b.tar.gz
Ensure that the boot CPU honours write protection in kernel mode.
This fixes one of the problems noted in PR kern/3688.
-rw-r--r--sys/amd64/amd64/mp_machdep.c10
-rw-r--r--sys/amd64/amd64/mptable.c10
-rw-r--r--sys/amd64/include/mptable.h10
-rw-r--r--sys/i386/i386/mp_machdep.c10
-rw-r--r--sys/i386/i386/mptable.c10
-rw-r--r--sys/i386/include/mptable.h10
-rw-r--r--sys/kern/subr_smp.c10
7 files changed, 63 insertions, 7 deletions
diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c
index 049aa83..91e77c2 100644
--- a/sys/amd64/amd64/mp_machdep.c
+++ b/sys/amd64/amd64/mp_machdep.c
@@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mp_machdep.c,v 1.19 1997/06/24 06:55:30 fsmp Exp $
+ * $Id: mp_machdep.c,v 1.20 1997/06/24 07:48:02 fsmp Exp $
*/
#include "opt_smp.h"
@@ -47,6 +47,7 @@
#include <machine/segments.h>
#include <machine/smptests.h> /** TEST_DEFAULT_CONFIG */
#include <machine/tss.h>
+#include <machine/specialreg.h>
#include <i386/i386/cons.h> /* cngetc() */
@@ -437,6 +438,13 @@ mp_enable(u_int boot_addr)
/* start each Application Processor */
start_all_aps(boot_addr);
+
+ /*
+ * The init process might be started on a different CPU now,
+ * and the boot CPU might not call prepare_usermode to get
+ * cr0 correctly configured. Thus we initialize cr0 here.
+ */
+ load_cr0(rcr0() | CR0_WP | CR0_AM);
}
diff --git a/sys/amd64/amd64/mptable.c b/sys/amd64/amd64/mptable.c
index 049aa83..91e77c2 100644
--- a/sys/amd64/amd64/mptable.c
+++ b/sys/amd64/amd64/mptable.c
@@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mp_machdep.c,v 1.19 1997/06/24 06:55:30 fsmp Exp $
+ * $Id: mp_machdep.c,v 1.20 1997/06/24 07:48:02 fsmp Exp $
*/
#include "opt_smp.h"
@@ -47,6 +47,7 @@
#include <machine/segments.h>
#include <machine/smptests.h> /** TEST_DEFAULT_CONFIG */
#include <machine/tss.h>
+#include <machine/specialreg.h>
#include <i386/i386/cons.h> /* cngetc() */
@@ -437,6 +438,13 @@ mp_enable(u_int boot_addr)
/* start each Application Processor */
start_all_aps(boot_addr);
+
+ /*
+ * The init process might be started on a different CPU now,
+ * and the boot CPU might not call prepare_usermode to get
+ * cr0 correctly configured. Thus we initialize cr0 here.
+ */
+ load_cr0(rcr0() | CR0_WP | CR0_AM);
}
diff --git a/sys/amd64/include/mptable.h b/sys/amd64/include/mptable.h
index 049aa83..91e77c2 100644
--- a/sys/amd64/include/mptable.h
+++ b/sys/amd64/include/mptable.h
@@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mp_machdep.c,v 1.19 1997/06/24 06:55:30 fsmp Exp $
+ * $Id: mp_machdep.c,v 1.20 1997/06/24 07:48:02 fsmp Exp $
*/
#include "opt_smp.h"
@@ -47,6 +47,7 @@
#include <machine/segments.h>
#include <machine/smptests.h> /** TEST_DEFAULT_CONFIG */
#include <machine/tss.h>
+#include <machine/specialreg.h>
#include <i386/i386/cons.h> /* cngetc() */
@@ -437,6 +438,13 @@ mp_enable(u_int boot_addr)
/* start each Application Processor */
start_all_aps(boot_addr);
+
+ /*
+ * The init process might be started on a different CPU now,
+ * and the boot CPU might not call prepare_usermode to get
+ * cr0 correctly configured. Thus we initialize cr0 here.
+ */
+ load_cr0(rcr0() | CR0_WP | CR0_AM);
}
diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c
index 049aa83..91e77c2 100644
--- a/sys/i386/i386/mp_machdep.c
+++ b/sys/i386/i386/mp_machdep.c
@@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mp_machdep.c,v 1.19 1997/06/24 06:55:30 fsmp Exp $
+ * $Id: mp_machdep.c,v 1.20 1997/06/24 07:48:02 fsmp Exp $
*/
#include "opt_smp.h"
@@ -47,6 +47,7 @@
#include <machine/segments.h>
#include <machine/smptests.h> /** TEST_DEFAULT_CONFIG */
#include <machine/tss.h>
+#include <machine/specialreg.h>
#include <i386/i386/cons.h> /* cngetc() */
@@ -437,6 +438,13 @@ mp_enable(u_int boot_addr)
/* start each Application Processor */
start_all_aps(boot_addr);
+
+ /*
+ * The init process might be started on a different CPU now,
+ * and the boot CPU might not call prepare_usermode to get
+ * cr0 correctly configured. Thus we initialize cr0 here.
+ */
+ load_cr0(rcr0() | CR0_WP | CR0_AM);
}
diff --git a/sys/i386/i386/mptable.c b/sys/i386/i386/mptable.c
index 049aa83..91e77c2 100644
--- a/sys/i386/i386/mptable.c
+++ b/sys/i386/i386/mptable.c
@@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mp_machdep.c,v 1.19 1997/06/24 06:55:30 fsmp Exp $
+ * $Id: mp_machdep.c,v 1.20 1997/06/24 07:48:02 fsmp Exp $
*/
#include "opt_smp.h"
@@ -47,6 +47,7 @@
#include <machine/segments.h>
#include <machine/smptests.h> /** TEST_DEFAULT_CONFIG */
#include <machine/tss.h>
+#include <machine/specialreg.h>
#include <i386/i386/cons.h> /* cngetc() */
@@ -437,6 +438,13 @@ mp_enable(u_int boot_addr)
/* start each Application Processor */
start_all_aps(boot_addr);
+
+ /*
+ * The init process might be started on a different CPU now,
+ * and the boot CPU might not call prepare_usermode to get
+ * cr0 correctly configured. Thus we initialize cr0 here.
+ */
+ load_cr0(rcr0() | CR0_WP | CR0_AM);
}
diff --git a/sys/i386/include/mptable.h b/sys/i386/include/mptable.h
index 049aa83..91e77c2 100644
--- a/sys/i386/include/mptable.h
+++ b/sys/i386/include/mptable.h
@@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mp_machdep.c,v 1.19 1997/06/24 06:55:30 fsmp Exp $
+ * $Id: mp_machdep.c,v 1.20 1997/06/24 07:48:02 fsmp Exp $
*/
#include "opt_smp.h"
@@ -47,6 +47,7 @@
#include <machine/segments.h>
#include <machine/smptests.h> /** TEST_DEFAULT_CONFIG */
#include <machine/tss.h>
+#include <machine/specialreg.h>
#include <i386/i386/cons.h> /* cngetc() */
@@ -437,6 +438,13 @@ mp_enable(u_int boot_addr)
/* start each Application Processor */
start_all_aps(boot_addr);
+
+ /*
+ * The init process might be started on a different CPU now,
+ * and the boot CPU might not call prepare_usermode to get
+ * cr0 correctly configured. Thus we initialize cr0 here.
+ */
+ load_cr0(rcr0() | CR0_WP | CR0_AM);
}
diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c
index 049aa83..91e77c2 100644
--- a/sys/kern/subr_smp.c
+++ b/sys/kern/subr_smp.c
@@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mp_machdep.c,v 1.19 1997/06/24 06:55:30 fsmp Exp $
+ * $Id: mp_machdep.c,v 1.20 1997/06/24 07:48:02 fsmp Exp $
*/
#include "opt_smp.h"
@@ -47,6 +47,7 @@
#include <machine/segments.h>
#include <machine/smptests.h> /** TEST_DEFAULT_CONFIG */
#include <machine/tss.h>
+#include <machine/specialreg.h>
#include <i386/i386/cons.h> /* cngetc() */
@@ -437,6 +438,13 @@ mp_enable(u_int boot_addr)
/* start each Application Processor */
start_all_aps(boot_addr);
+
+ /*
+ * The init process might be started on a different CPU now,
+ * and the boot CPU might not call prepare_usermode to get
+ * cr0 correctly configured. Thus we initialize cr0 here.
+ */
+ load_cr0(rcr0() | CR0_WP | CR0_AM);
}
OpenPOWER on IntegriCloud