From 35c2667fbfb57ccde005f826800993d3db2890e3 Mon Sep 17 00:00:00 2001 From: Eggert Jung Date: Mon, 28 Apr 2025 16:04:52 +0200 Subject: [PATCH] copystream for up to 8 cores --- arch/serial.cc | 1 - debug/output.h | 3 +-- device/textstream.cc | 4 ++-- main.cc | 60 ++++++++++++++++++++++++++++++++++++++++------------ 4 files changed, 49 insertions(+), 19 deletions(-) diff --git a/arch/serial.cc b/arch/serial.cc index 8b7e5df..b888e22 100644 --- a/arch/serial.cc +++ b/arch/serial.cc @@ -22,7 +22,6 @@ Serial::Serial(ComPort port, BaudRate baud_rate, DataBits data_bits, // FIFO: Enable & clear buffers writeReg(FIFO_CONTROL_REGISTER, ENABLE_FIFO | CLEAR_RECEIVE_FIFO | CLEAR_TRANSMIT_FIFO); - // Modem Control: OUT2 (0000 1000) must be set for interrupt writeReg(MODEM_CONTROL_REGISTER, OUT_2); } diff --git a/debug/output.h b/debug/output.h index 2d63bba..e9de634 100644 --- a/debug/output.h +++ b/debug/output.h @@ -43,11 +43,10 @@ * possible that the debug output in a multi core system is displayed * on the wrong (previous) core. */ -#include "arch/lapic.h" -#define DBG dout[LAPIC::getID()] #include "../arch/core.h" #include "../device/textstream.h" +#define DBG *copyout[Core::getID()] /*! \brief Debug window for the CGA screen * diff --git a/device/textstream.cc b/device/textstream.cc index a384780..a72de68 100644 --- a/device/textstream.cc +++ b/device/textstream.cc @@ -11,8 +11,8 @@ TextStream::TextStream(unsigned from_col, from_row, to_row, use_cursor){ - CGA::Color fg = static_cast((LAPIC::getID() + 1 )); - this->reset(' ', CGA::Attribute(CGA::LIGHT_GREEN, fg, false)); + //CGA::Color fg = static_cast((LAPIC::getID() + 1 )); + //this->reset(' ', CGA::Attribute(CGA::LIGHT_GREEN, fg, false)); } diff --git a/main.cc b/main.cc index c9b38e1..85b1974 100644 --- a/main.cc +++ b/main.cc @@ -1,5 +1,6 @@ #include "arch/lapic.h" #include "boot/startup_ap.h" +#include "debug/copystream.h" #include "debug/output.h" #include "arch/cga.h" @@ -8,17 +9,49 @@ #include "device/serialstream.h" #include "device/textstream.h" #include "device/ps2controller.h" -TextStream kout = TextStream(0, 80, 0, 12, true); - -TextStream dout[8] = { - TextStream(0 ,20,12,25,false), - TextStream(20,40,12,25,false), - TextStream(40,60,12,25,false), - TextStream(60,80,12,25,false), - TextStream(0 ,0 ,0, 0,false), - TextStream(0 ,0 ,0, 0,false), - TextStream(0 ,0 ,0, 0,false), - TextStream(0 ,0 ,0, 0,false), +TextStream kout = TextStream(0, 80, 0, 10, true); + +//TextStream dout[8] = { +// TextStream(0 ,20,12,25,false), +// TextStream(20,40,12,25,false), +// TextStream(40,60,12,25,false), +// TextStream(60,80,12,25,false), +// TextStream(0 ,0 ,0, 0,false), +// TextStream(0 ,0 ,0, 0,false), +// TextStream(0 ,0 ,0, 0,false), +// TextStream(0 ,0 ,0, 0,false), +//}; +TextStream dout[Core::MAX] = { + {0, 40, 10, 14}, + {40, 80, 10, 14}, + {0, 40, 14, 18}, + {40, 80, 14, 18}, + {0, 40, 18, 22}, + {40, 80, 18, 22}, + {0, 40, 22, 25}, + {40, 80, 22, 25}, +}; + +CopyStream copystream[Core::MAX]{ + {&dout[0], &sout}, + {&dout[1], &sout}, + {&dout[2], &sout}, + {&dout[3], &sout}, + {&dout[4], &sout}, + {&dout[5], &sout}, + {&dout[6], &sout}, + {&dout[7], &sout}, +}; + +OutputStream* copyout[Core::MAX]{ + &dout[0], + ©stream[1], + &dout[2], + &dout[3], + &dout[4], + &dout[5], + &dout[6], + &dout[7] }; @@ -83,7 +116,6 @@ extern "C" int main() { if (PS2Controller::fetch(key)) { kout << key.ascii() << flush ; } - } return 0; } @@ -101,8 +133,8 @@ extern "C" int main_ap() { ////test Serial - Serial s = Serial(); - s.write('a'); + //Serial s = Serial(); + //s.write('a'); //uint8_t from = static_cast(LAPIC::getID()) * 20;