Changes in / [bdfdc51c:f126c87] in mainline


Ignore:
Files:
4 added
32 edited

Legend:

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

    rbdfdc51c rf126c87  
    8181        INTERFACE_LOADER =
    8282            FOURCC_COMPACT('l', 'o', 'a', 'd') | IFACE_EXCHANGE_SERIALIZE,
     83        INTERFACE_PAGER =
     84            FOURCC_COMPACT('p', 'a', 'g', 'e') | IFACE_EXCHANGE_ATOMIC,
    8385        INTERFACE_LOGGER_WRITER =
    8486            FOURCC_COMPACT('l', 'o', 'g', 'w') | IFACE_EXCHANGE_SERIALIZE,
  • abi/include/abi/ipc/methods.h

    rbdfdc51c rf126c87  
    5151 */
    5252
    53 /** This message is sent to answerbox when the phone is hung up
    54  *
    55  * The numerical value zero (0) of this method is important,
    56  * so as the value can be easily tested in conditions.
    57  *
    58  */
    59 #define IPC_M_PHONE_HUNGUP  0
    60 
    61 /** Clone connection.
    62  *
    63  * The calling task clones one of its phones for the callee.
    64  *
    65  * - ARG1 - The caller sets ARG1 to the phone of the cloned connection.
    66  *        - The callee gets the new phone from ARG1.
    67  *
    68  * - on answer, the callee acknowledges the new connection by sending EOK back
    69  *   or the kernel closes it
    70  *
    71  */
    72 #define IPC_M_CONNECTION_CLONE  1
    73 
    74 /** Protocol for establishing a cloned connection.
    75  *
    76  * Through this call, the recipient learns about the new cloned connection.
    77  *
    78  * - ARG5 - the kernel sets ARG5 to contain the hash of the used phone
    79  * - on answer, the callee acknowledges the new connection by sending EOK back
    80  *   or the kernel closes it
    81  *
    82  */
    83 #define IPC_M_CLONE_ESTABLISH  2
    84 
    85 /** Protocol for initializing callback connections.
    86  *
    87  * Calling process asks the callee to create a callback connection,
    88  * so that it can start initiating new messages.
    89  *
    90  * The protocol for negotiating is:
    91  * - sys_connect_to_me - sends a message IPC_M_CONNECT_TO_ME
    92  * - recipient         - upon receipt tries to allocate new phone
    93  *                       - if it fails, responds with ELIMIT
    94  *                     - passes call to userspace. If userspace
    95  *                       responds with error, phone is deallocated and
    96  *                       error is sent back to caller. Otherwise
    97  *                       the call is accepted and the response is sent back.
    98  *                     - the hash of the allocated phone is passed to userspace
    99  *                       (on the receiving side) as ARG5 of the call.
    100  *
    101  */
    102 #define IPC_M_CONNECT_TO_ME  3
    103 
    104 /** Protocol for initializing new foward connections.
    105  *
    106  * Calling process asks the callee to create for him a new connection.
    107  * E.g. the caller wants a name server to connect him to print server.
    108  *
    109  * The protocol for negotiating is:
    110  * - sys_connect_me_to - send a synchronous message to name server
    111  *                       indicating that it wants to be connected to some
    112  *                       service
    113  *                     - arg1/2/3 are user specified, arg5 contains
    114  *                       address of the phone that should be connected
    115  *                       (TODO: it leaks to userspace)
    116  *  - recipient        -  if ipc_answer == 0, then accept connection
    117  *                     -  otherwise connection refused
    118  *                     -  recepient may forward message.
    119  *
    120  */
    121 #define IPC_M_CONNECT_ME_TO  4
    122 
    123 /** Send as_area over IPC.
    124  * - ARG1 - source as_area base address
    125  * - ARG2 - size of source as_area (filled automatically by kernel)
    126  * - ARG3 - flags of the as_area being sent
    127  *
    128  * on answer, the recipient must set:
    129  *
    130  * - ARG1 - dst as_area lower bound
    131  * - ARG2 - dst as_area base adress pointer
    132  *          (filled automatically by the kernel)
    133  *
    134  */
    135 #define IPC_M_SHARE_OUT  5
    136 
    137 /** Receive as_area over IPC.
    138  * - ARG1 - destination as_area size
    139  * - ARG2 - user defined argument
    140  *
    141  * on answer, the recipient must set:
    142  *
    143  * - ARG1 - source as_area base address
    144  * - ARG2 - flags that will be used for sharing
    145  * - ARG3 - dst as_area lower bound
    146  * - ARG4 - dst as_area base address (filled automatically by kernel)
    147  *
    148  */
    149 #define IPC_M_SHARE_IN  6
    150 
    151 /** Send data to another address space over IPC.
    152  * - ARG1 - source address space virtual address
    153  * - ARG2 - size of data to be copied, may be overriden by the recipient
    154  *
    155  * on answer, the recipient must set:
    156  *
    157  * - ARG1 - final destination address space virtual address
    158  * - ARG2 - final size of data to be copied
    159  *
    160  */
    161 #define IPC_M_DATA_WRITE  7
    162 
    163 /** Receive data from another address space over IPC.
    164  * - ARG1 - destination virtual address in the source address space
    165  * - ARG2 - size of data to be received, may be cropped by the recipient
    166  *
    167  * on answer, the recipient must set:
    168  *
    169  * - ARG1 - source virtual address in the destination address space
    170  * - ARG2 - final size of data to be copied
    171  *
    172  */
    173 #define IPC_M_DATA_READ  8
    174 
    175 /** Authorize change of recipient's state in a third party task.
    176  * - ARG1 - user protocol defined data
    177  * - ARG2 - user protocol defined data
    178  * - ARG3 - user protocol defined data
    179  * - ARG5 - sender's phone to the third party task
    180  *
    181  * on EOK answer, the recipient must set:
    182  *
    183  * - ARG1 - recipient's phone to the third party task
    184  */
    185 #define IPC_M_STATE_CHANGE_AUTHORIZE  9
    186 
    187 /** Debug the recipient.
    188  * - ARG1 - specifies the debug method (from udebug_method_t)
    189  * - other arguments are specific to the debug method
    190  *
    191  */
    192 #define IPC_M_DEBUG  10
     53enum {
     54        /** This message is sent to answerbox when the phone is hung up
     55         *
     56         * The numerical value zero (0) of this method is important,
     57         * so as the value can be easily tested in conditions.
     58         */
     59        IPC_M_PHONE_HUNGUP = 0,
     60
     61        /** Clone connection.
     62         *
     63         * The calling task clones one of its phones for the callee.
     64         *
     65         * - ARG1 - The caller sets ARG1 to the phone of the cloned connection.
     66         *        - The callee gets the new phone from ARG1.
     67         *
     68         * - on answer, the callee acknowledges the new connection by sending EOK back
     69         *   or the kernel closes it
     70         */
     71        IPC_M_CONNECTION_CLONE,
     72
     73        /** Protocol for establishing a cloned connection.
     74         *
     75         * Through this call, the recipient learns about the new cloned connection.
     76         *
     77         * - ARG5 - the kernel sets ARG5 to contain the hash of the used phone
     78         * - on answer, the callee acknowledges the new connection by sending EOK back
     79         *   or the kernel closes it
     80         */
     81        IPC_M_CLONE_ESTABLISH,
     82
     83        /** Protocol for initializing callback connections.
     84         *
     85         * Calling process asks the callee to create a callback connection,
     86         * so that it can start initiating new messages.
     87         *
     88         * The protocol for negotiating is:
     89         * - sys_connect_to_me - sends a message IPC_M_CONNECT_TO_ME
     90         * - recipient         - upon receipt tries to allocate new phone
     91         *                       - if it fails, responds with ELIMIT
     92         *                     - passes call to userspace. If userspace
     93         *                       responds with error, phone is deallocated and
     94         *                       error is sent back to caller. Otherwise
     95         *                       the call is accepted and the response is sent back.
     96         *                     - the hash of the allocated phone is passed to userspace
     97         *                       (on the receiving side) as ARG5 of the call.
     98         */
     99        IPC_M_CONNECT_TO_ME,
     100
     101        /** Protocol for initializing new foward connections.
     102         *
     103         * Calling process asks the callee to create for him a new connection.
     104         * E.g. the caller wants a name server to connect him to print server.
     105         *
     106         * The protocol for negotiating is:
     107         * - sys_connect_me_to - send a synchronous message to name server
     108         *                       indicating that it wants to be connected to some
     109         *                       service
     110         *                     - arg1/2/3 are user specified, arg5 contains
     111         *                       address of the phone that should be connected
     112         *                       (TODO: it leaks to userspace)
     113         *  - recipient        - if ipc_answer == 0, then accept connection
     114         *                     - otherwise connection refused
     115         *                     - recepient may forward message.
     116         */
     117        IPC_M_CONNECT_ME_TO,
     118
     119        /** Share a single page over IPC.
     120         *
     121         * - ARG1 - page-aligned offset from the beginning of the memory object
     122         * - ARG2 - page size
     123         *
     124         * on answer, the recipient must set:
     125         *
     126         * - ARG1 - source user page address
     127         */
     128        IPC_M_PAGE_IN,
     129
     130        /** Receive as_area over IPC.
     131         *
     132         * - ARG1 - destination as_area size
     133         * - ARG2 - user defined argument
     134         *
     135         * on answer, the recipient must set:
     136         *
     137         * - ARG1 - source as_area base address
     138         * - ARG2 - flags that will be used for sharing
     139         * - ARG3 - dst as_area lower bound
     140         * - ARG4 - dst as_area base address (filled automatically by kernel)
     141         */
     142        IPC_M_SHARE_IN,
     143
     144        /** Send as_area over IPC.
     145         *
     146         * - ARG1 - source as_area base address
     147         * - ARG2 - size of source as_area (filled automatically by kernel)
     148         * - ARG3 - flags of the as_area being sent
     149         *
     150         * on answer, the recipient must set:
     151         *
     152         * - ARG1 - dst as_area lower bound
     153         * - ARG2 - dst as_area base adress pointer
     154         *          (filled automatically by the kernel)
     155         */
     156        IPC_M_SHARE_OUT,
     157
     158        /** Receive data from another address space over IPC.
     159         *
     160         * - ARG1 - destination virtual address in the source address space
     161         * - ARG2 - size of data to be received, may be cropped by the recipient
     162         *
     163         * on answer, the recipient must set:
     164         *
     165         * - ARG1 - source virtual address in the destination address space
     166         * - ARG2 - final size of data to be copied
     167         */
     168        IPC_M_DATA_READ,
     169
     170        /** Send data to another address space over IPC.
     171         *
     172         * - ARG1 - source address space virtual address
     173         * - ARG2 - size of data to be copied, may be overriden by the recipient
     174         *
     175         * on answer, the recipient must set:
     176         *
     177         * - ARG1 - final destination address space virtual address
     178         * - ARG2 - final size of data to be copied
     179         */
     180        IPC_M_DATA_WRITE,
     181
     182        /** Authorize change of recipient's state in a third party task.
     183         *
     184         * - ARG1 - user protocol defined data
     185         * - ARG2 - user protocol defined data
     186         * - ARG3 - user protocol defined data
     187         * - ARG5 - sender's phone to the third party task
     188         *
     189         * on EOK answer, the recipient must set:
     190         *
     191         * - ARG1 - recipient's phone to the third party task
     192         */
     193        IPC_M_STATE_CHANGE_AUTHORIZE,
     194
     195        /** Debug the recipient.
     196         *
     197         * - ARG1 - specifies the debug method (from udebug_method_t)
     198         * - other arguments are specific to the debug method
     199         */
     200        IPC_M_DEBUG,
     201};
    193202
    194203/** Last system IPC method */
  • abi/include/abi/mm/as.h

    rbdfdc51c rf126c87  
    4444#define AS_AREA_LATE_RESERVE 0x20
    4545
     46#define AS_AREA_ANY    ((void *) -1)
     47#define AS_MAP_FAILED  ((void *) -1)
     48
     49#define AS_AREA_UNPAGED -1
     50
    4651/** Address space area info exported to uspace. */
    4752typedef struct {
  • kernel/Makefile

    rbdfdc51c rf126c87  
    237237        generic/src/mm/backend_elf.c \
    238238        generic/src/mm/backend_phys.c \
     239        generic/src/mm/backend_user.c \
    239240        generic/src/mm/slab.c \
    240241        generic/src/lib/func.c \
     
    278279        generic/src/ipc/ops/datawrite.c \
    279280        generic/src/ipc/ops/debug.c \
     281        generic/src/ipc/ops/pagein.c \
    280282        generic/src/ipc/ops/sharein.c \
    281283        generic/src/ipc/ops/shareout.c \
  • kernel/generic/include/ipc/ipc.h

    rbdfdc51c rf126c87  
    147147        struct task *sender;
    148148       
     149        /*
     150         * Answerbox that will receive the answer.
     151         * This will most of the times be the sender's answerbox,
     152         * but we allow for useful exceptions.
     153         */
     154        answerbox_t *callerbox;
     155
    149156        /** Phone which was used to send the call. */
    150157        phone_t *caller_phone;
     
    172179extern void ipc_call_release(call_t *);
    173180
     181extern int ipc_call_sync(phone_t *, call_t *);
    174182extern int ipc_call(phone_t *, call_t *);
    175183extern call_t *ipc_wait_for_call(answerbox_t *, uint32_t, unsigned int);
  • kernel/generic/include/ipc/sysipc.h

    rbdfdc51c rf126c87  
    4040#include <typedefs.h>
    4141
     42extern int ipc_req_internal(int, ipc_data_t *);
     43
    4244extern sysarg_t sys_ipc_call_async_fast(sysarg_t, sysarg_t, sysarg_t,
    4345    sysarg_t, sysarg_t, sysarg_t);
  • kernel/generic/include/mm/as.h

    rbdfdc51c rf126c87  
    169169/** Backend data stored in address space area. */
    170170typedef union mem_backend_data {
     171        /* anon_backend members */
     172        struct {
     173        };
     174
    171175        /** elf_backend members */
    172176        struct {
     
    181185                bool anonymous;
    182186        };
     187
     188        /** user_backend members */
     189        struct {
     190                int pager;      /**< Phone to the pager. */
     191        };
     192
    183193} mem_backend_data_t;
    184194
     
    296306extern mem_backend_t elf_backend;
    297307extern mem_backend_t phys_backend;
     308extern mem_backend_t user_backend;
    298309
    299310/* Address space area related syscalls. */
    300 extern sysarg_t sys_as_area_create(uintptr_t, size_t, unsigned int, uintptr_t);
     311extern sysarg_t sys_as_area_create(uintptr_t, size_t, unsigned int, uintptr_t,
     312    int);
    301313extern sysarg_t sys_as_area_resize(uintptr_t, size_t, unsigned int);
    302314extern sysarg_t sys_as_area_change_flags(uintptr_t, unsigned int);
  • kernel/generic/src/ipc/ipc.c

    rbdfdc51c rf126c87  
    7777        call->forget = false;
    7878        call->sender = NULL;
     79        call->callerbox = &TASK->answerbox;
    7980        call->buffer = NULL;
    8081}
     
    185186        phone->state = IPC_PHONE_FREE;
    186187        atomic_set(&phone->active_calls, 0);
     188}
     189
     190/** Helper function to facilitate synchronous calls.
     191 *
     192 * @param phone   Destination kernel phone structure.
     193 * @param request Call structure with request.
     194 *
     195 * @return EOK on success or a negative error code.
     196 *
     197 */
     198int ipc_call_sync(phone_t *phone, call_t *request)
     199{
     200        answerbox_t *mybox = slab_alloc(ipc_answerbox_slab, 0);
     201        ipc_answerbox_init(mybox, TASK);
     202       
     203        /* We will receive data in a special box. */
     204        request->callerbox = mybox;
     205       
     206        int rc = ipc_call(phone, request);
     207        if (rc != EOK) {
     208                slab_free(ipc_answerbox_slab, mybox);
     209                return rc;
     210        }
     211        // TODO: forget the call if interrupted
     212        (void) ipc_wait_for_call(mybox, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE);
     213       
     214        slab_free(ipc_answerbox_slab, mybox);
     215        return EOK;
    187216}
    188217
     
    220249        spinlock_unlock(&call->forget_lock);
    221250
    222         answerbox_t *callerbox = &call->sender->answerbox;
     251        answerbox_t *callerbox = call->callerbox;
    223252        bool do_lock = ((!selflocked) || (callerbox != &TASK->answerbox));
    224253       
     
    755784        ipc_cleanup_call_list(&TASK->answerbox,
    756785            &TASK->answerbox.dispatched_calls);
    757 
     786       
    758787        ipc_forget_all_active_calls();
    759788        ipc_wait_for_all_answered_calls();
  • kernel/generic/src/ipc/sysipc.c

    rbdfdc51c rf126c87  
    106106{
    107107        switch (imethod) {
     108        case IPC_M_PAGE_IN:
    108109        case IPC_M_SHARE_OUT:
    109110        case IPC_M_SHARE_IN:
     
    137138        case IPC_M_CONNECT_TO_ME:
    138139        case IPC_M_CONNECT_ME_TO:
     140        case IPC_M_PAGE_IN:
    139141        case IPC_M_SHARE_OUT:
    140142        case IPC_M_SHARE_IN:
     
    257259{
    258260        return SYSIPC_OP(request_process, call, box);
     261}
     262
     263/** Make a call over IPC and wait for reply.
     264 *
     265 * @param phoneid     Phone handle for the call.
     266 * @param data[inout] Structure with request/reply data.
     267 *
     268 * @return EOK on success.
     269 * @return ENOENT if there is no such phone handle.
     270 *
     271 */
     272int ipc_req_internal(int phoneid, ipc_data_t *data)
     273{
     274        phone_t *phone;
     275        if (phone_get(phoneid, &phone) != EOK)
     276                return ENOENT;
     277       
     278        call_t *call = ipc_call_alloc(0);
     279        memcpy(call->data.args, data->args, sizeof(data->args));
     280       
     281        int rc = request_preprocess(call, phone);
     282        if (!rc) {
     283#ifdef CONFIG_UDEBUG
     284                udebug_stoppable_begin();
     285#endif
     286
     287                rc = ipc_call_sync(phone, call);
     288
     289#ifdef CONFIG_UDEBUG
     290                udebug_stoppable_end();
     291#endif
     292
     293                if (rc != EOK)
     294                        return EINTR;
     295
     296                process_answer(call);
     297        } else
     298                IPC_SET_RETVAL(call->data, rc);
     299       
     300        memcpy(data->args, call->data.args, sizeof(data->args));
     301        ipc_call_free(call);
     302       
     303        return EOK;
    259304}
    260305
  • kernel/generic/src/ipc/sysipc_ops.c

    rbdfdc51c rf126c87  
    4242sysipc_ops_t ipc_m_connect_to_me_ops;
    4343sysipc_ops_t ipc_m_connect_me_to_ops;
     44sysipc_ops_t ipc_m_page_in_ops;
    4445sysipc_ops_t ipc_m_share_out_ops;
    4546sysipc_ops_t ipc_m_share_in_ops;
     
    5455        [IPC_M_CONNECT_TO_ME] = &ipc_m_connect_to_me_ops,
    5556        [IPC_M_CONNECT_ME_TO] = &ipc_m_connect_me_to_ops,
     57        [IPC_M_PAGE_IN] = &ipc_m_page_in_ops,
    5658        [IPC_M_SHARE_OUT] = &ipc_m_share_out_ops,
    5759        [IPC_M_SHARE_IN] = &ipc_m_share_in_ops,
  • kernel/generic/src/mm/as.c

    rbdfdc51c rf126c87  
    574574 * @param backend_data NULL or a pointer to custom backend data.
    575575 * @param base         Starting virtual address of the area.
    576  *                     If set to -1, a suitable mappable area is found.
    577  * @param bound        Lowest address bound if base is set to -1.
     576 *                     If set to AS_AREA_ANY, a suitable mappable area is
     577 *                     found.
     578 * @param bound        Lowest address bound if base is set to AS_AREA_ANY.
    578579 *                     Otherwise ignored.
    579580 *
     
    585586    mem_backend_data_t *backend_data, uintptr_t *base, uintptr_t bound)
    586587{
    587         if ((*base != (uintptr_t) -1) && !IS_ALIGNED(*base, PAGE_SIZE))
     588        if ((*base != (uintptr_t) AS_AREA_ANY) && !IS_ALIGNED(*base, PAGE_SIZE))
    588589                return NULL;
    589590       
     
    601602        mutex_lock(&as->lock);
    602603       
    603         if (*base == (uintptr_t) -1) {
     604        if (*base == (uintptr_t) AS_AREA_ANY) {
    604605                *base = as_get_unmapped_area(as, bound, size, guarded);
    605606                if (*base == (uintptr_t) -1) {
     
    21822183
    21832184sysarg_t sys_as_area_create(uintptr_t base, size_t size, unsigned int flags,
    2184     uintptr_t bound)
     2185    uintptr_t bound, int pager)
    21852186{
    21862187        uintptr_t virt = base;
     2188        mem_backend_t *backend;
     2189        mem_backend_data_t backend_data;
     2190
     2191        if (pager == AS_AREA_UNPAGED)
     2192                backend = &anon_backend;
     2193        else {
     2194                backend = &user_backend;
     2195                backend_data.pager = pager;
     2196        }
    21872197        as_area_t *area = as_area_create(AS, flags, size,
    2188             AS_AREA_ATTR_NONE, &anon_backend, NULL, &virt, bound);
     2198            AS_AREA_ATTR_NONE, backend, &backend_data, &virt, bound);
    21892199        if (area == NULL)
    2190                 return (sysarg_t) -1;
     2200                return (sysarg_t) AS_MAP_FAILED;
    21912201       
    21922202        return (sysarg_t) virt;
  • uspace/app/tester/Makefile

    rbdfdc51c rf126c87  
    7474        mm/malloc3.c \
    7575        mm/mapping1.c \
     76        mm/pager1.c \
    7677        hw/misc/virtchar1.c \
    7778        hw/serial/serial1.c
  • uspace/app/tester/mm/common.c

    rbdfdc51c rf126c87  
    341341       
    342342        area->addr = as_area_create(AS_AREA_ANY, size,
    343             AS_AREA_WRITE | AS_AREA_READ | AS_AREA_CACHEABLE);
     343            AS_AREA_WRITE | AS_AREA_READ | AS_AREA_CACHEABLE,
     344            AS_AREA_UNPAGED);
    344345        if (area->addr == AS_MAP_FAILED) {
    345346                free(area);
  • uspace/app/tester/mm/mapping1.c

    rbdfdc51c rf126c87  
    4343       
    4444        void *result = as_area_create(AS_AREA_ANY, size,
    45             AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE);
     45            AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE, AS_AREA_UNPAGED);
    4646        if (result == AS_MAP_FAILED)
    4747                return NULL;
  • uspace/app/tester/tester.c

    rbdfdc51c rf126c87  
    7474#include "mm/malloc3.def"
    7575#include "mm/mapping1.def"
     76#include "mm/pager1.def"
    7677#include "hw/serial/serial1.def"
    7778#include "hw/misc/virtchar1.def"
  • uspace/app/tester/tester.h

    rbdfdc51c rf126c87  
    107107extern const char *test_malloc3(void);
    108108extern const char *test_mapping1(void);
     109extern const char *test_pager1(void);
    109110extern const char *test_serial1(void);
    110111extern const char *test_virtchar1(void);
  • uspace/app/trace/syscalls.c

    rbdfdc51c rf126c87  
    4949    [SYS_FUTEX_WAKEUP] = { "futex_wakeup",              1,      V_ERRNO },
    5050
    51     [SYS_AS_AREA_CREATE] = { "as_area_create",          3,      V_ERRNO },
     51    [SYS_AS_AREA_CREATE] = { "as_area_create",          5,      V_ERRNO },
    5252    [SYS_AS_AREA_RESIZE] = { "as_area_resize",          3,      V_ERRNO },
    5353    [SYS_AS_AREA_DESTROY] = { "as_area_destroy",        1,      V_ERRNO },
  • uspace/lib/c/generic/as.c

    rbdfdc51c rf126c87  
    5050 * @param size  Size of the area.
    5151 * @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.
    5254 *
    5355 * @return Starting virtual address of the created area on success.
     
    5557 *
    5658 */
    57 void *as_area_create(void *base, size_t size, unsigned int flags)
     59void *as_area_create(void *base, size_t size, unsigned int flags, int pager)
    5860{
    59         return (void *) __SYSCALL4(SYS_AS_AREA_CREATE, (sysarg_t) base,
    60             (sysarg_t) size, (sysarg_t) flags, (sysarg_t) __entry);
     61        return (void *) __SYSCALL5(SYS_AS_AREA_CREATE, (sysarg_t) base,
     62            (sysarg_t) size, (sysarg_t) flags, (sysarg_t) __entry,
     63            (sysarg_t) pager);
    6164}
    6265
  • uspace/lib/c/generic/async.c

    rbdfdc51c rf126c87  
    116116#include <stdlib.h>
    117117#include <macros.h>
     118#include <as.h>
    118119#include "private/libc.h"
    119120
     
    33813382}
    33823383
     3384void *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);
     3388}
     3389
    33833390/** @}
    33843391 */
  • uspace/lib/c/generic/elf/elf_mod.c

    rbdfdc51c rf126c87  
    370370         */
    371371        a = as_area_create((uint8_t *) base + bias, mem_sz,
    372             AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE);
     372            AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE,
     373            AS_AREA_UNPAGED);
    373374        if (a == AS_MAP_FAILED) {
    374375                DPRINTF("memory mapping failed (%p, %zu)\n",
  • uspace/lib/c/generic/fibril.c

    rbdfdc51c rf126c87  
    279279        size_t stack_size = (stksz == FIBRIL_DFLT_STK_SIZE) ?
    280280            stack_size_get() : stksz;
    281         fibril->stack = as_area_create((void *) -1, stack_size,
     281        fibril->stack = as_area_create(AS_AREA_ANY, stack_size,
    282282            AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE | AS_AREA_GUARD |
    283             AS_AREA_LATE_RESERVE);
     283            AS_AREA_LATE_RESERVE, AS_AREA_UNPAGED);
    284284        if (fibril->stack == (void *) -1) {
    285285                fibril_teardown(fibril, false);
  • uspace/lib/c/generic/io/chargrid.c

    rbdfdc51c rf126c87  
    6060        if ((flags & CHARGRID_FLAG_SHARED) == CHARGRID_FLAG_SHARED) {
    6161                scrbuf = (chargrid_t *) as_area_create(AS_AREA_ANY, size,
    62                     AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE);
     62                    AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE,
     63                    AS_AREA_UNPAGED);
    6364                if (scrbuf == AS_MAP_FAILED)
    6465                        return NULL;
  • uspace/lib/c/generic/malloc.c

    rbdfdc51c rf126c87  
    354354        size_t asize = ALIGN_UP(size, PAGE_SIZE);
    355355        void *astart = as_area_create(AS_AREA_ANY, asize,
    356             AS_AREA_WRITE | AS_AREA_READ | AS_AREA_CACHEABLE);
     356            AS_AREA_WRITE | AS_AREA_READ | AS_AREA_CACHEABLE, AS_AREA_UNPAGED);
    357357        if (astart == AS_MAP_FAILED)
    358358                return false;
  • uspace/lib/c/generic/thread.c

    rbdfdc51c rf126c87  
    116116        void *stack = as_area_create(AS_AREA_ANY, stack_size,
    117117            AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE | AS_AREA_GUARD |
    118             AS_AREA_LATE_RESERVE);
     118            AS_AREA_LATE_RESERVE, AS_AREA_UNPAGED);
    119119        if (stack == AS_MAP_FAILED) {
    120120                free(uarg);
  • uspace/lib/c/include/as.h

    rbdfdc51c rf126c87  
    3838#include <sys/types.h>
    3939#include <abi/mm/as.h>
    40 #include <task.h>
    4140#include <libarch/config.h>
    42 
    43 #define AS_AREA_ANY    ((void *) -1)
    44 #define AS_MAP_FAILED  ((void *) -1)
    4541
    4642static inline size_t SIZE2PAGES(size_t size)
     
    5753}
    5854
    59 extern void *as_area_create(void *, size_t, unsigned int);
     55extern void *as_area_create(void *, size_t, unsigned int, int);
    6056extern int as_area_resize(void *, size_t, unsigned int);
    6157extern int as_area_change_flags(void *, unsigned int);
  • uspace/lib/c/include/async.h

    rbdfdc51c rf126c87  
    488488extern void async_remote_state_release_exchange(async_exch_t *);
    489489
     490extern void *async_as_area_create(void *, size_t, unsigned int, async_sess_t *);
     491
    490492#endif
    491493
  • uspace/lib/draw/surface.c

    rbdfdc51c rf126c87  
    6464        if (!pixbuf) {
    6565                if ((flags & SURFACE_FLAG_SHARED) == SURFACE_FLAG_SHARED) {
    66                         pixbuf = (pixel_t *) as_area_create(AS_AREA_ANY, pixbuf_size,
    67                             AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE);
     66                        pixbuf = (pixel_t *) as_area_create(AS_AREA_ANY,
     67                            pixbuf_size,
     68                            AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE,
     69                            AS_AREA_UNPAGED);
    6870                        if (pixbuf == AS_MAP_FAILED) {
    6971                                free(surface);
  • uspace/lib/posix/source/sys/mman.c

    rbdfdc51c rf126c87  
    5454                return MAP_FAILED;
    5555       
    56         return as_area_create(start, length, prot);
     56        return as_area_create(start, length, prot, AS_AREA_UNPAGED);
    5757}
    5858
  • uspace/srv/hid/compositor/compositor.c

    rbdfdc51c rf126c87  
    5555#include <async.h>
    5656#include <loc.h>
     57#include <task.h>
    5758
    5859#include <io/keycode.h>
  • uspace/srv/hid/console/console.c

    rbdfdc51c rf126c87  
    4949#include <malloc.h>
    5050#include <as.h>
     51#include <task.h>
    5152#include <fibril_synch.h>
    5253#include "console.h"
  • uspace/srv/hid/output/output.c

    rbdfdc51c rf126c87  
    3232#include <macros.h>
    3333#include <as.h>
     34#include <task.h>
    3435#include <ipc/output.h>
    3536#include "port/ega.h"
  • uspace/srv/vfs/vfs.c

    rbdfdc51c rf126c87  
    3737
    3838#include <vfs/vfs.h>
     39#include <stdlib.h>
    3940#include <ipc/services.h>
     41#include <abi/ipc/methods.h>
     42#include <libarch/config.h>
    4043#include <ns.h>
    4144#include <async.h>
     
    5154#define NAME  "vfs"
    5255
     56static void vfs_pager(ipc_callid_t iid, ipc_call_t *icall, void *arg)
     57{
     58        async_answer_0(iid, EOK);
     59
     60        char *buf = memalign(PAGE_SIZE, 1);
     61        const char hello[] = "Hello world!";
     62
     63        memcpy(buf, hello, sizeof(hello));
     64
     65        while (true) {
     66                ipc_call_t call;
     67                ipc_callid_t callid = async_get_call(&call);
     68               
     69                if (!IPC_GET_IMETHOD(call))
     70                        break;
     71               
     72                switch (IPC_GET_IMETHOD(call)) {
     73                case IPC_M_PAGE_IN:
     74                        if (buf)
     75                                async_answer_1(callid, EOK, (sysarg_t) buf);
     76                        else
     77                                async_answer_0(callid, ENOMEM);
     78                        break;
     79                       
     80                default:
     81                        async_answer_0(callid, ENOTSUP);
     82                        break;
     83                }
     84        }
     85}
     86
    5387static void vfs_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg)
    5488{
     
    150184int main(int argc, char **argv)
    151185{
     186        int rc;
     187
    152188        printf("%s: HelenOS VFS server\n", NAME);
    153189       
     
    165201         */
    166202        plb = as_area_create(AS_AREA_ANY, PLB_SIZE,
    167             AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE);
     203            AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE, AS_AREA_UNPAGED);
    168204        if (plb == AS_MAP_FAILED) {
    169205                printf("%s: Cannot create address space area\n", NAME);
     
    179215
    180216        /*
     217         * Create a port for the pager.
     218         */
     219        port_id_t port;
     220        rc = async_create_port(INTERFACE_PAGER, vfs_pager, NULL, &port);
     221        if (rc != EOK)
     222                return rc;
     223               
     224        /*
    181225         * Set a connection handling function/fibril.
    182226         */
     
    192236         * Register at the naming service.
    193237         */
    194         int rc = service_register(SERVICE_VFS);
     238        rc = service_register(SERVICE_VFS);
    195239        if (rc != EOK) {
    196240                printf("%s: Cannot register VFS service\n", NAME);
Note: See TracChangeset for help on using the changeset viewer.