Commit graph

180 commits

Author SHA1 Message Date
Boris Gjenero
f4954c4a9b Fix FS#12559: sigaltstack threads fortify failure
Ubuntu defines _FORTIFY_SOURCE=2, which causes glibc longjmp() to check sp
when gcc optimization is enabled. The check does not allow longjmp() to be
used for switching threads and results in a "longjmp causes uninitialized
stack frame" error. This disables the check.

Change-Id: Idb8877b43ce711df880ca88875ba5477445a577a
2012-01-26 20:33:28 -05:00
Thomas Martitz
991ae1e395 Create fimrware/asm directory for assembly optimized stuff.
This dir is suitable for stuff that doesn't fit the target tree, e.g. because
it also builds on hosted or otherwise. It also has a generic subfolder for
fallback C implementations so that not all archs need to provide asm files.

SOURCES should only contain "foo.c" where foo.c includes the specific
<arch>/foo.c files from the subdirs using the preprocessor. This way automatic
selection of asm versions or generic C verion is possible.

For the start, the thread support files are moved, since ASM threads can
be used on hosted platforms as well. Since core_sleep() remains platform
specific it's moved to the corresponding system.h headers.

Change-Id: Iebff272f3407a6eaafeb7656ceb0ae9eca3f7cb9
2012-01-22 18:46:44 +01:00
Michael Sevakis
6a67707b5e Commit to certain names for cache coherency APIs and discard the aliases.
Wouldn't surprise me a bit to get some non-green.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31339 a1c6a512-1295-4272-9138-f99709370657
2011-12-17 07:27:24 +00:00
Boris Gjenero
8906b3e659 Convert remaining __attribute__((noreturn)) to NORETURN_ATTR.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31189 a1c6a512-1295-4272-9138-f99709370657
2011-12-09 16:13:03 +00:00
Boris Gjenero
59e71ee80c Introduce USED_ATTR wrapper for __attribute__((used)).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31188 a1c6a512-1295-4272-9138-f99709370657
2011-12-09 15:33:59 +00:00
Boris Gjenero
d51e598335 FS#12412 : Delete old buffer allocation code which has been replaced by core_alloc, and move buffer setup code to core_alloc.c
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31088 a1c6a512-1295-4272-9138-f99709370657
2011-11-29 00:42:27 +00:00
Thomas Martitz
cc889e9d60 Change the thread api a bit.
* Remove THREAD_ID_CURRENT macro in favor of a thread_self() function, this allows thread functions to be simpler.
* thread_self_entry() shortcut for kernel.c.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29521 a1c6a512-1295-4272-9138-f99709370657
2011-03-05 17:48:06 +00:00
Thomas Martitz
70bb128ae9 Cleanup preprocessor around corelock usage and move its definition outside #ifdef ASSEMBLER_THREADS
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29330 a1c6a512-1295-4272-9138-f99709370657
2011-02-19 00:09:08 +00:00
Thomas Martitz
1e391fbdbc Fix yellows and checkwps.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29328 a1c6a512-1295-4272-9138-f99709370657
2011-02-18 23:17:07 +00:00
Thomas Martitz
6d85de3419 Implement cooperative threads on hosted platforms using C code.
This replaces SDL threads with real cooperative threads, which are less cpu intensive and allow priority scheduling.
The backend for context switching is dependant on the host (sigaltstack/longjmp on Unix, Fibers on Windows).
configure has options to force or disallow SDL threads.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29327 a1c6a512-1295-4272-9138-f99709370657
2011-02-18 22:46:01 +00:00
Michael Sevakis
fd58f426d3 Return thread ID as a string for name when a thread isn't named or name cannot be used, as comment says, not slot pointer.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28928 a1c6a512-1295-4272-9138-f99709370657
2010-12-29 20:03:47 +00:00
Michael Sevakis
5ea9bf39b8 Comment about thread_id_entry missleading and wrong. Fix the dumb.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28918 a1c6a512-1295-4272-9138-f99709370657
2010-12-28 14:24:13 +00:00
Nils Wallménius
b8bf7cb5ed Move codfire inline asm into cpu specific file.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28910 a1c6a512-1295-4272-9138-f99709370657
2010-12-27 10:22:39 +00:00
Nils Wallménius
479414facc Fix profiling on coldfire with newer Gcc.
In switch_thread, make the call to profile_thread_stopped from an inline asm block to make sure the sp is pointing to the right place before storing the context. This apparently worked by luck with the old Gcc.
The workaround used for coldfire in the codeclib's __cyg_profile_func_enter does not work with newer gcc, however the workaround isn't needed for those so enable it only for coldfire gcc version < 4.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28908 a1c6a512-1295-4272-9138-f99709370657
2010-12-27 09:49:33 +00:00
Frank Gevaerts
8ff4f1aec9 Add optional (define BUFFER_ALLOC_DEBUG to enable it) code to check for code overflowing buffer_alloc()-allocated buffers.
Also add a panicf() if buffer_alloc() doesn't have enough space left to allocate a requested buffer


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28173 a1c6a512-1295-4272-9138-f99709370657
2010-09-26 12:05:42 +00:00
Thomas Martitz
240923a801 Rockbox as an application: Commit current Android port progress.
General state is: Rockbox is usable (plays music, saves configuration, touchscreen works too).
Problems:
 - Playing music in the background (i.e. when switching to another app) doesn't work reliably, but I'm working on that now.
 - no cabbiev2 (only some preliminary files for it), no other default theme.
 - screen flickers sometimes if the updates are too frequent
 - no multi screen apk/package
 - strange behavior when a phone call comes in

The java files (and the eclipse project) resides in android/, which is also supposed to be the build folder.
I've put a small README in there for instructions. There are some steps needed after the make part, which are described there,
and which eclipse mostly handles. But there ought to be some script/makefile rules which do that instead in the future.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27668 a1c6a512-1295-4272-9138-f99709370657
2010-08-02 20:34:47 +00:00
Michael Sevakis
d9c9fe305c For multiprocessor targets, do the thread_exit routine such that we don't need to rely on the compiler's good graces to have stack switching be reliable. Only needs a few asm instructions.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26906 a1c6a512-1295-4272-9138-f99709370657
2010-06-18 03:10:18 +00:00
Michael Sevakis
6020075551 Fix red. Need 'inline' with 'always_inline'.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26899 a1c6a512-1295-4272-9138-f99709370657
2010-06-17 20:29:59 +00:00
Michael Sevakis
2b640ba4b8 Switch iPod 3G to use EABI toolchain. Make necessary threading changes to avoid use of stack after switching to idle stack.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26898 a1c6a512-1295-4272-9138-f99709370657
2010-06-17 20:15:58 +00:00
Michael Sevakis
555ad6710f Threading: Split processor support code into respective target files. C files from /target/xxx are included into thread.c because of essential inlining and files are code, not declarations. Copyrights in each new file go to whoever implemented the first functional support.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26479 a1c6a512-1295-4272-9138-f99709370657
2010-06-02 12:45:36 +00:00
Michael Sevakis
90ea991dff i.MX31: Issue some NOP's immediately after MCR WFI to prevent premature execution of subsequent code.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26058 a1c6a512-1295-4272-9138-f99709370657
2010-05-15 15:51:47 +00:00
Thomas Martitz
50a6ca39ad Move c/h files implementing/defining standard library stuff into a new libc directory, also standard'ify some parts of the code base (almost entirely #include fixes).
This is to a) to cleanup firmware/common and firmware/include a bit, but also b) for Rockbox as an application which should use the host system's c library and headers, separating makes it easy to exclude our files from the build.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25850 a1c6a512-1295-4272-9138-f99709370657
2010-05-06 21:04:40 +00:00
Michael Sevakis
2f02d62234 Fix red from r25666 (forgot to use macro to not use core variable on single core), update a comment and remove core check for setting THREAD_SWITCH upon wakeup which is irrelevant to the idea behind the change.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25667 a1c6a512-1295-4272-9138-f99709370657
2010-04-18 10:03:25 +00:00
Michael Sevakis
d6cd1bc58e Threads of PRIORITY_REALTIME and above are no longer subject to being switched away based upon aging of lower priority threads. Now, recommend a thread switch in wakeup_thread of any thread of higher priority is ready to run.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25666 a1c6a512-1295-4272-9138-f99709370657
2010-04-18 09:43:59 +00:00
Thomas Martitz
d9af87c40b Use API call instead of accessing a global variable for receiving the current thread.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25657 a1c6a512-1295-4272-9138-f99709370657
2010-04-16 22:01:59 +00:00
Frank Gevaerts
376d8d577f Add IO priority handling. Currently all IO has equal priority, except the dircache scanning thread which is lower. This fixes the slow boot problem for me, with the added benefit that actual audio playback also starts faster.
Lots of the changes are due to changing storage_(read|write)sectors() from macros to wrapper functions. This means that they have to be called with IF_MD2(drive,) again.

Flyspray: FS#11167
Author: Frank Gevaerts


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25459 a1c6a512-1295-4272-9138-f99709370657
2010-04-03 22:02:09 +00:00
Thomas Martitz
f8edc32589 FS#10756 - Free unused init code
Introduce a new .init section for initialisation code, so that it can be copied to an area which is later overwritten before calling. The stack/bss can then overwrite that code, effectively freeing the code size that the initialisation routines need. Gives a few kB ram usage back.
Only implemented for PP and as3525 so far. More targets could be added, as well as more functions.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25013 a1c6a512-1295-4272-9138-f99709370657
2010-03-03 23:20:32 +00:00
Rafaël Carré
054253ab33 as3525v2: core_sleep()
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24839 a1c6a512-1295-4272-9138-f99709370657
2010-02-22 02:42:50 +00:00
Andrew Mahone
36deb0a315 Fix warning on new gcc for checking value or truth of undefined _WIN32 and MIPS.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23670 a1c6a512-1295-4272-9138-f99709370657
2009-11-20 02:51:10 +00:00
Michael Sparmann
efe0dd723f "Implement" S5L8701 core_sleep
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23081 a1c6a512-1295-4272-9138-f99709370657
2009-10-10 22:02:22 +00:00
Jens Arnold
36eeecbe9a * Fix overlooked r12 usage possibility in mpegplayer ARM idct
* ARM dualcore: Don't save r12 in switch_thread_core()


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21830 a1c6a512-1295-4272-9138-f99709370657
2009-07-12 22:43:24 +00:00
Maurus Cuelenaere
580b1a5c4b MIPS: don't save gp register when switching threads
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20863 a1c6a512-1295-4272-9138-f99709370657
2009-05-06 19:51:34 +00:00
Maurus Cuelenaere
c606fd04c8 Jz4740:
* Optimize & cleanup thread handling a bit
 * Unify exception return and fix a potential bug


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20659 a1c6a512-1295-4272-9138-f99709370657
2009-04-08 14:30:33 +00:00
Michael Sevakis
84f8b0be2c s3c2440 can use the generic ARM WFI which is much simpler. If there's any advantage to setting the IDLE bit for power consumption, it's possible to combine its use with the old core_sleep instead of using the loop waiting for idle to kick in. For now, go basic. Let GCC choose the register for MCR instead of forcing it to r0.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19978 a1c6a512-1295-4272-9138-f99709370657
2009-02-11 19:28:02 +00:00
Michael Sevakis
21f0c9a282 Make basic cache functions into calls, and get rid of CACHE_FUNCTION_WRAPPERS and CACHE_FUNCTIONS_AS_CALL macros. Rename flush/invalidate_icache to cpucache_flush/invalidate. They're inlined only if an implementation isn't provided by defining HAVE_CPUCACHE_FLUSH/INVALIDATE.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19971 a1c6a512-1295-4272-9138-f99709370657
2009-02-11 12:55:51 +00:00
Maurus Cuelenaere
0df38260e8 Enable sleep() on MIPS targets
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19493 a1c6a512-1295-4272-9138-f99709370657
2008-12-19 23:35:42 +00:00
Michael Sevakis
0fab3e36f3 Place some LIKELY and UNLIKELY hints in kernel where I can definitively say anything about it and where it could make a small difference.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19433 a1c6a512-1295-4272-9138-f99709370657
2008-12-14 07:09:26 +00:00
Michael Sevakis
441fca176a Fix a wrong comment in thread.c and mention an alternative approach to inits. Fix a couple headers' Id fields while at it.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19386 a1c6a512-1295-4272-9138-f99709370657
2008-12-10 21:10:34 +00:00
Michael Sevakis
8cfbd3604f Use cookies for thread identification instead of pointers directly which gives a buffer against wrongly identifying a thread when the slot is recycled (which has been nagging me for awhile). A slot gets 255 uses before it repeats. Everything gets incompatible so a full update is required.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19377 a1c6a512-1295-4272-9138-f99709370657
2008-12-10 08:57:10 +00:00
Rafaël Carré
22ae232db2 core_sleep(): only write once the same implementation, and add as3525 to the list
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19057 a1c6a512-1295-4272-9138-f99709370657
2008-11-09 23:56:54 +00:00
Maurus Cuelenaere
1e8be6f6b0 Onda VX747:
clean up's, bug fixes and reworks


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19007 a1c6a512-1295-4272-9138-f99709370657
2008-11-04 20:30:01 +00:00
Maurus Cuelenaere
9003c116ca Fix TABs and get rid of HAVE_BUTTON_HOLD
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18737 a1c6a512-1295-4272-9138-f99709370657
2008-10-07 20:23:56 +00:00
Rob Purchase
1a08f46329 Commit fs#9404 (iAudio 7 updates by vitja). Also fixes play/pause behaviour on D2.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18528 a1c6a512-1295-4272-9138-f99709370657
2008-09-16 08:09:44 +00:00
Maurus Cuelenaere
ebe652b51a Forgot this..
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18513 a1c6a512-1295-4272-9138-f99709370657
2008-09-14 16:28:35 +00:00
Maurus Cuelenaere
1e294e3f25 Onda VX747:
* Get rid of bug when interrupts are enabled
 * Get threading to work (although with some weirdness)
 * Other fixes/optimizations


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18512 a1c6a512-1295-4272-9138-f99709370657
2008-09-14 16:26:08 +00:00
Maurus Cuelenaere
88ae9024e4 * Add basic (non-working) support for NAND flash
* Add panicf() handling
* Add not-yet-enabled dma acceleration
* Other (minor) fixes


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18203 a1c6a512-1295-4272-9138-f99709370657
2008-08-06 20:39:02 +00:00
Maurus Cuelenaere
1f692e5f55 1) Set svn:keywords where they should've been set
2) Onda VX747 specific changes


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18080 a1c6a512-1295-4272-9138-f99709370657
2008-07-17 10:13:56 +00:00
Maurus Cuelenaere
0709f0a5c6 Add preliminary support for the Onda VX747 (MIPS target)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18032 a1c6a512-1295-4272-9138-f99709370657
2008-07-14 15:03:10 +00:00
Daniel Stenberg
2acc0ac542 Updated our source code header to explicitly mention that we are GPL v2 or
later. We still need to hunt down snippets used that are not. 1324 modified
files...
http://www.rockbox.org/mail/archive/rockbox-dev-archive-2008-06/0060.shtml


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17847 a1c6a512-1295-4272-9138-f99709370657
2008-06-28 18:10:04 +00:00
Michael Sevakis
606d9d0c83 Reinstate the awful ATA hack that has no proper reason to exist for iPod 5.5g 60GB and/or 80GB.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17682 a1c6a512-1295-4272-9138-f99709370657
2008-06-03 04:23:09 +00:00