1

static logger

This commit is contained in:
2022-07-23 00:20:44 +02:00
parent bd95c02a08
commit e143733b00
5 changed files with 11 additions and 12 deletions

View File

@ -29,6 +29,7 @@ Scheduler scheduler;
KeyEventManager kevman;
SerialOut serial;
Logger& logger = Logger::instance();
unsigned int total_mem; // RAM total
unsigned long systime = 0;

View File

@ -26,6 +26,8 @@
#include "user/devices/SerialOut.h"
#include "user/event/KeyEventManager.h"
// I wanted to make more of these singletons but there were problems with atexit missing because of nostdlib I guess
extern CPU cpu; // CPU-spezifische Funktionen
extern CGA_Stream kout; // Ausgabe-Strom fuer Kernel
extern BIOS bios; // Schnittstelle zum 16-Bit BIOS
@ -45,6 +47,7 @@ extern Scheduler scheduler;
extern KeyEventManager kevman;
extern SerialOut serial;
extern Logger& logger;
extern unsigned int total_mem; // RAM total
extern unsigned long systime; // wird all 10ms hochgezaehlt

View File

@ -161,9 +161,9 @@ void pg_init() {
// sodass genau der physikalische Adressraum abgedeckt ist?
num_pages = total_mem / (4096 * 1024);
Logger::instance() << INFO << "pg_init: " << total_mem << endl;
Logger::instance() << INFO << " total_mem: " << total_mem << endl;
Logger::instance() << INFO << " #pages: " << total_mem / (4096 * 1024) << endl;
logger << INFO << "pg_init: " << total_mem << endl;
logger << INFO << " total_mem: " << total_mem << endl;
logger << INFO << " #pages: " << total_mem / (4096 * 1024) << endl;
//
// Aufbau des Page-Directory

View File

@ -13,7 +13,6 @@
#define __Scheduler_include__
#include "kernel/threads/Thread.h"
#include "lib/SpinLock.h"
#include "user/lib/Logger.h"
#include "user/lib/mem/UniquePointer.h"
#include "user/lib/Vector.h"
@ -40,13 +39,9 @@ private:
// bevor er initialisiert wurde
unsigned int idle_tid = 0U;
// NOTE: I would have to release the lock when switching threads but I don't know exactly how to do this
// in the assembly function
// SpinLock lock; // Use spinlock instead of cpu.disable_int() because it still allows preemption
// // for threads that don't use the scheduler
void start(bse::Vector<bse::unique_ptr<Thread>>::Iterator next); // Switches from prev to current active
void switch_to(Thread* prev_raw, bse::Vector<bse::unique_ptr<Thread>>::Iterator next); // Switches from prev to current active
// Roughly the old dispatcher functionality
void start(bse::Vector<bse::unique_ptr<Thread>>::Iterator next); // Start next without prev
void switch_to(Thread* prev_raw, bse::Vector<bse::unique_ptr<Thread>>::Iterator next); // Switch from prev to next
// Kann nur vom Idle-Thread aufgerufen werden (erster Thread der vom Scheduler gestartet wird)
void enable_preemption(unsigned int tid) { idle_tid = tid; }

View File

@ -6,7 +6,7 @@ void KeyEventListener::trigger(char c) {
}
char KeyEventListener::waitForKeyEvent() const {
Logger::instance() << DEBUG << "KEvLis:: Thread with id: " << tid << " waiting for key event" << endl;
logger << DEBUG << "KEvLis:: Thread with id: " << tid << " waiting for key event" << endl;
scheduler.block();
return this->lastChar; // This is only executed after thread is woken up by manager
}