Changeset 1084a784 in mainline for src/mm/page.c


Ignore:
Timestamp:
2005-10-04T22:09:41Z (20 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
342de62
Parents:
8e3f47b3
Message:

mips32 memory management work.
TLB Refill Exception implemented (passed basic testing).
Remove bit g from struct entry_hi.
Add generic find_mapping().
Add asid to vm_t type, define asid_t to hide architecture specific differences.
Implement ASID allocation for mips32, dummy for other architectures.
Add THE→vm (a.k.a. VM).
Add vm_install_arch().
Move pte_t definition to arch/types.h on each architecture.
Fix PTL manipulating functions on mips32 to shift pfn by 12 instead of by 14.
Fix tlb_init_arch() to initialize all entries.

Other.
Remove unnecessary header files from arch.h
Add missing headers here and there.
Remove two unnecessary ld flags from mips32 makefile.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mm/page.c

    r8e3f47b3 r1084a784  
    3434#include <arch/asm.h>
    3535#include <memstr.h>
    36 
    3736
    3837void page_init(void)
     
    110109        SET_FRAME_FLAGS(ptl3, PTL3_INDEX(page), flags);
    111110}
     111
     112/** Find mapping for virtual page
     113 *
     114 * Find mapping for virtual page.
     115 *
     116 * @param page Virtual page.
     117 * @param root PTL0 address if non-zero.
     118 *
     119 * @return NULL if there is no such mapping; entry from PTL3 describing the mapping otherwise.
     120 */
     121pte_t *find_mapping(__address page, __address root)
     122{
     123        pte_t *ptl0, *ptl1, *ptl2, *ptl3;
     124
     125        ptl0 = (pte_t *) PA2KA(root ? root : (__address) GET_PTL0_ADDRESS());
     126
     127        if (GET_PTL1_FLAGS(ptl0, PTL0_INDEX(page)) & PAGE_NOT_PRESENT)
     128                return NULL;
     129
     130        ptl1 = (pte_t *) PA2KA(GET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page)));
     131
     132        if (GET_PTL2_FLAGS(ptl1, PTL1_INDEX(page)) & PAGE_NOT_PRESENT)
     133                return NULL;
     134
     135        ptl2 = (pte_t *) PA2KA(GET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page)));
     136
     137        if (GET_PTL3_FLAGS(ptl2, PTL2_INDEX(page)) & PAGE_NOT_PRESENT)
     138                return NULL;
     139
     140        ptl3 = (pte_t *) PA2KA(GET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page)));
     141
     142        return &ptl3[PTL3_INDEX(page)];
     143}
Note: See TracChangeset for help on using the changeset viewer.