pkarashchenko commented on code in PR #6069: URL: https://github.com/apache/incubator-nuttx/pull/6069#discussion_r850421020
########## arch/risc-v/src/common/crt0.c: ########## @@ -0,0 +1,137 @@ +/**************************************************************************** + * arch/risc-v/src/common/crt0.c + * + * 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 <arch/syscall.h> + +#include <nuttx/addrenv.h> +#include <nuttx/compiler.h> +#include <nuttx/config.h> + +#include <sys/types.h> +#include <stdlib.h> + +#ifdef CONFIG_BUILD_KERNEL + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +int main(int argc, char *argv[]); + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: up_signal_handler + * + * Description: + * This function is the user-space, signal handler trampoline function. It + * is called from up_signal_dispatch() in user-mode. + * + * Input Parameters: + * a0 = sighand + * The address user-space signal handling function + * a1-a3 = signo, info, and ucontext + * Standard arguments to be passed to the signal handling function. + * + * Returned Value: + * None. This function does not return in the normal sense. It returns + * via the SYS_signal_handler_return (see syscall.h) + * + ****************************************************************************/ + +static void sig_trampoline(void) naked_function; +static void sig_trampoline(void) +{ + __asm__ __volatile__ + ( + " addi sp, sp, -16\n" /* Save ra on the stack */ + " sd ra, 8(sp)\n" Review Comment: Sorry for the dummy question, but still. I just saw that `dispatch_syscall` use `REGSTORE " ra, 0(sp)\n"`. Why we use `0(sp)` there and `8(sp)` here? -- 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]
