Rev 414 | Rev 443 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 414 | Rev 415 | ||
---|---|---|---|
Line 31... | Line 31... | ||
31 | 31 | ||
32 | #include <arch/types.h> |
32 | #include <arch/types.h> |
33 | #include <typedefs.h> |
33 | #include <typedefs.h> |
34 | #include <align.h> |
34 | #include <align.h> |
35 | 35 | ||
36 | #define STACK_ITEM_SIZE 16 |
36 | #define STACK_ITEM_SIZE 16 |
37 | #define STACK_ALIGNMENT 16 |
37 | #define STACK_ALIGNMENT 16 |
- | 38 | #define REGISTER_STACK_ALIGNMENT 8 |
|
38 | 39 | ||
39 | /* |
40 | /* |
40 | * context_save() and context_restore() are both leaf procedures. |
41 | * context_save() and context_restore() are both leaf procedures. |
41 | * No need to allocate scratch area. |
42 | * No need to allocate scratch area. |
42 | * |
43 | * |
43 | * One item is put onto the stack to support get_stack_base(). |
44 | * One item is put onto the stack to support get_stack_base(). |
44 | */ |
45 | */ |
45 | #define SP_DELTA (0+STACK_ITEM_SIZE) |
46 | #define SP_DELTA (0+STACK_ITEM_SIZE) |
46 | 47 | ||
- | 48 | #define PFM_MASK (~0x3fffffffff) |
|
- | 49 | ||
47 | #ifdef context_set |
50 | #ifdef context_set |
48 | #undef context_set |
51 | #undef context_set |
49 | #endif |
52 | #endif |
50 | 53 | ||
51 | #define context_set(c, _pc, stack, size) \ |
54 | #define context_set(c, _pc, stack, size) \ |
52 | (c)->pc = (__address) _pc; \ |
55 | (c)->pc = (__address) _pc; \ |
53 | (c)->bsp = ((__address) stack) + ALIGN(sizeof(the_t), STACK_ALIGNMENT); \ |
56 | (c)->bsp = ((__address) stack) + ALIGN(sizeof(the_t), REGISTER_STACK_ALIGNMENT); \ |
- | 57 | (c)->ar_pfs &= PFM_MASK; \ |
|
54 | (c)->sp = ((__address) stack) + ALIGN((size), STACK_ALIGNMENT) - SP_DELTA; |
58 | (c)->sp = ((__address) stack) + ALIGN((size), STACK_ALIGNMENT) - SP_DELTA; |
55 | 59 | ||
56 | /* |
60 | /* |
57 | * Only save registers that must be preserved across |
61 | * Only save registers that must be preserved across |
58 | * function calls. |
62 | * function calls. |