mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-07-10 23:09:18 +00:00
Update kernel
This commit is contained in:
@ -30,84 +30,84 @@ UART com2(COM2);
|
||||
|
||||
static inline SafeFunction NIF void profiler_uart_wrapper(char c, void *unused)
|
||||
{
|
||||
bool renable = EnableProfiler;
|
||||
EnableProfiler = false;
|
||||
com2.Write(c);
|
||||
UNUSED(unused);
|
||||
if (renable)
|
||||
EnableProfiler = true;
|
||||
bool renable = EnableProfiler;
|
||||
EnableProfiler = false;
|
||||
com2.Write(c);
|
||||
UNUSED(unused);
|
||||
if (renable)
|
||||
EnableProfiler = true;
|
||||
}
|
||||
|
||||
EXTERNC SafeFunction NIF void __cyg_profile_func_enter(void *Function, void *CallSite)
|
||||
{
|
||||
if (!EnableProfiler)
|
||||
return;
|
||||
if (!EnableProfiler)
|
||||
return;
|
||||
|
||||
while (Wait)
|
||||
while (Wait)
|
||||
#if defined(a86)
|
||||
asmv("pause");
|
||||
asmv("pause");
|
||||
#elif defined(aa64)
|
||||
asmv("yield");
|
||||
asmv("yield");
|
||||
#endif
|
||||
Wait = true;
|
||||
Wait = true;
|
||||
|
||||
if (Level > 40)
|
||||
Level--;
|
||||
if (Level > 40)
|
||||
Level--;
|
||||
|
||||
Level++;
|
||||
Level++;
|
||||
|
||||
if (!KernelSymbolTable)
|
||||
fctprintf(profiler_uart_wrapper, nullptr, "%lld [%02d]: \033[42m->\033[0m%*c \033[33m%p\033[0m - \033[33m%p\033[0m\n",
|
||||
LogDepth++,
|
||||
Level - 1,
|
||||
Level,
|
||||
' ',
|
||||
Function,
|
||||
CallSite);
|
||||
else
|
||||
fctprintf(profiler_uart_wrapper, nullptr, "%lld [%02d]: \033[42m->\033[0m%*c \033[33m%s\033[0m - \033[33m%s\033[0m\n",
|
||||
LogDepth++,
|
||||
Level - 1,
|
||||
Level,
|
||||
' ',
|
||||
KernelSymbolTable->GetSymbolFromAddress((uintptr_t)Function),
|
||||
KernelSymbolTable->GetSymbolFromAddress((uintptr_t)CallSite));
|
||||
Wait = false;
|
||||
if (!KernelSymbolTable)
|
||||
fctprintf(profiler_uart_wrapper, nullptr, "%lld [%02d]: \033[42m->\033[0m%*c \033[33m%p\033[0m - \033[33m%p\033[0m\n",
|
||||
LogDepth++,
|
||||
Level - 1,
|
||||
Level,
|
||||
' ',
|
||||
Function,
|
||||
CallSite);
|
||||
else
|
||||
fctprintf(profiler_uart_wrapper, nullptr, "%lld [%02d]: \033[42m->\033[0m%*c \033[33m%s\033[0m - \033[33m%s\033[0m\n",
|
||||
LogDepth++,
|
||||
Level - 1,
|
||||
Level,
|
||||
' ',
|
||||
KernelSymbolTable->GetSymbol((uintptr_t)Function),
|
||||
KernelSymbolTable->GetSymbol((uintptr_t)CallSite));
|
||||
Wait = false;
|
||||
}
|
||||
|
||||
EXTERNC SafeFunction NIF void __cyg_profile_func_exit(void *Function, void *CallSite)
|
||||
{
|
||||
if (!EnableProfiler)
|
||||
return;
|
||||
if (!EnableProfiler)
|
||||
return;
|
||||
|
||||
while (Wait)
|
||||
while (Wait)
|
||||
#if defined(a86)
|
||||
asmv("pause");
|
||||
asmv("pause");
|
||||
#elif defined(aa64)
|
||||
asmv("yield");
|
||||
asmv("yield");
|
||||
#endif
|
||||
Wait = true;
|
||||
Wait = true;
|
||||
|
||||
if (Level > 40)
|
||||
Level--;
|
||||
if (Level > 40)
|
||||
Level--;
|
||||
|
||||
Level--;
|
||||
Level--;
|
||||
|
||||
if (!KernelSymbolTable)
|
||||
fctprintf(profiler_uart_wrapper, nullptr, "%lld [%02d]: \033[41m<-\033[0m%*c \033[33m%p\033[0m - \033[33m%p\033[0m\n",
|
||||
LogDepth++,
|
||||
Level - 1,
|
||||
Level,
|
||||
' ',
|
||||
Function,
|
||||
CallSite);
|
||||
else
|
||||
fctprintf(profiler_uart_wrapper, nullptr, "%lld [%02d]: \033[41m<-\033[0m%*c \033[33m%s\033[0m - \033[33m%s\033[0m\n",
|
||||
LogDepth++,
|
||||
Level - 1,
|
||||
Level,
|
||||
' ',
|
||||
KernelSymbolTable->GetSymbolFromAddress((uintptr_t)Function),
|
||||
KernelSymbolTable->GetSymbolFromAddress((uintptr_t)CallSite));
|
||||
Wait = false;
|
||||
if (!KernelSymbolTable)
|
||||
fctprintf(profiler_uart_wrapper, nullptr, "%lld [%02d]: \033[41m<-\033[0m%*c \033[33m%p\033[0m - \033[33m%p\033[0m\n",
|
||||
LogDepth++,
|
||||
Level - 1,
|
||||
Level,
|
||||
' ',
|
||||
Function,
|
||||
CallSite);
|
||||
else
|
||||
fctprintf(profiler_uart_wrapper, nullptr, "%lld [%02d]: \033[41m<-\033[0m%*c \033[33m%s\033[0m - \033[33m%s\033[0m\n",
|
||||
LogDepth++,
|
||||
Level - 1,
|
||||
Level,
|
||||
' ',
|
||||
KernelSymbolTable->GetSymbol((uintptr_t)Function),
|
||||
KernelSymbolTable->GetSymbol((uintptr_t)CallSite));
|
||||
Wait = false;
|
||||
}
|
||||
|
@ -31,34 +31,34 @@ typedef long long gcov_type;
|
||||
|
||||
struct gcov_fn_info
|
||||
{
|
||||
unsigned int ident;
|
||||
unsigned int checksum;
|
||||
unsigned int n_ctrs[0];
|
||||
unsigned int ident;
|
||||
unsigned int checksum;
|
||||
unsigned int n_ctrs[0];
|
||||
};
|
||||
|
||||
struct gcov_ctr_info
|
||||
{
|
||||
unsigned int num;
|
||||
gcov_type *values;
|
||||
void (*merge)(gcov_type *, unsigned int);
|
||||
unsigned int num;
|
||||
gcov_type *values;
|
||||
void (*merge)(gcov_type *, unsigned int);
|
||||
};
|
||||
|
||||
struct gcov_info
|
||||
{
|
||||
unsigned int version;
|
||||
struct gcov_info *next;
|
||||
unsigned int stamp;
|
||||
const char *filename;
|
||||
unsigned int n_functions;
|
||||
const struct gcov_fn_info *functions;
|
||||
unsigned int ctr_mask;
|
||||
struct gcov_ctr_info counts[0];
|
||||
unsigned int version;
|
||||
struct gcov_info *next;
|
||||
unsigned int stamp;
|
||||
const char *filename;
|
||||
unsigned int n_functions;
|
||||
const struct gcov_fn_info *functions;
|
||||
unsigned int ctr_mask;
|
||||
struct gcov_ctr_info counts[0];
|
||||
};
|
||||
|
||||
static inline SafeFunction NIF void gcov_uart_wrapper(char c, void *unused)
|
||||
{
|
||||
UART(COM2).Write(c);
|
||||
UNUSED(unused);
|
||||
UART(COM2).Write(c);
|
||||
UNUSED(unused);
|
||||
}
|
||||
|
||||
// TODO: Implement
|
||||
@ -77,12 +77,12 @@ EXTERNC SafeFunction NIF void __gcov_flush(void)
|
||||
|
||||
EXTERNC SafeFunction NIF void __gcov_merge_add(gcov_type *counters, unsigned int n_counters)
|
||||
{
|
||||
UNUSED(counters);
|
||||
UNUSED(n_counters);
|
||||
UNUSED(counters);
|
||||
UNUSED(n_counters);
|
||||
}
|
||||
|
||||
EXTERNC SafeFunction NIF void __gcov_merge_single(gcov_type *counters, unsigned int n_counters)
|
||||
{
|
||||
UNUSED(counters);
|
||||
UNUSED(n_counters);
|
||||
UNUSED(counters);
|
||||
UNUSED(n_counters);
|
||||
}
|
||||
|
@ -25,14 +25,14 @@ using namespace UniversalAsynchronousReceiverTransmitter;
|
||||
|
||||
static inline SafeFunction NIF void gprof_uart_wrapper(char c, void *unused)
|
||||
{
|
||||
UART(COM2).Write(c);
|
||||
UNUSED(unused);
|
||||
UART(COM2).Write(c);
|
||||
UNUSED(unused);
|
||||
}
|
||||
|
||||
EXTERNC SafeFunction NIF void mcount(unsigned long frompc, unsigned long selfpc)
|
||||
{
|
||||
// TODO: Implement
|
||||
/* https://docs.kernel.org/trace/ftrace-design.html */
|
||||
UNUSED(frompc);
|
||||
UNUSED(selfpc);
|
||||
// TODO: Implement
|
||||
/* https://docs.kernel.org/trace/ftrace-design.html */
|
||||
UNUSED(frompc);
|
||||
UNUSED(selfpc);
|
||||
}
|
||||
|
Reference in New Issue
Block a user