lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Sun, 27 Dec 2020 02:45:30 +0800
From:   kernel test robot <lkp@...el.com>
To:     Luc Van Oostenryck <luc.vanoostenryck@...il.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Subject: arch/sh/kernel/kgdb.c:49:26: sparse: sparse: incorrect type in
 argument 1 (different base types)

Hi Luc,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   40f78232f97344afbbeb5b0008615f17c4b93466
commit: e5fc436f06eef54ef512ea55a9db8eb9f2e76959 sparse: use static inline for __chk_{user,io}_ptr()
date:   4 months ago
config: sh-randconfig-s032-20201225 (attached as .config)
compiler: sh4-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-184-g1b896707-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e5fc436f06eef54ef512ea55a9db8eb9f2e76959
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout e5fc436f06eef54ef512ea55a9db8eb9f2e76959
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=sh 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>


"sparse warnings: (new ones prefixed by >>)"
>> arch/sh/kernel/kgdb.c:49:26: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected void const volatile [noderef] __iomem *ptr @@     got unsigned long pc @@
   arch/sh/kernel/kgdb.c:49:26: sparse:     expected void const volatile [noderef] __iomem *ptr
   arch/sh/kernel/kgdb.c:49:26: sparse:     got unsigned long pc
>> arch/sh/kernel/kgdb.c:146:26: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected void const volatile [noderef] __iomem *ptr @@     got long @@
   arch/sh/kernel/kgdb.c:146:26: sparse:     expected void const volatile [noderef] __iomem *ptr
   arch/sh/kernel/kgdb.c:146:26: sparse:     got long
>> arch/sh/kernel/kgdb.c:160:17: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected void const volatile [noderef] __iomem *ptr @@     got unsigned long static [assigned] [toplevel] stepped_address @@
   arch/sh/kernel/kgdb.c:160:17: sparse:     expected void const volatile [noderef] __iomem *ptr
   arch/sh/kernel/kgdb.c:160:17: sparse:     got unsigned long static [assigned] [toplevel] stepped_address
>> arch/sh/kernel/kgdb.c:310:38: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected void const volatile [noderef] __iomem *ptr @@     got unsigned long @@
   arch/sh/kernel/kgdb.c:310:38: sparse:     expected void const volatile [noderef] __iomem *ptr
   arch/sh/kernel/kgdb.c:310:38: sparse:     got unsigned long
--
>> arch/sh/kernel/ftrace.c:50:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *ptr @@     got unsigned char * @@
   arch/sh/kernel/ftrace.c:50:9: sparse:     expected void const volatile [noderef] __iomem *ptr
   arch/sh/kernel/ftrace.c:50:9: sparse:     got unsigned char *
   arch/sh/kernel/ftrace.c:57:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *ptr @@     got unsigned char * @@
   arch/sh/kernel/ftrace.c:57:9: sparse:     expected void const volatile [noderef] __iomem *ptr
   arch/sh/kernel/ftrace.c:57:9: sparse:     got unsigned char *
--
   kernel/bpf/cgroup.c:1439:21: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int const *__gu_addr @@     got int [noderef] __user *optlen @@
   kernel/bpf/cgroup.c:1439:21: sparse:     expected int const *__gu_addr
   kernel/bpf/cgroup.c:1439:21: sparse:     got int [noderef] __user *optlen
>> kernel/bpf/cgroup.c:1439:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got int const *__gu_addr @@
   kernel/bpf/cgroup.c:1439:21: sparse:     expected void const volatile [noderef] __user *ptr
   kernel/bpf/cgroup.c:1439:21: sparse:     got int const *__gu_addr
--
   drivers/tty/sysrq.c:1110:21: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected char const *__gu_addr @@     got char const [noderef] __user *buf @@
   drivers/tty/sysrq.c:1110:21: sparse:     expected char const *__gu_addr
   drivers/tty/sysrq.c:1110:21: sparse:     got char const [noderef] __user *buf
>> drivers/tty/sysrq.c:1110:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got char const *__gu_addr @@
   drivers/tty/sysrq.c:1110:21: sparse:     expected void const volatile [noderef] __user *ptr
   drivers/tty/sysrq.c:1110:21: sparse:     got char const *__gu_addr
   drivers/tty/sysrq.c:148:13: sparse: sparse: context imbalance in 'sysrq_handle_crash' - unexpected unlock
--
   net/atm/ioctl.c:125:25: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned short const *__gu_addr @@     got unsigned short [noderef] [usertype] __user * @@
   net/atm/ioctl.c:125:25: sparse:     expected unsigned short const *__gu_addr
   net/atm/ioctl.c:125:25: sparse:     got unsigned short [noderef] [usertype] __user *
>> net/atm/ioctl.c:125:25: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got unsigned short const *__gu_addr @@
   net/atm/ioctl.c:125:25: sparse:     expected void const volatile [noderef] __user *ptr
   net/atm/ioctl.c:125:25: sparse:     got unsigned short const *__gu_addr
   net/atm/ioctl.c:180:29: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected void [noderef] __user *const *__gu_addr @@     got void [noderef] __user *[noderef] __user * @@
   net/atm/ioctl.c:180:29: sparse:     expected void [noderef] __user *const *__gu_addr
   net/atm/ioctl.c:180:29: sparse:     got void [noderef] __user *[noderef] __user *
>> net/atm/ioctl.c:180:29: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got void [noderef] __user *const *__gu_addr @@
   net/atm/ioctl.c:180:29: sparse:     expected void const volatile [noderef] __user *ptr
   net/atm/ioctl.c:180:29: sparse:     got void [noderef] __user *const *__gu_addr
   net/atm/ioctl.c:203:29: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected void [noderef] __user *const *__gu_addr @@     got void [noderef] __user *[noderef] __user * @@
   net/atm/ioctl.c:203:29: sparse:     expected void [noderef] __user *const *__gu_addr
   net/atm/ioctl.c:203:29: sparse:     got void [noderef] __user *[noderef] __user *
   net/atm/ioctl.c:203:29: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got void [noderef] __user *const *__gu_addr @@
   net/atm/ioctl.c:203:29: sparse:     expected void const volatile [noderef] __user *ptr
   net/atm/ioctl.c:203:29: sparse:     got void [noderef] __user *const *__gu_addr
   net/atm/ioctl.c:205:29: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int const *__gu_addr @@     got int [noderef] __user * @@
   net/atm/ioctl.c:205:29: sparse:     expected int const *__gu_addr
   net/atm/ioctl.c:205:29: sparse:     got int [noderef] __user *
>> net/atm/ioctl.c:205:29: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got int const *__gu_addr @@
   net/atm/ioctl.c:205:29: sparse:     expected void const volatile [noderef] __user *ptr
   net/atm/ioctl.c:205:29: sparse:     got int const *__gu_addr
--
   net/decnet/af_decnet.c:1540:12: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int const *__gu_addr @@     got int [noderef] __user *optlen @@
   net/decnet/af_decnet.c:1540:12: sparse:     expected int const *__gu_addr
   net/decnet/af_decnet.c:1540:12: sparse:     got int [noderef] __user *optlen
>> net/decnet/af_decnet.c:1540:12: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got int const *__gu_addr @@
   net/decnet/af_decnet.c:1540:12: sparse:     expected void const volatile [noderef] __user *ptr
   net/decnet/af_decnet.c:1540:12: sparse:     got int const *__gu_addr
   net/decnet/af_decnet.c:250:22: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int hash @@     got restricted __le16 [usertype] sdn_objnamel @@
   net/decnet/af_decnet.c:250:22: sparse:     expected unsigned int hash
   net/decnet/af_decnet.c:250:22: sparse:     got restricted __le16 [usertype] sdn_objnamel
   net/decnet/af_decnet.c:1519:21: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int const *__gu_addr @@     got int [noderef] __user *optlen @@
   net/decnet/af_decnet.c:1519:21: sparse:     expected int const *__gu_addr
   net/decnet/af_decnet.c:1519:21: sparse:     got int [noderef] __user *optlen
   net/decnet/af_decnet.c:1519:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got int const *__gu_addr @@
   net/decnet/af_decnet.c:1519:21: sparse:     expected void const volatile [noderef] __user *ptr
   net/decnet/af_decnet.c:1519:21: sparse:     got int const *__gu_addr
   net/decnet/af_decnet.c: note: in included file:
   include/net/dn.h:192:24: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __be16 [usertype] sport @@     got restricted __le16 [usertype] addrloc @@
   include/net/dn.h:192:24: sparse:     expected restricted __be16 [usertype] sport
   include/net/dn.h:192:24: sparse:     got restricted __le16 [usertype] addrloc
   include/net/dn.h:193:24: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __be16 [usertype] dport @@     got restricted __le16 [usertype] addrrem @@
   include/net/dn.h:193:24: sparse:     expected restricted __be16 [usertype] dport
   include/net/dn.h:193:24: sparse:     got restricted __le16 [usertype] addrrem
   net/decnet/af_decnet.c:2167:9: sparse: sparse: context imbalance in 'dn_socket_get_idx' - wrong count at exit
   net/decnet/af_decnet.c:2187:9: sparse: sparse: context imbalance in 'dn_socket_seq_next' - unexpected unlock
   net/decnet/af_decnet.c:2196:17: sparse: sparse: context imbalance in 'dn_socket_seq_stop' - unexpected unlock
--
   net/ieee802154/socket.c:837:13: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int const *__gu_addr @@     got int [noderef] __user *optlen @@
   net/ieee802154/socket.c:837:13: sparse:     expected int const *__gu_addr
   net/ieee802154/socket.c:837:13: sparse:     got int [noderef] __user *optlen
>> net/ieee802154/socket.c:837:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got int const *__gu_addr @@
   net/ieee802154/socket.c:837:13: sparse:     expected void const volatile [noderef] __user *ptr
   net/ieee802154/socket.c:837:13: sparse:     got int const *__gu_addr
--
   net/vmw_vsock/af_vsock.c:1612:15: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int const *__gu_addr @@     got int [noderef] __user *optlen @@
   net/vmw_vsock/af_vsock.c:1612:15: sparse:     expected int const *__gu_addr
   net/vmw_vsock/af_vsock.c:1612:15: sparse:     got int [noderef] __user *optlen
>> net/vmw_vsock/af_vsock.c:1612:15: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got int const *__gu_addr @@
   net/vmw_vsock/af_vsock.c:1612:15: sparse:     expected void const volatile [noderef] __user *ptr
   net/vmw_vsock/af_vsock.c:1612:15: sparse:     got int const *__gu_addr
--
   net/x25/af_x25.c:470:13: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int const *__gu_addr @@     got int [noderef] __user *optlen @@
   net/x25/af_x25.c:470:13: sparse:     expected int const *__gu_addr
   net/x25/af_x25.c:470:13: sparse:     got int [noderef] __user *optlen
>> net/x25/af_x25.c:470:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got int const *__gu_addr @@
   net/x25/af_x25.c:470:13: sparse:     expected void const volatile [noderef] __user *ptr
   net/x25/af_x25.c:470:13: sparse:     got int const *__gu_addr

vim +49 arch/sh/kernel/kgdb.c

ab6e570ba33dbee Paul Mundt 2008-12-11   45  
ab6e570ba33dbee Paul Mundt 2008-12-11   46  /* Calculate the new address for after a step */
ab6e570ba33dbee Paul Mundt 2008-12-11   47  static short *get_step_address(struct pt_regs *linux_regs)
ab6e570ba33dbee Paul Mundt 2008-12-11   48  {
2bcfffa42309b6f Paul Mundt 2009-05-09  @49  	insn_size_t op = __raw_readw(linux_regs->pc);
ab6e570ba33dbee Paul Mundt 2008-12-11   50  	long addr;
ab6e570ba33dbee Paul Mundt 2008-12-11   51  
ab6e570ba33dbee Paul Mundt 2008-12-11   52  	/* BT */
ab6e570ba33dbee Paul Mundt 2008-12-11   53  	if (OPCODE_BT(op)) {
ab6e570ba33dbee Paul Mundt 2008-12-11   54  		if (linux_regs->sr & SR_T_BIT_MASK)
ab6e570ba33dbee Paul Mundt 2008-12-11   55  			addr = linux_regs->pc + 4 + OPCODE_BTF_DISP(op);
ab6e570ba33dbee Paul Mundt 2008-12-11   56  		else
ab6e570ba33dbee Paul Mundt 2008-12-11   57  			addr = linux_regs->pc + 2;
ab6e570ba33dbee Paul Mundt 2008-12-11   58  	}
ab6e570ba33dbee Paul Mundt 2008-12-11   59  
ab6e570ba33dbee Paul Mundt 2008-12-11   60  	/* BTS */
ab6e570ba33dbee Paul Mundt 2008-12-11   61  	else if (OPCODE_BTS(op)) {
ab6e570ba33dbee Paul Mundt 2008-12-11   62  		if (linux_regs->sr & SR_T_BIT_MASK)
ab6e570ba33dbee Paul Mundt 2008-12-11   63  			addr = linux_regs->pc + 4 + OPCODE_BTF_DISP(op);
ab6e570ba33dbee Paul Mundt 2008-12-11   64  		else
ab6e570ba33dbee Paul Mundt 2008-12-11   65  			addr = linux_regs->pc + 4;	/* Not in delay slot */
ab6e570ba33dbee Paul Mundt 2008-12-11   66  	}
ab6e570ba33dbee Paul Mundt 2008-12-11   67  
ab6e570ba33dbee Paul Mundt 2008-12-11   68  	/* BF */
ab6e570ba33dbee Paul Mundt 2008-12-11   69  	else if (OPCODE_BF(op)) {
ab6e570ba33dbee Paul Mundt 2008-12-11   70  		if (!(linux_regs->sr & SR_T_BIT_MASK))
ab6e570ba33dbee Paul Mundt 2008-12-11   71  			addr = linux_regs->pc + 4 + OPCODE_BTF_DISP(op);
ab6e570ba33dbee Paul Mundt 2008-12-11   72  		else
ab6e570ba33dbee Paul Mundt 2008-12-11   73  			addr = linux_regs->pc + 2;
ab6e570ba33dbee Paul Mundt 2008-12-11   74  	}
ab6e570ba33dbee Paul Mundt 2008-12-11   75  
ab6e570ba33dbee Paul Mundt 2008-12-11   76  	/* BFS */
ab6e570ba33dbee Paul Mundt 2008-12-11   77  	else if (OPCODE_BFS(op)) {
ab6e570ba33dbee Paul Mundt 2008-12-11   78  		if (!(linux_regs->sr & SR_T_BIT_MASK))
ab6e570ba33dbee Paul Mundt 2008-12-11   79  			addr = linux_regs->pc + 4 + OPCODE_BTF_DISP(op);
ab6e570ba33dbee Paul Mundt 2008-12-11   80  		else
ab6e570ba33dbee Paul Mundt 2008-12-11   81  			addr = linux_regs->pc + 4;	/* Not in delay slot */
ab6e570ba33dbee Paul Mundt 2008-12-11   82  	}
ab6e570ba33dbee Paul Mundt 2008-12-11   83  
ab6e570ba33dbee Paul Mundt 2008-12-11   84  	/* BRA */
ab6e570ba33dbee Paul Mundt 2008-12-11   85  	else if (OPCODE_BRA(op))
ab6e570ba33dbee Paul Mundt 2008-12-11   86  		addr = linux_regs->pc + 4 + OPCODE_BRA_DISP(op);
ab6e570ba33dbee Paul Mundt 2008-12-11   87  
ab6e570ba33dbee Paul Mundt 2008-12-11   88  	/* BRAF */
ab6e570ba33dbee Paul Mundt 2008-12-11   89  	else if (OPCODE_BRAF(op))
ab6e570ba33dbee Paul Mundt 2008-12-11   90  		addr = linux_regs->pc + 4
ab6e570ba33dbee Paul Mundt 2008-12-11   91  		    + linux_regs->regs[OPCODE_BRAF_REG(op)];
ab6e570ba33dbee Paul Mundt 2008-12-11   92  
ab6e570ba33dbee Paul Mundt 2008-12-11   93  	/* BSR */
ab6e570ba33dbee Paul Mundt 2008-12-11   94  	else if (OPCODE_BSR(op))
ab6e570ba33dbee Paul Mundt 2008-12-11   95  		addr = linux_regs->pc + 4 + OPCODE_BSR_DISP(op);
ab6e570ba33dbee Paul Mundt 2008-12-11   96  
ab6e570ba33dbee Paul Mundt 2008-12-11   97  	/* BSRF */
ab6e570ba33dbee Paul Mundt 2008-12-11   98  	else if (OPCODE_BSRF(op))
ab6e570ba33dbee Paul Mundt 2008-12-11   99  		addr = linux_regs->pc + 4
ab6e570ba33dbee Paul Mundt 2008-12-11  100  		    + linux_regs->regs[OPCODE_BSRF_REG(op)];
ab6e570ba33dbee Paul Mundt 2008-12-11  101  
ab6e570ba33dbee Paul Mundt 2008-12-11  102  	/* JMP */
ab6e570ba33dbee Paul Mundt 2008-12-11  103  	else if (OPCODE_JMP(op))
ab6e570ba33dbee Paul Mundt 2008-12-11  104  		addr = linux_regs->regs[OPCODE_JMP_REG(op)];
ab6e570ba33dbee Paul Mundt 2008-12-11  105  
ab6e570ba33dbee Paul Mundt 2008-12-11  106  	/* JSR */
ab6e570ba33dbee Paul Mundt 2008-12-11  107  	else if (OPCODE_JSR(op))
ab6e570ba33dbee Paul Mundt 2008-12-11  108  		addr = linux_regs->regs[OPCODE_JSR_REG(op)];
ab6e570ba33dbee Paul Mundt 2008-12-11  109  
ab6e570ba33dbee Paul Mundt 2008-12-11  110  	/* RTS */
ab6e570ba33dbee Paul Mundt 2008-12-11  111  	else if (OPCODE_RTS(op))
ab6e570ba33dbee Paul Mundt 2008-12-11  112  		addr = linux_regs->pr;
ab6e570ba33dbee Paul Mundt 2008-12-11  113  
ab6e570ba33dbee Paul Mundt 2008-12-11  114  	/* RTE */
ab6e570ba33dbee Paul Mundt 2008-12-11  115  	else if (OPCODE_RTE(op))
ab6e570ba33dbee Paul Mundt 2008-12-11  116  		addr = linux_regs->regs[15];
ab6e570ba33dbee Paul Mundt 2008-12-11  117  
ab6e570ba33dbee Paul Mundt 2008-12-11  118  	/* Other */
ab6e570ba33dbee Paul Mundt 2008-12-11  119  	else
ab6e570ba33dbee Paul Mundt 2008-12-11  120  		addr = linux_regs->pc + instruction_size(op);
ab6e570ba33dbee Paul Mundt 2008-12-11  121  
ab6e570ba33dbee Paul Mundt 2008-12-11  122  	flush_icache_range(addr, addr + instruction_size(op));
ab6e570ba33dbee Paul Mundt 2008-12-11  123  	return (short *)addr;
ab6e570ba33dbee Paul Mundt 2008-12-11  124  }
ab6e570ba33dbee Paul Mundt 2008-12-11  125  
ab6e570ba33dbee Paul Mundt 2008-12-11  126  /*
ab6e570ba33dbee Paul Mundt 2008-12-11  127   * Replace the instruction immediately after the current instruction
ab6e570ba33dbee Paul Mundt 2008-12-11  128   * (i.e. next in the expected flow of control) with a trap instruction,
ab6e570ba33dbee Paul Mundt 2008-12-11  129   * so that returning will cause only a single instruction to be executed.
ab6e570ba33dbee Paul Mundt 2008-12-11  130   * Note that this model is slightly broken for instructions with delay
ab6e570ba33dbee Paul Mundt 2008-12-11  131   * slots (e.g. B[TF]S, BSR, BRA etc), where both the branch and the
ab6e570ba33dbee Paul Mundt 2008-12-11  132   * instruction in the delay slot will be executed.
ab6e570ba33dbee Paul Mundt 2008-12-11  133   */
ab6e570ba33dbee Paul Mundt 2008-12-11  134  
ab6e570ba33dbee Paul Mundt 2008-12-11  135  static unsigned long stepped_address;
2bcfffa42309b6f Paul Mundt 2009-05-09  136  static insn_size_t stepped_opcode;
ab6e570ba33dbee Paul Mundt 2008-12-11  137  
ab6e570ba33dbee Paul Mundt 2008-12-11  138  static void do_single_step(struct pt_regs *linux_regs)
ab6e570ba33dbee Paul Mundt 2008-12-11  139  {
ab6e570ba33dbee Paul Mundt 2008-12-11  140  	/* Determine where the target instruction will send us to */
ab6e570ba33dbee Paul Mundt 2008-12-11  141  	unsigned short *addr = get_step_address(linux_regs);
ab6e570ba33dbee Paul Mundt 2008-12-11  142  
ab6e570ba33dbee Paul Mundt 2008-12-11  143  	stepped_address = (int)addr;
ab6e570ba33dbee Paul Mundt 2008-12-11  144  
ab6e570ba33dbee Paul Mundt 2008-12-11  145  	/* Replace it */
ab6e570ba33dbee Paul Mundt 2008-12-11 @146  	stepped_opcode = __raw_readw((long)addr);
ab6e570ba33dbee Paul Mundt 2008-12-11  147  	*addr = STEP_OPCODE;
ab6e570ba33dbee Paul Mundt 2008-12-11  148  
ab6e570ba33dbee Paul Mundt 2008-12-11  149  	/* Flush and return */
ab6e570ba33dbee Paul Mundt 2008-12-11  150  	flush_icache_range((long)addr, (long)addr +
ab6e570ba33dbee Paul Mundt 2008-12-11  151  			   instruction_size(stepped_opcode));
ab6e570ba33dbee Paul Mundt 2008-12-11  152  }
ab6e570ba33dbee Paul Mundt 2008-12-11  153  
ab6e570ba33dbee Paul Mundt 2008-12-11  154  /* Undo a single step */
ab6e570ba33dbee Paul Mundt 2008-12-11  155  static void undo_single_step(struct pt_regs *linux_regs)
ab6e570ba33dbee Paul Mundt 2008-12-11  156  {
ab6e570ba33dbee Paul Mundt 2008-12-11  157  	/* If we have stepped, put back the old instruction */
ab6e570ba33dbee Paul Mundt 2008-12-11  158  	/* Use stepped_address in case we stopped elsewhere */
ab6e570ba33dbee Paul Mundt 2008-12-11  159  	if (stepped_opcode != 0) {
ab6e570ba33dbee Paul Mundt 2008-12-11 @160  		__raw_writew(stepped_opcode, stepped_address);
ab6e570ba33dbee Paul Mundt 2008-12-11  161  		flush_icache_range(stepped_address, stepped_address + 2);
ab6e570ba33dbee Paul Mundt 2008-12-11  162  	}
ab6e570ba33dbee Paul Mundt 2008-12-11  163  
ab6e570ba33dbee Paul Mundt 2008-12-11  164  	stepped_opcode = 0;
ab6e570ba33dbee Paul Mundt 2008-12-11  165  }
ab6e570ba33dbee Paul Mundt 2008-12-11  166  

:::::: The code at line 49 was first introduced by commit
:::::: 2bcfffa42309b6f73042c62459bf5207762a271d sh: Rename opcode_t to insn_size_t.

:::::: TO: Paul Mundt <lethal@...ux-sh.org>
:::::: CC: Paul Mundt <lethal@...ux-sh.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (21072 bytes)

Powered by blists - more mailing lists