Fix out of bounds read bug on open bus read
This bug doesn't affect many games but makes sanitizers unhappy. Also fix some minor FIFO clear bug
This commit is contained in:
parent
7068cbc95b
commit
8207775256
2
common.h
2
common.h
|
@ -21,7 +21,7 @@
|
|||
#define COMMON_H
|
||||
|
||||
#define ror(dest, value, shift) \
|
||||
dest = ((value) >> shift) | ((value) << (32 - shift)) \
|
||||
dest = ((value) >> (shift)) | ((value) << (32 - (shift))) \
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define PATH_SEPARATOR "\\"
|
||||
|
|
2
cpu.c
2
cpu.c
|
@ -954,7 +954,7 @@ const u32 psr_masks[16] =
|
|||
} \
|
||||
if(((_address >> 24) == 0) && (pc >= 0x4000)) \
|
||||
{ \
|
||||
dest = *((type *)((u8 *)&bios_read_protect + (_address & 0x03))); \
|
||||
ror(dest, bios_read_protect, (_address & 0x03) << 3); \
|
||||
} \
|
||||
else \
|
||||
\
|
||||
|
|
|
@ -574,7 +574,7 @@ u32 function_cc read_eeprom(void)
|
|||
case 0x00: \
|
||||
/* BIOS */ \
|
||||
if(reg[REG_PC] >= 0x4000) \
|
||||
value = readaddress##type(&bios_read_protect, address & 0x03); \
|
||||
ror(value, bios_read_protect, (address & 0x03) << 3); \
|
||||
else \
|
||||
value = readaddress##type(bios_rom, address & 0x3FFF); \
|
||||
break; \
|
||||
|
|
6
sound.c
6
sound.c
|
@ -77,7 +77,7 @@ void sound_timer_queue32(u32 channel, u32 value)
|
|||
void sound_timer(fixed8_24 frequency_step, u32 channel)
|
||||
{
|
||||
direct_sound_status_type sample_status = DIRECT_SOUND_INACTIVE;
|
||||
direct_sound_struct *ds = direct_sound_channel + channel;
|
||||
direct_sound_struct *ds = &direct_sound_channel[channel];
|
||||
|
||||
fixed8_24 fifo_fractional = ds->fifo_fractional;
|
||||
u32 buffer_index = ds->buffer_index;
|
||||
|
@ -172,9 +172,7 @@ void sound_timer(fixed8_24 frequency_step, u32 channel)
|
|||
|
||||
void sound_reset_fifo(u32 channel)
|
||||
{
|
||||
direct_sound_struct *ds = direct_sound_channel;
|
||||
|
||||
memset(ds->fifo, 0, 32);
|
||||
memset(direct_sound_channel[channel].fifo, 0, 32);
|
||||
}
|
||||
|
||||
// Initial pattern data = 4bits (signed)
|
||||
|
|
|
@ -1355,7 +1355,8 @@ void function_cc execute_store_spsr(u32 new_spsr, u32 store_mask)
|
|||
\
|
||||
if(((address >> 24) == 0) && (reg[REG_PC] >= 0x4000)) \
|
||||
{ \
|
||||
dest = *((type *)((u8 *)&bios_read_protect + (address & 0x03))); \
|
||||
ror(dest, bios_read_protect, (address & 0x03) << 3); \
|
||||
dest = (type)dest; \
|
||||
} \
|
||||
else \
|
||||
\
|
||||
|
@ -1376,7 +1377,8 @@ void function_cc execute_store_spsr(u32 new_spsr, u32 store_mask)
|
|||
\
|
||||
if(((address >> 24) == 0) && (reg[REG_PC] >= 0x4000)) \
|
||||
{ \
|
||||
dest = *((s16 *)((u8 *)&bios_read_protect + (address & 0x03))); \
|
||||
ror(dest, bios_read_protect, (address & 0x03) << 3); \
|
||||
dest = (s16)dest; \
|
||||
} \
|
||||
else \
|
||||
\
|
||||
|
|
Loading…
Reference in New Issue