Rev 2071 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2071 | Rev 2606 | ||
|---|---|---|---|
| Line 54... | Line 54... | ||
| 54 | } |
54 | } |
| 55 | 55 | ||
| 56 | /** Perform amd64 specific tasks needed before the new thread is scheduled. */ |
56 | /** Perform amd64 specific tasks needed before the new thread is scheduled. */ |
| 57 | void before_thread_runs_arch(void) |
57 | void before_thread_runs_arch(void) |
| 58 | { |
58 | { |
| - | 59 | CPU->arch.tss->rsp0 = |
|
| 59 | CPU->arch.tss->rsp0 = (uintptr_t) &THREAD->kstack[THREAD_STACK_SIZE-SP_DELTA]; |
60 | (uintptr_t) &THREAD->kstack[THREAD_STACK_SIZE - SP_DELTA]; |
| 60 | 61 | ||
| - | 62 | /* |
|
| 61 | /* Syscall support - write address of thread stack pointer to |
63 | * Syscall support. |
| 62 | * hidden part of gs */ |
64 | */ |
| 63 | swapgs(); |
65 | swapgs(); |
| 64 | write_msr(AMD_MSR_GS, (uint64_t)&THREAD->kstack); |
66 | write_msr(AMD_MSR_GS, (uintptr_t)THREAD->arch.syscall_rsp); |
| 65 | swapgs(); |
67 | swapgs(); |
| 66 | 68 | ||
| 67 | /* TLS support - set FS to thread local storage */ |
69 | /* TLS support - set FS to thread local storage */ |
| 68 | write_msr(AMD_MSR_FS, THREAD->arch.tls); |
70 | write_msr(AMD_MSR_FS, THREAD->arch.tls); |
| 69 | 71 | ||
| 70 | #ifdef CONFIG_DEBUG_AS_WATCHPOINT |
72 | #ifdef CONFIG_DEBUG_AS_WATCHPOINT |
| 71 | /* Set watchpoint on AS to ensure that nobody sets it to zero */ |
73 | /* Set watchpoint on AS to ensure that nobody sets it to zero */ |
| 72 | if (CPU->id < BKPOINTS_MAX) |
74 | if (CPU->id < BKPOINTS_MAX) |
| 73 | breakpoint_add(&((the_t *) THREAD->kstack)->as, |
75 | breakpoint_add(&((the_t *) THREAD->kstack)->as, |
| 74 | BKPOINT_WRITE | BKPOINT_CHECK_ZERO, |
76 | BKPOINT_WRITE | BKPOINT_CHECK_ZERO, CPU->id); |
| 75 | CPU->id); |
- | |
| 76 | #endif |
77 | #endif |
| 77 | } |
78 | } |
| 78 | 79 | ||
| 79 | void after_thread_ran_arch(void) |
80 | void after_thread_ran_arch(void) |
| 80 | { |
81 | { |