Skip to content

Commit b3e53b3

Browse files
authored
Merge pull request #808 from rickgaiser/for-ps2dev
General code improvements while trying to use LLVM
2 parents cc09fcc + c1cc246 commit b3e53b3

17 files changed

Lines changed: 34 additions & 43 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@ iop_obj/
3939
ee/erl-loader/src/exports.c
4040
tools/**/bin/
4141
docs/
42+
build/

iop/arcade/acata/src/acata-entry.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ int acAtaEntry(int argc, char **argv)
3434
{
3535
return ret;
3636
}
37-
if ( !RegisterLibraryEntries(&_exp_acata) == 0 )
37+
if ( RegisterLibraryEntries(&_exp_acata) != 0 )
3838
return -16;
3939
return 0;
4040
}

iop/cdvd/cdvdman/include/cdvdman.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ typedef struct cdvdman_dma3_parameter_
6464
typedef struct cdvdman_internal_struct_
6565
{
6666
char m_cdvdman_command;
67-
char m_last_error;
67+
unsigned char m_last_error;
6868
char m_unused_002;
6969
char m_ncmd_intr_count;
7070
int m_wait_flag;

iop/debug/iopdebug/src/iop_exceptions.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ ___iop_ex_def_handler_start:
231231
lw $s0, 0x040($s0) // restore s0
232232
nop
233233
jr $k1
234-
cop0 0x10
234+
rfe
235235
nop
236236
nop
237237
.end _iop_ex_def_handler
@@ -280,7 +280,7 @@ _iop_ex_dbg_handler:
280280
lw $s0, 0x040($s0) // restore s0
281281
nop
282282
jr $k1
283-
cop0 0x10
283+
rfe
284284
nop
285285
nop
286286
.end _iop_ex_dbg_handler

iop/debug/ioptrap/src/handler.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def_exc_handler:
147147
lw $k1, 0($k0)
148148
lw $k0, 0x410($0) # k0 saved here by exception prologue (at 0x80)
149149
jr $k1
150-
cop0 0x10
150+
rfe
151151
nop
152152
.set pop
153153
.end def_exc_handler
@@ -288,7 +288,7 @@ bp_exc_handler:
288288
lw $k1, 0($k0)
289289
lw $k0, 0x420($0) # k0 saved here by debug exception prologue (at 0x40)
290290
jr $k1
291-
cop0 0x10
291+
rfe
292292
nop
293293
.set pop
294294
.end bp_exc_handler

iop/dev9/atad/src/ps2atad.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ int ata_device_sector_io64(int device, void *buf, u64 lba, u32 nsectors, int dir
10301030

10311031
if (atad_devinfo[device].lba48 && (ata_dvrp_workaround ? (lba >= atad_devinfo[device].total_sectors) : 1)) {
10321032
/* Setup for 48-bit LBA. */
1033-
len = (nsectors > 65536) ? 65536 : nsectors;
1033+
len = (u16)((nsectors > 65536) ? 65536 : nsectors); /* 0 means 65536 in LBA48 */
10341034

10351035
/* Combine bits 24-31 and bits 0-7 of lba into sector. */
10361036
sector = ((lba >> 16) & 0xff00) | (lba & 0xff);

iop/fs/bdm/src/bdm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void bdm_connect_bd(struct block_device *bd)
5151
{
5252
int i;
5353

54-
M_PRINTF("connecting device %s%dp%d id=0x%x\n", bd->name, bd->devNr, bd->parNr, bd->parId);
54+
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);
5555

5656
for (i = 0; i < MAX_CONNECTIONS; ++i) {
5757
if (g_mount[i].bd == NULL) {
@@ -69,7 +69,7 @@ void bdm_disconnect_bd(struct block_device *bd)
6969
{
7070
int i;
7171

72-
M_PRINTF("disconnecting device %s%dp%d id=0x%x\n", bd->name, bd->devNr, bd->parNr, bd->parId);
72+
M_PRINTF("disconnecting device %s%dp%d\n", bd->name, bd->devNr, bd->parNr);
7373

7474
for (i = 0; i < MAX_CONNECTIONS; ++i) {
7575
if (g_mount[i].bd == bd) {

iop/fs/bdm/src/part_driver_gpt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ int part_connect_gpt(struct block_device *bd)
6767
entriesPerSector = bd->sectorSize / sizeof(gpt_partition_table_entry);
6868

6969
// Loop through all the partition table entries and attempt to mount each one.
70-
printf("Found GPT disk '%08x...'\n", *(u32*)&pGptHeader->disk_guid);
70+
M_PRINTF("Found GPT disk '%08x...'\n", *(u32*)&pGptHeader->disk_guid);
7171
for (int i = 0; i < pGptHeader->partition_count && endOfTable == 0; )
7272
{
7373
// 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)
133133
if ((partIndex = GetNextFreePartitionIndex()) == -1)
134134
{
135135
// No more free partition slots.
136-
printf("Can't mount partition, no more free partition slots!\n");
136+
M_PRINTF("Can't mount partition, no more free partition slots!\n");
137137
continue;
138138
}
139139

iop/fs/bdm/src/part_driver_mbr.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@ int partitions_sanity_check_mbr(struct block_device *bd, master_boot_record* pMb
1414
//At least one of them must be active.
1515
int valid = 0;
1616
int active = 0;
17-
17+
1818
for (int i = 0; i < 4; i++)
1919
{
20-
20+
2121
if (pMbrBlock->primary_partitions[i].partition_type != 0) {
22-
22+
2323
if((pMbrBlock->primary_partitions[i].first_lba == 0) || (pMbrBlock->primary_partitions[i].first_lba >= bd->sectorCount))
2424
return 0; //invalid
25-
25+
2626
active++;
2727
}
28-
28+
2929
valid++; //Considered at least a valid partition.
3030
}
31-
31+
3232
return (valid == 4) && (active > 0);
3333
}
3434

@@ -42,7 +42,7 @@ int part_connect_mbr(struct block_device *bd)
4242
int valid_partitions;
4343

4444
M_DEBUG("%s\n", __func__);
45-
45+
4646
// Filter out any block device where sectorOffset != 0, as this will be a block device for a file system partition and not
4747
// the raw device.
4848
if (bd->sectorOffset != 0)
@@ -82,18 +82,18 @@ int part_connect_mbr(struct block_device *bd)
8282
FreeSysMemory(pMbrBlock);
8383
return rval;
8484
}
85-
86-
85+
86+
8787
valid_partitions = partitions_sanity_check_mbr(bd, pMbrBlock);
8888

8989
//Most likely a VBR
9090
if(valid_partitions == 0) {
91-
printf("MBR disk valid_partitions=%d \n", valid_partitions);
91+
M_PRINTF("MBR disk valid_partitions=%d \n", valid_partitions);
9292
FreeSysMemory(pMbrBlock);
9393
return -1;
9494
}
9595

96-
printf("Found MBR disk\n");
96+
M_PRINTF("Found MBR disk\n");
9797

9898
// Loop and parse the primary partition entries in the MBR block.
9999
for (int i = 0; i < 4; i++)
@@ -106,14 +106,14 @@ int part_connect_mbr(struct block_device *bd)
106106
if (pMbrBlock->primary_partitions[i].partition_type == 0)
107107
continue;
108108

109-
printf("Found partition type 0x%02x\n", pMbrBlock->primary_partitions[i].partition_type);
110-
109+
M_PRINTF("Found partition type 0x%02x\n", pMbrBlock->primary_partitions[i].partition_type);
110+
111111
// TODO: Filter out unsupported partition types.
112112

113113
if ((partIndex = GetNextFreePartitionIndex()) == -1)
114114
{
115115
// No more free partition slots.
116-
printf("Can't mount partition, no more free partition slots!\n");
116+
M_PRINTF("Can't mount partition, no more free partition slots!\n");
117117
continue;
118118
}
119119

iop/fs/filexio/src/fileXio_iop.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ static int fileXio_GetDir_RPC(const char* pathname, struct fileXioDirEntry dirEn
386386
}
387387
// wait for any previous DMA to complete
388388
// before over-writing localDirEntry
389-
while(sceSifDmaStat(dmaID)>=0);
389+
while(sceSifDmaStat(dmaID)>=0) {}
390390
DirEntryCopy(&localDirEntry, &dirbuf);
391391
// DMA localDirEntry to the address specified by dirEntry[matched_entries]
392392
// setup the dma struct

0 commit comments

Comments
 (0)