On 05/18/11 18:32, Ariane van der Steldt wrote: > It turns out that on sparc64, doing something like > show map /f *kernel_map > in ddb, makes you crash with a nullpointer exception. > Diff below makes sure we read all bytes of the pointer. The int in the > original code also explains why amd64 (little-endian arch) never had a > problem. > > To test this, drop into ddb and type > show map /f *kernel_map > Without this diff, any big-endian 64-bit arch should have a null-pointer > excepction. > With this diff applied, the kernel allocation map should be printed. > > Please test the above to confirm this (I don't have the hardware here). > PS, unmount your filesystems before testing! > > Ok?
Works for me on amd64. Before: ddb{0}> show map /f *kernel_map show map /f *kernel_map kernel: page fault trap, code=0 Faulted in DDB; continuing... ddb{0}> boot reboot boot reboot rebooting... After: # sysctl -w ddb.trigger=1 sysctl -w ddb.trigger=1 Stopped at Debugger+0x5: leave ddb{1}> show map /f *kernel_map show map /f *kernel_map MAP 0xffffffff80cf6780: [0xffff800000000000->0xffff800100000000] #ent=12, sz=246595584, ref=1, version=2280, flags=0x1 pmap=0xffffffff80d5c6a0(resident=511) - 0xffffffff80d1a7d0: 0xffff800000000000->0xffff800000013000: obj=0x0/0x0, amap=0x0/0 submap=F, cow=F, nc=F, prot(max)=7/7, inh=2, wc=0, adv=1 - 0xffffffff80d1a740: 0xffff800000013000->0xffff800008013000: obj=0xffffffff80cceaa0/0x0, amap=0x0/0 submap=T, cow=F, nc=F, prot(max)=7/7, inh=2, wc=0, adv=1 - 0xffffffff80d1a6b0: 0xffff800008013000->0xffff800008133000: obj=0xffffffff80cf6740/0x8013000, amap=0x0/0 submap=F, cow=F, nc=F, prot(max)=7/7, inh=2, wc=0, adv=1 - 0xffffffff80d1a590: 0xffff800008133000->0xffff800008533000: obj=0xffff800000014f00/0x0, amap=0x0/0 submap=T, cow=F, nc=F, prot(max)=7/7, inh=2, wc=0, adv=1 - 0xffffffff80d1a500: 0xffff800008533000->0xffff80000865f000: obj=0xffff800000014e00/0x0, amap=0x0/0 submap=T, cow=F, nc=F, prot(max)=7/7, inh=2, wc=0, adv=1 - 0xffffffff80d1a470: 0xffff80000865f000->0xffff80000e89f000: obj=0x0/0x0, amap=0x0/0 submap=F, cow=F, nc=F, prot(max)=0/0, inh=2, wc=0, adv=0 - 0xffffffff80d1a350: 0xffff80000e89f000->0xffff80000e8ab000: obj=0xffffffff80cf6740/0xe89f000, amap=0x0/0 submap=F, cow=F, nc=F, prot(max)=7/7, inh=2, wc=0, adv=1 - 0xffffffff80d1a3e0: 0xffff80000e8ab000->0xffff80000e8ab040: obj=0xffffffff80cf6740/0xe8ab000, amap=0x0/0 submap=F, cow=F, nc=F, prot(max)=7/7, inh=2, wc=1, adv=1 - 0xffffffff80d1a230: 0xffff80000e8ab040->0xffff80000e8af000: obj=0xffffffff80cf6740/0xe8ab040, amap=0x0/0 submap=F, cow=F, nc=F, prot(max)=7/7, inh=2, wc=0, adv=1 - 0xffffffff80d1a1a0: 0xffff80000e8af000->0xffff80000eac8000: obj=0xffffffff80cf6740/0xe8af000, amap=0x0/0 submap=F, cow=F, nc=F, prot(max)=7/7, inh=2, wc=0, adv=1 - 0xfffffe803fe2f1b0: 0xffff80000eac8000->0xffff80000eb18000: obj=0xffffffff80cf6740/0xeac8000, amap=0x0/0 submap=F, cow=F, nc=F, prot(max)=3/3, inh=2, wc=0, adv=1 - 0xfffffe803fe2f6c0: 0xffff80000eb5a000->0xffff80000eb6e000: obj=0xffffffff80cf6740/0xeb5a000, amap=0x0/0 submap=F, cow=F, nc=F, prot(max)=3/3, inh=2, wc=0, adv=1 ddb{1}> boot reboot boot reboot rebooting... booting hd0a:bsd.ddbfix: 5612792+1596908+944936+0+628256 [89+496392+319941]=0xd28e90 entry point at 0x1001e0 [7205c766, 34000004, 24448b12, 8c58a304] [ using 817264 bytes of bsd ELF symbol table ] Copyright (c) 1982, 1986, 1989, 1991, 1993 The Regents of the University of California. All rights reserved. Copyright (c) 1995-2011 OpenBSD. All rights reserved. http://www.OpenBSD.org OpenBSD 4.9-current (GENERIC.MP) #21: Thu May 19 00:36:11 EDT 2011 r...@x2.thrush.com:/usr/src/sys/arch/amd64/compile/GENERIC.MP real mem = 1072627712 (1022MB) avail mem = 1030017024 (982MB) mainbus0 at root bios0 at mainbus0: SMBIOS rev. 2.5 @ 0xe1000 (5 entries) bios0: vendor innotek GmbH version "VirtualBox" date 12/01/2006 bios0: innotek GmbH VirtualBox acpi0 at bios0: rev 2 acpi0: sleep states S0 S5 acpi0: tables DSDT FACP APIC SSDT acpi0: wakeup devices acpitimer0 at acpi0: 3579545 Hz, 32 bits acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat cpu0 at mainbus0: apid 0 (boot processor) cpu0: AMD Phenom(tm) 9550 Quad-Core Processor, 2191.01 MHz cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,NXE,FFXSR,LONG,3DNOW2,3DNOW cpu0: 64KB 64b/line 2-way I-cache, 64KB 64b/line 2-way D-cache, 512KB 64b/line 16-way L2 cache cpu0: ITLB 32 4KB entries fully associative, 16 4MB entries fully associative cpu0: DTLB 48 4KB entries fully associative, 48 4MB entries fully associative cpu0: apic clock running at 999MHz cpu1 at mainbus0: apid 1 (application processor) cpu1: AMD Phenom(tm) 9550 Quad-Core Processor, 2190.72 MHz cpu1: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,NXE,FFXSR,LONG,3DNOW2,3DNOW cpu1: 64KB 64b/line 2-way I-cache, 64KB 64b/line 2-way D-cache, 512KB 64b/line 16-way L2 cache cpu1: ITLB 32 4KB entries fully associative, 16 4MB entries fully associative cpu1: DTLB 48 4KB entries fully associative, 48 4MB entries fully associative ioapic0 at mainbus0: apid 2 pa 0xfec00000, version 11, 24 pins ioapic0: misconfigured as apic 0, remapped to apid 2 acpiprt0 at acpi0: bus 0 (PCI0) acpicpu0 at acpi0 acpicpu1 at acpi0 acpibat0 at acpi0: BAT0 not present acpiac0 at acpi0: AC unit online pci0 at mainbus0 bus 0 pchb0 at pci0 dev 0 function 0 "Intel 82441FX" rev 0x02 pcib0 at pci0 dev 1 function 0 "Intel 82371SB ISA" rev 0x00 pciide0 at pci0 dev 1 function 1 "Intel 82371AB IDE" rev 0x01: DMA, channel 0 configured to compatibility, channel 1 configured to compatibility pciide0: channel 0 disabled (no drives) atapiscsi0 at pciide0 channel 1 drive 0 scsibus0 at atapiscsi0: 2 targets cd0 at scsibus0 targ 0 lun 0: <VBOX, CD-ROM, 1.0> ATAPI 5/cdrom removable cd0(pciide0:1:0): using PIO mode 4, Ultra-DMA mode 2 vga1 at pci0 dev 2 function 0 "InnoTek VirtualBox Graphics Adapter" rev 0x00 wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation) wsdisplay0: screen 1-5 added (80x25, vt100 emulation) em0 at pci0 dev 3 function 0 "Intel PRO/1000MT (82540EM)" rev 0x02: apic 2 int 19, address 08:00:27:14:ce:ca "InnoTek VirtualBox Guest Service" rev 0x00 at pci0 dev 4 function 0 not configured auich0 at pci0 dev 5 function 0 "Intel 82801AA AC97" rev 0x01: apic 2 int 21, ICH AC97 ac97: codec id 0x83847600 (SigmaTel STAC9700) audio0 at auich0 ohci0 at pci0 dev 6 function 0 "Apple Intrepid USB" rev 0x00: apic 2 int 22, version 1.0 piixpm0 at pci0 dev 7 function 0 "Intel 82371AB Power" rev 0x08: SMBus disabled ehci0 at pci0 dev 11 function 0 "Intel 82801FB USB" rev 0x00: apic 2 int 19 usb0 at ehci0: USB revision 2.0 uhub0 at usb0 "Intel EHCI root hub" rev 2.00/1.00 addr 1 ahci0 at pci0 dev 13 function 0 "Intel 82801HBM AHCI" rev 0x02: apic 2 int 21, AHCI 1.1 ahci0: device on port 0 didn't come ready, TFD: 0x171<ERR> scsibus1 at ahci0: 32 targets sd0 at scsibus1 targ 0 lun 0: <ATA, VBOX HARDDISK, 1.0> SCSI3 0/direct fixed t10.ATA_VBOX_HARDDISK_VB7c6c1ac7-21c49bfd_ sd0: 30720MB, 512 bytes/sec, 62914560 sec total isa0 at pcib0 isadma0 at isa0 com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo com0: console pckbc0 at isa0 port 0x60/5 pckbd0 at pckbc0 (kbd slot) pckbc0: using irq 1 for kbd slot wskbd0 at pckbd0: console keyboard, using wsdisplay0 pms0 at pckbc0 (aux slot) pckbc0: using irq 12 for aux slot wsmouse0 at pms0 mux 0 pcppi0 at isa0 port 0x61 spkr0 at pcppi0 usb1 at ohci0: USB revision 1.0 uhub1 at usb1 "Apple OHCI root hub" rev 1.00/1.00 addr 1 mtrr: CPU supports MTRRs but not enabled vscsi0 at root scsibus2 at vscsi0: 256 targets softraid0 at root root on sd0a (96fa835758f5cab4.a) swap on sd0b dump on sd0b setting tty flags pf enabled ddb.console: 1 -> 1 ddb.max_line: 24 -> 0 machdep.allowaperture: 0 -> 2 machdep.kbdreset: 0 -> 1 kern.bufcachepercent: 10 -> 90 starting network DHCPREQUEST on em0 to 255.255.255.255 port 67 DHCPACK from 10.1.2.18 (00:e0:4c:77:6d:ab) bound to 10.1.2.100 -- renewal in 302400 seconds. starting system logger starting initial daemons: portmap ntpd. savecore: no core dump checking quotas: done. building ps databases: kvm dev. clearing /tmp starting pre-securelevel daemons:. setting kernel security level: kern.securelevel: 0 -> 1 creating runtime link editor directory cache. preserving editor files. starting network daemons: sshd sendmail inetd. starting standard daemons: apmd cron. Thu May 19 00:44:55 EDT 2011