Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP UNTESTED - Fix building with gcc14 #3

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion patch/src/patch.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ int __attribute__((section(".text_entry"))) _start(void)
printf("Patch: Initializing heap between: 0x%x - 0x%x\n", ppc_patch_end, ppc_heap_end);

// init heap
umm_init_heap(ppc_patch_end, (ppc_heap_end - ppc_patch_end));
umm_init_heap((void *)ppc_patch_end, (ppc_heap_end - ppc_patch_end));

printf("Patch: Heap initialized, size: 0x%x (%i bytes)\n", ppc_heap_size, ppc_heap_size);

Expand Down
48 changes: 22 additions & 26 deletions patch/src/ppc_mon/src/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,10 @@ static int command_mem()

counter++;
} while (counter < len);

} else {
printf("Invalid action: %c\n", *rw);
return -1;
}

printf("Invalid action: %c\n", *rw);
return -1;
}

/* Reg commands:
Expand Down Expand Up @@ -255,13 +253,10 @@ static int command_reg()

counter++;
} while (counter < len);
}

} else {
printf("Invalid action: %c\n", *rw);
return -1;
}


printf("Invalid action: %c\n", *rw);
return -1;
}

/* Dump commands:
Expand Down Expand Up @@ -663,7 +658,7 @@ static int command_gte()
char *rw = pm_parser_get_argv_ptr(1);
char *reg = pm_parser_get_argv_ptr(2);

uint32_t value = pm_parser_get_argv_ptr(3);
uint32_t value = pm_parser_get_argv_dec(3);
uint32_t reg_num = 0;
uint32_t readback = 0;

Expand Down Expand Up @@ -811,7 +806,7 @@ static int command_gte()
static int command_xparam()
{
//TEMP:
void *xparam_str_ptr = 0xbe0a30;
void *xparam_str_ptr = (void *)0xbe0a30;

char *rw = pm_parser_get_argv_ptr(1);
uint32_t num = pm_parser_get_argv_dec(2);
Expand Down Expand Up @@ -841,10 +836,10 @@ static int command_xparam()
} else {
printf("XPARAM %i does not exist\n", num);
}
} else {
printf("Invalid action: %c\n", *rw);
return -1;
}
}

printf("Invalid action: %c\n", *rw);
return -1;
}

/* Emulator commands:
Expand Down Expand Up @@ -1148,10 +1143,10 @@ static int command_settings()
default:
break;
}
} else {
printf("Invalid action %c\n", *drw);
return -1;
}
}
printf("Invalid action %c\n", *drw);
return -1;
}

/* TODO: PPC core commands:
Expand Down Expand Up @@ -1205,11 +1200,10 @@ static int command_ppc()
} else if (*drw == 'r') {

} else if (*drw == 'w') {
}

} else {
printf("Invalid action: %c\n", *drw);
return -1;
}
printf("Invalid action: %c\n", *drw);
return -1;
}

/* Debug commands:
Expand All @@ -1220,7 +1214,7 @@ static int command_ppc()
* arg2: <r|w|b>
* arg3: <address>
*/
static void command_debug()
static int command_debug()
{
char *action = pm_parser_get_argv_ptr(1);
char *option = pm_parser_get_argv_ptr(2);
Expand Down Expand Up @@ -1286,6 +1280,8 @@ static void command_debug()
default:
break;
}

return 0;
}

pm_cmd_t pm_core_cmds[] = {
Expand Down Expand Up @@ -1398,7 +1394,7 @@ pm_cmd_t pm_core_cmds[] = {
},
{
.name = "debug",
.help = "debug <w|b> <r|w|b> <address>",
.help = "debug <w|b> <r|w|b> <address>\n"
"debug <c>",
.func = &command_debug
}
Expand Down
12 changes: 6 additions & 6 deletions patch/src/ppc_mon/src/ppc_mon.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static int ascii_hex_to_int(char *str)
int pm_parser_get_argc()
{
int argc = 1;
char *str = &rx_buf;
char *str = rx_buf;

while (*str != '\0') {
//Ignore extra whitespace
Expand All @@ -102,7 +102,7 @@ int pm_parser_get_argv_len(int n)
uint32_t arg = 0;
uint32_t len = 0;

char *str = &rx_buf;
char *str = rx_buf;

while (*str != '\0')
{
Expand All @@ -126,7 +126,7 @@ char *pm_parser_get_argv_ptr(int n)
uint32_t arg = 0;
uint32_t pos = 0;

char *str = &rx_buf;
char *str = rx_buf;

while (*str != '\0')
{
Expand All @@ -150,7 +150,7 @@ int pm_parser_get_argv_dec(int n)
uint32_t argc = 0;
uint32_t value = 0;

char *str = &rx_buf;
char *str = rx_buf;

while (*str != '\0')
{
Expand Down Expand Up @@ -360,7 +360,7 @@ void pm_rx()
add_event(pm_settings.event_cycles, &pm_rx, 0);

//Poll UART status register
while (*(uint8_t*)(0x01000205) & 1 != 0) {
while ((*(uint8_t*)(0x01000205) & 1) != 0) {

//Read char from UART FIFO
c = *(char*)(0x01000200);
Expand Down Expand Up @@ -478,7 +478,7 @@ void pm_start()
debug_uart_init(pm_settings.baud);

//Register PPC-MON core commands, mem, reg, mips, etc
pm_register_cmds(&pm_core_cmds, 12);
pm_register_cmds(pm_core_cmds, 12);

//Preserve PPC-MON RX event through mode reset (PS2 <-> PS1)
debug_run_on_reset(&pm_rx);
Expand Down
4 changes: 4 additions & 0 deletions patch_loader_ee/main.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#include <stdio.h>
#include <debug.h>
#include <iopcontrol.h>
#include <iopheap.h>
#include <sifrpc.h>
#include <tamtypes.h>
#include <loadfile.h>
#include <sbv_patches.h>
#include <unistd.h>
#include <kernel.h>
#include <ps2sdkapi.h>

extern unsigned char ppcpatchman_irx[];
extern unsigned int size_ppcpatchman_irx;
Expand Down