The Pedigree Project 0.1
LocalApicTimerHandlerSlots.h
1/*
2 * Copyright (c) 2026, Pedigree Developers
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted.
6 */
7
8#ifndef KERNEL_MACHINE_MACH_PC_LOCALAPICTIMERHANDLERSLOTS_H
9#define KERNEL_MACHINE_MACH_PC_LOCALAPICTIMERHANDLERSLOTS_H
10#include "pedigree/kernel/machine/SchedulerTimerHandlerSlot.h"
11#include "pedigree/kernel/processor/ProcessorInformation.h"
12
13#include <config.h>
14
17 public:
18 static constexpr size_t Capacity = 256;
19
20 LocalApicTimerHandlerSlots() : m_Handlers() {}
21
24 if (processor >= Capacity || !handler)
25 return false;
26
27 return m_Handlers[processor].publish(processor, handler);
28 }
29
35 if (processor >= Capacity || !handler)
36 return false;
37
38 return m_Handlers[processor].unpublish(processor, handler);
39 }
40
46 if (processor >= Capacity)
47 return false;
48 return m_Handlers[processor].beginDispatch(processor, guard);
49 }
50
52 bool isPublished(ProcessorId processor, SchedulerTimerHandler* handler) const {
53 return processor < Capacity && m_Handlers[processor].isPublished(processor, handler);
54 }
55
56 private:
59
60 SchedulerTimerHandlerSlot m_Handlers[Capacity];
61};
62
63#endif
bool beginDispatch(ProcessorId processor, SchedulerTimerHandlerSlot::DispatchGuard &guard)
bool registerHandler(ProcessorId processor, SchedulerTimerHandler *handler)
bool isPublished(ProcessorId processor, SchedulerTimerHandler *handler) const
bool removeHandler(ProcessorId processor, SchedulerTimerHandler *handler)
bool beginDispatch(size_t owner, DispatchGuard &guard)
bool publish(size_t owner, SchedulerTimerHandler *handler)
bool unpublish(size_t owner, SchedulerTimerHandler *handler)
bool isPublished(size_t owner, SchedulerTimerHandler *handler) const
size_t ProcessorId