OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [tools/] [cpu/] [unix/] [gensize.c] - Blame information for rev 583

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
2
 *  gensize.c
3
 *
4
 *  This file generates the file unixsize.h
5
 *
6
 *  NOTE:  It only prints the minimal information required.
7
 *
8
 *  COPYRIGHT (c) 1989-1999.
9
 *  On-Line Applications Research Corporation (OAR).
10
 *
11
 *  The license and distribution terms for this file may be
12
 *  found in the file LICENSE in this distribution or at
13
 *  http://www.OARcorp.com/rtems/license.html.
14
 *
15
 *  $Id: gensize.c,v 1.2 2001-09-27 12:02:54 chris Exp $
16
 *
17
 */
18
 
19
/*
20
 *  This feels like a very crude way to determine if we are on a Solaris
21
 *  host but it does work.
22
 */
23
 
24
#if defined(__sun__) && defined(__sparc__) && \
25
    defined(__unix__) && defined(__svr4__)
26
#undef  _POSIX_C_SOURCE
27
#define _POSIX_C_SOURCE 3
28
#undef  __STRICT_ANSI__
29
#endif
30
 
31
#include <stdio.h>
32
#include <unistd.h>
33
#include <setjmp.h>
34
#include <signal.h>
35
 
36
typedef struct {
37
  jmp_buf     regs;
38
  int         isr_level;
39
  int         pad[4]; /* just in case */
40
} Context_Control;
41
 
42
int main(
43
  int argc,
44
  char **argv
45
)
46
{
47
  Context_Control *cc = 0;
48
 
49
  /*
50
   * Print the file header
51
   */
52
 
53
printf(
54
  "/*  unixsize.h\n"
55
  " *\n"
56
  " *  This include file contans the size of the context control block\n"
57
  " *  C data structure.  This structure must be defined in such a way\n"
58
  " *  that files NOT including the native header files can work.\n"
59
  " *\n"
60
  " *  NOTE:  THIS FILE IS AUTOMATICALLY GENERATED!!!!\n"
61
  " *         DO NOT EDIT THIS BY HAND!!!!\n"
62
  " *\n"
63
  " *  COPYRIGHT (c) 1989-1999.\n"
64
  " *  On-Line Applications Research Corporation (OAR).\n"
65
  " *\n"
66
  " *  The license and distribution terms for this file may be\n"
67
  " *  found in the file LICENSE in this distribution or at\n"
68
  " *  http://www.OARcorp.com/rtems/license.html.\n"
69
  " */\n"
70
  "\n"
71
  "#ifndef __UNIXSIZE_h\n"
72
  "#define __UNIXSIZE_h\n"
73
  "\n"
74
);
75
 
76
#define PRINT_IT( STRING, NUMBER ) \
77
  printf( "#define\t%s\t0x%x\t\t/* %d */\n", \
78
          STRING, \
79
          NUMBER, \
80
          NUMBER );
81
 
82
#define PRINT_SIZE( STRING, NUMBER ) \
83
  printf( "#define\t%s\t0x%x\t\t/* %d */\n", \
84
          STRING, \
85
          NUMBER, \
86
          NUMBER );
87
 
88
#define PRINT_COMMENT( STRING ) \
89
  printf(       \
90
    "\n"        \
91
    "/*\n"      \
92
    " * " STRING "\n" \
93
    " */\n"     \
94
    "\n"        \
95
  );
96
 
97
  PRINT_COMMENT("Context_Control information");
98
 
99
  PRINT_SIZE("CPU_CONTEXT_SIZE_IN_BYTES", sizeof( Context_Control ) );
100
  PRINT_SIZE("CPU_CONTEXT_REGISTERS_OFFSET_IN_BYTES", (int) &cc->regs );
101
  PRINT_SIZE("CPU_CONTEXT_SIGNALS_OFFSET_IN_BYTES", (int) &cc->isr_level );
102
 
103
  /*
104
   *  Print the end of file stuff
105
   */
106
 
107
   printf(
108
    "\n"
109
    "#endif    /* __UNIXSIZE_h  */\n"
110
    "\n"
111
    "/* end of include file */\n"
112
  );
113
 
114
  return 0;
115
}
116
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.