~ubuntu-branches/ubuntu/quantal/gclcvs/quantal

« back to all changes in this revision

Viewing changes to h/sun386i.h

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2004-06-24 15:13:46 UTC
  • Revision ID: james.westby@ubuntu.com-20040624151346-xh0xaaktyyp7aorc
Tags: 2.7.0-26
C_GC_OFFSET is 2 on m68k-linux

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* created 3/14/89 by Michael Newton   */
 
2
/* %Caltech Submillimeter Observatory  */
 
3
/* POBox 4339                          */
 
4
/* Hilo HI 96720                       */
 
5
/* newton@csvax.caltech.edu            */
 
6
 
 
7
/* The sun386i is a ss mostly BSD, but
 
8
   uses COFF.  There are some bugs, and I was not able to get help
 
9
   through the support number.
 
10
   I _hope_ this code works for you but
 
11
   this code is supplied as is with NO WARRANTIES. */
 
12
 
 
13
 
 
14
/* We can't include bsd.h or att.h since neither is accurate (true?) */
 
15
 
 
16
#ifdef IN_UNIXFSYS
 
17
#define BSD
 
18
#else
 
19
#define ATT
 
20
#endif
 
21
 
 
22
#define UNIX
 
23
#define AV
 
24
#define SFASL
 
25
 
 
26
 
 
27
#define VSSIZE 8152
 
28
  
 
29
/* We use a COFF derived MEM_SAVE_LOCALS, READ_HEADER, COPY_TO_SAVE */
 
30
/* All of this is from wfs's code... */
 
31
 
 
32
#define         MEM_SAVE_LOCALS \
 
33
  struct filehdr fileheader;\
 
34
  struct exec header;\
 
35
  struct scnhdr sectionheader;\
 
36
  int diff
 
37
 
 
38
#define READ_HEADER \
 
39
 do{    fread(&fileheader, sizeof(fileheader), 1, original); \
 
40
        fread(&header, sizeof(header), 1, original); \
 
41
        data_begin = (char *)header.data_start; \
 
42
        data_end = core_end; \
 
43
        original_data = header.a_data; \
 
44
        header.a_data = data_end - data_begin; \
 
45
        diff = header.a_data - original_data; \
 
46
        header.a_bss = sbrk(0) - core_end; \
 
47
        fileheader.f_symptr += diff; \
 
48
        fwrite(&fileheader, sizeof(fileheader), 1, save);\
 
49
        fwrite(&header, sizeof(header), 1, save); \
 
50
        fread(&sectionheader, sizeof(sectionheader), 1, original); \
 
51
        if (sectionheader.s_lnnoptr) \
 
52
                sectionheader.s_lnnoptr += diff; \
 
53
        fwrite(&sectionheader, sizeof(sectionheader), 1, save); \
 
54
        fread(&sectionheader, sizeof(sectionheader), 1, original); \
 
55
        sectionheader.s_size += diff; \
 
56
        if (sectionheader.s_lnnoptr) \
 
57
                sectionheader.s_lnnoptr += diff; \
 
58
        fwrite(&sectionheader, sizeof(sectionheader), 1, save); \
 
59
        fread(&sectionheader, sizeof(sectionheader), 1, original); \
 
60
        sectionheader.s_paddr += diff; \
 
61
        sectionheader.s_vaddr += diff; \
 
62
        sectionheader.s_size = header.a_bss; \
 
63
        if (sectionheader.s_lnnoptr) \
 
64
                sectionheader.s_lnnoptr += diff; \
 
65
        fwrite(&sectionheader, sizeof(sectionheader), 1, save); \
 
66
        for (n = 4;  n <= fileheader.f_nscns;  n++) { \
 
67
                fread(&sectionheader, sizeof(sectionheader), 1, original); \
 
68
                if (sectionheader.s_scnptr) \
 
69
                        sectionheader.s_scnptr += diff; \
 
70
                if (sectionheader.s_lnnoptr) \
 
71
                        sectionheader.s_lnnoptr += diff; \
 
72
                fwrite(&sectionheader, sizeof(sectionheader), 1, save); \
 
73
        }}while(0)
 
74
 
 
75
#define COPY_TO_SAVE \
 
76
 do{for (;;) { \
 
77
                n = getc(original); \
 
78
                if (feof(original)) \
 
79
                        break; \
 
80
                putc(n, save); \
 
81
        }}while (0)
 
82
 
 
83
 
 
84
#define FILECPY_HEADER  filecpy(save, original, header.a_text)
 
85
 
 
86
 
 
87
#define exec            aouthdr
 
88
#define a_text          tsize
 
89
#define a_data          dsize
 
90
#define a_bss           bsize
 
91
 
 
92
/* Include <fcntl.h> rather than <sys/file.h> */
 
93
/* I'm not sure whether to include this or not -- MON */
 
94
/* ???? #define HAVE_FCNTL ???? */
 
95
 
 
96
#define NUMBER_OPEN_FILES _NFILE 
 
97
 
 
98
#define SET_REAL_MAXPAGE real_maxpage = MAXPAGE
 
99
 
 
100
#define INIT_ALLOC \
 
101
        heap_end = sbrk(0); \
 
102
        if (i = ((int)heap_end & (PAGESIZE - 1))) \
 
103
                sbrk(PAGESIZE - i); \
 
104
        heap_end = core_end = sbrk(0);
 
105
 
 
106
        
 
107
#define IF_ALLOCATE_ERR \
 
108
        if (core_end != sbrk(0)) \
 
109
                error("Someone allocated my memory!"); \
 
110
        if (core_end != sbrk(PAGESIZE*(n - m)))
 
111
        
 
112
 
 
113
#define cs_check(x) 
 
114
 
 
115
#define ADDITIONAL_FEATURES \
 
116
             ADD_FEATURE("SUN"); \
 
117
             ADD_FEATURE("I386")
 
118
 
 
119
/* ?? add "SYSTEM-V" to the above???? -- MON */
 
120
 
 
121
#define I386
 
122
#define IEEEFLOAT
 
123
 
 
124
#define DATA_BEGIN (char *)N_DATADDR(header)
 
125
 
 
126
#define N_RELOFF N_TRELOFF
 
127
 
 
128
#define RELOC_FILE "rel_coff.c"
 
129
 
 
130
/* Begin for cmpinclude */
 
131
 
 
132
 
 
133
/* End for cmpinclude */