Changes in / [d5f8f19:a7de7907] in mainline


Ignore:
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/amd64/include/cpu.h

    rd5f8f19 ra7de7907  
    3636#define KERN_amd64_CPU_H_
    3737
    38 #define RFLAGS_CF       (1 << 0)
    39 #define RFLAGS_PF       (1 << 2)
    40 #define RFLAGS_AF       (1 << 4)
    41 #define RFLAGS_ZF       (1 << 6)
    42 #define RFLAGS_SF       (1 << 7)
    43 #define RFLAGS_TF       (1 << 8)
    44 #define RFLAGS_IF       (1 << 9)
    45 #define RFLAGS_DF       (1 << 10)
    46 #define RFLAGS_OF       (1 << 11)
    47 #define RFLAGS_RF       (1 << 16)
     38#define RFLAGS_IF  (1 << 9)
     39#define RFLAGS_DF  (1 << 10)
     40#define RFLAGS_RF  (1 << 16)
    4841
    4942#define EFER_MSR_NUM    0xc0000080
  • kernel/arch/amd64/src/userspace.c

    rd5f8f19 ra7de7907  
    3434
    3535#include <userspace.h>
    36 #include <arch/cpu.h>
    3736#include <arch/pm.h>
    3837#include <arch/types.h>
     
    5150        ipl_t ipl = interrupts_disable();
    5251       
    53         ipl &= ~(RFLAGS_CF | RFLAGS_PF | RFLAGS_AF | RFLAGS_ZF | RFLAGS_SF |
    54             RFLAGS_DF | RFLAGS_OF);
     52        /* Clear CF, PF, AF, ZF, SF, DF, OF */
     53        ipl &= ~(0xcd4);
    5554       
    5655        asm volatile (
    57                 "pushq %[udata_des]\n"
    58                 "pushq %[stack_size]\n"
    59                 "pushq %[ipl]\n"
    60                 "pushq %[utext_des]\n"
    61                 "pushq %[entry]\n"
    62                 "movq %[uarg], %%rax\n"
     56                        "pushq %[udata_des]\n"
     57                        "pushq %[stack_size]\n"
     58                        "pushq %[ipl]\n"
     59                        "pushq %[utext_des]\n"
     60                        "pushq %[entry]\n"
     61                        "movq %[uarg], %%rax\n"
    6362                       
    64                 /* %rdi is defined to hold pcb_ptr - set it to 0 */
    65                 "xorq %%rdi, %%rdi\n"
    66                 "iretq\n"
    67                 :: [udata_des] "i" (gdtselector(UDATA_DES) | PL_USER),
    68                    [stack_size] "r" (kernel_uarg->uspace_stack + THREAD_STACK_SIZE),
    69                    [ipl] "r" (ipl),
    70                    [utext_des] "i" (gdtselector(UTEXT_DES) | PL_USER),
    71                    [entry] "r" (kernel_uarg->uspace_entry),
    72                    [uarg] "r" (kernel_uarg->uspace_uarg)
    73                 : "rax"
    74         );
     63                        /* %rdi is defined to hold pcb_ptr - set it to 0 */
     64                        "xorq %%rdi, %%rdi\n"
     65                        "iretq\n"
     66                        :: [udata_des] "i" (gdtselector(UDATA_DES) | PL_USER),
     67                           [stack_size] "r" (kernel_uarg->uspace_stack + THREAD_STACK_SIZE),
     68                           [ipl] "r" (ipl),
     69                           [utext_des] "i" (gdtselector(UTEXT_DES) | PL_USER),
     70                           [entry] "r" (kernel_uarg->uspace_entry),
     71                           [uarg] "r" (kernel_uarg->uspace_uarg)
     72                        : "rax"
     73                );
    7574       
    7675        /* Unreachable */
    77         while (1)
    78                 ;
     76        while (1);
    7977}
    8078
  • kernel/arch/sparc64/src/sparc64.c

    rd5f8f19 ra7de7907  
    135135void userspace(uspace_arg_t *kernel_uarg)
    136136{
    137         (void) interrupts_disable();
    138137        switch_to_userspace((uintptr_t) kernel_uarg->uspace_entry,
    139138            ((uintptr_t) kernel_uarg->uspace_stack) + STACK_SIZE
  • kernel/generic/src/main/uinit.c

    rd5f8f19 ra7de7907  
    8181        free((uspace_arg_t *) arg);
    8282       
     83        /*
     84         * Disable interrupts so that the execution of userspace() is not
     85         * disturbed by any interrupts as some of the userspace()
     86         * implementations will switch to the userspace stack before switching
     87         * the mode.
     88         */
     89        (void) interrupts_disable();
    8390        userspace(&uarg);
    8491}
  • kernel/generic/src/proc/task.c

    rd5f8f19 ra7de7907  
    7575static task_id_t task_counter = 0;
    7676
    77 /* Forward declarations. */
    78 static void task_kill_internal(task_t *);
    79 
    8077/** Initialize kernel tasks support. */
    8178void task_init(void)
     
    8683
    8784/*
    88  * The idea behind this walker is to kill and count all tasks different from
     85 * The idea behind this walker is to remember a single task different from
    8986 * TASK.
    9087 */
     
    9289{
    9390        task_t *t = avltree_get_instance(node, task_t, tasks_tree_node);
    94         unsigned *cnt = (unsigned *) arg;
    95 
    96         if (t != TASK) {
    97                 (*cnt)++;
    98 #ifdef CONFIG_DEBUG
    99                 printf("[%"PRIu64"] ", t->taskid);
    100 #endif
    101                 task_kill_internal(t);
     91        task_t **tp = (task_t **) arg;
     92
     93        if (t != TASK) {
     94                *tp = t;
     95                return false;   /* stop walking */
    10296        }
    10397
     
    108102void task_done(void)
    109103{
    110         unsigned tasks_left;
    111 
     104        task_t *t;
    112105        do { /* Repeat until there are any tasks except TASK */
     106               
    113107                /* Messing with task structures, avoid deadlock */
    114 #ifdef CONFIG_DEBUG
    115                 printf("Killing tasks... ");
    116 #endif
    117108                ipl_t ipl = interrupts_disable();
    118109                spinlock_lock(&tasks_lock);
    119                 tasks_left = 0;
    120                 avltree_walk(&tasks_tree, task_done_walker, &tasks_left);
    121                 spinlock_unlock(&tasks_lock);
    122                 interrupts_restore(ipl);
    123                 thread_sleep(1);
     110               
     111                t = NULL;
     112                avltree_walk(&tasks_tree, task_done_walker, &t);
     113               
     114                if (t != NULL) {
     115                        task_id_t id = t->taskid;
     116                       
     117                        spinlock_unlock(&tasks_lock);
     118                        interrupts_restore(ipl);
     119                       
    124120#ifdef CONFIG_DEBUG
    125                 printf("\n");
    126 #endif
    127         } while (tasks_left);
     121                        printf("Killing task %" PRIu64 "\n", id);
     122#endif                 
     123                        task_kill(id);
     124                        thread_usleep(10000);
     125                } else {
     126                        spinlock_unlock(&tasks_lock);
     127                        interrupts_restore(ipl);
     128                }
     129               
     130        } while (t != NULL);
    128131}
    129132
     
    347350}
    348351
    349 static void task_kill_internal(task_t *ta)
    350 {
    351         link_t *cur;
    352 
    353         /*
    354          * Interrupt all threads.
    355          */
    356         spinlock_lock(&ta->lock);
    357         for (cur = ta->th_head.next; cur != &ta->th_head; cur = cur->next) {
    358                 thread_t *thr;
    359                 bool sleeping = false;
    360                
    361                 thr = list_get_instance(cur, thread_t, th_link);
    362                
    363                 spinlock_lock(&thr->lock);
    364                 thr->interrupted = true;
    365                 if (thr->state == Sleeping)
    366                         sleeping = true;
    367                 spinlock_unlock(&thr->lock);
    368                
    369                 if (sleeping)
    370                         waitq_interrupt_sleep(thr);
    371         }
    372         spinlock_unlock(&ta->lock);
    373 }
    374 
    375352/** Kill task.
    376353 *
     
    386363        ipl_t ipl;
    387364        task_t *ta;
     365        link_t *cur;
    388366
    389367        if (id == 1)
     
    397375                return ENOENT;
    398376        }
    399         task_kill_internal(ta);
    400377        spinlock_unlock(&tasks_lock);
     378       
     379        /*
     380         * Interrupt all threads.
     381         */
     382        spinlock_lock(&ta->lock);
     383        for (cur = ta->th_head.next; cur != &ta->th_head; cur = cur->next) {
     384                thread_t *thr;
     385                bool sleeping = false;
     386               
     387                thr = list_get_instance(cur, thread_t, th_link);
     388               
     389                spinlock_lock(&thr->lock);
     390                thr->interrupted = true;
     391                if (thr->state == Sleeping)
     392                        sleeping = true;
     393                spinlock_unlock(&thr->lock);
     394               
     395                if (sleeping)
     396                        waitq_interrupt_sleep(thr);
     397        }
     398        spinlock_unlock(&ta->lock);
    401399        interrupts_restore(ipl);
     400       
    402401        return 0;
    403402}
  • tools/config.py

    rd5f8f19 ra7de7907  
    225225        "Create output configuration"
    226226       
    227         revision = commands.getoutput('bzr version-info --custom --template="{revision_id}" 2> /dev/null')
     227        revision = commands.getoutput('svnversion . 2> /dev/null')
    228228        timestamp = commands.getoutput('date "+%Y-%m-%d %H:%M:%S"')
    229229       
Note: See TracChangeset for help on using the changeset viewer.