ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/include/main.h
Revision: 1.9
Committed: 2005-02-27T21:52:06Z (19 years, 8 months ago) by gbeauche
Content type: text/plain
Branch: MAIN
Changes since 1.8: +1 -0 lines
Log Message:
Fix native Linux/ppc with recent enough glibc that supports TLS; r2 is used
in that case. Tell me if I broke other arches, e.g. r13 is no longer saved
in Video and Ethernet stubs, though it seems to be OK.

Colateral feature: SheepShaver should now run on Linux/ppc64 with relevant
32-bit runtime. Native Linux/ppc64 support is harder as low mem globals are
32-bit in mind and e.g. the TLS register there is %r13, %r2 is the TOC
(PowerOpen/AIX ABI)

File Contents

# User Rev Content
1 cebix 1.1 /*
2     * main.h - Emulation core
3     *
4 gbeauche 1.8 * SheepShaver (C) 1997-2005 Christian Bauer and Marc Hellwig
5 cebix 1.1 *
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 MAIN_H
22     #define MAIN_H
23    
24     // Global variables
25     extern void *TOC; // TOC pointer
26 gbeauche 1.9 extern void *R13; // r13 register
27 cebix 1.1 extern uint32 KernelDataAddr; // Address of Kernel Data
28     extern uint32 BootGlobsAddr; // Address of BootGlobs structure at top of Mac RAM
29     extern uint32 PVR; // Theoretical PVR
30     extern int64 CPUClockSpeed; // Processor clock speed (Hz)
31     extern int64 BusClockSpeed; // Bus clock speed (Hz)
32 gbeauche 1.5 extern int64 TimebaseSpeed; // Timebase clock speed (Hz)
33 cebix 1.1
34     #ifdef __BEOS__
35     extern system_info SysInfo; // System information
36     #endif
37    
38     // 68k register structure (for Execute68k())
39     struct M68kRegisters {
40     uint32 d[8];
41     uint32 a[8];
42     };
43    
44    
45     // Functions
46 gbeauche 1.7 extern bool InitAll(void);
47     extern void ExitAll(void);
48 cebix 1.1 extern void Dump68kRegs(M68kRegisters *r); // Dump 68k registers
49 gbeauche 1.6 extern void MakeExecutable(int dummy, uint32 start, uint32 length); // Make code executable
50 cebix 1.1 extern void PatchAfterStartup(void); // Patches after system startup
51     extern void QuitEmulator(void); // Quit emulator (must only be called from main thread)
52     extern void ErrorAlert(const char *text); // Display error alert
53     extern void WarningAlert(const char *text); // Display warning alert
54     extern bool ChoiceAlert(const char *text, const char *pos, const char *neg); // Display choice alert
55    
56     // Mutexes (non-recursive)
57     struct B2_mutex;
58     extern B2_mutex *B2_create_mutex(void);
59     extern void B2_lock_mutex(B2_mutex *mutex);
60     extern void B2_unlock_mutex(B2_mutex *mutex);
61     extern void B2_delete_mutex(B2_mutex *mutex);
62    
63     // Interrupt flags
64     enum {
65     INTFLAG_VIA = 1, // 60.15Hz VBL
66     INTFLAG_SERIAL = 2, // Serial driver
67     INTFLAG_ETHER = 4, // Ethernet driver
68     INTFLAG_AUDIO = 16, // Audio block read
69     INTFLAG_TIMER = 32, // Time Manager
70     INTFLAG_ADB = 64 // ADB
71     };
72    
73     extern volatile uint32 InterruptFlags; // Currently pending interrupts
74     extern void SetInterruptFlag(uint32);
75     extern void ClearInterruptFlag(uint32);
76     extern void TriggerInterrupt(void); // Trigger SIGUSR1 interrupt in emulator thread
77     extern void DisableInterrupt(void); // Disable SIGUSR1 interrupt (can be nested)
78     extern void EnableInterrupt(void); // Enable SIGUSR1 interrupt (can be nested)
79    
80     #endif