From: Alexander Kuleshov Date: Fri, 18 Dec 2015 18:01:13 +0000 (+0600) Subject: boot/libi386: use macros from to represent eflags's bits X-Git-Tag: v4.6.0rc~1124 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/4905c84722220a1092a8547e184e19664f6b8765 boot/libi386: use macros from to represent eflags's bits The libi386's source code contains some checks of the EFLAGS's bits. In the same time the header file provides macros which represents these bits. Let's use human readable names instead of numbers. --- diff --git a/sys/boot/pc32/libi386/biosdisk.c b/sys/boot/pc32/libi386/biosdisk.c index 2cf9407bab..0962c86161 100644 --- a/sys/boot/pc32/libi386/biosdisk.c +++ b/sys/boot/pc32/libi386/biosdisk.c @@ -43,6 +43,7 @@ #include #include #include +#include #include @@ -215,7 +216,7 @@ bd_int13probe(struct bdinfo *bd) v86.edx = bd->bd_unit; v86int(); - if (!(v86.efl & 0x1) && /* carry clear */ + if (!(v86.efl & PSL_C) && /* carry clear */ ((v86.edx & 0xff) > ((unsigned)bd->bd_unit & 0x7f))) { /* unit # OK */ /* @@ -235,7 +236,7 @@ bd_int13probe(struct bdinfo *bd) v86.edx = bd->bd_unit; v86.ebx = 0x55aa; v86int(); - if (!(v86.efl & 0x1) && /* carry clear */ + if (!(v86.efl & PSL_C) && /* carry clear */ ((v86.ebx & 0xffff) == 0xaa55) && /* signature */ (v86.ecx & 0x1)) { /* packets mode ok */ bd->bd_flags |= BD_MODEEDD1; @@ -1099,7 +1100,7 @@ bd_read(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest) v86.ds = VTOPSEG(packet); v86.esi = VTOPOFF(packet); v86int(); - result = (v86.efl & 0x1); + result = (v86.efl & PSL_C); if (result == 0) break; } else if (cyl < 1024) { @@ -1112,7 +1113,7 @@ bd_read(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest) v86.es = VTOPSEG(xp); v86.ebx = VTOPOFF(xp); v86int(); - result = (v86.efl & 0x1); + result = (v86.efl & PSL_C); if (result == 0) break; } else { @@ -1250,7 +1251,7 @@ bd_write(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest) v86.ds = VTOPSEG(packet); v86.esi = VTOPOFF(packet); v86int(); - result = (v86.efl & 0x1); + result = (v86.efl & PSL_C); if (result == 0) break; } else if (cyl < 1024) { @@ -1263,7 +1264,7 @@ bd_write(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest) v86.es = VTOPSEG(xp); v86.ebx = VTOPOFF(xp); v86int(); - result = (v86.efl & 0x1); + result = (v86.efl & PSL_C); if (result == 0) break; } else { @@ -1293,7 +1294,7 @@ bd_getgeom(struct open_disk *od) v86.edx = od->od_unit; v86int(); - if ((v86.efl & 0x1) || /* carry set */ + if ((v86.efl & PSL_C) || /* carry set */ ((v86.edx & 0xff) <= (unsigned)(od->od_unit & 0x7f))) /* unit # bad */ return(1); @@ -1330,7 +1331,7 @@ bd_getbigeom(int bunit) v86.eax = 0x800; v86.edx = 0x80 + bunit; v86int(); - if (v86.efl & 0x1) + if (v86.efl & PSL_C) return 0x4f010f; return ((v86.ecx & 0xc0) << 18) | ((v86.ecx & 0xff00) << 8) | (v86.edx & 0xff00) | (v86.ecx & 0x3f); diff --git a/sys/boot/pc32/libi386/biosmem.c b/sys/boot/pc32/libi386/biosmem.c index c284b75f9f..e80e7d5d69 100644 --- a/sys/boot/pc32/libi386/biosmem.c +++ b/sys/boot/pc32/libi386/biosmem.c @@ -24,12 +24,12 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/boot/i386/libi386/biosmem.c,v 1.7 2003/08/25 23:28:31 obrien Exp $ - * $DragonFly: src/sys/boot/pc32/libi386/biosmem.c,v 1.4 2004/06/26 02:26:22 dillon Exp $ */ /* * Obtain memory configuration information from the BIOS */ #include +#include #include "libi386.h" #include "btxv86.h" @@ -74,7 +74,7 @@ bios_getmem(void) (int)(smap.base >> 32), (int)smap.base, (int)(smap.length >> 32), (int)smap.length); #endif - if ((v86.efl & 1) || (v86.eax != SMAPSIG)) + if ((v86.efl & PSL_C) || (v86.eax != SMAPSIG)) break; /* look for a low-memory segment that's large enough */ if ((smap.type == 1) && (smap.base == 0) && (smap.length >= (512 * 1024))) { @@ -103,7 +103,7 @@ bios_getmem(void) v86.addr = 0x15; /* int 0x15 function 0xe801*/ v86.eax = 0xe801; v86int(); - if (!(v86.efl & 1)) { + if (!(v86.efl & PSL_C)) { v = ((v86.ecx & 0xffff) + ((int64_t)(v86.edx & 0xffff) * 64)) * 1024; if (v > 0x40000000) diff --git a/sys/boot/pc32/libi386/biospci.c b/sys/boot/pc32/libi386/biospci.c index f54d835ac5..dee55a2965 100644 --- a/sys/boot/pc32/libi386/biospci.c +++ b/sys/boot/pc32/libi386/biospci.c @@ -24,7 +24,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/boot/i386/libi386/biospci.c,v 1.4 2003/08/25 23:28:31 obrien Exp $ - * $DragonFly: src/sys/boot/pc32/libi386/biospci.c,v 1.3 2003/11/10 06:08:36 dillon Exp $ */ /* @@ -33,6 +32,7 @@ #include #include +#include #include #include #include @@ -212,7 +212,7 @@ biospci_enumerate(void) v86int(); /* Check for OK response */ - if ((v86.efl & 1) || ((v86.eax & 0xff00) != 0) || (v86.edx != 0x20494350)) + if ((v86.efl & PSL_C) || ((v86.eax & 0xff00) != 0) || (v86.edx != 0x20494350)) return; biospci_version = v86.ebx & 0xffff; @@ -240,7 +240,7 @@ biospci_enumerate(void) v86.esi = device_index; v86int(); /* error/end of matches */ - if ((v86.efl & 1) || (v86.eax & 0xff00)) + if ((v86.efl & PSL_C) || (v86.eax & 0xff00)) break; /* Got something */ @@ -254,7 +254,7 @@ biospci_enumerate(void) v86.edi = 0x0; v86int(); /* error */ - if ((v86.efl & 1) || (v86.eax & 0xff00)) + if ((v86.efl & PSL_C) || (v86.eax & 0xff00)) break; /* We have the device ID, create a PnP object and save everything */ diff --git a/sys/boot/pc32/libi386/biossmap.c b/sys/boot/pc32/libi386/biossmap.c index edf130bac7..99e6878a2c 100644 --- a/sys/boot/pc32/libi386/biossmap.c +++ b/sys/boot/pc32/libi386/biossmap.c @@ -33,6 +33,7 @@ #include #include #include +#include #include "bootstrap.h" #include "libi386.h" #include "btxv86.h" @@ -68,7 +69,7 @@ bios_getsmap(void) v86.es = VTOPSEG(&smap); v86.edi = VTOPOFF(&smap); v86int(); - if ((v86.efl & 1) || (v86.eax != SMAPSIG)) + if ((v86.efl & PSL_C) || (v86.eax != SMAPSIG)) break; n++; } while (v86.ebx != 0); @@ -121,7 +122,7 @@ bios_getsmap(void) smapbase[smaplen] = smap; ++smaplen; } - if ((v86.efl & 1) || (v86.eax != SMAPSIG)) + if ((v86.efl & PSL_C) || (v86.eax != SMAPSIG)) break; } while (v86.ebx != 0 && smaplen < n); }