Commit Graph

4079 Commits

Author SHA1 Message Date
Ingo Weinhold
3329d8c055 Patch by Andreas Faerber: Implemented arch_debug_call_with_fault_handler().
That makes the automatic stack traces in case of kernel panics work.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37021 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-06-05 18:36:44 +00:00
Ingo Weinhold
538a374b8a Patch by Andreas Faerber: Added support for
cpu_ent::fault_handler[_stack_pointer].


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37020 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-06-05 18:34:37 +00:00
Ingo Weinhold
193a433af0 Patch by Andreas Faerber: Generate an assembler compatible header with
structure offset definitions for PPC as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37019 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-06-05 18:32:44 +00:00
Ingo Weinhold
521aff921f Moved the page mapper and the page invalidation cache from
vm_translation_map_arch_info to X86VMTranslationMap where they actually
belong.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37014 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-06-04 22:53:17 +00:00
Ingo Weinhold
78dde7abd7 Consequently use uint32 for the physical page directory address.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37011 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-06-04 22:23:22 +00:00
Ingo Weinhold
2e04c067f9 Patch by Andreas Faerber:
vm_free_unused_boot_loader_range(): Don't free any memory beyond the given
range.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37010 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-06-04 22:04:20 +00:00
Axel Dörfler
db3aa13aaf * Patch by Andreas Färber that removes unneeded includes, mostly ones that don't
even have to be available in the generic case. See bug #6105, patch 1 & 2.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37007 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-06-04 08:03:02 +00:00
Ingo Weinhold
23aa437d66 Fixed nasty cast that breaks with sizeof(phys_addr_t) == 64.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37001 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-06-02 21:22:04 +00:00
Ingo Weinhold
1d578e15fe Fixed more address types related issues. Mostly printf() or comparison
warnings, but also some oversights from earlier changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37000 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-06-02 20:46:49 +00:00
Ingo Weinhold
8c9b84a588 Replaced the swap_addr_t and SWAP_SLOT_NONE in RadixBitmap.{h,cpp} by
radix_slot_t and RADIX_SLOT_NONE.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36998 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-06-02 20:42:53 +00:00
Ingo Weinhold
435c43f591 * Introduced type generic_io_vec, which is similar to iovec, but uses types
that are wide enough for both virtual and physical addresses.
* DMABuffer, IORequest, IOScheduler,... and code using them: Use
  generic_io_vec and generic_{addr,size}_t where necessary.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36997 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-06-02 18:42:20 +00:00
Axel Dörfler
03768a4052 * Introduced IOScheduler::MediaChanged() - this is now called by scsi_cd instead
of having the logic be triggered by IOScheduler::SetDeviceCapacity(), as that
  one might actually be called more often (for each call to update_capacity(),
  ie. each B_GET_GEOMETRY/B_GET_DEVICE_SIZE will trigger it), and there is no
  reason to throw away the cache every time (will make a difference during
  partition/file system detection).
* In cd_init_device() just call update_capacity() instead of duplicating its
  code.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36986 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-06-01 12:05:24 +00:00
Ingo Weinhold
64d79eff72 * Changed physical_entry::{address,size} to phys_{addr,size}_t and changed
map_physical_memory()'s physicalAddress parameter type from void* to
  phys_addr_t. This breaks source compatibility, but -- as long as
  phys_{addr,size}_t remain 32 bit wide -- keeps binary compatibility with
  BeOS.
* Adjusted all code using the affected interfaces (Oh what fun!). Added a few
  TODOs in places where the wrong types (e.g. void* for physical addresses
  are used). Looks like quite a few drivers aren't 64 bit safe and others
  will break with PAE.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36960 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-27 22:07:27 +00:00
Jérôme Duval
533119eab0 Patch from Joseph Prostko to fix the build with GCC 4.4 (ticket #4204).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36954 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-27 19:58:28 +00:00
Ingo Weinhold
e5846dfa61 Added shared sort_[physical_]address_ranges() to avoid code duplication. Also
fixes the m68k build.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36951 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-27 17:08:47 +00:00
Ingo Weinhold
d73ddac5bf * Introduced phys_addr_range type, an equivalent to addr_range for physical
address ranges, and a set of support functions working with it.
* Changed the type of the kernel_args physical address range arrays to
  phys_addr_range and adjusted the code working with those.
* Removed a bunch of duplicated address range code in the PPC's mmu.cpp.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36947 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-27 11:50:40 +00:00
Ingo Weinhold
147133b76c * First run through the kernel's private parts to use phys_{addr,size}_t
where appropriate.
* Typedef'ed page_num_t to phys_addr_t and used it in more places in
  vm_page.{h,cpp}.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36937 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-25 21:34:08 +00:00
Ingo Weinhold
9d570af7c8 Changed the type of the "op" parameter of the fs_vnode_ops::ioctl() hook and
the _kern_ioctl() syscall from ulong to uint32.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36927 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-24 21:04:22 +00:00
Ingo Weinhold
3a5655a502 * Reverted r34863.
* Don't keep any memory mappings from the OF for the time being. We can't
  keep mappings < 2 GB, since those aren't in the kernel address space and
  we don't handle memory mapped registers or the like correctly either.
Ticket #5193.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36886 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-21 15:33:28 +00:00
Ingo Weinhold
f51bcfb25b Added a heap_init_post_area() which is called right after areas can be
created, and moved the heap's grow and VIP heap initialization to it. Should
fix #5956.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36855 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-18 15:51:27 +00:00
Travis Geiselbrecht
53d7472637 BOOT SMP: allow systems with a large number of cpus and/or sparse apic ids to actually boot
The old mechanism to route an apic id back to a cpu id is faulty, built with the assumption that
the bios will 'pack' the apic ids from 0-num_cpus. In systems that dont do that, the code would
randomly corrupt the bootloader. Fatal in this case.

This quick fix simply rejects all apic ids >= MAX_CPUS (8). No way it would have worked before
if you had a box that started with >= 8 or anything, so it shouldn't regress any existing system.

Better solution is to allow any apic id to exist (0-255).

On this particular box the ids (from lunix dmesg):
SRAT: PXM 0 -> APIC 0 -> Node 0
SRAT: PXM 1 -> APIC 16 -> Node 1
SRAT: PXM 0 -> APIC 2 -> Node 0
SRAT: PXM 0 -> APIC 4 -> Node 0
SRAT: PXM 0 -> APIC 6 -> Node 0
SRAT: PXM 1 -> APIC 18 -> Node 1
SRAT: PXM 1 -> APIC 20 -> Node 1
SRAT: PXM 1 -> APIC 22 -> Node 1
SRAT: PXM 0 -> APIC 1 -> Node 0
SRAT: PXM 0 -> APIC 3 -> Node 0
SRAT: PXM 0 -> APIC 5 -> Node 0
SRAT: PXM 0 -> APIC 7 -> Node 0
SRAT: PXM 1 -> APIC 17 -> Node 1
SRAT: PXM 1 -> APIC 19 -> Node 1
SRAT: PXM 1 -> APIC 21 -> Node 1
SRAT: PXM 1 -> APIC 23 -> Node 1



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36836 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-17 03:47:24 +00:00
Axel Dörfler
ae26daa623 * The '-' modifier was ignored for anything but relative seconds. Now, months,
days, and years are supported as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36821 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-15 14:32:45 +00:00
Ingo Weinhold
8ccc58ffa9 Missing line breaks in dprintf().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36785 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-10 17:26:50 +00:00
Ingo Weinhold
07e1164e59 syslog_init(): Bail out, if kernel_args::debug_output is NULL. Would crash on
platforms that are ignorant of the debug syslog feature.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36748 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-08 17:02:02 +00:00
Ingo Weinhold
13fa4c845a * Introduced new area creation flag CREATE_AREA_DONT_COMMIT_MEMORY.
map_backing_store() doesn't commit memory when this flag is given.
* Used the new flag vm_copy_area(): We no longer commit memory for read-only
  areas. This prevents read-only mapped files from suddenly requiring memory
  after fork(). Might improve the situation on machines with very little RAM
  a bit.
  We should probably mark writable copies over-committing, since the usual
  case is fork() + exec() where the child normally doesn't need more than a
  few pages until calling exec(). That would significantly reduce the memory
  requirement for jamming the Haiku tree.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36651 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-06 14:59:14 +00:00
Ingo Weinhold
83bc49d051 vm_page_requeue(): Disabled DEBUG_PAGE_ACCESS_CHECK(). Since r36155
idle_scan_active_pages() cannot satisfy this assertion anymore. Added TODO
for a better fix which can wait until after the release.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36649 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-06 13:42:24 +00:00
Ingo Weinhold
7b926f5135 Allocate memory for the DEBUG_CACHE_LIST debug feature only when there's
plenty available.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36634 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-05 21:18:46 +00:00
Ingo Weinhold
3735d4e299 mark_page_range_in_use(): When the given range lies partially outside the
array at least work with the part intersecting with the array. Log those
quasi error cases.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36633 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-05 21:17:28 +00:00
Ingo Weinhold
8588e7fc6f Fixed broken mmu_allocate_physical():
* Now it checks whether the given physical range exists at all.
* Not only check whether any range of the given size is free, but also check
  whether the given range is free.
* B_BAD_VALUE is not a particularly good return value for a function supposed
  to return a bool

Fixes #5911. With only 64 MB RAM the usual debug syslog buffer location may
be outside the actually existing physical memory.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36632 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-05 21:15:33 +00:00
Ingo Weinhold
863c623f9a Added is_address_range_covered(), returning whether the given address range
is fully covered by the ranges in the array.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36631 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-05 21:09:11 +00:00
Axel Dörfler
18654db620 * Fixed minor style issues.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36626 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-05 14:37:35 +00:00
Axel Dörfler
cd7a139273 * boot_item_init() must come before debug_init_post_vm() or else neither the
boot screen cannot be updated, nor might VESA work.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36625 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-05 14:36:03 +00:00
Axel Dörfler
7198f76564 * During early kernel startup, we must not create areas without the
CREATE_AREA_DONT_WAIT flag; waiting at this point is not allowed.
* I hope I found all occurences, but there might be some areas left (note,
  only those that don't use B_ALREADY_WIRED are problematic).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36624 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-05 13:12:07 +00:00
Axel Dörfler
8c8fcd770a * Moved the addition of the basic debugger commands directly after the VM init.
* Separated the other stuff previously done in debug_init_post_vm() to the new
  debug_init_post_settings().
* Removed superfluous status_t return codes - they are ignored, anyway, and if
  there really is a show stopper in the init process, panicking would be the
  thing one should do.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36623 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-05 10:05:25 +00:00
Axel Dörfler
55d903d249 * Fixed typo.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36622 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-05 10:03:32 +00:00
Ingo Weinhold
c4697c01a9 Patch by Andreas Faerber: Implemented fallbacks (e801 and 88) to get the
memory map in case e820 is not supported by the BIOS.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36595 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-03 13:15:18 +00:00
Ingo Weinhold
38d2fc985c IORequest::NotifyFinished(): Assert that the request hasn't been finished
before.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36594 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-03 12:44:48 +00:00
Ingo Weinhold
fa0c1e96a0 Hopefully the last work on the MTRR code for the time being:
Since we also force uncacheability via the PTEs, it is no longer necessary to
use MTRRs for uncacheable ranges. It is recommended, which is why we still do
it, if possible, but when we run out of MTRRs, the algorithm ignores
uncacheable ranges now -- iteratively it increases the minimum size of ranges
to drop until the available MTRRs suffice.
Should fix #5703 and #5865.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36591 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-02 23:05:38 +00:00
Ingo Weinhold
6f2772b135 vm_map_physical_memory(): When alreadyWired we have to explicitly set the
memory type for the mapped pages.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36590 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-02 22:52:25 +00:00
Ingo Weinhold
001a0e0987 memory_type_to_pte_flags(): Also set the write-through flag for uncacheable
memory. This avoids implementation defined behavior on Pentium Pro/II when
intersecting with an write-combining or write-protected MTRR range.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36589 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-02 22:50:30 +00:00
Ingo Weinhold
f23be5bbed Support memory types in page mappings to the degree that is possible without
PAT support (i.e. uncacheable, write-through, and write-back). Has pretty
much no effect ATM, as the MTRRs restrict the types to what is actually
requested.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36583 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-02 15:30:52 +00:00
Ingo Weinhold
bfb3b117eb mmu_init(): In case we couldn't get a memory map from the BIOS the fixed
memory setup was 1 MiB larger than advertised.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36581 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-02 12:56:40 +00:00
Ingo Weinhold
e33adea4dc Fixed PPC build.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36580 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-02 12:53:47 +00:00
Stefano Ceccherini
c65e6981d2 rest of the patch by Kaliber in ticket #5875.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36578 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-02 10:34:57 +00:00
Ingo Weinhold
c1be1e0761 * VMTranslationMap::Map()/Protect(): Added "memoryType" parameter. Not
implemented for any architecture yet.
* vm_set_area_memory_type(): Call VMTranslationMap::ProtectArea() to change the
  memory type for the already mapped pages.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36574 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-01 21:33:12 +00:00
Ingo Weinhold
3b0c1b5227 * VMArea: Made memory_type private and added setter and getter methods.
* Don't set the VMArea's memory type in arch_vm_set_memory_type(), but let the
  callers do that.
* vm_set_area_memory_type(): Does nothing, if the memory type doesn't change.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36573 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-01 20:41:57 +00:00
Ingo Weinhold
907886143f * Changed some parameters of VM syscalls from int to uint32, mostly for sake
of consistency.
* Moved the B_OVERCOMMITTING_AREA flag from B_KERNEL_AREA_FLAGS to
  B_USER_AREA_FLAGS, since we really allow it to be passed from userland.
* Most VM syscalls check the provided protection against B_USER_AREA_FLAGS
  instead of B_USER_PROTECTION, now. This way they allow for
  B_OVERCOMMITTING_AREA as well.
* _user_map_file(), _user_set_memory_protection(): Check the protection like
  the other syscalls do and use fix_protection() instead of doing that
  manually.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36572 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-01 19:47:39 +00:00
Ingo Weinhold
a5de454f45 VM{Kernel,User}Area::Create(): On error free the area's memory heeding the
given allocation flags. Could deadlock otherwise.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36571 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-01 18:50:21 +00:00
Ingo Weinhold
40f1dd8443 arch_vm_supports_protection(): Fixed broken check.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36570 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-01 18:31:12 +00:00
Ingo Weinhold
f651548ee6 scheduler_reschedule_no_op(): panic() when the calling thread is not
continuing to run. This must not happen since the thread is the boot CPU's
idle thread performing the early kernel initialization (before the scheduler
is started).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36560 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-30 19:40:20 +00:00
Ingo Weinhold
26f1dd2708 Added a third rendez-vous point for the call_all_cpus() MTRR functions. This
fixes the problem that the CPU initiating the call could make the next call
and reset sCpuRendezvous2 before the other CPUs have returned from their
smp_cpu_rendezvous(). Probably virtually impossible on real hardware, but I
could almost reliably reproduce it with qemu -smp 2 (would hang the late boot
process without ability to enter KDL).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36559 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-30 19:37:19 +00:00
Ingo Weinhold
7f987e49d7 Added a rendez-vous variable parameter to smp_trap_non_boot_cpus() and make
boot CPU wait until all other CPUs are ready to wait. This solves a
theoretical problem in main(): The boot CPU could run fully through the early
initialization and reset sCpuRendezvous2 before the other CPUs left
smp_cpu_rendezvous(). It's very unlikely on real hardware that the non-boot
CPUs are so much slower, but it might be a concern in emulation.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36558 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-30 19:32:12 +00:00
Ingo Weinhold
4d6b1f03da Documented smp_cpu_rendezvous().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36556 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-30 18:33:25 +00:00
Ingo Weinhold
0ef0e3cfa0 Map read-only segments over-committing for the relocation. This prevents the
kernel from committing memory for all read-only segments until we're done
relocating. This allows Haiku to boot on machines with less RAM and swap
disabled. At least in qemu I could boot with 100 MB and start WebPositive.
Probably fixed #5822.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36552 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-30 12:09:43 +00:00
Ingo Weinhold
fe5ea7b4d2 VMAnonymous[NoSwap]Cache, overcommitting mode:
* Commit(): Unreserve memory when asked to shrink the commitment.
* Fault(): The whole logic is flawed, since this is always called by
  vm_soft_fault(), even, if the page is finally mapped from a lower cache.
  Now we do at least limit our commitment to (page_count + 1) * B_PAGE_SIZE
  instead of always reserving memory for another page.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36551 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-30 12:02:33 +00:00
Ingo Weinhold
278f7e57cd map_backing_store(): Also consider the B_OVERCOMMITTING_AREA for private
maps. The new cache will be created in over-committing mode.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36550 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-30 11:55:27 +00:00
Ingo Weinhold
8cd3dac13e Reintroduced sigwait(), sigsuspend(), and sigpending(). There are obviously
drivers using those.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36548 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-30 10:00:44 +00:00
Ingo Weinhold
73f4184b7b Unset sSyslogBuffer in all error cases in which we disable syslog output.
Spotted by Axel.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36532 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-29 15:32:54 +00:00
Ingo Weinhold
d3166e469c Replaced no longer necessary send_signal_etc() work-arounds for
resume_thread().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36531 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-29 15:23:29 +00:00
Ingo Weinhold
28d05e026f Make scheduler_reschedule() an no-op until we're ready to start the
scheduler. This avoids the need to use the send_signal_etc() work-around for
resume_thread() during the early kernel initialization. Might fix #5851.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36530 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-29 15:10:37 +00:00
Axel Dörfler
d3a302aae8 * embedded_controller_support() now actually checks all entries of the
supporting ID array (just that it only contains one entry).
* Fixed missing malloc() result check in embedded_controller_init_driver().
* Style fixes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36529 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-29 15:09:38 +00:00
Ingo Weinhold
7b8344c61e syslog_init_post_vm(): If the syslog is disabled, clear sSyslogBuffer. It is
already initialized in syslog_init(), if the debug syslog feature is enabled.
Since the area would never be created, the pointer becomes invalid, however,
and could cause a double fault on entering KDL.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36528 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-29 14:16:25 +00:00
Ingo Weinhold
d62afe7ab0 VMUserAddressSpace::LookupArea(): Although only a read-lock is the
precondition for calling the function it read/write accessed the fAreaHint
attribute in a non-atomic manner. I.e. if executed concurrently by two
threads of the same team one could return the wrong area. The most likely
problem could be caused in vm_soft_fault(), leading to pages being added to
the wrong caches.
The bug itself is inherited from NewOS, but is triggered way more likely
since the page daemon unmaps inactive pages (r35485). Probably fixes #5413.
Might also fix the sporadically occurring crashes/asserts in the hoard
allocator -- at least inactive pages being replaced by zeroed ones would be
an excellent explanation.
[Thanks to Matt for providing remote debug access to his machine.]


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36523 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-28 22:06:40 +00:00
Axel Dörfler
4fe399e426 * Use vm_page_write_modified_page_range() instead of
vm_page_schedule_write_page_range() to prevent more memory pressure.
* While it seems to help a bit, it doesn't solve the problem of bug #5777.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36519 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-28 18:09:09 +00:00
Ingo Weinhold
22984248fa * kernel_debugger_loop(): Don't access sSyslogBuffer without checking whether
it is non-NULL first.
* syslog_init_post_vm(): Make sure the area for the debug syslog could actually
  be created and fail otherwise.
* syslog_init_post_threads(): Fixed the cleanup on error. In case of a debug
  syslog we need to delete the respective area instead of free()ing the
  memory.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36497 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-26 21:16:36 +00:00
Ingo Weinhold
5060d7980f IOCache implements IOScheduler, now.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36494 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-26 15:43:20 +00:00
Ingo Weinhold
2eab54201c Added SetDeviceCapacity() method.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36493 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-26 15:42:34 +00:00
Ingo Weinhold
0715529b59 Renamed IOScheduler to IOSchedulerSimple and pulled an interface IOScheduler
out of it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36492 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-26 14:47:24 +00:00
Ingo Weinhold
7aba4e400e Moved IOSchedulerRoster into its own header/source files.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36491 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-26 14:09:39 +00:00
Ingo Weinhold
b1e06d23ce * The "page_stats" command does now also print the longest contiguous runs of
free respective free and cached pages.
* Removed the unused vm_page_allocate_page_run_no_base().
* vm_page_allocate_page_run() (and allocate_page_run()):
  - Use vm_page_reserve_pages() instead of vm_page_try_reserve_pages(), i.e.
    wait until the reservation succeeds.
  - Now we iterates two times through the pages to find a suitable page run. In
    the first iteration it only looks for free/clear pages, in the second
    iteration it also considers cached pages. This increases the chance of the
    function to succeed, when a lot of caching is going on.
    This reduces the amount of memory required to use the IOCache when booting
    off the anyboot Live CD to around 160 MB in qemu. It also seems to work with
    128 MB, but the syslog indicates that some memory allocations fail, which
    is not exactly inspiring confidence.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36489 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-26 13:56:09 +00:00
Ingo Weinhold
c1b8ab4ef0 vm_create_anonymous_area(): Allocate the page run for B_CONTIGUOUS areas
before locking the address space. That gives us a bit more flexibility in
vm_page_allocate_page_run().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36486 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-26 13:28:05 +00:00
Ingo Weinhold
f14480bc2c Essentially rewrote the IOCache to use a VMCache and unmapped pages for
caching (similar to the file cache) instead of contiguous areas. This is
probably a little bit slower, but integrates better with the VM -- the
caching doesn't increase memory pressure and the least recently used pages
will automatically be recycled when needed.
There are still memory allocation issues on machines with little memory. The
USB stack apparently tries to allocate a rather big chunk of contiguous
memory, which fails when all not otherwise bound memory is used for caches,
since the VM functions for allocating contiguous memory consider only free
pages ATM.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36458 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-24 21:54:49 +00:00
Axel Dörfler
fd722a6734 * Minor coding style cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36439 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-23 18:28:45 +00:00
Ingo Weinhold
e91e4ee0a6 Added IOCache, a simple write-through cache implementation that can be used
as a drop-in replacement for IOScheduler, processing IORequests synchronously
in FIFO order. It stores cache lines of user-defined size. Currently for each
cache line an area of contiguous memory is used, which is not optimal.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36436 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-23 18:07:31 +00:00
Ingo Weinhold
ccb3f07a14 get_memory_map_etc(): Setting the return value to B_BUFFER_OVERFLOW in the
loop causes the function to return before setting the _numEntries. The
overflow case is checked at the end of the function anyway, so we can just
break out.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36425 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-22 22:48:33 +00:00
Fredrik Holmqvist
5d9cc10f80 Moving ACPI Embedded Controller to ACPI bus manager.
* Removed irq_routing struct from ACPI.h to where it is used. Might be able to use acrestype.h instead of duplication.
 * Disable old embedded controller and remove it from image.
 * Move embedded controller code to busmanager module.
 * Remove (some) code duplication

Should work as before, but is now initialized right after the bus manager. Can probably remove further code duplication.
I hope I've done it correctly, feedback is most welcome.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36420 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-22 16:19:41 +00:00
Ingo Weinhold
63fe660c1b * Replaced a few hardcoded partitioning/file system type names by the
respective constants.
* compare_image_boot(): Compare volume names case insensitively.
* DiskBootMethod::IsBootDevice(): For BOOT_METHOD_CD only accept devices with
  removable media.
* DiskBootMethod::IsBootPartition(): Added special recognition for anyboot
  CDs. Since their partition types aren't kPartitionTypeDataSession,
  compare_cd_boot() didn't prefer them and it was more or less random whether
  it was chosen when other Haiku installations where available. Moreover
  selecting the CD in the boot loader menu would cause the kernel not to find
  it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36403 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-21 18:00:23 +00:00
Ingo Weinhold
04b174ca25 * Moved IOCallback class into separate source file.
* Moved IOScheduler::_IOCallbackWrapper() to IOCallback::WrapperFunction().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36394 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-21 11:20:07 +00:00
Jérôme Duval
8fbb8bd5b6 fixes r36356, *only* when times is NULL, both the access and modification timestamps should be set. Thanks to Ingo for reviewing!
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36379 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-20 17:23:57 +00:00
Ingo Weinhold
6e83a6fac9 * VMCache::Resize(): Corrected TODO comment.
* Changed the semantics of VMCache::HasPage(). It was interpreted
  inconsistently by the derived classes. Now it returns whether the backing
  store can provide the page (via Read()). The default implementation returns
  false. VNodeCache::HasPage() only returns true, if the given offset is
  within the cache (i.e. file) bounds. This prevents vm_soft_fault() from
  adding clean pages to vnode caches on faults beyond the file bounds.
  Probably fixes #5473 -- at least mmap_resize_test behaves correctly, now.
* Removed redundant HasPage() and Fault() overrides in VMCache derived
  classes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36374 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-20 15:10:09 +00:00
Ingo Weinhold
efeca209a1 Made VMCache::Resize() virtual and let VMAnonymousCache override it to free
swap space when the cache shrinks. Currently the implementation stil leaks
swap space of busy pages.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36373 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-20 14:04:18 +00:00
Ingo Weinhold
ba16e4ec61 cut_area(): We should only resize RAM caches.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36372 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-20 13:56:45 +00:00
Ingo Weinhold
1c1d16b344 Adjusted indentation. No functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36360 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-19 20:41:05 +00:00
Jérôme Duval
1276d52122 * fixed utimensat() when times is NULL, both the access and modification timestamps should be set (bug #5759).
* the meaning of AT_SYMLINK_NOFOLLOW was also reversed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36356 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-19 17:12:44 +00:00
Ingo Weinhold
d78426257a Use SPINLOCK_PAUSE() in the pthread_spin_lock() loop.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36352 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-19 14:17:17 +00:00
Ingo Weinhold
45538a5e31 x86_handle_debug_exception(): The values of dr6 and dr7 are only stored in
the CPU info, if x86_exit_user_debug_at_kernel_entry() was executed before,
i.e. if the debug exception occurred in userlands. In all other cases we need
to read the current register values. Fixes #5742, a regression introduced in
r35951.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36340 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-18 17:06:02 +00:00
Ingo Weinhold
ef1716f81b Patch by Lucian Adrian Grijincu: Added pthread spinlock support.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36333 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-17 19:38:01 +00:00
Jérôme Duval
42fb4f4050 * fstatat: the meaning of AT_SYMLINK_NOFOLLOW was reversed. Fixed #5731.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36331 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-17 11:39:01 +00:00
Ingo Weinhold
a34e7d0ec4 Set fTranslationMap to NULL in the constructor. Otherwise an error in
Create() could cause the destructor to crash.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36329 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-16 08:36:58 +00:00
Ingo Weinhold
f71274580b * Private libroot locking primitives:
- Reimplemented mutex to use the _kern_mutex*() syscalls.
  - The initializer functions cannot fail anymore -- changed their return type
    to void.
  - Changed the initializer function semantics to not copy the name by default
    anymore (as in the kernel). Also added *_etc() versions of them that take an
    additional flags.
  - Added static initializer macros.
  - Made the mutex (and thus recursive_lock) lock functions non-interruptable.
  - Got rid of the "lazy" version. They are no longer needed, since the
    initialization of the standard types can be done statically and cannot fail.
* Adjusted libroot, runtime loader, and other code using the private libroot
  locking primitives to the new semantics.
* pthreads mutexes and condition variables:
  - Reimplemented using the _kern_mutex*() syscalls.
  - Consistently use POSIX error codes.
  - Fixed some not quite POSIX compliant behavior.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36323 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-15 21:52:49 +00:00
Ingo Weinhold
251e72542e Added TODO.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36322 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-15 21:48:12 +00:00
Ingo Weinhold
0dffa8d48e * remove_user_mutex_entry(): The next entry wasn't removed from its own list.
* user_mutex_unlock_locked(): Set or clear the locked flag depending on whether
  we wake up a waiter.
* _user_mutex_switch_lock(): The syscall cannot be restartable.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36319 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-15 21:21:32 +00:00
Axel Dörfler
e3ce6e4be5 * Added warm reboot functionality based on a patch by Grey, thanks! It can be
invoked using the 'w' key.
* Checking allocations doesn't hurt.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36311 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-15 18:10:00 +00:00
Axel Dörfler
868aa7a0e0 * Added shortcut handling to the boot loader menu (in preparation of adopting
ticket #5312).
* Added shortcut 'b' to continue booting, 'r' to reboot.
* Consolidated asterisk style.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36310 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-15 18:07:40 +00:00
Axel Dörfler
024bc08b2f * Fixed warning.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36302 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-15 15:51:47 +00:00
Axel Dörfler
fba2ee2527 * We should check for the I/O APIC before mapping it (since we panic if mapping
it failed...).
* Moved IRQ table reading much earlier (before starting to program the I/O
  APIC), though it currently fails, possibly because the device manager isn't
  up yet, and there is no embedded controller driver.
* The kernel now enables I/O APICs by default, but the boot loader disables
  them - you can now enable them using the safe mode menu, but it currently
  won't have any (positive) effect.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36293 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-15 13:54:15 +00:00
Axel Dörfler
9de17be600 * Moved I/O APIC initialization to a later point, now the APCI and DPC modules
can safely be used.
* Since using the I/O APIC is disabled by default, I've removed the "return"
  that prevented its use when enabled. Let's see if it already does anything.
* Adapted other arch_int.cpp with a bit of cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36290 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-15 12:42:10 +00:00
Michael Lotz
fdad233b47 Move the actual area deletion out of the locked section as we could otherwise
double/deadlock when we delete heap areas because of other area deletions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36284 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-15 11:13:16 +00:00
Michael Lotz
1888e2289d bonefish+mmlr:
The O_CLOEXEC open mode wasn't actually set in the close-on-exec bitmap causing
all files opened with O_CLOEXEC (like done in the storage kit classes) to still
be inherited. This caused for example to be unable to unmount volumes when
opening apps while Tracker touched some files (i.e. copying some large files)
since these apps would inherit the file descriptor and therefore keep the
volume busy.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36273 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-14 21:46:14 +00:00
Michael Lotz
74fc3e9a8b bonefish+mmlr:
* Add file descriptor and IO context tracing.
* Some minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36272 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-14 21:38:08 +00:00
Axel Dörfler
a608485f26 * Added new team flag B_TEAM_DEBUG_PREVENT_EXIT that prevents teams from exiting
via exit() (the calling thread will drop into the debugger instead).
* The DebugServer now uses this flag by default.
* Added TODO comment: the default debugger should already be able to set a flag
  like this in order to close a race condition between dropping a thread into
  the debugger and setting the flag.
* Cleaned up the debug_server sources a bit.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36265 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-14 18:03:48 +00:00
Axel Dörfler
d97b5913aa * Fixed incorrect indentation.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36258 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-14 12:49:12 +00:00
Michael Lotz
545259ff2e This fixes the debug build of libroot.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36253 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-14 12:07:09 +00:00
Ingo Weinhold
e506fde883 wait_if_address_range_is_wired() was leaking a cache reference.
Fixes #5710.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36237 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-13 21:18:52 +00:00
Ingo Weinhold
5f310d4d0d Added TODO.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36236 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-13 21:16:23 +00:00
Axel Dörfler
a1b2e9e959 * Removed F8 and F12 keys again, see comments to bug #5163.
* Some cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36233 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-13 18:25:56 +00:00
Ingo Weinhold
fc813f1a1a Fixed typo in area name.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36232 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-13 17:42:10 +00:00
Ingo Weinhold
c3676b54bf * Added vm_debug_copy_page_memory() which copies memory from a potentially not
mapped page.
* debug_{mem,strl}cpy():
  - Added "team" parameter for specifying the address space the address are
    to be interpreted in.
  - When the standard memcpy() (with fault handler) fails, fall back to
    vm_debug_copy_page_memory().
* Added debug_is_debugged_team(): Predicate returning true, if the supplied
  team_id refers to the same team debug_get_debugged_thread() belongs to.
* Added DebuggedThreadSetter class for scope-based debug_set_debugged_thread().
  Made use of it in several debugger functions.
* print_demangled_call() (x86): Fixed unsafe memory access.

Allows KDL stack traces to work correctly again, even if the page daemon has
already unmapped the concerned pages.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36230 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-13 17:40:15 +00:00
Ingo Weinhold
ca4dd26afd Missed that one in r36228: DebugHasPage() implementation.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36229 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-13 17:34:32 +00:00
Ingo Weinhold
86875ad9d1 Added VMCache::DebugHasPage() and DebugLookupPage() for use in the kernel
debugger.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36228 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-13 17:18:57 +00:00
Ingo Weinhold
09418c869b Added DebugGet() method for use in the kernel debugger.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36227 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-13 17:16:42 +00:00
Michael Lotz
33fbe25496 * Add code to allocate and free interrupt vectors for message signaled
interrupts (MSI).
* Add the remaining IDT entries and redirection functions in the interrupt code.
* Make the PIC end_of_interrupt() return a result to indicate whether the vector
  was handled by this PIC. If it isn't we now issue a apic_end_of_interrupt()
  in the assumption of apic local interrupt, MSI or IPI. This also removes
  the need for the gUsingIOAPIC global and doing manual apic_end_of_interrupt()
  calls in the SMP and timer code.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36221 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-13 14:46:09 +00:00
Michael Lotz
aeae7bf4dc Add ffs() (find first set bit, starting at least significant) to the kernel.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36220 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-13 14:34:06 +00:00
Axel Dörfler
fefe246c70 * Set the exit status for the main thread as well in _user_exit_team().
* This closes bug #5713.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36215 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-13 13:29:56 +00:00
Axel Dörfler
2e7bd0169f * The kernel daemon no longer hold its lock when calling the registered hooks.
* This fixes bug #5421.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36209 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-13 12:09:56 +00:00
Ingo Weinhold
50e4dd9328 axeld + bonefish: X86VMTranslationMap::Protect():
* Removed rounding up the end address to page alignment. It's not necessary
  and could cause an overflow.
* Fixed possible infinite loop triggered by a rare race condition: When two
  threads of a team were accessing the same unmapped page at the same time
  each would trigger a page fault. One thread would map the page again, the
  second would wait until the first one was done and update the page
  protection (unnecessarily but harmlessly). If the first thread accessed the
  page again at an unfortunate time, it would implicitly change the
  accessed/dirty flags of the page's PTE, which was a situation the loop in
  Protect() didn't consider and thus run forever.
  Seen the problem twice today in form of an app server freeze.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36197 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-12 20:30:49 +00:00
Michael Lotz
3d310bd5f4 * Fix build, the APIC definitions are used in the bootloader too.
* Automatic whitespace cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36189 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-12 15:59:40 +00:00
Ingo Weinhold
aa26d10790 delete_area(): When the address space is the kernel address space, we need to
pass stricter allocation flags to VMAddressSpace::{Remove,Delete}Area() or
could deadlock otherwise.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36188 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-12 15:25:08 +00:00
Michael Lotz
655f3b4161 Seperate the generic (local) APIC stuff into it's own file and use it from the
other places where previously the same functionality was duplicated. Also
seperated the header which was originally arch_smp.h into apic.h and arch_smp.h
again as some of it is MP and not actually APIC.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36182 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-12 12:56:13 +00:00
Axel Dörfler
ee0d2be9e4 bonefish+axeld:
* Implemented a tiny bit more sophisticated version of
  estimate_max_scheduling_latency() that uses a syscall that lets the scheduler
  decide.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36170 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-11 20:40:58 +00:00
Ingo Weinhold
813d4cbe94 * Moved created subdirectory src/system/kernel/lock.cpp to new subdirectory
locks.
* Added syscalls for a new kind of mutex. A mutex consists only of an int32 and
  doesn't require any kernel resources. So it's initialization cannot fail
  (it consists only of setting the mutex value to 0). An uncontended lock or
  unlock operation can basically consist of an atomic_*() in userland. The
  syscalls (when the mutex is contended) are a bit more expensive than semaphore
  operations, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36158 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-11 16:07:39 +00:00
Ingo Weinhold
349039ff2e Added vm_[un]wire_page(), which are essentially versions of
[un]lock_memory_etc() optimized for a single page.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36156 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-11 15:07:06 +00:00
Ingo Weinhold
713bede839 full_scan_inactive_pages(): Don't call DEBUG_PAGE_ACCESS_START() before
checking whether the page is busy.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36155 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-11 14:49:06 +00:00
Clemens Zeidler
ad0b28334d Fix spelling, pointed out by Stefano and Axel.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36139 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-11 09:52:42 +00:00
Ingo Weinhold
9d3e718801 We must not resize the area hash table while holding an address space lock,
since it could be the kernel address space.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36091 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-08 18:30:22 +00:00
Ingo Weinhold
16b4b2c13b Fixed broken sprintf() invocation.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36087 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-08 17:06:56 +00:00
Ingo Weinhold
078dbb2d0e Defined more sysconf() and _POSIX_* constants required by POSIX.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36074 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-07 18:52:25 +00:00
Ingo Weinhold
f603ab3c58 Disabled more unused code (the cache allocation is disabled, so no need for
deallocation).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36073 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-07 18:51:00 +00:00
Clemens Zeidler
cb58e3f784 Rescue acpi irq stuff from my defect laptop. Code is disabled and should't to any harm.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36059 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-07 12:50:55 +00:00
Ingo Weinhold
6f33e7286f Handle sigaction[_etc]() return value correctly (it's not an error code).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36056 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-06 20:24:23 +00:00
Ingo Weinhold
2be99447d8 * Added some comments to the thread flags.
* Added new thread flag THREAD_FLAGS_ALWAYS_RESTART_SYSCALL. If set, it forces
  syscall restart even when a signal handler without SA_RESTART was invoked.
* Fixed sigwait(): If one of requested signals wasn't already pending it would
  never wake up. Also, the syscall always needs to be restarted, if interrupted
  by another signal.
* Renamed a bunch of the POSIX signal function implementations which did return
  an error code directly (instead via errno). Added correct POSIX functions
  where needed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36054 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-06 20:23:18 +00:00
Ingo Weinhold
5a0b30dbda Don't cancel the alarm on exec*(). POSIX alarm() requires that. The BeBook
doesn't mention the expected set_alarm() behavior. Tests under BeOS R5 Bone
crash the system in either case, though, so I guess we're free to go with the
expected POSIX behavior.
This make detection of hanging tests in the Open POSIX Test Suite work.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36046 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-06 17:06:08 +00:00
Ingo Weinhold
4f774c503c * VMArea::Unwire(addr_t, size_t, bool): Don't delete the removed range, but
return it.
* lock_memory_etc(): On error the VMAreaWiredRange object could be leaked.
* [un]lock_memory_etc(): Call VMArea::Unwire() with the cache locked and
  explicitly delete the range object after unlocking the cache to avoid
  potential deadlocks.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36035 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-05 12:12:36 +00:00
Ingo Weinhold
369111e741 * Removed the VMArea::Wire() version that has to allocate a VMAreaWiredRange.
Since the requirement is that the area's top cache is locked, allocating
  memory isn't allowed.
* lock_memory_etc(): Create the VMAreaWiredRange object explicitly before
  locking the area's top cache.

Fixes #5680 (deadlocks when using the slab as malloc() backend).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36033 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-05 11:08:01 +00:00
Ingo Weinhold
550376ffb8 * vm_delete_areas(): Changed return type to void (was status_t and not used).
* _user_map_file(), _user_unmap_memory(): Verify that the address (if given) is
  page aligned.
* Reworked memory locking (wiring):
  - VMArea does now have a list of wired memory ranges and supports waiting for
    a range to be removed.
  - vm_soft_fault():
    - Added "wirePage" parameter that, if given, makes the function wire the
      page and return it.
    - Added "wiredRange" parameter (for calls from lock_memory_etc()) and made
      sure we never unmap wired pages. This could e.g. happen when a page from a
      lower cache was read-mapped and a write fault occurred. Now in such a
      situation the function waits for the page to be unwired and restarts.
  - All functions that manipulate areas in a way that could affect wired ranges
    do now either require the caller to make sure there are no wired ranges in
    the way or do that themselves. Added a few wait_if_*_is_wired() helper
    functions for that purpose.
  - lock_memory_etc():
    - Does now also work correctly when the range spans more than one area.
    - Adds VMAreaWiredRanges to the affected VMAreas and retains an address
      space reference (so that the address space won't be deleted as long as a
      wired range exists).
    - Resolved TODO: The area's caches are now locked when
      increment_page_wired_count() is called.
    - Resolved TODO: The race condition due to missing locking after looking up
      the page mapping is now prevented. We hold the cache locks (in case the
      page is already mapped) and the new vm_soft_fault() parameter allows us
      to get the page wired.
  - unlock_memory_etc(): Changes symmetrical to those in lock_memory_etc() and
    resolved all TODOs.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36030 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-03 18:01:29 +00:00
Ingo Weinhold
21ff565f76 AddressSpaceWriteLocker: Added VMAddressSpace* constructor and SetTo()
versions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36029 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-03 16:11:47 +00:00
Ingo Weinhold
345730da43 Fixed gcc 2 build.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35981 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-27 20:16:10 +00:00
Ingo Weinhold
25bca18888 Moved setting the debug syslog default to main(). Previously that was done
only when the boot loader menu was entered.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35977 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-27 18:15:17 +00:00
Ingo Weinhold
c81e68b2b2 "syslog" debugger command: By default it now ignores the output added to the
syslog in the current KDL session. Added option "-k" for the former behavior.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35976 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-27 18:13:11 +00:00
Ingo Weinhold
feddedab0c x86:
Added fields for temporary storage of the debug registers dr6 and dr7 to the
arch_cpu_info structure. The actual registers are stored at the beginning of
x86_exit_user_debug_at_kernel_entry() and read in
x86_handle_debug_exception().
The problem was that x86_exit_user_debug_at_kernel_entry() itself overwrote
dr7 and, if kernel breakpoints were enabled, dr6 could be overwritten anytime
after. So x86_handle_debug_exception() would find incorrect values in the
registers (definitely in dr7) and thus interpret the detected debug condition
incorrectly. Usually watchpoints were recognized as breakpoints.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35951 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-26 00:03:53 +00:00
Ingo Weinhold
a959bc5b23 _user_wait_for_objects(): Don't copy the infos back to userland when an error
occurred. This fixes the automatic syscall restart case (would wait forever)
and aligns the behavior with poll().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35948 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-25 15:57:38 +00:00
Ingo Weinhold
a369198603 kernel_debugger_loop(): We need to use a dedicated jmp_buf for the call of
arch_debug_stack_trace() through debug_call_with_fault_handler(), since the
one in the CPU structure can only be used for debug_{strl,mem}cpy(), which do
not potentially have nested debug_call_with_fault_handler() calls.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35920 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-19 21:30:27 +00:00
Ingo Weinhold
4f339c2ce1 preload_image(): Removed erroneous rld_unlock() in error case. Fixes #5599.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35919 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-19 19:21:41 +00:00
Ingo Weinhold
c561bf792b block_cache::NewBlock(): Allocate cached_block::current_data only when the
block was freshly allocated. A block returned by _GetUnusedBlock() already
has current_data and we would leak it before.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35918 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-19 19:07:18 +00:00
Ingo Weinhold
59a4ec37b5 Changed the names of the block allocator object caches to avoid confusion
with the ones of the block cache.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35917 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-19 18:27:28 +00:00
Ingo Weinhold
cfefeee3f8 * Changed arch_debug_save_registers() to take an arch-specific structure
arch_debug_registers instead.
* Call arch_debug_save_registers() on all CPUs when entering the kernel
  debugger.
* Added debug_get_debug_registers() to return a specified CPU's saved
  registers.
* x86:
  - Replaced the previous arch_debug_save_registers() implementation. Disabled
    getting the registers via the gdb interface for the time being.
  - Fixed the "sc", "call", and "calling" commands to also work for threads
    running on another CPU.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35907 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-18 17:20:06 +00:00
Ingo Weinhold
d80af65fd8 The "page" and the "cache" kernel debugger commands set a few temporary
variables, now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35903 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-18 16:18:16 +00:00
Ingo Weinhold
2d2b6b1f1a * Unconditionally print a stack trace when we entered KDL via panic().
* Print the initial stack trace safely, i.e. in a setjmp() + fault handler
  environment.
* Disable pagination while executing the executing the panic() commands. This
  way even when it is not possible to use the keyboard we get the full output.
* Added "panic_commands" kernel debugger command, to execute the panic()
  commands again (with pagination enabled).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35902 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-18 16:17:15 +00:00
Ingo Weinhold
976e52595e Added blue_screen_paging_enabled() and blue_screen_set_paging() to get/set
pagination mode.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35901 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-18 16:11:29 +00:00
Stefano Ceccherini
43e738bd36 Style fixes
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35897 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-18 06:31:01 +00:00
Ingo Weinhold
64c15cfc27 * sCurrentKernelDebuggerMessageArgs is no longer used directly. Whenever it
is passed to some v*printf(), we clone it first. This way we can use it
  repeatedly. It worked only on certain architectures correctly before.
* Changed the panic() semantics a bit: When the format contains the
  (hopefully unusual enough) string "@!" only the part before it is
  considered to belong to the panic message. The part after it is interpreted
  as a command line to be executed directly after entering KDL. This way it
  is possible to provide helpful command invocations only developers somewhat
  familiar with the subsystem might come up with. E.g.:
    panic("dec_vnode_ref_count: called on busy vnode %p"
      "@! vnode -p %p; mount _mount", vnode, vnode);


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35896 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-18 00:47:43 +00:00
Ingo Weinhold
6365627b33 * Added support for giving multiple kernel debugger commands in a single
line, separated by ";".
* Fixed incorrect parsing when "|" was not separated by a space from the
  previous argument.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35895 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-17 22:56:07 +00:00
Stefano Ceccherini
33e11f7c0f Squashed todo: only compute the numEntries once, and made it static.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35889 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-17 12:19:34 +00:00
Ingo Weinhold
38c7ed7c47 Added kernel debug config option KDEBUG_ENABLE_DEBUG_SYSLOG which determines
the default setting for the "debug syslog" feature (can still be overridden
in the boot loader). Per default enabled for kdebug level >= 1.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35884 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-16 19:39:22 +00:00
Ingo Weinhold
3fded33493 * Write kernel debugger output to the syslog as well. This should make life
for people who cannot capture serial output easier.
* The syslog sender thread waits with timeout now, so output added to the
  syslog buffer without explicit notification is still written after a few
  seconds at the latest.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35883 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-16 19:36:54 +00:00
Ingo Weinhold
085cf27b40 * Added Directory::CreateFile() which can be implemented by file systems to
support file creation.
* Extended open() and open_from() to support O_CREAT to create files.
  open_from() has got an optional "permissions" parameter for that purpose.
* Fixed errno. It would crash when being used. Also changed the POSIX functions
  to return their error code via errno as expected.
* Added writev().
* FAT file system:
  - Added support for reading long file names.
  - Added support for creating files (8.3 name only) and writing to them.
  - Enabled scanning partitions with it.
* Boot loader menu:
  - Enabled the "Reboot" menu item unconditionally.
  - Added "Save syslog from previous session" menu item to the debug menu.
    Currently saving the syslog to FAT32 volumes is supported.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35882 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-16 17:29:58 +00:00
Ingo Weinhold
d1367a37cc Implemented BIOSDrive::WriteAt(). Currently it supports only LBA addressing
and requires position and size to be block-aligned.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35881 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-16 17:10:00 +00:00
Ingo Weinhold
fac2ce3d92 Added ring_buffer_get_vecs() that returns iovecs describing the contents of
the buffer.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35880 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-16 17:07:40 +00:00
Ingo Weinhold
7778bccf93 sigsuspend() would previously wake up correctly when a matching signal was
received, but if the signal was in the thread's signal block mask, it would
not be handled. Added thread::sig_temp_enabled, an additional mask of not
blocked signals, which is set by sigsuspend() and evaluated and reset by
handle_signals(). Fixes #5567.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35836 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-13 13:17:40 +00:00
Ingo Weinhold
f427f6af3f Added some kernel tracing for sigsuspend().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35834 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-13 12:31:01 +00:00
Ingo Weinhold
6daecfb154 Ignore physical memory ranges that are smaller than 64 KB. Those don't
contribute significantly to the usable memory, but possibly make the MTRR
setup impossible. Might improve #5550.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35825 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-12 16:59:26 +00:00
Ingo Weinhold
6b110c63fd Postpone clearing the debug syslog buffer signature to the time when going
to start the kernel with the option disabled.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35823 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-12 12:57:35 +00:00
Ingo Weinhold
98248b1612 Let the compiler decide whether to inline or not.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35821 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-12 11:25:30 +00:00
Matt Madia
4a27232637 Fixes build for PXE NetBoot. Uncertain if additional changes are needed.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35818 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-11 20:15:39 +00:00
Ingo Weinhold
8d25a30c3f Changed the location for the debug syslog buffer from 16 MB to 63 MB. On my
machine the previous location was overwritten, probably by GRUB.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35817 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-11 18:15:43 +00:00
Ingo Weinhold
28a2172c3f kernel:
* The kernel syslog ring buffer is no longer emptied by the syslog sender
  thread. Instead we only drop the oldest data from the buffer when we're
  writing to it and there's not enough free space in it.
  Advantages: We drop old data rather than the most recent data when the buffer
  is full. The "syslog" KDL command has more data available now. So the odds
  are that kernel syslog messages not written to disk yet are at least still
  in the kernel buffer.
* Changed dprintf_no_syslog() semantics: Now it writes to the syslog, but
  doesn't notify the syslog sender thread.

boot loader:
* Added the ring_buffer implementation and a dummy user_memcpy().
* bios_x86: Moved the syslog stuff from serial.{cpp,h} to debug.{cpp.h}.
* Moved the debug options from the "Select safe mode options" menu to a new
  "Select debug options" menu.
* Added option "Enable debug syslog" to the new menu (ATM available on x86
  only). It allocates a 1 MB in-memory buffer for the syslog for this session
  in such a way that it can be accessed by the boot loader after a reset.
* Added item "Display syslog from previous session" to the new menu, doing
  what its name suggests.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35816 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-11 17:46:36 +00:00
Ingo Weinhold
90bf6bef34 Added mmu_allocate_physical(), which allocates a specified physical memory
range.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35815 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-11 17:42:00 +00:00
Ingo Weinhold
bb7711cd5a Updated boot loader copyright year.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35814 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-11 17:13:12 +00:00
Ingo Weinhold
546f4e5e05 * Added create_ring_buffer_etc() which allows to re-create a ring buffer from
a given flat buffer.
* Added ring_buffer_peek() for random position reading from the ring buffer
  without changing its state.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35813 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-11 17:12:21 +00:00
Ingo Weinhold
dd5f340aea A simple pager implemented on top of the generic text console interface.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35812 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-11 17:09:11 +00:00
Ingo Weinhold
5d1f3d53e2 get_next_physical_address(): Directly update the
gKernelArgs.physical_allocated_range array. This way it is always up to date
and we don't need to fix it in mmu_init_for_kernel().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35802 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-10 18:38:57 +00:00
Ingo Weinhold
73a72c42e2 Added get_free_address_range() to get a free range in a given range array.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35801 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-10 18:36:44 +00:00
Axel Dörfler
47f23fb5c1 * If get_cached_block() failed reading a block, it would leave a deleted object
in the unused list if it got the block via block_cache::_GetUnusedBlock().
* block_cache::_GetUnusedBlock() leaked the compare data block if the
  BLOCK_CACHE_DEBUG_CHANGED feature had been enabled.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35799 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-10 10:57:37 +00:00
Ingo Weinhold
a915c50a60 panic() when running out of MTRRs. I know I'm gonna regret this...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35755 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-04 09:49:53 +00:00
Ingo Weinhold
affb47166b add_mtrrs_for_range(): Fixed computation of the register ranges. Per power of
2 size we might need to use two registers (for the start and the end of the
range).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35753 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-04 09:43:04 +00:00
Ingo Weinhold
2a196c6349 exchange_with_empty() did not set the freeMagazine return value to NULL when
the maximum magazine count wasn't reached yet. With object_depot_store() not
resetting its local variable, a magazine could thus be emptied and freed
twice. Fixes #5489 and #5497.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35752 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-04 01:55:37 +00:00
Ingo Weinhold
1aed263998 TracingMetaData::_InitPreviousTracingData():
* More output.
* Actually increment errorCount when encountering an error. The loop
  condition would never be false this way.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35750 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-03 23:23:09 +00:00
Ingo Weinhold
7263efe581 Override Fault() method for VM{Device,Null}Cache to prevent vm_soft_fault()
from inserting a clean page, if a fault happens. VMNullCaches are used by the
slab's memory manager -- all page faults in slab areas are serious bugs and
we want to panic() immediately.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35748 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-03 22:08:47 +00:00
Stefano Ceccherini
08876f2b96 Move the code which checks for disabled apic earlier (in the boot loader).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35741 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-03 19:14:42 +00:00
Axel Dörfler
88f1263865 * The slab_cache command now also dumps the actual slab lists.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35737 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-03 15:15:49 +00:00
Ingo Weinhold
6dacf0502d Ignore physical memory below 1 MB. This is a work-around for buggy BIOSes
providing incorrect memory types. It doesn't cost us anything, since the
kernel reserves all but the unusable range later anyway. Should fix #1925.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35736 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-03 14:54:46 +00:00
Axel Dörfler
6a7f219c8d * block_notifier_and_writer() will now flush 1000 blocks when reaching the soft
memory limit.
* Improved debug output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35735 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-03 14:39:26 +00:00
Axel Dörfler
0181fe4b21 * Replaced cached_block::accessed (the number of accesses) with last_accessed
(the time of the last access), as what we really want is a frequency/last
  access time scoring, and accessed alone is useless for that.
* put_cached_block() no longer frees any unused blocks.
* The low memory handler will now only lock the cache if there is something
  to do. Also, it did not take address space warnings into account.
* Even when memory is critical, we don't free all unused blocks anymore - if
  the number of blocks we free now (10000) is not sufficient to get out of the
  critical condition, chances are good that we will be called again :-)
* block_notifier_and_writer() now tries to make sure that the total block cache
  memory consumption grows not much larger than half of the available RAM.
* This should all help to limit the block cache usage a bit better. Hopefully,
  a checkfs run will no longer run out of memory here (couldn't test yet).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35733 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-03 10:28:57 +00:00
Ingo Weinhold
d40a935560 Boot loader (x86 mmu.cpp):
* Made the page table allocation more flexible. Got rid of sMaxVirtualAddress
  and added new virtual_end address to the architecture specific kernel args.
* Increased the virtual space we reserve for the kernel to 16 MB. That
  should suffice for quite a while. The previous 2 MB were too tight when
  building the kernel with debug info.
* mmu_init(): The way we were translating the BIOS' extended memory map to
  our physical ranges arrays was broken. Small gaps between usable memory
  ranges would be ignored and instead marked allocated. This worked fine for
  the boot loader and during the early kernel initialization, but after the
  VM has been fully set up it frees all physical ranges that have not been
  claimed otherwise. So those ranges could be entered into the free pages
  list and would be used later. This could possibly cause all kinds of weird
  problems, probably including ACPI issues. Now we add only the actually
  usable ranges to our list.

Kernel:
* vm_page_init(): The pages of the ranges between the usable physical memory
  ranges are now marked PAGE_STATE_UNUSED, the allocated ranges
  PAGE_STATE_WIRED.
* unmap_and_free_physical_pages(): Don't free pages marked as unused.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35726 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-02 18:13:06 +00:00
Ingo Weinhold
a93fa3c9ea More debug output.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35725 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-02 17:50:21 +00:00
Ingo Weinhold
dcdf2ab981 Extended assert output.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35724 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-02 17:49:46 +00:00
Michael Lotz
610a2eed63 Made heap classes const just in case. They really already were though.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35713 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-01 22:29:23 +00:00
Axel Dörfler
1c164de7d2 * Quick&dirty fix of a race condition that caused an endless loop in
object_cache_alloc(): the ObjectCache::total_objects count was increased in
  ObjectCache::InitSlab(), but the slab was really only added at a later point
  between the cache could be unlocked.
* If a second object_cache_reserve_internal() managed to be called while the
  lock was unlocked, it would see that there has to be space available, and
  will then return -- however, since the other thread could not yet place the
  slab into the cache, object_cache_alloc() cannot find it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35702 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-01 16:35:17 +00:00
Ingo Weinhold
c0d54ea244 Enabled serial output earlier.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35699 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-01 13:48:31 +00:00
Ingo Weinhold
dfa77fa65b Automatic whitespace cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35698 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-01 13:47:32 +00:00
Ingo Weinhold
84328c264b Extended assert output.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35697 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-01 13:45:02 +00:00
Ingo Weinhold
e82b595ac6 * TRACE(()) -> TRACE()
* Fixed warnings with tracing enabled.
* Improved some debug output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35686 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-02-28 23:45:00 +00:00
Ingo Weinhold
af0572ead2 Fixed debug output.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35685 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-02-28 23:30:23 +00:00
Stefano Ceccherini
283926fe70 small cleanup. Also increased LAPIC timer priority from 2 to 3 (nothing changes yet anyway).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35662 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-02-28 17:20:50 +00:00
Stefano Ceccherini
ae6721ad6e Small cleanups, undef TRACE_HPET. Still at priority 0.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35661 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-02-28 17:18:43 +00:00
Stefano Ceccherini
5b15d1ec1e small cleanup: move variables declaration near where they're used.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35660 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-02-28 17:17:42 +00:00
Stefano Ceccherini
734d41fbf6 Move variables declaration from start of function to where they are used.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35659 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-02-28 17:16:29 +00:00
Ingo Weinhold
2340fc36f1 Fixed build with tracing turned on and improve/added debug output.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35658 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-02-28 16:42:22 +00:00
Ingo Weinhold
fc5c7fdd81 dump_info(): We can't use use cpu_get_active_time() in the kernel debugger as
it tries to acquire the thread spinlock.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35657 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-02-28 15:39:44 +00:00
Alexandre Deckner
cd4e946773 * Add a serial_input command to the kernel debugger, allows using serial input even when on-screen kdebug is enabled. Usefull for remote debugging. Please review/adjust.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35650 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-02-28 00:50:01 +00:00