From 25e5f218474fdf0d304ff62ed3716e0b4abcc3d2 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka <gniibe@fsij.org> Date: Tue, 8 Mar 2016 20:27:24 +0900 Subject: AAPCS stack alignment --- ChangeLog | 10 ++++++++++ chopstx.c | 7 ++++--- chopstx.h | 4 ++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index dbfd7d1..d850bfe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2016-03-08 Niibe Yutaka <gniibe@fsij.org> + + * chopstx.h (CHOPSTX_THREAD_SIZE): Align by 8. + * chopstx.c (struct chx_thread): Add W field to align. This is to + comply AAPCS (ARM Architecture Procedure Call Standard). + (chx_init): Initialize W. + + * example-cdc/{usb_stm32f103.c,usb_lld.h}: Update from Gnuk. + * example-cdc/usb-cdc.c: Update. + 2015-11-05 Niibe Yutaka <gniibe@fsij.org> * example-cdc/sample.c: Enhanced to be echo service. diff --git a/chopstx.c b/chopstx.c index 7868ae2..6d25269 100644 --- a/chopstx.c +++ b/chopstx.c @@ -1,7 +1,8 @@ /* * chopstx.c - Threads and only threads. * - * Copyright (C) 2013, 2014, 2015 Flying Stone Technology + * Copyright (C) 2013, 2014, 2015, 2016 + * Flying Stone Technology * Author: NIIBE Yutaka <gniibe@fsij.org> * * This file is a part of Chopstx, a thread library for embedded. @@ -291,7 +292,7 @@ struct chx_thread { uint32_t : 7; uint32_t prio_orig : 8; uint32_t prio : 8; - uint32_t v; + uint32_t v, w; struct chx_mtx *mutex_list; struct chx_cleanup *clp; }; @@ -639,7 +640,7 @@ chx_init (struct chx_thread *tp) tp->flag_detached = (CHX_FLAGS_MAIN & CHOPSTX_DETACHED)? 1 : 0; tp->prio_orig = CHX_PRIO_MAIN_INIT; tp->prio = 0; - tp->v = 0; + tp->v = tp->w = 0; running = tp; if (CHX_PRIO_MAIN_INIT >= CHOPSTX_PRIO_INHIBIT_PREEMPTION) diff --git a/chopstx.h b/chopstx.h index cc8ae46..3ceda89 100644 --- a/chopstx.h +++ b/chopstx.h @@ -1,7 +1,7 @@ /* * chopstx.h - Threads and only threads. * - * Copyright (C) 2013 Flying Stone Technology + * Copyright (C) 2013, 2016 Flying Stone Technology * Author: NIIBE Yutaka <gniibe@fsij.org> * * This file is a part of Chopstx, a thread library for embedded. @@ -135,4 +135,4 @@ void chopstx_cleanup_pop (int execute); void chopstx_wakeup_usec_wait (chopstx_t thd); -#define CHOPSTX_THREAD_SIZE 60 +#define CHOPSTX_THREAD_SIZE 64 -- cgit v1.2.3