Rev 1882 | Rev 1899 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1882 | Rev 1885 | ||
---|---|---|---|
Line 39... | Line 39... | ||
39 | #include <typedefs.h> |
39 | #include <typedefs.h> |
40 | #include <arch/types.h> |
40 | #include <arch/types.h> |
41 | #include <arch/register.h> |
41 | #include <arch/register.h> |
42 | #include <config.h> |
42 | #include <config.h> |
43 | #include <time/clock.h> |
43 | #include <time/clock.h> |
- | 44 | #include <arch/stack.h> |
|
44 | 45 | ||
45 | /** Read Processor State register. |
46 | /** Read Processor State register. |
46 | * |
47 | * |
47 | * @return Value of PSTATE register. |
48 | * @return Value of PSTATE register. |
48 | */ |
49 | */ |
Line 242... | Line 243... | ||
242 | * The stack is assumed to be STACK_SIZE bytes long. |
243 | * The stack is assumed to be STACK_SIZE bytes long. |
243 | * The stack must start on page boundary. |
244 | * The stack must start on page boundary. |
244 | */ |
245 | */ |
245 | static inline uintptr_t get_stack_base(void) |
246 | static inline uintptr_t get_stack_base(void) |
246 | { |
247 | { |
247 | uintptr_t v; |
248 | uintptr_t unbiased_sp; |
248 | 249 | ||
249 | __asm__ volatile ("andn %%sp, %1, %0\n" : "=r" (v) : "r" (STACK_SIZE-1)); |
250 | __asm__ volatile ("add %%sp, %1, %0\n" : "=r" (unbiased_sp) : "i" (STACK_BIAS)); |
250 | 251 | ||
251 | return v; |
252 | return ALIGN_DOWN(unbiased_sp, STACK_SIZE); |
252 | } |
253 | } |
253 | 254 | ||
254 | /** Read Version Register. |
255 | /** Read Version Register. |
255 | * |
256 | * |
256 | * @return Value of VER register. |
257 | * @return Value of VER register. |