mirror of
				https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
				synced 2025-10-31 12:09:34 +00:00 
			
		
		
		
	 dacbe41f77
			
		
	
	
		dacbe41f77
		
	
	
	
	
		
			
			While in theory user_enable_single_step/user_disable_single_step/
user_enable_blockstep could also be provided as an inline or macro there's
no good reason to do so, and having the prototype in one places keeps code
size and confusion down.
Roland said:
  The original thought there was that user_enable_single_step() et al
  might well be only an instruction or three on a sane machine (as if we
  have any of those!), and since there is only one call site inlining
  would be beneficial.  But I agree that there is no strong reason to care
  about inlining it.
  As to the arch changes, there is only one thought I'd add to the
  record.  It was always my thinking that for an arch where
  PTRACE_SINGLESTEP does text-modifying breakpoint insertion,
  user_enable_single_step() should not be provided.  That is,
  arch_has_single_step()=>true means that there is an arch facility with
  "pure" semantics that does not have any unexpected side effects.
  Inserting a breakpoint might do very unexpected strange things in
  multi-threaded situations.  Aside from that, it is a peculiar side
  effect that user_{enable,disable}_single_step() should cause COW
  de-sharing of text pages and so forth.  For PTRACE_SINGLESTEP, all these
  peculiarities are the status quo ante for that arch, so having
  arch_ptrace() itself do those is one thing.  But for building other
  things in the future, it is nicer to have a uniform "pure" semantics
  that arch-independent code can expect.
  OTOH, all such arch issues are really up to the arch maintainer.  As
  of today, there is nothing but ptrace using user_enable_single_step() et
  al so it's a distinction without a practical difference.  If/when there
  are other facilities that use user_enable_single_step() and might care,
  the affected arch's can revisit the question when someone cares about
  the quality of the arch support for said new facility.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Roland McGrath <roland@redhat.com>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
		
	
			
		
			
				
	
	
		
			109 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			109 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /* MN10300 Exception frame layout and ptrace constants
 | |
|  *
 | |
|  * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
 | |
|  * Written by David Howells (dhowells@redhat.com)
 | |
|  *
 | |
|  * This program is free software; you can redistribute it and/or
 | |
|  * modify it under the terms of the GNU General Public Licence
 | |
|  * as published by the Free Software Foundation; either version
 | |
|  * 2 of the Licence, or (at your option) any later version.
 | |
|  */
 | |
| #ifndef _ASM_PTRACE_H
 | |
| #define _ASM_PTRACE_H
 | |
| 
 | |
| #define PT_A3		0
 | |
| #define PT_A2		1
 | |
| #define PT_D3		2
 | |
| #define	PT_D2		3
 | |
| #define PT_MCVF		4
 | |
| #define	PT_MCRL		5
 | |
| #define PT_MCRH		6
 | |
| #define	PT_MDRQ		7
 | |
| #define	PT_E1		8
 | |
| #define	PT_E0		9
 | |
| #define	PT_E7		10
 | |
| #define	PT_E6		11
 | |
| #define	PT_E5		12
 | |
| #define	PT_E4		13
 | |
| #define	PT_E3		14
 | |
| #define	PT_E2		15
 | |
| #define	PT_SP		16
 | |
| #define	PT_LAR		17
 | |
| #define	PT_LIR		18
 | |
| #define	PT_MDR		19
 | |
| #define	PT_A1		20
 | |
| #define	PT_A0		21
 | |
| #define	PT_D1		22
 | |
| #define	PT_D0		23
 | |
| #define PT_ORIG_D0	24
 | |
| #define	PT_EPSW		25
 | |
| #define	PT_PC		26
 | |
| #define NR_PTREGS	27
 | |
| 
 | |
| #ifndef __ASSEMBLY__
 | |
| /*
 | |
|  * This defines the way registers are stored in the event of an exception
 | |
|  * - the strange order is due to the MOVM instruction
 | |
|  */
 | |
| struct pt_regs {
 | |
| 	unsigned long		a3;		/* syscall arg 3 */
 | |
| 	unsigned long		a2;		/* syscall arg 4 */
 | |
| 	unsigned long		d3;		/* syscall arg 5 */
 | |
| 	unsigned long		d2;		/* syscall arg 6 */
 | |
| 	unsigned long		mcvf;
 | |
| 	unsigned long		mcrl;
 | |
| 	unsigned long		mcrh;
 | |
| 	unsigned long		mdrq;
 | |
| 	unsigned long		e1;
 | |
| 	unsigned long		e0;
 | |
| 	unsigned long		e7;
 | |
| 	unsigned long		e6;
 | |
| 	unsigned long		e5;
 | |
| 	unsigned long		e4;
 | |
| 	unsigned long		e3;
 | |
| 	unsigned long		e2;
 | |
| 	unsigned long		sp;
 | |
| 	unsigned long		lar;
 | |
| 	unsigned long		lir;
 | |
| 	unsigned long		mdr;
 | |
| 	unsigned long		a1;
 | |
| 	unsigned long		a0;		/* syscall arg 1 */
 | |
| 	unsigned long		d1;		/* syscall arg 2 */
 | |
| 	unsigned long		d0;		/* syscall ret */
 | |
| 	struct pt_regs		*next;		/* next frame pointer */
 | |
| 	unsigned long		orig_d0;	/* syscall number */
 | |
| 	unsigned long		epsw;
 | |
| 	unsigned long		pc;
 | |
| };
 | |
| #endif
 | |
| 
 | |
| /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
 | |
| #define PTRACE_GETREGS            12
 | |
| #define PTRACE_SETREGS            13
 | |
| #define PTRACE_GETFPREGS          14
 | |
| #define PTRACE_SETFPREGS          15
 | |
| 
 | |
| /* options set using PTRACE_SETOPTIONS */
 | |
| #define PTRACE_O_TRACESYSGOOD     0x00000001
 | |
| 
 | |
| #if defined(__KERNEL__)
 | |
| 
 | |
| extern struct pt_regs *__frame;		/* current frame pointer */
 | |
| 
 | |
| #if !defined(__ASSEMBLY__)
 | |
| struct task_struct;
 | |
| 
 | |
| #define user_mode(regs)			(((regs)->epsw & EPSW_nSL) == EPSW_nSL)
 | |
| #define instruction_pointer(regs)	((regs)->pc)
 | |
| #define user_stack_pointer(regs)	((regs)->sp)
 | |
| extern void show_regs(struct pt_regs *);
 | |
| 
 | |
| #define arch_has_single_step()	(1)
 | |
| 
 | |
| #endif  /*  !__ASSEMBLY  */
 | |
| 
 | |
| #define profile_pc(regs) ((regs)->pc)
 | |
| 
 | |
| #endif  /*  __KERNEL__  */
 | |
| #endif /* _ASM_PTRACE_H */
 |