Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/arch/s390/include/asm/current.h
26493 views
1
/* SPDX-License-Identifier: GPL-2.0 */
2
/*
3
* S390 version
4
* Copyright IBM Corp. 1999
5
* Author(s): Martin Schwidefsky ([email protected])
6
*
7
* Derived from "include/asm-i386/current.h"
8
*/
9
10
#ifndef _S390_CURRENT_H
11
#define _S390_CURRENT_H
12
13
#include <asm/lowcore.h>
14
#include <asm/machine.h>
15
16
struct task_struct;
17
18
static __always_inline struct task_struct *get_current(void)
19
{
20
unsigned long ptr, lc_current;
21
22
lc_current = offsetof(struct lowcore, current_task);
23
asm_inline(
24
ALTERNATIVE(" lg %[ptr],%[offzero](%%r0)\n",
25
" lg %[ptr],%[offalt](%%r0)\n",
26
ALT_FEATURE(MFEATURE_LOWCORE))
27
: [ptr] "=d" (ptr)
28
: [offzero] "i" (lc_current),
29
[offalt] "i" (lc_current + LOWCORE_ALT_ADDRESS));
30
return (struct task_struct *)ptr;
31
}
32
33
#define current get_current()
34
35
#endif /* !(_S390_CURRENT_H) */
36
37