Gintrace 0.9.0 - Support Gint 2.4.0
@add <> support gint 2.4.0 (remove custom gint fork dependency) <> new icon @update <> src/menu/callgraph: remove callgraph export <> src/menu/context: display VBR information <> src/menu/internal/dictionary/syscall: add some new syscalls' information @fix <> Makefile: libc link and fxcg50 header
This commit is contained in:
parent
d1bea31365
commit
bebf5bff28
|
@ -1,2 +1,3 @@
|
|||
build*
|
||||
*.cfg
|
||||
commit.txt
|
||||
|
|
8
Makefile
8
Makefile
|
@ -38,7 +38,7 @@
|
|||
#
|
||||
#---
|
||||
MAJOR := 0
|
||||
MINOR := 8
|
||||
MINOR := 9
|
||||
PATCH := 0
|
||||
EXTRAVERSION :=
|
||||
|
||||
|
@ -236,16 +236,18 @@ target-$(tname)-objcopy := $(CONFIG.TOOLCHAIN)-objcopy
|
|||
# generate platform specific flags
|
||||
ifeq ($1,fx)
|
||||
target-$(tname)-cflags += -D FX9860G -m3
|
||||
target-$(tname)-cflags += $(FX_INCLUDE) $(FX_CFLAGS)
|
||||
target-$(tname)-ldflags += -T fx9860g.ld
|
||||
target-$(tname)-libs := -L. -L $(GCC_INCLUDE_FX)
|
||||
target-$(tname)-libs += -lgint-fx -lgintrace-fx -lgint-fx -lgcc
|
||||
target-$(tname)-libs += -lgint-fx -lgintrace-fx -lgint-fx -lc -lgcc
|
||||
target-$(tname)-exec := $3.g1a
|
||||
endif
|
||||
ifeq ($1,cg)
|
||||
target-$(tname)-cflags += -D FXCG50 -m4-nofpu
|
||||
target-$(tname)-cflags += $(CG_INCLUDE) $(CG_CFLAGS)
|
||||
target-$(tname)-ldflags += -T fxcg50.ld
|
||||
target-$(tname)-libs := -L. -L $(GCC_INCLUDE_CG)
|
||||
target-$(tname)-libs += -lgint-cg -lgintrace-cg -lgint-cg -lgcc
|
||||
target-$(tname)-libs += -lgint-cg -lgintrace-cg -lgint-cg -lc -lgcc
|
||||
target-$(tname)-exec := $3.g3a
|
||||
endif
|
||||
|
||||
|
|
4
TODO
4
TODO
|
@ -3,15 +3,17 @@
|
|||
* fix fx9860 support
|
||||
|
||||
@update
|
||||
* session: add custom world in each session
|
||||
* makefile: handle header dependencies
|
||||
* makefile: handle dynamic lib generation
|
||||
* makefile: generate the documentation
|
||||
* context: refacto printXY() !
|
||||
* hexdump: search commands
|
||||
* callgraph: improve user interface.
|
||||
* icon
|
||||
|
||||
@feature
|
||||
* be compilent with giteapc
|
||||
* switch to cmake
|
||||
* add documentation
|
||||
* switch to justUI
|
||||
* add drivers menu
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 7.9 KiB |
Binary file not shown.
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 13 KiB |
36
demo/main.c
36
demo/main.c
|
@ -1,5 +1,6 @@
|
|||
#include "gintrace/tracer.h"
|
||||
|
||||
|
||||
#include <gint/bfile.h>
|
||||
#include <gint/display.h>
|
||||
#include <gint/keyboard.h>
|
||||
|
@ -36,15 +37,22 @@ int main(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef FXCG50
|
||||
/* get syscall address */
|
||||
systab = *(void ***)0x8002007c;
|
||||
//syscall = systab[0x1e48]; // Fugue_debug_menu
|
||||
syscall = systab[0x1da3]; // Bfile_OpenFile_OS
|
||||
|
||||
//syscall = systab[0x1e48]; // Fugue_debug_menu()
|
||||
//syscall = systab[0x1da3]; // Bfile_OpenFile_OS()
|
||||
//syscall = systab[0x1353]; // Comm_Open()
|
||||
//syscall = systab[0x1dac]; // Bfile_ReadFile_OS()
|
||||
syscall = systab[0x1630]; // App_optimize()
|
||||
//syscall = systab[0x1e56];
|
||||
#endif
|
||||
|
||||
/* prepare tracer */
|
||||
session = tracer_create_session(syscall,
|
||||
TRACER_DISASM | TRACER_CONTEXT | TRACER_HEXDUMP | TRACER_CALLGRAPH);
|
||||
session = tracer_create_session(
|
||||
syscall,
|
||||
TRACER_DISASM | TRACER_CONTEXT | TRACER_HEXDUMP
|
||||
);
|
||||
if (session == NULL) {
|
||||
dclear(C_WHITE);
|
||||
dtext(0, 0, C_BLACK, "Unable to create tracer session");
|
||||
|
@ -59,12 +67,24 @@ int main(void)
|
|||
//---
|
||||
// TEST part
|
||||
//---
|
||||
void (*bfile_openfile_os)(const uint16_t *filename, int mode, int p3);
|
||||
void (*app_optimize)(void) = (void*)syscall;
|
||||
gint_world_switch(GINT_CALL(app_optimize));
|
||||
|
||||
|
||||
#if 0
|
||||
int (*bfile_openfile_os)(const uint16_t *filename, int mode, int p3);
|
||||
int (*bfile_readfile_os)(int handle, void *b, size_t n, off_t p);
|
||||
//void (*comm_open)(int mode) = syscall;
|
||||
uint8_t buffer[128];
|
||||
int handle;
|
||||
|
||||
gint_switch_to_world(kernel_env_casio);
|
||||
bfile_openfile_os = syscall;
|
||||
bfile_openfile_os(u"\\\\fls0\\abcdefgijklmn", BFile_ReadOnly, 0);
|
||||
bfile_openfile_os = systab[0x1da3];
|
||||
handle = bfile_openfile_os(u"\\\\fls0\\azerty", BFile_ReadOnly, 0);
|
||||
bfile_readfile_os = systab[0x1dac];
|
||||
bfile_readfile_os(handle, buffer, 128, 0);
|
||||
gint_switch_to_world(kernel_env_gint);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
BIN
gintrace.g3a
BIN
gintrace.g3a
Binary file not shown.
BIN
libgintrace-cg.a
BIN
libgintrace-cg.a
Binary file not shown.
57
src/gint.c
57
src/gint.c
|
@ -1,57 +0,0 @@
|
|||
#include "gintrace/ubc.h"
|
||||
|
||||
#include <gint/gint.h>
|
||||
#include <gint/atomic.h>
|
||||
#include <gint/defs/attributes.h>
|
||||
#include <gint/drivers.h>
|
||||
#include <gint/display.h>
|
||||
|
||||
/* external symbols */
|
||||
extern void *kernel_env_casio;
|
||||
extern void *kernel_env_gint;
|
||||
extern void *kernel_env_tracer;
|
||||
|
||||
/* gint_switch(): Temporarily switch out of gint */
|
||||
void gint_switch(void (*function)(void))
|
||||
{
|
||||
void *buffctx_current;
|
||||
void *buffctx;
|
||||
|
||||
/* check useless action */
|
||||
if (function == NULL)
|
||||
return;
|
||||
|
||||
/* check useless world switch */
|
||||
buffctx_current = drivers_get_current();
|
||||
if (kernel_env_casio == buffctx_current) {
|
||||
function();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Switch from gint to the OS after a short wait */
|
||||
ubc_uninstall();
|
||||
buffctx = drivers_switch(kernel_env_casio);
|
||||
ubc_install();
|
||||
|
||||
/* involve the function */
|
||||
function();
|
||||
|
||||
/* then switch back to gint once the os finishes working */
|
||||
ubc_uninstall();
|
||||
drivers_switch(buffctx);
|
||||
ubc_install();
|
||||
}
|
||||
|
||||
/* Switch from gint to the OS after a short wait */
|
||||
void *gint_switch_to_world(void *buffctx)
|
||||
{
|
||||
void *buffctx_current;
|
||||
|
||||
buffctx_current = drivers_get_current();
|
||||
if (buffctx != buffctx_current) {
|
||||
ubc_uninstall();
|
||||
drivers_switch(buffctx);
|
||||
ubc_install();
|
||||
}
|
||||
return (buffctx_current);
|
||||
}
|
|
@ -14,11 +14,6 @@
|
|||
|
||||
#include "./src/menu/internal/dictionary.h"
|
||||
|
||||
/* internal info (TODO: move me) */
|
||||
extern void *kernel_env_gint;
|
||||
extern void *kernel_env_casio;
|
||||
extern void *gint_switch_to_world(void *buffctx);
|
||||
|
||||
//---
|
||||
// callode management
|
||||
//---
|
||||
|
@ -311,11 +306,12 @@ static void callgraph_command(struct tsession *session, int argc, char **argv)
|
|||
input_write("argument missing");
|
||||
return;
|
||||
}
|
||||
if (strcmp(argv[0], "export") != 0) {
|
||||
//if (strcmp(argv[0], "export") != 0) {
|
||||
input_write("'%s': command unknown", argv[0]);
|
||||
return;
|
||||
}
|
||||
// return;
|
||||
//}
|
||||
|
||||
#if 0
|
||||
/* convert the filename (arg2) into Bfile pathname */
|
||||
int i = -1;
|
||||
uint16_t pathname[14 + strlen(argv[1]) + 1];
|
||||
|
@ -377,6 +373,7 @@ static void callgraph_command(struct tsession *session, int argc, char **argv)
|
|||
BFile_Close(fd);
|
||||
gint_switch_to_world(kernel_env_gint);
|
||||
input_write("success");
|
||||
#endif
|
||||
}
|
||||
|
||||
/* callgraph_special_ctor(): Special constructor used to generate the graph */
|
||||
|
|
|
@ -57,11 +57,15 @@ static void context_ctor(struct tsession *session)
|
|||
/* context_display(); Display trace information */
|
||||
static void context_display(struct tsession *session)
|
||||
{
|
||||
uintptr_t __vbr;
|
||||
int x;
|
||||
int y;
|
||||
|
||||
__asm__ volatile ("stc vbr, %0": "=r"(__vbr)::);
|
||||
|
||||
x = session->menu.context.cursor.hoffset;
|
||||
y = session->menu.context.cursor.voffset;
|
||||
printXY(0 + x, 0 + y, "vbr : %p", __vbr);
|
||||
printXY(0 + x, 0 + y, "gbr : %p", session->info.context->gbr);
|
||||
printXY(0 + x, 1 + y, "macl : %p", session->info.context->mach);
|
||||
printXY(0 + x, 2 + y, "mach : %p", session->info.context->macl);
|
||||
|
|
|
@ -615,17 +615,33 @@ const struct sysname casio_syscalls[] = {
|
|||
//
|
||||
// Yatis
|
||||
//
|
||||
{.syscall = 0x0dc0, .name = "void SMEM_Optimize(void)"},
|
||||
{.syscall = 0x0dd2, .name = "int SMEM_fugue_retval_to_bfile_revet(int retval);"},
|
||||
{.syscall = 0x0de2, .name = "int SMEM_bfile_get_file_info(int handle, uint8_t buffer[540]);"},
|
||||
{.syscall = 0x0db0, .name = "int fugue_unmount(void);"},
|
||||
{.syscall = 0x0db1, .name = "int fugue_mount(void);"},
|
||||
{.syscall = 0x0dd2, .name = "const uint16_t *FONTCHARACTER_convert_to_FUGUECHARACTER(const uint16_t *src, uint8_t *dest);"},
|
||||
{.syscall = 0x0de2, .name = "int SMEM_get_file_info(int handle, uint8_t buffer[540]);"},
|
||||
{.syscall = 0x0ea6, .name = "void Debug_menu_TestMode(void);"},
|
||||
{.syscall = 0x0ea7, .name = "void Debug_menu_TestMode(int unknown);"},
|
||||
{.syscall = 0x1da1, .name = "int fugue_logical_format(void);"},
|
||||
{.syscall = 0x134e, .name = "int USB_Open(int param);"},
|
||||
{.syscall = 0x135d, .name = "int Comm_IsOpen(void);"},
|
||||
{.syscall = 0x135e, .name = "int Comm_GetCurrentSelector(void);"},
|
||||
{.syscall = 0x135f, .name = "int Comm_OS_wait(int delay_ms);"},
|
||||
{.syscall = 0x1361, .name = "int Serial_Reset(int action);"},
|
||||
{.syscall = 0x14ba, .name = "int USB_PowerOn(void);"},
|
||||
{.syscall = 0x14bb, .name = "int USB_PowerOff(void);"},
|
||||
{.syscall = 0x1da1, .name = "int SMEM_logical_format(void *unknown, int mode, int unknown);"},
|
||||
{.syscall = 0x1e44, .name = "void Debug_menu_FileSystem(void);"},
|
||||
{.syscall = 0x1e45, .name = "void Debug_menu_Fugue_OpenFileInfo(void);"},
|
||||
{.syscall = 0x1e48, .name = "void Debug_menu_Fugue_VolumeInfo(void);"},
|
||||
{.syscall = 0x1e49, .name = "void Debug_menu_Fugue_LogInfo(void);"},
|
||||
{.syscall = 0x1e66, .name = "void Debug_menu_stackAndHeap(void);"},
|
||||
{.syscall = 0x1ece, .name = "void USB_InterruptHandler(void);"},
|
||||
{.syscall = 0x1d99, .name = "int SD_isMounted(void);"},
|
||||
{.syscall = 0x1dc3, .name = "int Bfile_Optimize(const uint16_t *device);"},
|
||||
{.syscall = 0x1263, .name = "int SD_read(int handle, void *buffer, size_t nb, off_t pos);"},
|
||||
{.syscall = 0x1267, .name = "int SD_optimize(void);"},
|
||||
|
||||
//
|
||||
// Stop
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
/* global session (TODO: thread-safe) */
|
||||
struct tsession *session = NULL;
|
||||
|
||||
//TODO: ELF PIE world
|
||||
//TODO: custom world selection
|
||||
|
||||
/* tracer_new_session(): Create a new session */
|
||||
struct tsession *tracer_create_session(void *address, int menu)
|
||||
{
|
||||
|
|
|
@ -6,9 +6,7 @@
|
|||
#include "gintrace/ubc.h"
|
||||
#include "gintrace/tracer.h"
|
||||
|
||||
/* world information */
|
||||
extern void *kernel_env_tracer;
|
||||
extern void *gint_switch_to_world(void *buffctx);
|
||||
#include <gint/drivers.h>
|
||||
|
||||
/* gintrac_handler(): UBC handler
|
||||
* @note:
|
||||
|
@ -40,7 +38,7 @@ void gintrace_handler(struct ucontext *context)
|
|||
}
|
||||
|
||||
/* user break point */
|
||||
session->info.buffctx = gint_switch_to_world(kernel_env_tracer);
|
||||
gint_world_switch_in(gint_world_os, gint_world_addin);
|
||||
menu_init(session->display.gmenu);
|
||||
while (menu_is_open(session->display.gmenu) == 0) {
|
||||
menu_draw(session->display.gmenu);
|
||||
|
@ -56,5 +54,5 @@ void gintrace_handler(struct ucontext *context)
|
|||
|
||||
/* unblock UBC interrupt */
|
||||
ubc_unblock();
|
||||
gint_switch_to_world(session->info.buffctx);
|
||||
gint_world_switch_out(gint_world_addin, gint_world_os);
|
||||
}
|
||||
|
|
|
@ -83,8 +83,8 @@ ubc_kernel_inth_prologue:
|
|||
lds.l @r15+, pr
|
||||
|
||||
! Clean exit.
|
||||
rte ! Interrupt Exit.
|
||||
nop ! (db) Safety first.
|
||||
rte
|
||||
nop
|
||||
|
||||
.align 4
|
||||
ubc_handler: .long _ubc_handler
|
||||
|
|
|
@ -8,10 +8,6 @@ struct sh7305_ubc_context ubctx;
|
|||
void (*ubc_handler)(struct ucontext *ctx) = NULL;
|
||||
int ubc_driver_installed = 0;
|
||||
|
||||
extern void *kernel_env_gint;
|
||||
void *kernel_env_tracer = NULL;
|
||||
|
||||
|
||||
/* ubc_install(): Install the UBC driver */
|
||||
void ubc_install(void)
|
||||
{
|
||||
|
@ -47,10 +43,6 @@ void ubc_install(void)
|
|||
SH7305_UBC.CBR1.CE = 0;
|
||||
SH7305_UBC.CBCR.UBDE = 1;
|
||||
|
||||
/* generate the "tracer" tmp context */
|
||||
if (kernel_env_tracer == NULL)
|
||||
drivers_context_duplicate(&kernel_env_tracer, kernel_env_gint);
|
||||
|
||||
/* indicate that the UBC driver is installed */
|
||||
ubc_driver_installed = 1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue