Changeset 1066041 in mainline for kernel/generic/src


Ignore:
Timestamp:
2012-07-11T07:58:03Z (14 years ago)
Author:
Adam Hraska <adam.hraska+hos@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
935e28c
Parents:
b68ae24
Message:

preemption_disable: Turned functions into macros. Moved THREAD, AS, TASK, CPU into thread.h, as.h, task.h, cpu.h to fix the include hell that ensued.

Location:
kernel/generic/src
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/console/chardev.c

    rb68ae24 r1066041  
    3939#include <print.h>
    4040#include <func.h>
    41 #include <arch.h>
     41#include <cpu.h>
    4242
    4343/** Initialize input character device.
  • kernel/generic/src/console/console.c

    rb68ae24 r1066041  
    5252#include <errno.h>
    5353#include <str.h>
     54#include <mm/frame.h> /* SIZE2FRAMES */
     55#include <mm/slab.h>  /* malloc */
    5456
    5557#define KLOG_PAGES    8
  • kernel/generic/src/console/kconsole.c

    rb68ae24 r1066041  
    5959#include <putchar.h>
    6060#include <str.h>
     61#include <mm/slab.h>
    6162
    6263/** Simple kernel console.
  • kernel/generic/src/debug/panic.c

    rb68ae24 r1066041  
    9797        if (THE != NULL) {
    9898                printf("pe=%" PRIun " thr=%p task=%p cpu=%p as=%p"
    99                     " magic=%#" PRIx32 "\n", THE->preemption_disabled,
     99                    " magic=%#" PRIx32 "\n", THE->preemption,
    100100                    THE->thread, THE->task, THE->cpu, THE->as, THE->magic);
    101101        } else
  • kernel/generic/src/ipc/kbox.c

    rb68ae24 r1066041  
    4444#include <ipc/kbox.h>
    4545#include <print.h>
     46#include <proc/thread.h>
    4647
    4748void ipc_kbox_cleanup(void)
  • kernel/generic/src/lib/str.c

    rb68ae24 r1066041  
    111111#include <debug.h>
    112112#include <macros.h>
     113#include <mm/slab.h>
    113114
    114115/** Check the condition if wchar_t is signed */
  • kernel/generic/src/main/shutdown.c

    rb68ae24 r1066041  
    3737
    3838#include <arch.h>
     39#include <proc/task.h>
    3940#include <func.h>
    4041#include <print.h>
  • kernel/generic/src/mm/frame.c

    rb68ae24 r1066041  
    6161#include <config.h>
    6262#include <str.h>
     63#include <proc/thread.h> /* THREAD */
    6364
    6465zones_t zones;
  • kernel/generic/src/mm/km.c

    rb68ae24 r1066041  
    4949#include <macros.h>
    5050#include <bitops.h>
     51#include <proc/thread.h>
    5152
    5253static ra_arena_t *km_ni_arena;
  • kernel/generic/src/mm/slab.c

    rb68ae24 r1066041  
    114114#include <bitops.h>
    115115#include <macros.h>
     116#include <cpu.h>
    116117
    117118IRQ_SPINLOCK_STATIC_INITIALIZE(slab_cache_lock);
  • kernel/generic/src/preempt/preemption.c

    rb68ae24 r1066041  
    3737
    3838#include <preemption.h>
    39 #include <arch.h>
    40 #include <compiler/barrier.h>
    41 #include <debug.h>
    4239#include <proc/scheduler.h>
    4340
    44 /** Increment preemption disabled counter. */
    45 void preemption_disable(void)
    46 {
    47         THE->preemption_disabled++;
    48         compiler_barrier();
    49 }
    50 
    51 /** Decrement preemption disabled counter. */
    52 void preemption_enable(void)
    53 {
    54         preemption_enable_noresched();
    55        
    56         if (PREEMPTION_ENABLED && THREAD && THREAD->need_resched) {
    57                 preemption_enabled_scheduler();
    58         }
    59 }
    60 
    61 /** Decrement preemption disabled counter. */
    62 void preemption_enable_noresched(void)
    63 {
    64         ASSERT(PREEMPTION_DISABLED);
    65         compiler_barrier();
    66         THE->preemption_disabled--;
    67 }
    6841
    6942/** Preemption was enabled. Calls scheduler(). */
     
    7144{
    7245        ASSERT(PREEMPTION_ENABLED);
     46        ASSERT(PREEMPTION_NEEDED);
    7347       
    7448        /*
     
    8559}
    8660
     61/** Sets a flag to reschedule the next time preemption is enabled. */
     62void preemption_set_needed(void)
     63{
     64        /* No need to disable interrupts. */
     65        THE->preemption |= PREEMPTION_NEEDED_FLAG;
     66}
     67
     68/** Instructs not to reschedule immediately when preemption is enabled. */
     69void preemption_clear_needed(void)
     70{
     71        /* No need to disable interrupts. */
     72        THE->preemption &= ~PREEMPTION_NEEDED_FLAG;
     73}
     74
    8775/** @}
    8876 */
  • kernel/generic/src/proc/scheduler.c

    rb68ae24 r1066041  
    6565#include <debug.h>
    6666#include <stacktrace.h>
     67#include <cpu.h>
    6768
    6869static void scheduler_separated_stack(void);
     
    421422                after_thread_ran();
    422423               
    423                 THREAD->need_resched = false;
     424                preemption_clear_needed();
    424425               
    425426                switch (THREAD->state) {
  • kernel/generic/src/proc/the.c

    rb68ae24 r1066041  
    4343
    4444#include <arch.h>
     45#include <debug.h>
    4546
    4647/** Initialize THE structure
     
    5354void the_initialize(the_t *the)
    5455{
    55         the->preemption_disabled = 0;
     56        the->preemption = 0;
    5657        the->cpu = NULL;
    5758        the->thread = NULL;
  • kernel/generic/src/proc/thread.c

    rb68ae24 r1066041  
    375375        thread->nomigrate = 0;
    376376        thread->state = Entering;
    377         thread->need_resched = false;
    378377       
    379378        timeout_initialize(&thread->sleep_timeout);
  • kernel/generic/src/smp/smp_call.c

    rb68ae24 r1066041  
    3737
    3838#include <smp/smp_call.h>
     39#include <arch/barrier.h>
     40#include <arch/asm.h>  /* interrupt_disable */
    3941#include <arch.h>
    4042#include <config.h>
    4143#include <preemption.h>
    42 #include <arch/barrier.h>
    43 #include <arch/asm.h>  /* interrupt_disable */
    44 
     44#include <debug.h>
     45#include <cpu.h>
    4546
    4647static void call_start(smp_call_t *call_info, smp_call_func_t func, void *arg);
  • kernel/generic/src/synch/mutex.c

    rb68ae24 r1066041  
    4141#include <arch.h>
    4242#include <stacktrace.h>
     43#include <cpu.h>
     44#include <proc/thread.h>
    4345
    4446/** Initialize mutex.
  • kernel/generic/src/synch/smc.c

    rb68ae24 r1066041  
    4141#include <arch/barrier.h>
    4242#include <synch/smc.h>
     43#include <mm/as.h>
    4344
    4445sysarg_t sys_smc_coherence(uintptr_t va, size_t size)
  • kernel/generic/src/synch/spinlock.c

    rb68ae24 r1066041  
    4545#include <symtab.h>
    4646#include <stacktrace.h>
     47#include <cpu.h>
    4748
    4849#ifdef CONFIG_SMP
  • kernel/generic/src/time/clock.c

    rb68ae24 r1066041  
    225225#endif
    226226                        } else {
    227                                 THREAD->need_resched = true;
     227                                preemption_set_needed();
    228228                        }
    229229                }
  • kernel/generic/src/udebug/udebug.c

    rb68ae24 r1066041  
    4444#include <print.h>
    4545#include <arch.h>
     46#include <proc/task.h>
     47#include <proc/thread.h>
    4648
    4749/** Initialize udebug part of task structure.
Note: See TracChangeset for help on using the changeset viewer.