qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: xiaolei <1482995675@qq.com>
To: qemu-devel <qemu-devel@nongnu.org>
Subject: how to extend to load COFF executable image file
Date: Tue, 12 May 2020 15:40:30 +0800	[thread overview]
Message-ID: <tencent_A0D32CA7B0D4D56FF2B2182DAA3EB6BC6508@qq.com> (raw)

Hi all,
  I attempt to add DSP architecture support for some TI processor, based on QEMU 4.2.
  When I work on the executable file loading , I try to load COFF executable  file. Following the ELF file processing scheme, I thought I could write a function similar to :
       rom_add_elf_program(label, mapped_file, data, file_size, mem_size, addr, as);
  But I got lost when I track down the usage to the global variable  :static QTAILQ_HEAD(, Rom) roms;
  I did not get where this 'roms'  is used for program loading, and how the loaded program get to run eventually.  Can someone give me some hints?

  Also, the COFF file format differs from the ELF, there is no program header. I wonder if I could reuse the 'rom' structure like loading a ELF. Or there is a better way to do it.

struct Rom {
    char *name;
    char *path;

    /* datasize is the amount of memory allocated in "data". If datasize is less
     * than romsize, it means that the area from datasize to romsize is filled
     * with zeros.
     */
    size_t romsize;      //?how to fill romsize for coff file 
    size_t datasize;    //?how to fill datasize for coff file 
    uint8_t *data;      //? for coff file 
    MemoryRegion *mr;
    AddressSpace *as;
    int isrom;
    char *fw_dir;
    char *fw_file;
    GMappedFile *mapped_file;
    bool committed;
    hwaddr addr;
    QTAILQ_ENTRY(Rom) next;
}; 
    Any advise would be appreciated!!

regards,

xiaolei cui

             reply	other threads:[~2020-05-12  7:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-12  7:40 xiaolei [this message]
2020-05-12  9:31 ` how to extend to load COFF executable image file Peter Maydell
     [not found] <tencent_129CC651BFBFE9CB46B508FB74F1364C170A@qq.com>
2020-05-14  8:51 ` Peter Maydell

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=tencent_A0D32CA7B0D4D56FF2B2182DAA3EB6BC6508@qq.com \
    --to=1482995675@qq.com \
    --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).