sp1/amd64: mmu: Introduce virtual fuck regions
Signed-off-by: Ian Moffett <ian@mirocom.org>
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) 2026, Mirocom Laboratories
|
||||
* All rights reserved.
|
||||
*
|
||||
* The following sources are CONFIDENTIAL and PROPRIETARY
|
||||
* property of Mirocom Laboratories. Unauthorized copying,
|
||||
* use, distribution or modification of this file, in whole
|
||||
* and in part, is strictly prohibited without the prior written
|
||||
* consent from Mirocom Laboratories.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <mu/mmu.h>
|
||||
|
||||
void
|
||||
mu_mmu_readvfr(struct mmu_vfr *res)
|
||||
{
|
||||
if (res == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
__asmv(
|
||||
"mov %%cr3, %0"
|
||||
: "=r" (res->cr3)
|
||||
:
|
||||
: "memory"
|
||||
);
|
||||
}
|
||||
|
||||
void
|
||||
mu_mmu_writevfr(struct mmu_vfr *vfr)
|
||||
{
|
||||
if (vfr == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
__asmv(
|
||||
"mov %0, %%cr3"
|
||||
:
|
||||
: "r" (vfr->cr3)
|
||||
: "memory"
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 2026, Mirocom Laboratories
|
||||
* All rights reserved.
|
||||
*
|
||||
* The following sources are CONFIDENTIAL and PROPRIETARY
|
||||
* property of Mirocom Laboratories. Unauthorized copying,
|
||||
* use, distribution or modification of this file, in whole
|
||||
* and in part, is strictly prohibited without the prior written
|
||||
* consent from Mirocom Laboratories.
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_VFR_H_
|
||||
#define _MACHINE_VFR_H_ 1
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
/*
|
||||
* Virtual fuck region for AMD64
|
||||
*/
|
||||
struct mmu_vfr {
|
||||
uint64_t cr3;
|
||||
};
|
||||
|
||||
#endif /* !_MACHINE_VFR_H_ */
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2026, Mirocom Laboratories
|
||||
* All rights reserved.
|
||||
*
|
||||
* The following sources are CONFIDENTIAL and PROPRIETARY
|
||||
* property of Mirocom Laboratories. Unauthorized copying,
|
||||
* use, distribution or modification of this file, in whole
|
||||
* and in part, is strictly prohibited without the prior written
|
||||
* consent from Mirocom Laboratories.
|
||||
*/
|
||||
|
||||
#ifndef _MU_MMU_H_
|
||||
#define _MU_MMU_H_ 1
|
||||
|
||||
/*
|
||||
* Each running SP1 process is to have a virtual fuck region
|
||||
* which logically isolates their address space with the help
|
||||
* of the platform memory management unit.
|
||||
*/
|
||||
#include <machine/vfr.h> /* shared; virtual fuck region~ */
|
||||
|
||||
/*
|
||||
* Obtain the current VFR in-use
|
||||
*
|
||||
* @res: Result is written here
|
||||
*/
|
||||
void mu_mmu_readvfr(struct mmu_vfr *res);
|
||||
|
||||
/*
|
||||
* Write a new VFR to the processor
|
||||
*
|
||||
* @vfr: Virtual fuck region to set
|
||||
*/
|
||||
void mu_mmu_writevfr(struct mmu_vfr *vfr);
|
||||
|
||||
#endif /* !_MU_MMU_H_ */
|
||||
Reference in New Issue
Block a user