Commit Graph

4147 Commits

Author SHA1 Message Date
Oliver Tappe
6a5dacaa3c part1 of fixing #6599:
* protect against invocations of ctype-macros/-functions with negative
  character indices by mirroring the corresponding values at negative
  array indices (the legal access range of __ctype_b is now [-128..255])


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38708 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-18 15:55:42 +00:00
Oliver Tappe
338ddd836f Closing #6499:
* add missing getsubopt() POSIX-function
* added corresponding test


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38650 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-14 18:43:24 +00:00
Oliver Tappe
86932f41cc Try to fix #6581:
* avoid trying to overwrite values of a constant structure when
  updating the numeric locale data values used by glibc


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38623 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-12 17:24:38 +00:00
Oliver Tappe
ccee6057f0 * fix wrong signedness in values put into global 'timezone' variable,
the POSIX specs are a bit vague on this (to say the least)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38606 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-11 18:34:48 +00:00
Fredrik Holmqvist
01f964efeb Introduce a gSystemShutdown flag to be able to check if system is shutting down. ACPI Embedded Controller now uses polling when it is set to true.
This might help with ACPI shutdown issues, if not this change can be reverted. Not verified as it works on all my machines even without this.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38585 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-08 19:19:49 +00:00
Andreas Färber
3243de5750 boot_loader_openfirmware: Add iSCSI boot support
If no Haiku remote disk server is found, try an iSCSI discovery session on
the TFTP server, using the IP address from the boot command or OF options.
All available IPv4 targets are considered, Target Portal Groups are ignored.

RFC 4173 suggests a mechanism that avoids a discovery session by using DHCP;
that requires a compatibly configured DHCP server though and we wouldn't have
access to such data currently anyway. iSCSI is currently used as fallback,
and when it doesn't succeed it falls back to the menu as before.

Resolves ticket #5319.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38537 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-05 22:56:22 +00:00
Andreas Färber
5b086e27e8 boot_net: Add iSCSI initiator support
Add support for both discovery and regular iSCSI sessions. Command and status
sequence numbers do differentiate between session and connection but only
one connection per session is currently supported.

Code is Big Endian for now, so compile it for ppc only.

Based on RFC 3720 ff. Tested against OpenSolaris 2009.06.

Resolves most of ticket #5319.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38536 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-05 22:30:41 +00:00
Andreas Färber
eb5e456002 boot_net: Various TCP fixes
Don't enqueue a packet whose sequence number matches the first one in queue
or is between the next and the acknowledged on. This would lead to packet
duplication in the queue and leftovers after dequeuing.

Optimize calculation of acknowledgement number for out-of-order reception.
If a single missing packet arrived, this could have resulted in a timeout
depending on the window size.

In case the connection is closed, do dequeue remaining packets. This would
have caused a read error after a unidirectional FIN.

Prepare a dynamic window size calculation.

Do checksum calculation before attempting to trace packet contents. I have
seen a few and couldn't spot an error in the checksum calculation.

More fine-grained control over trace output.
Trace the Maximum Segment Size option if present; break after End of Options.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38535 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-05 21:02:38 +00:00
Fredrik Holmqvist
b0c5015140 If source_index is != 0 it is hardwired to a GSI (Global System Interrupt).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38532 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-05 08:20:47 +00:00
Andreas Färber
040b33980c boot_net: Prepare socket-specific TCP window size
Pass the desired window size from the socket to the service.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38530 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-04 22:36:35 +00:00
Andreas Färber
7d415c01cc boot_net: TCP and UDP style cleanup
Remove superfluous comments.
Adjust spacing and initializer indentation.
Make NULL pointer checks explicit.
Don't assign in if-clause.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38529 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-04 22:14:20 +00:00
Fredrik Holmqvist
688768804f The flag returns true if io_apic is disabled. Use the proper check so that it can be toggled while booting. (io_apic is not working though so no need to try unless you are interested in development).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38525 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-03 21:45:41 +00:00
Andreas Färber
3bc0fcc66e boot_net: Fix TCP memory leaks
In some error conditions the packet would have been leaked.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38503 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-01 18:19:57 +00:00
Andreas Färber
1f4a2bd985 boot_net: Disable TCP for all archs but ppc
Unbreaks the build until a better solution is found.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38485 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-31 22:57:33 +00:00
Andreas Färber
6c2e0f4377 boot_net: Mute some TCP debug output
Trace packet dequeing only when asked to.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38483 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-31 20:32:50 +00:00
Andreas Färber
6dfef7e9b2 boot_net: Use real_time_clock_usecs() for TCP
Initialize the PRNG seed for the sequence number with real_time_clock_usecs()
rather than system_time(). The remaining uses of system_time() for timeout
calculation match UDP.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38482 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-31 18:51:57 +00:00
Andreas Färber
58b1d4608a boot_loader_openfirmware: Implement real_time_clock_usecs()
Partially revert r38465 and move the code from system_time() into a new
real_time_clock_usecs() function. The system_time() implementation was correct
in relying on of_milliseconds(), as pointed out by Axel. Add the correct
function for the desired functionality.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38481 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-31 18:42:57 +00:00
Andreas Färber
a9e71a07a9 boot_loader_openfirmware: Style cleanup
Fix coding style issues and bump copyright (although there's not much anyway).

No functional changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38480 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-31 17:39:06 +00:00
Andreas Färber
b7e825d6e7 boot_net: Add TCP support
Modelled after UDP, add limited TCP support to the boot net stack. The socket
works by queuing received packets as well as sent packets that have not yet
been ACK'ed. Some known issues are documented, especially there's only limited
congestion control. I.e., we send immediately and in unlimited quantity, thus
its use should be restricted to local networks, and due to a fixed window size
there is potential for our socket being overrun with data packets before they
are read. Some corner cases like wrapping sequence numbers may cause a timeout.

The TCP implementation is based on Andrew S. Tanenbaum's "Computer Networks",
4th ed., as well as lecture notes from Prof. W. Effelsberg, the relevant RFCs
and Wikipedia. The pseudo-random number Galois LFSR used for the sequence
number was suggested by Endre Varga.

Since the code is unlikely to get much smaller, better merge it now so that
subsequent changes get easier to review. No platform actively uses TCP sockets
yet, and the receiving code has been reviewed for endianness issues and should
terminate okay after verifying the checksum if no sockets are open.
Based on a version tested with custom code (#5240) as well as with iSCSI.
Compile-tested boot_loader_openfirmware, pxehaiku-loader with gcc4 and
haiku_loader with gcc2. Closes ticket #5240.

Changes from #5240 proposed patch:
* Various bug fixes related to queuing, some memory leaks fixed.
* Never bump the sequence number when dequeuing a packet. It's done afterwards.
* Don't bump the sequence number again when resending the queue or ACK'ing.
* Aggressively ACK while waiting for packets.
* Don't queue sent ACK-only packets.
* More trace output, esp. for queue inspection.
* Adapted use of TCP header flags to r38434.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38472 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-31 01:00:06 +00:00
Andreas Färber
56f837e265 boot_loader_openfirmware: Fix system_time()
system_time() was based on of_milliseconds(), which returns the number of
milliseconds since power-on. This would produce very similar or identical
results for subsequent boots due to limited clock resolution; therefore it
was unsuited as PRNG seed, e.g., for TCP ports.

Try to inquire the RTC device node with get-time to return an improved time
value, if possible.

Closes ticket #6061.

Changes from proposed patch:
* Obtain the RTC handle once and reuse it for each inquiry.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38465 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-30 21:13:10 +00:00
Axel Dörfler
506894b6a8 * Return an error on initialization error. This fixes CID 1566.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38461 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-30 20:21:06 +00:00
Axel Dörfler
73b1cb8240 * The IOCache always needs a DMAResource; it was sometimes checked, and
sometimes not.
* This fixes CIDs 1755-1756, and 1505-1506.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38460 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-30 20:06:52 +00:00
Axel Dörfler
9910e4f1bf * The parent of an IOOperation cannot be NULL for completed operations.
* This fixes CID 1507.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38458 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-30 19:41:08 +00:00
Axel Dörfler
31d8c43d1c * Fixed CID 1262: waitForLock was not only -1 when exiting the loop, it didn't
make much sense to wake up any waiters either in this case.
* Fixed doubled semaphore deletion.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38418 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-28 15:17:23 +00:00
Axel Dörfler
46af4e7787 * Fixed CID 566 that was duplicated in blue_screen.cpp as well (but was not
discovered by Coverity for some reason): commands without arguments would
  overwrite memory (in this case the sConsole::arg_count only, though).
* Travis's copyright was missing in blue_screen.cpp.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38409 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-27 21:36:07 +00:00
Axel Dörfler
00400fd683 * Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38389 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-27 10:48:31 +00:00
Axel Dörfler
1e0617da2e * dladdr() apparently should work on any symbol, not just functions. This
closes bug #6491.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38373 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-26 13:49:14 +00:00
Andreas Färber
884432c2da boot_loader_openfirmware: Fix style issues
Adjust initializers.
Respect 80-column limit and adjust copyright notice.
Reorder some header groups. Enforce line spacing.

No functional changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38343 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-24 20:03:26 +00:00
Andreas Färber
f5aaa387bd boot_loader_openfirmware: Fetch EDID
Read the EDID from OF and pass it on to the kernel.

Last part of ticket #6105.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38307 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-22 02:38:55 +00:00
Andreas Färber
36ee6a8731 boot_loader_openfirmware: Add frame buffer support
Use the OF "screen" device alias to query frame buffer properties. Postpone
the opening of the device as far as possible as it erases the screen output.
Initialize the kernel arguments and hook into generic code to display the
splash screen.

Like on x86, the frame buffer is enabled by default. To disable it, either
press ESC during early boot or, for debugging, make sure in start.cpp that
platform_boot_options() has the BOOT_OPTION_DEBUG_OUTPUT flag set.

Resolves ticket #6105.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38306 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-22 01:56:40 +00:00
Andreas Färber
e633c3c15b kernel_ppc: Disable fake serial output for frame buffer
Avoid writing to stdout if the frame buffer is enabled.

Part of ticket #6105.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38305 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-22 00:57:20 +00:00
Andreas Färber
3c1cb3fd02 boot_loader_openfirmware: Enable boot options by keyboard
Introduce a non-blocking function for checking keyboard input, and refactor
existing code to share the escape key translations. The comment that key-up and
key-down result in a zero char is confirmed to apply.

If the space bar is pressed, enter the boot menu. If the escape key is pressed,
disable the frame buffer and keep showing the usual debug output. Apparently
the key press must come after console/keyboard initialization but before the
"Welcome to the Haiku bootloader!" line.

Closes ticket #6140.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38304 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-22 00:06:32 +00:00
Andreas Färber
4142bceb25 boot_loader_openfirmware: Refactor Jamfile
The frame buffer will need more generic sources than just the text menu.
Adapted from bios_ia32 platform.

Part of ticket #6105.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38301 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-21 19:52:46 +00:00
Andreas Färber
4d95518e60 boot_loader_openfirmware: Avoid console interference with frame buffer
Debug output calls OpenFirmware methods writing text into the frame buffer.
Depending on the screen mode this leads to garbled display or parts of the
screen overwritten, so mute the output during frame buffer use for now.

A better solution would be to redirect the output elsewhere (e.g., #6168),
so that ConsoleHandle::WriteAt() is not called for the problematic handle
in the first place. That does not work inside the kernel yet.

Part of ticket #6105.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38300 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-21 18:42:25 +00:00
Andreas Färber
0dfe97ade1 boot_loader_openfirmware: Preparations for frame buffer
Initialize the frame buffer as not enabled. Add checks for this condition
and for the debug boot option to the video functions.

Code is adapted from bios_ia32 platform. Part of ticket #6105.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38299 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-21 17:42:28 +00:00
Andreas Färber
3f0a83281f boot_loader_openfirmware: Coding style fixes
Rearrange copyright notice, reorder #includes.

No functional changes yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38298 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-21 17:01:18 +00:00
Andreas Färber
ff46905b11 kernel_ppc: Remove unused commented-out variable
This is a leftover from the r25913 build fix. It used to be an out parameter.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38294 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-21 12:50:17 +00:00
Andreas Färber
edaaaae8cd ppc: Implement arch_vm_translation_map_is_kernel_page_accessible()
This remedies "Current thread pointer [...] is an address we can't read from."
on entering KDL. Closes ticket #6163.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38293 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-21 02:12:25 +00:00
Andreas Färber
f290297bb6 ppc: Support other memory types
Let setting the memory type to B_MTR_UC succeed.

Add initial support for those memory types in the translation map,
pointed out by Ingo in ticket #5193.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38292 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-21 00:36:09 +00:00
Andreas Färber
31bce16715 ppc: Keep memory mappings set up by OpenFirmware
Revert r36886 and fix compilation of insert_virtual_range_to_keep().
The use of void* vs. addr_t matches the surrounding boot loader code
but should probably be revised in favour of addr_t.

create_area() in the kernel wrongly assumed a RAM-backed address range,
which was destined to fail since ranges below the kernel address space
were ignored anyway. Use vm_map_physical_memory() instead.

This fixes a hang once the frame buffer and other resources used by OF
get unmapped. Closes ticket #5193 again.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38291 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-20 22:22:38 +00:00
Fredrik Holmqvist
59ada82f26 First version of reading IRQ's that returns proper results.
There are TODO's in here, because the ACPI module needs restructuring and which I will take care of.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38289 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-20 19:48:49 +00:00
Fredrik Holmqvist
6555d1e061 Mismatch with ACPI definition.
(Refactoring ACPI never looked so good...)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38283 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-19 20:10:52 +00:00
Axel Dörfler
4af303359b * We need to reset the blockNumber, or else we'll discard the wrong blocks
which has rather desastrous consequences - thanks to Stippi for the heads
  up :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38242 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-18 16:44:51 +00:00
Axel Dörfler
c141a31f83 * Fixed CID 1447 which was an actual bug which completely voided the whole
discard mechanism eventually causing the conflicts between the file cache
  and the block cache it intended to fix.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38232 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-18 12:23:38 +00:00
Axel Dörfler
7ac6de66a4 * Removed a few superfluous "else" keywords.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38231 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-18 11:58:27 +00:00
Axel Dörfler
3e86abbd71 * Added an extra check as requested by CID 1567, but also added a comment why
this (and other checks) should not be necessary in the first place.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38229 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-18 11:39:39 +00:00
Axel Dörfler
d74f5f5bb5 * Cleaned up the code which also closes CID 176 which was not a bug, though.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38228 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-18 11:26:23 +00:00
Axel Dörfler
adc92cdef7 * Fixed CID 1750: the team args could be leaked in exec_team() on error.
* Also fixed a leak of the same object in team_create_thread_start() I spotted
  while looking into it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38227 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-18 11:07:20 +00:00
Axel Dörfler
9189743037 * Style cleanup.
* Made an enum out of the mailbox type.
* Rearranged some code to get rid of CID 1328 which was not a bug, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38209 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-17 19:07:16 +00:00
Axel Dörfler
87de0cb4e1 * Fixed CID 1199-1202: only call the cache listener in case the open succeeded
(this might also have derefenced a potentially freed vnode).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38196 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-17 16:15:45 +00:00