Ignore:
File:
1 edited

Legend:

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

    re4d96e9 r5cac9cd  
    5050#include <panic.h>
    5151#include <print.h>
    52 #include <stdarg.h>
    5352#include <symtab.h>
    5453#include <proc/thread.h>
    5554#include <arch/cycle.h>
    56 #include <arch/stack.h>
    5755#include <str.h>
    5856#include <trace.h>
     
    167165}
    168166
    169 static NO_TRACE
    170 void fault_from_uspace_core(istate_t *istate, const char *fmt, va_list args)
    171 {
     167/** Terminate thread and task if exception came from userspace.
     168 *
     169 */
     170NO_TRACE void fault_if_from_uspace(istate_t *istate, const char *fmt, ...)
     171{
     172        if (!istate_from_uspace(istate))
     173                return;
     174       
    172175        printf("Task %s (%" PRIu64 ") killed due to an exception at "
    173176            "program counter %p.\n", TASK->name, TASK->taskid,
     
    178181       
    179182        printf("Kill message: ");
    180         vprintf(fmt, args);
    181         printf("\n");
    182        
    183         task_kill_self(true);
    184 }
    185 
    186 /** Terminate thread and task after the exception came from userspace.
    187  *
    188  */
    189 NO_TRACE void fault_from_uspace(istate_t *istate, const char *fmt, ...)
    190 {
    191         va_list args;
    192 
    193         va_start(args, fmt);
    194         fault_from_uspace_core(istate, fmt, args);
    195         va_end(args);
    196 }
    197 
    198 /** Terminate thread and task if exception came from userspace.
    199  *
    200  */
    201 NO_TRACE void fault_if_from_uspace(istate_t *istate, const char *fmt, ...)
    202 {
    203         if (!istate_from_uspace(istate))
    204                 return;
    205183       
    206184        va_list args;
    207185        va_start(args, fmt);
    208         fault_from_uspace_core(istate, fmt, args);
     186        vprintf(fmt, args);
    209187        va_end(args);
     188        printf("\n");
     189       
     190        task_kill_self(true);
    210191}
    211192
     
    223204        /*
    224205         * The istate structure should be right at the bottom of the kernel
    225          * memory stack.
     206         * stack.
    226207         */
    227         return (istate_t *) &thread->kstack[MEM_STACK_SIZE - sizeof(istate_t)];
     208        return (istate_t *) ((uint8_t *)
     209            thread->kstack + STACK_SIZE - sizeof(istate_t));
    228210}
    229211
Note: See TracChangeset for help on using the changeset viewer.