Changeset aa9f0a4 in mainline for kernel/generic/src/mm/page.c


Ignore:
Timestamp:
2011-01-21T13:58:26Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a088d15, c431a83
Parents:
5d00e40 (diff), b93d637 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merged vojtechhorky/ - page mapping retrieval

File:
1 edited

Legend:

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

    r5d00e40 raa9f0a4  
    6060
    6161#include <mm/page.h>
     62#include <genarch/mm/page_ht.h>
     63#include <genarch/mm/page_pt.h>
    6264#include <arch/mm/page.h>
    6365#include <arch/mm/asid.h>
     
    7072#include <debug.h>
    7173#include <arch.h>
     74#include <syscall/copy.h>
     75#include <errno.h>
    7276
    7377/** Virtual operations for page subsystem. */
     
    173177}
    174178
     179/** Syscall wrapper for getting mapping of a virtual page.
     180 *
     181 * @retval EOK Everything went find, @p uspace_frame and @p uspace_node
     182 *             contains correct values.
     183 * @retval ENOENT Virtual address has no mapping.
     184 */
     185sysarg_t sys_page_find_mapping(uintptr_t virt_address,
     186    uintptr_t *uspace_frame)
     187{
     188        mutex_lock(&AS->lock);
     189       
     190        pte_t *pte = page_mapping_find(AS, virt_address);
     191        if (!PTE_VALID(pte) || !PTE_PRESENT(pte)) {
     192                mutex_unlock(&AS->lock);
     193               
     194                return (sysarg_t) ENOENT;
     195        }
     196       
     197        uintptr_t phys_address = PTE_GET_FRAME(pte);
     198       
     199        mutex_unlock(&AS->lock);
     200       
     201        int rc = copy_to_uspace(uspace_frame,
     202            &phys_address, sizeof(phys_address));
     203        if (rc != EOK) {
     204                return (sysarg_t) rc;
     205        }
     206       
     207        return EOK;
     208}
     209
    175210/** @}
    176211 */
Note: See TracChangeset for help on using the changeset viewer.