2013-09-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
[binutils-gdb.git] / gdb / s390-nat.c
1 /* S390 native-dependent code for GDB, the GNU debugger.
2 Copyright (C) 2001-2013 Free Software Foundation, Inc.
3
4 Contributed by D.J. Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
5 for IBM Deutschland Entwicklung GmbH, IBM Corporation.
6
7 This file is part of GDB.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21
22 #include "defs.h"
23 #include "regcache.h"
24 #include "inferior.h"
25 #include "target.h"
26 #include "linux-nat.h"
27 #include "auxv.h"
28 #include "gregset.h"
29
30 #include "s390-tdep.h"
31 #include "elf/common.h"
32
33 #include <asm/ptrace.h>
34 #include <sys/ptrace.h>
35 #include <asm/types.h>
36 #include <sys/procfs.h>
37 #include <sys/ucontext.h>
38 #include <elf.h>
39
40 #ifndef HWCAP_S390_HIGH_GPRS
41 #define HWCAP_S390_HIGH_GPRS 512
42 #endif
43
44 #ifndef PTRACE_GETREGSET
45 #define PTRACE_GETREGSET 0x4204
46 #endif
47
48 #ifndef PTRACE_SETREGSET
49 #define PTRACE_SETREGSET 0x4205
50 #endif
51
52 static int have_regset_last_break = 0;
53 static int have_regset_system_call = 0;
54
55 /* Map registers to gregset/ptrace offsets.
56 These arrays are defined in s390-tdep.c. */
57
58 #ifdef __s390x__
59 #define regmap_gregset s390x_regmap_gregset
60 #else
61 #define regmap_gregset s390_regmap_gregset
62 #endif
63
64 #define regmap_fpregset s390_regmap_fpregset
65
66 /* Fill the regset described by MAP into REGCACHE, using the values
67 from REGP. The MAP array represents each register as a pair
68 (offset, regno) of short integers and is terminated with -1. */
69
70 static void
71 s390_native_supply (struct regcache *regcache, const short *map,
72 const gdb_byte *regp)
73 {
74 for (; map[0] >= 0; map += 2)
75 regcache_raw_supply (regcache, map[1], regp + map[0]);
76 }
77
78 /* Collect the register REGNO out of the regset described by MAP from
79 REGCACHE into REGP. If REGNO == -1, do this for all registers in
80 this regset. */
81
82 static void
83 s390_native_collect (const struct regcache *regcache, const short *map,
84 int regno, gdb_byte *regp)
85 {
86 for (; map[0] >= 0; map += 2)
87 if (regno == -1 || regno == map[1])
88 regcache_raw_collect (regcache, map[1], regp + map[0]);
89 }
90
91 /* Fill GDB's register array with the general-purpose register values
92 in *REGP.
93
94 When debugging a 32-bit executable running under a 64-bit kernel,
95 we have to fix up the 64-bit registers we get from the kernel to
96 make them look like 32-bit registers. */
97
98 void
99 supply_gregset (struct regcache *regcache, const gregset_t *regp)
100 {
101 #ifdef __s390x__
102 struct gdbarch *gdbarch = get_regcache_arch (regcache);
103 if (gdbarch_ptr_bit (gdbarch) == 32)
104 {
105 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
106 ULONGEST pswm = 0, pswa = 0;
107 gdb_byte buf[4];
108 const short *map;
109
110 for (map = regmap_gregset; map[0] >= 0; map += 2)
111 {
112 const gdb_byte *p = (const gdb_byte *) regp + map[0];
113 int regno = map[1];
114
115 if (regno == S390_PSWM_REGNUM)
116 pswm = extract_unsigned_integer (p, 8, byte_order);
117 else if (regno == S390_PSWA_REGNUM)
118 pswa = extract_unsigned_integer (p, 8, byte_order);
119 else
120 {
121 if ((regno >= S390_R0_REGNUM && regno <= S390_R15_REGNUM)
122 || regno == S390_ORIG_R2_REGNUM)
123 p += 4;
124 regcache_raw_supply (regcache, regno, p);
125 }
126 }
127
128 store_unsigned_integer (buf, 4, byte_order, (pswm >> 32) | 0x80000);
129 regcache_raw_supply (regcache, S390_PSWM_REGNUM, buf);
130 store_unsigned_integer (buf, 4, byte_order,
131 (pswa & 0x7fffffff) | (pswm & 0x80000000));
132 regcache_raw_supply (regcache, S390_PSWA_REGNUM, buf);
133 return;
134 }
135 #endif
136
137 s390_native_supply (regcache, regmap_gregset, (const gdb_byte *) regp);
138 }
139
140 /* Fill register REGNO (if it is a general-purpose register) in
141 *REGP with the value in GDB's register array. If REGNO is -1,
142 do this for all registers. */
143
144 void
145 fill_gregset (const struct regcache *regcache, gregset_t *regp, int regno)
146 {
147 #ifdef __s390x__
148 struct gdbarch *gdbarch = get_regcache_arch (regcache);
149 if (gdbarch_ptr_bit (gdbarch) == 32)
150 {
151 gdb_byte *psw_p[2];
152 const short *map;
153
154 for (map = regmap_gregset; map[0] >= 0; map += 2)
155 {
156 gdb_byte *p = (gdb_byte *) regp + map[0];
157 int reg = map[1];
158
159 if (reg >= S390_PSWM_REGNUM && reg <= S390_PSWA_REGNUM)
160 psw_p[reg - S390_PSWM_REGNUM] = p;
161
162 else if (regno == -1 || regno == reg)
163 {
164 if ((reg >= S390_R0_REGNUM && reg <= S390_R15_REGNUM)
165 || reg == S390_ORIG_R2_REGNUM)
166 {
167 memset (p, 0, 4);
168 p += 4;
169 }
170 regcache_raw_collect (regcache, reg, p + 4);
171 }
172 }
173
174 if (regno == -1
175 || regno == S390_PSWM_REGNUM || regno == S390_PSWA_REGNUM)
176 {
177 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
178 ULONGEST pswa, pswm;
179 gdb_byte buf[4];
180
181 regcache_raw_collect (regcache, S390_PSWM_REGNUM, buf);
182 pswm = extract_unsigned_integer (buf, 4, byte_order);
183 regcache_raw_collect (regcache, S390_PSWA_REGNUM, buf);
184 pswa = extract_unsigned_integer (buf, 4, byte_order);
185
186 if (regno == -1 || regno == S390_PSWM_REGNUM)
187 store_unsigned_integer (psw_p[0], 8, byte_order,
188 ((pswm & 0xfff7ffff) << 32) |
189 (pswa & 0x80000000));
190 if (regno == -1 || regno == S390_PSWA_REGNUM)
191 store_unsigned_integer (psw_p[1], 8, byte_order,
192 pswa & 0x7fffffff);
193 }
194 return;
195 }
196 #endif
197
198 s390_native_collect (regcache, regmap_gregset, regno, (gdb_byte *) regp);
199 }
200
201 /* Fill GDB's register array with the floating-point register values
202 in *REGP. */
203 void
204 supply_fpregset (struct regcache *regcache, const fpregset_t *regp)
205 {
206 s390_native_supply (regcache, regmap_fpregset, (const gdb_byte *) regp);
207 }
208
209 /* Fill register REGNO (if it is a general-purpose register) in
210 *REGP with the value in GDB's register array. If REGNO is -1,
211 do this for all registers. */
212 void
213 fill_fpregset (const struct regcache *regcache, fpregset_t *regp, int regno)
214 {
215 s390_native_collect (regcache, regmap_fpregset, regno, (gdb_byte *) regp);
216 }
217
218 /* Find the TID for the current inferior thread to use with ptrace. */
219 static int
220 s390_inferior_tid (void)
221 {
222 /* GNU/Linux LWP ID's are process ID's. */
223 int tid = TIDGET (inferior_ptid);
224 if (tid == 0)
225 tid = PIDGET (inferior_ptid); /* Not a threaded program. */
226
227 return tid;
228 }
229
230 /* Fetch all general-purpose registers from process/thread TID and
231 store their values in GDB's register cache. */
232 static void
233 fetch_regs (struct regcache *regcache, int tid)
234 {
235 gregset_t regs;
236 ptrace_area parea;
237
238 parea.len = sizeof (regs);
239 parea.process_addr = (addr_t) &regs;
240 parea.kernel_addr = offsetof (struct user_regs_struct, psw);
241 if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea) < 0)
242 perror_with_name (_("Couldn't get registers"));
243
244 supply_gregset (regcache, (const gregset_t *) &regs);
245 }
246
247 /* Store all valid general-purpose registers in GDB's register cache
248 into the process/thread specified by TID. */
249 static void
250 store_regs (const struct regcache *regcache, int tid, int regnum)
251 {
252 gregset_t regs;
253 ptrace_area parea;
254
255 parea.len = sizeof (regs);
256 parea.process_addr = (addr_t) &regs;
257 parea.kernel_addr = offsetof (struct user_regs_struct, psw);
258 if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea) < 0)
259 perror_with_name (_("Couldn't get registers"));
260
261 fill_gregset (regcache, &regs, regnum);
262
263 if (ptrace (PTRACE_POKEUSR_AREA, tid, (long) &parea) < 0)
264 perror_with_name (_("Couldn't write registers"));
265 }
266
267 /* Fetch all floating-point registers from process/thread TID and store
268 their values in GDB's register cache. */
269 static void
270 fetch_fpregs (struct regcache *regcache, int tid)
271 {
272 fpregset_t fpregs;
273 ptrace_area parea;
274
275 parea.len = sizeof (fpregs);
276 parea.process_addr = (addr_t) &fpregs;
277 parea.kernel_addr = offsetof (struct user_regs_struct, fp_regs);
278 if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea) < 0)
279 perror_with_name (_("Couldn't get floating point status"));
280
281 supply_fpregset (regcache, (const fpregset_t *) &fpregs);
282 }
283
284 /* Store all valid floating-point registers in GDB's register cache
285 into the process/thread specified by TID. */
286 static void
287 store_fpregs (const struct regcache *regcache, int tid, int regnum)
288 {
289 fpregset_t fpregs;
290 ptrace_area parea;
291
292 parea.len = sizeof (fpregs);
293 parea.process_addr = (addr_t) &fpregs;
294 parea.kernel_addr = offsetof (struct user_regs_struct, fp_regs);
295 if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea) < 0)
296 perror_with_name (_("Couldn't get floating point status"));
297
298 fill_fpregset (regcache, &fpregs, regnum);
299
300 if (ptrace (PTRACE_POKEUSR_AREA, tid, (long) &parea) < 0)
301 perror_with_name (_("Couldn't write floating point status"));
302 }
303
304 /* Fetch all registers in the kernel's register set whose number is REGSET,
305 whose size is REGSIZE, and whose layout is described by REGMAP, from
306 process/thread TID and store their values in GDB's register cache. */
307 static void
308 fetch_regset (struct regcache *regcache, int tid,
309 int regset, int regsize, const short *regmap)
310 {
311 gdb_byte *buf = alloca (regsize);
312 struct iovec iov;
313
314 iov.iov_base = buf;
315 iov.iov_len = regsize;
316
317 if (ptrace (PTRACE_GETREGSET, tid, (long) regset, (long) &iov) < 0)
318 perror_with_name (_("Couldn't get register set"));
319
320 s390_native_supply (regcache, regmap, buf);
321 }
322
323 /* Store all registers in the kernel's register set whose number is REGSET,
324 whose size is REGSIZE, and whose layout is described by REGMAP, from
325 GDB's register cache back to process/thread TID. */
326 static void
327 store_regset (struct regcache *regcache, int tid,
328 int regset, int regsize, const short *regmap)
329 {
330 gdb_byte *buf = alloca (regsize);
331 struct iovec iov;
332
333 iov.iov_base = buf;
334 iov.iov_len = regsize;
335
336 if (ptrace (PTRACE_GETREGSET, tid, (long) regset, (long) &iov) < 0)
337 perror_with_name (_("Couldn't get register set"));
338
339 s390_native_collect (regcache, regmap, -1, buf);
340
341 if (ptrace (PTRACE_SETREGSET, tid, (long) regset, (long) &iov) < 0)
342 perror_with_name (_("Couldn't set register set"));
343 }
344
345 /* Check whether the kernel provides a register set with number REGSET
346 of size REGSIZE for process/thread TID. */
347 static int
348 check_regset (int tid, int regset, int regsize)
349 {
350 gdb_byte *buf = alloca (regsize);
351 struct iovec iov;
352
353 iov.iov_base = buf;
354 iov.iov_len = regsize;
355
356 if (ptrace (PTRACE_GETREGSET, tid, (long) regset, (long) &iov) < 0)
357 return 0;
358 else
359 return 1;
360 }
361
362 /* Fetch register REGNUM from the child process. If REGNUM is -1, do
363 this for all registers. */
364 static void
365 s390_linux_fetch_inferior_registers (struct target_ops *ops,
366 struct regcache *regcache, int regnum)
367 {
368 int tid = s390_inferior_tid ();
369
370 if (regnum == -1 || S390_IS_GREGSET_REGNUM (regnum))
371 fetch_regs (regcache, tid);
372
373 if (regnum == -1 || S390_IS_FPREGSET_REGNUM (regnum))
374 fetch_fpregs (regcache, tid);
375
376 if (have_regset_last_break)
377 if (regnum == -1 || regnum == S390_LAST_BREAK_REGNUM)
378 fetch_regset (regcache, tid, NT_S390_LAST_BREAK, 8,
379 (gdbarch_ptr_bit (get_regcache_arch (regcache)) == 32
380 ? s390_regmap_last_break : s390x_regmap_last_break));
381
382 if (have_regset_system_call)
383 if (regnum == -1 || regnum == S390_SYSTEM_CALL_REGNUM)
384 fetch_regset (regcache, tid, NT_S390_SYSTEM_CALL, 4,
385 s390_regmap_system_call);
386 }
387
388 /* Store register REGNUM back into the child process. If REGNUM is
389 -1, do this for all registers. */
390 static void
391 s390_linux_store_inferior_registers (struct target_ops *ops,
392 struct regcache *regcache, int regnum)
393 {
394 int tid = s390_inferior_tid ();
395
396 if (regnum == -1 || S390_IS_GREGSET_REGNUM (regnum))
397 store_regs (regcache, tid, regnum);
398
399 if (regnum == -1 || S390_IS_FPREGSET_REGNUM (regnum))
400 store_fpregs (regcache, tid, regnum);
401
402 /* S390_LAST_BREAK_REGNUM is read-only. */
403
404 if (have_regset_system_call)
405 if (regnum == -1 || regnum == S390_SYSTEM_CALL_REGNUM)
406 store_regset (regcache, tid, NT_S390_SYSTEM_CALL, 4,
407 s390_regmap_system_call);
408 }
409
410
411 /* Hardware-assisted watchpoint handling. */
412
413 /* We maintain a list of all currently active watchpoints in order
414 to properly handle watchpoint removal.
415
416 The only thing we actually need is the total address space area
417 spanned by the watchpoints. */
418
419 struct watch_area
420 {
421 struct watch_area *next;
422 CORE_ADDR lo_addr;
423 CORE_ADDR hi_addr;
424 };
425
426 static struct watch_area *watch_base = NULL;
427
428 static int
429 s390_stopped_by_watchpoint (void)
430 {
431 per_lowcore_bits per_lowcore;
432 ptrace_area parea;
433 int result;
434
435 /* Speed up common case. */
436 if (!watch_base)
437 return 0;
438
439 parea.len = sizeof (per_lowcore);
440 parea.process_addr = (addr_t) & per_lowcore;
441 parea.kernel_addr = offsetof (struct user_regs_struct, per_info.lowcore);
442 if (ptrace (PTRACE_PEEKUSR_AREA, s390_inferior_tid (), &parea) < 0)
443 perror_with_name (_("Couldn't retrieve watchpoint status"));
444
445 result = (per_lowcore.perc_storage_alteration == 1
446 && per_lowcore.perc_store_real_address == 0);
447
448 if (result)
449 {
450 /* Do not report this watchpoint again. */
451 memset (&per_lowcore, 0, sizeof (per_lowcore));
452 if (ptrace (PTRACE_POKEUSR_AREA, s390_inferior_tid (), &parea) < 0)
453 perror_with_name (_("Couldn't clear watchpoint status"));
454 }
455
456 return result;
457 }
458
459 static void
460 s390_fix_watch_points (struct lwp_info *lp)
461 {
462 int tid;
463
464 per_struct per_info;
465 ptrace_area parea;
466
467 CORE_ADDR watch_lo_addr = (CORE_ADDR)-1, watch_hi_addr = 0;
468 struct watch_area *area;
469
470 tid = TIDGET (lp->ptid);
471 if (tid == 0)
472 tid = PIDGET (lp->ptid);
473
474 for (area = watch_base; area; area = area->next)
475 {
476 watch_lo_addr = min (watch_lo_addr, area->lo_addr);
477 watch_hi_addr = max (watch_hi_addr, area->hi_addr);
478 }
479
480 parea.len = sizeof (per_info);
481 parea.process_addr = (addr_t) & per_info;
482 parea.kernel_addr = offsetof (struct user_regs_struct, per_info);
483 if (ptrace (PTRACE_PEEKUSR_AREA, tid, &parea) < 0)
484 perror_with_name (_("Couldn't retrieve watchpoint status"));
485
486 if (watch_base)
487 {
488 per_info.control_regs.bits.em_storage_alteration = 1;
489 per_info.control_regs.bits.storage_alt_space_ctl = 1;
490 }
491 else
492 {
493 per_info.control_regs.bits.em_storage_alteration = 0;
494 per_info.control_regs.bits.storage_alt_space_ctl = 0;
495 }
496 per_info.starting_addr = watch_lo_addr;
497 per_info.ending_addr = watch_hi_addr;
498
499 if (ptrace (PTRACE_POKEUSR_AREA, tid, &parea) < 0)
500 perror_with_name (_("Couldn't modify watchpoint status"));
501 }
502
503 static int
504 s390_insert_watchpoint (CORE_ADDR addr, int len, int type,
505 struct expression *cond)
506 {
507 struct lwp_info *lp;
508 struct watch_area *area = xmalloc (sizeof (struct watch_area));
509
510 if (!area)
511 return -1;
512
513 area->lo_addr = addr;
514 area->hi_addr = addr + len - 1;
515
516 area->next = watch_base;
517 watch_base = area;
518
519 ALL_LWPS (lp)
520 s390_fix_watch_points (lp);
521 return 0;
522 }
523
524 static int
525 s390_remove_watchpoint (CORE_ADDR addr, int len, int type,
526 struct expression *cond)
527 {
528 struct lwp_info *lp;
529 struct watch_area *area, **parea;
530
531 for (parea = &watch_base; *parea; parea = &(*parea)->next)
532 if ((*parea)->lo_addr == addr
533 && (*parea)->hi_addr == addr + len - 1)
534 break;
535
536 if (!*parea)
537 {
538 fprintf_unfiltered (gdb_stderr,
539 "Attempt to remove nonexistent watchpoint.\n");
540 return -1;
541 }
542
543 area = *parea;
544 *parea = area->next;
545 xfree (area);
546
547 ALL_LWPS (lp)
548 s390_fix_watch_points (lp);
549 return 0;
550 }
551
552 static int
553 s390_can_use_hw_breakpoint (int type, int cnt, int othertype)
554 {
555 return type == bp_hardware_watchpoint;
556 }
557
558 static int
559 s390_region_ok_for_hw_watchpoint (CORE_ADDR addr, int cnt)
560 {
561 return 1;
562 }
563
564 static int
565 s390_target_wordsize (void)
566 {
567 int wordsize = 4;
568
569 /* Check for 64-bit inferior process. This is the case when the host is
570 64-bit, and in addition bit 32 of the PSW mask is set. */
571 #ifdef __s390x__
572 long pswm;
573
574 errno = 0;
575 pswm = (long) ptrace (PTRACE_PEEKUSER, s390_inferior_tid (), PT_PSWMASK, 0);
576 if (errno == 0 && (pswm & 0x100000000ul) != 0)
577 wordsize = 8;
578 #endif
579
580 return wordsize;
581 }
582
583 static int
584 s390_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
585 gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
586 {
587 int sizeof_auxv_field = s390_target_wordsize ();
588 enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
589 gdb_byte *ptr = *readptr;
590
591 if (endptr == ptr)
592 return 0;
593
594 if (endptr - ptr < sizeof_auxv_field * 2)
595 return -1;
596
597 *typep = extract_unsigned_integer (ptr, sizeof_auxv_field, byte_order);
598 ptr += sizeof_auxv_field;
599 *valp = extract_unsigned_integer (ptr, sizeof_auxv_field, byte_order);
600 ptr += sizeof_auxv_field;
601
602 *readptr = ptr;
603 return 1;
604 }
605
606 #ifdef __s390x__
607 static unsigned long
608 s390_get_hwcap (void)
609 {
610 CORE_ADDR field;
611
612 if (target_auxv_search (&current_target, AT_HWCAP, &field))
613 return (unsigned long) field;
614
615 return 0;
616 }
617 #endif
618
619 static const struct target_desc *
620 s390_read_description (struct target_ops *ops)
621 {
622 int tid = s390_inferior_tid ();
623
624 have_regset_last_break
625 = check_regset (tid, NT_S390_LAST_BREAK, 8);
626 have_regset_system_call
627 = check_regset (tid, NT_S390_SYSTEM_CALL, 4);
628
629 #ifdef __s390x__
630 /* If GDB itself is compiled as 64-bit, we are running on a machine in
631 z/Architecture mode. If the target is running in 64-bit addressing
632 mode, report s390x architecture. If the target is running in 31-bit
633 addressing mode, but the kernel supports using 64-bit registers in
634 that mode, report s390 architecture with 64-bit GPRs. */
635
636 if (s390_target_wordsize () == 8)
637 return (have_regset_system_call? tdesc_s390x_linux64v2 :
638 have_regset_last_break? tdesc_s390x_linux64v1 :
639 tdesc_s390x_linux64);
640
641 if (s390_get_hwcap () & HWCAP_S390_HIGH_GPRS)
642 return (have_regset_system_call? tdesc_s390_linux64v2 :
643 have_regset_last_break? tdesc_s390_linux64v1 :
644 tdesc_s390_linux64);
645 #endif
646
647 /* If GDB itself is compiled as 31-bit, or if we're running a 31-bit inferior
648 on a 64-bit kernel that does not support using 64-bit registers in 31-bit
649 mode, report s390 architecture with 32-bit GPRs. */
650 return (have_regset_system_call? tdesc_s390_linux32v2 :
651 have_regset_last_break? tdesc_s390_linux32v1 :
652 tdesc_s390_linux32);
653 }
654
655 void _initialize_s390_nat (void);
656
657 void
658 _initialize_s390_nat (void)
659 {
660 struct target_ops *t;
661
662 /* Fill in the generic GNU/Linux methods. */
663 t = linux_target ();
664
665 /* Add our register access methods. */
666 t->to_fetch_registers = s390_linux_fetch_inferior_registers;
667 t->to_store_registers = s390_linux_store_inferior_registers;
668
669 /* Add our watchpoint methods. */
670 t->to_can_use_hw_breakpoint = s390_can_use_hw_breakpoint;
671 t->to_region_ok_for_hw_watchpoint = s390_region_ok_for_hw_watchpoint;
672 t->to_have_continuable_watchpoint = 1;
673 t->to_stopped_by_watchpoint = s390_stopped_by_watchpoint;
674 t->to_insert_watchpoint = s390_insert_watchpoint;
675 t->to_remove_watchpoint = s390_remove_watchpoint;
676
677 /* Detect target architecture. */
678 t->to_read_description = s390_read_description;
679 t->to_auxv_parse = s390_auxv_parse;
680
681 /* Register the target. */
682 linux_nat_add_target (t);
683 linux_nat_set_new_thread (t, s390_fix_watch_points);
684 }