ptos: ps: Add new VAS per-process
Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
#ifndef _PS_PROCESS_H_
|
#ifndef _PS_PROCESS_H_
|
||||||
#define _PS_PROCESS_H_ 1
|
#define _PS_PROCESS_H_ 1
|
||||||
|
|
||||||
|
#include <hal/mmu.h>
|
||||||
#include <ptapi/status.h>
|
#include <ptapi/status.h>
|
||||||
#include <ptdef.h>
|
#include <ptdef.h>
|
||||||
|
|
||||||
@@ -27,11 +28,13 @@
|
|||||||
* @Name: Name of process
|
* @Name: Name of process
|
||||||
* @Pid: Process ID
|
* @Pid: Process ID
|
||||||
* @Flags: Initialization flags
|
* @Flags: Initialization flags
|
||||||
|
* @Vas: Virtual address space of process
|
||||||
*/
|
*/
|
||||||
typedef struct _PROCESS {
|
typedef struct _PROCESS {
|
||||||
CHAR Name[PS_NAME_MAX];
|
CHAR Name[PS_NAME_MAX];
|
||||||
UQUAD Pid;
|
UQUAD Pid;
|
||||||
ULONG Flags;
|
ULONG Flags;
|
||||||
|
MMU_VAS Vas;
|
||||||
} PROCESS;
|
} PROCESS;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ PsCreateProcess(const CHAR *Name, ULONG Flags, PROCESS **Result)
|
|||||||
{
|
{
|
||||||
USIZE NameLen;
|
USIZE NameLen;
|
||||||
PROCESS *Process;
|
PROCESS *Process;
|
||||||
|
MMU_VAS CurrentVas;
|
||||||
|
PT_STATUS Status;
|
||||||
|
|
||||||
if (Name == NULL || Result == NULL) {
|
if (Name == NULL || Result == NULL) {
|
||||||
return STATUS_INVALID_PARAM;
|
return STATUS_INVALID_PARAM;
|
||||||
@@ -43,6 +45,14 @@ PsCreateProcess(const CHAR *Name, ULONG Flags, PROCESS **Result)
|
|||||||
return STATUS_NO_MEMORY;
|
return STATUS_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Fork a new VAS */
|
||||||
|
HalMmuReadVas(&CurrentVas);
|
||||||
|
Status = HalMmuForkVas(&CurrentVas, &Process->Vas);
|
||||||
|
if (PT_ERROR(Status)) {
|
||||||
|
ExFreePoolWithTag(Process, PS_POOL_TAG);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
RtlMemCpy(Process->Name, Name, NameLen);
|
RtlMemCpy(Process->Name, Name, NameLen);
|
||||||
Process->Pid = AtomicIncQuad(&ProcessId);
|
Process->Pid = AtomicIncQuad(&ProcessId);
|
||||||
Process->Flags = Flags;
|
Process->Flags = Flags;
|
||||||
|
|||||||
Reference in New Issue
Block a user