summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert de Bath <rdebath@poboxes.com>2012-08-13 22:10:14 +0200
committerLubomir Rintel <lkundrak@v3.sk>2013-10-23 23:48:50 +0200
commit5b6aee2a90b337856aa23fd24a4637f488929ed0 (patch)
tree10d49ef991ff9fa563f71a9fd022614ddeea5fe6
parentdddc44a59e3e393d5440a06e2b0535aeb1304f77 (diff)
downloaddev86-5b6aee2a90b337856aa23fd24a4637f488929ed0.tar.gz
Import Dev86src-0.16.19.tar.gzv0.16.19
-rw-r--r--GNUmakefile4
-rw-r--r--Makefile4
-rw-r--r--ar/ar.c18
-rw-r--r--as/errors.h5
-rw-r--r--as/mops.c1
-rw-r--r--bcc/bcc.c14
-rw-r--r--bcc/express.c8
-rw-r--r--bcc/scan.c12
-rw-r--r--bootblocks/makeboot.c42
-rw-r--r--bootblocks/mbr.s16
-rw-r--r--bootblocks/sysmbrtail.s2
-rw-r--r--cpp/cpp.c6
-rw-r--r--ld/catimage.c23
-rw-r--r--ld/dumps.c1
-rw-r--r--ld/mkar.c1
-rw-r--r--ld/objchop.c4
-rw-r--r--ld/type.h3
-rw-r--r--ld/x86_aout.h7
-rw-r--r--makefile.in11
19 files changed, 121 insertions, 61 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 1e8bbb9..eaac816 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -3,10 +3,10 @@
#
all: phony
- @$(MAKE) -f Makefile IFDEFFLAGS=-DGNUMAKE IFDEFNAME=ifdefg $@
+ @$(MAKE) $(MAKEARG) -f Makefile IFDEFFLAGS=-DGNUMAKE IFDEFNAME=ifdefg $@
%: phony
- @$(MAKE) -f Makefile IFDEFFLAGS=-DGNUMAKE IFDEFNAME=ifdefg $@
+ @$(MAKE) $(MAKEARG) -f Makefile IFDEFFLAGS=-DGNUMAKE IFDEFNAME=ifdefg $@
phony: ;
diff --git a/Makefile b/Makefile
index 5e53dc8..2dcbb2d 100644
--- a/Makefile
+++ b/Makefile
@@ -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.18
+VERSION=0.16.19
TARGETS=install clean other \
bcc86 unproto copt as86 ld86 elksemu \
@@ -38,7 +38,7 @@ realclean:
-rm -f make.fil ifdef ifdefg
make.fil: $(IFDEFNAME) makefile.in
- ./$(IFDEFNAME) -MU makefile.in >tmp.mak
+ ./$(IFDEFNAME) -MU $(IFDEFOPTS) makefile.in >tmp.mak
echo > tmp.sed
[ "$(BINDIR)" != "//bin" ] || echo >> tmp.sed "s:%BINDIR%:/bin:"
[ "$(LIBDIR)" != "//lib/bcc" ] || echo >> tmp.sed "s:%LIBDIR%:/lib:"
diff --git a/ar/ar.c b/ar/ar.c
index 8443fd9..4e5cb0a 100644
--- a/ar/ar.c
+++ b/ar/ar.c
@@ -1087,12 +1087,12 @@ header_from_map (header, mapelt)
#if defined(USG) || defined(HAVE_TRAILING_SLASH_IN_NAME)
{
/* System V tacks a trailing '/' onto the end of the name */
- char *p = header->ar_name;
- char *end = p + sizeof (header->ar_name);
+ char *np = header->ar_name;
+ char *end = np + sizeof (header->ar_name);
- while (p < end && *p)
- p++;
- *p = '/';
+ while (np < end && *np)
+ np++;
+ *np = '/';
}
#endif
@@ -1106,10 +1106,10 @@ header_from_map (header, mapelt)
/* Change all remaining nulls in the header into spaces. */
{
char *end = (char *) &header[1];
- register char *p;
- for (p = (char *) header; p < end; ++p)
- if (*p == '\0')
- *p = ' ';
+ register char *np;
+ for (np = (char *) header; np < end; ++np)
+ if (*np == '\0')
+ *np = ' ';
}
}
diff --git a/as/errors.h b/as/errors.h
index ad1b57f..ac26b6d 100644
--- a/as/errors.h
+++ b/as/errors.h
@@ -1,3 +1,6 @@
+
+#ifndef _H_ERRORS
+#define _H_ERRORS
/* Error codes. */
/* Syntax errors. */
@@ -103,3 +106,5 @@ EXTERN char UNSTABLE_LABEL[]; /* "label moved in last pass add -O?" */
/* Warnings. */
EXTERN char CPUCLASH[]; /* "instruction illegal for current cpu" */
EXTERN char SHORTB[]; /* "short branch would do" */
+
+#endif
diff --git a/as/mops.c b/as/mops.c
index d18510d..e6dc9b1 100644
--- a/as/mops.c
+++ b/as/mops.c
@@ -2172,6 +2172,7 @@ PUBLIC void mpushpop()
}
else
{
+ needcpu(1); /* On 8086 PUSH does not allow immediate */
opcode = 0x68;
if (oldopcode == POP_OPCODE)
++opcode;
diff --git a/bcc/bcc.c b/bcc/bcc.c
index 9e5269f..574752c 100644
--- a/bcc/bcc.c
+++ b/bcc/bcc.c
@@ -17,6 +17,7 @@
*/
#include <stdio.h>
#ifdef __STDC__
+#include <limits.h>
#include <stdlib.h>
#ifndef MSDOS
#include <unistd.h>
@@ -129,7 +130,7 @@ char * tmpdir = "/tmp/";
#endif
int main P((int argc, char **argv));
-void getargs P((int argc, char **argv));
+
void add_prefix P((char * path));
void build_prefix P((char * path1, char * path2, char * path3));
void run_aspreproc P((struct file_list * file));
@@ -145,6 +146,7 @@ void command_arch P((void));
void command_opts P((int opykey));
void newfilename P((struct file_list * file, int last_stage, int new_extn, int use_o));
void run_unlink P((void));
+void validate_link_opt P((char * option));
void validate_link_opts P((void));
void append_file P((char * filename, int ftype));
void append_option P((char * option, int otype));
@@ -157,6 +159,7 @@ char * copystr P((char * str));
char * catstr P((char * str, char * str2));
void reset_prefix_path P((void));
void run_command P((struct file_list * file));
+void getargs P((int argc, char ** argv));
char * prefix_path = "";
@@ -528,7 +531,8 @@ run_link()
}
void
-validate_link_opt(char * option)
+validate_link_opt(option)
+char * option;
{
int err = 0;
if (option[0] != '-') return;
@@ -1308,11 +1312,17 @@ void reset_prefix_path()
for(d=s=ptr; d && *s; s=d)
{
+#ifndef __BCC__
+#ifdef PATH_MAX
+ char buf[PATH_MAX];
+#else
#ifdef MAXPATHLEN
char buf[MAXPATHLEN];
#else
char buf[1024];
#endif
+#endif
+#endif
free(temp);
d=strchr(s, ':');
diff --git a/bcc/express.c b/bcc/express.c
index 66298d3..9533d91 100644
--- a/bcc/express.c
+++ b/bcc/express.c
@@ -20,7 +20,7 @@ PRIVATE unsigned insizeof; /* nest level for getsizeof */
/* on p49 of K & R */
FORWARD struct nodestruct *cast_exp P((void));
-FORWARD struct nodestruct *exp2 P((void));
+FORWARD struct nodestruct *expr2 P((void));
FORWARD struct nodestruct *exp3to12 P((fastin_pt lprecedence));
FORWARD struct nodestruct *listargs P((void));
FORWARD struct nodestruct *postfix_exp P((bool_pt seenlp));
@@ -54,7 +54,7 @@ PUBLIC struct nodestruct *assignment_exp()
struct nodestruct *lhs;
op_pt op;
- lhs = exp2();
+ lhs = expr2();
if (sym >= ASSIGNOP && sym <= SUBABOP) /* assign-op syms in order! */
{
op = sym;
@@ -77,7 +77,7 @@ PUBLIC struct nodestruct *expression()
return lhs;
}
-PRIVATE struct nodestruct *exp2()
+PRIVATE struct nodestruct *expr2()
{
struct nodestruct *lhs;
struct nodestruct *rhs;
@@ -88,7 +88,7 @@ PRIVATE struct nodestruct *exp2()
nextsym();
rhs = expression();
colon();
- lhs = node(CONDOP, lhs, node(COLONOP, rhs, exp2()));
+ lhs = node(CONDOP, lhs, node(COLONOP, rhs, expr2()));
}
return lhs;
}
diff --git a/bcc/scan.c b/bcc/scan.c
index 7db7629..17f22f5 100644
--- a/bcc/scan.c
+++ b/bcc/scan.c
@@ -149,27 +149,27 @@ int asm_only;
#endif
while (!asm_only || asmmode)
{
- int sym = SYMOFCHAR(ch);
+ int cppsym = SYMOFCHAR(ch);
- switch (sym)
+ switch (cppsym)
{
case CONTROL:
- if( !start_of_line ) sym=BADCHAR;
+ if( !start_of_line ) cppsym=BADCHAR;
break;
case WHITESPACE:
break;
case SPECIALCHAR:
- if( ch == '\\' ) sym=BADCHAR;
+ if( ch == '\\' ) cppsym=BADCHAR;
start_of_line = 1;
break;
case CHARCONST:
case STRINGCONST:
- if( asmmode ) sym=BADCHAR;
+ if( asmmode ) cppsym=BADCHAR;
default:
start_of_line = 0;
}
- switch (sym)
+ switch (cppsym)
{
case CHARCONST:
case STRINGCONST:
diff --git a/bootblocks/makeboot.c b/bootblocks/makeboot.c
index 9ee0c44..4b55068 100644
--- a/bootblocks/makeboot.c
+++ b/bootblocks/makeboot.c
@@ -18,6 +18,7 @@
#include "minix.v"
#include "minixhd.v"
#include "mbr.v"
+#include "mbr_dm.v"
#include "mbr_chs.v"
#include "mbr_lin.v"
#include "mbr_lba.v"
@@ -114,7 +115,7 @@ struct bblist {
#endif
{ "pbr", "LBA-Only Partition boot record",
- pbr_data,pbr_size, 0, 0, FS_MBR},
+ pbr_data,pbr_size, 0, 0, FS_ADOS},
{ "mbrchs","MBR using CHS addressing and BIOS",
mbr_chs_data,mbr_chs_size, 0, 0, FS_MBR},
{ "mbrlin","MBR using Linear addressing and CHS BIOS",
@@ -125,6 +126,10 @@ struct bblist {
nombr_data,nombr_size,
2, nombr_message-nombr_start, FS_MBR},
+#ifdef mbr_dm_size
+{ "mbrdm", "DM Master boot record for HD",
+ mbr_dm_data,mbr_dm_size, 0, 0, FS_MBR},
+#endif
{ "minix","Minix floppy FS booter",
minix_data, minix_size,
@@ -300,7 +305,7 @@ char ** argv;
break;
case FS_MBR:
- copy_mbr(ptr->data);
+ copy_mbr(ptr->data, ptr->size);
break;
case FS_ZERO:
@@ -871,6 +876,11 @@ copy_tarblock()
#define DOS7_INFO_SECT 22
#define DOS7_BOOT2 23
+#define DOS7_PHY_DRIVE 24
+#define DOS7_SERIAL 25
+#define DOS7_LABEL 26
+#define DOS7_FATTYPE 27
+
struct bootfields {
char * label;
int offset;
@@ -985,7 +995,10 @@ static char * fieldnames[] = {
(i==DOS_FATLEN || i==DOS_MAXSECT || i==DOS4_MAXSECT || i==DOS_NROOT))
continue;
- printf("%-35s%ld\n", fieldnames[i], v);
+ if ( i==DOS7_SERIAL )
+ printf("%-35s%08x\n", fieldnames[i], v);
+ else
+ printf("%-35s%ld\n", fieldnames[i], v);
if (i==DOS_SECT && v!=512 && v!=1024 && v!=2048)
break;
@@ -1244,7 +1257,7 @@ int boot_name;
if( strlen(boot_id) > i )
{
- fprintf(stderr, "Name '%s' is too long for bootblock\n");
+ fprintf(stderr, "Name '%s' is too long for bootblock\n", boot_name);
exit(1);
}
else
@@ -1306,17 +1319,22 @@ check_mbr()
}
}
-copy_mbr(mbr_data)
-char * mbr_data;
+copy_mbr(boot_data, boot_size)
+char * boot_data;
+int boot_size;
{
- if( buffer[252] != 0xAA || buffer[253] != 0x55 ||
- (unsigned char)mbr_data[252] != 0xAA || mbr_data[253] != 0x55 )
- memcpy(buffer, mbr_data, 446);
- else
- memcpy(buffer, mbr_data, 254);
+ int boot_to_copy = 446;
+ if (boot_size < boot_to_copy)
+ boot_to_copy = boot_size;
+
+ if ( boot_to_copy > 254 &&
+ buffer[252] == 0xAA && buffer[253] == 0x55 &&
+ (unsigned char)boot_data[252] == 0xAA && boot_data[253] == 0x55 )
+ boot_to_copy = 254;
+
+ memcpy(buffer, boot_data, boot_to_copy);
buffer[510] = 0x55;
buffer[511] = 0xAA;
write_zero = 1;
}
-
diff --git a/bootblocks/mbr.s b/bootblocks/mbr.s
index fb3ac50..25f29fe 100644
--- a/bootblocks/mbr.s
+++ b/bootblocks/mbr.s
@@ -574,21 +574,23 @@ export boot_part
endif
endif
- org mbr_extras ! Dirty bit, Serial number
- .word 0
-serial_no:
- .blkb 4
-
!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
! Clear the sector to the bottom of the partition table.
if markptab
- if *<partition_start
- org partition_start-1
+ if *<mbr_extras
+ org mbr_extras-1
.byte 0
endif
endif
+ org mbr_extras ! Dirty bit, Serial number
+ .blkb 2
+serial_no:
+ .blkb 4
+
if use512
+ org ORGADDR+0x1BC
+ .word 0xAA55
org ORGADDR+0x1FE
.word 0xAA55
endif
diff --git a/bootblocks/sysmbrtail.s b/bootblocks/sysmbrtail.s
index 1b37022..c16ef54 100644
--- a/bootblocks/sysmbrtail.s
+++ b/bootblocks/sysmbrtail.s
@@ -9,5 +9,5 @@ end_of_code:
! Clear the sector to the bottom of the partition table.
if *<table_start-1
org table_start-1
- .byte 0xFF
+ .byte 0
endif
diff --git a/cpp/cpp.c b/cpp/cpp.c
index 616cf87..9ac04f3 100644
--- a/cpp/cpp.c
+++ b/cpp/cpp.c
@@ -431,19 +431,19 @@ break_break:
/* Possible composite tokens */
if( ch > ' ' && ch <= '~' )
{
- struct token_trans *p;
+ struct token_trans *tt;
*curword = cc = ch;
for(state=1; ; state++)
{
curword[state] = ch = chget();
- if( !(p=is_ctok(curword, state+1)) )
+ if( !(tt=is_ctok(curword, state+1)) )
{
unchget(ch);
curword[state] = '\0';
return cc;
}
- cc=p->token;
+ cc=tt->token;
}
}
return ch;
diff --git a/ld/catimage.c b/ld/catimage.c
index 7d5c7a0..1f5e160 100644
--- a/ld/catimage.c
+++ b/ld/catimage.c
@@ -21,6 +21,10 @@
*/
#include <stdio.h>
+#ifdef __STDC__
+#include <unistd.h>
+#include <stdlib.h>
+#endif
#include "x86_aout.h"
#ifndef __OUT_OK
@@ -144,18 +148,19 @@ long file_off;
int value;
{
char wbuf[4];
- if( file_off <= 0 ) return;
-
- printf("Patch at offset 0x%05lx = %04x\n", file_off, value);
+ if( file_off > 0 )
+ {
+ printf("Patch at offset 0x%05lx = %04x\n", file_off, value);
- wbuf[0] = value;
- wbuf[0] = (value>>8);
+ wbuf[0] = value;
+ wbuf[0] = (value>>8);
- if( fseek(ofd, file_off, 0) < 0 )
- fatal("Cannot seek to patch binary");
+ if( fseek(ofd, file_off, 0) < 0 )
+ fatal("Cannot seek to patch binary");
- if( fwrite(wbuf, 1, 2, ofd) != 2 )
- fatal("Error patching output file");
+ if( fwrite(wbuf, 1, 2, ofd) != 2 )
+ fatal("Error patching output file");
+ }
}
read_symtable()
diff --git a/ld/dumps.c b/ld/dumps.c
index 4732017..10879b7 100644
--- a/ld/dumps.c
+++ b/ld/dumps.c
@@ -2,6 +2,7 @@
/* Copyright (C) 1994 Bruce Evans */
+#include "syshead.h"
#include "const.h"
#include "obj.h"
#include "type.h"
diff --git a/ld/mkar.c b/ld/mkar.c
index 8c4eb5b..da91456 100644
--- a/ld/mkar.c
+++ b/ld/mkar.c
@@ -10,6 +10,7 @@
#include <malloc.h>
#endif
+#include "type.h"
#include "ar.h"
static struct ar_hdr arbuf;
diff --git a/ld/objchop.c b/ld/objchop.c
index 8defc13..c7631c1 100644
--- a/ld/objchop.c
+++ b/ld/objchop.c
@@ -1,5 +1,9 @@
#include <stdio.h>
+#ifdef __STDC__
+#include <unistd.h>
+#include <stdlib.h>
+#endif
#include "x86_aout.h"
#ifndef __OUT_OK
diff --git a/ld/type.h b/ld/type.h
index 950446f..5301b6f 100644
--- a/ld/type.h
+++ b/ld/type.h
@@ -171,3 +171,6 @@ void write_elks P((char *outfilename, bool_pt argsepid, bool_pt argbits32,
/* linksym.c */
void linksyms P((bool_pt argreloc_output));
+
+/* mkar.c */
+void ld86r P((int argc, char ** argv));
diff --git a/ld/x86_aout.h b/ld/x86_aout.h
index 45bf0c7..542a70d 100644
--- a/ld/x86_aout.h
+++ b/ld/x86_aout.h
@@ -13,8 +13,15 @@
typedef long Long;
#define __OUT_OK 1
#else
+/* Beware: this will probably allow some BE hosts to generate broken files. */
+#ifdef INT32_MAX
+#include <stdint.h>
+typedef int32_t Long;
+#define __OUT_OK 1
+#else
typedef char Long[4];
#endif
+#endif
struct exec { /* a.out header */
unsigned char a_magic[2]; /* magic number */
diff --git a/makefile.in b/makefile.in
index afedd16..48698b3 100644
--- a/makefile.in
+++ b/makefile.in
@@ -34,15 +34,18 @@ AR=ar86
#ifdef __GNUC__
-WALL =-Wall -Wtraditional -Wshadow -Wid-clash-14 -Wpointer-arith \
+CC =%CC%
+#ifdef GCCDB
+WALL =-Wall -Wtraditional -Wshadow -Wpointer-arith \
-Wcast-qual -Wcast-align -Wconversion -Waggregate-return \
-Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls \
-Wnested-externs -Winline
-
+CFLAGS =$(GCCFLAG) $(WALL) -O2 -g
+#else
WALL =-Wall -Wstrict-prototypes
+CFLAGS =$(GCCFLAG) -O2 -fno-strict-aliasing
+#endif
-CC =%CC%
-CFLAGS =$(GCCFLAG) $(WALL) -O2 -g
#endif
#ifndef GNUMAKE