ohhhhhhhhhhh (exclude linux-extra-rootfs.img build artifact)

This commit is contained in:
Linehu
2026-10-01 23:13:42 +08:00
parent 737a2cb0db
commit 1074962546
533 changed files with 133239 additions and 5460 deletions
+11
View File
@@ -22,6 +22,10 @@ u32 log_get_length(void) {
}
static void log_emit(const char *s) {
/* Phase7: 日志行临界区——抢占可能把一行日志切成两半(串口与
* BOOTLOG 缓冲都会花),pushfq/popfq 保存并恢复本上下文的 IF。 */
u64 flags;
__asm__ volatile("pushfq; popq %0; cli" : "=r"(flags) :: "memory");
serial_write(s);
if (g_log_capture_on && s) {
while (*s) {
@@ -31,6 +35,13 @@ static void log_emit(const char *s) {
s++;
}
}
/* BUG-GP-IRET: 只恢复 IF,不做全量 popfq。全量 popfq 会把进入本
* 函数前 flags 里的历史污染位(如 NT=1)原样写回 RFLAGS 并在上下文
* 间传播(NT=1 时下一次 iretq 直接 #GP(0))。本临界区的语义仅仅是
* "保存并恢复 IF"。 */
if (flags & (1ULL << 9)) { /* 恢复进入前的 IF */
__asm__ volatile("sti" ::: "memory");
}
}
static void log_line(const char *level, const char *msg) {