From: Lv Ying <lvying.system.thoughts@gmail.com>
To: kernelnewbies@kernelnewbies.org
Subject: Why does dump_stack need asmlinkage?
Date: Wed, 14 Apr 2021 07:54:35 -0700 [thread overview]
Message-ID: <20210414145422.GA33226@localhost.localdomain> (raw)
Hi all:
asmlinkage is only defined in arch ia64 and x86_32:
1. arch/x86/include/asm/linkage.h:
#ifdef CONFIG_X86_32
#define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0)))
#endif /* CONFIG_X86_32 */
2. arch/ia64/include/asm/linkage.h:
#define asmlinkage CPP_ASMLINKAGE __attribute__((syscall_linkage))
3. arch independent include/linux/linkage.h:
#ifdef __cplusplus
#define CPP_ASMLINKAGE extern "C"
#else
#define CPP_ASMLINKAGE
#endif
#ifndef asmlinkage
#define asmlinkage CPP_ASMLINKAGE
#endif
As kernelnewbies FAQ(https://kernelnewbies.org/FAQ/asmlinkage) said, in short, asmlinkage tells your compiler to look on the CPU stack for the function parameters, instead of registers.
So, there are two questions:
1. asmlinkage is only defined in x86_32 and ia64, what about other archs? How do they achieve the same effect as mentioned above?
2. "asmlinkage __visible void dump_stack(void)", dump_stack does not have any parameter, so why do it need asmlinkage?
Thanks!
Lv Ying
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
reply other threads:[~2021-04-14 14:56 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=20210414145422.GA33226@localhost.localdomain \
--to=lvying.system.thoughts@gmail.com \
--cc=kernelnewbies@kernelnewbies.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).