Rev 1856 | Rev 1860 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1856 | Rev 1857 | ||
---|---|---|---|
Line 76... | Line 76... | ||
76 | /* |
76 | /* |
77 | * If this thread executes also in userspace, we have to lock |
77 | * If this thread executes also in userspace, we have to lock |
78 | * its userspace window buffer into DTLB. |
78 | * its userspace window buffer into DTLB. |
79 | */ |
79 | */ |
80 | ASSERT(THREAD->arch.uspace_window_buffer); |
80 | ASSERT(THREAD->arch.uspace_window_buffer); |
81 | uintptr_t uw_buf = (uintptr_t) THREAD->arch.uspace_window_buffer; |
81 | uintptr_t uw_buf = ALIGN_DOWN((uintptr_t) THREAD->arch.uspace_window_buffer, PAGE_SIZE); |
82 | if (!overlaps(uw_buf, PAGE_SIZE, base, 1<<KERNEL_PAGE_WIDTH)) { |
82 | if (!overlaps(uw_buf, PAGE_SIZE, base, 1<<KERNEL_PAGE_WIDTH)) { |
83 | /* |
83 | /* |
84 | * The buffer is not covered by the 4M locked kernel DTLB entry. |
84 | * The buffer is not covered by the 4M locked kernel DTLB entry. |
85 | */ |
85 | */ |
86 | dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_NUCLEUS, (uintptr_t) uw_buf); |
86 | dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_NUCLEUS, uw_buf); |
87 | dtlb_insert_mapping(uw_buf, KA2PA(uw_buf), PAGESIZE_8K, true, true); |
87 | dtlb_insert_mapping(uw_buf, KA2PA(uw_buf), PAGESIZE_8K, true, true); |
88 | } |
88 | } |
89 | 89 | ||
90 | /* |
90 | /* |
91 | * Write kernel stack address to %g6 and a pointer to the last item |
91 | * Write kernel stack address to %g6 and a pointer to the last item |
Line 124... | Line 124... | ||
124 | */ |
124 | */ |
125 | ASSERT(THREAD->arch.uspace_window_buffer); |
125 | ASSERT(THREAD->arch.uspace_window_buffer); |
126 | 126 | ||
127 | flushw(); /* force all userspace windows into memory */ |
127 | flushw(); /* force all userspace windows into memory */ |
128 | 128 | ||
129 | uintptr_t uw_buf = (uintptr_t) THREAD->arch.uspace_window_buffer; |
129 | uintptr_t uw_buf = ALIGN_DOWN((uintptr_t) THREAD->arch.uspace_window_buffer, PAGE_SIZE); |
130 | if (!overlaps(uw_buf, PAGE_SIZE, base, 1<<KERNEL_PAGE_WIDTH)) { |
130 | if (!overlaps(uw_buf, PAGE_SIZE, base, 1<<KERNEL_PAGE_WIDTH)) { |
131 | /* |
131 | /* |
132 | * The buffer is not covered by the 4M locked kernel DTLB entry |
132 | * The buffer is not covered by the 4M locked kernel DTLB entry |
133 | * and therefore it was given a dedicated locked DTLB entry. |
133 | * and therefore it was given a dedicated locked DTLB entry. |
134 | * Demap it. |
134 | * Demap it. |
135 | */ |
135 | */ |
136 | dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_NUCLEUS, (uintptr_t) uw_buf); |
136 | dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_NUCLEUS, uw_buf); |
137 | } |
137 | } |
138 | 138 | ||
139 | /* sample the state of the userspace window buffer */ |
139 | /* sample the state of the userspace window buffer */ |
140 | THREAD->arch.uspace_window_buffer = (uint8_t *) read_from_ag_g7(); |
140 | THREAD->arch.uspace_window_buffer = (uint8_t *) read_from_ag_g7(); |
141 | } |
141 | } |