error_handling: save stack bytes for firmwareError() too

This commit is contained in:
Andrey Gusakov 2025-01-22 19:01:47 +03:00 committed by rusefillc
parent e80d753390
commit 01d755306f
1 changed files with 6 additions and 0 deletions

View File

@ -503,6 +503,9 @@ const char* getConfigErrorMessage() {
}
void firmwareError(ObdCode code, const char *fmt, ...) {
// following is allocated on stack
// add some marker
uint32_t tmp = 0xfaaaaa11;
#if EFI_PROD_CODE
if (hasCriticalFirmwareErrorFlag)
return;
@ -543,6 +546,9 @@ void firmwareError(ObdCode code, const char *fmt, ...) {
err->msg[sizeof(err->msg) - 1] = '\0';
strlncpy(err->msg, criticalErrorMessageBuffer, sizeof(err->msg));
err->Cookie = ErrorCookie::FirmwareError;
// copy stack last as it can be corrupted and cause another exeption
uint32_t *sp = &tmp;
errorHandlerSaveStack(err, sp);
}
#endif // EFI_BACKUP_SRAM
#else // EFI_PROD_CODE