Add TOTK_CORE_DIAG: classify every virtual core wait by what the owner was doing, and answer SVC 0x36

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-10-25 23:23:48 +03:00
1 parent f63db636d4
commit d52cdfc6ee
6 files changed
+308 -4

No files matched your search

+7
View File
@@ -176,6 +176,13 @@ void kern_core_back(int *away);
void kern_checkpoint(void); // preemption point, at every SVC and indirect call
// A preempt request is pending for the thread (Cpu.thread): its RtThread starts with the flag (kernel.c).
static inline int kern_preempt_pending(const void *thread) { return __atomic_load_n((const int *)thread, __ATOMIC_RELAXED); }
// Set once before guest threads start (TOTK_CORE_DIAG): host calls (hostfn.c) and SVCs (svc.c) count their depth in
// the thread's second int, so the kernel knows whether a core owner runs game code at the top level.
extern int kern_host_track;
static inline int *kern_host_depth(void *thread) { return (int *)thread + 1; }
void kern_host_left(void *thread); // back at depth 0 with a preempt request pending
int kern_core_diag_on(void); // TOTK_CORE_DIAG
void kern_core_diag_frame(uint64_t frame, uint64_t interval_ns); // perf_present, every present
void kern_sched_report(uint64_t frame); // TOTK_TRACE=sched: per-thread time split, on present
uint32_t kern_handle_new(int kind, void *obj); // kind: KERN_SESSION or KERN_TMEM (ipc.c)
void *kern_handle_get(uint32_t h, int kind);