Rev 1705 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1705 | Rev 1780 | ||
|---|---|---|---|
| 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 = (__address) &THREAD->kstack[THREAD_STACK_SIZE-SP_DELTA]; |
59 | CPU->arch.tss->rsp0 = (uintptr_t) &THREAD->kstack[THREAD_STACK_SIZE-SP_DELTA]; |
| 60 | 60 | ||
| 61 | /* Syscall support - write address of thread stack pointer to |
61 | /* Syscall support - write address of thread stack pointer to |
| 62 | * hidden part of gs */ |
62 | * hidden part of gs */ |
| 63 | swapgs(); |
63 | swapgs(); |
| 64 | write_msr(AMD_MSR_GS, (__u64)&THREAD->kstack); |
64 | write_msr(AMD_MSR_GS, (uint64_t)&THREAD->kstack); |
| 65 | swapgs(); |
65 | swapgs(); |
| 66 | 66 | ||
| 67 | /* TLS support - set FS to thread local storage */ |
67 | /* TLS support - set FS to thread local storage */ |
| 68 | write_msr(AMD_MSR_FS, THREAD->arch.tls); |
68 | write_msr(AMD_MSR_FS, THREAD->arch.tls); |
| 69 | 69 | ||