Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Jan 2012 16:43:09 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r229502 - in stable/8/sys/boot: i386/boot2 i386/btx/lib i386/common i386/libi386 pc98/boot2 pc98/btx/lib pc98/libpc98 pc98/loader
Message-ID:  <201201041643.q04Gh9h9087191@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Wed Jan  4 16:43:08 2012
New Revision: 229502
URL: http://svn.freebsd.org/changeset/base/229502

Log:
  MFC 226746:
  Consolidate duplicate definitions of V86_CY() and V86_ZR() which check for
  the carry and zero flags being set, respectively, in <btxv86.h> and use
  them throughout the x86 boot code.

Modified:
  stable/8/sys/boot/i386/boot2/boot2.c
  stable/8/sys/boot/i386/btx/lib/btxv86.h
  stable/8/sys/boot/i386/common/cons.c
  stable/8/sys/boot/i386/common/drv.c
  stable/8/sys/boot/i386/libi386/bioscd.c
  stable/8/sys/boot/i386/libi386/biosdisk.c
  stable/8/sys/boot/i386/libi386/biosmem.c
  stable/8/sys/boot/i386/libi386/biospci.c
  stable/8/sys/boot/i386/libi386/biossmap.c
  stable/8/sys/boot/i386/libi386/vidconsole.c
  stable/8/sys/boot/pc98/boot2/boot2.c
  stable/8/sys/boot/pc98/btx/lib/btxv86.h
  stable/8/sys/boot/pc98/libpc98/bioscd.c
  stable/8/sys/boot/pc98/libpc98/vidconsole.c
  stable/8/sys/boot/pc98/loader/main.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/boot/i386/boot2/boot2.c
==============================================================================
--- stable/8/sys/boot/i386/boot2/boot2.c	Wed Jan  4 16:39:39 2012	(r229501)
+++ stable/8/sys/boot/i386/boot2/boot2.c	Wed Jan  4 16:43:08 2012	(r229502)
@@ -24,7 +24,6 @@ __FBSDID("$FreeBSD$");
 
 #include <machine/bootinfo.h>
 #include <machine/elf.h>
-#include <machine/psl.h>
 
 #include <stdarg.h>
 
@@ -84,8 +83,6 @@ __FBSDID("$FreeBSD$");
 #define NDEV		3
 #define MEM_BASE	0x12
 #define MEM_EXT 	0x15
-#define V86_CY(x)	((x) & PSL_C)
-#define V86_ZR(x)	((x) & PSL_Z)
 
 #define DRV_HARD	0x80
 #define DRV_MASK	0x7f

Modified: stable/8/sys/boot/i386/btx/lib/btxv86.h
==============================================================================
--- stable/8/sys/boot/i386/btx/lib/btxv86.h	Wed Jan  4 16:39:39 2012	(r229501)
+++ stable/8/sys/boot/i386/btx/lib/btxv86.h	Wed Jan  4 16:43:08 2012	(r229502)
@@ -21,6 +21,7 @@
 #define _BTXV86_H_
 
 #include <sys/types.h>
+#include <machine/psl.h>
 
 #define V86_ADDR   0x10000	/* Segment:offset address */
 #define V86_CALLF  0x20000	/* Emulate far call */
@@ -57,6 +58,9 @@ extern u_int32_t	__args;
 #define	VTOPSEG(va)	(u_int16_t)(VTOP((caddr_t)va) >> 4)
 #define	VTOPOFF(va)	(u_int16_t)(VTOP((caddr_t)va) & 0xf)
 
+#define	V86_CY(x)	((x) & PSL_C)
+#define	V86_ZR(x)	((x) & PSL_Z)
+
 void __exit(int) __attribute__((__noreturn__));
 void __exec(caddr_t, ...);
 

Modified: stable/8/sys/boot/i386/common/cons.c
==============================================================================
--- stable/8/sys/boot/i386/common/cons.c	Wed Jan  4 16:39:39 2012	(r229501)
+++ stable/8/sys/boot/i386/common/cons.c	Wed Jan  4 16:43:08 2012	(r229502)
@@ -27,8 +27,6 @@ __FBSDID("$FreeBSD$");
 #include "util.h"
 #include "cons.h"
 
-#define	V86_ZR(x)	((x) & PSL_Z)
-
 #define SECOND		18	/* Circa that many ticks in a second. */
 
 uint8_t ioctrl = IO_KEYBOARD;

Modified: stable/8/sys/boot/i386/common/drv.c
==============================================================================
--- stable/8/sys/boot/i386/common/drv.c	Wed Jan  4 16:39:39 2012	(r229501)
+++ stable/8/sys/boot/i386/common/drv.c	Wed Jan  4 16:43:08 2012	(r229502)
@@ -19,8 +19,6 @@ __FBSDID("$FreeBSD$");
 
 #include <sys/param.h>
 
-#include <machine/psl.h>
-
 #include <btxv86.h>
 
 #include "rbx.h"
@@ -30,9 +28,6 @@ __FBSDID("$FreeBSD$");
 #include "xreadorg.h"
 #endif
 
-#define	V86_CY(x)	((x) & PSL_C)
-#define	V86_ZR(x)	((x) & PSL_Z)
-
 #ifdef GPT
 uint64_t
 drvsize(struct dsk *dskp)

Modified: stable/8/sys/boot/i386/libi386/bioscd.c
==============================================================================
--- stable/8/sys/boot/i386/libi386/bioscd.c	Wed Jan  4 16:39:39 2012	(r229501)
+++ stable/8/sys/boot/i386/libi386/bioscd.c	Wed Jan  4 16:43:08 2012	(r229502)
@@ -42,12 +42,12 @@ __FBSDID("$FreeBSD$");
 
 #include <sys/param.h>
 #include <machine/bootinfo.h>
-#include <machine/psl.h>
 
 #include <stdarg.h>
 
 #include <bootstrap.h>
 #include <btxv86.h>
+#include <edd.h>
 #include "libi386.h"
 
 #define BIOSCD_SECSIZE		2048
@@ -333,7 +333,7 @@ bc_read(int unit, daddr_t dblk, int blks
 			v86.ds = VTOPSEG(&packet);
 			v86.esi = VTOPOFF(&packet);
 			v86int();
-			result = (v86.efl & PSL_C);
+			result = V86_CY(v86.efl);
 			if (result == 0)
 				break;
 		}

Modified: stable/8/sys/boot/i386/libi386/biosdisk.c
==============================================================================
--- stable/8/sys/boot/i386/libi386/biosdisk.c	Wed Jan  4 16:39:39 2012	(r229501)
+++ stable/8/sys/boot/i386/libi386/biosdisk.c	Wed Jan  4 16:43:08 2012	(r229502)
@@ -248,7 +248,7 @@ bd_int13probe(struct bdinfo *bd)
     v86.edx = bd->bd_unit;
     v86int();
     
-    if (!(v86.efl & 0x1) &&				/* carry clear */
+    if (!(V86_CY(v86.efl)) &&				/* carry clear */
 	((v86.edx & 0xff) > ((unsigned)bd->bd_unit & 0x7f))) {	/* unit # OK */
 	if ((v86.ecx & 0x3f) == 0) {			/* absurd sector size */
 		DEBUG("Invalid geometry for unit %d", bd->bd_unit);
@@ -262,11 +262,11 @@ bd_int13probe(struct bdinfo *bd)
 	v86.edx = bd->bd_unit;
 	v86.ebx = 0x55aa;
 	v86int();
-	if (!(v86.efl & 0x1) &&				/* carry clear */
+	if (!(V86_CY(v86.efl)) &&			/* carry clear */
 	    ((v86.ebx & 0xffff) == 0xaa55) &&		/* signature */
 	    (v86.ecx & 0x1)) {				/* packets mode ok */
 	    bd->bd_flags |= BD_MODEEDD1;
-	    if((v86.eax & 0xff00) >= 0x3000)
+	    if ((v86.eax & 0xff00) >= 0x3000)
 	        bd->bd_flags |= BD_MODEEDD3;
 	}
 	return(1);
@@ -560,7 +560,7 @@ bd_opendisk(struct open_disk **odp, stru
 	return (ENOMEM);
     }
 
-    /* Look up BIOS unit number, intialise open_disk structure */
+    /* Look up BIOS unit number, initalise open_disk structure */
     od->od_dkunit = dev->d_unit;
     od->od_unit = bdinfo[od->od_dkunit].bd_unit;
     od->od_flags = bdinfo[od->od_dkunit].bd_flags;
@@ -1148,7 +1148,7 @@ bd_edd_io(struct open_disk *od, daddr_t 
     v86.ds = VTOPSEG(&packet);
     v86.esi = VTOPOFF(&packet);
     v86int();
-    return (v86.efl & 0x1);
+    return (V86_CY(v86.efl));
 }
 
 static int
@@ -1181,7 +1181,7 @@ bd_chs_io(struct open_disk *od, daddr_t 
     v86.es = VTOPSEG(dest);
     v86.ebx = VTOPOFF(dest);
     v86int();
-    return (v86.efl & 0x1);
+    return (V86_CY(v86.efl));
 }
 
 static int
@@ -1309,7 +1309,7 @@ bd_getgeom(struct open_disk *od)
     v86.edx = od->od_unit;
     v86int();
 
-    if ((v86.efl & 0x1) ||				/* carry set */
+    if ((V86_CY(v86.efl)) ||				/* carry set */
 	((v86.edx & 0xff) <= (unsigned)(od->od_unit & 0x7f)))	/* unit # bad */
 	return(1);
     
@@ -1346,7 +1346,7 @@ bd_getbigeom(int bunit)
     v86.eax = 0x800;
     v86.edx = 0x80 + bunit;
     v86int();
-    if (v86.efl & 0x1)
+    if (V86_CY(v86.efl))
 	return 0x4f010f;
     return ((v86.ecx & 0xc0) << 18) | ((v86.ecx & 0xff00) << 8) |
 	   (v86.edx & 0xff00) | (v86.ecx & 0x3f);

Modified: stable/8/sys/boot/i386/libi386/biosmem.c
==============================================================================
--- stable/8/sys/boot/i386/libi386/biosmem.c	Wed Jan  4 16:39:39 2012	(r229501)
+++ stable/8/sys/boot/i386/libi386/biosmem.c	Wed Jan  4 16:43:08 2012	(r229502)
@@ -61,7 +61,7 @@ bios_getmem(void)
 	v86.es = VTOPSEG(&smap);
 	v86.edi = VTOPOFF(&smap);
 	v86int();
-	if ((v86.efl & 1) || (v86.eax != SMAP_SIG))
+	if ((V86_CY(v86.efl)) || (v86.eax != SMAP_SIG))
 	    break;
 	/* look for a low-memory segment that's large enough */
 	if ((smap.type == SMAP_TYPE_MEMORY) && (smap.base == 0) &&
@@ -108,7 +108,7 @@ bios_getmem(void)
 	v86.addr = 0x15;		/* int 0x15 function 0xe801*/
 	v86.eax = 0xe801;
 	v86int();
-	if (!(v86.efl & 1)) {
+	if (!(V86_CY(v86.efl))) {
 	    bios_extmem = ((v86.ecx & 0xffff) + ((v86.edx & 0xffff) * 64)) * 1024;
 	}
     }

Modified: stable/8/sys/boot/i386/libi386/biospci.c
==============================================================================
--- stable/8/sys/boot/i386/libi386/biospci.c	Wed Jan  4 16:39:39 2012	(r229501)
+++ stable/8/sys/boot/i386/libi386/biospci.c	Wed Jan  4 16:43:08 2012	(r229502)
@@ -218,7 +218,8 @@ biospci_enumerate(void)
     v86int();
 
     /* Check for OK response */
-    if ((v86.efl & 1) || ((v86.eax & 0xff00) != 0) || (v86.edx != 0x20494350))
+    if (V86_CY(v86.efl) || ((v86.eax & 0xff00) != 0) ||
+	(v86.edx != 0x20494350))
 	return;
 
     biospci_version = v86.ebx & 0xffff;
@@ -295,7 +296,7 @@ biospci_find_devclass(uint32_t class, in
 	v86int();
 
 	 /* error */
-	if ((v86.efl & 1) || (v86.eax & 0xff00))
+	if (V86_CY(v86.efl) || (v86.eax & 0xff00))
 		return (-1);
 
 	*locator = v86.ebx;
@@ -317,7 +318,7 @@ biospci_write_config(uint32_t locator, i
 	v86int();
 
 	 /* error */
-	if ((v86.efl & 1) || (v86.eax & 0xff00))
+	if (V86_CY(v86.efl) || (v86.eax & 0xff00))
 		return (-1);
 
 	return(0);
@@ -334,7 +335,7 @@ biospci_read_config(uint32_t locator, in
 	v86int();
 
 	 /* error */
-	if ((v86.efl & 1) || (v86.eax & 0xff00))
+	if (V86_CY(v86.efl) || (v86.eax & 0xff00))
 		return (-1);
 
 	*val = v86.ecx;

Modified: stable/8/sys/boot/i386/libi386/biossmap.c
==============================================================================
--- stable/8/sys/boot/i386/libi386/biossmap.c	Wed Jan  4 16:39:39 2012	(r229501)
+++ stable/8/sys/boot/i386/libi386/biossmap.c	Wed Jan  4 16:43:08 2012	(r229502)
@@ -36,14 +36,11 @@ __FBSDID("$FreeBSD$");
 #include <sys/queue.h>
 #include <sys/stddef.h>
 #include <machine/metadata.h>
-#include <machine/psl.h>
 #include <machine/pc/bios.h>
 #include "bootstrap.h"
 #include "libi386.h"
 #include "btxv86.h"
 
-#define	V86_CY(x)	((x) & PSL_C)
-
 struct smap_buf {
 	struct bios_smap	smap;
 	uint32_t		xattr;	/* Extended attribute from ACPI 3.0 */

Modified: stable/8/sys/boot/i386/libi386/vidconsole.c
==============================================================================
--- stable/8/sys/boot/i386/libi386/vidconsole.c	Wed Jan  4 16:39:39 2012	(r229501)
+++ stable/8/sys/boot/i386/libi386/vidconsole.c	Wed Jan  4 16:43:08 2012	(r229502)
@@ -516,7 +516,7 @@ vidc_ischar(void)
     v86.addr = 0x16;
     v86.eax = 0x100;
     v86int();
-    return (!(v86.efl & PSL_Z));
+    return (!V86_ZR(v86.efl));
 }
 
 #if KEYBOARD_PROBE

Modified: stable/8/sys/boot/pc98/boot2/boot2.c
==============================================================================
--- stable/8/sys/boot/pc98/boot2/boot2.c	Wed Jan  4 16:39:39 2012	(r229501)
+++ stable/8/sys/boot/pc98/boot2/boot2.c	Wed Jan  4 16:43:08 2012	(r229502)
@@ -26,7 +26,6 @@ __FBSDID("$FreeBSD$");
 #include <machine/bootinfo.h>
 #include <machine/cpufunc.h>
 #include <machine/elf.h>
-#include <machine/psl.h>
 
 #include <stdarg.h>
 
@@ -84,8 +83,6 @@ __FBSDID("$FreeBSD$");
 #define ARGS		0x900
 #define NOPT		14
 #define NDEV		3
-#define V86_CY(x)	((x) & PSL_C)
-#define V86_ZR(x)	((x) & PSL_Z)
 
 #define DRV_DISK	0xf0
 #define DRV_UNIT	0x0f

Modified: stable/8/sys/boot/pc98/btx/lib/btxv86.h
==============================================================================
--- stable/8/sys/boot/pc98/btx/lib/btxv86.h	Wed Jan  4 16:39:39 2012	(r229501)
+++ stable/8/sys/boot/pc98/btx/lib/btxv86.h	Wed Jan  4 16:43:08 2012	(r229502)
@@ -21,6 +21,7 @@
 #define _BTXV86_H_
 
 #include <sys/types.h>
+#include <machine/psl.h>
 
 #define V86_ADDR   0x10000	/* Segment:offset address */
 #define V86_CALLF  0x20000	/* Emulate far call */
@@ -57,6 +58,9 @@ extern u_int32_t	__args;
 #define	VTOPSEG(va)	(u_int16_t)(VTOP((caddr_t)va) >> 4)
 #define	VTOPOFF(va)	(u_int16_t)(VTOP((caddr_t)va) & 0xf)
 
+#define	V86_CY(x)	((x) & PSL_C)
+#define	V86_ZR(x)	((x) & PSL_Z)
+
 void __exit(int) __attribute__((__noreturn__));
 void __exec(caddr_t, ...);
 

Modified: stable/8/sys/boot/pc98/libpc98/bioscd.c
==============================================================================
--- stable/8/sys/boot/pc98/libpc98/bioscd.c	Wed Jan  4 16:39:39 2012	(r229501)
+++ stable/8/sys/boot/pc98/libpc98/bioscd.c	Wed Jan  4 16:43:08 2012	(r229502)
@@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$");
 
 #include <sys/param.h>
 #include <machine/bootinfo.h>
-#include <machine/psl.h>
 
 #include <stdarg.h>
 
@@ -325,7 +324,7 @@ bc_read(int unit, daddr_t dblk, int blks
 			v86.ebp = VTOPOFF(xp);
 			v86.es = VTOPSEG(xp);
 			v86int();
-			result = (v86.efl & PSL_C);
+			result = V86_CY(v86.efl);
 			if (result == 0)
 				break;
 		}

Modified: stable/8/sys/boot/pc98/libpc98/vidconsole.c
==============================================================================
--- stable/8/sys/boot/pc98/libpc98/vidconsole.c	Wed Jan  4 16:39:39 2012	(r229501)
+++ stable/8/sys/boot/pc98/libpc98/vidconsole.c	Wed Jan  4 16:43:08 2012	(r229502)
@@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$");
 #include <stand.h>
 #include <bootstrap.h>
 #include <btxv86.h>
-#include <machine/psl.h>
 #include <machine/cpufunc.h>
 #include "libi386.h"
 

Modified: stable/8/sys/boot/pc98/loader/main.c
==============================================================================
--- stable/8/sys/boot/pc98/loader/main.c	Wed Jan  4 16:39:39 2012	(r229501)
+++ stable/8/sys/boot/pc98/loader/main.c	Wed Jan  4 16:43:08 2012	(r229502)
@@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$");
 #include <stand.h>
 #include <string.h>
 #include <machine/bootinfo.h>
-#include <machine/psl.h>
 #include <sys/reboot.h>
 
 #include "bootstrap.h"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201041643.q04Gh9h9087191>