Ignore:
File:
1 edited

Legend:

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

    raae365bc r128359eb  
    3636#define KERN_ARCH_H_
    3737
    38 #include <arch/asm.h>   /* get_stack_base() */
    3938#include <config.h>
    4039
    41 /*
     40/** Return the current_t structure
     41 *
    4242 * The current_t structure holds pointers to various parts of the current
    4343 * execution state, like running task, thread, address space, etc.
     44 *
     45 * The current_t structure is located at the base address of the current
     46 * stack. The stack is assumed to be STACK_SIZE bytes long. The stack base
     47 * address must be aligned to STACK_SIZE.
     48 *
    4449 */
    45 #define CURRENT  ((current_t * )(get_stack_base()))
     50#define CURRENT \
     51        ((current_t *) (((uintptr_t) __builtin_frame_address(0)) & \
     52            (~((uintptr_t) STACK_SIZE - 1))))
    4653
    47 #define MAGIC                UINT32_C(0xfacefeed)
     54#define MAGIC  UINT32_C(0xfacefeed)
    4855
    4956#define container_check(ctn1, ctn2)  ((ctn1) == (ctn2))
     
    5966struct as;
    6067
    61 /**
     68/** Current structure
     69 *
    6270 * For each possible kernel stack, structure
    6371 * of the following type will be placed at
    6472 * the base address of the stack.
     73 *
    6574 */
    6675typedef struct {
    67         size_t preemption;     /**< Preemption disabled counter and flag. */
    68         struct thread *thread; /**< Current thread. */
    69         struct task *task;     /**< Current task. */
    70         struct cpu *cpu;       /**< Executing cpu. */
    71         struct as *as;         /**< Current address space. */
    72         uint32_t magic;        /**< Magic value */
     76        size_t preemption;      /**< Preemption disabled counter and flag. */
     77        struct thread *thread;  /**< Current thread. */
     78        struct task *task;      /**< Current task. */
     79        struct cpu *cpu;        /**< Executing CPU. */
     80        struct as *as;          /**< Current address space. */
     81        uint32_t magic;         /**< Magic value. */
    7382} current_t;
    7483
     
    8998        } while (0)
    9099
    91 #define ARCH_OP(op)     ARCH_STRUCT_OP(arch_ops, op)
     100#define ARCH_OP(op)  ARCH_STRUCT_OP(arch_ops, op)
    92101
    93102extern void current_initialize(current_t *);
Note: See TracChangeset for help on using the changeset viewer.