Rev 1137 | Rev 1702 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1137 | Rev 1138 | ||
|---|---|---|---|
| Line 34... | Line 34... | ||
| 34 | #include <typedefs.h> |
34 | #include <typedefs.h> |
| 35 | #include <align.h> |
35 | #include <align.h> |
| 36 | #include <arch/stack.h> |
36 | #include <arch/stack.h> |
| 37 | 37 | ||
| 38 | /* |
38 | /* |
| 39 | * context_save() and context_restore() are both leaf procedures. |
39 | * context_save_arch() and context_restore_arch() are both leaf procedures. |
| 40 | * No need to allocate scratch area. |
40 | * No need to allocate scratch area. |
| 41 | * |
41 | * |
| 42 | * One item is put onto the stack to support get_stack_base(). |
42 | * One item is put onto the stack to support get_stack_base(). |
| 43 | */ |
43 | */ |
| 44 | #define SP_DELTA (0+ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT)) |
44 | #define SP_DELTA (0+ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT)) |
| 45 | 45 | ||
| 46 | #ifdef context_set |
46 | #ifdef context_set |
| 47 | #undef context_set |
47 | #undef context_set |
| 48 | #endif |
48 | #endif |
| 49 | 49 | ||
| 50 | /*RSE stack should begin under bottom of stack @ kernel*/ |
50 | /* RSE stack starts at the bottom of memory stack. */ |
| 51 | #define context_set(c, _pc, stack, size) \ |
51 | #define context_set(c, _pc, stack, size) \ |
| - | 52 | do { \ |
|
| 52 | (c)->pc = (__address) _pc; \ |
53 | (c)->pc = (__address) _pc; \ |
| 53 | (c)->bsp = ((__address) stack) + ALIGN_UP((size), STACK_ALIGNMENT) ; \ |
54 | (c)->bsp = ((__address) stack) + ALIGN_UP((size), REGISTER_STACK_ALIGNMENT); \ |
| 54 | (c)->ar_pfs &= PFM_MASK; \ |
55 | (c)->ar_pfs &= PFM_MASK; \ |
| 55 | (c)->sp = ((__address) stack) + ALIGN_UP((size), STACK_ALIGNMENT) - SP_DELTA; |
56 | (c)->sp = ((__address) stack) + ALIGN_UP((size), STACK_ALIGNMENT) - SP_DELTA; \ |
| - | 57 | } while (0); |
|
| 56 | 58 | ||
| 57 | /* |
59 | /* |
| 58 | * Only save registers that must be preserved across |
60 | * Only save registers that must be preserved across |
| 59 | * function calls. |
61 | * function calls. |
| 60 | */ |
62 | */ |
| Line 120... | Line 122... | ||
| 120 | __r128 f31; |
122 | __r128 f31; |
| 121 | 123 | ||
| 122 | ipl_t ipl; |
124 | ipl_t ipl; |
| 123 | }; |
125 | }; |
| 124 | 126 | ||
| 125 | - | ||
| 126 | - | ||
| 127 | #endif |
127 | #endif |