File: arch_common.h

package info (click to toggle)
libpulp 0.3.16-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,976 kB
  • sloc: ansic: 11,792; python: 1,216; sh: 881; makefile: 871; cpp: 582; asm: 387
file content (59 lines) | stat: -rw-r--r-- 1,845 bytes parent folder | download
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
52
53
54
55
56
57
58
59
#ifndef _ARCH_PPC64LE_H
#define _ARCH_PPC64LE_H

/** Offset of TLS pointer.  */
#define TLS_DTV_OFFSET 0x8000

/* The Red zone.  */
#define RED_ZONE_LEN             512

/**
 * Number of bytes that the kernel subtracts from the program counter,
 * when an ongoing syscall gets interrupted and must be restarted.
 */
#define RESTART_SYSCALL_SIZE     0

#ifdef __ASSEMBLER__
/* Declarations that requires assembler.  */

/** Field offset determining the real size (in bytes) of the ulp stack.  */
#define ULP_STACK_REAL_SIZE       0

/** Field offset determining the used size (in bytes) of the ulp stack.  */
#define ULP_STACK_USED_SIZE       8

/** Field offset determining the object pointer (allocated by mmap) of the ulp stack.  */
#define ULP_STACK_PTR             16

#else
/* Declarations that requires a C compiler.  */

/** Struct used to store the registers in memory.  */
typedef struct pt_regs registers_t;

/** Register in which the function stores the return value.  */
#define FUNCTION_RETURN_REG(reg) ((reg).gpr[3])

/** Register which acts as a program counter.  */
#define PROGRAM_COUNTER_REG(reg) ((reg).nip)

/** Register which acts as top of stack.  */
#define STACK_TOP_REG(reg)       ((reg).gpr[1])

/** Set the GLOBAL ENTRYPOINT REGISTER, which in power is r12.  */
#define SET_GLOBAL_ENTRYPOINT_REG(reg, val) (reg).gpr[12] = (val)

/** Field determining the real size (in longs) of the ulp stack.  */
#define ULP_STACK_REAL_SIZE       0

/** Field determining the used size (in longs) of the ulp stack.  */
#define ULP_STACK_USED_SIZE       1

/** Field determining the object pointer (allocated by mmap) of the ulp stack.  */
#define ULP_STACK_PTR             2

/** The ulp_stack object, defined in ulp_prologue.S.  */
extern __thread unsigned long ulp_stack[];

#endif /* __ASSEMBLER__ */
#endif /* _ARCH_PPC64LE_H */