qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Aleksandar Markovic <aleksandar.markovic@rt-rk.com>,
	qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Thomas Huth" <thuth@redhat.com>, "Jia Liu" <proljc@gmail.com>,
	"Christian Borntraeger" <borntraeger@de.ibm.com>,
	"Thomas Huth" <huth@tuxfamily.org>,
	"Aurelien Jarno" <aurelien@aurel32.net>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Fabien Chouteau" <chouteau@adacore.com>,
	"Laurent Vivier" <laurent@vivier.eu>,
	"Max Filippov" <jcmvbkbc@gmail.com>,
	"KONRAD Frederic" <frederic.konrad@adacore.com>,
	"Michael Rolnik" <mrolnik@gmail.com>,
	"Michael Walle" <michael@walle.cc>,
	"Edgar E . Iglesias" <edgar.iglesias@gmail.com>,
	"Aleksandar Rikalo" <aleksandar.rikalo@rt-rk.com>,
	"David Gibson" <david@gibson.dropbear.id.au>,
	"Richard Henderson" <rth@twiddle.net>,
	"Aleksandar Markovic" <aleksandar.m.mail@gmail.com>,
	"Artyom Tarasenko" <atar4qemu@gmail.com>
Subject: Re: [PATCH rc3 23/30] hw/core/loader: Let load_elf populate the processor-specific flags
Date: Mon, 27 Jan 2020 09:05:33 +0100	[thread overview]
Message-ID: <8205c991-73d3-b721-5e21-b29a4b12ebd9@redhat.com> (raw)
In-Reply-To: <1580079311-20447-24-git-send-email-aleksandar.markovic@rt-rk.com>

On 1/26/20 11:55 PM, Aleksandar Markovic wrote:
> From: Philippe Mathieu-Daudé <f4bug@amsat.org>
> 
> Some platforms (like AVR) need to determine cpu type by reading
> the ELF flags (field e_flags oin ELF header).
> 
> This patch enables discovery of the content of that flag while
> using following functions:
> 
>    - load_elf()
>    - load_elf_as()
>    - load_elf_ram()
>    - load_elf_ram_sym()
> 
> The added argument of these functions is of type uint32_t*. It is
> allowed to pass NULL as that argument, and in such case no lookup
> to the field e_flags will happen, and of course, no information
> will be returned to the caller.
> 
> CC: Richard Henderson <rth@twiddle.net>
> CC: Peter Maydell <peter.maydell@linaro.org>
> CC: Edgar E. Iglesias <edgar.iglesias@gmail.com>
> CC: Michael Walle <michael@walle.cc>
> CC: Thomas Huth <huth@tuxfamily.org>
> CC: Laurent Vivier <laurent@vivier.eu>
> CC: Philippe Mathieu-Daudé <f4bug@amsat.org>
> CC: Aleksandar Rikalo <aleksandar.rikalo@rt-rk.com>
> CC: Aurelien Jarno <aurelien@aurel32.net>
> CC: Jia Liu <proljc@gmail.com>
> CC: David Gibson <david@gibson.dropbear.id.au>
> CC: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> CC: BALATON Zoltan <balaton@eik.bme.hu>
> CC: Christian Borntraeger <borntraeger@de.ibm.com>
> CC: Thomas Huth <thuth@redhat.com>
> CC: Artyom Tarasenko <atar4qemu@gmail.com>
> CC: Fabien Chouteau <chouteau@adacore.com>
> CC: KONRAD Frederic <frederic.konrad@adacore.com>
> CC: Max Filippov <jcmvbkbc@gmail.com>
> 
> Signed-off-by: Michael Rolnik <mrolnik@gmail.com>
> Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> [PMD: Extracted from bigger patch,
>        Replaced 'uint32_t *pe_flags' by 'int proc_flags']
> [AM: Replaced 'int proc_flags' with 'uint32_t *pflags',
>       replaced one instance of 'elf_sword' to 'elf_word',

IIRC I used 'int' because load_elf() uses 'int' for all the other ELF 
flags, regardless their type (except the addresses).

>       extended functionality to load_elf()]
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> Signed-off-by: Aleksandar Markovic <aleksandar.m.mail@gmail.com>
[...]
> diff --git a/include/hw/loader.h b/include/hw/loader.h
> index 48a96cd..a9eeea3 100644
> --- a/include/hw/loader.h
> +++ b/include/hw/loader.h
> @@ -101,6 +101,7 @@ const char *load_elf_strerror(int error);
>    * @pentry: Populated with program entry point. Ignored if NULL.
>    * @lowaddr: Populated with lowest loaded address. Ignored if NULL.
>    * @highaddr: Populated with highest loaded address. Ignored if NULL.
> + * @pflags: Populated with ELF processor-specific flags. Ignore if NULL.
>    * @bigendian: Expected ELF endianness. 0 for LE otherwise BE
>    * @elf_machine: Expected ELF machine type
>    * @clear_lsb: Set to mask off LSB of addresses (Some architectures use
> @@ -131,8 +132,9 @@ int load_elf_ram_sym(const char *filename,
>                        uint64_t (*elf_note_fn)(void *, void *, bool),
>                        uint64_t (*translate_fn)(void *, uint64_t),
>                        void *translate_opaque, uint64_t *pentry,
> -                     uint64_t *lowaddr, uint64_t *highaddr, int big_endian,
> -                     int elf_machine, int clear_lsb, int data_swab,
> +                     uint64_t *lowaddr, uint64_t *highaddr, uint32_t *pflags,
> +                     int big_endian, int elf_machine,
> +                     int clear_lsb, int data_swab,
>                        AddressSpace *as, bool load_rom, symbol_fn_t sym_cb);
>   
>   /** load_elf_ram:
> @@ -143,9 +145,9 @@ int load_elf_ram(const char *filename,
>                    uint64_t (*elf_note_fn)(void *, void *, bool),
>                    uint64_t (*translate_fn)(void *, uint64_t),
>                    void *translate_opaque, uint64_t *pentry, uint64_t *lowaddr,
> -                 uint64_t *highaddr, int big_endian, int elf_machine,
> -                 int clear_lsb, int data_swab, AddressSpace *as,
> -                 bool load_rom);
> +                 uint64_t *highaddr, uint32_t *pflags, int big_endian,
> +                 int elf_machine, int clear_lsb, int data_swab,
> +                 AddressSpace *as, bool load_rom);
>   
>   /** load_elf_as:
>    * Same as load_elf_ram(), but always loads the elf as ROM
> @@ -154,8 +156,9 @@ int load_elf_as(const char *filename,
>                   uint64_t (*elf_note_fn)(void *, void *, bool),
>                   uint64_t (*translate_fn)(void *, uint64_t),
>                   void *translate_opaque, uint64_t *pentry, uint64_t *lowaddr,
> -                uint64_t *highaddr, int big_endian, int elf_machine,
> -                int clear_lsb, int data_swab, AddressSpace *as);
> +                uint64_t *highaddr, uint32_t *pflags, int big_endian,
> +                int elf_machine, int clear_lsb, int data_swab,
> +                AddressSpace *as);
>   
>   /** load_elf:
>    * Same as load_elf_as(), but doesn't allow the caller to specify an
> @@ -165,8 +168,8 @@ int load_elf(const char *filename,
>                uint64_t (*elf_note_fn)(void *, void *, bool),
>                uint64_t (*translate_fn)(void *, uint64_t),
>                void *translate_opaque, uint64_t *pentry, uint64_t *lowaddr,
> -             uint64_t *highaddr, int big_endian, int elf_machine,
> -             int clear_lsb, int data_swab);
> +             uint64_t *highaddr, uint32_t *pflags, int big_endian,
> +             int elf_machine, int clear_lsb, int data_swab);
>   
>   /** load_elf_hdr:
>    * @filename: Path of ELF file
> 



  reply	other threads:[~2020-01-27  8:06 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-26 22:54 [PATCH rc3 00/30] target/avr merger Aleksandar Markovic
2020-01-26 22:54 ` [PATCH rc3 01/30] target/avr: Add basic parameters for new AVR platform Aleksandar Markovic
2020-01-27  8:54   ` Michael Rolnik
2020-01-28 13:25     ` Michael Rolnik
2020-01-28 13:49       ` Aleksandar Markovic
2020-01-28 15:10         ` Michael Rolnik
2020-01-28 18:01           ` Aleksandar Markovic
2020-01-29  7:38             ` Philippe Mathieu-Daudé
2020-01-29 10:09               ` Aleksandar Markovic
2020-01-26 22:54 ` [PATCH rc3 02/30] target/avr: Introduce AVR CPU class object Aleksandar Markovic
2020-01-27  2:39   ` Aleksandar Markovic
2020-01-27  8:03     ` Philippe Mathieu-Daudé
2020-01-27  8:43       ` Aleksandar Markovic
2020-01-27  8:51     ` Michael Rolnik
2020-01-29 12:20   ` Sarah Harris
2020-01-29 15:11     ` Aleksandar Markovic
2020-01-29 15:34       ` Michael Rolnik
2020-01-26 22:54 ` [PATCH rc3 03/30] target/avr: Add migration support Aleksandar Markovic
2020-01-26 22:54 ` [PATCH rc3 04/30] target/avr: Add GDB support Aleksandar Markovic
2020-01-26 22:54 ` [PATCH rc3 05/30] target/avr: Introduce AVR features Aleksandar Markovic
2020-01-26 22:54 ` [PATCH rc3 06/30] target/avr: Add defintions of AVR core types Aleksandar Markovic
2020-01-26 22:54 ` [PATCH rc3 07/30] target/avr: Add instruction helpers Aleksandar Markovic
2020-01-26 22:54 ` [PATCH rc3 08/30] target/avr: Add instruction translation - Registers definition Aleksandar Markovic
2020-01-26 22:54 ` [PATCH rc3 09/30] target/avr: Add instruction translation - Arithmetic and Logic Instructions Aleksandar Markovic
2020-01-26 22:54 ` [PATCH rc3 10/30] target/avr: Add instruction translation - Branch Instructions Aleksandar Markovic
2020-01-26 22:54 ` [PATCH rc3 11/30] target/avr: Add instruction translation - Data Transfer Instructions Aleksandar Markovic
2020-01-26 22:54 ` [PATCH rc3 12/30] target/avr: Add instruction translation - Bit and Bit-test Instructions Aleksandar Markovic
2020-01-26 22:54 ` [PATCH rc3 13/30] target/avr: Add instruction translation - MCU Control Instructions Aleksandar Markovic
2020-01-26 22:54 ` [PATCH rc3 14/30] target/avr: Add instruction translation - CPU main translation function Aleksandar Markovic
2020-01-26 22:54 ` [PATCH rc3 15/30] target/avr: Add instruction disassembly function Aleksandar Markovic
2020-01-26 22:54 ` [PATCH rc3 16/30] hw/char: Add limited support for Atmel USART peripheral Aleksandar Markovic
2020-01-26 22:54 ` [PATCH rc3 17/30] hw/timer: Add limited support for Atmel 16 bit timer peripheral Aleksandar Markovic
2020-01-26 22:54 ` [PATCH rc3 18/30] hw/misc: Add Atmel power device Aleksandar Markovic
2020-01-26 22:55 ` [PATCH rc3 19/30] target/avr: Add section about AVR into QEMU documentation Aleksandar Markovic
2020-01-26 22:55 ` [PATCH rc3 20/30] target/avr: Register AVR support with the rest of QEMU Aleksandar Markovic
2020-01-26 22:55 ` [PATCH rc3 21/30] target/avr: Add machine none test Aleksandar Markovic
2020-01-26 22:55 ` [PATCH rc3 22/30] target/avr: Update MAINTAINERS file Aleksandar Markovic
2020-01-26 22:55 ` [PATCH rc3 23/30] hw/core/loader: Let load_elf populate the processor-specific flags Aleksandar Markovic
2020-01-27  8:05   ` Philippe Mathieu-Daudé [this message]
2020-01-28 10:01   ` Aleksandar Markovic
2020-01-28 12:42     ` BALATON Zoltan
2020-01-28 13:27       ` Aleksandar Markovic
2020-01-28 19:25         ` Aleksandar Markovic
2020-01-29  7:32           ` Philippe Mathieu-Daudé
2020-01-29 10:02             ` Aleksandar Markovic
2020-01-29 13:56   ` Aleksandar Rikalo
2020-01-26 22:55 ` [PATCH rc3 24/30] hw/avr: Add helper to load raw/ELF firmware binaries Aleksandar Markovic
2020-01-27  7:25   ` Aleksandar Markovic
2020-01-26 22:55 ` [PATCH rc3 25/30] hw/avr: Add some ATmega microcontrollers Aleksandar Markovic
2020-01-26 22:55 ` [PATCH rc3 26/30] hw/avr: Add some Arduino boards Aleksandar Markovic
2020-01-26 22:55 ` [PATCH rc3 27/30] target/avr: Update build system Aleksandar Markovic
2020-01-26 22:55 ` [PATCH rc3 28/30] tests/boot-serial-test: Test some Arduino boards (AVR based) Aleksandar Markovic
2020-01-26 22:55 ` [PATCH rc3 29/30] tests/acceptance: Test the Arduino MEGA2560 board Aleksandar Markovic
2020-01-26 22:55 ` [PATCH rc3 30/30] .travis.yml: Run the AVR acceptance tests Aleksandar Markovic

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=8205c991-73d3-b721-5e21-b29a4b12ebd9@redhat.com \
    --to=philmd@redhat.com \
    --cc=aleksandar.m.mail@gmail.com \
    --cc=aleksandar.markovic@rt-rk.com \
    --cc=aleksandar.rikalo@rt-rk.com \
    --cc=atar4qemu@gmail.com \
    --cc=aurelien@aurel32.net \
    --cc=borntraeger@de.ibm.com \
    --cc=chouteau@adacore.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=edgar.iglesias@gmail.com \
    --cc=f4bug@amsat.org \
    --cc=frederic.konrad@adacore.com \
    --cc=huth@tuxfamily.org \
    --cc=jcmvbkbc@gmail.com \
    --cc=laurent@vivier.eu \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=michael@walle.cc \
    --cc=mrolnik@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=proljc@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=thuth@redhat.com \
    /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).