mips32
[Memory management]


Files

file  as.h
file  asid.h
file  frame.h
file  memory_init.h
file  page.h
file  tlb.h
file  as.c
file  frame.c
file  page.c
file  tlb.c

Data Structures

union  entry_lo
struct  pte
union  entry_hi
union  page_mask
union  index

Defines

#define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH   0
#define KERNEL_ADDRESS_SPACE_START_ARCH   (unsigned long) 0x80000000
#define KERNEL_ADDRESS_SPACE_END_ARCH   (unsigned long) 0xffffffff
#define USER_ADDRESS_SPACE_START_ARCH   (unsigned long) 0x00000000
#define USER_ADDRESS_SPACE_END_ARCH   (unsigned long) 0x7fffffff
#define USTACK_ADDRESS_ARCH   (0x80000000-PAGE_SIZE)
#define ASID_MAX_ARCH   255
#define FRAME_WIDTH   14
#define FRAME_SIZE   (1<<FRAME_WIDTH)
#define get_memory_size()   CONFIG_MEMORY_SIZE
#define PAGE_WIDTH   FRAME_WIDTH
#define PAGE_SIZE   FRAME_SIZE
#define KA2PA(x)   (((__address) (x)) - 0x80000000)
#define PA2KA(x)   (((__address) (x)) + 0x80000000)
#define TLB_ENTRY_COUNT   48
#define TLB_WIRED   1
#define TLB_KSTACK_WIRED_INDEX   0
#define TLB_PAGE_MASK_16K   (0x3<<13)
#define PAGE_UNCACHED   2
#define PAGE_CACHEABLE_EXC_WRITE   5
#define tlb_invalidate(asid)   tlb_invalidate_asid(asid)

Typedefs

typedef __u8 asid_t
typedef entry_lo entry_lo_t
typedef entry_hi entry_hi_t
typedef page_mask page_mask_t
typedef index tlb_index_t

Functions

void as_arch_init (void)
static void tlbp (void)
static void tlbr (void)
static void tlbwi (void)
static void tlbwr (void)
void tlb_invalid (istate_t *istate)
void tlb_refill (istate_t *istate)
void tlb_modified (istate_t *istate)
void as_install_arch (as_t *as)
void frame_arch_init (void)
void page_arch_init (void)
__address hw_map (__address physaddr, size_t size)
static void tlb_refill_fail (istate_t *istate)
static void tlb_invalid_fail (istate_t *istate)
static void tlb_modified_fail (istate_t *istate)
static pte_tfind_mapping_and_check (__address badvaddr, int access, istate_t *istate, int *pfrc)
static void prepare_entry_lo (entry_lo_t *lo, bool g, bool v, bool d, bool cacheable, __address pfn)
static void prepare_entry_hi (entry_hi_t *hi, asid_t asid, __address addr)
void tlb_arch_init (void)
void tlb_print (void)
void tlb_invalidate_all (void)
void tlb_invalidate_asid (asid_t asid)
void tlb_invalidate_pages (asid_t asid, __address page, count_t cnt)

Define Documentation

#define ASID_MAX_ARCH   255
 

Definition at line 40 of file asid.h.

#define FRAME_SIZE   (1<<FRAME_WIDTH)
 

Definition at line 39 of file frame.h.

Referenced by anon_page_fault(), arc_frame_init(), elf_frame_free(), elf_page_fault(), phys_page_fault(), and sys_physmem_map().

#define FRAME_WIDTH   14
 

Definition at line 38 of file frame.h.

Referenced by ADDR2PFN(), PFN2ADDR(), and SIZE2FRAMES().

 
#define get_memory_size  )     CONFIG_MEMORY_SIZE
 

Definition at line 43 of file memory_init.h.

Referenced by main_bsp().

#define KA2PA  )     (((__address) (x)) - 0x80000000)
 

Definition at line 44 of file page.h.

Referenced by frame_init(), obj2slab(), pt_mapping_insert(), ptl0_create(), return_config_frames(), slab_space_alloc(), slab_space_free(), thr_destructor(), and zone_create().

#define KERNEL_ADDRESS_SPACE_END_ARCH   (unsigned long) 0xffffffff
 

Definition at line 41 of file as.h.

#define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH   0
 

Definition at line 38 of file as.h.

#define KERNEL_ADDRESS_SPACE_START_ARCH   (unsigned long) 0x80000000
 

Definition at line 40 of file as.h.

#define PA2KA  )     (((__address) (x)) + 0x80000000)
 

Definition at line 45 of file page.h.

Referenced by anon_page_fault(), clock_counter_init(), cpu_init(), fb_init(), klog_init(), pt_mapping_find(), pt_mapping_insert(), pt_mapping_remove(), ptl0_create(), slab_space_alloc(), thr_constructor(), and zone_merge().

#define PAGE_CACHEABLE_EXC_WRITE   5
 

Definition at line 53 of file tlb.h.

Referenced by prepare_entry_lo().

#define PAGE_SIZE   FRAME_SIZE
 

Definition at line 41 of file page.h.

Referenced by anon_page_fault(), anon_share(), as_area_create(), as_area_destroy(), as_area_resize(), as_area_share(), as_get_size(), badness(), check_area_conflicts(), comp_objects(), ddi_physmem_map(), elf_frame_free(), elf_page_fault(), elf_share(), find_area_and_lock(), klog_init(), load_segment(), main_bsp(), map_structure(), phys_page_fault(), prepare_entry_hi(), pt_mapping_insert(), ptl0_create(), slab_space_alloc(), sys_futex_sleep_timeout(), sys_futex_wakeup(), sys_io(), sys_physmem_map(), task_run_program(), tlb_invalid(), tlb_invalidate_pages(), tlb_modified(), tlb_refill(), used_space_insert(), used_space_remove(), and userspace().

#define PAGE_UNCACHED   2
 

Definition at line 52 of file tlb.h.

Referenced by prepare_entry_lo().

#define PAGE_WIDTH   FRAME_WIDTH
 

Definition at line 40 of file page.h.

Referenced by as_area_resize(), elf_frame_free(), and elf_page_fault().

#define TLB_ENTRY_COUNT   48
 

Definition at line 44 of file tlb.h.

Referenced by tlb_arch_init(), tlb_invalidate_all(), tlb_invalidate_asid(), and tlb_print().

#define tlb_invalidate asid   )     tlb_invalidate_asid(asid)
 

Definition at line 176 of file tlb.h.

#define TLB_KSTACK_WIRED_INDEX   0
 

Definition at line 48 of file tlb.h.

#define TLB_PAGE_MASK_16K   (0x3<<13)
 

Definition at line 50 of file tlb.h.

Referenced by tlb_arch_init(), tlb_invalid(), tlb_modified(), and tlb_refill().

#define TLB_WIRED   1
 

Definition at line 47 of file tlb.h.

Referenced by tlb_invalidate_all().

#define USER_ADDRESS_SPACE_END_ARCH   (unsigned long) 0x7fffffff
 

Definition at line 43 of file as.h.

#define USER_ADDRESS_SPACE_START_ARCH   (unsigned long) 0x00000000
 

Definition at line 42 of file as.h.

#define USTACK_ADDRESS_ARCH   (0x80000000-PAGE_SIZE)
 

Definition at line 45 of file as.h.


Typedef Documentation

typedef __u8 asid_t
 

Definition at line 42 of file asid.h.

typedef union entry_hi entry_hi_t
 

Definition at line 56 of file tlb.h.

typedef union entry_lo entry_lo_t
 

Definition at line 55 of file tlb.h.

typedef union page_mask page_mask_t
 

Definition at line 57 of file tlb.h.

typedef union index tlb_index_t
 

Definition at line 58 of file tlb.h.


Function Documentation

void as_arch_init void   ) 
 

Architecture dependent address space init.

Definition at line 45 of file as.c.

References as_operations, as_pt_operations, and asid_fifo_init().

Referenced by as_init().

Here is the call graph for this function:

void as_install_arch as_t as  ) 
 

Install address space.

Install ASID.

Parameters:
as Address space structure.

Definition at line 57 of file as.c.

References entry_hi::asid, interrupts_disable(), interrupts_restore(), spinlock_lock, spinlock_unlock(), and entry_hi::value.

Referenced by as_switch().

Here is the call graph for this function:

pte_t * find_mapping_and_check __address  badvaddr,
int  access,
istate_t istate,
int *  pfrc
[static]
 

Try to find PTE for faulting address

Try to find PTE for faulting address. The AS->lock must be held on entry to this function.

Parameters:
badvaddr Faulting virtual address.
access Access mode that caused the fault.
istate Pointer to interrupted state.
pfrc Pointer to variable where as_page_fault() return code will be stored.
Returns:
PTE on success, NULL otherwise.

Definition at line 386 of file tlb.c.

References AS, as_page_fault(), entry_hi::asid, ASSERT, NULL, pte::p, page_mapping_find(), page_table_lock(), page_table_unlock(), panic, printf(), and entry_hi::value.

Referenced by tlb_invalid(), tlb_modified(), and tlb_refill().

Here is the call graph for this function:

void frame_arch_init void   ) 
 

Create memory zones

If ARC is known, read information from ARC, otherwise assume some defaults.

  • blacklist first FRAME because there is an exception vector

Definition at line 46 of file frame.c.

References ADDR2PFN(), arc_enabled(), arc_frame_init(), config, frame_mark_unavailable(), config_t::memory_size, and zone_create().

Referenced by frame_init().

Here is the call graph for this function:

__address hw_map __address  physaddr,
size_t  size
 

Map device into kernel space

  • on mips, all devices are already mapped into kernel space, translate the physical address to uncached area

Definition at line 48 of file page.c.

Referenced by fb_init().

void page_arch_init void   ) 
 

Definition at line 39 of file page.c.

References pt_mapping_operations.

Referenced by page_init().

void prepare_entry_hi entry_hi_t hi,
asid_t  asid,
__address  addr
[static]
 

Definition at line 458 of file tlb.c.

References ALIGN_DOWN, entry_hi::asid, PAGE_SIZE, and entry_hi::value.

Referenced by tlb_invalid(), tlb_invalidate_pages(), tlb_modified(), and tlb_refill().

void prepare_entry_lo entry_lo_t lo,
bool  g,
bool  v,
bool  d,
bool  cacheable,
__address  pfn
[static]
 

Definition at line 448 of file tlb.c.

References entry_lo::c, entry_lo::d, entry_lo::g, PAGE_CACHEABLE_EXC_WRITE, PAGE_UNCACHED, entry_lo::pfn, entry_lo::v, and entry_lo::value.

Referenced by tlb_invalid(), tlb_modified(), and tlb_refill().

void tlb_arch_init void   ) 
 

Initialize TLB

Initialize TLB. Invalidate all entries and mark wired entries.

Definition at line 64 of file tlb.c.

References TLB_ENTRY_COUNT, TLB_PAGE_MASK_16K, and tlbwi().

Referenced by tlb_init().

Here is the call graph for this function:

void tlb_invalid istate_t istate  ) 
 

Process TLB Invalid Exception

Process TLB Invalid Exception.

Parameters:
istate Interrupted register context.

Definition at line 166 of file tlb.c.

References pte::a, AS, entry_hi::asid, badvaddr, pte::cacheable, pte::d, find_mapping_and_check(), pte::g, pte::p, index::p, PAGE_SIZE, page_table_lock(), page_table_unlock(), panic, PF_ACCESS_READ, pte::pfn, prepare_entry_hi(), prepare_entry_lo(), printf(), tlb_invalid_fail(), TLB_PAGE_MASK_16K, tlbp(), tlbr(), tlbwi(), entry_lo::value, index::value, and entry_hi::value.

Referenced by tlbinv_exception().

Here is the call graph for this function:

void tlb_invalid_fail istate_t istate  )  [static]
 

Definition at line 352 of file tlb.c.

References istate::epc, fault_if_from_uspace, get_symtab_entry(), and panic.

Referenced by tlb_invalid().

Here is the call graph for this function:

void tlb_invalidate_all void   ) 
 

Invalidate all not wired TLB entries.

Definition at line 494 of file tlb.c.

References interrupts_disable(), TLB_ENTRY_COUNT, TLB_WIRED, tlbr(), tlbwi(), entry_lo::v, entry_lo::value, and entry_hi::value.

Referenced by tlb_shootdown_ipi_recv().

Here is the call graph for this function:

void tlb_invalidate_asid asid_t  asid  ) 
 

Invalidate all TLB entries belonging to specified address space.

Parameters:
asid Address space identifier.

Definition at line 528 of file tlb.c.

References entry_hi::asid, ASID_INVALID, ASSERT, interrupts_disable(), TLB_ENTRY_COUNT, tlbr(), tlbwi(), entry_lo::v, entry_lo::value, and entry_hi::value.

Referenced by asid_get(), and tlb_shootdown_ipi_recv().

Here is the call graph for this function:

void tlb_invalidate_pages asid_t  asid,
__address  page,
count_t  cnt
 

Invalidate TLB entries for specified page range belonging to specified address space.

Parameters:
asid Address space identifier.
page First page whose TLB entry is to be invalidated.
cnt Number of entries to invalidate.

Definition at line 570 of file tlb.c.

References ASID_INVALID, ASSERT, interrupts_disable(), index::p, PAGE_SIZE, prepare_entry_hi(), tlbp(), tlbr(), tlbwi(), entry_lo::v, entry_lo::value, index::value, and entry_hi::value.

Referenced by tlb_shootdown_ipi_recv().

Here is the call graph for this function:

void tlb_modified istate_t istate  ) 
 

Process TLB Modified Exception

Process TLB Modified Exception.

Parameters:
istate Interrupted register context.

Definition at line 250 of file tlb.c.

References pte::a, AS, entry_hi::asid, badvaddr, pte::cacheable, pte::d, find_mapping_and_check(), pte::g, pte::p, index::p, PAGE_SIZE, page_table_lock(), page_table_unlock(), panic, PF_ACCESS_WRITE, pte::pfn, prepare_entry_hi(), prepare_entry_lo(), printf(), tlb_modified_fail(), TLB_PAGE_MASK_16K, tlbp(), tlbr(), tlbwi(), entry_lo::value, index::value, entry_hi::value, and pte::w.

Referenced by tlbmod_exception().

Here is the call graph for this function:

void tlb_modified_fail istate_t istate  )  [static]
 

Definition at line 363 of file tlb.c.

References istate::epc, fault_if_from_uspace, get_symtab_entry(), and panic.

Referenced by tlb_modified().

Here is the call graph for this function:

void tlb_print void   ) 
 

Print contents of TLB.

Definition at line 465 of file tlb.c.

References entry_hi::asid, entry_lo::c, entry_lo::d, entry_lo::g, page_mask::mask, entry_lo::pfn, printf(), TLB_ENTRY_COUNT, tlbr(), entry_lo::v, entry_lo::value, page_mask::value, entry_hi::value, and entry_hi::vpn2.

Referenced by cmd_tlb().

Here is the call graph for this function:

void tlb_refill istate_t istate  ) 
 

Process TLB Refill Exception

Process TLB Refill Exception.

Parameters:
istate Interrupted register context.

Definition at line 94 of file tlb.c.

References pte::a, AS, badvaddr, pte::cacheable, pte::d, find_mapping_and_check(), pte::g, pte::p, PAGE_SIZE, page_table_lock(), page_table_unlock(), panic, PF_ACCESS_READ, pte::pfn, prepare_entry_hi(), prepare_entry_lo(), spinlock_lock, spinlock_unlock(), TLB_PAGE_MASK_16K, tlb_refill_fail(), tlbwr(), entry_lo::value, and entry_hi::value.

Here is the call graph for this function:

void tlb_refill_fail istate_t istate  )  [static]
 

Definition at line 335 of file tlb.c.

References istate::epc, fault_if_from_uspace, get_symtab_entry(), panic, and istate::ra.

Referenced by tlb_refill().

Here is the call graph for this function:

static void tlbp void   )  [static]
 

Probe TLB for Matching Entry

Probe TLB for Matching Entry.

Definition at line 143 of file tlb.h.

Referenced by tlb_invalid(), tlb_invalidate_pages(), and tlb_modified().

static void tlbr void   )  [static]
 

Read Indexed TLB Entry

Read Indexed TLB Entry.

Definition at line 153 of file tlb.h.

Referenced by tlb_invalid(), tlb_invalidate_all(), tlb_invalidate_asid(), tlb_invalidate_pages(), tlb_modified(), and tlb_print().

static void tlbwi void   )  [static]
 

Write Indexed TLB Entry

Write Indexed TLB Entry.

Definition at line 162 of file tlb.h.

Referenced by tlb_arch_init(), tlb_invalid(), tlb_invalidate_all(), tlb_invalidate_asid(), tlb_invalidate_pages(), and tlb_modified().

static void tlbwr void   )  [static]
 

Write Random TLB Entry

Write Random TLB Entry.

Definition at line 171 of file tlb.h.

Referenced by tlb_refill().


Generated on Sun Jun 18 17:12:30 2006 for HelenOS Kernel (mips32) by  doxygen 1.4.6