"]"
"\n\n";
+void print_kernel_version() {
+ //
+ extern tty_t *const default_tty;
+ tty_write_at(default_tty, 0, 0, version, (size_t)strlen(version));
+
+ //
+ printk(version);
+}
+
void setup_kernel() {
printk("sysenter esp mode: %s\n",
#if FIXED_SYSENTER_ESP_MODE
detect_cpu();
boot_delay(DEFAULT_BOOT_DELAY_TICKS);
- printk(version);
+ print_kernel_version();
boot_delay(DEFAULT_BOOT_DELAY_TICKS);
extern tty_t *const monitor_tty;
return;
}
- //
- char *dst = (char *)tty->base_addr;
- for (int src = BYTES_PER_LINE; src < (MAX_Y * BYTES_PER_LINE); src++) {
+ // 如果是default_tty则保留用来显示内核版本及编译时间信息
+ const int keep = tty != default_tty ? 0 : BYTES_PER_LINE;
+
+ char *dst = (char *)tty->base_addr + keep;
+ for (int src = BYTES_PER_LINE + keep; src < (MAX_Y * BYTES_PER_LINE); src++) {
*dst++ = *(char *)(tty->base_addr + src);
}
outb(VGA_CRTC_START_ADDR_H, VGA_CRTC_ADDR);
outb((offset >> 8) & 0xFF, VGA_CRTC_DATA);
outb(VGA_CRTC_START_ADDR_L, VGA_CRTC_ADDR);
- outb((offset)&0xFF, VGA_CRTC_DATA);
+ outb((offset) & 0xFF, VGA_CRTC_DATA);
irq_restore(flags);
current_tty = tty;