kgdb.S 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright (C) 2000 Murray Jensen <Murray.Jensen@cmst.csiro.au>
  3. *
  4. * See file CREDITS for list of people who contributed to this
  5. * project.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (at your option) any later version.
  11. *
  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.
  16. *
  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, Boston,
  20. * MA 02111-1307 USA
  21. */
  22. #include <config.h>
  23. #include <command.h>
  24. #include <ppc4xx.h>
  25. #include <version.h>
  26. #define CONFIG_405GP 1 /* needed for Linux kernel header files */
  27. #define _LINUX_CONFIG_H 1 /* avoid reading Linux autoconf.h file */
  28. #include <ppc_asm.tmpl>
  29. #include <ppc_defs.h>
  30. #include <asm/cache.h>
  31. #include <asm/mmu.h>
  32. #if defined(CONFIG_CMD_KGDB)
  33. /*
  34. * cache flushing routines for kgdb
  35. */
  36. .globl kgdb_flush_cache_all
  37. kgdb_flush_cache_all:
  38. /* icache */
  39. iccci r0,r0 /* iccci invalidates the entire I cache */
  40. /* dcache */
  41. addi r6,0,0x0000 /* clear GPR 6 */
  42. addi r7,r0, 128 /* do loop for # of dcache lines */
  43. /* NOTE: dccci invalidates both */
  44. mtctr r7 /* ways in the D cache */
  45. ..dcloop:
  46. dccci 0,r6 /* invalidate line */
  47. addi r6,r6, 32 /* bump to next line */
  48. bdnz ..dcloop
  49. blr
  50. .globl kgdb_flush_cache_range
  51. kgdb_flush_cache_range:
  52. li r5,CFG_CACHELINE_SIZE-1
  53. andc r3,r3,r5
  54. subf r4,r3,r4
  55. add r4,r4,r5
  56. srwi. r4,r4,CFG_CACHELINE_SHIFT
  57. beqlr
  58. mtctr r4
  59. mr r6,r3
  60. 1: dcbst 0,r3
  61. addi r3,r3,CFG_CACHELINE_SIZE
  62. bdnz 1b
  63. sync /* wait for dcbst's to get to ram */
  64. mtctr r4
  65. 2: icbi 0,r6
  66. addi r6,r6,CFG_CACHELINE_SIZE
  67. bdnz 2b
  68. SYNC
  69. blr
  70. #endif