[openfirmware] ppcsim: modernize for ANSI C compilers

Marcin Cieslak saper at saper.info
Thu Nov 5 01:07:52 CET 2015


Index: cpu/ppc/ppcsim/ppcsim.c
===================================================================
--- cpu/ppc/ppcsim/ppcsim.c	(revision 3786)
+++ cpu/ppc/ppcsim/ppcsim.c	(working copy)
@@ -39,6 +39,16 @@
 
 #define ILLEGAL goto illegal
 
+void catch_signals();
+void trace(char *name, u_long instruction, u_long pc);
+int xfindnext(register u_char *adr, 
+    register long strlen,
+    register long base,
+    register u_long link,
+    u_long *alf);
+
+void umtimes(u_long *dhighp, u_long *dlowp, u_long u1, u_long u2);
+
 #ifdef TRACE
 #define INSTR(a)	trace(a, instruction, pc)
 #else
@@ -1832,6 +1842,7 @@
 }
 
 
+void
 umtimes(dhighp, dlowp, u1, u2)
     u_long *dhighp, *dlowp;
     u_long u1, u2;
@@ -1868,6 +1879,7 @@
 
 #ifdef TRACE
 #include <sys/signal.h>
+void
 dumpregs()
 {
 #ifdef ARGREGS
@@ -1916,6 +1928,7 @@
 	printf("\n");
 #endif
 }
+void
 dumpallregs()
 {
         int i;
@@ -1937,6 +1950,8 @@
 	dumpregs();
 	s_bye(1);
 }
+
+void
 catch_signals()
 {
 	signal(SIGINT,handle_signal);
@@ -1950,6 +1965,7 @@
 #endif
 }
 
+void
 dumpmem(adr)
 	long adr;
 {
@@ -1968,9 +1984,12 @@
 #else
 #define GETLINE
 #endif
-trace(name, instruction)
+
+void
+trace(name, instruction, pc)
 	char *name;
 	u_long instruction;
+	u_long pc;
 {
 	int done;
 	int arg;
Index: cpu/ppc/ppcsim/simrom.c
===================================================================
--- cpu/ppc/ppcsim/simrom.c	(revision 3786)
+++ cpu/ppc/ppcsim/simrom.c	(working copy)
@@ -3,13 +3,19 @@
  * Main routine for calling the PowerPC simulator to simulate ROM images
  */
 
+#include <sys/types.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
 extern void simulate();
-extern char *malloc();
 
 char *loadaddr;
 
 #define MEMSIZE 0x800000
 
+int
 main()
 {
 	int f;



More information about the openfirmware mailing list