Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/mm/page.c

    r6645a14 r235e6c7  
    5353 * We assume that the other processors are either not using the mapping yet
    5454 * (i.e. during the bootstrap) or are executing the TLB shootdown code.  While
    55  * we don't care much about the former case, the processors in the latter case
     55 * we don't care much about the former case, the processors in the latter case 
    5656 * will do an implicit serialization by virtue of running the TLB shootdown
    5757 * interrupt handler.
     
    6060
    6161#include <mm/page.h>
    62 #include <genarch/mm/page_ht.h>
    63 #include <genarch/mm/page_pt.h>
    6462#include <arch/mm/page.h>
    6563#include <arch/mm/asid.h>
     
    7270#include <debug.h>
    7371#include <arch.h>
    74 #include <syscall/copy.h>
    75 #include <errno.h>
    76 #include <align.h>
    7772
    7873/** Virtual operations for page subsystem. */
     
    177172}
    178173
    179 int page_find_mapping(uintptr_t virt, void **phys)
    180 {
    181         mutex_lock(&AS->lock);
    182        
    183         pte_t *pte = page_mapping_find(AS, virt, false);
    184         if ((!PTE_VALID(pte)) || (!PTE_PRESENT(pte))) {
    185                 mutex_unlock(&AS->lock);
    186                 return ENOENT;
    187         }
    188        
    189         *phys = (void *) PTE_GET_FRAME(pte) +
    190             (virt - ALIGN_DOWN(virt, PAGE_SIZE));
    191        
    192         mutex_unlock(&AS->lock);
    193        
    194         return EOK;
    195 }
    196 
    197 /** Syscall wrapper for getting mapping of a virtual page.
    198  *
    199  * @return EOK on success.
    200  * @return ENOENT if no virtual address mapping found.
    201  *
    202  */
    203 sysarg_t sys_page_find_mapping(uintptr_t virt, void *phys_ptr)
    204 {
    205         void *phys;
    206         int rc = page_find_mapping(virt, &phys);
    207         if (rc != EOK)
    208                 return rc;
    209        
    210         rc = copy_to_uspace(phys_ptr, &phys, sizeof(phys));
    211         return (sysarg_t) rc;
    212 }
    213 
    214174/** @}
    215175 */
Note: See TracChangeset for help on using the changeset viewer.