Message ID | 20180619052535.24043-9-mikey@neuling.org |
---|---|
State | Accepted |
Headers | show |
Series | [01/18] Make -a the default for probe | expand |
So this means that htm_start will actually start htm?! On 19/06/18 15:25, Michael Neuling wrote: > Signed-off-by: Michael Neuling <mikey@neuling.org> > --- > libpdbg/htm.c | 12 +++--------- > libpdbg/libpdbg.h | 1 - > libpdbg/target.h | 1 - > src/htm.c | 25 ------------------------- > 4 files changed, 3 insertions(+), 36 deletions(-) > > diff --git a/libpdbg/htm.c b/libpdbg/htm.c > index 48ad001f15..d7ffbccd54 100644 > --- a/libpdbg/htm.c > +++ b/libpdbg/htm.c > @@ -207,13 +207,6 @@ int htm_stop(struct pdbg_target *target) > return htm ? htm->stop(htm) : -1; > } > > -int htm_reset(struct pdbg_target *target) > -{ > - struct htm *htm = check_and_convert(target); > - > - return htm ? htm->reset(htm) : -1; > -} > - > int htm_status(struct pdbg_target *target) > { > struct htm *htm = check_and_convert(target); > @@ -705,6 +698,9 @@ static int do_htm_start(struct htm *htm) > { > struct htm_status status; > > + if (do_htm_reset(htm) < 0) > + return -1; > + > if (HTM_ERR(get_status(htm, &status))) > return -1; > > @@ -950,7 +946,6 @@ static struct htm nhtm = { > }, > .start = do_htm_start, > .stop = do_htm_stop, > - .reset = do_htm_reset, > .status = do_htm_status, > .dump = do_htm_dump, > }; > @@ -965,7 +960,6 @@ static struct htm chtm = { > }, > .start = do_htm_start, > .stop = do_htm_stop, > - .reset = do_htm_reset, > .status = do_htm_status, > .dump = do_htm_dump, > }; > diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h > index 1f5c31167f..21e10c61b1 100644 > --- a/libpdbg/libpdbg.h > +++ b/libpdbg/libpdbg.h > @@ -165,7 +165,6 @@ struct thread_state { > int htm_start(struct pdbg_target *target); > int htm_stop(struct pdbg_target *target); > int htm_status(struct pdbg_target *target); > -int htm_reset(struct pdbg_target *target); > int htm_dump(struct pdbg_target *target, uint64_t size, char *filename); > > int adu_getmem(struct pdbg_target *target, uint64_t addr, uint8_t *ouput, uint64_t size); > diff --git a/libpdbg/target.h b/libpdbg/target.h > index ac00b56e86..6f8d4b8b08 100644 > --- a/libpdbg/target.h > +++ b/libpdbg/target.h > @@ -93,7 +93,6 @@ struct htm { > struct pdbg_target target; > int (*start)(struct htm *); > int (*stop)(struct htm *); > - int (*reset)(struct htm *); > int (*status)(struct htm *); > int (*dump)(struct htm *, uint64_t, char *); > }; > diff --git a/src/htm.c b/src/htm.c > index a41b2e52bb..a58a968c08 100644 > --- a/src/htm.c > +++ b/src/htm.c > @@ -146,30 +146,6 @@ static int run_status(enum htm_type type) > return rc; > } > > -static int run_reset(enum htm_type type) > -{ > - struct pdbg_target *target; > - int rc = 0; > - > - pdbg_for_each_class_target(HTM_ENUM_TO_STRING(type), target) { > - if (!target_selected(target)) > - continue; > - pdbg_target_probe(target); > - if (target_is_disabled(target)) > - continue; > - > - printf("Resetting HTM@"); > - print_htm_address(type, target); > - if (htm_reset(target) != 1) { > - printf("Couldn't reset HTM@"); > - print_htm_address(type, target); > - } > - rc++; > - } > - > - return rc; > -} > - > static int run_dump(enum htm_type type) > { > struct pdbg_target *target; > @@ -211,7 +187,6 @@ static struct { > { "start", "", "Start %s HTM", &run_start }, > { "stop", "", "Stop %s HTM", &run_stop }, > { "status", "", "Get %s HTM status", &run_status }, > - { "reset", "", "Reset %s HTM", &run_reset }, > { "dump", "", "Dump %s HTM buffer to file", &run_dump }, > }; >
On Thu, 2018-06-21 at 13:22 +1000, rashmica wrote:
> So this means that htm_start will actually start htm?!
Yep... crazy I know.
Mikey
diff --git a/libpdbg/htm.c b/libpdbg/htm.c index 48ad001f15..d7ffbccd54 100644 --- a/libpdbg/htm.c +++ b/libpdbg/htm.c @@ -207,13 +207,6 @@ int htm_stop(struct pdbg_target *target) return htm ? htm->stop(htm) : -1; } -int htm_reset(struct pdbg_target *target) -{ - struct htm *htm = check_and_convert(target); - - return htm ? htm->reset(htm) : -1; -} - int htm_status(struct pdbg_target *target) { struct htm *htm = check_and_convert(target); @@ -705,6 +698,9 @@ static int do_htm_start(struct htm *htm) { struct htm_status status; + if (do_htm_reset(htm) < 0) + return -1; + if (HTM_ERR(get_status(htm, &status))) return -1; @@ -950,7 +946,6 @@ static struct htm nhtm = { }, .start = do_htm_start, .stop = do_htm_stop, - .reset = do_htm_reset, .status = do_htm_status, .dump = do_htm_dump, }; @@ -965,7 +960,6 @@ static struct htm chtm = { }, .start = do_htm_start, .stop = do_htm_stop, - .reset = do_htm_reset, .status = do_htm_status, .dump = do_htm_dump, }; diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h index 1f5c31167f..21e10c61b1 100644 --- a/libpdbg/libpdbg.h +++ b/libpdbg/libpdbg.h @@ -165,7 +165,6 @@ struct thread_state { int htm_start(struct pdbg_target *target); int htm_stop(struct pdbg_target *target); int htm_status(struct pdbg_target *target); -int htm_reset(struct pdbg_target *target); int htm_dump(struct pdbg_target *target, uint64_t size, char *filename); int adu_getmem(struct pdbg_target *target, uint64_t addr, uint8_t *ouput, uint64_t size); diff --git a/libpdbg/target.h b/libpdbg/target.h index ac00b56e86..6f8d4b8b08 100644 --- a/libpdbg/target.h +++ b/libpdbg/target.h @@ -93,7 +93,6 @@ struct htm { struct pdbg_target target; int (*start)(struct htm *); int (*stop)(struct htm *); - int (*reset)(struct htm *); int (*status)(struct htm *); int (*dump)(struct htm *, uint64_t, char *); }; diff --git a/src/htm.c b/src/htm.c index a41b2e52bb..a58a968c08 100644 --- a/src/htm.c +++ b/src/htm.c @@ -146,30 +146,6 @@ static int run_status(enum htm_type type) return rc; } -static int run_reset(enum htm_type type) -{ - struct pdbg_target *target; - int rc = 0; - - pdbg_for_each_class_target(HTM_ENUM_TO_STRING(type), target) { - if (!target_selected(target)) - continue; - pdbg_target_probe(target); - if (target_is_disabled(target)) - continue; - - printf("Resetting HTM@"); - print_htm_address(type, target); - if (htm_reset(target) != 1) { - printf("Couldn't reset HTM@"); - print_htm_address(type, target); - } - rc++; - } - - return rc; -} - static int run_dump(enum htm_type type) { struct pdbg_target *target; @@ -211,7 +187,6 @@ static struct { { "start", "", "Start %s HTM", &run_start }, { "stop", "", "Stop %s HTM", &run_stop }, { "status", "", "Get %s HTM status", &run_status }, - { "reset", "", "Reset %s HTM", &run_reset }, { "dump", "", "Dump %s HTM buffer to file", &run_dump }, };
Signed-off-by: Michael Neuling <mikey@neuling.org> --- libpdbg/htm.c | 12 +++--------- libpdbg/libpdbg.h | 1 - libpdbg/target.h | 1 - src/htm.c | 25 ------------------------- 4 files changed, 3 insertions(+), 36 deletions(-)