Rev 903 | Rev 912 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 903 | Rev 911 | ||
|---|---|---|---|
| Line 27... | Line 27... | ||
| 27 | */ |
27 | */ |
| 28 | 28 | ||
| 29 | #include <proc/scheduler.h> |
29 | #include <proc/scheduler.h> |
| 30 | #include <proc/thread.h> |
30 | #include <proc/thread.h> |
| 31 | #include <arch.h> |
31 | #include <arch.h> |
| - | 32 | #include <arch/register.h> |
|
| 32 | #include <arch/mm/tlb.h> |
33 | #include <arch/mm/tlb.h> |
| 33 | #include <config.h> |
34 | #include <config.h> |
| 34 | #include <align.h> |
35 | #include <align.h> |
| 35 | 36 | ||
| 36 | /** Record kernel stack address in ar.k7 and make sure it is mapped in DTR. */ |
37 | /** Record kernel stack address in bank 0 r23 and make sure it is mapped in DTR. */ |
| 37 | void before_thread_runs_arch(void) |
38 | void before_thread_runs_arch(void) |
| 38 | { |
39 | { |
| 39 | __address base; |
40 | __address base; |
| 40 | 41 | ||
| 41 | base = ALIGN_DOWN(config.base, 1<<KERNEL_PAGE_WIDTH); |
42 | base = ALIGN_DOWN(config.base, 1<<KERNEL_PAGE_WIDTH); |
| Line 47... | Line 48... | ||
| 47 | */ |
48 | */ |
| 48 | dtlb_kernel_mapping_insert((__address) THREAD->kstack, KA2PA(THREAD->kstack), true, DTR_KSTACK); |
49 | dtlb_kernel_mapping_insert((__address) THREAD->kstack, KA2PA(THREAD->kstack), true, DTR_KSTACK); |
| 49 | } |
50 | } |
| 50 | 51 | ||
| 51 | /* |
52 | /* |
| 52 | * Record address of kernel stack to ar.k7 |
53 | * Record address of kernel stack to bank 0 r23 |
| 53 | * where it will be found after switch |
54 | * where it will be found after switch from userspace. |
| 54 | * from userspace. |
- | |
| 55 | */ |
55 | */ |
| - | 56 | __asm__ volatile ( |
|
| - | 57 | "bsw.0\n" |
|
| - | 58 | "mov r23 = %0\n" |
|
| - | 59 | "bsw.1\n" |
|
| 56 | __asm__ volatile ("mov ar.k7 = %0\n" : : "r" (THREAD->kstack)); |
60 | : : "r" (THREAD->kstack)); |
| 57 | } |
61 | } |
| 58 | 62 | ||
| 59 | void after_thread_ran_arch(void) |
63 | void after_thread_ran_arch(void) |
| 60 | { |
64 | { |
| 61 | } |
65 | } |