Rev 3386 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3386 | Rev 4718 | ||
|---|---|---|---|
| Line 43... | Line 43... | ||
| 43 | #define context_set(c, _pc, stack, size) \ |
43 | #define context_set(c, _pc, stack, size) \ |
| 44 | (c)->pc = (uintptr_t) (_pc); \ |
44 | (c)->pc = (uintptr_t) (_pc); \ |
| 45 | (c)->sp = ((uintptr_t) (stack)) + (size) - SP_DELTA; |
45 | (c)->sp = ((uintptr_t) (stack)) + (size) - SP_DELTA; |
| 46 | #endif /* context_set */ |
46 | #endif /* context_set */ |
| 47 | 47 | ||
| 48 | extern int context_save_arch(context_t *c); |
48 | extern int context_save_arch(context_t *c) __attribute__ ((returns_twice)); |
| 49 | extern void context_restore_arch(context_t *c) __attribute__ ((noreturn)); |
49 | extern void context_restore_arch(context_t *c) __attribute__ ((noreturn)); |
| 50 | 50 | ||
| 51 | /** Save register context. |
51 | /** Save register context. |
| 52 | * |
52 | * |
| 53 | * Save current register context (including stack pointers) |
53 | * Save current register context (including stack pointers) |
| Line 74... | Line 74... | ||
| 74 | * Note that this function does not normally return. |
74 | * Note that this function does not normally return. |
| 75 | * Instead, it returns at the same address as the |
75 | * Instead, it returns at the same address as the |
| 76 | * corresponding call to context_save(), the only |
76 | * corresponding call to context_save(), the only |
| 77 | * difference being return value. |
77 | * difference being return value. |
| 78 | * |
78 | * |
| 79 | * Note that content of any local variable defined by |
- | |
| 80 | * the caller of context_save() is undefined after |
- | |
| 81 | * context_restore(). |
- | |
| 82 | * |
- | |
| 83 | * @param c Context structure. |
79 | * @param c Context structure. |
| 84 | */ |
80 | */ |
| 85 | static inline void context_restore(context_t *c) |
81 | static inline void context_restore(context_t *c) |
| 86 | { |
82 | { |
| 87 | context_restore_arch(c); |
83 | context_restore_arch(c); |