Skip to content

Commit

Permalink
working on threading, scheduler and process improvements, this has a …
Browse files Browse the repository at this point in the history
…lot of side-effects,for the better hopefully
  • Loading branch information
Meulengracht committed Oct 24, 2018
1 parent 5c017f0 commit 65c9d0c
Show file tree
Hide file tree
Showing 41 changed files with 1,044 additions and 2,036 deletions.
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,9 @@
"os.h": "c",
"iospace.h": "c",
"deviceio.h": "c",
"mstring.h": "c"
"mstring.h": "c",
"assert.h": "c",
"memorybuffer.h": "c"
},
"git.ignoreLimitWarning": true,
"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\bash.exe",
Expand Down
9 changes: 5 additions & 4 deletions kernel/arch/x86/components/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@
*/
#define __MODULE "XTIF"

#include <process/process.h>
#include <system/thread.h>
#include <system/utils.h>
#include <threading.h>
#include <process/phoenix.h>
#include <interrupts.h>
#include <thread.h>
#include <memory.h>
#include <handle.h>
#include <debug.h>
#include <heap.h>
#include <apic.h>
Expand Down Expand Up @@ -122,7 +123,6 @@ OsStatus_t
ThreadingUnregister(
_In_ MCoreThread_t *Thread)
{
// Cleanup
kfree((void*)Thread->Data[THREAD_DATA_MATHBUFFER]);
return OsSuccess;
}
Expand Down Expand Up @@ -163,9 +163,10 @@ ThreadingYield(void)
* does not return. */
OsStatus_t
ThreadingSignalDispatch(
_In_ MCoreThread_t *Thread)
_In_ MCoreThread_t* Thread)
{
MCoreAsh_t *Process = PhoenixGetAsh(Thread->AshId);
SystemProcess_t* Process = (SystemProcess_t*)LookupHandle(Thread->ProcessHandle);
assert(Process != NULL);

// Now we can enter the signal context
// handler, we cannot return from this function
Expand Down
6 changes: 3 additions & 3 deletions kernel/arch/x86/interrupts/interrupts.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <system/thread.h>
#include <system/utils.h>
#include <ds/collection.h>
#include <process/phoenix.h>
#include <process/process.h>
#include <acpiinterface.h>
#include <interrupts.h>
#include <threading.h>
Expand Down Expand Up @@ -414,7 +414,7 @@ ExceptionSignal(
#ifdef __OSCONFIG_DISABLE_SIGNALLING
if (Signal >= 0) {
#else
if (PhoenixGetCurrentAsh() == NULL) {
if (GetCurrentProcess() == NULL) {
#endif
return OsError;
}
Expand Down Expand Up @@ -561,7 +561,7 @@ ExceptionEntry(
}

// Locate which module
if (DebugGetModuleByAddress(PhoenixGetCurrentAsh(), CONTEXT_IP(Registers), &Base, &Name) == OsSuccess) {
if (DebugGetModuleByAddress(GetCurrentProcess(), CONTEXT_IP(Registers), &Base, &Name) == OsSuccess) {
uintptr_t Diff = CONTEXT_IP(Registers) - Base;
WRITELINE("Faulty Address: 0x%x (%s)", Diff, Name);
}
Expand Down
6 changes: 3 additions & 3 deletions kernel/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ DebugStackTrace(
uintptr_t Value = StackPtr[0];
uintptr_t Base = 0;
char *Name = NULL;
if (DebugGetModuleByAddress(PhoenixGetCurrentAsh(), Value, &Base, &Name) == OsSuccess) {
if (DebugGetModuleByAddress(GetCurrentProcess(), Value, &Base, &Name) == OsSuccess) {
uintptr_t Diff = Value - Base;
WRITELINE("%u - 0x%x (%s)", MaxFrames - Itr, Diff, Name);
Itr--;
Expand Down Expand Up @@ -367,7 +367,7 @@ DebugPageFaultFileMappings(
// Variables
MCoreAshFileMappingEvent_t *Event = NULL;
MCoreAshFileMapping_t *Mapping = NULL;
MCoreAsh_t *Ash = PhoenixGetCurrentAsh();
MCoreAsh_t *Ash = GetCurrentProcess();

if (Ash != NULL) {
// Iterate file-mappings
Expand Down Expand Up @@ -399,7 +399,7 @@ DebugPageFaultProcessHeapMemory(
_In_ Context_t* Context,
_In_ uintptr_t Address)
{
MCoreAsh_t *Ash = PhoenixGetCurrentAsh();
MCoreAsh_t *Ash = GetCurrentProcess();
Flags_t PageFlags = MAPPING_USERSPACE | MAPPING_FIXED;

if (Ash != NULL) {
Expand Down
153 changes: 0 additions & 153 deletions kernel/events.c

This file was deleted.

4 changes: 3 additions & 1 deletion kernel/handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@

// Include all the systems that we have to cleanup
#include <memorybuffer.h>
#include <phoenix/process.h>

static Collection_t Handles = COLLECTION_INIT(KeyInteger);
static _Atomic(UUId_t) IdGenerator = 1;
static HandleDestructorFn HandleDestructors[HandleTypeCount] = {
DestroyMemoryBuffer
DestroyMemoryBuffer,
DestroyProcess
};

/* CreateHandle
Expand Down
108 changes: 0 additions & 108 deletions kernel/include/events.h

This file was deleted.

1 change: 1 addition & 0 deletions kernel/include/handle.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

typedef enum _SystemHandleType {
HandleTypeMemoryBuffer = 0,
HandleTypeProcess,

HandleTypeCount
} SystemHandleType_t;
Expand Down
Loading

0 comments on commit 65c9d0c

Please sign in to comment.