This repository has been archived on 2021-03-01. You can view files and clone it, but cannot push or open issues or pull requests.
kaneton/kaneton/machine/architecture/ia32/educational/tlb.c
Mercier Pierre-Olivier fee4dd4e6d Initial snapshot
2013-02-11 22:04:30 +01:00

59 lines
1.2 KiB
C

/*
* ---------- header ----------------------------------------------------------
*
* project kaneton
*
* license kaneton
*
* file /home/mycure/kane...hine/architecture/ia32/educational/tlb.c
*
* created matthieu bucchianeri [tue dec 20 19:57:00 2005]
* updated julien quintard [sat feb 5 10:40:55 2011]
*/
/*
* ---------- information -----------------------------------------------------
*
* this file contains functions for managing the TLB - Translation
* Lookaside Buffer.
*/
/*
* ---------- includes --------------------------------------------------------
*/
#include <kaneton.h>
/*
* ---------- functions -------------------------------------------------------
*/
/*
* this function invalidates a single address from the TLB.
*/
t_error architecture_tlb_invalidate(t_vaddr address)
{
asm volatile("invlpg (%0)"
:
: "r" (address)
: "memory");
MACHINE_LEAVE();
}
/*
* this function flushes the whole TLB's content.
*/
t_error architecture_tlb_flush(void)
{
asm volatile("movl %%cr3, %%eax\n\t"
"movl %%eax, %%cr3"
:
:
: "%eax", "memory");
MACHINE_LEAVE();
}