1 /* Target-dependent code for GDB, the GNU debugger.
2 Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000
3 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
32 /* The following two instructions are used in the signal trampoline
34 #define INSTR_LI_R0_0x7777 0x38007777
35 #define INSTR_SC 0x44000002
37 /* Since the *-tdep.c files are platform independent (i.e, they may be
38 used to build cross platform debuggers), we can't include system
39 headers. Therefore, details concerning the sigcontext structure
40 must be painstakingly rerecorded. What's worse, if these details
41 ever change in the header files, they'll have to be changed here
44 /* __SIGNAL_FRAMESIZE from <asm/ptrace.h> */
45 #define PPC_LINUX_SIGNAL_FRAMESIZE 64
47 /* From <asm/sigcontext.h>, offsetof(struct sigcontext_struct, regs) == 0x1c */
48 #define PPC_LINUX_REGS_PTR_OFFSET (PPC_LINUX_SIGNAL_FRAMESIZE + 0x1c)
50 /* From <asm/sigcontext.h>,
51 offsetof(struct sigcontext_struct, handler) == 0x14 */
52 #define PPC_LINUX_HANDLER_PTR_OFFSET (PPC_LINUX_SIGNAL_FRAMESIZE + 0x14)
54 /* From <asm/ptrace.h>, values for PT_NIP, PT_R1, and PT_LNK */
55 #define PPC_LINUX_PT_R0 0
56 #define PPC_LINUX_PT_R1 1
57 #define PPC_LINUX_PT_R2 2
58 #define PPC_LINUX_PT_R3 3
59 #define PPC_LINUX_PT_R4 4
60 #define PPC_LINUX_PT_R5 5
61 #define PPC_LINUX_PT_R6 6
62 #define PPC_LINUX_PT_R7 7
63 #define PPC_LINUX_PT_R8 8
64 #define PPC_LINUX_PT_R9 9
65 #define PPC_LINUX_PT_R10 10
66 #define PPC_LINUX_PT_R11 11
67 #define PPC_LINUX_PT_R12 12
68 #define PPC_LINUX_PT_R13 13
69 #define PPC_LINUX_PT_R14 14
70 #define PPC_LINUX_PT_R15 15
71 #define PPC_LINUX_PT_R16 16
72 #define PPC_LINUX_PT_R17 17
73 #define PPC_LINUX_PT_R18 18
74 #define PPC_LINUX_PT_R19 19
75 #define PPC_LINUX_PT_R20 20
76 #define PPC_LINUX_PT_R21 21
77 #define PPC_LINUX_PT_R22 22
78 #define PPC_LINUX_PT_R23 23
79 #define PPC_LINUX_PT_R24 24
80 #define PPC_LINUX_PT_R25 25
81 #define PPC_LINUX_PT_R26 26
82 #define PPC_LINUX_PT_R27 27
83 #define PPC_LINUX_PT_R28 28
84 #define PPC_LINUX_PT_R29 29
85 #define PPC_LINUX_PT_R30 30
86 #define PPC_LINUX_PT_R31 31
87 #define PPC_LINUX_PT_NIP 32
88 #define PPC_LINUX_PT_MSR 33
89 #define PPC_LINUX_PT_CTR 35
90 #define PPC_LINUX_PT_LNK 36
91 #define PPC_LINUX_PT_XER 37
92 #define PPC_LINUX_PT_CCR 38
93 #define PPC_LINUX_PT_MQ 39
94 #define PPC_LINUX_PT_FPR0 48 /* each FP reg occupies 2 slots in this space */
95 #define PPC_LINUX_PT_FPR31 (PPC_LINUX_PT_FPR0 + 2*31)
96 #define PPC_LINUX_PT_FPSCR (PPC_LINUX_PT_FPR0 + 2*32 + 1)
98 int ppc_linux_at_sigtramp_return_path (CORE_ADDR pc
);
100 /* Determine if pc is in a signal trampoline...
102 Ha! That's not what this does at all. wait_for_inferior in infrun.c
103 calls IN_SIGTRAMP in order to detect entry into a signal trampoline
104 just after delivery of a signal. But on linux, signal trampolines
105 are used for the return path only. The kernel sets things up so that
106 the signal handler is called directly.
108 If we use in_sigtramp2() in place of in_sigtramp() (see below)
109 we'll (often) end up with stop_pc in the trampoline and prev_pc in
110 the (now exited) handler. The code there will cause a temporary
111 breakpoint to be set on prev_pc which is not very likely to get hit
114 If this is confusing, think of it this way... the code in
115 wait_for_inferior() needs to be able to detect entry into a signal
116 trampoline just after a signal is delivered, not after the handler
119 So, we define in_sigtramp() below to return 1 if the following is
122 1) The previous frame is a real signal trampoline.
126 2) pc is at the first or second instruction of the corresponding
129 Why the second instruction? It seems that wait_for_inferior()
130 never sees the first instruction when single stepping. When a
131 signal is delivered while stepping, the next instruction that
132 would've been stepped over isn't, instead a signal is delivered and
133 the first instruction of the handler is stepped over instead. That
134 puts us on the second instruction. (I added the test for the
135 first instruction long after the fact, just in case the observed
136 behavior is ever fixed.)
138 IN_SIGTRAMP is called from blockframe.c as well in order to set
139 the signal_handler_caller flag. Because of our strange definition
140 of in_sigtramp below, we can't rely on signal_handler_caller getting
141 set correctly from within blockframe.c. This is why we take pains
142 to set it in init_extra_frame_info(). */
145 ppc_linux_in_sigtramp (CORE_ADDR pc
, char *func_name
)
153 lr
= read_register (LR_REGNUM
);
154 if (!ppc_linux_at_sigtramp_return_path (lr
))
157 sp
= read_register (SP_REGNUM
);
159 if (target_read_memory (sp
, buf
, sizeof (buf
)) != 0)
162 tramp_sp
= extract_unsigned_integer (buf
, 4);
164 if (target_read_memory (tramp_sp
+ PPC_LINUX_HANDLER_PTR_OFFSET
, buf
,
168 handler
= extract_unsigned_integer (buf
, 4);
170 return (pc
== handler
|| pc
== handler
+ 4);
174 * The signal handler trampoline is on the stack and consists of exactly
175 * two instructions. The easiest and most accurate way of determining
176 * whether the pc is in one of these trampolines is by inspecting the
177 * instructions. It'd be faster though if we could find a way to do this
178 * via some simple address comparisons.
181 ppc_linux_at_sigtramp_return_path (CORE_ADDR pc
)
184 unsigned long pcinsn
;
185 if (target_read_memory (pc
- 4, buf
, sizeof (buf
)) != 0)
188 /* extract the instruction at the pc */
189 pcinsn
= extract_unsigned_integer (buf
+ 4, 4);
192 (pcinsn
== INSTR_LI_R0_0x7777
193 && extract_unsigned_integer (buf
+ 8, 4) == INSTR_SC
)
196 && extract_unsigned_integer (buf
, 4) == INSTR_LI_R0_0x7777
));
200 ppc_linux_skip_trampoline_code (CORE_ADDR pc
)
203 struct obj_section
*sect
;
204 struct objfile
*objfile
;
206 CORE_ADDR plt_start
= 0;
207 CORE_ADDR symtab
= 0;
208 CORE_ADDR strtab
= 0;
210 int reloc_index
= -1;
216 struct minimal_symbol
*msymbol
;
218 /* Find the section pc is in; return if not in .plt */
219 sect
= find_pc_section (pc
);
220 if (!sect
|| strcmp (sect
->the_bfd_section
->name
, ".plt") != 0)
223 objfile
= sect
->objfile
;
225 /* Pick up the instruction at pc. It had better be of the
229 where IDX is an index into the plt_table. */
231 if (target_read_memory (pc
, buf
, 4) != 0)
233 insn
= extract_unsigned_integer (buf
, 4);
235 if ((insn
& 0xffff0000) != 0x39600000 /* li r11, VAL */ )
238 reloc_index
= (insn
<< 16) >> 16;
240 /* Find the objfile that pc is in and obtain the information
241 necessary for finding the symbol name. */
242 for (sect
= objfile
->sections
; sect
< objfile
->sections_end
; ++sect
)
244 const char *secname
= sect
->the_bfd_section
->name
;
245 if (strcmp (secname
, ".plt") == 0)
246 plt_start
= sect
->addr
;
247 else if (strcmp (secname
, ".rela.plt") == 0)
248 num_slots
= ((int) sect
->endaddr
- (int) sect
->addr
) / 12;
249 else if (strcmp (secname
, ".dynsym") == 0)
251 else if (strcmp (secname
, ".dynstr") == 0)
255 /* Make sure we have all the information we need. */
256 if (plt_start
== 0 || num_slots
== -1 || symtab
== 0 || strtab
== 0)
259 /* Compute the value of the plt table */
260 plt_table
= plt_start
+ 72 + 8 * num_slots
;
262 /* Get address of the relocation entry (Elf32_Rela) */
263 if (target_read_memory (plt_table
+ reloc_index
, buf
, 4) != 0)
265 reloc
= extract_address (buf
, 4);
267 sect
= find_pc_section (reloc
);
271 if (strcmp (sect
->the_bfd_section
->name
, ".text") == 0)
274 /* Now get the r_info field which is the relocation type and symbol
276 if (target_read_memory (reloc
+ 4, buf
, 4) != 0)
278 symidx
= extract_unsigned_integer (buf
, 4);
280 /* Shift out the relocation type leaving just the symbol index */
281 /* symidx = ELF32_R_SYM(symidx); */
282 symidx
= symidx
>> 8;
284 /* compute the address of the symbol */
285 sym
= symtab
+ symidx
* 4;
287 /* Fetch the string table index */
288 if (target_read_memory (sym
, buf
, 4) != 0)
290 symidx
= extract_unsigned_integer (buf
, 4);
292 /* Fetch the string; we don't know how long it is. Is it possible
293 that the following will fail because we're trying to fetch too
295 if (target_read_memory (strtab
+ symidx
, symname
, sizeof (symname
)) != 0)
298 /* This might not work right if we have multiple symbols with the
299 same name; the only way to really get it right is to perform
300 the same sort of lookup as the dynamic linker. */
301 msymbol
= lookup_minimal_symbol_text (symname
, NULL
, NULL
);
305 return SYMBOL_VALUE_ADDRESS (msymbol
);
308 /* The rs6000 version of FRAME_SAVED_PC will almost work for us. The
309 signal handler details are different, so we'll handle those here
310 and call the rs6000 version to do the rest. */
312 ppc_linux_frame_saved_pc (struct frame_info
*fi
)
314 if (fi
->signal_handler_caller
)
316 CORE_ADDR regs_addr
=
317 read_memory_integer (fi
->frame
+ PPC_LINUX_REGS_PTR_OFFSET
, 4);
318 /* return the NIP in the regs array */
319 return read_memory_integer (regs_addr
+ 4 * PPC_LINUX_PT_NIP
, 4);
321 else if (fi
->next
&& fi
->next
->signal_handler_caller
)
323 CORE_ADDR regs_addr
=
324 read_memory_integer (fi
->next
->frame
+ PPC_LINUX_REGS_PTR_OFFSET
, 4);
325 /* return LNK in the regs array */
326 return read_memory_integer (regs_addr
+ 4 * PPC_LINUX_PT_LNK
, 4);
329 return rs6000_frame_saved_pc (fi
);
333 ppc_linux_init_extra_frame_info (int fromleaf
, struct frame_info
*fi
)
335 rs6000_init_extra_frame_info (fromleaf
, fi
);
339 /* We're called from get_prev_frame_info; check to see if
340 this is a signal frame by looking to see if the pc points
341 at trampoline code */
342 if (ppc_linux_at_sigtramp_return_path (fi
->pc
))
343 fi
->signal_handler_caller
= 1;
345 fi
->signal_handler_caller
= 0;
350 ppc_linux_frameless_function_invocation (struct frame_info
*fi
)
352 /* We'll find the wrong thing if we let
353 rs6000_frameless_function_invocation () search for a signal trampoline */
354 if (ppc_linux_at_sigtramp_return_path (fi
->pc
))
357 return rs6000_frameless_function_invocation (fi
);
361 ppc_linux_frame_init_saved_regs (struct frame_info
*fi
)
363 if (fi
->signal_handler_caller
)
370 frame_saved_regs_zalloc (fi
);
373 read_memory_integer (fi
->frame
+ PPC_LINUX_REGS_PTR_OFFSET
, 4);
374 fi
->saved_regs
[PC_REGNUM
] = regs_addr
+ 4 * PPC_LINUX_PT_NIP
;
375 fi
->saved_regs
[PS_REGNUM
] = regs_addr
+ 4 * PPC_LINUX_PT_MSR
;
376 fi
->saved_regs
[CR_REGNUM
] = regs_addr
+ 4 * PPC_LINUX_PT_CCR
;
377 fi
->saved_regs
[LR_REGNUM
] = regs_addr
+ 4 * PPC_LINUX_PT_LNK
;
378 fi
->saved_regs
[CTR_REGNUM
] = regs_addr
+ 4 * PPC_LINUX_PT_CTR
;
379 fi
->saved_regs
[XER_REGNUM
] = regs_addr
+ 4 * PPC_LINUX_PT_XER
;
380 fi
->saved_regs
[MQ_REGNUM
] = regs_addr
+ 4 * PPC_LINUX_PT_MQ
;
381 for (i
= 0; i
< 32; i
++)
382 fi
->saved_regs
[GP0_REGNUM
+ i
] = regs_addr
+ 4 * PPC_LINUX_PT_R0
+ 4 * i
;
383 for (i
= 0; i
< 32; i
++)
384 fi
->saved_regs
[FP0_REGNUM
+ i
] = regs_addr
+ 4 * PPC_LINUX_PT_FPR0
+ 8 * i
;
387 rs6000_frame_init_saved_regs (fi
);
391 ppc_linux_frame_chain (struct frame_info
*thisframe
)
393 /* Kernel properly constructs the frame chain for the handler */
394 if (thisframe
->signal_handler_caller
)
395 return read_memory_integer ((thisframe
)->frame
, 4);
397 return rs6000_frame_chain (thisframe
);
400 /* FIXME: Move the following to rs6000-tdep.c (or some other file where
401 it may be used generically by ports which use either the SysV ABI or
404 /* round2 rounds x up to the nearest multiple of s assuming that s is a
408 #define round2(x,s) ((((long) (x) - 1) & ~(long)((s)-1)) + (s))
410 /* Pass the arguments in either registers, or in the stack. Using the
411 ppc sysv ABI, the first eight words of the argument list (that might
412 be less than eight parameters if some parameters occupy more than one
413 word) are passed in r3..r10 registers. float and double parameters are
414 passed in fpr's, in addition to that. Rest of the parameters if any
415 are passed in user stack.
417 If the function is returning a structure, then the return address is passed
418 in r3, then the first 7 words of the parametes can be passed in registers,
422 ppc_sysv_abi_push_arguments (nargs
, args
, sp
, struct_return
, struct_addr
)
427 CORE_ADDR struct_addr
;
441 greg
= struct_return
? 4 : 3;
446 /* Figure out how much new stack space is required for arguments
447 which don't fit in registers. Unlike the PowerOpen ABI, the
448 SysV ABI doesn't reserve any extra space for parameters which
449 are put in registers. */
450 for (argno
= 0; argno
< nargs
; argno
++)
453 type
= check_typedef (VALUE_TYPE (arg
));
454 len
= TYPE_LENGTH (type
);
456 if (TYPE_CODE (type
) == TYPE_CODE_FLT
)
462 /* SysV ABI converts floats to doubles when placed in
463 memory and requires 8 byte alignment */
464 if (argstkspace
& 0x4)
469 else if (TYPE_CODE (type
) == TYPE_CODE_INT
&& len
== 8) /* long long */
474 if (argstkspace
& 0x4)
488 || TYPE_CODE (type
) == TYPE_CODE_STRUCT
489 || TYPE_CODE (type
) == TYPE_CODE_UNION
)
491 /* Rounding to the nearest multiple of 8 may not be necessary,
492 but it is safe. Particularly since we don't know the
493 field types of the structure */
494 structstkspace
+= round2 (len
, 8);
503 /* Get current SP location */
504 saved_sp
= read_sp ();
506 sp
-= argstkspace
+ structstkspace
;
508 /* Allocate space for backchain and callee's saved lr */
511 /* Make sure that we maintain 16 byte alignment */
514 /* Update %sp before proceeding any further */
515 write_register (SP_REGNUM
, sp
);
517 /* write the backchain */
518 store_address (old_sp_buf
, 4, saved_sp
);
519 write_memory (sp
, old_sp_buf
, 4);
522 structoffset
= argoffset
+ argstkspace
;
525 /* Fill in r3 with the return structure, if any */
529 store_address (val_buf
, 4, struct_addr
);
530 memcpy (®isters
[REGISTER_BYTE (greg
)], val_buf
, 4);
533 /* Now fill in the registers and stack... */
534 for (argno
= 0; argno
< nargs
; argno
++)
537 type
= check_typedef (VALUE_TYPE (arg
));
538 len
= TYPE_LENGTH (type
);
540 if (TYPE_CODE (type
) == TYPE_CODE_FLT
)
546 "Fatal Error: a floating point parameter #%d with a size > 8 is found!\n", argno
);
547 memcpy (®isters
[REGISTER_BYTE (FP0_REGNUM
+ freg
)],
548 VALUE_CONTENTS (arg
), len
);
553 /* SysV ABI converts floats to doubles when placed in
554 memory and requires 8 byte alignment */
555 /* FIXME: Convert floats to doubles */
558 write_memory (sp
+ argoffset
, (char *) VALUE_CONTENTS (arg
), len
);
562 else if (TYPE_CODE (type
) == TYPE_CODE_INT
&& len
== 8) /* long long */
569 write_memory (sp
+ argoffset
, (char *) VALUE_CONTENTS (arg
), len
);
577 memcpy (®isters
[REGISTER_BYTE (greg
)],
578 VALUE_CONTENTS (arg
), 4);
579 memcpy (®isters
[REGISTER_BYTE (greg
+ 1)],
580 VALUE_CONTENTS (arg
) + 4, 4);
588 || TYPE_CODE (type
) == TYPE_CODE_STRUCT
589 || TYPE_CODE (type
) == TYPE_CODE_UNION
)
591 write_memory (sp
+ structoffset
, VALUE_CONTENTS (arg
), len
);
592 store_address (val_buf
, 4, sp
+ structoffset
);
593 structoffset
+= round2 (len
, 8);
597 memset (val_buf
, 0, 4);
598 memcpy (val_buf
, VALUE_CONTENTS (arg
), len
);
602 *(int *) ®isters
[REGISTER_BYTE (greg
)] = 0;
603 memcpy (®isters
[REGISTER_BYTE (greg
)], val_buf
, 4);
608 write_memory (sp
+ argoffset
, val_buf
, 4);
614 target_store_registers (-1);
618 /* ppc_linux_memory_remove_breakpoints attempts to remove a breakpoint
619 in much the same fashion as memory_remove_breakpoint in mem-break.c,
620 but is careful not to write back the previous contents if the code
621 in question has changed in between inserting the breakpoint and
624 Here is the problem that we're trying to solve...
626 Once upon a time, before introducing this function to remove
627 breakpoints from the inferior, setting a breakpoint on a shared
628 library function prior to running the program would not work
629 properly. In order to understand the problem, it is first
630 necessary to understand a little bit about dynamic linking on
633 A call to a shared library function is accomplished via a bl
634 (branch-and-link) instruction whose branch target is an entry
635 in the procedure linkage table (PLT). The PLT in the object
636 file is uninitialized. To gdb, prior to running the program, the
637 entries in the PLT are all zeros.
639 Once the program starts running, the shared libraries are loaded
640 and the procedure linkage table is initialized, but the entries in
641 the table are not (necessarily) resolved. Once a function is
642 actually called, the code in the PLT is hit and the function is
643 resolved. In order to better illustrate this, an example is in
644 order; the following example is from the gdb testsuite.
646 We start the program shmain.
648 [kev@arroyo testsuite]$ ../gdb gdb.base/shmain
651 We place two breakpoints, one on shr1 and the other on main.
654 Breakpoint 1 at 0x100409d4
656 Breakpoint 2 at 0x100006a0: file gdb.base/shmain.c, line 44.
658 Examine the instruction (and the immediatly following instruction)
659 upon which the breakpoint was placed. Note that the PLT entry
660 for shr1 contains zeros.
662 (gdb) x/2i 0x100409d4
663 0x100409d4 <shr1>: .long 0x0
664 0x100409d8 <shr1+4>: .long 0x0
669 Starting program: gdb.base/shmain
670 Breakpoint 1 at 0xffaf790: file gdb.base/shr1.c, line 19.
672 Breakpoint 2, main ()
673 at gdb.base/shmain.c:44
676 Examine the PLT again. Note that the loading of the shared
677 library has initialized the PLT to code which loads a constant
678 (which I think is an index into the GOT) into r11 and then
679 branchs a short distance to the code which actually does the
682 (gdb) x/2i 0x100409d4
683 0x100409d4 <shr1>: li r11,4
684 0x100409d8 <shr1+4>: b 0x10040984 <sg+4>
688 Breakpoint 1, shr1 (x=1)
689 at gdb.base/shr1.c:19
692 Now we've hit the breakpoint at shr1. (The breakpoint was
693 reset from the PLT entry to the actual shr1 function after the
694 shared library was loaded.) Note that the PLT entry has been
695 resolved to contain a branch that takes us directly to shr1.
696 (The real one, not the PLT entry.)
698 (gdb) x/2i 0x100409d4
699 0x100409d4 <shr1>: b 0xffaf76c <shr1>
700 0x100409d8 <shr1+4>: b 0x10040984 <sg+4>
702 The thing to note here is that the PLT entry for shr1 has been
705 Now the problem should be obvious. GDB places a breakpoint (a
706 trap instruction) on the zero value of the PLT entry for shr1.
707 Later on, after the shared library had been loaded and the PLT
708 initialized, GDB gets a signal indicating this fact and attempts
709 (as it always does when it stops) to remove all the breakpoints.
711 The breakpoint removal was causing the former contents (a zero
712 word) to be written back to the now initialized PLT entry thus
713 destroying a portion of the initialization that had occurred only a
714 short time ago. When execution continued, the zero word would be
715 executed as an instruction an an illegal instruction trap was
716 generated instead. (0 is not a legal instruction.)
718 The fix for this problem was fairly straightforward. The function
719 memory_remove_breakpoint from mem-break.c was copied to this file,
720 modified slightly, and renamed to ppc_linux_memory_remove_breakpoint.
721 In tm-linux.h, MEMORY_REMOVE_BREAKPOINT is defined to call this new
724 The differences between ppc_linux_memory_remove_breakpoint () and
725 memory_remove_breakpoint () are minor. All that the former does
726 that the latter does not is check to make sure that the breakpoint
727 location actually contains a breakpoint (trap instruction) prior
728 to attempting to write back the old contents. If it does contain
729 a trap instruction, we allow the old contents to be written back.
730 Otherwise, we silently do nothing.
732 The big question is whether memory_remove_breakpoint () should be
733 changed to have the same functionality. The downside is that more
734 traffic is generated for remote targets since we'll have an extra
735 fetch of a memory word each time a breakpoint is removed.
737 For the time being, we'll leave this self-modifying-code-friendly
738 version in ppc-linux-tdep.c, but it ought to be migrated somewhere
739 else in the event that some other platform has similar needs with
740 regard to removing breakpoints in some potentially self modifying
743 ppc_linux_memory_remove_breakpoint (CORE_ADDR addr
, char *contents_cache
)
748 char old_contents
[BREAKPOINT_MAX
];
750 /* Determine appropriate breakpoint contents and size for this address. */
751 bp
= BREAKPOINT_FROM_PC (&addr
, &bplen
);
753 error ("Software breakpoints not implemented for this target.");
755 val
= target_read_memory (addr
, old_contents
, bplen
);
757 /* If our breakpoint is no longer at the address, this means that the
758 program modified the code on us, so it is wrong to put back the
760 if (val
== 0 && memcmp (bp
, old_contents
, bplen
) == 0)
761 val
= target_write_memory (addr
, contents_cache
, bplen
);