xiaoxiang781216 commented on code in PR #14596: URL: https://github.com/apache/nuttx/pull/14596#discussion_r1841707539
########## fs/procfs/fs_procfstcbinfo.c: ########## @@ -182,14 +182,14 @@ static int tcbinfo_close(FAR struct file *filep) * Name: tcbinfo_current_regs * * Description: - * A special version of up_current_regs() that is non-optimized. + * A special version of up_running_regs() that is non-optimized. * ****************************************************************************/ nooptimiziation_function FAR static void *tcbinfo_current_regs(void) Review Comment: tcbinfo_running_regs ########## sched/misc/nxsched_regs.c: ########## @@ -0,0 +1,54 @@ +/**************************************************************************** + * sched/misc/nxsched_regs.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <sys/stat.h> +#include <sys/param.h> + +#include <nuttx/sched.h> +#include "sched/sched.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +FAR uintptr_t *nxsched_regs(uint8_t *buf, int size) Review Comment: `uint8_t *buf` to FAR `void *buf` ########## arch/arm/src/armv7-m/arm_doirq.c: ########## @@ -56,7 +56,13 @@ void exception_direct(void) uint32_t *arm_doirq(int irq, uint32_t *regs) { - struct tcb_s *tcb = this_task(); + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; + FAR struct tcb_s *tcb; + + if (*running_task != NULL) + { + (*running_task)->xcp.regs = regs; Review Comment: ditto ########## sched/misc/nxsched_regs.c: ########## @@ -0,0 +1,54 @@ +/**************************************************************************** + * sched/misc/nxsched_regs.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <sys/stat.h> +#include <sys/param.h> + +#include <nuttx/sched.h> +#include "sched/sched.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +FAR uintptr_t *nxsched_regs(uint8_t *buf, int size) +{ + if (up_interrupt_context()) + { + return (FAR uintptr_t *)up_running_regs(); + } + else + { + if (size < XCPTCONTEXT_SIZE) + { + return NULL; + } + + up_saveusercontext(buf); Review Comment: so nxsched_regs just have one caller, let's keep as before? ########## arch/arm/src/armv7-a/arm_syscall.c: ########## @@ -567,7 +565,7 @@ uint32_t *arm_syscall(uint32_t *regs) break; } - if (regs != tcb->xcp.regs) + if ((*running_task) != tcb) Review Comment: ditto ########## arch/arm/src/arm/arm_syscall.c: ########## @@ -134,7 +133,7 @@ uint32_t *arm_syscall(uint32_t *regs) break; } - if (regs != tcb->xcp.regs) + if ((*running_task) != tcb) Review Comment: remove () in ALL similar places ########## arch/arm/src/armv6-m/arm_doirq.c: ########## @@ -56,7 +56,13 @@ void exception_direct(void) uint32_t *arm_doirq(int irq, uint32_t *regs) { - struct tcb_s *tcb = this_task(); + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; + FAR struct tcb_s *tcb; + + if (*running_task != NULL) + { + (*running_task)->xcp.regs = regs; Review Comment: remove () too ########## arch/mips/src/mips32/mips_doirq.c: ########## @@ -58,6 +58,13 @@ uint32_t *mips_doirq(int irq, uint32_t *regs) { + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; + + if (*running_task != NULL) + { + mips_copystate((*running_task)->xcp.regs, regs); Review Comment: remove () -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
