Skip to content

Commit

Permalink
ps3: add elfv2 support
Browse files Browse the repository at this point in the history
ps3 are broken since we moved to clang/elfv2.  Fix this by updating the
hypercall glue to the new ABI.

Signed-off-by: Chattrapat Sangmanee <[email protected]>
Reviewed by:	jhibbits
MFC after:	1 week
Pull Request:	freebsd/freebsd-src#1413
  • Loading branch information
aomsin2526 authored and bsdjhb committed Dec 9, 2024
2 parents dcc8c5f + 50a0397 commit 3f0445b
Show file tree
Hide file tree
Showing 2 changed files with 230 additions and 224 deletions.
18 changes: 12 additions & 6 deletions sys/powerpc/ps3/ps3-hv-asm.awk
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,29 @@ BEGIN {
}

/HVCALL.*/ {
# Parameter save area
# 48 in elfv1, 32 in elfv2
stack_offset = 32;

code = $2;
ins = split($4, a, ",")
outs = split($5, a, ",")

printf("ASENTRY(%s)\n",$3);
printf("\tmflr %%r0\n");
printf("\tstd %%r0,16(%%r1)\n");
printf("\tstdu %%r1,-%d(%%r1)\n", 48+8*outs);
printf("\tstdu %%r1,-%d(%%r1)\n", stack_offset+8*outs);

if ($4 == "UNUSED")
ins = 0

# Save output reg addresses to the stack
for (i = 0; i < outs; i++) {
if (ins+i >= 8) {
printf("\tld %%r11,%d(%%r1)\n", 48+8*outs + 48 + 8*(i+ins));
printf("\tstd %%r11,%d(%%r1)\n", 48+8*i);
printf("\tld %%r11,%d(%%r1)\n", stack_offset+8*outs + stack_offset + 8*(i+ins));
printf("\tstd %%r11,%d(%%r1)\n", stack_offset+8*i);
} else {
printf("\tstd %%r%d,%d(%%r1)\n", 3+ins+i, 48+8*i);
printf("\tstd %%r%d,%d(%%r1)\n", 3+ins+i, stack_offset+8*i);
}
}

Expand All @@ -39,12 +43,14 @@ BEGIN {
printf("\textsw %%r3,%%r3\n");

for (i = 0; i < outs; i++) {
printf("\tld %%r11,%d(%%r1)\n", 48+8*i);
printf("\tld %%r11,%d(%%r1)\n", stack_offset+8*i);
printf("\tstd %%r%d,0(%%r11)\n", 4+i);
}

printf("\tld %%r1,0(%%r1)\n");
printf("\tld %%r0,16(%%r1)\n");
printf("\tmtlr %%r0\n");
printf("\tblr\n\n");
printf("\tblr\n");

printf("ASEND(%s)\n\n",$3);
}
Loading

0 comments on commit 3f0445b

Please sign in to comment.