SourceForge logo
SourceForge logo
Menu

linux-vax-usr-commit — Notifications of CVS commits to userland stuff (glibc, uClibc, etc)

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
(17)
Dec
2004 Jan
(9)
Feb
(17)
Mar
(13)
Apr
May
Jun
Jul
(3)
Aug
Sep
(2)
Oct
(7)
Nov
Dec
2005 Jan
Feb
Mar
(6)
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2007 Jan
Feb
Mar
Apr
May
Jun
(1)
Jul
Aug
Sep
Oct
Nov
Dec

Showing results of 75

1 2 3 > >> (Page 1 of 3)
Update of /cvsroot/linux-vax/usr/visualize_asm
In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv9395
Modified Files:
	Makefile address.c address.h graphic.c graphic.h graphic_dot.c 
	parse.h parse_backend.c parse_disassembly.c parse_i386.c 
	parse_vax.c regexp_helper.c regexp_helper.h 
Log Message:
* Touch-ups all over the place.
* Specifically fix a use-after-free bug in regexp_helper.c
Index: graphic_dot.c
===================================================================
RCS file: /cvsroot/linux-vax/usr/visualize_asm/graphic_dot.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- graphic_dot.c	14 Mar 2005 08:54:37 -0000	1.2
+++ graphic_dot.c	5 Jun 2007 22:09:06 -0000	1.3
@@ -10,8 +10,8 @@
 
 #define CLUSTER "cluster: "
 
-static unsigned char *
-alloc_sprintf_valist (unsigned char *format, va_list args)
+static char *
+alloc_sprintf_valist (char *format, va_list args)
 {
 	char buf[1];
 	char *real_buf;
@@ -28,9 +28,9 @@
 }
 
 static int
-dot_set_last_anchor (unsigned char *format, ...)
+dot_set_last_anchor (char *format, ...)
 {
-	unsigned char *buf;
+	char *buf;
 	va_list args;
 
 	if (!format) {
@@ -56,10 +56,10 @@
 		return -1;
 }
 
-static unsigned char *
+static char *
 dot_section_name (void)
 {
-	unsigned char *section_name;
+	char *section_name;
 
 	section_name = get_section_name ();
 	if (!section_name)
@@ -103,7 +103,7 @@
 }
 
 static int
-dot_start_output (unsigned char *filename)
+dot_start_output (char *filename)
 {
 	/* XXX escape filename */
 	printf ("digraph \"%s\" {\n", filename);
@@ -123,7 +123,7 @@
 }
 
 static int
-dot_start_section (unsigned char *name)
+dot_start_section (char *name)
 {
 	dot_close_section_block ();
 
@@ -136,7 +136,7 @@
 }
 
 static int
-dot_start_function (unsigned char *name, uint64_t address)
+dot_start_function (char *name, uint64_t address)
 {
 	dot_close_function_block ();
 
@@ -150,7 +150,7 @@
 }
 
 static int
-dot_push_normal_code (unsigned char *code, uint64_t address)
+dot_push_normal_code (char *code, uint64_t address)
 {
 	if (last_anchor)
 		printf ("\t\t\t\"%s\" -> \"%s:0x%016llx\";\n", last_anchor,
@@ -163,7 +163,7 @@
 }
 
 static int
-dot_push_jump (unsigned char *code, uint64_t address, uint64_t jump_address)
+dot_push_jump (char *code, uint64_t address, uint64_t jump_address)
 {
 	dot_close_code_block ();
 
@@ -184,7 +184,7 @@
 }
 
 static int
-dot_push_cond_jump (unsigned char *code, uint64_t address, uint64_t jump_address)
+dot_push_cond_jump (char *code, uint64_t address, uint64_t jump_address)
 {
 	dot_close_code_block ();
 
@@ -205,7 +205,7 @@
 }
 
 static int
-dot_push_ret (unsigned char *code, uint64_t address)
+dot_push_ret (char *code, uint64_t address)
 {
 	if (last_anchor)
 		printf ("\t\t\t\"%s\" -> \"%s:0x%016llx\";\n", last_anchor,
@@ -227,4 +227,3 @@
 	.push_cond_jump = &dot_push_cond_jump,
 	.push_ret = &dot_push_ret,
 };
-
Index: graphic.h
===================================================================
RCS file: /cvsroot/linux-vax/usr/visualize_asm/graphic.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- graphic.h	14 Mar 2005 08:54:37 -0000	1.2
+++ graphic.h	5 Jun 2007 22:09:06 -0000	1.3
@@ -4,27 +4,27 @@
 #include <stdint.h>
 
 struct graphic_implementation {
-	int (*start_output) (unsigned char *filename);
+	int (*start_output) (char *filename);
 	int (*finish_output) (void);
 
-	int (*start_section) (unsigned char *name);
-	int (*start_function) (unsigned char *name, uint64_t address);
-	int (*push_normal_code) (unsigned char *code, uint64_t address);
-	int (*push_jump) (unsigned char *code, uint64_t address, uint64_t jump_address);
-	int (*push_cond_jump) (unsigned char *code, uint64_t address, uint64_t jump_address);
-	int (*push_ret) (unsigned char *code, uint64_t address);
+	int (*start_section) (char *name);
+	int (*start_function) (char *name, uint64_t address);
+	int (*push_normal_code) (char *code, uint64_t address);
+	int (*push_jump) (char *code, uint64_t address, uint64_t jump_address);
+	int (*push_cond_jump) (char *code, uint64_t address, uint64_t jump_address);
+	int (*push_ret) (char *code, uint64_t address);
 };
 
-extern int graphic_init (unsigned char *name);
-extern int graphic_start_output (unsigned char *filename);
+extern int graphic_init (char *name);
+extern int graphic_start_output (char *filename);
 extern int graphic_finish_output (void);
-extern int graphic_start_section (unsigned char *name);
-extern int graphic_start_function (unsigned char *name, uint64_t address);
-extern int graphic_push_normal_code (unsigned char *code, uint64_t address);
-extern int graphic_push_jump (unsigned char *code, uint64_t address, uint64_t jump_address);
-extern int graphic_push_cond_jump (unsigned char *code, uint64_t address, uint64_t jump_address);
-extern int graphic_push_ret (unsigned char *code, uint64_t address);
+extern int graphic_start_section (char *name);
+extern int graphic_start_function (char *name, uint64_t address);
+extern int graphic_push_normal_code (char *code, uint64_t address);
+extern int graphic_push_jump (char *code, uint64_t address, uint64_t jump_address);
+extern int graphic_push_cond_jump (char *code, uint64_t address, uint64_t jump_address);
+extern int graphic_push_ret (char *code, uint64_t address);
 
-extern unsigned char *get_section_name (void);
+extern char *get_section_name (void);
 
 #endif /* GRAPHICS_H */
Index: Makefile
===================================================================
RCS file: /cvsroot/linux-vax/usr/visualize_asm/Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Makefile	11 Mar 2005 21:29:34 -0000	1.1
+++ Makefile	5 Jun 2007 22:09:05 -0000	1.2
@@ -1,7 +1,7 @@
 #!/usr/bin/make -f
 
 CC	= gcc
-CFLAGS	= -g -Wall -Werror -D_GNU_SOURCE
+CFLAGS	= -g -Wall -Werror -D_GNU_SOURCE -std=gnu99
 
 all:
 	$(CC) $(CFLAGS) -c -o parse_vax.o		parse_vax.c
@@ -21,6 +21,11 @@
 						regexp_helper.o		\
 						parse_backend.o
 
+te: all
+	./disassemble vax te.dis > xx 2> yy
+	dot -Tps < xx > xx.ps
+	poster -mA4 -p6x4A4 < xx.ps > xxx.ps
+
 vax: all
 	./disassemble vax vax.dis > xx 2> yy && dot -Tps < xx > xx.ps && poster -mA4 -p6x4A4 < xx.ps > xxx.ps
 
@@ -29,4 +34,3 @@
 
 clean:
 	-rm -f *.o core disassemble xx yy xx.* yy.* xxx.*
-
Index: parse_disassembly.c
===================================================================
RCS file: /cvsroot/linux-vax/usr/visualize_asm/parse_disassembly.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- parse_disassembly.c	11 Mar 2005 21:29:34 -0000	1.1
+++ parse_disassembly.c	5 Jun 2007 22:09:06 -0000	1.2
@@ -7,7 +7,7 @@
 #include "graphic.h"
 
 static void
-kill_newline (unsigned char *line)
+kill_newline (char *line)
 {
 	int i = 0;
 
@@ -25,8 +25,8 @@
 {
 	int ret;
 	char line[1000];
-	unsigned char *parser;
-	unsigned char *filename = NULL;
+	char *parser;
+	char *filename = NULL;
 	FILE *stream;
 	struct arch_parser_table *table;
 
@@ -66,7 +66,7 @@
 		return -1;
 	}
 
-	graphic_start_output (filename? filename: (unsigned char *) "<stdin>");
+	graphic_start_output (filename? filename: "<stdin>");
 
 	while (fgets (line, sizeof (line), stream)) {
 		kill_newline (line);
@@ -81,6 +81,5 @@
 
 	graphic_finish_output ();
 
-	return EXIT_SUCCESS;
+	return 0;
 }
-
Index: parse_i386.c
===================================================================
RCS file: /cvsroot/linux-vax/usr/visualize_asm/parse_i386.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- parse_i386.c	11 Mar 2005 21:29:34 -0000	1.1
+++ parse_i386.c	5 Jun 2007 22:09:06 -0000	1.2
@@ -50,4 +50,3 @@
 	},
 	{ },
 };
-
Index: graphic.c
===================================================================
RCS file: /cvsroot/linux-vax/usr/visualize_asm/graphic.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- graphic.c	11 Mar 2005 21:29:34 -0000	1.1
+++ graphic.c	5 Jun 2007 22:09:05 -0000	1.2
@@ -6,10 +6,10 @@
 extern struct graphic_implementation graphic_dot;
 
 static struct graphic_implementation *graphic = NULL;
-static unsigned char *section_name = NULL;
+static char *section_name = NULL;
 
 int
-graphic_init (unsigned char *name)
+graphic_init (char *name)
 {
 	if (strcmp (name, "dot") == 0)
 		graphic = &graphic_dot;
@@ -23,7 +23,7 @@
 }
 
 int
-graphic_start_output (unsigned char *filename)
+graphic_start_output (char *filename)
 {
 	if (graphic && graphic->start_output)
 		return (graphic->start_output) (filename);
@@ -41,7 +41,7 @@
 }
 
 int
-graphic_start_section (unsigned char *name)
+graphic_start_section (char *name)
 {
 	if (section_name) {
 		free (section_name);
@@ -56,7 +56,7 @@
 }
 
 int
-graphic_start_function (unsigned char *name, uint64_t address)
+graphic_start_function (char *name, uint64_t address)
 {
 	if (graphic && graphic->start_function)
 		return (graphic->start_function) (name, address);
@@ -65,7 +65,7 @@
 }
 
 int
-graphic_push_normal_code (unsigned char *code, uint64_t address)
+graphic_push_normal_code (char *code, uint64_t address)
 {
 	if (graphic && graphic->push_normal_code)
 		return (graphic->push_normal_code) (code, address);
@@ -74,7 +74,7 @@
 }
 
 int
-graphic_push_jump (unsigned char *code, uint64_t address, uint64_t jump_address)
+graphic_push_jump (char *code, uint64_t address, uint64_t jump_address)
 {
 	if (graphic && graphic->push_jump)
 		return (graphic->push_jump) (code, address, jump_address);
@@ -83,7 +83,7 @@
 }
 
 int
-graphic_push_cond_jump (unsigned char *code, uint64_t address, uint64_t jump_address)
+graphic_push_cond_jump (char *code, uint64_t address, uint64_t jump_address)
 {
 	if (graphic && graphic->push_cond_jump)
 		return (graphic->push_cond_jump) (code, address, jump_address);
@@ -92,7 +92,7 @@
 }
 
 int
-graphic_push_ret (unsigned char *code, uint64_t address)
+graphic_push_ret (char *code, uint64_t address)
 {
 	if (graphic && graphic->push_ret)
 		return (graphic->push_ret) (code, address);
@@ -100,9 +100,8 @@
 	return -1;
 }
 
-unsigned char *
+char *
 get_section_name (void)
 {
 	return section_name;
 }
-
Index: address.c
===================================================================
RCS file: /cvsroot/linux-vax/usr/visualize_asm/address.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- address.c	11 Mar 2005 21:29:34 -0000	1.1
+++ address.c	5 Jun 2007 22:09:05 -0000	1.2
@@ -4,8 +4,7 @@
 #include "address.h"
 
 uint64_t
-uint64_from_hex_address (unsigned char *hex)
+uint64_from_hex_address (char *hex)
 {
 	return strtoll (hex, NULL, 16);
 }
-
Index: regexp_helper.h
===================================================================
RCS file: /cvsroot/linux-vax/usr/visualize_asm/regexp_helper.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- regexp_helper.h	11 Mar 2005 21:29:34 -0000	1.1
+++ regexp_helper.h	5 Jun 2007 22:09:06 -0000	1.2
@@ -1,7 +1,6 @@
 #ifndef _REGEX_HELPER_H
 #define _REGEX_HELPER_H
 
-extern int try_regexp (unsigned char *regexp, unsigned char *line,
-		int num_returns, ...);
+extern int try_regexp (char *regexp, char *line, unsigned int num_returns, ...);
 
 #endif /* _REGEX_HELPER_H */
Index: regexp_helper.c
===================================================================
RCS file: /cvsroot/linux-vax/usr/visualize_asm/regexp_helper.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- regexp_helper.c	14 Mar 2005 08:54:37 -0000	1.2
+++ regexp_helper.c	5 Jun 2007 22:09:06 -0000	1.3
@@ -4,15 +4,15 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
+#include "regexp_helper.h"
 
 struct result_catcher {
 	int match_index;
-	unsigned char **result;
+	char **result;
 };
 
 int
-try_regexp (unsigned char *regexp, unsigned char *line,
-		unsigned int num_returns, ...)
+try_regexp (char *regexp, char *line, unsigned int num_returns, ...)
 {
 	int regex_ret;
 	regex_t regex;
@@ -25,7 +25,7 @@
 	 * Get memory for result catcher structures
 	 */
 	if (num_returns) {
-		int i;
+		unsigned int i;
 
 		catch = malloc (num_returns * sizeof (struct result_catcher));
 		if (!catch)
@@ -37,7 +37,7 @@
 		va_start (args, num_returns); {
 			for (i = 0; i < num_returns; i++) {
 				catch[i].match_index = va_arg (args, int);
-				catch[i].result = va_arg (args, unsigned char **);
+				catch[i].result = va_arg (args, char **);
 				if (largest_match < catch[i].match_index)
 					largest_match = catch[i].match_index;
 			}
@@ -48,8 +48,10 @@
 	 * Compile the regex
 	 */
 	regex_ret = regcomp (&regex, regexp, REG_EXTENDED);
-	if (regex_ret != 0)
+	if (regex_ret != 0) {
+		fprintf (stderr, "%s: regcomp() = %d\n", __FUNCTION__, regex_ret);
 		return -1;
+	}
 
 	/*
 	 * If we need to supply a result, actually work towards getting
@@ -71,7 +73,7 @@
 	 */
 	regex_ret = regexec (&regex, line, match? largest_match + 1: 0, match, 0);
 	if (regex_ret == 0) {
-		int i;
+		unsigned int i;
 		unsigned int failure = 0;
 
 		for (i = 0; i < num_returns; i++)
@@ -79,18 +81,18 @@
 				failure++;
 
 		if (failure) {
+			for (i = 0; i < num_returns; i++)
+				*(catch[i].result) = NULL;
 			if (catch)
 				free (catch);
 			if (match)
 				free (match);
-			for (i = 0; i < num_returns; i++)
-				*(catch[i].result) = NULL;
 			regfree (&regex);
 			return -1;
 		} else {
 			for (i = 0; i < num_returns; i++)
 				*(catch[i].result) = strndup (line + match[catch[i].match_index].rm_so,
-				match[catch[i].match_index].rm_eo - match[catch[i].match_index].rm_so);
+							 match[catch[i].match_index].rm_eo - match[catch[i].match_index].rm_so);
 			if (catch)
 				free (catch);
 			if (match)
@@ -99,16 +101,15 @@
 			return 0;
 		}
 	} else {
-			int i;
+			unsigned int i;
 
+			for (i = 0; i < num_returns; i++)
+				*(catch[i].result) = NULL;
 			if (catch)
 				free (catch);
 			if (match)
 				free (match);
-			for (i = 0; i < num_returns; i++)
-				*(catch[i].result) = NULL;
 			regfree (&regex);
 			return -1;
 	}
 }
-
Index: address.h
===================================================================
RCS file: /cvsroot/linux-vax/usr/visualize_asm/address.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- address.h	11 Mar 2005 21:29:34 -0000	1.1
+++ address.h	5 Jun 2007 22:09:05 -0000	1.2
@@ -3,6 +3,6 @@
 
 #include <stdint.h>
 
-extern uint64_t uint64_from_hex_address (unsigned char *hex);
+extern uint64_t uint64_from_hex_address (char *hex);
 
 #endif /* ADDRESS_H */
Index: parse.h
===================================================================
RCS file: /cvsroot/linux-vax/usr/visualize_asm/parse.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- parse.h	11 Mar 2005 21:29:34 -0000	1.1
+++ parse.h	5 Jun 2007 22:09:06 -0000	1.2
@@ -4,13 +4,13 @@
 #define NUM_MATCHES	3
 
 struct arch_parser_table {
-	unsigned char *regexp;
-	unsigned char *type;	/* condjump, jump, ignore, ... */
+	char *regexp;
+	char *type;	/* condjump, jump, ignore, ... */
 	unsigned int arg[NUM_MATCHES];
 #define MATCH_UNUSED ((unsigned int)-1)
 };
 
-extern int	parse_line (unsigned char *line, struct arch_parser_table *table);
+extern int parse_line (char *line, struct arch_parser_table *table);
 
 extern struct arch_parser_table	vax_parser[];
 extern struct arch_parser_table i386_parser[];
Index: parse_backend.c
===================================================================
RCS file: /cvsroot/linux-vax/usr/visualize_asm/parse_backend.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- parse_backend.c	14 Mar 2005 08:54:37 -0000	1.2
+++ parse_backend.c	5 Jun 2007 22:09:06 -0000	1.3
@@ -14,8 +14,7 @@
 #endif
 
 static int
-parse_condjump (unsigned char *line, unsigned char *line_address_hex,
-		unsigned char *jump_address_hex)
+parse_condjump (char *line, char *line_address_hex, char *jump_address_hex)
 {
 	uint64_t line_address;
 	uint64_t jump_address;
@@ -30,8 +29,7 @@
 }
 
 static int
-parse_jump (unsigned char *line, unsigned char *line_address_hex,
-		unsigned char *jump_address_hex)
+parse_jump (char *line, char *line_address_hex, char *jump_address_hex)
 {
 	uint64_t line_address;
 	uint64_t jump_address;
@@ -46,8 +44,7 @@
 }
 
 static int
-parse_ret (unsigned char *line, unsigned char *line_address_hex,
-		unsigned char *unused1)
+parse_ret (char *line, char *line_address_hex, char *unused1)
 {
 	uint64_t line_address;
 
@@ -60,15 +57,13 @@
 }
 
 static int
-parse_ignore (unsigned char *line, unsigned char *unused1,
-		unsigned char *unused2)
+parse_ignore (char *line, char *unused1, char *unused2)
 {
 	return 0;
 }
 
 static int
-parse_section (unsigned char *line, unsigned char *section_name,
-		unsigned char *unused1)
+parse_section (char *line, char *section_name, char *unused1)
 {
 	if (!line || !section_name)
 		return -1;
@@ -77,8 +72,7 @@
 }
 
 static int
-parse_function (unsigned char *line, unsigned char *function_name,
-		unsigned char *function_address_hex)
+parse_function (char *line, char *function_name, char *function_address_hex)
 {
 	uint64_t function_address;
 
@@ -91,8 +85,7 @@
 }
 
 static int
-parse_code (unsigned char *line, unsigned char *line_address_hex,
-		unsigned char *unused1)
+parse_code (char *line, char *line_address_hex, char *unused1)
 {
 	uint64_t line_address;
 
@@ -105,8 +98,8 @@
 }
 
 static struct parser_func_table_entry {
-	unsigned char *name;
-	int (*parser_function) (unsigned char *arg1, unsigned char *arg2, unsigned char *arg3);
+	char *name;
+	int (*parser_function) (char *arg1, char *arg2, char *arg3);
 } function_table[] = {
 	{ .name = "condjump",	&parse_condjump,	},
 	{ .name = "jump",	&parse_jump,		},
@@ -118,7 +111,7 @@
 };
 
 static void *
-find_parse_function (unsigned char *name)
+find_parse_function (char *name)
 {
 	int i;
 
@@ -130,10 +123,10 @@
 }
 
 int
-parse_line (unsigned char *line, struct arch_parser_table *arch)
+parse_line (char *line, struct arch_parser_table *arch)
 {
-	unsigned char *arg[NUM_MATCHES];
-	int (*parse_function) (unsigned char *, unsigned char *, unsigned char *);
+	char *arg[NUM_MATCHES];
+	int (*parse_function) (char *, char *, char *);
 	int ret;
 	int i;
 	unsigned int num_returns;
@@ -219,4 +212,3 @@
 
 	return -1;
 }
-
Index: parse_vax.c
===================================================================
RCS file: /cvsroot/linux-vax/usr/visualize_asm/parse_vax.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- parse_vax.c	12 Mar 2005 17:36:11 -0000	1.3
+++ parse_vax.c	5 Jun 2007 22:09:06 -0000	1.4
@@ -60,4 +60,3 @@
 	},
 	{ },
 };
-
Update of /cvsroot/linux-vax/usr/visualize_asm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10511
Modified Files:
	graphic.h graphic_dot.c parse_backend.c regexp_helper.c 
Log Message:
- Remove trailing whitespace. Easily spotted by:
 highlight RedundantWhitespace ctermbg=red guibg=red
 match RedundantWhitespace /\s\+$\| \+\ze\t/
 ...in your ~/.vimrc
Index: regexp_helper.c
===================================================================
RCS file: /cvsroot/linux-vax/usr/visualize_asm/regexp_helper.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- regexp_helper.c	11 Mar 2005 21:29:34 -0000	1.1
+++ regexp_helper.c	14 Mar 2005 08:54:37 -0000	1.2
@@ -42,7 +42,6 @@
 					largest_match = catch[i].match_index;
 			}
 		} va_end (args);
-		
 	}
 
 	/*
Index: graphic_dot.c
===================================================================
RCS file: /cvsroot/linux-vax/usr/visualize_asm/graphic_dot.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- graphic_dot.c	11 Mar 2005 21:29:34 -0000	1.1
+++ graphic_dot.c	14 Mar 2005 08:54:37 -0000	1.2
@@ -18,7 +18,7 @@
 	size_t len;
 
 	len = vsnprintf (buf, 0, format, args) + 5;
-	real_buf = malloc (len); 
+	real_buf = malloc (len);
 	if (!real_buf)
 		return NULL;
 
Index: parse_backend.c
===================================================================
RCS file: /cvsroot/linux-vax/usr/visualize_asm/parse_backend.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- parse_backend.c	11 Mar 2005 21:29:34 -0000	1.1
+++ parse_backend.c	14 Mar 2005 08:54:37 -0000	1.2
@@ -112,7 +112,7 @@
 	{ .name = "jump",	&parse_jump,		},
 	{ .name = "ret",	&parse_ret,		},
 	{ .name = "ignore",	&parse_ignore,		},
-	{ .name = "section",	&parse_section,	 	},
+	{ .name = "section",	&parse_section,		},
 	{ .name = "function",	&parse_function,	},
 	{ .name = "code",	&parse_code,		},
 };
Index: graphic.h
===================================================================
RCS file: /cvsroot/linux-vax/usr/visualize_asm/graphic.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- graphic.h	11 Mar 2005 21:29:34 -0000	1.1
+++ graphic.h	14 Mar 2005 08:54:37 -0000	1.2
@@ -26,6 +26,5 @@
 extern int graphic_push_ret (unsigned char *code, uint64_t address);
 
 extern unsigned char *get_section_name (void);
-	
-#endif /* GRAPHICS_H */
 
+#endif /* GRAPHICS_H */
From: Jan-Benedict G. <jb...@us...> - 2005年03月12日 17:36:21
Update of /cvsroot/linux-vax/usr/visualize_asm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18049
Modified Files:
	parse_vax.c Whats_Implemented.txt 
Log Message:
- Implement vax::condjump::blssu
Index: Whats_Implemented.txt
===================================================================
RCS file: /cvsroot/linux-vax/usr/visualize_asm/Whats_Implemented.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Whats_Implemented.txt	11 Mar 2005 21:30:32 -0000	1.1
+++ Whats_Implemented.txt	12 Mar 2005 17:36:11 -0000	1.2
@@ -31,6 +31,7 @@
 		bleq
 		blequ
 		blss
+		blssu
 		bneq
 		sobgtr
 	jump:
Index: parse_vax.c
===================================================================
RCS file: /cvsroot/linux-vax/usr/visualize_asm/parse_vax.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- parse_vax.c	12 Mar 2005 09:11:49 -0000	1.2
+++ parse_vax.c	12 Mar 2005 17:36:11 -0000	1.3
@@ -49,7 +49,7 @@
 		.arg	= { 0, 1, 4, },
 	},
 	{
-		.regexp	= "^[[:space:]]*([[:xdigit:]]+):	[[:xdigit:] ]+	(bneq|blss|beql|bleq|bgeq|blequ|bcc|bgtr) (0x|)([[:xdigit:]]+)( <.*>|)$",
+		.regexp	= "^[[:space:]]*([[:xdigit:]]+):	[[:xdigit:] ]+	(bneq|blss|blssu|beql|bleq|bgeq|blequ|bcc|bgtr) (0x|)([[:xdigit:]]+)( <.*>|)$",
 		.type	= "condjump",
 		.arg	= { 0, 1, 4, },
 	},
From: Jan-Benedict G. <jb...@us...> - 2005年03月12日 09:11:58
Update of /cvsroot/linux-vax/usr/visualize_asm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23942
Modified Files:
	parse_vax.c 
Log Message:
- When (trying to) visualize the output of disassembled ROM images, there
 are no function names, so make them optional.
Index: parse_vax.c
===================================================================
RCS file: /cvsroot/linux-vax/usr/visualize_asm/parse_vax.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- parse_vax.c	11 Mar 2005 21:29:34 -0000	1.1
+++ parse_vax.c	12 Mar 2005 09:11:49 -0000	1.2
@@ -34,24 +34,24 @@
 		.arg	= { 0, 1, MATCH_UNUSED, },
 	},
 	{
-		.regexp	= "^[[:space:]]*([[:xdigit:]]+):	[[:xdigit:] ]+	(sobgtr|blbc) [^,]+,([[:xdigit:]]+) <.*>$",
+		.regexp	= "^[[:space:]]*([[:xdigit:]]+):	[[:xdigit:] ]+	(sobgtr|blbc) [^,]+,(0x|)([[:xdigit:]]+)( <.*>|)$",
 		.type	= "condjump",
-		.arg	= { 0, 1, 3, },
+		.arg	= { 0, 1, 4, },
 	},
 	{
-		.regexp	= "^[[:space:]]*([[:xdigit:]]+):	[[:xdigit:] ]+	(bbss|bbs|bbc|aoblss|aobleq) [^,]+,[^,]+,([[:xdigit:]]+) <.*>$",
+		.regexp	= "^[[:space:]]*([[:xdigit:]]+):	[[:xdigit:] ]+	(bbss|bbs|bbc|aoblss|aobleq) [^,]+,[^,]+,(0x|)([[:xdigit:]]+)( <.*>|)$",
 		.type	= "condjump",
-		.arg	= { 0, 1, 3, },
+		.arg	= { 0, 1, 4, },
 	},
 	{
-		.regexp	= "^[[:space:]]*([[:xdigit:]]+):	[[:xdigit:] ]+	(brb|brw) ([[:xdigit:]]+) <.*>$",
+		.regexp	= "^[[:space:]]*([[:xdigit:]]+):	[[:xdigit:] ]+	(brb|brw) (0x|)([[:xdigit:]]+)( <.*>|)$",
 		.type	= "jump",
-		.arg	= { 0, 1, 3, },
+		.arg	= { 0, 1, 4, },
 	},
 	{
-		.regexp	= "^[[:space:]]*([[:xdigit:]]+):	[[:xdigit:] ]+	(bneq|blss|beql|bleq|bgeq|blequ|bcc|bgtr) ([[:xdigit:]]+) <.*>$",
+		.regexp	= "^[[:space:]]*([[:xdigit:]]+):	[[:xdigit:] ]+	(bneq|blss|beql|bleq|bgeq|blequ|bcc|bgtr) (0x|)([[:xdigit:]]+)( <.*>|)$",
 		.type	= "condjump",
-		.arg	= { 0, 1, 3, },
+		.arg	= { 0, 1, 4, },
 	},
 	{
 		.regexp	= "^[[:space:]]*([[:xdigit:]]+):[[:space:]]+.*$",
From: Jan-Benedict G. <jb...@us...> - 2005年03月11日 21:30:42
Update of /cvsroot/linux-vax/usr/visualize_asm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22230
Added Files:
	Whats_Implemented.txt 
Log Message:
- Forgot this file...
--- NEW FILE: Whats_Implemented.txt ---
Please keep this file ordered on all levels!!!
This is what's currently implemented:
i386:
	condjump:
		ja
		jb
		je
		jle
		jne
		jns
		js
	jump:
		jmp
	ret:
		ret
vax:
	condjump:
		aobleq
		aoblss
		bbc
		bbs
		bbss
		bcc
		beql
		bgeq
		bgtr
		blbc
		bleq
		blequ
		blss
		bneq
		sobgtr
	jump:
		brb
		brw
	ret:
		ret
Update of /cvsroot/linux-vax/usr/visualize_asm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21512
Added Files:
	address.c graphic.c graphic_dot.c parse_backend.c 
	parse_disassembly.c parse_i386.c parse_vax.c regexp_helper.c 
	address.h graphic.h parse.h regexp_helper.h LICENSE Makefile 
	i386.dis vax.dis README 
Log Message:
- About 10..15 hours of hacking, and this li'l tool showed up. Stuff
 regular expressions into it (those that describe a given assembler
 language) and it'll probably draw you a nice draw out of objdump -d -w
 disassembler.
--- NEW FILE: i386.dis ---
synaptics.o: file format elf32-i386
Disassembly of section .text:
00000000 <synaptics_send_cmd>:
 0:	83 ec 10 	sub 0ドルx10,%esp
 3:	0f b6 44 24 18 	movzbl 0x18(%esp),%eax
 8:	89 5c 24 0c 	mov %ebx,0xc(%esp)
 c:	8b 5c 24 14 	mov 0x14(%esp),%ebx
 10:	89 44 24 04 	mov %eax,0x4(%esp)
 14:	89 1c 24 	mov %ebx,(%esp)
 17:	e8 fc ff ff ff 	call 18 <synaptics_send_cmd+0x18>
 1c:	85 c0 	test %eax,%eax
 1e:	ba ff ff ff ff 	mov 0ドルxffffffff,%edx
 23:	75 27 	jne 4c <synaptics_send_cmd+0x4c>
 25:	b8 e9 03 00 00 	mov 0ドルx3e9,%eax
 2a:	89 44 24 08 	mov %eax,0x8(%esp)
 2e:	8b 44 24 1c 	mov 0x1c(%esp),%eax
[...1421 lines suppressed...]
 12aa:	5b 	pop %ebx
 12ab:	5e 	pop %esi
 12ac:	5f 	pop %edi
 12ad:	5d 	pop %ebp
 12ae:	c3 	ret 
 12af:	90 	nop 
 12b0:	89 34 24 	mov %esi,(%esp)
 12b3:	e8 b8 f3 ff ff 	call 670 <synaptics_pt_create>
 12b8:	eb a1 	jmp 125b <synaptics_init+0x6b>
 12ba:	8d b6 00 00 00 00 	lea 0x0(%esi),%esi
 12c0:	31 c0 	xor %eax,%eax
 12c2:	eb 8e 	jmp 1252 <synaptics_init+0x62>
 12c4:	c7 04 24 80 02 00 00 	movl 0ドルx280,(%esp)
 12cb:	e8 fc ff ff ff 	call 12cc <synaptics_init+0xdc>
 12d0:	89 1c 24 	mov %ebx,(%esp)
 12d3:	e8 fc ff ff ff 	call 12d4 <synaptics_init+0xe4>
 12d8:	b8 ff ff ff ff 	mov 0ドルxffffffff,%eax
 12dd:	eb c8 	jmp 12a7 <synaptics_init+0xb7>
 12df:	c7 04 24 c0 02 00 00 	movl 0ドルx2c0,(%esp)
 12e6:	eb e3 	jmp 12cb <synaptics_init+0xdb>
--- NEW FILE: graphic_dot.c ---
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "graphic.h"
static int section_block_opened = 0;
static int function_block_opened = 0;
static char *last_anchor = NULL;
#define CLUSTER "cluster: "
static unsigned char *
alloc_sprintf_valist (unsigned char *format, va_list args)
{
	char buf[1];
	char *real_buf;
	size_t len;
	len = vsnprintf (buf, 0, format, args) + 5;
	real_buf = malloc (len); 
	if (!real_buf)
		return NULL;
	vsnprintf (real_buf, len, format, args);
	return real_buf;
}
static int
dot_set_last_anchor (unsigned char *format, ...)
{
	unsigned char *buf;
	va_list args;
	if (!format) {
		if (last_anchor)
			free (last_anchor);
		last_anchor = NULL;
		return 0;
	}
	va_start (args, format); {
		buf = alloc_sprintf_valist (format, args);
	} va_end (args);
	if (buf) {
		if (last_anchor) {
			free (last_anchor);
			last_anchor = NULL;
		}
		last_anchor = buf;
		return 0;
	} else
		return -1;
}
static unsigned char *
dot_section_name (void)
{
	unsigned char *section_name;
	section_name = get_section_name ();
	if (!section_name)
		section_name = "*unknown*";
	return section_name;
}
static int
dot_close_code_block (void)
{
	return 0;
}
static int
dot_close_function_block (void)
{
	dot_close_code_block ();
	if (function_block_opened) {
		printf ("\t\t}\n");
		function_block_opened = 0;
	}
	dot_set_last_anchor (NULL);
	return 0;
}
static int
dot_close_section_block (void)
{
	dot_close_function_block ();
	if (section_block_opened) {
		printf ("\t}\n");
		section_block_opened = 0;
	}
	return 0;
}
static int
dot_start_output (unsigned char *filename)
{
	/* XXX escape filename */
	printf ("digraph \"%s\" {\n", filename);
	printf ("\tstyle=bold;\n");
	return 0;
}
static int
dot_finish_output (void)
{
	dot_close_section_block ();
	printf ("}\n");
	return 0;
}
static int
dot_start_section (unsigned char *name)
{
	dot_close_section_block ();
	printf ("\tsubgraph \"%sSection %s\" {\n", CLUSTER, name);
	printf ("\t\tlabel=\"Section \\\"%s\\\"\";\n", name);
	section_block_opened = 1;
	return 0;
}
static int
dot_start_function (unsigned char *name, uint64_t address)
{
	dot_close_function_block ();
	printf ("\t\tsubgraph \"%s%s:%s\" {\n", CLUSTER, dot_section_name (), name);
	printf ("\t\t\tlabel=\"Function %s()\";\n", name);
	dot_set_last_anchor (NULL);
	function_block_opened = 1;
	return 0;
}
static int
dot_push_normal_code (unsigned char *code, uint64_t address)
{
	if (last_anchor)
		printf ("\t\t\t\"%s\" -> \"%s:0x%016llx\";\n", last_anchor,
				dot_section_name (), address);
	printf ("\t\t\t\"%s:0x%016llx\" [shape=box,label=\"%s\"];\n",
			dot_section_name (), address, code);
	dot_set_last_anchor ("%s:0x%016llx", dot_section_name (), address);
	return 0;
}
static int
dot_push_jump (unsigned char *code, uint64_t address, uint64_t jump_address)
{
	dot_close_code_block ();
	printf ("\t\t\t\"%s:0x%016llx\" [shape=parallelogram,label=\"%s\"];\n",
			dot_section_name (), address, code);
	/* Edge from previous item to us. */
	if (last_anchor)
		printf ("\t\t\t\"%s\" -> \"%s:0x%016llx\";\n", last_anchor,
				dot_section_name (), address);
	/* Edge from us to jump_address */
	printf ("\t\t\t\"%s:0x%016llx\" -> \"%s:0x%016llx\";\n", dot_section_name (),
			address, dot_section_name (), jump_address);
	dot_set_last_anchor (NULL);
	return 0;
}
static int
dot_push_cond_jump (unsigned char *code, uint64_t address, uint64_t jump_address)
{
	dot_close_code_block ();
	printf ("\t\t\t\"%s:0x%016llx\" [shape=diamond,label=\"%s\"];\n",
			dot_section_name (), address, code);
	/* Edge from previous item to us. */
	if (last_anchor)
		printf ("\t\t\t\"%s\" -> \"%s:0x%016llx\";\n", last_anchor,
				dot_section_name (), address);
	/* Edge from us to jump_address */
	printf ("\t\t\t\"%s:0x%016llx\" -> \"%s:0x%016llx\";\n", dot_section_name (),
			address, dot_section_name (), jump_address);
	dot_set_last_anchor ("%s:0x%016llx", dot_section_name (), address);
	return 0;
}
static int
dot_push_ret (unsigned char *code, uint64_t address)
{
	if (last_anchor)
		printf ("\t\t\t\"%s\" -> \"%s:0x%016llx\";\n", last_anchor,
				dot_section_name (), address);
	printf ("\t\t\t\"%s:0x%016llx\" [shape=box,label=\"%s\"];\n",
			dot_section_name (), address, code);
	dot_set_last_anchor (NULL);
	return 0;
}
struct graphic_implementation graphic_dot = {
	.start_output = &dot_start_output,
	.finish_output = &dot_finish_output,
	.start_section = &dot_start_section,
	.start_function = &dot_start_function,
	.push_normal_code = &dot_push_normal_code,
	.push_jump = &dot_push_jump,
	.push_cond_jump = &dot_push_cond_jump,
	.push_ret = &dot_push_ret,
};
--- NEW FILE: vax.dis ---
./diag_led.o: file format elf32-vax
Disassembly of section .text:
00000000 <diag_led_get_base>:
 0:	00 00 	Entry mask 0x0000 = < >
 2:	d4 ef 00 00 00 00 	clrf 8 <diag_led_get_base+0x8>
 8:	9e ef 00 00 00 00 50 	movab e <diag_led_get_base+0xe>,r0
 f:	d4 51 	clrf r1
 11:	d1 ef 00 00 00 00 50 	cmpl 17 <diag_led_get_base+0x17>,r0
 18:	12 02 	bneq 1c <diag_led_get_base+0x1c>
 1a:	d6 51 	incl r1
 1c:	d5 51 	tstl r1
 1e:	12 18 	bneq 38 <diag_led_get_base+0x38>
 20:	9e ef 00 00 00 00 50 	movab 26 <diag_led_get_base+0x26>,r0
 27:	d4 51 	clrf r1
 29:	d1 ef 00 00 00 00 50 	cmpl 2f <diag_led_get_base+0x2f>,r0
 30:	12 02 	bneq 34 <diag_led_get_base+0x34>
 32:	d6 51 	incl r1
 34:	d5 51 	tstl r1
 36:	13 0f 	beql 47 <diag_led_get_base+0x47>
 38:	d0 01 ef c9 ff ff ff 	movl 0ドルx1,8 <diag_led_get_base+0x8>
 3f:	d0 8f 10 00 08 20 50 	movl 0ドルx20080010,r0
 46:	04 	ret
 47:	9e ef 00 00 00 00 50 	movab 4d <diag_led_get_base+0x4d>,r0
 4e:	d4 51 	clrf r1
 50:	d1 ef 00 00 00 00 50 	cmpl 56 <diag_led_get_base+0x56>,r0
 57:	12 02 	bneq 5b <diag_led_get_base+0x5b>
 59:	d6 51 	incl r1
 5b:	d5 51 	tstl r1
 5d:	13 0f 	beql 6e <diag_led_get_base+0x6e>
 5f:	d0 01 ef a2 ff ff ff 	movl 0ドルx1,8 <diag_led_get_base+0x8>
 66:	d0 8f 30 00 14 20 50 	movl 0ドルx20140030,r0
 6d:	04 	ret
 6e:	9f ef ef 00 00 00 	pushab 163 <diag_led_off+0x3f>
 74:	fb 01 ef 00 00 00 00 	calls 0ドルx1,7b <diag_led_get_base+0x7b>
 7b:	d4 50 	clrf r0
 7d:	04 	ret
0000007e <diag_led_set_state>:
 7e:	00 00 	Entry mask 0x0000 = < >
 80:	90 ac 04 52 	movb 0x4(ap),r2
 84:	d5 ef 76 ff ff ff 	tstl 0 <diag_led_get_base>
 8a:	12 04 	bneq 90 <diag_led_set_state+0x12>
 8c:	d2 12 50 	mcoml 0ドルx12,r0
 8f:	04 	ret
 90:	d5 ef 72 ff ff ff 	tstl 8 <diag_led_get_base+0x8>
 96:	13 0f 	beql a7 <diag_led_set_state+0x29>
 98:	d0 ef 62 ff ff ff 51 	movl 0 <diag_led_get_base>,r1
 9f:	92 52 50 	mcomb r2,r0
 a2:	90 50 61 	movb r0,(r1)
 a5:	11 0a 	brb b1 <diag_led_set_state+0x33>
 a7:	d0 ef 53 ff ff ff 50 	movl 0 <diag_led_get_base>,r0
 ae:	90 52 60 	movb r2,(r0)
 b1:	90 52 ef 4c ff ff ff 	movb r2,4 <diag_led_get_base+0x4>
 b8:	d4 50 	clrf r0
 ba:	04 	ret
 bb:	01 	nop
000000bc <diag_led_get_state>:
 bc:	00 00 	Entry mask 0x0000 = < >
 be:	d5 ef 3c ff ff ff 	tstl 0 <diag_led_get_base>
 c4:	12 17 	bneq dd <diag_led_get_state+0x21>
 c6:	9f ef d1 00 00 00 	pushab 19d <diag_led_knight_rider+0x35>
 cc:	fb 01 ef 00 00 00 00 	calls 0ドルx1,d3 <diag_led_get_state+0x17>
 d3:	fb 00 ef 00 00 00 00 	calls 0ドルx0,da <diag_led_get_state+0x1e>
 da:	d4 50 	clrf r0
 dc:	04 	ret
 dd:	9a ef 21 ff ff ff 50 	movzbl 4 <diag_led_get_base+0x4>,r0
 e4:	04 	ret
 e5:	01 	nop
000000e6 <diag_led_on>:
 e6:	40 00 	Entry mask 0x0040 = < r6 >
 e8:	d0 ac 04 56 	movl 0x4(ap),r6
 ec:	d1 56 07 	cmpl r6,0ドルx7
 ef:	1b 18 	blequ 109 <diag_led_on+0x23>
 f1:	9f ef e2 00 00 00 	pushab 1d9 <diag_led_knight_rider+0x71>
 f7:	fb 01 ef 00 00 00 00 	calls 0ドルx1,fe <diag_led_on+0x18>
 fe:	fb 00 ef 00 00 00 00 	calls 0ドルx0,105 <diag_led_on+0x1f>
 105:	d2 15 50 	mcoml 0ドルx15,r0
 108:	04 	ret
 109:	fb 00 ef 00 00 00 00 	calls 0ドルx0,110 <diag_led_on+0x2a>
 110:	78 56 01 51 	ashl r6,0ドルx1,r1
 114:	c2 03 5e 	subl2 0ドルx3,sp
 117:	89 50 51 7e 	bisb3 r0,r1,-(sp)
 11b:	fb 01 ef 00 00 00 00 	calls 0ドルx1,122 <diag_led_on+0x3c>
 122:	04 	ret
 123:	01 	nop
00000124 <diag_led_off>:
 124:	40 00 	Entry mask 0x0040 = < r6 >
 126:	d0 ac 04 56 	movl 0x4(ap),r6
 12a:	d1 56 07 	cmpl r6,0ドルx7
 12d:	1b 18 	blequ 147 <diag_led_off+0x23>
 12f:	9f ef a4 00 00 00 	pushab 1d9 <diag_led_knight_rider+0x71>
 135:	fb 01 ef 00 00 00 00 	calls 0ドルx1,13c <diag_led_off+0x18>
 13c:	fb 00 ef 00 00 00 00 	calls 0ドルx0,143 <diag_led_off+0x1f>
 143:	d2 15 50 	mcoml 0ドルx15,r0
 146:	04 	ret
 147:	fb 00 ef 00 00 00 00 	calls 0ドルx0,14e <diag_led_off+0x2a>
 14e:	9c 56 8f fe ff ff ff 51 	rotl r6,0ドルxfffffffe,r1
 156:	92 50 50 	mcomb r0,r0
 159:	c2 03 5e 	subl2 0ドルx3,sp
 15c:	8b 50 51 7e 	bicb3 r0,r1,-(sp)
 160:	fb 01 ef 00 00 00 00 	calls 0ドルx1,167 <diag_led_off+0x43>
 167:	04 	ret
00000168 <diag_led_knight_rider>:
 168:	c0 03 	Entry mask 0x03c0 = < r9 r8 r7 r6 >
 16a:	d4 58 	clrf r8
 16c:	d0 8f c0 1f 98 19 59 	movl 0ドルx19981fc0,r9
 173:	d4 56 	clrf r6
 175:	78 56 01 50 	ashl r6,0ドルx1,r0
 179:	c2 03 5e 	subl2 0ドルx3,sp
 17c:	90 50 7e 	movb r0,-(sp)
 17f:	fb 01 ef 00 00 00 00 	calls 0ドルx1,186 <diag_led_knight_rider+0x1e>
 186:	d0 1d 52 	movl 0ドルx1d,r2
 189:	d0 ef 00 00 00 00 53 	movl 18f <diag_led_knight_rider+0x27>,r3
 190:	7a 59 53 00 50 	emul r9,r3,0ドルx0,r0
 195:	d0 51 50 	movl r1,r0
 198:	f5 50 fd 	sobgtr r0,198 <diag_led_knight_rider+0x30>
 19b:	d7 52 	decl r2
 19d:	1e f1 	bcc 190 <diag_led_knight_rider+0x28>
 19f:	f3 06 56 d2 	aobleq 0ドルx6,r6,175 <diag_led_knight_rider+0xd>
 1a3:	d0 07 56 	movl 0ドルx7,r6
 1a6:	d0 8f c0 1f 98 19 57 	movl 0ドルx19981fc0,r7
 1ad:	78 56 01 50 	ashl r6,0ドルx1,r0
 1b1:	c2 03 5e 	subl2 0ドルx3,sp
 1b4:	90 50 7e 	movb r0,-(sp)
 1b7:	fb 01 ef 53 53 41 47 	calls 0ドルx1,47415511 <Letext+0x4741532e>
 1be:	d0 1d 52 	movl 0ドルx1d,r2
 1c1:	d0 ef 00 00 00 00 53 	movl 1c7 <diag_led_knight_rider+0x5f>,r3
 1c8:	7a 57 53 00 50 	emul r7,r3,0ドルx0,r0
 1cd:	d0 51 50 	movl r1,r0
 1d0:	f5 50 fd 	sobgtr r0,1d0 <diag_led_knight_rider+0x68>
 1d3:	d7 52 	decl r2
 1d5:	1e f1 	bcc 1c8 <diag_led_knight_rider+0x60>
 1d7:	d7 56 	decl r6
 1d9:	d1 56 01 	cmpl r6,0ドルx1
 1dc:	14 cf 	bgtr 1ad <diag_led_knight_rider+0x45>
 1de:	f3 09 58 91 	aobleq 0ドルx9,r8,173 <diag_led_knight_rider+0xb>
 1e2:	04 	ret
Disassembly of section .init.text:
00000000 <diag_led_probe>:
 0:	40 00 	Entry mask 0x0040 = < r6 >
 2:	fb 00 ef f7 ff ff ff 	calls 0ドルx0,0 <diag_led_probe>
 9:	d0 50 56 	movl r0,r6
 c:	12 04 	bneq 12 <diag_led_probe+0x12>
 e:	d2 12 50 	mcoml 0ドルx12,r0
 11:	04 	ret
 12:	dd 01 	pushl 0ドルx1
 14:	dd 56 	pushl r6
 16:	fb 02 ef 00 00 00 00 	calls 0ドルx2,1d <diag_led_probe+0x1d>
 1d:	d0 50 ef dc ff ff ff 	movl r0,0 <diag_led_probe>
 24:	12 13 	bneq 39 <diag_led_probe+0x39>
 26:	dd 56 	pushl r6
 28:	9f ef c5 01 00 00 	pushab 1f3 <Letext+0x10>
 2e:	fb 02 ef 00 00 00 00 	calls 0ドルx2,35 <diag_led_probe+0x35>
 35:	d2 0b 50 	mcoml 0ドルxb,r0
 38:	04 	ret
 39:	dd ef c1 ff ff ff 	pushl 0 <diag_led_probe>
 3f:	dd 56 	pushl r6
 41:	9f ef cf 01 00 00 	pushab 216 <Letext+0x33>
 47:	fb 03 ef 00 00 00 00 	calls 0ドルx3,4e <diag_led_probe+0x4e>
 4e:	fb 00 ef 13 01 00 00 	calls 0ドルx0,168 <diag_led_knight_rider>
 55:	c2 03 5e 	subl2 0ドルx3,sp
 58:	94 7e 	clrb -(sp)
 5a:	fb 01 ef 00 00 00 00 	calls 0ドルx1,61 <diag_led_probe+0x61>
 61:	d4 50 	clrf r0
 63:	04 	ret
00000064 <diag_led_init>:
 64:	00 00 	Entry mask 0x0000 = < >
 66:	9f ef ac ff ff ff 	pushab 18 <diag_led_probe+0x18>
 6c:	fb 01 ef 00 00 00 00 	calls 0ドルx1,73 <diag_led_init+0xf>
 73:	04 	ret
Disassembly of section .exit.text:
00000000 <diag_led_exit>:
 0:	00 00 	Entry mask 0x0000 = < >
 2:	d5 ef f8 ff ff ff 	tstl 0 <diag_led_exit>
 8:	13 20 	beql 2a <diag_led_exit+0x2a>
 a:	dd ef f0 ff ff ff 	pushl 0 <diag_led_exit>
 10:	9f ef 31 02 00 00 	pushab 247 <Letext+0x64>
 16:	fb 02 ef 00 00 00 00 	calls 0ドルx2,1d <diag_led_exit+0x1d>
 1d:	dd ef dd ff ff ff 	pushl 0 <diag_led_exit>
 23:	fb 01 ef 00 00 00 00 	calls 0ドルx1,2a <diag_led_exit+0x2a>
 2a:	04 	ret
--- NEW FILE: LICENSE ---
		 GNU GENERAL PUBLIC LICENSE
		 Version 2, June 1991
 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.
			 Preamble
 The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
 When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
 To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
 For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
 We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
 Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
 Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
 The precise terms and conditions for copying, distribution and
modification follow.

		 GNU GENERAL PUBLIC LICENSE
 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
 1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
 2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
 a) You must cause the modified files to carry prominent notices
 stating that you changed the files and the date of any change.
 b) You must cause any work that you distribute or publish, that in
 whole or in part contains or is derived from the Program or any
 part thereof, to be licensed as a whole at no charge to all third
 parties under the terms of this License.
 c) If the modified program normally reads commands interactively
 when run, you must cause it, when started running for such
 interactive use in the most ordinary way, to print or display an
 announcement including an appropriate copyright notice and a
 notice that there is no warranty (or else, saying that you provide
 a warranty) and that users may redistribute the program under
 these conditions, and telling the user how to view a copy of this
 License. (Exception: if the Program itself is interactive but
 does not normally print such an announcement, your work based on
 the Program is not required to print an announcement.)

These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
 3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
 a) Accompany it with the complete corresponding machine-readable
 source code, which must be distributed under the terms of Sections
 1 and 2 above on a medium customarily used for software interchange; or,
 b) Accompany it with a written offer, valid for at least three
 years, to give any third party, for a charge no more than your
 cost of physically performing source distribution, a complete
 machine-readable copy of the corresponding source code, to be
 distributed under the terms of Sections 1 and 2 above on a medium
 customarily used for software interchange; or,
 c) Accompany it with the information you received as to the offer
 to distribute corresponding source code. (This alternative is
 allowed only for noncommercial distribution and only if you
 received the program in object code or executable form with such
 an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.

 4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
 5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
 6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
 7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.

 8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
 9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
 10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
			 NO WARRANTY
 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
		 END OF TERMS AND CONDITIONS

	 How to Apply These Terms to Your New Programs
 If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
 To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
 <one line to give the program's name and a brief idea of what it does.>
 Copyright (C) <year> <name of author>
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
 Gnomovision version 69, Copyright (C) year name of author
 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
 This is free software, and you are welcome to redistribute it
 under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
 Yoyodyne, Inc., hereby disclaims all copyright interest in the program
 `Gnomovision' (which makes passes at compilers) written by James Hacker.
 <signature of Ty Coon>, 1 April 1989
 Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
--- NEW FILE: graphic.h ---
#ifndef _GRAPHICS_H
#define _GRAPHICS_H
#include <stdint.h>
struct graphic_implementation {
	int (*start_output) (unsigned char *filename);
	int (*finish_output) (void);
	int (*start_section) (unsigned char *name);
	int (*start_function) (unsigned char *name, uint64_t address);
	int (*push_normal_code) (unsigned char *code, uint64_t address);
	int (*push_jump) (unsigned char *code, uint64_t address, uint64_t jump_address);
	int (*push_cond_jump) (unsigned char *code, uint64_t address, uint64_t jump_address);
	int (*push_ret) (unsigned char *code, uint64_t address);
};
extern int graphic_init (unsigned char *name);
extern int graphic_start_output (unsigned char *filename);
extern int graphic_finish_output (void);
extern int graphic_start_section (unsigned char *name);
extern int graphic_start_function (unsigned char *name, uint64_t address);
extern int graphic_push_normal_code (unsigned char *code, uint64_t address);
extern int graphic_push_jump (unsigned char *code, uint64_t address, uint64_t jump_address);
extern int graphic_push_cond_jump (unsigned char *code, uint64_t address, uint64_t jump_address);
extern int graphic_push_ret (unsigned char *code, uint64_t address);
extern unsigned char *get_section_name (void);
	
#endif /* GRAPHICS_H */
--- NEW FILE: graphic.c ---
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "graphic.h"
extern struct graphic_implementation graphic_dot;
static struct graphic_implementation *graphic = NULL;
static unsigned char *section_name = NULL;
int
graphic_init (unsigned char *name)
{
	if (strcmp (name, "dot") == 0)
		graphic = &graphic_dot;
	else {
		fprintf (stderr, "Warning: Didn't recognize graphic "
				"subsystem \"%s\"!\n", name);
		return -1;
	}
	return 0;
}
int
graphic_start_output (unsigned char *filename)
{
	if (graphic && graphic->start_output)
		return (graphic->start_output) (filename);
	return -1;
}
int
graphic_finish_output (void)
{
	if (graphic && graphic->finish_output)
		return (graphic->finish_output) ();
	return -1;
}
int
graphic_start_section (unsigned char *name)
{
	if (section_name) {
		free (section_name);
		section_name = NULL;
	}
	section_name = strdup (name);
	if (graphic && graphic->start_section)
		return (graphic->start_section) (name);
	return -1;
}
int
graphic_start_function (unsigned char *name, uint64_t address)
{
	if (graphic && graphic->start_function)
		return (graphic->start_function) (name, address);
	return -1;
}
int
graphic_push_normal_code (unsigned char *code, uint64_t address)
{
	if (graphic && graphic->push_normal_code)
		return (graphic->push_normal_code) (code, address);
	return -1;
}
int
graphic_push_jump (unsigned char *code, uint64_t address, uint64_t jump_address)
{
	if (graphic && graphic->push_jump)
		return (graphic->push_jump) (code, address, jump_address);
	return -1;
}
int
graphic_push_cond_jump (unsigned char *code, uint64_t address, uint64_t jump_address)
{
	if (graphic && graphic->push_cond_jump)
		return (graphic->push_cond_jump) (code, address, jump_address);
	return -1;
}
int
graphic_push_ret (unsigned char *code, uint64_t address)
{
	if (graphic && graphic->push_ret)
		return (graphic->push_ret) (code, address);
	return -1;
}
unsigned char *
get_section_name (void)
{
	return section_name;
}
--- NEW FILE: parse_disassembly.c ---
#include <regex.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "parse.h"
#include "graphic.h"
static void
kill_newline (unsigned char *line)
{
	int i = 0;
	while (line[i]) {
		if (line[i] == '\n' || line[i] == '\r') {
			line[i] = '0円';
			break;
		}
		i++;
	}
}
int
main (int argc, char *argv[])
{
	int ret;
	char line[1000];
	unsigned char *parser;
	unsigned char *filename = NULL;
	FILE *stream;
	struct arch_parser_table *table;
	if (argc == 2) {
		parser = argv[1];
	} else if (argc == 3) {
		parser = argv[1];
		if (strcmp (argv[2], "-"))
			filename = argv[2];
	} else {
		fprintf (stderr, "%s <backend> [filename]\n", argv[0]);
		fprintf (stderr, "Eg.:\t%s vax < disass.txt\n", argv[0]);
		fprintf (stderr, "\tobjdump -d -w /path/to/file.o | %s vax\n", argv[0]);
		exit (EXIT_FAILURE);
	}
	if (filename) {
		stream = fopen (filename, "r");
		if (!stream) {
			fprintf (stderr, "Couldn't open %s\n", filename);
			return EXIT_FAILURE;
		}
	} else
		stream = stdin;
	if (strcmp (parser, "vax") == 0)
		table = vax_parser;
	else if (strcmp (parser, "i386") == 0)
		table = i386_parser;
	else {
		fprintf (stderr, "Backend %s unknown\n", parser);
		exit (EXIT_FAILURE);
	}
	if (graphic_init ("dot") != 0) {
		fprintf (stderr, "Couldn't init graphics\n");
		return -1;
	}
	graphic_start_output (filename? filename: (unsigned char *) "<stdin>");
	while (fgets (line, sizeof (line), stream)) {
		kill_newline (line);
		/*
		 * Try to parse the line.
		 */
		ret = parse_line (line, table);
		if (ret)
			fprintf (stderr, "\"%s\" didn't parse...\n", line);
	}
	graphic_finish_output ();
	return EXIT_SUCCESS;
}
--- NEW FILE: parse_i386.c ---
#include "parse.h"
/*
 *
 *
 * If you add additional codes here, please note them in Whats_Implemented.txt
 *
 *
 */
struct arch_parser_table i386_parser[] = {
	{
		.regexp	= "^.*: file format .*$",
		.type	= "ignore",
		.arg	= { MATCH_UNUSED, MATCH_UNUSED, MATCH_UNUSED, },
	},
	{
		.regexp	= "^$",
		.type	= "ignore",
		.arg	= { MATCH_UNUSED, MATCH_UNUSED, MATCH_UNUSED, },
	},
	{
		.regexp	= "^Disassembly of section ([^:]+):$",
		.type	= "section",
		.arg	= { 0, 1, MATCH_UNUSED, },
	},
	{
		.regexp	= "^[[:space:]]*([[:xdigit:]]+) <([^>]+)>:$",
		.type	= "function",
		.arg	= { 0, 2, 1, },
	},
	{
		.regexp	= "^[[:space:]]*([[:xdigit:]]+):[[:xdigit:][:space:]]+ret[[:space:]]*$",
		.type	= "ret",
		.arg	= { 0, 1, MATCH_UNUSED, },
	},
	{
		.regexp	= "^[[:space:]]*([[:xdigit:]]+):	[[:xdigit:] ]+	(jmp)[[:space:]]+([[:xdigit:]]+) <.*>$",
		.type	= "jump",
		.arg	= { 0, 1, 3, },
	},
	{
		.regexp	= "^[[:space:]]*([[:xdigit:]]+):	[[:xdigit:] ]+	(ja|jb|jns|jle|je|jne|js)[[:space:]]+([[:xdigit:]]+) <.*>$",
		.type	= "condjump",
		.arg	= { 0, 1, 3, },
	},
	{
		.regexp	= "^[[:space:]]*([[:xdigit:]]+):[[:space:]]+.*$",
		.type	= "code",
		.arg	= { 0, 1, MATCH_UNUSED, },
	},
	{ },
};
--- NEW FILE: Makefile ---
#!/usr/bin/make -f
CC	= gcc
CFLAGS	= -g -Wall -Werror -D_GNU_SOURCE
all:
	$(CC) $(CFLAGS) -c -o parse_vax.o		parse_vax.c
	$(CC) $(CFLAGS) -c -o parse_i386.o		parse_i386.c
	$(CC) $(CFLAGS) -c -o parse_disassembly.o	parse_disassembly.c
	$(CC) $(CFLAGS) -c -o graphic.o			graphic.c
	$(CC) $(CFLAGS) -c -o graphic_dot.o		graphic_dot.c
	$(CC) $(CFLAGS) -c -o address.o			address.c
	$(CC) $(CFLAGS) -c -o regexp_helper.o		regexp_helper.c
	$(CC) $(CFLAGS) -c -o parse_backend.o		parse_backend.c
	$(CC) $(CFLAGS) -o disassemble	parse_disassembly.o	\
						parse_vax.o		\
						parse_i386.o		\
						graphic.o		\
						graphic_dot.o		\
						address.o		\
						regexp_helper.o		\
						parse_backend.o
vax: all
	./disassemble vax vax.dis > xx 2> yy && dot -Tps < xx > xx.ps && poster -mA4 -p6x4A4 < xx.ps > xxx.ps
i386: all
	./disassemble i386 i386.dis > xx 2> yy && dot -Tps < xx > xx.ps && poster -mA4 -p6x4A4 < xx.ps > xxx.ps
clean:
	-rm -f *.o core disassemble xx yy xx.* yy.* xxx.*
--- NEW FILE: address.c ---
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include "address.h"
uint64_t
uint64_from_hex_address (unsigned char *hex)
{
	return strtoll (hex, NULL, 16);
}
--- NEW FILE: README ---
Notes to disasm-visualizer-0.0.1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you're a user...
~~~~~~~~~~~~~~~~~~~
I only implemented a parser backend for VAX disassembly. If you want to
visualize something else, you need to write it on your own.
As for the drawing backend, I decided to first of all implement a "dot"
backend. It'll generate "dot" files which can be visualized with "dot",
which is part of the graphviz package.
Invocation is like this:
vax-linux-objdump -d -w /path/to/vax_object_file.o | ./visualize vax - > output.dot
dot -Tps < output.dot > output.ps
gv output.ps
For a nice display, you may want to use "poster" (package: "poster") to bring
the output nicely readable onto a number of pages in large scale :)
If you need a different architecture's disassembler output supported...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You need to provide a parse_<your architecture>.c, which contains a number
of regexp's and actions to take on them. Look at the VAX file, and look at
the description in parse.h. It's really quite easy.
The second step is to make this backend known to the frontend. Just put it
into parse_disassembly.c:main(), there's also a (single) check for the
VAX backend which you simply must extend.
If you need a different graphic output...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Conceptually, this beast should easily support output to different formats
than "dot". If you've got some luck, "dot" (the program) can even convert
the "dot" format to whatever you need. At least, DIA, GIF, JPEG and a number
of other formats are already supported!
If this doesn't work for you, you need to implement a new backend. This isn't
really hard, too. Look at graphic.h: you need to provide an own implementation
of "struct graphic_implementation". For a first start, look at graphic_dot.c.
Most formats should be hierarchical, too, so it's probably only something like
exchanging keywords...
After you've done that, you must make your implementation known to
graphic.c:graphic_init(). Then, hack parse_disassembly.c:main() to also
select your implementation. Done.
2005年3月11日 13:34:49 +0100 -- Jan-Benedict Glaw <jb...@lu...>
--- NEW FILE: regexp_helper.h ---
#ifndef _REGEX_HELPER_H
#define _REGEX_HELPER_H
extern int try_regexp (unsigned char *regexp, unsigned char *line,
		int num_returns, ...);
#endif /* _REGEX_HELPER_H */
--- NEW FILE: regexp_helper.c ---
#include <regex.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
struct result_catcher {
	int match_index;
	unsigned char **result;
};
int
try_regexp (unsigned char *regexp, unsigned char *line,
		unsigned int num_returns, ...)
{
	int regex_ret;
	regex_t regex;
	regmatch_t *match;
	struct result_catcher *catch = NULL;
	va_list args;
	int largest_match = 0;
	/*
	 * Get memory for result catcher structures
	 */
	if (num_returns) {
		int i;
		catch = malloc (num_returns * sizeof (struct result_catcher));
		if (!catch)
			return -1;
		/*
		 * Set all values
		 */
		va_start (args, num_returns); {
			for (i = 0; i < num_returns; i++) {
				catch[i].match_index = va_arg (args, int);
				catch[i].result = va_arg (args, unsigned char **);
				if (largest_match < catch[i].match_index)
					largest_match = catch[i].match_index;
			}
		} va_end (args);
		
	}
	/*
	 * Compile the regex
	 */
	regex_ret = regcomp (&regex, regexp, REG_EXTENDED);
	if (regex_ret != 0)
		return -1;
	/*
	 * If we need to supply a result, actually work towards getting
	 * it at all...
	 */
	if (num_returns) {
		match = malloc ((largest_match + 1) * sizeof (regmatch_t));
		if (!match) {
			regfree (&regex);
			if (catch)
				free (catch);
			return -1;
		}
	} else
		match = NULL;
	/*
	 * Execute the regex
	 */
	regex_ret = regexec (&regex, line, match? largest_match + 1: 0, match, 0);
	if (regex_ret == 0) {
		int i;
		unsigned int failure = 0;
		for (i = 0; i < num_returns; i++)
			if (match[i].rm_so == -1 || match[i].rm_eo == -1)
				failure++;
		if (failure) {
			if (catch)
				free (catch);
			if (match)
				free (match);
			for (i = 0; i < num_returns; i++)
				*(catch[i].result) = NULL;
			regfree (&regex);
			return -1;
		} else {
			for (i = 0; i < num_returns; i++)
				*(catch[i].result) = strndup (line + match[catch[i].match_index].rm_so,
				match[catch[i].match_index].rm_eo - match[catch[i].match_index].rm_so);
			if (catch)
				free (catch);
			if (match)
				free (match);
			regfree (&regex);
			return 0;
		}
	} else {
			int i;
			if (catch)
				free (catch);
			if (match)
				free (match);
			for (i = 0; i < num_returns; i++)
				*(catch[i].result) = NULL;
			regfree (&regex);
			return -1;
	}
}
--- NEW FILE: address.h ---
#ifndef _ADDRESS_H
#define _ADDRESS_H
#include <stdint.h>
extern uint64_t uint64_from_hex_address (unsigned char *hex);
#endif /* ADDRESS_H */
--- NEW FILE: parse.h ---
#ifndef _PARSE_H
#define _PARSE_H
#define NUM_MATCHES	3
struct arch_parser_table {
	unsigned char *regexp;
	unsigned char *type;	/* condjump, jump, ignore, ... */
	unsigned int arg[NUM_MATCHES];
#define MATCH_UNUSED ((unsigned int)-1)
};
extern int	parse_line (unsigned char *line, struct arch_parser_table *table);
extern struct arch_parser_table	vax_parser[];
extern struct arch_parser_table i386_parser[];
/*
 * If you build your own parsing table, this is the HowTo:
 *
	{
		.regexp	= "^[[:space:]]*([[:xdigit:]]+):	[[:xdigit:] ]+	(sobgtr|blbc) [^,]+,([[:xdigit:]]+) <.*>$",
		.type	= "condjump",
		.arg	= { 0, 1, 3, },
	},
 *
 * If the above regexp matches, then you could think of it as a call to a
 * "condjump" function, which gets three arguments supplied. These
 * arguments are fugured out automatically from the regexp. You only
 * have to supply the match index from within the regexp. condjump()'s
 * first argument (which is "0"), shall be the 0th match of the regexp
 * (which is the whole line in this case). The second argument shall be
 * the 1st match of the regexp, which the first thing within (...), so
 * it's the address of the line in this example. condump()'s 3rd argument
 * is the match #3 in this example, which is the hexadecimal jump address
 * of the assembler output.
 *
 * Addresses _must_ always be in hex format, without leading "0x", but
 * leading '0's are allowed.
 *
 * If you add additional regexps, or whole architectures, blease note them
 * in Whats_Implemented.txt!!!
 *
 *
 * Here's the full list of supported callback function:
 *
 * condjump (<assembler code>, <address of line>, <jump target address>);
 * jump (<assembler code>, <address of line>, <jump target address>);
 * ret (<assembler code>, <address of line>, MATCH_UNUSED);
 * ignore (MATCH_UNUSED, MATCH_UNUSED, MATCH_UNUSED);
 * section (<assembler code>, <section name>, MATCH_UNUSED);
 * function (<assembler code>, <function name>, <function address>);
 * code (<assembler code>, <address of line>, MATCH_UNUSED);
 *
 */
#endif /* PARSE_H */
--- NEW FILE: parse_backend.c ---
#include <regex.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "address.h"
#include "graphic.h"
#include "parse.h"
#include "regexp_helper.h"
#ifndef ARRAY_SIZE
#	define ARRAY_SIZE(x)	( sizeof (x) / sizeof ((x)[0]) )
#endif
static int
parse_condjump (unsigned char *line, unsigned char *line_address_hex,
		unsigned char *jump_address_hex)
{
	uint64_t line_address;
	uint64_t jump_address;
	if (!line || !line_address || !jump_address)
		return -1;
	line_address = uint64_from_hex_address (line_address_hex);
	jump_address = uint64_from_hex_address (jump_address_hex);
	return graphic_push_cond_jump (line, line_address, jump_address);
}
static int
parse_jump (unsigned char *line, unsigned char *line_address_hex,
		unsigned char *jump_address_hex)
{
	uint64_t line_address;
	uint64_t jump_address;
	if (!line || !line_address || !jump_address)
		return -1;
	line_address = uint64_from_hex_address (line_address_hex);
	jump_address = uint64_from_hex_address (jump_address_hex);
	return graphic_push_jump (line, line_address, jump_address);
}
static int
parse_ret (unsigned char *line, unsigned char *line_address_hex,
		unsigned char *unused1)
{
	uint64_t line_address;
	if (!line || !line_address_hex)
		return -1;
	line_address = uint64_from_hex_address (line_address_hex);
	return graphic_push_ret (line, line_address);
}
static int
parse_ignore (unsigned char *line, unsigned char *unused1,
		unsigned char *unused2)
{
	return 0;
}
static int
parse_section (unsigned char *line, unsigned char *section_name,
		unsigned char *unused1)
{
	if (!line || !section_name)
		return -1;
	return graphic_start_section (section_name);
}
static int
parse_function (unsigned char *line, unsigned char *function_name,
		unsigned char *function_address_hex)
{
	uint64_t function_address;
	if (!line || !function_name || !function_address)
		return -1;
	function_address = uint64_from_hex_address (function_address_hex);
	return graphic_start_function (function_name, function_address);
}
static int
parse_code (unsigned char *line, unsigned char *line_address_hex,
		unsigned char *unused1)
{
	uint64_t line_address;
	if (!line || !line_address_hex)
		return -1;
	line_address = uint64_from_hex_address (line_address_hex);
	return graphic_push_normal_code (line, line_address);
}
static struct parser_func_table_entry {
	unsigned char *name;
	int (*parser_function) (unsigned char *arg1, unsigned char *arg2, unsigned char *arg3);
} function_table[] = {
	{ .name = "condjump",	&parse_condjump,	},
	{ .name = "jump",	&parse_jump,		},
	{ .name = "ret",	&parse_ret,		},
	{ .name = "ignore",	&parse_ignore,		},
	{ .name = "section",	&parse_section,	 	},
	{ .name = "function",	&parse_function,	},
	{ .name = "code",	&parse_code,		},
};
static void *
find_parse_function (unsigned char *name)
{
	int i;
	for (i = 0; i < ARRAY_SIZE (function_table); i++)
		if (strcmp (function_table[i].name, name) == 0)
			return function_table[i].parser_function;
	return NULL;
}
int
parse_line (unsigned char *line, struct arch_parser_table *arch)
{
	unsigned char *arg[NUM_MATCHES];
	int (*parse_function) (unsigned char *, unsigned char *, unsigned char *);
	int ret;
	int i;
	unsigned int num_returns;
	unsigned int returns[NUM_MATCHES];
	while (arch->regexp && arch->type) {
		num_returns = 0;
		/*
		 * First get the backend function for this arch's match
		 */
		parse_function = find_parse_function (arch->type);
		if (!parse_function) {
			fprintf (stderr, "Didn't find parse function for <%s>\n",
					arch->type);
			arch++;
			continue;
		}
		/*
		 * Execute the regex to see if it fires
		 */
		for (i = 0; i < NUM_MATCHES; i++) {
			if (arch->arg[i] != MATCH_UNUSED) {
				returns[i] = arch->arg[i];
				num_returns++;
			} else
				arg[i] = NULL;
		}
		/*
		 * Try to match the regexp.
		 */
		switch (num_returns) {
			case 0:
				ret = try_regexp (arch->regexp, line, num_returns);
				break;
			case 1:
				ret = try_regexp (arch->regexp, line, num_returns,
						returns[0], &arg[0]);
				break;
			case 2:
				ret = try_regexp (arch->regexp, line, num_returns,
						returns[0], &arg[0],
						returns[1], &arg[1]);
				break;
			case 3:
				ret = try_regexp (arch->regexp, line, num_returns,
						returns[0], &arg[0],
						returns[1], &arg[1],
						returns[2], &arg[2]);
				break;
			default:
				fprintf (stderr, "This needs to be modified "
						"for %d returns!!!\n",
						num_returns);
				exit (EXIT_FAILURE);
				break;
		}
		/*
		 * If the regexp fired, the result needs to be dispatched.
		 */
		if (ret == 0) {
			if (NUM_MATCHES != 3) {
				fprintf (stderr, "This needs to be modified "
						"for %d possible matches!!!\n",
						NUM_MATCHES);
				exit (EXIT_FAILURE);
			}
			ret = (*parse_function) (arg[0], arg[1], arg[2]);
			for (i = 0; i < NUM_MATCHES; i++)
				if (arg[i])
					free (arg[i]);
			if (ret == 0)
				return 0;
		}
		arch++;
	}
	return -1;
}
--- NEW FILE: parse_vax.c ---
#include "parse.h"
/*
 *
 *
 * If you add additional codes here, please note them in Whats_Implemented.txt
 *
 *
 */
struct arch_parser_table vax_parser[] = {
	{
		.regexp	= "^.*: file format .*$",
		.type	= "ignore",
		.arg	= { MATCH_UNUSED, MATCH_UNUSED, MATCH_UNUSED, },
	},
	{
		.regexp	= "^$",
		.type	= "ignore",
		.arg	= { MATCH_UNUSED, MATCH_UNUSED, MATCH_UNUSED, },
	},
	{
		.regexp	= "^Disassembly of section ([^:]+):$",
		.type	= "section",
		.arg	= { 0, 1, MATCH_UNUSED, },
	},
	{
		.regexp	= "^[[:space:]]*([[:xdigit:]]+) <([^>]+)>:$",
		.type	= "function",
		.arg	= { 0, 2, 1, },
	},
	{
		.regexp	= "^[[:space:]]*([[:xdigit:]]+):[[:xdigit:][:space:]]+ret$",
		.type	= "ret",
		.arg	= { 0, 1, MATCH_UNUSED, },
	},
	{
		.regexp	= "^[[:space:]]*([[:xdigit:]]+):	[[:xdigit:] ]+	(sobgtr|blbc) [^,]+,([[:xdigit:]]+) <.*>$",
		.type	= "condjump",
		.arg	= { 0, 1, 3, },
	},
	{
		.regexp	= "^[[:space:]]*([[:xdigit:]]+):	[[:xdigit:] ]+	(bbss|bbs|bbc|aoblss|aobleq) [^,]+,[^,]+,([[:xdigit:]]+) <.*>$",
		.type	= "condjump",
		.arg	= { 0, 1, 3, },
	},
	{
		.regexp	= "^[[:space:]]*([[:xdigit:]]+):	[[:xdigit:] ]+	(brb|brw) ([[:xdigit:]]+) <.*>$",
		.type	= "jump",
		.arg	= { 0, 1, 3, },
	},
	{
		.regexp	= "^[[:space:]]*([[:xdigit:]]+):	[[:xdigit:] ]+	(bneq|blss|beql|bleq|bgeq|blequ|bcc|bgtr) ([[:xdigit:]]+) <.*>$",
		.type	= "condjump",
		.arg	= { 0, 1, 3, },
	},
	{
		.regexp	= "^[[:space:]]*([[:xdigit:]]+):[[:space:]]+.*$",
		.type	= "code",
		.arg	= { 0, 1, MATCH_UNUSED, },
	},
	{ },
};
From: Jan-Benedict G. <jb...@us...> - 2005年03月11日 21:24:11
Update of /cvsroot/linux-vax/usr/visualize_asm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20180/visualize_asm
Log Message:
Directory /cvsroot/linux-vax/usr/visualize_asm added to the repository
Update of /cvsroot/linux-vax/usr/firmware_dumper
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9084
Modified Files:
	main.c main.h Makefile 
Added Files:
	backend_alpha.c 
Log Message:
- Alpha support by Peter De Schrijver.
- Works for his Turbochannel based M300.
Index: main.c
===================================================================
RCS file: /cvsroot/linux-vax/usr/firmware_dumper/main.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- main.c	19 Oct 2004 17:58:16 -0000	1.6
+++ main.c	19 Oct 2004 18:00:58 -0000	1.7
@@ -43,6 +43,12 @@
 		.init		= &vax_init,
 		.get_byte	= &vax_get_byte,
 	},
+	{
+		.name		= "alpha",
+		.wordsize	= 64,
+		.init		= &alpha_init,
+		.get_byte	= &alpha_get_byte,
+	},
 };
 
 
--- NEW FILE: backend_alpha.c ---
#include <stdio.h>
#include <string.h>
#include "main.h"
#include <unistd.h>
#include "serial.h"
int
alpha_init (int fd)
{
	unsigned char one_byte;
	int ret;
	serial_send_break (fd, 0);
	do {
		ret = serial_read_byte (fd, &one_byte, 1, 0);
	} while (ret == 0);
	sleep (3);
	do {
		ret = serial_read_byte (fd, &one_byte, 1, 0);
	} while (ret == 0);
	return 0;
}
int
alpha_get_byte (int fd, unsigned char *output, unsigned long long int address)
{
	unsigned char output_buffer[100];
	unsigned char input_buffer[200];
	unsigned char *ptr;
	int ret;
	int input_len = 0;
	sprintf (output_buffer, "EXAMINE -B -PM -U %016llx\r\n", address);
	serial_write (fd, output_buffer, strlen (output_buffer));
	bzero (input_buffer, sizeof (input_buffer));
	do {
		ret = serial_read_byte (fd, &input_buffer[input_len], 1, 0);
		if (ret == 0)
			input_len++;
	} while (ret == 0 && input_len < sizeof (input_buffer) && !strstr (input_buffer, ">>> "));
	if (ret)
		return -1;
	ptr = input_buffer;
	/* Over-read first line */
	while (*ptr != '\n' && *ptr != '\r')
		ptr++;
	while (*ptr == '\n' || *ptr == '\r')
		ptr++;
	ptr++;
	/* Strip leading spaces of second line */
	while (*ptr == ' ')
		ptr++;
	/* Over-read 'P' */
	ptr+=5;
	/* Strip leading spaces of second line */
	while (*ptr == ' ')
		ptr++;
	/* Strip address */
	while (			((*ptr >= '0') && (*ptr <= '9'))
			||	((*ptr >= 'a') && (*ptr <= 'z'))
			||	((*ptr >= 'A') && (*ptr <= 'Z'))
			||	(*ptr == '.'))
		*ptr++;
	/* Strip leading spaces */
	while (*ptr == ' ')
		ptr++;
	/* Now get the byte */
	if (*ptr >= 'A' && *ptr <= 'Z')
		*ptr = *ptr - 'A' + 'a';
	if (*ptr >= '0' && *ptr <= '9')
		*output = *ptr - '0';
	else
		*output = *ptr - 'a' + 10;
	*output <<= 4;
	ptr++;
	if (*ptr >= 'A' && *ptr <= 'Z')
		*ptr = *ptr - 'A' + 'a';
	if (*ptr >= '0' && *ptr <= '9')
		*output |= *ptr - '0';
	else
		*output |= *ptr - 'a' + 10;
	return 0;
}
Index: Makefile
===================================================================
RCS file: /cvsroot/linux-vax/usr/firmware_dumper/Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Makefile	23 Jul 2004 17:44:47 -0000	1.1
+++ Makefile	19 Oct 2004 18:00:58 -0000	1.2
@@ -1,6 +1,7 @@
 #!/usr/bin/make -f
 
 OBJECTS=	main.o		\
+		backend_alpha.o	\
 		backend_vax.o	\
 		serial.o
 
Index: main.h
===================================================================
RCS file: /cvsroot/linux-vax/usr/firmware_dumper/main.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- main.h	19 Oct 2004 17:59:53 -0000	1.2
+++ main.h	19 Oct 2004 18:00:58 -0000	1.3
@@ -4,4 +4,7 @@
 extern int vax_init (int fd);
 extern int vax_get_byte (int fd, unsigned char *output, unsigned long long int address);
 
+extern int alpha_init (int fd);
+extern int alpha_get_byte (int fd, unsigned char *output, unsigned long long int address);
+
 #endif /* _MAIN_H */
From: Jan-Benedict G. <jb...@us...> - 2004年10月19日 18:00:03
Update of /cvsroot/linux-vax/usr/firmware_dumper
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8839
Modified Files:
	main.h 
Log Message:
- There's no fini function for VAX.
Index: main.h
===================================================================
RCS file: /cvsroot/linux-vax/usr/firmware_dumper/main.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- main.h	23 Jul 2004 17:44:47 -0000	1.1
+++ main.h	19 Oct 2004 17:59:53 -0000	1.2
@@ -3,6 +3,5 @@
 
 extern int vax_init (int fd);
 extern int vax_get_byte (int fd, unsigned char *output, unsigned long long int address);
-extern int vax_fini (int fd);
 
 #endif /* _MAIN_H */
From: Jan-Benedict G. <jb...@us...> - 2004年10月19日 17:58:26
Update of /cvsroot/linux-vax/usr/firmware_dumper
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8294
Modified Files:
	main.c 
Log Message:
- In verbose mode, also output a percentage ratio (done/needed).
Index: main.c
===================================================================
RCS file: /cvsroot/linux-vax/usr/firmware_dumper/main.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- main.c	5 Oct 2004 11:49:52 -0000	1.5
+++ main.c	19 Oct 2004 17:58:16 -0000	1.6
@@ -196,7 +196,13 @@
 				return -3;
 			}
 			if (verbose)
-				printf ("[0x%0*llx] = [0x%0*llx+0x%0*x] = 0x%02x\n", target->wordsize / 4, start + i, target->wordsize / 4, start, target->wordsize / 4, i, last_byte);
+				printf ("[0x%0*llx] = [0x%0*llx+0x%0*x] = 0x%02x, %d/%d =%5.1f%%\n",
+						target->wordsize / 4, start + i,
+						target->wordsize / 4, start,
+						target->wordsize / 4, i,
+						last_byte,
+						i+1, len,
+						100.0 * (i+1) / len);
 		}
 	}
 
From: Jan-Benedict G. <jb...@us...> - 2004年10月19日 17:56:03
Update of /cvsroot/linux-vax/usr/firmware_dumper
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7746
Modified Files:
	backend_vax.c 
Log Message:
- My KA660's ROM doesn't sent '>>> ' but '>>>' as a prompt, so don't
 expect the ' ' at all...
Index: backend_vax.c
===================================================================
RCS file: /cvsroot/linux-vax/usr/firmware_dumper/backend_vax.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- backend_vax.c	5 Oct 2004 11:17:07 -0000	1.3
+++ backend_vax.c	19 Oct 2004 17:55:53 -0000	1.4
@@ -39,7 +39,7 @@
 		ret = serial_read_byte (fd, &input_buffer[input_len], 1, 0);
 		if (ret == 0)
 			input_len++;
-	} while (ret == 0 && input_len < sizeof (input_buffer) && !strstr (input_buffer, ">>> "));
+	} while (ret == 0 && input_len < sizeof (input_buffer) && !strstr (input_buffer, ">>>"));
 
 	if (ret)
 		return -1;
From: Jan-Benedict G. <jb...@us...> - 2004年10月05日 11:50:03
Update of /cvsroot/linux-vax/usr/firmware_dumper
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6277
Modified Files:
	main.c 
Log Message:
- Add a missing space.
Index: main.c
===================================================================
RCS file: /cvsroot/linux-vax/usr/firmware_dumper/main.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- main.c	5 Oct 2004 11:29:43 -0000	1.4
+++ main.c	5 Oct 2004 11:49:52 -0000	1.5
@@ -196,7 +196,7 @@
 				return -3;
 			}
 			if (verbose)
-				printf ("[0x%0*llx] = [0x%0*llx+0x%0*x]= 0x%02x\n", target->wordsize / 4, start + i, target->wordsize / 4, start, target->wordsize / 4, i, last_byte);
+				printf ("[0x%0*llx] = [0x%0*llx+0x%0*x] = 0x%02x\n", target->wordsize / 4, start + i, target->wordsize / 4, start, target->wordsize / 4, i, last_byte);
 		}
 	}
 
From: Jan-Benedict G. <jb...@us...> - 2004年10月05日 11:29:53
Update of /cvsroot/linux-vax/usr/firmware_dumper
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1157
Modified Files:
	main.c 
Log Message:
- Add support to continue an aborted dump.
Index: main.c
===================================================================
RCS file: /cvsroot/linux-vax/usr/firmware_dumper/main.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- main.c	30 Sep 2004 21:27:28 -0000	1.3
+++ main.c	5 Oct 2004 11:29:43 -0000	1.4
@@ -16,17 +16,18 @@
 #define FWDUMP_VERSION	"fwdump-0.0.2"
 
 
-#define	DEFAULT_TARGET	"*invalid_target*"
-#define	DEFAULT_DEVICE	"*invalid_device*"
-#define	DEFAULT_SPEED	"9600"
-#define	DEFAULT_BITS	"8"
-#define	DEFAULT_PARITY	"N"
-#define	DEFAULT_STOP	"1"
-#define	DEFAULT_OUTFILE	"rom.dump"
-#define	DEFAULT_START	"0x00000000"
-#define	DEFAULT_LEN	"0"
+#define DEFAULT_TARGET	"*invalid_target*"
+#define DEFAULT_DEVICE	"*invalid_device*"
+#define DEFAULT_SPEED	"9600"
+#define DEFAULT_BITS	"8"
+#define DEFAULT_PARITY	"N"
+#define DEFAULT_STOP	"1"
+#define DEFAULT_OUTFILE	"rom.dump"
+#define DEFAULT_START	"0x00000000"
+#define DEFAULT_LEN	"0"
 #define DEFAULT_SCHEME	"3"
 #define DEFAULT_VERBOSE	0
+#define DEFAULT_APPEND	0
 
 
 static struct backend_descriptor {
@@ -76,6 +77,7 @@
 	fprintf (stderr, "--len nnnn\n");
 	fprintf (stderr, "--scheme n\n");
 	fprintf (stderr, "--verbose\n");
+	fprintf (stderr, "--append\n");
 	fprintf (stderr, "\n");
 	fprintf (stderr, "scheme:");
 	fprintf (stderr, "\t1 - XXXXXXnn (low byte of byte longword)\n");
@@ -142,7 +144,7 @@
 static int
 read_memory (struct backend_descriptor *target, int serial_fd,
 		unsigned char *outfile, unsigned long long start,
-		size_t len, int scheme, int verbose)
+		size_t len, int scheme, int verbose, int append)
 {
 	int outfile_fd;
 	size_t i;
@@ -155,7 +157,8 @@
 		return -1;
 	}
 
-	outfile_fd = open (outfile, O_WRONLY | O_CREAT | O_NOCTTY | O_TRUNC,
+	outfile_fd = open (outfile, O_WRONLY | O_CREAT | O_NOCTTY |
+			(append? O_APPEND: O_TRUNC),
 			S_IRUSR | S_IWUSR | S_IRGRP);
 	if (outfile_fd < 0) {
 		perror ("Failed to open output file");
@@ -226,6 +229,7 @@
 	unsigned char *parity_string = strdup (DEFAULT_PARITY);
 	unsigned char *stop_string = strdup (DEFAULT_STOP);
 	int verbose = DEFAULT_VERBOSE;
+	int append = DEFAULT_APPEND;
 
 	while (1) {
 		int option_index = 0;
@@ -241,10 +245,11 @@
 			{ .name = "help",	.has_arg = no_argument,		.flag = NULL, .val = 'i', },
 			{ .name = "outfile",	.has_arg = required_argument,	.flag = NULL, .val = 'j', },
 			{ .name = "scheme",	.has_arg = required_argument,	.flag = NULL, .val = 'k', },
-			{ .name = "verbose",	.has_arg = no_argument,		.flag = NULL, .val = 'v', },
+			{ .name = "verbose",	.has_arg = no_argument,		.flag = NULL, .val = 'v', },/**/
+			{ .name = "append",	.has_arg = no_argument,		.flag = NULL, .val = 'l', },
 		};
 
-		c = getopt_long (argc, argv, "a:b:c:d:e:f:g:h:iv", long_options, &option_index);
+		c = getopt_long (argc, argv, "a:b:c:d:e:f:g:h:ivl", long_options, &option_index);
 		if (c == -1)
 			break;
 
@@ -322,6 +327,10 @@
 				verbose = 1;
 				break;
 
+			case 'l':
+				append = 1;
+				break;
+
 			case 'i':
 			default:
 				show_help = 1;
@@ -360,7 +369,7 @@
 	ret = read_memory (back, fd, outfile_string,
 			strtoull (start_string, NULL, 0),
 			strtoul (len_string, NULL, 0),
-			atoi (scheme_string), verbose);
+			atoi (scheme_string), verbose, append);
 	if (back->fini)
 		back->fini (fd);
 
From: Jan-Benedict G. <jb...@us...> - 2004年10月05日 11:17:23
Update of /cvsroot/linux-vax/usr/firmware_dumper
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30235
Modified Files:
	backend_vax.c 
Log Message:
- After sending a break, wait some time. Not waiting (and just sending
 the first command) will kill a KA49 so that it directly restarts it's
 whole initialization (like as it was just switched on).
Index: backend_vax.c
===================================================================
RCS file: /cvsroot/linux-vax/usr/firmware_dumper/backend_vax.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- backend_vax.c	23 Jul 2004 17:48:44 -0000	1.2
+++ backend_vax.c	5 Oct 2004 11:17:07 -0000	1.3
@@ -1,6 +1,7 @@
 #include <stdio.h>
 #include <string.h>
 #include "main.h"
+#include <unistd.h>
 #include "serial.h"
 
 int
@@ -13,6 +14,10 @@
 	do {
 		ret = serial_read_byte (fd, &one_byte, 1, 0);
 	} while (ret == 0);
+	sleep (3);
+	do {
+		ret = serial_read_byte (fd, &one_byte, 1, 0);
+	} while (ret == 0);
 
 	return 0;
 }
@@ -29,7 +34,6 @@
 	sprintf (output_buffer, "EXAMINE /B /P /U %08lx\r\n", (unsigned long) address);
 	serial_write (fd, output_buffer, strlen (output_buffer));
 
-
 	bzero (input_buffer, sizeof (input_buffer));
 	do {
 		ret = serial_read_byte (fd, &input_buffer[input_len], 1, 0);
From: Jan-Benedict G. <jb...@us...> - 2004年09月30日 21:27:38
Update of /cvsroot/linux-vax/usr/firmware_dumper
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28414
Modified Files:
	main.c 
Log Message:
- Implement some "verbose" mode.
Index: main.c
===================================================================
RCS file: /cvsroot/linux-vax/usr/firmware_dumper/main.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- main.c	23 Jul 2004 17:48:44 -0000	1.2
+++ main.c	30 Sep 2004 21:27:28 -0000	1.3
@@ -26,6 +26,8 @@
 #define	DEFAULT_START	"0x00000000"
 #define	DEFAULT_LEN	"0"
 #define DEFAULT_SCHEME	"3"
+#define DEFAULT_VERBOSE	0
+
 
 static struct backend_descriptor {
 	unsigned char *name;
@@ -73,6 +75,7 @@
 	fprintf (stderr, "--start 0xNNNNNNNN\n");
 	fprintf (stderr, "--len nnnn\n");
 	fprintf (stderr, "--scheme n\n");
+	fprintf (stderr, "--verbose\n");
 	fprintf (stderr, "\n");
 	fprintf (stderr, "scheme:");
 	fprintf (stderr, "\t1 - XXXXXXnn (low byte of byte longword)\n");
@@ -110,7 +113,7 @@
 
 static int
 read_memory_byte (struct backend_descriptor *target, int serial_fd,
-		int outfile_fd, unsigned long long int address)
+		int outfile_fd, unsigned long long int address, unsigned char *data)
 {
 	int ret1;
 	unsigned char one_byte;
@@ -118,8 +121,8 @@
 
 	ret1 = target->get_byte (serial_fd, &one_byte, address);
 	if (ret1 != 0) {
-		fprintf (stderr, "Failed to read byte at address %lld\n",
-				address);
+		fprintf (stderr, "Failed to read byte at address 0x%0*llx\n",
+				target->wordsize / 4, address);
 		return -1;
 	}
 
@@ -130,18 +133,22 @@
 		return -2;
 	}
 
+	if (data)
+		*data = one_byte;
+
 	return 0;
 }
 
 static int
 read_memory (struct backend_descriptor *target, int serial_fd,
 		unsigned char *outfile, unsigned long long start,
-		size_t len, int scheme)
+		size_t len, int scheme, int verbose)
 {
 	int outfile_fd;
 	size_t i;
 	int ret;
 	int read_this_address;
+	unsigned char last_byte;
 
 	if (scheme < 1 || scheme > 6) {
 		fprintf (stderr, "Don't know how to handle scheme %d\n", scheme);
@@ -179,12 +186,14 @@
 		}
 
 		if (read_this_address) {
-			ret = read_memory_byte (target, serial_fd, outfile_fd, start + i);
+			ret = read_memory_byte (target, serial_fd, outfile_fd, start + i, &last_byte);
 			if (ret != 0) {
-				fprintf (stderr, "Failed to read byte at offset %lld\n",
+				fprintf (stderr, "Failed to read byte at offset 0x%llx\n",
 						(unsigned long long int) i);
 				return -3;
 			}
+			if (verbose)
+				printf ("[0x%0*llx] = [0x%0*llx+0x%0*x]= 0x%02x\n", target->wordsize / 4, start + i, target->wordsize / 4, start, target->wordsize / 4, i, last_byte);
 		}
 	}
 
@@ -211,12 +220,12 @@
 	unsigned char *len_string = strdup (DEFAULT_LEN);
 	unsigned char *outfile_string = strdup (DEFAULT_OUTFILE);
 	unsigned char *scheme_string = strdup (DEFAULT_SCHEME);
-
 	unsigned char *device_string = strdup (DEFAULT_DEVICE);
 	unsigned char *speed_string = strdup (DEFAULT_SPEED);
 	unsigned char *bits_string = strdup (DEFAULT_BITS);
 	unsigned char *parity_string = strdup (DEFAULT_PARITY);
 	unsigned char *stop_string = strdup (DEFAULT_STOP);
+	int verbose = DEFAULT_VERBOSE;
 
 	while (1) {
 		int option_index = 0;
@@ -232,9 +241,10 @@
 			{ .name = "help",	.has_arg = no_argument,		.flag = NULL, .val = 'i', },
 			{ .name = "outfile",	.has_arg = required_argument,	.flag = NULL, .val = 'j', },
 			{ .name = "scheme",	.has_arg = required_argument,	.flag = NULL, .val = 'k', },
+			{ .name = "verbose",	.has_arg = no_argument,		.flag = NULL, .val = 'v', },
 		};
 
-		c = getopt_long (argc, argv, "a:b:c:d:e:f:g:h:i", long_options, &option_index);
+		c = getopt_long (argc, argv, "a:b:c:d:e:f:g:h:iv", long_options, &option_index);
 		if (c == -1)
 			break;
 
@@ -308,6 +318,10 @@
 				}
 				break;
 
+			case 'v':
+				verbose = 1;
+				break;
+
 			case 'i':
 			default:
 				show_help = 1;
@@ -346,7 +360,7 @@
 	ret = read_memory (back, fd, outfile_string,
 			strtoull (start_string, NULL, 0),
 			strtoul (len_string, NULL, 0),
-			atoi (scheme_string));
+			atoi (scheme_string), verbose);
 	if (back->fini)
 		back->fini (fd);
 
From: Jan-Benedict G. <jb...@us...> - 2004年09月30日 18:05:49
Update of /cvsroot/linux-vax/usr/firmware_dumper
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20161
Modified Files:
	serial.c serial.h 
Log Message:
- KA49 crashes if I send multiple bytes down to it, while not fetching
 their echo off the machine. So here are helper functions to support
 that.
Index: serial.c
===================================================================
RCS file: /cvsroot/linux-vax/usr/firmware_dumper/serial.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- serial.c	23 Jul 2004 17:44:47 -0000	1.1
+++ serial.c	30 Sep 2004 18:05:39 -0000	1.2
@@ -303,6 +303,24 @@
 	return 0;
 }
 
+int
+serial_write_byte_rb (int fd, unsigned char byte)
+{
+	ssize_t ret;
+	int ret2;
+	unsigned char readback_byte;
+
+	ret = write (fd, &byte, 1);
+	if (ret != 1)
+		return -1;
+
+	ret2 = serial_read_byte (fd, &readback_byte, 1, 0);
+	if (ret2 != 0)
+		return -2;
+	else
+		return 0;
+}
+
 size_t
 serial_write (int fd, unsigned char *buf, size_t len)
 {
@@ -336,6 +354,24 @@
 	return 0;
 }
 
+size_t
+serial_write_rb (int fd, unsigned char *buf, size_t len)
+{
+	int i;
+	size_t written = 0;
+	int ret;
+
+	for (i = 0; i < len; i++) {
+		ret = serial_write_byte_rb (fd, buf[i]);
+		if (ret == 0)
+			written++;
+		else
+			break;
+	}
+
+	return len - written;
+}
+
 int
 serial_read_byte (int fd, unsigned char *byte, time_t sec, suseconds_t usec)
 {
Index: serial.h
===================================================================
RCS file: /cvsroot/linux-vax/usr/firmware_dumper/serial.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- serial.h	23 Jul 2004 17:44:47 -0000	1.1
+++ serial.h	30 Sep 2004 18:05:39 -0000	1.2
@@ -25,7 +25,9 @@
 extern int	serial_set_stop (int fd, unsigned char stop);
 extern int	serial_set_one_byte_each (int fd);
 extern int	serial_write_byte (int fd, unsigned char byte);
+extern int	serial_write_byte_rb (int fd, unsigned char byte); /* with readback */
 extern size_t	serial_write (int fd, unsigned char *buf, size_t len); /* returning remaining byte # not sent */
+extern size_t	serial_write_rb (int fd, unsigned char *buf, size_t len); /* returning remaining byte # not sent, with readback */
 extern int	serial_read_byte (int fd, unsigned char *byte, time_t sec,
 				suseconds_t usec);
 extern int	serial_get_modem (int fd, int what, int *result);
From: Jan-Benedict G. <jb...@us...> - 2004年07月23日 17:48:58
Update of /cvsroot/linux-vax/usr/firmware_dumper
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20916
Modified Files:
	backend_vax.c main.c 
Log Message:
- No need to put a fini function for VAX, so omit it...
Index: backend_vax.c
===================================================================
RCS file: /cvsroot/linux-vax/usr/firmware_dumper/backend_vax.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- backend_vax.c	23 Jul 2004 17:44:47 -0000	1.1
+++ backend_vax.c	23 Jul 2004 17:48:44 -0000	1.2
@@ -90,9 +90,3 @@
 	return 0;
 }
 
-int
-vax_fini (int fd)
-{
-	return 0;
-}
-
Index: main.c
===================================================================
RCS file: /cvsroot/linux-vax/usr/firmware_dumper/main.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- main.c	23 Jul 2004 17:44:47 -0000	1.1
+++ main.c	23 Jul 2004 17:48:44 -0000	1.2
@@ -39,7 +39,6 @@
 		.wordsize	= 32,
 		.init		= &vax_init,
 		.get_byte	= &vax_get_byte,
-		.fini		= &vax_fini,
 	},
 };
 
Update of /cvsroot/linux-vax/usr/firmware_dumper
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20302
Added Files:
	Makefile README backend_vax.c main.c main.h serial.c serial.h 
Log Message:
- This is my firmware dumper, a nice hack to read out ROM areas.
--- NEW FILE: backend_vax.c ---
#include <stdio.h>
#include <string.h>
#include "main.h"
#include "serial.h"
int
vax_init (int fd)
{
	unsigned char one_byte;
	int ret;
	serial_send_break (fd, 0);
	do {
		ret = serial_read_byte (fd, &one_byte, 1, 0);
	} while (ret == 0);
	return 0;
}
int
vax_get_byte (int fd, unsigned char *output, unsigned long long int address)
{
	unsigned char output_buffer[100];
	unsigned char input_buffer[200];
	unsigned char *ptr;
	int ret;
	int input_len = 0;
	sprintf (output_buffer, "EXAMINE /B /P /U %08lx\r\n", (unsigned long) address);
	serial_write (fd, output_buffer, strlen (output_buffer));
	bzero (input_buffer, sizeof (input_buffer));
	do {
		ret = serial_read_byte (fd, &input_buffer[input_len], 1, 0);
		if (ret == 0)
			input_len++;
	} while (ret == 0 && input_len < sizeof (input_buffer) && !strstr (input_buffer, ">>> "));
	if (ret)
		return -1;
	ptr = input_buffer;
	/* Over-read first line */
	while (*ptr != '\n' && *ptr != '\r')
		ptr++;
	while (*ptr == '\n' || *ptr == '\r')
		ptr++;
	ptr++;
	/* Strip leading spaces of second line */
	while (*ptr == ' ')
		ptr++;
	/* Over-read 'P' */
	ptr++;
	/* Strip leading spaces of second line */
	while (*ptr == ' ')
		ptr++;
	/* Strip address */
	while (			((*ptr >= '0') && (*ptr <= '9'))
			||	((*ptr >= 'a') && (*ptr <= 'z'))
			||	((*ptr >= 'A') && (*ptr <= 'Z')))
		*ptr++;
	/* Strip leading spaces */
	while (*ptr == ' ')
		ptr++;
	/* Now get the byte */
	if (*ptr >= 'A' && *ptr <= 'Z')
		*ptr = *ptr - 'A' + 'a';
	if (*ptr >= '0' && *ptr <= '9')
		*output = *ptr - '0';
	else
		*output = *ptr - 'a' + 10;
	*output <<= 4;
	ptr++;
	if (*ptr >= 'A' && *ptr <= 'Z')
		*ptr = *ptr - 'A' + 'a';
	if (*ptr >= '0' && *ptr <= '9')
		*output |= *ptr - '0';
	else
		*output |= *ptr - 'a' + 10;
	return 0;
}
int
vax_fini (int fd)
{
	return 0;
}
--- NEW FILE: serial.c ---
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <termios.h>
#include <time.h>
#include <unistd.h>
#include <sys/select.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include "serial.h"
int
serial_open (unsigned char *devname)
{
	int fd;
	fd = open (devname, O_RDWR | O_NOCTTY | O_NONBLOCK);
	if (fd < 0)
		return -1;
	return fd;
}
int
serial_close (int fd)
{
	close (fd);
	return 0;
}
int
serial_set_bits (int fd, unsigned char bits)
{
	struct termios termios;
	int termios_bits;
	int ret;
	ret = tcgetattr (fd, &termios);
	if (ret != 0)
		return -1;
	termios.c_cflag = termios.c_cflag & ~CSIZE;
	switch (bits) {
		case 5:
			termios_bits = CS5;
			break;
		case 6:
			termios_bits = CS6;
			break;
		case 7:
			termios_bits = CS7;
			break;
		case 8:
			termios_bits = CS8;
			break;
		default:
			termios_bits = CS8;
			break;
	}
	termios.c_cflag |= termios_bits;
	ret = tcsetattr (fd, TCSANOW, &termios);
	if (ret != 0)
		return -2;
	return 0;
}
int
serial_set_parity (int fd, unsigned char parity)
{
	struct termios termios;
	int ret;
	ret = tcgetattr (fd, &termios);
	if (ret != 0)
		return -1;
	switch (parity) {
		case 'E':
		case 'e':
			termios.c_cflag &= ~PARODD;
			termios.c_cflag |= PARENB;
			break;
		case 'O':
		case 'o':
			termios.c_cflag |= ~PARODD;
			termios.c_cflag |= PARENB;
			break;
		case 'N':
		case 'n':
			termios.c_cflag &= ~PARODD;
			termios.c_cflag &= ~PARENB;
			break;
		default:
			termios.c_cflag &= ~PARODD;
			termios.c_cflag &= ~PARENB;
			break;
	}
	ret = tcsetattr (fd, TCSANOW, &termios);
	if (ret != 0)
		return -2;
	return 0;
}
int
serial_set_stop (int fd, unsigned char stop)
{
	struct termios termios;
	int ret;
	ret = tcgetattr (fd, &termios);
	if (ret != 0)
		return -1;
	switch (stop) {
		case 1:
			termios.c_cflag &= ~CSTOPB;
			break;
		case 2: 
			termios.c_cflag |= CSTOPB;
			break;
		default:
			termios.c_cflag &= ~CSTOPB;
			break;
	}
	ret = tcsetattr (fd, TCSANOW, &termios);
	if (ret != 0)
		return -2;
	return 0;
}
int
serial_set_one_byte_each (int fd)
{
	struct termios termios;
	int ret;
	ret = tcgetattr (fd, &termios);
	if (ret != 0)
		return -1;
	termios.c_iflag |= IGNPAR;	/* Ignore bytes with parity errors */
	termios.c_cflag |= CLOCAL;	/* No modem control lines */
	termios.c_cflag |= CREAD;	/* Enable serial receiver */
	termios.c_cflag &= ~CRTSCTS;	/* Disable handshake */
	termios.c_oflag = 0;		/* Raw output */
	termios.c_lflag = 0;		/* Raw local handling */
	termios.c_cc[VTIME] = 0;	/* Inter-character timer unused */
	termios.c_cc[VMIN] = 1;		/* One byte per read */
	
	ret = tcsetattr (fd, TCSANOW, &termios);
	if (ret != 0)
		return -2;
	return 0;
}
int
serial_set_speed (int fd, unsigned int speed)
{
	struct termios termios;
	unsigned int termios_speed;
	int ret;
	ret = tcgetattr (fd, &termios);
	if (ret != 0)
		return -1;
	termios.c_cflag = termios.c_cflag & ~CBAUD;
	termios.c_cflag = termios.c_cflag & ~CBAUDEX;
	switch (speed) {
#ifdef B0
		case 0:		termios_speed = B0;		break;
#endif
#ifdef B50
		case 50:	termios_speed = B50;		break;
#endif
#ifdef B75
		case 75:	termios_speed = B75;		break;
#endif
#ifdef B110
		case 110:	termios_speed = B110;		break;
#endif
#ifdef B134
		case 134:	termios_speed = B134;		break;
#endif
#ifdef B150
		case 150:	termios_speed = B150;		break;
#endif
#ifdef B200
		case 200:	termios_speed = B200;		break;
#endif
#ifdef B300
		case 300:	termios_speed = B300;		break;
#endif
#ifdef B600
		case 600:	termios_speed = B600;		break;
#endif
#ifdef B1200
		case 1200:	termios_speed = B1200;		break;
#endif
#ifdef B1800
		case 1800:	termios_speed = B1800;		break;
#endif
#ifdef B2400
		case 2400:	termios_speed = B2400;		break;
#endif
#ifdef B4800
		case 4800:	termios_speed = B4800;		break;
#endif
#ifdef B9600
		case 9600:	termios_speed = B9600;		break;
#endif
#ifdef B19200
		case 19200:	termios_speed = B19200;		break;
#endif
#ifdef B38400
		case 38400:	termios_speed = B38400;		break;
#endif
#ifdef B57600
		case 57600:	termios_speed = B57600;		break;
#endif
#ifdef B115200
		case 115200:	termios_speed = B115200;	break;
#endif
#ifdef B230400
		case 230400:	termios_speed = B230400;	break;
#endif
#ifdef B460800
		case 460800:	termios_speed = B460800;	break;
#endif
#ifdef B5000000
		case 500000:	termios_speed = B500000;	break;
#endif
#ifdef B576000
		case 576000:	termios_speed = B576000;	break;
#endif
#ifdef B921600
		case 921600:	termios_speed = B921600;	break;
#endif
#ifdef B1000000
		case 1000000:	termios_speed = B1000000;	break;
#endif
#ifdef B1152000
		case 1152000:	termios_speed = B1152000;	break;
#endif
#ifdef B1500000
		case 1500000:	termios_speed = B1500000;	break;
#endif
#ifdef B2000000
		case 2000000:	termios_speed = B2000000;	break;
#endif
#ifdef B2500000
		case 2500000:	termios_speed = B2500000;	break;
#endif
#ifdef B3000000
		case 3000000:	termios_speed = B3000000;	break;
#endif
#ifdef B3500000
		case 3500000:	termios_speed = B3500000;	break;
#endif
#ifdef B4000000
		case 4000000:	termios_speed = B4000000;	break;
#endif
		default:
				termios_speed = B9600;
				break;
	}
	termios.c_cflag |= termios_speed;
	ret = tcsetattr (fd, TCSANOW, &termios);
	if (ret != 0)
		return -2;
	return 0;
}
int
serial_write_byte (int fd, unsigned char byte)
{
	ssize_t ret;
	ret = write (fd, &byte, 1);
	if (ret != 1)
		return -1;
	return 0;
}
size_t
serial_write (int fd, unsigned char *buf, size_t len)
{
	ssize_t ret;
	size_t written = 0;
	int errcount = 0;
	while (written < len) {
		ret = write (fd, buf + written, len - written);
		if (ret >= 0) {
			written += ret;
			errcount = 0;
		} else {
			switch (errno) {
				/* "Soft" errors allow retransmission */
				case EINTR:
				case ENOSPC:
				case EAGAIN:
					if (errcount++ > 200)
						return len - written;
					break;
				/* Anything else is considered fatal */
				default:
					return len - written;
					break;
			}
		}
	}
	return 0;
}
int
serial_read_byte (int fd, unsigned char *byte, time_t sec, suseconds_t usec)
{
	struct timeval timeout;
	fd_set read_set;
	unsigned char my_byte;
	int ret;
	ssize_t len;
	timeout.tv_sec = sec;
	timeout.tv_usec = usec;
	FD_ZERO (&read_set);
	FD_SET (fd, &read_set);
	ret = select (fd + 1, &read_set, NULL, NULL, &timeout);
	if (ret > 0) {
		len = read (fd, &my_byte, 1);
		if (len == 1) {
			*byte = my_byte;
			return 0;
		} else
			return -1;
	} else
		return -2;
}
int
serial_set_line_parameters (int fd, unsigned int speed, unsigned char bits,
		unsigned char parity, unsigned char stop)
{
	int ret;
	ret = serial_set_speed (fd, speed);
	if (ret != 0)
		return -1;
	ret = serial_set_bits (fd, bits);
	if (ret != 0)
		return -2;
	ret = serial_set_parity (fd, parity);
	if (ret != 0)
		return -3;
	ret = serial_set_stop (fd, stop);
	if (ret != 0)
		return -4;
	return 0;
}
int
serial_open_luxury (unsigned char *device, unsigned int speed,
		unsigned char bits, unsigned char parity, unsigned char stop)
{
	int fd;
	int ret;
	fd = serial_open (device);
	if (fd < 0)
		return -1;
	ret = serial_set_line_parameters (fd, speed, bits, parity, stop);
	if (ret != 0) {
		close (fd);
		return -2;
	}
	ret = serial_set_one_byte_each (fd);
	if (ret != 0) {
		close (fd);
		return -3;
	}
	return fd;
}
int
serial_get_modem (int fd, int what, int *result)
{
	int ret;
	int status;
	status = what;
	ret = ioctl (fd, TIOCMGET, &status);
	if (ret == 0) {
		*result = status;
		return 0;
	} else
		return -1;
}
int
serial_set_modem (int fd, int what, int state)
{
	int ret;
	int old_state;
	int new_state;
	ret = ioctl (fd, TIOCMGET, &old_state);
	if (ret != 0)
		return -1;
	if (state)
		new_state = old_state | what;
	else
		new_state = old_state & ~what;
	ret = ioctl (fd, TIOCMSET, &new_state);
	if (ret != 0)
		return -1;
	return 0;
}
int
serial_send_break (int fd, int duration)
{
	return tcsendbreak (fd, duration);
}
--- NEW FILE: main.h ---
#ifndef _MAIN_H
#define _MAIN_H
extern int vax_init (int fd);
extern int vax_get_byte (int fd, unsigned char *output, unsigned long long int address);
extern int vax_fini (int fd);
#endif /* _MAIN_H */
--- NEW FILE: README ---
This is a firmware dumper, designed to make use of firmware examine
functionality available over a serial console.
Currently, only the VAX backend is implemented, but it should be simple
to add more backends. Just look into the backend_vax.c file. Other memory
access schemes are also simple to implement, just look at the scheduler in
main.c.
This software is subject to the terms of the GNU General Public License,
Version 2 or any later version, at your opinion.
(C)opyright 2004 by Jan-Benedict Glaw <jb...@lu...>
EXAMPLE:
~~~~~~~~
$ ./dumper --target vax --device /dev/ttyS1 --speed 9600 --bits 8 --parity N \
	--stop 1 --outfile LCG-ROM.image --start 0x20140000 --len 0x40000 \
	--scheme 1
This'll dump the LCG ROM of a VAXstation 4000m60. The machine is attached to
/dev/ttyS1, uses 9k6 8N1. The LCG ROM starts at address 0x20140000 and is
addressed with scheme 1 (that is, only the low byte of a longword is used).
Thus, we need a length to read of 0x40000 (that is the memory length; the
ROM itself is only 1/4 of it in size).
$ ./dumper --help
./dumper -- read area of memory through firmware
--target xxx
--device /dev/ttySn
--speed nnnn
--bits {5,6,7,8}
--parity {E,O,N}
--stop {1,2}
--outfile xxxx
--start 0xNNNNNNNN
--len nnnn
--scheme n
scheme: 1 - XXXXXXnn (low byte of byte longword)
 2 - XXXXnnnn (low word of 4 byte longword)
 3 - nnnnnnnn (full 4 byte longwords)
 4 - XXXXXXXXXXXXXXnn (low byte of 8 byte longword)
 5 - XXXXXXXXXXXXnnnn (low word of 8 byte longword)
 6 - XXXXXXXXnnnnnnnn (low 4 byte longword of 8 byte longword)
--- NEW FILE: Makefile ---
#!/usr/bin/make -f
OBJECTS=	main.o		\
		backend_vax.o	\
		serial.o
all:	dumper
clean:
	-rm -f $(OBJECTS) dumper rom.dump a.out core
.c.o:
	gcc -Wall -Werror -g -c $*.c
dumper:	$(OBJECTS)
	gcc -Wall -Werror -g -o dumper $(OBJECTS)
strip: dumper
	strip dumper
--- NEW FILE: main.c ---
#include <fcntl.h>
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "serial.h"
#include "main.h"
#ifndef ARRAY_SIZE
# define ARRAY_SIZE(x)	((sizeof (x))/(sizeof ((x)[0])))
#endif
#define FWDUMP_VERSION	"fwdump-0.0.2"
#define	DEFAULT_TARGET	"*invalid_target*"
#define	DEFAULT_DEVICE	"*invalid_device*"
#define	DEFAULT_SPEED	"9600"
#define	DEFAULT_BITS	"8"
#define	DEFAULT_PARITY	"N"
#define	DEFAULT_STOP	"1"
#define	DEFAULT_OUTFILE	"rom.dump"
#define	DEFAULT_START	"0x00000000"
#define	DEFAULT_LEN	"0"
#define DEFAULT_SCHEME	"3"
static struct backend_descriptor {
	unsigned char *name;
	int (*init) (int fd);
	int (*get_byte) (int fd, unsigned char *output, unsigned long long int address);
	int (*fini) (int fd);
	int wordsize;
} backend[] = {
	{
		.name		= "vax",
		.wordsize	= 32,
		.init		= &vax_init,
		.get_byte	= &vax_get_byte,
		.fini		= &vax_fini,
	},
};
struct backend_descriptor *
get_backend (unsigned char *name)
{
	int i;
	for (i = 0; i < ARRAY_SIZE (backend); i++)
		if (strcmp (name, backend[i].name) == 0)
			return &backend[i];
	return NULL;
}
static void
help (unsigned char *program_name)
{
	int i;
	fprintf (stderr, "Firmware dumper: %s\n", FWDUMP_VERSION);
	fprintf (stderr, "%s -- read area of memory through firmware\n", program_name);
	fprintf (stderr, "\n");
	fprintf (stderr, "--target xxx\n");
	fprintf (stderr, "--device /dev/ttySn\n");
	fprintf (stderr, "--speed nnnn\n");
	fprintf (stderr, "--bits {5,6,7,8}\n");
	fprintf (stderr, "--parity {E,O,N}\n");
	fprintf (stderr, "--stop {1,2}\n");
	fprintf (stderr, "--outfile xxxx\n");
	fprintf (stderr, "--start 0xNNNNNNNN\n");
	fprintf (stderr, "--len nnnn\n");
	fprintf (stderr, "--scheme n\n");
	fprintf (stderr, "\n");
	fprintf (stderr, "scheme:");
	fprintf (stderr, "\t1 - XXXXXXnn (low byte of byte longword)\n");
	fprintf (stderr, "\t2 - XXXXnnnn (low word of 4 byte longword)\n");
	fprintf (stderr, "\t3 - nnnnnnnn (full 4 byte longwords)\n");
	fprintf (stderr, "\t4 - XXXXXXXXXXXXXXnn (low byte of 8 byte longword)\n");
	fprintf (stderr, "\t5 - XXXXXXXXXXXXnnnn (low word of 8 byte longword)\n");
	fprintf (stderr, "\t6 - XXXXXXXXnnnnnnnn (low 4 byte longword of 8 byte longword)\n");
	fprintf (stderr, "\n");
	fprintf (stderr, "backends:\t");
	for (i = 0; i < ARRAY_SIZE (backend); i++) {
		if (i == 0)
			fprintf (stderr, "%s\n", backend[i].name);
		else
			fprintf (stderr, "\t\t%s\n", backend[i].name);
	}
	exit (EXIT_FAILURE);
}
static int
set_option (unsigned char **store, char *option)
{
	if (*store) {
		free (*store);
		*store = NULL;
	}
	printf ("Processing option \"%s\"\n", option);
	*store = strdup (option);
	return (*store == NULL)? -1: 0;
}
static int
read_memory_byte (struct backend_descriptor *target, int serial_fd,
		int outfile_fd, unsigned long long int address)
{
	int ret1;
	unsigned char one_byte;
	ssize_t ret2;
	ret1 = target->get_byte (serial_fd, &one_byte, address);
	if (ret1 != 0) {
		fprintf (stderr, "Failed to read byte at address %lld\n",
				address);
		return -1;
	}
	ret2 = write (outfile_fd, &one_byte, sizeof (one_byte));
	if (ret2 != sizeof (one_byte)) {
		fprintf (stderr, "Failed to write byte at address %lld\n",
				address);
		return -2;
	}
	return 0;
}
static int
read_memory (struct backend_descriptor *target, int serial_fd,
		unsigned char *outfile, unsigned long long start,
		size_t len, int scheme)
{
	int outfile_fd;
	size_t i;
	int ret;
	int read_this_address;
	if (scheme < 1 || scheme > 6) {
		fprintf (stderr, "Don't know how to handle scheme %d\n", scheme);
		return -1;
	}
	outfile_fd = open (outfile, O_WRONLY | O_CREAT | O_NOCTTY | O_TRUNC,
			S_IRUSR | S_IWUSR | S_IRGRP);
	if (outfile_fd < 0) {
		perror ("Failed to open output file");
		return -2;
	}
	for (i = 0; i < len; i++) {
		read_this_address = 0;
		switch (scheme) {
			case 1:
				if (i % 4 == 0)
					read_this_address = 1; break;
			case 2:
				if (i % 4 == 0 || i % 4 == 1)
					read_this_address = 1; break;
			case 3:
				read_this_address = 1; break;
			case 4:
				if (i % 8 == 0)
					read_this_address = 1; break;
			case 5:
				if (i % 8 == 0 || i % 8 == 1)
					read_this_address = 1; break;
			case 6:
				if (i % 8 == 0 || i % 8 == 1 || i % 8 == 2 || i % 8 == 3)
					read_this_address = 1; break;
		}
		if (read_this_address) {
			ret = read_memory_byte (target, serial_fd, outfile_fd, start + i);
			if (ret != 0) {
				fprintf (stderr, "Failed to read byte at offset %lld\n",
						(unsigned long long int) i);
				return -3;
			}
		}
	}
	close (outfile_fd);
	return 0;
}
int
main (int argc, char *argv[])
{
	/* Variables we work with */
	struct backend_descriptor *back;
	int fd;
	int ret;
	int c;
	int show_help = 0;
	
	/* Variables the user supplied */
	unsigned char *target_string = strdup (DEFAULT_TARGET);
	unsigned char *start_string = strdup (DEFAULT_START);
	unsigned char *len_string = strdup (DEFAULT_LEN);
	unsigned char *outfile_string = strdup (DEFAULT_OUTFILE);
	unsigned char *scheme_string = strdup (DEFAULT_SCHEME);
	unsigned char *device_string = strdup (DEFAULT_DEVICE);
	unsigned char *speed_string = strdup (DEFAULT_SPEED);
	unsigned char *bits_string = strdup (DEFAULT_BITS);
	unsigned char *parity_string = strdup (DEFAULT_PARITY);
	unsigned char *stop_string = strdup (DEFAULT_STOP);
	while (1) {
		int option_index = 0;
		static struct option long_options[] = {
			{ .name	= "target",	.has_arg = required_argument,	.flag = NULL, .val = 'a', },
			{ .name	= "start",	.has_arg = required_argument,	.flag = NULL, .val = 'b', },
			{ .name	= "len",	.has_arg = required_argument,	.flag = NULL, .val = 'c', },
			{ .name = "device",	.has_arg = required_argument,	.flag = NULL, .val = 'd', },
			{ .name = "speed",	.has_arg = required_argument,	.flag = NULL, .val = 'e', },
			{ .name = "bits",	.has_arg = required_argument,	.flag = NULL, .val = 'f', },
			{ .name = "parity",	.has_arg = required_argument,	.flag = NULL, .val = 'g', },
			{ .name = "stop",	.has_arg = required_argument,	.flag = NULL, .val = 'h', },
			{ .name = "help",	.has_arg = no_argument,		.flag = NULL, .val = 'i', },
			{ .name = "outfile",	.has_arg = required_argument,	.flag = NULL, .val = 'j', },
			{ .name = "scheme",	.has_arg = required_argument,	.flag = NULL, .val = 'k', },
		};
		c = getopt_long (argc, argv, "a:b:c:d:e:f:g:h:i", long_options, &option_index);
		if (c == -1)
			break;
		switch (c) {
			case 'a':
				if (set_option (&target_string, optarg)) {
					fprintf (stderr, "Failed to set target\n");
					exit (EXIT_FAILURE);
				}
				break;
			case 'b':
				if (set_option (&start_string, optarg)) {
					fprintf (stderr, "Failed to set start address\n");
					exit (EXIT_FAILURE);
				}
				break;
			case 'c':
				if (set_option (&len_string, optarg)) {
					fprintf (stderr, "Failed to set len to dump\n");
					exit (EXIT_FAILURE);
				}
				break;
			case 'd':
				if (set_option (&device_string, optarg)) {
					fprintf (stderr, "Failed to set device name\n");
					exit (EXIT_FAILURE);
				}
				break;
			case 'e':
				if (set_option (&speed_string, optarg)) {
					fprintf (stderr, "Failed to set speed\n");
					exit (EXIT_FAILURE);
				}
				break;
			case 'f':
				if (set_option (&bits_string, optarg)) {
					fprintf (stderr, "Failed to set number of bits\n");
					exit (EXIT_FAILURE);
				}
				break;
			case 'g':
				if (set_option (&parity_string, optarg)) {
					fprintf (stderr, "Failed to set parity\n");
					exit (EXIT_FAILURE);
				}
				break;
			case 'h':
				if (set_option (&stop_string, optarg)) {
					fprintf (stderr, "Failed to set number of stop-bits\n");
					exit (EXIT_FAILURE);
				}
				break;
			case 'j':
				if (set_option (&outfile_string, optarg)) {
					fprintf (stderr, "Failed to set name of output file\n");
					exit (EXIT_FAILURE);
				}
				break;
			case 'k':
				if (set_option (&scheme_string, optarg)) {
					fprintf (stderr, "Failed to set byte gathering scheme\n");
					exit (EXIT_FAILURE);
				}
				break;
			case 'i':
			default:
				show_help = 1;
				break;
		}
	}
	if (show_help) {
		help (argv[0]);
		return EXIT_FAILURE;
	}
	back = get_backend (target_string);
	if (!back) {
		fprintf (stderr, "Didn't find target \"%s\"\n", target_string);
		return EXIT_FAILURE;
	}
	fd = serial_open_luxury (
			device_string,
			atoi (speed_string),
			atoi (bits_string),
			(parity_string && parity_string[0])?
				*parity_string:
				DEFAULT_PARITY[0],
			atoi (stop_string));
	if (fd < 0) {
		fprintf (stderr, "Failed to open serial interface \"%s\"\n",
				device_string);
		exit (EXIT_FAILURE);
	}
	if (back->init)
		back->init (fd);
	ret = read_memory (back, fd, outfile_string,
			strtoull (start_string, NULL, 0),
			strtoul (len_string, NULL, 0),
			atoi (scheme_string));
	if (back->fini)
		back->fini (fd);
	if (ret != 0) {
		fprintf (stderr, "Failed to read memory\n");
		close (fd);
		return EXIT_FAILURE;
	}
	close (fd);
	return EXIT_SUCCESS;
}
--- NEW FILE: serial.h ---
#ifndef _SERIAL_H
#define _SERIAL_H
#include <sys/types.h>
#include <sys/ioctl.h>
#define SER_STX	0x02
#define SER_ETX	0x03
#define SER_EOT	0x04
#define SER_ENQ 0x05
#define SER_ACK	0x06
#define SER_DLE	0x10
#define SER_NAK	0x15
#define SER_ETB	0x17
#define SER_RS	0x1e
extern int	serial_open (unsigned char *device);
extern int	serial_open_luxury (unsigned char *device, unsigned int speed,
				unsigned char bits, unsigned char parity,
				unsigned char stop);
extern int	serial_close (int fd);
extern int	serial_set_speed (int fd, unsigned int speed);
extern int	serial_set_bits (int fd, unsigned char bits);
extern int	serial_set_parity (int fd, unsigned char parity);
extern int	serial_set_stop (int fd, unsigned char stop);
extern int	serial_set_one_byte_each (int fd);
extern int	serial_write_byte (int fd, unsigned char byte);
extern size_t	serial_write (int fd, unsigned char *buf, size_t len); /* returning remaining byte # not sent */
extern int	serial_read_byte (int fd, unsigned char *byte, time_t sec,
				suseconds_t usec);
extern int	serial_get_modem (int fd, int what, int *result);
extern int	serial_set_modem (int fd, int what, int state);
extern int	serial_send_break (int fd, int duration);
#endif /* _SERIAL_H */
From: Jan-Benedict G. <jb...@us...> - 2004年07月23日 17:43:23
Update of /cvsroot/linux-vax/usr/firmware_dumper
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20158/firmware_dumper
Log Message:
Directory /cvsroot/linux-vax/usr/firmware_dumper added to the repository
From: Jan-Benedict G. <jb...@lu...> - 2004年03月01日 13:30:45
On Sat, 2004年02月28日 23:44:28 -0800, ai...@us... <airlied@u=
sers.sourceforge.net>
wrote in message <E1A...@sc...>:
> Update of /cvsroot/linux-vax/glibc/sysdeps/vax
> Modified Files:
> 	dl-machine.h=20
> Log Message:
> cleanup and pass _dl_fini to the main
Copied into my tree.
MfG, JBG
--=20
 Jan-Benedict Glaw jb...@lu... . +49-172-7608481
 "Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg
 fuer einen Freien Staat voll Freier B=FCrger" | im Internet! | im Ira=
k!
 ret =3D do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TC=
PA));
From: Jan-Benedict G. <jb...@lu...> - 2004年03月01日 13:27:48
On Sat, 2004年02月28日 23:44:28 -0800, ai...@us... <airlied@u=
sers.sourceforge.net>
wrote in message <E1A...@sc...>:
> Update of /cvsroot/linux-vax/glibc/sysdeps/vax/elf
> Modified Files:
> 	start.S=20
> Log Message:
> cleanup and pass _dl_fini to the main
Copied into my tree, but...
> RCS file: /cvsroot/linux-vax/glibc/sysdeps/vax/elf/start.S,v
> retrieving revision 1.6
> retrieving revision 1.7
> diff -u -d -r1.6 -r1.7
> --- start.S	26 Feb 2004 11:35:35 -0000	1.6
> +++ start.S	29 Feb 2004 07:44:26 -0000	1.7
> @@ -32,7 +32,7 @@
> 	/* start to load the arguments from the stack */
> 	/* arguments are on ap stack */
> 	pushl %sp
> -	pushl 0ドル
> +	pushl %r5
> 	pushl $_fini
This is "pushl 0ドル" in glibc-current
> 	pushl $_init
This is "pushl 0ドル", too!
> 	pushl %r3
MfG, JBG
--=20
 Jan-Benedict Glaw jb...@lu... . +49-172-7608481
 "Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg
 fuer einen Freien Staat voll Freier B=FCrger" | im Internet! | im Ira=
k!
 ret =3D do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TC=
PA));
From: Jan-Benedict G. <jb...@lu...> - 2004年03月01日 13:25:36
On Sat, 2004年02月28日 21:04:57 -0800, ai...@us... <airlied@u=
sers.sourceforge.net>
wrote in message <E1A...@sc...>:
> Update of /cvsroot/linux-vax/glibc/sysdeps/vax
> Modified Files:
> 	dl-machine.h=20
> Log Message:
> port over resolver entry trampoline from uClibc
Copied into my tree.
MfG, JBG
--=20
 Jan-Benedict Glaw jb...@lu... . +49-172-7608481
 "Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg
 fuer einen Freien Staat voll Freier B=FCrger" | im Internet! | im Ira=
k!
 ret =3D do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TC=
PA));
From: Jan-Benedict G. <jb...@lu...> - 2004年03月01日 13:21:47
On Thu, 2004年02月26日 16:14:23 -0800, ai...@us... <airlied@u=
sers.sourceforge.net>
wrote in message <E1A...@sc...>:
> Update of /cvsroot/linux-vax/glibc/sysdeps/vax/bits
> Modified Files:
> 	setjmp.h=20
> Log Message:
> missing )
Copied into my tree.
MfG, JBG
--=20
 Jan-Benedict Glaw jb...@lu... . +49-172-7608481
 "Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg
 fuer einen Freien Staat voll Freier B=FCrger" | im Internet! | im Ira=
k!
 ret =3D do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TC=
PA));
On Thu, 2004年02月26日 03:35:37 -0800, ai...@us... <airlied@u=
sers.sourceforge.net>
wrote in message <E1A...@sc...>:
> In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3519
> Modified Files:
> 	dl-machine.h=20
> Added Files:
> 	__longjmp.S setjmp.S=20
> Log Message:
> Another batch of linker and setjmp changes
Copied into my tree.
--=20
 Jan-Benedict Glaw jb...@lu... . +49-172-7608481
 "Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg
 fuer einen Freien Staat voll Freier B=FCrger" | im Internet! | im Ira=
k!
 ret =3D do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TC=
PA));
From: Jan-Benedict G. <jb...@lu...> - 2004年03月01日 11:52:25
On Thu, 2004年02月26日 03:35:37 -0800, ai...@us... <airlied@u=
sers.sourceforge.net>
wrote in message <E1A...@sc...>:
> Update of /cvsroot/linux-vax/glibc/sysdeps/vax/bits
> Modified Files:
> 	setjmp.h=20
> Log Message:
> Another batch of linker and setjmp changes
Copied into my tree.
MfG, JBG
--=20
 Jan-Benedict Glaw jb...@lu... . +49-172-7608481
 "Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg
 fuer einen Freien Staat voll Freier B=FCrger" | im Internet! | im Ira=
k!
 ret =3D do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TC=
PA));

Showing results of 75

1 2 3 > >> (Page 1 of 3)
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /