Date: Wed, 4 Jan 2012 16:39:39 +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-9@freebsd.org Subject: svn commit: r229501 - in stable/9/sys/boot: i386/boot2 i386/btx/lib i386/common i386/libi386 pc98/boot2 pc98/btx/lib pc98/libpc98 pc98/loader Message-ID: <201201041639.q04GddBs087024@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Wed Jan 4 16:39:39 2012 New Revision: 229501 URL: http://svn.freebsd.org/changeset/base/229501 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/9/sys/boot/i386/boot2/boot2.c stable/9/sys/boot/i386/btx/lib/btxv86.h stable/9/sys/boot/i386/common/cons.c stable/9/sys/boot/i386/common/drv.c stable/9/sys/boot/i386/libi386/bioscd.c stable/9/sys/boot/i386/libi386/biosdisk.c stable/9/sys/boot/i386/libi386/biosmem.c stable/9/sys/boot/i386/libi386/biospci.c stable/9/sys/boot/i386/libi386/biossmap.c stable/9/sys/boot/i386/libi386/vidconsole.c stable/9/sys/boot/pc98/boot2/boot2.c stable/9/sys/boot/pc98/btx/lib/btxv86.h stable/9/sys/boot/pc98/libpc98/bioscd.c stable/9/sys/boot/pc98/libpc98/vidconsole.c stable/9/sys/boot/pc98/loader/main.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/boot/i386/boot2/boot2.c ============================================================================== --- stable/9/sys/boot/i386/boot2/boot2.c Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/i386/boot2/boot2.c Wed Jan 4 16:39:39 2012 (r229501) @@ -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/9/sys/boot/i386/btx/lib/btxv86.h ============================================================================== --- stable/9/sys/boot/i386/btx/lib/btxv86.h Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/i386/btx/lib/btxv86.h Wed Jan 4 16:39:39 2012 (r229501) @@ -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/9/sys/boot/i386/common/cons.c ============================================================================== --- stable/9/sys/boot/i386/common/cons.c Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/i386/common/cons.c Wed Jan 4 16:39:39 2012 (r229501) @@ -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/9/sys/boot/i386/common/drv.c ============================================================================== --- stable/9/sys/boot/i386/common/drv.c Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/i386/common/drv.c Wed Jan 4 16:39:39 2012 (r229501) @@ -19,8 +19,6 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> -#include <machine/psl.h> - #include <btxv86.h> #include "rbx.h" @@ -31,9 +29,6 @@ __FBSDID("$FreeBSD$"); #include "xreadorg.h" #endif -#define V86_CY(x) ((x) & PSL_C) -#define V86_ZR(x) ((x) & PSL_Z) - #ifdef GPT static struct edd_params params; Modified: stable/9/sys/boot/i386/libi386/bioscd.c ============================================================================== --- stable/9/sys/boot/i386/libi386/bioscd.c Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/i386/libi386/bioscd.c Wed Jan 4 16:39:39 2012 (r229501) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <machine/bootinfo.h> -#include <machine/psl.h> #include <stdarg.h> @@ -334,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/9/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- stable/9/sys/boot/i386/libi386/biosdisk.c Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/i386/libi386/biosdisk.c Wed Jan 4 16:39:39 2012 (r229501) @@ -251,7 +251,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); @@ -265,11 +265,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 & EDD_INTERFACE_FIXED_DISK)) { /* 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); @@ -563,7 +563,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; @@ -1151,7 +1151,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 @@ -1184,7 +1184,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 @@ -1312,7 +1312,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); @@ -1349,7 +1349,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/9/sys/boot/i386/libi386/biosmem.c ============================================================================== --- stable/9/sys/boot/i386/libi386/biosmem.c Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/i386/libi386/biosmem.c Wed Jan 4 16:39:39 2012 (r229501) @@ -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/9/sys/boot/i386/libi386/biospci.c ============================================================================== --- stable/9/sys/boot/i386/libi386/biospci.c Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/i386/libi386/biospci.c Wed Jan 4 16:39:39 2012 (r229501) @@ -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/9/sys/boot/i386/libi386/biossmap.c ============================================================================== --- stable/9/sys/boot/i386/libi386/biossmap.c Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/i386/libi386/biossmap.c Wed Jan 4 16:39:39 2012 (r229501) @@ -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/9/sys/boot/i386/libi386/vidconsole.c ============================================================================== --- stable/9/sys/boot/i386/libi386/vidconsole.c Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/i386/libi386/vidconsole.c Wed Jan 4 16:39:39 2012 (r229501) @@ -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/9/sys/boot/pc98/boot2/boot2.c ============================================================================== --- stable/9/sys/boot/pc98/boot2/boot2.c Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/pc98/boot2/boot2.c Wed Jan 4 16:39:39 2012 (r229501) @@ -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/9/sys/boot/pc98/btx/lib/btxv86.h ============================================================================== --- stable/9/sys/boot/pc98/btx/lib/btxv86.h Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/pc98/btx/lib/btxv86.h Wed Jan 4 16:39:39 2012 (r229501) @@ -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/9/sys/boot/pc98/libpc98/bioscd.c ============================================================================== --- stable/9/sys/boot/pc98/libpc98/bioscd.c Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/pc98/libpc98/bioscd.c Wed Jan 4 16:39:39 2012 (r229501) @@ -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/9/sys/boot/pc98/libpc98/vidconsole.c ============================================================================== --- stable/9/sys/boot/pc98/libpc98/vidconsole.c Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/pc98/libpc98/vidconsole.c Wed Jan 4 16:39:39 2012 (r229501) @@ -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/9/sys/boot/pc98/loader/main.c ============================================================================== --- stable/9/sys/boot/pc98/loader/main.c Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/pc98/loader/main.c Wed Jan 4 16:39:39 2012 (r229501) @@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$"); #include <stand.h> #include <string.h> #include <machine/bootinfo.h> -#include <machine/psl.h> #include <sys/param.h> #include <sys/reboot.h>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201041639.q04GddBs087024>