mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-20 11:11:24 +00:00
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.
This commit is contained in:
parent
bc96a57571
commit
4f88092408
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=226746
@ -24,7 +24,6 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <machine/bootinfo.h>
|
||||
#include <machine/elf.h>
|
||||
#include <machine/psl.h>
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
@ -85,8 +84,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
|
||||
|
@ -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, ...);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
@ -337,7 +337,7 @@ bc_read(int unit, daddr_t dblk, int blks, caddr_t dest)
|
||||
v86.ds = VTOPSEG(&packet);
|
||||
v86.esi = VTOPOFF(&packet);
|
||||
v86int();
|
||||
result = (v86.efl & PSL_C);
|
||||
result = V86_CY(v86.efl);
|
||||
if (result == 0)
|
||||
break;
|
||||
}
|
||||
|
@ -250,7 +250,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);
|
||||
@ -264,11 +264,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);
|
||||
@ -562,7 +562,7 @@ bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev)
|
||||
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;
|
||||
@ -1150,7 +1150,7 @@ bd_edd_io(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest, int write)
|
||||
v86.ds = VTOPSEG(&packet);
|
||||
v86.esi = VTOPOFF(&packet);
|
||||
v86int();
|
||||
return (v86.efl & 0x1);
|
||||
return (V86_CY(v86.efl));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -1183,7 +1183,7 @@ bd_chs_io(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest, int write)
|
||||
v86.es = VTOPSEG(dest);
|
||||
v86.ebx = VTOPOFF(dest);
|
||||
v86int();
|
||||
return (v86.efl & 0x1);
|
||||
return (V86_CY(v86.efl));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -1311,7 +1311,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);
|
||||
|
||||
@ -1348,7 +1348,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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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, int index, uint32_t *locator)
|
||||
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, int offset, int width, uint32_t val)
|
||||
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, int offset, int width, uint32_t *val)
|
||||
v86int();
|
||||
|
||||
/* error */
|
||||
if ((v86.efl & 1) || (v86.eax & 0xff00))
|
||||
if (V86_CY(v86.efl) || (v86.eax & 0xff00))
|
||||
return (-1);
|
||||
|
||||
*val = v86.ecx;
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
|
@ -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>
|
||||
|
||||
@ -85,8 +84,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
|
||||
|
@ -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, ...);
|
||||
|
||||
|
@ -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, caddr_t dest)
|
||||
v86.ebp = VTOPOFF(xp);
|
||||
v86.es = VTOPSEG(xp);
|
||||
v86int();
|
||||
result = (v86.efl & PSL_C);
|
||||
result = V86_CY(v86.efl);
|
||||
if (result == 0)
|
||||
break;
|
||||
}
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user