You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

107 lines
3.6 KiB

  1. /***************************************************************************
  2. * Copyright (C) 2011 by Broadcom Corporation *
  3. * Evan Hunter - ehunter@broadcom.com *
  4. * *
  5. * This program is free software; you can redistribute it and/or modify *
  6. * it under the terms of the GNU General Public License as published by *
  7. * the Free Software Foundation; either version 2 of the License, or *
  8. * (at your option) any later version. *
  9. * *
  10. * This program is distributed in the hope that it will be useful, *
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  13. * GNU General Public License for more details. *
  14. * *
  15. * You should have received a copy of the GNU General Public License *
  16. * along with this program; if not, write to the *
  17. * Free Software Foundation, Inc., *
  18. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
  19. ***************************************************************************/
  20. #ifndef RTOS_H
  21. #define RTOS_H
  22. #include "server/server.h"
  23. #include <helper/types.h>
  24. #include <jim-nvp.h>
  25. typedef long long threadid_t;
  26. typedef long long symbol_address_t;
  27. struct reg;
  28. /**
  29. * Table should be terminated by an element with NULL in symbol_name
  30. */
  31. typedef struct symbol_table_elem_struct
  32. {
  33. char * symbol_name;
  34. symbol_address_t address;
  35. } symbol_table_elem_t;
  36. struct thread_detail
  37. {
  38. threadid_t threadid;
  39. bool exists;
  40. char * display_str;
  41. char * thread_name_str;
  42. char * extra_info_str;
  43. };
  44. struct rtos
  45. {
  46. const struct rtos_type *type;
  47. symbol_table_elem_t * symbols;
  48. struct target *target;
  49. threadid_t current_thread;
  50. struct thread_detail* thread_details;
  51. int thread_count;
  52. void * rtos_specific_params;
  53. };
  54. struct rtos_type
  55. {
  56. char * name;
  57. int (*detect_rtos) ( struct target* target );
  58. int (*create) ( struct target* target );
  59. int (*update_threads) ( struct rtos* rtos );
  60. int (*get_thread_reg_list) ( struct rtos *rtos, long long thread_id, char ** hex_reg_list );
  61. int (*get_symbol_list_to_lookup) (symbol_table_elem_t * symbol_list[] );
  62. };
  63. struct stack_register_offset
  64. {
  65. signed short offset; // offset in bytes from stack head, or -1 to indicate register is not stacked, or -2 to indicate this is the stack pointer register
  66. unsigned short width_bits;
  67. };
  68. struct rtos_register_stacking
  69. {
  70. unsigned char stack_registers_size;
  71. signed char stack_growth_direction;
  72. unsigned char num_output_registers;
  73. const struct stack_register_offset* register_offsets;
  74. };
  75. #define GDB_THREAD_PACKET_NOT_CONSUMED (-40)
  76. int rtos_create(Jim_GetOptInfo *goi, struct target * target);
  77. int rtos_generic_stack_read( struct target * target, const struct rtos_register_stacking* stacking, long long stack_ptr, char ** hex_reg_list );
  78. int rtos_try_next( struct target * target );
  79. int gdb_thread_packet(struct connection *connection, struct target *target, char *packet, int packet_size);
  80. int rtos_get_gdb_reg_list(struct connection *connection, struct target *target, struct reg **reg_list[], int *reg_list_size);
  81. int rtos_update_threads( struct target *target );
  82. #endif // RTOS_H