mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 08:28:11 +00:00
Kernel: Reorganize Arch/x86 directory to Arch/x86_64 after i686 removal
No functional change.
This commit is contained in:
parent
5ff318cf3a
commit
91db482ad3
129 changed files with 482 additions and 1116 deletions
48
Kernel/Arch/x86_64/DebugOutput.cpp
Normal file
48
Kernel/Arch/x86_64/DebugOutput.cpp
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Liav A. <liavalb@hotmail.co.il>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <Kernel/Arch/DebugOutput.h>
|
||||
#include <Kernel/Arch/x86_64/BochsDebugOutput.h>
|
||||
#include <Kernel/Arch/x86_64/IO.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
static constexpr u16 serial_com1_io_port = 0x3F8;
|
||||
|
||||
void bochs_debug_output(char ch)
|
||||
{
|
||||
IO::out8(IO::BOCHS_DEBUG_PORT, ch);
|
||||
}
|
||||
|
||||
void debug_output(char ch)
|
||||
{
|
||||
static bool serial_ready = false;
|
||||
static bool was_cr = false;
|
||||
|
||||
if (!serial_ready) {
|
||||
IO::out8(serial_com1_io_port + 1, 0x00);
|
||||
IO::out8(serial_com1_io_port + 3, 0x80);
|
||||
IO::out8(serial_com1_io_port + 0, 0x02);
|
||||
IO::out8(serial_com1_io_port + 1, 0x00);
|
||||
IO::out8(serial_com1_io_port + 3, 0x03);
|
||||
IO::out8(serial_com1_io_port + 2, 0xC7);
|
||||
IO::out8(serial_com1_io_port + 4, 0x0B);
|
||||
|
||||
serial_ready = true;
|
||||
}
|
||||
|
||||
while ((IO::in8(serial_com1_io_port + 5) & 0x20) == 0)
|
||||
;
|
||||
|
||||
if (ch == '\n' && !was_cr)
|
||||
IO::out8(serial_com1_io_port, '\r');
|
||||
|
||||
IO::out8(serial_com1_io_port, ch);
|
||||
|
||||
was_cr = ch == '\r';
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue