From nobody Thu Nov 21 17:53:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=cloud.com ARC-Seal: i=1; a=rsa-sha256; t=1724932403; cv=none; d=zohomail.com; s=zohoarc; b=XhOeFfvgwJwFAfZ2piI3WxnCnBqzooKiaCJkeDAUCtzFE0OXUJ/wiA8i9Bp7t9TgA/uLMIxA6sjHP5kysmJrrGBqmObxoiZVR9rcXtk+mZ+xjaXMs9Te22dOziPwksxkmzU6+T9SIsm36XEgCYNyPp3CjfisTYm4Urm7or/2vAM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724932403; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=t4OqEWyZVMJYP4Q1dCFXbk9bU+PaTs6KjTWg21ZmJh4=; b=icm3SZd9mHjpzxf2nIo0jCI1B6cdgRGtVuMOxcmFbvhiMK4VvODVjpHvBGj/V9I4X3gyOcNxAHx3GChN2EEJR6FcKayRsUicb1Af6na4z6VKi+wBuuSXw7Z2SePlEWV5qe8NkxckiIR+IVARexzQTtsMigSs0ZwcvENAdJhoeOo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1724932402975590.8243600218826; Thu, 29 Aug 2024 04:53:22 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.785701.1195171 (Exim 4.92) (envelope-from ) id 1sjdi2-0005qy-9q; Thu, 29 Aug 2024 11:53:02 +0000 Received: by outflank-mailman (output) from mailman id 785701.1195171; Thu, 29 Aug 2024 11:53:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sjdi2-0005qr-6n; Thu, 29 Aug 2024 11:53:02 +0000 Received: by outflank-mailman (input) for mailman id 785701; Thu, 29 Aug 2024 11:53:00 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sjdi0-0005ql-Kc for xen-devel@lists.xenproject.org; Thu, 29 Aug 2024 11:53:00 +0000 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [2a00:1450:4864:20::529]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 3c26f364-65fd-11ef-99a0-01e77a169b0f; Thu, 29 Aug 2024 13:52:58 +0200 (CEST) Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-5c210e23651so556647a12.3 for ; Thu, 29 Aug 2024 04:52:58 -0700 (PDT) Received: from fziglio-xenia-fedora.eng.citrite.net ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c226ccfe78sm616104a12.69.2024.08.29.04.52.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 04:52:57 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 3c26f364-65fd-11ef-99a0-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.com; s=cloud; t=1724932378; x=1725537178; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=t4OqEWyZVMJYP4Q1dCFXbk9bU+PaTs6KjTWg21ZmJh4=; b=iaKNbYMAkB84Q9XDyiK0WGKIocZ4XZx2jJbHgo+j14JE6mA+NPkQpEk9Z982IyrHuW Gs7Gp35isDXMlX7uFowMTvhfr1SxxhMQADRL9IW4BypnjLZM3nuSBFZmLM11CfqqssCn n9RXB8dFq+Fly1RjXQJnVZ5L+A+Q4DydBVTnM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724932378; x=1725537178; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=t4OqEWyZVMJYP4Q1dCFXbk9bU+PaTs6KjTWg21ZmJh4=; b=ums1RbCfa/CCOU1QcYjmBgEMnovSmPcLgzSNN5LclUra9PeQ+AMZuBZxrsgDhX015V 3GHi5Eb6XNLwEFxNOaqOPDY+eKUCBT/k+PMOeqpv5UwI9j6SCFCZ2RNFB8pHaYrbdXhq ExBwXnNbwQiISZfWkxrp2Xp8ZUM9e89ZLBg1eRdf6SPKC3xty+uh2cflpxBYoPdbKkZQ xQlHckmXaBNz7OtPqeJ0Wo47GX3fZNd8mPuO/dx3BrCHwgRvAhyJzr7LenuNz+DdmzoL PU6k36SY4QJTfu4ERpW1mgHQZbsLuyv+ueZdUaFniC3MY5el6Laclc2CP5tEnuxoH0nv C9og== X-Gm-Message-State: AOJu0Yz2BbCtg5vFqf52afw80l95rAnJn0NZL5nhuS7lmCxnCSVQ6xC6 2B0c2FZIojGmO6CZQXLoqH0lTeXcLU8rY2ZpTFMBDx8thRfjY+ihSj3BgokQ2m0AGJrafa5aDo1 c X-Google-Smtp-Source: AGHT+IHpIyPbAlSbhyV3XURLXvebXe2XRgkMpd6IIEIdby5cc/qYAgdnr5Vc8CjlYbg+0x50U7G0eg== X-Received: by 2002:a05:6402:3481:b0:5be:e01c:6b5e with SMTP id 4fb4d7f45d1cf-5c21eda3441mr2093762a12.35.1724932377470; Thu, 29 Aug 2024 04:52:57 -0700 (PDT) From: Frediano Ziglio To: xen-devel@lists.xenproject.org Cc: Frediano Ziglio , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH] x86/boot: Use C99 types for integers Date: Thu, 29 Aug 2024 12:52:44 +0100 Message-ID: <20240829115247.168608-1-frediano.ziglio@cloud.com> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @cloud.com) X-ZM-MESSAGEID: 1724932404832116600 Content-Type: text/plain; charset="utf-8" Just style update, no functional change. Signed-off-by: Frediano Ziglio Acked-by: Andrew Cooper --- xen/arch/x86/boot/cmdline.c | 30 ++++++++++++++--------------- xen/arch/x86/boot/defs.h | 2 +- xen/arch/x86/boot/reloc.c | 38 ++++++++++++++++++------------------- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/xen/arch/x86/boot/cmdline.c b/xen/arch/x86/boot/cmdline.c index f9eee756aa..b8ad7f3a14 100644 --- a/xen/arch/x86/boot/cmdline.c +++ b/xen/arch/x86/boot/cmdline.c @@ -36,15 +36,15 @@ asm ( =20 /* Keep in sync with trampoline.S:early_boot_opts label! */ typedef struct __packed { - u8 skip_realmode; - u8 opt_edd; - u8 opt_edid; - u8 padding; + uint8_t skip_realmode; + uint8_t opt_edd; + uint8_t opt_edid; + uint8_t padding; #ifdef CONFIG_VIDEO - u16 boot_vid_mode; - u16 vesa_width; - u16 vesa_height; - u16 vesa_depth; + uint16_t boot_vid_mode; + uint16_t vesa_width; + uint16_t vesa_height; + uint16_t vesa_depth; #endif } early_boot_opts_t; =20 @@ -214,7 +214,7 @@ static bool skip_realmode(const char *cmdline) return find_opt(cmdline, "no-real-mode", false) || find_opt(cmdline, "= tboot=3D", true); } =20 -static u8 edd_parse(const char *cmdline) +static uint8_t edd_parse(const char *cmdline) { const char *c; =20 @@ -229,7 +229,7 @@ static u8 edd_parse(const char *cmdline) return !strmaxcmp(c, "skipmbr", delim_chars); } =20 -static u8 edid_parse(const char *cmdline) +static uint8_t edid_parse(const char *cmdline) { const char *c; =20 @@ -245,7 +245,7 @@ static u8 edid_parse(const char *cmdline) } =20 #ifdef CONFIG_VIDEO -static u16 rows2vmode(unsigned int rows) +static uint16_t rows2vmode(unsigned int rows) { switch ( rows ) { @@ -300,7 +300,7 @@ static void vga_parse(const char *cmdline, early_boot_o= pts_t *ebo) { vesa_width =3D strtoui(c + strlen("gfx-"), "x", &c); =20 - if ( vesa_width > U16_MAX ) + if ( vesa_width > UINT16_MAX ) return; =20 /* @@ -311,12 +311,12 @@ static void vga_parse(const char *cmdline, early_boot= _opts_t *ebo) ++c; vesa_height =3D strtoui(c, "x", &c); =20 - if ( vesa_height > U16_MAX ) + if ( vesa_height > UINT16_MAX ) return; =20 vesa_depth =3D strtoui(++c, delim_chars_comma, NULL); =20 - if ( vesa_depth > U16_MAX ) + if ( vesa_depth > UINT16_MAX ) return; =20 ebo->vesa_width =3D vesa_width; @@ -328,7 +328,7 @@ static void vga_parse(const char *cmdline, early_boot_o= pts_t *ebo) { tmp =3D strtoui(c + strlen("mode-"), delim_chars_comma, NULL); =20 - if ( tmp > U16_MAX ) + if ( tmp > UINT16_MAX ) return; =20 ebo->boot_vid_mode =3D tmp; diff --git a/xen/arch/x86/boot/defs.h b/xen/arch/x86/boot/defs.h index 239b9f8716..ee1a4da6af 100644 --- a/xen/arch/x86/boot/defs.h +++ b/xen/arch/x86/boot/defs.h @@ -57,7 +57,7 @@ typedef u16 uint16_t; typedef u32 uint32_t; typedef u64 uint64_t; =20 -#define U16_MAX ((u16)(~0U)) +#define UINT16_MAX ((uint16_t)(~0U)) #define UINT_MAX (~0U) =20 #endif /* __BOOT_DEFS_H__ */ diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c index 4033557481..589e026ff9 100644 --- a/xen/arch/x86/boot/reloc.c +++ b/xen/arch/x86/boot/reloc.c @@ -68,24 +68,24 @@ struct vesa_mode_info { #endif /* CONFIG_VIDEO */ =20 #define get_mb2_data(tag, type, member) (((const multiboot2_tag_##type##= _t *)(tag))->member) -#define get_mb2_string(tag, type, member) ((u32)get_mb2_data(tag, type, me= mber)) +#define get_mb2_string(tag, type, member) ((uint32_t)get_mb2_data(tag, typ= e, member)) =20 -static u32 alloc; +static uint32_t alloc; =20 -static u32 alloc_mem(u32 bytes) +static uint32_t alloc_mem(uint32_t bytes) { return alloc -=3D ALIGN_UP(bytes, 16); } =20 -static void zero_mem(u32 s, u32 bytes) +static void zero_mem(uint32_t s, uint32_t bytes) { while ( bytes-- ) *(char *)s++ =3D 0; } =20 -static u32 copy_mem(u32 src, u32 bytes) +static uint32_t copy_mem(uint32_t src, uint32_t bytes) { - u32 dst, dst_ret; + uint32_t dst, dst_ret; =20 dst =3D alloc_mem(bytes); dst_ret =3D dst; @@ -96,9 +96,9 @@ static u32 copy_mem(u32 src, u32 bytes) return dst_ret; } =20 -static u32 copy_string(u32 src) +static uint32_t copy_string(uint32_t src) { - u32 p; + uint32_t p; =20 if ( !src ) return 0; @@ -109,7 +109,7 @@ static u32 copy_string(u32 src) return copy_mem(src, p - src + 1); } =20 -static struct hvm_start_info *pvh_info_reloc(u32 in) +static struct hvm_start_info *pvh_info_reloc(uint32_t in) { struct hvm_start_info *out; =20 @@ -139,7 +139,7 @@ static struct hvm_start_info *pvh_info_reloc(u32 in) return out; } =20 -static multiboot_info_t *mbi_reloc(u32 mbi_in) +static multiboot_info_t *mbi_reloc(uint32_t mbi_in) { int i; multiboot_info_t *mbi_out; @@ -192,7 +192,7 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, ui= nt32_t video_out) #ifdef CONFIG_VIDEO struct boot_video_info *video =3D NULL; #endif - u32 ptr; + uint32_t ptr; unsigned int i, mod_idx =3D 0; =20 ptr =3D alloc_mem(sizeof(*mbi_out)); @@ -203,8 +203,8 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, ui= nt32_t video_out) ptr =3D ALIGN_UP(mbi_in + sizeof(*mbi_fix), MULTIBOOT2_TAG_ALIGN); =20 /* Get the number of modules. */ - for ( tag =3D _p(ptr); (u32)tag - mbi_in < mbi_fix->total_size; - tag =3D _p(ALIGN_UP((u32)tag + tag->size, MULTIBOOT2_TAG_ALIGN))= ) + for ( tag =3D _p(ptr); (uint32_t)tag - mbi_in < mbi_fix->total_size; + tag =3D _p(ALIGN_UP((uint32_t)tag + tag->size, MULTIBOOT2_TAG_AL= IGN)) ) { if ( tag->type =3D=3D MULTIBOOT2_TAG_TYPE_MODULE ) ++mbi_out->mods_count; @@ -228,8 +228,8 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, ui= nt32_t video_out) ptr =3D ALIGN_UP(mbi_in + sizeof(*mbi_fix), MULTIBOOT2_TAG_ALIGN); =20 /* Put all needed data into mbi_out. */ - for ( tag =3D _p(ptr); (u32)tag - mbi_in < mbi_fix->total_size; - tag =3D _p(ALIGN_UP((u32)tag + tag->size, MULTIBOOT2_TAG_ALIGN))= ) + for ( tag =3D _p(ptr); (uint32_t)tag - mbi_in < mbi_fix->total_size; + tag =3D _p(ALIGN_UP((uint32_t)tag + tag->size, MULTIBOOT2_TAG_AL= IGN)) ) { switch ( tag->type ) { @@ -272,10 +272,10 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, = uint32_t video_out) mmap_dst[i].size =3D sizeof(*mmap_dst); mmap_dst[i].size -=3D sizeof(mmap_dst[i].size); /* Now copy a given region data. */ - mmap_dst[i].base_addr_low =3D (u32)mmap_src->addr; - mmap_dst[i].base_addr_high =3D (u32)(mmap_src->addr >> 32); - mmap_dst[i].length_low =3D (u32)mmap_src->len; - mmap_dst[i].length_high =3D (u32)(mmap_src->len >> 32); + mmap_dst[i].base_addr_low =3D (uint32_t)mmap_src->addr; + mmap_dst[i].base_addr_high =3D (uint32_t)(mmap_src->addr >= > 32); + mmap_dst[i].length_low =3D (uint32_t)mmap_src->len; + mmap_dst[i].length_high =3D (uint32_t)(mmap_src->len >> 32= ); mmap_dst[i].type =3D mmap_src->type; mmap_src =3D _p(mmap_src) + get_mb2_data(tag, mmap, entry_= size); } --=20 2.46.0