Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/cpu.h

    rd23712e rd19b3fc  
    4444#include <arch.h>
    4545
    46 #define CPU                  (CURRENT->cpu)
    47 #define CPU_LOCAL            (&CPU->local)
     46#define CPU                  CURRENT->cpu
    4847
    49 /**
    50  * Contents of CPU_LOCAL. These are variables that are only ever accessed by
    51  * the CPU they belong to, so they don't need any synchronization,
    52  * just locally disabled interrupts.
     48/** CPU structure.
     49 *
     50 * There is one structure like this for every processor.
    5351 */
    54 typedef struct cpu_local {
     52typedef struct cpu {
     53        IRQ_SPINLOCK_DECLARE(lock);
     54
     55        tlb_shootdown_msg_t tlb_messages[TLB_MESSAGE_QUEUE_LEN];
     56        size_t tlb_messages_count;
     57
     58        context_t saved_context;
     59
     60        atomic_t nrdy;
     61        runq_t rq[RQ_COUNT];
     62        volatile size_t needs_relink;
     63
     64        IRQ_SPINLOCK_DECLARE(timeoutlock);
     65        list_t timeout_active_list;
     66
    5567        /**
    5668         * When system clock loses a tick, it is
    5769         * recorded here so that clock() can react.
     70         * This variable is CPU-local and can be
     71         * only accessed when interrupts are
     72         * disabled.
    5873         */
    5974        size_t missed_clock_ticks;
    60 
    61         uint64_t current_clock_tick;
    62         uint64_t preempt_deadline;  /* < when should the currently running thread be preempted */
    63         uint64_t relink_deadline;
    64 
    65         /**
    66          * Stack used by scheduler when there is no running thread.
    67          * This field is unchanged after initialization.
    68          */
    69         uint8_t *stack;
    7075
    7176        /**
     
    7479        bool idle;
    7580        uint64_t last_cycle;
    76 
    77         context_t scheduler_context;
    78 
    79         struct thread *prev_thread;
    80 } cpu_local_t;
    81 
    82 /** CPU structure.
    83  *
    84  * There is one structure like this for every processor.
    85  */
    86 typedef struct cpu {
    87         IRQ_SPINLOCK_DECLARE(tlb_lock);
    88 
    89         tlb_shootdown_msg_t tlb_messages[TLB_MESSAGE_QUEUE_LEN];
    90         size_t tlb_messages_count;
    91 
    92         atomic_size_t nrdy;
    93         runq_t rq[RQ_COUNT];
    94 
    95         IRQ_SPINLOCK_DECLARE(timeoutlock);
    96         list_t timeout_active_list;
    97 
    98         /**
    99          * Processor cycle accounting.
    100          */
    101         atomic_time_stat_t idle_cycles;
    102         atomic_time_stat_t busy_cycles;
     81        uint64_t idle_cycles;
     82        uint64_t busy_cycles;
    10383
    10484        /**
     
    11595        cpu_arch_t arch;
    11696
    117 #ifdef CONFIG_FPU_LAZY
    118         /* For synchronization between FPU trap and thread destructor. */
    119         IRQ_SPINLOCK_DECLARE(fpu_lock);
    120 #endif
    121         _Atomic(struct thread *) fpu_owner;
     97        struct thread *fpu_owner;
    12298
    123         cpu_local_t local;
     99        /**
     100         * Stack used by scheduler when there is no running thread.
     101         */
     102        uint8_t *stack;
    124103} cpu_t;
    125104
Note: See TracChangeset for help on using the changeset viewer.