summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2020-08-15 09:57:10 -0400
committerWilliam Wilgus <wilgus.william@gmail.com>2020-08-15 09:57:10 -0400
commit84bfd68fb5fc32debaf95551ffeafb5ea1583033 (patch)
tree6dac296a6f073500c18117d9d45a23e8871e274b
parenta9ac2d0ba3b01de26944dc6a93c490c89c4ead70 (diff)
downloadrockbox-84bfd68fb5fc32debaf95551ffeafb5ea1583033.tar.gz
rockbox-84bfd68fb5fc32debaf95551ffeafb5ea1583033.zip
Battery_bench & announce_status stack fix
had stack growing the wrong way Change-Id: I51bf14526f5239e77e15dc0ffd76ad3ed8bdcbc8
-rw-r--r--apps/plugins/announce_status.c6
-rw-r--r--apps/plugins/battery_bench.c4
2 files changed, 4 insertions, 6 deletions
diff --git a/apps/plugins/announce_status.c b/apps/plugins/announce_status.c
index a1e9f430a8..92f9aa28ec 100644
--- a/apps/plugins/announce_status.c
+++ b/apps/plugins/announce_status.c
@@ -438,7 +438,7 @@ void plugin_buffer_init(void)
438 { 438 {
439 rb->memset(&gThread, 0, sizeof(gThread)); 439 rb->memset(&gThread, 0, sizeof(gThread));
440 gThread.buf = rb->plugin_get_buffer(&gThread.buf_size); 440 gThread.buf = rb->plugin_get_buffer(&gThread.buf_size);
441 ALIGN_BUFFER(gThread.buf, gThread.buf_size, 4); 441 ALIGN_BUFFER(gThread.buf, gThread.buf_size, sizeof(long));
442 } 442 }
443} 443}
444 444
@@ -448,9 +448,9 @@ void thread_create(void)
448 gThread.stacksize = gThread.buf_size; 448 gThread.stacksize = gThread.buf_size;
449 gThread.buf_size -= gThread.stacksize; 449 gThread.buf_size -= gThread.stacksize;
450 450
451 gThread.stack = (long *) gThread.buf + gThread.buf_size; 451 gThread.stack = (long *) gThread.buf;
452 452
453 ALIGN_BUFFER(gThread.stack, gThread.stacksize, 4); 453 ALIGN_BUFFER(gThread.stack, gThread.stacksize, sizeof(long));
454 454
455 if (gThread.stacksize < DEFAULT_STACK_SIZE) 455 if (gThread.stacksize < DEFAULT_STACK_SIZE)
456 { 456 {
diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c
index 75c448bb27..ff979abd8e 100644
--- a/apps/plugins/battery_bench.c
+++ b/apps/plugins/battery_bench.c
@@ -656,9 +656,7 @@ enum plugin_status plugin_start(const void* parameter)
656 rb->memset(buf, 0, buf_size); 656 rb->memset(buf, 0, buf_size);
657 657
658 gThread.stacksize = buf_size; 658 gThread.stacksize = buf_size;
659 gThread.stack = (long *) buf + buf_size; /* stack grows towards *buf */ 659 gThread.stack = (long *) buf;
660
661 ALIGN_BUFFER(gThread.stack, gThread.stacksize, sizeof(long));
662 660
663 if (gThread.stacksize < MIN_THREAD_STACK_SIZE) 661 if (gThread.stacksize < MIN_THREAD_STACK_SIZE)
664 { 662 {