Commit graph

128 commits

Author SHA1 Message Date
Max Horn
7ace85e636 PLUGINS: Simplify ELF plugin providers & DLObject subclasses
* Remove DLObject virtual methods allocSegment and freeSegment.
  As long as all DLObject implementations use memalign + free to
  allocate/release segments, there is no point in wrapping those.
  This enables further simplifications.
* Add TemplatedELFPlugin template class. Use this instead of explicit
  ELFPlugin subclasses.
* Rename DLObject::discard_symtab to discardSymtab

svn-id: r54082
2010-11-05 01:20:34 +00:00
Max Horn
102e7ee88c PLUGINS: Add EM_SH to elf32.h (e_machine type used by DC backend)
svn-id: r54081
2010-11-05 01:19:45 +00:00
Yotam Barnoy
f5bfae598c PSP: cleaning up some stuff from plugin merge
svn-id: r54060
2010-11-04 06:28:34 +00:00
Max Horn
99cf0e3936 COMMON: Undo changes to common/ptr.h, remove Common::ScopedPtrC
The deletePointer() method approach cannot work, as it is called
by the destructor of the base class.
A possible correct solution would be to enhance ScopedPtr with a
"deleter" object like SharedPtr. But this seems overkill as long as we
need it in only one place.

svn-id: r54057
2010-11-04 00:49:12 +00:00
Yotam Barnoy
13b904d282 Merge from gsoc2010-plugins
This merge was extremely difficult to carry out. It wasn't entirely SVN's fault -- there were several merges to the branch that were done by hand. Please check for any issues and regressions. Also note that the DS makefile was not copied over since the "one at a time" plugin mode currently has too much fragmentation ie. it doesn't work.

svn-id: r54051
2010-11-03 22:01:01 +00:00
Yotam Barnoy
e56a3747d2 Dummy file creation through SVN to allow merging gsoc plugins via mercurial
svn-id: r54046
2010-11-03 06:23:16 +00:00
Yotam Barnoy
94c8d0a14d Updated with latest from trunk
svn-id: r53976
2010-10-31 11:08:43 +00:00
Max Horn
6ea76cd913 SDL: Fix SDL plugin provider code (used e.g. by Dingux port)
svn-id: r53968
2010-10-30 23:53:30 +00:00
Yotam Barnoy
8df4278ba8 PLUGINS: fixed issue with R_MIPS_32 relocations
Caused crash in some games. The problem was referring to the right segment. R_MIPS_32 relocations can be found in the Shorts segment, but still need to refer to the main segment if the symbol is found there.

svn-id: r52750
2010-09-16 17:37:54 +00:00
Yotam Barnoy
09cb941690 PLUGINS: Fix function arguments in MIPS loader
Derived virtual function wasn't overwriting base function.

svn-id: r52749
2010-09-16 17:37:31 +00:00
Andre Heider
2596143e2b PLUGINS: Additional plugin check for the ELF loader.
The ELF loader does not have access to the symbols of the main
executable, it just relocates symbols to it via fixed offsets. We need
to make sure that loaded plugins are from the same link process to
prevent crashes. An embedded build date is used for that.

svn-id: r52730
2010-09-15 07:44:08 +00:00
Andre Heider
41834499ed PLUGINS: Cleanup.
- Unify ELF loader handling in configure
- Rename ELF_LOADER_TARGET to USE_ELF_LOADER

svn-id: r52728
2010-09-15 07:43:16 +00:00
Andre Heider
83a931dac0 PLUGINS: Only resolve __dso_handle if loading was successful.
svn-id: r52612
2010-09-06 22:17:46 +00:00
Andre Heider
d3ea6265ba PLUGINS: Formatting.
svn-id: r52611
2010-09-06 22:17:23 +00:00
Andre Heider
ae408db07f PLUGINS: Use the C++ ABI to call dtors when unloading a plugin.
Avoid linking all plugins against libstdc++ to free up some memory
(about ~40kb on Wii per plugin). Enable it on GameCube, Wii, DS and PSP
(PS2 doesn't have __cxa_atexit support in its libc).

svn-id: r52607
2010-09-06 20:34:00 +00:00
Yotam Barnoy
c2cafe426e PLUGINS: used variation of ScopedPtr to clean up load() function
svn-id: r52592
2010-09-06 13:31:27 +00:00
Yotam Barnoy
b77fd21969 PLUGINS: fixed MIPS plugin loader
Adjusted to new VMA handling and fixed a few errors which caused crashes. Also removed unneeded expansion of alignment value.

svn-id: r52589
2010-09-06 12:04:30 +00:00
Yotam Barnoy
a3190a5bb5 PLUGINS: added missing call in destructor which caused crashing
svn-id: r52588
2010-09-06 12:03:15 +00:00
Andre Heider
cd5e62bbe8 PLUGINS: Added _segmentVMA to the MIPS loader.
Also added 2 TODOs for all loaders not respection that offset.

svn-id: r52577
2010-09-05 22:00:41 +00:00
Andre Heider
364acaae45 PLUGINS: Remove spurious extra allocation.
Elf32_Phdr.p_align is to align the memory location of the loaded
segment, not to extend its size. The size of the scratch area
(like .bss and .sbss) is p_memsz-p_filesz, which has to be set to
zero by the loader.

svn-id: r52576
2010-09-05 22:00:19 +00:00
Andre Heider
4c7f5084c2 PLUGINS: Plug some memleaks.
svn-id: r52575
2010-09-05 21:59:50 +00:00
Andre Heider
a4c9de25e6 PLUGINS: Move doxygen to the base class header.
No point in documenting it on every derived class.

svn-id: r52574
2010-09-05 21:59:29 +00:00
Andre Heider
a318934e45 PLUGINS: Add missing variable initialization.
svn-id: r52573
2010-09-05 21:59:07 +00:00
Andre Heider
d8b85ffcb8 PLUGINS: Formatting.
Misformatted casts in an earier commit, oops.

svn-id: r52572
2010-09-05 21:58:45 +00:00
Andre Heider
8889f4c5ad PLUGINS: Set svn:keywords property on all new files.
svn-id: r52566
2010-09-05 15:47:04 +00:00
Andre Heider
402c71860f PLUGINS: Make the file stream a member of DLObject.
No point in passing it to functions all over the place. Release the
stream when it's not required anymore.

svn-id: r52558
2010-09-05 12:53:15 +00:00
Andre Heider
3b2a9734d1 PLUGINS: Type cleanup.
Use our types, get rid of some casts.

svn-id: r52557
2010-09-05 12:52:49 +00:00
Andre Heider
c4a88559a5 PLUGINS: Move platform specific code out of the generic ELF loader.
Instead overwrite pure virtual functions in a backend specific class.

svn-id: r52556
2010-09-05 12:52:17 +00:00
Andre Heider
86f4dbd956 PLUGINS: Move all ELF loader related files to its own directory.
svn-id: r52555
2010-09-05 12:51:25 +00:00
Andre Heider
13770ce9cd PLUGINS: Plugin support for the GameCube/Wii backend.
svn-id: r52553
2010-09-05 12:49:29 +00:00
Andre Heider
5986aa96f2 PLUGINS: Formatting.
svn-id: r52552
2010-09-05 12:39:28 +00:00
Andre Heider
c5a189f4d5 PLUGINS: Respect the VMA when relocating.
Plugins do not have to be linked at 0x0. Some platforms have limited
relocation jump offsets, which makes 0x0 unusable.

svn-id: r52551
2010-09-05 12:38:58 +00:00
Andre Heider
ee2f4ef189 PLUGINS: Properly check the ELF header.
The ELFMAG is only 4 bytes, not 6. Properly check for endianess.

svn-id: r52550
2010-09-05 12:38:38 +00:00
Andre Heider
628842d457 PLUGINS: The VMA doesn't get added to any PHDR.
svn-id: r52549
2010-09-05 12:38:18 +00:00
Andre Heider
253a0aa7f9 PLUGINS: Fix warnings.
svn-id: r52548
2010-09-05 12:37:59 +00:00
Andre Heider
07e3a42224 PLUGINS: Cleanup includes and debug output.
Use the common debug functions instead of spamming #defines.

svn-id: r52547
2010-09-05 12:37:36 +00:00
Andre Heider
2c746709aa PLUGINS: Flush only memory ranges, not everything
svn-id: r52546
2010-09-05 12:37:07 +00:00
Andre Heider
ff1b64937a PLUGINS: Fix warnings and unnecessary casts.
svn-id: r52439
2010-08-29 11:14:14 +00:00
Yotam Barnoy
8fb92b9e2a PSP: made PSP compile with plugins.
Also removed criticalSection calls from elf-loader.cpp, since now streams are used so the criticalSections are automatic.

svn-id: r52206
2010-08-19 11:18:01 +00:00
Yotam Barnoy
3ece67d1b8 PLUGINS: added virtual destructor to DLObject
This could be really important. Maybe.

svn-id: r52205
2010-08-19 11:17:17 +00:00
Tony Puccinelli
8f7de9974f Added doxygen comments for a few different plugin-related classes
svn-id: r52124
2010-08-16 16:32:06 +00:00
Tony Puccinelli
34b5eb3ba3 added a todo to plugins.cpp and a comment to elf32.h; Collapsed plugin providers for a few ports into their .h files, removing the corresponding .cpp files
svn-id: r52112
2010-08-16 08:41:04 +00:00
Tony Puccinelli
2cd99b449f refactored NEW_PLUGIN_DESIGN_FIRST_REFINEMENT define into ONE_PLUGIN_AT_A_TIME
svn-id: r52058
2010-08-13 05:58:11 +00:00
Tony Puccinelli
62d8126df0 added appropriate ifdefs throughout the plugins directory
svn-id: r52053
2010-08-13 02:58:52 +00:00
Tony Puccinelli
139a96182d modified DS makefile to use new plugin design where only one plugin is loaded at a time and tested successfully on the DS. Added code to prevent a crash in the case where there are no engine plugins present. Removed code for R_ARM_TARGET1 in arm-loader, as it is no longer used and was never used successfully
svn-id: r52052
2010-08-12 23:55:12 +00:00
Tony Puccinelli
682807f0e9 merged trunk into branch, reverted Cruise Singleton changes
svn-id: r51961
2010-08-10 23:21:08 +00:00
Tony Puccinelli
9cf5dedca5 got rid of rest of leftover stuff from GP2X-WIZ elf-loader attempt
svn-id: r51846
2010-08-07 22:30:18 +00:00
Tony Puccinelli
de1e941370 refined constructors, removed destructors, got rid of unneccessary method duplication in DLObject and its subtypes
svn-id: r51845
2010-08-07 22:27:23 +00:00
Tony Puccinelli
68b986545a added necessary files I forgot to commit yesterday (whoops...) for mips and arm loaders
svn-id: r51843
2010-08-07 21:47:50 +00:00
Tony Puccinelli
d6adeb9ccf took out hacky 'ifdef MIPS_TARGET' statements in DLObject's methods and instead overrode those methods in MIPSDLObject
svn-id: r51827
2010-08-07 06:15:57 +00:00