errno: implement _get_errno() in common code

We really should have more faith in the compiler, it generates
code to implement this exactly like the arch-specific assembly
versions, and on ARM is actually 4 bytes shorter.

FUNC_NO_FP used to disable the usual C preamble to update the
frame/stack pointers, which is how the sizes are still the same
or less. It's debatable how useful the occasional use of
FUNC_NO_FP is in practice since it hinders debugging and in a
production build frame pointers should be globally disabled, but
we can address that later.

Change-Id: I6c4b64ab3e3a9b6f91d52fa8c92e6e79a986fc77
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2016-05-03 18:56:33 -07:00 committed by Benjamin Walsh
commit 68b3b6135e
8 changed files with 5 additions and 98 deletions

View file

@ -7,6 +7,5 @@ obj-y = vector_table.o reset.o \
nmi_on_reset.o prep_c.o scs.o scb.o nmi.o \
exc_manage.o exc_wrapper.o
obj-$(CONFIG_ERRNO) += errno.o
obj-$(CONFIG_IRQ_VECTOR_TABLE_SOC) += irq_vector_table.o
obj-$(CONFIG_SW_ISR_TABLE) += sw_isr_table.o

View file

@ -1,40 +0,0 @@
/*
* Copyright (c) 2015 Wind River Systems, Inc.
*
* Licensed 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.
*/
/** @file
*
* @brief Per-thread errno accessor function
*
* Allow accessing the errno for the current thread without involving the
* context switching.
*/
#define _ASMLANGUAGE
#include <nano_private.h>
#include <offsets.h> /* nanokernel structure offset definitions */
_ASM_FILE_PROLOGUE
GTEXT(_nanokernel)
GTEXT(_get_errno)
SECTION_FUNC(TEXT, _get_errno)
ldr r0, =_nanokernel
ldr r0, [r0, #__tNANO_current_OFFSET]
adds.n r0, #__tTCS_errno_var_OFFSET
bx lr