Date: Sun, 18 Jan 2015 20:00:34 +0000 (UTC) From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r277335 - in head/sys/powerpc: aim include ofw powerpc Message-ID: <201501182000.t0IK0YxW019320@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: nwhitehorn Date: Sun Jan 18 20:00:33 2015 New Revision: 277335 URL: https://svnweb.freebsd.org/changeset/base/277335 Log: Use TOC to look up all kernel globals on powerpc64 instead of doing the non-relocatable lis @ha, ori @l dance and hoping they are below 4 GB. MFC after: 2 months Modified: head/sys/powerpc/aim/locore64.S head/sys/powerpc/aim/trap_subr64.S head/sys/powerpc/include/asm.h head/sys/powerpc/ofw/ofwcall64.S head/sys/powerpc/powerpc/swtch64.S Modified: head/sys/powerpc/aim/locore64.S ============================================================================== --- head/sys/powerpc/aim/locore64.S Sun Jan 18 18:32:43 2015 (r277334) +++ head/sys/powerpc/aim/locore64.S Sun Jan 18 20:00:33 2015 (r277335) @@ -91,6 +91,8 @@ GLOBAL(__endkernel) GLOBAL(tmpstk) .space TMPSTKSZ +TOC_ENTRY(tmpstk) + .text .globl btext btext: @@ -124,8 +126,8 @@ ASENTRY_NOPROF(__start) ld %r2,0(%r2) /* Set up the stack pointer */ - lis %r1,(tmpstk+TMPSTKSZ-48)@ha - addi %r1,%r1,(tmpstk+TMPSTKSZ-48)@l + ld %r1,TOC_REF(tmpstk)(%r2) + addi %r1,%r1,TMPSTKSZ-48 /* Switch to 64-bit mode */ mfmsr %r9 Modified: head/sys/powerpc/aim/trap_subr64.S ============================================================================== --- head/sys/powerpc/aim/trap_subr64.S Sun Jan 18 18:32:43 2015 (r277334) +++ head/sys/powerpc/aim/trap_subr64.S Sun Jan 18 20:00:33 2015 (r277335) @@ -307,10 +307,11 @@ CNAME(rstcode): CNAME(rstsize) = . - CNAME(rstcode) cpu_reset: - lis %r1,(tmpstk+TMPSTKSZ-48)@ha /* get new SP */ - addi %r1,%r1,(tmpstk+TMPSTKSZ-48)@l - GET_TOCBASE(%r2) + + ld %r1,TOC_REF(tmpstk)(%r2) /* get new SP */ + addi %r1,%r1,(TMPSTKSZ-48) + bl CNAME(cpudep_ap_early_bootstrap) /* Set PCPU */ nop lis %r3,1@l @@ -751,8 +752,10 @@ dbtrap: andi. %r1,%r1,0xff00 mtsprg3 %r1 - lis %r1,(tmpstk+TMPSTKSZ-48)@ha /* get new SP */ - addi %r1,%r1,(tmpstk+TMPSTKSZ-48)@l + li %r1,TRAP_TOCBASE /* get new SP */ + ld %r1,0(%r1) + ld %r1,TOC_REF(tmpstk)(%r1) + addi %r1,%r1,(TMPSTKSZ-48) FRAME_SETUP(PC_DBSAVE) /* Call C trap code: */ Modified: head/sys/powerpc/include/asm.h ============================================================================== --- head/sys/powerpc/include/asm.h Sun Jan 18 18:32:43 2015 (r277334) +++ head/sys/powerpc/include/asm.h Sun Jan 18 20:00:33 2015 (r277335) @@ -80,6 +80,12 @@ name: #ifdef __powerpc64__ +#define TOC_REF(name) __CONCAT(.L,name) +#define TOC_ENTRY(name) \ + .section ".toc","aw"; \ + TOC_REF(name): \ + .tc name[TC],name + #define _ENTRY(name) \ .section ".text"; \ .p2align 2; \ Modified: head/sys/powerpc/ofw/ofwcall64.S ============================================================================== --- head/sys/powerpc/ofw/ofwcall64.S Sun Jan 18 18:32:43 2015 (r277334) +++ head/sys/powerpc/ofw/ofwcall64.S Sun Jan 18 20:00:33 2015 (r277335) @@ -52,6 +52,13 @@ GLOBAL(openfirmware_entry) GLOBAL(rtas_entry) .llong 0 /* RTAS entry point */ +TOC_ENTRY(ofmsr) +TOC_ENTRY(ofwstk) +TOC_ENTRY(rtasmsr) +TOC_ENTRY(openfirmware_entry) +TOC_ENTRY(rtas_entry) +TOC_ENTRY(rtas_regsave) + /* * Open Firmware Real-mode Entry Point. This is a huge pain. */ @@ -94,16 +101,20 @@ ASENTRY_NOPROF(ofwcall) mfmsr %r6 /* read client interface handler */ - lis %r4,openfirmware_entry@ha - ld %r4,openfirmware_entry@l(%r4) + ld %r4,TOC_REF(openfirmware_entry)(%r2) + ld %r4,0(%r4) + + /* Get OF stack pointer */ + ld %r7,TOC_REF(ofwstk)(%r2) + addi %r7,%r7,OFWSTKSZ-32 /* * Set the MSR to the OF value. This has the side effect of disabling * exceptions, which is important for the next few steps. */ - lis %r5,ofmsr@ha - ld %r5,ofmsr@l(%r5) + ld %r5,TOC_REF(ofmsr)(%r2) + ld %r5,0(%r5) mtmsrd %r5 isync @@ -114,8 +125,7 @@ ASENTRY_NOPROF(ofwcall) * the old MSR so we can get them back later. */ mr %r5,%r1 - lis %r1,(ofwstk+OFWSTKSZ-32)@ha - addi %r1,%r1,(ofwstk+OFWSTKSZ-32)@l + mr %r1,%r7 std %r5,8(%r1) /* Save real stack pointer */ std %r2,16(%r1) /* Save old TOC */ std %r6,24(%r1) /* Save old MSR */ @@ -212,17 +222,18 @@ ASENTRY_NOPROF(rtascall) /* Record the old MSR */ mfmsr %r6 - /* read client interface handler */ - lis %r5,rtas_entry@ha - ld %r5,rtas_entry@l(%r5) + /* Read RTAS entry and reg save area pointers */ + ld %r5,TOC_REF(rtas_entry)(%r2) + ld %r5,0(%r5) + ld %r8,TOC_REF(rtas_regsave)(%r2) /* * Set the MSR to the RTAS value. This has the side effect of disabling * exceptions, which is important for the next few steps. */ - lis %r7,rtasmsr@ha - ld %r7,rtasmsr@l(%r7) + ld %r7,TOC_REF(rtasmsr)(%r2) + ld %r7,0(%r7) mtmsrd %r7 isync @@ -233,8 +244,7 @@ ASENTRY_NOPROF(rtascall) * are below 4 GB, so this is safe. */ mr %r7,%r1 - lis %r1,rtas_regsave@ha - addi %r1,%r1,rtas_regsave@l + mr %r1,%r8 std %r7,0(%r1) /* Save 64-bit stack pointer */ std %r2,8(%r1) /* Save TOC */ std %r6,16(%r1) /* Save MSR */ Modified: head/sys/powerpc/powerpc/swtch64.S ============================================================================== --- head/sys/powerpc/powerpc/swtch64.S Sun Jan 18 18:32:43 2015 (r277334) +++ head/sys/powerpc/powerpc/swtch64.S Sun Jan 18 20:00:33 2015 (r277335) @@ -65,6 +65,8 @@ #include <machine/param.h> #include <machine/asm.h> +TOC_ENTRY(blocked_lock) + /* * void cpu_throw(struct thread *old, struct thread *new) */ @@ -145,8 +147,7 @@ ENTRY(cpu_switch) cpu_switchin: #if defined(SMP) && defined(SCHED_ULE) /* Wait for the new thread to become unblocked */ - lis %r6,blocked_lock@ha - addi %r6,%r6,blocked_lock@l + ld %r6,TOC_REF(blocked_lock)(%r2) blocked_loop: ld %r7,TD_LOCK(%r13) cmpd %r6,%r7
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501182000.t0IK0YxW019320>