diff --git a/.gitignore b/.gitignore index e5485ffe65e..28bfd800c95 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,4 @@ iop_obj/ ee/erl-loader/src/exports.c tools/**/bin/ docs/ +build/ diff --git a/iop/arcade/acata/src/acata-entry.c b/iop/arcade/acata/src/acata-entry.c index 12597742479..3ef73f78951 100644 --- a/iop/arcade/acata/src/acata-entry.c +++ b/iop/arcade/acata/src/acata-entry.c @@ -34,7 +34,7 @@ int acAtaEntry(int argc, char **argv) { return ret; } - if ( !RegisterLibraryEntries(&_exp_acata) == 0 ) + if ( RegisterLibraryEntries(&_exp_acata) != 0 ) return -16; return 0; } diff --git a/iop/cdvd/cdvdman/include/cdvdman.h b/iop/cdvd/cdvdman/include/cdvdman.h index 9c20739ea4e..46ea269e6c2 100644 --- a/iop/cdvd/cdvdman/include/cdvdman.h +++ b/iop/cdvd/cdvdman/include/cdvdman.h @@ -64,7 +64,7 @@ typedef struct cdvdman_dma3_parameter_ typedef struct cdvdman_internal_struct_ { char m_cdvdman_command; - char m_last_error; + unsigned char m_last_error; char m_unused_002; char m_ncmd_intr_count; int m_wait_flag; diff --git a/iop/debug/iopdebug/src/iop_exceptions.S b/iop/debug/iopdebug/src/iop_exceptions.S index 3a134aa2539..3ac06965ba7 100644 --- a/iop/debug/iopdebug/src/iop_exceptions.S +++ b/iop/debug/iopdebug/src/iop_exceptions.S @@ -231,7 +231,7 @@ ___iop_ex_def_handler_start: lw $s0, 0x040($s0) // restore s0 nop jr $k1 - cop0 0x10 + rfe nop nop .end _iop_ex_def_handler @@ -280,7 +280,7 @@ _iop_ex_dbg_handler: lw $s0, 0x040($s0) // restore s0 nop jr $k1 - cop0 0x10 + rfe nop nop .end _iop_ex_dbg_handler diff --git a/iop/debug/ioptrap/src/handler.S b/iop/debug/ioptrap/src/handler.S index 6d8b6af49c6..7d7510a844a 100644 --- a/iop/debug/ioptrap/src/handler.S +++ b/iop/debug/ioptrap/src/handler.S @@ -147,7 +147,7 @@ def_exc_handler: lw $k1, 0($k0) lw $k0, 0x410($0) # k0 saved here by exception prologue (at 0x80) jr $k1 - cop0 0x10 + rfe nop .set pop .end def_exc_handler @@ -288,7 +288,7 @@ bp_exc_handler: lw $k1, 0($k0) lw $k0, 0x420($0) # k0 saved here by debug exception prologue (at 0x40) jr $k1 - cop0 0x10 + rfe nop .set pop .end bp_exc_handler diff --git a/iop/dev9/atad/src/ps2atad.c b/iop/dev9/atad/src/ps2atad.c index 91cfcc29db4..8d2a32256f1 100644 --- a/iop/dev9/atad/src/ps2atad.c +++ b/iop/dev9/atad/src/ps2atad.c @@ -1030,7 +1030,7 @@ int ata_device_sector_io64(int device, void *buf, u64 lba, u32 nsectors, int dir if (atad_devinfo[device].lba48 && (ata_dvrp_workaround ? (lba >= atad_devinfo[device].total_sectors) : 1)) { /* Setup for 48-bit LBA. */ - len = (nsectors > 65536) ? 65536 : nsectors; + len = (u16)((nsectors > 65536) ? 65536 : nsectors); /* 0 means 65536 in LBA48 */ /* Combine bits 24-31 and bits 0-7 of lba into sector. */ sector = ((lba >> 16) & 0xff00) | (lba & 0xff); diff --git a/iop/fs/bdm/src/bdm.c b/iop/fs/bdm/src/bdm.c index 5c2d34c8b77..fc1feffd9ce 100644 --- a/iop/fs/bdm/src/bdm.c +++ b/iop/fs/bdm/src/bdm.c @@ -51,7 +51,7 @@ void bdm_connect_bd(struct block_device *bd) { int i; - M_PRINTF("connecting device %s%dp%d id=0x%x\n", bd->name, bd->devNr, bd->parNr, bd->parId); + M_PRINTF("connecting device %s%dp%d size=%luMB id=0x%x\n", bd->name, bd->devNr, bd->parNr, (u32)bd->sectorCount / ((1000 * 1000) / bd->sectorSize), bd->parId); for (i = 0; i < MAX_CONNECTIONS; ++i) { if (g_mount[i].bd == NULL) { @@ -69,7 +69,7 @@ void bdm_disconnect_bd(struct block_device *bd) { int i; - M_PRINTF("disconnecting device %s%dp%d id=0x%x\n", bd->name, bd->devNr, bd->parNr, bd->parId); + M_PRINTF("disconnecting device %s%dp%d\n", bd->name, bd->devNr, bd->parNr); for (i = 0; i < MAX_CONNECTIONS; ++i) { if (g_mount[i].bd == bd) { diff --git a/iop/fs/bdm/src/part_driver_gpt.c b/iop/fs/bdm/src/part_driver_gpt.c index 5294cd04ff5..3b626e5cc5e 100644 --- a/iop/fs/bdm/src/part_driver_gpt.c +++ b/iop/fs/bdm/src/part_driver_gpt.c @@ -67,7 +67,7 @@ int part_connect_gpt(struct block_device *bd) entriesPerSector = bd->sectorSize / sizeof(gpt_partition_table_entry); // Loop through all the partition table entries and attempt to mount each one. - printf("Found GPT disk '%08x...'\n", *(u32*)&pGptHeader->disk_guid); + M_PRINTF("Found GPT disk '%08x...'\n", *(u32*)&pGptHeader->disk_guid); for (int i = 0; i < pGptHeader->partition_count && endOfTable == 0; ) { // Check if we need to buffer more data, GPT usually uses LBA 2-33 for partition table entries. Typically there will @@ -133,7 +133,7 @@ int part_connect_gpt(struct block_device *bd) if ((partIndex = GetNextFreePartitionIndex()) == -1) { // No more free partition slots. - printf("Can't mount partition, no more free partition slots!\n"); + M_PRINTF("Can't mount partition, no more free partition slots!\n"); continue; } diff --git a/iop/fs/bdm/src/part_driver_mbr.c b/iop/fs/bdm/src/part_driver_mbr.c index a559047cc82..45d13e4239a 100644 --- a/iop/fs/bdm/src/part_driver_mbr.c +++ b/iop/fs/bdm/src/part_driver_mbr.c @@ -14,21 +14,21 @@ int partitions_sanity_check_mbr(struct block_device *bd, master_boot_record* pMb //At least one of them must be active. int valid = 0; int active = 0; - + for (int i = 0; i < 4; i++) { - + if (pMbrBlock->primary_partitions[i].partition_type != 0) { - + if((pMbrBlock->primary_partitions[i].first_lba == 0) || (pMbrBlock->primary_partitions[i].first_lba >= bd->sectorCount)) return 0; //invalid - + active++; } - + valid++; //Considered at least a valid partition. } - + return (valid == 4) && (active > 0); } @@ -42,7 +42,7 @@ int part_connect_mbr(struct block_device *bd) int valid_partitions; M_DEBUG("%s\n", __func__); - + // Filter out any block device where sectorOffset != 0, as this will be a block device for a file system partition and not // the raw device. if (bd->sectorOffset != 0) @@ -82,18 +82,18 @@ int part_connect_mbr(struct block_device *bd) FreeSysMemory(pMbrBlock); return rval; } - - + + valid_partitions = partitions_sanity_check_mbr(bd, pMbrBlock); //Most likely a VBR if(valid_partitions == 0) { - printf("MBR disk valid_partitions=%d \n", valid_partitions); + M_PRINTF("MBR disk valid_partitions=%d \n", valid_partitions); FreeSysMemory(pMbrBlock); return -1; } - printf("Found MBR disk\n"); + M_PRINTF("Found MBR disk\n"); // Loop and parse the primary partition entries in the MBR block. for (int i = 0; i < 4; i++) @@ -106,14 +106,14 @@ int part_connect_mbr(struct block_device *bd) if (pMbrBlock->primary_partitions[i].partition_type == 0) continue; - printf("Found partition type 0x%02x\n", pMbrBlock->primary_partitions[i].partition_type); - + M_PRINTF("Found partition type 0x%02x\n", pMbrBlock->primary_partitions[i].partition_type); + // TODO: Filter out unsupported partition types. if ((partIndex = GetNextFreePartitionIndex()) == -1) { // No more free partition slots. - printf("Can't mount partition, no more free partition slots!\n"); + M_PRINTF("Can't mount partition, no more free partition slots!\n"); continue; } diff --git a/iop/fs/filexio/src/fileXio_iop.c b/iop/fs/filexio/src/fileXio_iop.c index 41e441d9a93..ce35588247d 100644 --- a/iop/fs/filexio/src/fileXio_iop.c +++ b/iop/fs/filexio/src/fileXio_iop.c @@ -386,7 +386,7 @@ static int fileXio_GetDir_RPC(const char* pathname, struct fileXioDirEntry dirEn } // wait for any previous DMA to complete // before over-writing localDirEntry - while(sceSifDmaStat(dmaID)>=0); + while(sceSifDmaStat(dmaID)>=0) {} DirEntryCopy(&localDirEntry, &dirbuf); // DMA localDirEntry to the address specified by dirEntry[matched_entries] // setup the dma struct diff --git a/iop/fs/http/src/ps2http.c b/iop/fs/http/src/ps2http.c index 6d12f3415cf..3312ec3400a 100644 --- a/iop/fs/http/src/ps2http.c +++ b/iop/fs/http/src/ps2http.c @@ -140,7 +140,7 @@ int readLine( int socket, char * buffer, int size ) if ( rc <= 0 ) return rc; - if ( (*ptr == '\n') ) break; + if (*ptr == '\n') break; // increment after check for cr. Don't want to count the cr. count++; diff --git a/iop/iLink/IEEE1394_bd/src/scsi.c b/iop/iLink/IEEE1394_bd/src/scsi.c index 4d54c48a724..871ec5c89db 100644 --- a/iop/iLink/IEEE1394_bd/src/scsi.c +++ b/iop/iLink/IEEE1394_bd/src/scsi.c @@ -174,7 +174,7 @@ static int scsi_warmup(struct block_device *bd) bd->sectorSize = getBI32(&rcd.block_length); bd->sectorOffset = 0; bd->sectorCount = getBI32(&rcd.last_lba); - M_PRINTF("%u %u-byte logical blocks: (%uMB / %uMiB)\n", bd->sectorCount, bd->sectorSize, bd->sectorCount / ((1000 * 1000) / bd->sectorSize), bd->sectorCount / ((1024 * 1024) / bd->sectorSize)); + M_PRINTF("%lu %u-byte logical blocks: (%luMB / %luMiB)\n", (u32)bd->sectorCount, bd->sectorSize, (u32)bd->sectorCount / ((1000 * 1000) / bd->sectorSize), (u32)bd->sectorCount / ((1024 * 1024) / bd->sectorSize)); return 0; } diff --git a/iop/sio/mx4sio_bd/src/spi_sdcard_driver_config.h b/iop/sio/mx4sio_bd/src/spi_sdcard_driver_config.h index fa352497e91..0de5830a19b 100644 --- a/iop/sio/mx4sio_bd/src/spi_sdcard_driver_config.h +++ b/iop/sio/mx4sio_bd/src/spi_sdcard_driver_config.h @@ -4,15 +4,7 @@ /* Includes ------------------------------------------------------------------*/ #include -#include - -typedef u8 uint8_t; -typedef u16 uint16_t; -typedef u32 uint32_t; - -typedef s8 int8_t; -typedef s16 int16_t; -typedef s32 int32_t; +#include #define SPISD_ASSERT(cond) \ while (!cond) {}; diff --git a/iop/sound/libsnd2/src/ssclose.c b/iop/sound/libsnd2/src/ssclose.c index 5c50b687fd4..d1b1cbcf7d3 100644 --- a/iop/sound/libsnd2/src/ssclose.c +++ b/iop/sound/libsnd2/src/ssclose.c @@ -25,7 +25,7 @@ static void _SsClose(s16 seq_sep_no) score_struct = &_ss_score[sep_no][seq_no]; score_struct->m_flags = 0; - score_struct->m_next_sep = 255; + score_struct->m_next_sep = -1; score_struct->m_next_seq = 0; score_struct->m_unk48 = 0; score_struct->m_unk4A = 0; diff --git a/iop/sound/libsnd2/src/sstable.c b/iop/sound/libsnd2/src/sstable.c index 044e8c430c1..dc5c5e1b6d0 100644 --- a/iop/sound/libsnd2/src/sstable.c +++ b/iop/sound/libsnd2/src/sstable.c @@ -38,7 +38,7 @@ void SsSetTableSize(char *table, s16 s_max, s16 t_max) score_struct = &_ss_score[i][j]; score_struct->m_flags = 0; - score_struct->m_next_sep = 255; + score_struct->m_next_sep = -1; score_struct->m_next_seq = 0; score_struct->m_unk48 = 0; score_struct->m_unk4A = 0; diff --git a/iop/usb/usbmass_bd/src/scsi.c b/iop/usb/usbmass_bd/src/scsi.c index ec8076e8a58..a7d3ba9906e 100644 --- a/iop/usb/usbmass_bd/src/scsi.c +++ b/iop/usb/usbmass_bd/src/scsi.c @@ -174,7 +174,7 @@ static int scsi_warmup(struct block_device *bd) bd->sectorSize = getBI32(&rcd.block_length); bd->sectorOffset = 0; bd->sectorCount = getBI32(&rcd.last_lba); - M_PRINTF("%u %u-byte logical blocks: (%uMB / %uMiB)\n", bd->sectorCount, bd->sectorSize, bd->sectorCount / ((1000 * 1000) / bd->sectorSize), bd->sectorCount / ((1024 * 1024) / bd->sectorSize)); + M_PRINTF("%lu %u-byte logical blocks: (%luMB / %luMiB)\n", (u32)bd->sectorCount, bd->sectorSize, (u32)bd->sectorCount / ((1000 * 1000) / bd->sectorSize), (u32)bd->sectorCount / ((1024 * 1024) / bd->sectorSize)); return 0; } diff --git a/samples/ps2dev_iop.cmake b/samples/ps2dev_iop.cmake index cdfb6c3fc02..3b8abb90d0b 100644 --- a/samples/ps2dev_iop.cmake +++ b/samples/ps2dev_iop.cmake @@ -27,9 +27,7 @@ SET(CMAKE_SYSTEM_VERSION 1) SET(CMAKE_SYSTEM_PROCESSOR mips) SET(CMAKE_C_COMPILER mipsel-none-elf-gcc) SET(CMAKE_CXX_COMPILER mipsel-none-elf-g++) -SET(CMAKE_C_COMPILER_WORKS 1) #Hack by f0bes -SET(CMAKE_CXX_COMPILER_WORKS 1) #Hack by f0bes - +SET(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) # # set arch flags depending on gcc version