mirror of
https://github.com/holub/mame
synced 2025-07-02 08:39:21 +03:00
Yet another attempt to fix the MIPS 64-bit Linux crash.
This commit is contained in:
parent
3a0b58f14e
commit
8fc9bc85e4
@ -2161,12 +2161,16 @@ void mips3_get_info(UINT32 state, cpuinfo *info)
|
||||
#if (HAS_R4600)
|
||||
static void r4600be_init(int index, int clock, const void *config, int (*irqcallback)(int))
|
||||
{
|
||||
mips3com_init(&mips3.core, MIPS3_TYPE_R4600, TRUE, index, clock, config, irqcallback);
|
||||
size_t memsize = mips3com_init(&mips3.core, MIPS3_TYPE_R4600, TRUE, index, clock, config, irqcallback, NULL);
|
||||
void *memory = auto_malloc(memsize);
|
||||
mips3com_init(&mips3.core, MIPS3_TYPE_R4600, TRUE, index, clock, config, irqcallback, memory);
|
||||
}
|
||||
|
||||
static void r4600le_init(int index, int clock, const void *config, int (*irqcallback)(int))
|
||||
{
|
||||
mips3com_init(&mips3.core, MIPS3_TYPE_R4600, FALSE, index, clock, config, irqcallback);
|
||||
size_t memsize = mips3com_init(&mips3.core, MIPS3_TYPE_R4600, FALSE, index, clock, config, irqcallback, NULL);
|
||||
void *memory = auto_malloc(memsize);
|
||||
mips3com_init(&mips3.core, MIPS3_TYPE_R4600, FALSE, index, clock, config, irqcallback, memory);
|
||||
}
|
||||
|
||||
void r4600be_get_info(UINT32 state, cpuinfo *info)
|
||||
@ -2215,12 +2219,16 @@ void r4600le_get_info(UINT32 state, cpuinfo *info)
|
||||
#if (HAS_R4650)
|
||||
static void r4650be_init(int index, int clock, const void *config, int (*irqcallback)(int))
|
||||
{
|
||||
mips3com_init(&mips3.core, MIPS3_TYPE_R4650, TRUE, index, clock, config, irqcallback);
|
||||
size_t memsize = mips3com_init(&mips3.core, MIPS3_TYPE_R4650, TRUE, index, clock, config, irqcallback, NULL);
|
||||
void *memory = auto_malloc(memsize);
|
||||
mips3com_init(&mips3.core, MIPS3_TYPE_R4650, TRUE, index, clock, config, irqcallback, memory);
|
||||
}
|
||||
|
||||
static void r4650le_init(int index, int clock, const void *config, int (*irqcallback)(int))
|
||||
{
|
||||
mips3com_init(&mips3.core, MIPS3_TYPE_R4650, FALSE, index, clock, config, irqcallback);
|
||||
size_t memsize = mips3com_init(&mips3.core, MIPS3_TYPE_R4650, FALSE, index, clock, config, irqcallback, NULL);
|
||||
void *memory = auto_malloc(memsize);
|
||||
mips3com_init(&mips3.core, MIPS3_TYPE_R4650, FALSE, index, clock, config, irqcallback, memory);
|
||||
}
|
||||
|
||||
void r4650be_get_info(UINT32 state, cpuinfo *info)
|
||||
@ -2269,12 +2277,16 @@ void r4650le_get_info(UINT32 state, cpuinfo *info)
|
||||
#if (HAS_R4700)
|
||||
static void r4700be_init(int index, int clock, const void *config, int (*irqcallback)(int))
|
||||
{
|
||||
mips3com_init(&mips3.core, MIPS3_TYPE_R4700, TRUE, index, clock, config, irqcallback);
|
||||
size_t memsize = mips3com_init(&mips3.core, MIPS3_TYPE_R4700, TRUE, index, clock, config, irqcallback, NULL);
|
||||
void *memory = auto_malloc(memsize);
|
||||
mips3com_init(&mips3.core, MIPS3_TYPE_R4700, TRUE, index, clock, config, irqcallback, memory);
|
||||
}
|
||||
|
||||
static void r4700le_init(int index, int clock, const void *config, int (*irqcallback)(int))
|
||||
{
|
||||
mips3com_init(&mips3.core, MIPS3_TYPE_R4700, FALSE, index, clock, config, irqcallback);
|
||||
size_t memsize = mips3com_init(&mips3.core, MIPS3_TYPE_R4700, FALSE, index, clock, config, irqcallback, NULL);
|
||||
void *memory = auto_malloc(memsize);
|
||||
mips3com_init(&mips3.core, MIPS3_TYPE_R4700, FALSE, index, clock, config, irqcallback, memory);
|
||||
}
|
||||
|
||||
void r4700be_get_info(UINT32 state, cpuinfo *info)
|
||||
@ -2324,12 +2336,16 @@ void r4700le_get_info(UINT32 state, cpuinfo *info)
|
||||
#if (HAS_R5000)
|
||||
static void r5000be_init(int index, int clock, const void *config, int (*irqcallback)(int))
|
||||
{
|
||||
mips3com_init(&mips3.core, MIPS3_TYPE_R5000, TRUE, index, clock, config, irqcallback);
|
||||
size_t memsize = mips3com_init(&mips3.core, MIPS3_TYPE_R5000, TRUE, index, clock, config, irqcallback, NULL);
|
||||
void *memory = auto_malloc(memsize);
|
||||
mips3com_init(&mips3.core, MIPS3_TYPE_R5000, TRUE, index, clock, config, irqcallback, memory);
|
||||
}
|
||||
|
||||
static void r5000le_init(int index, int clock, const void *config, int (*irqcallback)(int))
|
||||
{
|
||||
mips3com_init(&mips3.core, MIPS3_TYPE_R5000, FALSE, index, clock, config, irqcallback);
|
||||
size_t memsize = mips3com_init(&mips3.core, MIPS3_TYPE_R5000, FALSE, index, clock, config, irqcallback, NULL);
|
||||
void *memory = auto_malloc(memsize);
|
||||
mips3com_init(&mips3.core, MIPS3_TYPE_R5000, FALSE, index, clock, config, irqcallback, memory);
|
||||
}
|
||||
|
||||
void r5000be_get_info(UINT32 state, cpuinfo *info)
|
||||
@ -2378,12 +2394,16 @@ void r5000le_get_info(UINT32 state, cpuinfo *info)
|
||||
#if (HAS_QED5271)
|
||||
static void qed5271be_init(int index, int clock, const void *config, int (*irqcallback)(int))
|
||||
{
|
||||
mips3com_init(&mips3.core, MIPS3_TYPE_QED5271, TRUE, index, clock, config, irqcallback);
|
||||
size_t memsize = mips3com_init(&mips3.core, MIPS3_TYPE_QED5271, TRUE, index, clock, config, irqcallback, NULL);
|
||||
void *memory = auto_malloc(memsize);
|
||||
mips3com_init(&mips3.core, MIPS3_TYPE_QED5271, TRUE, index, clock, config, irqcallback, memory);
|
||||
}
|
||||
|
||||
static void qed5271le_init(int index, int clock, const void *config, int (*irqcallback)(int))
|
||||
{
|
||||
mips3com_init(&mips3.core, MIPS3_TYPE_QED5271, FALSE, index, clock, config, irqcallback);
|
||||
size_t memsize = mips3com_init(&mips3.core, MIPS3_TYPE_QED5271, FALSE, index, clock, config, irqcallback, NULL);
|
||||
void *memory = auto_malloc(memsize);
|
||||
mips3com_init(&mips3.core, MIPS3_TYPE_QED5271, FALSE, index, clock, config, irqcallback, memory);
|
||||
}
|
||||
|
||||
void qed5271be_get_info(UINT32 state, cpuinfo *info)
|
||||
@ -2432,12 +2452,16 @@ void qed5271le_get_info(UINT32 state, cpuinfo *info)
|
||||
#if (HAS_RM7000)
|
||||
static void rm7000be_init(int index, int clock, const void *config, int (*irqcallback)(int))
|
||||
{
|
||||
mips3com_init(&mips3.core, MIPS3_TYPE_RM7000, TRUE, index, clock, config, irqcallback);
|
||||
size_t memsize = mips3com_init(&mips3.core, MIPS3_TYPE_RM7000, TRUE, index, clock, config, irqcallback, NULL);
|
||||
void *memory = auto_malloc(memsize);
|
||||
mips3com_init(&mips3.core, MIPS3_TYPE_RM7000, TRUE, index, clock, config, irqcallback, memory);
|
||||
}
|
||||
|
||||
static void rm7000le_init(int index, int clock, const void *config, int (*irqcallback)(int))
|
||||
{
|
||||
mips3com_init(&mips3.core, MIPS3_TYPE_RM7000, FALSE, index, clock, config, irqcallback);
|
||||
size_t memsize = mips3com_init(&mips3.core, MIPS3_TYPE_RM7000, FALSE, index, clock, config, irqcallback, NULL);
|
||||
void *memory = auto_malloc(memsize);
|
||||
mips3com_init(&mips3.core, MIPS3_TYPE_RM7000, FALSE, index, clock, config, irqcallback, memory);
|
||||
}
|
||||
|
||||
void rm7000be_get_info(UINT32 state, cpuinfo *info)
|
||||
|
@ -92,8 +92,12 @@ static const memory_handlers le_memory =
|
||||
structure based on the configured type
|
||||
-------------------------------------------------*/
|
||||
|
||||
void mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, int index, int clock, const struct mips3_config *config, int (*irqcallback)(int))
|
||||
size_t mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, int index, int clock, const struct mips3_config *config, int (*irqcallback)(int), void *memory)
|
||||
{
|
||||
/* if no memory, return the amount needed */
|
||||
if (memory == NULL)
|
||||
return config->icache + config->dcache + (sizeof(mips->tlb_table[0]) * (1 << (MIPS3_MAX_PADDR_SHIFT - MIPS3_MIN_PAGE_SHIFT)));
|
||||
|
||||
/* initialize the state */
|
||||
memset(mips, 0, sizeof(*mips));
|
||||
|
||||
@ -113,15 +117,16 @@ void mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, int in
|
||||
mips->memory = le_memory;
|
||||
|
||||
/* allocate memory */
|
||||
mips->icache = auto_malloc(config->icache);
|
||||
mips->dcache = auto_malloc(config->dcache);
|
||||
mips->tlb_table = auto_malloc(sizeof(mips->tlb_table[0]) * (1 << (MIPS3_MAX_PADDR_SHIFT - MIPS3_MIN_PAGE_SHIFT)));
|
||||
mips->icache = memory;
|
||||
mips->dcache = (void *)((UINT8 *)memory + config->icache);
|
||||
mips->tlb_table = (void *)((UINT8 *)memory + config->dcache);
|
||||
|
||||
/* allocate a timer for the compare interrupt */
|
||||
mips->compare_int_timer = timer_alloc(compare_int_callback, NULL);
|
||||
|
||||
/* reset the state */
|
||||
mips3com_reset(mips);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -216,7 +216,7 @@ struct _mips3_state
|
||||
FUNCTION PROTOTYPES
|
||||
***************************************************************************/
|
||||
|
||||
void mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, int index, int clock, const struct mips3_config *config, int (*irqcallback)(int));
|
||||
size_t mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, int index, int clock, const struct mips3_config *config, int (*irqcallback)(int), void *memory);
|
||||
void mips3com_reset(mips3_state *mips);
|
||||
#ifdef MAME_DEBUG
|
||||
offs_t mips3com_dasm(mips3_state *mips, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram);
|
||||
|
@ -161,6 +161,7 @@ static void mips3c_reset(void);
|
||||
***************************************************************************/
|
||||
|
||||
static mips3_regs mips3;
|
||||
static size_t allocatedsize;
|
||||
|
||||
|
||||
|
||||
@ -181,15 +182,17 @@ static void mips3_init(mips3_flavor flavor, int bigendian, int index, int clock,
|
||||
COMPILE_MAX_SEQUENCE, /* maximum instructions to include in a sequence */
|
||||
mips3fe_describe /* callback to describe a single instruction */
|
||||
};
|
||||
size_t memsize = mips3com_init(NULL, flavor, bigendian, index, clock, config, irqcallback, NULL);
|
||||
|
||||
/* allocate a cache and memory for the core data in a single block */
|
||||
mips3.core = osd_alloc_executable(CACHE_SIZE + sizeof(*mips3.core));
|
||||
allocatedsize = CACHE_SIZE + sizeof(*mips3.core) + memsize;
|
||||
mips3.core = osd_alloc_executable(allocatedsize);
|
||||
if (mips3.core == NULL)
|
||||
fatalerror("Unable to allocate cache of size %d\n", CACHE_SIZE);
|
||||
mips3.cache = (UINT8 *)(mips3.core + 1);
|
||||
fatalerror("Unable to allocate cache of size %d\n", allocatedsize);
|
||||
mips3.cache = (UINT8 *)(mips3.core + 1) + memsize;
|
||||
|
||||
/* initialize the core */
|
||||
mips3com_init(mips3.core, flavor, bigendian, index, clock, config, irqcallback);
|
||||
mips3com_init(mips3.core, flavor, bigendian, index, clock, config, irqcallback, mips3.core + 1);
|
||||
#if COMPARE_AGAINST_C
|
||||
mips3c_init(flavor, bigendian, index, clock, config, irqcallback);
|
||||
#endif
|
||||
@ -1246,7 +1249,9 @@ static const memory_handlers override_memory =
|
||||
|
||||
static void mips3c_init(mips3_flavor flavor, int bigendian, int index, int clock, const struct mips3_config *config, int (*irqcallback)(int))
|
||||
{
|
||||
mips3com_init(&c_mips3.core, flavor, bigendian, index, clock, config, irqcallback);
|
||||
size_t memsize = mips3com_init(&c_mips3.core, flavor, bigendian, index, clock, config, irqcallback, NULL);
|
||||
void *memory = auto_malloc(memsize);
|
||||
mips3com_init(&c_mips3.core, flavor, bigendian, index, clock, config, irqcallback, memory);
|
||||
mips3.orighandler = mips3.core->memory;
|
||||
mips3.core->memory = override_memory;
|
||||
c_mips3.core.memory = override_memory;
|
||||
|
Loading…
Reference in New Issue
Block a user