summaryrefslogtreecommitdiffstats
path: root/src/include/kernel/cpu.H
blob: 4d5134114fa79c5723422935ec36cbf1fc96a0eb (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
28
#ifndef __KERNEL_CPU_H
#define __KERNEL_CPU_H

#include <kernel/types.h>
#include <arch/ppc.H>
#include <builtins.h>

// Thread ID support only, Power7 (4 threads).
#define KERNEL_MAX_SUPPORTED_CPUS (4 * 8 * 4) // Sockets, cores, threads.

class Scheduler;

struct cpu_t
{
    void* kernel_stack;
    cpuid_t cpu;

    Scheduler* scheduler;
    task_t* idle_task;
};

ALWAYS_INLINE
inline uint64_t getCpuId()
{
    return getPIR() & (KERNEL_MAX_SUPPORTED_CPUS - 1);
}

#endif
OpenPOWER on IntegriCloud