Commit Graph

3546 Commits

Author SHA1 Message Date
François Revol
98a3545295 [ARM]
Add support for boot splash, only for PXA.
Disabled for now as it forces the framebuffer onto some useful data.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32399 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-14 22:14:07 +00:00
François Revol
477d2636d8 Return B_OK on success.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32397 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-14 21:04:29 +00:00
François Revol
7db9fbfe80 Factor out the splash image display logic too.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32395 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-14 20:51:29 +00:00
Ingo Weinhold
7435db9ff0 * _user_read_dir(): Allocate a temporary heap buffer passed into the kernel
instead of using the user buffer. This frees the VFS and FS implementations
  from handling user buffers.
* Adjusted fix_dirent() accordingly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32384 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-14 18:31:35 +00:00
François Revol
0573d397e1 Factor out the RLE and blitting functions from bios_ia32 to platform/generic/ so it can be reused by other platforms.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32383 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-14 18:15:44 +00:00
Axel Dörfler
55be27517f * Also print the capabilities on boot up.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32360 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-14 14:31:38 +00:00
François Revol
3f6f17cf36 [ARM]
Start of framebuffer initialization for the Verdex board.
For now it points to the data section as framebuffer for testing and shows an RGB pattern.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32352 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-14 12:40:16 +00:00
Axel Dörfler
bb693d7764 * Added VESA capabilities field to the kernel args.
* The vesa driver no longer uses VGA programming if the chip does not support
  VGA compatibility.
* The VESA driver now tries to set the DAC to 8 bits per color gun.
* In VESA modes, the driver no longer tries to use VGA programming; introduced
  the new vesa_set_indexed_colors() that is now used for palette programming.
  This should fix wrong colors of 8 bit BWindowScreen users with VESA on real
  hardware (emulators usually didn't mind either way).
* Note that the app_server needs to maintain a palette per 8 bit screen, as
  right now, the colors are garbled after a workspace switch. Stefano, are you
  looking into that already?


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32347 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-14 09:49:28 +00:00
François Revol
3f366cdc39 [ARM]
Don't forget the ELF header else we end up loading at 0x7fff8000...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32341 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-14 01:10:19 +00:00
François Revol
d9c434dc91 [ARM]
Use the same trick as for m68k (r26536) to get separate text & data segments for the kernel, though this should really not be needed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32340 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-14 00:18:25 +00:00
François Revol
7ac9833646 [GSoC] [ARM] Patch by Johannes Wischert.
Update the memory map to account for passed tgz mapping. It's still hardcoded for now though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32339 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-14 00:10:59 +00:00
François Revol
f5ad74ca68 [ARM]
Actually enable mmu_init() since it works for verdex now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32338 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-14 00:10:03 +00:00
François Revol
89fd3a7d20 [ARM]
move checking for the tgz after debug init, and print something when found.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32337 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 23:43:56 +00:00
François Revol
78db3ad125 [GSoC] [ARM] Patch by Johannes Wischert.
Fix wrong string comparison.
(btw the coding style police will inspect this, beware :p)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32336 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 23:41:40 +00:00
François Revol
d8417ee73b [ARM]
- cleanup,
- fix getimg().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32335 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 23:35:02 +00:00
François Revol
715a9925f1 [ARM]
Move ARM MMU definitions to a separate header file.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32332 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 21:09:48 +00:00
François Revol
38ec40dcbe [GSoC] [ARM] Patch by Johannes Wischert.
Partial implementation of mmu support for the bootloader, with lot of debugging output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32330 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 20:30:20 +00:00
François Revol
c2662f0d22 [GSoC] [ARM] Patch by Johannes Wischert.
- empty u-boot specific platform code for the kernel,
- add various objects needed by the kernel from libroot or the generic C implementation.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32328 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 18:48:21 +00:00
François Revol
23eafdaf31 [GSoC] [ARM] Patch by Johannes Wischert.
- stubbed out many arch kernel functions (borrowed from other archs),
- partially implement ELF relocations code, enough to load the kernel,
- move uart.c to kernel sources and use the same one for the loader,
- default implementation for gensyscalls,
- assembler code functions for interrupt masking (enable/disable/restore/query).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32327 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 18:34:15 +00:00
Artur Wyszynski
818ef0e501 Fixed wrong check
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32326 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 17:46:39 +00:00
François Revol
79cf966c2c [ARM]
Add unwind symbols to the kernel too... not sure it goes here though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32325 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 17:36:42 +00:00
François Revol
a2577dbfd1 [ARM]
Stubbed out config_manager and pci bus_manager arch code.
Now really use the boot floppy tgz for the netbsd uimage as it all builds, but with other kernel arch code not yet commited.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32324 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 17:29:46 +00:00
Axel Dörfler
368fc35adf * Also have the uppper limit check in the assert.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32323 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 16:49:53 +00:00
François Revol
b927aacaf9 [GSoC] [ARM] Patch by Johannes Wischert.
Add UART initialization for OMAP. uncomment polling wait loops.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32317 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 14:56:40 +00:00
Axel Dörfler
48cb56d8ef * We also shouldn't try to copy if the dirent is too large, obviously.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32314 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 14:21:18 +00:00
François Revol
0f282bc263 Use a more logical and native error here.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32313 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 14:03:43 +00:00
François Revol
0e20032995 [ARM]
Move the unwind data out of the bss section, it broke bss init which ended up erasing real data and making dprintf do weird things...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32308 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 12:48:33 +00:00
Axel Dörfler
f9ba5c92e3 * Let fix_dirent() handle invalid reclen's gracefully.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32306 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 12:05:20 +00:00
Bryce Groff
6f0f2e9ecd * Cleaned up pointer style
* Added new line that was missing from previous commit.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32298 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 08:38:58 +00:00
François Revol
01c8294cc7 [ARM]
- don't clobber the parameter regs in the entry point,
- fix entry point address for netbsd loader emulation,
- added a gUImage global to point to the uimage blob with the tgz,
- added tgz info to platform stage2 args,
- add simple uimage support, just dumps the header and gets the nth blob in the image, (seems we have a bug in the math code, some infos don't print),
- made devices.cpp use them to publish the MemoryDisk,
- add an haiku_loader_nbsd.ub target which puts both the loader and kernel_arm for now (need to replace with the tgz).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32295 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 05:28:30 +00:00
François Revol
f4e0ad68b3 [ARM]
- fixed copyright,
- added a naive armv5 implementation for __swap_int{16,32}.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32294 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 04:32:05 +00:00
Michael Lotz
68b6dce107 We already panic to indicate that something's wrong, no real need to crash
afterwards instead of returning gracefully.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32293 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 02:00:49 +00:00
François Revol
1e33c1136e [ARM]
- cleanup,
- moved the startup asm code to u-boot/arch/arm/shell.S
- added netbsd loader entry point,
- store the invocation type (0: standalone, 1: netbsd),
- store the global data in a variable,
- added some debug code to see what U-Boot gives us.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32291 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 01:15:21 +00:00
François Revol
cd5d972ea0 [ARM]
Name the FAT; no need to list the contents.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32290 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-12 22:06:14 +00:00
François Revol
2807c5413f fix PXE build with multiboot. GRUB supports netboot btw, could be interesting to explore... but the pxe shell doesn't check for the info yet.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32289 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-12 20:30:03 +00:00
Axel Dörfler
b5cc4c1958 * Disabled multiboot for now, as it breaks the PXE build.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32286 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-12 17:48:18 +00:00
François Revol
e4b608db5b [ARM]
Missed this one in previous commit: remove board.ld include as we now give LD the address directly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32285 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-12 16:25:02 +00:00
François Revol
feb750d331 [ARM]
- consolidate board specific definitions into build/jam/board/*/BoardSetup to avoid duplicating address values everywhere,
	- add various addresses, boot script, custom C/C++ flags and SD card definition,
	- not sure BoardSetup is included at the best place though,
	- replaced board-specific ldscript with passing the loader address directly to LD from BoardSetup,
- added haiku.mmc target which generates an mmc/SD card image with a FAT partition with the files needed to boot for the board, should later be integrated with haiku.image with the BFS partition offset passed to bfs_shell, requires apt:sfdisk,mtools on GNU/Linux,
- added some more rules, one to build a script for the SD image,
- fake a NetBSD loader for now, U-Boot doesn't know haiku, and we'll need a way to pass the tgz image and RAM size, we'll either use standlone way (usual C argv[]) or the NetBSD args,
- style fixes,
- 80 cols, /me pets Ingo.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32284 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-12 16:12:35 +00:00
Axel Dörfler
30f4c392a4 * Cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32281 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-12 14:39:37 +00:00
François Revol
43da1b4f11 [ARM]
Condition the exclusive ops to >= armv6 instead of specific version.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32277 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-12 14:17:05 +00:00
Axel Dörfler
9e90c30ebd * Fixed warnings.
* Removed FAT support from the boot loader for now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32276 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-12 14:12:09 +00:00
Axel Dörfler
a068dcb15a * cdda_read_dir() could copy too many bytes into the provided buffer (worst
case was an unterminated string, though).
* fix_dirent() did not copy the trailing null-byte.
* Not yet entirely sure why, but this caused #4214.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32254 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-11 15:46:07 +00:00
François Revol
166983b771 [ARM]
Stub out swap funcs for pre armv6 which lack REV/REV16. WRITEME.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32240 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-11 03:24:22 +00:00
François Revol
e3db8e35e3 [ARM]
Temporary (?) solution to linking the loader: generate symbols needed by the unwinding code, which should actually not be used since we disable exceptions...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32239 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-11 03:21:29 +00:00
Bryce Groff
1987b05aa0 * Added open_partition to disk_device_manager
* Rewrote PartitionMapWriter
* Updated style to match current style guide for the intel partitioning system.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32235 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-10 22:28:47 +00:00
Michael Lotz
60a5ced394 Adding a disabled debug helper.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32217 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-09 19:54:41 +00:00
Michael Lotz
50d22f83ef The reference of the currently active translation map shouldn't be released
until the data it protects isn't in active use anymore. Previously it would
release the translation map and therefore the page directory reference while
the page dir was still set on the CPU, as only the actual call to
i386_context_switch() will replace the page directory in the control register.
This didn't cause any harm though, as during the context switch interrupts are
disabled and therefore the page directory would only be deferred_delete()ed and
not directly freed/overwritten. Still this is logically more correct.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32216 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-09 17:39:05 +00:00
François Revol
ac15f9dd16 [ARM]
Add rule to handle uimage, and board-specific stuff to handle load addresses. Need to fix them, u-boot doesn't like loading the file with the header where the header says it should go, must copy to a different address.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32214 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-09 16:40:17 +00:00
François Revol
71c5ee196b [ARM]
Remove debug leftover.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32208 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-08 16:12:02 +00:00
François Revol
e60a2810f6 [ARM]
Include board-specific file from the u-boot ldscript, to allow linking to different load addresses.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32207 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-08 16:02:34 +00:00
François Revol
0693778cee [ARM]
Move uart.c to arch/arm/ where it belongs, it has nothing u-boot specific.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32203 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-08 02:38:44 +00:00
François Revol
f875744d56 [ARM]
Remove duplicate header.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32202 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-08 02:26:01 +00:00
François Revol
658d387ad5 [ARM]
- cleanup,
- add an uart_debug_port() to avoid using the #define in serial.cpp,
- use board_config defines in uart.c.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32201 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-08 02:23:22 +00:00
François Revol
67a0108c3b [ARM]
- add board specific headers to includes,
- some unused flash image targets.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32199 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-08 02:01:59 +00:00
François Revol
541e58f98f Seems r31815 got MIA due to r31919+r31925...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32196 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-08 00:18:59 +00:00
Axel Dörfler
f7a6506e0f * Replaced all "status < B_OK" with != B_OK - this should make the VFS layer
more robust against broken (userland) file systems.
* 80 character column cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32184 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-07 12:29:17 +00:00
Axel Dörfler
f7be7fea76 * Setting the depth to 1 for VGA mode in frame_buffer_console_init() was not
a good idea; it didn't have any consequences in there, but actually broke
  the app_server's support for the VGA mode.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32181 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-07 11:07:14 +00:00
Axel Dörfler
86766d6aca * handle_driver_events() kept the sDriversListLock locked over the whole
time. But since this is also locked from within the driver/directory watcher
  (with the node monitor lock held), and handle_driver_events() could cause
  node monitoring updates, the locking order could be reverted, causing a
  deadlock (I just ran into).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32152 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-06 08:24:23 +00:00
Axel Dörfler
13247f3a8c * This fixes VGA mode frame buffer use, no idea when this got broken. It might
be broken in the app_server now, but I haven't checked yet.
* Fixed typo in vesa.h.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32141 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-05 17:24:23 +00:00
Axel Dörfler
45ed4939f9 * area_for() now also returns the area ID for kernel areas if they are
accessible to the userland - this fixes #2405 (ie. MediaPlayer overlay now
  works).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32135 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-05 15:04:45 +00:00
Axel Dörfler
cfd22919f2 * FileMap::Translate() did not choke on negative offsets, and _Cache() does not
necessarily return an error in this case.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32129 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-05 13:05:58 +00:00
Ingo Weinhold
af31cb589c Added comment.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32119 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-05 02:31:00 +00:00
Michael Lotz
ee280b59e9 Prevent the user TLB invalidation function from being preempted by turning off
interrupts when invoking it. The user TLB invalidation function essentially only
reads and writes back control register 3 (cr3) which holds the physical address
of the current page directory. Still a preemption between the read and the write
can cause problems when the last thread of a team dies and therefore the team
is deleted. The context switch on preemption would decrement the refcount of the
object that holds the page directory. Then the team address space is deleted
causing the context switch returning to that thread to not re-acquire a
reference to the object. At that point the page directory as set in cr3 is the
one of the previously run thread (which is fine, as all share the kernel space
mappings we need). Now when the preempted thread continues though, it would
overwrite cr3 with the physical page directory address from before the context
switch still stored in eax, therefore setting the page directory to the one of
the dying thread that now doesn't have the corresponding reference. Further
progressing the thread would release the last reference causing the deletion
of the object and freeing of the, now active again, page directory. The memory
getting overwritten (by deadbeef) now completely corrupts the page directory
causing basically any memory access to fault, in the end resulting in a
triplefault. This should fix bug #3399.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32118 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-04 23:15:05 +00:00
François Revol
f676f30b36 Remove those antique misleading leftovers, the good ones are at headers/private/kernel/boot/images.h
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32116 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-04 18:50:08 +00:00
François Revol
f335531bbc Remove file map disk support by default, it's not used anyway, and we'll use layers for CD anyway. Doesn't spare that many bytes though...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32110 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-04 09:00:10 +00:00
François Revol
98977abc9b Fix m68k build, still unimplemented.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32102 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-03 21:17:03 +00:00
François Revol
af9475fd3d Initialize args.arguments on ARM too.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32100 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-03 19:53:17 +00:00
Ingo Weinhold
1d099cad03 Patch by Bryce Groff: Allow passing an ID of any partition contained in the
disk device to the locking functions, not only the ID of the disk device
itself.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32094 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-03 19:01:20 +00:00
François Revol
696e647c0f Implemented getting bootargs from OF. Untested.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32081 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-03 15:12:24 +00:00
François Revol
56c6c0fefb - introduced an "argumetns" field in stage2_args to hold command line args from chaining loader,
- added some multiboot support code:
	- dump some of the passed info,
	- parse command line (skip the 'kernel' name and pass the rest to stage2_args.arguments),
- added an add_stage2_driver_settings() function which takes stage2_args.arguments and translates it into safe mode driver settings, a bit dumb for now.
This allows using qemu -kernel haiku_loader -append 'debug_screen true' and get debug output without having to enter the menu (once multiboot info is used to determine the boot device too).
The idea is to allow passing driver settings and using them to pass extra stuff (like 'force_keymap fr' and other stuff for demo), and to help automate tests ('run_test /bin/sometest').
This should answer Axel's question :)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32076 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-03 14:39:41 +00:00
Michael Lotz
255c9104e5 * Rework the heap locking strategy. Use a read-write lock for the area lock to
allow for more parallelism. Also introduce seperate locks for the bins and
  for page allocation. This greatly reduces lock contention and reduces the
  duration the locks are held due to them overall protecting less code. Now only
  allocations of the same size hitting the same allocator or allocating larger
  chunks of memory should block. Previously, basically any allocation and also
  free would be mutually exclusive, making it scale pretty badely.
* Added memalign_nogrow(). As it uses heap_memalign() anyway, there's no real
  reason not to allow for an alignment.
* Some cleanup.


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

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


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32073 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-03 12:39:56 +00:00
Ingo Weinhold
16357dea6b Don't lock when the debugger is running.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32072 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-03 11:54:25 +00:00
Ingo Weinhold
885b7b4a85 Removed unsupported architectures.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32071 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-03 11:32:08 +00:00
François Revol
4b8d0e6856 Some ppc fixes for #4115, patch by kallisti5 (without the #ifdef _BOOT_MODE):
- stubbed out arch_cpu_init_percpu(),
- make atomic ops declarations extern "C",
- move calls to [i]sync inside the asm code that needs it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32067 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-03 10:10:22 +00:00
François Revol
91517f4f12 Minimal definition of the MultiBoot Info struct, should be enough for now.
We use official names for defines & struct members.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32060 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-01 12:32:18 +00:00
François Revol
a9c45a68ef Add MultiBoot support.
Based on a patch from Dustin Howett, reworked, and help from Vladimir 'phcoder' Serbinenko.
- used defines for clarity, the rest of teh code could make use of them too...
- added a gMultiBootInfo pointer to the passed args, to let C code handle it instead of faking the boot drive ID,
- conditionalized the copy back, maybe we can get rid of it when QEMU handles our default load address correctly,
- added video mode info to ask for 1024x768 but QEMU ignores it anyway, and we might need to show the menu, so it's disabled.


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

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


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32050 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-01 01:53:54 +00:00
Ingo Weinhold
1af695be01 Automatic whitespace cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32044 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-01 01:18:39 +00:00
Ingo Weinhold
cc77aba101 * Allocate a separate double fault stack for each CPU.
* Added x86_double_fault_get_cpu(), a save way to get the CPU index when in
  the double fault handler. smp_get_current_cpu() requires at least a somewhat
  intact thread structure, so we rather want to avoid it when handling a double
  fault. There are a lot more of those dependencies in the KDL entry code.
  Working on it...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32028 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-31 16:14:18 +00:00
Axel Dörfler
61b6f38cfc * Cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32021 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-31 14:11:12 +00:00
Axel Dörfler
061d2ed1a2 * Creating a symlink now fails with B_NOT_SUPPORTED instead of
B_READ_ONLY_DEVICE if it has a write hook.
* This fixes bug #4141.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32004 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-31 00:40:52 +00:00
Axel Dörfler
c32499b4f7 * Since the file_map reports its chunk with a file system specific alignment, we
cannot assume that the file is that long - we need to check for the actual
  file size specifically, and then clear the extraneous bytes based on that one.
* This fixes seeing old file left-overs in the space beyond the file size in
  mmapped file. Thanks to Oliver who provided me with a nice test program to
  reproduce this problem (this should also fix gcc's fix_includes app (although
  I wonder what it does if a file actually ends on a page boundary).
* Also fixed a bug in precaching that would cause the last page of the cache
  to be discarded, causing it to be re-read later on.
* Moved partial page clearing into its own function
  read_pages_and_clear_partial(), even though it's currently only used once.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32001 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-30 23:12:12 +00:00
Ingo Weinhold
ce50cdc3ed When recovering a tracing buffer from a previous session we do now check the
tracing buffer entry list at least. Eventually we should check the entries
themselves, too.


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


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31991 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-30 19:50:50 +00:00
Ingo Weinhold
57a25014b0 Statically initialize sTracingMetaData to sDummyTracingMetaData. This causes
tracing use before real initialization to be ignored gracefully again. Fixes
#4158.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31973 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-30 15:12:21 +00:00
Ingo Weinhold
213d2d8f9d Added syscall _kern_kernel_debugger() to enter the kernel debugger.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31965 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-30 12:35:42 +00:00
Axel Dörfler
ca39f8d89f * Use parse_expression() instead of strtoul().
* "owner count" contained an extra tab.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31951 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 23:01:27 +00:00
Ingo Weinhold
d829579dc0 mmlr + bonefish:
Moved the static variables for managing the tracing buffer into a separate
area. The area is mapped at one of a few possible physical addresses and can
be found again when rebooting. This allows us to resurrect the tracing buffer
from the previous session, which could help tremendously when tracking certain
bugs (like triple faults). There's very little checking done yet, so it is
probably not as robust as we would wish it to be.


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


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


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31932 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 18:57:21 +00:00
Ingo Weinhold
00e22bae44 Use B_SYSTEM_TEAM instead of the hard-coded 1.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31931 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 18:53:38 +00:00
Oliver Tappe
a50f9555a8 * re-added the broken bsd-version of strtod.c, as our kernel depends on strtod,
too, and I do not dare to add a glibc-based source to our kernel.
  This means that our kernel will have to live with strod() yielding
  inaccurate results, but since the only use I have found was for fs-queries,
  I think we can cope for now.
* added a comment to the top of strtod.c that explains the current state.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31925 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 17:07:00 +00:00
Oliver Tappe
8c359d8eb4 * small cleanup
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31920 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 16:22:00 +00:00
Oliver Tappe
4f86db4973 * replaced broken bsd-inherited implementation of strtod() with the glibc
version that lives in our repo, too, and actually works as intended
* removed the broken strtod() implementation from the repo
This fixes all floating-point test regressions reported in #3308.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31919 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 16:03:14 +00:00
Axel Dörfler
4cb7d2e55d * Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31915 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 15:46:21 +00:00
Oliver Tappe
c11fb6fd9f * removed a TODO that no longer applies
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31914 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 15:45:14 +00:00
Axel Dörfler
533cba7eff bonefish + axeld:
* Reverted r31809 as it introduced a race condition; if the I/O request had been
  notified, it could already been deleted at that point.
* Instead, we need to notify the request in each file system/driver that uses
  it. Added new notify_io_request() function that does that exactly.
* Added a TODO comment to the userlandfs where the request notification needs
  a bit more thought.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31903 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 12:16:15 +00:00
Axel Dörfler
8ae594ffd4 * Introduced dedicated syscalls for the deprecated BeOS fs_attr API. Before,
each attribute access needed 3 syscalls, now only one as it should.
* Renamed the new Haiku call fs_open_attr() to fs_fopen_attr(), and added a new
  function fs_open_attr() that takes a path (same semantics as the
  fs_[f]open_attr_dir() functions already present in BeOS).
* Merged former _kern_open_attr(), and _kern_create_attr() into one syscall.
* Cleaned up vfs.h.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31881 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 00:34:44 +00:00
Axel Dörfler
0a5bfde225 * Added stack traced to the Abort tracing output.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31870 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-28 21:50:42 +00:00
Axel Dörfler
61efcc328d * Cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31869 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-28 21:49:28 +00:00
Axel Dörfler
71d2034366 * Enhanced cache_blocks_in_main_transaction() to also return the correct number
of blocks in case there is no sub-transaction at all.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31868 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-28 21:47:06 +00:00
Michael Lotz
ebc89d1766 Remove extra newline in debug command description which caused empty lines in
the KDL help to be printed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31866 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-28 21:35:16 +00:00
Michael Lotz
ab5421283b Accommodate for the two lines of clearing ahead when in KDL. This avoids over-
writing lines that are printed below the previously cleared lines when paging.
Fixes bug #4145.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31865 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-28 21:31:27 +00:00
Axel Dörfler
483acc4382 * has_sub_transaction was never initialized, no clue why this didn't come up
earlier.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31845 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-28 14:09:28 +00:00
François Revol
f2a3f51996 jam target to build a flash image. Requires passing UBOOT_IMAGE to jam.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31823 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-27 17:11:40 +00:00
François Revol
6f14ecb425 [GSoC] [ARM] Patch by Johannes Wischert.
Misc. Assembler functions (atomic ops, byte swapping, longjmp and libc).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31822 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-27 16:27:13 +00:00
François Revol
1f4fe94583 [GSoC] [ARM] Patch by Johannes Wischert.
LD scripts for u-boot based bootloader and the kernel.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31819 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-27 16:21:20 +00:00
François Revol
20cbef82a4 [GSoC] [ARM] Patch by Johannes Wischert.
Stubbed u-boot platform code. Mostly copied from other platforms.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31818 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-27 16:13:38 +00:00
François Revol
811662afae [GSoC] [ARM] Patch by Johannes Wischert.
Default arm arch Jamfile for bootloader.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31817 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-27 16:10:29 +00:00
François Revol
95337b50b0 [GSoC] [ARM] Patch by Johannes Wischert.
Include ARM in the endian test.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31815 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-27 16:08:32 +00:00
Michael Lotz
fec23a53d7 Add another paging mode to onscreen debug output. Activated by pressing "t" it
will show the next page after a timeout of 3 seconds instead of waiting for a key
to be pressed. This allows you to enjoy onscreen debug output even when you only
have a USB keyboard. Should be enough time to take a quick look or take a photo.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31814 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-27 15:51:02 +00:00
Axel Dörfler
eb26e782f3 * Decoupled block_cache_used_memory() from the sCachesLock - this should fix the
UI freezes (ActivityMonitor and ProcessController both use get_system_info() a
  lot), although this is only the symptom of another problem.
* The downside is that the block cache usage information isn't as up to date as
  it was previously - it's updated by the block write/notifier thread now (worst
  case every 2 seconds).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31812 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-27 14:59:39 +00:00
Michael Lotz
5efec82035 * Fix KDL output to use kprintf instead of dprintf.
* Make the allocations command available even without leak checking. The sizes
  that are dumped aren't as accurate without leak checking info, but having the
  address and max size is already helpful.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31811 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-27 14:47:04 +00:00
Axel Dörfler
2c8ad7ab3e * If the fs_io() hook failed, we need to check if the request has been notified
about it (there is also no public API to do that in the FS yet).
* This could have caused bug #2719, although the specific reason why the FS hook
  failed remains unknown. At least it won't hang in this case anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31809 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-27 14:38:29 +00:00
Stephan Aßmus
5147963dcd headers/private/kernel/util/OpenHashTable.h, Hugo's version, is a bit nicer than
Tracker's OpenHashTable.h which it should eventually replace. We've renamed the
class to BOpenHashTable and changed the interface slightly so that HashTableLink
became superfluous.
Adapted all the code that used it. Since the OpenHashTables no longer clash,
this should fix the GCC4 build.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31791 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-27 00:39:12 +00:00
Axel Dörfler
f75b8de3fc * Discarded the "parametersSize" parameter from various disk device manager
functions.
* Since we now use UserStringParameter, this fixes the missing null termination
  of the parameter string, and thus bug #4045.
* Removed UserMemoryParameter, as it's no longer in use.
* Adjusted syscalls accordingly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31779 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-26 17:27:27 +00:00
Axel Dörfler
6def1a637b * In order to resolve mount points, fix_dirents() retrieved all vnodes from
disk; but since mount points are always kept in memory, it makes much more
  sense to use lookup_vnode() instead.
* As a side effect, directory listings are no longer aborted when they contain
  broken files that could not be retrieved anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31775 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-26 15:07:27 +00:00
Axel Dörfler
71e439ea3e * Moved most utility functions from bfs.h to Utility.h.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31770 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-26 13:44:31 +00:00
Axel Dörfler
813d9285bf * Fixed a number of problems of the "block_cache_data" command.
* Also added stack traces to each BlockData entry.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31763 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-26 12:18:11 +00:00
Axel Dörfler
27a88ee6b2 * Fixed typo.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31762 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-26 12:13:20 +00:00
Axel Dörfler
6102f0788a * file_cache_set_size() now clears the last page of its cache if needed. This
fixes #4106 for good.
* Also removed a bit of dead code in that function.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31732 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-24 09:19:24 +00:00
Axel Dörfler
c06e68d0c8 * Added partitioning system modules efi_gpt, amiga_rdb, and apple to the image.
* Changed the boot loader to have architecture dependent partition/file system
  support. Amiga/Apple partitions, and the AmigaFFS file system are now only
  supported on PPC, while EFI GPT, and the FAT file system is now only supported
  on x86.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31713 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-23 12:10:09 +00:00
Axel Dörfler
664683a7d2 * Fixed just another typo.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31709 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-23 08:33:57 +00:00
Axel Dörfler
bdee97bc3a * Applied slightly changed patch by Alexander von Gluck.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31708 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-23 08:22:01 +00:00
Axel Dörfler
1ad5198c09 * Reset keyboard state when an emergency key has been processed - it's likely
that we lost a few keystrokes, and would make keys (like SysReq) stick.
  Thanks to Rene for the note!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31688 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-22 08:02:51 +00:00
Ingo Weinhold
0b11ecb18c * Always include the public arch_debugger.h headers. The structures defined
there are prefixed with the respective architecture name. Useful for remote
  debugging a different architecture.
* <x86/arch_debugger.h>: Introduced a structure for the FPU state, so that it
  isn't left to the debugger.
* Removed the _kern_get_thread_cpu_state() syscall. Was originally intended for
  bdb compatiblity, but isn't really needed.
* Kernel x86 arch_get_debug_cpu_state(): The use of fnsave was broken, since
  it reinits the FPU after saving the state. This resulted in weird results
  when debugging functions using the FPU. We now use fxsave, if available.
  Otherwise fnsave + frstor should be used -- not fully implemented yet.
  Same for arch_set_debug_cpu_state().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31682 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-21 22:18:39 +00:00
Axel Dörfler
a64c204e23 * The module iteration code now ignores entries named "dev", and "bin" - this
reduced the boot time in VMware by several seconds, and should also help with
  booting from CD.
* Added TODOs on how to further improve the situation in the future.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31672 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-21 12:33:15 +00:00
Axel Dörfler
13aa1795dd * It seems we always have to specify all flags to make it work; removed "flags"
parameter from start_system_profiler().
* Added stack depth, and interval parameters to it, though.
* Profiling the boot process is now possible.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31671 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-21 12:09:15 +00:00
Axel Dörfler
db8fb4fdf0 * The file cache must clear partial pages as well, since they can be mapped
directly via mmap().
* This fixes bug #4106.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31669 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-21 10:17:57 +00:00
Axel Dörfler
c755ecfe96 * Added an emergency key mechanism to the kernel, inspired by Jan Klötzke's
patch from about a year ago (I couldn't use any code of his yet, though,
  but there are a few things left). The emergency keys are triggered by
  pressing Alt-SysReq + key.
* By default, only Alt-SysReq+'d' is used as a means to deliberately enter
  the kernel debugger. F12 belongs to userland again, now :-)
* Debugger add-ons now have another optional method to implement their own
  emergency keys - 'd' for the debugger cannot be overridden, though.
* The mechanism can be turned off via a new kernel setting, so it's not that
  easy anymore to "crash" Haiku if you don't want to.
* Right now, the PS/2 driver, and the pre-input_server in-kernel debugger
  keyboard mini-driver support this, USB not yet.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31660 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-20 20:39:37 +00:00
Ingo Weinhold
7f96148cac Patch by Bryce Groff with changes by myself:
* Added missing name parameter to the partitioning system module child creation
  and child creation validation hooks. Pass the name to them.
* Added BPartitionParameterEditor interface, which is/will be used for editing
  disk system specific parameters.
* Implemented partition parameter editors for BFS initialization and Intel
  partition map child creation.
* Fixed the incorrect supported child partition type iteration in the Intel
  partition map add-on. It does now return actual types.
* Handle the "active" flag parameter in the Intel partitioning system module.
* DriveSetup:
  - Replaced the "Create" submenu by a simple menu item. The type can now by
    chosen in the dialog.
  - Make use of initialization and child creation parameter editors. Some
    non-generic code has been moved to the respective editor implementations
    (BFS, intel partitioning system).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31658 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-20 20:29:16 +00:00
Axel Dörfler
24a9c1bbba * Added option "-r, --recorded" to profile: this will now retrieve the kernel
profile data area, and evaluate its data - it doesn't produce any output yet,
  though.
* _user_system_profiler_recorded() now also makes sure the userland app can read
  from the buffer area.
* Fixed leak in SharedImage::Init().
* Made the symbol retriever more smart when it deals with kernel images; if the
  image ID is no longer available, it will now use the path based image symbol
  iterator (and also adds the boot kernel path, in case the module don't have
  one).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31653 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-20 14:50:14 +00:00
Axel Dörfler
5fbad060b3 * Work-in-progress on a kernel profile service that can be evaluated from
userland afterwards.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31621 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-17 16:21:06 +00:00
Ingo Weinhold
ecece29dd8 thread_hit_serious_debug_event(): Incorrect return value. Fixes #4098.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31584 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-15 11:37:04 +00:00
Rene Gollent
008ec58d9f When building the block cache for UserlandFS's haiku emulation lib, don't include tracing since that's unavailable outside of the kernel. Fixes ticket #4092. Axel or Ingo, please review.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31525 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-12 03:52:52 +00:00
Ingo Weinhold
a365e1cfbb Patch by Bryce Groff, some changes by myself:
* devfs:
  - devfs_[un]publish_partition(): They no longer get the partition path as
    parameter, but rather the device path and the partition name.
  - Added devfs_rename_partition(), which renames an already published
    partition node.
* KPartition/KDiskDevice:
  - Replaced the fPublished flag by fPublishedName, the name under which the
    partition is published. This simplifies UnpublishDevice() and makes it
    practically infallible.
  - Added GetFileName(), which only returns the partition's file name.
    Simplified GetPath() by using it.
  - When a partition is added/removed the subsequent sibling partitions get a
    new index. Now we also rename their published device nodes (and those of
    their descendents). When something goes wrong we unpublish the concerned
    partition's device to be on the safe side. Would be a shame to accidentally
    format the wrong partition, eh? :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31520 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-11 14:35:04 +00:00
Axel Dörfler
a9b9937a3d * Fixed remove(): it should behave like rmdir() for directories.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31500 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-10 13:31:02 +00:00
Axel Dörfler
3f7eb638dc * Ah, well. Now it's really replaced.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31499 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-10 13:04:13 +00:00
Axel Dörfler
6de41102e5 * Replaced the broken BSD realpath() that is neither thread-safe nor POSIX
compliant with one that is both, and magnitudes faster at that, too.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31498 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-10 12:27:05 +00:00
Clemens Zeidler
4ce5127b79 Also I missed this file.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31489 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-09 18:39:15 +00:00
Oliver Tappe
be1f4fe800 * find_symbol_breadth_first() didn't ever set _foundInImage, although
it's signature indicates that it should - the callers just never use
  the value currently, so it caused no harm
* squashed a TODO in the runtime_loader about the resolving strategy
  for undefined symbols in add-ons: I've implemented the breadth-first
  strategy (leaving out the add-on itself), as that one made most sense to
  me.
This avoids loader problems with older optional packages of Pe on gcc4, as some
add-ons (e.g. "Expand Tabs") could not be loaded due to them containing undefined
symbols that are found in second level dependencies (libstdc++.so in this case).

Ingo: please review.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31465 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-08 21:22:12 +00:00
Ingo Weinhold
1cc5e46925 Added offset and size parameters to create_child_partition() and
KPartition::CreateChild(). CreateChild() calls AddChild(), which publishes
the new partition, though at that point offset and size were not set, so that
the published devices would not be usable.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31463 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-08 20:26:43 +00:00
Ingo Weinhold
4dceabd707 * Publish the newly added child partition, not the (already published) parent
partition.
* Don't fail, if publishing failed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31460 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-08 12:50:13 +00:00
Ingo Weinhold
34bc7f03ed Patch by Bryce Groff:
* SetBusy(): Use AddFlags() instead of SetFlags() so that the other flags
  aren't cleared.
* AddChild(): Publish the newly added child partition. Otherwise no-one can do
  anything with it without rebooting first. Other children may need to be
  republished under a new name, if their index changes, which doesn't happen
  yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31444 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-07 13:10:52 +00:00
Oliver Tappe
16d5c24e53 * merged 32bit-wchar_t branches of buildtools and haiku back into
the respective trunk

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31443 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-07 10:30:09 +00:00
Ingo Weinhold
811467dd8f Added missing dependency to generated header.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31415 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-06 02:00:43 +00:00
Axel Dörfler
7af3465eb5 * Made set_timezone() argument const - it's not supposed to mess with it.
* Renamed time.c to time.cpp.
* set_timezone() now uses localtime_r() instead of localtime(), and will also
  no longer fail in case there was no timezone symlink before.
* Cleaned up OS.h header.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31371 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-02 14:07:46 +00:00
Axel Dörfler
215c1a6c75 * _user_{get|set}_tzfilename() can now be used with NULL filename pointers
in case one just want to get or set the timezone.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31370 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-02 14:05:44 +00:00
Axel Dörfler
d1084ff757 * Renamed fs_attr.c to fs_attr.cpp and cleaned it up a bit.
* Always use _kern_create_attr() in fs_write_attr(), or otherwise it might not
  be created when it should.
* Stippi special: fixed typo "in another words" -> "in other words" ("a" is
  singular, not plural).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31312 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-29 09:56:22 +00:00
Stephan Aßmus
181593ba0b * Properly document why fs_write_attr() does what it does.
* As even the author of fs_attr.c was trying to use fs_write_attr() in an
  unsupported way in the cp copy_attributes() implementation, try to be
  more forgiving and support writing attributes at an offset. The method is
  required to behave inconsistent in that replacing bytes at offset 0 is
  not supported as replacing bytes at any other offset. Writing at offset 0
  will clobber the existing attribute to stay compatible with BeOS.

NOTE: BFS itself still does not support writing attributes at an offset which
are withing the "small data section". To work around this problem, programs
which copy attributes in a loop must make sure that their buffer is large
enough that such "small data section" attributes require only one loop
iteration.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31309 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-29 09:08:43 +00:00
Axel Dörfler
e0965f2727 * reload_driver() now also checks if the binary node changed, and will update
the node listener, to make sure it won't lose track.
* The DriverWatcher now also listens for B_ENTRY_REMOVED. This causes drivers to
  be unpublished even if they are only symlinked.
* However, to detect new drivers in a symlinked location, we'd need special
  support for those, and also need to watch the parent directory of the symlink
  target - this is close to overkill, so I stayed away from implementing that
  for now :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31267 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-27 14:24:55 +00:00
Ingo Weinhold
5afb8ea7d7 Patch by Bryce Groff: Implemented DeleteChild().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31234 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-25 15:35:16 +00:00
Ingo Weinhold
fab1c05c05 Split the commpage initialization into two parts. The second part is executed
after all CPUs have been queried for their features. On SMP machines
sysenter/sysexit weren't used before due to the non-boot CPUs appearing not
to have the feature.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31226 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-24 13:53:58 +00:00
Ingo Weinhold
6a1f462e72 * arch_debug_get_interrupt_pc() does now optionally return whether the iframe
is a syscall iframe.
* User debugger support: Don't to call BreakpointManager::PrepareToContinue(),
  if the thread returns from a syscall. We don't want to skip breakpoints in
  that case.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31223 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-24 11:49:35 +00:00
Ingo Weinhold
b0f12d64f4 Added transparent software breakpoint support for user debuggers:
* The bulk of the work -- i.e. juggling the software and hardware breakpoints,
  watchpoints, and memory reads/writes -- is done in the new class
  BreakpointManager.
* For the architectures a few capability macros have to be defined, one
  pointing to the software breakpoint instruction opcode. Done for x86.
* Some more simplifications in the user debugger code, made possible by the
  recently introduced debugger_changed_condition attribute.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31214 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-23 21:03:57 +00:00
Ingo Weinhold
ba391bcc56 Added team_debug_info::debugger_changed_condition to serialize changes to the
installed team debugger and adjusted the code accordingly. It's not needed yet,
but I intend to add support for software breakpoints and those require a bit of
uninitialization that needs to be synchronized with debugger changes and can't
be done with interrupts disabled.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31194 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-23 01:39:51 +00:00
Ingo Weinhold
6a6974b63e gcc 4 warnings.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31192 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-23 01:29:47 +00:00
Ingo Weinhold
6dcc2a7e00 Made destroy_team_debug_info() static, as it's not used outside the source
file.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31190 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-22 23:46:55 +00:00
Axel Dörfler
3609af391d * Renamed _kern_reserve_heap_address_range() to _kern_reserve_address_range(),
and added a _kern_unreserve_address_range() as well.
* The runtime loader now reserves the space needed for all its areas first
  to make sure there is enough space left for all areas of a single image.
* This also fixes the final part of bug #4008.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31115 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-19 11:09:21 +00:00
Axel Dörfler
82db8a9e15 * Added an "unmapAddressRange" argument to the file mapping syscall. This is
the first part of making the runtime loader behave itself; it should already
  make Clockwerk run okay with any number of translators (even if not all of
  them will work yet).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31113 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-19 08:23:11 +00:00
Axel Dörfler
c39811b8b3 * Fixed stupid typo with big consequences as pointed out by Rene. Thanks!
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31098 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-18 14:29:15 +00:00
Axel Dörfler
160f2d1081 * Added private header defining __gUmask which is now used everywhere where
needed.
* Some cleanup in Directory.cpp, and File.cpp.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31086 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-17 14:09:40 +00:00
Axel Dörfler
75557e0ac3 * Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31078 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-17 09:55:07 +00:00
Ingo Weinhold
bbe9c7b15e Rewrote user_debug_thread_deleted():
* It was broken since the support for debugger handovers. Using
  debugger_write() couldn't work, since the thread didn't belong to the
  debugged team anymore (but to the kernel) and thus getting the debug info
  for team would always fail. This makes B_DEBUGGER_MESSAGE_THREAD_DELETED
  notifications work again.
* Allow the thread to block. Locking/writing to the port was non-blocking
  before, but there shouldn't be a problem, if the thread has to wait.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31076 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-17 01:02:33 +00:00
Ingo Weinhold
995aa3f06a broadcast_debugged_thread_message(): Only send the message to threads that are
stopped. Besides that the message won't be interesting to the other threads
anyway, we also risk filling the port and blocking the nub thread.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31075 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-17 00:28:36 +00:00
Ingo Weinhold
e4b912a7f4 Fixed comments and removed superfluous code.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31074 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-17 00:17:37 +00:00
Axel Dörfler
fa00207c50 * Made the internal file systems correctly handle the timespec struct stat
times.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31059 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-15 14:03:24 +00:00
Ingo Weinhold
568ade58d0 User debugger support:
* Generalized address checks. The debugger can now also read the commpage.
* Added new syscall _kern_get_thread_cpu_state() to get the CPU state of a
  not running thread. Introduced arch_get_thread_debug_cpu_state() for that
  purpose, which is only implemented for x86 ATM (uses the new
  i386_get_thread_user_iframe()).
* Don't allow a debugger to change a thread's "esp" anymore. That's the esp
  register in the kernel. "user_esp" can still be changed.
* Generally set RF (resume flag) in eflags in interrupt handlers, not only
  after a instruction breakpoint debug exception. This should prevent
  breakpoints from being triggered more than once (e.g. when the breakpoint is
  on an instruction that can cause a page fault). I still saw those with bdb
  in VMware, but that might be a VMware bug.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31045 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-14 12:14:06 +00:00
Ingo Weinhold
58e784dfe6 Don't build compatibility.c for non-gcc2 anymore.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31043 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-14 11:10:36 +00:00
Ingo Weinhold
6ad4a777b6 Also set user_thread to NULL. It shouldn't make a difference, though.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31040 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-14 10:58:54 +00:00
Michael Lotz
f835a75f31 Make two runs of MTRR setting when setting memory ranges to write-back. At the
first run only set up uncacheable MTRRs and in the second run set the write-back
ones up. If this order is not followed, we could set too large ranges to
cacheable first and then limit it back to uncacheable later. On systems with
enough physical memory this would lead to a temporary situation in which areas
become cacheable that must not be, resulting in system hangs or other unexpected
behaviour. Fixes last part of #4018.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31027 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-13 11:40:05 +00:00
François Revol
1fcdc25661 Fix build due to stricter type checking in C++ than C.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31021 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-12 22:02:21 +00:00
Axel Dörfler
874f23496b * Returning random stat data isn't really nice.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31010 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-11 21:47:19 +00:00
Axel Dörfler
477a4ca70e * vfs_boot.cpp now also exports gReadOnlyBootDevice which is true when the
boot device is actually read-only (even if it's using the write overlay).
* Do not create a swap file on a read-only device - this would really be a
  stupid use of the write overlay (just saw this happening on an older
  machine).
* Made swap_file_{add|delete}() take a const char* path - there was no reason
  this was writable, and this also avoids casting away the const when adding
  the default swap file.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30975 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-05 15:52:58 +00:00
Axel Dörfler
cb8948154c * Only call Removed() on the device if the device actually got removed, not if
only one of its partitions went away. This should fix #3983.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30961 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-04 21:06:06 +00:00
Axel Dörfler
9ca4077700 * Fixed a bug that let _InvalidateAfter() access already freed memory, and would
also mess up the file map, causing all sorts of file corruption.
* This fixes bug #3991 (and eventually some others).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30960 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-04 12:29:15 +00:00
Ingo Weinhold
7927ebb672 Moved the appending of '*'/'&' for pointer/reference parameters to the gcc 2
demangler, where it belongs. The gcc 4 stack traces look correct now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30955 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-04 02:00:45 +00:00
Axel Dörfler
cf2a26ea96 * Don't overwrite the history buffer when you issue the same command more than
once.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30953 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-03 21:05:29 +00:00
Ingo Weinhold
813d6a742f print_demangled_call(): Use a heap allocated buffer. This allows us to be more
generous with the size.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30950 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-03 13:36:35 +00:00
Ingo Weinhold
360d4974b9 Replaced the temporary storage used in the kernel debug command parser. We now
have a simple dedicated heap for the kernel debugger with stacked allocation
pools (deleting a pool frees all memory allocated in it). The heap should
eventually be used for all commands that need temporary storage too large for
the stack instead of each using its own static buffer.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30949 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-03 12:28:49 +00:00
Jérôme Duval
59d67522ea added lrint and llrint functions to math.h
added generic implementations for ppc and m68k


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30945 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-02 20:24:18 +00:00
Ingo Weinhold
fa773c0ae5 vnode_path_to_vnode(): Don't propagate the traverseLeafLink flag, if we've
decided to recursively resolve a symlink. We only have to do the resolution
when the flag is true anyway or the symlink is not the last component of
our path, in which case we have to resolve it anyway. Fixes #3986.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30937 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-01 11:12:12 +00:00
Ingo Weinhold
eb0262fc4c * Reworked vm_soft_fault() and friends:
- While walking down the cache chain, we keep all upper caches locked.
  - When we have to unlock -- when waiting for a busy page or reading a page in
    -- we unlock completely, including the address space, and restart
    vm_soft_fault().
  - Folded fault_get_page() and fault_find_page() into one.
  This simplifies and improves things considerably:
  - We no longer need dummy pages.
  - We no longer need vm_area::no_cache_change.
  - #2710 is fixed, since we no longer hold the address space lock while
    waiting.
* vm_soft_fault(): When we have found our page, we first check whether a page
  is already mapped at the address. If it is already our page, we just change
  its protection. If not, we unmap it first. Fixes race conditions when multiple
  threads fault at the same address at the same time.
* fault_get_page(): When copying a read-only page from a lower cache, no longer
  mark it active, since at least for the fault area it is shadowed from then on.
* vm_set_area_protection(): Fixed potential overflow for in the
  vm_translation_map::protect() call.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30911 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-29 12:55:25 +00:00
Jérôme Duval
591bc3f2d9 * various fixes identified by gcc4, provided by Joe Prostko
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30902 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-28 20:36:22 +00:00
Ingo Weinhold
c533f813a2 Normalized the FATAL messages. The image path is always printed, now.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30878 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-27 14:32:11 +00:00
Ingo Weinhold
6a79745b4c Disabled the stack traces on unhandled userland page faults. As was already
known those can cause a deadlock. Besides, when the debug server is running,
it prints an even nicer stack trace. Not removing the code yet to make things
easier for architectures on which we don't have a userland yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30877 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-27 13:57:07 +00:00
Oliver Tappe
78176019e6 * squashed a TODO in parsedate() about missing timezones - now both textual
(3-letter) and numerical timezones (e.g. -0700) are supported
This means that the workaround in mail_util.cpp of the mail kit could be
removed, but since I do not know if that should still support other versions
of BeOS, I have chosen to leave it alone.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30864 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-26 15:11:05 +00:00
Ingo Weinhold
c7d1aa192f Added system_info::abi field. It contains the system's ABI version, which
might be different from that of the caller (on hybrid builds).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30858 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-26 01:02:39 +00:00
Michael Lotz
f2d4d6f676 Invalidate the elfHeader variable when the image struct is deleted on error, as
they share the same pointer. Should fix bug #3955.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30848 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-24 23:10:55 +00:00
Ingo Weinhold
bcfe344c53 * Made our struct stat POSIX compliant again -- the time_t fields have been
replaced by timespec fields. Via macros the structure is still source
  compatible with the old one.
* Introduced header <compat/sys/stat.h> that defines the old stat structure
  (as stat_beos) and conversion functions
* Introduced versions for [l,f]stat().
* Added symbol versions for BDirectory::GetStatFor() for sake of binary
  compatibility.
* BStatable::GetStat(): Renamed the old method, changed its parameter to
  stat_beos*, and and made it private. Added a new version (using up a
  reserved vtable slot). It remains source and binary compatible.
* BRefFilter::Filter(): Changed the struct stat* parameter to struct stat_beos*
  for sake of binary compatibility. This breaks source compatibility, though,
  which we can't help, since the class doesn't have reserved vtable slots.
* Fixed several issues with the stat structure change, mostly adjusted uses of
  BRefFilter.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30830 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-22 15:15:16 +00:00
Ingo Weinhold
f15e418bab Removed remapping of the *stat() symbols for BeOS executables. We'll use
symbol versioning instead.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30829 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-22 14:59:19 +00:00
Ingo Weinhold
544e3d2523 Commented out more unused glibc stuff. Scary...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30827 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-22 14:55:28 +00:00
Ingo Weinhold
ef3966e888 Added version scripts for the kernel, libroot, and libbe. ATM each has two
version nodes: *_BASE and *_1_ALPHA1.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30826 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-22 14:53:31 +00:00
Ingo Weinhold
79182ad1e5 Reverted r30822, fixing the build.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30824 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-21 20:44:04 +00:00
Jérôme Duval
d5dbb2e3b1 TARGET_STATIC_LIBSUPC++ needs strcat on gcc4, get it before libruntime_loader.a
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30822 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-21 19:36:52 +00:00
Ingo Weinhold
9bf61a0ecc * Added GNU style ELF symbol versioning support in the kernel, too.
* Fixed memory leak in insert_preloaded_image() in error case.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30820 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-21 15:08:42 +00:00
Ingo Weinhold
0f7d5a0010 Should have been part of r30818. The version "glue".
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30819 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-21 15:05:45 +00:00
Ingo Weinhold
c154b94624 Added haiku_version_glue.o "glue code" containing the Haiku/ABI version
symbols recently introduced. Until init_term_dyn.o is linked into kernel
add-ons, too, we link with haiku_version_glue.o, so we have those symbols
in kernel add-ons as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30818 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-21 15:04:37 +00:00
Ingo Weinhold
b3f709b800 Removed unused elf_version_info::hidden field.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30817 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-21 13:11:54 +00:00
Ingo Weinhold
94830eb226 * Moved most code of the heavy elf.cpp into several smaller source files.
* Some style cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30808 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-21 00:57:46 +00:00
Oliver Tappe
b327a1bc7d * when forking a team, not only the signal mask, but also the sig_actions
and the signal stack must be copied into the new thread (at least that's
  what I could make of IEEE Std 1003.1-2001 regarding the expected behaviour
  of fork)
This brings down the failures of the rsync test suite from 24 to 18 ...

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30807 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-20 23:10:13 +00:00
Ingo Weinhold
003ebb0e83 * Also define the build system variables TARGET_STATIC_{LIBSTDC++,LIBSUPC++}.
* runtime loader:
  - Fixed gcc 4 warnings.
  - Enabled -Werror.
  - Renamed all remaining *.c source files to *.cpp.
  - Implemented GNU style ELF symbol versioning support.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30806 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-20 02:22:36 +00:00
Axel Dörfler
e85f80eedf * So many style violations in so few lines of code...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30775 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-16 22:48:45 +00:00
Bruno G. Albuquerque
1bf034d2f5 - Check if we had any changes in status before sending a notification for a new
inserted media. This fixes ticket #3921.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30774 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-16 21:41:33 +00:00
Axel Dörfler
ce4db6ae11 * The covered vnode release was never put when it already was a mount point
during fs_mount(). This fixes bug #3934.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30773 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-16 21:28:12 +00:00
Axel Dörfler
d88527df5c * Applied a patch by Rene that fixes bug #3856.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30770 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-16 20:00:59 +00:00
Ingo Weinhold
6a1e04b121 Symbol resolution functions in the kernel: Removed the unused parameter
allowing optional prepending of a string to the symbol names.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30750 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-13 15:25:27 +00:00
Ingo Weinhold
f91194e546 Removed the gcc_version from the runtime loader's image_t. Instead we always
determine (or guess) Haiku version and ABI and use those for compatibility
decisions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30747 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-13 14:44:17 +00:00
Ingo Weinhold
593ee7bbc3 Extended image_info by fields for the Haiku version and ABI. The runtime loader
and the kernel read those values from the shared object (if available). In the
runtime loader this should eventually replace the gcc version guessing method
currently used (at least for shared objects built for Haiku). The optional
packages need to be rebuilt first, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30729 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-12 21:08:56 +00:00
Ingo Weinhold
51c706f70c Added variables to the glue code that identify the Haiku version and ABI.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30728 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-12 21:01:26 +00:00
Axel Dörfler
6015793f57 * Instead of deleting the device directly, we now only remove it from its
parent.
* Additionally, when a vnode is deleted, the new BaseDevice::Removed() method is
  called that will remove the device from its parent if needed, and delete it
  then.
* This should fix #3856.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30726 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-12 20:03:58 +00:00
Stephan Aßmus
f04362eac3 * Change the drivers that use the ATA stack (ata_adapter) to publish
themselves in busses/ata instead of busses/ide.
* Re-introduce Francois change to install these drivers in busses/ata
  when building with HAIKU_ATA_STACK = 1.
* Adopted the device manager to look for drivers in busses/ata
  additionally to busses/ide.

This change works fine with a clean installation on a computer where I can
(and indeed have to) use the new ATA stack.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30695 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-10 09:22:35 +00:00
Michael Lotz
03a574d8cd * Check for disk extensions before using them (mostly for good practice reasons)
* A CHS read error would previously be hidden by a successful disk system reset.
  Not that it matters much because it'd have resulted in a non-booting system
  anyway.
* Add some more debug output, minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30643 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-06 11:55:19 +00:00
Axel Dörfler
c24d3c0d98 * Fixed two bugs in rootfs_rename(): the check of the result of
rootfs_find_in_dir() was wrong, leading to never be able to find the fromName
  in the directory. Furthermore, the parent of the root directory is itself, but
  the check to see whether or not the target is valid did not take this into
  account, and therefore ran into an endless loop. This fixes bug #3864.
* Rearranged rootfs_rename() to be clearer.
* Style cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30633 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-05 11:53:46 +00:00
Axel Dörfler
a5dbd78b7a * Since PrecacheIO is used as asynchronous callback object, we must not access
it anymore after having called vfs_asynchronous_read_pages().
* Now, Prepare() does all the preparation work, and ReadAsync() does the actual
  work - this must be called without having the cache locked. This also fixes
  another bug where the callback would be deleted twice in case the I/O request
  failed.
* This fixes bug #3847.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30632 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-05 10:13:55 +00:00
Axel Dörfler
3873c5f3f2 * Style cleanup, mostly 80 character limit per line.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30631 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-05 10:05:11 +00:00
Jonas Sundström
cb8f3e2698 More mipsel
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30621 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-03 22:41:38 +00:00
Jonas Sundström
4ba7f1c0ed Staking out some more mipsel ground.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30620 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-03 22:26:23 +00:00
Ingo Weinhold
a866fa9466 panic() when a page that is still mapped is freed.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30606 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-03 12:37:51 +00:00
Ingo Weinhold
88b29adcbd VMCache::Resize(): When shrinking the cache unmap the pages we're removing.
Theoretically, not doing that could have caused still mapped pages to get
into the free queue. This could have been a cause of #3110, but the reported
circumstances don't look quite fitting.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30605 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-03 12:32:20 +00:00
Axel Dörfler
c39ecc608f * If getting a new port message failed, we must release the port's write sem
again, or else the port loses capacity.
* This fixes bug #2720.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30517 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-30 19:07:38 +00:00
Axel Dörfler
d5ad762913 Fixed several problems of the prefetching code:
* Did claim to have reserved pages when calling vm_page_allocate_page(), but
  didn't have any (copy&paste bug). We cannot use it without reserved pages,
  as we need to call vm_page_allocate_page() with a cache locked.
* No longer use low_resource_state() to determine whether to precache or not,
  but use the new vm_page_num_used_pages() instead.
* Also don't (try to) precache when the cache already has more than 2/3 of its
  pages to safe some unnecessary work.
* The size to precache was limited to the file size incorrectly.
* When precaching failed, the cache reference was not released.
* The precaching started one page too late, causing bug #3835.
* Reenabled precaching.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30515 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-30 15:53:41 +00:00
Axel Dörfler
2d8073a9dc * Added a TODO about a problematic use of vm_page_allocate_page() in combination
with vm_cache_acquire_locked_page_cache().
* Added new function vm_page_num_unused_pages() which returns the pages that are
  actually completely free and unused.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30514 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-30 15:46:55 +00:00
Ingo Weinhold
9073b0dccc Made _debuggerAssert()'s "message" parameter const. Fixes building with gcc4.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30502 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-30 12:21:20 +00:00
Axel Dörfler
9431509f5c * Fixed broken socket_get_next_stat() that was responsible for bug #3830.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30500 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-30 11:59:11 +00:00
François Revol
e5ea3d8c41 Print the zlib-provided message in case of error.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30483 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-29 01:53:58 +00:00
François Revol
ff6382031e Build only the required part of zlib with correct options instead of reusing the userland version. This fixes some weird m68k issue, and still works on x86.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30482 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-29 01:52:01 +00:00
François Revol
12442ce54b - add a gBootDriveAPI variable telling which method was used to load,
- move gBoot* out of the boot sector,
- fix the FAT params to actually indicate 1.44kB floppy,
- fix the FloppyDrive class to also use 18 sectors/track, so now tarfs won't get data from start of disk when on the middle.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30481 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-29 01:35:37 +00:00
Stephan Aßmus
996af6d997 Disable pre-fetching until we fix bug #3835.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30477 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-28 10:01:44 +00:00
Stephan Aßmus
aff0fbbe57 axeld:
* vfs_read_pages_async() must not be called with locked cache,
  since it cannot be guaranteed that the operation will be
  performed asynchronously. (The ISO9660 FS for example does not
  implement the new IO hooks... yet.)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30476 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-28 08:03:39 +00:00
Stephan Aßmus
eb2bd0e8e3 axeld:
* Implemented a way to do asynchronous pre-fetching when mapping files.
* There are slight code duplications in some places that could benefit
  from cleaning up, but nothing too bad.
* Implementing smarter ways to trigger prefetching and more analysis of
  the situations in the kernel would be nice. Currently up to 10 MB
  of every mapped file are pre-fetched without further analysis.
* The speed improvement is nice for certain operations. On our test
  system (real hardware), Firefox took 9 seconds from being launched
  to display a window. Now it takes 5 seconds. Both measurements
  right after booting. The same system took 35 seconds from launching
  Haiku in the GRUB menu to displaying the Tracker desktop background
  image. Now it takes 27 seconds.
* We didn't have the chance to check out the effects of this on the
  CD boot, but potentially, they could speed it up a lot.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30465 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-27 18:16:58 +00:00
François Revol
f77b0a6b83 Implemented a FloppyDrive class that uses Floprd, this allows the loader to start reading the tgz, but it fails after 2 blocks.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30464 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-27 16:18:08 +00:00
François Revol
4fd7901292 Finally managed to get floppy boot working for Atari \o/
- loop on Floprd() alternating sides every sect/track, currently hardcoded from the FAT bootblock as probing like the NetBSD loader asserts ARAnyM,
- print a dot / sector read in the great tradition of bootloaders,
- set gBootedFromImage correctly,
- fix the script, make it jam later on.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30455 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-27 02:37:31 +00:00
François Revol
901b8dd28a No reason to keep the .prg startup asm code inside the first 512 bytes, this frees up some space for the floppy code.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30446 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-26 21:45:36 +00:00
François Revol
f2cec6b732 Just keep this around before it get lost... Failed attempt at generating a bootable floppy for Atari.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30444 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-26 21:17:19 +00:00
Michael Lotz
5c8e597e90 Don't try to use disk extensions for non-disk devices (like actual floppies or
emulated ones on CD-boot). One of my laptops returns bogus drive parameters
and another one silently fails the read, previously preventing CD-boot on both.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30389 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-24 23:16:26 +00:00
Ingo Weinhold
106fd6b5cb * Make the wait object hash table larger than the maximum number of wait
objects we're going to add, so we get less slot collisions.
* Use the "Unchecked" versions of the OpenHashTable Insert()/Remove() methods,
  since we have interrupts disabled.
* Fixed wrong check that caused the wait object info events not to be filled in.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30384 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-24 22:44:26 +00:00
Ingo Weinhold
a7ccfc910c Added WaitObjectListener destructor. Hopefully fixes the gcc 2 build.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30346 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-23 14:53:18 +00:00
Ingo Weinhold
227fe7d34a * Scheduler/wait object listener:
- Moved scheduler listening interface to <listeners.h> and added more
    convenient to use templatized notification functions.
  - Added a listener mechanism for the wait objects (semaphores, condition
    variables, mutex, rw_lock).
* system profiler:
  - Hopefully fixed locking issues related to notifying the profiler thread
    for good. We still had an inconsistent locking order, since the scheduler
    notification callbacks are invoked with the thread lock held and have to
    acquire the object lock then, while the other callbacks acquired the object
    lock first and as a side effect of ConditionVariable::NotifyOne() acquired
    the thread lock. Now we make sure the object lock is the innermost lock.
  - Track the number of dropped events due to a full buffer.
    _user_system_profiler_next_buffer() returns this count now.
  - When scheduling profiling events are requested also listen to wait objects
    and generate the respective profiling events. We send those events lazily
    and cache the infos to avoid resending an event for the same wait object.
  - When starting profiling we do now generate "thread scheduled" events for
    the already running threads.
  - _user_system_profiler_start(): Check whether the parameters pointer is a
    userland address at all.
  - The system_profiler_team_added event does now also contain the team's name.
* Added a sem_get_name_unsafe() returning a semaphore's name. It is "unsafe",
  since the caller has to ensure that the semaphore exists and continues to
  exist as long as the returned name is used.
* Adjusted the "profile" and "scheduling_recorder" according to the system
  profiling changes. The latter prints the number of dropped events, now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30345 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-23 13:47:52 +00:00
Ingo Weinhold
1c800aa1f9 Updated TODO.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30344 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-23 12:19:36 +00:00
Ingo Weinhold
146f113fec Fixed issues with the scheduling events. In the listener callbacks we
potentially want to notify the profiler thread (i.e. wake it up), which can
cause another scheduling event notification. That is we have to make sure that
event buffer is in a consistent state at that point (i.e. wake up the thread
at the very end of the callbacks). Furthermore the ThreadEnqueuedInRunQueue()
callback can be called with spinlocks besides the thread spinlock being held. In
particular waking up threads also happens in the condition variable code with
a static spinlock being held. Trying to notify the condition variable the
profiler thread is waiting on in such a case would be a guaranteed deadlock.
Hence we avoid doing that, now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30339 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-22 22:15:27 +00:00
Ingo Weinhold
4a559f388b simple_enqueue_in_run_queue(): Between having found the insertion point and
manipulating the queue is a particularly unsuitable place for calling the
listeners, as they wouldn't be allowed to e.g. unblock threads, since that
would screw the run queue.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30338 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-22 22:03:56 +00:00
Ingo Weinhold
bc2e00c1c7 _user_system_profiler_start(): Check the sampling related parameters only when
sampling is requested at all.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30294 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-21 15:26:16 +00:00
Ingo Weinhold
e0518baa0c Fixed incorrect loop condition. Thanks Francois for reviewing! (and sorry for
mistreating your name -- Haiku's svn is to blame :-)).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30293 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-21 12:30:54 +00:00
Ingo Weinhold
8b3b05cbf9 Synchronize the TSCs of all CPUs early in the boot process, so system_time()
will return consistent values. This helps with debug measurements for the time
being. Obviously we'll have to think of something different when we support
speed-stepping on models with frequency-dependent TSCs.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30287 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-21 00:38:11 +00:00
Ingo Weinhold
65d2b8a8e9 * Introduces VMCache::CanWritePage() returning whether the given cache can
theoretically write the given page.
* page writer: Fixed the incorrect check whether a temporary page can be
  written by using the new CanWritePage().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30281 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-20 15:19:41 +00:00
Axel Dörfler
8a26f35a6d * Sequential write accesses were never detected, due to an incorrect check.
* The previous code would have scheduled a single page to be written out (if it
  would have ever been triggered), now we schedule the complete previous write
  access. This greatly speeds up a "dd if=/dev/zero of=test ..." beyond the
  size of available memory.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30276 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-20 08:02:51 +00:00
Ingo Weinhold
1cdc2fb608 Align the entries in the event buffer to 4 bytes at least. Usually CPUs like
that.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30272 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-19 23:36:59 +00:00
Ingo Weinhold
5b2f0f33f9 * Changed the interface of _kern_system_profiler_start(). The parameters are
passed in a structure now, so it is easier to extend it and ignore unused
  parameters.
* One can now select which system profiling events one is interested in.
* Added scheduling events to the system profiling interface. Those are pretty
  much the ones recorded when scheduler tracing is enabled. Still missing are
  the "wait object" events that allow to interpret what a thread is waiting
  for.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30243 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-18 17:35:28 +00:00
Ingo Weinhold
79257a4ad6 Added a listener mechanism to the scheduler (ATM only for scheduler_simple).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30242 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-18 17:24:58 +00:00
Ingo Weinhold
3539fc6e19 page writer:
* When writing a page failed it is not a good idea to re-enqueue it at the tail
  of the modified queue, since that is definitely behind the page writer's
  marker and the page would be picked up again before reaching the end of the
  queue. If that happened with more than 256 pages, the page writer would keep
  picking up only those non-writable pages and make no more progress.
* When selecting pages also skip temporary pages, if there's no more swap space
  available, since trying to write those pages would most likely fail anyway
  (triggering the first problem).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30230 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-17 14:26:17 +00:00
Ingo Weinhold
8342d4cdd2 * Updated to use add_debugger_command_etc().
* Added "step" debugger command to single-step to the next instruction (of the
  topmost iframe).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30212 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-16 22:56:53 +00:00
Ingo Weinhold
8753babd62 Handle kernel debug exceptions similar to those in userland. This allows to
continue kernel breakpoints -- we would just retrigger the breakpoint when
continuing before.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30210 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-16 22:18:02 +00:00
Ingo Weinhold
31d9352ff6 Make sure kernel breakpoints are installed on all CPUs.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30209 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-16 21:57:52 +00:00
Ingo Weinhold
48b0c6f93a debug_trap_cpu_in_kdl(): If the CPU running the kernel debugger exited and
re-entered it fast enough, we wouldn't leave the loop and thus cause a
deadlock, since we wouldn't process the ICI message telling us to halt. We do
now call smp_intercpu_int_handler() in the loop and guard the function from
being re-entered. This also has the advantage that we can execute code on all
CPUs in the kernel debugger, if we have to.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30208 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-16 21:55:40 +00:00
Ingo Weinhold
b447670286 * Removed most of the special-casing for kernel breakpoints in the kernel
enter/exit code. There's no real reason not to keep kernel breakpoints
  enabled when in userland (unless there are breakpoints installed for the
  team, of course).
* Enabled kernel breakpoints by default (check your kernel_debug_config.h,
  if you have overridden it!), since they don't really add any overhead
  anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30206 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-16 19:56:11 +00:00
Axel Dörfler
78e7cdaede * Removed the get_next_removed_vnode() call again - besides the problems Ingo
pointed out, there is also an unsolvable race condition with BFS that other
  file systems should share.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30204 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-16 18:29:12 +00:00
Axel Dörfler
09a60e4bd4 * Since we moved the socket stuff into the kernel, we lost the ability to
unload the network stack. This now works again, although I didn't manage to
  do it without another lock.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30196 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-16 10:49:21 +00:00
Ingo Weinhold
1b9d2885d3 * Also pass the team arguments and thread names with the respective system
profiling events.
* profile: Avoid using get_{team,thread}_info() in common code paths. The
  system profiling mode is asynchronous, so the team or thread in question
  could already be gone.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30193 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-16 10:02:33 +00:00
Axel Dörfler
4e98292b8e * Introduced new call get_next_removed_vnode() to be able to iterate over
removed but not yet deleted vnodes.
* Simplified get_vnode_removed().
* Header cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30176 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-15 16:14:04 +00:00
Ingo Weinhold
e2ae69da52 The kernel side of a new system-wide sampling-based profiling mechanism.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30127 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-11 22:20:51 +00:00
Ingo Weinhold
efd536ff89 * Cleared up a misconception in the notification mechanism. We already had
methods that used an "event mask" field. There was no need to introduce
  a "flags" field for the same purpose.
* Renamed protected DefaultNotificationService methods (removed "_" prefix).
* Adjusted the code providing a notification service accordingly.
* Changed the event message several notification services generated by renaming
  the "opcode" field to "event".
* Implemented the TEAM_ADDED event and also added a TEAM_EXEC event.
* Added notifications for threads and images.
* Added visitor-like iteration functions for teams, threads, and images.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30126 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-11 21:45:25 +00:00
Axel Dörfler
d1cad26854 * Added an insane block cache tracing mode that will also log the whole block
data. This is available when BLOCK_CACHE_BLOCK_TRACING is 2 or greater.
* Completely untested as of now, though. Will do so soon.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30104 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-10 09:55:04 +00:00
Axel Dörfler
00e8c084e6 Extremely important cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30103 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-10 09:53:50 +00:00
David McPaul
2ecebae14f ignore Stack type in elf loader
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30099 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-10 03:28:00 +00:00
Ingo Weinhold
90d46a5c43 * Fixed the "qOffsets" return value. At least how I understand the
documentation the segment offsets it shall return are relative to the
  address specified in the program header.
* Added "qSupported".
* Added the mandatory commands and some additional ones. Partially implemented
  only.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30038 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-08 16:54:57 +00:00
Ingo Weinhold
7be389053f Don't use exit() when compiling for the kernel.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30037 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-08 16:48:32 +00:00
Ingo Weinhold
b36c8ba26a Added elf_get_kernel_image() returning the image for the kernel.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30036 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-08 16:47:45 +00:00
Ingo Weinhold
777ae2fbb5 More style fixes. Sorry, missed those before.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30027 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-08 13:15:16 +00:00
Ingo Weinhold
c970c6e8f3 Converted C to C++ comments.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30026 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-08 13:13:08 +00:00
Ingo Weinhold
ae2e6c439f * Style cleanup.
* gdb.c -> gdb.cpp


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30025 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-08 12:56:02 +00:00
Stephan Aßmus
6cf94c8595 Removed unintentional thought mumbling left-over that would fortunately cause
no harm.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30002 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-07 17:40:16 +00:00
Ingo Weinhold
0228ef3608 IOOperation::Finish():
* Fixed the read with bounce buffer case. When skipping a partial bounce
  buffer before the part we're interested in, we forgot to update "offset".
* Added some more comments for readability.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29999 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-07 16:06:30 +00:00
Axel Dörfler
093e00573f * Added --stacktrace to the flat list of options.
* Removed superfluous and uncommon '"' around options.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29997 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-07 15:53:37 +00:00
Axel Dörfler
28a650e94d * Made the WeakReferenceable class templatized. Not really sure yet I like that
better, though :-)
* Also fixed a mixup of the unintuitive argument order of our
  atomic_test_and_set(); I guess I will change that sooner or later.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29994 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-07 15:14:15 +00:00
Ingo Weinhold
8c91d29b34 * PageWriterRun::Go(), vm_page_write_modified_page_range(): When writing the
page failed since the cache has been shrunk, we need not only remove the
  page from the cache, we also need to remove all of its area mappings and
  free it. Not removing the area mappings might have been the cause of #3110,
  not freeing it would cause it to be leaked for good.
* vm_page_write_modified_page_range(): When writing failed for another reason
  and the page wasn't in the modified queue before, we would lose the info
  in which queue it was before and setting the page state to modified would
  assume the active queue. This could potentially screw up our page queue
  structures.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29992 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-07 14:06:07 +00:00
Axel Dörfler
e1fed132d2 * Added a WeakReferenceable implementation, completely untested yet.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29990 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-07 12:01:30 +00:00
Axel Dörfler
fd0803f300 * Added RemoveTail() method.
* Renamed DoublyLinkedList::Size() to Count(), since it actually counts the
  items (ie. O(n)).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29979 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-06 21:06:19 +00:00
Oliver Tappe
f9ae64e9a5 zooey + bonefish:
* optimized unmapping of a single page that was rather inefficient
  for large areas

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29978 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-06 20:46:18 +00:00
Stephan Aßmus
e18d4a2d06 Patch by Olivier Coursiere: When rebooting, shutdown all the system teams,
most importantly input_server, which then closes the drivers for input devices.
This in turn will do some cleanup. The touch pad driver will then be reset to
act as normal PS/2 mouse, so that OS like BeOS can use it again.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29948 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-05 19:04:25 +00:00
François Revol
80e1f0e419 Fix error reporting to conform to the POSIX ttyname_r and ttyname.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29917 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-05 07:34:37 +00:00
Ingo Weinhold
53e1017720 bonefish + mmlr:
* We started the "main2" thread too late. Since the scheduler was already
  started on all CPUs, the idle thread could wait (for a mutex) while
  spawing the "main2" thread. This violated the assumption in the scheduler
  that all idle threads would always be ready or running. We now create the
  thread while the kernel runs still single-threaded.
* scheduler_start() is now invoked with interrupts still disabled. We enable
  them after the function returns. This prevents scheduler_reschedule() from
  potentially being invoked before scheduler_start().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29914 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-04 23:54:01 +00:00
Ingo Weinhold
ec29f0842c bonefish + mmlr:
Don't really resume the undertaker thread after creating it, since at that
point the scheduler has not been started yet. Didn't do any harm, since it was
only the second thread anyway and the idle thread was rescheduled almost
immediately.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29908 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-04 21:59:37 +00:00
Ingo Weinhold
73b118b633 bonefish + mmlr:
Check gKernelStartup to avoid sending ICI when entering the kernel debugger
(after ICI is enabled). Moreover it's more obvious than to use that instead
of relying on ICIs not being enabled.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29907 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-04 21:57:07 +00:00
Philippe Houdoin
23614f0aeb Another fix after /boot/beos -> /boot/system change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29888 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-03 23:50:12 +00:00
Axel Dörfler
317bd7dda3 * Changed directory structure as suggested on the mailing list.
* Made the TimeZoneView less error prone, and also actually use Haiku code (the
  previous check didn't work since it used #if, not #ifdef).
* Also took the liberty to rename our boot loader to haiku_loader, since I had
  to update the nasm binary anyway. Updated the assembly sources to nasm 2.0.
* I haven't found where the synth location in the MIDI code is specified,
  though.
* Also, NetBootArchive, and FloppyBootImage haven't been updated yet. Will do
  so next.
* Some optional packages still put their license to beos/etc/licenses. I didn't
  update them yet, as we'll probably do so anyway at some point. Also, I think
  we might want to introduce a common/data/licenses instead for those.
* If you encounter any problems, please tell!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29876 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-03 09:02:44 +00:00
Axel Dörfler
7a517c04b0 * Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29875 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-03 08:05:25 +00:00
Axel Dörfler
49fb53ee7e * Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29868 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-02 16:07:09 +00:00
Rene Gollent
14df3c2bed Various tweaks - 1) while enqueued, keep track of which run queue a thread is in on the scheduler data structure, and use this information so that set_thread_priority doesn't have to search every CPU to find the thread. Also slightly tweak the enqueue and steal operations to take advantage of some of the stats we're now tracking, and experiment with variable quantum sizes for low priority CPU bound threads. Still lots of work to do with respect to balancing and/or affinity though.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29857 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-02 03:13:55 +00:00
Stephan Aßmus
d30acbf30b Patch by maxime.simon: Don't allow to enter sub-menus by the space bar anymore.
This allows to have the first item selected when entering a menu, since still
pressing space would not enter it unintentionally anymore, in case it's a sub-
menu again. Even though it makes some sense to have "Continue booting" selected
by default, it somehow feels more natural to have the first item always selected
instead. Thanks!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29832 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-31 16:28:50 +00:00
Ingo Weinhold
328029e178 Patch by Alexander von Gluck (kallisti5) to get the PPC build going again
(mostly at least). Also disables -Werror for the binutils, but those should
be fixed eventually.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29804 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-30 15:00:10 +00:00
Rene Gollent
4cabb4a077 Integer precision is good enough for us here. Thanks Axel.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29796 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-29 21:44:44 +00:00
Rene Gollent
6ad5d4edc0 dump_run_queue() now outputs the average quantum usage for threads as well. Not quite formatted properly due to what appear to be limitations in kprintf's handling of float format specifiers. Need to investigate.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29789 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-29 18:11:28 +00:00
Rene Gollent
bd037e94a0 Track the number of threads in each CPU's runqueue.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29786 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-29 17:14:52 +00:00
Rene Gollent
6c990aa4af Start tracking thread timeslice usage. Not actually used for any determinations just yet, but will be.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29785 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-29 17:08:10 +00:00
Rene Gollent
dc707c28aa Small cleanup, no functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29784 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-29 16:53:38 +00:00
Rene Gollent
a27b5524c8 Fix code style violation (thanks Axel! ;-)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29733 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-26 15:26:15 +00:00
Ingo Weinhold
880d0bde5a acquire_spinlock[_nocheck]() do now panic() when they couldn't acquire the
spinlock for a long time. That should help to analyze system "freezes"
involving spinlocks. In VMware on a Core 2 Duo 2.2 GHz the panic() is
triggered after 20-30 seconds. The time will be shorter on faster machines.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29732 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-26 15:16:39 +00:00
Rene Gollent
0296b82ae6 Add several extra scheduler hook functions to allow the scheduler(s) to maintain private housekeeping data on the thread structs. These hooks are called on thread creation/destruction and when prepping a thread for use. Review welcome.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29721 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-26 00:58:20 +00:00
Ingo Weinhold
3cf43c2651 Removed the fs_vnode_ops::create_dir() parameter for returning the ID of the
newly created dir. The VFS really doesn't need it and for some file systems
it might not be easy to get by. Several file systems (e.g. rootfs and fat)
were ignoring the parameter anyway.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29719 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-26 00:16:34 +00:00
Jérôme Duval
4acbaafd89 * added help for image KDL command
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29710 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-25 21:05:06 +00:00
Ingo Weinhold
39d58e2f49 Experimental approach to tackle the problem with Be's negative error codes and
ported software:
* If the macro B_USE_POSITIVE_POSIX_ERRORS is defined the POSIX error code
  constants (ENOMEM, EINTR,...) will have positive values.
* Introduced the macros B_TO_{POSITIVE,NEGATIVE}_ERROR() which do convert a
  given error code to a positive/negative value.
* Added static library libposix_error_mapper.a that overrides all POSIX
  functions (save the ones I forgot to add :-)) directly meddling with error
  codes (having them as parameter or returning them) dealing with the
  positive<->negative error code conversions. The functions have hidden
  visibility, so they affect only the shared object they are linked into.
* So ideally all one has to do is to build a ported software with
  -DB_USE_POSITIVE_POSIX_ERRORS and -lposix_error_mapper and be good with
  respect to error code problems.
* Potential issues:
  - When mixing ported and Haiku native code, i.e. using Haiku native code in
    a ported software or using a ported library in a Haiku native application
    care must be taken to convert error codes where the two interface. That's
    what the B_TO_{POSITIVE,NEGATIVE}_ERROR() macros are supposed to be used
    for.
  - A ported static library can obviously not be linked directly against
    -lposix_error_mapper. The shared object linking a against the ported static
    library has to do that. The previous point applies when that causes mixing
    with Haiku native code.
  - When dependent ported libraries are used probably all of them should use
    the error mapping.

Comments welcome.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29653 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-22 15:43:03 +00:00
Ingo Weinhold
a2dad9e1a9 get_library_symbol(): Simplified the RTLD_NEXT case. The caller is not bound
to search for a function with the same name as the calling function, so we
really don't need to find the calling function; the calling image suffices.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29645 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-22 01:39:34 +00:00
Rene Gollent
24fde47c7a Introduce an experimental new scheduler intended to work fundamentally the same as our existing one, but with various optimizations to better handle the SMP case:
1) We now maintain a runqueue per CPU, rather than a single global shared queue. Idle threads are segregated into their own queue for simplicity.
2) Enqueueing threads is now somewhat more intelligent - if the thread is pinned, it is always enqueued onto that core. Otherwise we enqueue it on whichever CPU it previously ran, unless it either hasn't run before, or that core has been disabled via ProcessController. If so, we try to enqueue it on whichever core has been the most idle recently.
3) The above allow various simplifications to thread scheduling. Pinned threads and/or disabled cores are now no longer special cases that need to be dealt with. If a CPU has no threads ready, it looks for another one to steal a thread from, though that part still needs some tuning along with enqueueing for load balancing purposes.

The chief aim here is better load balancing and support for soft affinity. However, at the moment the overall behavior still exhibits some regressions compared to the old scheduler, so it's disabled by default. If you wish to experiment/debug with it, instructions for enabling it can be found in scheduler.cpp. Much thanks to Ingo, Axel and everyone who's helped with either code review/advice or testing so far.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29643 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-22 00:39:51 +00:00
Ingo Weinhold
c029607ba8 Support 0 file descriptors/infos in poll()/wait_for_objects(). Fixes #3591.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29633 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-21 20:23:36 +00:00
Axel Dörfler
c8b762e456 * Userland applications can no longer delete kernel semaphores. However, they
are still allowed to delete semaphores of other teams...
* Anyway, this fixes bug #3585.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29621 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-20 08:29:50 +00:00
Ingo Weinhold
f68892b93e deliver_signal() SIGKILL:
* Use atomic_or() to update sig_pending of the main thread.
* We didn't call update_thread_signals_flag() for the main thread, so its
  handle_signals() wouldn't be called, resulting in an infinite loop, if this
  signal interrupted a restartable syscall. Calling exit() from another thread
  than the main thread was likely to run into this problem. Should fix #3178.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29612 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-19 13:57:10 +00:00
Axel Dörfler
defc7c56fb * One should not rely on the comma operator being evaluated right-to-left as
it was done in SAS/C... (yeah, that was ages ago). This fixes bug #2030.
* Also, we should probably check if the area we're about to shrink/remove
  actually is a reserved area.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29605 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-19 08:55:28 +00:00
Jérôme Duval
7305309909 * proposition to fix a deadlock between kernel daemon and package installer install thread (bug #3447)
to manage this, avoid locking the main sLock in notification handling methods. Instead fill up two lists which will be emptied later by the kernel daemon thread.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29603 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-18 22:59:50 +00:00
Ingo Weinhold
98092e9867 gcc 4 fixes.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29602 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-18 22:43:47 +00:00
Axel Dörfler
941b2f41ec * Cleanup, added TODO.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29589 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-18 14:36:19 +00:00
Axel Dörfler
3f78b216ad * Implemented a basic notification mechanism. Right now, only media changes and
device additions/removals can be monitored.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29582 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-18 08:55:49 +00:00
Ingo Weinhold
4c35c6b5e1 * _user_unblock_thread[s]() also set the user thread's wait_status, now. This
makes them more convenient to use, since the caller doesn't need to know the
  target threads' user thread structure.
* Adjusted the pthread rwlock implementation accordingly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29578 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-18 01:53:06 +00:00
Ingo Weinhold
9e83cc1768 team_free_user_thread(): Unset the thread's user thread before putting it in
the free list. Do that with the threads lock held. This allows other threads
to freely access a thread's user thread structure while holding the threads
lock.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29577 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-18 01:46:29 +00:00
Axel Dörfler
51755cf832 * Added DefaultNotificationService and DefaultUserNotificationService
implementations that can be used by subsystems that want to have a pretty
  standard service. Only the latter is really complete, though.
* The notification manager is now available earlier in the boot process.
* Added notifications to teams/ports (only add/remove).
* The network notification implementation is now using the
  DefaultUserNotificationService.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29543 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-15 10:21:56 +00:00
Michael Lotz
3e37362327 At least if we hit the boot volume override the hardcoded check for BFS. This
makes the Desktop work when booted from an iso only CD, but I agree with the
TODO to move those into the filesystem API.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29518 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-14 15:29:49 +00:00
Michael Lotz
e94d1badf5 Add the name of the missing symbol to the error message that is sent via port.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29515 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-14 14:14:21 +00:00
Rene Gollent
289b6c8d56 Remove invalid TODO.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29504 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-14 00:18:23 +00:00
Axel Dörfler
24ace12957 * Worked over the "area" KDL command to make it more useful, and easier to use.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29503 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-13 21:48:03 +00:00
Rene Gollent
3f71e54926 If a CPU is disabled, continue serving any threads still pinned. Otherwise disabling a CPU in ProcessController at an inopportune time will result in a total system deadlock. Might explain part of the problem in ticket #3535.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29484 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-12 22:11:17 +00:00
Axel Dörfler
c9bc3be3d9 * Minor cleanup, no functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29480 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-12 14:22:05 +00:00
Axel Dörfler
e0b0a173b6 * Cleanup, no functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29478 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-12 12:18:25 +00:00
Michael Lotz
5b9d5a2ec9 * Add has_debugger_command() so whether or not a debugger command is available
can be checked.
* Make the usb_keyboard module check the presence of the needed debugger
  commands to avoid the error messages in case of them being unavailable.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29472 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-11 12:17:23 +00:00
Ingo Weinhold
b538ceb816 Added dup_foreign_fd() to duplicate a FD from another team.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29468 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-11 00:57:17 +00:00
Ingo Weinhold
e055b92aac Added missing header.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29455 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-09 00:50:53 +00:00
Ingo Weinhold
aa4ba93e25 * Renamed src/system/kernel/device_manager/io_requests.{h,cpp} to
IORequest.{h,cpp}.
* Introduced public <io_requests.h> header. Currently it only declares the
  single function BFS uses.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29446 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-08 17:30:37 +00:00
Rene Gollent
f528e1ad7a Fix two more problems in the messaging service:
1) When searching the area for a place to allocate the next command, the case of the first command being the same as the last command (as is the case after adding the first message) was not correctly considered. This prevented a given area from ever containing more than one command.
2) The size of a command was incorrectly word-aligned. Rather than aligning to 32-bit boundaries, the size was truncated to between 1-3 bytes, leading to command corruption once multiple messages were in the area, eventually causing registrar to crash while retrieving the messages.

Combined these two changes result in us no longer constantly allocating/destroying areas during heavy node monitor activity.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29417 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-06 22:57:36 +00:00
Rene Gollent
58336b68a9 Add a TODO note.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29412 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-06 05:49:56 +00:00
Rene Gollent
75d1cb286f The loop that looks for the next area to add a message to has a somewhat fatal flaw: it checks for a non-zero area size (which is always set to the physical size of the area rather than the number of message commands stored within it). As a consequence, areas would never get cleaned up once allocated, which lead the kernel to steadily bleed memory if any reasonable level of node monitoring activity was going on. We now check whether or not the area's command count is non-zero instead, and use that as the criteria for selection. Fixes ticket #3518.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29411 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-06 05:45:32 +00:00
Ingo Weinhold
a7edf1f7c0 Moved RECURSIVE_LOCK_HOLDER() macro to the header and fixed it.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29407 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-05 23:15:15 +00:00
Axel Dörfler
43b2ca9108 * Fixed wrong use of MutexLocker as pointed out by Korli - nice catch! This
could have caused a number of problems.
* Fixed coding style violation Ingo introduced.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29378 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-02 08:23:16 +00:00
Ingo Weinhold
5ecc4b3775 * Introduced ref-counting for the I/O contexts.
* The I/O context related vfs_*() functions have io_context* instead of void*
  parameters/return values, now.
* vfs_new_io_context(): Lock the parent I/O context before getting its table
  size. Otherwise the table size could change until we do.
* vfs_resize_fd_table(): Fixed use of MutexLocker. We created only a temporary
  object, not one with function scope.
* Renamed load_image_etc() to load_image_internal() and added a parameter for
  specifying the parent team of the one to create.
* Introduced a kernel private load_image_etc() with a few more arguments than
  load_image().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29375 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-02 00:26:22 +00:00
Ingo Weinhold
80ece78534 Added private get_image_symbol_etc() that can recursively search for a symbol
(similar to how dlsym() works).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29356 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-28 18:50:40 +00:00
Ingo Weinhold
f6d0017dea Fixed duplicate parameter name.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29342 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-28 10:08:30 +00:00
Axel Dörfler
2e47b62e2c * Consolidated '*' style.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29341 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-27 23:09:39 +00:00
Axel Dörfler
ed3e5ec031 * zero_pages() did not fill in the _bytes parameter correctly - it returned how
many unclear bytes remained instead of how many were cleared. This caused
  sparse files to show garbage instead of empty space. This fixes bug #2889.
* common_file_io_vec_pages() set "size" (size_t) from file_io_vecs::length
  which is off_t without taking into account that important information could
  be lost.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29339 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-27 22:31:15 +00:00
Ingo Weinhold
9bb78ee296 Removed the superfluous 'extern "C"'s.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29334 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-27 12:06:43 +00:00
Ingo Weinhold
e1975d3353 * When a team debugger is installed automatically, the thread causing that is
stored now.
* Extended the debugger message for B_DEBUGGER_MESSAGE_HANDED_OVER by the
  causing thread.
* Also send B_DEBUGGER_MESSAGE_HANDED_OVER to the debugger to which the team
  was handed over. The message will be the very first one the debugger gets
  from the team in question.
* Some harmless refactoring (added thread_hit_serious_debug_event()).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29302 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-23 22:59:45 +00:00
Michael Lotz
63448c92a4 Better do the check for "." and ".." after stripping off superflous leafs as
otherwise a "rmdir ./" would still have caused the corruption.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29299 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-23 22:48:16 +00:00
Michael Lotz
24a7f4c285 Disallow removing the "." entry. We do the same for ".." already and it seems
to be in line with what other systems do as well. Also fixes bug #3476.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29296 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-23 19:55:03 +00:00
Michael Lotz
6eba063647 * Added simplified possibility to schedule UHCI transfers from within KDL.
* Added debugger commands to resolve usb_ids to pipes.
* Adjusted the physical memory allocator to be usable in a slimmed down mode
  when running inside the kernel debugger.
* Implemented USB keyboard support for KDL through a kernel debugger add-on.
* Added kgetc() and made use of it where previously individual methods were used
  to ensure that reading characters always goes through the kernel debugger
  add-ons and the other methods.

This has some preconditions to meet though:
1) The keyboard must be in the boot protocol (currently the case but needs to
   be revisited once we have a full usb_hid).
2) The keyboard must be attached to a UHCI root port (i.e. not use EHCI or OHCI,
   also not through hubs unless those are USB 1.1).
3) the usb_hid driver has to be opened for this to work. This means that for the
   time between initializing USB and when usb_hid is opened by the input_server
   there is no keyboard support.

Also note that this has no way of detecting hot-plug, meaning that you can't
re-attach your USB keyboard from the hub to the root port once in KDL.

On the bright side of things, since this is a non-destructive mechanism it is
possible to enter and leave KDL without loosing the USB state.

Tested OK in QEMU, not tested on real hardware yet, will see in a few minutes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29291 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-22 20:46:27 +00:00
Michael Lotz
c41ac5b0e1 * Remove the original overlay filesystem.
* Add attribute_overlay and write_overlay to the image/floppy instead.
* Mount a iso9660 boot volume with both write and attribute overlay for now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29261 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-19 23:01:42 +00:00
Michael Lotz
77b26c3221 We need a longer filesystem string here to fit in all the possible layers.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29259 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-19 22:39:52 +00:00
Michael Lotz
49004dc730 Remove the additional fs_vnode_ops arugment from get_vnode() again as it's not
needed at all when used as intended. Thanks Ingo for the explanation on how this
is intended to work. Adjusted the overlay fs accordingly and updated/reverted
the changes to the other filesystems.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29250 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-19 18:13:01 +00:00
Michael Lotz
b1a58597b9 Add a new fs_volume op all_layers_mounted() that is called when all layers have
been mounted. This is to allow layered filesystems to setup internal data that
requires all the sub/super volumes to be available.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29248 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-19 01:16:07 +00:00
Michael Lotz
896e3e9c52 Fix wrong check, thanks Axel :-)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29244 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-18 17:52:51 +00:00
Michael Lotz
3684e40bb8 * Introduce a (private) flag B_NO_HANDLED_INFO for install_io_interrupt_handler.
It causes the interrupt handler to be inserted at the very end of the list
  instead of at the top. It is intended to be used as a workaround when a
  interrupt handler cannot know if it actually handled the interrupt. This
  should never be used by native drivers. Also if we know that the result is
  not valid because of this flag we won't disable the vector in case we count
  many unhandled interrupts as those numbers are then unreliable.
* Moved B_NO_LOCK_VECTOR to be a private flag as well.
* Made the interrupt handler list a simple manually maintaned singly linked list
  instead of the doubly linked one used with insque and remque as it greatly
  simplifies things for such an easy use case and is more compact.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29241 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-17 21:41:51 +00:00
Philippe Houdoin
532a47a9f0 Fixed broken style I've introduced.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29228 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-15 21:56:27 +00:00
Philippe Houdoin
4c0255d795 Refactor the code, computing next entry earlier and use continue as suggested by Jerome.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29225 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-15 19:27:36 +00:00
Philippe Houdoin
7f0b01654d Fixed the patch: on disabled processor entry, next entry pointer wasn't computed,
leading to an infinite loop...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29224 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-15 18:43:02 +00:00
Philippe Houdoin
63c851a15d Applied patch supplied by jkeeping in #3445: smp_do_mp_config wasn't checking
MPS table CPU entries for the enabled flag.
This caused Haiku to fail to boot under KVM on Linux.

Thanks you, jkeeping.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29222 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-15 18:26:13 +00:00
Michael Lotz
bea22f6240 * Add overlay filesystem to the boot floppy and normal image.
* When booting from an iso, mount the boot volume with the overlay layer.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29202 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-14 22:51:50 +00:00
Michael Lotz
a413108c54 Make the overlay filesystem a standalone module. It can now be mounted as an
additional layer by supplying "-t <actualFileSystem>:overlay" to a mount command.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29201 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-14 20:57:15 +00:00
Michael Lotz
3c1b330b3b Add volume ops to the overlay filesystem and prepare it to be a standalone module.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29200 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-14 20:32:10 +00:00
Michael Lotz
a26c243920 * Adding volume ops to the overlay filesystem.
* Remove the previous method of applying the overlay by flags. In the future the
  overlay can just be mounted as a filesystem layer. This is probably how layers
  were intended to work in the first place.
* Move the filesystem module info and filesystem name from the fs_mount to the
  fs_volume structure. Filesystem layering is done by having multiple layered
  volumes and we want to be able to have a different fs per layer.
* Adapt VFS code to this move.
* Implement mounting layered filesystems. Specifying multiple filesystems
  separated by a colon on mount will cause the layers to be set up and the
  corresponding filesystems to be mounted at that layer.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29199 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-14 20:30:49 +00:00
Michael Lotz
6e5f12279d Handle the overlay request flag in publish_vnode() as well.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29196 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-14 12:48:44 +00:00
Michael Lotz
a079780e8a * Add the iso9660 filesystem to the floppy image.
* Allow iso9660 partitions to be boot partitions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29193 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-14 00:11:15 +00:00
Michael Lotz
3f31053904 Skip our attribute directory when reading directories.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29191 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-14 00:06:28 +00:00
Michael Lotz
00405f2286 * Add an additional argument to get_vnode() that gets the fs_vnode_ops of the
node. That is needed for a layered filesystem to be able to construct a full
  fs_vnode out of a volume/inode pair.
* Adapt places where get_vnode is used. Sadly this is a C API and we can't just
  use a default NULL for that argument.
* Introduce a flag B_VNODE_WANTS_OVERLAY_SUB_NODE that can be returned in the
  flags field of a fs get_vnode call. A filesystem can use this flag to indicate
  that it doesn't support the full set of fs features (attributes, write support)
  and it'd like to have unsupported calls emulated by an overlay sub node.
* Add a perliminary overlay filesystem that emulates file attributes using files
  on a filesystem where attributes aren't supported. It does currently only
  support reading attributes/attribute directories though. All other calls are
  just passed through to the super filesystem.
* Adjust places where a HAS_FS_CALL() is taken as a guarantee that the operation
  is supported. For the overlay filesystem we may later return a B_UNSUPPORTED,
  so make sure that in that case proper fallback options are taken.
* Make the iso9660 filesystem request overlay sub nodes. This can be fine tuned
  later to only trigger where there are features on a CD that need emulation
  at all.

If you happened to know the attribute file format and location you could build
an iso with read-only attribute support now. Note that this won't be enough to
get a bootable iso-only image as the query and index support is yet missing.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29177 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-09 23:06:31 +00:00
Michael Lotz
bc2836bbaa Allow pressing 'p' to disable paging during boot debug output.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29169 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-08 21:38:30 +00:00
Jérôme Duval
e06359547c activated wfileops.c instead of wfilestubs.c, commented out mmap stuff (as in fileops.c)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29153 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-07 20:05:39 +00:00
François Revol
b36570e51f Do proper unlocking of the KPath when find_directory() fails. This should help with CD boot where find_directory() can't create folders on a read-only media.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29139 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-06 16:48:03 +00:00
Michael Lotz
d9c6f9a92c Remove separate GCC4 versions of add_debug_command()/remove_debug_command() and
add the const in any case. As Axel points out these are C functions and we do
not affect binary compatibility by changing their signature.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29124 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-01 23:32:25 +00:00
Michael Lotz
d0eaec3086 Fix more operator precedence errors. These do not do what you'd expect at first
sight. The comparison operator takes precedence over the binary ones.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29121 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-01 23:24:55 +00:00
Michael Lotz
c33667d400 Fixing warnings under GCC4 in preparation to enable -Werror there as well:
* Replaced the use of offsetof() for structs that aren't PODs. Add a
  offset_of_member() macro to util/khash.h because that's what it's used for
  in our cases.
* Change the signature of add_debugger_command()/remove_debugger_command() on
  GCC > 2 to avoid the depricated conversion from string constants to char *.
* Adding some "suggested" parenthesis. I know that not everyone likes that, but
  it pointed out at least one bug that is fixed here as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29113 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-01 20:48:02 +00:00
Ingo Weinhold
47bc666311 The assumption that the program image is not used for relocation of
dlopen()ed objects was incorrect. This should fix problems with ports of
software with a plugin/add-on interface.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29112 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-01 18:40:42 +00:00
Jérôme Duval
e293302d3d * now init SSE on all CPUs, as I noted cr4 wasn't set correctly
* this fixes the use of SSE instructions here on a dual core.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29051 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-26 22:57:49 +00:00
Michael Lotz
74a366707f When linking against libgcc already don't include these symbols. Otherwise we
get multiple definitions of them when building with GCC4 on a GCC4 host.
With that we can now build completely on a GCC4 host with native GCC 4.3.3.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29020 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-25 21:28:43 +00:00
Jérôme Duval
d5a6891975 * Patch from Olivier Coursiere: restore sFreeHeapSize in case of resize_area failure
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29013 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-25 18:13:49 +00:00
Stefano Ceccherini
6dcca60207 fix the build. Sorry for the trouble
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28999 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-23 21:54:34 +00:00
Stefano Ceccherini
4a7ad412f6 revert r28970, since they cause crashes. Still looking into it
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28997 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-23 14:05:12 +00:00
Stephan Aßmus
708f40e5a9 Fixed GCC version check according to Michael.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28996 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-23 12:36:36 +00:00
Michael Lotz
ddb785a296 Better return B_ERROR when not compiling the actual call in.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28987 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-23 01:30:29 +00:00
Michael Lotz
c9c7eecd8e Comment out problematic inline asm statement for GCC 4. The direct reference
to sAPMBiosEntry generates undefined symbols and I'm not in a condition to fix
this right now. Added a TODO.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28986 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-23 01:24:47 +00:00
Michael Lotz
b668bf21b2 Change function name to work with stricter name lookup in GCC 4.3. See
http://gcc.gnu.org/gcc-4.3/porting_to.html for reference.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28981 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-22 23:10:50 +00:00
Axel Dörfler
78e1849576 * atomic_test_and_set() did actually not test if the lock was lost, and
would therefore not always work correctly.
* Minor cleanup, added return register for completeness.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28977 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-21 11:28:50 +00:00
Stefano Ceccherini
64f6abaa91 Imported some wide char functions from freebsd, adapted to the build, tried to integrate them with the glibc we are using. The mbtest supplied in ticket #2822 seems to work, without regressions. Please shout if there are issues.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28970 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-20 16:09:58 +00:00
François Revol
9b7603b992 This should definitely fix CD booting, it was still looking for the tgz at 192k while zbeos is now almost 300k... Maybe we need something more failproof but it shoudl do for now.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28965 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-20 04:40:57 +00:00
Axel Dörfler
18f27bf19f * Added POSIX function strndup(), closing ticket #3309.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28939 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-18 20:27:12 +00:00
François Revol
b641656c2b Make sure the hack-coff tool is built when needed.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28910 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-15 16:47:53 +00:00
Axel Dörfler
f58d8cf235 * _user_flock() will no longer accept invalid operations, thus fixing bug #3141.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28889 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-12 12:07:06 +00:00
Salvatore Benedetto
b3e849c2ce * Adding libgen.h as a public header
* Implementing dirname and basename

I removed dirname from glibc/misc and reimplemented in order
to (hopefully) keep thing tidy.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28888 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-11 23:38:27 +00:00
Axel Dörfler
fbb7d4cd57 * fs_write() is optional for read-only file systems. This fixes bug #3062 and
also #3083 (although I could not reproduce the latter).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28881 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-11 14:24:38 +00:00
Axel Dörfler
99fe8fb0f6 * "" is not really a good error description.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28879 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-11 14:19:20 +00:00
Axel Dörfler
d5ec380523 * Added siginterrupt() function, this closes ticket #3263.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28854 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-07 19:40:53 +00:00
Axel Dörfler
25b944d41c * Applied patch by Olivier: fixed sending wrong signal to a custom signal
handler. This closes ticket #3265, thanks!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28852 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-07 19:02:25 +00:00
Axel Dörfler
6a90578f76 * Removed a left-over mutex_unlock() that could cause a panic on removing
a busy vnode.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28851 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-06 21:19:09 +00:00
Axel Dörfler
5500d8a54f * All file descriptors that only refer to a mount now keep the mount, ie. they
won't call put_mount() before they are freed. Internally, this causes them
  to grab a reference to the mount's root vnode.
* This fixes bug #3262.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28850 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-06 21:17:47 +00:00
Axel Dörfler
2187c4988a * Not sure how this happened.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28844 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-02 10:42:44 +00:00
Axel Dörfler
74c05b1d3c * Accidently forgot to fix the typo that Adrian pointed out in his patch to
#2919 (OMG :-)).
* While I was at it, I also cleaned up some style inconsistencies.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28842 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-02 09:39:29 +00:00
Axel Dörfler
f9e72b6e5b * Small variation of Adrian's patch to fix bug #2919, ie. re-enable paging
and colors for the on-screen debug output when leaving KDL. Thanks, Adrian!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28841 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-01 22:13:02 +00:00
Salvatore Benedetto
e4263eb78e * Uncommenting POSIX mkdtemp function. Tested.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28840 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-01 21:01:51 +00:00
Axel Dörfler
bf6bf2e36b * get_context() didn't quite do what it was supposed to be doing. Especially,
it was not guaranteed that this function returned a valid context even with
  low memory.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28826 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-12-27 22:12:08 +00:00
Axel Dörfler
3ede860e30 * kernel.so must link agaist kernel_misc.o as well to make all of its symbols
available for modules.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28823 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-12-27 20:37:55 +00:00
Axel Dörfler
311635a1ab * Minor cleanup - thanks, Rene, I just got aware of it.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28789 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-12-09 23:09:58 +00:00
Rene Gollent
5a60521c89 Build fix. Redeclaration of status variable.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28788 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-12-09 22:36:00 +00:00
Axel Dörfler
c0c4841c24 While looking at the code, I found two memory leaks:
* UpdateUserListener() did not delete the copiedListener in case adding the
  monitor listener failed.
* RemoveListener() did never delete UserNodeListeners, IOW user node monitors
  were never freed!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28787 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-12-09 22:23:36 +00:00
François Revol
7613c6c7ca Add a boot menu option to disable using the IO APIC for IRQ handling and fallback to PIC.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28686 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-18 14:40:40 +00:00
François Revol
4eb5ec0805 Fix typo.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28659 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-16 00:24:47 +00:00
François Revol
1c532eedf1 Make the tgz archive offset in floppy image settable. Set it to 270k for now, until zbeos gets some diet.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28657 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-15 03:30:00 +00:00
Axel Dörfler
55ddbd7bca * When a file system reports -1 offsets in its fs_get_file_map() function, this
will now accepted and regarded as sparse file data. FileMap::_Add() also
  correctly joins multiple vecs with that offset together, FileMap::Translate()
  will always report offset -1 even for offsets into that extent.
* read_file_io_vec_pages() (or rather, its backend common_file_io_vec_pages())
  now supports sparse files, and will just clear the memory it should read from
  offset -1 instead of passing a request to the vnode.
* ext2 now correctly reports sparse files. This should close bug #2889, as well
  as #975.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28648 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-14 12:06:44 +00:00
Ingo Weinhold
f8d77bfb1c * The deferred_deleter() kernel daemon dropped out, if the list with
memory to free was empty, but didn't check the list with objects to
  delete. So those were queued until someone used deferred_free().
  Should fix #3128.
* Run the daemon once a second instead of every five seconds, so memory
  is recycled a little quicker.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28644 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-14 01:50:13 +00:00
Oliver Tappe
b898cc3709 solved build dependency puzzle in regex.c:
* removed superfluous #include <config.h> which was protected by an #ifdef
  that evaluated to false - so the file never got included, but jam tried
  to locate it and usually failed, unless there happens to be a config.h
  in the current working directory. 
  This fixes a spurious dependency from regex.c to the config.h in 
  src/libs/iconv.h if you invoked jam from there.
* fixed two warnings by always including stdlib.h

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28639 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-13 16:23:04 +00:00
François Revol
fd19697e68 Make use of hack-coff.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28623 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-12 02:36:03 +00:00
François Revol
f080e026b9 Merge in all .text.Z* sections back to .text...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28619 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-12 00:14:07 +00:00
Axel Dörfler
8f1cb8fca2 * Brought the fs_shell block_cache implementation up to date, and incorporate
the fixes applied to the kernel version of it (most notably a correctly
  working block_cache_discard(), and cache_detach_sub_transaction()).
  Also switched to the new notification functions, even though it still works
  synchronously in the fs_shell.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28617 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-11 22:19:46 +00:00
Axel Dörfler
e6e76e14dd * elf_find_symbol() now checks if the hashtable section is greater than 0.
* Whatever is the cause of #2733, this should at least not make it crash.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28615 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-11 21:24:09 +00:00
François Revol
11a47de374 Support creating a COFF bootloader from the ELF one, at least for ppc.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28611 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-11 19:08:51 +00:00
François Revol
3b148e533f This gets the bootloader further on, but it still breaks... OpenHackware seems worse than Pegasos OF :^)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28587 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-10 02:03:58 +00:00
Axel Dörfler
186c8af1e4 * The large page mapper did not invalidate the TLBs of the other CPUs for the
generic page mapping mechanism. This should fix #2902 (will test in a minute).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28584 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-09 21:49:33 +00:00
Ingo Weinhold
aa22a3cfda dlclose() also set the static error variable.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28579 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-09 18:19:46 +00:00
Ingo Weinhold
df30098d91 unload_library() invoked from dlclose() might not have deleted images
correctly and it returned an error on success.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28578 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-09 18:18:51 +00:00
Ingo Weinhold
0c85bd054e * Reworked undefined symbol resolution in the runtime loader. Got rid of
the per-root-image breadth-first sorted image array. Instead we have a
  per-image hook function to resolve the symbols. The default function
  uses the sLoadedImages list directly, which is breadth-first sorted
  anyway. There's also a BeOS function for old-style symbol resolution
  and one for add-ons, which lacks a proper implementation yet (just
  uses old-style ATM).
* Made the dl*() functions POSIX compliant:
  - dlopen() does no longer use load_add_on(), but loads the object as a
    library. It also properly supports a NULL name, now -- the previous
    "_APP_" work-around did only work, if this soname was set on the
    program (unlikely for programs using this API).
  - Implemented RTLD_{GLOBAL,LOCAL}.
  - dlsym() looks up symbols properly now, i.e. not just in the given
    image, but breadth-first for an actual image or in load order for
    the global scope. It also supports the not-quite POSIX RTLD_DEFAULT
    and RTLD_NEXT extensions. Our RTLD_NEXT finds more symbols than in
    Linux (also in later dlopen()ed libraries), but that should be fine.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28568 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-08 22:40:56 +00:00
Ingo Weinhold
e10b4cace5 Added __arch_get_caller(). Correctly implemented for x86 only.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28567 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-08 22:09:28 +00:00
Axel Dörfler
9a2cfc4ab1 * BaseDevice::InitDevice() and UninitDevice() must not be called with the devfs
lock held - that was a relict of the past.
* This fixes bug #2535.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28551 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-07 13:23:24 +00:00
Axel Dörfler
d4b5a9b14e * The kernel daemon now uses a recursive lock instead of a mutex. This fixes
bug #3082.
* Also, it now allows to remove daemons in their hook function.
* Added a "daemons" KDL command that dumps all registered kernel daemons, and
  resource resizers.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28550 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-07 12:22:05 +00:00
François Revol
da7dce9b35 This seems to fix building libroot on ppc... the *l versions aren't used.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28541 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-06 23:24:41 +00:00
Axel Dörfler
5074333ded * Updating glob() actually broke it, since Haiku does have broken mbrtowc(),
and wcrtomb() functions. I worked around the issue, and added a build
  warning so that we don't forget to change it back once we have working
  versions of those.
* This lets apps like "ftp", and "sftp" work again.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28531 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-06 11:26:01 +00:00
Axel Dörfler
2c1e463c7e * Removed B_{MIN|MAX}_PRIORITY from OS.h - they were never really intended
as public defines. They are now called THREAD_{MIN|MAX}_SET_PRIORITY to
  better reflect what they are for. Minimum priority is now 1, ie. you no
  longer can set another thread to the idle priority. This fixes part of
  ticket #2959.
* set_thread_priority() will no longer allow to change the priority of the
  idle thread to something else. This fixes the rest of ticket #2959.
* Automatic whitespace cleanup in OS.h.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28521 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-05 18:11:58 +00:00
Axel Dörfler
fbc2cd83dc * wait_for_notifications() must make sure that the order of the notifications
in the cache is the same as in the condition variable. It now uses the
  low-contention sCachesLock to accomplish this.
* Also added an ASSERT to make sure the notification is no longer part of the
  list at this point.
* Improved KDL command output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28516 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-05 15:22:58 +00:00
Axel Dörfler
7e621f16d0 * Use parse_expression() for argument parsing.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28515 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-05 14:07:33 +00:00
Axel Dörfler
a26045b7a6 * cache_detach_sub_transaction(), and cache_abort_sub_transaction() now support
discarded blocks correctly as well.
* cache_detach_sub_transaction() left cached_block::original_data unchanged even
  if the parent data was to become current (in case the sub transaction didn't
  change the block yet). This could cause outdated blocks to be written back.
* cache_detach_sub_transaction() also set cached_block::previous_transaction
  for all blocks, not just the ones with a previous transaction. This could
  cause blocks to be written twice for no reason.
* cache_start_sub_transaction() did not change the num_blocks count for
  discarded blocks.
* block_cache_discard() now panics if the block was already changed in the
  current transaction.
* Improved test application, added more tests, revealing the above bugs in
  cache_detach_sub_transaction().
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28514 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-05 13:52:34 +00:00
Axel Dörfler
ddd20af422 * Fixed a potential race condition: when wait_for_notifications() is called
from the block notifier, the cache could be deleted before we have the chance
  to lock it. We now lock the sCachesLock, and see if this cache is still valid.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28512 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-05 11:16:04 +00:00
Axel Dörfler
96e19c19fc * The first functions now handle the "discard" flag correctly (namely
cache_end_transaction(), and cache_start_sub_transaction()).
* Further work on the test application, it's now actually usable, first test
  passes.
* dump_block() did erroneously print 'B' for the dirty flag; now both dirty and
  discard have the 'D' (3rd and 5th column).
* block_cache::LowMemoryHandler() is now private (and got an underscore prefix).
* Minor cleanup, shuffled some methods around.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28508 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-04 22:40:11 +00:00
Axel Dörfler
f69f65ec96 * Cleanup, no functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28497 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-04 15:02:09 +00:00
Axel Dörfler
5b812019b4 * Added function block_cache_discard() that flushes blocks from the block cache,
discarding their changes. This functionality currently only works correctly
  when no transactions are used.
* Started test application for the block cache, doesn't do anything yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28496 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-04 14:49:33 +00:00
Ingo Weinhold
3cbd4a09f7 system() is supposed to return a waitpid() style exit status value.
wait_for_thread() doesn't provide that; use waitpid() instead.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28479 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-03 16:35:09 +00:00
Ingo Weinhold
10b4b5d175 * Added an "add-on" interface for the runtime loader. Pre-loaded images
can export a structure containing callback hooks invoked by the
  runtime loader when certain image events occur (image loaded,
  relocated, initialized, etc.).
* Also added a mechanism to patch image symbols. For an image callback
  functions can be installed that patch symbols exported or imported by
  the image.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28475 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-03 13:27:14 +00:00
Ingo Weinhold
56eb43e3ca * Made kernel_cpp.h usable in the runtime loader.
* Added new(mynothrow) operators which avoid clashes when also linking
  against libgcc.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28474 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-03 13:15:12 +00:00
Axel Dörfler
bfc607d44f * "devfs_node" now also dumps the partition info, if any.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28473 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-03 11:02:02 +00:00
Ingo Weinhold
19d40f9eb7 Moved the rld_export structure from <user_runtime.h> to
<runtime_loader.h>, since it isn't a kernel <-> userland interface.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28456 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-02 03:43:01 +00:00
Ingo Weinhold
ca618b2259 * Changed the way symbols are resolved. For each root image (program,
add-on) we create a breadth-first sorted image list and use that to
  search for symbols.
* Added support for preloading libraries. The environment variable
  LD_PRELOAD can contain a whitespace-separated list of shared objects
  that will be loaded before the program. This allows to replace
  symbols without changing the executable or libraries.
* Resolved TODO in load_program() regarding the order of remapping the
  images and initializing the dependencies (problem fixed in r28453).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28455 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-02 03:16:30 +00:00
Ingo Weinhold
f68fa9d364 Implemented realloc().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28454 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-02 02:59:15 +00:00
Ingo Weinhold
2ef4a8b524 Moved the variable cv_factor from the text to the bss section.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28453 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-02 02:58:38 +00:00
François Revol
9da2356857 Work in progress to pass the image extents to the kernel,
- code is disabled yet as the bootloader doesn't have add_boot_item.. will need to pass via kernel args
- add a GetFileMap() method to the vfs, and implement it in FAT code.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28445 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-01 20:39:14 +00:00
Ingo Weinhold
8d41d0ee72 Spotted by "daste": When unlocking the mutex owner must be set to -1
also for error check mutexes, otherwise the next pthread_mutex_lock()
will fail.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28428 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-01 14:30:09 +00:00
Axel Dörfler
a8cecea091 * As suggested by Gerald, we now ignore the EDID information on VBE2 graphics
chips due to possible timing issues.
* This means you will now get a 1024x768 boot screen on older hardware instead
  of the one of your native resolution. If that always worked great for you,
  and you want to be able to turn on using EDID information again, please yell.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28399 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-31 13:35:09 +00:00
Axel Dörfler
39c7faa460 * vesa_set_mode() now gets another parameter that specifies whether or not
the mode timing should be used.
* Apparently, some VBE3 implementations don't implement the CRTC support, and
  they seem to fail when the SET_MODE_SPECIFY_CRTC bit is set.
* Therefore, we'll first try with timing, and if that fails, we'll try again
  without it. This should bring back the boot screen for all those who had
  problems with it before.
* Added tracing output of the CRTC to be used.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28398 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-31 13:14:07 +00:00
Ingo Weinhold
3a39905b59 Implemented __freading(), __fpurge(), and fpurge().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28397 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-31 13:02:40 +00:00
Axel Dörfler
ebf6c5de78 * 15 and 16 bit KDL consoles now have nice colors, too.
* For 8 bit, the palette is pretty messed up during the boot process
  (thanks to the boot loader image), so that we might want to change
  how the colors are set then.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28393 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-31 10:39:50 +00:00
Axel Dörfler
3a5a677501 * print_demangled_call() now brings some color into your Haiku life (ie. to
the KDL sessions).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28392 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-31 10:22:46 +00:00
Axel Dörfler
d5a9a2d118 * Made the KDL colors a bit more eye friendly in 24/32 bit modes.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28391 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-31 10:17:04 +00:00
Axel Dörfler
b4c8ccc372 * The boot loader now creates a CRTCInfoBlock structure when detailed EDID
mode informations are available.
* This is passed to the graphics card when the mode is set in the hopes that it
  will be more conforming.
* Not yet tested on real hardware, though, therefore the VESA driver doesn't
  do anything like this yet. I will test next, but please report any problems
  with this nonetheless.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28390 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-31 09:52:57 +00:00
Axel Dörfler
97ba3fb358 * Instead of faulting when trying to print an invalid string pointer,
print_demangled_call() will now use user_strlcpy() to copy the string
  first (if that fails, it will printf '???' to show this).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28386 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-30 18:29:49 +00:00
Axel Dörfler
6179ce7957 * Removed the DEBUG_DEBUGGER_COMMANDS define again, and followed Ingo's
suggestion by adding a "faults" command that now sets the
  gInvokeCommandDirectly variable as wished.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28382 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-30 16:29:37 +00:00
Axel Dörfler
9521c5abb6 * If DEBUG_DEBUGGER_COMMANDS is 1, invoke_debugger_command() will no longer
install a fault handler, allowing to debug KDL commands better.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28376 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-30 11:33:15 +00:00
Axel Dörfler
cca9f05114 * debug_demangle_symbol() did not set _isObjectMethod when there was no
demangle module (yet). This could cause a read fault in x86's
  print_demangled_call() (as it assumed there must be a ':' when this is true).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28375 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-30 11:16:01 +00:00
Axel Dörfler
6e036f0479 * Updated glob.h and its implementation to FreeBSD current (1.10, 1.27),
adapted them to work on Haiku.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28355 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-28 14:13:30 +00:00
Ingo Weinhold
f20ccdc461 Fixed some incorrect behavior pointed out in #2990:
* The pthread_mutex_*lock() family should return EDEADLK when re-locking
  an error-checked mutex.
* pthread_mutex_trylock() is supposed to return EBUSY, not
  B_WOULD_BLOCK.
* pthread_mutex_unlock() should return EPERM when the caller is not the
  owner. It used to print a message and try to unlock anyway.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28354 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-28 12:04:51 +00:00