ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/Unix/sysdeps.h
Revision: 1.4
Committed: 2003-05-22T22:12:05Z (21 years, 5 months ago) by gbeauche
Content type: text/plain
Branch: MAIN
Changes since 1.3: +3 -0 lines
Log Message:
Import VOSF from Basilisk II for faster and more accurate video refresh.
There may be some bugs left though. Rework sigsegv_handler() a little to
accomodate VOSF way of life.

TODO: merge video drivers infrastructure from B2.

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 gbeauche 1.4 // Mac and host address space are the same
63     #define REAL_ADDRESSING 1
64    
65 cebix 1.1 // Are we using a PPC emulator or the real thing?
66     #ifdef __powerpc__
67     #define EMULATED_PPC 0
68     #else
69     #define EMULATED_PPC 1
70     #endif
71    
72     #define POWERPC_ROM 1
73    
74     // Data types
75     typedef unsigned char uint8;
76     typedef signed char int8;
77     #if SIZEOF_SHORT == 2
78     typedef unsigned short uint16;
79     typedef short int16;
80     #elif SIZEOF_INT == 2
81     typedef unsigned int uint16;
82     typedef int int16;
83     #else
84     #error "No 2 byte type, you lose."
85     #endif
86     #if SIZEOF_INT == 4
87     typedef unsigned int uint32;
88     typedef int int32;
89     #elif SIZEOF_LONG == 4
90     typedef unsigned long uint32;
91     typedef long int32;
92     #else
93     #error "No 4 byte type, you lose."
94     #endif
95     #if SIZEOF_LONG == 8
96     typedef unsigned long uint64;
97     typedef long int64;
98 gbeauche 1.3 #define VAL64(a) (a ## l)
99     #define UVAL64(a) (a ## ul)
100 cebix 1.1 #elif SIZEOF_LONG_LONG == 8
101     typedef unsigned long long uint64;
102     typedef long long int64;
103 gbeauche 1.3 #define VAL64(a) (a ## LL)
104     #define UVAL64(a) (a ## uLL)
105 cebix 1.1 #else
106     #error "No 8 byte type, you lose."
107     #endif
108 gbeauche 1.3 #if SIZEOF_VOID_P == 4
109     typedef uint32 uintptr;
110     typedef int32 intptr;
111     #elif SIZEOF_VOID_P == 8
112     typedef uint64 uintptr;
113     typedef int64 intptr;
114     #else
115     #error "Unsupported size of pointer"
116     #endif
117 cebix 1.1
118     // Time data type for Time Manager emulation
119     #ifdef HAVE_CLOCK_GETTIME
120     typedef struct timespec tm_time_t;
121     #else
122     typedef struct timeval tm_time_t;
123     #endif
124    
125 cebix 1.2 // Setup pthread attributes
126     extern void Set_pthread_attr(pthread_attr_t *attr, int priority);
127    
128 cebix 1.1 // Various definitions
129     typedef struct rgb_color {
130     uint8 red;
131     uint8 green;
132     uint8 blue;
133     uint8 alpha;
134     } rgb_color;
135    
136     // Macro for calling MacOS routines
137     #define CallMacOS(type, tvect) call_macos((uint32)tvect)
138     #define CallMacOS1(type, tvect, arg1) call_macos1((uint32)tvect, (uint32)arg1)
139     #define CallMacOS2(type, tvect, arg1, arg2) call_macos2((uint32)tvect, (uint32)arg1, (uint32)arg2)
140     #define CallMacOS3(type, tvect, arg1, arg2, arg3) call_macos3((uint32)tvect, (uint32)arg1, (uint32)arg2, (uint32)arg3)
141     #define CallMacOS4(type, tvect, arg1, arg2, arg3, arg4) call_macos4((uint32)tvect, (uint32)arg1, (uint32)arg2, (uint32)arg3, (uint32)arg4)
142     #define CallMacOS5(type, tvect, arg1, arg2, arg3, arg4, arg5) call_macos5((uint32)tvect, (uint32)arg1, (uint32)arg2, (uint32)arg3, (uint32)arg4, (uint32)arg5)
143     #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)
144     #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)
145    
146 gbeauche 1.3 #ifdef __cplusplus
147     extern "C" {
148     #endif
149     extern uint32 call_macos(uint32 tvect);
150     extern uint32 call_macos1(uint32 tvect, uint32 arg1);
151     extern uint32 call_macos2(uint32 tvect, uint32 arg1, uint32 arg2);
152     extern uint32 call_macos3(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3);
153     extern uint32 call_macos4(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4);
154     extern uint32 call_macos5(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5);
155     extern uint32 call_macos6(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5, uint32 arg6);
156     extern uint32 call_macos7(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5, uint32 arg6, uint32 arg7);
157     #ifdef __cplusplus
158     }
159     #endif
160 cebix 1.1
161     #endif