Commit Graph

5459 Commits

Author SHA1 Message Date
Pawel Dziepak
ffbf0328d2 debug: update debug kit to correctly recognize commpage 2013-04-04 15:27:23 +02:00
Pawel Dziepak
e85e399fd7 commpage: randomize position of commpage
This patch introduces randomization of commpage position. From now on commpage
table contains offsets from begining to of the commpage to the particular
commpage entry. Similary addresses of symbols in ELF memory image "commpage"
are just offsets from the begining of the commpage.

This patch also updates KDL so that commpage entries are recognized and shown
correctly in stack trace. An update of Debugger is yet to be done.
2013-04-04 15:27:22 +02:00
Pawel Dziepak
966f207668 x86: enable data execution prevention
Set execute disable bit for any page that belongs to area with neither
B_EXECUTE_AREA nor B_KERNEL_EXECUTE_AREA set.

In order to take advanage of NX bit in 32 bit protected mode PAE must be
enabled. Thus, from now on it is also enabled when the CPU supports NX bit.

vm_page_fault() takes additional argument which indicates whether page fault
was caused by an illegal instruction fetch.
2013-04-04 15:22:23 +02:00
Pawel Dziepak
211f71325a x86: move x86_userspace_thread_exit() from user stack to commpage
x86_userspace_thread_exit() is a stub originally placed at the bottom of
each thread user stack that ensures any thread invokes exit_thread() upon
returning from its main higher level function.

Putting anything that is expected to be executed on a stack causes problems
when implementing data execution prevention. Code of x86_userspace_thread_exit()
is now moved to commpage which seems to be much more appropriate place for it.
2013-04-04 15:16:27 +02:00
Pawel Dziepak
537d84a07c libroot: randomize position of areas created by mmap()
When mmap() is invoked without specifying address hint B_RANDOMIZED_ANY_ADDRESS
is used.
Otherwise, unless MAP_FIXED flag is set (which requires mmap() to return an area
positioned exactly at given address), B_RANDOMIZED_BASE_ADDRESS is used.
2013-04-04 15:16:26 +02:00
Pawel Dziepak
02cceebe40 team: randomize position of team user data
When forking a process team user data area is not cloned but a new one is
created instead. However, the new one has to be at exactly the same address
parent's team user data area is. When process is exec then team user data
area may be recreated at random position.

This patch also make sure that instances of struct user_thread in team user
data are each in separate cache line in order to prevent false sharing since
these data are very likely to be accessed simultaneously from threads executing
on different CPUs. This change however reduces the number of threads process
can create. It is fixed by reserving 512kB of address space in case team user
data area needs to grow.
2013-04-04 15:16:25 +02:00
Pawel Dziepak
0cf91fc14f runtime_loader: randomize position of relocatable images
Use B_RANDOMIZED_BASE for creating areas for relocatable segments.
2013-04-04 15:16:24 +02:00
Pawel Dziepak
31eb9b8261 malloc: randomize heap position
Use B_RANDOMIZE_BASE_ADDRESS for initial heap creation as well as for resizing
it when keeping it contignuous is no longer possible.
2013-04-04 15:16:23 +02:00
Pawel Dziepak
17c189899a thread: randomize user stack position
Use B_RANDOMIZE_BASE_ADDRESS for creating both main and other threads user
stack.
2013-04-04 15:16:22 +02:00
Pawel Dziepak
b3e4c67739 vm: implement B_RANDOMIZED_ANY_ADDRESS address specification
Randomized equivalent of B_ANY_ADDRESS. When a free space is found (as in
B_ANY_ADDRESS) the base adress is then randomized using _RandomizeAddress
pretty much like it is done in B_RANDOMIZED_BASE_ADDRESS.
2013-04-04 15:16:21 +02:00
Pawel Dziepak
f9bab525f6 vm: implement B_RANDOMIZED_BASE_ADDRESS address specification
B_RAND_BASE_ADDRESS is basically B_BASE_ADDRESS with non-deterministic created
area's base address.

Initial start address is randomized and then the algorithm looks for a large
enough free space in the interval [randomized start, end]. If it fails then
the search is repeated in the interval [original start, randomized start]. In
case it also fails the algorithm falls back to B_ANY_ADDRESS
(B_RANDOMIZED_ANY_ADDRESS when it is implemented) just like B_BASE_ADDRESS does.

Randomization range is limited by kMaxRandomize and kMaxInitialRandomize.
2013-04-04 15:16:21 +02:00
Pawel Dziepak
3b4269ecf5 arch: randomize initial user stack pointer
Inside the page randomization of initial user stack pointer is not only a part
of ASLR implementation but also a performance improvement that helps
eliminating aligned 64 kB data access.

Minimal user stack size is increased to 8 kB in order to ensure that regardless
of initial stack pointer value there is still enough space on stack.
2013-04-04 15:16:20 +02:00
François Revol
d4eea7d43c Merge branch 'master' into sam460ex 2013-03-28 09:47:50 +01:00
Alex Smith
e6a0c79790 CID 608055: Fixed unintended sign extension. 2013-03-22 19:41:57 +00:00
Alex Smith
5e0c3db286 Account for the physical map area in the kernel VM space. Fixes #9547.
The physical memory map area was not included in the kernel virtual
address space range (it was below KERNEL_BASE). This caused problems
if an I/O operation took place on physical memory mapped there (the
bad address error seen in #9547 was occurring in lock_memory_etc()).
Changed KERNEL_BASE and KERNEL_SIZE to cover the area and add a null
area that covers all of it. Also changed X86VMTranslationMap64Bit to
handle large pages in Query(), as the physical map area uses large
pages.
2013-03-22 18:30:01 +00:00
Alex Smith
8627383bf7 Fixed compilation errors with ENABLE_TRACING set. 2013-03-22 16:46:09 +00:00
Alex Smith
1aef6664d1 Fixed compilation of VFS/IORequest trace messages. 2013-03-22 14:14:33 +00:00
Fredrik Holmqvist
39a81e5ac6 The optimised aligned version was broken and not used.
As pointed out by Hamish the alignment used && in second case
instead of &, which meant it was never used.

Another error when a32 was 0xFF000000 and b32 was 0xFF00FFFF
would return a non zero value. A simple fix for the issues
with going over to the byte by byte comparison failed, so
rather than leave broken code I remove this for the time being.

Not the best code I've written obviously.
2013-03-15 11:49:13 +01:00
Pawel Dziepak
1a0386d743 Fix #8661: fcntl(fd, F_GETLK, ...) violates POSIX
The standard states that F_GETLK should check whether given lock would be
blocked by another one and return description of the conflicting one (or
set l_type to F_UNLCK if there is no collision).

Current implementation of F_GETLK performs completely different actions, it
"Retrieves the first lock that has been set by the current team". Moreover,
if there are no locks (advisory_locking == NULL) an error is returned
instead of l_type set to F_UNLCK.
2013-03-12 17:35:54 +01:00
François Revol
8b72ce2651 Merge branch 'master' into sam460ex 2013-03-12 03:24:15 +01:00
Pawel Dziepak
7f61e6e4e5 Merge branch 'nfs4'
Conflicts:
	build/jam/HaikuImage
2013-03-11 13:00:55 +01:00
François Revol
af63ede7a1 U-Boot: PPC: Implement Book-E MMU support in bootloader
Unlike Classic PPC, Book-E CPUs do not have hardware page-table walk,
rather only a limited set of software-managed TLBs. Also, translation
is never disabled even when page-faulting.

The Linux Book-E port pins part of the RAM in one or more TLBs, and
allocates kernel memory from it for the kernel itself and exception
vectors, as well as page tables.
cf. http://kernel.org/doc/ols/2003/ols2003-pages-340-350.pdf

We take a similar approach, but instead of using a tree-like page
directory we reserve a large part of this mapped range for an
hashed page table similar to the Classic one, to later allow
factoring code out. The kernel and boot modules will also be
allocated there, and the rest should be used as SLAB areas.

Note doing so will not allow implementing proper permissions for
the areas allocated there since they are all handled by a single TLB.

Also note Book-E does not standardize the MMU implementation itself.
For now only AMCC440 type MMU is supported. This will need to be
cleaned up later on.
2013-03-09 03:33:12 +01:00
François Revol
6e809753b1 U-Boot: PPC: Include asm macros header
Use the macros from the header instead of hardcoding.
Add FUNCTION_END() call to help gdb.
2013-03-09 03:22:41 +01:00
François Revol
2441f3ed90 PPC: add debug sections to the linked kernel
Seems to be needed for gdb.
2013-02-23 18:25:36 +01:00
François Revol
c3052f0795 Merge branch 'master' into sam460ex 2013-02-22 16:58:43 +01:00
François Revol
32bd2dedd9 bootloader: Fix an overlooked condition in mmu_allocate()
The size variable at this point is actually a page count.
The test should never be true anyway though. Maybe we should use a
pages variable for clarity?
2013-02-21 16:35:37 +01:00
François Revol
55e7521e36 ARM: Fix typo 2013-02-18 15:00:35 +01:00
François Revol
85e1bac215 U-Boot: Fix warning 2013-02-18 03:39:09 +01:00
François Revol
0255210b04 U-Boot: PPC: properly enumerate CPUs
* Code comes almost verbatim from OF platform.
* Only bus frequency needs to be read from the /plb node instead.
2013-02-18 02:47:34 +01:00
François Revol
4c50a9bcfd U-Boot: move of_init() call before cpu_init()
So we can use the OF wrapper there as well and copy code verbatim from
the OF platform.
2013-02-18 02:42:03 +01:00
François Revol
05e65058fe U-Boot: cleanup 2013-02-18 02:41:16 +01:00
François Revol
aa9d092029 U-Boot: implement of_get_next_device() in the OF wrapper 2013-02-18 02:40:16 +01:00
François Revol
acc4e245de U-Boot: Typo 2013-02-18 00:58:16 +01:00
François Revol
219f59da1f U-Boot: bail out in of_init() if no FDT passed 2013-02-18 00:52:31 +01:00
François Revol
307c6177df U-Boot: cleanup OpenFirmware wrapper tracing 2013-02-18 00:47:22 +01:00
François Revol
5bdc10121b U-Boot: use FDT call directly in of_init() in OF wrapper
This avoids calling dprintf() and allows calling it earlier.
2013-02-18 00:42:10 +01:00
François Revol
f4b31e85b5 U-Boot: PPC: Spice up CPU detection, trying both PVR and FDT
* Read the PVR register to determine the CPU type.
* Also check the FDT /cpu/cpu@0 node for model string
  (we use the FDT calls directly since the OF wrapper isn't initialized yet).
* Use this to enable the FPU APU hack for 440 (instead of #ifdef).
2013-02-18 00:22:56 +01:00
François Revol
34a12c7678 Merge branch 'master' into sam460ex 2013-02-03 00:39:40 +01:00
Axel Dörfler
ab31389341 Implemented write support, reorganized source files.
* Moved some functionality into their own files so that they can easily
  be reused by other code.
* Added crc32() function from FreeBSD. Implemented CRC handling and
  validation.
* Implemented missing write functionality.
2013-01-26 01:30:23 +01:00
Axel Dörfler
61ba12594b Renamed partitioning system "efi" directory to "gpt". 2013-01-23 23:21:25 +01:00
François Revol
287040333d Merge branch 'master' into sam460ex 2013-01-20 23:57:00 +01:00
Przemysław Buczkowski
89b48debc2 Correct errno return in link() function (bug #8770)
* edited as pointed by Axel
2013-01-18 20:00:26 +01:00
François Revol
7daaf25d9c Merge branch 'master' into sam460ex 2013-01-15 07:09:10 +01:00
Landon Fuller
4b5a13ab81 Add Haiku support.
This replaces the use of a few BSD-specific functions, as well
as the direct references to _open/_close et-al.

BFS doesn't support the FTS_NOSTAT directory link count optimization,
and no statfs() function is available, so we simply turn that off.
2013-01-11 00:26:48 +01:00
Landon Fuller
7de6d45ca2 Drop in unmodified fts/ftw implementations from FreeBSD HEAD (r245067). 2013-01-11 00:26:47 +01:00
François Revol
ef7bb168f7 U-Boot: fix warnings 2013-01-02 02:07:06 +01:00
François Revol
28d1701896 Merge branch 'master' into sam460ex 2012-12-29 11:55:24 +01:00
Hamish Morrison
d1f280c805 Add support for pthread_attr_get/setguardsize()
* Added the aforementioned functions.
* create_area_etc() now takes a guard size parameter.
* The thread_info::stack_base/end range now refers to the usable range
  only.
2012-12-28 18:02:58 +00:00
François Revol
98191ec624 Merge branch 'master' into sam460ex 2012-12-19 15:44:14 +01:00
Sergei Reznikov
b7b5d7636b 64-bit fixes for kernel with KDEBUG_LEVEL = 0
Signed-off-by: Alex Smith <alex@alex-smith.me.uk>
2012-12-18 14:56:16 +00:00
François Revol
cbabdc1731 Merge branch 'master' into sam460ex 2012-12-15 02:11:36 +01:00
Jérôme Duval
f1a3e05d8c style fix as suggested by axeld and jscipione. 2012-12-11 23:21:45 +01:00
Sam Toyer
3cdae65125 sem_timedwait: fix errno, return value and NULL behaviour
* Takes into account remarks from Ingo.

Signed-off-by: Jerome Duval <jerome.duval@gmail.com>
Signed-off-by: Ingo Weinhold <ingo_weinhold@gmx.de>
2012-12-11 19:23:17 +01:00
Matt Madia
5644d283b6 Manually applied: Fix typos: super block -> superblock (#8974)
by: Przemysław Buczkowski <przemub@yahoo.pl>
2012-12-09 08:51:58 -05:00
Przemysław Buczkowski
46cf7a5a73 Fix typos: super block -> superblock (#8974)
Signed-off-by: Przemysław Buczkowski <przemub@yahoo.pl>
Signed-off-by: Matt Madia <mattmadia@gmail.com>
2012-12-09 08:47:46 -05:00
François Revol
97b9539c65 Merge branch 'master' into sam460ex 2012-12-06 00:12:40 +01:00
Michael Lotz
760de9b200 Tiny code style cleanup. 2012-12-04 23:38:11 +01:00
Michael Lotz
85db228177 Style cleanup only. 2012-12-04 23:38:10 +01:00
Michael Lotz
1ed5f66cd4 Add missing function end macro. 2012-12-04 23:38:09 +01:00
Michael Lotz
2b5d52a174 Whitespace cleanup only. 2012-12-04 23:38:09 +01:00
Michael Lotz
f0422c6f9f Only set the physical address if the entry is mapped.
Otherwise, even when the address was 0, we would possibly set the
physical address to != 0 as we always applied the page offset.
2012-12-04 23:38:08 +01:00
Michael Lotz
926d1024d0 Fix wrong address mask (page directory vs. page table). 2012-12-04 23:38:07 +01:00
Michael Lotz
fd6e3a11e2 Use the existing ARM MMU definitions and remove duplicates. 2012-12-04 23:38:06 +01:00
Michael Lotz
7c45cf7155 Remove tracking of sMaxVirtualAddress as it's not used.
The value computed isn't actually used anywhere. It just ensured that
a panic would be triggered if we "skipped" to virtual addresses further
along. This shouldn't be problematic however.
2012-12-04 23:38:06 +01:00
Michael Lotz
83f7c22537 Reuse get_or_create_page_table() and remove similar add_page().
The former also does the initialization, simplifying the code and
reducing redundancy with the page directory init path.
2012-12-04 23:38:05 +01:00
Michael Lotz
a438da7c8b Clear the page tables on creation, use macros for counts.
This makes it less likely that uninitialized entries cause troubles.
Also panic if we encounter an unknown entry type instead of defaulting
to 4K pages.
2012-12-04 23:38:04 +01:00
Michael Lotz
89564c0a10 Simplify the page directory init loops.
Also check and possibly reuse an existing page directory entry. This
makes the possible memory maps a little more flexible.
2012-12-04 23:38:04 +01:00
Michael Lotz
50c463f4f1 Header cleanup, rename macros for more consistency. 2012-12-04 23:38:03 +01:00
Michael Lotz
3d4175bfe1 Map the page directory before turning on the MMU.
And actually use the virtual address for it later on. This wasn't
problematic as the virtual and physical addresses are identity mapped,
but it seems more correct to do it in this order.
2012-12-04 23:37:18 +01:00
Michael Lotz
0deac574bd Simplify, don't do the calculation twice. 2012-12-04 23:36:09 +01:00
Michael Lotz
05893479e3 Style cleanup only. 2012-12-04 23:36:09 +01:00
Michael Lotz
eca34ad168 Print page and cache using initial commands in panic message. 2012-12-04 23:36:09 +01:00
Michael Lotz
d50875de46 Use format macros in debug output. 2012-12-04 23:36:08 +01:00
Michael Lotz
333883485c Rephrase the debug output, it is not that early anymore. 2012-12-04 23:36:08 +01:00
Michael Lotz
2dcc1cfeb9 Remove test pattern that is no longer needed. 2012-12-04 23:36:08 +01:00
Michael Lotz
67d9fcc3ba Whitespace cleanup, no functional change. 2012-12-04 23:35:40 +01:00
François Revol
c9bb94092f U-Boot: cleanup
Remove commented asm code. We should use the U-Boot API later on.
2012-12-01 23:56:05 +01:00
François Revol
218af294af arm: Move spin() stub to the raspberry_pi cpu.cpp
This unbreaks the U-Boot build, since we already have spin()
in cpu.cpp there, for future implementation using the U-Boot API.
2012-12-01 23:56:05 +01:00
Rene Gollent
86f0f139a9 Fix kernel build with KDEBUG_LEVEL 0. 2012-11-30 18:23:15 -05:00
Michael Lotz
fed8bb7dff Fix index range for ARM MMU coarse page tables.
As there are only 8 bits for the index in the coarse page table entries
the maximum index is 256. This makes us correctly move to the next page
directory once we've run through all entries. Fixes missing unmap of
pages that crossed that boundary and consequent panic "page still has
mappings" when the page was removed from a cache.
2012-11-30 22:09:07 +01:00
François Revol
c435277d49 Merge branch 'master' into sam460ex 2012-11-29 16:06:28 +01:00
Michael Lotz
c5dbfbe5fc Remove early video init, don't need the debug output anymore. 2012-11-28 02:30:56 +01:00
Michael Lotz
32064fee1b Copy platform_start_kernel from uboot as well.
The kernel now starts on the rPi.
2012-11-28 02:30:56 +01:00
Michael Lotz
d95ecd7341 Remove empty devices implementation and use the one from uboot.
Since we have the same setup with a loaded and mapped boot archive, we
can reuse the MemoryDevice implemented in uboot. This gets the loader
to the stage where it loads and attempts to boot the kernel.
2012-11-28 02:30:37 +01:00
Michael Lotz
046e01014d Add boot archive base and size and map the boot archive.
An archive (ramfs) to be loaded can be specified in the raspberry pi
config.txt with a certain base address. We can use this to put our
floppy boot archive into memory on startup.

During the start procedure we now map that archive so we can later
load the kernel from it.
2012-11-28 02:00:00 +01:00
Michael Lotz
05e2d61a5e Fill the kernel args framebuffer config. 2012-11-28 01:41:05 +01:00
Michael Lotz
3c3b8858a1 Move framebuffer init past mmu_init and map the framebuffer.
Add more fields to arch framebuffer to hold the physical address and
size of the framebuffer. Then fill these in when mapping the
framebuffer to virtual memory.
2012-11-28 01:38:38 +01:00
Michael Lotz
87cedaf493 Fix more format strings for MMU trace output. 2012-11-28 01:35:42 +01:00
Michael Lotz
ebd0697853 Enable the early framebuffer and on-screen debug output. 2012-11-27 22:42:33 +01:00
Michael Lotz
18b04bdde1 Also hand debug output to the on-screen debug output. 2012-11-27 22:42:33 +01:00
Michael Lotz
75b481f2a4 Attach frame_buffer_console and initialize/enter blue_screen.
This enables early on-screen debug output on the raspberry pi.
2012-11-27 22:42:32 +01:00
Michael Lotz
94b364b469 Add blue_screen and frame_buffer_console into the bootloader.
These can be used for on-screen debug output with relatively little
effort, as they just need a plain framebuffer definition to work.

Some stubs are added to not clutter up the kernel sources with too
many ifdefs.
2012-11-27 22:41:47 +01:00
Michael Lotz
054ec8a776 Fix warnings by using format macros in debug output. 2012-11-27 20:58:32 +01:00
Michael Lotz
fc1ca8cb5a Initialize the BCM2708 arch framebuffer in platform_init_video. 2012-11-27 20:58:32 +01:00
Michael Lotz
8b9562633f Add BCM2708 arch framebuffer implementation for rPi.
It uses the mailbox mechanism to instruct the VideoCore to configure
the desired video mode and fills it with a black and white test
pattern.
2012-11-27 20:58:32 +01:00
Michael Lotz
57e6aff3f7 Add debug helpers that communicate information via the LED.
Blink patterns and delay mechanisms allow for "easier" debugging using
just the onboard LED on the raspberry pi.
2012-11-27 20:58:31 +01:00
Michael Lotz
0d92f5576d Allow getting and setting arch framebuffer config.
Making the fields protected allows them to be set by arch framebuffer
implementations. The getters can be used to retrieve the configuration
from outside the implementation.
2012-11-27 20:58:31 +01:00
Michael Lotz
a961b0f2ed Turn on unaligned memory access on raspberry pi. 2012-11-27 20:58:31 +01:00
Michael Lotz
4818400fcf Add BCM2708 mailbox definitions and implementation.
The mailbox is used to communicate with the VideoCore on the rPi for
various tasks. First it will be used to configure the framebuffer.
2012-11-27 20:58:30 +01:00
Michael Lotz
5db97b2668 Add memory barrier functions to the ARM bootloader. 2012-11-27 20:58:30 +01:00
Michael Lotz
0f434c4a95 Initialize the stack pointer to allow rPi to jump into C.
The stack pointer is set up so that it uses the space below our .text
section at 0x8000. The stack pointer actually points at one entry less
than the specified address, so it starts at 0x8000 - sizeof(uint32) and
grows downwards from there.
2012-11-27 20:58:30 +01:00
Michael Lotz
dc333d7460 Remove conflicting _start prototype to fix raspberry pi build. 2012-11-27 20:58:29 +01:00
Alexander von Gluck IV
7018b3c67e Rpi: Convert start.c to cpp
* Wrap _start in extern "C" to prevent
  symbol mangling.
* Thanks mmlr for reminding me of this! :)
2012-11-24 08:11:26 -06:00
Alexander von Gluck IV
bbe04a83e0 Rpi: Fix build of Raspberry Pi.
* Raspberry Pi is broken now after
  the other recent arm work... needs
  more investigation.
* Comment out stage2 header as it
  links to headers with c++ code.
  Need to verify entry.s can call
  c++ code (I think it's mangled to
  the assembly or something)
* Fix naming of code entry to match
  other arm code.
2012-11-24 07:49:04 -06:00
François Revol
c447257769 Merge branch 'master' into sam460ex 2012-11-23 14:18:16 +01:00
Ithamar R. Adema
2beda3bb5b ARM/runtime_loader: add stub to make it compile 2012-11-22 20:09:09 +01:00
Ithamar R. Adema
8b33059d8c ARM/libroot: fixup string functions 2012-11-22 00:00:15 +01:00
Ithamar R. Adema
0495c9313a ARM/libroot: last missing bits-n-pieces to get a full image built 2012-11-22 00:00:14 +01:00
Ithamar R. Adema
379aaaab11 ARM/libroot: small workaround for crash
The whole system_time support will have to be revisited anyhow, since
the only base we have for timing is SoC specific, not ARM core specific :(
2012-11-22 00:00:14 +01:00
Ithamar R. Adema
7a66f06442 ARM/libroot: add (l)rintf functions 2012-11-22 00:00:14 +01:00
Ithamar R. Adema
066688dcac ARM/haiku_loader: Style fixes
As suggested by Axel, thanks!
2012-11-22 00:00:13 +01:00
François Revol
77d95e1d47 Merge branch 'master' into sam460ex
Conflicts:
	src/system/boot/platform/u-boot/arch/ppc/Jamfile
2012-11-18 23:10:49 +01:00
Alex Smith
11c9f9a1d6 Merge branch 'master' into x86_64
Conflicts:
	build/jam/FloppyBootImage
	build/jam/OptionalBuildFeatures
	build/jam/OptionalPackages
	headers/private/shared/cpu_type.h
	src/bin/ps.c
	src/bin/sysinfo.cpp
	src/kits/tracker/PoseView.cpp
	src/preferences/appearance/DecorSettingsView.cpp
	src/preferences/virtualmemory/Settings.cpp
	src/servers/input/AddOnManager.cpp
	src/servers/input/InputServer.cpp
	src/servers/input/InputServerMethod.cpp
	src/system/boot/Jamfile
	src/system/boot/platform/raspberrypi_arm/mmu.cpp
	src/system/boot/platform/u-boot/arch/arm/Jamfile
	src/system/kernel/arch/x86/arch_cpu.cpp
	src/system/kernel/arch/x86/arch_thread.cpp
	src/system/kernel/cache/block_cache.cpp
	src/system/kernel/vm/VMAnonymousCache.cpp
2012-11-18 14:02:07 +00:00
Ithamar R. Adema
fb32cff770 ARM/libroot: and more fp calls.... 2012-11-16 15:58:35 +01:00
Ithamar R. Adema
d9a0abe462 ARM/libroot: Enable sig{set,long}jmp 2012-11-16 14:20:57 +01:00
Ithamar R. Adema
2d4e1654f3 ARM/libroot: Some last fp bits-n-pieces 2012-11-16 13:16:51 +01:00
Ithamar R. Adema
a03044aa5b ARM/libroot: Add more floating point code to get UCI happy 2012-11-16 03:04:27 +01:00
Ithamar R. Adema
9ffc3c3d8a ARM/libroot: stub out the missing functions for now
This will get libroot.so to build, which should give us much more compilation
coverage for ARM now too. Will have to go through all the libroot code with
a tooth comb anyway once userland comes up...

(Will consider replacing the glibc mess with bsd for all non gcc2 platforms)
2012-11-16 03:04:26 +01:00
François Revol
2b3046e60d Merge branch 'master' into sam460ex 2012-11-16 00:09:54 +01:00
Ithamar R. Adema
4f66136005 ARM/libroot: Add ARM specific Jamfile
This gets us to compiling/linking libroot almost completely, except
for some Haiku/ARM specific hooks that need to be done....

Almost there!
2012-11-15 15:22:44 +00:00
Ithamar R. Adema
7d2a37737d ARM/libroot: more stubs for floating point related things
Will sort this out properly when userland is coming up. Need to get
a basic libroot version working first, so I can build a proper HaikuImage
to boot from ;)
2012-11-15 15:18:42 +00:00
Ithamar R. Adema
e27a224fb2 ARM/libroot: copy some headers from x86
These are pretty generic 32bit target files, so just copy them over.
Once we get userland properly starting, we can review these to see
if they need any changes.
2012-11-15 15:16:03 +00:00
Ithamar R. Adema
40b16ecb97 generic/libroot: Add missing generic functions
This adds a few generic implementations of basic arithmetic functions. These
would normally be implemented in assembly, but add them for easy bringup of
new architectures.

This enables new platforms to start with a minimal set of changes to libroot.
2012-11-15 15:15:34 +00:00
Ithamar R. Adema
e054288f9d ARM/libroot: import files from glibc-ports-2.9
There is no ARM port for the glibc version we're using mostly, so I'm picking
up files from more recent glibc and will probably need to hack around in them,
as glibc seem to have cleaned up their arch support a lot these days.
2012-11-15 15:15:32 +00:00
Michael Lotz
963d68a632 Fix typo. 2012-11-14 15:16:47 +01:00
Michael Lotz
ad53cd29cb Fix iterator in hash_remove_current() to not skip elements.
When iterator->current is NULL, hash_next() assumes we've reached the
end of a bucket (linked list) and moves to the next one. Wehn the first
element of a linked list was removed in hash_remove_current()
iterator->current was set to NULL, causing the next call to hash_next()
to skip over the rest of the list of that bucket.

To fix this we now decrement iterator->bucket by one, so the next call
to hash_next() correctly arrives at the new first element of the same
bucket. Doing it this way avoids having to search backwards through the
table to find the actual previous item.

This caused modules to be skipped in module_init_post_boot_device()
when normalizing module image paths so some of the module images ended
up non-normalized. This could then cause images to be loaded a second
time for modules that were part of an actually already loaded image.
This setup is present for the PCI module with the pci/x86 submodule
and would lead to a second copy of the PCI module image to be loaded
but without being initialized, eventually leading to #8684.

The affected module images were pretty much random, as it depended on
the order in which they were loaded from the file system, in this case
the boot floppy archive of the El-Torito boot part of ISO and anyboot
images. The r1alpha4 release images unfortunately had the module files
ordered in the archive just so that the PCI module image would be
skipped, allowing #8684 to happen on many systems with MSI support.

Since the block cache uses hash_remove_current() as well in some cases,
it is possible that transactions in its list could've been skipped.
Cursory testing didn't reveal this to be a usual case, and it is
possible that in the pattern it is used there, the bug wouldn't be
triggered at all. It's still possible that it caused rare misbehaviour
though.
2012-11-14 15:09:54 +01:00
François Revol
dd686298c5 Merge branch 'master' into sam460ex 2012-11-13 12:51:50 +01:00
Ithamar R. Adema
344b3218d4 ARM/u-boot: Add support for FDTs passed in the uImage
Since we're using multi-part uImage format, we can add the FDT as
a seperate "blob" in the uImage, if the used U-Boot version is not
"FDT enabled".

This is used for example for our Verdex target. Currently I've got
a local hack in the platform/u-boot/Jamfile, looking into pulling
in the FDT files and a proper Jam setup to do that properly...
2012-11-13 12:27:11 +01:00
Ithamar R. Adema
1df5784a22 ARM: Add ARM architecture detection to generic bootloader ARM code.
This detects everything up to ARMv6 right now. Need to check more
recent ARM ARMs for ARMv7 detection.

The detected details get passed on to the kernel, which can use
the pre-detected info for selecting right pagetable format and such.

Copyright removal of Axel done after agreement with Axel @ BeGeistert
that for files that were copy/pasted from x86 arch and then fully
replaced the implementation, removal of original copyright holder is
allowed, since their actual code is gone ;)
2012-11-13 12:04:35 +01:00
Ithamar R. Adema
4b2a1d798b ARM: implement arch_cpu_user_memcpy/memset/strlcpy functions
Remove the dummies from the C code and implement them in assembly,
due to the label referencing issues with the fault handler.

This code is ripe for optimisation, my ARM assembly is pretty
basic ;)

Does work though, and gets us one step closer to a full arch.
2012-11-12 20:03:48 +01:00
Ithamar R. Adema
75b285a969 ARM: Fix incorrect panic message.
As noted during BeGeistert and today again by kallisti5, there's a
Pentium reference in the ARM bootloader code.

Correct the message to something more appropriate....

Thanks to Rene for the suggestion ;)
2012-11-12 18:08:41 +01:00
François Revol
13abd68fc3 Merge branch 'master' into sam460ex 2012-11-10 20:36:35 +01:00
Ithamar R. Adema
36b41db7aa Merge common ARM CPU/MMU code
This is to make sure all ARM platforms will benefit from planned work on this
MMU/CPU code. The less code duplicated, the better.

Compile-tested for all supported ARM platforms
2012-11-10 03:03:24 +01:00
Ithamar R. Adema
3d49fa31ec VMCache: Fix broken trace statements 2012-11-10 00:32:30 +01:00
François Revol
8e75bf5845 Merge branch 'master' into sam460ex 2012-11-09 10:56:13 +01:00
Jerome Duval
5ad12a800d vm_page_allocate_page_run: use a mask to enforce the boundary
* use a mask to enforce the boundary as suggested by Ingo. Thanks!
2012-11-09 00:21:41 +01:00
François Revol
17c270bd4f Merge branch 'master' into sam460ex 2012-11-08 10:25:41 +01:00
czeidler
9abf4591d5 Ok there are some more, thanks Rene. 2012-11-07 21:45:43 +01:00
czeidler
71d45a0f76 Coding style. 2012-11-07 21:37:40 +01:00
Ithamar R. Adema
e2b8ceb23c ARM/int: remove CPU fault handler debug output 2012-11-07 17:08:15 +01:00
Ithamar R. Adema
f86b582848 ARM: Cleanup of port support code.
This also implements the fault handler correctly now, and cleans up the
exception handling. Seems a lot more stable now, no unexpected panics or
faults happening anymore.
2012-11-07 16:24:22 +01:00
Ithamar R. Adema
0cf5ecba12 ARM: Add asm_offsets.cpp
This will generate asm_offsets.h which makes our assembly code
easier to maintain by preventing hardcoded offsets for fields within structures.

(copied from X86 and removed the X86 specifics)
2012-11-07 16:24:22 +01:00
Ithamar R. Adema
ff163585ec ARM/threads: Disable debug output
Tracing was accidently switched on by a previous commit.
2012-11-07 16:24:21 +01:00
Ithamar R. Adema
0e5d97e97e ARM/vm: small formatting change and trace fix.
Copy some minor changes over from the X86 paging implementation to keep
the two reasonably aligned. Smaller diff ;-)
2012-11-07 16:24:21 +01:00
François Revol
597636d909 Merge branch 'master' into sam460ex 2012-11-06 20:17:17 +01:00
François Revol
2d014a2886 U-Boot: Fix linking the kernel by adding FDT support
Add FDT support to the kernel,
move fdt_support.cpp and declare gFDT there for the kernel.
2012-11-06 19:43:12 +01:00
Jerome Duval
8ddec5b565 vm_page_allocate_page_run: fix previous commit
* remove superfluous codes
* when aligning, sPhysicalPageOffset would be substracted twice
+alpha4

Signed-off-by: Ingo Weinhold <ingo_weinhold at gmx dot de>
2012-11-06 19:40:47 +01:00
François Revol
3b4ba8d607 U-Boot: PPC: Copy the memory sizing code from OF
Just an exercise to see how well the OF wrapper works.
Had to adjust cause the FDT I had had /memory node,
but no memory prop on /chosen.
2012-11-06 16:45:39 +01:00
François Revol
f24f590392 U-Boot: implement part of the OpenFirmware wrapper
We'll see later on if it's really useful to keep it around.
2012-11-06 16:41:36 +01:00
François Revol
11e7e1aa75 Merge branch 'master' into sam460ex 2012-11-06 13:35:30 +01:00
Jérôme Duval
f5a14b17df vm_page_allocate_page_run: fix for aligned page allocations
* don't enforce a zero boundary or a zero alignment
* when going to the next range, takes alignment into account.
  It could previously just be enforced again through alignment and loop infinite.
* it should help with some FreeBSD based drivers
2012-11-06 00:41:08 +01:00
François Revol
5130ac0445 Merge branch 'master' into sam460ex 2012-11-05 15:42:03 +01:00
Axel Dörfler
d2c8db267d Just ignore unknown ELF program headers instead of failing.
* This fixes loading executables with a TLS section (which we do not support
  so far, though). Still, no reason to let the runtime loader choke on it.
2012-11-05 12:18:46 +01:00
Ithamar R. Adema
de4f3cf3a7 ARM: only warn if unknown memory types are being mapped.
This is a workaround for missing writecombine & friends support. Needs
proper fixing, but too many other things to do atm to focus on that...
2012-11-05 01:45:25 +01:00
Ithamar R. Adema
4fc1dadd58 ARM: add context switch implementation 2012-11-05 01:45:25 +01:00
Ithamar R. Adema
f8b47f2b2a ARM: fixup interrupt enable/disable/restore functions 2012-11-05 01:45:25 +01:00
Ithamar R. Adema
02081e0950 ARM: Initial implementation of interrupt/exception handling.
This contains both the common ARM(v5) vector handling as well as
the PXA(verdex) specific interrupt controller code, to be seperated
when ARM support for FDT is implemented.

Functional enough to handle interrupts, needs work on KDL support.
2012-11-05 01:45:24 +01:00
Ithamar R. Adema
be7195d0f7 ARM: add initial timer support.
Currently hardcoded to PXA (verdex) support, needs SoC abstraction
for seperating implementations, best done using FDT code as committed
by Francois.
2012-11-05 01:45:24 +01:00
Ithamar R. Adema
d09e7b5b90 ARM: mark pages found in query as present 2012-11-05 01:45:24 +01:00
Ithamar R. Adema
b867e1156e fix a TRACE() formatting string 2012-11-05 01:45:23 +01:00
Ithamar R. Adema
457556ca12 Fix variable name in TRACE() statement
Signed-off-by: Ithamar R. Adema <ithamar@upgrade-android.com>
2012-11-05 01:45:23 +01:00
Ithamar R. Adema
03e2e071fd bring back framebuffer support in haiku_loader on ARM/u-boot
* General fixes to get the refactored framebuffer code to work
  (across all 3 supported architectures)
* PXA (verdex) specific fixes to framebuffer code.

Now properly displays the (greyed) icons on the framebuffer!

Signed-off-by: Ithamar R. Adema <ithamar@upgrade-android.com>
2012-11-05 01:45:22 +01:00
François Revol
dd15872ac9 Fix warnings
(cherry picked from my sam460ex branch)
2012-11-04 16:40:17 +01:00
François Revol
338324dc66 U-Boot: check for /chosen in the FDT for an initrd holding our tgz
* since the FDT linux boot method doesn't pass the uimage, we can't
use it to pass the kernel+driver tgz in a multi-file uimage.
* instead we check for the linux initrd properties in the /chosen node.

(cherry picked from my sam460ex branch)
2012-11-04 16:40:17 +01:00
François Revol
97bcc417ce U-Boot: fix hex dump in fdt support
(cherry picked from my sam460ex branch)
2012-11-04 16:40:16 +01:00
François Revol
9b8ce8c462 U-Boot: initialize the debug UART using FDT hints when possible
* we first try to find 'serial', 'serial0' or 'serial1' in /aliases
* extract the required properties from the found node and use them
* fallback to the hardcoded UART from the board definition header

(cherry picked from my sam460ex branch)
2012-11-04 16:40:16 +01:00
François Revol
6e804e0e9c U-Boot: don't dump the FDT nodes by default
* only dump some header infos from the FDT by default, as dumping
the complete tree can get quite verbose.

(cherry picked from my sam460ex branch)
2012-11-04 16:40:16 +01:00
François Revol
18f4b7dd3b U-Boot: dump the passed FDT
* add some helpers for Flattened Device Trees, for now a dump call
* dump the passed FDT on startup for now

Conflicts:
	src/system/boot/platform/u-boot/Jamfile

(cherry picked from my sam460ex branch)
2012-11-04 16:40:15 +01:00
François Revol
fa44ac9be8 U-Boot: compile and link to libfdt
* For the sam460ex and likely some ARM boards we will try to boot
using the passed FDT, as it's the recommended method now.

(cherry picked from my sam460ex branch)
2012-11-04 16:40:15 +01:00
François Revol
f0339bc92c haiku_loader: add memchr to the list of imported libroot objects
* libfdt uses memchr, so add this function from the libroot objects

(cherry picked from my sam460ex branch)
2012-11-04 16:40:15 +01:00
François Revol
f1ad2f5a23 U-Boot: disable optimisation to help debugging
* the U-Boot support code is yet unfinished and needs more debugging.

(cherry picked from my sam460ex branch)
2012-11-04 16:40:14 +01:00
François Revol
04d6229ef8 Merge branch 'master' into sam460ex 2012-11-04 15:10:36 +01:00
Jérôme Duval
12e574a316 enlarge the buffer for the CPU features string
* 256 bytes wasn't enough for i5-2557m
2012-11-04 10:35:40 +01:00
Fredrik Holmqvist
9b0d045c59 Update to ACPICA 20121018.
This is an update from 20120711 and A LOT has happened since then. See
    https://acpica.org/download/changes.txt for all the changes.
2012-11-03 22:46:22 +01:00
François Revol
813cf8cdba Merge branch 'master' into sam460ex 2012-10-09 14:26:57 +02:00
Axel Dörfler
9b9cb227c7 Consolidated and fixed device_geometry computation.
* The only implementation that would accept more than 2 TB was the one in
  scsi_disk. But even that one was limited to 63 TB.
* Now there is a new utility function devfs_compute_geometry_size() which
  does it correctly for sizes up to 2^64 which should be good enough for
  quite some time :-)
* This fixes bug #8992.
2012-10-08 13:59:16 +02:00
François Revol
3d0f413d21 Merge branch 'master' into sam460ex 2012-10-03 22:52:25 +02:00
Prasad Joshi
45132e2b22 ps: fix uid and gid in the ps output
The function fill_team_info() completely ignored the user id and the
group id of the process (fields info->uid and info->gid respectively).
Since the info structure was zeroed earlier, the ps output showed uid
and gid of each process equal to zero.

The patch fixes the problem by properly initializing the members with
effective uid and gid. Now the output is correct.

Fixes #8995.

Signed-off-by: Ryan Leavengood <leavengood@gmail.com>
2012-10-03 15:45:56 -04:00
François Revol
f916b68079 B_POSIX_ENOMEM is obviously an error...
* was wrongly reported as "No error"
2012-09-27 16:42:40 +02:00
François Revol
ca6bf83ff9 Fix warnings 2012-09-23 02:59:40 +02:00
François Revol
0e5f979720 PPC: Add a stub PPCUBoot platform class
* use the platform field in arch_kernel_args to determine which platform to instanciate
2012-09-22 22:12:56 +02:00
François Revol
9a713d9417 U-Boot: PPC: stub out OF calls
* For now this allows linking the kernel and the pci bus manager.
* Could later on be turned into a wrapper to FDT methods since the
concepts are similar.
2012-09-22 20:45:25 +02:00
François Revol
2a01ed9660 Merge branch 'master' into sam460ex 2012-09-22 04:20:39 +02:00
François Revol
9c50f5eded U-Boot: arch_mmu.cpp does not come from kernel sources
* so don't try to find it there
2012-09-22 04:18:37 +02:00
François Revol
27f5335cb3 Merge branch 'master' into sam460ex
* U-Boot Copy arch_mmu.cpp to arch/ppc/ as stubs to fix the build.
2012-09-22 04:12:18 +02:00
François Revol
db5bd5535e U-Boot: move mmu.cpp to arch/arm/arch_mmu.cpp
* only contains ARM stuff anyway.
* PPC implementation will be very different anyway.
2012-09-22 04:00:13 +02:00
François Revol
5600cae48c Add arch_framebuffer.h for ppc
* should fix the build
2012-09-22 03:39:19 +02:00
François Revol
8c1740d305 Merge branch 'master' into sam460ex 2012-09-21 04:14:59 +02:00
Axel Dörfler
8c3a938fc3 cache_abort_sub_transaction() did not maintain num_blocks.
* When a block was only used in a sub-transaction, it was thrown away,
  but the transaction::num_blocks field was not decremented.
* This caused transactions never considered finished which eventually
  led to bug #8942. This does not explain the disk corruption occurring
  in #8969, though.
2012-09-19 20:06:19 +02:00
Alexander von Gluck IV
b341f104e9 ARM: Build fixes and cleanup
* Don't redefine incorrect cpu headers in framebuffer code
* Drop unused err
* Fix missing parentheses as per gcc
* Fix Raspberry Pi Build
* Fix overo build due to missing header
2012-09-15 17:12:56 -05:00
François Revol
17f274de98 Merge branch 'master' into sam460ex 2012-09-15 20:48:30 +02:00
Alexander von Gluck IV
8eeafbce5f arm framebuffer: Convert arm arch_video code into classes
* Proper framebuffer code is chosen based on hardware
* This change could extend into other arch code as well
* François gave permission to update his copyrights
* Minimal functional change
2012-09-15 13:23:34 -05:00
Alexander von Gluck IV
58f219d49f beagleboard: Fix build, missing header 2012-09-15 12:50:08 -05:00
François Revol
6249f798aa Merge branch 'master' into sam460ex 2012-09-15 19:43:11 +02:00
Alexander von Gluck IV
7ccc9b45e8 arm loader: Style cleanup of loader arm arch code
* These video sources would be good cannidates to be
  refactored as classes. (like the arm serial code)
* No functional change. There are some order style issues
  in some of the code (the top externs), but I decided to
  not fix them as I can't build these atm to test.
2012-09-15 09:24:13 -05:00
Alexander von Gluck IV
d501b694bf rPi: Set 1 cpu in the loader 2012-09-15 09:24:12 -05:00
Ingo Weinhold
1bd0748253 Fix crash in MemoryManager::PerformMaintenance()
sFreeAreaCount wasn't decremented after removing an area from
sFreeAreas, thus causing the loop to continue until enountering and
crashing on a NULL pointer after removing the last area. Introduce
helper methods _PushFreeArea() and _PopFreeArea() to ensure this cannot
easily happen again.

Fixes ticket #8972.
2012-09-11 22:31:19 +02:00
François Revol
95540b8a19 Merge branch 'master' into sam460ex 2012-09-10 11:14:31 +02:00
Alexander von Gluck IV
1946d374f2 rPi: Update boot process for later Pi firmwares
* The bootprocess is better documented now.
  Put technical info in linker script, user info
  into info.txt
2012-09-09 21:10:16 -05:00
Fredrik Holmqvist
cdca279abd Remove unused header hpet.h. 2012-09-09 14:47:49 +02:00
Alexander von Gluck IV
534268052d Kernel VM: Utilize swap_auto option
* Refine the swap logic a little
* Refine header copyright to preferred format
  I had hamishm's verbal permission to change his entry
2012-09-07 00:13:14 +00:00
François Revol
54b6d06e8e Merge branch 'master' into sam460ex 2012-09-05 16:22:03 +02:00
Alexander von Gluck IV
4517ef5728 Kernel VM: A few changes as per Axel in #7742
* Avoid floating point numbers in the kernel
* Warning would always show if custom swap file in use
* Don't change a custom swap file size if low space occurs
* Ram > 1GB? Don't double the memory for the automatic size
2012-09-04 15:35:10 -05:00
Alexander von Gluck IV
3e01905aca Kernel VM: Add compatibility logic
* If old-format swap config file found, parse it properly
2012-09-04 13:27:33 -05:00
Alexander von Gluck IV
0606074fd9 Kernel VM: Improve swap file selection
* Heavily based on Hamish Morrison's GCI work with some
  modified logic and cleanup. #3723
* Adds automatic swap as well as user specified swap
* Limits:
  Automatic: (ram * 2) up to 25% of the disk
  User: user specified up to 90% of the disk
* Supports changing the swap disk location
2012-09-04 12:31:56 -05:00
Alexander von Gluck IV
3d87b8120c Kernel VM: Style cleanup; No functional change 2012-09-04 08:42:36 -05:00
Axel Dörfler
098967cee1 Fixed the new issue in #8910 from r44585.
* The ASSERT() I introduced in r44585 was incorrect: when the sub transaction
  used block_cache_get_empty() to get the block, there is no original_data for
  a reason.
* Added a test case that reproduces this situation.
* The block must be moved to the unused list in this situation, though, or else
  it might contain invalid data. Since the block can only be allocated in the
  current transaction, this should not be a problem, though, AFAICT.
2012-09-04 01:00:33 +02:00
François Revol
bea1908f0f Merge branch 'master' into sam460ex 2012-09-01 13:28:41 +02:00
Yongcong Du
19187c464b x86: Initialize IA32_MSR_ENERGY_PERF_BIAS
The lowest 4 bits of the MSR serves as a hint to the hardware to
favor performance or energy saving. 0 means a hint preference for
highest performance while 15 corresponds to the maximum energy
savings. A value of 7 translates into a hint to balance performance
with energy savings.

The default reset value of the MSR is 0. If BIOS doesn't intialize
the MSR, the hardware will run in performance state. This patch
initialize the MSR with value of 7 for balance between performance
and energy savings

Signed-off-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2012-08-29 22:11:56 +02:00
François Revol
defa25e38f Merge branch 'master' into sam460ex 2012-08-28 18:53:03 +02:00
Axel Dörfler
713945cecb The original_data could be freed late.
* In cache_abort_sub_transaction(), the original_data can already be freed
  when the block is being removed from the transaction.
* block_cache::_GetUnusedBlock() no longer frees original/parent data - it
  now requires them to be freed already (it makes no sense to have them still
  around at this point).
* AFAICT the previous version did not have any negative consequences besides
  freeing the original data late.
2012-08-27 20:00:06 +02:00
Axel Dörfler
9089ab06bd Minor block cache refactoring.
* Extracted a write_blocks_in_previous_transaction() function out of
  cache_end_transaction(), and cache_detach_sub_transaction().
2012-08-27 12:46:22 +02:00
Axel Dörfler
dd9d610500 Fixed broken block list introduced in hrev44357.
* cache_abort_sub_transaction() was setting the transaction_next pointer to
  NULL in order to remove a block from a transaction -- however, it forgot to
  actually remove it from the transaction's block list.
* Minor restructuring.
2012-08-27 12:42:48 +02:00
Axel Dörfler
153d895337 Fixed broken discard handling in cache_start_sub_transaction().
* This actually resolves a TODO.
2012-08-27 12:38:35 +02:00
Axel Dörfler
8f9dac699d Cleanup, no functional change intended. 2012-08-27 11:21:42 +02:00
François Revol
80dfcc7311 U-Boot: check for /chosen in the FDT for an initrd holding our tgz
* since the FDT linux boot method doesn't pass the uimage, we can't
use it to pass the kernel+driver tgz in a multi-file uimage.
* instead we check for the linux initrd properties in the /chosen node.
2012-08-25 00:33:24 +02:00
Edward Robbins
6912e7dc03 getrlimit with RLIMIT_STACK now returns USER_MAIN_THREAD_STACK_SIZE
Signed-off-by: Rene Gollent <anevilyak@gmail.com>
2012-08-24 18:29:59 -04:00
François Revol
60a40e4ff0 U-Boot: fix hex dump in fdt support 2012-08-24 23:04:16 +02:00
François Revol
74eeabe4a6 U-Boot: initialize the debug UART using FDT hints when possible
* we first try to find 'serial', 'serial0' or 'serial1' in /aliases
* extract the required properties from the found node and use them
* fallback to the hardcoded UART from the board definition header
2012-08-24 21:20:09 +02:00
François Revol
513f67f193 U-Boot: don't dump the FDT nodes by default
* only dump some header infos from the FDT by default, as dumping
the complete tree can get quite verbose.
2012-08-24 21:15:50 +02:00
François Revol
696526b2b8 U-Boot: dump the passed FDT
* add some helpers for Flattened Device Trees, for now a dump call
* dump the passed FDT on startup for now
2012-08-24 17:56:45 +02:00
François Revol
78ea39c7d2 U-Boot: compile and link to libfdt
* For the sam460ex and likely some ARM boards we will try to boot
using the passed FDT, as it's the recommended method now.
2012-08-24 15:48:02 +02:00
François Revol
6955cba65b haiku_loader: add memchr to the list of imported libroot objects
* libfdt uses memchr, so add this function from the libroot objects
2012-08-24 15:32:44 +02:00
François Revol
7f99a36bc7 Merge branch 'master' into sam460ex 2012-08-21 22:02:56 +02:00
Alex Smith
d2a1be1c4e Cleaner separation of 32-/64-bit specific CPU/interrupt code.
Renamed {32,64}/int.cpp to {32,64}/descriptors.cpp, which now contain
functions for GDT and TSS setup that were previously in arch_cpu.cpp,
as well as the IDT setup code. These get called from the init functions
in arch_cpu.cpp, rather than having a bunch of ifdef'd chunks of code
for 32/64.
2012-08-18 17:43:40 +01:00
Alex Smith
d339b8398c CID 712424: Unintended sign extension.
Fix taken from glibc, glibc bug #3747.
2012-08-18 13:52:10 +01:00
Alex Smith
173342c0ab Change the heap reservation for 64-bit platforms.
Hoard reserves a chunk of the address space to grow the heap into.
As there is a much larger address space available on 64-bit systems,
we may as well reserve a larger chunk of address space (64GB for now,
though could probably reserve a lot more than that and still leave
plenty of room for other areas).
2012-08-17 15:34:11 +01:00
Alex Smith
9f629ef38e Rename KERNEL_LOAD_BASE_64BIT to KERNEL_LOAD_BASE_64_BIT for consistency. 2012-08-17 15:16:25 +01:00
Alex Smith
e993391e9c Fixed crypt() for 64-bit systems. 2012-08-17 13:37:05 +01:00
Rene Gollent
1e068aea46 Slight improvement to tracing output.
- If a trace entry has a stack trace, attempt to demangle the associated symbols.
  Could be enhanced further to also demangle the arguments but doesn't yet.
  Interestingly there are some mangled symbols that our demangler appears to
  not handle correctly (gcc4).
2012-08-19 16:04:36 -04:00
Fredrik Holmqvist
ac827a2baa Make strcmp do four byte comparisons on aligned strings.
Used libMicro's strcmp test to evaluate performance:
OPTS="-E -C 200 -S -W"
bin/strcmp	$OPTS -N "strcmp_10"	-s 10	-I 10
bin/strcmp	$OPTS -N "strcmp_100"	-s 100	-I 20
bin/strcmp	$OPTS -N "strcmp_1k"	-s 1k	-I 50
bin/strcmp	$OPTS -N "strcmp_10k"	-s 10k	-I 800
bin/strcmp	$OPTS -N "strcmp_1m"	-s 1m   -I 500000
bin/strcmp	$OPTS -N "strcmp_10m"	-s 10m  -I 5000000

Before:
             prc thr   usecs/call      samples   errors cnt/samp     size
strcmp_10      1   1      0.02510          201        0    10000       10
strcmp_100     1   1      0.17520          169        0     5000      100
strcmp_1k      1   1      1.67700          177        0     2000     1024
strcmp_10k     1   1     17.24800          194        0      125    10240
strcmp_1m      1   1  17892.00000          160        0        1  1048576
strcmp_10m     1   1 183136.00000          201        0        1 10485760

After:
strcmp_10      1   1      0.01800          194        0    10000       10
strcmp_100     1   1      0.13540          190        0     5000      100
strcmp_1k      1   1      1.24950          188        0     2000     1024
strcmp_10k     1   1     12.85600          190        0      125    10240
strcmp_1m      1   1  12930.00000          170        0        1  1048576
strcmp_10m     1   1 134382.00000          195        0        1 10485760
2012-08-19 11:39:16 +02:00
Alex Smith
e688bf23d4 Merge branch 'master' into x86_64
Conflicts:
	src/servers/app/ServerWindow.cpp
2012-08-16 21:11:15 +01:00
Alex Smith
1eaa9e63cd Compilation fix for malloc_debug. 2012-08-16 14:23:43 +01:00
Alex Smith
c864ba1a2d Build a separate libsupc++ for the kernel with correct flags.
Kernel mode code on x86_64 needs to be built with -mno-red-zone as
interrupts would corrupt the red zone if it were in use. However, the
kernel is linked with libsupc++, which was not compiled with
-mno-red-zone. If an interrupt occurred in libsupc++ code the red zone
would get corrupted. This was causing random panics, particularly under
heavy system load. Therefore, on x86_64 a separate build of libsupc++
with -mno-red-zone is now done for the kernel to use. Note: this commit
will require a rerun of configure and rebuild of cross tools.
2012-08-16 13:57:04 +01:00
Michael Lotz
c936a02360 Move MSI initialization before IO-APIC to fix missing init.
Initializing the IO-APIC will initialize the PCI module, which does
read the MSI config of the devices only when MSIs are available.
Since we initialized them only after that, that condition wasn't met.
Later, due to the uninitialized arch info, MSIs were still marked as
available (0xcc = 204 MSIs). Due to the also uninitialized configured
count, they were always deemed busy however, in effect just breaking
MSI support whereever IO-APICs were available.
2012-08-16 00:31:18 +02:00
François Revol
091ba358a8 U-Boot: disable optimisation to help debugging
* the U-Boot support code is yet unfinished and needs more debugging.
2012-08-15 21:28:30 +02:00
Alex Smith
294818c5fd More x86_64 printf() fixes from glibc. 2012-08-15 15:40:32 +01:00
Alex Smith
91899cd48d Fix from glibc for possible crash when printf()'ing a long double. 2012-08-14 20:08:42 +01:00
Alex Smith
4efc3430a0 Fixed possible NULL dereference in vm_page_fault.
This bug was introduced by changing IS_USER_ADDRESS to check against
USER_BASE AND USER_TOP rather than just !IS_KERNEL_ADDRESS. Faults
on addresses outside both the user and kernel address spaces (i.e. the
gap between user and kernel) would result in addressSpace being NULL,
but addressSpace was being used without checking for NULL at one point.
2012-08-14 17:46:09 +01:00
Alex Smith
a53cfbf491 Jump to the fault handler for GPFs in the debugger.
If an uncanonical address is accessed a general protection fault will
be raised. When in the debugger, uncanonical address faults should be
handled by the fault handler (if any).
2012-08-14 16:03:33 +01:00
Alex Smith
fa6327c9f4 Compile remaining x86 bits for x86_64.
The IOAPIC and IRQ routing code now gets compiled for x86_64, though
they won't be used yet as there is no ACPI support currently.
2012-08-09 13:18:53 +01:00
Alex Smith
f3e4f18be7 Debugging fixes.
* INT3 had the wrong DPL set in the IDT, could not be raised from
  userland.
* Need the debug server running.
2012-08-09 09:17:04 +01:00
Alex Smith
8a1903353e Implemented user debugging support for x86_64.
Reused x86 arch_user_debugger.cpp, with a few minor changes to make
the code work for both 32 and 64 bit. Something isn't quite working
right, if a breakpoint is hit the kernel will hang. Other than that
everything appears to work correctly.
2012-08-07 20:20:42 +01:00
Alex Smith
cc30eec43d System call restart support. 2012-08-05 14:20:37 +01:00
Alex Smith
f429464535 User symbol lookup works now on x86_64. 2012-08-05 08:12:39 +01:00
Alex Smith
25871c6895 Removed Thread::fault_callback, no longer necessary now that vm86 is gone. 2012-08-04 11:02:54 +01:00
Pawel Dziepak
24128e493f nfs4: Send the server client's network address 2012-08-04 04:40:22 +02:00
Alex Smith
74bda98cb2 Killed off vm86 code, no longer being used. 2012-08-03 16:49:15 +01:00
Alex Smith
d93ed09564 Improved safety for user memory accesses.
* Changed IS_USER_ADDRESS to check an address using USER_BASE and
  USER_SIZE, rather than just !IS_KERNEL_ADDRESS. The old check would
  allow user buffers to point into the physical memory map area.
* Added an unmapped hole at the end of the bottom half of the address
  space which catches buffers that cross into the uncanonical address
  region. This also removes the need to check for uncanonical return
  addresses in the syscall handler, it is no longer possible for the
  return address to be uncanonical under normal circumstances. All
  cases in which the return address might be changed by the kernel
  are still handled via the IRET path.
2012-08-02 09:32:33 +01:00
Alex Smith
9a5503d01c Different uname machine type for x86_64.
* Added B_64_BIT_PC_PLATFORM platform type.
* Return "x86_64" as the machine type for that platform in uname.
2012-08-01 11:13:14 +01:00