Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arch: inline up_switch_context,in arm arm64 #13644

Merged
merged 2 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions arch/arm/include/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <sys/types.h>
#ifndef __ASSEMBLY__
# include <stdbool.h>
# include <arch/syscall.h>
#endif

/****************************************************************************
Expand Down Expand Up @@ -76,6 +77,17 @@

#ifndef __ASSEMBLY__

#ifndef up_switch_context
#define up_switch_context(tcb, rtcb) \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use inline function?

Copy link
Contributor Author

@hujun260 hujun260 Sep 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we use inline, we need to see the definition of struct tcb_s, but irq.h can't include nuttx/sched.h

do { \
if (!up_interrupt_context()) \
{ \
sys_call2(SYS_switch_context, (uintptr_t)&rtcb->xcp.regs, \
(uintptr_t)tcb->xcp.regs); \
} \
} while (0)
#endif

#ifdef __cplusplus
#define EXTERN extern "C"
extern "C"
Expand Down
Loading
Loading