Commit f1a95459 authored by GnoStiC's avatar GnoStiC

puae 2.3.1

parent 5928ccfc
......@@ -673,12 +673,14 @@ static uae_u8 ReadCIAA (unsigned int addr)
if (notinrom())
write_log ("BFE001 R %02X %s\n", tmp, debuginfo(0));
#endif
if (inputrecord_debug & 2) {
if (input_record > 0)
inprec_recorddebug_cia (tmp, div10, m68k_getpc ());
else if (input_play > 0)
inprec_playdebug_cia (tmp, div10, m68k_getpc ());
}
return tmp;
case 1:
#ifdef PARALLEL_PORT
......
......@@ -1693,7 +1693,7 @@ STATIC_INLINE void raw_inc_sp(int off)
static int in_handler=0;
static uae_u8 *veccode;
# ifdef _WIN32
#ifdef _WIN32
#if defined(CPU_64_BIT)
#define ctxPC (pContext->Rip)
......@@ -1945,7 +1945,7 @@ int EvalException (LPEXCEPTION_POINTERS blah, int n_except)
#endif
invalidate_block(bi);
raise_in_cl_list(bi);
set_special (0);
set_special(0);
return EXCEPTION_CONTINUE_EXECUTION;
}
bi=bi->next;
......@@ -2359,7 +2359,7 @@ static void
c->x86_vendor = X86_VENDOR_UNKNOWN;
}
static void cpuid (uae_u32 op, uae_u32 *eax, uae_u32 *ebx, uae_u32 *ecx, uae_u32 *edx)
static void cpuid(uae_u32 op, uae_u32 *eax, uae_u32 *ebx, uae_u32 *ecx, uae_u32 *edx)
{
const int CPUID_SPACE = 4096;
uae_u8* cpuid_space = (uae_u8*)cache_alloc(CPUID_SPACE);
......
......@@ -1701,7 +1701,7 @@ MIDFUNC(0,live_flags,(void))
}
MENDFUNC(0,live_flags,(void))
MIDFUNC(0,dont_care_flags,(void))
MIDFUNC(0,dont_care_flags,(void))
{
live.flags_are_important=0;
}
......@@ -1795,7 +1795,7 @@ MENDFUNC(2,bt_l_ri,(R4 r, IMM i)) /* This is defined as only affecting C */
}
MENDFUNC(2,bt_l_rr,(R4 r, R4 b)) /* This is defined as only affecting C */
MIDFUNC(2,btc_l_ri,(RW4 r, IMM i))
MIDFUNC(2,btc_l_ri,(RW4 r, IMM i))
{
int size=4;
if (i<16)
......@@ -1831,7 +1831,7 @@ MENDFUNC(2,btc_l_rr,(RW4 r, R4 b))
}
MENDFUNC(2,btr_l_ri,(RW4 r, IMM i))
MIDFUNC(2,btr_l_rr,(RW4 r, R4 b))
MIDFUNC(2,btr_l_rr,(RW4 r, R4 b))
{
CLOBBER_BT;
b=readreg(b,4);
......@@ -1843,7 +1843,7 @@ MIDFUNC(2,btr_l_rr,(RW4 r, R4 b))
MENDFUNC(2,btr_l_rr,(RW4 r, R4 b))
MIDFUNC(2,bts_l_ri,(RW4 r, IMM i))
MIDFUNC(2,bts_l_ri,(RW4 r, IMM i))
{
int size=4;
if (i<16)
......@@ -1855,7 +1855,7 @@ MIDFUNC(2,bts_l_ri,(RW4 r, IMM i))
}
MENDFUNC(2,bts_l_ri,(RW4 r, IMM i))
MIDFUNC(2,bts_l_rr,(RW4 r, R4 b))
MIDFUNC(2,bts_l_rr,(RW4 r, R4 b))
{
CLOBBER_BT;
b=readreg(b,4);
......
......@@ -298,13 +298,15 @@ static void REGPARAM2 expamem_wput (uaecptr addr, uae_u32 value)
// Z3 P96 RAM
p2 = p96ram_start >> 16;
}
if (value != p2) {
put_word (regs.regs[11] + 0x20, p2);
put_word (regs.regs[11] + 0x28, p2);
}
// -Bernd Roesch
expamem_hi = p2;
(*card_map[ecard]) ();
ecard++;
if (p1 != p2)
if (value != p2)
write_log (" Card %d remapped %04x0000 -> %04x0000\n", ecard, p1, p2);
write_log (" Card %d (Zorro%s) done.\n", ecard, expamem_type () == 0xc0 ? "II" : "III");
if (ecard < cardno)
......@@ -982,7 +984,7 @@ static void expamem_init_filesys (void)
expamem_write (0x08, no_shutup);
expamem_write (0x04, 2);
expamem_write (0x04, currprefs.maprom ? 2 : 82);
expamem_write (0x10, uae_id >> 8);
expamem_write (0x14, uae_id & 0xff);
......
......@@ -37,7 +37,7 @@
#define f_out fprintf
#define console_out printf
#ifdef JIT
extern uae_u8* compiled_code;
//extern uae_u8* compiled_code;
#include "compemu.h"
#else
/* Need to have these somewhere */
......
......@@ -75,25 +75,27 @@ void cache_free (uae_u8 *cache)
static uae_u32 lowmem (void)
{
uae_u32 change = 0;
if (currprefs.z3fastmem_size + currprefs.z3fastmem2_size >= 8 * 1024 * 1024) {
if (currprefs.z3fastmem_size + currprefs.z3fastmem2_size + currprefs.z3chipmem_size >= 8 * 1024 * 1024) {
if (currprefs.z3fastmem2_size) {
if (currprefs.z3fastmem2_size <= 128 * 1024 * 1024) {
change = currprefs.z3fastmem2_size;
currprefs.z3fastmem2_size = 0;
} else if (currprefs.z3chipmem_size) {
if (currprefs.z3chipmem_size <= 16 * 1024 * 1024) {
change = currprefs.z3chipmem_size;
currprefs.z3chipmem_size = 0;
} else {
change = currprefs.z3fastmem2_size / 2;
currprefs.z3fastmem2_size >>= 1;
changed_prefs.z3fastmem2_size = currprefs.z3fastmem2_size;
change = currprefs.z3chipmem_size / 2;
currprefs.z3chipmem_size /= 2;
}
} else {
change = currprefs.z3fastmem_size - currprefs.z3fastmem_size / 4;
currprefs.z3fastmem2_size = changed_prefs.z3fastmem2_size = currprefs.z3fastmem_size / 4;
currprefs.z3fastmem_size >>= 1;
currprefs.z3fastmem_size /= 2;
changed_prefs.z3fastmem_size = currprefs.z3fastmem_size;
}
} else if (currprefs.gfxmem_size >= 1 * 1024 * 1024) {
change = currprefs.gfxmem_size - currprefs.gfxmem_size / 2;
currprefs.gfxmem_size >>= 1;
currprefs.gfxmem_size /= 2;
changed_prefs.gfxmem_size = currprefs.gfxmem_size;
}
if (currprefs.z3fastmem2_size < 128 * 1024 * 1024)
......@@ -158,13 +160,11 @@ void preinit_shm (void)
}
write_log ("Max Z3FastRAM %dM. Total physical RAM %u %uM\n", max_z3fastmem >> 20, totalphys64 >> 20, totalphys64 >> 20);
//testwritewatch ();
canbang = 1;
}
static void resetmem (void)
{
return;
int i;
if (!shm_start)
......@@ -190,7 +190,8 @@ return;
int init_shm (void)
{
uae_u32 size, totalsize, z3size, natmemsize, rtgbarrier, rtgextra;
uae_u32 size, totalsize, z3size, natmemsize;
uae_u32 rtgbarrier, z3chipbarrier, rtgextra;
int rounds = 0;
restart:
......@@ -209,13 +210,16 @@ restart:
z3size = 0;
size = 0x1000000;
rtgextra = 0;
z3chipbarrier = 0;
rtgbarrier = getpagesize();
if (currprefs.cpu_model >= 68020)
size = 0x10000000;
if (currprefs.z3fastmem_size || currprefs.z3fastmem2_size) {
z3size = currprefs.z3fastmem_size + currprefs.z3fastmem2_size + (currprefs.z3fastmem_start - 0x10000000);
if (currprefs.z3fastmem_size || currprefs.z3fastmem2_size || currprefs.z3chipmem_size) {
z3size = currprefs.z3fastmem_size + currprefs.z3fastmem2_size + currprefs.z3chipmem_size + (currprefs.z3fastmem_start - 0x10000000);
if (currprefs.gfxmem_size)
rtgbarrier = 16 * 1024 * 1024;
if (currprefs.z3chipmem_size && (currprefs.z3fastmem_size || currprefs.z3fastmem2_size))
z3chipbarrier = 16 * 1024 * 1024;
} else {
rtgbarrier = 0;
}
......@@ -233,14 +237,6 @@ restart:
}
natmemsize = size + z3size;
free (memwatchtable);
memwatchtable = 0;
if (currprefs.gfxmem_size) {
if (!memwatchok) {
write_log ("GetWriteWatch() not supported, using guard pages, RTG performance will be slower.\n");
memwatchtable = xcalloc (uae_u8, currprefs.gfxmem_size / getpagesize() + 1);
}
}
if (currprefs.gfxmem_size) {
rtgextra = getpagesize();
} else {
......@@ -250,13 +246,12 @@ restart:
size = natmemsize + rtgbarrier + currprefs.gfxmem_size + rtgextra + 16 * getpagesize();
blah = (uae_u8*)valloc (size);
mprotect (blah, size, PROT_READ|PROT_WRITE|PROT_EXEC);
if (blah) {
natmem_offset = blah;
break;
}
write_log ("NATMEM: %dM area failed to allocate, err=%d (Z3=%dM,RTG=%dM)\n",
natmemsize >> 20, errno, (currprefs.z3fastmem_size + currprefs.z3fastmem2_size) >> 20, currprefs.gfxmem_size >> 20);
natmemsize >> 20, errno, (currprefs.z3fastmem_size + currprefs.z3fastmem2_size + currprefs.z3chipmem_size) >> 20, currprefs.gfxmem_size >> 20);
if (!lowmem ()) {
write_log ("NATMEM: No special area could be allocated (2)!\n");
return 0;
......@@ -265,7 +260,7 @@ restart:
p96mem_size = currprefs.gfxmem_size;
if (p96mem_size) {
free (natmem_offset);
size = natmemsize + rtgbarrier;
size = natmemsize + rtgbarrier + z3chipbarrier;
if (!(natmem_offset = valloc (size))) {
write_log ("VirtualAlloc() part 2 error %d. RTG disabled.\n", errno);
currprefs.gfxmem_size = changed_prefs.gfxmem_size = 0;
......@@ -282,6 +277,7 @@ restart:
write_log ("NATMEM: failed to allocate special Picasso96 GFX RAM, err=%d\n", errno);
}
}
if (!natmem_offset) {
write_log ("NATMEM: No special area could be allocated! (1) err=%d\n", errno);
} else {
......@@ -393,19 +389,24 @@ void *my_shmat (int shmid, void *shmaddr, int shmflg)
got = TRUE;
}
if(!_tcscmp (shmids[shmid].name, "z3")) {
shmaddr=natmem_offset + currprefs.z3fastmem_start;
shmaddr=natmem_offset + z3fastmem_start;
if (!currprefs.z3fastmem2_size)
size += BARRIER;
got = TRUE;
}
if(!_tcscmp (shmids[shmid].name, "z3_2")) {
shmaddr=natmem_offset + currprefs.z3fastmem_start + currprefs.z3fastmem_size;
shmaddr=natmem_offset + z3fastmem_start + currprefs.z3fastmem_size;
size += BARRIER;
got = TRUE;
}
if(!_tcscmp (shmids[shmid].name, "z3_chip")) {
shmaddr=natmem_offset + z3chipmem_start;
size += BARRIER;
got = TRUE;
}
if(!_tcscmp (shmids[shmid].name, "gfx")) {
got = TRUE;
p96special = 1;
p96special = TRUE;
p96ram_start = p96mem_offset - natmem_offset;
shmaddr = natmem_offset + p96ram_start;
size += BARRIER;
......@@ -499,9 +500,9 @@ void *my_shmat (int shmid, void *shmaddr, int shmflg)
size, size >> 10, errno);
} else {
shmids[shmid].attached = result;
write_log ("VirtualAlloc %08X - %08X %x (%dk) ok%s\n",
write_log ("VirtualAlloc %08X - %08X %x (%dk) ok (%08X)%s\n",
(uae_u8*)shmaddr - natmem_offset, (uae_u8*)shmaddr - natmem_offset + size,
size, size >> 10, p96special ? " P96" : "");
size, size >> 10, shmaddr, p96special ? " P96" : "");
}
}
return result;
......@@ -530,6 +531,29 @@ STATIC_INLINE key_t find_shmkey (key_t key)
return result;
}
int my_shmdt (const void *shmaddr)
{
return 0;
}
int my_shmget (key_t key, size_t size, int shmflg, const char *name)
{
int result = -1;
// write_log ("key %d (%d), size %d, shmflg %d, name %s\n", key, IPC_PRIVATE, size, shmflg, name);
// if((key == IPC_PRIVATE) || ((shmflg & IPC_CREAT) && (find_shmkey (key) == -1))) {
write_log ("shmget of size %d (%dk) for %s\n", size, size >> 10, name);
if ((result = get_next_shmkey ()) != -1) {
shmids[result].size = size;
_tcscpy (shmids[result].name, name);
} else {
result = -1;
}
// }
return result;
}
int my_shmctl (int shmid, int cmd, struct shmid_ds *buf)
{
int result = -1;
......@@ -555,28 +579,5 @@ int my_shmctl (int shmid, int cmd, struct shmid_ds *buf)
return result;
}
int my_shmdt (const void *shmaddr)
{
return 0;
}
int my_shmget (key_t key, size_t size, int shmflg, const char *name)
{
int result = -1;
// write_log ("key %d (%d), size %d, shmflg %d, name %s\n", key, IPC_PRIVATE, size, shmflg, name);
// if((key == IPC_PRIVATE) || ((shmflg & IPC_CREAT) && (find_shmkey (key) == -1))) {
write_log ("shmget of size %d (%dk) for %s\n", size, size >> 10, name);
if ((result = get_next_shmkey ()) != -1) {
shmids[result].size = size;
_tcscpy (shmids[result].name, name);
} else {
result = -1;
}
// }
return result;
}
#endif //NATMEM_OFFSET
#endif //JIT
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment