summaryrefslogtreecommitdiffstats
path: root/contrib/rom-scan
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/rom-scan')
-rw-r--r--contrib/rom-scan/Makefile64
-rw-r--r--contrib/rom-scan/rom-scan.c115
2 files changed, 0 insertions, 179 deletions
diff --git a/contrib/rom-scan/Makefile b/contrib/rom-scan/Makefile
deleted file mode 100644
index 637404ad..00000000
--- a/contrib/rom-scan/Makefile
+++ /dev/null
@@ -1,64 +0,0 @@
-CPPFLAGS =
-LDLIBS =
-CFLAGS = -pipe -g -O2 -Wall
-LDFLAGS = -pipe
-CC = gcc
-LD = gcc
-# Some "black" magic to determine optimal compiler flags for target
-# architecture
-TARGET_ARCH:= $(shell if [ \! -r .compile-options ] ; then ( \
- cpu=`grep cpu /proc/cpuinfo 2>&1 |head -1| \
- cut -d : -f 2-| sed -e 's/ //g'`; \
- if [ x"$$cpu" = x"" ] ; then \
- echo -fno-strength-reduce; \
- else if [ "$$cpu" = "386" ] ; then \
- echo -m386 -fno-strength-reduce; \
- else if [ "$$cpu" = "486" ] ; then \
- echo -m486 -fno-strength-reduce; \
- else if [ "$$cpu" = "Alpha" ] ; then \
- echo -fno-strength-reduce; \
- else echo main\(\)\{\} >.compile-options.c; \
- if gcc -mpentium -o .compile-options.o -c \
- .compile-options.c &>/dev/null; then \
- echo -mpentium -fstrength-reduce; \
- else if gcc -m486 -malign-functions=2 -malign-jumps=2 \
- -malign-loops=2 -o .compile-options.o -c \
- .compile-options.c &>/dev/null; then \
- echo -n -m486 -malign-functions=2 -malign-jumps=2; \
- echo ' '-malign-loops=2 -fno-strength-reduce; \
- else echo -m486; \
- fi;fi;fi;fi;fi;fi) > .compile-options; \
- rm -f .compile-options.c .compile-options.o; \
- fi; cat .compile-options)
-ASFLAGS = $(TARGET_ARCH)
-
-OBJS = rom-scan.o
-
-##############################################################################
-
-ifeq (.depend,$(wildcard .depend))
-all: rom-scan
-include .depend
-else
-all: depend
- @$(MAKE) all
-endif
-
-##############################################################################
-
-rom-scan: $(OBJS)
-
-##############################################################################
-
-clean:
- $(RM) *~ *.o *.dvi *.log *.aux *yacc.tab.[ch] *yacc.output *lex.[co] \
- *.dat .depend .tmp_depend .compile-options*
- strip rom-scan >&/dev/null || true
-
-##############################################################################
-
-depend:
- for i in *.c;do $(CPP) $(CPPFLAGS) -MM $$i;done >.tmp_depend
- mv .tmp_depend .depend
-
-
diff --git a/contrib/rom-scan/rom-scan.c b/contrib/rom-scan/rom-scan.c
deleted file mode 100644
index c5e48299..00000000
--- a/contrib/rom-scan/rom-scan.c
+++ /dev/null
@@ -1,115 +0,0 @@
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#ifndef __TURBOC__
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-#endif
-
-#ifdef __TURBOC__
-#define HUGE huge
-#else
-#define HUGE
-#endif
-
-#define ROMSTART 0xC8000
-#define ROMEND 0xE8000
-#define ROMINCREMENT 0x00800
-#define ROMMASK 0x03FFF
-
-#ifndef MAP_FAILED
-#define MAP_FAILED ((void *)(long long)-1)
-#endif
-
-typedef struct Images {
- struct Images *next;
- long start;
- long size;
-} Images;
-
-static void rom_scan(const unsigned char HUGE *rom,long offset,long len)
-{
- static Images *images = NULL;
- Images *ptr;
-/* The assignments to dummy are to overcome a bug in TurboC */
- long dummy, size;
- int chksum;
- long i;
-
- if (rom[offset] != 0x55 || rom[dummy = offset+1] != 0xAA)
- return;
- size = (long)rom[dummy = offset+2]*512L;
- printf("Found ROM header at %04lX:0000; "
- "announces %ldk image (27C%02d EPROM)\n",
- offset/16,(size+512)/1024,
- size <= 1024 ? 8 :
- size <= 2048 ? 16 :
- size <= 4096 ? 32 :
- size <= 8192 ? 64 :
- size <= 16384 ? 128 :
- size <= 32768 ? 256 :
- size <= 65536 ? 512 : 11);
- if (offset & ROMMASK)
- printf(" This is a unusual position; not all BIOSs might find it.\n"
- " Try to move to a 16kB boundary.\n");
- if (size > len) {
- printf(" This image extends beyond %04X:0000. "
- "It clashes with the system BIOS\n",
- ROMEND/16);
- size = len; }
- for (chksum=0, i = size; i--; chksum += rom[dummy = offset+i]);
- if (chksum % 256)
- printf(" Checksum does not match. This image is not active\n");
- ptr = malloc(sizeof(Images));
- ptr->next = images;
- ptr->start = offset;
- ptr->size = size;
- images = ptr;
- for (ptr = ptr->next; ptr != NULL; ptr = ptr->next) {
- for (i = 0; i < size && i < ptr->size; i++)
- if (rom[dummy = ptr->start+i] != rom[dummy = offset+i])
- break;
- if (i > 32) {
- printf(" Image is identical with image at %04lX:0000 "
- "for the first %ld bytes\n",
- ptr->start/16,i);
- if (i >= 1024)
- if (i == size)
- printf(" this means that you misconfigured the EPROM size!\n");
- else
- printf(" this could suggest that you misconfigured the "
- "EPROM size\n");
- else
- printf(" this is probably harmless. Just ignore it...\n"); } }
- return;
-}
-
-int main(void)
-{
- long i;
- unsigned char HUGE *rom;
-
-#ifndef __TURBOC__
- int fh;
- if ((fh = open("/dev/kmem",O_RDONLY|O_SYNC)) < 0) {
- fprintf(stderr,"Could not open \"/dev/kmem\": %s\n",0 );//strerror(errno));
- return(1); }
- if ((rom = mmap(NULL,ROMEND-ROMSTART,PROT_READ,MAP_SHARED,fh,
- ROMSTART)) == MAP_FAILED) {
- fprintf(stderr,"Could not mmap \"/dev/kmem\": %s\n",0); //strerror(errno));
- close(fh);
- return(1); }
- close(fh);
-#endif
- for (i = ROMEND; (i -= ROMINCREMENT) >= ROMSTART; )
-#ifdef __TURBOC__
- rom_scan(0,i,ROMEND-i);
-#else
- rom_scan(rom-ROMSTART,i,ROMEND-i);
- munmap(rom,ROMEND-ROMSTART);
-#endif
- return(0);
-}