1

initial reformat, still has misformats

This commit is contained in:
churl
2022-04-25 14:24:56 +02:00
parent 67fce9ff2d
commit 263563c105
20 changed files with 295 additions and 317 deletions

View File

@ -10,19 +10,19 @@
#ifndef __CPU_include__
#define __CPU_include__
class CPU {
private:
CPU(const CPU &copy); // Verhindere Kopieren
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) );
unsigned long long int ret;
asm volatile("rdtsc"
: "=A"(ret));
return ret;
}
};

View File

@ -10,8 +10,6 @@
#include "kernel/Globals.h"
CPU cpu; // CPU-spezifische Funktionen
PCSPK pcspk; // PC-Lautsprecher
CGA_Stream kout; // Ausgabe-Strom fuer Kernel
CPU cpu; // CPU-spezifische Funktionen
PCSPK pcspk; // PC-Lautsprecher
CGA_Stream kout; // Ausgabe-Strom fuer Kernel

View File

@ -10,12 +10,12 @@
#ifndef __Globals_include__
#define __Globals_include__
#include "kernel/CPU.h"
#include "devices/PCSPK.h"
#include "devices/CGA_Stream.h"
#include "devices/PCSPK.h"
#include "kernel/CPU.h"
extern CPU cpu; // CPU-spezifische Funktionen
extern PCSPK pcspk; // PC-Lautsprecher
extern CGA_Stream kout; // Ausgabe-Strom fuer Kernel
extern CPU cpu; // CPU-spezifische Funktionen
extern PCSPK pcspk; // PC-Lautsprecher
extern CGA_Stream kout; // Ausgabe-Strom fuer Kernel
#endif

View File

@ -16,7 +16,6 @@
#ifndef __IOport_include__
#define __IOport_include__
class IOport {
// Kopieren erlaubt!
@ -25,50 +24,56 @@ class IOport {
public:
// Konstruktor, speichert Port-Adresse
IOport (unsigned short a) : address (a) { };
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) );
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) );
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) );
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 inb() const {
unsigned char ret;
asm volatile ( "inb %1, %0"
: "=a"(ret)
: "Nd"(address) );
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 inw() const {
unsigned short ret;
asm volatile ( "inw %1, %0"
: "=a"(ret)
: "Nd"(address) );
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 indw() const {
unsigned int ret;
asm volatile ( "inl %1, %0"
: "=a"(ret)
: "Nd"(address) );
asm volatile("inl %1, %0"
: "=a"(ret)
: "Nd"(address));
return ret;
}
};

View File

@ -11,11 +11,8 @@
* Autor: Michael Schoettner, 30.7.16 *
*****************************************************************************/
extern "C" void int_disp (unsigned int slot);
extern "C" void int_disp(unsigned int slot);
// Low-Level Interrupt-Behandlung. (Die Funktion wird spaeter noch erweitert)
void int_disp (unsigned int slot) {
void int_disp(unsigned int slot) {
}