This reverts commit
63a23e6fc862b94f00e0833ab474bd02901a019f
Change-Id: I62778fb3b1dabc6470d582bea9ca64d593999233
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Change-Id: Iaf5a2cf5bdc4a62ba68ad9403e1c1229112970de
Reviewed-on: http://openocd.zylin.com/899
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
new_wa->size = area->size - size;
new_wa->address = area->address + size;
new_wa->backup = NULL;
new_wa->size = area->size - size;
new_wa->address = area->address + size;
new_wa->backup = NULL;
new_wa->free = true;
area->next = new_wa;
new_wa->free = true;
area->next = new_wa;
new_wa->size = target->working_area_size & ~3UL; /* 4-byte align */
new_wa->address = target->working_area;
new_wa->backup = NULL;
new_wa->size = target->working_area_size & ~3UL; /* 4-byte align */
new_wa->address = target->working_area;
new_wa->backup = NULL;
c->free = false;
*area = c;
c->free = false;
*area = c;
+ /* user pointer */
+ c->user = area;
+
print_wa_layout(target);
return ERROR_OK;
print_wa_layout(target);
return ERROR_OK;
LOG_DEBUG("freed %"PRIu32" bytes of working area at address 0x%08"PRIx32,
area->size, area->address);
LOG_DEBUG("freed %"PRIu32" bytes of working area at address 0x%08"PRIx32,
area->size, area->address);
+ /* mark user pointer invalid */
+ /* TODO: Is this really safe? It points to some previous caller's memory.
+ * How could we know that the area pointer is still in that place and not
+ * some other vital data? What's the purpose of this, anyway? */
+ *area->user = NULL;
+ area->user = NULL;
+
target_merge_working_areas(target);
print_wa_layout(target);
target_merge_working_areas(target);
print_wa_layout(target);
if (restore)
target_restore_working_area(target, c);
c->free = true;
if (restore)
target_restore_working_area(target, c);
c->free = true;
+ *c->user = NULL; /* Same as above */
+ c->user = NULL;
uint32_t size;
bool free;
uint8_t *backup;
uint32_t size;
bool free;
uint8_t *backup;
+ struct working_area **user;
struct working_area *next;
};
struct working_area *next;
};