Commit Graph

5552 Commits

Author SHA1 Message Date
Ingo Weinhold
7bea0205ed vm_page_allocate_page_run(): fix debug output 2013-07-11 17:56:20 +02:00
Ingo Weinhold
c53508b730 kernel tracing: implement fallback for meta data allocation
We the meta data area couldn't be allocated in any of the supported
(reattachable) places, just use a static allocation. The tracing feature
wouldn't be available at all in such a case.
2013-07-11 17:56:13 +02:00
Jérôme Duval
86340fcef3 kernel/int.cpp: typo fix 2013-07-09 23:53:26 +02:00
Ingo Weinhold
7e78b434f4 Merge remote-tracking branch 'haiku/master' into package-management
Conflicts:
	build/jam/HaikuImage
	build/jam/OptionalPackageDependencies
	build/jam/OptionalPackages
	build/scripts/build_cross_tools_gcc4
	src/add-ons/translators/icns/Jamfile
	src/add-ons/translators/jpeg/Jamfile
2013-07-08 14:01:00 +02:00
Alex Smith
e818b9707c Call debug_cleanup() before converting kernel_args to 64-bit addresses, fixes #9842.
In debug_cleanup(), if the debug syslog buffer is disabled (the default when
KDEBUG_LEVEL is 0), then a new buffer is allocated with kernel_args_malloc().
This is done after kernel_args addresses have been converted to 64-bit, so
the address the kernel gets will be 32-bit, resulting in the page fault seen
in #9842. Fixed by moving the call to debug_cleanup() to before
convert_kernel_args().
2013-07-04 13:01:07 +01:00
Jérôme Duval
d3b108c53d virtio_scsi: added to the image.
* device_manager: scans busses/scsi for generic drivers.
2013-07-02 22:48:25 +02:00
Jérôme Duval
3c47ce8421 DMAResource: mutex_lock() before calling mutex_destroy(). 2013-07-02 19:00:43 +02:00
Ingo Weinhold
2eb2b522bf Enforce team and thread limits
Also fixes incorrect team accounting in case of error when creating
a team. The previously incremented sUsedTeams wasn't decremented again.
2013-07-02 01:57:30 +02:00
Ingo Weinhold
cbcde3ba80 kernel team.cpp: fix unbalanced io_context ref management
... in case of team creation error. Once assigned to Team::io_context
the Team object takes responsibility of the I/O context object and
releases the reference on destruction. load_image_internal() and
fork_team() were thus releasing one reference too many.

Fixes #9851.
2013-07-02 01:57:30 +02:00
Ingo Weinhold
8c974aa800 node monitor: add TODO regarding the syscalls 2013-06-27 21:57:43 +02:00
Ingo Weinhold
0d603ac65c Fix node monitoring slot accounting for stop_watching()
NodeMonitorService::RemoveUserListeners() didn't decrement
io_context::num_monitors when removing a listener, so limit checks
would be off afterwards.
2013-06-27 21:57:43 +02:00
Oliver Tappe
ece582547a Improve robustness of asctime() and asctime_r().
* Return NULL and set EINVAL if the given tm pointer is NULL. This 
  isn't mandated by the POSIX base specs, but it just makes sense.
2013-06-23 17:01:12 +02:00
Oliver Tappe
51bce887cd Fix behaviour of localtime(), gmtime() and mktime().
* In case the locale backend could not be loaded, these functions (and
  their reentrant counterparts) just returned an error. So we reactivate
  parts of the BSD-/Olson-implementation in localtime_fading_out.c in
  order to use them as fallback.
* Cleanup localtime_fading_out.c (remove a lot of unused cruft).
2013-06-23 16:43:23 +02:00
Oliver Tappe
b4dc51b39a Fix behaviour of towlower(), towupper() and towctrans():
* all those functions need to return the given wc unchanged in case of
  error, not 0
* towctrans() didn't actually look at the requested transition, but 
  always acted as if _ISlower was given
2013-06-23 11:45:38 +02:00
Jérôme Duval
6121ae660c device_manager: init DMAResource::fScratchVecs. 2013-06-15 16:26:50 +02:00
Ingo Weinhold
178da21ad1 Update icu package
Also use the new build feature rules.
2013-06-13 18:42:44 +02:00
Ingo Weinhold
c80c7982c8 boot packagefs: Fix zlib dependency declaration 2013-06-08 00:18:28 +02:00
Ingo Weinhold
3dadb47f21 boot loader tarfs: Declare dependency to zlib package 2013-06-08 00:04:45 +02:00
Oliver Tappe
729c6333ad Runtime loader: rename compatibilitySubDir to abiSpecificSubDir. 2013-06-05 18:32:47 +02:00
Oliver Tappe
0050b4b452 Runtime loader: don't fall back to OS-ABI directories.
* when an executable with a different ABI is being loaded and some
  needed image isn't found, don't retry using the standard ABI folders
  of the system - those are now considered incompatible
2013-06-05 18:32:47 +02:00
Ingo Weinhold
a6e03f41d2 find_directory(): Fix B_{APPS,PREFERENCES}_DIRECTORY paths 2013-06-05 00:00:47 +02:00
François Revol
a442699e34 PPC: Use asm_defs.h instead of hardcoded defines 2013-06-01 19:32:43 +02:00
François Revol
d4659184b8 PPC: Add a 44x version of arch_exceptions.S
For now just a copy of the classic code.
2013-06-01 19:18:12 +02:00
François Revol
b8ded2f897 Merge branch 'master' into sam460ex 2013-05-27 17:45:55 +02:00
Jérôme Duval
78b461d6a1 Merge branch 'virtio' 2013-05-26 17:12:25 +02:00
Jérôme Duval
3aae21ab63 virtio: integrate into the build and image
* device_manager: scans busses/virtio for network device types
  and scsi controllers.
2013-05-26 16:05:53 +02:00
Ingo Weinhold
46122852f1 packagefs: Add caching for the package file heap reader
* ReaderImplBase:
  - Add virtual CreateCachedHeapReader() which can create a cached
    reader based on the given heap reader.
  - Rename HeapReader() to RawHeapReader() and add HeapReader() for the
    cached heap reader.
  - Add DetachHeapReader() to allow a clients to remove the heap
    reader(s) after deleting the ReaderImplBase object.
* packagefs:
  - Add CachedDataReader class, which wraps a given
    BAbstractBufferedDataReader and provides caching for it using a
    VMCache. The implementation is based on the IOCache implementation.
  - Use CachedDataReader to wrap the heap reader. For file data that
    means they are cached twice -- in the heap reader cache and in the
    file cache -- but due to the heap reader using a VMCache as well,
    the pages will be recycled automatically anyway. For attribute data
    the cache should be very helpful, since they weren't cached at all
    before.
2013-05-25 01:12:32 +02:00
Ingo Weinhold
d59e0feb59 package: Suppress version mismatch errors where V1 is supported
* Add flags parameter to Init() of BPackageReader and friends.
* Introduce flag B_HPKG_READER_DONT_PRINT_VERSION_MISMATCH_MESSAGE and
  don't print a version mismatch error when given.
* package extract/list: Use the new flag.
2013-05-25 01:12:31 +02:00
Ingo Weinhold
64bb883062 Support booting with a packaged boot loader
* Add new package haiku_loader.hpkg and move haiku_loader there. The
  package is built without compression, so that the stage 1 boot loader
  has a chance of loading it.
* Adjust the stage 1 boot loader to load the haiku_loader package and
  relocate the boot loader code accordingly.
2013-05-25 01:12:31 +02:00
Ingo Weinhold
5261923e87 Add dvprintf() 2013-05-25 01:12:29 +02:00
Ingo Weinhold
1f633814fa hpkg format: compress the whole heap
Instead of handling compression for individual file/attribute data we
do now compress the whole heap where they are stored. This
significantly improves compression ratios. We still divide the
uncompressed data into 64 KiB chunks and use a chunk offset array for
the compressed chunks to allow for quick random access without too much
overhead. The tradeoff is a limited possible compression ratio -- i.e.
we won't be as good as tar.gz (though surprisingly with my test
archives we did better than zip).

The other package file sections (package attributes and TOC) are no
longer compressed individually. Their uncompressed data are simply
pushed onto the heap where the usual compression strategy applies. To
simplify things the repository format has been changed in the same
manner although it doesn't otherwise use the heap, since it only stores
meta data.

Due to the data compression having been exposed in public and private
API, this change touches a lot of package kit using code, including
packagefs and the boot loader packagefs support. The latter two haven't
been tested yet. Moreover packagefs needs a new kind of cache so we
avoid re-reading the same heap chunk for two different data items it
contains.
2013-05-25 01:12:25 +02:00
Ingo Weinhold
0ee1651856 Rename BBlockBufferCache and friends to *Pool*
Also move BBlockBufferPoolNoLock into BHPKG namespace with the other
classes. Not sure why it wasn't there before.
2013-05-25 01:12:25 +02:00
Pawel Dziepak
6c9c8a037c vm: fix area insertion logic
* When looking for a place for new area the size of the area to be
   inserted instead of the next area size was used to check whether
   we are already past the upper bound.
 * There was an attempt to insert area even if we were past the
   upper bound.
2013-05-22 19:31:26 +02:00
Pawel Dziepak
07e1875ea2 libroot: explicitly check ABI version
As Axel suggested use simple, explicit checks for legacy ABI version
instead of obscure "compatibility mode".
2013-05-22 19:31:05 +02:00
Pawel Dziepak
5d0a1da8bf libroot: make all areas executable for old binaries
* If at least one image is either B_HAIKU_ABI_GCC_2_ANCIENT or
   B_HAIKU_ABI_GCC_2_BEOS almost all areas are marked as executable.
 * B_EXECUTE_AREA and B_STACK_AREA are made public. The former is enforced since
   the introduction of DEP and apps need it to correctly set area protection.
   The latter is currently needed only to recognize stack areas and fix their
   protection in compatibility mode, but may also be useful if an app wants
   to use sigaltstack from POSIX API.
2013-05-15 00:06:39 +02:00
Ingo Weinhold
c663ca2171 Merge branch 'master' into package-management
Conflicts:
	build/jam/HaikuImage
	src/system/kernel/arch/x86/64/arch.S
2013-05-12 00:18:19 +02:00
Ingo Weinhold
1848fdc329 util/khash: Add hash_hash_string_part() 2013-05-11 23:17:55 +02:00
Axel Dörfler
4b723e3fb8 boot loader: Almost removed use of kernel_cpp.h.
* For some reason that is beyond me, fat/CachedBlock.cpp needs this header,
  or else building the boot loader fails.
2013-05-11 19:34:22 +02:00
Ingo Weinhold
0bfcf7312a Move deskbar menu directory to ~/config/settings/deskbar/menu
Also remove the "be" symlink in ~/config/settings.
2013-05-11 09:57:58 +02:00
Ingo Weinhold
f132bdfe9f boot loader: Add 256 KB additional heap
packagefs is using quite a bit additional memory for the MIME DB
entries and with all files identified.
2013-05-09 03:17:43 +02:00
Ingo Weinhold
00090d290d boot loader: print max heap usage info before entering kernel 2013-05-09 03:14:35 +02:00
Oliver Tappe
9abd3e6f53 Fix race condition during build of some file systems.
* make sure the zlib package is available before trying to use zlib.h
2013-05-06 20:01:40 +02:00
Ingo Weinhold
7c6bff1734 Complete outsourcing of zlib
* Add optional packages Zlib and Zlib-devel.
* Simplify the build feature section for zlib and also extract the
  source package.
* Replace all remaining references to the zlib instance in the tree and
  remove it.
2013-05-06 04:37:18 +02:00
Rene Gollent
1b17f7ab00 Fix x86-64 build. 2013-05-05 16:57:51 -04:00
Ingo Weinhold
5af6169bb2 x86[-64]: Fix arch_cpu_user_strlcpy() for small buffers
The case for small buffers was broken, since scasb operates on edi/rdi,
not esi/rsi.
2013-05-05 15:46:32 -04:00
Ingo Weinhold
bcbf22a316 x86[-64]: Fix arch_cpu_user_strlcpy() for small buffers
The case for small buffers was broken, since scasb operates on edi/rdi,
not esi/rsi.
2013-05-05 18:01:12 +02:00
Ingo Weinhold
25a7b01d15 Merge branch 'master' into package-management
Additional changes:
* Add src/system/kernel/lib/zlib, which builds a kernel version of zlib,
  needed by packagefs.
* BuildFeatures: Add a build feature "gcc2" to allow for easier checks.
* Referenceable.cpp: Include <OS.h> instead of <debugger.h>. The latter
  is not needed and prevents building for the build platform.
* zlib/zutil.h: Fix gcc 2 build. We really should use the external
  package instead.

Conflicts:
	.gitignore
	build/jam/BuildSetup
	build/jam/FileRules
	build/jam/FloppyBootImage
	build/jam/HaikuImage
	build/jam/ImageRules
	build/jam/KernelRules
	build/jam/NetBootArchive
	build/jam/OptionalBuildFeatures
	build/jam/OptionalLibPackages
	build/jam/OptionalPackageDependencies
	build/jam/OptionalPackages
	build/scripts/build_haiku_image
	configure
	data/bin/installoptionalpackage
	data/system/boot/Bootscript
	headers/os/app/Message.h
	headers/os/package/PackageInfo.h
	headers/os/package/PackageInfoAttributes.h
	headers/os/package/PackageInfoSet.h
	headers/os/package/PackageRoster.h
	headers/os/package/PackageVersion.h
	headers/os/package/hpkg/PackageInfoAttributeValue.h
	headers/os/storage/FindDirectory.h
	headers/os/storage/Node.h
	headers/os/support/StringList.h
	headers/private/system/directories.h
	src/add-ons/kernel/drivers/audio/ac97/es1370/Jamfile
	src/add-ons/kernel/file_systems/packagefs/AttributeIndex.cpp
	src/add-ons/kernel/file_systems/packagefs/Jamfile
	src/add-ons/kernel/file_systems/packagefs/Package.cpp
	src/add-ons/kernel/file_systems/packagefs/Package.h
	src/add-ons/kernel/file_systems/packagefs/PackageDomain.cpp
	src/add-ons/kernel/file_systems/packagefs/PackageDomain.h
	src/add-ons/kernel/file_systems/packagefs/PackageFSRoot.cpp
	src/add-ons/kernel/file_systems/packagefs/PackageLinkDirectory.cpp
	src/add-ons/kernel/file_systems/packagefs/PackageLinkDirectory.h
	src/add-ons/kernel/file_systems/packagefs/PackageLinkSymlink.cpp
	src/add-ons/kernel/file_systems/packagefs/PackageLinkSymlink.h
	src/add-ons/kernel/file_systems/packagefs/PackageLinksDirectory.cpp
	src/add-ons/kernel/file_systems/packagefs/PackageNode.h
	src/add-ons/kernel/file_systems/packagefs/ResolvableFamily.cpp
	src/add-ons/kernel/file_systems/packagefs/Version.cpp
	src/add-ons/kernel/file_systems/packagefs/Version.h
	src/add-ons/kernel/file_systems/packagefs/Volume.cpp
	src/add-ons/kernel/file_systems/packagefs/Volume.h
	src/add-ons/kernel/file_systems/packagefs/kernel_interface.cpp
	src/add-ons/kernel/file_systems/userlandfs/shared/driver_settings.c
	src/apps/deskbar/BarApp.cpp
	src/apps/deskbar/BarMenuBar.cpp
	src/apps/deskbar/BarMenuBar.h
	src/apps/deskbar/BarView.cpp
	src/apps/deskbar/BarView.h
	src/apps/deskbar/BarWindow.cpp
	src/apps/deskbar/BarWindow.h
	src/apps/deskbar/DeskbarMenu.cpp
	src/apps/deskbar/DeskbarMenu.h
	src/apps/deskbar/DeskbarUtils.cpp
	src/apps/deskbar/DeskbarUtils.h
	src/apps/deskbar/ExpandoMenuBar.cpp
	src/apps/deskbar/ExpandoMenuBar.h
	src/apps/deskbar/TeamMenu.cpp
	src/apps/processcontroller/ProcessController.cpp
	src/apps/remotedesktop/RemoteDesktop.cpp
	src/bin/bash/config-top.h
	src/bin/finddir.c
	src/bin/package/Jamfile
	src/bin/package/command_add.cpp
	src/bin/package/command_create.cpp
	src/bin/package/command_list.cpp
	src/bin/package_repo/command_list.cpp
	src/bin/pkgman/command_refresh.cpp
	src/build/libbe/support/Jamfile
	src/build/libpackage/Jamfile
	src/build/libroot/Jamfile
	src/build/libroot/fs.cpp
	src/build/libroot/remapped_functions.h
	src/kits/locale/MutableLocaleRoster.cpp
	src/kits/opengl/GLRendererRoster.cpp
	src/kits/package/PackageInfo.cpp
	src/kits/package/PackageInfoSet.cpp
	src/kits/package/PackageRoster.cpp
	src/kits/package/PackageVersion.cpp
	src/kits/package/RepositoryCache.cpp
	src/kits/package/hpkg/PackageWriterImpl.cpp
	src/kits/package/hpkg/ReaderImplBase.cpp
	src/kits/package/hpkg/WriterImplBase.cpp
	src/kits/print/PrintTransport.cpp
	src/kits/print/Printer.cpp
	src/kits/screensaver/ScreenSaverRunner.cpp
	src/kits/support/StringList.cpp
	src/kits/tracker/ContainerWindow.cpp
	src/kits/tracker/DeskWindow.cpp
	src/kits/tracker/PoseView.cpp
	src/libs/print/libprint/Transport.cpp
	src/preferences/printers/AddPrinterDialog.cpp
	src/preferences/screensaver/ScreenSaverWindow.cpp
	src/servers/debug/DebugServer.cpp
	src/servers/input/AddOnManager.cpp
	src/servers/media_addon/MediaAddonServer.cpp
	src/system/boot/Jamfile
	src/system/boot/loader/Jamfile
	src/system/boot/loader/loader.cpp
	src/system/boot/loader/vfs.cpp
	src/system/kernel/fs/vfs.cpp
	src/system/kernel/fs/vfs_boot.cpp
	src/system/libroot/os/find_directory.cpp
	src/system/runtime_loader/runtime_loader.cpp
	src/tools/package/Jamfile
2013-05-05 15:03:26 +02:00
Michael Lotz
1a5e87cc64 haiku_loader: Reuse BPlusTree implementation of the BFS add-on.
Instead of having an almost exact, albeit read only, duplicate of the
implementation.
2013-05-02 23:26:03 +02:00
Jérôme Duval
3756e0ac38 kernel: use uint64 instead of int64 to avoid narrowing conversion warnings.
* gdb_register is used only in arch_debug.cpp
2013-04-29 21:20:35 +02:00
Jérôme Duval
311e148798 vfs: fixed two warnings.
* warnings about comparison between signed and unsigned integer expressions.
2013-04-29 20:57:34 +02:00
Michael Lotz
a064168869 Fix truncation of comparison value introduced in 848acd67.
Casting the difference of the two off_t values to size_t may truncate
the result. Doing so before the comparison will therefore break it.
Instead cast the size to off_t to get around the signed versus unsigned
integer expression comparison and then cast the result of the comparison
to size_t again. Should fix #9714.
2013-04-27 18:42:05 +02:00
Jérôme Duval
32d7bcb470 VMAnonymousCache.cpp: use off_t instead of page_num_t
* use off_t instead of page_num_t to fit in swap_hash_key struct.
* this fixes narrowing conversion and signedness warnings on GCC 4.7.
2013-04-27 14:43:20 +02:00
Jerome Duval
dc0e22d800 Revert "VMAnonymousCache.cpp: changed page_index type to page_num_t"
This reverts commit f7176b0ee5. Citing Ingo:
"off_t is the correct type to use for addressing pages in a cache/file,
which page_num_t should only be used for physical pages." I'll see how to
fix the GCC 4.7 warnings differently :)
2013-04-27 13:36:49 +02:00
Jérôme Duval
f7176b0ee5 VMAnonymousCache.cpp: changed page_index type to page_num_t
* consistently use page_num_t for page numbers and off_t for offsets and sizes.
2013-04-26 21:17:39 +02:00
Jérôme Duval
5f08555a59 GCC 4.7.x doesn't allow writes in a referenced packed struct.
* error: cannot bind packed field 'image->preloaded_elf64_image::elf_header'
    to 'ELFLoader<ELF64Class>::EhdrType& {aka Elf64_Ehdr&}'
2013-04-26 21:17:36 +02:00
Jérôme Duval
848acd672c devfs: casts as size_t before comparing.
* error: comparison between signed and unsigned integer expressions.
2013-04-26 21:17:34 +02:00
Jérôme Duval
d762df1df1 GCC 4.7.x doesn't allow setting a field in a referenced packed struct.
* error message: error: cannot bind packed field
'args->kernel_args::platform_args.platform_kernel_args::apm' to 'apm_info&'
* the reason would be that the reference doesn't have alignment information anymore.
* changed the reference to const for read access, and use the long form for setting a field.
2013-04-26 21:17:31 +02:00
Ingo Weinhold
3b5cb32533 find_directory(): Actually handle the new constants 2013-04-24 15:11:16 +02:00
Ingo Weinhold
3f85cfc132 Add a few missing directory_which constants 2013-04-24 14:55:03 +02:00
Pawel Dziepak
26b2423794 runtime_loader: Always map program image at random position 2013-04-24 14:06:05 +02:00
Pawel Dziepak
902d41fc75 util: Use real_time_clock() in secure PRNG 2013-04-24 14:05:28 +02:00
Pawel Dziepak
c36a000cb4 vm: Fix off-by-one mistakes in _InsertAreaSlot 2013-04-24 14:05:27 +02:00
Pawel Dziepak
0fef11f1a8 arch: some CPUID leaves may be not available 2013-04-23 02:43:26 +02:00
Rene Gollent
c24adb2950 Rework DefaultNotificationService registration.
- Instead of implicitly registering and unregistering a service
  instance on construction/destruction, DefaultNotificationService
  now exports explicit Register()/Unregister() calls, which subclasses
  are expected to call when they're ready.

- Adjust all implementing subclasses. Resolves an issue with deadlocks
  when booting a DEBUG=1 build.
2013-04-22 18:42:21 -04:00
Ingo Weinhold
237127fbe4 Fix _user_entry_ref_to_path() in chroot
* Add "bool kernel" parameter to vfs_entry_ref_to_path(), so it can be
  specified for which I/O context the entry ref shall be translated.
* _user_entry_ref_to_path(): Use the calling team's I/O context instead
  of the kernel's. Fixes the bug that in a chroot the syscall would
  return a path for outside the chroot.
2013-04-22 18:06:28 +02:00
Pawel Dziepak
be573dcd88 arch: make sure not to set NX-bit when it is reserved 2013-04-22 17:36:36 +02:00
François Revol
3060b78cfc PPC: Setup debug UART for kernel when booted from U-Boot
Welcome to kernel debugger output!
\o/
2013-04-21 03:29:48 +02:00
François Revol
2e27c020cb U-Boot: Factor-out debug UART setup from FDT for kernel use 2013-04-21 03:28:01 +02:00
François Revol
94b802f588 U-Boot: PPC: Tell the kernel we come in peace from U-Boot 2013-04-21 03:16:46 +02:00
François Revol
0f8e6ba440 Typo 2013-04-21 02:12:12 +02:00
François Revol
18ea985add U-Boot: PPC: set gFDT when passed to the kernel. 2013-04-21 02:08:24 +02:00
François Revol
eecde8e37c Merge branch 'master' into sam460ex 2013-04-21 01:34:20 +02:00
François Revol
247db0d169 U-Boot: pass a copy of the FDT to the kernel 2013-04-21 01:15:43 +02:00
Pawel Dziepak
103977d0a9 arch: NX is initialized too early on non-boot CPUs 2013-04-18 00:15:57 +02:00
Pawel Dziepak
84bb91df83 arch: use PRNGs from kernel utils for initializing stack pointer 2013-04-16 22:35:10 +02:00
Pawel Dziepak
8614737f71 elf: restore correct region protection after relocation 2013-04-16 03:44:38 +02:00
Pawel Dziepak
9f3bd49737 runtime_loader: explicitly randomize rld_heap and _rld_debug_ positions 2013-04-16 02:44:47 +02:00
Pawel Dziepak
db1ca60528 runtime_loader: randomize position of runtime_loader
* make runtime_loader a dynammically linked object
 * add kernel support for loading user images that need to be relocated
 * load runtime_loader at random address
2013-04-16 02:29:05 +02:00
Pawel Dziepak
cf35dcc5bc vm: make aslr use more secure PRNG 2013-04-11 17:16:49 +02:00
Pawel Dziepak
d0a8e6ef2b vm: remove unused static function log2() 2013-04-11 12:32:32 +02:00
Pawel Dziepak
87d1bdb87c util: add secure pseudorandom number generator 2013-04-11 12:31:58 +02:00
Pawel Dziepak
69042ecd1b util: style fixes 2013-04-11 12:15:47 +02:00
Pawel Dziepak
d9fa99bb60 scheduler: let schedulers use kernel utils for random numbers 2013-04-11 04:37:23 +02:00
Pawel Dziepak
5c455f803f vm: let aslr use kernel utils for random numbers 2013-04-11 04:35:11 +02:00
Pawel Dziepak
6003243ef3 util: introduce kernel utils for pseudorandom number generation
Currently there are two generators. The fast one is the same one the scheduler
is using. The standard one is the same algorithm libroot's rand() uses. Should
there be a need for more cryptographically PRNG MD4 or MD5 might be a good
candidates.
2013-04-11 04:34:59 +02:00
Pawel Dziepak
feae2b5a00 vm: force userland to use B_RANDOMIZED_* address specifications 2013-04-09 23:25:19 +02:00
Pawel Dziepak
bf65fc1dfe vm: remove B_RANDOMIZED_IMAGE_ADDRESS address specification
This address specification is actually not needed since PIC images can be
located anywhere. Only their size is restriced but that is the compiler and
linker concern. Thanks to Alex Smith for pointing that out.
2013-04-09 22:09:13 +02:00
Pawel Dziepak
d57105534b vm: several improvements to VMUserAddressSpace::_InsertAreaSlot implementation
* B_BASE_ADDRESS honors requested alignment
 * end of range is honored
 * B_BASE_ADDRESS reuses B_ANY_ADDRESS code
2013-04-08 23:56:10 +02:00
Ingo Weinhold
5b6fb78c40 VFS: _kern_open_dir(): Fix NULL path case
It would create an empty path buffer and pass that on to dir_open(),
which accepts NULL, but not empty paths.
2013-04-05 19:19:20 +02:00
Ingo Weinhold
d482342399 VM: Fix vm_block_address_range() area protection
B_ALREADY_WIRED, which was erroneously passed for the area protection
parameter to map_backing_store(), has the value 7 which implies user
readable and writable. Hence the address ranges around 0xdeadbeef and
0xcccccccc could actually be read and written from anywhere.
2013-04-05 16:58:50 +02:00
Pawel Dziepak
4cafc0acab runtime_loader: use long type for region delta 2013-04-04 20:54:13 +02:00
Pawel Dziepak
65ed4fa908 vm: implement B_RANDOMIZED_IMAGE_ADDRESS address specification
On some 64 bit architectures program and library images have to be mapped in
the lower 2 GB of the address space (due to instruction pointer relative
addressing). Address specification B_RANDOMIZED_IMAGE_ADDRESS ensures that
created area satisfies that requirement.
2013-04-04 20:54:02 +02:00
Pawel Dziepak
f697412ff8 vm: place commpage and team data near the top of user address space
Placing commpage and team user data somewhere at the top of the user accessible
virtual address space prevents these areas from conflicting with elf images
that require to be mapped at exact address (in most cases: runtime_loader).
2013-04-04 15:27:24 +02:00
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