Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x68k/x68k Misc cosmetic changes to reduce diffs fro...



details:   https://anonhg.NetBSD.org/src/rev/1185ae57c612
branches:  trunk
changeset: 794203:1185ae57c612
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Mar 08 17:44:37 2014 +0000

description:
Misc cosmetic changes to reduce diffs from other m68k ports.

- replace magic numbers with macro via genassym.cf
- include opt_fpu_emulate.h at the top
- use C-style comments
- add register '%' prefix in comments
- sync several comments
- indent adjustments etc.

No text binary changes. (only .global _KERNEL_OPT_FPU_EMULATE is moved)

diffstat:

 sys/arch/x68k/x68k/genassym.cf |    4 +-
 sys/arch/x68k/x68k/locore.s    |  137 +++++++++++++++++++++-------------------
 2 files changed, 74 insertions(+), 67 deletions(-)

diffs (truncated from 409 to 300 lines):

diff -r cc3e264230a4 -r 1185ae57c612 sys/arch/x68k/x68k/genassym.cf
--- a/sys/arch/x68k/x68k/genassym.cf    Sat Mar 08 17:05:47 2014 +0000
+++ b/sys/arch/x68k/x68k/genassym.cf    Sat Mar 08 17:44:37 2014 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.33 2011/01/14 02:06:33 rmind Exp $
+#      $NetBSD: genassym.cf,v 1.34 2014/03/08 17:44:37 tsutsui Exp $
 
 #
 # Copyright (c) 1982, 1990, 1993
@@ -158,6 +158,8 @@
 # magic
 define FC_USERD                FC_USERD
 define FC_SUPERD               FC_SUPERD
+define DC_FREEZE               DC_FREEZE
+define CACHE40_ON              CACHE40_ON
 define CACHE_ON                CACHE_ON
 define CACHE_OFF               CACHE_OFF
 define CACHE_CLR               CACHE_CLR
diff -r cc3e264230a4 -r 1185ae57c612 sys/arch/x68k/x68k/locore.s
--- a/sys/arch/x68k/x68k/locore.s       Sat Mar 08 17:05:47 2014 +0000
+++ b/sys/arch/x68k/x68k/locore.s       Sat Mar 08 17:44:37 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.113 2014/01/31 18:49:35 tsutsui Exp $     */
+/*     $NetBSD: locore.s,v 1.114 2014/03/08 17:44:37 tsutsui Exp $     */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -45,6 +45,7 @@
 #include "opt_fpsp.h"
 #include "opt_kgdb.h"
 #include "opt_lockdebug.h"
+#include "opt_fpu_emulate.h"
 #include "opt_m68k_arch.h"
 
 #include "ite.h"
@@ -55,8 +56,10 @@
 
 #include <machine/asm.h>
 
-| This is for kvm_mkdb, and should be the address of the beginning
-| of the kernel text segment (not necessarily the same as kernbase).
+/*
+ * This is for kvm_mkdb, and should be the address of the beginning
+ * of the kernel text segment (not necessarily the same as kernbase).
+ */
        .text
 GLOBAL(kernel_text)
 
@@ -84,8 +87,8 @@
 /*
  * Macro to relocate a symbol, used before MMU is enabled.
  */
-#define        _RELOC(var, ar) \
-       lea     var,ar; \
+#define        _RELOC(var, ar)                 \
+       lea     var,ar;                 \
        addl    %a5,ar
 
 #define        RELOC(var, ar)          _RELOC(_C_LABEL(var), ar)
@@ -100,6 +103,7 @@
  * through ROM until MMU is turned on at which time they will vector
  * through our table (vectors.s).
  */
+
 BSS(lowram,4)
 BSS(esym,4)
 
@@ -143,7 +147,7 @@
        movc    %d0,%cacr               | clear and disable on-chip cache(s)
 
 /* determine our CPU/MMU combo - check for all regardless of kernel config */
-       movl    #0x200,%d0              | data freeze bit
+       movl    #DC_FREEZE,%d0          | data freeze bit
        movc    %d0,%cacr               |   only exists on 68030
        movc    %cacr,%d0               | read it back
        tstl    %d0                     | zero?
@@ -196,6 +200,7 @@
        subl    %d0,%d1                 | compute amount of RAM present
        RELOC(physmem, %a0)
        movl    %d1,%a0@                | and physmem
+
 /* configure kernel and lwp0 VA space so we can get going */
 #if NKSYMS || defined(DDB) || defined(MODULAR)
        RELOC(esym,%a0)                 | end of static kernel test/data/syms
@@ -225,7 +230,7 @@
        RELOC(mmutype, %a0)
        cmpl    #MMU_68040,%a0@         | 68040?
        jne     Lmotommu1               | no, skip
-       .long   0x4e7b1807              | movc d1,srp
+       .long   0x4e7b1807              | movc %d1,%srp
        jra     Lstploaddone
 Lmotommu1:
        RELOC(protorp, %a0)
@@ -242,9 +247,9 @@
        /* JUPITER-X: set system register "SUPER" bit */
        movl    #0x0200a240,%d0         | translate DRAM area transparently
        .long   0x4e7b0006              | movc d0,dtt0
-       lea     0x00c00000,%a0          | a0: graphic VRAM
-       lea     0x02c00000,%a1          | a1: graphic VRAM ( not JUPITER-X )
-                                       |     DRAM ( JUPITER-X )
+       lea     0x00c00000,%a0          | %a0: graphic VRAM
+       lea     0x02c00000,%a1          | %a1: graphic VRAM ( not JUPITER-X )
+                                       |      DRAM ( JUPITER-X )
        movw    %a0@,%d0
        movw    %d0,%d1
        notw    %d1
@@ -253,15 +258,15 @@
        cmpw    %a1@,%d1                | JUPITER-X?
        jne     Ljupiterdone            | no, skip
        movl    #0x0100a240,%d0         | to access system register
-       .long   0x4e7b0006              | movc d0,dtt0
+       .long   0x4e7b0006              | movc %d0,%dtt0
        movb    #0x01,0x01800003        | set "SUPER" bit
 Ljupiterdone:
 #endif /* JUPITER */
        moveq   #0,%d0                  | ensure TT regs are disabled
-       .long   0x4e7b0004              | movc d0,itt0
-       .long   0x4e7b0005              | movc d0,itt1
-       .long   0x4e7b0006              | movc d0,dtt0
-       .long   0x4e7b0007              | movc d0,dtt1
+       .long   0x4e7b0004              | movc %d0,%itt0
+       .long   0x4e7b0005              | movc %d0,%itt1
+       .long   0x4e7b0006              | movc %d0,%dtt0
+       .long   0x4e7b0007              | movc %d0,%dtt1
        .word   0xf4d8                  | cinva bc
        .word   0xf518                  | pflusha
 #if PGSHIFT == 13
@@ -269,19 +274,19 @@
 #else
        movl    #0x8000,%d0
 #endif
-       .long   0x4e7b0003              | movc d0,tc
+       .long   0x4e7b0003              | movc %d0,%tc
 #ifdef M68060
        RELOC(cputype, %a0)
        cmpl    #CPU_68060,%a0@         | 68060?
        jne     Lnot060cache
        movl    #1,%d0
-       .long   0x4e7b0808              | movcl d0,pcr
+       .long   0x4e7b0808              | movcl %d0,%pcr
        movl    #0xa0808000,%d0
        movc    %d0,%cacr               | enable store buffer, both caches
        jmp     Lenab1
 Lnot060cache:
 #endif
-       movl    #0x80008000,%d0
+       movl    #CACHE40_ON,%d0
        movc    %d0,%cacr               | turn on both caches
        jmp     Lenab1
 Lmotommu2:
@@ -304,8 +309,8 @@
 /* call final pmap setup */
        jbsr    _C_LABEL(pmap_bootstrap_finalize)
 /* set kernel stack, user SP */
-       movl    _C_LABEL(lwp0uarea),%a1 | grab lwp0 uarea
-       lea     %a1@(USPACE-4),%sp      | set kernel stack to end of area  
+       movl    _C_LABEL(lwp0uarea),%a1 | get lwp0 uarea
+       lea     %a1@(USPACE-4),%sp      | set kernel stack to end of area
        movl    #USRSTACK-4,%a2
        movl    %a2,%usp                | init user SP
 
@@ -316,7 +321,7 @@
        jeq     Lenab2                  | No, skip.
        clrl    %a1@(PCB_FPCTX)         | ensure null FP context
        movl    %a1,%sp@-
-       jbsr    _C_LABEL(m68881_restore) | restore it (does not kill a1)
+       jbsr    _C_LABEL(m68881_restore) | restore it (does not kill %a1)
        addql   #4,%sp
 Lenab2:
        cmpl    #MMU_68040,_C_LABEL(mmutype)    | 68040?
@@ -346,7 +351,7 @@
        clrl    %sp@-                   | stack adjust count and padding
        lea     %sp@(-64),%sp           | construct space for D0-D7/A0-A7
        lea     _C_LABEL(lwp0),%a0      | save pointer to frame
-       movl    %sp,%a0@(L_MD_REGS)     |   in lwp0.p_md.md_regs
+       movl    %sp,%a0@(L_MD_REGS)     |   in lwp0.l_md.md_regs
 
        jra     _C_LABEL(main)          | main()
 
@@ -495,7 +500,7 @@
        ptestr  %d0,%a0@,#7             | do a table search
        pmove   %psr,%sp@               | save result
        movb    %sp@,%d1
-       btst    #2,%d1                  | invalid? (incl. limit viol and berr)
+       btst    #2,%d1                  | invalid (incl. limit viol and berr)?
        jeq     Lmightnotbemerr         | no -> wp check
        btst    #7,%d1                  | is it MMU table berr?
        jeq     Lismerr                 | no, must be fast
@@ -522,7 +527,6 @@
 /*
  * FP exceptions.
  */
-#include "opt_fpu_emulate.h"
 ENTRY_NOPROFILE(fpfline)
 #if defined(M68040)
        cmpl    #FPU_68040,_C_LABEL(fputype) | 68040 FPU?
@@ -538,7 +542,7 @@
        jra     _ASM_LABEL(fault)       | do it
 #endif
 Lfp_unimp:
-#endif
+#endif /* M68040 */
 #ifdef FPU_EMULATE
        clrl    %sp@-                   | stack adjust count
        moveml  #0xFFFF,%sp@-           | save registers
@@ -550,7 +554,7 @@
 
 ENTRY_NOPROFILE(fpunsupp)
 #if defined(M68040)
-       cmpl    #FPU_68040,_C_LABEL(fputype) | 68040?
+       cmpl    #FPU_68040,_C_LABEL(fputype) | 68040 FPU?
        jne     Lfp_unsupp              | no, skip FPSP
 #ifdef FPSP
        jmp     _ASM_LABEL(fpsp_unsupp) | yes, go handle it
@@ -559,7 +563,7 @@
        moveml  #0xFFFF,%sp@-           | save registers
        moveq   #T_FPEMULD,%d0          | denote as FP emulation trap
        jra     _ASM_LABEL(fault)       | do it
-#endif
+#endif /* M68040 */
 Lfp_unsupp:
 #endif
 #ifdef FPU_EMULATE
@@ -578,28 +582,28 @@
  * after the trap call.
  */
 ENTRY_NOPROFILE(fpfault)
-       clrl    %sp@-           | stack adjust count
-       moveml  #0xFFFF,%sp@-   | save user registers
-       movl    %usp,%a0        | and save
-       movl    %a0,%sp@(FR_SP) |   the user stack pointer
-       clrl    %sp@-           | no VA arg
-       movl    _C_LABEL(curpcb),%a0 | current pcb
-       lea     %a0@(PCB_FPCTX),%a0 | address of FP savearea
-       fsave   %a0@            | save state
+       clrl    %sp@-                   | stack adjust count
+       moveml  #0xFFFF,%sp@-           | save user registers
+       movl    %usp,%a0                | and save
+       movl    %a0,%sp@(FR_SP)         |   the user stack pointer
+       clrl    %sp@-                   | no VA arg
+       movl    _C_LABEL(curpcb),%a0    | current pcb
+       lea     %a0@(PCB_FPCTX),%a0     | address of FP savearea
+       fsave   %a0@                    | save state
 #if defined(M68040) || defined(M68060)
        /* always null state frame on 68040, 68060 */
        cmpl    #FPU_68040,_C_LABEL(fputype)
        jge     Lfptnull
 #endif
-       tstb    %a0@            | null state frame?
-       jeq     Lfptnull        | yes, safe
-       clrw    %d0             | no, need to tweak BIU
-       movb    %a0@(1),%d0     | get frame size
-       bset    #3,%a0@(0,%d0:w) | set exc_pend bit of BIU
+       tstb    %a0@                    | null state frame?
+       jeq     Lfptnull                | yes, safe
+       clrw    %d0                     | no, need to tweak BIU
+       movb    %a0@(1),%d0             | get frame size
+       bset    #3,%a0@(0,%d0:w)        | set exc_pend bit of BIU
 Lfptnull:
-       fmovem  %fpsr,%sp@-     | push fpsr as code argument
-       frestore %a0@           | restore state
-       movl    #T_FPERR,%sp@-  | push type arg
+       fmovem  %fpsr,%sp@-             | push fpsr as code argument
+       frestore %a0@                   | restore state
+       movl    #T_FPERR,%sp@-          | push type arg
        jra     _ASM_LABEL(faultstkadj) | call trap and deal with stack cleanup
 
 /*
@@ -642,11 +646,11 @@
 /*
  * Trap 12 is the entry point for the cachectl "syscall" (both HPUX & BSD)
  *     cachectl(command, addr, length)
- * command in d0, addr in a1, length in d1
+ * command in %d0, addr in %a1, length in %d1
  */
 ENTRY_NOPROFILE(trap12)
        movl    _C_LABEL(curlwp),%a0
-       movl    %a0@(L_PROC),%sp@-      | push curproc pointer
+       movl    %a0@(L_PROC),%sp@-      | push current proc pointer
        movl    %d1,%sp@-               | push length
        movl    %a1,%sp@-               | push addr
        movl    %d0,%sp@-               | push command
@@ -691,7 +695,7 @@
        jne     Lkbrkpt                 | yes, kernel breakpoint
        jra     _ASM_LABEL(fault)       | no, user-mode fault
 
-Lkbrkpt: | Kernel-mode breakpoint or trace trap. (d0=trap_type)
+Lkbrkpt: | Kernel-mode breakpoint or trace trap. (%d0=trap_type)
        | Save the system sp rather than the user sp.
        movw    #PSL_HIGHIPL,%sr        | lock out interrupts
        lea     %sp@(FR_SIZE),%a6       | Save stack pointer
@@ -703,9 +707,9 @@
        cmpl    #_ASM_LABEL(tmpstk),%d1
        jls     Lbrkpt2                 | already on tmpstk
        | Copy frame to the temporary stack
-       movl    %sp,%a0                 | a0=src
-       lea     _ASM_LABEL(tmpstk)-96,%a1 | a1=dst
-       movl    %a1,%sp                 | sp=new frame
+       movl    %sp,%a0                 | %a0=src
+       lea     _ASM_LABEL(tmpstk)-96,%a1 | %a1=dst



Home | Main Index | Thread Index | Old Index