Rev 2441 | Rev 3485 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2441 | Rev 2630 | ||
|---|---|---|---|
| Line 56... | Line 56... | ||
| 56 | * |
56 | * |
| 57 | * THREAD is locked and interrupts are disabled. |
57 | * THREAD is locked and interrupts are disabled. |
| 58 | */ |
58 | */ |
| 59 | void before_thread_runs_arch(void) |
59 | void before_thread_runs_arch(void) |
| 60 | { |
60 | { |
| 61 | CPU->arch.tss->esp0 = (uintptr_t) &THREAD->kstack[THREAD_STACK_SIZE-SP_DELTA]; |
61 | CPU->arch.tss->esp0 = (uintptr_t) &THREAD->kstack[THREAD_STACK_SIZE - |
| - | 62 | SP_DELTA]; |
|
| 62 | CPU->arch.tss->ss0 = selector(KDATA_DES); |
63 | CPU->arch.tss->ss0 = selector(KDATA_DES); |
| 63 | 64 | ||
| 64 | /* Set up TLS in GS register */ |
65 | /* Set up TLS in GS register */ |
| 65 | set_tls_desc(THREAD->arch.tls); |
66 | set_tls_desc(THREAD->arch.tls); |
| 66 | 67 | ||
| 67 | #ifdef CONFIG_DEBUG_AS_WATCHPOINT |
68 | #ifdef CONFIG_DEBUG_AS_WATCHPOINT |
| 68 | /* Set watchpoint on AS to ensure that nobody sets it to zero */ |
69 | /* Set watchpoint on AS to ensure that nobody sets it to zero */ |
| 69 | if (CPU->id < BKPOINTS_MAX) { |
70 | if (CPU->id < BKPOINTS_MAX) { |
| 70 | the_t *the = THE; |
71 | the_t *the = THE; |
| 71 | breakpoint_add(&((the_t *) the->thread->kstack)->as, |
72 | breakpoint_add(&((the_t *) the->thread->kstack)->as, |
| 72 | BKPOINT_WRITE | BKPOINT_CHECK_ZERO, the->cpu->id); |
73 | BKPOINT_WRITE | BKPOINT_CHECK_ZERO, the->cpu->id); |
| 73 | } |
74 | } |
| 74 | #endif |
75 | #endif |
| 75 | } |
76 | } |
| 76 | 77 | ||
| 77 | void after_thread_ran_arch(void) |
78 | void after_thread_ran_arch(void) |