summaryrefslogtreecommitdiff
path: root/arch/ppc/qemu/context.h
blob: 7cf9da839fa0d9317af42f7f441111a60146dcfa (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
#ifndef PPC_CONTEXT_H
#define PPC_CONTEXT_H

struct context {
#define SP_LOC(ctx) (&(ctx)->sp)
    unsigned long _sp;
    unsigned long return_addr;
    unsigned long sp;
    unsigned long pc;
    /* General registers */
    unsigned long regs[34];
#define REG_R3 3
#define REG_R4 7
#define REG_R5 8
#define REG_R6 9
#define REG_R7 10
    /* Flags */
    /* Optional stack contents */
    unsigned long param[0];
};

/* Create a new context in the given stack */
struct context *
init_context(uint8_t *stack, uint32_t stack_size, int num_param);

/* Switch context */
struct context *switch_to(struct context *);

/* Holds physical address of boot context */
extern unsigned long __boot_ctx;

/* This can always be safely used to refer to the boot context */
#define boot_ctx ((struct context *) phys_to_virt(__boot_ctx))

#endif /* PPC_CONTEXT_H */