* Simplify APIC writes.
* Add explicit volatile keyword. * Minor variable name cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41684 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
2ae3d5121c
commit
f599932f82
@ -60,15 +60,14 @@ static int smp_get_current_cpu(void);
|
|||||||
static uint32
|
static uint32
|
||||||
apic_read(uint32 offset)
|
apic_read(uint32 offset)
|
||||||
{
|
{
|
||||||
return *(uint32 *)((uint32)gKernelArgs.arch_args.apic + offset);
|
return *(volatile uint32 *)((uint32)gKernelArgs.arch_args.apic + offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
apic_write(uint32 offset, uint32 data)
|
apic_write(uint32 offset, uint32 data)
|
||||||
{
|
{
|
||||||
uint32 *addr = (uint32 *)((uint32)gKernelArgs.arch_args.apic + offset);
|
*(volatile uint32 *)((uint32)gKernelArgs.arch_args.apic + offset) = data;
|
||||||
*addr = data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -78,9 +77,9 @@ smp_get_current_cpu(void)
|
|||||||
if (gKernelArgs.arch_args.apic == NULL)
|
if (gKernelArgs.arch_args.apic == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
uint8_t apic_id = (apic_read(APIC_ID) & 0xffffffff) >> 24;
|
uint8 apicID = apic_read(APIC_ID) >> 24;
|
||||||
for (uint32 i = 0; i < gKernelArgs.num_cpus; i++) {
|
for (uint32 i = 0; i < gKernelArgs.num_cpus; i++) {
|
||||||
if (gKernelArgs.arch_args.cpu_apic_id[i] == apic_id)
|
if (gKernelArgs.arch_args.cpu_apic_id[i] == apicID)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user