mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Murali Vijayaraghavan <vmurali@csail.mit.edu>
To: musl@lists.openwall.com
Subject: Using unistd functions vs calling syscall straight in the code
Date: Fri, 10 Aug 2012 21:47:59 +0900	[thread overview]
Message-ID: <CAFNG3t6_H1dN1AoFT2oq8y9rF=sL5Qrpi_3_Zcdyw+XrTPDRvA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1222 bytes --]

Hi

I am trying to run C programs on a barebones (MIPS-like) processor
simulator without any OS. The simulator mainly implements the userspace
ISA, with no syscall instruction support in hardware. I was hoping to
instead support some of the system calls (like open, read, write, etc,
mainly for debugging purposes) by using custom instructions, one for each
(or a few similar) system call(s). For that, the implementation of
functions like read and write should be calling these custom instructions
in assembly, in other words, I have to port the system call layer to my
simulator. I looked at musl among other libc implementations, and this was
the only one whose structure I could understand well, making it easy to
port. I did successfully and easily port it for my purposes, which brings
to my question/comment.

You guys do have a unistd implementation which supposedly implements each
of the system calls. But you are not consistent with the use of these
functions to perform the unistd-implemented tasks. Wouldn't it be a lot
cleaner to call these functions instead of calling syscall / syscall_cp
directly from the other (top-level) functions? Was there some rationale or
is it just code evolution?

Thanks
Murali

[-- Attachment #2: Type: text/html, Size: 1343 bytes --]

             reply	other threads:[~2012-08-10 12:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-10 12:47 Murali Vijayaraghavan [this message]
2012-08-10 14:16 ` Szabolcs Nagy
2012-08-10 14:32   ` Murali Vijayaraghavan
2012-08-10 14:59     ` Szabolcs Nagy
2012-08-10 15:40       ` Murali Vijayaraghavan
2012-08-10 17:59         ` Rich Felker
2012-08-10 18:40           ` Murali Vijayaraghavan

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='CAFNG3t6_H1dN1AoFT2oq8y9rF=sL5Qrpi_3_Zcdyw+XrTPDRvA@mail.gmail.com' \
    --to=vmurali@csail.mit.edu \
    --cc=musl@lists.openwall.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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).