AAPCS stack alignment

This commit is contained in:
NIIBE Yutaka
2016-03-08 20:27:24 +09:00
parent 90ac7f7c13
commit 25e5f21847
3 changed files with 16 additions and 5 deletions

View File

@@ -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> 2015-11-05 Niibe Yutaka <gniibe@fsij.org>
* example-cdc/sample.c: Enhanced to be echo service. * example-cdc/sample.c: Enhanced to be echo service.

View File

@@ -1,7 +1,8 @@
/* /*
* chopstx.c - Threads and only threads. * 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> * Author: NIIBE Yutaka <gniibe@fsij.org>
* *
* This file is a part of Chopstx, a thread library for embedded. * This file is a part of Chopstx, a thread library for embedded.
@@ -291,7 +292,7 @@ struct chx_thread {
uint32_t : 7; uint32_t : 7;
uint32_t prio_orig : 8; uint32_t prio_orig : 8;
uint32_t prio : 8; uint32_t prio : 8;
uint32_t v; uint32_t v, w;
struct chx_mtx *mutex_list; struct chx_mtx *mutex_list;
struct chx_cleanup *clp; 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->flag_detached = (CHX_FLAGS_MAIN & CHOPSTX_DETACHED)? 1 : 0;
tp->prio_orig = CHX_PRIO_MAIN_INIT; tp->prio_orig = CHX_PRIO_MAIN_INIT;
tp->prio = 0; tp->prio = 0;
tp->v = 0; tp->v = tp->w = 0;
running = tp; running = tp;
if (CHX_PRIO_MAIN_INIT >= CHOPSTX_PRIO_INHIBIT_PREEMPTION) if (CHX_PRIO_MAIN_INIT >= CHOPSTX_PRIO_INHIBIT_PREEMPTION)

View File

@@ -1,7 +1,7 @@
/* /*
* chopstx.h - Threads and only threads. * 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> * Author: NIIBE Yutaka <gniibe@fsij.org>
* *
* This file is a part of Chopstx, a thread library for embedded. * 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); void chopstx_wakeup_usec_wait (chopstx_t thd);
#define CHOPSTX_THREAD_SIZE 60 #define CHOPSTX_THREAD_SIZE 64