From: casmac <climber.cui@qq.com>
To: qemu-devel <qemu-devel@nongnu.org>
Subject: Implement standard file operation with QEMU
Date: Thu, 16 Jul 2020 08:51:53 +0800 [thread overview]
Message-ID: <tencent_BF749AEC7484FAFD4D5356B065C6679BF705@qq.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2903 bytes --]
Hi all,
I am trying to implment standard file operation (stdio) with QEMU for DSP architecture. The manufacture (TI) provides a runtime library that support posix standard IO, but it left the device level implmentation as hook function calls, like in the library source , it contains add_device() function, and write(),read(),open() are not implemented:
int add_device(char *name,
unsigned flags,
int (*dopen) (const char *path, unsigned flags, int foo),
int (*dclose) (int fno),
int (*dread) (int fno, char *buf, unsigned count),
int (*dwrite) (int fno, const char *buf, unsigned count),
fpos_t (*dlseek) (int fno, fpos_t offset, int origin),
int (*dunlink)(const char *path),
int (*drename)(const char *old_name, const char *new_name))
{
_DEVICE *dt;
strncpy(dt->name,name,8);
dt->name[8] = '\0';
dt->flags = flags;
dt->OPEN = dopen;
dt->CLOSE = dclose;
dt->READ = dread;
dt->WRITE = dwrite;
dt->LSEEK = dlseek;
dt->UNLINK = dunlink;
dt->RENAME = drename;
}
int write(int fildes,
const char *bufptr,
unsigned cnt)
{
/*------------------------------------------------------------------------*/
/* CALL FUNCTION FROM DEVICE TABLE TO PERFORM WRITE FOR THIS DEVICE/FILE */
/*------------------------------------------------------------------------*/
return (*(_stream[fildes]->WRITE)) (fildes,bufptr,cnt);
}
Then, how can we use this runtime library together with QEMu to implement full-stack file oerations? I really appreaciate any advice.
Thanks.
regards,
xiaolei
[-- Attachment #2: Type: text/html, Size: 3143 bytes --]
next reply other threads:[~2020-07-16 0:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-16 0:51 casmac [this message]
2020-07-16 7:57 ` Implement standard file operation with QEMU Philippe Mathieu-Daudé
-- strict thread matches above, loose matches on Subject: below --
2020-07-17 15:18 casmac
2020-07-17 15:43 ` 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_BF749AEC7484FAFD4D5356B065C6679BF705@qq.com \
--to=climber.cui@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).