summaryrefslogtreecommitdiffstats
path: root/sys/ia64
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2003-06-12 00:15:18 +0000
committermarcel <marcel@FreeBSD.org>2003-06-12 00:15:18 +0000
commit4d9ed138d159fb2a89482211c9477013fb1485c4 (patch)
tree8ec8d29673e3f75447595c7d14d3361995061967 /sys/ia64
parentb0678d7a4429dd07b729a73ad0e24e2d62fec0fb (diff)
downloadFreeBSD-src-4d9ed138d159fb2a89482211c9477013fb1485c4.zip
FreeBSD-src-4d9ed138d159fb2a89482211c9477013fb1485c4.tar.gz
Make sure pcpu->pc_pcb is pointing to a 16-byte aligned address. The
PCB contains FP registers, whose alignment must be 16 bytes at least. Since the PCB pointed to by pc_pcb is immediately after the PCPU itself, round-up the size of thge PCPU to a multiple of 16 bytes. The PCPU is page aligned. This fixes a misalignment trap caused by stopping a CPU in a SMP kernel, such as been done when entering the debugger. Reported by: Alan Robinson <alan.robinson@fujitsu-siemens.com>
Diffstat (limited to 'sys/ia64')
-rw-r--r--sys/ia64/ia64/machdep.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/ia64/ia64/machdep.c b/sys/ia64/ia64/machdep.c
index 49015b5..90bed54 100644
--- a/sys/ia64/ia64/machdep.c
+++ b/sys/ia64/ia64/machdep.c
@@ -244,9 +244,17 @@ cpu_throw(struct thread *old __unused, struct thread *new)
void
cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t size)
{
- KASSERT(size >= sizeof(struct pcpu) + sizeof(struct pcb),
+ size_t pcpusz;
+
+ /*
+ * Make sure the PCB is 16-byte aligned by making the PCPU
+ * a multiple of 16 bytes. We assume the PCPU is 16-byte
+ * aligned itself.
+ */
+ pcpusz = (sizeof(struct pcpu) + 15) & ~15;
+ KASSERT(size >= pcpusz + sizeof(struct pcb),
("%s: too small an allocation for pcpu", __func__));
- pcpu->pc_pcb = (void*)(pcpu+1);
+ pcpu->pc_pcb = (struct pcb *)((char*)pcpu + pcpusz);
}
static void
OpenPOWER on IntegriCloud