Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 1856 → Rev 1857

/trunk/kernel/arch/sparc64/src/proc/scheduler.c
78,12 → 78,12
* its userspace window buffer into DTLB.
*/
ASSERT(THREAD->arch.uspace_window_buffer);
uintptr_t uw_buf = (uintptr_t) THREAD->arch.uspace_window_buffer;
uintptr_t uw_buf = ALIGN_DOWN((uintptr_t) THREAD->arch.uspace_window_buffer, PAGE_SIZE);
if (!overlaps(uw_buf, PAGE_SIZE, base, 1<<KERNEL_PAGE_WIDTH)) {
/*
* The buffer is not covered by the 4M locked kernel DTLB entry.
*/
dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_NUCLEUS, (uintptr_t) uw_buf);
dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_NUCLEUS, uw_buf);
dtlb_insert_mapping(uw_buf, KA2PA(uw_buf), PAGESIZE_8K, true, true);
}
126,7 → 126,7
flushw(); /* force all userspace windows into memory */
uintptr_t uw_buf = (uintptr_t) THREAD->arch.uspace_window_buffer;
uintptr_t uw_buf = ALIGN_DOWN((uintptr_t) THREAD->arch.uspace_window_buffer, PAGE_SIZE);
if (!overlaps(uw_buf, PAGE_SIZE, base, 1<<KERNEL_PAGE_WIDTH)) {
/*
* The buffer is not covered by the 4M locked kernel DTLB entry
133,7 → 133,7
* and therefore it was given a dedicated locked DTLB entry.
* Demap it.
*/
dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_NUCLEUS, (uintptr_t) uw_buf);
dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_NUCLEUS, uw_buf);
}
/* sample the state of the userspace window buffer */
/trunk/kernel/arch/sparc64/src/proc/thread.c
35,6 → 35,9
#include <proc/thread.h>
#include <arch/proc/thread.h>
#include <mm/frame.h>
#include <mm/page.h>
#include <arch/mm/page.h>
#include <align.h>
 
void thr_constructor_arch(thread_t *t)
{
46,8 → 49,13
 
void thr_destructor_arch(thread_t *t)
{
if (t->arch.uspace_window_buffer)
frame_free((uintptr_t) t->arch.uspace_window_buffer);
if (t->arch.uspace_window_buffer) {
/*
* Mind the possible alignment of the userspace window buffer
* belonging to a killed thread.
*/
frame_free(ALIGN_DOWN((uintptr_t) t->arch.uspace_window_buffer, PAGE_SIZE));
}
}
 
void thread_create_arch(thread_t *t)
58,6 → 66,14
* returned from the slab allocator doesn't have any.
*/
t->arch.uspace_window_buffer = frame_alloc(ONE_FRAME, 0);
} else {
uintptr_t uw_buf = (uintptr_t) t->arch.uspace_window_buffer;
 
/*
* Mind the possible alignment of the userspace window buffer
* belonging to a killed thread.
*/
t->arch.uspace_window_buffer = (uint8_t *) ALIGN_DOWN(uw_buf, PAGE_SIZE);
}
}