Changeset 357b5f5 in mainline for kernel/generic/src


Ignore:
Timestamp:
2011-01-23T20:09:13Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fdb9982c
Parents:
cead2aa (diff), 7e36c8d (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:

Merge mainline changes.

Location:
kernel/generic/src
Files:
33 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/adt/avl.c

    rcead2aa r357b5f5  
    723723void avltree_walk(avltree_t *t, avltree_walker_t walker, void *arg)
    724724{
    725         _avltree_walk(t->root, walker, arg);
     725        if (t->root)
     726                _avltree_walk(t->root, walker, arg);
    726727}
    727728
  • kernel/generic/src/adt/hash_table.c

    rcead2aa r357b5f5  
    8282 * @param item Item to be inserted into the hash table.
    8383 */
    84 void hash_table_insert(hash_table_t *h, unative_t key[], link_t *item)
     84void hash_table_insert(hash_table_t *h, sysarg_t key[], link_t *item)
    8585{
    8686        size_t chain;
     
    105105 * @return Matching item on success, NULL if there is no such item.
    106106 */
    107 link_t *hash_table_find(hash_table_t *h, unative_t key[])
     107link_t *hash_table_find(hash_table_t *h, sysarg_t key[])
    108108{
    109109        link_t *cur;
     
    138138 * @param keys Number of keys in the key array.
    139139 */
    140 void hash_table_remove(hash_table_t *h, unative_t key[], size_t keys)
     140void hash_table_remove(hash_table_t *h, sysarg_t key[], size_t keys)
    141141{
    142142        size_t chain;
  • kernel/generic/src/console/cmd.c

    rcead2aa r357b5f5  
    601601       
    602602        /* This doesn't have to be very accurate */
    603         unative_t sec = uptime->seconds1;
     603        sysarg_t sec = uptime->seconds1;
    604604       
    605605        printf("Up %" PRIun " days, %" PRIun " hours, %" PRIun " minutes, %" PRIun " seconds\n",
     
    656656        uintptr_t symaddr;
    657657        char *symbol;
    658         unative_t (*fnc)(void);
     658        sysarg_t (*fnc)(void);
    659659        fncptr_t fptr;
    660660        int rc;
     
    672672
    673673                ipl = interrupts_disable();
    674                 fnc = (unative_t (*)(void)) arch_construct_function(&fptr,
     674                fnc = (sysarg_t (*)(void)) arch_construct_function(&fptr,
    675675                    (void *) symaddr, (void *) cmd_call0);
    676676                printf("Calling %s() (%p)\n", symbol, (void *) symaddr);
     
    720720        uintptr_t symaddr;
    721721        char *symbol;
    722         unative_t (*fnc)(unative_t, ...);
    723         unative_t arg1 = argv[1].intval;
     722        sysarg_t (*fnc)(sysarg_t, ...);
     723        sysarg_t arg1 = argv[1].intval;
    724724        fncptr_t fptr;
    725725        int rc;
     
    737737
    738738                ipl = interrupts_disable();
    739                 fnc = (unative_t (*)(unative_t, ...))
     739                fnc = (sysarg_t (*)(sysarg_t, ...))
    740740                    arch_construct_function(&fptr, (void *) symaddr,
    741741                    (void *) cmd_call1);
     
    756756        uintptr_t symaddr;
    757757        char *symbol;
    758         unative_t (*fnc)(unative_t, unative_t, ...);
    759         unative_t arg1 = argv[1].intval;
    760         unative_t arg2 = argv[2].intval;
     758        sysarg_t (*fnc)(sysarg_t, sysarg_t, ...);
     759        sysarg_t arg1 = argv[1].intval;
     760        sysarg_t arg2 = argv[2].intval;
    761761        fncptr_t fptr;
    762762        int rc;
     
    774774
    775775                ipl = interrupts_disable();
    776                 fnc = (unative_t (*)(unative_t, unative_t, ...))
     776                fnc = (sysarg_t (*)(sysarg_t, sysarg_t, ...))
    777777                    arch_construct_function(&fptr, (void *) symaddr,
    778778                    (void *) cmd_call2);
     
    792792        uintptr_t symaddr;
    793793        char *symbol;
    794         unative_t (*fnc)(unative_t, unative_t, unative_t, ...);
    795         unative_t arg1 = argv[1].intval;
    796         unative_t arg2 = argv[2].intval;
    797         unative_t arg3 = argv[3].intval;
     794        sysarg_t (*fnc)(sysarg_t, sysarg_t, sysarg_t, ...);
     795        sysarg_t arg1 = argv[1].intval;
     796        sysarg_t arg2 = argv[2].intval;
     797        sysarg_t arg3 = argv[3].intval;
    798798        fncptr_t fptr;
    799799        int rc;
     
    811811
    812812                ipl = interrupts_disable();
    813                 fnc = (unative_t (*)(unative_t, unative_t, unative_t, ...))
     813                fnc = (sysarg_t (*)(sysarg_t, sysarg_t, sysarg_t, ...))
    814814                    arch_construct_function(&fptr, (void *) symaddr,
    815815                    (void *) cmd_call3);
  • kernel/generic/src/console/console.c

    rcead2aa r357b5f5  
    162162        ddi_parea_register(&klog_parea);
    163163       
    164         sysinfo_set_item_val("klog.faddr", NULL, (unative_t) faddr);
     164        sysinfo_set_item_val("klog.faddr", NULL, (sysarg_t) faddr);
    165165        sysinfo_set_item_val("klog.pages", NULL, KLOG_PAGES);
    166166       
     
    193193
    194194/** Tell kernel to get keyboard/console access again */
    195 unative_t sys_debug_enable_console(void)
     195sysarg_t sys_debug_enable_console(void)
    196196{
    197197#ifdef CONFIG_KCONSOLE
     
    204204
    205205/** Tell kernel to relinquish keyboard/console access */
    206 unative_t sys_debug_disable_console(void)
     206sysarg_t sys_debug_disable_console(void)
    207207{
    208208        release_console();
     
    333333 *
    334334 */
    335 unative_t sys_klog(int fd, const void *buf, size_t size)
     335sysarg_t sys_klog(int fd, const void *buf, size_t size)
    336336{
    337337        char *data;
     
    339339       
    340340        if (size > PAGE_SIZE)
    341                 return (unative_t) ELIMIT;
     341                return (sysarg_t) ELIMIT;
    342342       
    343343        if (size > 0) {
    344344                data = (char *) malloc(size + 1, 0);
    345345                if (!data)
    346                         return (unative_t) ENOMEM;
     346                        return (sysarg_t) ENOMEM;
    347347               
    348348                rc = copy_from_uspace(data, buf, size);
    349349                if (rc) {
    350350                        free(data);
    351                         return (unative_t) rc;
     351                        return (sysarg_t) rc;
    352352                }
    353353                data[size] = 0;
  • kernel/generic/src/console/kconsole.c

    rcead2aa r357b5f5  
    426426
    427427NO_TRACE static bool parse_int_arg(const char *text, size_t len,
    428     unative_t *result)
     428    sysarg_t *result)
    429429{
    430430        bool isaddr = false;
     
    461461                case EOK:
    462462                        if (isaddr)
    463                                 *result = (unative_t) symaddr;
     463                                *result = (sysarg_t) symaddr;
    464464                        else if (isptr)
    465                                 *result = **((unative_t **) symaddr);
     465                                *result = **((sysarg_t **) symaddr);
    466466                        else
    467                                 *result = *((unative_t *) symaddr);
     467                                *result = *((sysarg_t *) symaddr);
    468468                        break;
    469469                default:
     
    483483                        return false;
    484484                case EOK:
    485                         *result = (unative_t) value;
     485                        *result = (sysarg_t) value;
    486486                        if (isptr)
    487                                 *result = *((unative_t *) *result);
     487                                *result = *((sysarg_t *) *result);
    488488                        break;
    489489                default:
     
    629629                                            cmdline + start + 1,
    630630                                            (end - start) - 1);
    631                                         cmd->argv[i].intval = (unative_t) buf;
     631                                        cmd->argv[i].intval = (sysarg_t) buf;
    632632                                        cmd->argv[i].vartype = ARG_TYPE_STRING;
    633633                                } else {
  • kernel/generic/src/ddi/ddi.c

    rcead2aa r357b5f5  
    232232 *
    233233 */
    234 unative_t sys_physmem_map(unative_t phys_base, unative_t virt_base,
    235     unative_t pages, unative_t flags)
    236 {
    237         return (unative_t) ddi_physmem_map(ALIGN_DOWN((uintptr_t) phys_base,
     234sysarg_t sys_physmem_map(sysarg_t phys_base, sysarg_t virt_base,
     235    sysarg_t pages, sysarg_t flags)
     236{
     237        return (sysarg_t) ddi_physmem_map(ALIGN_DOWN((uintptr_t) phys_base,
    238238            FRAME_SIZE), ALIGN_DOWN((uintptr_t) virt_base, PAGE_SIZE),
    239239            (size_t) pages, (int) flags);
     
    247247 *
    248248 */
    249 unative_t sys_iospace_enable(ddi_ioarg_t *uspace_io_arg)
     249sysarg_t sys_iospace_enable(ddi_ioarg_t *uspace_io_arg)
    250250{
    251251        ddi_ioarg_t arg;
    252252        int rc = copy_from_uspace(&arg, uspace_io_arg, sizeof(ddi_ioarg_t));
    253253        if (rc != 0)
    254                 return (unative_t) rc;
    255        
    256         return (unative_t) ddi_iospace_enable((task_id_t) arg.task_id,
     254                return (sysarg_t) rc;
     255       
     256        return (sysarg_t) ddi_iospace_enable((task_id_t) arg.task_id,
    257257            (uintptr_t) arg.ioaddr, (size_t) arg.size);
    258258}
    259259
    260 /** Disable or enable specified interrupts.
    261  *
    262  * @param irq the interrupt to be enabled/disabled.
    263  * @param enable if true enable the interrupt, disable otherwise.
    264  *
    265  * @retutn Zero on success, error code otherwise.
    266  */
    267 unative_t sys_interrupt_enable(int irq, int enable)
    268 {
    269 /* FIXME: this needs to be generic code, or better not be in kernel at all. */
    270 #if 0
    271         cap_t task_cap = cap_get(TASK);
    272         if (!(task_cap & CAP_IRQ_REG))
    273                 return EPERM;
    274                
    275         if (irq < 0 || irq > 16) {
    276                 return EINVAL;
    277         }
    278        
    279         uint16_t irq_mask = (uint16_t)(1 << irq);
    280         if (enable) {
    281                 trap_virtual_enable_irqs(irq_mask);
    282         } else {
    283                 trap_virtual_disable_irqs(irq_mask);
    284         }
    285        
    286 #endif
    287         return 0;
    288 }
    289 
    290260/** @}
    291261 */
  • kernel/generic/src/ddi/device.c

    rcead2aa r357b5f5  
    5454}
    5555
    56 unative_t sys_device_assign_devno(void)
     56sysarg_t sys_device_assign_devno(void)
    5757{
    58         return (unative_t) device_assign_devno();
     58        return (sysarg_t) device_assign_devno();
    5959}
    6060
  • kernel/generic/src/ddi/irq.c

    rcead2aa r357b5f5  
    106106 *
    107107 */
    108 static size_t irq_ht_hash(unative_t *key);
    109 static bool irq_ht_compare(unative_t *key, size_t keys, link_t *item);
     108static size_t irq_ht_hash(sysarg_t *key);
     109static bool irq_ht_compare(sysarg_t *key, size_t keys, link_t *item);
    110110static void irq_ht_remove(link_t *item);
    111111
     
    123123 *
    124124 */
    125 static size_t irq_lin_hash(unative_t *key);
    126 static bool irq_lin_compare(unative_t *key, size_t keys, link_t *item);
     125static size_t irq_lin_hash(sysarg_t *key);
     126static bool irq_lin_compare(sysarg_t *key, size_t keys, link_t *item);
    127127static void irq_lin_remove(link_t *item);
    128128
     
    136136static size_t buckets;
    137137
     138/** Last valid INR. */
     139inr_t last_inr = 0;
     140
    138141/** Initialize IRQ subsystem.
    139142 *
     
    145148{
    146149        buckets = chains;
     150        last_inr = inrs - 1;
     151
    147152        /*
    148153         * Be smart about the choice of the hash table operations.
     
    194199void irq_register(irq_t *irq)
    195200{
    196         unative_t key[] = {
    197                 (unative_t) irq->inr,
    198                 (unative_t) irq->devno
     201        sysarg_t key[] = {
     202                (sysarg_t) irq->inr,
     203                (sysarg_t) irq->devno
    199204        };
    200205       
     
    212217{
    213218        link_t *lnk;
    214         unative_t key[] = {
    215                 (unative_t) inr,
    216                 (unative_t) -1    /* Search will use claim() instead of devno */
     219        sysarg_t key[] = {
     220                (sysarg_t) inr,
     221                (sysarg_t) -1    /* Search will use claim() instead of devno */
    217222        };
    218223       
     
    235240{
    236241        link_t *lnk;
    237         unative_t key[] = {
    238                 (unative_t) inr,
    239                 (unative_t) -1    /* Search will use claim() instead of devno */
     242        sysarg_t key[] = {
     243                (sysarg_t) inr,
     244                (sysarg_t) -1    /* Search will use claim() instead of devno */
    240245        };
    241246       
     
    306311 *
    307312 */
    308 size_t irq_ht_hash(unative_t key[])
     313size_t irq_ht_hash(sysarg_t key[])
    309314{
    310315        inr_t inr = (inr_t) key[KEY_INR];
     
    333338 *
    334339 */
    335 bool irq_ht_compare(unative_t key[], size_t keys, link_t *item)
     340bool irq_ht_compare(sysarg_t key[], size_t keys, link_t *item)
    336341{
    337342        irq_t *irq = hash_table_get_instance(item, irq_t, link);
     
    381386 *
    382387 */
    383 size_t irq_lin_hash(unative_t key[])
     388size_t irq_lin_hash(sysarg_t key[])
    384389{
    385390        inr_t inr = (inr_t) key[KEY_INR];
     
    408413 *
    409414 */
    410 bool irq_lin_compare(unative_t key[], size_t keys, link_t *item)
     415bool irq_lin_compare(sysarg_t key[], size_t keys, link_t *item)
    411416{
    412417        irq_t *irq = list_get_instance(item, irq_t, link);
  • kernel/generic/src/interrupt/interrupt.c

    rcead2aa r357b5f5  
    197197                /* Notify the subscriber that a fault occurred. */
    198198                event_notify_3(EVENT_FAULT, LOWER32(TASK->taskid),
    199                     UPPER32(TASK->taskid), (unative_t) THREAD);
     199                    UPPER32(TASK->taskid), (sysarg_t) THREAD);
    200200               
    201201#ifdef CONFIG_UDEBUG
     
    207207        task_kill(TASK->taskid);
    208208        thread_exit();
     209}
     210
     211/** Get istate structure of a thread.
     212 *
     213 * Get pointer to the istate structure at the bottom of the kernel stack.
     214 *
     215 * This function can be called in interrupt or user context. In interrupt
     216 * context the istate structure is created by the low-level exception
     217 * handler. In user context the istate structure is created by the
     218 * low-level syscall handler.
     219 */
     220istate_t *istate_get(thread_t *thread)
     221{
     222        /*
     223         * The istate structure should be right at the bottom of the kernel
     224         * stack.
     225         */
     226        return (istate_t *) ((uint8_t *) thread->kstack + THREAD_STACK_SIZE -
     227            sizeof(istate_t));
    209228}
    210229
     
    263282               
    264283                const char *symbol =
    265                     symtab_fmt_name_lookup((unative_t) exc_table[i].handler);
     284                    symtab_fmt_name_lookup((sysarg_t) exc_table[i].handler);
    266285               
    267286#ifdef __32_BITS__
  • kernel/generic/src/ipc/event.c

    rcead2aa r357b5f5  
    5757                events[i].answerbox = NULL;
    5858                events[i].counter = 0;
    59                 events[i].method = 0;
     59                events[i].imethod = 0;
    6060        }
    6161}
    6262
    63 static int event_subscribe(event_type_t evno, unative_t method,
     63static int event_subscribe(event_type_t evno, sysarg_t imethod,
    6464    answerbox_t *answerbox)
    6565{
     
    7373        if (events[evno].answerbox == NULL) {
    7474                events[evno].answerbox = answerbox;
    75                 events[evno].method = method;
     75                events[evno].imethod = imethod;
    7676                events[evno].counter = 0;
    7777                res = EOK;
     
    8484}
    8585
    86 unative_t sys_event_subscribe(unative_t evno, unative_t method)
     86sysarg_t sys_event_subscribe(sysarg_t evno, sysarg_t imethod)
    8787{
    88         return (unative_t) event_subscribe((event_type_t) evno, (unative_t)
    89             method, &TASK->answerbox);
     88        return (sysarg_t) event_subscribe((event_type_t) evno, (sysarg_t)
     89            imethod, &TASK->answerbox);
    9090}
    9191
     
    113113                        events[i].answerbox = NULL;
    114114                        events[i].counter = 0;
    115                         events[i].method = 0;
     115                        events[i].imethod = 0;
    116116                }
    117117                spinlock_unlock(&events[i].lock);
     
    119119}
    120120
    121 void event_notify(event_type_t evno, unative_t a1, unative_t a2, unative_t a3,
    122     unative_t a4, unative_t a5)
     121void event_notify(event_type_t evno, sysarg_t a1, sysarg_t a2, sysarg_t a3,
     122    sysarg_t a4, sysarg_t a5)
    123123{
    124124        ASSERT(evno < EVENT_END);
     
    130130                        call->flags |= IPC_CALL_NOTIF;
    131131                        call->priv = ++events[evno].counter;
    132                         IPC_SET_METHOD(call->data, events[evno].method);
     132                        IPC_SET_IMETHOD(call->data, events[evno].imethod);
    133133                        IPC_SET_ARG1(call->data, a1);
    134134                        IPC_SET_ARG2(call->data, a2);
  • kernel/generic/src/ipc/ipc.c

    rcead2aa r357b5f5  
    270270 *
    271271 */
    272 void ipc_backsend_err(phone_t *phone, call_t *call, unative_t err)
     272void ipc_backsend_err(phone_t *phone, call_t *call, sysarg_t err)
    273273{
    274274        call->data.phone = phone;
     
    367367               
    368368                call_t *call = ipc_call_alloc(0);
    369                 IPC_SET_METHOD(call->data, IPC_M_PHONE_HUNGUP);
     369                IPC_SET_IMETHOD(call->data, IPC_M_PHONE_HUNGUP);
    370370                call->flags |= IPC_CALL_DISCARD_ANSWER;
    371371                _ipc_call(phone, box, call);
     
    547547                         * disconnected.
    548548                         */
    549                         IPC_SET_METHOD(call->data, IPC_M_PHONE_HUNGUP);
     549                        IPC_SET_IMETHOD(call->data, IPC_M_PHONE_HUNGUP);
    550550                        call->flags |= IPC_CALL_DISCARD_ANSWER;
    551551                        _ipc_call(phone, box, call);
     
    655655                    (call->flags & IPC_CALL_NOTIF));
    656656               
    657                 /*
    658                  * Record the receipt of this call in the current task's counter
    659                  * of active calls. IPC_M_PHONE_HUNGUP calls do not contribute
    660                  * to this counter so do not record answers to them either.
    661                  */
    662                 if (!(call->flags & IPC_CALL_DISCARD_ANSWER))
    663                         atomic_dec(&TASK->active_calls);
    664                
    665657                ipc_call_free(call);
    666658        }
     
    714706                                break;
    715707                        case IPC_PHONE_CONNECTED:
    716                                 printf("connected to: %p ",
    717                                     task->phones[i].callee);
     708                                printf("connected to: %p (%" PRIu64 ") ",
     709                                    task->phones[i].callee,
     710                                    task->phones[i].callee->task->taskid);
    718711                                break;
    719712                        case IPC_PHONE_SLAMMED:
     
    749742                    " A4:%" PRIun " A5:%" PRIun " Flags:%x\n", call,
    750743                    call->sender->taskid,
    751                     IPC_GET_METHOD(call->data), IPC_GET_ARG1(call->data),
     744                    IPC_GET_IMETHOD(call->data), IPC_GET_ARG1(call->data),
    752745                    IPC_GET_ARG2(call->data), IPC_GET_ARG3(call->data),
    753746                    IPC_GET_ARG4(call->data), IPC_GET_ARG5(call->data),
     
    765758                    " A4:%" PRIun " A5:%" PRIun " Flags:%x\n", call,
    766759                    call->sender->taskid,
    767                     IPC_GET_METHOD(call->data), IPC_GET_ARG1(call->data),
     760                    IPC_GET_IMETHOD(call->data), IPC_GET_ARG1(call->data),
    768761                    IPC_GET_ARG2(call->data), IPC_GET_ARG3(call->data),
    769762                    IPC_GET_ARG4(call->data), IPC_GET_ARG5(call->data),
     
    779772                printf("Callid:%p M:%" PRIun " A1:%" PRIun " A2:%" PRIun
    780773                    " A3:%" PRIun " A4:%" PRIun " A5:%" PRIun " Flags:%x\n",
    781                     call, IPC_GET_METHOD(call->data), IPC_GET_ARG1(call->data),
     774                    call, IPC_GET_IMETHOD(call->data), IPC_GET_ARG1(call->data),
    782775                    IPC_GET_ARG2(call->data), IPC_GET_ARG3(call->data),
    783776                    IPC_GET_ARG4(call->data), IPC_GET_ARG5(call->data),
  • kernel/generic/src/ipc/ipcrsc.c

    rcead2aa r357b5f5  
    144144 *
    145145 */
    146 call_t *get_call(unative_t callid)
     146call_t *get_call(sysarg_t callid)
    147147{
    148148        link_t *lst;
     
    153153            lst != &TASK->answerbox.dispatched_calls; lst = lst->next) {
    154154                call_t *call = list_get_instance(lst, call_t, link);
    155                 if ((unative_t) call == callid) {
     155                if ((sysarg_t) call == callid) {
    156156                        result = call;
    157157                        break;
  • kernel/generic/src/ipc/irq.c

    rcead2aa r357b5f5  
    4242 *
    4343 * The structure of a notification message is as follows:
    44  * - METHOD: method as registered by the SYS_IPC_REGISTER_IRQ syscall
     44 * - IMETHOD: interface and method as registered by the SYS_IPC_REGISTER_IRQ
     45 *            syscall
    4546 * - ARG1: payload modified by a 'top-half' handler
    4647 * - ARG2: payload modified by a 'top-half' handler
     
    4950 * - ARG5: payload modified by a 'top-half' handler
    5051 * - in_phone_hash: interrupt counter (may be needed to assure correct order
    51  *         in multithreaded drivers)
     52 *                  in multithreaded drivers)
    5253 *
    5354 * Note on synchronization for ipc_irq_register(), ipc_irq_unregister(),
     
    130131/** Register an answerbox as a receiving end for IRQ notifications.
    131132 *
    132  * @param box    Receiving answerbox.
    133  * @param inr    IRQ number.
    134  * @param devno  Device number.
    135  * @param method Method to be associated with the notification.
    136  * @param ucode  Uspace pointer to top-half pseudocode.
    137  *
    138  * @return EBADMEM, ENOENT or EEXISTS on failure or 0 on success.
     133 * @param box           Receiving answerbox.
     134 * @param inr           IRQ number.
     135 * @param devno         Device number.
     136 * @param imethod       Interface and method to be associated with the
     137 *                      notification.
     138 * @param ucode         Uspace pointer to top-half pseudocode.
     139 * @return              EOK on success or a negative error code.
    139140 *
    140141 */
    141142int ipc_irq_register(answerbox_t *box, inr_t inr, devno_t devno,
    142     unative_t method, irq_code_t *ucode)
    143 {
    144         unative_t key[] = {
    145                 (unative_t) inr,
    146                 (unative_t) devno
     143    sysarg_t imethod, irq_code_t *ucode)
     144{
     145        sysarg_t key[] = {
     146                (sysarg_t) inr,
     147                (sysarg_t) devno
    147148        };
     149
     150        if ((inr < 0) || (inr > last_inr))
     151                return ELIMIT;
    148152       
    149153        irq_code_t *code;
     
    167171        irq->notif_cfg.notify = true;
    168172        irq->notif_cfg.answerbox = box;
    169         irq->notif_cfg.method = method;
     173        irq->notif_cfg.imethod = imethod;
    170174        irq->notif_cfg.code = code;
    171175        irq->notif_cfg.counter = 0;
     
    206210/** Unregister task from IRQ notification.
    207211 *
    208  * @param box   Answerbox associated with the notification.
    209  * @param inr   IRQ number.
    210  * @param devno Device number.
    211  *
     212 * @param box           Answerbox associated with the notification.
     213 * @param inr           IRQ number.
     214 * @param devno         Device number.
     215 * @return              EOK on success or a negative error code.
    212216 */
    213217int ipc_irq_unregister(answerbox_t *box, inr_t inr, devno_t devno)
    214218{
    215         unative_t key[] = {
    216                 (unative_t) inr,
    217                 (unative_t) devno
     219        sysarg_t key[] = {
     220                (sysarg_t) inr,
     221                (sysarg_t) devno
    218222        };
     223
     224        if ((inr < 0) || (inr > last_inr))
     225                return ELIMIT;
    219226       
    220227        irq_spinlock_lock(&irq_uspace_hash_table_lock, true);
     
    290297                }
    291298               
    292                 unative_t key[2];
     299                sysarg_t key[2];
    293300                key[0] = irq->inr;
    294301                key[1] = irq->devno;
     
    397404                            (uint32_t) code->cmds[i].value);
    398405                        break;
     406                case CMD_PIO_WRITE_A_8:
     407                        if (srcarg) {
     408                                pio_write_8((ioport8_t *) code->cmds[i].addr,
     409                                    (uint8_t) scratch[srcarg]);
     410                        }
     411                        break;
     412                case CMD_PIO_WRITE_A_16:
     413                        if (srcarg) {
     414                                pio_write_16((ioport16_t *) code->cmds[i].addr,
     415                                    (uint16_t) scratch[srcarg]);
     416                        }
     417                        break;
     418                case CMD_PIO_WRITE_A_32:
     419                        if (srcarg) {
     420                                pio_write_32((ioport32_t *) code->cmds[i].addr,
     421                                    (uint32_t) scratch[srcarg]);
     422                        }
     423                        break;
    399424                case CMD_BTEST:
    400425                        if ((srcarg) && (dstarg)) {
     
    444469               
    445470                /* Set up args */
    446                 IPC_SET_METHOD(call->data, irq->notif_cfg.method);
     471                IPC_SET_IMETHOD(call->data, irq->notif_cfg.imethod);
    447472                IPC_SET_ARG1(call->data, irq->notif_cfg.scratch[1]);
    448473                IPC_SET_ARG2(call->data, irq->notif_cfg.scratch[2]);
     
    465490 *
    466491 */
    467 void ipc_irq_send_msg(irq_t *irq, unative_t a1, unative_t a2, unative_t a3,
    468     unative_t a4, unative_t a5)
     492void ipc_irq_send_msg(irq_t *irq, sysarg_t a1, sysarg_t a2, sysarg_t a3,
     493    sysarg_t a4, sysarg_t a5)
    469494{
    470495        irq_spinlock_lock(&irq->lock, true);
     
    481506                call->priv = ++irq->notif_cfg.counter;
    482507               
    483                 IPC_SET_METHOD(call->data, irq->notif_cfg.method);
     508                IPC_SET_IMETHOD(call->data, irq->notif_cfg.imethod);
    484509                IPC_SET_ARG1(call->data, a1);
    485510                IPC_SET_ARG2(call->data, a2);
  • kernel/generic/src/ipc/kbox.c

    rcead2aa r357b5f5  
    167167                        continue;  /* Try again. */
    168168               
    169                 switch (IPC_GET_METHOD(call->data)) {
     169                switch (IPC_GET_IMETHOD(call->data)) {
    170170               
    171171                case IPC_M_DEBUG_ALL:
     
    192192}
    193193
    194 
    195194/** Connect phone to a task kernel-box specified by id.
    196195 *
  • kernel/generic/src/ipc/sysipc.c

    rcead2aa r357b5f5  
    4949#include <syscall/copy.h>
    5050#include <security/cap.h>
     51#include <console/console.h>
    5152#include <mm/as.h>
    5253#include <print.h>
     
    6869 *
    6970 */
    70 static int phone_get(unative_t phoneid, phone_t **phone)
     71static int phone_get(sysarg_t phoneid, phone_t **phone)
    7172{
    7273        if (phoneid >= IPC_MAX_PHONES)
     
    7778}
    7879
    79 /** Decide if the method is a system method.
    80  *
    81  * @param method Method to be decided.
    82  *
    83  * @return true if the method is a system method.
    84  *
    85  */
    86 static inline bool method_is_system(unative_t method)
    87 {
    88         if (method <= IPC_M_LAST_SYSTEM)
     80/** Decide if the interface and method is a system method.
     81 *
     82 * @param imethod Interface and method to be decided.
     83 *
     84 * @return True if the interface and method is a system
     85 *         interface and method.
     86 *
     87 */
     88static inline bool method_is_system(sysarg_t imethod)
     89{
     90        if (imethod <= IPC_M_LAST_SYSTEM)
    8991                return true;
    9092       
     
    9294}
    9395
    94 /** Decide if the message with this method is forwardable.
    95  *
    96  * - some system messages may be forwarded, for some of them
    97  *   it is useless
    98  *
    99  * @param method Method to be decided.
    100  *
    101  * @return true if the method is forwardable.
    102  *
    103  */
    104 static inline bool method_is_forwardable(unative_t method)
    105 {
    106         switch (method) {
     96/** Decide if the message with this interface and method is forwardable.
     97 *
     98 * Some system messages may be forwarded, for some of them
     99 * it is useless.
     100 *
     101 * @param imethod Interface and method to be decided.
     102 *
     103 * @return True if the interface and method is forwardable.
     104 *
     105 */
     106static inline bool method_is_forwardable(sysarg_t imethod)
     107{
     108        switch (imethod) {
    107109        case IPC_M_CONNECTION_CLONE:
    108110        case IPC_M_CONNECT_ME:
     
    115117}
    116118
    117 /** Decide if the message with this method is immutable on forward.
    118  *
    119  * - some system messages may be forwarded but their content cannot be altered
    120  *
    121  * @param method Method to be decided.
    122  *
    123  * @return true if the method is immutable on forward.
    124  *
    125  */
    126 static inline bool method_is_immutable(unative_t method)
    127 {
    128         switch (method) {
     119/** Decide if the message with this interface and method is immutable on forward.
     120 *
     121 * Some system messages may be forwarded but their content cannot be altered.
     122 *
     123 * @param imethod Interface and method to be decided.
     124 *
     125 * @return True if the interface and method is immutable on forward.
     126 *
     127 */
     128static inline bool method_is_immutable(sysarg_t imethod)
     129{
     130        switch (imethod) {
    129131        case IPC_M_SHARE_OUT:
    130132        case IPC_M_SHARE_IN:
     
    152154static inline bool answer_need_old(call_t *call)
    153155{
    154         switch (IPC_GET_METHOD(call->data)) {
     156        switch (IPC_GET_IMETHOD(call->data)) {
    155157        case IPC_M_CONNECTION_CLONE:
    156158        case IPC_M_CONNECT_ME:
     
    196198                return 0;
    197199       
    198         if (IPC_GET_METHOD(*olddata) == IPC_M_CONNECTION_CLONE) {
     200        if (IPC_GET_IMETHOD(*olddata) == IPC_M_CONNECTION_CLONE) {
    199201                int phoneid = IPC_GET_ARG1(*olddata);
    200202                phone_t *phone = &TASK->phones[phoneid];
     
    218220                        mutex_unlock(&phone->lock);
    219221                }
    220         } else if (IPC_GET_METHOD(*olddata) == IPC_M_CONNECT_ME) {
     222        } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_CONNECT_ME) {
    221223                phone_t *phone = (phone_t *) IPC_GET_ARG5(*olddata);
    222224               
     
    237239                        mutex_unlock(&phone->lock);
    238240                }
    239         } else if (IPC_GET_METHOD(*olddata) == IPC_M_CONNECT_TO_ME) {
     241        } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_CONNECT_TO_ME) {
    240242                int phoneid = IPC_GET_ARG5(*olddata);
    241243               
     
    248250                        /* Set 'phone hash' as arg5 of response */
    249251                        IPC_SET_ARG5(answer->data,
    250                             (unative_t) &TASK->phones[phoneid]);
    251                 }
    252         } else if (IPC_GET_METHOD(*olddata) == IPC_M_CONNECT_ME_TO) {
     252                            (sysarg_t) &TASK->phones[phoneid]);
     253                }
     254        } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_CONNECT_ME_TO) {
    253255                /* If the users accepted call, connect */
    254256                if (IPC_GET_RETVAL(answer->data) == EOK) {
     
    256258                            &TASK->answerbox);
    257259                }
    258         } else if (IPC_GET_METHOD(*olddata) == IPC_M_SHARE_OUT) {
     260        } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_SHARE_OUT) {
    259261                if (!IPC_GET_RETVAL(answer->data)) {
    260262                        /* Accepted, handle as_area receipt */
     
    270272                        return rc;
    271273                }
    272         } else if (IPC_GET_METHOD(*olddata) == IPC_M_SHARE_IN) {
     274        } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_SHARE_IN) {
    273275                if (!IPC_GET_RETVAL(answer->data)) {
    274276                        irq_spinlock_lock(&answer->sender->lock, true);
     
    281283                        IPC_SET_RETVAL(answer->data, rc);
    282284                }
    283         } else if (IPC_GET_METHOD(*olddata) == IPC_M_DATA_READ) {
     285        } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_DATA_READ) {
    284286                ASSERT(!answer->buffer);
    285287                if (!IPC_GET_RETVAL(answer->data)) {
     
    310312                        }
    311313                }
    312         } else if (IPC_GET_METHOD(*olddata) == IPC_M_DATA_WRITE) {
     314        } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_DATA_WRITE) {
    313315                ASSERT(answer->buffer);
    314316                if (!IPC_GET_RETVAL(answer->data)) {
     
    363365static int request_preprocess(call_t *call, phone_t *phone)
    364366{
    365         switch (IPC_GET_METHOD(call->data)) {
     367        switch (IPC_GET_IMETHOD(call->data)) {
    366368        case IPC_M_CONNECTION_CLONE: {
    367369                phone_t *cloned_phone;
     
    399401        }
    400402        case IPC_M_CONNECT_ME:
    401                 IPC_SET_ARG5(call->data, (unative_t) phone);
     403                IPC_SET_ARG5(call->data, (sysarg_t) phone);
    402404                break;
    403405        case IPC_M_CONNECT_ME_TO: {
     
    407409               
    408410                /* Set arg5 for server */
    409                 IPC_SET_ARG5(call->data, (unative_t) &TASK->phones[newphid]);
     411                IPC_SET_ARG5(call->data, (sysarg_t) &TASK->phones[newphid]);
    410412                call->flags |= IPC_CALL_CONN_ME_TO;
    411413                call->priv = newphid;
     
    503505static int process_request(answerbox_t *box, call_t *call)
    504506{
    505         if (IPC_GET_METHOD(call->data) == IPC_M_CONNECT_TO_ME) {
     507        if (IPC_GET_IMETHOD(call->data) == IPC_M_CONNECT_TO_ME) {
    506508                int phoneid = phone_alloc(TASK);
    507509                if (phoneid < 0) { /* Failed to allocate phone */
     
    514516        }
    515517       
    516         switch (IPC_GET_METHOD(call->data)) {
     518        switch (IPC_GET_IMETHOD(call->data)) {
    517519        case IPC_M_DEBUG_ALL:
    518520                return -1;
     
    530532 *
    531533 * @param phoneid Phone handle for the call.
    532  * @param method  Method of the call.
     534 * @param imethod Interface and method of the call.
    533535 * @param arg1    Service-defined payload argument.
    534536 * @param arg2    Service-defined payload argument.
    535537 * @param arg3    Service-defined payload argument.
    536  * @param data    Address of userspace structure where the reply call will
     538 * @param data    Address of user-space structure where the reply call will
    537539 *                be stored.
    538540 *
     
    541543 *
    542544 */
    543 unative_t sys_ipc_call_sync_fast(unative_t phoneid, unative_t method,
    544     unative_t arg1, unative_t arg2, unative_t arg3, ipc_data_t *data)
     545sysarg_t sys_ipc_call_sync_fast(sysarg_t phoneid, sysarg_t imethod,
     546    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, ipc_data_t *data)
    545547{
    546548        phone_t *phone;
    547549        if (phone_get(phoneid, &phone) != EOK)
    548550                return ENOENT;
    549 
     551       
    550552        call_t *call = ipc_call_alloc(0);
    551         IPC_SET_METHOD(call->data, method);
     553        IPC_SET_IMETHOD(call->data, imethod);
    552554        IPC_SET_ARG1(call->data, arg1);
    553555        IPC_SET_ARG2(call->data, arg2);
     
    579581               
    580582                process_answer(call);
    581                
    582583        } else
    583584                IPC_SET_RETVAL(call->data, res);
     
    593594/** Make a synchronous IPC call allowing to transmit the entire payload.
    594595 *
    595  * @param phoneid  Phone handle for the call.
    596  * @param question Userspace address of call data with the request.
    597  * @param reply    Userspace address of call data where to store the
    598  *                 answer.
     596 * @param phoneid Phone handle for the call.
     597 * @param request User-space address of call data with the request.
     598 * @param reply   User-space address of call data where to store the
     599 *                answer.
    599600 *
    600601 * @return Zero on success or an error code.
    601602 *
    602603 */
    603 unative_t sys_ipc_call_sync_slow(unative_t phoneid, ipc_data_t *question,
     604sysarg_t sys_ipc_call_sync_slow(sysarg_t phoneid, ipc_data_t *request,
    604605    ipc_data_t *reply)
    605606{
     
    607608        if (phone_get(phoneid, &phone) != EOK)
    608609                return ENOENT;
    609 
     610       
    610611        call_t *call = ipc_call_alloc(0);
    611         int rc = copy_from_uspace(&call->data.args, &question->args,
     612        int rc = copy_from_uspace(&call->data.args, &request->args,
    612613            sizeof(call->data.args));
    613614        if (rc != 0) {
    614615                ipc_call_free(call);
    615                 return (unative_t) rc;
     616                return (sysarg_t) rc;
    616617        }
    617618       
     
    644645}
    645646
    646 /** Check that the task did not exceed the allowed limit of asynchronous calls.
     647/** Check that the task did not exceed the allowed limit of asynchronous calls
     648 * made over a phone.
     649 *
     650 * @param phone Phone to check the limit against.
    647651 *
    648652 * @return 0 if limit not reached or -1 if limit exceeded.
    649653 *
    650654 */
    651 static int check_call_limit(void)
    652 {
    653         if (atomic_preinc(&TASK->active_calls) > IPC_MAX_ASYNC_CALLS) {
    654                 atomic_dec(&TASK->active_calls);
     655static int check_call_limit(phone_t *phone)
     656{
     657        if (atomic_get(&phone->active_calls) >= IPC_MAX_ASYNC_CALLS)
    655658                return -1;
    656         }
    657659       
    658660        return 0;
     
    665667 *
    666668 * @param phoneid Phone handle for the call.
    667  * @param method  Method of the call.
     669 * @param imethod Interface and method of the call.
    668670 * @param arg1    Service-defined payload argument.
    669671 * @param arg2    Service-defined payload argument.
     
    677679 *
    678680 */
    679 unative_t sys_ipc_call_async_fast(unative_t phoneid, unative_t method,
    680     unative_t arg1, unative_t arg2, unative_t arg3, unative_t arg4)
    681 {
    682         if (check_call_limit())
    683                 return IPC_CALLRET_TEMPORARY;
    684        
     681sysarg_t sys_ipc_call_async_fast(sysarg_t phoneid, sysarg_t imethod,
     682    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
     683{
    685684        phone_t *phone;
    686685        if (phone_get(phoneid, &phone) != EOK)
    687686                return IPC_CALLRET_FATAL;
    688687       
     688        if (check_call_limit(phone))
     689                return IPC_CALLRET_TEMPORARY;
     690       
    689691        call_t *call = ipc_call_alloc(0);
    690         IPC_SET_METHOD(call->data, method);
     692        IPC_SET_IMETHOD(call->data, imethod);
    691693        IPC_SET_ARG1(call->data, arg1);
    692694        IPC_SET_ARG2(call->data, arg2);
     
    707709                ipc_backsend_err(phone, call, res);
    708710       
    709         return (unative_t) call;
     711        return (sysarg_t) call;
    710712}
    711713
     
    718720 *
    719721 */
    720 unative_t sys_ipc_call_async_slow(unative_t phoneid, ipc_data_t *data)
    721 {
    722         if (check_call_limit())
    723                 return IPC_CALLRET_TEMPORARY;
    724        
     722sysarg_t sys_ipc_call_async_slow(sysarg_t phoneid, ipc_data_t *data)
     723{
    725724        phone_t *phone;
    726725        if (phone_get(phoneid, &phone) != EOK)
    727726                return IPC_CALLRET_FATAL;
     727
     728        if (check_call_limit(phone))
     729                return IPC_CALLRET_TEMPORARY;
    728730
    729731        call_t *call = ipc_call_alloc(0);
     
    732734        if (rc != 0) {
    733735                ipc_call_free(call);
    734                 return (unative_t) rc;
     736                return (sysarg_t) rc;
    735737        }
    736738       
     
    742744                ipc_backsend_err(phone, call, res);
    743745       
    744         return (unative_t) call;
     746        return (sysarg_t) call;
    745747}
    746748
     
    751753 * @param callid  Hash of the call to forward.
    752754 * @param phoneid Phone handle to use for forwarding.
    753  * @param method  New method to use for the forwarded call.
     755 * @param imethod New interface and method to use for the forwarded call.
    754756 * @param arg1    New value of the first argument for the forwarded call.
    755757 * @param arg2    New value of the second argument for the forwarded call.
     
    767769 *
    768770 */
    769 static unative_t sys_ipc_forward_common(unative_t callid, unative_t phoneid,
    770     unative_t method, unative_t arg1, unative_t arg2, unative_t arg3,
    771     unative_t arg4, unative_t arg5, unsigned int mode, bool slow)
     771static sysarg_t sys_ipc_forward_common(sysarg_t callid, sysarg_t phoneid,
     772    sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3,
     773    sysarg_t arg4, sysarg_t arg5, unsigned int mode, bool slow)
    772774{
    773775        call_t *call = get_call(callid);
     
    784786        }
    785787       
    786         if (!method_is_forwardable(IPC_GET_METHOD(call->data))) {
     788        if (!method_is_forwardable(IPC_GET_IMETHOD(call->data))) {
    787789                IPC_SET_RETVAL(call->data, EFORWARD);
    788790                ipc_answer(&TASK->answerbox, call);
     
    791793       
    792794        /*
    793          * Userspace is not allowed to change method of system methods on
    794          * forward, allow changing ARG1, ARG2, ARG3 and ARG4 by means of method,
    795          * arg1, arg2 and arg3.
    796          * If the method is immutable, don't change anything.
     795         * Userspace is not allowed to change interface and method of system
     796         * methods on forward, allow changing ARG1, ARG2, ARG3 and ARG4 by
     797         * means of method, arg1, arg2 and arg3.
     798         * If the interface and method is immutable, don't change anything.
    797799         */
    798         if (!method_is_immutable(IPC_GET_METHOD(call->data))) {
    799                 if (method_is_system(IPC_GET_METHOD(call->data))) {
    800                         if (IPC_GET_METHOD(call->data) == IPC_M_CONNECT_TO_ME)
     800        if (!method_is_immutable(IPC_GET_IMETHOD(call->data))) {
     801                if (method_is_system(IPC_GET_IMETHOD(call->data))) {
     802                        if (IPC_GET_IMETHOD(call->data) == IPC_M_CONNECT_TO_ME)
    801803                                phone_dealloc(IPC_GET_ARG5(call->data));
    802804                       
    803                         IPC_SET_ARG1(call->data, method);
     805                        IPC_SET_ARG1(call->data, imethod);
    804806                        IPC_SET_ARG2(call->data, arg1);
    805807                        IPC_SET_ARG3(call->data, arg2);
     
    813815                        }
    814816                } else {
    815                         IPC_SET_METHOD(call->data, method);
     817                        IPC_SET_IMETHOD(call->data, imethod);
    816818                        IPC_SET_ARG1(call->data, arg1);
    817819                        IPC_SET_ARG2(call->data, arg2);
     
    829831/** Forward a received call to another destination - fast version.
    830832 *
    831  * In case the original method is a system method, ARG1, ARG2 and ARG3 are
    832  * overwritten in the forwarded message with the new method and the new
    833  * arg1 and arg2, respectively. Otherwise the METHOD, ARG1 and ARG2 are
    834  * rewritten with the new method, arg1 and arg2, respectively. Also note there
    835  * is a set of immutable methods, for which the new method and arguments are not
    836  * set and these values are ignored.
     833 * In case the original interface and method is a system method, ARG1, ARG2
     834 * and ARG3 are overwritten in the forwarded message with the new method and
     835 * the new arg1 and arg2, respectively. Otherwise the IMETHOD, ARG1 and ARG2
     836 * are rewritten with the new interface and method, arg1 and arg2, respectively.
     837 * Also note there is a set of immutable methods, for which the new method and
     838 * arguments are not set and these values are ignored.
    837839 *
    838840 * @param callid  Hash of the call to forward.
    839841 * @param phoneid Phone handle to use for forwarding.
    840  * @param method  New method to use for the forwarded call.
     842 * @param imethod New interface and method to use for the forwarded call.
    841843 * @param arg1    New value of the first argument for the forwarded call.
    842844 * @param arg2    New value of the second argument for the forwarded call.
     
    846848 *
    847849 */
    848 unative_t sys_ipc_forward_fast(unative_t callid, unative_t phoneid,
    849     unative_t method, unative_t arg1, unative_t arg2, unsigned int mode)
    850 {
    851         return sys_ipc_forward_common(callid, phoneid, method, arg1, arg2, 0, 0,
     850sysarg_t sys_ipc_forward_fast(sysarg_t callid, sysarg_t phoneid,
     851    sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, unsigned int mode)
     852{
     853        return sys_ipc_forward_common(callid, phoneid, imethod, arg1, arg2, 0, 0,
    852854            0, mode, false);
    853855}
     
    856858 *
    857859 * This function is the slow verision of the sys_ipc_forward_fast interface.
    858  * It can copy all five new arguments and the new method from the userspace.
    859  * It naturally extends the functionality of the fast version. For system
    860  * methods, it additionally stores the new value of arg3 to ARG4. For non-system
    861  * methods, it additionally stores the new value of arg3, arg4 and arg5,
    862  * respectively, to ARG3, ARG4 and ARG5, respectively.
     860 * It can copy all five new arguments and the new interface and method from
     861 * the userspace. It naturally extends the functionality of the fast version.
     862 * For system methods, it additionally stores the new value of arg3 to ARG4.
     863 * For non-system methods, it additionally stores the new value of arg3, arg4
     864 * and arg5, respectively, to ARG3, ARG4 and ARG5, respectively.
    863865 *
    864866 * @param callid  Hash of the call to forward.
     
    870872 *
    871873 */
    872 unative_t sys_ipc_forward_slow(unative_t callid, unative_t phoneid,
     874sysarg_t sys_ipc_forward_slow(sysarg_t callid, sysarg_t phoneid,
    873875    ipc_data_t *data, unsigned int mode)
    874876{
     
    877879            sizeof(newdata.args));
    878880        if (rc != 0)
    879                 return (unative_t) rc;
     881                return (sysarg_t) rc;
    880882       
    881883        return sys_ipc_forward_common(callid, phoneid,
    882             IPC_GET_METHOD(newdata), IPC_GET_ARG1(newdata),
     884            IPC_GET_IMETHOD(newdata), IPC_GET_ARG1(newdata),
    883885            IPC_GET_ARG2(newdata), IPC_GET_ARG3(newdata),
    884886            IPC_GET_ARG4(newdata), IPC_GET_ARG5(newdata), mode, true);
     
    900902 *
    901903 */
    902 unative_t sys_ipc_answer_fast(unative_t callid, unative_t retval,
    903     unative_t arg1, unative_t arg2, unative_t arg3, unative_t arg4)
     904sysarg_t sys_ipc_answer_fast(sysarg_t callid, sysarg_t retval,
     905    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
    904906{
    905907        /* Do not answer notification callids */
     
    945947 *
    946948 */
    947 unative_t sys_ipc_answer_slow(unative_t callid, ipc_data_t *data)
     949sysarg_t sys_ipc_answer_slow(sysarg_t callid, ipc_data_t *data)
    948950{
    949951        /* Do not answer notification callids */
     
    982984 *
    983985 */
    984 unative_t sys_ipc_hangup(unative_t phoneid)
     986sysarg_t sys_ipc_hangup(sysarg_t phoneid)
    985987{
    986988        phone_t *phone;
     
    10081010 *
    10091011 */
    1010 unative_t sys_ipc_wait_for_call(ipc_data_t *calldata, uint32_t usec,
     1012sysarg_t sys_ipc_wait_for_call(ipc_data_t *calldata, uint32_t usec,
    10111013    unsigned int flags)
    10121014{
     
    10371039                ipc_call_free(call);
    10381040               
    1039                 return ((unative_t) call) | IPC_CALLID_NOTIFICATION;
     1041                return ((sysarg_t) call) | IPC_CALLID_NOTIFICATION;
    10401042        }
    10411043       
     
    10461048                        ipc_call_free(call);
    10471049                        goto restart;
    1048                 } else {
    1049                         /*
    1050                          * Decrement the counter of active calls only if the
    1051                          * call is not an answer to IPC_M_PHONE_HUNGUP,
    1052                          * which doesn't contribute to the counter.
    1053                          */
    1054                         atomic_dec(&TASK->active_calls);
    10551050                }
    10561051               
     
    10581053                ipc_call_free(call);
    10591054               
    1060                 return ((unative_t) call) | IPC_CALLID_ANSWERED;
     1055                return ((sysarg_t) call) | IPC_CALLID_ANSWERED;
    10611056        }
    10621057       
     
    10861081        }
    10871082       
    1088         return (unative_t) call;
     1083        return (sysarg_t) call;
    10891084}
    10901085
     
    10921087 *
    10931088 */
    1094 unative_t sys_ipc_poke(void)
     1089sysarg_t sys_ipc_poke(void)
    10951090{
    10961091        waitq_unsleep(&TASK->answerbox.wq);
     
    11001095/** Connect an IRQ handler to a task.
    11011096 *
    1102  * @param inr    IRQ number.
    1103  * @param devno  Device number.
    1104  * @param method Method to be associated with the notification.
    1105  * @param ucode  Uspace pointer to the top-half pseudocode.
     1097 * @param inr     IRQ number.
     1098 * @param devno   Device number.
     1099 * @param imethod Interface and method to be associated with the notification.
     1100 * @param ucode   Uspace pointer to the top-half pseudocode.
    11061101 *
    11071102 * @return EPERM or a return code returned by ipc_irq_register().
    11081103 *
    11091104 */
    1110 unative_t sys_ipc_register_irq(inr_t inr, devno_t devno, unative_t method,
     1105sysarg_t sys_ipc_register_irq(inr_t inr, devno_t devno, sysarg_t imethod,
    11111106    irq_code_t *ucode)
    11121107{
     
    11141109                return EPERM;
    11151110       
    1116         return ipc_irq_register(&TASK->answerbox, inr, devno, method, ucode);
     1111        return ipc_irq_register(&TASK->answerbox, inr, devno, imethod, ucode);
    11171112}
    11181113
     
    11251120 *
    11261121 */
    1127 unative_t sys_ipc_unregister_irq(inr_t inr, devno_t devno)
     1122sysarg_t sys_ipc_unregister_irq(inr_t inr, devno_t devno)
    11281123{
    11291124        if (!(cap_get(TASK) & CAP_IRQ_REG))
     
    11351130}
    11361131
    1137 #include <console/console.h>
    1138 
    1139 /** Syscall connect to a task by id.
     1132#ifdef __32_BITS__
     1133
     1134/** Syscall connect to a task by ID (32 bits)
    11401135 *
    11411136 * @return Phone id on success, or negative error code.
    11421137 *
    11431138 */
    1144 unative_t sys_ipc_connect_kbox(sysarg64_t *uspace_taskid_arg)
     1139sysarg_t sys_ipc_connect_kbox(sysarg64_t *uspace_taskid)
    11451140{
    11461141#ifdef CONFIG_UDEBUG
    1147         sysarg64_t taskid_arg;
    1148         int rc = copy_from_uspace(&taskid_arg, uspace_taskid_arg, sizeof(sysarg64_t));
     1142        sysarg64_t taskid;
     1143        int rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(sysarg64_t));
    11491144        if (rc != 0)
    1150                 return (unative_t) rc;
    1151        
    1152         LOG("sys_ipc_connect_kbox(%" PRIu64 ")", taskid_arg.value);
    1153        
    1154         return ipc_connect_kbox(taskid_arg.value);
     1145                return (sysarg_t) rc;
     1146       
     1147        return ipc_connect_kbox((task_id_t) taskid);
    11551148#else
    1156         return (unative_t) ENOTSUP;
     1149        return (sysarg_t) ENOTSUP;
    11571150#endif
    11581151}
    11591152
     1153#endif  /* __32_BITS__ */
     1154
     1155#ifdef __64_BITS__
     1156
     1157/** Syscall connect to a task by ID (64 bits)
     1158 *
     1159 * @return Phone id on success, or negative error code.
     1160 *
     1161 */
     1162sysarg_t sys_ipc_connect_kbox(sysarg_t taskid)
     1163{
     1164#ifdef CONFIG_UDEBUG
     1165        return ipc_connect_kbox((task_id_t) taskid);
     1166#else
     1167        return (sysarg_t) ENOTSUP;
     1168#endif
     1169}
     1170
     1171#endif  /* __64_BITS__ */
     1172
    11601173/** @}
    11611174 */
  • kernel/generic/src/lib/memstr.c

    rcead2aa r357b5f5  
    6262        unsigned int i, j;
    6363       
    64         if (ALIGN_UP((uintptr_t) src, sizeof(unative_t)) != (uintptr_t) src ||
    65             ALIGN_UP((uintptr_t) dst, sizeof(unative_t)) != (uintptr_t) dst) {
     64        if (ALIGN_UP((uintptr_t) src, sizeof(sysarg_t)) != (uintptr_t) src ||
     65            ALIGN_UP((uintptr_t) dst, sizeof(sysarg_t)) != (uintptr_t) dst) {
    6666                for (i = 0; i < cnt; i++)
    6767                        ((uint8_t *) dst)[i] = ((uint8_t *) src)[i];
    6868        } else {
    69                 for (i = 0; i < cnt / sizeof(unative_t); i++)
    70                         ((unative_t *) dst)[i] = ((unative_t *) src)[i];
     69                for (i = 0; i < cnt / sizeof(sysarg_t); i++)
     70                        ((sysarg_t *) dst)[i] = ((sysarg_t *) src)[i];
    7171               
    72                 for (j = 0; j < cnt % sizeof(unative_t); j++)
    73                         ((uint8_t *)(((unative_t *) dst) + i))[j] =
    74                             ((uint8_t *)(((unative_t *) src) + i))[j];
     72                for (j = 0; j < cnt % sizeof(sysarg_t); j++)
     73                        ((uint8_t *)(((sysarg_t *) dst) + i))[j] =
     74                            ((uint8_t *)(((sysarg_t *) src) + i))[j];
    7575        }
    7676               
  • kernel/generic/src/lib/rd.c

    rcead2aa r357b5f5  
    9696        sysinfo_set_item_val("rd.size", NULL, dsize);
    9797        sysinfo_set_item_val("rd.address.physical", NULL,
    98             (unative_t) KA2PA((void *) header + hsize));
     98            (sysarg_t) KA2PA((void *) header + hsize));
    9999
    100100        return RE_OK;
  • kernel/generic/src/main/main.c

    rcead2aa r357b5f5  
    185185        LOG("\nconfig.base=%p config.kernel_size=%zu"
    186186            "\nconfig.stack_base=%p config.stack_size=%zu",
    187             config.base, config.kernel_size, config.stack_base,
    188             config.stack_size);
     187            (void *) config.base, config.kernel_size,
     188            (void *) config.stack_base, config.stack_size);
    189189       
    190190#ifdef CONFIG_KCONSOLE
     
    242242                for (i = 0; i < init.cnt; i++)
    243243                        LOG("init[%zu].addr=%p, init[%zu].size=%zu",
    244                             i, init.tasks[i].addr, i, init.tasks[i].size);
     244                            i, (void *) init.tasks[i].addr, i, init.tasks[i].size);
    245245        } else
    246246                printf("No init binaries found.\n");
  • kernel/generic/src/mm/as.c

    rcead2aa r357b5f5  
    20002000
    20012001/** Wrapper for as_area_create(). */
    2002 unative_t sys_as_area_create(uintptr_t address, size_t size, unsigned int flags)
     2002sysarg_t sys_as_area_create(uintptr_t address, size_t size, unsigned int flags)
    20032003{
    20042004        if (as_area_create(AS, flags | AS_AREA_CACHEABLE, size, address,
    20052005            AS_AREA_ATTR_NONE, &anon_backend, NULL))
    2006                 return (unative_t) address;
     2006                return (sysarg_t) address;
    20072007        else
    2008                 return (unative_t) -1;
     2008                return (sysarg_t) -1;
    20092009}
    20102010
    20112011/** Wrapper for as_area_resize(). */
    2012 unative_t sys_as_area_resize(uintptr_t address, size_t size, unsigned int flags)
    2013 {
    2014         return (unative_t) as_area_resize(AS, address, size, 0);
     2012sysarg_t sys_as_area_resize(uintptr_t address, size_t size, unsigned int flags)
     2013{
     2014        return (sysarg_t) as_area_resize(AS, address, size, 0);
    20152015}
    20162016
    20172017/** Wrapper for as_area_change_flags(). */
    2018 unative_t sys_as_area_change_flags(uintptr_t address, unsigned int flags)
    2019 {
    2020         return (unative_t) as_area_change_flags(AS, flags, address);
     2018sysarg_t sys_as_area_change_flags(uintptr_t address, unsigned int flags)
     2019{
     2020        return (sysarg_t) as_area_change_flags(AS, flags, address);
    20212021}
    20222022
    20232023/** Wrapper for as_area_destroy(). */
    2024 unative_t sys_as_area_destroy(uintptr_t address)
    2025 {
    2026         return (unative_t) as_area_destroy(AS, address);
     2024sysarg_t sys_as_area_destroy(uintptr_t address)
     2025{
     2026        return (sysarg_t) as_area_destroy(AS, address);
    20272027}
    20282028
  • kernel/generic/src/mm/slab.c

    rcead2aa r357b5f5  
    612612        cache->name = name;
    613613       
    614         if (align < sizeof(unative_t))
    615                 align = sizeof(unative_t);
     614        if (align < sizeof(sysarg_t))
     615                align = sizeof(sysarg_t);
    616616       
    617617        size = ALIGN_UP(size, align);
     
    806806}
    807807
    808 /** Go through all caches and reclaim what is possible
    809  *
    810  * Interrupts must be disabled before calling this function,
    811  * otherwise  memory allocation from interrupts can deadlock.
    812  *
    813  */
     808/** Go through all caches and reclaim what is possible */
    814809size_t slab_reclaim(unsigned int flags)
    815810{
    816         irq_spinlock_lock(&slab_cache_lock, false);
     811        irq_spinlock_lock(&slab_cache_lock, true);
    817812       
    818813        size_t frames = 0;
     
    824819        }
    825820       
    826         irq_spinlock_unlock(&slab_cache_lock, false);
     821        irq_spinlock_unlock(&slab_cache_lock, true);
    827822       
    828823        return frames;
  • kernel/generic/src/proc/program.c

    rcead2aa r357b5f5  
    210210 *
    211211 */
    212 unative_t sys_program_spawn_loader(char *uspace_name, size_t name_len)
     212sysarg_t sys_program_spawn_loader(char *uspace_name, size_t name_len)
    213213{
    214214        /* Cap length of name and copy it from userspace. */
     
    219219        int rc = copy_from_uspace(namebuf, uspace_name, name_len);
    220220        if (rc != 0)
    221                 return (unative_t) rc;
     221                return (sysarg_t) rc;
    222222       
    223223        namebuf[name_len] = 0;
  • kernel/generic/src/proc/task.c

    rcead2aa r357b5f5  
    151151        atomic_set(&task->refcount, 0);
    152152        atomic_set(&task->lifecount, 0);
    153         atomic_set(&task->active_calls, 0);
    154153       
    155154        irq_spinlock_initialize(&task->lock, "task_t_lock");
     
    291290}
    292291
    293 /** Syscall for reading task ID from userspace.
    294  *
    295  * @param uspace_task_id Userspace address of 8-byte buffer
    296  *                       where to store current task ID.
     292#ifdef __32_BITS__
     293
     294/** Syscall for reading task ID from userspace (32 bits)
     295 *
     296 * @param uspace_taskid Pointer to user-space buffer
     297 *                      where to store current task ID.
    297298 *
    298299 * @return Zero on success or an error code from @ref errno.h.
    299300 *
    300301 */
    301 unative_t sys_task_get_id(task_id_t *uspace_task_id)
     302sysarg_t sys_task_get_id(sysarg64_t *uspace_taskid)
    302303{
    303304        /*
     
    305306         * the lifespan of the task.
    306307         */
    307         return (unative_t) copy_to_uspace(uspace_task_id, &TASK->taskid,
     308        return (sysarg_t) copy_to_uspace(uspace_taskid, &TASK->taskid,
    308309            sizeof(TASK->taskid));
    309310}
     311
     312#endif  /* __32_BITS__ */
     313
     314#ifdef __64_BITS__
     315
     316/** Syscall for reading task ID from userspace (64 bits)
     317 *
     318 * @return Current task ID.
     319 *
     320 */
     321sysarg_t sys_task_get_id(void)
     322{
     323        /*
     324         * No need to acquire lock on TASK because taskid remains constant for
     325         * the lifespan of the task.
     326         */
     327        return TASK->taskid;
     328}
     329
     330#endif  /* __64_BITS__ */
    310331
    311332/** Syscall for setting the task name.
     
    319340 *
    320341 */
    321 unative_t sys_task_set_name(const char *uspace_name, size_t name_len)
     342sysarg_t sys_task_set_name(const char *uspace_name, size_t name_len)
    322343{
    323344        int rc;
     
    331352        rc = copy_from_uspace(namebuf, uspace_name, name_len);
    332353        if (rc != 0)
    333                 return (unative_t) rc;
     354                return (sysarg_t) rc;
    334355       
    335356        namebuf[name_len] = '\0';
     
    337358       
    338359        return EOK;
     360}
     361
     362/** Syscall to forcefully terminate a task
     363 *
     364 * @param uspace_taskid Pointer to task ID in user space.
     365 *
     366 * @return 0 on success or an error code from @ref errno.h.
     367 *
     368 */
     369sysarg_t sys_task_kill(task_id_t *uspace_taskid)
     370{
     371        task_id_t taskid;
     372        int rc;
     373
     374        rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(taskid));
     375        if (rc != 0)
     376                return (sysarg_t) rc;
     377
     378        return (sysarg_t) task_kill(taskid);
    339379}
    340380
     
    478518#ifdef __32_BITS__
    479519        if (*additional)
    480                 printf("%-8" PRIu64 " %9" PRIua " %7" PRIua, task->taskid,
    481                     atomic_get(&task->refcount), atomic_get(&task->active_calls));
     520                printf("%-8" PRIu64 " %9" PRIua, task->taskid,
     521                    atomic_get(&task->refcount));
    482522        else
    483523                printf("%-8" PRIu64 " %-14s %-5" PRIu32 " %10p %10p"
     
    490530        if (*additional)
    491531                printf("%-8" PRIu64 " %9" PRIu64 "%c %9" PRIu64 "%c "
    492                     "%9" PRIua " %7" PRIua,
    493                     task->taskid, ucycles, usuffix, kcycles, ksuffix,
    494                     atomic_get(&task->refcount), atomic_get(&task->active_calls));
     532                    "%9" PRIua, task->taskid, ucycles, usuffix, kcycles,
     533                    ksuffix, atomic_get(&task->refcount));
    495534        else
    496535                printf("%-8" PRIu64 " %-14s %-5" PRIu32 " %18p %18p\n",
  • kernel/generic/src/proc/thread.c

    rcead2aa r357b5f5  
    755755 *
    756756 */
    757 unative_t sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name,
     757sysarg_t sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name,
    758758    size_t name_len, thread_id_t *uspace_thread_id)
    759759{
     
    764764        int rc = copy_from_uspace(namebuf, uspace_name, name_len);
    765765        if (rc != 0)
    766                 return (unative_t) rc;
     766                return (sysarg_t) rc;
    767767       
    768768        namebuf[name_len] = 0;
     
    779779        if (rc != 0) {
    780780                free(kernel_uarg);
    781                 return (unative_t) rc;
     781                return (sysarg_t) rc;
    782782        }
    783783       
     
    804804                                free(kernel_uarg);
    805805                               
    806                                 return (unative_t) rc;
     806                                return (sysarg_t) rc;
    807807                         }
    808808                }
     
    827827                free(kernel_uarg);
    828828       
    829         return (unative_t) ENOMEM;
     829        return (sysarg_t) ENOMEM;
    830830}
    831831
     
    833833 *
    834834 */
    835 unative_t sys_thread_exit(int uspace_status)
     835sysarg_t sys_thread_exit(int uspace_status)
    836836{
    837837        thread_exit();
     
    849849 *
    850850 */
    851 unative_t sys_thread_get_id(thread_id_t *uspace_thread_id)
     851sysarg_t sys_thread_get_id(thread_id_t *uspace_thread_id)
    852852{
    853853        /*
     
    856856         *
    857857         */
    858         return (unative_t) copy_to_uspace(uspace_thread_id, &THREAD->tid,
     858        return (sysarg_t) copy_to_uspace(uspace_thread_id, &THREAD->tid,
    859859            sizeof(THREAD->tid));
    860860}
    861861
    862862/** Syscall wrapper for sleeping. */
    863 unative_t sys_thread_usleep(uint32_t usec)
     863sysarg_t sys_thread_usleep(uint32_t usec)
    864864{
    865865        thread_usleep(usec);
  • kernel/generic/src/security/cap.c

    rcead2aa r357b5f5  
    4141#include <proc/task.h>
    4242#include <synch/spinlock.h>
    43 #include <syscall/sysarg64.h>
    4443#include <syscall/copy.h>
    4544#include <arch.h>
     
    7978 * The calling task must have the CAP_CAP capability.
    8079 *
    81  * @param uspace_taskid_arg Userspace structure holding destination task ID.
    82  * @param caps Capabilities to grant.
    83  *
    84  * @return Zero on success or an error code from @ref errno.h.
    85  *
    86  */
    87 unative_t sys_cap_grant(sysarg64_t *uspace_taskid_arg, cap_t caps)
     80 * @param taskid Destination task ID.
     81 * @param caps   Capabilities to grant.
     82 *
     83 * @return Zero on success or an error code from @ref errno.h.
     84 *
     85 */
     86static sysarg_t cap_grant(task_id_t taskid, cap_t caps)
    8887{
    8988        if (!(cap_get(TASK) & CAP_CAP))
    90                 return (unative_t) EPERM;
    91        
    92         sysarg64_t taskid_arg;
    93         int rc = copy_from_uspace(&taskid_arg, uspace_taskid_arg, sizeof(sysarg64_t));
    94         if (rc != 0)
    95                 return (unative_t) rc;
     89                return (sysarg_t) EPERM;
    9690       
    9791        irq_spinlock_lock(&tasks_lock, true);
    98         task_t *task = task_find_by_id((task_id_t) taskid_arg.value);
     92        task_t *task = task_find_by_id(taskid);
    9993       
    10094        if ((!task) || (!context_check(CONTEXT, task->context))) {
    10195                irq_spinlock_unlock(&tasks_lock, true);
    102                 return (unative_t) ENOENT;
     96                return (sysarg_t) ENOENT;
    10397        }
    10498       
     
    116110 * attempt to revoke capabilities from itself.
    117111 *
    118  * @param uspace_taskid_arg Userspace structure holding destination task ID.
    119  * @param caps Capabilities to revoke.
    120  *
    121  * @return Zero on success or an error code from @ref errno.h.
    122  *
    123  */
    124 unative_t sys_cap_revoke(sysarg64_t *uspace_taskid_arg, cap_t caps)
    125 {
    126         sysarg64_t taskid_arg;
    127         int rc = copy_from_uspace(&taskid_arg, uspace_taskid_arg, sizeof(sysarg64_t));
    128         if (rc != 0)
    129                 return (unative_t) rc;
    130        
     112 * @param taskid Destination task ID.
     113 * @param caps   Capabilities to revoke.
     114 *
     115 * @return Zero on success or an error code from @ref errno.h.
     116 *
     117 */
     118static sysarg_t cap_revoke(task_id_t taskid, cap_t caps)
     119{
    131120        irq_spinlock_lock(&tasks_lock, true);
    132121       
    133         task_t *task = task_find_by_id((task_id_t) taskid_arg.value);
     122        task_t *task = task_find_by_id(taskid);
    134123        if ((!task) || (!context_check(CONTEXT, task->context))) {
    135124                irq_spinlock_unlock(&tasks_lock, true);
    136                 return (unative_t) ENOENT;
     125                return (sysarg_t) ENOENT;
    137126        }
    138127       
     
    147136                irq_spinlock_unlock(&TASK->lock, false);
    148137                irq_spinlock_unlock(&tasks_lock, true);
    149                 return (unative_t) EPERM;
     138                return (sysarg_t) EPERM;
    150139        }
    151140       
     
    157146}
    158147
     148#ifdef __32_BITS__
     149
     150/** Grant capabilities to a task (32 bits)
     151 *
     152 * The calling task must have the CAP_CAP capability.
     153 *
     154 * @param uspace_taskid User-space pointer to destination task ID.
     155 * @param caps          Capabilities to grant.
     156 *
     157 * @return Zero on success or an error code from @ref errno.h.
     158 *
     159 */
     160sysarg_t sys_cap_grant(sysarg64_t *uspace_taskid, cap_t caps)
     161{
     162        sysarg64_t taskid;
     163        int rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(sysarg64_t));
     164        if (rc != 0)
     165                return (sysarg_t) rc;
     166       
     167        return cap_grant((task_id_t) taskid, caps);
     168}
     169
     170/** Revoke capabilities from a task (32 bits)
     171 *
     172 * The calling task must have the CAP_CAP capability or the caller must
     173 * attempt to revoke capabilities from itself.
     174 *
     175 * @param uspace_taskid User-space pointer to destination task ID.
     176 * @param caps          Capabilities to revoke.
     177 *
     178 * @return Zero on success or an error code from @ref errno.h.
     179 *
     180 */
     181sysarg_t sys_cap_revoke(sysarg64_t *uspace_taskid, cap_t caps)
     182{
     183        sysarg64_t taskid;
     184        int rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(sysarg64_t));
     185        if (rc != 0)
     186                return (sysarg_t) rc;
     187       
     188        return cap_revoke((task_id_t) taskid, caps);
     189}
     190
     191#endif  /* __32_BITS__ */
     192
     193#ifdef __64_BITS__
     194
     195/** Grant capabilities to a task (64 bits)
     196 *
     197 * The calling task must have the CAP_CAP capability.
     198 *
     199 * @param taskid Destination task ID.
     200 * @param caps   Capabilities to grant.
     201 *
     202 * @return Zero on success or an error code from @ref errno.h.
     203 *
     204 */
     205sysarg_t sys_cap_grant(sysarg_t taskid, cap_t caps)
     206{
     207        return cap_grant((task_id_t) taskid, caps);
     208}
     209
     210/** Revoke capabilities from a task (64 bits)
     211 *
     212 * The calling task must have the CAP_CAP capability or the caller must
     213 * attempt to revoke capabilities from itself.
     214 *
     215 * @param taskid Destination task ID.
     216 * @param caps   Capabilities to revoke.
     217 *
     218 * @return Zero on success or an error code from @ref errno.h.
     219 *
     220 */
     221sysarg_t sys_cap_revoke(sysarg_t taskid, cap_t caps)
     222{
     223        return cap_revoke((task_id_t) taskid, caps);
     224}
     225
     226#endif  /* __64_BITS__ */
     227
    159228/** @}
    160229 */
  • kernel/generic/src/synch/futex.c

    rcead2aa r357b5f5  
    6060
    6161static futex_t *futex_find(uintptr_t paddr);
    62 static size_t futex_ht_hash(unative_t *key);
    63 static bool futex_ht_compare(unative_t *key, size_t keys, link_t *item);
     62static size_t futex_ht_hash(sysarg_t *key);
     63static bool futex_ht_compare(sysarg_t *key, size_t keys, link_t *item);
    6464static void futex_ht_remove_callback(link_t *item);
    6565
     
    108108 *                      synch.h.
    109109 */
    110 unative_t sys_futex_sleep(uintptr_t uaddr)
     110sysarg_t sys_futex_sleep(uintptr_t uaddr)
    111111{
    112112        futex_t *futex;
     
    122122        if (!t || !PTE_VALID(t) || !PTE_PRESENT(t)) {
    123123                page_table_unlock(AS, true);
    124                 return (unative_t) ENOENT;
     124                return (sysarg_t) ENOENT;
    125125        }
    126126        paddr = PTE_GET_FRAME(t) + (uaddr - ALIGN_DOWN(uaddr, PAGE_SIZE));
     
    136136        udebug_stoppable_end();
    137137#endif
    138         return (unative_t) rc;
     138        return (sysarg_t) rc;
    139139}
    140140
     
    145145 * @return              ENOENT if there is no physical mapping for uaddr.
    146146 */
    147 unative_t sys_futex_wakeup(uintptr_t uaddr)
     147sysarg_t sys_futex_wakeup(uintptr_t uaddr)
    148148{
    149149        futex_t *futex;
     
    158158        if (!t || !PTE_VALID(t) || !PTE_PRESENT(t)) {
    159159                page_table_unlock(AS, true);
    160                 return (unative_t) ENOENT;
     160                return (sysarg_t) ENOENT;
    161161        }
    162162        paddr = PTE_GET_FRAME(t) + (uaddr - ALIGN_DOWN(uaddr, PAGE_SIZE));
     
    235235 * @return              Index into futex hash table.
    236236 */
    237 size_t futex_ht_hash(unative_t *key)
     237size_t futex_ht_hash(sysarg_t *key)
    238238{
    239239        return (*key & (FUTEX_HT_SIZE - 1));
     
    247247 * @return              True if the item matches the key. False otherwise.
    248248 */
    249 bool futex_ht_compare(unative_t *key, size_t keys, link_t *item)
     249bool futex_ht_compare(sysarg_t *key, size_t keys, link_t *item)
    250250{
    251251        futex_t *futex;
  • kernel/generic/src/synch/smc.c

    rcead2aa r357b5f5  
    4242#include <synch/smc.h>
    4343
    44 unative_t sys_smc_coherence(uintptr_t va, size_t size)
     44sysarg_t sys_smc_coherence(uintptr_t va, size_t size)
    4545{
    4646        if (overlaps(va, size, (uintptr_t) NULL, PAGE_SIZE))
  • kernel/generic/src/syscall/syscall.c

    rcead2aa r357b5f5  
    4545#include <debug.h>
    4646#include <ddi/device.h>
     47#include <interrupt.h>
    4748#include <ipc/sysipc.h>
    4849#include <synch/futex.h>
     
    5657
    5758/** Dispatch system call */
    58 unative_t syscall_handler(unative_t a1, unative_t a2, unative_t a3,
    59     unative_t a4, unative_t a5, unative_t a6, unative_t id)
     59sysarg_t syscall_handler(sysarg_t a1, sysarg_t a2, sysarg_t a3,
     60    sysarg_t a4, sysarg_t a5, sysarg_t a6, sysarg_t id)
    6061{
    6162        /* Do userpace accounting */
     
    6667#ifdef CONFIG_UDEBUG
    6768        /*
     69         * An istate_t-compatible record was created on the stack by the
     70         * low-level syscall handler. This is the userspace space state
     71         * structure.
     72         */
     73        THREAD->udebug.uspace_state = istate_get(THREAD);
     74
     75        /*
    6876         * Early check for undebugged tasks. We do not lock anything as this
    6977         * test need not be precise in either direction.
    70          *
    7178         */
    7279        if (THREAD->udebug.active)
     
    7481#endif
    7582       
    76         unative_t rc;
     83        sysarg_t rc;
    7784        if (id < SYSCALL_END) {
    7885                rc = syscall_table[id](a1, a2, a3, a4, a5, a6);
     
    98105                udebug_stoppable_end();
    99106        }
     107
     108        /* Clear userspace state pointer */
     109        THREAD->udebug.uspace_state = NULL;
    100110#endif
    101111       
     
    120130        (syshandler_t) sys_task_get_id,
    121131        (syshandler_t) sys_task_set_name,
     132        (syshandler_t) sys_task_kill,
    122133        (syshandler_t) sys_program_spawn_loader,
    123134       
     
    147158        (syshandler_t) sys_ipc_register_irq,
    148159        (syshandler_t) sys_ipc_unregister_irq,
     160        (syshandler_t) sys_ipc_connect_kbox,
    149161       
    150162        /* Event notification syscalls. */
     
    159171        (syshandler_t) sys_physmem_map,
    160172        (syshandler_t) sys_iospace_enable,
    161         (syshandler_t) sys_interrupt_enable,
    162173       
    163174        /* Sysinfo syscalls */
     
    169180        /* Debug calls */
    170181        (syshandler_t) sys_debug_enable_console,
    171         (syshandler_t) sys_debug_disable_console,
    172        
    173         (syshandler_t) sys_ipc_connect_kbox
     182        (syshandler_t) sys_debug_disable_console
    174183};
    175184
  • kernel/generic/src/sysinfo/stats.c

    rcead2aa r357b5f5  
    8787 *
    8888 */
    89 static unative_t get_stats_uptime(struct sysinfo_item *item)
     89static sysarg_t get_stats_uptime(struct sysinfo_item *item)
    9090{
    9191        /* This doesn't have to be very accurate */
  • kernel/generic/src/sysinfo/sysinfo.c

    rcead2aa r357b5f5  
    296296 */
    297297void sysinfo_set_item_val(const char *name, sysinfo_item_t **root,
    298     unative_t val)
     298    sysarg_t val)
    299299{
    300300        /* Protect sysinfo tree consistency */
     
    481481                sysinfo_indent(depth);
    482482               
    483                 unative_t val;
     483                sysarg_t val;
    484484                size_t size;
    485485               
     
    660660 *
    661661 */
    662 unative_t sys_sysinfo_get_tag(void *path_ptr, size_t path_size)
     662sysarg_t sys_sysinfo_get_tag(void *path_ptr, size_t path_size)
    663663{
    664664        /*
     
    679679                ret.tag = SYSINFO_VAL_DATA;
    680680       
    681         return (unative_t) ret.tag;
     681        return (sysarg_t) ret.tag;
    682682}
    683683
     
    696696 *
    697697 */
    698 unative_t sys_sysinfo_get_value(void *path_ptr, size_t path_size,
     698sysarg_t sys_sysinfo_get_value(void *path_ptr, size_t path_size,
    699699    void *value_ptr)
    700700{
     
    715715                rc = EINVAL;
    716716       
    717         return (unative_t) rc;
     717        return (sysarg_t) rc;
    718718}
    719719
     
    732732 *
    733733 */
    734 unative_t sys_sysinfo_get_data_size(void *path_ptr, size_t path_size,
     734sysarg_t sys_sysinfo_get_data_size(void *path_ptr, size_t path_size,
    735735    void *size_ptr)
    736736{
     
    752752                rc = EINVAL;
    753753       
    754         return (unative_t) rc;
     754        return (sysarg_t) rc;
    755755}
    756756
     
    774774 *
    775775 */
    776 unative_t sys_sysinfo_get_data(void *path_ptr, size_t path_size,
     776sysarg_t sys_sysinfo_get_data(void *path_ptr, size_t path_size,
    777777    void *buffer_ptr, size_t buffer_size)
    778778{
     
    797797                free(ret.data.data);
    798798       
    799         return (unative_t) rc;
     799        return (sysarg_t) rc;
    800800}
    801801
  • kernel/generic/src/time/clock.c

    rcead2aa r357b5f5  
    7070 *
    7171 */
    72 static unative_t secfrag = 0;
     72static sysarg_t secfrag = 0;
    7373
    7474/** Initialize realtime clock counter
     
    100100         *
    101101         */
    102         sysinfo_set_item_val("clock.cacheable", NULL, (unative_t) true);
    103         sysinfo_set_item_val("clock.faddr", NULL, (unative_t) faddr);
     102        sysinfo_set_item_val("clock.cacheable", NULL, (sysarg_t) true);
     103        sysinfo_set_item_val("clock.faddr", NULL, (sysarg_t) faddr);
    104104}
    105105
  • kernel/generic/src/udebug/udebug.c

    rcead2aa r357b5f5  
    219219 *
    220220 */
    221 void udebug_syscall_event(unative_t a1, unative_t a2, unative_t a3,
    222     unative_t a4, unative_t a5, unative_t a6, unative_t id, unative_t rc,
     221void udebug_syscall_event(sysarg_t a1, sysarg_t a2, sysarg_t a3,
     222    sysarg_t a4, sysarg_t a5, sysarg_t a6, sysarg_t id, sysarg_t rc,
    223223    bool end_variant)
    224224{
     
    314314        IPC_SET_RETVAL(call->data, 0);
    315315        IPC_SET_ARG1(call->data, UDEBUG_EVENT_THREAD_B);
    316         IPC_SET_ARG2(call->data, (unative_t) thread);
     316        IPC_SET_ARG2(call->data, (sysarg_t) thread);
    317317       
    318318        /*
  • kernel/generic/src/udebug/udebug_ipc.c

    rcead2aa r357b5f5  
    210210static void udebug_receive_name_read(call_t *call)
    211211{
    212         unative_t uspace_addr;
    213         unative_t to_copy;
     212        sysarg_t uspace_addr;
     213        sysarg_t to_copy;
    214214        size_t data_size;
    215215        size_t buf_size;
     
    257257static void udebug_receive_areas_read(call_t *call)
    258258{
    259         unative_t uspace_addr;
    260         unative_t to_copy;
     259        sysarg_t uspace_addr;
     260        sysarg_t to_copy;
    261261        size_t data_size;
    262262        size_t buf_size;
     
    304304{
    305305        thread_t *t;
    306         unative_t uspace_addr;
     306        sysarg_t uspace_addr;
    307307        int rc;
    308308        void *buffer;
     
    328328           (no way to distinguish method in answer) */
    329329        IPC_SET_ARG1(call->data, uspace_addr);
    330         IPC_SET_ARG2(call->data, 6 * sizeof(unative_t));
     330        IPC_SET_ARG2(call->data, 6 * sizeof(sysarg_t));
    331331        call->buffer = buffer;
    332332
     
    341341{
    342342        thread_t *t;
    343         unative_t uspace_addr;
    344         unative_t to_copy;
     343        sysarg_t uspace_addr;
     344        sysarg_t to_copy;
    345345        void *buffer;
    346346        int rc;
     
    382382static void udebug_receive_mem_read(call_t *call)
    383383{
    384         unative_t uspace_dst;
    385         unative_t uspace_src;
     384        sysarg_t uspace_dst;
     385        sysarg_t uspace_src;
    386386        unsigned size;
    387387        void *buffer;
  • kernel/generic/src/udebug/udebug_ops.c

    rcead2aa r357b5f5  
    371371       
    372372        /* Allocate a buffer to hold thread IDs */
    373         unative_t *id_buffer = malloc(buf_size + 1, 0);
     373        sysarg_t *id_buffer = malloc(buf_size + 1, 0);
    374374       
    375375        mutex_lock(&TASK->udebug.lock);
     
    385385        /* Copy down the thread IDs */
    386386       
    387         size_t max_ids = buf_size / sizeof(unative_t);
     387        size_t max_ids = buf_size / sizeof(sysarg_t);
    388388        size_t copied_ids = 0;
    389389        size_t extra_ids = 0;
     
    404404                if (copied_ids < max_ids) {
    405405                        /* Using thread struct pointer as identification hash */
    406                         id_buffer[copied_ids++] = (unative_t) thread;
     406                        id_buffer[copied_ids++] = (sysarg_t) thread;
    407407                } else
    408408                        extra_ids++;
     
    414414       
    415415        *buffer = id_buffer;
    416         *stored = copied_ids * sizeof(unative_t);
    417         *needed = (copied_ids + extra_ids) * sizeof(unative_t);
     416        *stored = copied_ids * sizeof(sysarg_t);
     417        *needed = (copied_ids + extra_ids) * sizeof(sysarg_t);
    418418       
    419419        return 0;
     
    463463{
    464464        /* Prepare a buffer to hold the arguments. */
    465         unative_t *arg_buffer = malloc(6 * sizeof(unative_t), 0);
     465        sysarg_t *arg_buffer = malloc(6 * sizeof(sysarg_t), 0);
    466466       
    467467        /* On success, this will lock t->udebug.lock. */
     
    478478       
    479479        /* Copy to a local buffer before releasing the lock. */
    480         memcpy(arg_buffer, thread->udebug.syscall_args, 6 * sizeof(unative_t));
     480        memcpy(arg_buffer, thread->udebug.syscall_args, 6 * sizeof(sysarg_t));
    481481       
    482482        _thread_op_end(thread);
     
    539539 *
    540540 */
    541 int udebug_mem_read(unative_t uspace_addr, size_t n, void **buffer)
     541int udebug_mem_read(sysarg_t uspace_addr, size_t n, void **buffer)
    542542{
    543543        /* Verify task state */
Note: See TracChangeset for help on using the changeset viewer.