mirror of
https://github.com/genodelabs/genode.git
synced 2025-05-03 09:12:57 +00:00
base-hw: explicit bounds check in store_apic_id
Avoid relying on the caller regarding the CPU index argument to ease the reasoning about the code.
This commit is contained in:
parent
01713c74f9
commit
5635c1318c
@ -209,10 +209,13 @@ class Board::Pic : public Genode::Mmio
|
|||||||
|
|
||||||
void irq_mode(unsigned irq, unsigned trigger, unsigned polarity);
|
void irq_mode(unsigned irq, unsigned trigger, unsigned polarity);
|
||||||
|
|
||||||
void store_apic_id(unsigned const cpu_id) {
|
void store_apic_id(unsigned const cpu_id)
|
||||||
|
{
|
||||||
|
if (cpu_id < NR_OF_CPUS) {
|
||||||
Id::access_t const lapic_id = read<Id>();
|
Id::access_t const lapic_id = read<Id>();
|
||||||
lapic_ids[cpu_id] = (lapic_id >> 24) & 0xff;
|
lapic_ids[cpu_id] = (lapic_id >> 24) & 0xff;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void send_ipi(unsigned const);
|
void send_ipi(unsigned const);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user