Module Name: src Committed By: tsutsui Date: Sat Mar 8 17:44:37 UTC 2014
Modified Files: src/sys/arch/x68k/x68k: genassym.cf locore.s Log Message: 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) To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/arch/x68k/x68k/genassym.cf cvs rdiff -u -r1.113 -r1.114 src/sys/arch/x68k/x68k/locore.s Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/x68k/x68k/genassym.cf diff -u src/sys/arch/x68k/x68k/genassym.cf:1.33 src/sys/arch/x68k/x68k/genassym.cf:1.34 --- src/sys/arch/x68k/x68k/genassym.cf:1.33 Fri Jan 14 02:06:33 2011 +++ src/sys/arch/x68k/x68k/genassym.cf Sat Mar 8 17:44:37 2014 @@ -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 @@ define SPL6 PSL_S | PSL_IPL6 # 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 Index: src/sys/arch/x68k/x68k/locore.s diff -u src/sys/arch/x68k/x68k/locore.s:1.113 src/sys/arch/x68k/x68k/locore.s:1.114 --- src/sys/arch/x68k/x68k/locore.s:1.113 Fri Jan 31 18:49:35 2014 +++ src/sys/arch/x68k/x68k/locore.s Sat Mar 8 17:44:37 2014 @@ -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 @@ ASLOCAL(tmpstk) /* * 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 @@ ASLOCAL(tmpstk) * 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 @@ ASENTRY_NOPROFILE(start) 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 @@ Lstart1: 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 @@ Lstart2: 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 @@ Lstploaddone: /* 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 @@ Lstploaddone: 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 @@ Ljupiterdone: #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 @@ Lenab1: /* 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 @@ Lenab1: 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 @@ Lenab3: 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 @@ Lbe10a: 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 @@ Lisberr: /* * 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 @@ ENTRY_NOPROFILE(fpfline) 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 @@ Lfp_unimp: 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 @@ ENTRY_NOPROFILE(fpunsupp) 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 @@ Lfp_unsupp: * 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 @@ Ltrap1: /* * 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 @@ ENTRY_NOPROFILE(trap15) 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 @@ Lkbrkpt: | Kernel-mode breakpoint or tra 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 + movl %a1,%sp | %sp=new frame moveq #FR_SIZE,%d1 Lbrkpt1: movl %a0@+,%a1@+ @@ -719,7 +723,7 @@ Lbrkpt2: | the trap type is either T_TRACE or T_BREAKPOINT. | If we have both DDB and KGDB, let KGDB see it first, | because KGDB will just return 0 if not connected. - | Save args in d2, a2 + | Save args in %d2, %a2 movl %d0,%d2 | trap type movl %sp,%a2 | frame ptr #ifdef KGDB @@ -749,13 +753,13 @@ Lbrkpt3: | so push the hardware frame at the current sp | before restoring registers and returning. - movl %sp@(FR_SP),%a0 | modified sp + movl %sp@(FR_SP),%a0 | modified %sp lea %sp@(FR_SIZE),%a1 | end of our frame movl %a1@-,%a0@- | copy 2 longs with movl %a1@-,%a0@- | ... predecrement - movl %a0,%sp@(FR_SP) | sp = h/w frame - moveml %sp@+,#0x7FFF | restore all but sp - movl %sp@,%sp | ... and sp + movl %a0,%sp@(FR_SP) | %sp = h/w frame + moveml %sp@+,#0x7FFF | restore all but %sp + movl %sp@,%sp | ... and %sp rte | all done /* Use common m68k sigreturn */ @@ -857,6 +861,7 @@ ENTRY_NOPROFILE(fdeject) * This code is complicated by the fact that sendsig may have been called * necessitating a stack cleanup. */ + ASENTRY_NOPROFILE(rei) tstl _C_LABEL(astpending) | AST pending? jeq Lchksir | no, go check for SIR @@ -949,7 +954,7 @@ Ldorte: /* * Use common m68k process/lwp switch and context save subroutines. */ -#define FPCOPROC /* XXX: Temp. Reqd. */ +#define FPCOPROC /* XXX: Temp. reqd. */ #include <m68k/m68k/switch_subr.s> @@ -997,8 +1002,8 @@ ENTRY(loadustp) #if defined(M68040) || defined(M68060) cmpl #MMU_68040,_C_LABEL(mmutype) | 68040? jne LmotommuC | no, skip - .word 0xf518 | pflusha - .long 0x4e7b0806 | movc d0,urp + .word 0xf518 | yes, pflusha + .long 0x4e7b0806 | movc %d0,%urp #ifdef M68060 cmpl #CPU_68060,_C_LABEL(cputype) jne Lldno60 @@ -1058,9 +1063,9 @@ Lspldone: * which should be set based on the CPU clock rate. */ ENTRY_NOPROFILE(_delay) - | d0 = arg = (usecs << 8) + | %d0 = arg = (usecs << 8) movl %sp@(4),%d0 - | d1 = delay_divisor + | %d1 = delay_divisor movl _C_LABEL(delay_divisor),%d1 L_delay: subl %d1,%d0 @@ -1116,30 +1121,30 @@ Lebootcode: */ .data GLOBAL(machineid) - .long 0 | default to X68030 + .long 0 | default to X68030 GLOBAL(mmutype) - .long MMU_68030 | default to 030 internal MMU + .long MMU_68030 | default to 030 internal MMU GLOBAL(cputype) - .long CPU_68030 | default to 68030 CPU + .long CPU_68030 | default to 68030 CPU #ifdef M68K_MMU_HP GLOBAL(ectype) - .long EC_NONE | external cache type, default to none + .long EC_NONE | external cache type, default to none #endif GLOBAL(fputype) .long FPU_NONE GLOBAL(protorp) - .long 0,0 | prototype root pointer + .long 0,0 | prototype root pointer GLOBAL(intiobase) - .long 0 | KVA of base of internal IO space + .long 0 | KVA of base of internal IO space GLOBAL(intiolimit) - .long 0 | KVA of end of internal IO space + .long 0 | KVA of end of internal IO space #ifdef DEBUG ASGLOBAL(fulltflush)