csrts: Add CSRTS stub and load from kernel
Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
+39
-1
@@ -12,7 +12,9 @@
|
||||
#include <ke/sched.h>
|
||||
#include <ex/trace.h>
|
||||
#include <ex/pbi.h>
|
||||
#include <ex/loader.h>
|
||||
#include <ps/process.h>
|
||||
#include <ps/thread.h>
|
||||
#include <mm/pm.h>
|
||||
#include <mm/vm.h>
|
||||
#include <hal/prim.h>
|
||||
@@ -26,6 +28,7 @@
|
||||
/* Globals */
|
||||
static KPCR BootstrapCore;
|
||||
static PROCESS *RootProcess;
|
||||
static THREAD *RootThread;
|
||||
|
||||
/*
|
||||
* Display the copyright for legal reasons
|
||||
@@ -44,11 +47,13 @@ static VOID
|
||||
InitializeRootProcess(VOID)
|
||||
{
|
||||
PT_STATUS Status;
|
||||
PBI_FILE File;
|
||||
LOADER_PROGRAM Csrts;
|
||||
|
||||
/* Create the client server runtime service */
|
||||
Status = PsCreateProcess(
|
||||
"csrts.sys",
|
||||
0,
|
||||
PS_USER,
|
||||
&RootProcess
|
||||
);
|
||||
|
||||
@@ -58,6 +63,39 @@ InitializeRootProcess(VOID)
|
||||
"could not create csrts.sys process\n"
|
||||
);
|
||||
}
|
||||
|
||||
/* Get the CSRTS binary */
|
||||
Status = ExPbiLookup("/boot/csrts.sys", &File);
|
||||
if (PT_ERROR(Status)) {
|
||||
KeBugCheck(
|
||||
BUGCHECK_MISC,
|
||||
"unable to locate /boot/csrts.sys\n"
|
||||
);
|
||||
}
|
||||
|
||||
/* Now load the program */
|
||||
Status = ExLoadProgramOf(
|
||||
LOADER_ELF64,
|
||||
&RootProcess->Vas,
|
||||
File.Data,
|
||||
&Csrts
|
||||
);
|
||||
|
||||
if (PT_ERROR(Status)) {
|
||||
KeBugCheck(
|
||||
BUGCHECK_MISC,
|
||||
"unable to load csrts.sys\n"
|
||||
);
|
||||
}
|
||||
|
||||
Status = PsCreateThread(
|
||||
RootProcess,
|
||||
0,
|
||||
Csrts.EntryPoint,
|
||||
&RootThread
|
||||
);
|
||||
|
||||
KeSchedEnqueue(&BootstrapCore.SchedQueue, RootThread);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user