Changeset 473d5d2 in mainline for kernel/generic/include/arch.h


Ignore:
Timestamp:
2011-05-19T16:44:47Z (13 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bcaca55
Parents:
9c757820
Message:

add magic value to THE structure for better stack/memory corruption detection
rename (security) contexts to containers (a slightly less overloaded term within SPARTAN kernel)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/arch.h

    r9c757820 r473d5d2  
    4141#include <mm/as.h>
    4242
    43 #define DEFAULT_CONTEXT  0
     43/*
     44 * THE is not an abbreviation, but the English definite article written in
     45 * capital letters. It means the current pointer to something, e.g. thread,
     46 * processor or address space. Kind reader of this comment shall appreciate
     47 * the wit of constructs like THE->thread and similar.
     48 */
     49#define THE  ((the_t * )(get_stack_base()))
    4450
    4551#define CPU                  THE->cpu
     
    4753#define TASK                 THE->task
    4854#define AS                   THE->as
    49 #define CONTEXT              (THE->task ? THE->task->context : DEFAULT_CONTEXT)
    5055#define PREEMPTION_DISABLED  THE->preemption_disabled
     56#define MAGIC                UINT32_C(0xfacefeed)
    5157
    52 #define context_check(ctx1, ctx2)  ((ctx1) == (ctx2))
     58#define container_check(ctn1, ctn2)  ((ctn1) == (ctn2))
     59
     60#define DEFAULT_CONTAINER  0
     61#define CONTAINER \
     62        ((THE->task) ? (THE->task->container) : (DEFAULT_CONTAINER))
    5363
    5464/**
     
    6373        cpu_t *cpu;                  /**< Executing cpu. */
    6474        as_t *as;                    /**< Current address space. */
     75        uint32_t magic;              /**< Magic value */
    6576} the_t;
    66 
    67 /*
    68  * THE is not an abbreviation, but the English definite article written in
    69  * capital letters. It means the current pointer to something, e.g. thread,
    70  * processor or address space. Kind reader of this comment shall appreciate
    71  * the wit of constructs like THE->thread and similar.
    72  */
    73 #define THE  ((the_t * )(get_stack_base()))
    7477
    7578extern void the_initialize(the_t *);
Note: See TracChangeset for help on using the changeset viewer.