Kernel Newbies Archive on lore.kernel.org
 help / color / Atom feed
* Why does dump_stack need asmlinkage?
@ 2021-04-14 14:54 Lv Ying
  0 siblings, 0 replies; only message in thread
From: Lv Ying @ 2021-04-14 14:54 UTC (permalink / raw)
  To: kernelnewbies

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-14 14:54 Why does dump_stack need asmlinkage? Lv Ying

Kernel Newbies Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/kernelnewbies/0 kernelnewbies/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kernelnewbies kernelnewbies/ https://lore.kernel.org/kernelnewbies \
		kernelnewbies@kernelnewbies.org
	public-inbox-index kernelnewbies

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernelnewbies.kernelnewbies


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git