2015-10-23 19:21:55 +00:00
|
|
|
/*
|
2015-10-23 19:48:45 +00:00
|
|
|
* Portions Copyright 2008-2010 VMware, Inc.
|
2015-10-23 19:21:55 +00:00
|
|
|
*/
|
|
|
|
#ifndef _X86_64_CURRENT_H
|
|
|
|
#define _X86_64_CURRENT_H
|
|
|
|
|
|
|
|
#if !defined(__ASSEMBLY__)
|
|
|
|
struct task_struct;
|
|
|
|
|
|
|
|
#include <asm/pda.h>
|
|
|
|
|
2015-10-23 19:48:45 +00:00
|
|
|
#if defined(__VMKLNX__)
|
|
|
|
#include <vmklinux_dist.h>
|
2015-10-23 19:21:55 +00:00
|
|
|
/**
|
|
|
|
* get_current - Gets current task pointer for the current world.
|
|
|
|
*
|
|
|
|
* Gets current task pointer for the current world.
|
|
|
|
*
|
|
|
|
* RETURN VALUE:
|
|
|
|
* Pointer to the task struct of the running process.
|
|
|
|
*/
|
|
|
|
/* _VMKLNX_CODECHECK_: get_current */
|
|
|
|
static inline struct task_struct *get_current(void)
|
|
|
|
{
|
|
|
|
return vmklnx_GetCurrent();
|
2015-10-23 19:48:45 +00:00
|
|
|
}
|
2015-10-23 19:21:55 +00:00
|
|
|
#else /* !defined(__VMKLNX__) */
|
2015-10-23 19:48:45 +00:00
|
|
|
static inline struct task_struct *get_current(void)
|
|
|
|
{
|
2015-10-23 19:21:55 +00:00
|
|
|
struct task_struct *t = read_pda(pcurrent);
|
|
|
|
return t;
|
|
|
|
}
|
2015-10-23 19:48:45 +00:00
|
|
|
#endif /* defined(__VMKLNX__) */
|
2015-10-23 19:21:55 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* current - Get current task pointer of current task
|
|
|
|
*
|
|
|
|
* Returns a pointer to the task struct of the running task
|
|
|
|
*
|
|
|
|
* SYNOPSIS:
|
|
|
|
* #define current
|
|
|
|
*
|
|
|
|
* RETURN VALUE:
|
|
|
|
* Pointer to current task of type task_struct
|
|
|
|
*
|
|
|
|
*/
|
2015-10-23 22:26:03 +00:00
|
|
|
/* If the macro 'current' or its comments are changed please
|
|
|
|
* update the documentation for 'current' in vmkdrivers/src_92/doc/dummyDefs.doc
|
|
|
|
*/
|
2015-10-23 19:21:55 +00:00
|
|
|
#define current get_current()
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#ifndef ASM_OFFSET_H
|
|
|
|
#include <asm/asm-offsets.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define GET_CURRENT(reg) movq %gs:(pda_pcurrent),reg
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* !(_X86_64_CURRENT_H) */
|