xref: /kvm-unit-tests/lib/arm/asm/thread_info.h (revision 1693644d49d196ef1a22c868a16d2aa92fc2dfbf)
1 #ifndef _ASMARM_THREAD_INFO_H_
2 #define _ASMARM_THREAD_INFO_H_
3 /*
4  * Adapted from arch/arm64/include/asm/thread_info.h
5  *
6  * Copyright (C) 2015, Red Hat Inc, Andrew Jones <drjones@redhat.com>
7  *
8  * This work is licensed under the terms of the GNU LGPL, version 2.
9  */
10 
11 #define THREAD_SIZE		16384
12 #define THREAD_START_SP		(THREAD_SIZE - 16)
13 
14 struct thread_info {
15 	int cpu;
16 	char ext[0];		/* allow unit tests to add extended info */
17 };
18 
19 register unsigned long current_stack_pointer asm("sp");
20 
21 static inline struct thread_info *current_thread_info(void)
22 {
23 	return (struct thread_info *)
24 		(current_stack_pointer & ~(THREAD_SIZE - 1));
25 }
26 
27 #endif /* _ASMARM_THREAD_INFO_H_ */
28