From: Stefan Berger Subject: [PATCH] [HVMLOADER] built-in memcmp function uses not-yet implemented opcode Date: Tue, 28 Nov 2006 23:15:27 -0500 Message-ID: <1164773727.27538.12.camel@lt2.watson.ibm.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-UMt4sJEOsKGNQYaAeiKw" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Xen-devel Cc: keir@xensource.com List-Id: xen-devel@lists.xenproject.org --=-UMt4sJEOsKGNQYaAeiKw Content-Type: text/plain Content-Transfer-Encoding: 7bit Keir, it seems like the acpi/build.c function now uses the gcc built-in memcmp function. Unfortunately that one seems to generate some code that hits a not-yet implemented/emulated opcode. Instead of implementing emultaion for that opcode I just copied the previously used memcmp function from util.c into the build.c and renamed it to _memcmp to avoid linking problems. (XEN) a6, This opcode isn't handled yet! (XEN) handle_mmio: failed to decode instruction (XEN) mmio opcode: gpa 0xfed40f00, len 2: f3 a6 (XEN) domain_crash_sync called from platform.c:944 Signed-off-by: Stefan Berger --=-UMt4sJEOsKGNQYaAeiKw Content-Disposition: attachment; filename=acpi_build_memcmp_fix.diff Content-Type: text/x-patch; name=acpi_build_memcmp_fix.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit diff -r 81c9213b3d39 tools/firmware/hvmloader/acpi/build.c --- a/tools/firmware/hvmloader/acpi/build.c Tue Nov 28 18:41:42 2006 +++ b/tools/firmware/hvmloader/acpi/build.c Tue Nov 28 23:09:29 2006 @@ -32,6 +32,24 @@ extern unsigned char AmlCode[]; extern int DsdtLen; +static int +_memcmp(const void *s1, const void *s2, unsigned n) +{ + unsigned i; + uint8_t *p1 = (uint8_t *) s1; + uint8_t *p2 = (uint8_t *) s2; + + for ( i = 0; i < n; i++ ) + { + if ( p1[i] < p2[i] ) + return -1; + else if ( p1[i] > p2[i] ) + return 1; + } + + return 0; +} + static void set_checksum( void *table, uint32_t checksum_offset, uint32_t length) { @@ -126,7 +144,7 @@ } /* TPM TCPA and SSDT. */ - if ( memcmp((char *)0xFED40F00, tis_did_vid_rid, + if (_memcmp((char *)0xFED40F00, tis_did_vid_rid, sizeof(tis_did_vid_rid)) == 0 ) /* Probe for TIS interface. */ { memcpy(&buf[offset], AmlCode_TPM, sizeof(AmlCode_TPM)); --=-UMt4sJEOsKGNQYaAeiKw Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-UMt4sJEOsKGNQYaAeiKw--