1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-12-23 18:56:03 +00:00

thermosphere: gdb: add debugManagerInit

This commit is contained in:
TuxSH 2020-01-31 02:53:40 +00:00
parent cf0b052590
commit e4de512e6f
7 changed files with 85 additions and 3 deletions

View file

@ -152,7 +152,7 @@ SECTIONS
. = ALIGN(8); . = ALIGN(8);
__real_bss_end__ = ABSOLUTE(.); __real_bss_end__ = ABSOLUTE(.);
__image_size__ = ABSOLUTE(__real_bss_end__ - __start__); __image_size__ = ABSOLUTE(__real_bss_end__ - __start__);
ASSERT(__image_size__ <= __max_image_size__, "Image too big!"); /*ASSERT(__image_size__ <= __max_image_size__, "Image too big!");*/
/* /*
The logic here: tempbss *additional pages* are at a very different PA, but The logic here: tempbss *additional pages* are at a very different PA, but
we can allow .tempbss to use unused "non-temporary" BSS space. Their VAs are we can allow .tempbss to use unused "non-temporary" BSS space. Their VAs are

View file

@ -75,6 +75,12 @@ void debugManagerPauseSgiHandler(void)
barrierWait(&g_debugManager.pauseBarrier); barrierWait(&g_debugManager.pauseBarrier);
} }
void debugManagerInit(TransportInterfaceType gdbIfaceType, u32 gdbIfaceId, u32 gdbIfaceFlags)
{
memset(&g_debugManager, 0, sizeof(DebugManager));
GDB_InitializeContext(&g_gdbContext, gdbIfaceType, gdbIfaceId, gdbIfaceFlags);
}
bool debugManagerHandlePause(void) bool debugManagerHandlePause(void)
{ {
u32 coreId = currentCoreCtx->coreId; u32 coreId = currentCoreCtx->coreId;

View file

@ -18,6 +18,7 @@
#include "exceptions.h" #include "exceptions.h"
#include "gdb/context.h" #include "gdb/context.h"
#include "transport_interface.h"
extern GDBContext g_gdbContext; extern GDBContext g_gdbContext;
@ -49,6 +50,8 @@ typedef struct DebugEventInfo {
void debugManagerPauseSgiHandler(void); void debugManagerPauseSgiHandler(void);
void debugManagerInit(TransportInterfaceType gdbIfaceType, u32 gdbIfaceId, u32 gdbIfaceFlags);
void debugManagerSetReportingEnabled(bool enabled); void debugManagerSetReportingEnabled(bool enabled);
// Hypervisor interrupts will be serviced during the pause-wait // Hypervisor interrupts will be serviced during the pause-wait

View file

@ -43,6 +43,7 @@
#include "../watchpoints.h" #include "../watchpoints.h"
static TEMPORARY char g_gdbWorkBuffer[GDB_WORK_BUF_LEN]; static TEMPORARY char g_gdbWorkBuffer[GDB_WORK_BUF_LEN];
static TEMPORARY char g_gdbBuffer[GDB_BUF_LEN + 4];
static const struct{ static const struct{
char command; char command;
@ -174,6 +175,7 @@ void GDB_InitializeContext(GDBContext *ctx, TransportInterfaceType ifaceType, u3
{ {
memset(ctx, 0, sizeof(GDBContext)); memset(ctx, 0, sizeof(GDBContext));
ctx->workBuffer = g_gdbWorkBuffer; ctx->workBuffer = g_gdbWorkBuffer;
ctx->buffer = g_gdbBuffer;
ctx->transportInterface = transportInterfaceCreate( ctx->transportInterface = transportInterfaceCreate(
ifaceType, ifaceType,
ifaceId, ifaceId,

View file

@ -93,7 +93,7 @@ typedef struct GDBContext {
char *commandData, *commandEnd; char *commandData, *commandEnd;
size_t lastSentPacketSize; size_t lastSentPacketSize;
char buffer[GDB_BUF_LEN + 4]; char *buffer;
char *workBuffer; char *workBuffer;
} GDBContext; } GDBContext;

View file

@ -101,7 +101,7 @@ void thermosphereMain(ExceptionStackFrame *frame, u64 pct)
transportInterfaceInitLayer(); transportInterfaceInitLayer();
debugLogInit(); debugLogInit();
test(); test();
debugManagerInit(TRANSPORT_INTERFACE_TYPE_UART, DEFAULT_UART, DEFAULT_UART_FLAGS);
DEBUG("EL2: core %u reached main first!\n", currentCoreCtx->coreId); DEBUG("EL2: core %u reached main first!\n", currentCoreCtx->coreId);
} }

View file

@ -700,6 +700,77 @@ strchr (const char *s1,
return NULL; return NULL;
} }
/*
FUNCTION
<<strcat>>---concatenate strings
INDEX
strcat
ANSI_SYNOPSIS
#include <string.h>
char *strcat(char *<[dst]>, const char *<[src]>);
TRAD_SYNOPSIS
#include <string.h>
char *strcat(<[dst]>, <[src]>)
char *<[dst]>;
char *<[src]>;
DESCRIPTION
<<strcat>> appends a copy of the string pointed to by <[src]>
(including the terminating null character) to the end of the
string pointed to by <[dst]>. The initial character of
<[src]> overwrites the null character at the end of <[dst]>.
RETURNS
This function returns the initial value of <[dst]>
PORTABILITY
<<strcat>> is ANSI C.
<<strcat>> requires no supporting OS subroutines.
QUICKREF
strcat ansi pure
*/
/*SUPPRESS 560*/
/*SUPPRESS 530*/
char *
strcat (char *s1, const char *s2)
{
#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
char *s = s1;
while (*s1)
s1++;
while ((*s1++ = *s2++))
;
return s;
#else
char *s = s1;
/* Skip over the data in s1 as quickly as possible. */
if (ALIGNED (s1))
{
unsigned long *aligned_s1 = (unsigned long *)s1;
while (!DETECTNULL (*aligned_s1))
aligned_s1++;
s1 = (char *)aligned_s1;
}
while (*s1)
s1++;
/* s1 now points to the its trailing null character, we can
just use strcpy to do the work for us now.
?!? We might want to just include strcpy here.
Also, this will cause many more unaligned string copies because
s1 is much less likely to be aligned. I don't know if its worth
tweaking strcpy to handle this better. */
strcpy (s1, s2);
return s;
#endif /* not PREFER_SIZE_OVER_SPEED */
}
/* /*
FUNCTION FUNCTION
<<strcmp>>---character string compare <<strcmp>>---character string compare