Changeset ae6021d in mainline


Ignore:
Timestamp:
2016-09-02T15:44:09Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e755b3f
Parents:
c1f7a315
Message:

Associate each paged as_area with its memory object upon creation

This will allow us to have one pager fibril per task rather than one
per paged area.

Files:
10 edited

Legend:

Unmodified
Added
Removed
  • abi/include/abi/ipc/methods.h

    rc1f7a315 rae6021d  
    121121         * - ARG1 - page-aligned offset from the beginning of the memory object
    122122         * - ARG2 - page size
     123         * - ARG3 - user defined memory object ID
     124         * - ARG4 - user defined memory object ID
     125         * - ARG5 - user defined memory object ID
    123126         *
    124127         * on answer, the recipient must set:
  • abi/include/abi/mm/as.h

    rc1f7a315 rae6021d  
    4747#define AS_MAP_FAILED  ((void *) -1)
    4848
    49 #define AS_AREA_UNPAGED -1
     49#define AS_AREA_UNPAGED NULL
    5050
    5151/** Address space area info exported to uspace. */
     
    6161} as_area_info_t;
    6262
     63typedef struct {
     64        int pager;
     65        sysarg_t id1;
     66        sysarg_t id2;
     67        sysarg_t id3;
     68} as_area_pager_info_t;
     69
    6370#endif
    6471
  • kernel/generic/include/mm/as.h

    rc1f7a315 rae6021d  
    188188        /** user_backend members */
    189189        struct {
    190                 int pager;      /**< Phone to the pager. */
     190                as_area_pager_info_t pager_info;
    191191        };
    192192
     
    310310/* Address space area related syscalls. */
    311311extern sysarg_t sys_as_area_create(uintptr_t, size_t, unsigned int, uintptr_t,
    312     int);
     312    as_area_pager_info_t *);
    313313extern sysarg_t sys_as_area_resize(uintptr_t, size_t, unsigned int);
    314314extern sysarg_t sys_as_area_change_flags(uintptr_t, unsigned int);
  • kernel/generic/src/mm/as.c

    rc1f7a315 rae6021d  
    21872187
    21882188sysarg_t sys_as_area_create(uintptr_t base, size_t size, unsigned int flags,
    2189     uintptr_t bound, int pager)
     2189    uintptr_t bound, as_area_pager_info_t *pager_info)
    21902190{
    21912191        uintptr_t virt = base;
     
    21932193        mem_backend_data_t backend_data;
    21942194
    2195         if (pager == AS_AREA_UNPAGED)
     2195        if (pager_info == AS_AREA_UNPAGED)
    21962196                backend = &anon_backend;
    21972197        else {
    21982198                backend = &user_backend;
    2199                 backend_data.pager = pager;
     2199                if (copy_from_uspace(&backend_data.pager_info, pager_info,
     2200                        sizeof(as_area_pager_info_t)) != EOK) {
     2201                        return (sysarg_t) AS_MAP_FAILED;
     2202                }
    22002203        }
    22012204        as_area_t *area = as_area_create(AS, flags, size,
  • kernel/generic/src/mm/backend_user.c

    rc1f7a315 rae6021d  
    3939#include <mm/as.h>
    4040#include <mm/page.h>
     41#include <abi/mm/as.h>
    4142#include <abi/ipc/methods.h>
    4243#include <ipc/sysipc.h>
     
    132133                return AS_PF_FAULT;
    133134
     135        as_area_pager_info_t *pager_info = &area->backend_data.pager_info;
     136
    134137        ipc_data_t data = {};
    135138        IPC_SET_IMETHOD(data, IPC_M_PAGE_IN);
    136139        IPC_SET_ARG1(data, upage - area->base);
    137140        IPC_SET_ARG2(data, PAGE_SIZE);
     141        IPC_SET_ARG3(data, pager_info->id1);
     142        IPC_SET_ARG4(data, pager_info->id2);
     143        IPC_SET_ARG5(data, pager_info->id3);
    138144
    139         int rc = ipc_req_internal(area->backend_data.pager, &data);
     145        int rc = ipc_req_internal(pager_info->pager, &data);
    140146
    141147        if (rc != EOK) {
     
    143149                    "Page-in request for page %#" PRIxn
    144150                    " at pager %d failed with error %d.",
    145                     upage, area->backend_data.pager, rc);
     151                    upage, pager_info->pager, rc);
    146152                return AS_PF_FAULT;
    147153        }
  • uspace/app/tester/mm/pager1.c

    rc1f7a315 rae6021d  
    5151       
    5252        void *result = async_as_area_create(AS_AREA_ANY, size,
    53             AS_AREA_READ | AS_AREA_CACHEABLE, vfs_pager_sess);
     53            AS_AREA_READ | AS_AREA_CACHEABLE, vfs_pager_sess, 0, 0, 0);
    5454        if (result == AS_MAP_FAILED)
    5555                return NULL;
  • uspace/lib/c/generic/as.c

    rc1f7a315 rae6021d  
    4545/** Create address space area.
    4646 *
    47  * @param base  Starting virtual address of the area.
    48  *              If set to AS_AREA_ANY ((void *) -1),
    49  *              the kernel finds a mappable area.
    50  * @param size  Size of the area.
    51  * @param flags Flags describing type of the area.
    52  * @param pager If non-negative, phone to the external pager backing the area.
    53  *              If AS_AREA_UNPAGED (-1), the area is anonymous.
     47 * @param base       Starting virtual address of the area.
     48 *                   If set to AS_AREA_ANY ((void *) -1), the kernel finds a
     49 *                  mappable area.
     50 * @param size       Size of the area.
     51 * @param flags      Flags describing type of the area.
     52 * @param pager_info Pager info structure or AS_AREA_UNPAGED (NULL) if the area
     53 *                   is not paged (i.e. anonymous).
    5454 *
    5555 * @return Starting virtual address of the created area on success.
     
    5757 *
    5858 */
    59 void *as_area_create(void *base, size_t size, unsigned int flags, int pager)
     59void *as_area_create(void *base, size_t size, unsigned int flags,
     60    as_area_pager_info_t *pager_info)
    6061{
    6162        return (void *) __SYSCALL5(SYS_AS_AREA_CREATE, (sysarg_t) base,
    6263            (sysarg_t) size, (sysarg_t) flags, (sysarg_t) __entry,
    63             (sysarg_t) pager);
     64            (sysarg_t) pager_info);
    6465}
    6566
  • uspace/lib/c/generic/async.c

    rc1f7a315 rae6021d  
    117117#include <macros.h>
    118118#include <as.h>
     119#include <abi/mm/as.h>
    119120#include "private/libc.h"
    120121
     
    33833384
    33843385void *async_as_area_create(void *base, size_t size, unsigned int flags,
    3385     async_sess_t *pager)
    3386 {
    3387         return as_area_create(base, size, flags, pager->phone);
     3386    async_sess_t *pager, sysarg_t id1, sysarg_t id2, sysarg_t id3)
     3387{
     3388        as_area_pager_info_t pager_info = {
     3389                .pager = pager->phone,
     3390                .id1 = id1,
     3391                .id2 = id2,
     3392                .id3 = id3
     3393        };
     3394        return as_area_create(base, size, flags, &pager_info);
    33883395}
    33893396
  • uspace/lib/c/include/as.h

    rc1f7a315 rae6021d  
    5353}
    5454
    55 extern void *as_area_create(void *, size_t, unsigned int, int);
     55extern void *as_area_create(void *, size_t, unsigned int,
     56    as_area_pager_info_t *);
    5657extern int as_area_resize(void *, size_t, unsigned int);
    5758extern int as_area_change_flags(void *, unsigned int);
  • uspace/lib/c/include/async.h

    rc1f7a315 rae6021d  
    488488extern void async_remote_state_release_exchange(async_exch_t *);
    489489
    490 extern void *async_as_area_create(void *, size_t, unsigned int, async_sess_t *);
     490extern void *async_as_area_create(void *, size_t, unsigned int, async_sess_t *,
     491    sysarg_t, sysarg_t, sysarg_t);
    491492
    492493#endif
Note: See TracChangeset for help on using the changeset viewer.