mailing list of musl libc
 help / color / mirror / code / Atom feed
From: 王洪亮 <wanghongliang@loongson.cn>
To: musl@lists.openwall.com
Subject: Re: [musl] add loongarch64 port v3
Date: Tue, 24 May 2022 17:08:21 +0800	[thread overview]
Message-ID: <777071eb-d8c3-eb04-fef4-4f54d6016e8f@loongson.cn> (raw)
In-Reply-To: <20220521082246.GA20105@voyager>

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


在 2022/5/21 下午4:22, Markus Wichmann 写道:
>>> I'm also not clear on how
>>> specifying the alignment here helps since any object created in a way
>>> that the alignment would affect cannot have the FAM present.
>>>
>> the __aligned__(16)  here used to save 128bit vector later.
> But it has no effect, right? The array member is offset an integer
> multiple of sixteen bytes from the start of the structure, so it is
> already aligned with respect to that, and the declaration adds no
> further padding (and if it did, common style in both Linux and musl is
> to explicate the padding). And the pointer to the structure comes from
> the kernel.

if no __aligned__(16),the struct sigcontext is 8 bytes align,even if the 
extcontext[]

is offset an integer multiple of 16 bytes from the start of struct 
sigcontext,it can only

ensure the extcontext[] is 8 bytes align. (just only when sigcontext is 
16 bytes align,

extcontext[] can meet 16 bytes align.)


> The only thing this alignment directive does is raise the alignment
> requirement of the structure up to sixteen, but that only possibly
> matters for variables of the structure type, be they automatic or
> program life time. But from here it is hard to see why the alignment
> should matter in either of those cases, since those would only possibly
> be local buffers of the kernel-provided mcontext. And the kernel
> provides the mcontext already with all the alignment it needs. I am not
> aware of any kernel API that receives a user provided mcontext. And even
> if there was one, the kernel would have to copy it into kernel space
> before doing anything with it, anyway.

this not need kernel API, in kernel, if task has pending signal, kernel 
save context

to ucontext(in user stack space), then return to userspace to signal 
handle, from

the third parameter of signal_handler, user can access the ucontext and 
mcontext.

libc and kernel access the same ucontext in user stack space.

void signal_handler (int sig, siginfo_t *info, void *ctx) {

         ucontext_t *uc = ctx;

mcontext_t *mc = ctx->uc_mcontext;

}

> And, BTW, if the alignment really is needed on the mcontext_t itself, it
> might be better to put the alignment tag on the type, not one of the
> members.

we need extcontext[] 16 bytes align for 128bit vector access, if put the
alignment on mcontext_t itself,although it can also meet the 16 bytes align
requirements of extcontext[] (the offset is an integer multiple of 16 bytes
from the start of struct sigcontext),the meaning is not clear.

>
> Ciao,
> Markus

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

  reply	other threads:[~2022-05-24  9:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-05  3:21 王洪亮
2022-05-09  1:34 ` [musl] " 王洪亮
2022-05-11 13:37   ` Rich Felker
2022-05-11 16:08     ` Arnd Bergmann
2022-05-16 14:27 ` [musl] " Rich Felker
2022-05-21  6:38   ` 王洪亮
2022-05-21  8:22     ` Markus Wichmann
2022-05-24  9:08       ` 王洪亮 [this message]
2022-05-24 12:32         ` Rich Felker
2022-05-25 10:08           ` 王洪亮
2022-05-25 12:32             ` Rich Felker
2022-05-26  3:07               ` 王洪亮
2022-05-29  6:34                 ` Szabolcs Nagy

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=777071eb-d8c3-eb04-fef4-4f54d6016e8f@loongson.cn \
    --to=wanghongliang@loongson.cn \
    --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).