1
This commit is contained in:
2022-07-04 22:05:07 +02:00
parent 19ab6fef06
commit 51390ef277
10 changed files with 52 additions and 47 deletions

View File

@ -72,7 +72,7 @@ CC ?= gcc
CXX ?= g++
# I added O0 to allow paging/bluescreen to work (We need the ebp on the stack)
CFLAGS := $(CFLAGS) -O0 -m32 -march=i486 -Wall -fno-stack-protector -nostdlib -I. -g -ffreestanding -fno-pie -fno-pic -mpreferred-stack-boundary=2 -Wno-write-strings -mno-sse -mno-sse2 -mmanual-endbr
CFLAGS := $(CFLAGS) -O0 -m32 -march=i486 -Wall -fno-stack-protector -nostdlib -I. -g -ffreestanding -fno-pie -fno-pic -Wno-write-strings -mno-sse -mno-sse2 -mmanual-endbr -mpreferred-stack-boundary=2
# I added -std=c++17 for if constexpr, but it isn't necessary for anything critical
# Needed for template concepts, but we don't have it available: -std=c++20

View File

@ -11,17 +11,20 @@
#include "kernel/Globals.h"
CPU cpu; // CPU-spezifische Funktionen
PCSPK pcspk; // PC-Lautsprecher
CGA_Stream kout; // Ausgabe-Strom fuer Kernel
Keyboard kb; // Tastatur
IntDispatcher intdis; // Unterbrechungsverteilung
BIOS bios; // Schnittstelle zum 16-Bit BIOS
VESA vesa; // VESA-Treiber
PIC pic; // Interrupt-Controller
unsigned int total_mem; // RAM total
unsigned long systime = 0;
IntDispatcher intdis; // Unterbrechungsverteilung
PIT pit(10000);
Keyboard kb; // Tastatur
PCSPK pcspk; // PC-Lautsprecher
// BumpAllocator allocator;
// LinkedListAllocator allocator;
TreeAllocator allocator;
Scheduler scheduler;
BIOS bios; // Schnittstelle zum 16-Bit BIOS
VESA vesa; // VESA-Treiber
PIT pit(10000);
unsigned int total_mem; // RAM total
unsigned long systime = 0;

View File

@ -13,6 +13,7 @@
#include "devices/CGA_Stream.h"
#include "devices/Keyboard.h"
#include "devices/PCSPK.h"
#include "devices/PIT.h"
#include "devices/VESA.h"
#include "kernel/allocator/BumpAllocator.h"
#include "kernel/allocator/LinkedListAllocator.h"
@ -22,24 +23,26 @@
#include "kernel/interrupts/IntDispatcher.h"
#include "kernel/interrupts/PIC.h"
#include "kernel/threads/Scheduler.h"
#include "devices/PIT.h"
extern CPU cpu; // CPU-spezifische Funktionen
extern PCSPK pcspk; // PC-Lautsprecher
extern CGA_Stream kout; // Ausgabe-Strom fuer Kernel
extern Keyboard kb; // Tastatur
extern IntDispatcher intdis; // Unterbrechungsverteilung
extern BIOS bios; // Schnittstelle zum 16-Bit BIOS
extern VESA vesa; // VESA-Treiber
extern PIC pic; // Interrupt-Controller
extern IntDispatcher intdis; // Unterbrechungsverteilung
extern PIT pit; // Zeitgeber
extern unsigned int total_mem; // RAM total
extern unsigned long systime; // wird all 10ms hochgezaehlt
extern Keyboard kb; // Tastatur
extern PCSPK pcspk; // PC-Lautsprecher
// extern BumpAllocator allocator;
// extern LinkedListAllocator allocator;
extern TreeAllocator allocator;
extern Scheduler scheduler;
extern BIOS bios; // Schnittstelle zum 16-Bit BIOS
extern VESA vesa; // VESA-Treiber
constexpr bool DEBUG = true;
extern unsigned int total_mem; // RAM total
extern unsigned long systime; // wird all 10ms hochgezaehlt
#endif

View File

@ -52,7 +52,6 @@ public:
// CPU freiwillig abgeben und Auswahl des naechsten Threads
void yield();
// Thread umschalten; wird aus der ISR des PITs gerufen
void preempt();
};

View File

@ -15,9 +15,9 @@
#include "kernel/threads/IdleThread.h"
#include "user/CoopThreadDemo.h"
#include "user/HelloWorldThread.h"
#include "user/VBEdemo.h"
#include "user/PCSPKdemo.h"
#include "user/PreemptiveThreadDemo.h"
#include "user/VBEdemo.h"
int main() {
kout.clear();

View File

@ -1,8 +1,8 @@
#ifndef __pre_loopthread_include__
#define __pre_loopthread_include__
#include "kernel/threads/Thread.h"
#include "kernel/Globals.h"
#include "kernel/threads/Thread.h"
class PreemptiveLoopThread : public Thread {