Skip to content

Commit

Permalink
arch: inline this_task
Browse files Browse the repository at this point in the history
Configuring NuttX and compile:
$ ./tools/configure.sh -l qemu-armv8a:nsh_smp
$ make
Running with qemu
$ qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic \
   -machine virt,virtualization=on,gic-version=3 \
   -net none -chardev stdio,id=con,mux=on -serial chardev:con \
   -mon chardev=con,mode=readline -kernel ./nuttx

Signed-off-by: hujun5 <[email protected]>
  • Loading branch information
hujun260 committed Aug 18, 2024
1 parent 9c2af72 commit 4f3b432
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 85 deletions.
4 changes: 0 additions & 4 deletions sched/sched/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,6 @@ else()
list(APPEND SRCS sched_processtimer.c)
endif()

if(CONFIG_SMP)
list(APPEND SRCS sched_thistask.c)
endif()

if(CONFIG_SCHED_CRITMONITOR)
list(APPEND SRCS sched_critmonitor.c)
endif()
Expand Down
4 changes: 0 additions & 4 deletions sched/sched/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ else
CSRCS += sched_processtimer.c
endif

ifeq ($(CONFIG_SMP),y)
CSRCS += sched_thistask.c
endif

ifeq ($(CONFIG_SCHED_CRITMONITOR),y)
CSRCS += sched_critmonitor.c
endif
Expand Down
23 changes: 22 additions & 1 deletion sched/sched/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,28 @@ void nxsched_suspend(FAR struct tcb_s *tcb);
#endif

#ifdef CONFIG_SMP
FAR struct tcb_s *this_task(void) noinstrument_function;
noinstrument_function
static inline_function FAR struct tcb_s *this_task(void)
{
FAR struct tcb_s *tcb;
irqstate_t flags;

/* If the CPU supports suppression of interprocessor interrupts, then
* simple disabling interrupts will provide sufficient protection for
* the following operations.
*/

flags = up_irq_save();

/* Obtain the TCB which is currently running on this CPU */

tcb = current_task(this_cpu());

/* Enable local interrupts */

up_irq_restore(flags);
return tcb;
}

int nxsched_select_cpu(cpu_set_t affinity);
int nxsched_pause_cpu(FAR struct tcb_s *tcb);
Expand Down
76 changes: 0 additions & 76 deletions sched/sched/sched_thistask.c

This file was deleted.

0 comments on commit 4f3b432

Please sign in to comment.