mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Patrick Oppenlander <patrick.oppenlander@gmail.com>
To: musl@lists.openwall.com
Cc: unicorn_wang <unicorn_wang@outlook.com>
Subject: Re: [musl] [Question] about arch/riscv64/crt_arch.h
Date: Wed, 28 Oct 2020 12:48:02 +1100	[thread overview]
Message-ID: <CAEg67G=yLdAa8Q66N6K-7z7UKL54ninhsL35T66rRm7G=B3ySg@mail.gmail.com> (raw)
In-Reply-To: <OSYP286MB01819392108BA73A3E838A2EFE170@OSYP286MB0181.JPNP286.PROD.OUTLOOK.COM>

On Wed, Oct 28, 2020 at 12:40 PM Chen Wang <unicorn_wang@outlook.com> wrote:
>
> hi,
> I'm reading musl (1.2.1) code for riscv. In arch/riscv64/crt_arch.h,
>
> __asm__(
> ......
> "andi sp, sp, -16\n\t" // <--- why do we need this?
> "tail " START "_c"
> );
>

I'm not familiar with RISC-V, but it's there to guarantee that the
stack is 16-byte aligned which must be either an architectural or ABI
requirement.

Perhaps the kernel can start the process with a more relaxed stack
alignment. Otherwise it's there for safety (paranoia).

Patrick

  reply	other threads:[~2020-10-28  1:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-28  1:40 Chen Wang
2020-10-28  1:48 ` Patrick Oppenlander [this message]
2020-10-28  1:50   ` Rich Felker

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='CAEg67G=yLdAa8Q66N6K-7z7UKL54ninhsL35T66rRm7G=B3ySg@mail.gmail.com' \
    --to=patrick.oppenlander@gmail.com \
    --cc=musl@lists.openwall.com \
    --cc=unicorn_wang@outlook.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).