Changeset ee454eb in mainline for kernel/arch/sparc64/src/proc


Ignore:
Timestamp:
2006-08-30T15:50:29Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
beb3926a
Parents:
e11ae91
Message:

sparc64 work.
More bits needed to reach the userspace milestone were added.
The preemptible_handler(), still a prototype, now contains all functionality it needs.
Some sanitation was added to functions expecting page-aligned pointers to
userspace window buffer.

Location:
kernel/arch/sparc64/src/proc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/src/proc/scheduler.c

    re11ae91 ree454eb  
    7979                 */
    8080                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);
    8282                if (!overlaps(uw_buf, PAGE_SIZE, base, 1<<KERNEL_PAGE_WIDTH)) {
    8383                        /*
    8484                         * The buffer is not covered by the 4M locked kernel DTLB entry.
    8585                         */
    86                         dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_NUCLEUS, (uintptr_t) uw_buf);
     86                        dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_NUCLEUS, uw_buf);
    8787                        dtlb_insert_mapping(uw_buf, KA2PA(uw_buf), PAGESIZE_8K, true, true);
    8888                }
     
    127127                flushw();       /* force all userspace windows into memory */
    128128               
    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);
    130130                if (!overlaps(uw_buf, PAGE_SIZE, base, 1<<KERNEL_PAGE_WIDTH)) {
    131131                        /*
     
    134134                         * Demap it.
    135135                         */
    136                         dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_NUCLEUS, (uintptr_t) uw_buf);
     136                        dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_NUCLEUS, uw_buf);
    137137                }
    138138       
  • kernel/arch/sparc64/src/proc/thread.c

    re11ae91 ree454eb  
    3636#include <arch/proc/thread.h>
    3737#include <mm/frame.h>
     38#include <mm/page.h>
     39#include <arch/mm/page.h>
     40#include <align.h>
    3841
    3942void thr_constructor_arch(thread_t *t)
     
    4750void thr_destructor_arch(thread_t *t)
    4851{
    49         if (t->arch.uspace_window_buffer)
    50                 frame_free((uintptr_t) t->arch.uspace_window_buffer);
     52        if (t->arch.uspace_window_buffer) {
     53                /*
     54                 * Mind the possible alignment of the userspace window buffer
     55                 * belonging to a killed thread.
     56                 */
     57                frame_free(ALIGN_DOWN((uintptr_t) t->arch.uspace_window_buffer, PAGE_SIZE));
     58        }
    5159}
    5260
     
    5967                 */
    6068                t->arch.uspace_window_buffer = frame_alloc(ONE_FRAME, 0);
     69        } else {
     70                uintptr_t uw_buf = (uintptr_t) t->arch.uspace_window_buffer;
     71
     72                /*
     73                 * Mind the possible alignment of the userspace window buffer
     74                 * belonging to a killed thread.
     75                 */
     76                 t->arch.uspace_window_buffer = (uint8_t *) ALIGN_DOWN(uw_buf, PAGE_SIZE);
    6177        }
    6278}
Note: See TracChangeset for help on using the changeset viewer.