From 40beb1be289a49f381bd653c5f3446b4a2b6d9ba Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sun, 15 Aug 2021 20:36:40 -0300 Subject: [PATCH] Establish a common library for Watcom tools --- .gitignore | 3 +- cp437/README.md | 3 +- cp437/cp437.c | 12 ++++--- lib/build_watcom_dos.bat | 8 +++-- lib/build_watcom_dos.sh | 8 ++--- lib/build_watcom_host.bat | 2 +- lib/build_watcom_host.sh | 2 +- lib/wlib.c | 33 +++++++++++++++++ lib/wlib.h | 70 ++++++++++++++++++++++++++++++++++++ pcireg/PCIREG.EXE | Bin 34776 -> 34776 bytes pcireg/build.bat | 2 +- pcireg/build.sh | 2 +- pcireg/pcireg.c | 73 ++++++-------------------------------- 13 files changed, 138 insertions(+), 80 deletions(-) create mode 100644 lib/wlib.c create mode 100644 lib/wlib.h diff --git a/.gitignore b/.gitignore index 974fee9..9003691 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ # cp437 tool cp437/cp437 cp437/cp437.exe -*.cp437 +cp437.tmp +*_cp437 # Watcom C *.err diff --git a/cp437/README.md b/cp437/README.md index 52c912e..f60da94 100644 --- a/cp437/README.md +++ b/cp437/README.md @@ -7,6 +7,7 @@ Usage ``` cp437 infile [infile...] - Converts UTF-8 input file(s) to CP437 output file(s) with .cp437 appended. + The new file names are also printed to stdout. ``` Building @@ -14,4 +15,4 @@ Building This tool is automatically built as needed by the build scripts for other tools. Alternatively: * **Windows:** Run `build.bat` from an OpenWatcom "Build Environment" command prompt. -* **Linux:** Run `./build.sh` with OpenWatcom tools present on `$PATH`. +* **Linux:** Run `./build.sh` with OpenWatcom tools present in `$PATH`. diff --git a/cp437/cp437.c b/cp437/cp437.c index ce9ab7e..aa2954e 100644 --- a/cp437/cp437.c +++ b/cp437/cp437.c @@ -48,8 +48,9 @@ main(int argc, char **argv) char *buf; FILE *fin, *fout; - /* Disable stdout buffering. */ + /* Disable stdout/stderr buffering. */ setbuf(stdout, NULL); + setbuf(stderr, NULL); /* Print usage if no input files were specified. */ if (argc < 2) { @@ -57,6 +58,7 @@ main(int argc, char **argv) printf("\n"); printf("cp437 infile [infile...]\n"); printf("- Converts UTF-8 input file(s) to CP437 output file(s) with .cp437 appended.\n"); + printf(" The new file names are also printed to stdout.\n"); return 1; } @@ -66,23 +68,23 @@ main(int argc, char **argv) /* Open input file. */ fin = fopen(argv[i], "rb"); if (!fin) { - printf("Could not open input file \"%s\"\n", argv[i]); + fprintf(stderr, "Could not open input file \"%s\"\n", argv[i]); continue; } /* Generate output file name. */ buf = malloc(strlen(argv[i]) + 7); - sprintf(buf, "%s.cp437", argv[i]); + sprintf(buf, "%s_cp437", argv[i]); /* Open output file. */ fout = fopen(buf, "wb"); if (!fout) { fclose(fin); - printf("Could not open output file \"%s\"\n", buf); + fprintf(stderr, "Could not open output file \"%s\"\n", buf); continue; } - printf("Processing \"%s\"\n", argv[i]); + printf("%s\n", buf); /* Perform the conversion. */ while (!feof(fin)) { diff --git a/lib/build_watcom_dos.bat b/lib/build_watcom_dos.bat index 7204ed3..0b6e5dd 100644 --- a/lib/build_watcom_dos.bat +++ b/lib/build_watcom_dos.bat @@ -33,8 +33,8 @@ if not exist ..\cp437\cp437.exe ( ) :: Convert source file to CP437. -echo *** Converting %1 to CP437... -..\cp437\cp437.exe %1 +echo *** Converting source to CP437... +..\cp437\cp437.exe %* > cp437.tmp if errorlevel 1 ( echo *** Conversion failed. exit /b 2 @@ -48,7 +48,9 @@ for %%i in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do set "destfil :: Call compiler. echo *** Building... -wcl -bcl=dos -fo="!destfile!" "%1.cp437" +set srcfiles= +for /f "delims=" %%i in (cp437.tmp) do set srcfiles=!srcfiles! %%i +wcl -bcl=dos -i=..\lib -fe="!destfile!" %srcfiles% :: Check for success. if errorlevel 1 ( diff --git a/lib/build_watcom_dos.sh b/lib/build_watcom_dos.sh index 4daa0ab..b2391d4 100644 --- a/lib/build_watcom_dos.sh +++ b/lib/build_watcom_dos.sh @@ -35,9 +35,9 @@ then popd fi -# Convert source file to CP437. -echo '***' Converting $1 to CP437... -if ! ../cp437/cp437 "$1" +# Convert source files to CP437. +echo '***' Converting source to CP437... +if ! ../cp437/cp437 "$@" > cp437.tmp then echo '***' Conversion failed. exit 2 @@ -47,7 +47,7 @@ fi destfile=$(basename "$1" .c | tr [:lower:] [:upper:]).EXE # Call compiler and check for success. -if wcl -bcl=dos -fo="$destfile" "$1".cp437 +if wcl -bcl=dos -fo="$destfile" $(cat cp437.tmp) then echo '***' Build successful. else diff --git a/lib/build_watcom_host.bat b/lib/build_watcom_host.bat index f66fbc3..05f67c7 100644 --- a/lib/build_watcom_host.bat +++ b/lib/build_watcom_host.bat @@ -29,7 +29,7 @@ set destfile=%srcfile:~0,-2%.exe :: Call compiler. echo *** Building... -wcl386 -bcl=nt -fo="%destfile%" "%1" +wcl386 -bcl=nt -fo="%destfile%" %* :: Check for success. if errorlevel 1 ( diff --git a/lib/build_watcom_host.sh b/lib/build_watcom_host.sh index 4933f7f..f47a586 100644 --- a/lib/build_watcom_host.sh +++ b/lib/build_watcom_host.sh @@ -26,7 +26,7 @@ fi destfile=$(basename "$1" .c) # Call compiler and check for success. -if wcl386 -bcl=linux -fo="$destfile" "$1" +if wcl386 -bcl=linux -fo="$destfile" "$@" then echo '***' Build successful. chmod +x "$destfile" diff --git a/lib/wlib.c b/lib/wlib.c new file mode 100644 index 0000000..9b69dbd --- /dev/null +++ b/lib/wlib.c @@ -0,0 +1,33 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box Probing Tools distribution. + * + * Common functions for Watcom C-based tools. + * + * + * + * Authors: RichardG, + * + * Copyright 2021 RichardG. + * + */ +#include +#include "wlib.h" + + +uint32_t +pci_cf8(uint8_t bus, uint8_t dev, uint8_t func, uint8_t reg) +{ + /* Generate a PCI port CF8h dword. */ + multi_t ret; + ret.u8[3] = 0x80; + ret.u8[2] = bus; + ret.u8[1] = dev << 3; + ret.u8[1] |= func & 7; + ret.u8[0] = reg & 0xfc; + return ret.u32; +} diff --git a/lib/wlib.h b/lib/wlib.h new file mode 100644 index 0000000..df3bd04 --- /dev/null +++ b/lib/wlib.h @@ -0,0 +1,70 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box Probing Tools distribution. + * + * Definitions for common functions for Watcom C-based tools. + * + * + * + * Authors: RichardG, + * + * Copyright 2021 RichardG. + * + */ +#ifndef WLIB_H +# define WLIB_H +#include + +#pragma pack(push, 0) +/* Convenience type for breaking a dword value down into words and bytes. */ +typedef union { + uint8_t u8[4]; + uint16_t u16[2]; + uint32_t u32; +} multi_t; +#pragma pack(pop) + + +/* Port I/O functions. */ +uint8_t inb(uint16_t port); +#pragma aux inb = "in al, dx" parm [dx] value [al]; +void outb(uint16_t port, uint8_t data); +#pragma aux outb = "out dx, al" parm [dx] [al]; +uint16_t inw(uint16_t port); +#pragma aux inw = "in ax, dx" parm [dx] value [ax]; +void outw(uint16_t port, uint16_t data); +#pragma aux outw = "out dx, ax" parm [dx] [ax]; +#ifdef M_I386 +uint32_t inl(uint16_t port); +# pragma aux inl = "in eax, dx" parm [dx] value [eax]; +void outl(uint16_t port, uint32_t data); +# pragma aux outl = "out dx, eax" parm [dx] [eax]; +#else +/* Some manual prefixing trickery to perform 32-bit I/O and access + the extended part of EAX in real mode. Exchanging is necessary + due to Watcom ignoring the order registers are specified in... */ +uint32_t inl(uint16_t port); +# pragma aux inl = "db 0x66" "in ax, dx" /* in eax, dx */ \ + "mov cx, ax" \ + "db 0x66, 0xc1, 0xe8, 0x10" /* shr eax, 16 */ \ + "xchg ax, cx" \ + parm [dx] \ + value [ax cx]; +void outl(uint16_t port, uint32_t data); +# pragma aux outl = "xchg ax, cx" \ + "db 0x66, 0xc1, 0xe0, 0x10" /* shl eax, 16 */ \ + "mov ax, cx" \ + "db 0x66" "out dx, ax" /* out dx, eax */ \ + parm [dx] [ax cx] \ + modify [ax cx]; +#endif + + +/* PCI functions. */ +extern uint32_t pci_cf8(uint8_t bus, uint8_t dev, uint8_t func, uint8_t reg); + +#endif diff --git a/pcireg/PCIREG.EXE b/pcireg/PCIREG.EXE index 2023766d8d3cbc820974c3810b06e939949b4c25..631b28780715e0f33946a430c8a675d5b150f3c3 100644 GIT binary patch delta 3199 zcmZuzdstLu8b9BeVVGfHVJ@Kj^azGolEpB0Z*tfwqZ#^uW&Z54dG`rD?sKeg zSYaJ(FzSaI94F{;i*TuxFhW<0Gel1%Hw^;OE60LbaAnJ-OVAoZx&+_%>X-GFs^~v6B_Bn-s7yRyap8S%npn*wN%YxR)KS+@2Er95{B6ai>^pXztP%Q{Vj! ztLqC_>9&=^Zr02?Qs7f|N~9_!_(R|s1};V?>OW>^PjWEblgH~0D?bJsYhls3LXk$c z!e10c)l$iF3EJy@yDR zA^gFTu(*`)RDmjGFiNaKeBCUYSv1!+iz`sm0|}~8Y47*z<*;S_VXvU-b{N2N)qIi< zZ7P#~(13mq1}B=KTUAG1hKk5FtThQvN6uLDMIxqf92HlwJUt}g3GUyM>Mx2el;4+R zcX6qKUmYdZp<I`xPKGI~sOwC~J4%6+!Ndt$*3jfg9NCjGR$xXPbnQCZFaJNVAS2G?b zr4Ppn$6=+?49lZTYp%!2Md*uS#B2k-5r^rk)!VXhd1tG8`bXDdk9CZ}qt7$oEWWuW z_=Q74A2nKhT`Z1Ti_l5OT0GWdbg>!~)*LMUQCR%w{L%oqiV-smbn5_l29lpga%o(1 zz9u@D;rl^iI>ZI79&0AjjF2)tdOOqG9A@~23%D4MH4Uxl{p7`ekdHIa2?ONgkhB}g z<ai3;m8Z{KtzdLoaCOmzMCN3L6b*43^BJ+B<7mdrnVqG5Z;%aD@J>#{zWr z;q}qY65Da2yI_W)pt9Q3P^>YOyNW!K;}5P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5daqLOf)^CQlwO%v^saJydU zZxaSe?bHHZ`#5qKdh8N83+o&M_8B>Qn~inGe;W6;;m~f}`!xmXiW_cbq_OLHD?cy) z$!|v1b^5yCgYi@Fit~-Xk#PBz)QZ~NrjBI%S5R<1E>PB`Uwdv&*hfe%?3%PJ?Z+$1 zCsIX%^Nhbqxgh=yS v?fdavbNi3`C~3wUEO@^mopg%EAM^LpZcoRu`&8ub9$Wd&RMfPOwv7BgHH}LA diff --git a/pcireg/build.bat b/pcireg/build.bat index 6ca3449..398911f 100644 --- a/pcireg/build.bat +++ b/pcireg/build.bat @@ -1,2 +1,2 @@ @echo off -..\lib\build_watcom_dos.bat pcireg.c +..\lib\build_watcom_dos.bat pcireg.c ..\lib\wlib.c diff --git a/pcireg/build.sh b/pcireg/build.sh index f1fc705..3d42296 100644 --- a/pcireg/build.sh +++ b/pcireg/build.sh @@ -1,2 +1,2 @@ #!/bin/sh -exec ../lib/build_watcom_dos.sh pcireg.c +exec ../lib/build_watcom_dos.sh pcireg.c ../lib/wlib.c diff --git a/pcireg/pcireg.c b/pcireg/pcireg.c index 2f8ab04..7b4e71e 100644 --- a/pcireg/pcireg.c +++ b/pcireg/pcireg.c @@ -27,14 +27,9 @@ #include #include #include +#include "wlib.h" -typedef union { - uint8_t u8[4]; - uint16_t u16[2]; - uint32_t u32; -} multi_t; - struct videoconfig vc; union REGPACK rp; /* things break if this is not a global variable... */ @@ -74,52 +69,6 @@ typedef struct { #pragma pack(pop) -void outb(uint16_t port, uint8_t data); -#pragma aux outb = "out dx, al" parm [dx] [al]; -uint8_t inb(uint16_t port); -#pragma aux inb = "in al, dx" parm [dx] value [al]; - -void outw(uint16_t port, uint16_t data); -#pragma aux outw = "out dx, ax" parm [dx] [ax]; -uint16_t inw(uint16_t port); -#pragma aux inw = "in ax, dx" parm [dx] value [ax]; - -#ifdef M_I386 -void outl(uint16_t port, uint32_t data); -# pragma aux outl = "out dx, eax" parm [dx] [eax]; -uint32_t inl(uint16_t port); -# pragma aux inl = "in eax, dx" parm [dx] value [eax]; -#else -void outl(uint16_t port, uint32_t data); -# pragma aux outl = "xchg ax, cx" \ - "db 0x66, 0xc1, 0xe0, 0x10" /* shl eax, 16 */ \ - "mov ax, cx" \ - "db 0x66" "out dx, ax" /* out dx, eax */ \ - parm [dx] [ax cx] \ - modify [ax cx]; -uint32_t inl(uint16_t port); -# pragma aux inl = "db 0x66" "in ax, dx" /* in eax, dx */ \ - "mov cx, ax" \ - "db 0x66, 0xc1, 0xe8, 0x10" /* shr eax, 16 */ \ - "xchg ax, cx" \ - parm [dx] \ - value [ax cx]; -#endif - - -uint32_t -make_cf8(uint8_t bus, uint8_t dev, uint8_t func, uint8_t reg) -{ - multi_t ret; - ret.u8[3] = 0x80; - ret.u8[2] = bus; - ret.u8[1] = dev << 3; - ret.u8[1] |= func & 7; - ret.u8[0] = reg & 0xfc; - return ret.u32; -} - - char * read_string(FILE *f, uint32_t offset) { @@ -148,7 +97,7 @@ dump_regs(uint8_t bus, uint8_t dev, uint8_t func, uint8_t start_reg, char sz) start_reg &= 0xfc; /* Build the base CF8h dword for this dump. */ - cf8 = make_cf8(bus, dev, func, 0x00); + cf8 = pci_cf8(bus, dev, func, 0x00); /* Generate dump file name. */ sprintf(buf, "PCI%02X%02X%d.BIN", bus, dev, func); @@ -568,7 +517,7 @@ scan_bus(uint8_t bus, int nesting, char dump, FILE *f, char *buf) dev_id.u32 = 0xffffffff; } #else - cf8 = make_cf8(bus, dev, func, 0x00); + cf8 = pci_cf8(bus, dev, func, 0x00); outl(0xcf8, cf8); dev_id.u32 = inl(0xcfc); #endif @@ -595,7 +544,7 @@ scan_bus(uint8_t bus, int nesting, char dump, FILE *f, char *buf) dev_rev_class.u16[0] = rand(); dev_rev_class.u16[1] = rand(); #else - cf8 = make_cf8(bus, dev, func, 0x08); + cf8 = pci_cf8(bus, dev, func, 0x08); outl(0xcf8, cf8); dev_rev_class.u32 = inl(0xcfc); #endif @@ -721,7 +670,7 @@ unknown: #ifdef DEBUG header_type = (bus < (DEBUG - 1)) ? 0x01 : 0x00; #else - cf8 = make_cf8(bus, dev, func, 0x0c); + cf8 = pci_cf8(bus, dev, func, 0x0c); outl(0xcf8, cf8); header_type = inb(0xcfe); #endif @@ -732,7 +681,7 @@ unknown: #ifdef DEBUG new_bus = bus + 1; #else - cf8 = make_cf8(bus, dev, func, 0x18); + cf8 = pci_cf8(bus, dev, func, 0x18); outl(0xcf8, cf8); new_bus = inb(0xcfd); #endif @@ -803,7 +752,7 @@ read_reg(uint8_t bus, uint8_t dev, uint8_t func, uint8_t reg) bus, dev, func, reg | 3, reg & 0xfc); /* Read dword value from register. */ - cf8 = make_cf8(bus, dev, func, reg); + cf8 = pci_cf8(bus, dev, func, reg); #ifdef DEBUG reg_val.u32 = cf8; #else @@ -916,7 +865,7 @@ retry_buf: if (entries > 0) { /* Assume device 00 is the northbridge if it has a host bridge class. */ if (entry->dev > 0x00) { - cf8 = make_cf8(0x00, 0x00, 0, 0x08); + cf8 = pci_cf8(0x00, 0x00, 0, 0x08); outl(0xcf8, cf8); dev_class = inw(0xcfe); if (dev_class == 0x0600) @@ -924,7 +873,7 @@ retry_buf: } /* Assume device 01 is the AGP bridge if it has a PCI bridge class. */ if (entry->dev > 0x01) { - cf8 = make_cf8(0x00, 0x01, 0, 0x08); + cf8 = pci_cf8(0x00, 0x01, 0, 0x08); outl(0xcf8, cf8); dev_class = inw(0xcfe); if (dev_class == 0x0604) @@ -1000,7 +949,7 @@ retry_buf: printf("NORTHBRIDGE,"); } else { /* Read device class. */ - cf8 = make_cf8(0x00, entry->dev, 0, 0x08); + cf8 = pci_cf8(0x00, entry->dev, 0, 0x08); outl(0xcf8, cf8); dev_class = inw(0xcfe); @@ -1081,7 +1030,7 @@ write_reg(uint8_t bus, uint8_t dev, uint8_t func, uint8_t reg, char *val) multi_t reg_val; /* Write a byte, word or dword depending on the input value's length. */ - cf8 = make_cf8(bus, dev, func, reg); + cf8 = pci_cf8(bus, dev, func, reg); data_port = 0xcfc; switch (strlen(val)) { case 1: