Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Apr 2003 14:03:14 -0700 (PDT)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 29975 for review
Message-ID:  <200304282103.h3SL3Eep083867@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=29975

Change 29975 by marcel@marcel_nfs on 2003/04/28 14:02:44

	Use the endian encoding/decoding functions to get 64-bit
	values out of the XSDT. They are very likely misaligned
	and handling of misaligned memory accesses by the kernel
	must not be depended upon. In other words: we coredump
	on ia64 because handling of unaligned memory access has
	a bug (a kernel from HEAD -- No EPC related fodder :-)
	
	This makes acpidump usable again on my bigsur. I can't
	recall having seen coredumps on pluto, which is where I
	would expect to see them...

Affected files ...

.. //depot/projects/ia64/usr.sbin/acpi/acpidump/acpi.c#11 edit

Differences ...

==== //depot/projects/ia64/usr.sbin/acpi/acpidump/acpi.c#11 (text+ko) ====

@@ -28,6 +28,7 @@
  *	$FreeBSD: src/usr.sbin/acpi/acpidump/acpi.c,v 1.7 2003/04/15 05:15:50 njl Exp $
  */
 
+#include <sys/endian.h>
 #include <sys/param.h>
 #include <sys/stat.h>
 
@@ -474,7 +475,7 @@
 {
 	struct	ACPIsdt *sp;
 
-	sp = acpi_map_physical(pa, sizeof(struct ACPIsdt));
+	sp = acpi_map_physical(pa, SIZEOF_SDT_HDR);
 	sp = acpi_map_physical(pa, sp->len);
 	return (sp);
 }
@@ -506,7 +507,7 @@
 		if (p != (void*)rsdp->body)
 			printf(", ");
 		if (rsdp->signature[0] == 'X') {
-			printf("0x%016x", *((u_int64_t*)p));
+			printf("0x%016x", le64dec(p));
 			p += sizeof(u_int64_t);
 		} else {
 			printf("0x%08x", *((u_int32_t*)p));
@@ -521,7 +522,7 @@
 	p = (void*)rsdp->body;
 	while (p < end) {
 		if (rsdp->signature[0] == 'X') {
-			sdp = acpi_map_sdt(*((u_int64_t*)p));
+			sdp = acpi_map_sdt(le64dec(p));
 			p += sizeof(u_int64_t);
 		} else {
 			sdp = acpi_map_sdt(*((u_int32_t*)p));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200304282103.h3SL3Eep083867>