Skip to content
Open
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
4 changes: 3 additions & 1 deletion ee/libprofglue/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

EE_LIB = libprofglue.a

EE_OBJS = prof.o mcount.o
EE_FATLTOFLAGS ?=

EE_OBJS = prof.o

include $(PS2SDKSRC)/Defs.make
include $(PS2SDKSRC)/ee/Rules.lib.make
Expand Down
39 changes: 0 additions & 39 deletions ee/libprofglue/src/mcount.S

This file was deleted.

43 changes: 43 additions & 0 deletions ee/libprofglue/src/prof.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,3 +245,46 @@ void __mcount(unsigned int frompc, unsigned int selfpc)
arc->count++;
}
}

__asm__
(
"\t" ".set push" "\n"
"\t" ".set noreorder" "\n"
"\t" ".set noat" "\n"

"\t" ".global _mcount" "\n"
"\t" ".ent _mcount" "\n"

"\t" "_mcount:" "\n"

// Generated code already substracts 8 bytes
// We store our ra, at and a0-a3
"\t" "\t" "daddiu $sp, $sp, -56" "\n" // Adjust stack pointer for 64-bit registers, 7 registers * 8 bytes each
"\t" "\t" "sd $ra, 0($sp)" "\n" // store ra
"\t" "\t" "sd $at, 8($sp)" "\n" // at = ra of caller
"\t" "\t" "sd $a0, 16($sp)" "\n"
"\t" "\t" "sd $a1, 24($sp)" "\n"
"\t" "\t" "sd $a2, 32($sp)" "\n"
"\t" "\t" "sd $a3, 40($sp)" "\n"

// Call internal C handler
"\t" "\t" "move $a0, $at" "\n"
"\t" "\t" "move $a1, $ra" "\n"
"\t" "\t" "jal __mcount" "\n"
"\t" "\t" "nop" "\n"

// Restore registers
"\t" "\t" "ld $ra, 0($sp)" "\n"
"\t" "\t" "ld $at, 8($sp)" "\n"
"\t" "\t" "ld $a0, 16($sp)" "\n"
"\t" "\t" "ld $a1, 24($sp)" "\n"
"\t" "\t" "ld $a2, 32($sp)" "\n"
"\t" "\t" "ld $a3, 40($sp)" "\n"
"\t" "\t" "daddiu $sp, $sp, 56" "\n" // Adjust stack pointer back
"\t" "\t" "jr $ra" "\n"
"\t" "\t" "move $ra, $at" "\n" // restore caller's ra

"\t" ".end _mcount" "\n"

"\t" ".set pop" "\n"
);
2 changes: 1 addition & 1 deletion iop/debug/iop_sbusdbg/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ IOP_IMPORT_INCS += \
system/sysmem \
system/threadman

IOP_OBJS = main.o sbus_dbg_low.o sbus_tty.o sbus_dbg.o imports.o
IOP_OBJS = main.o sbus_tty.o sbus_dbg.o imports.o

include $(PS2SDKSRC)/Defs.make
include $(PS2SDKSRC)/iop/Rules.bin.make
Expand Down
18 changes: 18 additions & 0 deletions iop/debug/iop_sbusdbg/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,24 @@ void _iop_ex_handler(IOP_RegFrame *frame)
int tid;

extern void soft_break(void);
__asm__
(
"\t" ".set push" "\n"
"\t" ".set noreorder" "\n"
"\t" ".set noat" "\n"

"\t" ".global soft_break" "\n"
"\t" ".ent soft_break" "\n"
"\t" "soft_break:" "\n"
"\t" "\t" "nop" "\n"
"\t" "\t" "break" "\n"
"\t" "\t" "nop" "\n"
"\t" "\t" "jr $ra" "\n"
"\t" "\t" "nop" "\n"
"\t" ".end soft_break" "\n"

"\t" ".set pop" "\n"
);

void _controller_thread(void *arg)
{
Expand Down
15 changes: 0 additions & 15 deletions iop/debug/iop_sbusdbg/src/sbus_dbg_low.S

This file was deleted.

2 changes: 1 addition & 1 deletion iop/system/udnl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ IOP_IMPORT_INCS += \
system/sysmem \
system/threadman

IOP_OBJS = udnl.o udnl_asm.o imports.o
IOP_OBJS = udnl.o imports.o

include $(PS2SDKSRC)/Defs.make
include $(PS2SDKSRC)/iop/Rules.bin.make
Expand Down
Loading
Loading