Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 May 2019 13:42:35 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        Justin Hibbits <chmeeedalf@gmail.com>, FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>
Subject:   powerpc64: kern_slbtrap double mtlr, one from (PC_SLBSAVE+120)(%r1) and one from (PC_SLBSAVE+136)(%r1)?
Message-ID:  <E893618A-5734-4D41-9954-825C9D997EB5@yahoo.com>

next in thread | raw e-mail | index | archive | help
kern_slbtrap has . . .
(I have capitalized to make specific MFLR,
MTLR, LD, and STD and related register usage
stand out. Also note PC_SLBSAVE+136 and
PC_SLBSAVE+120 usage.)

CNAME(slbtrap):
. . .
2:      MFLR    %R2                     /* Save the old LR in r2 */
        nop
        bl      3f                      /* Begin dance to jump to =
kern_slbtrap*/
        .llong  kern_slbtrap
3:      mflr    %r1
        ld      %r1,0(%r1)
        mtlr    %r1
        GET_CPUINFO(%r1)
        blrl                            /* 124 bytes -- 4 to spare */
CNAME(slbtrapend):

kern_slbtrap:
        STD     %R2,(PC_SLBSAVE+136)(%R1) /* old LR */
. . .
3:      /* Real kernel SLB miss */
. . .
        mfxer   %r2                     /* save XER */
        std     %r2,(PC_SLBSAVE+112)(%r1)
        MFLR    %R2                     /* save LR (SP already saved) */
        STD     %R2,(PC_SLBSAVE+120)(%R1)
. . .
        LD      %R2,(PC_SLBSAVE+120)(%R1)
        MTLR    %R2
        ld      %r2,(PC_SLBSAVE+128)(%r1)
        mtctr   %r2
        LD      %R2,(PC_SLBSAVE+136)(%R1)
        MTLR    %R2

        /* Restore r0-r3 */


It appears that PC_SLBSAVE+120(%r1) is being used
to save and restore an "internal" lr value,
despite overall being replaced before lr is used.

If I gather right, the ld from PC_SLBSAVE+120(%r1)
is effectively unneeded. May be the store to
PC_SLBSAVE+120(%r1) serves for being able to
see the value in a standard place, but my guess
would be that it is also unneeded in the above
code. Similarly for the matching mtlr and mflr.


=3D=3D=3D
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E893618A-5734-4D41-9954-825C9D997EB5>