summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2005-02-15 07:21:20 +0000
committernjl <njl@FreeBSD.org>2005-02-15 07:21:20 +0000
commit9f5b889b7b37c36d49786ca6e494aa05ad996edb (patch)
tree089d4523a049b14a9cabfdf4bb44a1b3f9f83907
parent9a64d9e8994f83844324dad52bbf524cd9832cdb (diff)
downloadFreeBSD-src-9f5b889b7b37c36d49786ca6e494aa05ad996edb.zip
FreeBSD-src-9f5b889b7b37c36d49786ca6e494aa05ad996edb.tar.gz
Correct a few bugs in the legacy cpu attachment. Get the unit from the
parent cpu device before passing it to pcpu_find(). Get the ivars from the child, not parent cpu device. These bugs would cause a panic when dereferencing the pcpu ivar, but weren't present in the acpi attachment which it seems most people are using.
-rw-r--r--sys/i386/i386/legacy.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/i386/i386/legacy.c b/sys/i386/i386/legacy.c
index 276c40f..e5f7e8e 100644
--- a/sys/i386/i386/legacy.c
+++ b/sys/i386/i386/legacy.c
@@ -314,8 +314,7 @@ cpu_add_child(device_t bus, int order, const char *name, int unit)
return (NULL);
resource_list_init(&cd->cd_rl);
- pc = pcpu_find(unit);
- KASSERT(pc != NULL, ("pcpu_find failed"));
+ pc = pcpu_find(device_get_unit(bus));
cd->cd_pcpu = pc;
child = device_add_child_ordered(bus, order, name, unit);
@@ -343,7 +342,7 @@ cpu_read_ivar(device_t dev, device_t child, int index, uintptr_t *result)
if (index != CPU_IVAR_PCPU)
return (ENOENT);
- cpdev = device_get_ivars(dev);
+ cpdev = device_get_ivars(child);
*result = (uintptr_t)cpdev->cd_pcpu;
return (0);
}
OpenPOWER on IntegriCloud