Changeset 04803bf in mainline for kernel/generic/src/syscall/syscall.c


Ignore:
Timestamp:
2011-03-21T22:00:17Z (13 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
143932e
Parents:
b50b5af2 (diff), 7308e84 (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 (needs fixes).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/syscall/syscall.c

    rb50b5af2 r04803bf  
    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/** Print a hex integer into klog */
    58 static unative_t sys_debug_putint(unative_t i)
     59static sysarg_t sys_debug_putint(sysarg_t i)
    5960{
    6061        printf("[task:0x%x]", i);
     
    6364
    6465/** Dispatch system call */
    65 unative_t syscall_handler(unative_t a1, unative_t a2, unative_t a3,
    66     unative_t a4, unative_t a5, unative_t a6, unative_t id)
     66sysarg_t syscall_handler(sysarg_t a1, sysarg_t a2, sysarg_t a3,
     67    sysarg_t a4, sysarg_t a5, sysarg_t a6, sysarg_t id)
    6768{
    68         unative_t rc;
    69 
     69        /* Do userpace accounting */
     70        irq_spinlock_lock(&THREAD->lock, true);
     71        thread_update_accounting(true);
     72        irq_spinlock_unlock(&THREAD->lock, true);
     73       
    7074#ifdef CONFIG_UDEBUG
    71         bool debug;
     75        /*
     76         * An istate_t-compatible record was created on the stack by the
     77         * low-level syscall handler. This is the userspace space state
     78         * structure.
     79         */
     80        THREAD->udebug.uspace_state = istate_get(THREAD);
    7281
    7382        /*
    7483         * Early check for undebugged tasks. We do not lock anything as this
    75          * test need not be precise in either way.
     84         * test need not be precise in either direction.
    7685         */
    77         debug = THREAD->udebug.active;
    78        
    79         if (debug) {
     86        if (THREAD->udebug.active)
    8087                udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, 0, false);
    81         }
    8288#endif
    8389       
     90        sysarg_t rc;
    8491        if (id < SYSCALL_END) {
    8592                rc = syscall_table[id](a1, a2, a3, a4, a5, a6);
    8693        } else {
    8794                printf("Task %" PRIu64": Unknown syscall %#" PRIxn, TASK->taskid, id);
    88                 task_kill(TASK->taskid);
    89                 thread_exit();
     95                task_kill_self(true);
    9096        }
    9197       
     
    94100       
    95101#ifdef CONFIG_UDEBUG
    96         if (debug) {
     102        if (THREAD->udebug.active) {
    97103                udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, rc, true);
    98        
     104               
    99105                /*
    100106                 * Stopping point needed for tasks that only invoke
     
    105111                udebug_stoppable_end();
    106112        }
     113
     114        /* Clear userspace state pointer */
     115        THREAD->udebug.uspace_state = NULL;
    107116#endif
     117       
     118        /* Do kernel accounting */
     119        irq_spinlock_lock(&THREAD->lock, true);
     120        thread_update_accounting(false);
     121        irq_spinlock_unlock(&THREAD->lock, true);
    108122       
    109123        return rc;
     
    118132        (syshandler_t) sys_thread_exit,
    119133        (syshandler_t) sys_thread_get_id,
     134        (syshandler_t) sys_thread_usleep,
    120135       
    121136        (syshandler_t) sys_task_get_id,
    122137        (syshandler_t) sys_task_set_name,
     138        (syshandler_t) sys_task_kill,
     139        (syshandler_t) sys_task_exit,
    123140        (syshandler_t) sys_program_spawn_loader,
    124141       
    125142        /* Synchronization related syscalls. */
    126         (syshandler_t) sys_futex_sleep_timeout,
     143        (syshandler_t) sys_futex_sleep,
    127144        (syshandler_t) sys_futex_wakeup,
    128145        (syshandler_t) sys_smc_coherence,
     
    133150        (syshandler_t) sys_as_area_change_flags,
    134151        (syshandler_t) sys_as_area_destroy,
     152        (syshandler_t) sys_as_get_unmapped_area,
    135153       
    136154        /* IPC related syscalls. */
     
    146164        (syshandler_t) sys_ipc_poke,
    147165        (syshandler_t) sys_ipc_hangup,
    148         (syshandler_t) sys_ipc_register_irq,
    149         (syshandler_t) sys_ipc_unregister_irq,
    150 
     166        (syshandler_t) sys_ipc_connect_kbox,
     167       
    151168        /* Event notification syscalls. */
    152169        (syshandler_t) sys_event_subscribe,
     
    160177        (syshandler_t) sys_physmem_map,
    161178        (syshandler_t) sys_iospace_enable,
    162         (syshandler_t) sys_preempt_control,
     179        (syshandler_t) sys_register_irq,
     180        (syshandler_t) sys_unregister_irq,
    163181       
    164182        /* Sysinfo syscalls */
    165         (syshandler_t) sys_sysinfo_valid,
    166         (syshandler_t) sys_sysinfo_value,
     183        (syshandler_t) sys_sysinfo_get_tag,
     184        (syshandler_t) sys_sysinfo_get_value,
     185        (syshandler_t) sys_sysinfo_get_data_size,
     186        (syshandler_t) sys_sysinfo_get_data,
    167187       
    168188        /* Debug calls */
    169189        (syshandler_t) sys_debug_putint,
    170190        (syshandler_t) sys_debug_enable_console,
    171         (syshandler_t) sys_debug_disable_console,
    172        
    173         (syshandler_t) sys_ipc_connect_kbox
     191        (syshandler_t) sys_debug_disable_console
    174192};
    175193
Note: See TracChangeset for help on using the changeset viewer.