Commit Graph

1300 Commits

Author SHA1 Message Date
Axel Dörfler
e25fbc6849 Moved cpuid.S from src/kernel/libroot/os/arch/x86/. Fixed it so that it
actually fills a cpuid_info structure. Renamed cpuid() to get_current_cpuid().
Added syscall _user_get_cpuid().
Added a lot of other vendor brand strings. The cpu_type and cpu_revision
fields should now be correctly set.
get_cpuid() now returns B_BAD_VALUE if the cpuNum parameter is out of bounds
(ie. higher than the number of available CPUs in the system).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10321 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-12-01 03:48:28 +00:00
Axel Dörfler
7c3dbcf249 Threads and teams now maintain a used counter - they also provide a maximum
limit, but this is not yet enforced. Added getter functions.
team_init() now returns a status_t.
System info stuff is now globally initialized in main().
get_system_info() now also reports the number of used pages, and calls the
architecture dependent function.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10315 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-30 21:11:37 +00:00
Axel Dörfler
e774a942a9 Implemented basics of the architecture specific get_system_info(), also
added get_cpuid() function (does not respect the cpu parameter yet).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10314 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-30 21:08:19 +00:00
Axel Dörfler
d3ee51c1d2 Removed the ERR_VM_PF_BAD_ADDRESS constant, and use B_BAD_ADDRESS instead.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10307 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-30 18:27:38 +00:00
Axel Dörfler
b5d786bdac Improved fs_unmount(): it will now free all vnodes directly via free_vnode(),
and no longer relies on put_vnode() for the root node. This will also call
the FS release/remove vnode calls. Extended comments.
Added "flags" parameter to unmount.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10289 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-29 22:45:27 +00:00
Axel Dörfler
41c3a7a3d5 Moved freeing the vnode out of dec_vnode_ref_count() into a separate function
(free_vnode()). Upon freeing, the file cache is now only written back if the
file is not deleted.
dec_vnode_ref_count() no longer frees vnodes that are not going to be deleted.
Instead, it will add them to an unused vnode list, so that they can be freed
if needed (currently only 512 unused vnodes will be kept around). This should
speed up the whole thing, and makes the file cache much more useful, as it's
no longer dumped after the file is closed.
fs_unmount() is not yet respecting this (ie. it doesn't free those nodes as
it should).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10287 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-29 21:27:17 +00:00
Axel Dörfler
86a48e24ad Got inspired by mmu_man's dmidecode release and added a simple identification
of BIOS32, SMBIOS, and DMI services.
Also implemented a get_bios32_service() function which you can use to get
access to that service (ie. for use by the PCI bus manager).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10286 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-29 20:42:04 +00:00
Axel Dörfler
22ca5e3c35 Added a comment to vm_page_write_modified() that writing pages can only
be done consistently if they are unmapped from memory - which is not yet
done.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10285 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-29 15:52:49 +00:00
Jérôme Duval
bfb2692a61 Fixed set_timezone()
Added user_shutdown user control
Reverted to rtc_boot_time()


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10278 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-28 23:13:22 +00:00
Axel Dörfler
92af23fa88 Now uses the new Be-style constants for get_team_usage_info().
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10268 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-27 12:57:36 +00:00
Axel Dörfler
9f30bca262 Moved _user_system_time() to real_time_clock.c.
Added safemode.h header.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10265 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-27 12:35:30 +00:00
Axel Dörfler
515d213528 create_port() incremented the used ports counter twice, thanks to Stefano
Ceccherini for the hint.
The first port ID is now 1 and not 0 anymore.
Added a first free slot hint to speed up port creation.
Added more debug output when tracing is enabled.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10260 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-27 12:03:48 +00:00
Axel Dörfler
50edebb6cb Added B_CURRENT_TEAM support to get_team_info() as well - dunno though, if
BeOS supports this as well, at least it's not documented in the BeBook
(but it's useful anyway).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10259 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-26 16:37:41 +00:00
Axel Dörfler
b9ead42463 Support for B_CURRENT_TEAM was missing from get_team_usage_info().
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10258 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-26 16:34:32 +00:00
Axel Dörfler
a09c4553a6 Made the get_safemode_option() function public.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10257 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-26 16:25:18 +00:00
Axel Dörfler
7c8c40ecb2 Moved _user_system_time() to real_time_clock.c.
Renamed _user_set_tzspecs() to _user_set_timezone().
Renamed sTzFilename to sTimezoneFilename.
Moved rtc_print() into rtc_debug().
Fixed changing system_time_offset; since this is a shared 64 bit value,
we have to use atomic calls when we change it.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10253 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-26 15:03:28 +00:00
Axel Dörfler
9b6593acae Now remembers the time spent in children/threads that are already gone.
Implemented get_team_usage_info() - not really tested, though.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10251 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-26 14:58:01 +00:00
Axel Dörfler
2ff908a59e Added empty get_team_usage_info().
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10244 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-25 21:20:17 +00:00
Axel Dörfler
73e29ea0c4 Added empty get_safemode_option() call - right now, it's even private
and only the syscall is exported.
For now, it always returns B_ENTRY_NOT_FOUND - since the boot loader
does not have support for driver settings yet.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10237 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-25 18:36:42 +00:00
Axel Dörfler
216b269cbc Moved shutdown() into a separate file.
Added _user_shutdown() and made it available as syscall.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10233 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-25 17:59:13 +00:00
Axel Dörfler
1e32802a52 New call new_fd_etc() which accepts a starting index for where to search for free FDs.
Implemented F_DUPFD support for fcntl() - we no longer see any redirection errors when
booting into Haiku.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10221 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-25 02:56:35 +00:00
Jérôme Duval
766dfdaf6c fixed system_time_offset and sTimeOffset
added some trace


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10217 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-24 22:54:50 +00:00
Axel Dörfler
f19955303e _user_set_area_protection() did not set any B_KERNEL_*_AREA protection.
_user_create_area() and _user_clone_area() now inherit the read/write protection
for the kernel, too - before, it was always mapped read/write in the kernel,
but there is no reason to do that.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10214 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-24 18:57:20 +00:00
Axel Dörfler
4bc2682135 First go at set_area_protection() - does work for everything but changing
a read-only area to read/write.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10213 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-24 18:22:17 +00:00
Axel Dörfler
40ab990937 vm_cache_resize() can now resize all caches - and therefore, it now accepts
an off_t as size argument.
Implemented new function vm_cache_write_modified() which will write all
dirty pages of this cache back to disk (using the new vm_page_write_modified()
function).
Fixed warnings when compiled with debug output.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10205 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-23 03:34:04 +00:00
Axel Dörfler
86b5aa8df9 Implemented new function vm_page_write_modified() that writes all dirty
pages in a cache back using the store's write method. Doesn't optimize
disk access yet.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10204 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-23 03:30:02 +00:00
Axel Dörfler
257d99f228 Renamed readwrite() to cache_io(), and readwrite_pages() to pages_io().
While we can tolerate the device driver to ignore the bytes argument when we
read from the device, we cannot do this for writes - now the code actually
takes this into account. Also added a comment about what to do when our own
driver is fixed :)
Implemented file_cache_sync().
file_cache_set_size() now uses vm_cache::virtual_size instead of the now
removed vnode_store::size. Also, it now resizes the vm_cache as well, so
that any no longer used pages are freed.
write_to_cache() now puts all pages in the modified list, so that they
can be written back easily.
Improved debug output.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10203 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-23 03:27:45 +00:00
Axel Dörfler
3aacbe700a Removed the vnode_store::size field - it's no longer needed. Instead,
vm_cache::virtual_size is now used by the file cache code.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10202 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-23 03:22:35 +00:00
Axel Dörfler
3e5bf45013 attr_dir_open() now checks if the FS call is implemented at all.
dec_vnode_ref_count() now deletes the cache *after* calling the file system's
remove/release vnode function. Also, it will now write back any pending
changes in that cache before removing it.
Some cleanup.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10201 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-23 03:20:20 +00:00
Axel Dörfler
e057f978ce Inode::FillPendingRequests() could fill the requests in the wrong team context.
Now, it will only notify the read requests do gather the data.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10198 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-23 02:57:34 +00:00
Jérôme Duval
177fdbb034 renamed rtc_boot_time to rtc_system_time_offset
move code from use of boot_time to use of system_time_offset
added _user_get_tzfilename


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10192 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-23 00:16:24 +00:00
Jérôme Duval
e2383c107d fixed offset sign, gmt clock is working
this should be factored in kernel core to only have a system_time_offset


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10186 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-22 21:54:24 +00:00
Jérôme Duval
377eab2488 added _user_set_tzfilename
moved set_tzfilename into _user_tzfilename


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10177 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-22 17:14:06 +00:00
Jérôme Duval
3787bef109 timezone_offset and dst_observed fields of real_time_data struct are inited
timezone_offset is used to have GMT real_time_clock() and set_real_time_clock()


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10133 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-22 00:32:22 +00:00
Axel Dörfler
90d1241219 sys_setenv() and sys_getenv() are not only at the wrong place (that sort of
stuff belongs to userland), they are completely broken, too.
As a quick hack, they no longer disable interrupts, so that the env memory
can be accessed almost safely (in case its valid memory at all).
Please don't fix this, but remove those functions from the kernel.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10071 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-21 00:01:59 +00:00
Axel Dörfler
7377137f87 Fixed a bug in the debugger "thread" command when it was called with no
arguments (which should have taken the dumped thread).
Improved "thread" debug output to have all data values at the same column.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10070 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-20 23:58:57 +00:00
Axel Dörfler
8210771d09 Oops, exec_team() should rename the team as well.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10062 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-20 22:31:28 +00:00
Axel Dörfler
77a6e0beb6 exec_team() now renames its main thread to the new program name.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10061 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-20 22:05:50 +00:00
Axel Dörfler
4f952f6c3a pipefs_create() didn't call Inode::Open(), and since the read/write counters
were messed up because of that, most shell pipe access didn't actually work
(thinks like "cat x | grep y", or "a=`uname -m`) - they now do.
Added more debug output.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10060 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-20 21:51:01 +00:00
Axel Dörfler
672ba60193 Removed unnecessary reference to ktypes.h.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10055 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-19 21:56:02 +00:00
Axel Dörfler
d621b8a482 Now uses the shutdown() function instead of reboot() directly. Maybe this
must be changed again to arch_cpu_shutdown(), since it might not be safe
to properly shutdown from the kernel debugger.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10054 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-19 21:55:12 +00:00
Axel Dörfler
8f60d4cdba Removed dumb put BeOS compatible cache implementation - it's not needed anymore.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10051 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-19 20:29:17 +00:00
Axel Dörfler
10b8d84f32 Added empty file_cache_sync().
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10048 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-19 20:24:27 +00:00
Axel Dörfler
5987043c75 Added new shutdown() function that at least does a sync() before rebooting
the system. Should shutdown all other things, too.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10045 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-19 20:18:27 +00:00
Axel Dörfler
fc5fb64131 Implemented arch_cpu_shutdown().
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10044 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-19 20:16:52 +00:00
Axel Dörfler
d9dd2139b1 Removed misc.c from the build for now.
Removed unneeded grist from source files.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10029 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-19 19:12:21 +00:00
Axel Dörfler
48d914c9ce Disabled some unneeded checksum code (cbuf is still "abused" in our ports
and pipefs implementation, but was originally thought for a network stack).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10028 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-19 19:11:04 +00:00
Axel Dörfler
0db0e9aaa2 KSTACK_SIZE, STACK_SIZE, and MAIN_THREAD_STACK_SIZE were all renamed.
Fixed a bug in the team thread start: it did not set sizeLeft correctly
before copying the arguments - shouldn't have had any consequences, though,
as the size of the arguments is known before.
Added a comment explaining the current layout of the main thread stack area.
Now makes use of B_STACK_AREA and B_KERNEL_STACK_AREA.
fill_thread_info() did not correctly set thread_info::stack_end.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10016 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-18 18:15:39 +00:00
Axel Dörfler
b139f2481d Renamed KSTACK_SIZE to KERNEL_STACK_SIZE.
Fixed a bug in arch_init_tls() that did not support different stack sizes
(ie. didn't use the thread::user_stack_size variable).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10015 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-18 18:11:19 +00:00
Axel Dörfler
8bde4cf98c vm_store::fault() can now decide not to handle the fault - when it returns
B_BAD_HANDLER, vm_soft_fault() will just continue as if there is no fault()
function.
There is now support for the B_STACK_AREA and B_KERNEL_STACK_AREA protection
values: if the former is used, or the latter in combination with DEBUG_KERNEL_STACKS,
a number of guard pages is inserted at the bottom of the stack (depending on
the STACK_GROWS_DOWNWARDS/UPWARDS arch config).
In addition, user stacks are no longer committed completely, ie. they don't
reserve memory for their whole size, only as much as is needed. That may
result in applications crashing when they need a lot of stack and there is
no memory left. Before this change, you could not even run that application.
Since BeOS has a 16 MB stack for the main thread, you could only run about
2 applications with 64 MB before.
Due to these changes, we've now switched to the standard BeOS stack sizes.
Some minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10014 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-18 18:03:34 +00:00
Axel Dörfler
893e0713fb vm_store::fault() now returns a status_t.
Some cleanup.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10005 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-18 14:35:40 +00:00
Axel Dörfler
5d6e6b647c Fixed warning.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9996 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-18 04:15:10 +00:00
Axel Dörfler
1979c1f90c Page directories are now always allow user read/write access - this reduces
the x86 protection model to page level protection only. It's currently needed
for BeOS compatibility, though we might want to get rid of it later. Thanks
to Jerome for stombling into this :)
arch_vm_translation_map_init_post_sem() did not return a proper status.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9989 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-17 15:51:24 +00:00
Axel Dörfler
abb0fbc167 vfs_mount_boot_file_system() now at least checks for the right partition
offset to recognize the boot volume.
This should work well enough for now (as long as you don't have too many
disks in your system).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9965 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-15 20:02:04 +00:00
Axel Dörfler
06db250916 vfs_mount_boot_file_system() now also gets the kernel_args.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9964 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-15 20:00:49 +00:00
Axel Dörfler
0084d31635 Added an additional flags parameter to fs_mount(), "args" is now a const char.
Turned off debugging output in pipefs.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9951 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-15 16:43:30 +00:00
Axel Dörfler
ead0d79064 Debug output now uses the TRACE() macro, turned debug output off.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9942 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-12 17:21:14 +00:00
Axel Dörfler
fdc19c4c1a Accidently disabled old BeOS API.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9941 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-12 17:18:45 +00:00
Axel Dörfler
f99b76aafb Changed fs_mount() call, "args" is now a const char, added flags parameter.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9940 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-12 17:03:48 +00:00
Axel Dörfler
eb9f0103f8 file_cache_delete() can now safely be used with a NULL pointer.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9938 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-12 16:46:05 +00:00
Axel Dörfler
6d6292cffa Some changes and bug fixes to make the API better to use:
- added user data pointer to cache_transaction notifier
- added functions block_cache_set_dirty(), and block_cache_make_writable()
- cache_transaction_next_block() let's you iterate over all blocks in the transaction
- instead of binding the block contents to the transaction (read-only checked
  out blocks did only see the unchanged blocks until the transaction was closed)
  the block now always shows the current data - even if the old way had some
  advantages, it was terrible to use
- the blocks were not correctly added to the transaction
- improved debug output
- can check if the read-only blocks were changed accidently (compile time option)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9936 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-12 16:43:51 +00:00
Axel Dörfler
9ad2b1324f The boot loader places the debug symbols in the kernel args, and since
we don't want to copy them over to the kernel heap, we just don't free
the kernel args if the debug symbols are enabled - and since there are
no driver settings yet in the kernel, this is always for now.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9931 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-11 19:43:59 +00:00
Axel Dörfler
85b750f216 Implemented first test implementation of the new block cache and transaction API.
Moved from mutexes to benaphores.
Removed partial write support of the old API.
remove_cached_device_blocks() will now actually free all remaining blocks.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9895 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-10 02:03:39 +00:00
Axel Dörfler
4f727c8fb6 New function hash_remove_first() makes emptying a hash table much simpler.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9892 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-10 01:56:22 +00:00
Axel Dörfler
43576fd35b Removed some debugging output that shouldn't have made it into the repository.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9886 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-09 13:57:03 +00:00
Axel Dörfler
3407cab7da Temporarily added initialization of the system time conversion factor (x86)
to the arch independent section (pure laziness + I am not yet sure how this
will look like on other platforms).
Fixed the clone_area() command: B_CLONE_ADDRESS must not be used in the
same address space, because the area creation then can only fail.
Added an explanation on why the area is cloned at all.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9885 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-09 13:50:52 +00:00
Jérôme Duval
06dae80951 clean up of region=>area, addr_type=>addressSpec, fixed compile errors when trace is active
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9884 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-09 13:42:12 +00:00
Jérôme Duval
b138834ceb added a read only cloned area for real time data. untested yet.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9880 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-09 12:44:53 +00:00
Axel Dörfler
3f345c7e95 Implemented clone_area() and _user_clone_area(). Not tested, but should work.
Added some missing consts.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9872 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-08 19:26:43 +00:00
Axel Dörfler
5b532f8614 Added fs_volume.h header, "resolved" one of the last old ERR_* error codes.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9870 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-08 18:35:47 +00:00
Axel Dörfler
b9be02df0c vm_area_for() did not work correctly; apparently, I had chosen the wrong area_for()
like implementation to copy from...


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9863 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-08 15:05:10 +00:00
Axel Dörfler
534d8fbcc7 Fine-graded debug output. Debug output disabled by default.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9862 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-08 14:37:07 +00:00
Axel Dörfler
13dee31361 Now uses create_area() instead of vm_create_anonymous_region().
The page_stats debugger command now understands queue names as well.
Some minor cleanup, improved error checking.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9861 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-08 14:34:35 +00:00
Axel Dörfler
1c11f7ea8a Got rid of regions - we're now back in area-land.
Renamed vm_area::lock to vm_area::protection to be less confusing - wiring
is still called wiring, though (might be renamed to lock later, as that's
how BeOS calls it).
Renamed some global variables to match our naming scheme.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9860 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-08 14:25:09 +00:00
Axel Dörfler
df9445ba48 Replaced region_id with area_id.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9859 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-08 14:17:19 +00:00
Axel Dörfler
98cc327660 Replaced region_id with area_id.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9857 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-08 14:11:46 +00:00
Axel Dörfler
070f286492 Use create_area() instead of vm_create_anonymous_region().
Some minor other cosmetic changes.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9856 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-08 14:06:50 +00:00
Axel Dörfler
a13f918460 No need to have the kernel daemon run immediately.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9855 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-08 14:03:19 +00:00
Axel Dörfler
07bdb9c6ea Got rid of gSemRegion as it is never really used.
Renamed all static global variables to have the 's' prefix.
acquire_sem_etc() now fails if B_RELATIVE_TIMEOUT and B_ABSOLUTE_TIMEOUT
are both set.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9854 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-08 13:57:40 +00:00
Axel Dörfler
148a8e0c57 Renamed *_stack_region_id with *_stack_area, also replaced region_id with area_id.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9853 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-08 13:53:34 +00:00
Axel Dörfler
877547cdb0 Renamed *_stack_region_id with *_stack_area, also replaced region_id with area_id.
Fixed a bug in snooze_etc(): it could define both, B_ABSOLUTE_TIMEOUT and
B_RELATIVE_TIMEOUT at the same time.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9852 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-08 13:52:11 +00:00
Axel Dörfler
99bd520827 Now makes use of the real_time_data structure.
No longer crashes due to architectural VM restrictions (ie. the area
is kernel only but writable now - should be cloned).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9851 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-08 11:48:04 +00:00
Axel Dörfler
6aa419e55f Correctly implemented find_area() and area_for(), available for userland
and the kernel.
create_area() can now only create kernel areas.
_user_create_area() now directly calls vm_create_anonymous_region().
Removed broken find_region_by_address() and find_region_by_name().
Removed vm_find_region_by_name().
Renamed the idle thread stack areas.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9848 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-08 11:20:20 +00:00
Axel Dörfler
bcf9ffef0b Fixed a possible crashing bug.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9847 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-08 11:17:06 +00:00
Axel Dörfler
8bce4da9ee Replaced vm_find_region_by_name() with find_area().
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9846 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-08 11:15:07 +00:00
Axel Dörfler
704df541ac No longer uses private VM API to the base address of the idle thread stacks.
Renamed the idle thread and their stack areas.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9844 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-08 11:12:05 +00:00
Axel Dörfler
3f97e14d42 Fixed a comment as pointed out by Jerome.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9843 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-08 10:17:41 +00:00
Jérôme Duval
d104cdcbae Moved sBootTime to an area, so that userland can clone it
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9811 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-06 17:37:00 +00:00
Axel Dörfler
d2170152b1 _user_set_real_time_clock() can now return an error. It currently even
will do this if this function is called by anyone other than the root
user.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9804 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-05 16:08:00 +00:00
Axel Dörfler
fe5b39146f Neither unregister_wait_for_any() nor register_wait_for_any() returned
status.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9799 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-04 16:42:16 +00:00
Axel Dörfler
bd00cbc6a9 Updated the PPC stuff to recent changes in other parts.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9798 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-04 16:41:32 +00:00
Ingo Weinhold
90072e721d Always define the symbols needed for basic C++ features. If we link against libgcc.a the symbols from there are simply overridden.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9778 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-03 17:33:17 +00:00
Axel Dörfler
ba44a1e8e1 Changed the way the stores commit their memory: there is no special handling
for temporary memory anymore, it's the store's responsibility to do that
correctly now, and that functionality is reached via the vm_cache using
vm_cache_set_minimal_commitment().
Therefore, the vm_store commit() function now returns a status instead of
the size that could be commited.
Replaced the max_commit mechanism with one that cares about the available
memory, stores can reserve and unreserve such memory. The anonymous_commit()
will now fail in case it could not reserve the needed amount of memory.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9777 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-03 17:24:41 +00:00
Axel Dörfler
2786541fbe Fixed a crashing bug in fill_sem_info() - if it was called for a semaphore
with an empty queue, it crashed. sem_info::latest_holder is obviously not
set correctly, and should be fixed.
Some cosmetics.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9771 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-03 15:33:01 +00:00
Axel Dörfler
9d171dd8f9 Implemented _{user|kern}_{read|write}v() functions.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9765 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-03 14:54:10 +00:00
Axel Dörfler
ed85746ace If available, main2() will now execute the Bootscript. If not, it will fall
back to the old "init" command.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9720 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-01 21:44:23 +00:00
Axel Dörfler
e27751d3df Fixed a stupid bug in create_team_thread_start(): it copied the env variables
in the wrong direction for some time now, corrupting the argument area (user
apps would crash).
B_SYSTEM_TEAM is now reserved, so that no team can be created there.
Fixed some warnings when debug output is enabled.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9719 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-01 21:38:56 +00:00
Axel Dörfler
0759a7e5da pipefs_create() now also allows to open an existing pipe.
The inode now keeps track of the number of readers/writers.
Inode::BytesInChain() is now only used protected by the request lock.
Implemented some missing POSIX demands:
- when the last writer is closed, all waiting read requests are aborted
- pipefs_write() now returns EPIPE and signals the current thread with
  SIGPIPE in case there are no readers left
- pipefs_read() will now return 0 in case there are no writers and no
  unread buffers left in the pipe.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9717 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-01 20:36:09 +00:00
Axel Dörfler
fa00c58619 Fixed a potential memory leak in devfs_open().
Correctly implemented devfs_create() - it will now open the an already
existing file if O_EXCL is not set, and no longer fail with EROFS.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9716 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-01 20:20:37 +00:00
Axel Dörfler
7adec93fe8 Added some minor debug output, and a ToDo comment for file_seek().
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9714 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-01 19:48:40 +00:00
Axel Dörfler
de0807a907 Now uses the file name to build the area name, and not the full path anymore.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9707 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-01 15:24:39 +00:00
Axel Dörfler
e4211d820c Fixed another bad bug in the file cache: when one iovec would have to be
divided into several parts, it could happen that overwrite the whole data
portion with data beyond the part that should have been read.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9706 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-01 15:20:27 +00:00
Axel Dörfler
eef883acab Semaphores created in the kernel always belong to the kernel; there is
absolutely no reason to move them to B_SYSTEM_TEAM (additionally, during
startup, set_sem_owner() may crash).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9693 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-01 00:52:27 +00:00
Axel Dörfler
efdc9c95d0 Replaced SYS_MAX_PATH_LEN with B_PATH_NAME_LENGTH.
Changed the last argument of _kern_mount() to be a string rather than a void pointer.
Greatly reduced the stack usage of _user_mount(); it now uses KPath instead
of on stack paths. It now also copies the parameter argument on the heap.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9692 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-01 00:35:27 +00:00
Axel Dörfler
6f5f688cde Thanks to Ingo, symbolic links are now correctly read all the time.
devfs_read_link() and rootfs_read_link() could write beyond the buffer
size passed in (off by one).
The comment for _kern_read_link() didn't fit to what the function really
did.
common_read_link() no longer null terminates the link - it's the file
system's responsibility to do that.
fs_read_link() is not supposed to return the length of the link anymore,
but only B_OK for success.

Note, we deviate slightly from POSIX here, where even a buffer too small
would be filled, and no terminating null byte has to be written at all.
We always return an error in case the buffer is too small, and the link
is not partially copied into the buffer.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9652 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-29 13:11:46 +00:00
Axel Dörfler
eeb4323204 Implemented devfs_unpublish_partition() and devfs_unpublish_file_device().
Made the FS internal API a bit more consistent.
Removed devfs_unlink(), and devfs_rename() (which was just returning EROFS
anyway) - the devfs now appears completely read-only to the user. All
changes are triggered by kernel internal APIs (most usually through either
the devfs itself (old style drivers), the disk_device_manager, or the
standard device_manager).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9645 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-29 02:24:30 +00:00
Axel Dörfler
e876e8c516 Implemented devfs_publish_file_device(); it should actually work, but I haven't tested it yet.
Also implemented the now needed devfs_read_link() function.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9644 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-29 01:58:08 +00:00
Axel Dörfler
433c716b82 Removed the empty function stubs from this file (and basically moved there
where they belong). Lazy Ingo ;-)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9642 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-29 01:43:15 +00:00
Axel Dörfler
554e58f0d4 Added new functions devfs_[un]publish_file_device() - they're not implemented
yet, though, and just return B_ERROR.
devfs_unpublish_partition() now also returns B_ERROR since it's not yet
implemented.
Refactored the device publishing code, so that implementing devfs_publish_file_device()
will become easy.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9639 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-29 01:41:16 +00:00
Ingo Weinhold
de278b48c4 Now implements the _user_*() functions for the DDM syscalls.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9636 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-29 01:38:17 +00:00
Ingo Weinhold
7146639259 DDM syscalls added.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9635 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-29 01:37:37 +00:00
Ingo Weinhold
7fb2963ae4 * Added vfs_normalize_path() service call.
* Added resolve_mount_point_to_volume_root() which does what
  resolve_volume_root_to_mount_point() did. IOW the latter one didn't
  do what it advertised.
* Fixed dir_vnode_to_path(). Basically broken due to the broken
  resolve_volume_root_to_mount_point(), but also compared potentially
  unrelated vnode IDs (belonging to different volumes).
* Fixed get_dir_path_and_leaf(). It didn't deal correctly with paths
  ending in '/' (including the root dir).
* fs_mount() does now accept a NULL fsName, getting the FS name from
  the DDM in this case.
* fs_mount() now also supports mounting file images; it lets the DDM
  create a file device for them.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9629 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-28 22:31:43 +00:00
Ingo Weinhold
c06238cbd6 * Reworked publishing/unpublishing of the device. This is now basically
done by (currently not existing) devfs functions.
* Overridden GetMediaStatus() and GetGeometry() to return useful data.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9627 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-28 22:22:04 +00:00
Ingo Weinhold
1e2e4b3c71 Re-added support for file devices.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9626 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-28 22:18:20 +00:00
Ingo Weinhold
cba3b01fdf Added support for path normalization.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9625 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-28 22:16:41 +00:00
Ingo Weinhold
da87ac8c9a Added KFileDiskDevice to the build again. Fixed compile errors. It won't work yet, though.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9566 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-28 16:05:22 +00:00
Ingo Weinhold
6a6164e712 Renamed RecursiveLockAutoLocker to RecursiveLocker. Don't mount the standard file systems read-only anymore -- they either aren't or know better anyway.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9563 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-28 15:57:04 +00:00
Ingo Weinhold
e5452be634 Cleaned up GetPath(). In the kernel we no longer prefix the partition path names with "obos_" or "haiku_".
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9561 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-28 15:13:08 +00:00
Ingo Weinhold
0402530222 Extended Append() to also allow adding parts of path components. Added leaf component manipulation. Now always chop trailing slashes off the path.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9560 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-28 15:09:48 +00:00
Axel Dörfler
9902467dac Fixed the build in case debug output was enabled.
Moved the debug macros into the program flow, so that they don't look so
temporary :)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9557 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-28 00:32:10 +00:00
Ingo Weinhold
480742bd7a KPath added to the build.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9556 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-27 22:15:11 +00:00
Ingo Weinhold
f3604f65e7 * Added missing `flags' parameter for the mount functions.
* fs_mount() and fs_unmount() are now aware of partitions. A device to
  be mounted is looked up by the DDM and the mount state and mount
  cookie of the corresponding KPartition are updated accordingly.
  Still missing is support for mounting files. Moreover the device path
  needs to be normalized.
* Added RecursiveLockAutoLocker class to ease the `goto errN' pain a bit.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9555 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-27 22:11:57 +00:00
Ingo Weinhold
5de8542789 Since the kernel links against libgcc.a and we use some C++ features that cause functions of libgcc.a to be included that use a couple of formerly undefined symbols (stderr, fprintf, abort, debugger) those had to be added to kernel_cpp.cpp. We don't build the kernel utils as static library anymore, since libgcc.a is listed at the end of the link command line and trying to change that would be a bit ugly. For C++ in the boot loader nothing changes.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9554 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-27 22:07:00 +00:00
Ingo Weinhold
2cee54a863 Use KPath now.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9553 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-27 21:59:54 +00:00
Ingo Weinhold
8ece359269 Uses KPath now, which significantly reduces the stack footprint.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9552 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-27 21:59:05 +00:00
Ingo Weinhold
1766c66484 Added header directories needed now.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9551 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-27 21:57:23 +00:00
Ingo Weinhold
92eb857652 Used KPath where possible.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9550 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-27 21:56:38 +00:00
Ingo Weinhold
92221d2425 KPath is used now where possible.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9549 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-27 21:56:05 +00:00
Ingo Weinhold
1b5f626633 * Changes to use KPath where possible now.
* Made GetMediaStatus() a bit more robust. If the ioctl fails (e.g. if it
  is not implemented as in Thomas' drivers), it gets the device geometry
  and does not fail, if the device is not removable.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9546 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-27 21:52:33 +00:00
Ingo Weinhold
0707c10377 KPartition::GetPath() now uses the new KPath class, which makes it more convenient to use.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9545 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-27 21:48:47 +00:00
Ingo Weinhold
d68a188e6d Added class KPath. Convenient wrapper for a fixed-sized path buffer.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9541 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-27 21:41:16 +00:00
Ingo Weinhold
42b568aeb5 Moved to headers/private/kernel/disk_device_manager, since it is included by KDiskDevice.h.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9540 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-27 21:38:01 +00:00
Axel Dörfler
0ec71451f5 Added a more or less clean implementation of devfs_publish_partition(); might
be changed later.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9532 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-27 15:21:11 +00:00
Axel Dörfler
b81068c0c8 Turns out that the interrupts were temporarily turned on during startup,
and that main2() cannot therefore just wait until interrupts become
enabled.
Now, the main2() thread is resumed after interrupts are turned on.
I am not yet sure if this is really necessary, but I have the feeling that it is.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9531 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-27 14:00:40 +00:00
Axel Dörfler
4002d2d272 Improved state_to_text() output to match the states in get_thread_info().
Improved the threads list: despite looking much better, it now also prints
out the semaphore number a thread is waiting on.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9530 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-27 12:50:48 +00:00
Axel Dörfler
b229567a92 Now puts out a message if the kernel doesn't fit to the boot loader.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9519 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-26 23:31:48 +00:00
Axel Dörfler
c32cb87156 Moved arch_dbg_con_init() to the end of the file.
Added the new arch_dbg_con_early_boot_message() function.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9518 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-26 23:30:51 +00:00
Axel Dörfler
8083619cf7 Since the additional 512 bytes of dprintf() on the stack can potentially
change the flow of things, it now has its own buffer, and fills it with
interrupts disabled (everything comes at a price).
Now uses the safe vsnprintf() instead of vsprintf() which could crash
the kernel.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9510 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-25 22:53:37 +00:00
Axel Dörfler
e88a0f0885 thread_init() now calls the new arch_thread_init() function.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9509 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-25 22:30:44 +00:00
Axel Dörfler
f9fea8ac78 A clean FPU state is now saved during init, and copied into every fresh
thread. That also allows kernel threads to use the FPU as well.
arch_thread_enter_uspace() no longer needs to initialize the FPU.
i386_stack_init() is now only called once, in arch_thread_init(), as
thought.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9508 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-25 22:29:00 +00:00
Axel Dörfler
ad2a2999a9 In early boot mode, open_module_list() is not able to find everything we
want it to find; therefore, we're now using get_next_loaded_module_name().
Added a temporary suffix to the FS DDM modules (disk_device/v1) - they
might get merged with the standard FS interface modules.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9503 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-25 13:53:52 +00:00
Axel Dörfler
06eec38c23 Added a table with the names of the standard interrupts on x86: they are
now printed out when an unhandled exception is taken.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9483 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-24 14:42:43 +00:00
Axel Dörfler
3ae4fa637a Now also prints the size of every stack frame, as well as the kernel and
eventual user stack regions of the thread.
The registers are no longer jumping around depending on the length of their values.
Removed some unused or doubly included headers.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9479 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-24 14:02:51 +00:00
Axel Dörfler
ddccb72483 Improved the kernel debugger's "thread" command: it will now dump the current
thread if no arguments were given.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9462 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-23 17:09:51 +00:00
Axel Dörfler
8c3666d980 Renamed heap_init_postsem() to _post_sem(), added new heap_init_post_thread().
We now have a working periodic wall checker, enabled by USE_CHECKING_WALL.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9459 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-23 13:59:27 +00:00
Axel Dörfler
842b03d549 Now calls vm_free_kernel_args().
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9458 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-23 13:53:13 +00:00
Axel Dörfler
25c4f39f68 Implemented vm_free_kernel_args() which frees all arguments from the kernel_args arguments
list (but not the structure itself).
Now calls heap_init_post_thread(), heap_init_post_sem() was called ..._postsem() before.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9457 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-23 13:52:42 +00:00
Axel Dörfler
4a3a8d94e5 Add a different approach to calm down page fault handling when debug output is enabled.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9443 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-21 02:44:07 +00:00
Axel Dörfler
8a37c740eb Renamed some init2() functions to init_post_vm() to make clearer when and why
they are called.
Fixed some return types (mostly from int to status_t).
Some minor other cleanup.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9440 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-21 01:50:09 +00:00
Axel Dörfler
d330cc09e2 Renamed some init2() functions to init_post_vm() to make clearer when and why
they are called.
Introduced a cpu_init_post_vm() that will now call arch_init_post_vm() instead
of letting main() doing it.
Fixed some return types (mostly from int to status_t).
Some minor other cleanup.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9439 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-21 01:45:43 +00:00
Axel Dörfler
93048e141e The decision to put reserved regions along real ones proves problematic: fixed
three code locations that didn't handle them properly (when iterating over all
areas).
That and the fact that unmap_and_free_physical_pages() is no longer broken now
leads to the boot region being unmapped and freed properly as intended before.
That revealed another bug: the boot loader region was disposed too early, we
need a few other components pick up boot loader resources first; it now happens
in vm_init_post_sem().
allocate_kernel_args() was also broken, and actually didn't try to allocate
kernel args areas, but tried to reallocate all the virtual allocated ranges
of the boot loader...


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9437 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-21 01:38:37 +00:00
Axel Dörfler
3433f318e0 Disabled the USE_WALL checking by default.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9435 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-20 10:53:03 +00:00
Axel Dörfler
7605ddddf0 Replaced all remaining PAGE_SIZE with B_PAGE_SIZE and "addr" with addr_t.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9430 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-20 00:19:38 +00:00
Axel Dörfler
64807a40c3 As Thomas and I found out in a late debugging session, the VM handled the
boot loaders passed in memory completely wrong (for example, the premapped
graphics buffer could be mapped to the same region as some thread stacks,
just because the VM did not use its knowledge about that mapping): the boot
loader regions are now reserved so that they cannot be overwritten
with other regions anymore. The kernel_args arguments are now tracked, and
areas are created for them (they are not yet freed, though). arch_vm_init_end()
must now call the new vm_free_unused_boot_loader_range() to free any remaining
parts of the memory not yet mapped in by any areas.
Renamed a lot of init functions (ie. postsem to post_sem, init2 to post_area),
also updated because of the vm_translation_map*() arch_vm_translation_map*() move.
B_ALREADY_WIRED can now only be used during kernel startup (it's a private flag).
Replaced PAGE_SIZE with B_PAGE_SIZE.
Some minor cleanups.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9429 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-19 23:51:42 +00:00
Axel Dörfler
be84cd391c Renamed vm_alloc_from_ka_struct() to vm_alloc_from_kernel_args().
Replaced PAGE_SIZE with B_PAGE_SIZE.
Changed some return types to status_t.
Added proper debugging macro instead of dprintf() usage - disabled
debugging output.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9428 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-19 23:41:48 +00:00
Axel Dörfler
952d67454e Now make sure that the kernel address space translation map is initialized
correctly by calling arch_vm_translation_map_init_kernel_map_post_sem().
dump_aspace() now behaves like all debugging functions should behave: it
now accepts decimal numbers as well as hexadecimal numbers as IDs.
vm_translation_map_create() was renamed to arch_translation_map_init_map().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9427 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-19 23:38:05 +00:00
Axel Dörfler
189a0b84e6 Renamed all externally available functions to have the arch_ prefix.
Moved some functions around, so that the public functions come last.
Renamed the internal vm_translation_map_quick_query() to early_query(),
renamed vm_translation_map_quick_map() to arch_vm_translation_map_early_map().
Removed the _module part of the initialization functions.
Added a function that completes the initialization of the kernel map (it
creates the map's lock, which was just not done before).
arch_vm_translation_map_init_map() will now fail with an appropriate
error code if the map's lock couldn't be created for anything that
is not the kernel map.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9426 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-19 23:35:30 +00:00
Axel Dörfler
10abe59096 Since only the arch dependent code may know how much memory the boot
loader preallocated, arch_vm_init_end() (formerly called _endvm())
now calls the new vm_free_unused_boot_loader_range() with the correct
parameters.
Moved the creation of the DMA area from 0-0xa0000 into arch_vm_init_post_area().
Changed return types to status_t rather than just having "int" stand
for a status code.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9425 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-19 23:25:32 +00:00
Axel Dörfler
8d7e89291f The VM init calls were renamed.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9424 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-19 23:21:07 +00:00
Axel Dörfler
8df71f7876 Fixed compilation with debug output enabled.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9407 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-19 00:31:54 +00:00
Axel Dörfler
db01e67532 Added a comment about what vm_alloc_from_ka_struct() is used for.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9400 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-18 15:56:08 +00:00
Axel Dörfler
0d2dca3b56 That requirement hasn't changed with the name :)
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9399 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-18 15:43:16 +00:00
Axel Dörfler
2fdc57b522 BeGeistert checkin: fixed broken allocation length as found by the USE_WALL
feature.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9398 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-18 15:39:21 +00:00
Axel Dörfler
cc0c987a28 No longer relies on certain allocation aligments of malloc(), and instead
uses the new memalign() call.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9397 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-18 15:36:31 +00:00
Axel Dörfler
09ff55a821 BeGeistert checkin: we now have memalign() - and because of that, the
USE_WALL feature can now be used.
Started implementing a USE_CHECKING_WALLS feature, that has a kernel
daemon running that periodically checks the walls of *all* memory
allocations - does not work yet (because of some initialization order
problems).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9396 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-18 15:29:17 +00:00
Axel Dörfler
e1e5a66bc2 BeGeistert checkin: wait_for_child() does now work as expected for any
team and process group IDs as well.
Added a ToDo item that process groups do only work well as long as
their group leader is still active.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9394 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-18 15:16:00 +00:00
Axel Dörfler
b767f41204 BeGeistert checkin: if B_RELEASE_ALL is used, the "count" argument should be
ignored completely (so that zero and below become valid).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9393 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-18 15:14:03 +00:00
Axel Dörfler
2b6c3301f7 Forgot to put the forked team into its parent group in fork_team() - which
resulted in a nice crash on exit.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9371 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-15 16:14:51 +00:00
Axel Dörfler
8cab02c5ce Removed the TRACEPFAULT macro, as it's not really that useful.
Fixed some warnings with debug output enabled.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9370 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-15 16:06:14 +00:00
Axel Dörfler
8593dcc214 Being on a kernel stack doesn't mean we didn't come from userland: we now
no longer pop %fs from the iframe in that case, too.
When we restore a custom stack, however, we'll now pop %fs from the iframe
as such strange threads may even do their own business with it.
Added some comments.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9369 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-15 15:50:41 +00:00
Axel Dörfler
d296d770a3 %fs won't be adopted from the iframe anymore, we don't need to change it there.
We also should disable interrupts in arch_restore_fork_frame().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9368 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-15 15:47:34 +00:00
Axel Dörfler
ba9c55b555 Sure, that bug waited *that* long to pop up.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9367 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-15 14:20:51 +00:00
Axel Dörfler
a7fa05a54b Since arguments may on the stack even in the kernel, load_image() now
always copies the arguments and environment arrays.
No need for the "owns_arrays" in team_arg anymore - it now always owns
them.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9363 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-15 01:52:07 +00:00
Axel Dörfler
4578da13a4 main() now waits until interrupts are available before bringing the device drivers up.
Switched to load_image() instad of using the old team_create_team() to start "init".


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9361 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-14 18:18:22 +00:00
Axel Dörfler
bd4b903e57 Switched from the old team_create_team() to a load_image() compatible mechanism.
The path name is now always taken from the provided argument list (except for
_user_exec() which now replaces args[0] with the path argument).
The team_arg structure know nows if it must delete its arguments or not - this
also fixes a memory leak in case team_create_team() failed when invoked from
userland.
load_image() is now also exported for the kernel.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9360 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-14 18:07:04 +00:00
Axel Dörfler
4711148ca9 wait_for_child() can now also wait on children in the current or any other
process ID (in the current session).
get_death_entry() could call free() with interrupts disabled; now follows
the same mechanism as chosen with the groups (ie. it returns a pointer
to a death_entry to be freed by the calling function).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9354 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-14 15:42:56 +00:00
Axel Dörfler
38cd9a7521 send_signal_etc() is now capable of broadcasting a signal to all teams in
the specified process group (by passing in a negative pid, as in BeOS).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9351 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-14 14:48:40 +00:00
Axel Dörfler
6a70123a9d Big update, but everything is related:
- we now have a working process group/session model. Implemented related syscalls
  and the kernel backend, some POSIX process functions are now available in the
  kernel as well.
- dying teams now monitor their exitus by leaving death_entry structures in
  their parent team.
- Implemented wait_for_child() for pid == -1 and pid > 0; IOW waiting for process
  groups is missing yet. Hasn't yet been tested intensively.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9350 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-14 14:46:12 +00:00
Axel Dörfler
f197107a3d B_RELEASE_ALL is now a bit faster if it has nothing to do.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9349 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-14 14:37:39 +00:00
Axel Dörfler
b51a65027b Fixed a warning.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9343 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-14 14:24:42 +00:00
Axel Dörfler
48e64cd7c8 Added two experimental release_sem_etc() flags (both should stay, but they
may be renamed):
- B_RELEASE_ALL: the semaphore count is set to 0, all waiting threads are released
  (the "count" argument of release_etc_sem() is ignored then)
- B_RELEASE_IF_WAITING_ONLY: the semaphore count is only decreased if there
  are any waiting threads; ie. the semaphore is signaled
Together, they will make the pthread_cond_*() functions easy to implement, and
they come in handy at other places, too.
Removed release_threads variable in release_sem_etc(), as it was useless.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9330 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-13 15:55:30 +00:00
Axel Dörfler
1956e69d13 Moved the thread::sem fields into their own sub-structure for clarity.
Some minor cleanups.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9328 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-13 15:19:08 +00:00
Axel Dörfler
386977d795 Removed delete_sem_etc(), there is no thread::sem_deleted_retcode anymore.
Also removed syscall for that function (shouldn't have been there in the
first place, anyway).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9325 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-13 14:56:44 +00:00
Axel Dörfler
c8e662b19c Changed some thread exit related fields.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9324 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-13 14:54:51 +00:00
Axel Dörfler
c2289a8876 Changed the way a dying thread propagates its exit status and reason: we
no longer abuse the semaphore mechanism to carry an extra status value,
instead, wait_for_thread() registers a death_entry with the thread that
will be filled upon exit.
Removed delete_sem_etc() as it's no longer of use or available.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9323 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-13 14:52:52 +00:00
Axel Dörfler
822e4e0b41 suspend_thread() and resume_thread() no longer have the B_DO_NOT_RESCHEDULE
flag set.
Fixes _user_wait_for_thread() which returned an invalid return code in case
of error.
Some minor cosmetics.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9321 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-13 13:10:27 +00:00
Axel Dörfler
4609c64d48 The %fs register is used by user space TLS - it is CPU dependent, and must
not be restored from the iframe; it will be set by the scheduling code.
This is only of concern on SMP machines and could prevent TLS from working.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9310 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-12 22:42:22 +00:00
Axel Dörfler
fdbd1b5d7b fork_team() is working now! It might not be 100% complete (signal handling),
but the kernel part seems to work good enough for now.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9296 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-12 04:03:52 +00:00
Axel Dörfler
a52cce2963 Moved thread_kthread_{entry|exit}() to where they are found easier.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9294 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-12 03:55:46 +00:00
Axel Dörfler
adf29fcdda Removed the broken arch_thread::current_iframe field and switched to the
same mechanism as NewOS, ie. using the iframe "stack" pointer (using the
new i386_get_current_iframe() function).
Implemented fork() support functions arch_{store|restore}_fork_frame().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9292 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-12 03:52:53 +00:00
Axel Dörfler
21942ca92a The arch_thread::current_iframe was not only redundant, but also incorrectly
maintained. Removed it completely.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9291 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-12 03:48:51 +00:00
Axel Dörfler
27d0a0aaff Implemented new i386_restore_frame_from_syscall() function needed by fork().
Added some comments.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9290 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-12 03:47:09 +00:00
Axel Dörfler
8bf77a7332 _get_next_area_info() skipped every second area if they were adjacent.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9289 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-12 02:50:30 +00:00
Axel Dörfler
d3ddbef95c vm_copy_on_write_area() did not correctly set the upper cache_ref - vm_cache's
pointer to the ref was not set (resulting in a crash).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9282 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-11 12:23:02 +00:00
Axel Dörfler
41dbd5191c Fixed vm_copy_area() when B_CLONE_ADDRESS was specified (insert_area() does not
know about this specifier, it has to be replaced by B_EXACT_ADDRESS).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9281 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-11 12:02:20 +00:00
Axel Dörfler
71eeb427c3 Implemented team_get_address_space() which gets you a pointer to the
team's address space - for internal use, anyway.
Added a ToDo: item to exec_team() to remind me of alarms and signals.
Started implementing fork_team() based on team_create_team() - it's not
completed (or even works), though.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9279 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-10 17:30:42 +00:00
Axel Dörfler
7bb329730d vm_delete_areas() didn't do any locking, but the address space region list
must not be accessed without it.
Implemented _get_next_area_info() and _user_get_next_area_info().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9277 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-10 17:23:54 +00:00
Axel Dörfler
b9d74a6b88 Added vm_delete_aspace() again - unlike before, it now also puts the last
reference to the address space, so that the calling team deletion function
doesn't have to do this.
delete_address_space() doesn't have to delete any areas anymore, since
at the point it's called, there is no area anymore, anyway: each area
holds a reference to the address space.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9276 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-10 17:21:38 +00:00
Axel Dörfler
b492de88e3 I've already switched the page pointer to vm_cache, so this comment was
not necessary anymore.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9268 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-08 23:27:04 +00:00
Axel Dörfler
adf3b19660 resize_area() must unmap the area beyond the new size, if the area has shrinked.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9267 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-08 23:19:33 +00:00
Axel Dörfler
ed3d2e92e8 Added tests for vm_copy_area() and resize_area().
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9266 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-08 23:12:55 +00:00
Axel Dörfler
ad07c81011 vm_cache_resize() now requires you to have the vm_cache_ref lock held.
This actually reflects the only usage of this function anyway, and thus,
fixes the resize_area() function.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9265 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-08 23:11:50 +00:00
Axel Dörfler
f774bf16ea Implemented vm_copy_area(), mainly a support function for fork().
vm_page no longer keeps a pointer to the vm_cache_ref but to the vm_cache.
This cleans the page handling when having to make an area copy-on-write;
regions belong to vm_cache_ref, pages to vm_cache.
Fixed some return types.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9264 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-08 22:56:51 +00:00
Axel Dörfler
c77c1efff5 Removed the broken vm_resize_region() and implemented it properly in resize_area(),
some ToDo-items are left.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9260 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-08 15:16:29 +00:00
Axel Dörfler
d0f673c8e2 Implemented vm_cache_resize(): it removes all pages outside the current bounds.
It currently checks for temporary caches, but it should really only be used
with regions for anonymous memory.
Fixed some return types.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9259 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-08 15:10:50 +00:00
Axel Dörfler
6978315d3a B_EXACT_KERNEL_ADDRESS doesn't really make a lot of sense.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9256 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-08 01:16:54 +00:00
Axel Dörfler
da504d877d Removed team::_aspace_id since it already has a direct pointer to it.
Changed the way a vm_address_space is deleted: instead of having to explicitly
call vm_delete_aspace(), the last vm_put_aspace() will remove it.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9255 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-07 17:17:04 +00:00
Axel Dörfler
1a705b91b7 Removed team::_aspace_id since it already has a direct pointer to it.
Changed the way a vm_address_space is deleted: instead of having to explicitly
call vm_delete_aspace(), the last vm_put_aspace() will remove it.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9254 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-07 17:11:54 +00:00
Axel Dörfler
894e120a01 Moved everything from vm.c belonging to vm_address_space into a separate file.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9253 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-07 16:15:49 +00:00
Axel Dörfler
acfca1a3f5 We now have a working exec_team() function (the backend of the exec() function family)!
Should be tested and verified more intensively, though.
Moved the creation, initialization, and deletion of the team_arg structure out of
team_create_team(); it's now also used by exec_team().
Renamed kfree_strings_array() to free_strings_array().
Renamed the fields of the team_arg structure to be more in sync with the names used
at other places.
Fixed the routine that copied the environment/arguments into the userland space.
Improved and fixed the user_copy_strings_array() function.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9250 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-07 15:34:17 +00:00
Axel Dörfler
5ad2b8edae Added exec() support function vm_delete_areas(); factored that code out
of vm_delete_aspace() (which now calls it).
Fixed some return types.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9248 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-07 15:15:08 +00:00
Axel Dörfler
5c41c39314 Implemented exec() support function vfs_exec_io_context() which closes all
file descriptors that have O_CLOEXEC set.
Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9242 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-07 14:47:58 +00:00
Ingo Weinhold
5741bcb5d8 * Eliminated fs_mount::mount_point. It wasn't really used anyway, only
in dir_vnode_to_path() which does now continue until hitting "/".
* Refactored common volume root to mount point resolution code into a
  separate function.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9210 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-05 16:08:31 +00:00
Axel Dörfler
d6571884c7 Added basic fcntl() functions and syscalls.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9201 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-05 13:36:44 +00:00
Axel Dörfler
c7a0c0f9e1 Added set_flags() support where needed. devfs now uses the ioctl() mechanism
via B_SET_(NON)BLOCKING_IO to notify the device about any access mode changes.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9199 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-05 13:24:12 +00:00
Axel Dörfler
40cc0ebde2 Added an endless loop detection; it will now store up to 16 stack positions
and will check against those. This fixes the rare case an interrupt frame
could cause before.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9191 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-04 22:52:56 +00:00
Axel Dörfler
0f5095f9f9 Now uses thread::user_stack_size instead of STACK_SIZE. This also fixes a
potential bug if MAIN_STACK_SIZE and STACK_SIZE would have been different.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9190 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-04 22:41:34 +00:00
Axel Dörfler
57bf060563 Fixed another stupid bug in the file cache: when the first read was a partial
read over two blocks, some memory behind that memory could be trashed.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9188 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-04 21:03:31 +00:00
Axel Dörfler
2c8b3014ef Moved select events to Select.h. Now includes that header, too.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9142 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-01 00:31:20 +00:00
Ingo Weinhold
b4c1459318 Make use of the newly introduced generated syscall numbers header.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9135 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-30 23:30:29 +00:00
Ingo Weinhold
89e53cea26 It is now understood where the _kern_restore_signal_frame() is used.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9132 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-30 23:25:55 +00:00
Axel Dörfler
8b41e11557 Fixed a possible deadlock (the requests benaphore is now unlocked before
waiting on the write semaphore).
The write functions didn't change the buffer address on a partial write
which could lead to corruption in the pipe data.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9111 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-29 14:30:53 +00:00
Axel Dörfler
a83d9efacf Some changes to debug output.
Fixed a warning that popped up if TRACE_VM was defined.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9110 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-29 14:24:44 +00:00
Axel Dörfler
f3df760478 Fixed the return type of user_memcpy() and friends.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9105 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-29 10:47:46 +00:00
Axel Dörfler
f7bc46254a readwrite() was broken when it had to load more than one missing page at once.
It now prints a warning if the device driver doesn't handle iovecs correctly.
Again, this could lead to very strange behaviour.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9092 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-28 16:30:25 +00:00
Axel Dörfler
da63fa920a device_open() gets the relative path from devfs mount point, not just the
name of the node.
devfs_read_stat() now (presumably temporary) sets the size of the device
for partitions and reports a block device rather than a character device
if the size unequals zero.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9085 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-28 03:22:56 +00:00
Ingo Weinhold
3b554981d3 * Corrected sMountMutex comment.
* Turned sMountOpMutex into a recursive lock.
* Re-inserted sMountOpLock locking in vnode_path_to_vnode(). It doesn't
  deadlock on mounting anymore. :-P
* Added a check in fs_mount(), whether the mount point is a directory. If
  it wasn't, in general it wouldn't be possible to get its parent
  directory.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8993 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-17 12:29:27 +00:00
Axel Dörfler
452ba3abd1 Just like any other mount point, "/" should not be remounted - dunno
why that was there before. Thanks to Ingo for pointing this out.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8981 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-16 15:34:26 +00:00
Axel Dörfler
41f37da0fd Added empty and non-working syscalls for _user_fork(), _user_wait_for_child(),
and _user_exec().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8973 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-15 15:45:37 +00:00
Axel Dörfler
75e4b8694c Removed the STREAM_TYPE_ constants.
Now maintains uid/gid/mode, modification and creation time for all nodes.
Implemented rootfs_write_stat() completely. rootfs_read_stat() now fills
in all required values.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8962 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-15 00:44:57 +00:00
Axel Dörfler
31a726883b Now maintains uid/gid/mode/mtime/crtime, added pipefs_write_stat().
Access permissions are not verified.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8961 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-15 00:15:52 +00:00
Axel Dörfler
e4a0232cc7 Small bugfix: rootfs_read_stat() returned creation time instead of modification
time in st_mtime.
rootfs_write_stat() now properly locks the node access.
Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8960 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-15 00:02:55 +00:00
Axel Dörfler
a837c705f5 Now has a basic understanding of uid/gid/mode values and maintains it -
permissions are not tested, though.
Removed the STREAM_TYPE_ constants.
Now maintains a modification and creation time for all nodes.
Implemented rootfs_write_stat() completely. rootfs_read_stat() now fills
in all required values.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8959 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-14 23:42:14 +00:00
Axel Dörfler
2ef444519e Work-around for buggy device drivers: some drivers (including our current
IDE drivers :-)) don't respect the total amount of bytes to be read in the
former readv() (now read_pages()) call. This can potentially fix all sorts
of strange errors in userland :)
Fixed the debug build.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8938 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-14 17:37:43 +00:00
Axel Dörfler
aad5dc5b3d Removed holding the sMountOpMutex added by the last commit; although this
recreates a race condition, having it here breaks the kernel as fs_mount()
calls this function and already holds the mutex.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8936 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-14 15:46:02 +00:00
Ingo Weinhold
79c795cc5d * create_new_vnode() now also fails, if the volume is about to be
unmounted.
* Clarified a comment in fs_mount().
* Added a bit of documentation regarding the mutexes and the basic vnode
  functions.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8930 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-13 14:53:09 +00:00
Ingo Weinhold
2c731698a2 Verified incorrect behavior of entry_ref_to_vnode() when hitting a mount point or the parent of a mount point.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8923 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-12 10:58:29 +00:00
Ingo Weinhold
1f8bfacc76 *_read_dir() now also returns "." and ".." Entries.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8922 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-12 00:06:37 +00:00
Ingo Weinhold
4f9e4fc932 * The VFS cannot just pass the result of fs_read_dir() calls back to
Userland. It must always set the d_pdev and d_pino fields and, if the
  Entry refers to a mount point even replace d_dev and d_ino.
* Added a TODO comment to entry_ref_to_vnode(). It should take care of
  mount points, as vnode_path_to_vnode() does, I believe. Will verify
  and fix that next.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8921 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-12 00:05:51 +00:00
Ingo Weinhold
119e5eeef8 *_read_dir() now also returns "." and ".." Entries.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8920 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-12 00:00:29 +00:00
Axel Dörfler
eab2037630 When a B_CONTIGUOUS area is created, its pages are now reserved upfront, as
this is the one thing most likely to fail - it now also handles this case
gracefully instead of dying.
Small cleanup, cleared some other ToDos: some user functions now delete
the area when they could not copy the target address.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8911 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-11 00:38:54 +00:00
Axel Dörfler
76faade4e7 Cleanup, no functional change.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8910 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-10 23:43:15 +00:00
Axel Dörfler
d79751261c Added write support for the cache - it only writes internally right now,
it never writes back dirty pages. Code is not tested!


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8905 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-10 19:49:46 +00:00
Axel Dörfler
327981c3d8 Now includes arch_config.h instead of arch_cpu.h (because the info contained therein has moved).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8901 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-10 15:20:37 +00:00
Ingo Weinhold
61b83cc210 * Changed my doxygen comment markers from Qt to javadoc style, still
leaving the tags Qt style though. That's a bit weird, but that's the
  way Axel likes it, and we want to keep him happy, don't we? ;-P
* The common_[path_]read_stat() now fills in st_dev and st_ino in the
  result stat structure after the FS had its go. The information is
  readily available in the VFS, so why bother the FSs. In fact devfs
  didn't (and still doesn't) fill in st_dev which gave dev_for_path()
  some head ache.
* Modified _user_open_parent_dir() to accept a NULL buffer for the
  entry name and added a doxygen comment for it.

df now works properly on Haiku (save that printf() doesn't support
floating point numbers at the moment).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8898 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-09 23:21:09 +00:00
Ingo Weinhold
86170a3cd5 * Got rid of devfs_cookie::stream. It was superfluous since one can
always also access it through the devfs_vnode. This also solves an issue
  in devfs_read() where an access of a cookie->stream would crash the
  kernel, since cookie->stream was not set in devfs_open().
* devfs_open() now doesn't fail for directories and symlinks anymore.
  That prevented BNode to work for devfs dirs and symlinks.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8897 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-09 23:06:04 +00:00
Ingo Weinhold
1dae20235b If the /..' is /' then the name of the root node should consequently be
`.'. This fixes the _kern_open_parent_dir() syscall for the root directory.

I realized, that rootfs_read_dir() doesn't return the entries `.' and `..',
unlike Be's rootfs. Shall I add those, Axel?


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8895 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-08 21:31:18 +00:00
Axel Dörfler
bd80f1c775 Now handles NULL cookies for the VM fs calls gracefully (in case someone
would want to mmap() a device directly).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8884 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-07 15:39:03 +00:00
Axel Dörfler
dc3089f8ff Added a "cookie" parameter to the fs_read|write|has_page[s]().
This has the advantage that the device can now be access in the right context.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8876 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-06 22:48:58 +00:00
Axel Dörfler
dd6cb90eac Added a "cookie" parameter to the fs_read|write|has_page[s]().
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8875 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-06 22:34:08 +00:00