root/arch/unicore32/kernel/debug.S

/* [<][>][^][v][top][bottom][index][help] */
   1 /* SPDX-License-Identifier: GPL-2.0-only */
   2 /*
   3  * linux/arch/unicore32/kernel/debug.S
   4  *
   5  * Code specific to PKUnity SoC and UniCore ISA
   6  *
   7  * Copyright (C) 2001-2010 GUAN Xue-tao
   8  *
   9  *  32-bit debugging code
  10  */
  11 #include <linux/linkage.h>
  12 #include <asm/assembler.h>
  13 
  14                 .text
  15 
  16 /*
  17  * Some debugging routines (useful if you've got MM problems and
  18  * printk isn't working).  For DEBUGGING ONLY!!!  Do not leave
  19  * references to these in a production kernel!
  20  */
  21 #include "debug-macro.S"
  22 
  23 /*
  24  * Useful debugging routines
  25  */
  26 ENTRY(printhex8)
  27                 mov     r1, #8
  28                 b       printhex
  29 ENDPROC(printhex8)
  30 
  31 ENTRY(printhex4)
  32                 mov     r1, #4
  33                 b       printhex
  34 ENDPROC(printhex4)
  35 
  36 ENTRY(printhex2)
  37                 mov     r1, #2
  38 printhex:       adr     r2, hexbuf
  39                 add     r3, r2, r1
  40                 mov     r1, #0
  41                 stb     r1, [r3]
  42 1:              and     r1, r0, #15
  43                 mov     r0, r0 >> #4
  44                 csub.a  r1, #10
  45                 beg     2f
  46                 add     r1, r1, #'0' - 'a' + 10
  47 2:              add     r1, r1, #'a' - 10
  48                 stb.w   r1, [r3+], #-1
  49                 cxor.a  r3, r2
  50                 bne     1b
  51                 mov     r0, r2
  52                 b       printascii
  53 ENDPROC(printhex2)
  54 
  55                 .ltorg
  56 
  57 ENTRY(printascii)
  58                 addruart r3
  59                 b       2f
  60 1:              waituart r2, r3
  61                 senduart r1, r3
  62                 busyuart r2, r3
  63                 cxor.a  r1, #'\n'
  64                 cmoveq  r1, #'\r'
  65                 beq     1b
  66 2:              cxor.a  r0, #0
  67                 beq     3f
  68                 ldb.w   r1, [r0]+, #1
  69                 cxor.a  r1, #0
  70                 bne     1b
  71 3:              mov     pc, lr
  72 ENDPROC(printascii)
  73 
  74 ENTRY(printch)
  75                 addruart r3
  76                 mov     r1, r0
  77                 mov     r0, #0
  78                 b       1b
  79 ENDPROC(printch)
  80 
  81 hexbuf:         .space 16
  82 

/* [<][>][^][v][top][bottom][index][help] */