x86: Add function to modify CR3 register

Register CR3 holds the physical address of paging-structure hierarchy.
Add functions to enable read/write of this register.

Change-Id: Icfd8f8e32833d2c80cefc8f930d6eedbfeb5e3ee
Signed-off-by: Naresh G Solanki <naresh.solanki@intel.com>
Reviewed-on: https://review.coreboot.org/25478
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Naresh G Solanki 2018-04-02 21:36:05 +05:30 committed by Subrata Banik
parent 65d2d21a04
commit f92fcabba8
1 changed files with 21 additions and 0 deletions

View File

@ -59,6 +59,27 @@ static alwaysinline void write_cr0(CRx_TYPE data)
);
}
static alwaysinline CRx_TYPE read_cr3(void)
{
CRx_TYPE value;
__asm__ __volatile__ (
"mov %%cr3, %0"
: CRx_RET(value)
:
: COMPILER_BARRIER
);
return value;
}
static alwaysinline void write_cr3(CRx_TYPE data)
{
__asm__ __volatile__ (
"mov %0, %%cr3"
:
: CRx_IN(data)
: COMPILER_BARRIER
);
}
static alwaysinline CRx_TYPE read_cr4(void)
{
CRx_TYPE value;