From f64ebb1c1f10e8d15fcc4879d781703c86c5fb8b Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Sat, 8 Sep 2007 12:20:53 +0000 Subject: Sim I/O and threading that runs more like on target. Tweakable if any genuine slowness imitation is required for any one of them. One point of concern is the sim shutdown on an OS other than Linux just because terminating threads in a manner other than having the do it themselves is kind of dirty IMHO. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14639 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/thread.h | 10 +++++++--- firmware/include/file.h | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'firmware') diff --git a/firmware/export/thread.h b/firmware/export/thread.h index 2915d23207..19bf9e12fc 100644 --- a/firmware/export/thread.h +++ b/firmware/export/thread.h @@ -76,7 +76,13 @@ struct regs void *start; /* Thread start address, or NULL when started */ }; # endif - +#else +struct regs +{ + void *t; /* Simulator OS thread */ + void *c; /* Condition for blocking and sync */ + void (*start)(void); /* Start function */ +}; #endif /* !SIMULATOR */ #define STATE_RUNNING 0x00000000 @@ -97,9 +103,7 @@ struct regs #define SET_BOOST_STATE(var) (var |= STATE_BOOSTED) struct thread_entry { -#ifndef SIMULATOR struct regs context; -#endif const char *name; void *stack; unsigned long statearg; diff --git a/firmware/include/file.h b/firmware/include/file.h index 989f50a283..9a94e91263 100644 --- a/firmware/include/file.h +++ b/firmware/include/file.h @@ -55,6 +55,8 @@ #define fsync(x) sim_fsync(x) #define ftruncate(x,y) sim_ftruncate(x,y) #define lseek(x,y,z) sim_lseek(x,y,z) +#define read(x,y,z) sim_read(x,y,z) +#define write(x,y,z) sim_write(x,y,z) #endif typedef int (*open_func)(const char* pathname, int flags); -- cgit v1.2.3