Rev 3993 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3993 | Rev 4369 | ||
---|---|---|---|
Line 56... | Line 56... | ||
56 | void before_thread_runs_arch(void) |
56 | void before_thread_runs_arch(void) |
57 | { |
57 | { |
58 | if ((THREAD->flags & THREAD_FLAG_USPACE)) { |
58 | if ((THREAD->flags & THREAD_FLAG_USPACE)) { |
59 | uint64_t sp = (uintptr_t) THREAD->kstack + STACK_SIZE - |
59 | uint64_t sp = (uintptr_t) THREAD->kstack + STACK_SIZE - |
60 | (STACK_BIAS + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT)); |
60 | (STACK_BIAS + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT)); |
61 | int cpuid = asi_u64_read(ASI_SCRATCHPAD, SCRATCHPAD_CPUID); |
61 | asi_u64_write(ASI_SCRATCHPAD, SCRATCHPAD_KSTACK, sp); |
62 | kstack_wbuf_ptrs[cpuid].kstack = sp; |
62 | asi_u64_write(ASI_SCRATCHPAD, SCRATCHPAD_WBUF, |
63 | kstack_wbuf_ptrs[cpuid].wbuf = |
- | |
64 | (uintptr_t) THREAD->arch.uspace_window_buffer; |
63 | (uintptr_t) THREAD->arch.uspace_window_buffer); |
65 | } |
64 | } |
66 | } |
65 | } |
67 | 66 | ||
68 | /** Perform sparc64 specific steps before a thread stops running. */ |
67 | /** Perform sparc64 specific steps before a thread stops running. */ |
69 | void after_thread_ran_arch(void) |
68 | void after_thread_ran_arch(void) |
70 | { |
69 | { |
71 | if ((THREAD->flags & THREAD_FLAG_USPACE)) { |
70 | if ((THREAD->flags & THREAD_FLAG_USPACE)) { |
72 | /* sample the state of the userspace window buffer */ |
71 | /* sample the state of the userspace window buffer */ |
73 | int cpuid = asi_u64_read(ASI_SCRATCHPAD, SCRATCHPAD_CPUID); |
- | |
74 | THREAD->arch.uspace_window_buffer = |
72 | THREAD->arch.uspace_window_buffer = |
75 | (uint8_t *) kstack_wbuf_ptrs[cpuid].wbuf; |
73 | (uint8_t *) asi_u64_read(ASI_SCRATCHPAD, SCRATCHPAD_WBUF); |
- | 74 | ||
76 | } |
75 | } |
77 | } |
76 | } |
78 | 77 | ||
79 | /** @} |
78 | /** @} |
80 | */ |
79 | */ |