kgdb_stubs.c 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * U-Boot - stub functions for common kgdb code,
  3. * can be overridden in board specific files
  4. *
  5. * Copyright 2009 Analog Devices Inc.
  6. *
  7. * Licensed under the GPL-2 or later.
  8. */
  9. #include <common.h>
  10. #include <cpu_func.h>
  11. #include <kgdb.h>
  12. #include <serial.h>
  13. #include <asm/ptrace.h>
  14. int (*debugger_exception_handler)(struct pt_regs *);
  15. __attribute__((weak))
  16. void kgdb_serial_init(void)
  17. {
  18. puts("[on serial] ");
  19. }
  20. __attribute__((weak))
  21. void putDebugChar(int c)
  22. {
  23. serial_putc(c);
  24. }
  25. __attribute__((weak))
  26. void putDebugStr(const char *str)
  27. {
  28. #ifdef DEBUG
  29. serial_puts(str);
  30. #endif
  31. }
  32. __attribute__((weak))
  33. int getDebugChar(void)
  34. {
  35. return serial_getc();
  36. }
  37. __attribute__((weak))
  38. void kgdb_interruptible(int yes)
  39. {
  40. return;
  41. }
  42. __attribute__((weak))
  43. void kgdb_flush_cache_range(void *from, void *to)
  44. {
  45. flush_cache((unsigned long)from, (unsigned long)(to - from));
  46. }
  47. __attribute__((weak))
  48. void kgdb_flush_cache_all(void)
  49. {
  50. if (dcache_status()) {
  51. dcache_disable();
  52. dcache_enable();
  53. }
  54. if (icache_status()) {
  55. icache_disable();
  56. icache_enable();
  57. }
  58. }