Lee Daly fd93e165fb examples/performance-thread: convert license to SPDX tag
This updates the Intel and Cavium license on files in examples to be
the standard BSD-3-Clause license used for the rest of DPDK, bringing
the files in compliance with the DPDK licensing policy.

Signed-off-by: Lee Daly <lee.daly@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2018-02-08 22:37:19 +01:00

67 lines
2.1 KiB
C

/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2015 Intel Corporation.
* Copyright(c) Cavium, Inc. 2017.
* All rights reserved.
*/
/*
* Some portions of this software is derived from the
* https://github.com/halayli/lthread which carrys the following license.
*
* Copyright (C) 2012, Hasan Alayli <halayli@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef STACK_H
#define STACK_H
#ifdef __cplusplus
extern "C" {
#endif
#include "lthread_int.h"
/*
* Sets up the initial stack for the lthread.
*/
static inline void
arch_set_stack(struct lthread *lt, void *func)
{
char *stack_top = (char *)(lt->stack) + lt->stack_size;
void **s = (void **)stack_top;
/* set initial context */
s[-3] = NULL;
s[-2] = (void *)lt;
lt->ctx.rsp = (void *)(stack_top - (4 * sizeof(void *)));
lt->ctx.rbp = (void *)(stack_top - (3 * sizeof(void *)));
lt->ctx.rip = func;
}
#ifdef __cplusplus
}
#endif
#endif /* STACK_H_ */