summaryrefslogtreecommitdiffstats
path: root/src/include/kernel/cpu.H
blob: 2f012700c06a8f344565ea3c37f766c7cfbf88ef (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

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