Ignore:
Timestamp:
2012-07-26T21:38:14Z (12 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4fc93d5
Parents:
f66c203d
Message:

Add a variant of fault_if_from_uspace() that doesn't check whether
the istate is from uspace.

File:
1 edited

Legend:

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

    rf66c203d r8f4f444  
    5050#include <panic.h>
    5151#include <print.h>
     52#include <stdarg.h>
    5253#include <symtab.h>
    5354#include <proc/thread.h>
     
    165166}
    166167
    167 /** Terminate thread and task if exception came from userspace.
    168  *
    169  */
    170 NO_TRACE void fault_if_from_uspace(istate_t *istate, const char *fmt, ...)
    171 {
    172         if (!istate_from_uspace(istate))
    173                 return;
    174        
     168static NO_TRACE void fault_from_uspace_core(istate_t *istate, const char *fmt, va_list args)
     169{
    175170        printf("Task %s (%" PRIu64 ") killed due to an exception at "
    176171            "program counter %p.\n", TASK->name, TASK->taskid,
     
    181176       
    182177        printf("Kill message: ");
     178        vprintf(fmt, args);
     179        printf("\n");
     180       
     181        task_kill_self(true);
     182}
     183
     184/** Terminate thread and task after the exception came from userspace.
     185 *
     186 */
     187NO_TRACE void fault_from_uspace(istate_t *istate, const char *fmt, ...)
     188{
     189        va_list args;
     190
     191        va_start(args, fmt);
     192        fault_from_uspace_core(istate, fmt, args);
     193        va_end(args);
     194}
     195
     196/** Terminate thread and task if exception came from userspace.
     197 *
     198 */
     199NO_TRACE void fault_if_from_uspace(istate_t *istate, const char *fmt, ...)
     200{
     201        if (!istate_from_uspace(istate))
     202                return;
    183203       
    184204        va_list args;
    185205        va_start(args, fmt);
    186         vprintf(fmt, args);
     206        fault_from_uspace_core(istate, fmt, args);
    187207        va_end(args);
    188         printf("\n");
    189        
    190         task_kill_self(true);
    191208}
    192209
Note: See TracChangeset for help on using the changeset viewer.