summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2017-06-26 19:52:19 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2017-06-26 19:52:19 +0900
commit1fbbf66e8ea4bf57ff4a95188142e92f942f4d99 (patch)
treea76bbc07995b39149180840ce65af485ddb7de77
parent1f7d4a6aac0bfe45ac140545655f7e3b989d5062 (diff)
Fix for GNU/Linux emulation.
-rw-r--r--chopstx-gnu-linux.c4
-rw-r--r--chopstx-gnu-linux.h1
-rw-r--r--chopstx.h2
-rw-r--r--entry.c5
4 files changed, 8 insertions, 4 deletions
diff --git a/chopstx-gnu-linux.c b/chopstx-gnu-linux.c
index b7b6767..078f0db 100644
--- a/chopstx-gnu-linux.c
+++ b/chopstx-gnu-linux.c
@@ -146,7 +146,7 @@ chx_handle_intr (uint32_t irq_num)
static ucontext_t idle_tc;
static char idle_stack[4096];
-static struct chx_thread main_thread;
+struct chx_thread main_thread;
void
chx_sigmask (ucontext_t *uc)
@@ -163,6 +163,7 @@ chx_sigmask (ucontext_t *uc)
static void
sigalrm_handler (int sig, siginfo_t *siginfo, void *arg)
{
+ extern void chx_timer_expired (void);
ucontext_t *uc = arg;
(void)sig;
(void)siginfo;
@@ -321,6 +322,7 @@ static struct chx_thread *
chopstx_create_arch (uintptr_t stack_addr, size_t stack_size,
voidfunc thread_entry, void *arg)
{
+ struct chx_thread *tp;
tp = malloc (sizeof (struct chx_thread));
if (!tp)
chx_fatal (CHOPSTX_ERR_THREAD_CREATE);
diff --git a/chopstx-gnu-linux.h b/chopstx-gnu-linux.h
index cce34f1..aaa93d4 100644
--- a/chopstx-gnu-linux.h
+++ b/chopstx-gnu-linux.h
@@ -1,3 +1,4 @@
+#include <ucontext.h>
/*
* The thread context: specific to GNU/Linux.
*
diff --git a/chopstx.h b/chopstx.h
index 026a185..d926415 100644
--- a/chopstx.h
+++ b/chopstx.h
@@ -30,7 +30,7 @@ struct chx_qh {
struct chx_pq *next, *prev;
};
-typedef uint32_t chopstx_t;
+typedef uintptr_t chopstx_t;
typedef uint8_t chopstx_prio_t;
extern chopstx_t chopstx_main;
diff --git a/entry.c b/entry.c
index 3c3a26a..29d520d 100644
--- a/entry.c
+++ b/entry.c
@@ -35,13 +35,14 @@
#ifdef GNU_LINUX_EMULATION
int emulated_main (int, const char **);
-void chx_init (void);
+void chx_init (struct chx_thread *);
void chx_systick_init (void);
+extern struct chx_thread main_thread;
int
main (int argc, const char *argv[])
{
- chx_init ();
+ chx_init (&main_thread);
chx_systick_init ();
emulated_main (argc, argv);
}