zephyr/include/arch/x86/arch_inlines.h
Andrew Boie 4f77c2ad53 kernel: rename z_arch_ to arch_
Promote the private z_arch_* namespace, which specifies
the interface between the core kernel and the
architecture code, to a new top-level namespace named
arch_*.

This allows our documentation generation to create
online documentation for this set of interfaces,
and this set of interfaces is worth treating in a
more formal way anyway.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-11-07 15:21:46 -08:00

34 lines
658 B
C

/*
* Copyright (c) 2019 Intel Corporation
* Copyright (c) 2019 Stephanos Ioannidis <root@stephanos.io>
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_INCLUDE_ARCH_X86_ARCH_INLINES_H_
#define ZEPHYR_INCLUDE_ARCH_X86_ARCH_INLINES_H_
#ifndef _ASMLANGUAGE
#if defined(CONFIG_X86_64)
#include <arch/x86/intel64/thread.h>
#include <kernel_structs.h>
static inline struct _cpu *arch_curr_cpu(void)
{
struct _cpu *cpu;
__asm__ volatile("movq %%gs:(%c1), %0"
: "=r" (cpu)
: "i" (offsetof(x86_tss64_t, cpu)));
return cpu;
}
#endif /* CONFIG_X86_64 */
#endif /* !_ASMLANGUAGE */
#endif /* ZEPHYR_INCLUDE_ARCH_X86_ARCH_INLINES_H_ */