FATAL error: lsize mismatch 336/3342 #884
This commit is contained in:
parent
7a573e884d
commit
23a29073b6
|
@ -38,6 +38,7 @@
|
||||||
#include "memstreams.h"
|
#include "memstreams.h"
|
||||||
#include "console_io.h"
|
#include "console_io.h"
|
||||||
#include "os_util.h"
|
#include "os_util.h"
|
||||||
|
#endif // EFI_UNIT_TEST
|
||||||
|
|
||||||
static uint8_t intermediateLoggingBufferData[INTERMEDIATE_LOGGING_BUFFER_SIZE] CCM_OPTIONAL;
|
static uint8_t intermediateLoggingBufferData[INTERMEDIATE_LOGGING_BUFFER_SIZE] CCM_OPTIONAL;
|
||||||
|
|
||||||
|
@ -47,17 +48,23 @@ public:
|
||||||
* Class constructors are a great way to have simple initialization sequence
|
* Class constructors are a great way to have simple initialization sequence
|
||||||
*/
|
*/
|
||||||
IntermediateLogging() {
|
IntermediateLogging() {
|
||||||
|
#if ! EFI_UNIT_TEST
|
||||||
msObjectInit(&intermediateLoggingBuffer, intermediateLoggingBufferData, INTERMEDIATE_LOGGING_BUFFER_SIZE, 0);
|
msObjectInit(&intermediateLoggingBuffer, intermediateLoggingBufferData, INTERMEDIATE_LOGGING_BUFFER_SIZE, 0);
|
||||||
|
#endif // EFI_UNIT_TEST
|
||||||
}
|
}
|
||||||
|
#if ! EFI_UNIT_TEST
|
||||||
MemoryStream intermediateLoggingBuffer;
|
MemoryStream intermediateLoggingBuffer;
|
||||||
|
#endif // EFI_UNIT_TEST
|
||||||
|
|
||||||
// todo: look into chsnprintf once on Chibios 3
|
// todo: look into chsnprintf once on Chibios 3
|
||||||
void vappendPrintfI(Logging *logging, const char *fmt, va_list arg) {
|
void vappendPrintfI(Logging *logging, const char *fmt, va_list arg) {
|
||||||
|
#if ! EFI_UNIT_TEST
|
||||||
intermediateLoggingBuffer.eos = 0; // reset
|
intermediateLoggingBuffer.eos = 0; // reset
|
||||||
efiAssertVoid(CUSTOM_ERR_6603, getCurrentRemainingStack() > 128, "lowstck#1b");
|
efiAssertVoid(CUSTOM_ERR_6603, getCurrentRemainingStack() > 128, "lowstck#1b");
|
||||||
chvprintf((BaseSequentialStream *) &intermediateLoggingBuffer, fmt, arg);
|
chvprintf((BaseSequentialStream *) &intermediateLoggingBuffer, fmt, arg);
|
||||||
intermediateLoggingBuffer.buffer[intermediateLoggingBuffer.eos] = 0; // need to terminate explicitly
|
intermediateLoggingBuffer.buffer[intermediateLoggingBuffer.eos] = 0; // need to terminate explicitly
|
||||||
logging->append((char *)intermediateLoggingBuffer.buffer);
|
logging->append((char *)intermediateLoggingBuffer.buffer);
|
||||||
|
#endif // EFI_UNIT_TEST
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -116,12 +123,14 @@ void appendFast(Logging *logging, const char *text) {
|
||||||
* this method acquires system lock to guard the shared intermediateLoggingBuffer memory stream
|
* this method acquires system lock to guard the shared intermediateLoggingBuffer memory stream
|
||||||
*/
|
*/
|
||||||
void Logging::vappendPrintf(const char *fmt, va_list arg) {
|
void Logging::vappendPrintf(const char *fmt, va_list arg) {
|
||||||
|
#if ! EFI_UNIT_TEST
|
||||||
efiAssertVoid(CUSTOM_ERR_6604, getCurrentRemainingStack() > 128, "lowstck#5b");
|
efiAssertVoid(CUSTOM_ERR_6604, getCurrentRemainingStack() > 128, "lowstck#5b");
|
||||||
int wasLocked = lockAnyContext();
|
int wasLocked = lockAnyContext();
|
||||||
intermediateLogging.vappendPrintfI(this, fmt, arg);
|
intermediateLogging.vappendPrintfI(this, fmt, arg);
|
||||||
if (!wasLocked) {
|
if (!wasLocked) {
|
||||||
unlockAnyContext();
|
unlockAnyContext();
|
||||||
}
|
}
|
||||||
|
#endif // EFI_UNIT_TEST
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: replace with logging->appendPrintf
|
// todo: replace with logging->appendPrintf
|
||||||
|
@ -134,11 +143,18 @@ void appendPrintf(Logging *logging, const char *fmt, ...) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logging::appendPrintf(const char *fmt, ...) {
|
void Logging::appendPrintf(const char *fmt, ...) {
|
||||||
|
#if EFI_UNIT_TEST
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, fmt);
|
||||||
|
vsprintf(buffer, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
#else
|
||||||
efiAssertVoid(CUSTOM_APPEND_STACK, getCurrentRemainingStack() > 128, "lowstck#4");
|
efiAssertVoid(CUSTOM_APPEND_STACK, getCurrentRemainingStack() > 128, "lowstck#4");
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
vappendPrintf(fmt, ap);
|
vappendPrintf(fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
#endif // EFI_UNIT_TEST
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logging::initLoggingExt(const char *name, char *buffer, int bufferSize) {
|
void Logging::initLoggingExt(const char *name, char *buffer, int bufferSize) {
|
||||||
|
@ -190,6 +206,7 @@ static char header[16];
|
||||||
* this method should invoked on the main thread only
|
* this method should invoked on the main thread only
|
||||||
*/
|
*/
|
||||||
void printWithLength(char *line) {
|
void printWithLength(char *line) {
|
||||||
|
#if ! EFI_UNIT_TEST
|
||||||
int len;
|
int len;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
|
@ -222,6 +239,7 @@ void printWithLength(char *line) {
|
||||||
|
|
||||||
consoleOutputBuffer((const uint8_t *) header, strlen(header));
|
consoleOutputBuffer((const uint8_t *) header, strlen(header));
|
||||||
consoleOutputBuffer((const uint8_t *) line, p - line);
|
consoleOutputBuffer((const uint8_t *) line, p - line);
|
||||||
|
#endif // EFI_UNIT_TEST
|
||||||
}
|
}
|
||||||
|
|
||||||
void appendMsgPrefix(Logging *logging) {
|
void appendMsgPrefix(Logging *logging) {
|
||||||
|
@ -265,21 +283,6 @@ uint32_t remainingSize(Logging *logging) {
|
||||||
return logging->bufferSize - loggingSize(logging);
|
return logging->bufferSize - loggingSize(logging);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
/* unit test implementations */
|
|
||||||
void Logging::vappendPrintf(const char *fmt, va_list arg) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Logging::appendPrintf(const char *fmt, ...) {
|
|
||||||
va_list ap;
|
|
||||||
va_start(ap, fmt);
|
|
||||||
vsprintf(buffer, fmt, ap);
|
|
||||||
va_end(ap);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* ! EFI_UNIT_TEST */
|
|
||||||
|
|
||||||
Logging::Logging() {
|
Logging::Logging() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue