mirror of
https://github.com/apache/nuttx.git
synced 2026-10-23 23:08:44 +00:00
ARM: Partial implementation of TLS
This commit is contained in:
parent
5445a1af83
commit
78e4ca2bc7
4 changed files with 115 additions and 24 deletions
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* arch/arm/src/common/up_checkstack.c
|
||||
*
|
||||
* Copyright (C) 2011, 2013, 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011, 2013, 2015-2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -42,9 +42,11 @@
|
|||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <sched.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/tls.h>
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
|
|
@ -82,11 +84,20 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size)
|
|||
FAR uint32_t *ptr;
|
||||
size_t mark;
|
||||
|
||||
/* Get aligned addresses and adjusted sizes */
|
||||
/* Get aligned addresses of the top and bottom of the stack */
|
||||
#ifdef CONFIG_TLS
|
||||
/* Skip over the TLS data structure at the bottom of the stack */
|
||||
|
||||
start = alloc & ~3;
|
||||
end = (alloc + size + 3) & ~3;
|
||||
size = end - start;
|
||||
DEBUGASSERT((alloc & TLS_STACK_MASK) == 0);
|
||||
start = alloc + sizeof(struct tls_info_s);
|
||||
#else
|
||||
start = alloc & ~3;
|
||||
#endif
|
||||
end = (alloc + size + 3) & ~3;
|
||||
|
||||
/* Get the adjusted size based on the top and bottom of the stack */
|
||||
|
||||
size = end - start;
|
||||
|
||||
/* The ARM uses a push-down stack: the stack grows toward lower addresses
|
||||
* in memory. We need to start at the lowest address in the stack memory
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue