Fix compiler warnings on ARM builds.

This commit is contained in:
SarahW 2018-08-02 22:09:18 +01:00
commit 42d62925c3
6 changed files with 50 additions and 57 deletions

View file

@ -14,7 +14,6 @@ static ATAPI ioctl_atapi;
static uint32_t last_block = 0;
static uint32_t cdrom_capacity = 0;
static int ioctl_inited = 0;
static char ioctl_path[8];
static int tocvalid = 0;
static struct cdrom_tocentry toc[256];
static int toc_tracks;
@ -209,7 +208,7 @@ static int read_toc(int fd, struct cdrom_tocentry *btoc)
first_track = toc_hdr.cdth_trk0;
last_track = toc_hdr.cdth_trk1;
//pclog("read_toc: first_track=%i last_track=%i\n", first_track, last_track);
memset(btoc, 0, sizeof(btoc));
memset(btoc, 0, sizeof(struct cdrom_tocentry));
c = 0;
for (track = 0; track < 256; track++)
@ -233,8 +232,6 @@ static int read_toc(int fd, struct cdrom_tocentry *btoc)
static int ioctl_ready(void)
{
long size;
int temp;
struct cdrom_tochdr toc_hdr;
struct cdrom_tocentry toc_entry;
int err;
@ -266,7 +263,6 @@ static int ioctl_ready(void)
(toc_entry.cdte_addr.msf.frame != toc[toc_hdr.cdth_trk1].cdte_addr.msf.frame ) ||
!tocvalid)
{
int track;
ioctl_cd_state = CD_STOPPED;
tocvalid = read_toc(ioctl_fd, toc);
@ -306,8 +302,6 @@ static int ioctl_get_last_block(unsigned char starttrack, int msf, int maxlen, i
static int ioctl_medium_changed(void)
{
long size;
int temp;
struct cdrom_tochdr toc_hdr;
struct cdrom_tocentry toc_entry;
int err;
@ -338,15 +332,12 @@ static int ioctl_medium_changed(void)
static uint8_t ioctl_getcurrentsubchannel(uint8_t *b, int msf)
{
struct cdrom_subchnl sub;
uint32_t cdpos = ioctl_cd_pos;
int track = get_track_nr(cdpos);
uint32_t track_address = toc[track].cdte_addr.msf.frame +
(toc[track].cdte_addr.msf.second * 75) +
(toc[track].cdte_addr.msf.minute * 75 * 60);
long size;
int pos=0;
int err;
uint8_t ret;
//pclog("ioctl_getsubchannel: cdpos=%x track_address=%x track=%i\n", cdpos, track_address, track);
if (ioctl_cd_state == CD_PLAYING)
@ -460,7 +451,6 @@ static void ioctl_readsector_raw(uint8_t *b, int sector)
static int ioctl_readtoc(unsigned char *b, unsigned char starttrack, int msf, int maxlen, int single)
{
int len=4;
long size;
int c,d;
uint32_t temp;
uint32_t last_address = 0;
@ -644,7 +634,7 @@ static uint32_t ioctl_size()
static int ioctl_status()
{
if (!(ioctl_ready) && (cdrom_drive <= 0)) return CD_STATUS_EMPTY;
if (!ioctl_ready() && (cdrom_drive <= 0)) return CD_STATUS_EMPTY;
switch(ioctl_cd_state)
{
@ -653,6 +643,7 @@ static int ioctl_status()
case CD_PAUSED:
return CD_STATUS_PAUSED;
case CD_STOPPED:
default:
return CD_STATUS_STOPPED;
}
}

View file

@ -34,7 +34,7 @@ int codegen_host_reg_list[CODEGEN_HOST_REGS] =
static void build_load_routine(codeblock_t *block, int size)
{
uint32_t *branch_offset;
uint8_t *misaligned_offset;
uint32_t *misaligned_offset;
/*In - R0 = address
Out - R0 = data, R1 = abrt*/
@ -73,7 +73,7 @@ static void build_load_routine(codeblock_t *block, int size)
*branch_offset |= ((((uintptr_t)&block->data[block_pos] - (uintptr_t)branch_offset) - 8) & 0x3fffffc) >> 2;
if (size != 1)
*misaligned_offset |= ((((uintptr_t)&block->data[block_pos] - (uintptr_t)misaligned_offset) - 8) & 0x3fffffc) >> 2;
host_arm_STR_IMM_WB(block, REG_LR, REG_SP, -4);
host_arm_STR_IMM_WB(block, REG_LR, REG_HOST_SP, -4);
if (size == 1)
host_arm_BL(block, (uintptr_t)readmemb386l);
else if (size == 2)
@ -83,15 +83,15 @@ static void build_load_routine(codeblock_t *block, int size)
else
fatal("build_load_routine - unknown size %i\n", size);
host_arm_LDRB_ABS(block, REG_R1, &cpu_state.abrt);
host_arm_LDR_IMM_POST(block, REG_PC, REG_SP, 4);
host_arm_LDR_IMM_POST(block, REG_PC, REG_HOST_SP, 4);
block_pos = (block_pos + 63) & ~63;
}
static void build_store_routine(codeblock_t *block, int size)
{
uint8_t *branch_offset;
uint8_t *misaligned_offset;
uint32_t *branch_offset;
uint32_t *misaligned_offset;
/*In - R0 = address
Out - R0 = data, R1 = abrt*/
@ -130,7 +130,7 @@ static void build_store_routine(codeblock_t *block, int size)
*branch_offset |= ((((uintptr_t)&block->data[block_pos] - (uintptr_t)branch_offset) - 8) & 0x3fffffc) >> 2;
if (size != 1)
*misaligned_offset |= ((((uintptr_t)&block->data[block_pos] - (uintptr_t)misaligned_offset) - 8) & 0x3fffffc) >> 2;
host_arm_STR_IMM_WB(block, REG_LR, REG_SP, -4);
host_arm_STR_IMM_WB(block, REG_LR, REG_HOST_SP, -4);
if (size == 1)
host_arm_BL(block, (uintptr_t)writememb386l);
else if (size == 2)
@ -140,7 +140,7 @@ static void build_store_routine(codeblock_t *block, int size)
else
fatal("build_store_routine - unknown size %i\n", size);
host_arm_LDRB_ABS(block, REG_R1, &cpu_state.abrt);
host_arm_LDR_IMM_POST(block, REG_PC, REG_SP, 4);
host_arm_LDR_IMM_POST(block, REG_PC, REG_HOST_SP, 4);
block_pos = (block_pos + 63) & ~63;
}
@ -221,15 +221,15 @@ void codegen_backend_prologue(codeblock_t *block)
host_arm_nop(block);
block_pos = BLOCK_EXIT_OFFSET; /*Exit code*/
host_arm_ADD_IMM(block, REG_SP, REG_SP, 0x20);
host_arm_LDMIA_WB(block, REG_SP, REG_MASK_LOCAL | REG_MASK_PC);
host_arm_ADD_IMM(block, REG_HOST_SP, REG_HOST_SP, 0x20);
host_arm_LDMIA_WB(block, REG_HOST_SP, REG_MASK_LOCAL | REG_MASK_PC);
while (block_pos != BLOCK_START)
host_arm_nop(block);
/*Entry code*/
host_arm_STMDB_WB(block, REG_SP, REG_MASK_LOCAL | REG_MASK_LR);
host_arm_SUB_IMM(block, REG_SP, REG_SP, 0x20);
host_arm_STMDB_WB(block, REG_HOST_SP, REG_MASK_LOCAL | REG_MASK_LR);
host_arm_SUB_IMM(block, REG_HOST_SP, REG_HOST_SP, 0x20);
host_arm_ADD_IMM(block, REG_LITERAL, REG_PC, ARM_LITERAL_POOL_OFFSET);
host_arm_SUB_IMM(block, REG_LITERAL, REG_LITERAL, 16 + BLOCK_START);
offset = add_literal(block, (uintptr_t)&cpu_state);
@ -238,8 +238,8 @@ void codegen_backend_prologue(codeblock_t *block)
void codegen_backend_epilogue(codeblock_t *block)
{
host_arm_ADD_IMM(block, REG_SP, REG_SP, 0x20);
host_arm_LDMIA_WB(block, REG_SP, REG_MASK_LOCAL | REG_MASK_PC);
host_arm_ADD_IMM(block, REG_HOST_SP, REG_HOST_SP, 0x20);
host_arm_LDMIA_WB(block, REG_HOST_SP, REG_MASK_LOCAL | REG_MASK_PC);
if (block_pos > ARM_LITERAL_POOL_OFFSET)
fatal("Over limit!\n");

View file

@ -11,7 +11,7 @@
#define REG_R10 10
#define REG_R11 11
#define REG_R12 12
#define REG_SP 13
#define REG_HOST_SP 13
#define REG_LR 14
#define REG_PC 15
@ -38,7 +38,7 @@
#define REG_MASK_R10 (1 << REG_R10)
#define REG_MASK_R11 (1 << REG_R11)
#define REG_MASK_R12 (1 << REG_R12)
#define REG_MASK_SP (1 << REG_SP)
#define REG_MASK_SP (1 << REG_HOST_SP)
#define REG_MASK_LR (1 << REG_LR)
#define REG_MASK_PC (1 << REG_PC)

View file

@ -233,7 +233,7 @@ static int codegen_CMP_IMM_JZ(codeblock_t *block, uop_t *uop)
}
else
fatal("CMP_IMM_JZ %02x\n", uop->src_reg_a_real);
host_arm_BEQ(block, uop->p);
host_arm_BEQ(block, (uintptr_t)uop->p);
return 0;
}
@ -299,20 +299,20 @@ static int codegen_MEM_LOAD_ABS(codeblock_t *block, uop_t *uop)
host_arm_ADD_IMM(block, REG_R0, seg_reg, uop->imm_data);
if (REG_IS_B(dest_size) || REG_IS_BH(dest_size))
{
host_arm_BL(block, codegen_mem_load_byte);
host_arm_BL(block, (uintptr_t)codegen_mem_load_byte);
}
else if (REG_IS_W(dest_size))
{
host_arm_BL(block, codegen_mem_load_word);
host_arm_BL(block, (uintptr_t)codegen_mem_load_word);
}
else if (REG_IS_L(dest_size))
{
host_arm_BL(block, codegen_mem_load_long);
host_arm_BL(block, (uintptr_t)codegen_mem_load_long);
}
else
fatal("MEM_LOAD_ABS - %02x\n", uop->dest_reg_a_real);
host_arm_TST_REG(block, REG_R1, REG_R1);
host_arm_BNE(block, &block->data[BLOCK_EXIT_OFFSET]);
host_arm_BNE(block, (uintptr_t)&block->data[BLOCK_EXIT_OFFSET]);
if (REG_IS_B(dest_size))
{
host_arm_BFI(block, dest_reg, REG_R0, 0, 8);
@ -341,20 +341,20 @@ static int codegen_MEM_LOAD_REG(codeblock_t *block, uop_t *uop)
host_arm_ADD_REG(block, REG_R0, seg_reg, addr_reg);
if (REG_IS_B(dest_size) || REG_IS_BH(dest_size))
{
host_arm_BL(block, codegen_mem_load_byte);
host_arm_BL(block, (uintptr_t)codegen_mem_load_byte);
}
else if (REG_IS_W(dest_size))
{
host_arm_BL(block, codegen_mem_load_word);
host_arm_BL(block, (uintptr_t)codegen_mem_load_word);
}
else if (REG_IS_L(dest_size))
{
host_arm_BL(block, codegen_mem_load_long);
host_arm_BL(block, (uintptr_t)codegen_mem_load_long);
}
else
fatal("MEM_LOAD_REG - %02x\n", uop->dest_reg_a_real);
host_arm_TST_REG(block, REG_R1, REG_R1);
host_arm_BNE(block, &block->data[BLOCK_EXIT_OFFSET]);
host_arm_BNE(block, (uintptr_t)&block->data[BLOCK_EXIT_OFFSET]);
if (REG_IS_B(dest_size))
{
host_arm_BFI(block, dest_reg, REG_R0, 0, 8);
@ -384,22 +384,22 @@ static int codegen_MEM_STORE_ABS(codeblock_t *block, uop_t *uop)
if (REG_IS_B(src_size))
{
host_arm_MOV_REG(block, REG_R1, src_reg);
host_arm_BL(block, codegen_mem_store_byte);
host_arm_BL(block, (uintptr_t)codegen_mem_store_byte);
}
else if (REG_IS_W(src_size))
{
host_arm_MOV_REG(block, REG_R1, src_reg);
host_arm_BL(block, codegen_mem_store_word);
host_arm_BL(block, (uintptr_t)codegen_mem_store_word);
}
else if (REG_IS_L(src_size))
{
host_arm_MOV_REG(block, REG_R1, src_reg);
host_arm_BL(block, codegen_mem_store_long);
host_arm_BL(block, (uintptr_t)codegen_mem_store_long);
}
else
fatal("MEM_STORE_ABS - %02x\n", uop->src_reg_b_real);
host_arm_TST_REG(block, REG_R1, REG_R1);
host_arm_BNE(block, &block->data[BLOCK_EXIT_OFFSET]);
host_arm_BNE(block, (uintptr_t)&block->data[BLOCK_EXIT_OFFSET]);
return 0;
}
@ -413,27 +413,27 @@ static int codegen_MEM_STORE_REG(codeblock_t *block, uop_t *uop)
if (REG_IS_B(src_size))
{
host_arm_MOV_REG(block, REG_R1, src_reg);
host_arm_BL(block, codegen_mem_store_byte);
host_arm_BL(block, (uintptr_t)codegen_mem_store_byte);
}
else if (REG_IS_BH(src_size))
{
host_arm_MOV_REG_LSR(block, REG_R1, src_reg, 8);
host_arm_BL(block, codegen_mem_store_byte);
host_arm_BL(block, (uintptr_t)codegen_mem_store_byte);
}
else if (REG_IS_W(src_size))
{
host_arm_MOV_REG(block, REG_R1, src_reg);
host_arm_BL(block, codegen_mem_store_word);
host_arm_BL(block, (uintptr_t)codegen_mem_store_word);
}
else if (REG_IS_L(src_size))
{
host_arm_MOV_REG(block, REG_R1, src_reg);
host_arm_BL(block, codegen_mem_store_long);
host_arm_BL(block, (uintptr_t)codegen_mem_store_long);
}
else
fatal("MEM_STORE_REG - %02x\n", uop->src_reg_c_real);
host_arm_TST_REG(block, REG_R1, REG_R1);
host_arm_BNE(block, &block->data[BLOCK_EXIT_OFFSET]);
host_arm_BNE(block, (uintptr_t)&block->data[BLOCK_EXIT_OFFSET]);
return 0;
}
@ -444,9 +444,9 @@ static int codegen_MEM_STORE_IMM_8(codeblock_t *block, uop_t *uop)
host_arm_ADD_REG(block, REG_R0, seg_reg, addr_reg);
host_arm_MOV_IMM(block, REG_R1, uop->imm_data);
host_arm_BL(block, codegen_mem_store_byte);
host_arm_BL(block, (uintptr_t)codegen_mem_store_byte);
host_arm_TST_REG(block, REG_R1, REG_R1);
host_arm_BNE(block, &block->data[BLOCK_EXIT_OFFSET]);
host_arm_BNE(block, (uintptr_t)&block->data[BLOCK_EXIT_OFFSET]);
return 0;
}
@ -456,9 +456,9 @@ static int codegen_MEM_STORE_IMM_16(codeblock_t *block, uop_t *uop)
host_arm_ADD_REG(block, REG_R0, seg_reg, addr_reg);
host_arm_MOV_IMM(block, REG_R1, uop->imm_data);
host_arm_BL(block, codegen_mem_store_word);
host_arm_BL(block, (uintptr_t)codegen_mem_store_word);
host_arm_TST_REG(block, REG_R1, REG_R1);
host_arm_BNE(block, &block->data[BLOCK_EXIT_OFFSET]);
host_arm_BNE(block, (uintptr_t)&block->data[BLOCK_EXIT_OFFSET]);
return 0;
}
@ -468,9 +468,9 @@ static int codegen_MEM_STORE_IMM_32(codeblock_t *block, uop_t *uop)
host_arm_ADD_REG(block, REG_R0, seg_reg, addr_reg);
host_arm_MOV_IMM(block, REG_R1, uop->imm_data);
host_arm_BL(block, codegen_mem_store_long);
host_arm_BL(block, (uintptr_t)codegen_mem_store_long);
host_arm_TST_REG(block, REG_R1, REG_R1);
host_arm_BNE(block, &block->data[BLOCK_EXIT_OFFSET]);
host_arm_BNE(block, (uintptr_t)&block->data[BLOCK_EXIT_OFFSET]);
return 0;
}
@ -908,7 +908,7 @@ void codegen_direct_write_ptr(codeblock_t *block, void *p, int host_reg)
void codegen_direct_read_32_stack(codeblock_t *block, int host_reg, int stack_offset)
{
if (stack_offset >= 0 && stack_offset < 4096)
host_arm_LDR_IMM(block, host_reg, REG_SP, stack_offset);
host_arm_LDR_IMM(block, host_reg, REG_HOST_SP, stack_offset);
else
fatal("codegen_direct_read_32 - not in range\n");
}
@ -916,7 +916,7 @@ void codegen_direct_read_32_stack(codeblock_t *block, int host_reg, int stack_of
void codegen_direct_write_32_stack(codeblock_t *block, int stack_offset, int host_reg)
{
if (stack_offset >= 0 && stack_offset < 4096)
host_arm_STR_IMM(block, host_reg, REG_SP, stack_offset);
host_arm_STR_IMM(block, host_reg, REG_HOST_SP, stack_offset);
else
fatal("codegen_direct_write_32 - not in range\n");
}

View file

@ -1628,7 +1628,7 @@ static void fdi2_decode (FDI *fdi, uint32_t totalavg, uae_u32 *avgp, uae_u32 *mi
randval = rand();
if (randval < (RAND_MAX / 2)) {
if (randval > (RAND_MAX / 4)) {
if (randval <= (3 * RAND_MAX / 8))
if (randval <= (3 * (int64_t)RAND_MAX / 8))
randval = (2 * randval) - (RAND_MAX /4);
else
randval = (4 * randval) - RAND_MAX;
@ -1637,7 +1637,7 @@ static void fdi2_decode (FDI *fdi, uint32_t totalavg, uae_u32 *avgp, uae_u32 *mi
} else {
randval -= RAND_MAX / 2;
if (randval > (RAND_MAX / 4)) {
if (randval <= (3 * RAND_MAX / 8))
if (randval <= (3 * (int64_t)RAND_MAX / 8))
randval = (2 * randval) - (RAND_MAX /4);
else
randval = (4 * randval) - RAND_MAX;
@ -1663,7 +1663,7 @@ static void fdi2_decode (FDI *fdi, uint32_t totalavg, uae_u32 *avgp, uae_u32 *mi
randval = rand();
if (randval < (RAND_MAX / 2)) {
if (randval > (RAND_MAX / 4)) {
if (randval <= (3 * RAND_MAX / 8))
if (randval <= (3 * (int64_t)RAND_MAX / 8))
randval = (2 * randval) - (RAND_MAX /4);
else
randval = (4 * randval) - RAND_MAX;
@ -1672,7 +1672,7 @@ static void fdi2_decode (FDI *fdi, uint32_t totalavg, uae_u32 *avgp, uae_u32 *mi
} else {
randval -= RAND_MAX / 2;
if (randval > (RAND_MAX / 4)) {
if (randval <= (3 * RAND_MAX / 8))
if (randval <= (3 * (int64_t)RAND_MAX / 8))
randval = (2 * randval) - (RAND_MAX /4);
else
randval = (4 * randval) - RAND_MAX;

View file

@ -2659,7 +2659,9 @@ static void voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, vood
int dither = params->fbzMode & FBZ_DITHER;*/
int texels;
int c;
#ifndef NO_CODEGEN
uint8_t (*voodoo_draw)(voodoo_state_t *state, voodoo_params_t *params, int x, int real_y);
#endif
int y_diff = SLI_ENABLED ? 2 : 1;
if ((params->textureMode[0] & TEXTUREMODE_MASK) == TEXTUREMODE_PASSTHROUGH ||