1
2
3
4
5
6
7
8
9
10
11
12 #include <asm/asm-compat.h>
13
14 .machine ppc64
15 .balign 256
16 .globl purgatory_start
17 purgatory_start:
18 b master
19
20
21 .org purgatory_start + 0x5c
22 .globl run_at_load
23 run_at_load:
24 .long 0
25 .size run_at_load, . - run_at_load
26
27
28 .org purgatory_start + 0x60
29 slave:
30 b .
31
32 .org purgatory_start + 0x100
33 .size purgatory_start, . - purgatory_start
34
35
36
37
38
39
40 master:
41 or %r1,%r1,%r1
42 isync
43 mr %r17,%r3
44 mr %r15,%r4
45
46 or %r3,%r3,%r3
47 lis %r6,0x1
48 mtctr %r6
49 bdnz .
50
51 bl 0f
52 0: mflr %r18
53
54
55 ld %r3, (dt_offset - 0b)(%r18)
56 mr %r16,%r3
57 li %r4,20
58 LWZX_BE %r6,%r3,%r4
59 cmpwi %cr0,%r6,2
60 blt 1f
61 li %r4,28
62 STWX_BE %r17,%r3,%r4
63 1:
64
65 ld %r4,(kernel - 0b)(%r18)
66
67
68
69 ld %r6,(run_at_load - 0b)(%r18)
70
71 stw %r6,(0x5c)(%r4)
72
73 mr %r3,%r16
74
75 li %r5,0
76
77 mfmsr %r11
78 andi. %r10,%r11,1
79 bne .Little_endian
80
81 mtctr %r4
82 bctr
83
84 .Little_endian:
85 mtsrr0 %r4
86
87 clrrdi %r11,%r11,1
88 mtsrr1 %r11
89
90 rfid
91
92
93 .balign 8
94 .globl kernel
95 kernel:
96 .8byte 0x0
97 .size kernel, . - kernel
98
99 .balign 8
100 .globl dt_offset
101 dt_offset:
102 .8byte 0x0
103 .size dt_offset, . - dt_offset
104
105
106 .data
107 .balign 8
108 .globl purgatory_sha256_digest
109 purgatory_sha256_digest:
110 .skip 32
111 .size purgatory_sha256_digest, . - purgatory_sha256_digest
112
113 .balign 8
114 .globl purgatory_sha_regions
115 purgatory_sha_regions:
116 .skip 8 * 2 * 16
117 .size purgatory_sha_regions, . - purgatory_sha_regions