Fix for GNU/Linux emulation.

This commit is contained in:
NIIBE Yutaka
2017-06-26 19:52:19 +09:00
parent 1f7d4a6aac
commit 1fbbf66e8e
4 changed files with 8 additions and 4 deletions

View File

@@ -146,7 +146,7 @@ chx_handle_intr (uint32_t irq_num)
static ucontext_t idle_tc; static ucontext_t idle_tc;
static char idle_stack[4096]; static char idle_stack[4096];
static struct chx_thread main_thread; struct chx_thread main_thread;
void void
chx_sigmask (ucontext_t *uc) chx_sigmask (ucontext_t *uc)
@@ -163,6 +163,7 @@ chx_sigmask (ucontext_t *uc)
static void static void
sigalrm_handler (int sig, siginfo_t *siginfo, void *arg) sigalrm_handler (int sig, siginfo_t *siginfo, void *arg)
{ {
extern void chx_timer_expired (void);
ucontext_t *uc = arg; ucontext_t *uc = arg;
(void)sig; (void)sig;
(void)siginfo; (void)siginfo;
@@ -321,6 +322,7 @@ static struct chx_thread *
chopstx_create_arch (uintptr_t stack_addr, size_t stack_size, chopstx_create_arch (uintptr_t stack_addr, size_t stack_size,
voidfunc thread_entry, void *arg) voidfunc thread_entry, void *arg)
{ {
struct chx_thread *tp;
tp = malloc (sizeof (struct chx_thread)); tp = malloc (sizeof (struct chx_thread));
if (!tp) if (!tp)
chx_fatal (CHOPSTX_ERR_THREAD_CREATE); chx_fatal (CHOPSTX_ERR_THREAD_CREATE);

View File

@@ -1,3 +1,4 @@
#include <ucontext.h>
/* /*
* The thread context: specific to GNU/Linux. * The thread context: specific to GNU/Linux.
* *

View File

@@ -30,7 +30,7 @@ struct chx_qh {
struct chx_pq *next, *prev; struct chx_pq *next, *prev;
}; };
typedef uint32_t chopstx_t; typedef uintptr_t chopstx_t;
typedef uint8_t chopstx_prio_t; typedef uint8_t chopstx_prio_t;
extern chopstx_t chopstx_main; extern chopstx_t chopstx_main;

View File

@@ -35,13 +35,14 @@
#ifdef GNU_LINUX_EMULATION #ifdef GNU_LINUX_EMULATION
int emulated_main (int, const char **); int emulated_main (int, const char **);
void chx_init (void); void chx_init (struct chx_thread *);
void chx_systick_init (void); void chx_systick_init (void);
extern struct chx_thread main_thread;
int int
main (int argc, const char *argv[]) main (int argc, const char *argv[])
{ {
chx_init (); chx_init (&main_thread);
chx_systick_init (); chx_systick_init ();
emulated_main (argc, argv); emulated_main (argc, argv);
} }