LinnuxKPI: drm2: retire timespec_to_jiffies()
[freebsd/src.git] / sys / powerpc / ps3 / ps3-hv-asm.awk
blobd3364a0c2bd76d7dffa669fd1b695df7c733e1b3
1 # This script generates the PS3 hypervisor call stubs from an HV
2 # interface definition file. The PS3 HV calling convention is very
3 # similar to the PAPR one, except that the function token is passed in
4 # r11 instead of r3.
6 # Invoke like so: awk -f ps3-hv-asm.awk < ps3-hvcall.master > ps3-hvcall.S
9 BEGIN {
10 printf("#include <machine/asm.h>\n\n");
11 printf("#define hc .long 0x44000022\n\n");
14 /HVCALL.*/ {
15 # Parameter save area
16 # 48 in elfv1, 32 in elfv2
17 stack_offset = 32;
19 code = $2;
20 ins = split($4, a, ",")
21 outs = split($5, a, ",")
23 printf("ASENTRY(%s)\n",$3);
24 printf("\tmflr %%r0\n");
25 printf("\tstd %%r0,16(%%r1)\n");
26 printf("\tstdu %%r1,-%d(%%r1)\n", stack_offset+8*outs);
28 if ($4 == "UNUSED")
29 ins = 0
31 # Save output reg addresses to the stack
32 for (i = 0; i < outs; i++) {
33 if (ins+i >= 8) {
34 printf("\tld %%r11,%d(%%r1)\n", stack_offset+8*outs + stack_offset + 8*(i+ins));
35 printf("\tstd %%r11,%d(%%r1)\n", stack_offset+8*i);
36 } else {
37 printf("\tstd %%r%d,%d(%%r1)\n", 3+ins+i, stack_offset+8*i);
41 printf("\tli %%r11,%d\n", code);
42 printf("\thc\n");
43 printf("\textsw %%r3,%%r3\n");
45 for (i = 0; i < outs; i++) {
46 printf("\tld %%r11,%d(%%r1)\n", stack_offset+8*i);
47 printf("\tstd %%r%d,0(%%r11)\n", 4+i);
50 printf("\tld %%r1,0(%%r1)\n");
51 printf("\tld %%r0,16(%%r1)\n");
52 printf("\tmtlr %%r0\n");
53 printf("\tblr\n");
55 printf("ASEND(%s)\n\n",$3);