Commit Graph

1286 Commits

Author SHA1 Message Date
Ingo Weinhold
383a9ac435 * Added an explicit boot_splash_uninit(). Not really needed, but makes
it clear when boot_splash_set_stage() must no longer be used.
* Free the memory associated with the kernel args before starting the
  init process. Unlike the original TODO stated there are quite a few
  more users of the kernel args (including the boot splash screen),
  hence we can't really do that earlier, unless we decide to copy the
  data over to the kernel heap. 


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26344 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-09 15:25:01 +00:00
Axel Dörfler
191a03fd11 * {add|remove}_node_listener() erroneously had "dev_t" as type of "node".
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26340 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-09 13:04:54 +00:00
Axel Dörfler
78b32dd026 * The rw_lock is now able to nest read/write locks when you have a write lock.
It follows the semantics of the BFS R/W lock, though, that is, if you unlock
  your write lock before the read locks, the read locks effectively become
  write locks, too.
* Added a mutex_transfer_lock() function that will allow you to unlock a mutex
  in a different thread than the one which locked it (only matters if KDEBUG
  is enabled, though).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26316 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-08 07:56:49 +00:00
Axel Dörfler
06d5e1b3b6 * Added ReadLocker/WriteLocker classes to auto lock an rw_lock.
* Added *_init_etc() functions to the fs_shell.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26302 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-07 18:12:33 +00:00
Axel Dörfler
af370c702a * Added a recursive_lock_trylock() function.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26297 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-07 16:17:34 +00:00
Axel Dörfler
52ecda6ecf * Added some optional KDL command and statistics to the file map implementation.
* Turned them on for now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26291 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-07 12:02:24 +00:00
François Revol
26e45f0523 Would work better with the definition...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26289 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-07 11:30:12 +00:00
Stefano Ceccherini
165db546bf should've been part of the previous commit.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26266 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-05 20:45:17 +00:00
Stefano Ceccherini
6e29a04d36 Patch by Dustin Howett which 'modularizes' timers. The best timer is
automatically selected at boot time. Pit and Apic timers are implemented
for now. Thanks Dustin!



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26265 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-05 20:40:06 +00:00
Axel Dörfler
0875ae984f * Preparations for a module listener API - this will be used in the (disk)
device managers.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26239 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-03 11:52:36 +00:00
Michael Lotz
b1f4df4a62 Implement heap classes that each have their own range of allocation sizes they
serve, bin sizes and page size. This minimizes the amount of "large"
allocations made in heaps that don't have a bin for the allocation size
(combining multiple pages). This is desirable as such large allocations
are generally pretty inefficient, and also because it separates larger from
smaller allocations better, making the chance of a heap becoming empty higher.
For now there are three heap classes "small", "large" and "huge", with a
predefined set of bin sizes for each. This might need some finetuning later on.
Reduce the grow size to 4MB though as the allocations should now be spread
across heap classes which each grow on their own.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26210 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-01 23:19:35 +00:00
Axel Dörfler
8531599a27 * KDiskDeviceManager::RescanDiskSystems() now also rescans all partitions with
the newly found disk systems.
* _ScanPartition() now allows to restrict the disk systems to a predefined set.
* _ScanPartition() now even scans partitions that already have a disk system
  assigned; if a better one is found, the existing one is replaced. It will
  ignore mounted or partitions with children, though.
* KPartition now also stores the priority of the disk system assigned to it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26177 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-30 10:36:47 +00:00
François Revol
ff41eb66a3 Fix build.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26171 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-29 21:08:12 +00:00
François Revol
f41c3a5bcd - Move Atari platform class out to a platform file.
- Use the platform object to determine the platform type in system_info.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26166 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-29 18:22:34 +00:00
Ingo Weinhold
e1b630c55d * Replaced the global cache pages hash table by an IteratableSplayTree
per cache.
* Changed the strategy vm_cache_acquire_page_cache_ref() uses to ensure
  that the cache isn't deleted while trying to get a reference. Instead
  of the global cache pages hash table lock, it holds the global cache
  list lock now. We acquire + release this lock in delete_cache() after
  removing all pages and just before deleting the object.
* Some small optimizations using the property that the cache's pages are
  ordered, now (vm_cache_resize(), vm_page_write_modified_page_range(),
  vm_page_schedule_write_page_range()).
* Replaced some code counting a cache's pages by simply using
  vm_cache::page_count.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26160 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-28 23:42:41 +00:00
Ingo Weinhold
c84d037f75 Added templatized SplayTree class derived from a Java implementation by
D. Sleater. Also added a IteratableSplayTree class that extends
SplayTree, additionally maintaining a singly-linked list, thus allowing
for efficient forward iteration.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26159 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-28 23:22:43 +00:00
Ingo Weinhold
276aa463ef * Replaced the useless InitCheck() method in {Open,Multi}HashTable (it
always returned B_OK) by a Init() method, which sets the initial size
  and returns an error, if that fails.
* Adjusted code using the classes accordingly. Replaced a few
  InitCheck() methods in the network code by Init().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26127 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-24 22:23: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
5da61ace79 - 040 mmu descriptors, FIXME
- remove unneeded include to make those usable by bootloader.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26117 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-23 23:15:43 +00:00
François Revol
1fd024be6a - missing ppc stub
- kernel_m68K almost links now, jsut bails out on the linker script...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26096 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-23 03:28:18 +00:00
François Revol
f0c5a3da4b - Add missing globals
- stubbed commpage stuff.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26094 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-23 01:54:18 +00:00
François Revol
30629f410c - move atari platform subclass to platform/atari_m68k/
- fix exception handling, at least it builds now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26089 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-23 00:16:23 +00:00
François Revol
375be9fa40 Add a machine type field. It should hold a platform dependant type. On Atari it's the high word of the _MCH cookie (2=TT,3=Falcon,5=ARAnyM).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26085 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-22 20:57:49 +00:00
François Revol
35471ac53e - add fpu states
- add needed asm_offsets
- start of exception handling


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26073 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-22 01:36:52 +00:00
Salvatore Benedetto
e65b3b4eac * Let's keep the alphabetical order
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26049 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-20 22:45:33 +00:00
Salvatore Benedetto
242b8e12a3 * Added italian keymap
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26048 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-20 22:40:15 +00:00
François Revol
04390361b5 - comment
- fix building arch_debug. Misses many regs still.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26042 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-20 02:22:26 +00:00
François Revol
a3dc7ef06c - some cpu and platform fixes.
- we'll just use decimal chip number (68030, ...) to identify cpu, fpu, and mmu for simplicity.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26041 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-20 02:11:45 +00:00
Michael Lotz
df7096a4aa * Added malloc_nogrow() function that does allocation without triggering or
waiting for a heap grow.
* Use that nogrow version in the VM code to avoid a deadlock with the address
  space lock when a grow operation would try to create an area while a malloc
  happened from such a function in the VM.
* When waiting for a grow to happen, notify the waiting thread from the grower
  also if it failed to allocate a new heap. Otherwise a thread would just sit
  there and wait until another thread requested growing too and that one
  succeeded (or just forever in the worst case).
* Make the dedicated grow heap growable too. If the current grow heaps run low
  on memory it will instruct the grower to allocate a new grow heap. This
  reduces the likelyhood of running out of memory with no way to grow to a
  minimum. As the growing is done asynchronously it is still possible to
  happen, but it is highly unlikely as the grow heap is solely used to
  allocate memory in the process of creating new heap areas and it will even
  try using normal public memory if the dedicated memory has run out.
* Reduced the dedicated grow heap from 2 to 1MB. As it can now grow itself, it
  doesn't need to last so long.
* Extract heap creation into it's own function that does area creation and heap
  attach and use this function for growing normal and grow heaps.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26009 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-18 19:55:51 +00:00
François Revol
9f0d1cf39d Remove PAGE_SIZE define for ppc and m68k from kernel private headers. It's not needed there and should be in public header anyway.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25921 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-11 01:16:48 +00:00
Michael Lotz
ca7b0f375e Patch by Olivier Coursiere that removes unneeded special characters.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25870 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-08 21:48:23 +00:00
Michael Lotz
cfbfa8bade Add french KDL keymap contributed by Olivier Coursiere, thanks!
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25858 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-08 00:32:14 +00:00
Michael Lotz
f5b3a6a796 * Initialize all static mutexes in the kernel through a MUTEX_INITIALIZER()
and remove the then unneeded mutex_init() for them.
* Remove the workaround for allowing uninitialized mutexes on kernel startup.
  As they are all initialized statically through the MUTEX_INITIALIZER() now
  this is not needed anymore.
* An uninitialized mutex will now cause a panic when used to find possibly
  remaining cases.
* Remove now unnecessary driver_settings_init_post_sem() function.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25812 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-05 23:19:27 +00:00
Michael Lotz
2c19d5ec25 * Add Dvorak keymap contributed by Darian Rackham, thanks!
* Cleanup the license header and add authors
* Sort the available keymaps list in the config file and add 'dv'

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25806 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-05 16:34:30 +00:00
Michael Lotz
01e46bdb18 * Extract the KDL keymap to a separate header and provide a 'sg' swiss german
keymap there too.
* Add a config header where one can select what KDL keymap should be used
  (currently only 'us' and 'sg' are available though).
* Provide a third keymap that is used when the alt modifier is used (the swiss
  german keymap is pretty useless without alt as all the useful keys like
  backslash and curly braces use alt).

Our KDL is so powerful and nice to use, the only thing that bothered me was
that I always had to think about where some of the special keys are located in
the US keymap. So this simple compile-time keymap switching provided to be
helpful for me and might be for others too. Keymaps for other layouts obviously
have to be written before this becomes really useful.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25803 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-04 17:56:30 +00:00
Axel Dörfler
d16ddc579c * The boot loader now passes on its EDID info to the kernel, and that will
be put into a boot_item in frame_buffer_console_init().
* The VESA driver now supports gettings the EDID information as well; this
  is necessary now, since the app_server no longer takes over the mode the
  boot loader had chosen.
* Note, we might want to do this via vm86 instead in the future, and remove
  the kernel part again.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25786 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-03 15:17:59 +00:00
Stefano Ceccherini
fa827b37fc took the liberty to add this to the buiild and fix compilation :)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25774 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-03 05:02:59 +00:00
Stefano Ceccherini
54d9d37f9d Added patch by Dustin Howett: header with HPET definitions and (empty)
file for hpet implementation. Not yet added to the build.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25773 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-03 04:37:18 +00:00
Ingo Weinhold
1c8de8581b * Added optional spinlock contention measurement feature. Enabled when
B_DEBUG_SPINLOCK_CONTENTION is defined to 1. It typedefs spinlock to a
  structure (thus breaking BeOS binary compatibility), containing a
  counter which is incremented whenever a thread has to wait for the
  spinlock.
* Added macros for spinlock initialization and access and changed
  code using spinlocks accordingly. This breaks compilation for BeOS --
  the macros should be defined in the respective compatibility wrappers.
* Added generic syscall to get the spinlock counters for the thread and
  the team spinlocks.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25752 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-02 02:04:12 +00:00
Ingo Weinhold
73aa393d73 * Introduced pipes in the kernel debugger. The syntax is similar to
pipes in the shell, though the semantics is a little different: The
  second command is invoked whenever the first command has written a
  complete line. The line is passed as last argument to the second
  command. The new command flag B_KDEBUG_PIPE_FINAL_RERUN causes the
  second command to be invoked again (with NULL argument) after the
  first command is done.
* Added kprintf_unfiltered() and kputs_unfiltered() which bypass the
  pipe mechanism and directly print to the bluescreen/serial output.
* Moved most commands from debug.cpp to the new
  debug_builtin_commands.cpp.
* B_KDEBUG_DONT_PARSE_ARGUMENTS commands don't get an argument anymore,
  if it would consist of white space only.
* Added new debugger command return value B_KDEBUG_ERROR, which
  indicates that executing the command failed. This return code will
  abort a complete pipe.
* Since debugger commands can nest (i.e. one command can invoke another
  one) the setjmp()/longjmp() mechanism to restore the stack after a
  page fault in a command needs more than one jump buffer.
* Added abort_debugger_command(), which longjmp()s out of the currently
  executed command. This will also abort the current pipe.
* When pagination is enabled pressing "a" will abort the running command
  (as opposed to "q" which only disables the blue screen output, but
  lets the command continue).
* Added debugger commands:
  - "grep" which can be used to filter output by pattern. Removed the
    "filter" command and the underlying mechanism that did that before.
  - "head" which prints only the first lines of output of another
    command.
  - "wc" counts lines, words, and characters of another command's
    output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25744 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-01 02:25:00 +00:00
Ingo Weinhold
9101535322 Added new kernel thread "undertaker" which gets rid of dead thread
remains. This replaces the previous mechanism of switching the thread to
a dedicated death stack. We might consider moving more cleanup work to
the undertaker, but that seems a little more involved.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25704 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-29 14:28:31 +00:00
Ingo Weinhold
2daa4194d4 Added macros for static initialization of mutexes, recursive locks, and
R/W locks.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25691 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-29 02:10:10 +00:00
Ingo Weinhold
2b07b8e0f1 * Replaced all instances of benaphores in the kernel code by mutexes.
* Removed kernel benaphores.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25690 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-29 02:08:23 +00:00
Ingo Weinhold
1c18a5df87 Replaced R/W lock implementation. Should have a little less overhead
than a semaphore, and can already be used in the early boot process.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25689 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-29 00:32:06 +00:00
Ingo Weinhold
b0f5179aa5 * Changed recursive_lock to use a mutex instead of a semaphore.
* Adjusted code using recursive locks respectively. The initialization
  cannot fail anymore, and it is possible to use recursive locks in the
  early boot process (even uninitialized, if in BSS), which simplifies
  things a little.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25687 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-28 23:12:36 +00:00
Axel Dörfler
9f16184577 Patch by Jan Klötzke with minor changes by myself:
* Use vm86 mode to call the VESA BIOS to do the actual mode switching by
  providing an ioctl in the vesa driver.
* Fix vm86.h.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25680 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-28 10:48:01 +00:00
Axel Dörfler
368167ede8 * Integration of the new driver architecture.
* Moved devfs from fs/ to device_manager/, and separated the legacy driver
  support from it.
* Removed fast_log module.
* There are a couple of (temporary) regressions, though:
  - legacy SATA and ISA IDE support is disabled, the drivers haven't been
    ported yet.
  - The not yet used ATA bus manager hasn't been ported yet, either.
  - AHCI changes have not been tested.
  - the listdev command has been removed from the build (as it currently
    doesn't work anymore).
  - device manager generated IDs currently are not freed anymore when a device
    node is removed.
  - generic drivers can't yet use the new driver architecture.
  - simple busses that do not support device types won't work yet.
  - legacy driver publishing/unpublishing (ie. what USB needs) has not been
    tested, and may be broken.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25662 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-26 16:52:27 +00:00
Ingo Weinhold
0f448d21e5 * Added vm_page_write_modified_page_range(), which is similar to
vm_page_write_modified_pages(), save that it only writes pages in the
  given range.
* Added vm_page_schedule_write_page_range() which schedules all modified
  pages in the given cache's range for writing by the page writer.
* Added _kern_sync_memory() syscall and the msync() POSIX function.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25620 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-22 21:51:12 +00:00
Axel Dörfler
15173df4e9 Last patch of the vm86 patch series from Jan Klötzke - thanks!:
* The new function vm86_do_int(struct vm86_state *state, uint8 vec) provides a
  facility to call BIOS interupt handlers. The function must only be called from
  a user thread context because the lower 1MB of the address space is used.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25610 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-22 13:54:28 +00:00
Axel Dörfler
7da0a81c0e Patch by Jan Klötzke (with additional TODO comments):
* Add a "fault_callback" to the thread structure which is called when a
  unhandled page fault happens in user space. A SIGSEGV will only be sent
  if the callback returns "true".


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25609 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-22 12:33:30 +00:00