Commit Graph

5115 Commits

Author SHA1 Message Date
Michael Lotz
255c9104e5 * Rework the heap locking strategy. Use a read-write lock for the area lock to
allow for more parallelism. Also introduce seperate locks for the bins and
  for page allocation. This greatly reduces lock contention and reduces the
  duration the locks are held due to them overall protecting less code. Now only
  allocations of the same size hitting the same allocator or allocating larger
  chunks of memory should block. Previously, basically any allocation and also
  free would be mutually exclusive, making it scale pretty badely.
* Added memalign_nogrow(). As it uses heap_memalign() anyway, there's no real
  reason not to allow for an alignment.
* Some cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32074 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-03 13:59:45 +00:00
Ingo Weinhold
ea2abd110b * Renamed the ROUNDOWN macro to ROUNDDOWN. Also changed the implementation of
ROUNDUP to use '*' and '/' -- the compiler will optimize that for powers of
  two anyway and this implementation works for other numbers as well.
* The thread::fault_handler use in C[++] code was broken with gcc 4. At least
  when other functions were invoked. Trying to trick the compiler wasn't a
  particularly good idea anyway, since the next compiler version could break
  the trick again. So the general policy is to use the fault handlers only in
  assembly code where we have full control. Changed that for x86 (save for the
  vm86 mode, which has a similar mechanism), but not for the other
  architectures.
* Introduced fault_handler, fault_handler_stack_pointer, and fault_jump_buffer
  fields in the cpu_ent structure, which must be used instead of
  thread::fault_handler in the kernel debugger. Consequently user_memcpy() must
  not be used in the kernel debugger either. Introduced a debug_memcpy()
  instead.
* Introduced debug_call_with_fault_handler() function which calls a function
  in a setjmp() and fault handler context. The architecture specific backend
  arch_debug_call_with_fault_handler() has only been implemented for x86 yet.
* Introduced debug_is_kernel_memory_accessible() for use in the kernel
  debugger. It determines whether a range of memory can be accessed in the
  way specified. The architecture specific back end
  arch_vm_translation_map_is_kernel_page_accessible() has only been implemented
  for x86 yet.
* Added arch_debug_unset_current_thread() (only implemented for x86) to unset
  the current thread pointer in the kernel debugger. When entering the kernel
  debugger we do some basic sanity checks of the currently set thread structure
  and unset it, if they fail. This allows certain commands (most importantly
  the stack trace command) to avoid accessing the thread structure.
* x86: When handling a double fault, we do now install a special handler for
  page faults. This allows us to gracefully catch faulting commands, even if
  e.g. the thread structure is toast.

We are now in much better shape to deal with double faults. Hopefully avoiding
the triple faults that some people have been experiencing on their hardware
and ideally even allowing to use the kernel debugger normally.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32073 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-03 12:39:56 +00:00
François Revol
4b8d0e6856 Some ppc fixes for #4115, patch by kallisti5 (without the #ifdef _BOOT_MODE):
- stubbed out arch_cpu_init_percpu(),
- make atomic ops declarations extern "C",
- move calls to [i]sync inside the asm code that needs it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32067 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-03 10:10:22 +00:00
Stefano Ceccherini
dcc8ae9118 Some cleanups: made the bitmaps static, moved variables around. No functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32056 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-01 08:14:18 +00:00
Ingo Weinhold
671a2442d9 More work towards making our double fault handler less triple fault prone:
* SMP:
  - Added smp_send_broadcast_ici_interrupts_disabled(), which is basically
    equivalent to smp_send_broadcast_ici(), but is only called with interrupts
    disabled and gets the CPU index, so it doesn't have to use
    smp_get_current_cpu() (which dereferences the current thread).
  - Added cpu index parameter to smp_intercpu_int_handler().
* x86:
  - arch_int.c -> arch_int.cpp
  - Set up an IDT per CPU. We were using a single IDT for all CPUs, but that
    can't work, since we need different tasks for the double fault interrupt
    vector.
  - Set the per CPU double fault task gates correctly.
  - Renamed set_intr_gate() to set_interrupt_gate and set_system_gate() to
    set_trap_gate() and documented them a bit.
  - Renamed double_fault_exception() x86_double_fault_exception() and fixed
    it not to use smp_get_current_cpu(). Instead we have the new
    x86_double_fault_get_cpu() that deducts the CPU index from the used stack.
  - Fixed the double_fault interrupt handler: It no longer calls int_bottom to
    avoid accessing the current thread.
* debug.cpp:
  - Introduced explicit debug_double_fault() to enter the kernel debugger from
    a double fault handler.
  - Avoid using smp_get_current_cpu().
  - Don't use kprintf() before sDebuggerOnCPU is set. Otherwise
    acquire_spinlock() is invoked by arch_debug_serial_puts().

Things look a bit better when the current thread pointer is broken -- we run
into kernel_debugger_loop() and successfully print the "Welcome to KDL"
message -- but we still dereference the thread pointer afterwards, so that we
don't get a usable kernel debugger yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32050 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-01 01:53:54 +00:00
Stephan Aßmus
54897d5c06 * Also pass the media_codec_info to the Writer::AllocateCookie(), since that
info is not part of the media_format otherwise.
* Finished enough in the AVFormatWriter and AVCodecEncoder that we can now
  actually create AVIs and MPGs and encode MPEG1, MPEG2 and MPEG4 video.
  But no audio as of yet. Also, there is no bit-rate/quality setup, so it seems
  libavformat is using the least possible bit-rate/quality.
* Enable some more muxers and encoders in the FFmpeg libs.
* Uses pixel format conversion from libswsscale, need to read the documentation
  again, but I think it makes the plugin GPL.
* Fixed includes in libswscale/swscale.h, this is now an unmodified FFmpeg 0.5
  header again (AFAICT).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32043 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-01 01:16:12 +00:00
Michael Lotz
d7a16b238f * Fully switch to the Haiku message format so that it is also used for on-disk
storage.
* Remove reduntant information from the header (field_count vs. fields_size).
* Remove checksums previously used to validate the message passing by area
  mechanism.
* Move variables that are purely used by the instance out of the header and into
  the BMessage object.
* Use more sensible types for the different message fields.
* Reduce some field sizes to realistic values.
* Make size_t values into uint32 values so the message format will not change
  when later moving to 64 bits.
* Pack the structures used for flat message storage so it doesn't change
  because of padding.
* Fix message passing by area. It never worked because the created area was
  never actually filled with any data!
* Some more allocation checks with graceful fallbacks (should be all now).
* Some more checks for negative index values (should also be all now).
* Make printing more inline with how the rest of the class works and make some
  of the output more consistent.
* Also add the new unsigned types to PrintToStream() output.
* Fix printing of unknown types and invalid BMessages, it would always have
  printed only the first entry respectively the same error.
* Added some clarifying comments.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32039 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-31 22:19:36 +00:00
Rene Gollent
2252911973 Add missing definition for wcsstr. This was preventing clucene from building with wide chars enabled.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32038 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-31 22:16:58 +00:00
Axel Dörfler
e90b90daf6 * Added desperately missing Trim() method.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32035 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-31 21:13:19 +00:00
Ingo Weinhold
cc77aba101 * Allocate a separate double fault stack for each CPU.
* Added x86_double_fault_get_cpu(), a save way to get the CPU index when in
  the double fault handler. smp_get_current_cpu() requires at least a somewhat
  intact thread structure, so we rather want to avoid it when handling a double
  fault. There are a lot more of those dependencies in the KDL entry code.
  Working on it...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32028 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-31 16:14:18 +00:00
Stephan Aßmus
4384acf6c1 * Tweaked the Writer API. Basically, we need an Init() method that takes the
media_file_format as input, so that the Writer knows what kind of file is
  needed.
* Also, since information about the stream format is going to be needed at the
  Writer level as well, the AllocateCookie() method gets the stream
  media_format.
* Fleshed out some aspects of AVFormatWriter, many TODOs are left.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32025 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-31 15:29:08 +00:00
Axel Dörfler
61b6f38cfc * Cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32021 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-31 14:11:12 +00:00
Stephan Aßmus
fa770e4c84 * Writer::WriteChunk() takes media_encode_info* instead of flags.
* Improved Encoder API towards what we need for the get_next_encoder() variants
  and the BMediaTrack API.
* Implemented the rest of MediaWriter. Still undecided what to make of
  AddTrackInfo(). BMediaEncoder has that as well, which hints that this is
  something the Encoder needs to support. But it could also be that this is
  only possible to support in Writer.
* Wired a lot of previously unimplemented methods in BMediaFile and BMediaTrack
  needed for write support. If I have not overlooked anything, only the
  parameter stuff is still unimplemented now.

This is all untested, since the FFMpeg Encoder and Writer are still only stubs.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32013 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-31 10:46:58 +00:00
Stephan Aßmus
6033e52a83 Implemented support for get_next_encoder() variations from MediaFormats.h.
The AddOnManager in the media_server registers one encoder entry per
successful EncoderPlugin::RegisterNextEncoder(). This gives us a first idea
what media_format_family and input/output media_type is supported. The
mechanism may have to be extended, or the Encoder needs an API to specialize
a format further. In that case, the get_next_encoder() version that takes
optional _acceptedInput/OutputFormat needs to instantiate the plugin and
needs to ask the Encoder. But AFAIK, no app uses it like that anyway.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32005 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-31 00:46:36 +00:00
Stephan Aßmus
377e95304a * This header couldn't actually be used from C code, since C doesn't support
overloading functions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32000 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-30 22:10:11 +00:00
Stephan Aßmus
7cd2513b82 Changed the way Encoders are published by EncoderPlugins. Encoder retrieval
in PluginManager is reenabled. We use the media_codec_info.id to reference
a specific plugin, while the sub_id will be used to reference individual
Encoders that the plugin supports. No idea if that's how it was intented, but
some comments hint in this direction. I failed to mention this before, but
comments are of course very welcome on any of these commits, as always.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31993 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-30 20:05:11 +00:00
Ingo Weinhold
3fccf0679f C++ified the code. Introduced new trace entry flags, which will eventually be
used to mark entries after recovering a tracing log from a previous session.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31991 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-30 19:50:50 +00:00
Stephan Aßmus
a07b059b16 Implemented first version of MediaWriter, which is the bridge between
BMediaFile/BMediaTrack and Writer plugins.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31988 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-30 17:56:01 +00:00
Stephan Aßmus
c98ea33596 Let's call it WriteChunk() instead of WriteNextChunk() and make the signature
consistent everywhere (according to BMediaTracker::WriteChunk()).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31987 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-30 17:54:03 +00:00
Stephan Aßmus
efd1469d4f Encoders will most likely be found by media_codec_info, not by media_format,
changed method signature accordingly and disabled the code for now, since
the media_server communication has not been adapted yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31985 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-30 17:52:14 +00:00
Stephan Aßmus
b8316d9f93 Cleanup and preparations for BPrivate::media::MediaWriter, which will soon
exist.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31983 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-30 17:47:54 +00:00
Stefano Ceccherini
c2c39a98a2 Moved functions declarations to InterfacePrivate.h
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31979 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-30 16:46:19 +00:00
Stephan Aßmus
ee9408a18d Re-wrote MediaFormats.h header.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31978 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-30 16:34:06 +00:00
Axel Dörfler
753365b433 * Added new (private) calls {get|set}_workspaces_layout().
* Implemented old count_workspaces(), and set_workspace_count() using the
  new functions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31971 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-30 14:13:14 +00:00
Ingo Weinhold
07745f2a0b Added support for new notify_io_request() function.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31970 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-30 14:12:47 +00:00
Axel Dörfler
617ebd8897 * Added convenience methods to add BTextControls and BMenuFields to a grid
layout.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31968 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-30 14:03:48 +00:00
Ingo Weinhold
213d2d8f9d Added syscall _kern_kernel_debugger() to enter the kernel debugger.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31965 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-30 12:35:42 +00:00
Stefano Ceccherini
7a8567e61d Moved MenuPrivate implementation to its own file. Made MenuPrivate.h
self-contained. Adjusted other files accordingly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31963 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-30 10:41:33 +00:00
Stefano Ceccherini
c3d7cee2d9 Instead of creating the Modifiers bitmaps on demand, for every DrawItem invocation,
for every BMenuItem, have them created in _init_interface_kit(), and keep
them cached. This required some reorganisation of the code in Menu and MenuItem.
Also has the side effect that BMenuItem doesn't have to know about the
alt/ctrl/command keys stuff.
Added a comment in BMenu::AttachedToWindow().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31962 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-30 10:33:46 +00:00
Ingo Weinhold
cdcacd7f9f * Added missing ToReferenceable().
* _SetTo(const BVariant&): Acquire a reference for the wrong object.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31959 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-30 02:34:41 +00:00
Axel Dörfler
69f9a367bc * The app_server no longer uses workspace counts internally, but only columns,
and rows.
* set_workspace_count() now uses the logic formerly found in
  WorkspacesView::_GetGrid() to determine the layout.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31958 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-30 00:52:21 +00:00
Stephan Aßmus
60c85abee5 Resolved TODO, make it clear who maintains the allocation of the
media_file_format array (it remains with the plugin itself, as with
DecoderPlugins).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31955 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-30 00:11:02 +00:00
Stephan Aßmus
7c06546a8e Implement the backend of get_next_file_format(). The AddOnManager maintains
a list for known media_file_formats. The internal IDs map to plugins.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31950 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 22:49:23 +00:00
Ingo Weinhold
d3b44ccb14 Added explicit physical address parameter to vm_create_anonymous_area() and
create_area_etc(). 0 for the default behavior.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31941 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 21:30:35 +00:00
Oliver Tappe
31a41b605d Fixing #3460:
* resolved a couple of redundant function declaration in our public headers
* adjusted zipomatic accordingly - everything else built fine

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31938 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 19:45:09 +00:00
Stephan Aßmus
c30ef79def Small cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31934 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 19:11:50 +00:00
Stephan Aßmus
92d809b687 Added interface to WriterPlugin to get all supported media_format_families.
Don't yet know if that's the way it's supposed to work...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31933 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 19:11:32 +00:00
Ingo Weinhold
069b477dd7 * Introduced CREATE_AREA_DONT_CLEAR create_area_etc() flag, which allows the
call to fetch non-clear pages.
* B_PHYSICAL_BASE_ADDRESS does now imply B_CONTIGUOUS.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31932 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 18:57:21 +00:00
Oliver Tappe
a64a5357f2 * added missing declarations of all the scanf() variants, as we now provide
those, too. Among other things, this should facilitate making use of wstring
  with gcc4.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31927 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 17:41:10 +00:00
Oliver Tappe
51c5e9f685 fixing #4031:
* added declaration of strtof() to stdlib.h, as we now provide it alongside
  with strtod()

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31926 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 17:33:30 +00:00
Stephan Aßmus
57bb0b9fcd * Added DataExchange message constants and server communication structs for
retrieving WriterPlugins and EncoderPlugins from the media_addon_server.
* Enabled respective code in PluginManager (and fixed the copy&paste bugs),
  the server side is still missing, though...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31924 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 16:35:37 +00:00
Stephan Aßmus
f3d79634e6 Beginnings of Encoder[Plugin] and Writer[Plugin] base classes and add-on
management.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31922 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 16:25:30 +00:00
Stephan Aßmus
3575ad0034 Small style cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31921 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 16:24:00 +00:00
Stephan Aßmus
9d72a129c6 * Cleanup
* Added copyright.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31918 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 16:01:28 +00:00
Stephan Aßmus
ddcf2f7a64 Removed unused headers.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31917 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 15:54:56 +00:00
Stephan Aßmus
b1e235937a * Style cleanup.
* Added copyright.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31916 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 15:54:12 +00:00
Axel Dörfler
0d22b1a78c * Fixed copyright years, thanks Urias!
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31910 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 14:14:08 +00:00
Rene Gollent
9fba8251e9 Since wchar support now works, the wstring typedef should now also be safe.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31909 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 14:09:43 +00:00
Axel Dörfler
533cba7eff bonefish + axeld:
* Reverted r31809 as it introduced a race condition; if the I/O request had been
  notified, it could already been deleted at that point.
* Instead, we need to notify the request in each file system/driver that uses
  it. Added new notify_io_request() function that does that exactly.
* Added a TODO comment to the userlandfs where the request notification needs
  a bit more thought.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31903 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 12:16:15 +00:00
Axel Dörfler
c881516f65 * Accidently committed the wrong bash history line... these are the files that
were supposed to be deleted/changed with the previous commit.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31888 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 01:31:19 +00:00