Commit Graph

5561 Commits

Author SHA1 Message Date
Pawel Dziepak
dd8a866adc libroot/x86: Fix indirect jump 2014-01-16 20:18:22 +01:00
Pawel Dziepak
79c9b824e4 libroot: sync() should not return any value 2014-01-16 20:18:22 +01:00
Jonathan Schleifer
9fc69d1b00 runtime_loader: Add __dso_handle.
The symbol is needed for global objects. Usually, GCC also requires
this, but for some reason, the linking error only occurs when using
Clang.

Signed-off-by: Jérôme Duval <jerome.duval@gmail.com>
2014-01-13 19:35:34 +01:00
Jonathan Schleifer
d1c7f766fd glibc: Remove a ++ that was accidentally added.
Thanks to PulkoMandy for noticing!

Work towards bug #10396
2014-01-11 17:33:42 -06:00
Alexander von Gluck IV
4f357bc071 sysinfo: Improve x86 CPU information
* Displays standard CPUID, and shows what the
  internal CPUID used by OS.h *should* be.
* Should help out in identifying new CPU's
  as all end users have to do is run sysinfo
  to get the CPU info + value for OS.h
2014-01-11 16:14:22 -06:00
Jonathan Schleifer
38fee4c388 glibc: Remove nested function.
Nested functions are a (again, broken) GNU extension which is not
supported by Clang. It has been replaced by a bunch of gotos and a
variable that works as a return address.
2014-01-10 22:32:05 +01:00
Jonathan Schleifer
4683fcc35c glibc: Correctly create weak symbols. 2014-01-10 22:31:58 +01:00
Alexander von Gluck IV
aa4b5749d6 runtime_loader: Detect and trigger on PE binaries
* Previously PE binaries would trigger the "incorrectly
  executable" dialog. Now we get a special message for
  B_LEGACY_EXECUTABLE and B_UNKNOWN_EXECUTABLE
* Legacy at the moment is a R3 x86 PE binary. This could
  be extended to gcc2 binaries someday far, far, down the
  road though
* The check for legacy is based on a PE flag I see
  set on every R3 binary (that isn't set on dos ones)
* Unknown is something we know *is* an executable, but
  can't do anything with (such as an MSDOS or Windows
  application)
* No performance drops as we do the PE scan last
* Tested on x86 and x86_gcc2
2014-01-07 19:38:07 -06:00
Jonathan Schleifer
e3e0255008 rootfs.cpp: Replace undefined behaviour with offsetof.
Signed-off-by: Axel Dörfler <axeld@pinc-software.de>
2013-12-19 01:52:33 +01:00
Jonathan Schleifer
c7cb9b2f59 delete_driver_settings.cpp: Get rid of the weak alias.
As weak aliases are not supported on OS X, this caused problems when
building Haiku on OS X, as this file is also used for the host tools.

Signed-off-by: Axel Dörfler <axeld@pinc-software.de>
2013-12-19 01:52:33 +01:00
Ingo Weinhold
781671ad5b dump_mapping_info(): Remove problematic initializer
Fixes gcc 2 build.
2013-12-10 23:17:43 +01:00
Ingo Weinhold
c259766f94 KDL "mapping" command: Allow specifying a thread ID
... instead of only a team ID.
2013-12-10 19:13:56 +01:00
Ingo Weinhold
5d3978dbe7 KDL "mapping" command: Fix argument check
It wasn't possible to actually specify the second argument (team ID).
2013-12-10 19:13:08 +01:00
Ingo Weinhold
a3fe978f8a boot loader: Always show 4 GB memory limit safemode option
On x86 we mainly want to disable PAE, which is now also used with less
memory as long as NX support is available. Ideally we'd check this
condition as well and only add the menu item, if the kernel would
enable PAE.
2013-12-10 19:12:16 +01:00
Ingo Weinhold
fc7801bc6f boot loader: apply_boot_settings(): Replace string literal 2013-12-10 19:08:07 +01:00
Ingo Weinhold
647b768f54 x86: Disable PAE, if 4 GB memory limit safemode is set 2013-12-10 19:07:01 +01:00
Ingo Weinhold
9bdb5e0a92 kernel safemode: Add functions to get options early
Add get_safemode_option_early() and get_safemode_boolean_early() to get
safemode options before the kernel heap has been initialized. They use a
simplified parser.
2013-12-10 19:05:47 +01:00
François Revol
e36ad522d6 Fix 24d0e21f51 correctly
CreateSubRequest() could still return an error and break out of the
while loop without exiting the outer for loop.

Instead we reset the error code before entering the for loop.
2013-12-08 11:34:07 +01:00
François Revol
664e3fba9b Partially revert 24d0e21f51
This reverts the extra for loop condition from
"do_iterative_fd_io_iterate(): Support sparse files".

When reading a file with more than 8 block_runs, get_vecs() would
return B_BUFFER_OVERFLOW which would never create any subrequest due
to the test on error == B_OK on the loop, but instead just fail.

Except for the get_vecs() return code, where it is not wanted,
the test made no sense as all other assignments are tested directly
or passed around with break.

Works for me but I don't guarantee it's completely correct.
2013-12-08 01:43:02 +01:00
Ingo Weinhold
00b42dde0d FD kernel tracing: Capture kernel-only stack traces
* When exec()'ing we'd otherwise get (harmless but annoying) messages
  from vm_page_fault(). With syscall tracing enabled we can get userland
  stack traces anyway.
* Simplify by using TRACE_ENTRY_SELECTOR().
2013-12-07 15:44:22 +01:00
Ingo Weinhold
0a4cbd786c X86VMTranslationMapPAE: Extend kernel tracing
* Beside the physical address also print the PTE flags.
* Also trace Protect(), ClearFlags(), ClearAccessedAndModified().
2013-12-07 15:44:22 +01:00
Ingo Weinhold
3c70914f66 ktracing: TraceOutput::PrintStackTrace(): Fix duplication 2013-12-07 15:44:22 +01:00
Michael Lotz
57d8dd92ef pthread_join: Retry when interrupted as mandated by POSIX.
The spec explicitly states that pthread_join shall not return EINTR, so
we have to retry the wait when it gets interrupted instead of letting
the error code through.
2013-12-07 14:15:05 +00:00
Ingo Weinhold
dac7b7c980 Fix various 64 bit related warnings
Mostly printf() format strings and signed-unsigned comparisons.
Fixes the x86_64 build.
2013-12-06 14:17:58 +01:00
Ingo Weinhold
736fe5bc63 Fix build with TRANSLATION_MAP_TRACING enabled 2013-12-05 21:44:54 +01:00
Ingo Weinhold
372b309a4a X86VMTranslationMapPAE: Fix gcc 2 warning
... which due to the reactivated -Werror causes the build to fail.
2013-12-05 20:42:06 +01:00
Ingo Weinhold
7b83ce1142 Add KDL command "mapping"
* VMTranslationMap:
  - Add DebugPrintMappingInfo(): Given a virtual address it is supposed
    to print the paging structure information for that address. To be
    implemented by derived classes.
  - Add DebugGetReverseMappingInfo(): Given a physical addresss it is
    supposed to find all virtual addresses mapped to it. To be
    implemented by derived classes.
* X86VMTranslationMapPAE: Implement the new methods
  DebugPrintMappingInfo() and DebugGetReverseMappingInfo().
* Add KDL command "mapping". It supports both virtual address lookups
  and reverse lookups.
2013-12-05 05:13:21 +01:00
Ingo Weinhold
e551626f40 Implement support for a SYS:ENV attribute on executable
__flatten_process_args() does now have the executable path as an
additional (optional) parameter. If specified, the function will read
the file's SYS:ENV attribute (if set) and use its value to modified the
environment it is preparing for the new process. Currently supported
attribute values are strings consisting of "<var>=<value>" substrings
separated by "\0" (backslash zero), with '\' being used as an escape
character. The environment will be altered to contain the specified
"<var>=<value>" elements, replacing a preexisting <var> element (if
any).

A possible use case would be setting a SYS:ENV attribute with value
"DISABLE_ASLR=1" on an executable that needs ASLR disabled.
2013-12-01 18:34:07 +01:00
Ingo Weinhold
7bf85edf58 Allow disabling ASLR via DISABLE_ASLR environment variable
* VMAddressSpace: Add randomizingEnabled property.
* VMUserAddressSpace: Randomize addresses only when randomizingEnabled
  property is set.
* create_team_arg(): Check, if the team's environment contains
  "DISABLE_ASLR=1". Set the team's address space property
  randomizingEnabled accordingly in load_image_internal() and
  exec_team().
2013-12-01 02:51:50 +01:00
Ingo Weinhold
84ed99c2aa mmap(): Fix !MAP_FIXED with non-NULL address case
In that case the caller ideally wants to obtain an allocation at the
specified address, which was thwarted by using
B_RANDOMIZED_BASE_ADDRESS. Use B_BASE_ADDRESS instead.

This improves the experience with the gcc 4 pre-compiled headers
implementation (which expects to be able to map the PCH file at the same
address where it was located originally when it had been created), but
doesn't fix it completely. As long as ASLR is active, it is always
possible that something else (mapped shared objects, heap, stack) is in
the way.
2013-12-01 00:58:28 +01:00
Ingo Weinhold
97a4e3202f VMUserAddressSpace: Use align_address() instead of ROUNDUP()
Mainly for aesthetical reasons.
2013-12-01 00:46:41 +01:00
Ingo Weinhold
6c41755609 VMUserAddressSpace::_InsertAreaSlot(): Fix base address handling
Unless a free range was found before the first area a specified base
address was ignored. In the non-randomized case this could result in
a range other than (i.e. starting before) the preferred one being
chosen, although the preferred range was available.
2013-12-01 00:44:58 +01:00
Ingo Weinhold
7b96ce222a VMUserAddressSpace: Small coding style fixes 2013-11-30 23:17:34 +01:00
Ingo Weinhold
93e99b6113 VMUserAddressSpace: Use std::min/max instead of min/max_c 2013-11-30 23:13:48 +01:00
Ingo Weinhold
65947ae5ae boot loader: blacklist menu: Set different title when disabled
When booting from CD (or when no boot volume has been selected)
blacklisting isn't supported. In that case let the menu title indicated
that.
2013-11-30 19:58:41 +01:00
Ingo Weinhold
ccfc7bea50 boot loader: blacklist menu: Add "Return to ..." item 2013-11-30 19:56:13 +01:00
Ingo Weinhold
cbfc38c62d boot loader: MenuItem: Add SetLabel() 2013-11-30 19:39:57 +01:00
Ingo Weinhold
2a368f9b0e boot loader: text menu: run_menu(): Fix empty menu crash 2013-11-30 19:25:56 +01:00
Ingo Weinhold
aea2cb917e device_manager: Implement unpublish_device() 2013-11-30 17:02:49 +01:00
Ingo Weinhold
28092be196 devfs: Add devfs_{get,put}_device()
devfs_get_device() returns the device for a given path (if any), also
acquiring a reference to its vnode (thus ensuring the device won't go
away). devfs_put_device() puts the device vnode's reference.
2013-11-30 17:02:48 +01:00
Ingo Weinhold
e26c3df48c devfs: Remove superfluous create() hook
We don't support creation of files and the VFS calls open() when an
entry already exists.
2013-11-30 17:02:48 +01:00
Rene Gollent
09a8919213 InstallationLocations: Add missing static specifiers.
- Fixes a crash in find_paths() due to the InstallationLocations object getting overwritten.

Thanks to Chris Roberts for reporting.
2013-11-26 21:45:35 -05:00
Ingo Weinhold
8d23c440f7 runtime loader: Add support for $ORIGIN in rpath
Like in Linux it resolves to the directory of the shared object whose
needed library is to be loaded.
2013-11-26 16:40:42 +01:00
Ingo Weinhold
f170a888c2 FIFO: Handle user reads/writes more correctly
* Determine whether called from userland or kernel.
* Check the buffer address via IS_USER_ADDRESS(), if from userland.
* Simplify things by merging UserRead() with Read() and
  UserWrite() with Write().
2013-11-25 16:08:00 +01:00
Ingo Weinhold
8019fdbab8 FIFO: Implement FION{BIO,READ}, B_SET_[NON]BLOCKING_IO ioctls 2013-11-25 16:08:00 +01:00
Ingo Weinhold
fd0bfd5593 FIFO: More correct locking when accessing file_cookie::open_mode 2013-11-25 16:08:00 +01:00
Ingo Weinhold
38b150a9de VFS FIFO: Add "fifo" KDL command
Prints information about a FIFO node and, optionally, its data buffer
content.
2013-11-25 12:45:37 +01:00
Ingo Weinhold
fb52b1f8b4 VFS FIFO: Enlarge FIFO buffer sizes
* Increase FIFO buffer capacity from 32 to 64 KiB and the FIFO atomic
  write size ({BUF_SIZE}) from 512 bytes to 4 KiB (both like Linux).
* Fix *pathconf(..., _PC_PIPE_BUF). It was returning 4 KiB although the
  implemented atomic write size was 512 bytes only. Now both *pathconf()
  and the FIFO implementation refer to the same constant.
2013-11-25 12:45:37 +01:00
Ingo Weinhold
334ae3c73b VFS FIFO: Fix RingBuffer::Read()/Write() return types
size_t -> ssize_t, since they may actually return an error code.
2013-11-25 12:45:37 +01:00
Ingo Weinhold
dd11460a49 Add a hex dump utility for use in KDL commands 2013-11-25 12:45:36 +01:00