Changeset 8605b24 in mainline


Ignore:
Timestamp:
2008-06-14T11:48:37Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d7c9fcb
Parents:
c7511ec
Message:

Maintain cache coherence after sys_task_spawn() copies ELF image from user space.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/proc/task.c

    rc7511ec r8605b24  
    4646#include <synch/waitq.h>
    4747#include <arch.h>
     48#include <arch/barrier.h>
    4849#include <panic.h>
    4950#include <adt/avl.h>
     
    260261        if (rc != EOK)
    261262                return rc;
    262        
    263         uspace_arg_t *kernel_uarg = (uspace_arg_t *) malloc(sizeof(uspace_arg_t), 0);
     263
     264        /*
     265         * Not very efficient and it would be better to call it on code only,
     266         * but this whole function is a temporary hack anyway and one day it
     267         * will go in favor of the userspace dynamic loader.
     268         */
     269        smc_coherence_block(kimage, size);
     270       
     271        uspace_arg_t *kernel_uarg;
     272        kernel_uarg = (uspace_arg_t *) malloc(sizeof(uspace_arg_t), 0);
    264273        if (kernel_uarg == NULL) {
    265274                free(kimage);
     
    290299       
    291300        as_area_t *area = as_area_create(as,
    292                 AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE,
    293                 LOADED_PROG_STACK_PAGES_NO * PAGE_SIZE, USTACK_ADDRESS,
    294                 AS_AREA_ATTR_NONE, &anon_backend, NULL);
     301            AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE,
     302            LOADED_PROG_STACK_PAGES_NO * PAGE_SIZE, USTACK_ADDRESS,
     303            AS_AREA_ATTR_NONE, &anon_backend, NULL);
    295304        if (area == NULL) {
    296305                as_destroy(as);
     
    312321       
    313322        thread_t *thread = thread_create(uinit, kernel_uarg, task,
    314                 THREAD_FLAG_USPACE, "user", false);
     323            THREAD_FLAG_USPACE, "user", false);
    315324        if (thread == NULL) {
    316325                task_destroy(task);
     
    443452
    444453#ifdef __32_BITS__     
    445         printf("%-6" PRIu64 " %-10s %-3" PRIu32 " %10p %10p %9" PRIu64 "%c %7ld %6ld",
    446                 t->taskid, t->name, t->context, t, t->as, cycles, suffix,
    447                 atomic_get(&t->refcount), atomic_get(&t->active_calls));
     454        printf("%-6" PRIu64 " %-10s %-3" PRIu32 " %10p %10p %9" PRIu64
     455            "%c %7ld %6ld", t->taskid, t->name, t->context, t, t->as, cycles,
     456            suffix, atomic_get(&t->refcount), atomic_get(&t->active_calls));
    448457#endif
    449458
    450459#ifdef __64_BITS__
    451         printf("%-6" PRIu64 " %-10s %-3" PRIu32 " %18p %18p %9" PRIu64 "%c %7ld %6ld",
    452                 t->taskid, t->name, t->context, t, t->as, cycles, suffix,
    453                 atomic_get(&t->refcount), atomic_get(&t->active_calls));
     460        printf("%-6" PRIu64 " %-10s %-3" PRIu32 " %18p %18p %9" PRIu64
     461            "%c %7ld %6ld", t->taskid, t->name, t->context, t, t->as, cycles,
     462            suffix, atomic_get(&t->refcount), atomic_get(&t->active_calls));
    454463#endif
    455464
     
    475484#ifdef __32_BITS__     
    476485        printf("taskid name       ctx address    as         "
    477                 "cycles     threads calls  callee\n");
     486            "cycles     threads calls  callee\n");
    478487        printf("------ ---------- --- ---------- ---------- "
    479                 "---------- ------- ------ ------>\n");
     488            "---------- ------- ------ ------>\n");
    480489#endif
    481490
    482491#ifdef __64_BITS__
    483492        printf("taskid name       ctx address            as                 "
    484                 "cycles     threads calls  callee\n");
     493            "cycles     threads calls  callee\n");
    485494        printf("------ ---------- --- ------------------ ------------------ "
    486                 "---------- ------- ------ ------>\n");
     495            "---------- ------- ------ ------>\n");
    487496#endif
    488497
Note: See TracChangeset for help on using the changeset viewer.