1 |
|
/* |
2 |
|
* main_windows.cpp - Startup code for Windows |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-2005 Christian Bauer |
4 |
> |
* Basilisk II (C) 1997-2008 Christian Bauer |
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 |
52 |
|
#include "kernel_windows.h" |
53 |
|
|
54 |
|
#if USE_JIT |
55 |
< |
extern void flush_icache_range(uint32 start, uint32 size); // from compemu_support.cpp |
55 |
> |
extern void flush_icache_range(uint8 *start, uint32 size); // from compemu_support.cpp |
56 |
|
#endif |
57 |
|
|
58 |
|
#ifdef ENABLE_MON |
73 |
|
bool CPUIs68060; |
74 |
|
int FPUType; |
75 |
|
bool TwentyFourBitAddressing; |
76 |
– |
bool ThirtyThreeBitAddressing = false; |
76 |
|
|
77 |
|
|
78 |
|
// Global variables |
133 |
|
|
134 |
|
void *vm_acquire_mac(size_t size) |
135 |
|
{ |
136 |
< |
void *m = vm_acquire(size, VM_MAP_DEFAULT | VM_MAP_33BIT); |
138 |
< |
if (m == NULL) { |
139 |
< |
ThirtyThreeBitAddressing = false; |
140 |
< |
m = vm_acquire(size); |
141 |
< |
} |
142 |
< |
return m; |
136 |
> |
return vm_acquire(size, VM_MAP_DEFAULT | VM_MAP_32BIT); |
137 |
|
} |
138 |
|
|
139 |
|
|
141 |
|
* SIGSEGV handler |
142 |
|
*/ |
143 |
|
|
144 |
< |
static sigsegv_return_t sigsegv_handler(sigsegv_address_t fault_address, sigsegv_address_t fault_instruction) |
144 |
> |
static sigsegv_return_t sigsegv_handler(sigsegv_info_t *sip) |
145 |
|
{ |
146 |
+ |
const uintptr fault_address = (uintptr)sigsegv_get_fault_address(sip); |
147 |
|
#if ENABLE_VOSF |
148 |
|
// Handle screen fault |
149 |
< |
extern bool Screen_fault_handler(sigsegv_address_t, sigsegv_address_t); |
150 |
< |
if (Screen_fault_handler(fault_address, fault_instruction)) |
149 |
> |
extern bool Screen_fault_handler(sigsegv_info_t *sip); |
150 |
> |
if (Screen_fault_handler(sip)) |
151 |
|
return SIGSEGV_RETURN_SUCCESS; |
152 |
|
#endif |
153 |
|
|
168 |
|
* Dump state when everything went wrong after a SEGV |
169 |
|
*/ |
170 |
|
|
171 |
< |
static void sigsegv_dump_state(sigsegv_address_t fault_address, sigsegv_address_t fault_instruction) |
171 |
> |
static void sigsegv_dump_state(sigsegv_info_t *sip) |
172 |
|
{ |
173 |
+ |
const sigsegv_address_t fault_address = sigsegv_get_fault_address(sip); |
174 |
+ |
const sigsegv_address_t fault_instruction = sigsegv_get_fault_instruction_address(sip); |
175 |
|
fprintf(stderr, "Caught SIGSEGV at address %p", fault_address); |
176 |
< |
if (fault_instruction != SIGSEGV_INVALID_PC) |
176 |
> |
if (fault_instruction != SIGSEGV_INVALID_ADDRESS) |
177 |
|
fprintf(stderr, " [IP=%p]", fault_instruction); |
178 |
|
fprintf(stderr, "\n"); |
179 |
|
uaecptr nextpc; |
353 |
|
vm_init(); |
354 |
|
|
355 |
|
// Create areas for Mac RAM and ROM |
359 |
– |
#ifdef USE_33BIT_ADDRESSING |
360 |
– |
// Speculatively enables 33-bit addressing |
361 |
– |
ThirtyThreeBitAddressing = true; |
362 |
– |
#endif |
356 |
|
RAMBaseHost = (uint8 *)vm_acquire_mac(RAMSize); |
357 |
|
ROMBaseHost = (uint8 *)vm_acquire_mac(0x100000); |
358 |
|
if (RAMBaseHost == VM_MAP_FAILED || ROMBaseHost == VM_MAP_FAILED) { |
510 |
|
{ |
511 |
|
#if USE_JIT |
512 |
|
if (UseJIT) |
513 |
< |
flush_icache_range((uintptr)start, size); |
513 |
> |
flush_icache_range((uint8 *)start, size); |
514 |
|
#endif |
515 |
|
} |
516 |
|
|