Commit Graph

738 Commits

Author SHA1 Message Date
Axel Dörfler b7d8ef5a0d The term vnode_ptr is not used anywhere else; renamed vfs_put_vnode_ptr() to vfs_put_vnode().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13865 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-01 14:17:41 +00:00
Ingo Weinhold d08379a80b * Now we deal with all x86 exceptions, i.e. we no longer panic() when a
user application performs a division by zero or causes a general
  protection fault. For some exceptions (e.g. machine check) I wasn't
  quite sure whether they can be caused by user apps at all, so we panic()
  in those cases. Wouldn't harm, if someone more knowledgable would check
  this, though.
* Removed the unused fault handling stuff, respectively moved the little
  that was used into x86/arch_int.c.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13795 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-21 23:47:08 +00:00
Axel Dörfler 31a5ff5d8e We now have a (private) writev_port_etc() call. This could be used to avoid
allocating a buffer and copying your data into it, when you have data to
send in several chunks (for example, this could be used by BMessage, as
suggested by Ingo Weinhold).
Code is untested, but should work.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13667 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-13 23:55:15 +00:00
Axel Dörfler b7a96f02fd Now fills in system_info::cpu_infos[] (ie. CPU activity) by looking at the active
time of the idle thread. IOW Pulse now works :-)
Renamed the idle thread/stack to start with 1 instead of 0 (first idle thread will
be called "idle thread 1").
Minor cleanup.


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


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13113 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-06-14 11:23:29 +00:00
Axel Dörfler b84688be5f Added a basic low memory handler service.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13090 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-06-13 13:03:54 +00:00
Axel Dörfler b1a248305b Minor cleanup, changed return type of page count functions (from addr_t to size_t,
as that's more correct).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13089 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-06-13 13:02:24 +00:00
Axel Dörfler a69e0ac327 The boot item list was not initialized; this was no problem, though, as
no items can be removed from that list - nevertheless, it's wrong.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13088 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-06-13 13:01:13 +00:00
Axel Dörfler 183dee22cb Unlike R5, receive_data() could return an error code under Haiku - this
can now only happen if the thread is killed.
_user_receive_data() will now longer pass B_CAN_INTERRUPT to receive_data(),
but B_KILL_CAN_INTERRUPT - this should fix the problem Stefano experienced
with this function, even if I couldn't reproduce it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13075 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-06-12 11:14:37 +00:00
Axel Dörfler 80f6ef8bd8 Moved load_driver() and load_driver_symbols() over to devfs.
Added new devfs_add_driver() function that the device manager will now call
to register new drivers.
Devfs will now keep a list of known drivers and remembers, if they have
been initialized already - a driver can now safely scan the directory it's
in while being scanned itself without having its hooks called twice.
Devfs is now using a recursive lock instead of a mutex (that's not really
a requirement right now, but would allow us to keep the fs lock during
scanning).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12933 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-06-02 18:32:21 +00:00
Axel Dörfler c88974d026 The app_server now updates the kernel's blue screen frame buffer on mode changes
(only the accelerant HW interface does this for now).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12897 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-05-29 20:23:00 +00:00
Axel Dörfler f33c8020e2 Removed debug/console.c, we no longer need it. frame_buffer_console_init() is now
called by debug_init_post_vm().
Since the availability of a blue screen specific getchar() is static anyway, there
is no need for the sBlueScreenGetChar variable (only the message "only serial input
available" gets lost, but since that is platform specific anyway...).
Hello blue screen! We now have an on-screen KDL, to be enabled by the kernel
setting "bluescreen", just like on BeOS.
The blue screen does not yet support any cursor actions or backspace, though (need
to grab some stuff from our console driver).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12896 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-05-29 16:23:00 +00:00
Axel Dörfler 2b8d85854d Renamed arch_dbg_console.c to arch_debug_console.c, dbg_console.h to debug_console.h.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12891 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-05-29 13:31:15 +00:00
Axel Dörfler eca3ada99b Removed some unused old headers.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12890 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-05-29 13:29:55 +00:00
Axel Dörfler 9a63135f7c Cleanup of the debug stuff, prepared for blue screen debugging.
kernel_debugger() didn't do enough before; panic() did all the work - but
since the former is a public function as well, I moved all the functionality
to it. Also fixed a possible buffer overrun in panic().
Renamed dbg_* to debug_*.
"serial_debug_port" setting did not ignore negative values.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12889 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-05-29 13:01:38 +00:00
Axel Dörfler 18b6200e54 Enlarged the kernel heap to 16 MB.
This will keep it alive longer until a) the block cache no longer
uses the heap, and b) we get a better heap without a fixed size.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12830 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-05-26 09:11:30 +00:00
Axel Dörfler d260b2c469 Made the header C++ safe.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12829 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-05-26 09:08:54 +00:00
Axel Dörfler 6d352d08b3 Added an arch_get_caller() function that returns the caller of the calling function :-)
Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12810 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-05-25 13:58:32 +00:00
Axel Dörfler 47f39c93cb Merged the disk device manager module interface for file systems with the
VFS's interface, so that a file system only has to implement one interface.
As a side effect, the automatic file system detection may now work (not yet
tested, though).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12786 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-05-23 17:15:56 +00:00
Axel Dörfler 62d6961672 Renamed vm.c to vm.cpp and made all the changes to let it compile without
errors. Also made the VM headers C++ safe.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12694 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-05-16 23:17:45 +00:00
Axel Dörfler 4393552b4d The heap is now located at 384 MB, and creates a reserved range that spans over the
following 1152 MB - that area only guarantees that the heap can grow this much before
the application need the memory for something else. And even then, the heap range
is reused from top-to-bottom, allowing for maximum heap usage. Of course, if the
memory after the heap range is not claimed yet, it can still be claimed by the heap,
too. Added new syscall to create the reserved range.
Fixed a bug in vm_delete_areas(): when it removed reserved areas, the area list
could get messed up.
Fixed a bug in resize_area(): resized areas could never be deleted (missing vm_put_area())!
resize_area() now supports reserved regions (but not perfectly yet, see ToDo items).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12692 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-05-16 22:15:13 +00:00
Axel Dörfler a3e9996e9d Added support for special reserved address ranges: they will be used
only if memory becomes tight, and then the range is used from end to
start.
This is useful to reserve heap address ranges.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12675 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-05-15 15:56:55 +00:00
Axel Dörfler 20a6e5473b Renamed RESERVED_REGION_ID to RESERVED_AREA_ID.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12674 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-05-15 15:06:57 +00:00
Axel Dörfler ccc8865ba2 Added an additional flag B_OVERCOMMITTING_AREA (currently to be specified
along the protection flags).
Changed the handling of B_STACK_AREA types and anonymous vm_areas: now
every area can overcommit if B_OVERCOMMITTING_AREA was specified.
B_STACK_AREA areas are still automatically overcommitting, but
B_KERNEL_STACK_AREA areas no longer.
vm_store_anonymous_noswap.c now only tests for guard pages if there were
any specified which is only done for B_STACK_AREA areas.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12673 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-05-15 15:03:44 +00:00
Axel Dörfler d5b04e50f8 First step into a new block allocation strategy for the block_cache
(right now, it's still malloc/free, just encapsulated in an allocator class).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12662 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-05-13 18:18:28 +00:00
Axel Dörfler 6094d89f2f Merged branches/developer/axeld/driver_recognition changed r12307:12637 into trunk.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12638 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-05-12 03:27:44 +00:00
Axel Dörfler d4112f6bc5 Applied some changes suggested by mmu_man, more to come, though:
- has_signals_pending() is not declared in Be headers, and it isn't declared in
  our KernelExport.h anymore, too
- removed snooze_etc() from KernelExport.h, as it's already defined in OS.h
  (and really exported by libroot.so).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12506 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-04-29 11:41:12 +00:00
Axel Dörfler b20667b35b {install|remove}_io_interrupt_handler() now correctly handle the B_NO_ENABLE_COUNTER flag.
Lots of cleanup:
- moved B_NO_ENABLE_COUNTER flag definition out of int.h to KernelExport.h, as it's
  described in the BeBook (although it's probably not really used that often :))
- int.c no longer has any platform dependent code (+ 0x20 on interrupt numbers is gone);
  it's now entirely handled in the arch/x86/ section.
- the io_vectors[] is now statically initialized, instead of allocated from the heap
- removed {install|remove}_interrupt_handler(); they weren't that useful, arch_smp_init()
  is now calling install_io_interrupt_handler() correctly instead
- introduced a new arch_int.h header file that currently contains NUM_IO_VECTORS only
  (though on x86, it also has ARCH_INTERRUPT_BASE == 0x20).
- changed the return type from {install|remove}_io_interrupt_handler() from "long" to
  "status_t"
- rearranged and cleaned the PIC initialization code, made the PIC code more prominent
- changed comments that talk about a non existing 8239 (the PIC chip is actually 8259)
- moved arch/x86/interrupts.h to the source directory, as it's not used outside
- added BeOS compatible interrupts_enabled() function, that should replace our
  equivalent (and private) are_interrupts_enabled()


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12477 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-04-27 01:08:35 +00:00
Axel Dörfler 3e15f83d9e Added a BenaphoreLocker.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12380 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-04-13 22:40:48 +00:00
Axel Dörfler ef2b38e7a9 Added a simple ring buffer implementation to be used by the mouse
and keyboard drivers, as well as pipefs.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12357 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-04-13 12:57:42 +00:00
Axel Dörfler f80b1fa5b5 Moved the kernel_startup variable declaration from int.h to kernel.h (it's defined in main.c).
Some cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12327 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-04-12 06:09:13 +00:00
Axel Dörfler 219dacab3c Changed our read link syscall and FS interface call to make it easily possible to be POSIX compliant.
Also changed readlink() to be POSIX compliant with those changes.
"ls -l" does now resolve links properly again (the new coreutils version outlined the problems).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12263 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-04-06 16:07:10 +00:00
Axel Dörfler bc440dcb46 No longer used.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12253 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-04-05 14:09:08 +00:00
Axel Dörfler f05e261fd7 The VM can now ask the platform dependent part if it supports a specified protection.
create_area() and friends should fail if it's not supported.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12248 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-04-05 13:50:37 +00:00
Ingo Weinhold 8e26b085e5 Fixed double fault handler. Personally I disclaim all responsiblity
for these changes. I was mostly just staring in amazement at the screen
while Axel and Thomas were discussing IA32 internals. A particularly
fascinating moment was when Thomas produced the cause of a bug we had
been trying to track down for hours off the top of his head (of course
iret behaves specially when the NT bit is set :-). His slowness must be
excused though, since he hadn't slept for more then 30 hours. ;-)

The code doesn't wholeheartedly deal with multi-processor machines yet.
Axel will certainly do some cleanup...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12239 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-04-04 21:43:47 +00:00
Axel Dörfler e5b0e0b5e3 Changed the set_segment_descriptor()'s usage of the limit/granularity
flag. Now, it will choose how to set the granularity by evaluating the
limit.
This call was actually already used this way in the kernel, so that
the TLS and TSS segments were much too large (harmless but incorrect).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12231 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-04-04 14:34:18 +00:00
Axel Dörfler 9d06770cdc The iframe stack is now in a special structure iframe_stack.
Introduced a gBootFrameStack that is used until the first thread structure
is available - this allows stack crawls and useful register dumps during
early startup. Could also be solved differently by making sure there is
always a thread structure installed in %dr3 (ie. the boot thread would
get a static thread structure instead of a static iframe stack only).
This might be a better solution as i386_handle_trap() would no longer
need to check for an existing thread structure.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12230 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-04-04 14:13:25 +00:00
Axel Dörfler edb5566393 Fixed struct tss; there is no ss3/sp3.
Moved ptentry/pdentry to arch_vm_translation_map.c and renamed them to
page_table_entry and page_directory_entry.
Fixed a race condition that happened when memory was remapped (which
can currently happen because lock_memory() does not work correctly, and
there might be other conditions as well, like certain vm_store fault
handlers). Now, page table and directory entries are updated atomically.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12229 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-04-04 14:07:24 +00:00
Axel Dörfler d305ab35ac Added the get_boot_item() call similar to what BeOS exports (have a look at
the APM driver to see it at work).
The frame buffer console now creates such a boot item to give a potential
VESA driver access to the boot frame buffer configuration.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12221 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-04-01 15:09:09 +00:00
Axel Dörfler 2d7ad656ec Added "Disable IDE DMA" safemode option.
MenuItem::SetData() now asks for a const parameter.
The safemode menu options now set their MenuItem::Data() to the safemode option string.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12191 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-31 15:16:09 +00:00
Ingo Weinhold d832aa7efc We must just the same naming as in DiskDeviceTypes.cpp for the intel partition types, since the implementation relies on it.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12186 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-31 11:22:02 +00:00
Axel Dörfler 9f90fa0e3a Introduced new B_KERNEL_AREA_FLAGS and B_USER_AREA_FLAGS that can be used
instead B_KERNEL_PROTECTION and B_USER_PROTECTION.
Unlike before, B_USER_CLONEABLE_AREA is now only in B_KERNEL_AREA_FLAGS,
but no longer in B_KERNEL_PROTECTION. This fixes a couple of problems
when B_USER_CLONEABLE_AREA was defined without specifing read/write
access.
PAGE_PRESENT|MODIFIED|ACCESSED are in the same "namespace" as the
protection flags, and therefore, shouldn't overlap.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12154 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-30 06:34:17 +00:00
Ingo Weinhold 85001a7cc6 * Fixed checking for DR6 bits after a debug exception (we were and'ing
with the bit number, not the respective mask).
* Added a small hack to allow single stepping to work in qemu.
  Apparently the BS bit in DR6 is not set when the debug exception
  is handled. So we always assume that a single step event occurred,
  when we couldn't recognize any other event, if the hack is enabled.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11998 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-25 18:48:51 +00:00
Ingo Weinhold 3eae1fea40 * Added support for debugging through exec*().
* Added initialization function. Currently only need to init the
  single step hack for qemu.
* Fixed a deadlock when the nub thread destroyed the debug info. It was
  waiting for itself.
* Moved the filling in the origin info of the debug messages into
  thread_hit_debug_event_internal(). No need for code duplication.
* Writing to user memory can now be partial. We also change the area
  protection, if it wasn't writable. Necessary for setting software
  breakpoints.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11996 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-25 18:40:07 +00:00
Ingo Weinhold 1cebd061c3 Added delete_select_sync_pool() to clean up.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11928 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-20 22:07:29 +00:00
Ingo Weinhold 8af41139d5 Added default constructor. Useful in combination with SetTo().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11924 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-20 21:59:51 +00:00
Axel Dörfler 1ff0923db6 Removed the old (and nowadays unused) addons directory and related headers.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11915 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-19 02:35:40 +00:00
Axel Dörfler 52fe8bf7a8 Minor header cleanup: moved some headers to better matching directories,
removed unused headers. Adapted sources to still compile with the new
header locations.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11913 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-19 01:58:05 +00:00
Axel Dörfler 74b043d98d Removed execute property that was set accidently (since CVS days).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11896 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-18 01:50:45 +00:00
Axel Dörfler 9391dd214d Fixed broken handling of the new file_descriptor::open_count across
team boundaries; if you didn't actually call close() from within the
application, the close-hook of the file system was never called.
Also, you could close files of other teams (ie. invoke close on a
shared file descriptor).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11892 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-18 01:24:11 +00:00