aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2008-08-15 19:34:02 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2008-08-15 19:34:02 +0000
commit226a681031ae8fcfb05534caa098293be518e14e (patch)
treea2f88087a57b758f24f148e9857ac6bc1901e3dd
parent2ca68351259502d0defb88c8e049e024cd94ce01 (diff)
downloadsrc-226a681031ae8fcfb05534caa098293be518e14e.tar.gz
src-226a681031ae8fcfb05534caa098293be518e14e.zip
MFC: Initialize the vm86 structure to a known-good state, specifically
eflags.
Notes
Notes: svn path=/stable/4/; revision=181767
-rw-r--r--sys/boot/i386/boot2/boot2.c6
-rw-r--r--sys/boot/i386/loader/main.c5
-rw-r--r--sys/boot/pc98/loader/main.c5
3 files changed, 14 insertions, 2 deletions
diff --git a/sys/boot/i386/boot2/boot2.c b/sys/boot/i386/boot2/boot2.c
index 34f548d7b1f0..1cd9fcd7205e 100644
--- a/sys/boot/i386/boot2/boot2.c
+++ b/sys/boot/i386/boot2/boot2.c
@@ -24,6 +24,7 @@
#include <sys/dirent.h>
#include <machine/bootinfo.h>
#include <machine/elf.h>
+#include <machine/psl.h>
#include <ufs/ffs/fs.h>
#include <ufs/ufs/dinode.h>
@@ -62,8 +63,8 @@
#define NDEV 5
#define MEM_BASE 0x12
#define MEM_EXT 0x15
-#define V86_CY(x) ((x) & 1)
-#define V86_ZR(x) ((x) & 0x40)
+#define V86_CY(x) ((x) & PSL_C)
+#define V86_ZR(x) ((x) & PSL_Z)
#define DRV_HARD 0x80
#define DRV_MASK 0x7f
@@ -243,6 +244,7 @@ main(void)
int autoboot, i;
v86.ctl = V86_FLAGS;
+ v86.efl = PSL_RESERVED_DEFAULT | PSL_I;
dsk.drive = *(uint8_t *)PTOV(ARGS);
dsk.type = dsk.drive & DRV_HARD ? TYPE_AD : TYPE_FD;
dsk.unit = dsk.drive & DRV_MASK;
diff --git a/sys/boot/i386/loader/main.c b/sys/boot/i386/loader/main.c
index 63b9ddbc8404..51cc31019b6c 100644
--- a/sys/boot/i386/loader/main.c
+++ b/sys/boot/i386/loader/main.c
@@ -34,6 +34,7 @@
#include <stand.h>
#include <string.h>
#include <machine/bootinfo.h>
+#include <machine/psl.h>
#include <sys/reboot.h>
#include "bootstrap.h"
@@ -82,6 +83,10 @@ main(void)
initial_bootdev = kargs->bootdev;
initial_bootinfo = kargs->bootinfo ? (struct bootinfo *)PTOV(kargs->bootinfo) : NULL;
+ /* Initialize the v86 register set to a known-good state. */
+ bzero(&v86, sizeof(v86));
+ v86.efl = PSL_RESERVED_DEFAULT | PSL_I;
+
/*
* Initialise the heap as early as possible. Once this is done, malloc() is usable.
*/
diff --git a/sys/boot/pc98/loader/main.c b/sys/boot/pc98/loader/main.c
index 4f5bed0f19ae..e1e0e8931899 100644
--- a/sys/boot/pc98/loader/main.c
+++ b/sys/boot/pc98/loader/main.c
@@ -34,6 +34,7 @@
#include <stand.h>
#include <string.h>
#include <machine/bootinfo.h>
+#include <machine/psl.h>
#include <sys/reboot.h>
#include "bootstrap.h"
@@ -82,6 +83,10 @@ main(void)
initial_bootdev = kargs->bootdev;
initial_bootinfo = kargs->bootinfo ? (struct bootinfo *)PTOV(kargs->bootinfo) : NULL;
+ /* Initialize the v86 register set to a known-good state. */
+ bzero(&v86, sizeof(v86));
+ v86.efl = PSL_RESERVED_DEFAULT | PSL_I;
+
/*
* Initialise the heap as early as possible. Once this is done, malloc() is usable.
*/