Changeset b1d3c36 in mainline for kernel


Ignore:
Timestamp:
2010-02-04T16:51:36Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4cac2d69
Parents:
d32358f
Message:

small arch/generic interface cleanup:
context_set() should be always defined explicitly (either as a custom macro
or as a reference to context_set_generic()), using #undef and implicit macro
values can be rather confusing

Location:
kernel
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/abs32le/include/context.h

    rd32358f rb1d3c36  
    3939#define SP_DELTA         0
    4040
     41#define context_set(ctx, pc, stack, size) \
     42    context_set_generic(ctx, pc, stack, size)
     43
    4144/*
    4245 * On real hardware this stores the registers which
  • kernel/arch/ia64/include/context.h

    rd32358f rb1d3c36  
    4848 */
    4949#define SP_DELTA        (0 + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))
    50 
    51 #ifdef context_set
    52 #undef context_set
    53 #endif
    5450
    5551/* RSE stack starts at the bottom of memory stack. */
  • kernel/arch/mips32/include/context.h

    rd32358f rb1d3c36  
    2727 */
    2828
    29 /** @addtogroup mips32 
     29/** @addtogroup mips32
    3030 * @{
    3131 */
     
    4242 * Put one item onto the stack to support get_stack_base() and align it up.
    4343 */
    44 #define SP_DELTA        (0 + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))
    45 
     44#define SP_DELTA  (0 + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))
    4645
    4746#ifndef __ASM__
    4847
    4948#include <arch/types.h>
     49
     50#define context_set(ctx, pc, stack, size) \
     51    context_set_generic(ctx, pc, stack, size)
    5052
    5153/*
  • kernel/arch/ppc32/include/context.h

    rd32358f rb1d3c36  
    2727 */
    2828
    29 /** @addtogroup ppc32   
     29/** @addtogroup ppc32
    3030 * @{
    3131 */
     
    3838#include <arch/types.h>
    3939
    40 #define SP_DELTA        16
     40#define SP_DELTA  16
     41
     42#define context_set(ctx, pc, stack, size) \
     43    context_set_generic(ctx, pc, stack, size)
    4144
    4245typedef struct {
     
    6871       
    6972        ipl_t ipl;
    70 } __attribute__ ((packed)) context_t;
     73} __attribute__((packed)) context_t;
    7174
    7275#endif
  • kernel/arch/sparc64/include/context.h

    rd32358f rb1d3c36  
    4242#define SP_DELTA        (STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE)
    4343
    44 #ifdef context_set
    45 #undef context_set
    46 #endif
    47 
    4844#define context_set(c, _pc, stack, size)                        \
    4945        (c)->pc = ((uintptr_t) _pc) - 8;                        \
  • kernel/generic/include/context.h

    rd32358f rb1d3c36  
    2727 */
    2828
    29 /** @addtogroup generic 
     29/** @addtogroup generic
    3030 * @{
    3131 */
     
    3939#include <arch/context.h>
    4040
     41#define context_set_generic(ctx, _pc, stack, size) \
     42        (ctx)->pc = (uintptr_t) (_pc); \
     43        (ctx)->sp = ((uintptr_t) (stack)) + (size) - SP_DELTA;
    4144
    42 #ifndef context_set
    43 #define context_set(c, _pc, stack, size)        \
    44         (c)->pc = (uintptr_t) (_pc);            \
    45         (c)->sp = ((uintptr_t) (stack)) + (size) - SP_DELTA;
    46 #endif /* context_set */
    47 
    48 extern int context_save_arch(context_t *c) __attribute__ ((returns_twice));
    49 extern void context_restore_arch(context_t *c) __attribute__ ((noreturn));
     45extern int context_save_arch(context_t *ctx) __attribute__((returns_twice));
     46extern void context_restore_arch(context_t *ctx) __attribute__((noreturn));
    5047
    5148/** Save register context.
     
    7370 * saved like that would therefore lead to a disaster.
    7471 *
    75  * @param c             Context structure.
     72 * @param ctx Context structure.
    7673 *
    77  * @return              context_save() returns 1, context_restore() returns 0.
     74 * @return context_save() returns 1, context_restore() returns 0.
     75 *
    7876 */
    79 #define context_save(c)   context_save_arch(c)
     77#define context_save(ctx)  context_save_arch(ctx)
    8078
    8179/** Restore register context.
     
    8886 * being return value.
    8987 *
    90  * @param c             Context structure.
     88 * @param ctx Context structure.
    9189 */
    92 static inline void context_restore(context_t *c)
     90static inline void context_restore(context_t *ctx)
    9391{
    94         context_restore_arch(c);
     92        context_restore_arch(ctx);
    9593}
    9694
Note: See TracChangeset for help on using the changeset viewer.