Commit Graph

132 Commits

Author SHA1 Message Date
Axel Dörfler
e73923b0c2 * Renamed static recursive lock variables to match our coding style guidelines.
* Renamed runtime loader semphore to something clearer.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27623 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-09-18 14:01:29 +00:00
Axel Dörfler
9a6072a35f * Resolved TODO added by Ingo: the runtime loader now lazily updates its
image IDs when needed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27611 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-09-18 08:04:29 +00:00
Ingo Weinhold
cbc456de3b Added TODO regarding updating the image ID's after fork().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27604 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-09-17 22:56:18 +00:00
Axel Dörfler
320bd2bd5a * More specific error message when relocating fails.
* Whitespace cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27031 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-18 11:03:50 +00:00
Axel Dörfler
b5753dd7c9 * Added a __swap_int32() function to the runtime_loader - this fixes the build,
since KMessage needs it now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26366 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-10 11:52:57 +00:00
Ingo Weinhold
2965c99fea * Changed the _kern_exec() and _kern_load_image() syscalls. They expect
a flattened argument/environment buffer now. This simplifies the work
  for the kernel a bit, since it can just copy the buffer and check
  whether it looks OK instead of messing around with individual strings.
  The runtime loader also gets a flattened array.
* Set the maximum size of the arguments/environment buffer to 128 KB.
  When more arguments are passed, we fail with a proper error code
  (instead of just truncating the arguments as before).
* On exec*() the first argument was silently replaced by the given path
  name, which is not correct.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26119 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-24 03:37:07 +00:00
François Revol
7e60c269dc m68k runtime loader code, not sure it works.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26103 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-23 15:31:51 +00:00
Ingo Weinhold
2a33a944e5 Don't spam to the standard output when not finding a symbol.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25784 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-03 15:05:16 +00:00
Ingo Weinhold
61b37794a4 Added explicit support for loading executables compiled with the
respectively other gcc version on a Haiku compiled with gcc 2 or gcc 4.
The libraries for such an executable are first searched in "gcc4"
respectively "gcc2" subdirectories of the standard search path
directories. If not found there, we try again with the standard paths.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25532 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-17 23:25:17 +00:00
Ingo Weinhold
6b202f4e3d * Introduced new header directory headers/private/system which is supposed
to contain headers shared by kernel and userland (mainly libroot).
* Moved quite a few private kernel headers to the new location. Split
  several kernel headers into a shared part and one that is still kernel
  private. Adjusted all affected Jamfiles and source in the standard x86
  build accordingly. The build for other architectures and for test code
  may be broken.
* Quite a bit of userland code still includes private kernel headers.
  Mostly those are <util/*> headers. The ones that aren't strictly
  kernel-only should be moved to some other place (maybe
  headers/private/shared/util).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25486 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-14 03:55:16 +00:00
Ingo Weinhold
3560b757c2 Fixed warning.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25438 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-10 22:22:08 +00:00
Ingo Weinhold
5d0638bf88 Changed FATAL macro to always dprintf() the error. Additionally it still
prints to stdout, but only until the program and its dependencies are
loaded. Failed attempts to load add-ons and the like doesn't pollute
stdout anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25437 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-10 22:21:52 +00:00
Ingo Weinhold
6bf15ffcdc * Changed macros that enable tracing for individual components from
defined/undefined to numeric values (0 for undefined). This allows for
  trace levels.
* Set SYSCALL_TRACING_IGNORE_KTRACE_OUTPUT default to 1, since this is
  what one usually wants.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25213 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-27 14:24:18 +00:00
Ingo Weinhold
0efc7a1ed7 Temporarily added the /boot/home/config/* paths to the executable,
library, and add-on search paths. Can be removed again, when certain
optional packages have been moved to /boot/common.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25194 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-26 20:28:20 +00:00
Ingo Weinhold
3cf7ecd1e4 * Added <sys/mman.h> header. It declares only mmap() and munmap() yet
and defines the macros needed by them.
* Renamed syscall sys_vm_map_file() to _kern_map_file() and changed the
  path to an FD parameter. Changed vm_map_file() accordingly and
  adjusted the kernel ELF loader and the runtime loader.
* Added syscall _kern_unmap_memory().
* Added bool unmapAddressRange parameter to vm_create_anonymous_area()
  and map_backing_store(). If true and the address specification is
  B_EXACT_ADDRESS, all areas in the specified address range will be
  deleted (unless an area is covered only partially).
* Introduced B_SHARED_AREA flag, which is set on areas that have been
  created by {vm,_user}_map_file() with REGION_NO_PRIVATE_MAP. When
  fork()ing those areas won't be copied CoW, but rather be cloned. This
  is needed for mmap() MAP_SHARED.
* {vm,_user}_map_file() also accept an FD argument < 0, in which case an
  anonymous area is created.
* Implemented mmap() and munmap(). Currently there's the restriction
  that we can't partially unmap areas. Otherwise the functions should be
  rather compliant. We also support the non-POSIX extension
  MAP_ANONYMOUS.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24964 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-13 22:52:11 +00:00
Ingo Weinhold
071f9c3aa2 Build configurations shouldn't be done in svn controlled files, so I
finally created a solution to avoid that: Header files that contain
configuration settings (and nothing else) go to build/config_headers.
To change settings, create a directory build/user_config_headers (which
is ignored by svn), copy the respective header there and modify it at
your leisure. Currently only tracing_config.h has been moved to the new
location, but more files will follow eventually. It is also recommended
to move optional macro definitions in Jamfile (as for BFS) to a config
header instead; the build system will then automatically rebuild on
changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24611 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-27 22:01:38 +00:00
Ingo Weinhold
92af28df98 Turned the note into a TODO, adding a thought how to implement it.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24546 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-24 02:31:20 +00:00
Ingo Weinhold
5fd6637b4d * Decide whether to use BeOS style symbol resolution at run time
depending on the gcc version of the executable.
* Adjusted non-BeOS-style symbol resolution so that add-ons and
  dynamically loaded libraries find symbols in the executable.

This change re-enables support for undefined symbols.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24537 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-23 19:43:41 +00:00
Ingo Weinhold
3498280968 The runtime loader now reads a part of the .comment section of each
shared object to find out the GCC version it has been compiled with.
This is not an exact science, since we've got the version string for
every single object file that has been linked in, but my heuristic seems
to be good enough.

Having the gcc version at hand will allow for two features: Enabling
work-arounds for old executables (like the type info problem in BeOS
apps), and automatically selecting the right set of libraries in a mixed
gcc 2/gcc 4 environment.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24534 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-23 17:01:42 +00:00
Ingo Weinhold
dd76bc97f5 Fixed NULL related warnings.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24484 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-20 01:45:29 +00:00
Ingo Weinhold
8560d1885b * The runtime_loader's test_executable() no longer analyzes the
executable permissions of the file by hand. We use _kern_access()
  instead, which also handles the root case correctly.
* The user and group arguments of test_executable() aren't needed any
  longer.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24483 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-20 01:45:00 +00:00
Ingo Weinhold
c57db7d007 _kern_read_link() no longer null-terminates the read string. Fixes
loading of symlinked libraries.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24467 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-19 14:09:03 +00:00
Axel Dörfler
12a5e9a4a2 bonefish+axeld:
The runtime loader did not correctly resolve %A correctly with the
actual normalized program path. IOW it would not work correctly with
symlinks to applications that had their own lib directory.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23986 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-17 16:38:07 +00:00
Ingo Weinhold
2dd86b93a6 axeld + bonefish:
Adjusted PATH, LIBRARY_PATH, and the paths built into the runtime loader
to included the /boot/common tree.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23974 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-17 13:59:29 +00:00
Ingo Weinhold
6918dbf421 Normalize the given image path in load_container(). Just constructing
some absolute path was not enough to always recognize a library as
already loaded. This fixes problems with Perl where loading an add-on
would cause another instance of libperl.so to be loaded, which would
lead to crashes due to uninitialized static vars in the new instance.
Perl builds now and the tests run, but quite a few do fail.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23930 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-08 03:18:26 +00:00
Ingo Weinhold
7486b72dd1 Added some kernel tracing to the runtime loader.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23921 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-07 19:22:39 +00:00
Michael Lotz
3be509a228 Fix the static cleanup mechanism introduced to the runtime_loader/libroot:
* Fixed wrong start and size used in the runtime_loader
* Fixed off by one error in the matching loop of the cleanup hook
* Make sure we successfully acquire the locking sem of the exit stack

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23493 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-13 18:49:27 +00:00
Michael Lotz
8c2a9d7433 bonefish+mmlr:
As (our) gcc unfortunately uses atexit() to clean up lazily initialized static
variables inside functions we have to ensure that we do the right thing with
unloadable shared objects. In case a shared object was unloaded that installed
an atexit() hook the application would crash on exit. We now implement a
callback into libroot that is used to call all the atexit() hooks of a
component that is to be unloaded. Most prominently this fixes the media_server
crash at shutdown.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23486 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-13 12:08:34 +00:00
Ingo Weinhold
7ca40195ba Don't overwrite the last read byte with the null-terminator. Fixes bug
#1536.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22452 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-10-05 19:01:18 +00:00
Axel Dörfler
4421183286 * Changed Ld rule to allow adding resource files.
* Changed ResAttr rule to allow not deleting the file before writing the
  attributes.
* Added application signatures for the runtime_loader and zbeos, just so that
  they may have an icon, too (hint, hint) :-)
* As a side effect, this also let's FileTypes handle these two as apps (even
  though they aren't), so that I can close bug #606.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22412 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-10-02 15:22:13 +00:00
Axel Dörfler
2760c4cd73 * load_program() (and probably others) could call delete_image() with a NULL
pointer - which it now handles gracefully.
* This also fixes starting the runtime loader directly: it no longer crashes
  but will just return an error.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22409 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-10-02 13:17:19 +00:00
Marcus Overhagen
5aa7b7b6da Fix broken build and the compiler warning "enumeral mismatch in conditional expression".
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22332 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-09-27 13:33:47 +00:00
Ingo Weinhold
1873b4b37e Give the runtime loader a chance to reinit its semaphore after fork().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21886 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-08-11 00:14:26 +00:00
Axel Dörfler
4bef3723a1 * Followed Ingo's suggestion and send the message manually in the runtime loader;
therefore, we could remove the ugly defines from KMessage again, and compile it
  with KMESSAGE_CONTAINER_ONLY.
* Added KMessage::SetDeliveryInfo() to be able to send messages with a correct
  header.
* Fixed a bug in KMessage::SendTo() that would not send the senderTeam when passing
  a negative value for the parameter, but override it when passing in a valid
  value.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21740 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-29 21:36:49 +00:00
Axel Dörfler
74c0424a43 * Added a mechanism to retrieve a BMessage with eventual error descriptions
for _kern_load_image().
* Added KMessage to the runtime_loader (a bit hacky, though) - it will use
  it to deliver the above mentioned functionality.
* load_dependencies() did return the wrong status code in case a library
  was missing; now it returns B_MISSING_LIBRARY.
* load_dependencies() will now try to load all dependencies when a report
  message is requested; therefore, all missing libraries are listed.
* Renamed uspace_program_args to user_space_program_args.
* The kernel filled in various members of the user_space_program_args structure
  unsafely, ie. was not using user_memcpy().
* Renamed some local variables in team.c to better fit our style guide (ie.
  uargs to userArgs).
* Changed Tracker to use the new _kern_load_image() variant on Haiku to retrieve
  and report all missing libraries. This fixes bug #1324.
* Adapted kernel_cpp.cpp to the runtime loader as well; the latter will now
  compile with _LOADER_MODE defined.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21715 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-27 02:32:19 +00:00
Axel Dörfler
93c2088983 * Removed all user paths from the default runtime_loader paths.
* $PATH is now set differently when booted in safe mode (just like LIBRARY_PATH,
  and ADDON_PATH already were).
* This closes ticket #1103.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21406 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-06-13 23:12:00 +00:00
Ingo Weinhold
46f4d84912 * Got rid of sLoadingImages. It was always empty.
* The previous symbol resolution code was incorrect. It would search all
  loaded images in the order they had been loaded. Thus an add-on would
  possibly see a symbol of an earlier loaded add-on. Now we search
  recursively starting with the respective root image (executable or
  add-on).
* Added BeOS style symbol resolution and made it the default. A symbol
  undefined in an image is only searched in its direct dependencies.
  Fixes bug #889 (BeOS apps crashing under Haiku when opening a file
  panel).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21290 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-06-01 18:09:32 +00:00
Ingo Weinhold
0c0fea5de2 elf.c -> elf.cpp
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21283 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-06-01 06:46:57 +00:00
Travis Geiselbrecht
831486a2d3 Turn the assembly optimized memcpy (simple rep movsd) back on for x86. Had to hack around the make system a bit, and the result is pretty nasty, specifically due to the amount of places in the system where various targets poke their fingers into the libroot directory.
The solution is less than optimal, but should work for now.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20722 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-16 06:17:14 +00:00
Axel Dörfler
f0a5326923 * Made all exported safe against NULL pointers, this fixes bug #485.
* Slightly improved error codes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19941 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-01-24 14:32:05 +00:00
Axel Dörfler
f5fc6356c4 Fixed a GCC 4 warning.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19059 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-10-13 11:37:00 +00:00
Axel Dörfler
57d9d07781 * Fixed another big bug that the new heap revealed: when loading an image failed,
it was never removed from the sLoadedImages list - and thus, would happily
  access invalid memory.
* get_next_image_dependency() is now using the global lock as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19047 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-10-11 17:50:06 +00:00
Axel Dörfler
5cfd3a1592 The heap now grows if needed; this allows VLC to load all of its plugins.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19046 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-10-11 17:45:13 +00:00
Axel Dörfler
6f0994d460 * Switched to the boot loader's heap implementation.
* This sane heap revealed a bunch of bugs (like sLoadedImageCount not being
  maintained that was used for various allocations).
* If the allocation of the image fails, opening the app will now just fail
  instead of crashing of overwriting random data (IOW VLC will now load
  okay, but cannot load some of its add-ons anymore).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19045 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-10-11 16:02:43 +00:00
Axel Dörfler
3862cbfeee Fixed a potential buffer overflow error.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19044 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-10-11 13:54:51 +00:00
Axel Dörfler
e979f4bac7 get_image_symbol() and get_nth_image_symbol() now accept NULL arguments for the
location and type parameters.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19010 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-10-06 12:17:06 +00:00
Axel Dörfler
0d7ec13a82 Simplified a bit, removed unneeded function stubs.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19009 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-10-06 11:46:23 +00:00
Axel Dörfler
7f4e6824df Added a private call to get the dependencies of a loaded image. This will be used
to determine linkage of libnet.so vs. libsocket.so/libbind.so in the libnetwork.so.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19008 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-10-06 11:40:20 +00:00
Axel Dörfler
fe7f3a2f1d Now supports symbolic links correctly, and no longer loads the same shared
library twice.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17929 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-06-27 00:07:42 +00:00
Axel Dörfler
0cd3c003d1 While investigating how our deals with doubled shared libs, I found two
issues:
* Our glue code was broken after all - it allowed Haiku apps to start under
  BeOS (and vice versa), but the initialization/termination functions were
  called with an invalid image ID - on *both* sides! As it turns out, the
  Be glue code did *something* with %ebx, but certainly didn't put the image
  ID in there, but just passed it on the stack, as we did before (just in
  the wrong order...). Therefore, the arch_call_init_term stuff is not
  necessary.
* When unloading add-ons, their termination functions were never called, as
  the image (for get_image_symbol()) was already made inaccessible, and
  therefore the symbol couldn't be found.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17928 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-06-26 22:09:13 +00:00
Axel Dörfler
3728e62e88 Unlike the ELF specs, BeOS ignores the path of shared objects specified by the DT_NEEDED
element. We now soften the rule that the absolute path should be used, and give libraries
another chance and search them in the standard search paths. This fixes bug #601 and lets
Becasso run on Haiku.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17669 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-05-31 15:59:42 +00:00
Axel Dörfler
d7b5138a70 Some more GCC 4.1.0 fixes, more to come (tomorrow).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17501 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-05-17 21:40:29 +00:00
Axel Dörfler
9c243392a4 Even short scripts are B_NOT_AN_EXECUTABLE, and not B_BAD_VALUE.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17472 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-05-16 01:01:17 +00:00
Axel Dörfler
9a6bbd514e Once libroot's getenv() is available, that one will be used instead of the one built in.
This makes the runtime_loader able to adopt path changes properly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17380 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-05-08 23:50:09 +00:00
Jérôme Duval
ce91cbc42d now checks if a search entry is a directory and returns B_IS_A_DIRECTORY in case it's the sole entry for this name (btw getenv(PATH) doesn't return the current PATH)
fixes bug #569


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17372 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-05-08 20:07:01 +00:00
Axel Dörfler
0f0234a5d0 We no longer return B_OK in test_executable() for executables that don't
define an entry point (like shared libraries).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17022 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-04-06 06:16:20 +00:00
Axel Dörfler
2ed4099289 Renamed the linker script to runtime_loader.ld to match the rest.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16937 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-30 18:10:59 +00:00
Axel Dörfler
af3e5cd947 Renamed our runtime loader from rld.so to runtime_loader, and moved it into beos/system/.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16936 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-30 18:08:51 +00:00
Axel Dörfler
76cd9b1961 Renamed runtime loader source files.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16935 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-30 16:29:53 +00:00
Axel Dörfler
87a9cb2d70 * No longer tries to start an application that doesn't export an entry point != NULL.
This fixes bug #360.
* Also removed no longer necessary undefining of _KERNEL_MODE, as we're now built
  correctly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16930 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-30 14:17:14 +00:00
Axel Dörfler
93c49610b5 Improved error output.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16837 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-19 14:34:21 +00:00
Axel Dörfler
aa9383c1f2 And the final build fix: the boot loader was using libroot's strlen.o object
file (which does no longer exist) - it now uses the one from the kernel as a
quick fix.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16821 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-17 01:18:20 +00:00
Ingo Weinhold
bae7848e66 We were trashing non-volatile register ebx in the arch_call_{init,term}()
functions. Weird things could happen due to that. E.g. application crashes when 
unloading add-ons.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15994 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-01-17 02:21:17 +00:00
Ingo Weinhold
1005ea4b5d Fixed PPC build.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15857 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-01-07 19:35:18 +00:00
Stephan Aßmus
71d2531d52 terminate_program() is now actually called - forgot to commit this before...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15849 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-01-06 11:09:44 +00:00
Stephan Aßmus
34a9556215 Made our glue code compatible to BeOS again. IOW executables compiled for Haiku will
now run under BeOS as well (as long as they don't use any functions that are not
available under R5).
The solution is a bit messy, but we have to live with it :-)
The runtime loader now patches the __gRuntimeLoader symbol in libroot.so to point
to its exported structure instead of passing it to the init functions as an
argument.
(Hax0red by axeld and bonefish on stippi's assimilated machine -- resistence is futile)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15848 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-01-06 03:48:11 +00:00
Axel Dörfler
a31b66b768 Added tracing for calling the init routines.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15694 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-28 14:47:51 +00:00
Ingo Weinhold
353d20c0c5 * libroot and the runtime loader are no longer built with kernel rules.
* New rule Ld, analogously to KernelLd.
* Added StaticLibrary parameter for supplying additional objects.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15191 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-27 13:31:50 +00:00
Ingo Weinhold
38f6264454 Reorganized building of kernel, boot loader, and libroot.
Each component is built in the respective subdirectory now
and no longer in src/system/Jamfile.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15184 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-27 00:27:19 +00:00
Ingo Weinhold
df23b0271e Corrected the sizes of the text and data segments reported to the
kernel. They are now the sizes of the allocated areas, which might be a
bit more than the actually used size, but at least they are not
potentially less, as they were before. This could have unexpected
effects like the Tracker not finding its resources... 


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14977 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-17 00:27:42 +00:00
Ingo Weinhold
9cc1e772dc More debug output.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14963 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-16 17:22:55 +00:00
Ingo Weinhold
ad512dbeac Print error code when relocation failed.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14958 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-16 15:21:54 +00:00
Ingo Weinhold
338b8dc301 Merged changes from branch build_system_redesign at revision 14573.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14574 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-29 16:27:43 +00:00
Marcus Overhagen
794df3bf25 This removes the inline assembly code for find_thread
from OS.h, sorry for triggering a complete rebuild.
To avoid doing a syscall for find_thread(0), the assembly
version is now in libroot. For BeOS R5 compatibility, 
_kfind_thread_ is retained. This will fix some compile 
problems, and provides a cleaner OS.h for future Haiku
versions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14014 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-20 23:57:11 +00:00
Axel Dörfler
90f1dccb72 Our ELF loader now gets something like error handling - it may still have some
(memory) holes, but failing to load an add-on should no longer exit your
application. Reported by Korli.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13945 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-12 20:52:46 +00:00
Ingo Weinhold
7f53c2cc96 We now make sure, that images always have absolute paths, otherwise
their path could be invalid in other contexts (e.g. the debug server might
be unabled to find them). This seems to be what BeOS does, too.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13796 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-21 23:51:02 +00:00
Axel Dörfler
09105be0f8 Now uses the TO_PAGE_SIZE() macro already defined to round the debug area to a page size multiple.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13713 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-17 12:54:41 +00:00
Ingo Weinhold
28e0d4cd19 The runtime loader now creates a debug area through which other teams can
access a team's internal loader data.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13697 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-16 21:07:17 +00:00
Axel Dörfler
43ed6aa0db The "shebang" handler is supposed to parse arguments, too - we now do that.
Also, when the line is too long, E2BIG is returned.
Thanks to Korli who pointed me to this: http://homepages.cwi.nl/~aeb/std/shebang/


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13114 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-06-14 12:39:06 +00:00
Axel Dörfler
be22452f3b Apparently, both load_image() and exec*() support running scripts. We do that
now as well.
Also, both functions will now test if the executable exists and is valid; that
way, load_image()/exec*() can catch many errors without having to create a new
team (or erase the current one - an exec*("my invalid app") might now return
with an error).
The runtime linker now exports a function to test executables that is aware
of the search paths, and will also check user permissions upfront.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13113 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-06-14 11:23:29 +00:00
Axel Dörfler
718b5114e0 This should fix the build after all the kernel/system renaming.
If anything is still broken (and was not before :)), please shout.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12361 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-04-13 13:59:17 +00:00
Axel Dörfler
5af32e7526 Renamed src/kernel to src/system.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12359 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-04-13 13:06:35 +00:00