Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 724 → Rev 727

/kernel/trunk/generic/include/mm/asid.h
26,9 → 26,35
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/*
* This is generic interface for managing
* Address Space IDentifiers (ASIDs).
*/
 
#ifndef __ASID_H__
#define __ASID_H__
 
#include <arch/mm/asid.h>
#include <typedefs.h>
 
#define ASID_KERNEL 0
#define ASID_INVALID 1
#define ASID_START 2
#define ASID_MAX ASID_MAX_ARCH
 
#define ASIDS_ALLOCABLE ((ASID_MAX+1)-ASID_START)
 
extern spinlock_t asidlock;
extern link_t as_with_asid_head;
 
extern asid_t asid_get(void);
extern void asid_put(asid_t asid);
 
#ifndef asid_install
extern void asid_install(as_t *as);
#endif /* !def asid_install */
 
#define asid_find_free() ASID_START
#define asid_put_arch(x)
 
#endif
/kernel/trunk/generic/include/mm/tlb.h
31,25 → 31,14
 
#include <arch/mm/asid.h>
#include <arch/types.h>
#include <typedefs.h>
 
extern void tlb_init(void);
 
#ifdef CONFIG_SMP
extern void tlb_shootdown_start(void);
extern void tlb_shootdown_finalize(void);
extern void tlb_shootdown_ipi_recv(void);
#else
# define tlb_shootdown_start() ;
# define tlb_shootdown_finalize() ;
# define tlb_shootdown_ipi_recv() ;
#endif /* CONFIG_SMP */
 
/** Type of TLB shootdown message. */
enum tlb_invalidate_type {
TLB_INVL_INVALID = 0, /**< Invalid type. */
TLB_INVL_ALL, /**< Invalidate all entries in TLB. */
TLB_INVL_ASID, /**< Invalidate all entries belonging to one address space. */
TLB_INVL_PAGE /**< Invalidate one entry for specified page. */
TLB_INVL_PAGES /**< Invalidate specified page range belonging to one address space. */
};
 
typedef enum tlb_invalidate_type tlb_invalidate_type_t;
63,14 → 52,25
 
typedef struct tlb_shootdown_msg tlb_shootdown_msg_t;
 
extern void tlb_init(void);
 
#ifdef CONFIG_SMP
extern void tlb_shootdown_start(tlb_invalidate_type_t type, asid_t asid, __address page, count_t cnt);
extern void tlb_shootdown_finalize(void);
extern void tlb_shootdown_ipi_recv(void);
#else
# define tlb_shootdown_start(w, x, y, z)
# define tlb_shootdown_finalize()
# define tlb_shootdown_ipi_recv()
#endif /* CONFIG_SMP */
 
 
/* Export TLB interface that each architecture must implement. */
extern void tlb_arch_init(void);
extern void tlb_print(void);
extern void tlb_invalidate(asid_t asid);
extern void tlb_shootdown_ipi_send(void);
 
extern void tlb_invalidate_all(void);
extern void tlb_invalidate_asid(asid_t asid);
extern void tlb_invalidate_page(asid_t asid, __address page);
 
extern void tlb_invalidate_pages(asid_t asid, __address page, count_t cnt);
#endif
/kernel/trunk/generic/include/mm/as.h
48,6 → 48,8
#define USTACK_ADDRESS USTACK_ADDRESS_ARCH
#define UDATA_ADDRESS UDATA_ADDRESS_ARCH
 
#define AS_KERNEL (1<<0) /**< Kernel address space. */
 
enum as_area_type {
AS_AREA_TEXT = 1, AS_AREA_DATA, AS_AREA_STACK
};
61,7 → 63,7
SPINLOCK_DECLARE(lock);
link_t link;
as_area_type_t type;
size_t size; /**< Size of this area. */
size_t size; /**< Size of this area in multiples of PAGE_SIZE. */
__address base; /**< Base address of this area. */
index_t *mapping; /**< Map of physical frame numbers mapped to virtual page numbers in this area. */
};
74,6 → 76,9
* set up during system initialization.
*/
struct as {
/** Protected by asidlock. Must be acquired before as-> lock. */
link_t as_with_asid_link;
 
SPINLOCK_DECLARE(lock);
link_t as_area_head;
pte_t *ptl0;
80,20 → 85,13
asid_t asid; /**< Address space identifier. */
};
 
extern as_t * as_create(pte_t *ptl0);
extern as_t * as_create(pte_t *ptl0, int flags);
extern as_area_t *as_area_create(as_t *as, as_area_type_t type, size_t size, __address base);
extern void as_area_set_mapping(as_area_t *a, index_t vpn, index_t pfn);
extern int as_page_fault(__address page);
extern void as_install(as_t *m);
 
/*
* Each architecture should implement this function.
* Its main purpose is to do TLB purges according
* to architecture's requirements. Note that
* some architectures invalidate their TLB automatically
* on hardware address space switch (e.g. ia32 and
* amd64).
*/
/* Interface to be implemented by architectures. */
#ifndef as_install_arch
extern void as_install_arch(as_t *as);
#endif /* !def as_install_arch */