From nobody Tue Nov 18 15:26:27 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1611156187; cv=none; d=zohomail.com; s=zohoarc; b=C0ChJBr+tH9rb3xNTEpaSILLMXtBfiHu736Z+6Y1rokgw0srpToU0TU1unvPD7p1YDzE7EGlVfN50WQ+2TTssIKdnKjEfPRrFmRmo17lEnNlhjSNUaCOLwB6cnusFd6fwPMBf65Clxh8FqOpc60CYWRjscOayNuOuoDeNukOF6k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611156187; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TdG9O0sWijtsBB97lQ18hk5C9jos/AzZLMhxasOjyos=; b=eAh29Y1kTwfoi+k9NeuCtHX8luwSrRoXrPaVw67d9hYAvLENVdS+B48odfOYHPLSogIYAwkMbL8wgG61PevQv1o/+Cse8hUA47I2fyo1oP200EpQzWflEe2s6cZR0Qy3nUgtq3JMzSIQvLQuL/U7KydK5fK780WfYCItaHPGUYA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611156187919549.2067937693524; Wed, 20 Jan 2021 07:23:07 -0800 (PST) Received: from localhost ([::1]:49364 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l2FK6-0004rR-Ud for importer@patchew.org; Wed, 20 Jan 2021 10:23:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43910) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l2FFc-0000H6-5S for qemu-devel@nongnu.org; Wed, 20 Jan 2021 10:18:28 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:28479) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l2FFM-0007hz-DX for qemu-devel@nongnu.org; Wed, 20 Jan 2021 10:18:22 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-348-2VWuCwn6PhW5WSOvTXli5g-1; Wed, 20 Jan 2021 10:18:03 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 07D3F8066EA; Wed, 20 Jan 2021 15:18:02 +0000 (UTC) Received: from thuth.com (ovpn-114-135.ams2.redhat.com [10.36.114.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id C2B2260C6C; Wed, 20 Jan 2021 15:18:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611155886; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TdG9O0sWijtsBB97lQ18hk5C9jos/AzZLMhxasOjyos=; b=DLpKpRUg5ruA29aP5SYl00ZKuOLEj+dy/qr1VL1IEGc+kZFzYorOJZTB7E561rR+KrTLvN PBT95F3vpzR5Tge6Qp75vNTVl+aHOJKvVS0SzWSKqbx3ogsxppd+ifl59hu7f6Cvs6yK22 Ye4xroCgKtWZqibtPlzPJIkiN56fyMw= X-MC-Unique: 2VWuCwn6PhW5WSOvTXli5g-1 From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 05/14] elf2dmp: Rename PAGE_SIZE to ELF2DMP_PAGE_SIZE Date: Wed, 20 Jan 2021 16:17:42 +0100 Message-Id: <20210120151751.520597-6-thuth@redhat.com> In-Reply-To: <20210120151751.520597-1-thuth@redhat.com> References: <20210120151751.520597-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=thuth@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Jiaxun Yang As per POSIX specification of limits.h [1], OS libc may define PAGE_SIZE in limits.h. To prevent collosion of definition, we rename PAGE_SIZE here. [1]: https://pubs.opengroup.org/onlinepubs/7908799/xsh/limits.h.html Signed-off-by: Jiaxun Yang Reviewed-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20210118063808.12471-6-jiaxun.yang@flygoat.com> Signed-off-by: Thomas Huth --- contrib/elf2dmp/addrspace.c | 4 ++-- contrib/elf2dmp/addrspace.h | 6 +++--- contrib/elf2dmp/main.c | 18 +++++++++--------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/contrib/elf2dmp/addrspace.c b/contrib/elf2dmp/addrspace.c index 8a76069cb5..53ded17061 100644 --- a/contrib/elf2dmp/addrspace.c +++ b/contrib/elf2dmp/addrspace.c @@ -207,8 +207,8 @@ int va_space_rw(struct va_space *vs, uint64_t addr, void *buf, size_t size, int is_write) { while (size) { - uint64_t page =3D addr & PFN_MASK; - size_t s =3D (page + PAGE_SIZE) - addr; + uint64_t page =3D addr & ELF2DMP_PFN_MASK; + size_t s =3D (page + ELF2DMP_PAGE_SIZE) - addr; void *ptr; =20 s =3D (s > size) ? size : s; diff --git a/contrib/elf2dmp/addrspace.h b/contrib/elf2dmp/addrspace.h index d87f6a18c6..00b44c1218 100644 --- a/contrib/elf2dmp/addrspace.h +++ b/contrib/elf2dmp/addrspace.h @@ -10,9 +10,9 @@ =20 #include "qemu_elf.h" =20 -#define PAGE_BITS 12 -#define PAGE_SIZE (1ULL << PAGE_BITS) -#define PFN_MASK (~(PAGE_SIZE - 1)) +#define ELF2DMP_PAGE_BITS 12 +#define ELF2DMP_PAGE_SIZE (1ULL << ELF2DMP_PAGE_BITS) +#define ELF2DMP_PFN_MASK (~(ELF2DMP_PAGE_SIZE - 1)) =20 #define INVALID_PA UINT64_MAX =20 diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c index ac746e49e0..20b477d582 100644 --- a/contrib/elf2dmp/main.c +++ b/contrib/elf2dmp/main.c @@ -244,8 +244,8 @@ static int fill_header(WinDumpHeader64 *hdr, struct pa_= space *ps, WinDumpHeader64 h; size_t i; =20 - QEMU_BUILD_BUG_ON(KUSD_OFFSET_SUITE_MASK >=3D PAGE_SIZE); - QEMU_BUILD_BUG_ON(KUSD_OFFSET_PRODUCT_TYPE >=3D PAGE_SIZE); + QEMU_BUILD_BUG_ON(KUSD_OFFSET_SUITE_MASK >=3D ELF2DMP_PAGE_SIZE); + QEMU_BUILD_BUG_ON(KUSD_OFFSET_PRODUCT_TYPE >=3D ELF2DMP_PAGE_SIZE); =20 if (!suite_mask || !product_type) { return 1; @@ -281,14 +281,14 @@ static int fill_header(WinDumpHeader64 *hdr, struct p= a_space *ps, }; =20 for (i =3D 0; i < ps->block_nr; i++) { - h.PhysicalMemoryBlock.NumberOfPages +=3D ps->block[i].size / PAGE_= SIZE; + h.PhysicalMemoryBlock.NumberOfPages +=3D ps->block[i].size / ELF2D= MP_PAGE_SIZE; h.PhysicalMemoryBlock.Run[i] =3D (WinDumpPhyMemRun64) { - .BasePage =3D ps->block[i].paddr / PAGE_SIZE, - .PageCount =3D ps->block[i].size / PAGE_SIZE, + .BasePage =3D ps->block[i].paddr / ELF2DMP_PAGE_SIZE, + .PageCount =3D ps->block[i].size / ELF2DMP_PAGE_SIZE, }; } =20 - h.RequiredDumpSpace +=3D h.PhysicalMemoryBlock.NumberOfPages << PAGE_B= ITS; + h.RequiredDumpSpace +=3D h.PhysicalMemoryBlock.NumberOfPages << ELF2DM= P_PAGE_BITS; =20 *hdr =3D h; =20 @@ -379,7 +379,7 @@ static int pe_get_pdb_symstore_hash(uint64_t base, void= *start_addr, size_t pdb_name_sz; size_t i; =20 - QEMU_BUILD_BUG_ON(sizeof(*dos_hdr) >=3D PAGE_SIZE); + QEMU_BUILD_BUG_ON(sizeof(*dos_hdr) >=3D ELF2DMP_PAGE_SIZE); =20 if (memcmp(&dos_hdr->e_magic, e_magic, sizeof(e_magic))) { return 1; @@ -509,10 +509,10 @@ int main(int argc, char *argv[]) } printf("CPU #0 IDT[0] -> 0x%016"PRIx64"\n", idt_desc_addr(first_idt_de= sc)); =20 - KernBase =3D idt_desc_addr(first_idt_desc) & ~(PAGE_SIZE - 1); + KernBase =3D idt_desc_addr(first_idt_desc) & ~(ELF2DMP_PAGE_SIZE - 1); printf("Searching kernel downwards from 0x%016"PRIx64"...\n", KernBase= ); =20 - for (; KernBase >=3D 0xfffff78000000000; KernBase -=3D PAGE_SIZE) { + for (; KernBase >=3D 0xfffff78000000000; KernBase -=3D ELF2DMP_PAGE_SI= ZE) { nt_start_addr =3D va_space_resolve(&vs, KernBase); if (!nt_start_addr) { continue; --=20 2.27.0