blob: 65c0cdf1f14918f6e4fea595642f8b354c89ce6c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#ifndef __ARM_CURRENT_H__
#define __ARM_CURRENT_H__
#include <xen/config.h>
#include <xen/percpu.h>
#include <public/xen.h>
#include <asm/percpu.h>
#include <asm/processor.h>
#ifndef __ASSEMBLY__
struct vcpu;
/* Which VCPU is "current" on this PCPU. */
DECLARE_PER_CPU(struct vcpu *, curr_vcpu);
#define current (this_cpu(curr_vcpu))
#define set_current(vcpu) do { current = (vcpu); } while (0)
/* Per-VCPU state that lives at the top of the stack */
struct cpu_info {
struct cpu_user_regs guest_cpu_user_regs;
unsigned long elr;
unsigned int pad;
};
static inline struct cpu_info *get_cpu_info(void)
{
register unsigned long sp asm ("sp");
return (struct cpu_info *)((sp & ~(STACK_SIZE - 1)) + STACK_SIZE - sizeof(struct cpu_info));
}
#define guest_cpu_user_regs() (&get_cpu_info()->guest_cpu_user_regs)
#define switch_stack_and_jump(stack, fn) \
asm volatile ("mov sp,%0; b " STR(fn) : : "r" (stack) : "memory" )
#define reset_stack_and_jump(fn) switch_stack_and_jump(get_cpu_info(), fn)
#endif
#endif /* __ARM_CURRENT_H__ */
/*
* Local variables:
* mode: C
* c-file-style: "BSD"
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*/
|