Processor object <nucleus/kernel.h>

A Processor object describes a logical processor and the resources it holds. Every processor in the system has its own Processor object, which it can access through the cpu global variable. This variable is in a per-processor segment, which has a base pointing to the processor's Processor structure.

Structure

typedef struct Processor Processor;
struct Processor {
	Processor *self;
	cpuid_t id;
	struct GDTEntry *gdt;
	struct TSS *tss;
	struct Context *ctx;

	unsigned int tid;
	Scheduler *scheduler;
};

Members

self

A reference to this structure in main memory (not per-processor segment). Since other processors cannot use the local variable, this value may be used safely when passing this around. This is set when the structure is created and should not be modified.

id

The logical ID of the processor. Every processor is given a sequential ID, starting from 0. Using this avoids the need for repeatedly executing cpuid instructions or reading from APIC registers. This value is set when the structure is created and should not be modified.

gdt

A pointer to this processor's Global Descriptor Table. This value is for use only inside the micro-kernel module; its structure is not public. This value is maintained internally and should never be touched.

tss

A pointer to this processor's Task State Segment. This value is for use only inside the micro-kernel module; its structure is not public. This value is maintained internally and should never be touched.

ctx

A pointer to the current Context structure currently loaded by the kernel. This is for internal use only, and should never be touched.

tid

A unique identifier for the currently running thread. This is mostly maintained by the Process Manager, not the kernel, but is available for reading for any module.

scheduler

A reference to the Scheduler object belonging to the processor. This is mostly maintained by the Process Manager, not the kernel.