Changeset 8a568e3 in mainline


Ignore:
Timestamp:
2006-05-14T17:17:35Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
52352ec
Parents:
8071af9f
Message:

Added support to IPC for sharing pages. Remove old calls as_area_send/accept,
modify tests.

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • init/init.c

    r8071af9f r8a568e3  
    3939#include <as.h>
    4040#include <ddi.h>
     41#include <string.h>
    4142
    4243int a;
     
    292293}
    293294
     295static int test_as_send()
     296{
     297        char *as;
     298        int retval;
     299        ipcarg_t result;
     300
     301        as = as_area_create((void *)(1024*1024), 16384, AS_AREA_READ | AS_AREA_WRITE);
     302        if (!as) {
     303                printf("Error creating as.\n");
     304                return 0;
     305        }
     306
     307        memcpy(as, "Hello world.\n", 14);
     308
     309        retval = ipc_call_sync_2(PHONE_NS, IPC_M_AS_SEND, 0, (sysarg_t) as,
     310                NULL, NULL);
     311        if (retval) {
     312                printf("AS_SEND failed.\n");
     313                return 0;
     314        }
     315        printf("Done\n");
     316}
     317
    294318int main(int argc, char *argv[])
    295319{
     
    307331//      test_hangup();
    308332//      test_slam();
    309        
     333        test_as_send();
     334/*     
    310335        printf("Userspace task, taskid=%llX\n", task_get_id());
    311336
     
    350375
    351376        printf("Main thread exiting.\n");
     377*/
    352378        return 0;
    353379}
  • libc/generic/as.c

    r8071af9f r8a568e3  
    7070}
    7171
    72 /** Prepare to accept address space area.
    73  *
    74  * @param id Task ID of the donor task.
    75  * @param base Destination address for the new address space area.
    76  * @param size Size of the new address space area.
    77  * @param flags Flags of the area TASK is willing to accept.
    78  *
    79  * @return 0 on success or a code from errno.h.
    80  */
    81 int as_area_accept(task_id_t id, void *base, size_t size, int flags)
    82 {
    83         as_area_acptsnd_arg_t arg;
    84        
    85         arg.task_id = id;
    86         arg.base = base;
    87         arg.size = size;
    88         arg.flags = flags;
    89        
    90         return __SYSCALL1(SYS_AS_AREA_ACCEPT, (sysarg_t) &arg);
    91 }
    92 
    93 /** Send address space area to another task.
    94  *
    95  * @param id Task ID of the acceptor task.
    96  * @param base Source address of the existing address space area.
    97  *
    98  * @return 0 on success or a code from errno.h.
    99  */
    100 int as_area_send(task_id_t id, void *base)
    101 {
    102         as_area_acptsnd_arg_t arg;
    103        
    104         arg.task_id = id;
    105         arg.base = base;
    106         arg.size = 0;
    107         arg.flags = 0;
    108        
    109         return __SYSCALL1(SYS_AS_AREA_SEND, (sysarg_t) &arg);
    110 }
    111 
    11272static size_t heapsize = 0;
    11373/* Start of heap linker symbol */
  • libc/include/as.h

    r8071af9f r8a568e3  
    2727 */
    2828
    29 #ifndef __AS_H__
    30 #define __AS_H__
     29#ifndef __libc_AS_H__
     30#define __libc_AS_H__
    3131
    3232#include <types.h>
    3333#include <task.h>
     34#include <kernel/mm/as.h>
    3435
    3536extern void *as_area_create(void *address, size_t size, int flags);
    3637extern int as_area_resize(void *address, size_t size, int flags);
    3738extern int as_area_destroy(void *address);
    38 extern int as_area_accept(task_id_t id, void *base, size_t size, int flags);
    39 extern int as_area_send(task_id_t id, void *base);
    4039
    4140#endif
  • libipc/generic/ipc.c

    r8071af9f r8a568e3  
    149149
    150150/** Send answer to a received call */
    151 void ipc_answer(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1,
     151ipcarg_t ipc_answer(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1,
    152152                ipcarg_t arg2)
    153153{
    154         __SYSCALL4(SYS_IPC_ANSWER_FAST, callid, retval, arg1, arg2);
     154        return __SYSCALL4(SYS_IPC_ANSWER_FAST, callid, retval, arg1, arg2);
    155155}
    156156
     
    272272        return __SYSCALL1(SYS_IPC_UNREGISTER_IRQ, irq);
    273273}
     274
     275/*
     276int ipc_open_dgrconn(int pohoneid, size_t max_dgram)
     277{
     278       
     279}
     280
     281
     282*/
  • libipc/include/ipc.h

    r8071af9f r8a568e3  
    5555                         ipcarg_t *result);
    5656extern ipc_callid_t ipc_wait_for_call(ipc_call_t *data, int flags);
    57 extern void ipc_answer(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1,
    58                        ipcarg_t arg2);
     57extern ipcarg_t ipc_answer(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1,
     58                           ipcarg_t arg2);
    5959
    6060#define ipc_call_async(phoneid,method,arg1,private, callback) (ipc_call_async_2(phoneid, method, arg1, 0, private, callback))
  • ns/ns.c

    r8071af9f r8a568e3  
    3232        ipc_call_t call;
    3333        ipc_callid_t callid;
     34        char *as;
    3435       
    3536        ipcarg_t retval, arg1, arg2;
     
    4243                printf("NS:Call phone=%lX..", call.phoneid);
    4344                switch (IPC_GET_METHOD(call)) {
     45                case IPC_M_AS_SEND:
     46                        as = (char *)IPC_GET_ARG2(call);
     47                        printf("Received as: %P, size:%d\n", as, IPC_GET_ARG3(call));
     48                        retval = ipc_answer(callid, 0,(sysarg_t)(1024*1024), 0);
     49                        if (!retval) {
     50                                printf("Reading shared memory...");
     51                                printf("Text: %s", as);
     52                        } else
     53                                printf("Failed answer: %d\n", retval);
     54                        continue;
     55                        break;
    4456                case IPC_M_INTERRUPT:
    4557                        printf("GOT INTERRUPT: %c\n", IPC_GET_ARG2(call));
Note: See TracChangeset for help on using the changeset viewer.