MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / initialize_memwatch

Function initialize_memwatch

src/debug.cpp:4936–4991  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4934}
4935
4936static void initialize_memwatch (int mode)
4937{
4938 membank_total = currprefs.address_space_24 ? 256 : 65536;
4939 deinitialize_memwatch ();
4940 debug_mem_banks = xcalloc (addrbank*, 65536);
4941 if (!debug_mem_banks)
4942 return;
4943 if (membank_total < 65536) {
4944 for (int i = 256; i < 65536; i++) {
4945 debug_mem_banks[i] = &dummy_bank;
4946 }
4947 }
4948 debug_mem_area = xcalloc (addrbank, membank_total);
4949 membank_stores = xcalloc (struct membank_store, MEMWATCH_STORE_SLOTS);
4950 for (int i = 0; i < MEMWATCH_TOTAL; i++) {
4951 struct memwatch_node *m = &mwnodes[i];
4952 m->pc = 0xffffffff;
4953 }
4954#if 0
4955 int i, j, as;
4956 addrbank *a1, *a2, *oa;
4957 oa = NULL;
4958 for (i = 0; i < as; i++) {
4959 a1 = debug_mem_banks[i] = debug_mem_area + i;
4960 a2 = mem_banks[i];
4961 if (a2 != oa) {
4962 for (j = 0; membank_stores[j].addr; j++) {
4963 if (membank_stores[j].addr == a2)
4964 break;
4965 }
4966 if (membank_stores[j].addr == NULL) {
4967 membank_stores[j].addr = a2;
4968 memcpy (&membank_stores[j].store, a2, sizeof (addrbank));
4969 }
4970 }
4971 memcpy (a1, a2, sizeof (addrbank));
4972 }
4973 for (i = 0; i < as; i++) {
4974 a2 = mem_banks[i];
4975 a2->bget = mode ? mmu_bget : debug_bget;
4976 a2->wget = mode ? mmu_wget : debug_wget;
4977 a2->lget = mode ? mmu_lget : debug_lget;
4978 a2->bput = mode ? mmu_bput : debug_bput;
4979 a2->wput = mode ? mmu_wput : debug_wput;
4980 a2->lput = mode ? mmu_lput : debug_lput;
4981 a2->check = debug_check;
4982 a2->xlateaddr = debug_xlate;
4983 a2->wgeti = mode ? mmu_wgeti : debug_wgeti;
4984 a2->lgeti = mode ? mmu_lgeti : debug_lgeti;
4985 }
4986#endif
4987 if (mode)
4988 mmu_enabled = 1;
4989 else
4990 memwatch_enabled = 1;
4991}
4992
4993int debug_bankchange (int mode)

Callers 6

smc_detect_initFunction · 0.85
debug_bankchangeFunction · 0.85
memwatchFunction · 0.85
mmu_initFunction · 0.85
debug_trainer_enableFunction · 0.85

Calls 1

deinitialize_memwatchFunction · 0.85

Tested by

no test coverage detected