OLD | NEW |
1 /* Low level interface to SPUs, for the remote server for GDB. | 1 /* Low level interface to SPUs, for the remote server for GDB. |
2 Copyright (C) 2006-2012 Free Software Foundation, Inc. | 2 Copyright (C) 2006-2012 Free Software Foundation, Inc. |
3 | 3 |
4 Contributed by Ulrich Weigand <uweigand@de.ibm.com>. | 4 Contributed by Ulrich Weigand <uweigand@de.ibm.com>. |
5 | 5 |
6 This file is part of GDB. | 6 This file is part of GDB. |
7 | 7 |
8 This program is free software; you can redistribute it and/or modify | 8 This program is free software; you can redistribute it and/or modify |
9 it under the terms of the GNU General Public License as published by | 9 it under the terms of the GNU General Public License as published by |
10 the Free Software Foundation; either version 3 of the License, or | 10 the Free Software Foundation; either version 3 of the License, or |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 return 0; | 199 return 0; |
200 } | 200 } |
201 | 201 |
202 | 202 |
203 /* If the PPU thread is currently stopped on a spu_run system call, | 203 /* If the PPU thread is currently stopped on a spu_run system call, |
204 return to FD and ADDR the file handle and NPC parameter address | 204 return to FD and ADDR the file handle and NPC parameter address |
205 used with the system call. Return non-zero if successful. */ | 205 used with the system call. Return non-zero if successful. */ |
206 static int | 206 static int |
207 parse_spufs_run (int *fd, CORE_ADDR *addr) | 207 parse_spufs_run (int *fd, CORE_ADDR *addr) |
208 { | 208 { |
209 char buf[4]; | 209 unsigned int insn; |
210 CORE_ADDR pc = fetch_ppc_register (32); /* nip */ | 210 CORE_ADDR pc = fetch_ppc_register (32); /* nip */ |
211 | 211 |
212 /* Fetch instruction preceding current NIP. */ | 212 /* Fetch instruction preceding current NIP. */ |
213 if (fetch_ppc_memory (pc-4, buf, 4) != 0) | 213 if (fetch_ppc_memory (pc-4, (char *) &insn, 4) != 0) |
214 return 0; | 214 return 0; |
215 /* It should be a "sc" instruction. */ | 215 /* It should be a "sc" instruction. */ |
216 if (*(unsigned int *)buf != INSTR_SC) | 216 if (insn != INSTR_SC) |
217 return 0; | 217 return 0; |
218 /* System call number should be NR_spu_run. */ | 218 /* System call number should be NR_spu_run. */ |
219 if (fetch_ppc_register (0) != NR_spu_run) | 219 if (fetch_ppc_register (0) != NR_spu_run) |
220 return 0; | 220 return 0; |
221 | 221 |
222 /* Register 3 contains fd, register 4 the NPC param pointer. */ | 222 /* Register 3 contains fd, register 4 the NPC param pointer. */ |
223 *fd = fetch_ppc_register (34); /* orig_gpr3 */ | 223 *fd = fetch_ppc_register (34); /* orig_gpr3 */ |
224 *addr = fetch_ppc_register (4); | 224 *addr = fetch_ppc_register (4); |
225 return 1; | 225 return 1; |
226 } | 226 } |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 fprintf (stderr, "\nChild exited with retcode = %x \n", WEXITSTATUS (w)); | 448 fprintf (stderr, "\nChild exited with retcode = %x \n", WEXITSTATUS (w)); |
449 ourstatus->kind = TARGET_WAITKIND_EXITED; | 449 ourstatus->kind = TARGET_WAITKIND_EXITED; |
450 ourstatus->value.integer = WEXITSTATUS (w); | 450 ourstatus->value.integer = WEXITSTATUS (w); |
451 clear_inferiors (); | 451 clear_inferiors (); |
452 return pid_to_ptid (ret); | 452 return pid_to_ptid (ret); |
453 } | 453 } |
454 else if (!WIFSTOPPED (w)) | 454 else if (!WIFSTOPPED (w)) |
455 { | 455 { |
456 fprintf (stderr, "\nChild terminated with signal = %x \n", WTERMSIG (w)); | 456 fprintf (stderr, "\nChild terminated with signal = %x \n", WTERMSIG (w)); |
457 ourstatus->kind = TARGET_WAITKIND_SIGNALLED; | 457 ourstatus->kind = TARGET_WAITKIND_SIGNALLED; |
458 ourstatus->value.sig = target_signal_from_host (WTERMSIG (w)); | 458 ourstatus->value.sig = gdb_signal_from_host (WTERMSIG (w)); |
459 clear_inferiors (); | 459 clear_inferiors (); |
460 return pid_to_ptid (ret); | 460 return pid_to_ptid (ret); |
461 } | 461 } |
462 | 462 |
463 /* After attach, we may have received a SIGSTOP. Do not return this | 463 /* After attach, we may have received a SIGSTOP. Do not return this |
464 as signal to GDB, or else it will try to continue with SIGSTOP ... */ | 464 as signal to GDB, or else it will try to continue with SIGSTOP ... */ |
465 if (!server_waiting) | 465 if (!server_waiting) |
466 { | 466 { |
467 ourstatus->kind = TARGET_WAITKIND_STOPPED; | 467 ourstatus->kind = TARGET_WAITKIND_STOPPED; |
468 ourstatus->value.sig = TARGET_SIGNAL_0; | 468 ourstatus->value.sig = GDB_SIGNAL_0; |
469 return ptid_build (ret, ret, 0); | 469 return ptid_build (ret, ret, 0); |
470 } | 470 } |
471 | 471 |
472 ourstatus->kind = TARGET_WAITKIND_STOPPED; | 472 ourstatus->kind = TARGET_WAITKIND_STOPPED; |
473 ourstatus->value.sig = target_signal_from_host (WSTOPSIG (w)); | 473 ourstatus->value.sig = gdb_signal_from_host (WSTOPSIG (w)); |
474 return ptid_build (ret, ret, 0); | 474 return ptid_build (ret, ret, 0); |
475 } | 475 } |
476 | 476 |
477 /* Fetch inferior registers. */ | 477 /* Fetch inferior registers. */ |
478 static void | 478 static void |
479 spu_fetch_registers (struct regcache *regcache, int regno) | 479 spu_fetch_registers (struct regcache *regcache, int regno) |
480 { | 480 { |
481 int fd; | 481 int fd; |
482 CORE_ADDR addr; | 482 CORE_ADDR addr; |
483 | 483 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 | 667 |
668 void | 668 void |
669 initialize_low (void) | 669 initialize_low (void) |
670 { | 670 { |
671 static const unsigned char breakpoint[] = { 0x00, 0x00, 0x3f, 0xff }; | 671 static const unsigned char breakpoint[] = { 0x00, 0x00, 0x3f, 0xff }; |
672 | 672 |
673 set_target_ops (&spu_target_ops); | 673 set_target_ops (&spu_target_ops); |
674 set_breakpoint_data (breakpoint, sizeof breakpoint); | 674 set_breakpoint_data (breakpoint, sizeof breakpoint); |
675 init_registers_spu (); | 675 init_registers_spu (); |
676 } | 676 } |
OLD | NEW |