From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 16:43:09 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A3400106564A; Wed, 4 Jan 2012 16:43:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8E7C28FC13; Wed, 4 Jan 2012 16:43:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q04Gh955087207; Wed, 4 Jan 2012 16:43:09 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04Gh9h9087191; Wed, 4 Jan 2012 16:43:09 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201041643.q04Gh9h9087191@svn.freebsd.org> From: John Baldwin Date: Wed, 4 Jan 2012 16:43:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: 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 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 16:43:09 -0000 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 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 #include -#include #include @@ -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 +#include #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 -#include - #include #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 #include -#include #include #include #include +#include #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 #include #include -#include #include #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 #include #include -#include #include @@ -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 +#include #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 #include -#include #include @@ -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 #include #include -#include #include #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 #include #include -#include #include #include "bootstrap.h"