fixes for A2
mostly include some things that should and remove some things that shouldn't have been included in the handout (yes this does hint at some places that need to be touched for A2)
This commit is contained in:
3175
kernel/assets/osg.h
3175
kernel/assets/osg.h
File diff suppressed because it is too large
Load Diff
@@ -96,13 +96,11 @@ Module *getModule(unsigned i) {
|
||||
|
||||
unsigned getModuleCount() { return multiboot_addr->mods.size; }
|
||||
|
||||
void *Memory::getStartAddress() const {
|
||||
return reinterpret_cast<void *>(static_cast<uintptr_t>(addr));
|
||||
}
|
||||
void *Memory::getStartAddress() const { return reinterpret_cast<void *>(addr); }
|
||||
|
||||
void *Memory::getEndAddress() const {
|
||||
uint64_t end = addr + len;
|
||||
return reinterpret_cast<void *>(static_cast<uintptr_t>(end));
|
||||
return reinterpret_cast<void *>(end);
|
||||
}
|
||||
|
||||
bool Memory::isAvailable() const { return type == AVAILABLE; }
|
||||
|
||||
@@ -21,7 +21,6 @@ OutputStream* copyout = ©stream;
|
||||
#include "./device/ps2controller.h"
|
||||
#include "./interrupt/guard.h"
|
||||
#include "./sync/semaphore.h"
|
||||
#include "./thread/thread.h"
|
||||
Semaphore koutsem(1);
|
||||
TextStream kout(0, 80, 1, 17, true);
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ assert_size(ErrorCode, 4);
|
||||
uint64_t err) {
|
||||
PageFault::ErrorCode error(err);
|
||||
// Get the faulting address
|
||||
uintptr_t virt;
|
||||
uintptr_t virt = 0;
|
||||
asm volatile("mov %%cr2, %0" : "=r"(virt));
|
||||
DBG << "Page fault at " << hex << virt << dec << endl;
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#include "syscall/handler.h"
|
||||
|
||||
#include "arch/core.h"
|
||||
#include "arch/core_interrupt.h"
|
||||
#include "arch/gdt.h"
|
||||
#include "arch/idt.h"
|
||||
#include "debug/kernelpanic.h"
|
||||
#include "debug/output.h"
|
||||
@@ -26,12 +24,12 @@ namespace Syscall {
|
||||
* by the system call number -- allowing up to five parameters for the system
|
||||
* call.
|
||||
*
|
||||
* \param sysnum identifier for the system call
|
||||
* \param p1 first parameter
|
||||
* \param p2 second parameter
|
||||
* \param p3 third parameter
|
||||
* \param p4 fourth parameter
|
||||
* \param p5 fifth parameter
|
||||
* \param sysnum identifier for the system call
|
||||
* \param user pointer to the interrupt \ref context (for example to determine
|
||||
* instruction pointer)
|
||||
* \return system call return value
|
||||
|
||||
@@ -32,15 +32,13 @@ void Scheduler::resume(bool ready) {
|
||||
Thread *me = dispatcher.active();
|
||||
assert(me != nullptr && "Pointer to active thread should never be nullptr");
|
||||
|
||||
if (true) {
|
||||
// Be careful, never put the idle thread into the ready list
|
||||
bool is_idle_thread = static_cast<Thread *>(&idleThread) == me;
|
||||
// Be careful, never put the idle thread into the ready list
|
||||
bool is_idle_thread = static_cast<Thread *>(&idleThread) == me;
|
||||
|
||||
if (ready && readylist.is_empty()) {
|
||||
return;
|
||||
} else if (!is_idle_thread) {
|
||||
if (ready) readylist.enqueue(*me);
|
||||
}
|
||||
if (ready && readylist.is_empty()) {
|
||||
return;
|
||||
} else if (!is_idle_thread) {
|
||||
if (ready) readylist.enqueue(*me);
|
||||
}
|
||||
|
||||
dispatcher.dispatch(getNext());
|
||||
@@ -56,6 +54,8 @@ void Scheduler::kill(Thread *that) {
|
||||
if (dispatcher.active() == that) {
|
||||
exit();
|
||||
}
|
||||
|
||||
readylist.remove(that);
|
||||
}
|
||||
|
||||
bool Scheduler::isEmpty() const { return readylist.is_empty(); }
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
#include "device/textstream.h"
|
||||
Reference in New Issue
Block a user