add bluescreen demo
This commit is contained in:
@ -67,12 +67,6 @@
|
||||
#define FST_ALLOCABLE_PAGE 0x202000
|
||||
#define LST_ALLOCABLE_PAGE 0x2FF000
|
||||
|
||||
// Externe Funktionen in startup.asm
|
||||
extern "C" {
|
||||
void paging_on(unsigned int* p_pdir); // Paging einschalten
|
||||
void invalidate_tlb_entry(unsigned int* ptr); // Page in TLB invalid.
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* Funktion: pg_alloc_page *
|
||||
*---------------------------------------------------------------------------*
|
||||
|
||||
@ -52,6 +52,12 @@
|
||||
#ifndef __Paging_include__
|
||||
#define __Paging_include__
|
||||
|
||||
// Externe Funktionen in startup.asm
|
||||
extern "C" {
|
||||
void paging_on(unsigned int* p_pdir); // Paging einschalten
|
||||
void invalidate_tlb_entry(unsigned int* ptr); // Page in TLB invalid.
|
||||
}
|
||||
|
||||
// ativiert paging
|
||||
extern void pg_init();
|
||||
|
||||
|
||||
20
c_os/main.cc
20
c_os/main.cc
@ -11,12 +11,11 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "kernel/Globals.h"
|
||||
|
||||
// TODO: paging/bluescreen demo, don't include here
|
||||
#include "kernel/Paging.h"
|
||||
|
||||
// Demos
|
||||
// TODO: Make demo header or include through demo menu
|
||||
#include "user/demo/BlueScreenDemo.h"
|
||||
#include "user/demo/HeapDemo.h"
|
||||
#include "user/demo/KeyboardDemo.h"
|
||||
#include "user/demo/PCSPKdemo.h"
|
||||
@ -63,28 +62,13 @@ int main() {
|
||||
// This has to happen after the allocator is initialized but before the scheduler is started
|
||||
pg_init();
|
||||
|
||||
// TODO: Move this to demo
|
||||
// Trigger Bluescreen
|
||||
// kout << "Trigger Bluescreen, if you can read this it didn't work" << endl;
|
||||
|
||||
// BlueScreen 1
|
||||
// asm("int $3");
|
||||
|
||||
// BlueScreen 2
|
||||
// unsigned int* page = pg_alloc_page();
|
||||
// *page = 42;
|
||||
// pg_write_protect_page(page);
|
||||
// invalidate_tlb_entry(page); // If we don't invalidate after first access the write protection
|
||||
// // won't work as no lookup is performed (address in tlb)
|
||||
// *page = 42; // We map logical to physical 1:1 so no need to do any lookup
|
||||
// // If tlb is invalidated this access produces a pagefault
|
||||
|
||||
// Demos
|
||||
// scheduler.ready(new TextDemo());
|
||||
// scheduler.ready(new PCSPKdemo(&PCSPK::aerodynamic));
|
||||
// scheduler.ready(new KeyboardDemo());
|
||||
// scheduler.ready(new HeapDemo());
|
||||
// scheduler.ready(new VBEdemo());
|
||||
// scheduler.ready(new BlueScreenDemo());
|
||||
// scheduler.ready(new PreemptiveThreadDemo());
|
||||
|
||||
// Scheduler starten (schedule() erzeugt den Idle-Thread)
|
||||
|
||||
20
c_os/user/demo/BlueScreenDemo.cc
Normal file
20
c_os/user/demo/BlueScreenDemo.cc
Normal file
@ -0,0 +1,20 @@
|
||||
#include "user/demo/BlueScreenDemo.h"
|
||||
#include "kernel/Paging.h"
|
||||
|
||||
void BlueScreenDemo::run() {
|
||||
kout << "Trigger Bluescreen, if you can read this it didn't work" << endl;
|
||||
|
||||
// BlueScreen 1
|
||||
// asm("int $3");
|
||||
|
||||
// BlueScreen 2
|
||||
unsigned int* page = pg_alloc_page();
|
||||
*page = 42;
|
||||
pg_write_protect_page(page);
|
||||
invalidate_tlb_entry(page); // If we don't invalidate after first access the write protection
|
||||
// won't work as no lookup is performed (address in tlb)
|
||||
*page = 42; // We map logical to physical 1:1 so no need to do any lookup
|
||||
// If tlb is invalidated this access produces a pagefault
|
||||
|
||||
scheduler.exit();
|
||||
}
|
||||
20
c_os/user/demo/BlueScreenDemo.h
Normal file
20
c_os/user/demo/BlueScreenDemo.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef __BlueScreenDemo_include__
|
||||
#define __BlueScreenDemo_include__
|
||||
|
||||
#include "kernel/Globals.h"
|
||||
#include "kernel/threads/Thread.h"
|
||||
|
||||
class BlueScreenDemo : public Thread {
|
||||
private:
|
||||
BlueScreenDemo(const BlueScreenDemo& copy) = delete;
|
||||
|
||||
public:
|
||||
BlueScreenDemo() {
|
||||
kout << "Initialized BlueScreenDemo" << endl;
|
||||
}
|
||||
|
||||
void run() override;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user