Added freeldr and hal from PPC branch, along with needed headers and
[reactos.git] / reactos / boot / freeldr / freeldr / arch / powerpc / ofw_util.s
1 .section .text
2 .globl ofw_functions
3 .globl ofw_call_addr
4 .globl call_ofw
5 call_ofw:
6 /* R3 has the function offset to call (n * 4)
7 * Other arg registers are unchanged. */
8 subi %r1,%r1,0x100
9 stw %r8,24(%r1)
10 mflr %r8
11 stw %r8,0(%r1)
12 stw %r3,4(%r1)
13 stw %r4,8(%r1)
14 stw %r5,12(%r1)
15 stw %r6,16(%r1)
16 stw %r7,20(%r1)
17 stw %r9,28(%r1)
18 stw %r10,32(%r1)
19 stw %r20,36(%r1)
20
21 lis %r10,ofw_functions@ha
22 addi %r8,%r10,ofw_functions@l
23 add %r8,%r3,%r8
24 lwz %r9,0(%r8)
25 mtctr %r9
26
27 mr %r3,%r4
28 mr %r4,%r5
29 mr %r5,%r6
30 mr %r6,%r7
31 mr %r7,%r8
32 mr %r8,%r9
33
34 /* Call ofw proxy function */
35 bctrl
36
37 lwz %r8,0(%r1)
38 mtlr %r8
39 lwz %r4,8(%r1)
40 lwz %r5,12(%r1)
41 lwz %r6,16(%r1)
42 lwz %r7,20(%r1)
43 lwz %r8,24(%r1)
44 lwz %r9,28(%r1)
45 lwz %r10,32(%r1)
46 lwz %r20,36(%r1)
47 addi %r1,%r1,0x100
48 blr
49