Battery_bench & announce_status stack fix

had stack growing the wrong way

Change-Id: I51bf14526f5239e77e15dc0ffd76ad3ed8bdcbc8
This commit is contained in:
William Wilgus 2020-08-15 09:57:10 -04:00
parent a9ac2d0ba3
commit 84bfd68fb5
2 changed files with 4 additions and 6 deletions

View file

@ -438,7 +438,7 @@ void plugin_buffer_init(void)
{ {
rb->memset(&gThread, 0, sizeof(gThread)); rb->memset(&gThread, 0, sizeof(gThread));
gThread.buf = rb->plugin_get_buffer(&gThread.buf_size); gThread.buf = rb->plugin_get_buffer(&gThread.buf_size);
ALIGN_BUFFER(gThread.buf, gThread.buf_size, 4); ALIGN_BUFFER(gThread.buf, gThread.buf_size, sizeof(long));
} }
} }
@ -448,9 +448,9 @@ void thread_create(void)
gThread.stacksize = gThread.buf_size; gThread.stacksize = gThread.buf_size;
gThread.buf_size -= gThread.stacksize; gThread.buf_size -= gThread.stacksize;
gThread.stack = (long *) gThread.buf + gThread.buf_size; gThread.stack = (long *) gThread.buf;
ALIGN_BUFFER(gThread.stack, gThread.stacksize, 4); ALIGN_BUFFER(gThread.stack, gThread.stacksize, sizeof(long));
if (gThread.stacksize < DEFAULT_STACK_SIZE) if (gThread.stacksize < DEFAULT_STACK_SIZE)
{ {

View file

@ -656,9 +656,7 @@ enum plugin_status plugin_start(const void* parameter)
rb->memset(buf, 0, buf_size); rb->memset(buf, 0, buf_size);
gThread.stacksize = buf_size; gThread.stacksize = buf_size;
gThread.stack = (long *) buf + buf_size; /* stack grows towards *buf */ gThread.stack = (long *) buf;
ALIGN_BUFFER(gThread.stack, gThread.stacksize, sizeof(long));
if (gThread.stacksize < MIN_THREAD_STACK_SIZE) if (gThread.stacksize < MIN_THREAD_STACK_SIZE)
{ {