summaryrefslogtreecommitdiffstats
path: root/src/include/kernel/cpu.H
blob: 81b43a57c8e0c9d8e20ecb3133ba9cbc10d77e02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifndef __KERNEL_CPU_H
#define __KERNEL_CPU_H

#include <kernel/types.h>
#include <kernel/ppcarch.H>

// Thread ID support only, Power7 (4 threads).
#define KERNEL_MAX_SUPPORTED_CPUS 4

class Scheduler;

struct cpu_t
{
    void* kernel_stack;
    cpuid_t cpu;

    Scheduler* scheduler;
    task_t* idle_task;
};

__attribute__((always_inline))
inline uint64_t getCpuId()
{
    return ppc_getPIR() & (KERNEL_MAX_SUPPORTED_CPUS - 1);
}

#endif
OpenPOWER on IntegriCloud