Skip to content
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
16 changes: 12 additions & 4 deletions arch/sim/include/setjmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
/* Storage order: %rbx, %rsp, %rbp, %r12, %r13, %r14, %r15, %rip */

# define XCPTCONTEXT_REGS 9
# define XCPTCONTEXT_REGS 11
# define XCPTCONTEXT_SIZE (8 * XCPTCONTEXT_REGS)

# ifdef __ASSEMBLY__
Expand All @@ -54,6 +54,8 @@
# define JB_R15 (6*8)
# define JB_RIP (7*8)
# define JB_FLAG (8*8)
# define JB_ERRNO (9*8)
# define JB_ALIGN0 (10*8)

# else

Expand All @@ -66,6 +68,8 @@
# define JB_R15 (6)
# define JB_RIP (7)
# define JB_FLAG (8)
# define JB_ERRNO (9)
# define JB_ALIGN0 (10)

# endif /* __ASSEMBLY__ */

Expand All @@ -78,7 +82,7 @@
#elif defined(CONFIG_HOST_X86) || defined(CONFIG_SIM_M32)
/* Storage order: %ebx, %esi, %edi, %ebp, sp, and return PC */

# define XCPTCONTEXT_REGS (8)
# define XCPTCONTEXT_REGS (9)
# define XCPTCONTEXT_SIZE (4 * XCPTCONTEXT_REGS)

# ifdef __ASSEMBLY__
Expand All @@ -91,6 +95,7 @@
# define JB_EIP (5*4)
# define JB_FLAG (6*4)
# define JB_FLAG1 (7*4)
# define JB_ERRNO (8*4)

# else

Expand All @@ -102,6 +107,7 @@
# define JB_EIP (5)
# define JB_FLAG (6)
# define JB_FLAG1 (7)
# define JB_ERRNO (8)

# endif /* __ASSEMBLY__ */

Expand All @@ -113,18 +119,19 @@

#elif defined(CONFIG_HOST_ARM)

# define XCPTCONTEXT_REGS 18
# define XCPTCONTEXT_REGS 19
# define XCPTCONTEXT_SIZE (4 * XCPTCONTEXT_REGS)

# define JB_FP 7
# define JB_SP 8
# define JB_PC 9
# define JB_FLAG 16
# define JB_FLAG1 17
# define JB_ERRNO 18

#elif defined(CONFIG_HOST_ARM64)

# define XCPTCONTEXT_REGS 33
# define XCPTCONTEXT_REGS 34
# define XCPTCONTEXT_SIZE (8 * XCPTCONTEXT_REGS)

# ifdef __ASSEMBLY__
Expand All @@ -148,6 +155,7 @@
# define JB_FP (12)
# define JB_SP (13)
# define JB_FLAG (32)
# define JB_ERRNO (33)

# endif /* __ASSEMBLY__ */

Expand Down
2 changes: 1 addition & 1 deletion arch/sim/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ ifeq ($(CONFIG_FS_LARGEFILE),y)
endif

HOSTSRCS = sim_hostirq.c sim_hostmemory.c sim_hostmisc.c sim_hosttime.c sim_hostuart.c
HOSTSRCS += sim_hostfs.c
HOSTSRCS += sim_hostfs.c sim_errno.c

hostfs.h: $(TOPDIR)/include/nuttx/fs/hostfs.h
@echo "CP: $<"
Expand Down
2 changes: 2 additions & 0 deletions arch/sim/src/sim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ endif()
list(APPEND HOSTSRCS sim_hostfs.c)
list(APPEND HOST_DEFINITIONS CONFIG_NAME_MAX=${CONFIG_NAME_MAX})

list(APPEND HOSTSRCS sim_errno.c)

configure_file(${NUTTX_DIR}/include/nuttx/fs/hostfs.h
${CMAKE_CURRENT_BINARY_DIR}/hostfs.h COPYONLY)
configure_file(${CMAKE_BINARY_DIR}/include/nuttx/config.h
Expand Down
46 changes: 46 additions & 0 deletions arch/sim/src/sim/posix/sim_errno.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/****************************************************************************
* arch/sim/src/sim/posix/sim_errno.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 <errno.h>

/****************************************************************************
* Public Functions
****************************************************************************/

int host_errno_convert(int errcode)
{
return errcode;
}

int host_errno_get(void)
{
return errno;
}

void host_errno_set(int errcode)
{
errno = errcode;
}
Loading
Loading