1

Merge branch 'main' into thread.asm_change

This commit is contained in:
2022-07-23 15:23:55 +02:00
10 changed files with 16 additions and 14 deletions

View File

@ -3,6 +3,7 @@ Makefile
- Added the -std=c++17 flag to enable better constexpr support.
- Removed optimizations as the system would crash with them.
The BlueScreen would show an empty callstack on crashes with -O2 so I guess the problem is the missing ebp or something like that.
- Added qemu-stdio target for easy access to the serial output
Changes
======================================
@ -31,5 +32,7 @@ Additions
Bugs
======================================
- Can't exit the PCSPKdemo (bluescreen)
- After exiting the VBEdemo the paging isn't reactivated (so the pagefault bluescreen no longer works)
- The PreemptiveThreadDemo LoopThreads can't be exited, the demo can't be launched multiple times
- Random bluescreens that are hard to pinpoint
- Tree Allocator (uses a red black tree to find best-fit blocks) crashes when freelist root is removed

View File

@ -78,14 +78,14 @@ EMPTY :=
GCC = gcc
ifeq ($(CXX),$(GCC))
# Separate these as they are not compatible with clang14
EXTRAFLAGS = -mmanual-endbr -mpreferred-stack-boundary=2
GCCFLAGS = -mmanual-endbr -mpreferred-stack-boundary=2
else
EXTRAFLAGS = $(EMPTY)
GCCFLAGS = $(EMPTY)
endif
# NOTE: Need -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 -Wno-write-strings -mno-sse -mno-sse2 $(EXTRAFLAGS)
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 $(GCCFLAGS)
# NOTE: -std=c++17 for if constexpr and probably some other stuff
# -std=c++20 is needed for template concepts and optional references, but we don't have it available :(

View File

@ -12,7 +12,7 @@
* Aenderungen von Michael Schoettner, HHU, 21.8.2016 *
*****************************************************************************/
#include "devices/CGA.h"
#include "user/lib/MyLib.h"
#include "user/lib/Memory.h"
/*****************************************************************************
* Methode: CGA::setpos *

View File

@ -37,7 +37,7 @@ public:
void outb(unsigned char offset, unsigned char val) const {
asm volatile("outb %0, %1"
:
: "a"(val), "Nd"(address + offset));
: "a"(val), "Nd"((unsigned short)(address + offset)));
}
// Wortweise Ausgabe eines Wertes ueber einen I/O-Port.
@ -70,7 +70,7 @@ public:
asm volatile("inb %1, %0"
: "=a"(ret)
: "Nd"(address + offset));
: "Nd"((unsigned short)(address + offset)));
return ret;
}

View File

@ -42,6 +42,7 @@ void Thread_init(unsigned int* esp, unsigned int* stack, void (*kickoff)(Thread*
// NOTE: c++17 doesn't allow register
// register unsigned int** sp = (unsigned int**)stack;
unsigned int** sp = (unsigned int**)stack;
// Stack initialisieren. Es soll so aussehen, als waere soeben die
// eine Funktion aufgerufen worden, die als Parameter den Zeiger

View File

@ -1,8 +1,6 @@
#ifndef __Iterator_Include_H_
#define __Iterator_Include_H_
#include <cstddef>
namespace bse {
// This iterator works for structures where the elements are adjacent in memory.
@ -30,11 +28,11 @@ namespace bse {
return *this;
}
ContinuousIterator operator+(std::size_t add) {
ContinuousIterator operator+(unsigned int add) {
return ContinuousIterator(this->ptr + add);
}
ContinuousIterator operator-(std::size_t sub) {
ContinuousIterator operator-(unsigned int sub) {
return ContinuousIterator(this->ptr - sub);
}
@ -52,11 +50,11 @@ namespace bse {
bool operator!=(const ContinuousIterator& other) const { return this->ptr != other.ptr; }
template<typename t>
friend std::size_t distance(const ContinuousIterator<t>& first, const ContinuousIterator<t>& last);
friend unsigned int distance(const ContinuousIterator<t>& first, const ContinuousIterator<t>& last);
};
template<typename T>
std::size_t distance(const ContinuousIterator<T>& first, const ContinuousIterator<T>& last) {
unsigned int distance(const ContinuousIterator<T>& first, const ContinuousIterator<T>& last) {
return last.ptr - first.ptr;
}

View File

@ -1,4 +1,4 @@
#include "user/lib/MyLib.h"
#include "user/lib/Memory.h"
void bse::memset(char* destination, char value, unsigned int bytes) {
for (unsigned int byte = 0; byte < bytes; ++byte) {

View File

@ -2,6 +2,7 @@
#define __MYSTDLIB_INCLUDE_H_
namespace bse {
template<typename T>
void memcpy(T* destination, T* source, unsigned int count = 1) {
for (unsigned int i = 0; i < count; ++i) {

View File

@ -7,7 +7,6 @@
#include "Iterator.h"
#include "Logger.h"
#include <cstddef>
#include <utility>
// https://en.cppreference.com/w/cpp/container/vector

Binary file not shown.