1

move folder

This commit is contained in:
churl
2022-04-16 14:50:17 +02:00
parent 87e482bc7c
commit 4ec2beeda2
25 changed files with 319 additions and 0 deletions

30
c_os/kernel/CPU.h Executable file
View File

@ -0,0 +1,30 @@
/*****************************************************************************
* *
* C P U *
* *
*---------------------------------------------------------------------------*
* Beschreibung: Implementierung einer Abstraktion fuer den Prozessor. *
* *
* Autor: Michael Schoettner, 30.7.16 *
*****************************************************************************/
#ifndef __CPU_include__
#define __CPU_include__
class CPU {
private:
CPU(const CPU &copy); // Verhindere Kopieren
public:
CPU() {}
// Time-Stamp-Counter auslesen
inline unsigned long long int rdtsc() {
unsigned long long int ret;
asm volatile ( "rdtsc" : "=A"(ret) );
return ret;
}
};
#endif

17
c_os/kernel/Globals.cc Executable file
View File

@ -0,0 +1,17 @@
/*****************************************************************************
* *
* G L O B A L S *
* *
*---------------------------------------------------------------------------*
* Beschreibung: Globale Variablen des Systems. *
* *
* Autor: Michael Schoettner, 30.7.16 *
*****************************************************************************/
#include "kernel/Globals.h"
CPU cpu; // CPU-spezifische Funktionen
PCSPK pcspk; // PC-Lautsprecher
CGA_Stream kout; // Ausgabe-Strom fuer Kernel

21
c_os/kernel/Globals.h Executable file
View File

@ -0,0 +1,21 @@
/*****************************************************************************
* *
* G L O B A L S *
* *
*---------------------------------------------------------------------------*
* Beschreibung: Globale Variablen des Systems. *
* *
* Autor: Michael Schoettner, 30.7.16 *
*****************************************************************************/
#ifndef __Globals_include__
#define __Globals_include__
#include "kernel/CPU.h"
#include "devices/PCSPK.h"
#include "devices/CGA_Stream.h"
extern CPU cpu; // CPU-spezifische Funktionen
extern PCSPK pcspk; // PC-Lautsprecher
extern CGA_Stream kout; // Ausgabe-Strom fuer Kernel
#endif

76
c_os/kernel/IOport.h Executable file
View File

@ -0,0 +1,76 @@
/*****************************************************************************
* *
* I O P O R T *
* *
*---------------------------------------------------------------------------*
* Beschreibung: Diese Klasse dient dem Zugriff auf die Ein-/Ausgabe *
* Ports des PCs. Beim PC gibt es einen gesonderten I/O- *
* Adressraum, der nur mittels der Maschineninstruktionen *
* 'in' und 'out' angesprochen werden kann. Ein IOport- *
* Objekt wird beim Erstellen an eine Adresse des I/O- *
* Adressraums gebunden und kann dann fuer byte- oder *
* wortweise Ein- oder Ausgaben verwendet werden. *
* *
* Autor: Michael Schoettner, 28.8.2016 *
*****************************************************************************/
#ifndef __IOport_include__
#define __IOport_include__
class IOport {
// Kopieren erlaubt!
// 16-Bit Adresse im I/O-Adressraum
unsigned short address;
public:
// Konstruktor, speichert Port-Adresse
IOport (unsigned short a) : address (a) { };
// Byteweise Ausgabe eines Wertes ueber einen I/O-Port.
void outb (unsigned char val) const {
asm volatile ( "outb %0, %1" : : "a"(val), "Nd"(address) );
}
// Wortweise Ausgabe eines Wertes ueber einen I/O-Port.
void outw (unsigned short val) const {
asm volatile ( "outw %0, %1" : : "a"(val), "Nd"(address) );
}
// 32-Bit Ausgabe eines Wertes ueber einen I/O-Port.
void outdw (unsigned int val) const {
asm volatile ( "outl %0, %1" : : "a"(val), "Nd"(address) );
}
// Byteweises Einlesen eines Wertes ueber einen I/O-Port.
unsigned char inb () const {
unsigned char ret;
asm volatile ( "inb %1, %0"
: "=a"(ret)
: "Nd"(address) );
return ret;
}
// Wortweises Einlesen eines Wertes ueber einen I/O-Port.
unsigned short inw () const {
unsigned short ret;
asm volatile ( "inw %1, %0"
: "=a"(ret)
: "Nd"(address) );
return ret;
}
// 32-Bit Einlesen eines Wertes ueber einen I/O-Port.
unsigned int indw () const {
unsigned int ret;
asm volatile ( "inl %1, %0"
: "=a"(ret)
: "Nd"(address) );
return ret;
}
};
#endif

View File

@ -0,0 +1,21 @@
/*****************************************************************************
* *
* I N T D I S P A T C H E R *
* *
*---------------------------------------------------------------------------*
* Beschreibung: Zentrale Unterbrechungsbehandlungsroutine des Systems. *
* Der Parameter gibt die Nummer des aufgetretenen *
* Interrupts an. Wenn eine Interrupt Service Routine *
* registriert ist, wird diese aufgerufen. *
* *
* Autor: Michael Schoettner, 30.7.16 *
*****************************************************************************/
extern "C" void int_disp (unsigned int slot);
// Low-Level Interrupt-Behandlung. (Die Funktion wird spaeter noch erweitert)
void int_disp (unsigned int slot) {
}