OpenBSD/sgi on octane2 - cplをcurcpu()->ci_cplへ移動

こっちは面倒い。アセンブリから沢山参照されている。

Index: context.S
===================================================================
RCS file: /cvs/src/sys/arch/mips64/mips64/context.S,v
retrieving revision 1.20
diff -r1.20 context.S
40,41d39
< #define curproc       (cpu_info_primary + CI_CURPROC)
<
62a61,62
>       GET_CPU_INFO(t0, t1)
>       lw      t0, CI_CPL(t0)
64d63
<       lw      t0, cpl
106c105,106
<       PTR_L   t3, curprocpaddr
---
>       GET_CPU_INFO(t1, t3)
>       PTR_L   t3, CI_CURPROCPADDR(t1)
116c116
<       lw      t0, cpl
---
>       lw      t0, CI_CPL(t1)
149,150c149,151
<       PTR_S   s0, curproc                     # set curproc
<       PTR_S   t3, curprocpaddr
---
>       GET_CPU_INFO(t1, t0)
>       PTR_S   s0, CI_CURPROC(t1)              # set curproc
>       PTR_S   t3, CI_CURPROCPADDR(t1)
271c272,273
<       sw      a0, cpl
---
>       GET_CPU_INFO(t1, t0)
>       sw      a0, CI_CPL(t1)
Index: exception.S
===================================================================
RCS file: /cvs/src/sys/arch/mips64/mips64/exception.S,v
retrieving revision 1.16
diff -r1.16 exception.S
319c323
<       sw      a3, cpl
---
>       sw      a3, CI_CPL(k1)
470c478
<       sw      a3, cpl
---
>       sw      a3, CI_CPL(k1)
515c523,524
<       lw      a3, cpl
---
>       GET_CPU_INFO(t0, t1)
>       lw      a3, CI_CPL(t0)
580c589,590
<       sw      a3, cpl
---
>       GET_CPU_INFO(t0, t1)
>       sw      a3, CI_CPL(t0)
609c623,624
<       sw      zero, cpl               # lower to spl0
---
>       GET_CPU_INFO(t0, t1)
>       sw      zero, CI_CPL(t0)        # lower to spl0
Index: cpustate.h
===================================================================
RCS file: /cvs/src/sys/arch/mips64/include/cpustate.h,v
retrieving revision 1.6
diff -r1.6 cpustate.h
82c82,83
<       lw      a2, cpl                         ;\
---
>       GET_CPU_INFO(v0, v1)                    ;\
>       lw      a2, CI_CPL(v0)                  ;\

intr.hのインライン関数群はstruct cpu_infoを参照しようとするとコンパイルが通らなくなったので、interrupt.cへ移動してしまった。

Index: intr.h
===================================================================
RCS file: /cvs/src/sys/arch/sgi/include/intr.h,v
retrieving revision 1.22
diff -r1.22 intr.h
50,52d49
< /* This define controls whether splraise is inlined or not */
< /* #define INLINE_SPLRAISE */
<
133a131
> #define spllock()             splhigh()
157c155
< extern volatile intrmask_t cpl;
---
> extern intrmask_t imask[NIPLS];
161,162d158
< extern intrmask_t imask[NIPLS];
<
172,173c168,169
< static __inline void splx(int newcpl);
< static __inline int spllower(int newcpl);
---
> void splx(int newcpl);
> int spllower(int newcpl);
186,199d181
< #ifdef INLINE_SPLRAISE
< static __inline int splraise(int newcpl);
< static __inline int
< splraise(int newcpl)
< {
<       int oldcpl;
<
<       __asm__ (" .set noreorder\n");
<       oldcpl = cpl;
<       cpl = oldcpl | newcpl;
<       __asm__ (" sync\n .set reorder\n");
<       return (oldcpl);
< }
< #else
201,223d182
< #endif
<
< static __inline void
< splx(int newcpl)
< {
<       if (ipending & ~newcpl)
<               (*pending_hand)(newcpl);
<       else
<               cpl = newcpl;
< }
<
< static __inline int
< spllower(int newcpl)
< {
<       int oldcpl;
<
<       oldcpl = cpl;
<       if (ipending & ~newcpl)
<               (*pending_hand)(newcpl);
<       else
<               cpl = newcpl;
<       return (oldcpl);
< }
Index: interrupt.c
===================================================================
RCS file: /cvs/src/sys/arch/mips64/mips64/interrupt.c,v
retrieving revision 1.35
diff -r1.35 interrupt.c
62d61
< volatile intrmask_t cpl;
138a138
>       struct cpu_info *ci = curcpu();
197c197
<       cpl = xcpl;
---
>       ci->ci_cpl = xcpl;
241a242
>       struct cpu_info *ci = curcpu();
251c252
<       if (want_resched)
---
>       if (ci->ci_want_resched)
290d290
< #ifndef INLINE_SPLRAISE
293a294
>       struct cpu_info *ci = curcpu();
297,298c298,299
<       oldcpl = cpl;
<       cpl = oldcpl | newcpl;
---
>       oldcpl = ci->ci_cpl;
>       ci->ci_cpl = oldcpl | newcpl;
302c303,327
< #endif
---
>
> void
> splx(int newcpl)
> {
>       struct cpu_info *ci = curcpu();
>       if (ipending & ~newcpl)
>               (*pending_hand)(newcpl);
>       else
>               ci->ci_cpl = newcpl;
> }
>
> int
> spllower(int newcpl)
> {
>       struct cpu_info *ci = curcpu();
>       int oldcpl;
>
>       oldcpl = ci->ci_cpl;
>       if (ipending & ~newcpl)
>               (*pending_hand)(newcpl);
>       else
>               ci->ci_cpl = newcpl;
>       return (oldcpl);
> }
>
Index: xheart.c
===================================================================
RCS file: /cvs/src/sys/arch/sgi/xbow/xheart.c,v
retrieving revision 1.7
diff -r1.7 xheart.c
398a399
>       struct cpu_info *ci = curcpu();
401c402
<       cpl = newcpl;
---
>       ci->ci_cpl = newcpl;
448c449
<               icpl = cpl;
---
>               icpl = curcpu()->ci_cpl;
476c477
<               cpl = icpl;
---
>               curcpu()->ci_cpl = icpl;