summaryrefslogtreecommitdiffstats
path: root/tools/cpu/unix/gensize.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1995-09-27 20:53:58 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1995-09-27 20:53:58 +0000
commit37f4c2d99fbf09142aeafe3a9908a81e283f8186 (patch)
tree04dc487b28113dc17f1c3c9ab2241390b4ed95ea /tools/cpu/unix/gensize.c
parentc701f1974b049ab58290a183a0d144f470e9cb44 (diff)
downloadrtems-37f4c2d99fbf09142aeafe3a9908a81e283f8186.tar.bz2
Modified UNIX simulator port so all references to native unix
stuff is in the executive source proper in the file cpu.c. This should help avoid conflicts between RTEMS POSIX files and UNIX files.
Diffstat (limited to '')
-rw-r--r--tools/cpu/unix/gensize.c116
1 files changed, 116 insertions, 0 deletions
diff --git a/tools/cpu/unix/gensize.c b/tools/cpu/unix/gensize.c
new file mode 100644
index 0000000000..0466d67b09
--- /dev/null
+++ b/tools/cpu/unix/gensize.c
@@ -0,0 +1,116 @@
+/*
+ * gensize.c
+ *
+ * This file generates the file unixsize.h
+ *
+ * NOTE: It only prints the minimal information required.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ *
+ */
+
+/*
+ * This feels like a very crude way to determine if we are on a Solaris
+ * host but it does work.
+ */
+
+#if defined(__sun__) && defined(__sparc__) && \
+ defined(__unix__) && defined(__svr4__)
+#undef _POSIX_C_SOURCE
+#define _POSIX_C_SOURCE 3
+#undef __STRICT_ANSI__
+#endif
+
+#include <stdio.h>
+#include <unistd.h>
+#include <setjmp.h>
+#include <signal.h>
+
+typedef struct {
+ jmp_buf regs;
+ sigset_t isr_level;
+} Context_Control;
+
+int main(
+ int argc,
+ char **argv
+)
+{
+ Context_Control *cc = 0;
+
+ /*
+ * Print the file header
+ */
+
+printf(
+ "/* unixsize.h\n"
+ " *\n"
+ " * This include file contans the size of the context control block\n"
+ " * C data structure. This structure must be defined in such a way\n"
+ " * that files NOT including the native header files can work.\n"
+ " *\n"
+ " * NOTE: THIS FILE IS AUTOMATICALLY GENERATED!!!!\n"
+ " * DO NOT EDIT THIS BY HAND!!!!\n"
+ " *\n"
+ " * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.\n"
+ " * On-Line Applications Research Corporation (OAR).\n"
+ " * All rights assigned to U.S. Government, 1994.\n"
+ " *\n"
+ " * This material may be reproduced by or for the U.S. Government pursuant\n"
+ " * to the copyright license under the clause at DFARS 252.227-7013. This\n"
+ " * notice must appear in all copies of this file and its derivatives.\n"
+ " */\n"
+ "\n"
+ "#ifndef __UNIXSIZE_h\n"
+ "#define __UNIXSIZE_h\n"
+ "\n"
+);
+
+#define PRINT_IT( STRING, NUMBER ) \
+ printf( "#define\t%s\t0x%x\t\t/* %d */\n", \
+ STRING, \
+ NUMBER, \
+ NUMBER );
+
+#define PRINT_SIZE( STRING, NUMBER ) \
+ printf( "#define\t%s\t0x%x\t\t/* %d */\n", \
+ STRING, \
+ NUMBER, \
+ NUMBER );
+
+#define PRINT_COMMENT( STRING ) \
+ printf( \
+ "\n" \
+ "/*\n" \
+ " * " STRING "\n" \
+ " */\n" \
+ "\n" \
+ );
+
+ PRINT_COMMENT("Context_Control information");
+
+ PRINT_SIZE("CPU_CONTEXT_SIZE_IN_BYTES", sizeof( Context_Control ) );
+ PRINT_SIZE("CPU_CONTEXT_REGISTERS_OFFSET_IN_BYTES", (int) &cc->regs );
+ PRINT_SIZE("CPU_CONTEXT_SIGNALS_OFFSET_IN_BYTES", (int) &cc->isr_level );
+
+ /*
+ * Print the end of file stuff
+ */
+
+ printf(
+ "\n"
+ "#endif /* __UNIXSIZE_h */\n"
+ "\n"
+ "/* end of include file */\n"
+ );
+
+ return 0;
+}
+