PERFORCE change 29850 for review
Marcel Moolenaar
marcel at FreeBSD.org
Sat Apr 26 20:26:14 PDT 2003
http://perforce.freebsd.org/chv.cgi?CH=29850
Change 29850 by marcel at marcel_nfs on 2003/04/26 20:25:52
Deal with unaligned memory accesses again. Don't try too hard
though. There's just too much that can go wrong or that we
don't deal with that it's merely intended to get ntpd(8) up
and running again. I'll get back here later..
While reverting the change to files.ia64, take this
opportunity to resort.
Affected files ...
.. //depot/projects/ia64_epc/sys/conf/files.ia64#9 edit
.. //depot/projects/ia64_epc/sys/ia64/ia64/trap.c#16 edit
.. //depot/projects/ia64_epc/sys/ia64/ia64/unaligned.c#3 edit
Differences ...
==== //depot/projects/ia64_epc/sys/conf/files.ia64#9 (text+ko) ====
@@ -18,14 +18,49 @@
no-obj no-implicit-rule before-depend \
clean "atkbdmap.h"
#
+crypto/blowfish/bf_enc.c optional crypto
+crypto/blowfish/bf_enc.c optional ipsec ipsec_esp
+crypto/des/des_enc.c optional crypto
+crypto/des/des_enc.c optional ipsec ipsec_esp
+dev/advansys/adv_isa.c optional adv isa
+dev/aic/aic_isa.c optional aic isa
+dev/fb/fb.c optional fb
+dev/fb/fb.c optional vga sc
+dev/fb/splash.c optional splash
+dev/kbd/atkbd.c optional atkbd
+dev/kbd/atkbdc.c optional atkbdc
+dev/kbd/kbd.c optional atkbd
+dev/kbd/kbd.c optional kbd
+dev/kbd/kbd.c optional sc
+dev/kbd/kbd.c optional ukbd
+dev/sio/sio_isa.c optional sio acpi
+dev/sio/sio_isa.c optional sio isa
+dev/syscons/schistory.c optional sc
+dev/syscons/scmouse.c optional sc
+dev/syscons/scterm-dumb.c optional sc
+dev/syscons/scterm-sc.c optional sc
+dev/syscons/scterm.c optional sc
+dev/syscons/scvgarndr.c optional sc vga
+dev/syscons/scvidctl.c optional sc
+dev/syscons/scvtb.c optional sc
+dev/syscons/syscons.c optional sc
+dev/syscons/sysmouse.c optional sc
+dev/vga/vga.c optional vga
+dev/vga/vga_isa.c optional vga isa
+dev/vga/vga_pci.c optional vga pci
+dev/vga/vga_vid.c optional vga sc
+geom/geom_bsd.c standard
+geom/geom_bsd_enc.c standard
+geom/geom_gpt.c standard
+geom/geom_mbr.c standard
+geom/geom_mbr_enc.c standard
+ia64/acpica/OsdEnvironment.c optional acpi
ia64/acpica/acpi_machdep.c optional acpi
ia64/acpica/acpi_wakeup.c optional acpi
-ia64/acpica/OsdEnvironment.c optional acpi
ia64/acpica/madt.c optional acpi
ia64/ia32/ia32_misc.c optional ia32
ia64/ia32/ia32_sysent.c optional ia32
ia64/ia32/ia32_sysvec.c optional ia32
-ia64/ia64/ia64-gdbstub.c optional ddb
ia64/ia64/autoconf.c standard
ia64/ia64/busdma_machdep.c standard
ia64/ia64/clock.c standard
@@ -40,6 +75,7 @@
ia64/ia64/eficlock.c standard
ia64/ia64/elf_machdep.c standard
ia64/ia64/exception.s standard
+ia64/ia64/ia64-gdbstub.c optional ddb
ia64/ia64/in_cksum.c optional inet
ia64/ia64/interrupt.c standard
ia64/ia64/locore.s standard no-obj
@@ -54,55 +90,19 @@
ia64/ia64/sapic.c standard
ia64/ia64/setjmp.s standard
ia64/ia64/sio_machdep.c optional sio
-ia64/ia64/support.s standard
ia64/ia64/ssc.c optional ski
ia64/ia64/sscdisk.c optional ski
+ia64/ia64/support.s standard
ia64/ia64/sys_machdep.c standard
ia64/ia64/syscall.s standard
ia64/ia64/trap.c standard
-#ia64/ia64/unaligned.c standard
+ia64/ia64/unaligned.c standard
ia64/ia64/unwind.c standard
ia64/ia64/vga_machdep.c optional vga
ia64/ia64/vm_machdep.c standard
ia64/isa/isa.c optional isa
ia64/isa/isa_dma.c optional isa
ia64/pci/pci_cfgreg.c optional pci
-crypto/blowfish/bf_enc.c optional ipsec ipsec_esp
-crypto/des/des_enc.c optional ipsec ipsec_esp
-crypto/blowfish/bf_enc.c optional crypto
-crypto/des/des_enc.c optional crypto
-dev/advansys/adv_isa.c optional adv isa
-dev/aic/aic_isa.c optional aic isa
-dev/fb/fb.c optional fb
-dev/fb/fb.c optional vga sc
-dev/fb/splash.c optional splash
-dev/kbd/atkbd.c optional atkbd
-dev/kbd/atkbdc.c optional atkbdc
-dev/kbd/kbd.c optional atkbd
-dev/kbd/kbd.c optional kbd
-dev/kbd/kbd.c optional sc
-dev/kbd/kbd.c optional ukbd
-dev/sio/sio_isa.c optional sio acpi
-dev/sio/sio_isa.c optional sio isa
-dev/syscons/schistory.c optional sc
-dev/syscons/scmouse.c optional sc
-dev/syscons/scterm.c optional sc
-dev/syscons/scterm-dumb.c optional sc
-dev/syscons/scterm-sc.c optional sc
-dev/syscons/scvgarndr.c optional sc vga
-dev/syscons/scvidctl.c optional sc
-dev/syscons/scvtb.c optional sc
-dev/syscons/syscons.c optional sc
-dev/syscons/sysmouse.c optional sc
-dev/vga/vga.c optional vga
-dev/vga/vga_isa.c optional vga isa
-dev/vga/vga_pci.c optional vga pci
-dev/vga/vga_vid.c optional vga sc
-geom/geom_bsd.c standard
-geom/geom_bsd_enc.c standard
-geom/geom_gpt.c standard
-geom/geom_mbr.c standard
-geom/geom_mbr_enc.c standard
isa/atkbd_isa.c optional isa atkbd
isa/atkbdc_isa.c optional isa atkbdc
isa/fd.c optional fdc isa
@@ -110,15 +110,15 @@
isa/psm.c optional psm isa
isa/syscons_isa.c optional sc
kern/imgact_elf32.c optional ia32
-libkern/ia64/bswap16.S standard
-libkern/ia64/bswap32.S standard
+libkern/bcmp.c standard
+libkern/ffs.c standard
+libkern/ia64/__divdi3.S standard
libkern/ia64/__divsi3.S standard
+libkern/ia64/__moddi3.S standard
libkern/ia64/__modsi3.S standard
+libkern/ia64/__udivdi3.S standard
libkern/ia64/__udivsi3.S standard
+libkern/ia64/__umoddi3.S standard
libkern/ia64/__umodsi3.S standard
-libkern/ia64/__divdi3.S standard
-libkern/ia64/__moddi3.S standard
-libkern/ia64/__udivdi3.S standard
-libkern/ia64/__umoddi3.S standard
-libkern/bcmp.c standard
-libkern/ffs.c standard
+libkern/ia64/bswap16.S standard
+libkern/ia64/bswap32.S standard
==== //depot/projects/ia64_epc/sys/ia64/ia64/trap.c#16 (text+ko) ====
@@ -376,15 +376,9 @@
* and per-process unaligned-access-handling flags).
*/
if (user) {
-#if NOTYET
- mtx_lock(&Giant);
i = unaligned_fixup(framep, td);
- mtx_unlock(&Giant);
if (i == 0)
goto out;
-#else
- i = SIGBUS;
-#endif
ucode = framep->tf_special.ifa; /* VA */
break;
}
==== //depot/projects/ia64_epc/sys/ia64/ia64/unaligned.c#3 (text+ko) ====
@@ -152,16 +152,45 @@
read_register(struct trapframe *framep, struct thread *td,
int reg, u_int64_t *valuep)
{
- if (reg == 0) {
- *valuep = 0;
- return 0;
- } else if (reg < 32) {
- *valuep = framep->tf_r[reg - 1];
- return 0;
+
+ if (reg < 32) {
+ switch (reg) {
+ case 0: *valuep = 0; break;
+ case 1: *valuep = framep->tf_special.gp; break;
+ case 2: *valuep = framep->tf_scratch.gr2; break;
+ case 3: *valuep = framep->tf_scratch.gr3; break;
+ case 8: *valuep = framep->tf_scratch.gr8; break;
+ case 9: *valuep = framep->tf_scratch.gr9; break;
+ case 10: *valuep = framep->tf_scratch.gr10; break;
+ case 11: *valuep = framep->tf_scratch.gr11; break;
+ case 12: *valuep = framep->tf_special.sp; break;
+ case 13: *valuep = framep->tf_special.tp; break;
+ case 14: *valuep = framep->tf_scratch.gr14; break;
+ case 15: *valuep = framep->tf_scratch.gr15; break;
+ case 16: *valuep = framep->tf_scratch.gr16; break;
+ case 17: *valuep = framep->tf_scratch.gr17; break;
+ case 18: *valuep = framep->tf_scratch.gr18; break;
+ case 19: *valuep = framep->tf_scratch.gr19; break;
+ case 20: *valuep = framep->tf_scratch.gr20; break;
+ case 21: *valuep = framep->tf_scratch.gr21; break;
+ case 22: *valuep = framep->tf_scratch.gr22; break;
+ case 23: *valuep = framep->tf_scratch.gr23; break;
+ case 24: *valuep = framep->tf_scratch.gr24; break;
+ case 25: *valuep = framep->tf_scratch.gr25; break;
+ case 26: *valuep = framep->tf_scratch.gr26; break;
+ case 27: *valuep = framep->tf_scratch.gr27; break;
+ case 28: *valuep = framep->tf_scratch.gr28; break;
+ case 29: *valuep = framep->tf_scratch.gr29; break;
+ case 30: *valuep = framep->tf_scratch.gr30; break;
+ case 31: *valuep = framep->tf_scratch.gr31; break;
+ default:
+ return (EINVAL);
+ }
} else {
- u_int64_t cfm = framep->tf_cr_ifs;
- u_int64_t *bsp = (u_int64_t *) (td->td_kstack
- + framep->tf_ndirty);
+#if 0
+ u_int64_t cfm = framep->tf_special.cfm;
+ u_int64_t *bsp = (u_int64_t *)(td->td_kstack +
+ framep->tf_ndirty);
int sof = cfm & 0x7f;
int sor = 8*((cfm >> 14) & 15);
int rrb_gr = (cfm >> 18) & 0x7f;
@@ -181,23 +210,54 @@
}
*valuep = *ia64_rse_register_address(bsp, reg);
- return 0;
+ return (0);
+#else
+ return (EINVAL);
+#endif
}
-
- return EINVAL;
+ return (0);
}
static int
write_register(struct trapframe *framep, struct thread *td,
int reg, u_int64_t value)
{
- if (reg == 0) {
- return EINVAL; /* can't happen */
- } else if (reg < 32) {
- framep->tf_r[reg - 1] = value;
- return 0;
+
+ if (reg < 32) {
+ switch (reg) {
+ case 1: framep->tf_special.gp = value; break;
+ case 2: framep->tf_scratch.gr2 = value; break;
+ case 3: framep->tf_scratch.gr3 = value; break;
+ case 8: framep->tf_scratch.gr8 = value; break;
+ case 9: framep->tf_scratch.gr9 = value; break;
+ case 10: framep->tf_scratch.gr10 = value; break;
+ case 11: framep->tf_scratch.gr11 = value; break;
+ case 12: framep->tf_special.sp = value; break;
+ case 13: framep->tf_special.tp = value; break;
+ case 14: framep->tf_scratch.gr14 = value; break;
+ case 15: framep->tf_scratch.gr15 = value; break;
+ case 16: framep->tf_scratch.gr16 = value; break;
+ case 17: framep->tf_scratch.gr17 = value; break;
+ case 18: framep->tf_scratch.gr18 = value; break;
+ case 19: framep->tf_scratch.gr19 = value; break;
+ case 20: framep->tf_scratch.gr20 = value; break;
+ case 21: framep->tf_scratch.gr21 = value; break;
+ case 22: framep->tf_scratch.gr22 = value; break;
+ case 23: framep->tf_scratch.gr23 = value; break;
+ case 24: framep->tf_scratch.gr24 = value; break;
+ case 25: framep->tf_scratch.gr25 = value; break;
+ case 26: framep->tf_scratch.gr26 = value; break;
+ case 27: framep->tf_scratch.gr27 = value; break;
+ case 28: framep->tf_scratch.gr28 = value; break;
+ case 29: framep->tf_scratch.gr29 = value; break;
+ case 30: framep->tf_scratch.gr30 = value; break;
+ case 31: framep->tf_scratch.gr31 = value; break;
+ default:
+ return (EINVAL);
+ }
} else {
- u_int64_t cfm = framep->tf_cr_ifs;
+#if 0
+ u_int64_t cfm = framep->tf_special.cfm;
u_int64_t *bsp = (u_int64_t *) (td->td_kstack
+ framep->tf_ndirty);
int sof = cfm & 0x7f;
@@ -220,9 +280,11 @@
*ia64_rse_register_address(bsp, reg) = value;
return 0;
+#else
+ return (EINVAL);
+#endif
}
-
- return EINVAL;
+ return (0);
}
/*
@@ -366,7 +428,7 @@
int
unaligned_fixup(struct trapframe *framep, struct thread *td)
{
- vm_offset_t va = framep->tf_cr_ifa;
+ vm_offset_t va = framep->tf_special.ifa;
int doprint, dofix, dosigbus;
int signal, size = 0;
unsigned long uac;
@@ -398,7 +460,7 @@
* If psr.ac is set, then clearly the user program *wants* to
* fault.
*/
- if (framep->tf_cr_ipsr & IA64_PSR_AC) {
+ if (framep->tf_special.psr & IA64_PSR_AC) {
dofix = 0;
dosigbus = 1;
}
@@ -418,10 +480,10 @@
* offending instruction.
* XXX assume that the instruction is in an 'M' slot.
*/
- copyin((const void *) framep->tf_cr_iip, &low, 8);
- copyin((const void *) (framep->tf_cr_iip + 8), &high, 8);
+ copyin((const void *) framep->tf_special.iip, &low, 8);
+ copyin((const void *) (framep->tf_special.iip + 8), &high, 8);
ia64_unpack_bundle(low, high, &b);
- slot = (framep->tf_cr_ipsr >> 41) & 3;
+ slot = (framep->tf_special.psr >> 41) & 3;
ins.ins = b.slot[slot];
decoded = 0;
@@ -450,7 +512,7 @@
*/
if (doprint) {
uprintf("pid %d (%s): unaligned access: va=0x%lx pc=0x%lx",
- p->p_pid, p->p_comm, va, framep->tf_cr_iip);
+ p->p_pid, p->p_comm, va, framep->tf_special.iip);
if (decoded) {
uprintf(" op=");
if (dec.isload) {
@@ -499,7 +561,7 @@
*/
__asm __volatile("flushrs");
- isr = framep->tf_cr_isr;
+ isr = framep->tf_special.isr;
error = read_register(framep, td, dec.basereg, &addr);
if (error) {
signal = SIGBUS;
@@ -564,12 +626,12 @@
* Advance to the instruction following the
* one which faulted.
*/
- if ((framep->tf_cr_ipsr & IA64_PSR_RI)
+ if ((framep->tf_special.psr & IA64_PSR_RI)
== IA64_PSR_RI_2) {
- framep->tf_cr_ipsr &= ~IA64_PSR_RI;
- framep->tf_cr_iip += 16;
+ framep->tf_special.psr &= ~IA64_PSR_RI;
+ framep->tf_special.iip += 16;
} else {
- framep->tf_cr_ipsr += IA64_PSR_RI_1;
+ framep->tf_special.psr += IA64_PSR_RI_1;
}
}
} else {
More information about the p4-projects
mailing list