public inbox for newlib-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] libgloss: pru: Fix _open syscal arguments Date: Wed, 27 Apr 2022 09:43:27 +0000 (GMT) [thread overview] Message-ID: <20220427094327.190A13858C54@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=21f0edbf9f0efd3d96a83191630eac0eb52726d2 commit 21f0edbf9f0efd3d96a83191630eac0eb52726d2 Author: Dimitar Dimitrov <dimitar@dinux.eu> Date: Sun Apr 3 21:57:39 2022 +0300 libgloss: pru: Fix _open syscal arguments The _open() C function is declared as having variable arguments in newlib, so second and third arguments are passed on stack. Add code to move them into registers, since that's where the PRU simulator expects them. Issue was exposed by the GCC test gcc.c-torture/execute/fprintf-2.c, which relies on tmpnam implementation to pass correct flags to _open. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu> Diff: --- libgloss/pru/syscalls.S | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/libgloss/pru/syscalls.S b/libgloss/pru/syscalls.S index 252231e90..80486d1f9 100644 --- a/libgloss/pru/syscalls.S +++ b/libgloss/pru/syscalls.S @@ -68,7 +68,6 @@ __SC_ret_skip_errno_set: users use other methods for communicating with the host - remoteproc, rpmsg, shared memory. */ SC _exit, SYS_exit - SC _open, SYS_open SC _close, SYS_close SC _read, SYS_read SC _write, SYS_write @@ -77,3 +76,20 @@ __SC_ret_skip_errno_set: SC _getpid, SYS_getpid SC _kill, SYS_kill SC _fstat, SYS_fstat + + + /* _open is special because it has VA declaration. */ + .section .text._open, "ax" + .global _open + .type _open,@function + .func +_open: + /* Pop the second and third argument from stack, per VA ABI. + Thus simulator can get all arguments from registers + for any supported syscall. */ + lbbo r16, sp, 4, 4 + lbbo r15, sp, 0, 4 + ldi r1, SYS_open + halt + jmp __SC_ret + .endfunc
reply other threads:[~2022-04-27 9:43 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220427094327.190A13858C54@sourceware.org \ --to=corinna@sourceware.org \ --cc=newlib-cvs@sourceware.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: linkBe 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 read-only IMAP folder(s) and NNTP newsgroup(s).