ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/Unix/sysdeps.h
Revision: 1.3
Committed: 2003-01-04T12:23:39Z (21 years, 5 months ago) by gbeauche
Content type: text/plain
Branch: MAIN
Changes since 1.2: +27 -8 lines
Log Message:
Sync with changes from cxmon and B2. I have yet to find out why my old
disk image (8.1 based) no longer boots completely. :-/

File Contents

# User Rev Content
1 cebix 1.1 /*
2     * sysdeps.h - System dependent definitions for Linux
3     *
4     * SheepShaver (C) 1997-2002 Christian Bauer and Marc Hellwig
5     *
6     * This program is free software; you can redistribute it and/or modify
7     * it under the terms of the GNU General Public License as published by
8     * the Free Software Foundation; either version 2 of the License, or
9     * (at your option) any later version.
10     *
11     * This program is distributed in the hope that it will be useful,
12     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     * GNU General Public License for more details.
15     *
16     * You should have received a copy of the GNU General Public License
17     * along with this program; if not, write to the Free Software
18     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19     */
20    
21     #ifndef SYSDEPS_H
22     #define SYSDEPS_H
23    
24     #ifndef __STDC__
25     #error "Your compiler is not ANSI. Get a real one."
26     #endif
27    
28     #include "config.h"
29     #include "user_strings_unix.h"
30    
31     #ifndef STDC_HEADERS
32     #error "You don't have ANSI C header files."
33     #endif
34    
35     #ifdef HAVE_UNISTD_H
36     # include <sys/types.h>
37     # include <unistd.h>
38     #endif
39    
40     #include <netinet/in.h>
41     #include <assert.h>
42     #include <stdio.h>
43     #include <stdlib.h>
44     #include <string.h>
45     #include <signal.h>
46    
47     #ifdef HAVE_FCNTL_H
48     # include <fcntl.h>
49     #endif
50    
51     #ifdef TIME_WITH_SYS_TIME
52     # include <sys/time.h>
53     # include <time.h>
54     #else
55     # ifdef HAVE_SYS_TIME_H
56     # include <sys/time.h>
57     # else
58     # include <time.h>
59     # endif
60     #endif
61    
62     // Are we using a PPC emulator or the real thing?
63     #ifdef __powerpc__
64     #define EMULATED_PPC 0
65     #else
66     #define EMULATED_PPC 1
67     #endif
68    
69     #define POWERPC_ROM 1
70    
71     // Data types
72     typedef unsigned char uint8;
73     typedef signed char int8;
74     #if SIZEOF_SHORT == 2
75     typedef unsigned short uint16;
76     typedef short int16;
77     #elif SIZEOF_INT == 2
78     typedef unsigned int uint16;
79     typedef int int16;
80     #else
81     #error "No 2 byte type, you lose."
82     #endif
83     #if SIZEOF_INT == 4
84     typedef unsigned int uint32;
85     typedef int int32;
86     #elif SIZEOF_LONG == 4
87     typedef unsigned long uint32;
88     typedef long int32;
89     #else
90     #error "No 4 byte type, you lose."
91     #endif
92     #if SIZEOF_LONG == 8
93     typedef unsigned long uint64;
94     typedef long int64;
95 gbeauche 1.3 #define VAL64(a) (a ## l)
96     #define UVAL64(a) (a ## ul)
97 cebix 1.1 #elif SIZEOF_LONG_LONG == 8
98     typedef unsigned long long uint64;
99     typedef long long int64;
100 gbeauche 1.3 #define VAL64(a) (a ## LL)
101     #define UVAL64(a) (a ## uLL)
102 cebix 1.1 #else
103     #error "No 8 byte type, you lose."
104     #endif
105 gbeauche 1.3 #if SIZEOF_VOID_P == 4
106     typedef uint32 uintptr;
107     typedef int32 intptr;
108     #elif SIZEOF_VOID_P == 8
109     typedef uint64 uintptr;
110     typedef int64 intptr;
111     #else
112     #error "Unsupported size of pointer"
113     #endif
114 cebix 1.1
115     // Time data type for Time Manager emulation
116     #ifdef HAVE_CLOCK_GETTIME
117     typedef struct timespec tm_time_t;
118     #else
119     typedef struct timeval tm_time_t;
120     #endif
121    
122 cebix 1.2 // Setup pthread attributes
123     extern void Set_pthread_attr(pthread_attr_t *attr, int priority);
124    
125 cebix 1.1 // Various definitions
126     typedef struct rgb_color {
127     uint8 red;
128     uint8 green;
129     uint8 blue;
130     uint8 alpha;
131     } rgb_color;
132    
133     // Macro for calling MacOS routines
134     #define CallMacOS(type, tvect) call_macos((uint32)tvect)
135     #define CallMacOS1(type, tvect, arg1) call_macos1((uint32)tvect, (uint32)arg1)
136     #define CallMacOS2(type, tvect, arg1, arg2) call_macos2((uint32)tvect, (uint32)arg1, (uint32)arg2)
137     #define CallMacOS3(type, tvect, arg1, arg2, arg3) call_macos3((uint32)tvect, (uint32)arg1, (uint32)arg2, (uint32)arg3)
138     #define CallMacOS4(type, tvect, arg1, arg2, arg3, arg4) call_macos4((uint32)tvect, (uint32)arg1, (uint32)arg2, (uint32)arg3, (uint32)arg4)
139     #define CallMacOS5(type, tvect, arg1, arg2, arg3, arg4, arg5) call_macos5((uint32)tvect, (uint32)arg1, (uint32)arg2, (uint32)arg3, (uint32)arg4, (uint32)arg5)
140     #define CallMacOS6(type, tvect, arg1, arg2, arg3, arg4, arg5, arg6) call_macos6((uint32)tvect, (uint32)arg1, (uint32)arg2, (uint32)arg3, (uint32)arg4, (uint32)arg5, (uint32)arg6)
141     #define CallMacOS7(type, tvect, arg1, arg2, arg3, arg4, arg5, arg6, arg7) call_macos7((uint32)tvect, (uint32)arg1, (uint32)arg2, (uint32)arg3, (uint32)arg4, (uint32)arg5, (uint32)arg6, (uint32)arg7)
142    
143 gbeauche 1.3 #ifdef __cplusplus
144     extern "C" {
145     #endif
146     extern uint32 call_macos(uint32 tvect);
147     extern uint32 call_macos1(uint32 tvect, uint32 arg1);
148     extern uint32 call_macos2(uint32 tvect, uint32 arg1, uint32 arg2);
149     extern uint32 call_macos3(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3);
150     extern uint32 call_macos4(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4);
151     extern uint32 call_macos5(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5);
152     extern uint32 call_macos6(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5, uint32 arg6);
153     extern uint32 call_macos7(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5, uint32 arg6, uint32 arg7);
154     #ifdef __cplusplus
155     }
156     #endif
157 cebix 1.1
158     #endif