Ignore:
File:
1 edited

Legend:

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

    r057d21a r5bcf1f9  
    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{
    61         unative_t rc;
    62 
     62        /* Do userpace accounting */
     63        irq_spinlock_lock(&THREAD->lock, true);
     64        thread_update_accounting(true);
     65        irq_spinlock_unlock(&THREAD->lock, true);
     66       
    6367#ifdef CONFIG_UDEBUG
    64         bool debug;
     68        /*
     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);
    6574
    6675        /*
    6776         * Early check for undebugged tasks. We do not lock anything as this
    68          * test need not be precise in either way.
     77         * test need not be precise in either direction.
    6978         */
    70         debug = THREAD->udebug.active;
    71        
    72         if (debug) {
     79        if (THREAD->udebug.active)
    7380                udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, 0, false);
    74         }
    7581#endif
    7682       
     83        sysarg_t rc;
    7784        if (id < SYSCALL_END) {
    7885                rc = syscall_table[id](a1, a2, a3, a4, a5, a6);
    7986        } else {
    8087                printf("Task %" PRIu64": Unknown syscall %#" PRIxn, TASK->taskid, id);
    81                 task_kill(TASK->taskid);
    82                 thread_exit();
     88                task_kill_self(true);
    8389        }
    8490       
     
    8793       
    8894#ifdef CONFIG_UDEBUG
    89         if (debug) {
     95        if (THREAD->udebug.active) {
    9096                udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, rc, true);
    91        
     97               
    9298                /*
    9399                 * Stopping point needed for tasks that only invoke
     
    98104                udebug_stoppable_end();
    99105        }
     106
     107        /* Clear userspace state pointer */
     108        THREAD->udebug.uspace_state = NULL;
    100109#endif
     110       
     111        /* Do kernel accounting */
     112        irq_spinlock_lock(&THREAD->lock, true);
     113        thread_update_accounting(false);
     114        irq_spinlock_unlock(&THREAD->lock, true);
    101115       
    102116        return rc;
     
    111125        (syshandler_t) sys_thread_exit,
    112126        (syshandler_t) sys_thread_get_id,
     127        (syshandler_t) sys_thread_usleep,
    113128       
    114129        (syshandler_t) sys_task_get_id,
    115130        (syshandler_t) sys_task_set_name,
     131        (syshandler_t) sys_task_kill,
     132        (syshandler_t) sys_task_exit,
    116133        (syshandler_t) sys_program_spawn_loader,
    117134       
    118135        /* Synchronization related syscalls. */
    119         (syshandler_t) sys_futex_sleep_timeout,
     136        (syshandler_t) sys_futex_sleep,
    120137        (syshandler_t) sys_futex_wakeup,
    121138        (syshandler_t) sys_smc_coherence,
     
    139156        (syshandler_t) sys_ipc_poke,
    140157        (syshandler_t) sys_ipc_hangup,
    141         (syshandler_t) sys_ipc_register_irq,
    142         (syshandler_t) sys_ipc_unregister_irq,
    143 
     158        (syshandler_t) sys_ipc_connect_kbox,
     159       
    144160        /* Event notification syscalls. */
    145161        (syshandler_t) sys_event_subscribe,
     
    153169        (syshandler_t) sys_physmem_map,
    154170        (syshandler_t) sys_iospace_enable,
    155         (syshandler_t) sys_preempt_control,
     171        (syshandler_t) sys_register_irq,
     172        (syshandler_t) sys_unregister_irq,
    156173       
    157174        /* Sysinfo syscalls */
    158         (syshandler_t) sys_sysinfo_valid,
    159         (syshandler_t) sys_sysinfo_value,
     175        (syshandler_t) sys_sysinfo_get_tag,
     176        (syshandler_t) sys_sysinfo_get_value,
     177        (syshandler_t) sys_sysinfo_get_data_size,
     178        (syshandler_t) sys_sysinfo_get_data,
    160179       
    161180        /* Debug calls */
    162181        (syshandler_t) sys_debug_enable_console,
    163         (syshandler_t) sys_debug_disable_console,
    164        
    165         (syshandler_t) sys_ipc_connect_kbox
     182        (syshandler_t) sys_debug_disable_console
    166183};
    167184
Note: See TracChangeset for help on using the changeset viewer.