Changeset b93d637 in mainline for uspace


Ignore:
Timestamp:
2011-01-21T13:54:04Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
aa9f0a4, c979591b
Parents:
85d0cf8
Message:

Add syscall for getting physical address

Location:
uspace
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/tester/Makefile

    r85d0cf8 rb93d637  
    5353        loop/loop1.c \
    5454        mm/malloc1.c \
     55        mm/mapping1.c \
    5556        hw/misc/virtchar1.c \
    5657        hw/serial/serial1.c
  • uspace/app/tester/tester.c

    r85d0cf8 rb93d637  
    6262#include "loop/loop1.def"
    6363#include "mm/malloc1.def"
     64#include "mm/mapping1.def"
    6465#include "hw/serial/serial1.def"
    6566#include "adt/usbaddrkeep.def"
  • uspace/app/tester/tester.h

    r85d0cf8 rb93d637  
    7979extern const char *test_loop1(void);
    8080extern const char *test_malloc1(void);
     81extern const char *test_mapping1(void);
    8182extern const char *test_serial1(void);
    8283extern const char *test_usbaddrkeep(void);
  • uspace/lib/c/generic/as.c

    r85d0cf8 rb93d637  
    3535#include <as.h>
    3636#include <libc.h>
     37#include <errno.h>
    3738#include <unistd.h>
    3839#include <align.h>
     
    128129}
    129130
     131/** Find mapping to physical address.
     132 *
     133 * @param address Virtual address in question (virtual).
     134 * @param[out] frame Frame address (physical).
     135 * @return Error code.
     136 * @retval EOK No error, @p frame holds the translation.
     137 * @retval ENOENT Mapping not found.
     138 */
     139int as_get_physical_mapping(void *address, uintptr_t *frame)
     140{
     141        uintptr_t tmp_frame;
     142        uintptr_t virt = (uintptr_t) address;
     143       
     144        int rc = (int) __SYSCALL2(SYS_PAGE_FIND_MAPPING,
     145            (sysarg_t) virt, (sysarg_t) &tmp_frame);
     146        if (rc != EOK) {
     147                return rc;
     148        }
     149       
     150        if (frame != NULL) {
     151                *frame = tmp_frame;
     152        }
     153       
     154        return EOK;
     155}
     156
    130157/** @}
    131158 */
  • uspace/lib/c/include/as.h

    r85d0cf8 rb93d637  
    4747extern void *set_maxheapsize(size_t mhs);
    4848extern void * as_get_mappable_page(size_t sz);
     49extern int as_get_physical_mapping(void *address, uintptr_t *frame);
    4950
    5051#endif
Note: See TracChangeset for help on using the changeset viewer.