From: Jiaxun Yang <jiaxun.yang@flygoat.com>
To: qemu-devel@nongnu.org
Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>,
chenhuacai@kernel.org, f4bug@amsat.org, paulburton@kernel.org
Subject: [PATCH v2 1/8] hw/mips: Make bootloader addresses unsgined
Date: Tue, 15 Dec 2020 14:41:53 +0800 [thread overview]
Message-ID: <20201215064200.28751-2-jiaxun.yang@flygoat.com> (raw)
In-Reply-To: <20201215064200.28751-1-jiaxun.yang@flygoat.com>
Address should be unsigned anyway, otherwise it may carry
calculations wrongly.
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
hw/mips/fuloong2e.c | 12 ++++++------
hw/mips/malta.c | 22 +++++++++++-----------
2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c
index 45c596f4fe..fc4d7f21ed 100644
--- a/hw/mips/fuloong2e.c
+++ b/hw/mips/fuloong2e.c
@@ -107,9 +107,9 @@ static void GCC_FMT_ATTR(3, 4) prom_set(uint32_t *prom_buf, int index,
va_end(ap);
}
-static int64_t load_kernel(CPUMIPSState *env)
+static uint64_t load_kernel(CPUMIPSState *env)
{
- int64_t kernel_entry, kernel_high, initrd_size;
+ uint64_t kernel_entry, kernel_high, initrd_size;
int index = 0;
long kernel_size;
ram_addr_t initrd_offset;
@@ -118,8 +118,8 @@ static int64_t load_kernel(CPUMIPSState *env)
kernel_size = load_elf(loaderparams.kernel_filename, NULL,
cpu_mips_kseg0_to_phys, NULL,
- (uint64_t *)&kernel_entry, NULL,
- (uint64_t *)&kernel_high, NULL,
+ &kernel_entry, NULL,
+ &kernel_high, NULL,
0, EM_MIPS, 1, 0);
if (kernel_size < 0) {
error_report("could not load kernel '%s': %s",
@@ -180,7 +180,7 @@ static int64_t load_kernel(CPUMIPSState *env)
}
static void write_bootloader(CPUMIPSState *env, uint8_t *base,
- int64_t kernel_addr)
+ uint64_t kernel_addr)
{
uint32_t *p;
@@ -294,7 +294,7 @@ static void mips_fuloong2e_init(MachineState *machine)
MemoryRegion *bios = g_new(MemoryRegion, 1);
long bios_size;
uint8_t *spd_data;
- int64_t kernel_entry;
+ uint64_t kernel_entry;
PCIDevice *pci_dev;
PCIBus *pci_bus;
ISABus *isa_bus;
diff --git a/hw/mips/malta.c b/hw/mips/malta.c
index 366f4fdfcd..7db009a3e9 100644
--- a/hw/mips/malta.c
+++ b/hw/mips/malta.c
@@ -616,8 +616,8 @@ static void network_init(PCIBus *pci_bus)
}
}
-static void write_bootloader_nanomips(uint8_t *base, int64_t run_addr,
- int64_t kernel_entry)
+static void write_bootloader_nanomips(uint8_t *base, uint64_t run_addr,
+ uint64_t kernel_entry)
{
uint16_t *p;
@@ -840,8 +840,8 @@ static void write_bootloader_nanomips(uint8_t *base, int64_t run_addr,
* a2 - 32-bit address of the environment variables table
* a3 - RAM size in bytes
*/
-static void write_bootloader(uint8_t *base, int64_t run_addr,
- int64_t kernel_entry)
+static void write_bootloader(uint8_t *base, uint64_t run_addr,
+ uint64_t kernel_entry)
{
uint32_t *p;
@@ -1003,7 +1003,7 @@ static void GCC_FMT_ATTR(3, 4) prom_set(uint32_t *prom_buf, int index,
const char *string, ...)
{
va_list ap;
- int32_t table_addr;
+ uint32_t table_addr;
if (index >= ENVP_NB_ENTRIES) {
return;
@@ -1014,7 +1014,7 @@ static void GCC_FMT_ATTR(3, 4) prom_set(uint32_t *prom_buf, int index,
return;
}
- table_addr = sizeof(int32_t) * ENVP_NB_ENTRIES + index * ENVP_ENTRY_SIZE;
+ table_addr = sizeof(uint32_t) * ENVP_NB_ENTRIES + index * ENVP_ENTRY_SIZE;
prom_buf[index] = tswap32(ENVP_ADDR + table_addr);
va_start(ap, string);
@@ -1023,9 +1023,9 @@ static void GCC_FMT_ATTR(3, 4) prom_set(uint32_t *prom_buf, int index,
}
/* Kernel */
-static int64_t load_kernel(void)
+static uint64_t load_kernel(void)
{
- int64_t kernel_entry, kernel_high, initrd_size;
+ uint64_t kernel_entry, kernel_high, initrd_size;
long kernel_size;
ram_addr_t initrd_offset;
int big_endian;
@@ -1042,8 +1042,8 @@ static int64_t load_kernel(void)
kernel_size = load_elf(loaderparams.kernel_filename, NULL,
cpu_mips_kseg0_to_phys, NULL,
- (uint64_t *)&kernel_entry, NULL,
- (uint64_t *)&kernel_high, NULL, big_endian, EM_MIPS,
+ &kernel_entry, NULL,
+ &kernel_high, NULL, big_endian, EM_MIPS,
1, 0);
if (kernel_size < 0) {
error_report("could not load kernel '%s': %s",
@@ -1234,7 +1234,7 @@ void mips_malta_init(MachineState *machine)
MemoryRegion *bios, *bios_copy = g_new(MemoryRegion, 1);
const size_t smbus_eeprom_size = 8 * 256;
uint8_t *smbus_eeprom_buf = g_malloc0(smbus_eeprom_size);
- int64_t kernel_entry, bootloader_run_addr;
+ uint64_t kernel_entry, bootloader_run_addr;
PCIBus *pci_bus;
ISABus *isa_bus;
qemu_irq cbus_irq, i8259_irq;
--
2.29.2
next prev parent reply other threads:[~2020-12-15 6:44 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-15 6:41 [PATCH v2 0/8] MIPS Bootloader helper Jiaxun Yang
2020-12-15 6:41 ` Jiaxun Yang [this message]
2021-01-01 23:15 ` [PATCH v2 1/8] hw/mips: Make bootloader addresses unsgined Philippe Mathieu-Daudé
2021-01-03 15:57 ` Philippe Mathieu-Daudé
2021-01-03 20:41 ` Philippe Mathieu-Daudé
2020-12-15 6:41 ` [PATCH v2 2/8] hw/mips/malta: Use address translation helper to calculate bootloader_run_addr Jiaxun Yang
2021-01-01 20:40 ` Philippe Mathieu-Daudé
2020-12-15 6:41 ` [PATCH v2 3/8] hw/mips: Use address translation helper to handle ENVP_ADDR Jiaxun Yang
2021-01-01 20:38 ` Philippe Mathieu-Daudé
2021-01-01 23:16 ` Philippe Mathieu-Daudé
2020-12-15 6:45 ` [PATCH v2 4/8] hw/mips: Add a bootloader helper Jiaxun Yang
2020-12-15 6:45 ` [PATCH v2 5/8] hw/mips: Use bl_gen_kernel_jump to generate bootloaders Jiaxun Yang
2021-01-06 17:48 ` Philippe Mathieu-Daudé
2021-01-27 3:03 ` Jiaxun Yang
2020-12-15 6:45 ` [PATCH v2 6/8] target/mips/addr: Add translation helpers for KSEG1 Jiaxun Yang
2021-01-01 20:42 ` Philippe Mathieu-Daudé
2021-01-01 23:16 ` Philippe Mathieu-Daudé
2021-01-03 1:46 ` Huacai Chen
2020-12-15 6:45 ` [PATCH v2 7/8] hw/mips/malta: Use bootloader helper to set BAR resgiters Jiaxun Yang
2021-01-06 17:21 ` Philippe Mathieu-Daudé
2020-12-15 6:46 ` [PATCH v2 8/8] hw/mips/boston: Use bootloader helper to set GCRs Jiaxun Yang
2021-01-06 17:28 ` Philippe Mathieu-Daudé
2021-01-06 17:30 ` Philippe Mathieu-Daudé
2021-01-06 17:35 ` Philippe Mathieu-Daudé
2020-12-19 6:20 ` [PATCH v2 0/8] MIPS Bootloader helper Jiaxun Yang
2020-12-19 19:04 ` Philippe Mathieu-Daudé
2021-01-03 20:42 ` Philippe Mathieu-Daudé
2021-01-06 17:50 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201215064200.28751-2-jiaxun.yang@flygoat.com \
--to=jiaxun.yang@flygoat.com \
--cc=chenhuacai@kernel.org \
--cc=f4bug@amsat.org \
--cc=paulburton@kernel.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).