diff -Nurd linux86.old/Changes linux86/Changes --- linux86.old/Changes Sat Jan 24 14:41:13 2004 +++ linux86/Changes Fri Jun 4 09:47:08 2004 @@ -1,5 +1,14 @@ For version 0.16.*. +> Starting to remove builtin cpp from bcc-cc1, beware. + +> Added __BCC_VERSION__ macro, defined by bcc.c contains hex version no. + +> Bugfix for offsets generated by #asm when using -O option to bcc-cc1. + Extra compile option ASM_USES_CALLEE_REGS. + +> Extra checking and bugfix for mixing char values with long shifts. + > WARNING to distributions: I've altered the install scripts and paths you will want to check them. Altered paths for bcc.c and normal installs, defaults should now be good for distributions where bcc is a diff -Nurd linux86.old/Makefile linux86/Makefile --- linux86.old/Makefile Sat Jan 24 12:12:14 2004 +++ linux86/Makefile Thu Jun 3 20:08:12 2004 @@ -2,7 +2,7 @@ # This file is part of the Linux-8086 Development environment and is # distributed under the GNU General Public License. -VERSION=0.16.15 +VERSION=0.16.16 TARGETS=install clean other \ bcc unproto copt as86 ld86 elksemu \ diff -Nurd linux86.old/as/as.c linux86/as/as.c --- linux86.old/as/as.c Fri Jan 2 21:49:35 2004 +++ linux86/as/as.c Thu Jun 3 19:50:21 2004 @@ -193,7 +193,11 @@ case 'v': outfd = STDOUT; writes("as86 version: "); +#ifdef VERSION writesn(VERSION); +#else + writesn("Unknown!"); +#endif exit(1); #ifdef I80386 case '0': case '1': case '2': diff -Nurd linux86.old/bcc/Makefile linux86/bcc/Makefile --- linux86.old/bcc/Makefile Sat Jan 24 12:27:21 2004 +++ linux86/bcc/Makefile Thu Jun 3 22:03:28 2004 @@ -16,7 +16,7 @@ OBJS = bcc-cc1.o codefrag.o debug.o declare.o express.o exptree.o floatop.o \ function.o gencode.o genloads.o glogcode.o hardop.o input.o label.o \ loadexp.o longop.o output.o preproc.o preserve.o scan.o softop.o \ - state.o table.o type.o assign.o + state.o table.o type.o assign.o hashcmd.o all: bcc-cc1 bcc diff -Nurd linux86.old/bcc/bcc.c linux86/bcc/bcc.c --- linux86.old/bcc/bcc.c Sat Jan 24 15:25:32 2004 +++ linux86/bcc/bcc.c Thu Jun 3 20:25:13 2004 @@ -1082,6 +1082,15 @@ if (opt_arch == 1) libdir_suffix = "/i386"; if (opt_arch == 4) libdir_suffix = "/m09"; + +#ifdef VERSION + { + char verbuf[64]; + sprintf(verbuf, "-D__BCC_VERSION__=0x%02x%02x%02xL", + VER_MAJ, VER_MIN, VER_PAT); + append_option(verbuf, 'p'); + } +#endif } void @@ -1222,8 +1231,10 @@ void Usage() { +#ifdef VERSION if (opt_v) fprintf(stderr, "%s: version %s\n", progname, VERSION); +#endif fprintf(stderr, "Usage: %s [-ansi] [-options] [-o output] file [files].\n", progname); exit(1); diff -Nurd linux86.old/bcc/codefrag.c linux86/bcc/codefrag.c --- linux86.old/bcc/codefrag.c Sat Aug 3 17:38:27 2002 +++ linux86/bcc/codefrag.c Thu Jun 3 08:25:10 2004 @@ -1619,6 +1619,18 @@ outstr(name); outset(); outshex(value); +#ifdef FRAMEPOINTER +#ifdef I8088 +#ifndef NO_DEL_PUSH + if (framep && optimise && !callersaves && value+sp-framep >= 0 + && !(regfuse & callee1mask)) { + outbyte('-'); + outstr(funcname); + outstr(".off"); + } +#endif +#endif +#endif outnl(); #ifdef FRAMEPOINTER if (framep) @@ -1629,6 +1641,16 @@ outstr(name); outset(); outshex(value+sp-framep); +#ifdef I8088 +#ifndef NO_DEL_PUSH + if (optimise && !callersaves && value+sp-framep < 0 + && !(regfuse & callee1mask)) { + outbyte('+'); + outstr(funcname); + outstr(".off"); + } +#endif +#endif outnl(); } #endif diff -Nurd linux86.old/bcc/const.h linux86/bcc/const.h --- linux86.old/bcc/const.h Fri Jan 2 21:49:35 2004 +++ linux86/bcc/const.h Thu Jun 3 06:46:13 2004 @@ -21,9 +21,8 @@ #define VERY_SMALL_MEMORY #endif -#define SELFTYPECHECK /* check calculated type = runtime type */ - #ifndef VERY_SMALL_MEMORY +#define SELFTYPECHECK /* check calculated type = runtime type */ #define DEBUG /* generate compiler-debugging code */ #define OPTIMISE /* include optimisation code */ #define BUILTIN_CPP diff -Nurd linux86.old/bcc/genloads.c linux86/bcc/genloads.c --- linux86.old/bcc/genloads.c Wed Dec 4 21:30:42 2002 +++ linux86/bcc/genloads.c Thu Jun 3 22:57:25 2004 @@ -584,7 +584,10 @@ if (strcmp (source->name.namep, "__AX") == 0) { /* Load AX register - do nothing. */ -done: source->storage = AXREG; /* in register for further use */ +done: + if (targreg != AXREG) + bugerror("specified access of register clone variable not implemented"); + source->storage = AXREG; /* in register for further use */ source->flags = 0; if (source->level == OFFKLUDGELEVEL) source->level = EXPRLEVEL; @@ -653,6 +656,12 @@ { if ((store_t) targreg & ALLDATREGS && source->type->scalar & CHAR) targreg = BREG; +#ifdef I8086 + if (source->type->scalar & CHAR && + targreg != BREG && targreg != DATREG1B ) { + bugerror("moving char sym into int register"); + } +#endif #ifdef I80386 if (i386_32 && source->type->scalar & SHORT && source->indcount <= 1) diff -Nurd linux86.old/bcc/hashcmd.c linux86/bcc/hashcmd.c --- linux86.old/bcc/hashcmd.c Thu Jan 1 01:00:00 1970 +++ linux86/bcc/hashcmd.c Thu Jun 3 22:20:26 2004 @@ -0,0 +1,23 @@ + +/* decode remaining preprocessor lines, minimal version. */ + +/* Copyright (C) GPL V2, derived from preproc.c by RDB. */ + +#include "bcc.h" +#include "input.h" +#include "os.h" +#include "output.h" +#include "parse.h" +#include "sc.h" +#include "scan.h" +#include "table.h" +#include "type.h" + +#ifndef BUILTIN_CPP +/* docontrol() - process control statement, #line and #asm only. */ + +PUBLIC void docontrol() +{ + bugerror("docontrol for tiny machines not implemented yet"); +} +#endif diff -Nurd linux86.old/bcc/longop.c linux86/bcc/longop.c --- linux86.old/bcc/longop.c Sun Jan 11 12:18:35 1998 +++ linux86/bcc/longop.c Thu Jun 3 20:43:51 2004 @@ -39,7 +39,8 @@ else scalar |= source->type->scalar; if ((source->indcount == 0 && !shiftflag) || - source->storage & (DREG | OPREG | OPWORKREG)) + source->type->scalar & CHAR || + source->storage & (BREG | DREG | OPREG | OPWORKREG)) { pres2(source, target); push(source); @@ -60,6 +61,16 @@ if (source->offset.offv == 0) goto shiftdone; } +#ifdef I8088 + /* This is ugly! But it works. I should be able to stop it being used + * by removing the char demotion. */ + if (source->type->scalar & CHAR && + !(source->storage & (BREG|DREG|DATREG1B))) { + load(source, DATREG1B); + outop2str("xor\tch,ch"); outnl(); + source->storage = DATREG1; + } +#endif load(source, OPWORKREG); switch ((op_t) op) { diff -Nurd linux86.old/bcc/softop.c linux86/bcc/softop.c --- linux86.old/bcc/softop.c Fri Feb 6 20:20:14 1998 +++ linux86/bcc/softop.c Wed Jun 2 12:44:45 2004 @@ -219,7 +219,16 @@ { case DIVOP: #ifdef I8088 - call("idiv_"); + if (uflag) + call("idiv_"); + else { + if (i386_32) + outnop1str("cdq"); + else + outnop1str("cwd"); + outop2str("idiv\t"); + outregname(INDREG0); + } #else call("idiv"); #endif diff -Nurd linux86.old/bcc/table.c linux86/bcc/table.c --- linux86.old/bcc/table.c Sun Jul 28 08:43:13 2002 +++ linux86/bcc/table.c Thu Jun 3 20:47:03 2004 @@ -400,6 +400,13 @@ register struct symstruct *symptr; int i; +#ifdef ASM_USES_CALLEE_REGS + if (framep && optimise && !callersaves) { + regfuse |= callee1mask; + outnstr("! Assuming #asm uses all callee saves registers"); + } +#endif + for (i = 0; i < HASHTABSIZE; ++i) for (symptr = hashtab[i]; symptr != NULL; symptr = symptr->next) if (symptr->storage == LOCAL) diff -Nurd linux86.old/ld/io.c linux86/ld/io.c --- linux86.old/ld/io.c Mon Oct 6 17:27:43 2003 +++ linux86/ld/io.c Thu Jun 3 19:51:34 2004 @@ -626,8 +626,12 @@ PUBLIC void version_msg() { stderr_out(); +#ifdef VERSION putstr("ld86 version: "); errexit(VERSION); +#else + errexit("ld86 version unknown"); +#endif } PUBLIC void use_error(message) diff -Nurd linux86.old/makefile.in linux86/makefile.in --- linux86.old/makefile.in Sat Jan 24 14:50:11 2004 +++ linux86/makefile.in Thu Jun 3 20:19:57 2004 @@ -150,6 +150,11 @@ bcc: bindir echo '#define VERSION "'"$(VERSION)"'"' > bcc/version.h + VER=$(VERSION) ; \ + echo "#define VER_MAJ $${VER%%.*}" >> bcc/version.h ; \ + VER="$${VER#*.}" ; \ + echo "#define VER_MIN $${VER%.*}" >> bcc/version.h ; \ + echo "#define VER_PAT $${VER#*.}" >> bcc/version.h $(MAKEC) bcc $(MAKEARG) BCCARCH='$(BCCARCH)' bcc ncc bcc-cc1 cp -p bcc/bcc$(EXE) bin/Bcc$(EXE) cp -p bcc/ncc$(EXE) bin/ncc$(EXE) diff -Nurd linux86.old/tests/ft.c linux86/tests/ft.c --- linux86.old/tests/ft.c Sat Jan 24 15:01:12 2004 +++ linux86/tests/ft.c Sun Jan 25 08:51:22 2004 @@ -722,13 +722,15 @@ if( (cur_file_stat.st_mode&07777) != (last_mode&07777) ) printf(":%03o", cur_file_stat.st_mode & 07777); - major = (cur_file_stat.st_rdev >> 8); - minor = (cur_file_stat.st_rdev&0xFF); #ifdef __linux__ - major &= 0xFFF; - minor |= ((cur_file_stat.st_rdev&0xFF000000)>>12); + major = ((cur_file_stat.st_rdev >> 8) & 0xfff); + if (sizeof(cur_file_stat.st_rdev) > 4) + major |= ((cur_file_stat.st_rdev >> 32) & ~0xfff); + minor = (cur_file_stat.st_rdev & 0xff) | + ((cur_file_stat.st_rdev >> 12) & ~0xff); #else - major &= 0xFF; + major = ((cur_file_stat.st_rdev >> 8) & 0xFF); + minor = (cur_file_stat.st_rdev&0xFF); #endif switch(cur_file_stat.st_mode & S_IFMT) { diff -Nurd linux86.old/bootblocks/boot_win.c linux86/bootblocks/boot_win.c --- linux86.old/bootblocks/boot_win.c Mon Jan 19 17:00:23 2004 +++ linux86/bootblocks/boot_win.c Wed Apr 28 14:41:01 2004 @@ -49,6 +49,13 @@ if (rv != 0 || bs_buf[510] != 0x55 || bs_buf[511] != (char)0xAA) { cprintf("Hard disk not bootable.\n"); floppy_only = 1; + + /* Check for zapped MBR */ + for(i=0; i<512; i++) { + if (bs_buf[i]) break; + if (i==511) + boot_floppy(); + } } if (!floppy_only) {