Changeset 4b2c872d in mainline for include/context.h


Ignore:
Timestamp:
2005-10-18T09:33:02Z (20 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8005218
Parents:
22f7769
Message:

Create generic context_save() and context_restore().
These two functions are defined inline and only call context_save_arch() and context_restore_arch(), respectively.
The main purpose of this is to enable centralized commenting of these important and tricky functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • include/context.h

    r22f7769 r4b2c872d  
    3232#include <arch/types.h>
    3333#include <typedefs.h>
     34#include <arch/context.h>
     35
    3436
    3537#ifndef context_set
     
    3941#endif /* context_set */
    4042
    41 extern int context_save(context_t *c);
    42 extern void context_restore(context_t *c) __attribute__ ((noreturn));
     43extern int context_save_arch(context_t *c);
     44extern void context_restore_arch(context_t *c) __attribute__ ((noreturn));
     45
     46/** Save register context.
     47 *
     48 * Save current register context (including stack pointers)
     49 * to context structure.
     50 *
     51 * Note that call to context_restore() will return at the same
     52 * address as the corresponding call to context_save().
     53 *
     54 * @param c Context structure.
     55 *
     56 * @return context_save() returns 1, context_restore() returns 0.
     57 */
     58static inline int context_save(context_t *c)
     59{
     60        return context_save_arch(c);
     61}
     62
     63/** Restore register context.
     64 *
     65 * Restore previously saved register context (including stack pointers)
     66 * from context structure.
     67 *
     68 * Note that this function does not normally return.
     69 * Instead, it returns at the same address as the
     70 * corresponding call to context_save(), the only
     71 * difference being return value.
     72 *
     73 * Note that content of any local variable defined by
     74 * the caller of context_save() is undefined after
     75 * context_restore().
     76 *
     77 * @param c Context structure.
     78 */
     79static inline void context_restore(context_t *c)
     80{
     81        context_restore_arch(c);
     82}
    4383
    4484#endif
Note: See TracChangeset for help on using the changeset viewer.