[haiku-commits] haiku: hrev44862 - in src: libs/x86emu bin/gdb/bfd/config-x86_64 system/kernel/arch/x86 . system/libroot/posix/glibc/arch/generic

  • From: alex@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 18 Nov 2012 20:47:19 +0100 (CET)

hrev44862 adds 257 changesets to branch 'master'
old head: 2efebaa1d1614d772f565650bbe625c5766e312f
new head: 30afb18c8f2ac5d063924bc4e6239bf7c1c7d192
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=30afb18+%5E2efebaa

----------------------------------------------------------------------------

65ad1ba: Made it possible to build the bootloader when targetting x86_64.
  
  * x86_64 is using the existing *_ia32 boot platforms.
  * Special flags are required when compiling the loader to get GCC to compile
    32-bit code. This adds a new set of rules for compiling boot code rather
    than using the kernel rules, which compile using the necessary flags.
  * Some x86_64 private headers have been stubbed by #include'ing the x86
    versions. These will be replaced later.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

07b3311: Merge branch 'master' into x86_64

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

2f3e39b: Fixed copyright date on arch_config.h.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

0d916c3: x86_64: added linker script for the kernel.
  
  * Based on the x86 one, changes made to match the default GCC x86_64 linker
    script and correct kernel load address added.
  * Not tested yet as the kernel doesn't fully compile.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

23d8784: Made *_addr_t {,un}signed long rather than long long on x86_64.
  
  * long is 64-bit on x86_64.
  * Makes addr_t compatible with size_t.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

0e88a88: First round of 64-bit safety fixes in the kernel.
  
  * Most of this is incorrect printf format strings. Changed all strings
    causing errors to use the B_PRI* format string definitions, which
    means the strings should be correct across all platforms.
  * Some other fixes for errors, casts required, etc.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

f76bc43: Added some x86_64 system/kernel headers and kernel Jamfiles.
  
  * Not all of these headers are correct yet, just adding what's necessary
    to get things to compile for the time being.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

ced5037: Merge branch 'master' into x86_64

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

11d3892: Changed ICI data argument types from uint32 to addr_t.
  
  Since ICI arguments are used to send addresses in some places, uint32 is
  not sufficient on x86_64. addr_t still refers to the same type as uint32
  (unsigned long) on other platforms, so this change only really affects
  x86_64.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

40e20c1: Added gensyscalls headers for x86_64.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

4be4fc6: More 64-bit compilation/safety fixes.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

82b4b37: Added a TODO in to say that {,u}int64 should be changed to long on 
x86_64.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

f4f0f79: Merge branch 'master' into x86_64

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

73f27ec: Implementations of some libroot functions for x86_64.
  
  These are the functions required by the kernel. These are all full
  implementations except for system_time(), which will be implemented later.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

8c0e3c9: Add -mno-red-zone to the kernel CCFLAGS/C++FLAGS.
  
  The red zone is a 128-byte area below the stack pointer specified by the
  AMD64 ABI that can be used by leaf functions for their stack frame without
  modifying the stack pointer. It is guaranteed not to be modified by signal
  handlers. This cannot be used in kernel mode code, as an interrupt handler
  could overwrite it, so stop GCC from generating code that uses it.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

146f966: Fixed a mistake in 11d3892, changed a parameter type to addr_t that 
shouldn't have been changed.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

043c61d: Added stub versions of everything needed to build the kernel.
  
  The whole kernel now builds and there are no undefined references when
  linking, I just need to fix some strange relocation errors I'm getting
  (probably a problem with the linker script) and then I'll have a kernel
  image.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

6296722: Fixed incorrect link address in kernel linker script.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

e114f50: Fixed bootloader build under x86_64.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

7c488bf: Modified the floppy boot image target so that it can be used to build 
an x86_64 boot image.
  
  * set_haiku_revision doesn't currently support ELF64, don't use a
    revisioned kernel image on x86_64 for now.
  * Don't try to build add-ons for x86_64 yet.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

cfd1c18: Add -march=pentium to boot {CC,C++}FLAGS on x86_64, prevents GCC from 
generating SSE code.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

7417d5e: Made the bootloader search for both kernel_x86 and kernel_x86_64 when 
built for x86 or x86_64.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

93cb953: Don't store a KMessage in kernel_args for the boot volume, only the 
buffer address/size.
  
  Pointers in kernel_args are going to be changed to unconditionally use 64-bit
  storage (to make kernel_args compatible with both the x86 and x86_64 kernels).
  KMessage stores a pointer to its buffer, however since KMessage is used
  outside of the boot code it is undesirable to change it to use 64-bit storage
  for the pointer as it may add additional overhead on 32-bit builds. Therefore,
  only store the buffer address and size and then construct a KMessage from
  those in the kernel.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

192af9e: Changed addr_range to use uint64.
  
  I've tested this change on x86, causing no issues. I've checked over the code
  for all other platforms and made the necessary changes and to the best of my
  knowledge they should also still work, but I haven't actually built and
  tested them. Once I've completed the kernel_args changes the other platforms
  will need testing.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

d8efc6c: Changes to kernel_args to make it identical for x86 and x86_64.
  
  * Added a FixedWidthPointer template class which uses 64-bit storage to hold
    a pointer. This is used in place of raw pointers in kernel_args.
  * Added __attribute__((packed)) to kernel_args and all structures contained
    within it. This is necessary due to different alignment behaviour for
    32-bit and 64-bit compilation with GCC.
  * With these changes, kernel_args will now come out the same size for both
    the x86_64 kernel and the loader, excluding the preloaded_image structure
    which has not yet been changed.
  * Tested both an x86 GCC2 and GCC4 build, no problems caused by these changes.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

5915eeb: Some improvements to the previous changes made to vfs_boot.cpp 
suggested by Ingo.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

17a3389: Remove phys_addr_range, just use addr_range for both virtual and 
physical address ranges (as requested by Ingo).

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

1651dd7: Merge branch 'master' into x86_64

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

17e407e: Proper implementation of arch_kernel.h for x86_64.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

6b87898: Code style fixes.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

474aa3b: Added ELF64 headers, common ELF32 and ELF64 definitions moved to 
elf_common.h.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

62d36f9: Removed the addr_t conversion operators from FixedWidthPointer which 
makes comparison against NULL work properly.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

f124497: Added an ELF64 version of preloaded_image.
  
  * There is now 2 structures, preloaded_elf32_image and preloaded_elf64_image,
    which both inherit from preloaded_image.
  * For now I've just hardcoded in use of preloaded_elf32_image, but the
    bootloader ELF code will shortly be converted to use templates which use
    the appropriate structure. The kernel will be changed later when I add
    ELF64 support to it.
  * All kernel_args data is now compatible between 32-bit and 64-bit kernels.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

3a2a336: Support static_cast on FixedWidthPointer.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

ccadfae: Changed the boot ELF code to use templates and added ELF64 support.
  
  The actual implementation of the ELF loading methods have been put into
  an ELFLoader template class that takes a single template parameter, which
  is a structure containing all the necessary ELF typedefs. It's a bit
  verbose, but I thought it was a neater solution than using a bunch of
  standalone functions with a huge number of template parameters. There is
  no change to code outside of elf.cpp, the ELF32/ELF64 differences are
  handled internally.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

69a8b95: FixedWidthPointer: Fix ==/!= operators, remove OtherType casts
  
  * FixedWidthPointer:
    - operators ==/!=: Change second operand type from void* to const
      Type*. Also add non-const version to resolve ambiguity warning when
      comparing with non-const pointer.
    - Add Pointer() getter.
    - Remove templatized cast operators. They are nice for casting the
      pointer directly to another pointer type, but result in ambiguity.
  * Make preloaded_image::debug_string_table non-const. Avoids clashes of
    the const and non-coast FixedWidthPointer comparison operators. A
    cleaner (but more verbose) solution would be to spezialize
    FixedWidthPointer for const types.

                                    [ Ingo Weinhold <ingo_weinhold@xxxxxx> ]

acda52f: Fixes for other platforms.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

035825c: Align the start of the kernel .data to a 2MB boundary, prevents ld 
from merging the text and data PHDRs.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

c2656eb: Improved elf_load_image() a bit.
  
  After enabling BOOT_SUPPORT_ELF64 on x86 the x86 kernel could no longer be
  booted because too many kernel_args allocations were taking place and filling
  kernel_args_ranges. This was because for each image load it would check if
  the image is ELF64, fail and fall back to ELF32 (each ELF64 check allocated
  a preloaded_image). Changed elf_load_image() so that it only tries both when
  loading the kernel image, and then for modules it will only try the same ELF
  class as the kernel image.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

f6a3444: Added x86_64 ELF64 relocation functions for the bootloader. All that's 
left to do now is handle the 64-bit load address properly.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

8846189: Handle 64-bit load addresses for ELF64 images in the bootloader.
  
  The ELF loader now uses a new platform function, platform_allocate_elf_region,
  which returns 2 addresses: the real load address and an address where the
  region is mapped in the loader's address space. All of the ELF loading code
  has been changed to access the load region through the mapped address rather
  than the addresses contained in the ELF image. The ELF64 version of
  platform_allocate_elf_region on x86 uses the existing MMU code, which maps
  everything at 0x80000000, but returns the correct 64-bit address. The long
  mode switch code will just set up the 64-bit address space with everything
  remapped at the correct address.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

6f6d78e: Cleaned up ELF64 address handling.
  
  * platform_allocate_elf_region() is removed, it is implemented in platform-
    independent code now (ELF*Class::AllocateRegion). For ELF64 it is now
    assumed that 64-bit addresses are mapped in the loader's 32-bit address 
space
    as (address - KERNEL_BASE_64BIT + KERNEL_BASE).
  * mapped_delta field from preloaded_*_image removed, now handled compile-time
    using the ELF*Class::Map method.
  * Also link the kernel with -z max-page-size=0x1000, removes the need for
    2MB alignment on the data segment (not going to map the kernel with large
    pages for the time being).

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

f69dd48: Fixed x86 GCC2 build.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

5a17b2f: Forgot to change driver_settings_file to use FixedWidthPointer.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

a820f12: Style fixes to elf.cpp.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

e5fc2bf: Implemented long mode setup/switch code, the bootloader can now start 
the 64-bit kernel!
  
  The setup procedure is fairly simple: create a 64-bit GDT and 64-bit page
  tables that include all kernel mappings from the 32-bit address space, but at
  the correct 64-bit address, then go through kernel_args and changes all 
virtual
  addresses to 64-bit addresses, and finally switch to long mode and jump to the
  kernel.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

991e5be: Pass correct kernel_args address to the kernel.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

b8a9a3a: Copied the x86 debug console functions to x86_64.
  
  Note that this is only temporary so that I have serial output from the kernel,
  the x86 and x86_64 versions will be merged later.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

3f017e9: Also need to fix the kernel_args_range addresses.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

3403f23: Moved the common parts of arch_cpu.h between x86 and x86_64 to 
arch/common_x86/cpu.h.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

575a67c: Merge branch 'master' into x86_64

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

45e0e08: Made panic() safe to use before the current thread has been set.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

014f440: Use unsigned long, not uint32, for the 'l' qualifier in printf() - 
long is 64-bit on x86_64.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

c9f6d22: x86_64: Implemented exception handling.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

0705884: Style fixes.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

294711f: Changed {,u}int64 to be long rather than long long on x86_64.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

120585d: Merge branch 'master' into x86_64

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

4f78437: Style fix.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

da80a05: Preparation for merge of x86 and x86_64 kernel sources.
  
  Since x86 and x86_64 share a lot of common code, x86_64 kernel sources/headers
  are going to reside under headers/private/kernel/arch/x86 and
  src/system/kernel/arch/x86 along with the existing x86 code. This commit
  changes the build system to handle this. A new variable, TARGET_KERNEL_ARCH,
  has been added. This is the name of the kernel/boot architecture directory
  name, set to x86 on both x86 and x86_64. This is now used in all places where
  TARGET_ARCH was used to get to kernel arch sources/headers (I've changed
  everything necessary as far as I can tell). Kernel won't build for x86_64
  at the moment as the sources have not been merged, loader does.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

0897e31: Merged x86_64 headers into x86 headers.
  
  Not many changes seeing as there's not much x86_64 stuff done yet. Small
  differences are handled with ifdefs, large differences (descriptors.h,
  struct iframe) have separate headers under arch/x86/32 and arch/x86/64.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

020a25c: Fixed x86_64 kernel compilation.
  
  For now I've just put all the stub functions that are needed to link the
  kernel into a file called stubs.cpp. I've not yet moved across the interrupt
  handling code or the ELF64 relocation code to the x86 directory. Once those
  have been moved I can get rid of the x86_64 headers/source directories.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

90907c3: Moved ELF64 relocation functions to x86 arch_elf.cpp.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

22fe9b2: Merge branch 'master' into x86_64

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

4f419b5: Merged in the x86_64 exception handling.
  
  I've split the 32-bit dependent IDT setup code and ASM interrupt handlers to
  the 32 subdirectory, arch_int.cpp now contains only the generic hardware
  interrupt handling code.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

c005e74: Removed the x86_64 headers/source directories, now all merged with x86.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

cbfe5fc: Removed redundant x86 sources/headers.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

4e8fbfb: x86_{read,write}_cr{0,4} can just be implemented as macros, put an 
x86_ prefix on the other read/write macros for consistency.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

4304bb9: Added arch_cpu.cpp to the x86_64 build.
  
  * Some things are currently ifndef'd out completely for x86_64 because
    they aren't implemented, there's a few other ifdef's to handle x86_64
    differences but most of the code works unchanged.
  * Renamed some i386_* functions to x86_*.
  * Added a temporary method for setting the current thread on x86_64
    (a global variable, not SMP safe). This will be changed to be done
    via the GS segment but I've not implemented that yet.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

428b9e7: Check whether gX86PagingMethod is NULL in 
arch_vm_translation_map_is_kernel_page_accessible.
  
  This means that the kernel debugger won't cause a recursive panic if a
  panic occurs before vm_init().

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

4988ca5: Build arch_vm.cpp for x86_64. No changes required except for 
temporarily disabling bios_init call.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

950b24e: Begun work on VMTranslationMap implementation for x86_64.
  
  * Added empty source files for all the 64-bit paging method code, and a
    stub implementation of X86PagingMethod64Bit.
  * arch_vm_translation_map.cpp has been modified to use X86PagingMethod64Bit
    on x86_64.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

e70dd7e: Map all physical memory in the long mode paging setup.
  
  Since x86_64 has such a large virtual address space all available physical
  memory can be mapped in to it. The physical page mapper implementation for
  x86_64 will use this mapping. Also changed the mapping code to map kernel
  pages with the global flag.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

a8f85e6: Removed accidently left in debug message.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

40aeaeb: Should enable CR4.PGE while switching to the kernel.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

d687d8a: Implementation of VMPhysicalPageMapper for x86_64 using the permanent 
physical memory mapping.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

78d482e: Style fixes.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

2f36ef5: Fixed the x86_64 setjmp implementation.
  
  * typedef for jmp_buf was using int where it should be long.
  * setjmp was clearing the buffer pointer rather than the signal mask before
    calling sigsetjmp.
  * KDL now works without crashing on x86_64.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

0da10c8: Some fixes to the long mode switch code.
  
  * Wasn't storing the fixed virtual address of the PML4 in kernel_args.
  * After switching to long mode, reload GDTR with the virtual address of
    the GDT. This was working fine until now because the physical address
    was identity mapped, but broke as soon as I removed the identity
    mapping.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

898b29e: Added temporary stack trace function to x86_64.
  
  Will be merged with the x86 one later on. Requires -fno-omit-frame-pointer on
  the kernel build flags, GCC defaults to not generating stack frames on x86_64.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

1671cfd: Improved stack tracer, traces over iframes.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

11d35d1: Fixed tracing printf formats in VM code.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

e276cc0: Finished implementation of x86_64 paging.
  
  * vm_init now runs up until create_preloaded_image_areas(), which needs
    fixing to handle ELF64.
  * Not completely tested. I know Map(), Unmap() and Query() work fine, the
    other methods have not been tested as the kernel doesn't boot far enough
    for any of them to be called yet. As far as I know they're correct, though.
  * Not yet implemented the destructor for X86VMTranslationMap64Bit or Init()
    for a user address space.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

ab7726a: Temporary fix for create_preloaded_image_areas. Will be replaced with 
a typedef later on.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

84bf29f: Compile in arch_platform.cpp for x86_64. The apm_init call is disabled 
for x86_64, APM is 32-bit only.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

15feb60: A few improvements suggested by Ingo.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

c151762: Compile APIC and timer code for x86_64, and create an area for the IDT.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

7444a55: Merge branch 'master' into x86_64

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

5c7d521: Implemented system_time() for x86_64.
  
  * Uses 64-bit multiplication, special handling for CPUs clocked < 1 GHz
    in system_time_nsecs() not required like on x86.
  * Tested against a straight conversion of the x86 version, noticably
    faster with a large number of system_time() calls.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

cc248cf: A couple of bug fixes.
  
  * mmu_get_virtual_mapping() should check that the page directory entry is
    present rather than assuming there's a page table there. This was resulting
    in some invalid mappings being created in the 64-bit virtual address space.
  * arch_vm_init_end() should clear from KERNEL_LOAD_BASE to virtual_end, not
    from KERNEL_BASE. On x86_64 this was causing it to loop through ~512GB of
    address space, which obviously was taking quite a while.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

93cba1d: Fixed a bug resulting from a mistake in the boot 64-bit paging setup.
  
  This was an interesting bug to find. Was getting spurious triple faults
  in the slab allocator. The problem was that the boot paging setup code
  was mapping all page tables it created into the virtual address space,
  but in the kernel no areas were being created to cover them, so during
  arch_vm_init_end() the pages for them ended up being freed and then
  overwritten later on. Fixed by unmapping page tables after populating
  them in long_mmu_init().

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

bc30934: Changes suggested by Ingo: style fix, and a system_time optimization.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

3b80262: Support ELF64 in the kernel.
  
  This has been done by adding typedefs in elf_common.h to the correct ELF
  structures for the architecture, and changing all Elf32_* uses to those
  types. I don't know whether image loading works as I cannot test it yet,
  there may be some 64-bit safety issues around. However, symbol lookup for
  the kernel is working correctly.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

ee7aba5: Print symbol information in a stack trace.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

5e9bb17: Renamed remaining i386_* functions to x86_* for consistency.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

8c5e747: Don't need to shift the factor in system_time(), just store the 
already shifted value.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

85d4a8b: Fixed compilation of C code using ELF headers.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

b5c9d24: Implemented threading for x86_64.
  
  * Thread creation and switching is working fine, however threads do not yet
    get interrupted because I've not implemented hardware interrupt handling
    yet (I'll do that next).
  * I've made some changes to struct iframe: I've removed the e/r prefixes
    from the member names for both 32/64, so now they're just named ip, ax,
    bp, etc. This makes it easier to write code that works with both 32/64
    without having to deal with different iframe member names.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

c8049a8: Enabled hardware interrupt handler, timers now work and threads are 
preempted.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

5670b0a: Moved the 32-bit page fault handler to arch_int.cpp, use it for x86_64.
  
  A proper page fault handler was required for areas that were not locked
  into the kernel address space. This enables the boot process to get
  up to the point of trying to find the boot volume.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

609b308: Return B_NOT_SUPPORTED for shutdown if ACPI is unavailable (no APM on 
x86_64).

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

fc64410: Merge branch 'master' into x86_64

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

d776fd5: Implemented arch_cpu_user_*() for x86_64, based on the x86 versions.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

659baca: Compile arch_real_time_clock.cpp and arch_system_info.cpp for x86_64.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

76a1175: Support for SMP on x86_64.
  
  No major changes to the kernel: just compiled in arch_smp.cpp and fixed the
  IDT load in arch_cpu_init_percpu to use the correct limit for x86_64 (uses
  sizeof(interrupt_descriptor)). In the boot loader, changed smp_boot_other_cpus
  to construct a temporary GDT and get the page directory address from CR3, as
  what's in kernel_args will be 64-bit stuff and will not work to switch the
  CPUs into 32-bit mode in the trampoline code. Refactored 64-bit kernel entry
  code to not use the stack after disabling paging, as the secondary CPUs are
  given a 32-bit virtual stack address by the SMP trampoline code which will
  no longer work.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

c3f0fd2: Fixed formatting of output in some debugger commands.
  
  Currently all debugger commands assume 32-bit pointers when formatting their
  output. This means that on x86_64 the output is incorrectly formatted. Fixed
  this by adding a B_PRINTF_POINTER_WIDTH definition (16 on 64-bit, 8 on
  32-bit), and using this to correctly format the output. Not all commands have
  been fixed yet, but all VM, slab, VFS, team, thread and image commands should
  be correct.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

98614a9: Merge branch 'master' into x86_64

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

6ba74ba: Fixed compilation of the boot loader on GCC 2.
  
  Not sure why but GCC 2 seems to be ignoring the extern "C" in smp.h when
  compiling smp_boot_other_cpus() resulting in undefined references. Fixed
  by putting extern "C" on the definition too.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

5774b5a: C++ified remaining C users of arch_cpu.h.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

d38f130: Cleaned up 32-bit descriptors.h.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

6e06fa6: Added missing validity check on relocation address.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

4ebc6df: Moved some 32-bit specific stuff to the 32 subdirectory.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

8a65fed: Merge branch 'master' into x86_64
  
  Conflicts:
        src/system/kernel/arch/x86/arch_debug.cpp

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

e690e5a: Proper fix for GCC 2 compilation error that was fixed earlier, cause 
pointed out by Ingo.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

bcb07a3: Implemented the rest of the kernel debugger functions for x86_64.
  
  Merged with the x86 implementations, mostly the same except for a
  few differences. GDB stub is currently broken, will investigate
  later.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

368f253: Merge branch 'master' into x86_64

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

b2cd72d: Implemented arch_debug_call_with_fault_handler for x86_64.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

0cbce9a: A few 64-bit fixes for ELF/module code.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

385d69f: Made it possible to build kernel modules for x86_64.
  
  Added the necessary build flags for modules, and added a module (dpc)
  to the floppy image for x86_64 builds for testing purposes. The module
  gets loaded correctly and its code runs without issue. Only non-trivial
  addition is the different method for generating kernel.so, this is
  explained in the kernel Jamfile.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

2865db3: Compile msi.cpp for x86_64.
  
  Needed to link the PCI module, not enabling it yet though, I'm not
  sure whether everything needed for it is in place yet.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

9d4e925: Support x86_64 in config_manager.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

12bd781: Ported PCI module to x86_64.
  
  Uses the x86 architecture code, made fixes to printf formats and a
  couple of 64-bit fixes. Only potentially intrusive change is that I've
  changed PCI.h to use uint32 rather than ulong. I don't see any way
  this would cause any issues, though.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

1b41387: Added missing packed attributes on disk_identifier.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

d7ec2fa: A couple of format string fixes for tracing printfs.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

0063d2b: Various 64-bit fixes to SCSI and ATA bus managers/drivers.
  
  Mostly compilation fixes, as well as a few 64-bit safety fixes. I've
  briefly looked through everything for any obvious issues and fixed
  the ones I've found, and it seems like they're working properly, though
  there could be some more well hidden ones that I've missed.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

7f7e76e: 64-bit compilation fixes for write_overlay and intel partitioning 
system modules.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

a9fdaec: Added disk drivers and CD file system modules to the boot image for 
x86_64.
  
  This adds disk drivers, intel/session partitioning systems, and ISO9660
  (+ write/attribute_overlay) modules to the CD/floppy boot image targets
  for x86_64. The kernel now detects and mounts the boot CD, and runs up
  to attempting to start the boot script.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

82694bd: Merge branch 'master' into x86_64
  
  Conflicts:
        headers/posix/arch/x86_64/arch_setjmp.h
        src/system/kernel/cache/block_cache.cpp

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

4451c47: Compile generic_x86 CPU module for x86_64.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

6497f6b: Moved the exception handling functions to arch_int.cpp, shared between 
x86 and x86_64.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

5234e66: Optimized memcpy/memset for x86_64.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

5f6b522: Merge branch 'master' into x86_64

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

195a0f3: Changed argument type of fcntl syscall from uint32 to size_t.
  
  Since this argument may be used to pass pointers, uint32 is not
  correct for 64-bit. Effectively no change on 32-bit targets, both
  size_t and uint32 are unsigned long there.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

59ae45c: Fixed commpage for x86_64.
  
  Since the commpage is at a kernel address, changed 64-bit paging code
  to match x86's behaviour of allowing user-accessible mappings to be
  created in the kernel portion of the address space. This is also
  required by some drivers.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

1c24eba: 64-bit compilation fixes for BFS, add to x86_64 boot image.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

700c8d3: Support building images for x86_64.
  
  Added a temporary Haiku64Image file that gets included instead of
  HaikuImage when building for x86_64, which I will add to as I port
  stuff. Images currently only include the boot loader, kernel and
  a bunch of add-ons.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

5afce63: Demangle symbols in stack traces.
  
  Since the demangle debugger extension now gets loaded when booting
  from an image, use it in stack traces. Can't print argument values
  like on x86, however, since x86_64 uses registers to pass the first
  6 arguments rather than the stack we can't easily get to them.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

aef19e3: Implemented creation and destruction of user translation maps.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

fd9f32c: Added some libroot bits for x86_64.
  
  Still some parts missing (the glibc bits + fenv.c), plus the TLS
  functions are only stubs.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

fe2e732: Avoid an unnecessary mov on syscalls with < 4 arguments.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

07c6bd6: Format string fixes for TRACE_{THREAD,TEAM}.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

370ab57: Initial userland support for x86_64.
  
  Userland switch is implemented, as is basic system call support (using
  SYSCALL/SYSRET). The system call handler is not yet complete: it doesn't
  handle more than 6 arguments, and does not perform all the necessary kernel
  entry/exit work (neither does the interrupt handler). However, this is
  sufficient for runtime_loader to start and print some debug output.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

6f1f972: Finished system call handler.
  
  The interrupt and system call handlers now perform all the necessary
  kernel entry/exit work, and the system call handler now handles calls
  with more than 6 arguments. Debugging and system call tracing hooks
  are not yet called, will be added when user debugging gets implemented.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

ce35b7a: Fixed broken build for x86.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

e3ac258: Changed runtime_loader to use elf_* typedefs over Elf32_*.
  
  This means that it will be using ELF64 types on x86_64 rather than
  ELF32. The next step for supporting x86_64 is to implement relocations.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

5f119ed: Added x86_64 glue code.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

3fde535: Updated x86_64 fenv.h and added fenv.c.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

04c1e6d: ASM code fixes for PIC compilation.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

a3210bb: Added x86_64 math functions to libroot.
  
  These have been pulled from glibc 2.10, the last version before a
  bunch of changes were made that would have made porting more difficult.
  None of this has been tested yet, it is not currently possible to do
  so: I'm just trying to get libroot compiling so that I can work on the
  runtime loader. I will test them when I am able to.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

c3b03e5: 64-bit fixes to Hoard.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

e453c0f: 64-bit printf warning fixes in libroot.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

0efc5e7: Merge branch 'master' into x86_64

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

bd8b78e: Added a dumb TLS implementation rather than printing an error.
  
  Will properly implement TLS soon, for now a "working" implementation
  is needed for anything to work properly.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

12b3e8a: Support x86_64 in the runtime loader.
  
  * Added x86_64 linker script and relocation code.
  * Some 64-bit safety fixes to the heap code.
  * Added runtime_loader, libroot and bash to the x86_64 image. The boot
    script will be launched, but will panic shortly after because fork
    is broken.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

6e2f6d1: Changed cookie type for get_next_area_info() to ssize_t.
  
  The cookie is used to store the base address of the area that was just
  visited. On 64-bit systems, int32 is not sufficient. Therefore, changed
  to ssize_t which retains compatibility on x86 while expanding to a
  sufficient size on x86_64.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

03add8e: Implemented TLS for x86_64.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

afde37f: Prevent allocating address 0 when inserting an area with B_ANY_ADDRESS.
  
  The USER_BASE_ANY definition exists to specify where to start searching
  for B_ANY_ADDRESS allocations, but this was not being used correctly.
  On x86_64, this was causing the runtime loader's heap to be allocated
  at address 0 so NULL pointer accesses were not getting caught.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

e27109c: Merge branch 'master' into x86_64

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

bd16f0d: Fixed configure for legacy buildtools.
  
  The elfedit tool doesn't exist with the old binutils, so configure was
  failing when it tried to get the path to it. Only try to search for it
  if building GCC 4.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

5568c50: Added coreutils to the x86_64 image.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

c0d28c0: Implemented signals for x86_64.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

ef67788: Ported ISA bus manager and PS/2 driver.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

9be774b: Compilation and 64-bit fixes to libbe.so sources.
  
  Fixed the usual issues - printf format strings, uint32 instead of
  addr_t, etc. One thing that isn't so nice is several places where
  BList is used to store (u)int32, these require a double cast to addr_t
  then void* to silence a warning on x86_64.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

533f3bb: Support x86_64 in sysinfo.
  
  Just changed all #ifdef __INTEL__ to __INTEL__ || __x86_64__, and
  fixed all the printf format strings. The CPU detection code all
  works the same.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

a1a38e8: Retry a few times if opening keyboard fails in consoled.
  
  I'm using consoled at the moment without input_server having been run,
  so when it starts the input drivers will not have been loaded. Have to
  retry a few times with delays so that the input devices have a chance
  to appear.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

666b46e: Added libbe, ICU and consoled to the image.
  
  The boot script now launches consoled instead if app_server does not
  exist, so there is now an interactive Bash prompt! libbe requires ICU,
  which is an optional package, so I've built the packages and they've
  been uploaded to haiku-files.org (thanks umccullough).

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

02dd323: Better names for syscall/signal functions copied to the commpage.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

3cd66dd: Fix CID 712419, 712420, 712421, 712422: Unintentional sign extension 
to 64 bits.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

d4ec857: Merge branch 'master' into x86_64

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

e6b3188: Merge branch 'master' into x86_64

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

8110732: Added some more binaries to the image.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

9a5503d: 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.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

b777727: Changed x86_64 toolchain target to x86_64-unknown-haiku.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

d93ed09: 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.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

50cedfd: Build registrar for x86_64.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

a9ee7a5: Added new BIOS module for calling BIOS interrupts.
  
  This module provides an interface for drivers to use to perform calls
  to the BIOS (only really for use by graphics drivers which need to use
  the VESA BIOS). It uses the x86emu library from X.org which emulates
  a real mode x86 CPU. This is necessary for x86_64 as virtual 8086 mode
  no longer exists there.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

b28f734: Remove line copied from old vm86 code that shouldn't be there.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

9f90e8a: Updated drivers to use BIOS module instead of vm86.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

74bda98: Killed off vm86 code, no longer being used.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

9bfe064: GCC 2 compilation fix for x86emu.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

54393c0: Merge branch 'master' into x86_64

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

92f09f1: Added AHCI driver to image.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

70ee5a7: Moved x86emu to {src,headers}/libs/.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

25871c6: Removed Thread::fault_callback, no longer necessary now that vm86 is 
gone.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

57ab039: 64-bit fixes for input_server.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

049d149: Handle 64-bit types correctly.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

f429464: User symbol lookup works now on x86_64.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

3fed1a1: Get app_server working on x86_64.
  
  With this commit, app_server now compiles and runs at boot! Nothing
  particularly interesting happens, just the blue background and a mouse
  pointer. Remote backends are broken and not compiled in, see #8834.
  Note that it won't be possible to build this quite yet, need to get
  the FreeType package uploaded.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

e5363c9: Style fix.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

adf8818: Compilation fixes for Terminal, add to image.
  
  It runs, but has shown up various bugs: app_server crashes, kernel
  panics, rendering problems. Working on fixing these now.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

284d75b: Merge branch 'master' into x86_64

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

e1be7d0: Fixed a 64-bit calculation error.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

cc30eec: System call restart support.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

d8b4cfc: Get USB functional on x86-64.
  
  - Various changes to printf format specifiers to make them 32/64 safe.
  - Adjustments to various descriptor structures since addr_t is not 32-bit
    on x86-64, and consequently this breaks the physical structure that's
    expected. Also adjusted padding to accomodate 32-byte boundaries when
    64-bit pointers are in use.
  - Adjustments to make use of phys_addr_t where needed.

                                      [ Rene Gollent <anevilyak@xxxxxxxxx> ]

abfb41a: Added USB modules to image.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

44672ad: Add usb_hid to image and get it building/working.

                                      [ Rene Gollent <anevilyak@xxxxxxxxx> ]

2997a19: Fixed UHCI for x86_64.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

c802257: Merge branch 'master' into x86_64

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

2b883e1: Fix compilation of OHCI on x86.
  
  Fixes were needed to go with the USB stack changes. Haven't tested it
  yet because I don't have a a machine with OHCI, but I doubt there
  will be any problems.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

8a19033: 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.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

a731ad1: ELF64 and x86_64 support in the debug kit.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

a3802ca: x86_64 support for GDB.
  
  As mentioned in one of the previous commits, breakpoints don't work
  properly yet, and I haven't done much extensive testing yet, but the
  basic functionality works.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

a5e96a3: Merge branch 'master' into x86_64

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

f3e4f18: Debugging fixes.
  
  * INT3 had the wrong DPL set in the IDT, could not be raised from
    userland.
  * Need the debug server running.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

fa6327c: 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.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

c0166cf: Should check for ELF_CLASS, not ELFCLASS32.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

4b8a51c: Fixed incorrect sizeof in LinkReceiver::ReadRegion.
  
  The type of BRegion::fCount is long, and ServerLink sends/receives it
  with sizeof(long), but LinkReceiver was using sizeof(int32). Due to
  long being 64 bit this was resulting in a mismatch. This fixes the
  drawing problems on x86_64.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

e963289: Added Tracker and Deskbar to x86_64 build.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

5084d0d: Added more things to x86_64 image.
  
  Some preference apps, mount_server and AboutSystem. Removed the check
  for x86_64 in the boot script, the normal path through the script will
  work now. Also removed a temporary hack to workaround AboutSystem not
  being there in build_haiku_image.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

81aad16: Fixed type mismatch in picture data.
  
  The size of an operation block was written as size_t by PictureDataWriter
  but read as int32 by PicturePlayer. Fixes an app_server crash.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

2b861dd: Added translator add-ons.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

6d796a8: Fixed up network stack and drivers for x86_64.
  
  * Various compilation fixes.
  * Fixes to the FreeBSD compatibility layer (from comparing the x86-
    specific bits with the equivalent amd64 sources in FreeBSD).
  * Compile all the Ethernet drivers except for sis900 and wb840, these
    require a bit more work to fix (will file a ticket soon). Tested
    ipro1000 and rtl81xx, no issues.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

ac4525b: Changed BRegion to use int32 instead of long.
  
  There is no need for fCount and fDataSize to be long, not going to have
  more than 2^32 rectangles in a region. Thanks Axel for pointing that
  out.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

8098ef4: Added Network preferences.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

d384cac: Support ELF64 in set_haiku_revision.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

e1c748e: Revert "Fixed type mismatch in picture data."
  
  This reverts commit 81aad168f87486149f6e4ce8acc43e3e7a5de9e1.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

efffcb2: Better fix for picture data type mismatch.
  
  Should use a fixed-size type (int32) rather than a platform-dependent
  one.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

b067b28: Fix expr from coreutils on x86_64.
  
  The coreutils sources get built against the regex.h included with
  coreutils, but linked against the regex implementation in libroot. Some
  of the types used by coreutils' regex implementation differ from those
  in libroot's on 64-bit platforms meaning they are incompatible. Fixed by
  building coreutils' own regex implementation rather than linking to
  libroot's (GCC 2 still uses libroot though, coreutils' implementation
  doesn't build with GCC 2).

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

a53cfbf: 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).

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

4efc343: 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.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

91899cd: Fix from glibc for possible crash when printf()'ing a long double.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

294818c: More x86_64 printf() fixes from glibc.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

c864ba1: 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.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

1eaa9e6: Compilation fix for malloc_debug.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

aaeadfc: Do a separate libgcc build for the kernel as well.
  
  Turns out that libgcc is needed, for some reason building the kernel
  with -O0 does not end up referencing libgcc but -O2 does. A separate
  build of it is done with -mno-red-zone, same reason as for libsupc++.
  Ended up being easy to rebuild with different CFLAGS: previously I'd
  tried doing `CFLAGS="-mno-red-zone" make` in the libgcc dir which
  didn't override, the correct way is `make CFLAGS="-mno-red-zone"`

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

602d9c9: Added some of the development optional packages.
  
  This adds some of the development packages for x86_64. All of the
  DevelopmentBase packages (gcc, make, jam, bison, flex, m4, mkdepend)
  have been built and uploaded.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

e688bf2: Merge branch 'master' into x86_64
  
  Conflicts:
        src/servers/app/ServerWindow.cpp

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

55e16d9: Added OHCI to image (thanks mmlr), RTF-Translator -> RTFTranslator.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

3bf3aa2: Added the rest of the basic development packages.
  
  Added autoconf, automake, libtool, texinfo, perl, gettext and nano.
  Building an image with the nightly targets should give you an image
  with these included.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

e993391: Fixed crypt() for 64-bit systems.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

9f629ef: Rename KERNEL_LOAD_BASE_64BIT to KERNEL_LOAD_BASE_64_BIT for 
consistency.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

173342c: 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).

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

7e5b39b: Fix printf format warnings that were missed earlier (CIDs 
715645-715657).

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

816aded: Added Installer and DriveSetup to image.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

79a1c3c: Another missed printf string (CID 715659).

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

660e7dd: CID 714542: Unintentional sign extension to 64 bits.
  
  Fixed by changing type of val from u_long to u_int32_t. val only gets
  passed to htonl which takes a uint32_t, so no need for it to be u_long.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

be2f57f: 64-bit fixes for wb840 network driver.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

3c23097: 64-bit fixes for sis900 network driver.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

6314232: Added VirtualMemory preferences to image.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

f3780ae: CID 715700, 715701: Fixed assumption of 4 byte pointer size.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

3ab9de3: CID 714425: Operands don't affect result.
  
  Result of a call to strtoul was stored in a uint32, then checked
  against ULONG_MAX for error. If long is 64 bits, the error check
  will never be true.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

d339b83: CID 712424: Unintended sign extension.
  
  Fix taken from glibc, glibc bug #3747.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

f16cf07: CID 714526: Operands don't affect result.
  
  Incorrect check of in_addr_t (uint32_t) against (unsigned long)-1
  would never be true.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

423d8df: CID 714424: Operands don't affect result.
  
  Storing size_t result of std::string::find_first_of in a uint32 then
  checking against std::string::npos would never be true.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

dcd705c: CID 715610: Operands don't affect result.
  
  Comparing a uint32 against ~0UL would always be false on 64-bit.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

d2a1be1: 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.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

aecb956: Rebuilt flex package for x86_64.
  
  The original package was cross-compiled to Haiku, turns out flex's
  build system uses paths to stuff from the host system, so the package
  was broken. Rebuilt from Haiku.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

4591ebc: Fixes for building Haiku x86_64 from itself.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

c3fa08a: 64-bit fixes for ProcessController.

                                      [ Rene Gollent <anevilyak@xxxxxxxxx> ]

cdf2554: 64-bit fixes for StyledEdit.

                                      [ Rene Gollent <anevilyak@xxxxxxxxx> ]

ceb29f6: Add ProcessController, NetworkStatus and StyledEdit to image.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

c88f490: Added missing AHCI driver in FloppyBootImage, should fix #8943.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

11c9f9a: 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

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

2913b1d: Compilation fixes for x86_64.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

5ccc0cb: Merge branch 'master' into x86_64

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

5f4df83: Fixed ARM build.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

5196d5d: Merge branch 'master' into x86_64
  
  Conflicts:
        build/jam/HaikuImage
        src/add-ons/kernel/generic/Jamfile

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

30afb18: Merge branch 'x86_64'

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

789 files changed, 60546 insertions(+), 7275 deletions(-)
Jamfile                                          |     6 +-
Jamrules                                         |     1 +
build/jam/BootRules                              |   129 +
build/jam/BuildSetup                             |    53 +-
build/jam/FloppyBootImage                        |   139 +-
build/jam/Haiku64Image                           |   593 +
build/jam/HaikuImage                             |     4 +-
build/jam/KernelRules                            |    24 +-
build/jam/OptionalBuildFeatures                  |    23 +-
build/jam/OptionalPackages                       |   324 +-
build/scripts/build_cross_tools_gcc4             |    29 +-
configure                                        |    44 +-
data/system/boot/Bootscript                      |     6 +
data/system/boot/SetupEnvironment                |     2 +-
headers/config/types.h                           |    36 +-
headers/libs/x86emu/x86emu.h                     |   197 +
headers/libs/x86emu/x86emu/debug.h               |   209 +
headers/libs/x86emu/x86emu/decode.h              |    87 +
headers/libs/x86emu/x86emu/fpu.h                 |    60 +
headers/libs/x86emu/x86emu/fpu_regs.h            |   119 +
headers/libs/x86emu/x86emu/ops.h                 |    45 +
headers/libs/x86emu/x86emu/prim_asm.h            |  1053 ++
headers/libs/x86emu/x86emu/prim_ops.h            |   141 +
headers/libs/x86emu/x86emu/prim_x86_gcc.h        |    77 +
headers/libs/x86emu/x86emu/regs.h                |   342 +
headers/libs/x86emu/x86emu/types.h               |    80 +
headers/libs/x86emu/x86emu/x86emui.h             |   100 +
headers/os/arch/x86_64/arch_debugger.h           |    69 +
headers/os/drivers/ISA.h                         |     6 +-
headers/os/drivers/PCI.h                         |    44 +-
headers/os/drivers/bios.h                        |    73 +
headers/os/interface/Region.h                    |     6 +-
headers/os/interface/TextView.h                  |     2 +-
headers/os/kernel/OS.h                           |     7 +-
headers/os/kernel/debugger.h                     |     5 +-
headers/os/support/SupportDefs.h                 |     8 +
headers/posix/arch/x86_64/arch_setjmp.h          |     3 +-
headers/posix/arch/x86_64/fenv.h                 |    13 +-
headers/posix/arch/x86_64/fpu.h                  |   218 +
headers/posix/arch/x86_64/signal.h               |   123 +-
headers/posix/fenv.h                             |     2 +-
headers/posix/netinet/in.h                       |     6 +-
headers/private/kernel/arch/arm/arch_kernel.h    |     4 +-
headers/private/kernel/arch/elf.h                |    13 +-
headers/private/kernel/arch/m68k/arch_kernel.h   |     4 +-
headers/private/kernel/arch/mipsel/arch_kernel.h |     4 +-
headers/private/kernel/arch/ppc/arch_kernel.h    |     4 +-
headers/private/kernel/arch/x86/32/descriptors.h |   146 +
headers/private/kernel/arch/x86/32/iframe.h      |    44 +
headers/private/kernel/arch/x86/64/descriptors.h |   169 +
headers/private/kernel/arch/x86/64/iframe.h      |    48 +
headers/private/kernel/arch/x86/apm.h            |     4 +-
headers/private/kernel/arch/x86/arch_cpu.h       |   249 +-
headers/private/kernel/arch/x86/arch_debug.h     |     2 +-
headers/private/kernel/arch/x86/arch_int.h       |    19 +-
headers/private/kernel/arch/x86/arch_kernel.h    |    67 +-
.../private/kernel/arch/x86/arch_kernel_args.h   |    21 +-
.../private/kernel/arch/x86/arch_system_info.h   |     4 +-
headers/private/kernel/arch/x86/arch_thread.h    |    56 +-
.../private/kernel/arch/x86/arch_thread_types.h  |    63 +-
.../private/kernel/arch/x86/arch_user_debugger.h |    14 +-
headers/private/kernel/arch/x86/bios.h           |     4 +
headers/private/kernel/arch/x86/descriptors.h    |   114 +-
headers/private/kernel/arch/x86/selector.h       |    32 -
headers/private/kernel/arch/x86/smp_priv.h       |     1 -
headers/private/kernel/arch/x86/types.h          |    31 -
headers/private/kernel/arch/x86/vm86.h           |    38 -
headers/private/kernel/boot/addr_range.h         |    40 +-
headers/private/kernel/boot/arch.h               |    21 +-
headers/private/kernel/boot/disk_identifier.h    |    22 +-
headers/private/kernel/boot/driver_settings.h    |     9 +-
headers/private/kernel/boot/elf.h                |    98 +-
headers/private/kernel/boot/kernel_args.h        |    43 +-
.../platform/bios_ia32/platform_kernel_args.h    |     8 +-
headers/private/kernel/boot/stage2.h             |     2 +
headers/private/kernel/elf.h                     |     7 +-
headers/private/kernel/elf_priv.h                |    90 +-
headers/private/kernel/kernel.h                  |    13 +-
headers/private/kernel/smp.h                     |    12 +-
headers/private/kernel/thread_types.h            |    11 +-
headers/private/kernel/util/FixedWidthPointer.h  |   156 +
headers/private/kernel/vfs.h                     |     2 +-
headers/private/kernel/vm/vm.h                   |     2 +-
headers/private/net/net_buffer.h                 |     4 +-
headers/private/runtime_loader/runtime_loader.h  |    27 +-
headers/private/shared/cpu_type.h                |    16 +-
headers/private/system/arch/x86/arch_elf.h       |     4 +
.../system/arch/x86_64/arch_commpage_defs.h      |    19 +
headers/private/system/arch/x86_64/arch_config.h |    15 +
.../private/system/arch/x86_64/arch_cpu_defs.h   |    12 +
headers/private/system/arch/x86_64/arch_elf.h    |    55 +
.../system/arch/x86_64/arch_real_time_data.h     |    17 +
headers/private/system/arch/x86_64/asm_defs.h    |    17 +
headers/private/system/elf32.h                   |   240 +-
headers/private/system/elf64.h                   |   247 +
headers/private/system/elf_common.h              |   301 +
headers/private/system/syscalls.h                |    10 +-
src/add-ons/disk_systems/bfs/BFSAddOn.cpp        |     4 +-
.../devices/wacom/MasterServerDevice.cpp         |     2 +-
[ *** stats truncated: 690 lines dropped *** ]

############################################################################

Commit:      65ad1ba320d945c9626f471c4fb0972ae49440b5
URL:         http://cgit.haiku-os.org/haiku/commit/?id=65ad1ba
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat May 26 20:47:27 2012 UTC

Made it possible to build the bootloader when targetting x86_64.

* x86_64 is using the existing *_ia32 boot platforms.
* Special flags are required when compiling the loader to get GCC to compile
  32-bit code. This adds a new set of rules for compiling boot code rather
  than using the kernel rules, which compile using the necessary flags.
* Some x86_64 private headers have been stubbed by #include'ing the x86
  versions. These will be replaced later.

----------------------------------------------------------------------------

diff --git a/Jamrules b/Jamrules
index c8f6182..711d802 100644
--- a/Jamrules
+++ b/Jamrules
@@ -44,6 +44,7 @@ include [ FDirName $(HAIKU_BUILD_RULES_DIR) 
DocumentationRules ] ;
 include [ FDirName $(HAIKU_BUILD_RULES_DIR) FileRules ] ;
 include [ FDirName $(HAIKU_BUILD_RULES_DIR) HeadersRules ] ;
 include [ FDirName $(HAIKU_BUILD_RULES_DIR) KernelRules ] ;
+include [ FDirName $(HAIKU_BUILD_RULES_DIR) BootRules ] ;
 include [ FDirName $(HAIKU_BUILD_RULES_DIR) ImageRules ] ;
 include [ FDirName $(HAIKU_BUILD_RULES_DIR) CDRules ] ;
 include [ FDirName $(HAIKU_BUILD_RULES_DIR) MainBuildRules ] ;
diff --git a/build/jam/BootRules b/build/jam/BootRules
new file mode 100644
index 0000000..fde7d54
--- /dev/null
+++ b/build/jam/BootRules
@@ -0,0 +1,129 @@
+
+rule SetupBoot
+{
+       # Usage SetupBoot <sources_or_objects> : <extra_cc_flags> : 
<include_private_headers> ;
+       #
+       # <sources_or_objects> - Ideally sources, otherwise HDRSEARCH can not be
+       #                        set for the sources and the sources some header
+       #                        dependencies might be missing.
+
+       local sources = [ FGristFiles $(1) ] ;
+       local objects = $(sources:S=$(SUFOBJ)) ;
+
+       # add private kernel headers
+       if $(3) != false {
+               SourceSysHdrs $(sources) : $(TARGET_PRIVATE_KERNEL_HEADERS) ;
+       }
+
+       local object ;
+       for object in $(objects) {
+               # add boot flags for the object
+               ObjectCcFlags $(object) : $(TARGET_BOOT_CCFLAGS) $(2) ;
+               ObjectC++Flags $(object) : $(TARGET_BOOT_C++FLAGS) $(2) ;
+               ObjectDefines $(object) : $(TARGET_KERNEL_DEFINES) ;
+        ASFLAGS on $(object) = $(TARGET_BOOT_CCFLAGS) ;
+
+               # override warning flags
+               TARGET_WARNING_CCFLAGS on $(object) = 
$(TARGET_KERNEL_WARNING_CCFLAGS) ;
+               TARGET_WARNING_C++FLAGS on $(object)
+                       = $(TARGET_KERNEL_WARNING_C++FLAGS) ;
+       }
+}
+
+rule BootObjects
+{
+       SetupBoot $(1) : $(2) ;
+       Objects $(1) ;
+}
+
+rule BootLd
+{
+       # BootLd <name> : <objs> : <linkerscript> : <args> ;
+
+       LINK on $(1) = $(TARGET_LD) ;
+
+       LINKFLAGS on $(1) = $(4) ;
+       if $(3) { LINKFLAGS on $(1) += --script=$(3) ; }
+
+       # Remove any preset LINKLIBS, but link against libgcc.a. Linking against
+       # libsupc++ is opt-out.
+       local libs ;
+       if ! [ on $(1) return HAIKU_NO_LIBSUPC++ ] {
+               libs += $(TARGET_BOOT_LIBSUPC++) ;
+       }
+       LINKLIBS on $(1) =  $(libs) $(TARGET_BOOT_LIBGCC) ;
+
+       # TODO: Do we really want to invoke SetupBoot here? The objects should
+       # have been compiled with BootObjects anyway, so we're doing that twice.
+       SetupBoot $(2) ;
+
+       # Show that we depend on the libraries we need
+       LocalClean clean : $(1) ;
+       LocalDepends all : $(1) ;
+       Depends $(1) : $(2) ;
+
+       MakeLocateDebug $(1) ;
+
+       on $(1) XRes $(1) : $(RESFILES) ;
+       if ! [ on $(1) return $(DONT_USE_BEOS_RULES) ] {
+               SetType $(1) ;
+               MimeSet $(1) ;
+               SetVersion $(1) ;
+       }
+}
+
+actions BootLd bind VERSION_SCRIPT
+{
+       $(LINK) $(LINKFLAGS) -o "$(1)" "$(2)" $(LINKLIBS) \
+               --version-script=$(VERSION_SCRIPT)
+}
+
+rule BootMergeObject
+{
+       # BootMergeObject <name> : <sources> : <extra CFLAGS> : <other objects> 
;
+       # Compiles source files and merges the object files to an object file.
+       # <name>: Name of the object file to create. No grist will be added.
+       # <sources>: Sources to be compiled. Grist will be added.
+       # <extra CFLAGS>: Additional flags for compilation.
+       # <other objects>: Object files or static libraries to be merged. No 
grist
+       #                  will be added.
+       #
+
+       SetupBoot $(2) : $(3) ;
+       Objects $(2) ;
+       MergeObjectFromObjects $(1) : $(2:S=$(SUFOBJ)) : $(4) ;
+       LINKFLAGS on $(1) += $(TARGET_BOOT_LINKFLAGS) ;
+}
+
+rule BootStaticLibrary
+{
+       # Usage BootStaticLibrary <name> : <sources> : <extra cc flags>  ;
+       # This is designed to take a set of sources and libraries and create
+       # a file called lib<name>.a
+
+       SetupBoot $(2) : $(3) : false ;
+       Library $(1) : $(2) ;
+}
+
+rule BootStaticLibraryObjects
+{
+       # Usage BootStaticLibrary <name> : <sources> ;
+       # This is designed to take a set of sources and libraries and create
+       # a file called <name>
+
+       # Show that we depend on the libraries we need
+       SetupBoot $(2) ;
+       LocalClean clean : $(1) ;
+       LocalDepends all : $(1) ;
+       Depends $(1) : $(2) ;
+
+       MakeLocateDebug $(1) ;
+}
+
+actions BootStaticLibraryObjects
+{
+       # Force recreation of the archive to avoid build errors caused by
+       # stale dependencies after renaming or deleting object files.
+       $(RM) "$(1)"
+       $(HAIKU_AR) -r "$(1)" "$(2)" ;
+}
diff --git a/build/jam/BuildSetup b/build/jam/BuildSetup
index dd4a91d..6a564e7 100644
--- a/build/jam/BuildSetup
+++ b/build/jam/BuildSetup
@@ -159,10 +159,13 @@ if $(HAIKU_GCC_VERSION[1]) = 2 {
 HAIKU_C++ ?= $(HAIKU_CC) ;
 HAIKU_LINK = $(HAIKU_CC) ;
 HAIKU_LINKFLAGS = $(HAIKU_GCC_BASE_FLAGS) ;
+HAIKU_BOOT_LINKFLAGS = ;
 
 HAIKU_HDRS = [ FStandardHeaders ] ;
 HAIKU_KERNEL_CCFLAGS = $(HAIKU_CCFLAGS) $(HAIKU_GCC_BASE_FLAGS) ;
 HAIKU_KERNEL_C++FLAGS = $(HAIKU_C++FLAGS) $(HAIKU_GCC_BASE_FLAGS) ;
+HAIKU_BOOT_CCFLAGS = $(HAIKU_CCFLAGS) $(HAIKU_GCC_BASE_FLAGS) ;
+HAIKU_BOOT_C++FLAGS = $(HAIKU_C++FLAGS) $(HAIKU_GCC_BASE_FLAGS) ;
 HAIKU_CCFLAGS += $(HAIKU_GCC_BASE_FLAGS) -nostdinc ;
 HAIKU_C++FLAGS += $(HAIKU_GCC_BASE_FLAGS) -nostdinc ;
 HAIKU_DEFINES = __HAIKU__ ;
@@ -249,7 +252,6 @@ switch $(HAIKU_CPU) {
        }
        case x86_64 :
        {
-               HAIKU_DEFINES += __x86_64__ ;
                HAIKU_BOOT_PLATFORM = bios_ia32 ;
                HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 2880 ; # in kB
                # offset in floppy image (>= sizeof(haiku_loader))
@@ -329,6 +331,8 @@ HAIKU_ASFLAGS = ;
 HAIKU_KERNEL_CCFLAGS += -finline -fno-builtin ;
 HAIKU_KERNEL_C++FLAGS += -finline -fno-builtin -fno-exceptions ;
 HAIKU_KERNEL_DEFINES += _KERNEL_MODE ;
+HAIKU_BOOT_CCFLAGS += -finline -fno-builtin ;
+HAIKU_BOOT_C++FLAGS += -finline -fno-builtin -fno-exceptions ;
 
 if $(HAIKU_GCC_VERSION[1]) >= 3 {
        HAIKU_KERNEL_C++FLAGS += -fno-use-cxa-atexit ;
@@ -340,6 +344,8 @@ if $(HAIKU_GCC_VERSION[1]) >= 4 {
        if $(HAIKU_GCC_VERSION[2]) >= 3 {
                HAIKU_KERNEL_CCFLAGS += -ffreestanding ;
                HAIKU_KERNEL_C++FLAGS += -ffreestanding ;
+               HAIKU_BOOT_CCFLAGS += -ffreestanding ;
+               HAIKU_BOOT_C++FLAGS += -ffreestanding ;
        }
 }
 
@@ -377,6 +383,15 @@ switch $(HAIKU_ARCH) {
        }
        case x86_64 :
        {
+               # Kernel lives in the top 2GB of the address space, use kernel 
code model.
+               HAIKU_KERNEL_CCFLAGS += -mcmodel=kernel ;
+               HAIKU_KERNEL_C++FLAGS += -mcmodel=kernel ;
+
+               # Bootloader is 32-bit.
+               HAIKU_BOOT_LINKFLAGS += -m elf_i386_haiku ;
+               HAIKU_BOOT_CCFLAGS += -m32 ;
+               HAIKU_BOOT_C++FLAGS += -m32 ;
+
                # Enable use of the gcc built-in atomic functions instead of 
atomic_*().
                # The former are inlined and have thus less overhead.
                HAIKU_DEFINES += B_USE_BUILTIN_ATOMIC_FUNCTIONS ;
@@ -962,6 +977,7 @@ local buildVars =
 
        KERNEL_CCFLAGS KERNEL_C++FLAGS
        KERNEL_PIC_CCFLAGS KERNEL_PIC_LINKFLAGS
+       BOOT_CCFLAGS BOOT_C++FLAGS BOOT_LINKFLAGS
        WARNING_CCFLAGS WARNING_C++FLAGS
 
        KERNEL_WARNING_CCFLAGS KERNEL_WARNING_C++FLAGS
@@ -998,6 +1014,9 @@ if $(TARGET_PLATFORM) = haiku {
        TARGET_GCC_LIBGCC                       = $(HAIKU_GCC_LIBGCC) ;
        TARGET_GCC_LIBGCC_OBJECTS       = $(HAIKU_GCC_LIBGCC_OBJECTS) ;
 
+       TARGET_BOOT_LIBGCC                      = $(HAIKU_BOOT_LIBGCC) ;
+       TARGET_BOOT_LIBSUPC++           = $(HAIKU_BOOT_LIBSUPC++) ;
+
        TARGET_BOOT_PLATFORM            ?= $(HAIKU_BOOT_PLATFORM) ;
        TARGET_BOOT_BOARD                       ?= $(HAIKU_BOOT_BOARD) ;
 
@@ -1014,6 +1033,9 @@ if $(TARGET_PLATFORM) = haiku {
        TARGET_GCC_LIBGCC                       = ;
        TARGET_GCC_LIBGCC_OBJECTS       = ;
 
+       TARGET_BOOT_LIBGCC                      = ;
+       TARGET_BOOT_LIBSUPC++           = ;
+
        TARGET_BOOT_PLATFORM            = ;
        TARGET_BOOT_BOARD                       = ;
 
diff --git a/configure b/configure
index 9d6ca5a..48911b3 100755
--- a/configure
+++ b/configure
@@ -242,6 +242,14 @@ standard_gcc_settings()
                        fi
                ;;
        esac
+
+       if [ "$targetArch" = "x86_64" ]; then
+               HAIKU_BOOT_LIBGCC=`$HAIKU_CC -m32 -print-libgcc-file-name`
+               HAIKU_BOOT_LIBSUPCXX=`$HAIKU_CC -m32 
-print-file-name=libsupc++.a`
+       else
+               HAIKU_BOOT_LIBGCC=$HAIKU_GCC_LIBGCC
+               HAIKU_BOOT_LIBSUPCXX=$HAIKU_STATIC_LIBSUPCXX
+       fi
 }
 
 # set_default_value
@@ -549,6 +557,9 @@ HAIKU_STATIC_LIBSUPC++              ?= 
${HAIKU_STATIC_LIBSUPCXX} ;
 HAIKU_SHARED_LIBSUPC++         ?= ${HAIKU_SHARED_LIBSUPCXX} ;
 HAIKU_C++_HEADERS_DIR          ?= ${HAIKU_CXX_HEADERS_DIR} ;
 
+HAIKU_BOOT_LIBGCC                      ?= ${HAIKU_BOOT_LIBGCC} ;
+HAIKU_BOOT_LIBSUPC++           ?= ${HAIKU_BOOT_LIBSUPCXX} ;
+
 HAIKU_BUILD_ATTRIBUTES_DIR     ?= ${HAIKU_BUILD_ATTRIBUTES_DIR} ;
 
 HAIKU_AR                                       ?= ${HAIKU_AR} ;
diff --git a/headers/private/kernel/arch/x86/apm.h 
b/headers/private/kernel/arch/x86/apm.h
index 905ac0d..675ed5a 100644
--- a/headers/private/kernel/arch/x86/apm.h
+++ b/headers/private/kernel/arch/x86/apm.h
@@ -7,7 +7,7 @@
 
 #include <SupportDefs.h>
 
-#include <apm_defs.h>
+#include <arch/x86/apm_defs.h>
 
 
 struct kernel_args;
diff --git a/headers/private/kernel/arch/x86_64/arch_cpu.h 
b/headers/private/kernel/arch/x86_64/arch_cpu.h
new file mode 100644
index 0000000..dfdfe6a
--- /dev/null
+++ b/headers/private/kernel/arch/x86_64/arch_cpu.h
@@ -0,0 +1,6 @@
+#ifndef _KERNEL_ARCH_x86_64_CPU_H
+#define _KERNEL_ARCH_x86_64_CPU_H
+
+#include "../x86/arch_cpu.h"
+
+#endif /* _KERNEL_ARCH_x86_64_CPU_H */
diff --git a/headers/private/kernel/arch/x86_64/arch_int.h 
b/headers/private/kernel/arch/x86_64/arch_int.h
new file mode 100644
index 0000000..cd1f423
--- /dev/null
+++ b/headers/private/kernel/arch/x86_64/arch_int.h
@@ -0,0 +1,6 @@
+#ifndef _KERNEL_ARCH_x86_64_INT_H
+#define _KERNEL_ARCH_x86_64_INT_H
+
+#include "../x86/arch_int.h"
+
+#endif /* _KERNEL_ARCH_x86_64_INT_H */
diff --git a/headers/private/kernel/arch/x86_64/arch_kernel.h 
b/headers/private/kernel/arch/x86_64/arch_kernel.h
new file mode 100644
index 0000000..40d55a3
--- /dev/null
+++ b/headers/private/kernel/arch/x86_64/arch_kernel.h
@@ -0,0 +1,6 @@
+#ifndef _KERNEL_ARCH_x86_64_KERNEL_H
+#define _KERNEL_ARCH_x86_64_KERNEL_H
+
+#include "../x86/arch_kernel.h"
+
+#endif /* _KERNEL_ARCH_x86_64_KERNEL_H */
diff --git a/headers/private/kernel/arch/x86_64/arch_kernel_args.h 
b/headers/private/kernel/arch/x86_64/arch_kernel_args.h
new file mode 100644
index 0000000..ecb2638
--- /dev/null
+++ b/headers/private/kernel/arch/x86_64/arch_kernel_args.h
@@ -0,0 +1,6 @@
+#ifndef _KERNEL_ARCH_x86_64_KERNEL_ARGS_H
+#define _KERNEL_ARCH_x86_64_KERNEL_ARGS_H
+
+#include "../x86/arch_kernel_args.h"
+
+#endif /* _KERNEL_ARCH_x86_64_KERNEL_ARGS_H */
diff --git a/headers/private/kernel/arch/x86_64/arch_system_info.h 
b/headers/private/kernel/arch/x86_64/arch_system_info.h
new file mode 100644
index 0000000..aeee330
--- /dev/null
+++ b/headers/private/kernel/arch/x86_64/arch_system_info.h
@@ -0,0 +1,6 @@
+#ifndef _KERNEL_ARCH_x86_64_SYSTEM_INFO_H
+#define _KERNEL_ARCH_x86_64_SYSTEM_INFO_H
+
+#include "../x86/arch_system_info.h"
+
+#endif /* _KERNEL_ARCH_x86_64_SYSTEM_INFO_H */
diff --git a/headers/private/kernel/arch/x86_64/arch_thread.h 
b/headers/private/kernel/arch/x86_64/arch_thread.h
new file mode 100644
index 0000000..0776b28
--- /dev/null
+++ b/headers/private/kernel/arch/x86_64/arch_thread.h
@@ -0,0 +1,6 @@
+#ifndef _KERNEL_ARCH_x86_64_THREAD_H
+#define _KERNEL_ARCH_x86_64_THREAD_H
+
+#include "../x86/arch_thread.h"
+
+#endif /* _KERNEL_ARCH_x86_64_THREAD_H */
diff --git a/headers/private/kernel/arch/x86_64/arch_thread_types.h 
b/headers/private/kernel/arch/x86_64/arch_thread_types.h
new file mode 100644
index 0000000..f0dc013
--- /dev/null
+++ b/headers/private/kernel/arch/x86_64/arch_thread_types.h
@@ -0,0 +1,6 @@
+#ifndef _KERNEL_ARCH_x86_64_THREAD_TYPES_H
+#define _KERNEL_ARCH_x86_64_THREAD_TYPES_H
+
+#include "../x86/arch_thread_types.h"
+
+#endif /* _KERNEL_ARCH_x86_64_THREAD_TYPES_H */
diff --git a/headers/private/kernel/arch/x86_64/arch_user_debugger.h 
b/headers/private/kernel/arch/x86_64/arch_user_debugger.h
new file mode 100644
index 0000000..9491ef5
--- /dev/null
+++ b/headers/private/kernel/arch/x86_64/arch_user_debugger.h
@@ -0,0 +1,6 @@
+#ifndef _KERNEL_ARCH_x86_64_USER_DEBUGGER_H
+#define _KERNEL_ARCH_x86_64_USER_DEBUGGER_H
+
+#include "../x86/arch_user_debugger.h"
+
+#endif /* _KERNEL_ARCH_x86_64_USER_DEBUGGER_H */
diff --git 
a/headers/private/kernel/boot/platform/bios_ia32/platform_kernel_args.h 
b/headers/private/kernel/boot/platform/bios_ia32/platform_kernel_args.h
index e66bebe..1b0ff82 100644
--- a/headers/private/kernel/boot/platform/bios_ia32/platform_kernel_args.h
+++ b/headers/private/kernel/boot/platform/bios_ia32/platform_kernel_args.h
@@ -10,7 +10,7 @@
 #endif
 
 
-#include <apm.h>
+#include <arch/x86/apm.h>
 #include <bios_drive.h>
 
 
diff --git a/headers/private/system/arch/x86_64/arch_config.h 
b/headers/private/system/arch/x86_64/arch_config.h
new file mode 100644
index 0000000..e788a33
--- /dev/null
+++ b/headers/private/system/arch/x86_64/arch_config.h
@@ -0,0 +1,15 @@
+/*
+ * Copyright 2004, Alex Smith, alex@xxxxxxxxxxxxxxxxx
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _KERNEL_ARCH_x86_64_CONFIG_H
+#define _KERNEL_ARCH_x86_64_CONFIG_H
+
+#define FUNCTION_CALL_PARAMETER_ALIGNMENT_TYPE  unsigned long
+
+#define STACK_GROWS_DOWNWARDS
+
+//#define ATOMIC_FUNCS_ARE_SYSCALLS
+//#define ATOMIC64_FUNCS_ARE_SYSCALLS
+
+#endif /* _KERNEL_ARCH_x86_64_CONFIG_H */
diff --git a/headers/private/system/arch/x86_64/arch_elf.h 
b/headers/private/system/arch/x86_64/arch_elf.h
new file mode 100644
index 0000000..410c003
--- /dev/null
+++ b/headers/private/system/arch/x86_64/arch_elf.h
@@ -0,0 +1,6 @@
+#ifndef _KERNEL_ARCH_x86_64_ELF_H
+#define _KERNEL_ARCH_x86_64_ELF_H
+
+#include "../x86/arch_elf.h"
+
+#endif /* _KERNEL_ARCH_x86_64_ELF_H */
diff --git a/headers/private/system/arch/x86_64/asm_defs.h 
b/headers/private/system/arch/x86_64/asm_defs.h
new file mode 100644
index 0000000..26d13c5
--- /dev/null
+++ b/headers/private/system/arch/x86_64/asm_defs.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright 2008, Ingo Weinhold, ingo_weinhold@xxxxxxx
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef SYSTEM_ARCH_X86_64_ASM_DEFS_H
+#define SYSTEM_ARCH_X86_64_ASM_DEFS_H
+
+
+#define SYMBOL(name)                   .global name; name
+#define SYMBOL_END(name)               1: .size name, 1b - name
+#define STATIC_FUNCTION(name)  .type name, @function; name
+#define FUNCTION(name)                 .global name; .type name, @function; 
name
+#define FUNCTION_END(name)             1: .size name, 1b - name
+
+
+#endif /* SYSTEM_ARCH_X86_64_ASM_DEFS_H */
+
diff --git a/src/system/boot/Jamfile b/src/system/boot/Jamfile
index ad8d151..548883a 100644
--- a/src/system/boot/Jamfile
+++ b/src/system/boot/Jamfile
@@ -1,27 +1,37 @@
 SubDir HAIKU_TOP src system boot ;
 
-local librootFunctions =
-       abs.o
-       ctype.o
-       LocaleData.o
-       qsort.o
-       kernel_vsprintf.o
-       memcmp.o
-       memmove.o
-       strdup.o
-       strndup.o
-       strlen.o
-       strnlen.o
-       strcmp.o
-       strcasecmp.o
-       strncmp.o
-       strcat.o
-       strcpy.o
-       strlcat.o
-       strlcpy.o
-       strchr.o
-       strrchr.o
-       strtol.o
+DEFINES += _BOOT_MODE ;
+
+SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot posix string ] ;
+SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot posix stdlib ] ;
+SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot posix locale ] ;
+SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) kernel lib ] ;
+
+UsePrivateHeaders [ FDirName libroot locale ] ;
+
+BootMergeObject boot_libroot.o :
+       abs.c
+       ctype.cpp
+       LocaleData.cpp
+       qsort.c
+       kernel_vsprintf.cpp
+       memcmp.c
+       memmove.c
+       strdup.c
+       strndup.cpp
+       strlen.cpp
+       strnlen.cpp
+       strcmp.c
+       strcasecmp.c
+       strncmp.c
+       strcat.c
+       strcpy.c
+       strlcat.c
+       strlcpy.c
+       strchr.c
+       strrchr.c
+       strtol.c
+       : -fno-pic
 ;
 
 local extraLinkerArgs = ;
@@ -31,7 +41,7 @@ if $(HAIKU_BOARD_LOADER_BASE) {
 
 AddResources haiku_loader : boot_loader.rdef ;
 
-KernelLd boot_loader_$(TARGET_BOOT_PLATFORM) :
+BootLd boot_loader_$(TARGET_BOOT_PLATFORM) :
        boot_platform_$(TARGET_BOOT_PLATFORM).o
        boot_arch_$(TARGET_ARCH).o
        boot_loader.a
@@ -47,9 +57,8 @@ KernelLd boot_loader_$(TARGET_BOOT_PLATFORM) :
        # needed by tarfs and video_splash.cpp
        boot_zlib.a
 
-       # libroot functions needed by the stage2 boot loader (compiled for the
-       # kernel)
-       $(librootFunctions:G=src!system!kernel!lib)
+       # libroot functions needed by the stage2 boot loader
+       boot_libroot.o
 
        : 
$(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/boot_loader_$(TARGET_BOOT_PLATFORM).ld
        : -Bstatic $(extraLinkerArgs)
diff --git a/src/system/boot/arch/arm/Jamfile b/src/system/boot/arch/arm/Jamfile
index cd3dd05..d035c41 100644
--- a/src/system/boot/arch/arm/Jamfile
+++ b/src/system/boot/arch/arm/Jamfile
@@ -22,7 +22,7 @@ local kernelLibArchObjects =
        <src!system!kernel!lib!arch!$(TARGET_ARCH)>memset.o
 ;
 
-KernelMergeObject boot_arch_$(TARGET_ARCH).o :
+BootMergeObject boot_arch_$(TARGET_ARCH).o :
        debug_uart_8250.cpp
        arch_uart_8250.cpp
        arch_uart_pl011.cpp
diff --git a/src/system/boot/arch/m68k/Jamfile 
b/src/system/boot/arch/m68k/Jamfile
index a632090..349a350 100644
--- a/src/system/boot/arch/m68k/Jamfile
+++ b/src/system/boot/arch/m68k/Jamfile
@@ -13,7 +13,7 @@ local kernelLibArchObjects =
        <src!system!kernel!lib!arch!$(TARGET_ARCH)>memset.o
 ;
 
-KernelMergeObject boot_arch_$(TARGET_ARCH).o :
+BootMergeObject boot_arch_$(TARGET_ARCH).o :
        arch_elf.cpp
        $(librootArchObjects)
        : -fno-pic
@@ -21,17 +21,17 @@ KernelMergeObject boot_arch_$(TARGET_ARCH).o :
        $(kernelLibArchObjects)
 ;
 
-KernelMergeObject boot_arch_$(TARGET_ARCH)_030.o :
+BootMergeObject boot_arch_$(TARGET_ARCH)_030.o :
        mmu_030.cpp
        : -fno-pic -Wno-unused -m68030
 ;
 
-KernelMergeObject boot_arch_$(TARGET_ARCH)_040.o :
+BootMergeObject boot_arch_$(TARGET_ARCH)_040.o :
        mmu_040.cpp
        : -fno-pic -Wno-unused -m68040
 ;
 
-KernelMergeObject boot_arch_$(TARGET_ARCH)_060.o :
+BootMergeObject boot_arch_$(TARGET_ARCH)_060.o :
        mmu_060.cpp
        : -fno-pic -Wno-unused -m68060
 ;
diff --git a/src/system/boot/arch/mipsel/Jamfile 
b/src/system/boot/arch/mipsel/Jamfile
index 55f63e6..33f0198 100644
--- a/src/system/boot/arch/mipsel/Jamfile
+++ b/src/system/boot/arch/mipsel/Jamfile
@@ -8,7 +8,7 @@ local kernelLibArchObjects =
        <src!system!kernel!lib!arch!$(TARGET_ARCH)>memset.o
 ;
 
-KernelMergeObject boot_arch_$(TARGET_ARCH).o :
+BootMergeObject boot_arch_$(TARGET_ARCH).o :
        arch_elf.cpp
        : # additional flags
        :
diff --git a/src/system/boot/arch/ppc/Jamfile b/src/system/boot/arch/ppc/Jamfile
index c2b817b..07ad229 100644
--- a/src/system/boot/arch/ppc/Jamfile
+++ b/src/system/boot/arch/ppc/Jamfile
@@ -15,7 +15,7 @@ local kernelLibArchObjects =
        <src!system!kernel!lib!arch!$(TARGET_ARCH)>memset.o
 ;
 
-KernelMergeObject boot_arch_$(TARGET_ARCH).o :
+BootMergeObject boot_arch_$(TARGET_ARCH).o :
        debug_uart_8250.cpp
        arch_uart_8250.cpp
        arch_elf.cpp
diff --git a/src/system/boot/arch/x86/Jamfile b/src/system/boot/arch/x86/Jamfile
index 7315dc7..21eb0ac 100644
--- a/src/system/boot/arch/x86/Jamfile
+++ b/src/system/boot/arch/x86/Jamfile
@@ -18,7 +18,7 @@ local kernelLibArchObjects =
        <src!system!kernel!lib!arch!$(TARGET_ARCH)>byteorder.o
 ;
 
-KernelMergeObject boot_arch_$(TARGET_ARCH).o :
+BootMergeObject boot_arch_$(TARGET_ARCH).o :
        $(kernelArchSources)
        $(kernelLibArchSources)
        : # additional flags
diff --git a/src/system/boot/arch/x86_64/Jamfile 
b/src/system/boot/arch/x86_64/Jamfile
new file mode 100644
index 0000000..dae2896
--- /dev/null
+++ b/src/system/boot/arch/x86_64/Jamfile
@@ -0,0 +1,30 @@
+SubDir HAIKU_TOP src system boot arch x86_64 ;
+
+DEFINES += _BOOT_MODE ;
+
+local kernelArchSources =
+       arch_elf.cpp
+       cpuid.S
+;
+
+local kernelLibArchSources =
+       arch_string.S
+;
+
+local librootOsArchSources =
+       byteorder.S
+;
+
+BootMergeObject boot_arch_$(TARGET_ARCH).o :
+       $(kernelArchSources)
+       $(kernelLibArchSources)
+       $(librootOsArchSources)
+       : # additional flags
+;
+
+SEARCH on [ FGristFiles $(kernelArchSources) ]
+    = [ FDirName $(HAIKU_TOP) src system kernel arch x86 ] ;
+SEARCH on [ FGristFiles $(kernelLibArchSources) ]
+    = [ FDirName $(HAIKU_TOP) src system kernel lib arch x86 ] ;
+SEARCH on [ FGristFiles $(librootOsArchSources) ]
+    = [ FDirName $(HAIKU_TOP) src system libroot os arch x86 ] ;
diff --git a/src/system/boot/loader/Jamfile b/src/system/boot/loader/Jamfile
index 671ca94..1cb962c 100644
--- a/src/system/boot/loader/Jamfile
+++ b/src/system/boot/loader/Jamfile
@@ -50,7 +50,7 @@ UsePrivateHeaders shared storage ;
        SubDirC++Flags $(defines) -fno-rtti ;
 }
 
-KernelStaticLibrary boot_loader :
+BootStaticLibrary boot_loader :
        elf.cpp
        heap.cpp
        kernel_args.cpp
@@ -81,7 +81,7 @@ KernelStaticLibrary boot_loader :
 # The partition support is built in an extra static library
 # so that only the ones that are used will be included.
 
-KernelStaticLibrary boot_partitions :
+BootStaticLibrary boot_partitions :
        FileMapDisk.cpp
        amiga_rdb.cpp
        apple.cpp
diff --git a/src/system/boot/loader/file_systems/amiga_ffs/Jamfile 
b/src/system/boot/loader/file_systems/amiga_ffs/Jamfile
index 222c775..1b2d8bb 100644
--- a/src/system/boot/loader/file_systems/amiga_ffs/Jamfile
+++ b/src/system/boot/loader/file_systems/amiga_ffs/Jamfile
@@ -8,7 +8,7 @@ UsePrivateHeaders kernel storage ;
 
 SubDirC++Flags -fno-rtti ;
 
-KernelStaticLibrary boot_amiga_ffs :
+BootStaticLibrary boot_amiga_ffs :
        amiga_ffs.cpp
        Volume.cpp
        Directory.cpp
diff --git a/src/system/boot/loader/file_systems/bfs/Jamfile 
b/src/system/boot/loader/file_systems/bfs/Jamfile
index f5840e9..e91cf72 100644
--- a/src/system/boot/loader/file_systems/bfs/Jamfile
+++ b/src/system/boot/loader/file_systems/bfs/Jamfile
@@ -10,7 +10,7 @@ local defines = [ FDefines _BOOT_MODE ] ;
 SubDirCcFlags $(defines) ;
 SubDirC++Flags -fno-rtti $(defines) ;
 
-KernelStaticLibrary boot_bfs :
+BootStaticLibrary boot_bfs :
        bfs.cpp
        Directory.cpp
        File.cpp
diff --git a/src/system/boot/loader/file_systems/fat/Jamfile 
b/src/system/boot/loader/file_systems/fat/Jamfile
index 69aee03..52de886 100644
--- a/src/system/boot/loader/file_systems/fat/Jamfile
+++ b/src/system/boot/loader/file_systems/fat/Jamfile
@@ -13,7 +13,7 @@ local defines = [ FDefines _BOOT_MODE ] ;
 SubDirCcFlags $(defines) ;
 SubDirC++Flags -fno-rtti $(defines) ;
 
-KernelStaticLibrary boot_fatfs :
+BootStaticLibrary boot_fatfs :
        fatfs.cpp
        Volume.cpp
        CachedBlock.cpp
diff --git a/src/system/boot/loader/file_systems/hfs_plus/Jamfile 
b/src/system/boot/loader/file_systems/hfs_plus/Jamfile
index 9a02d8a..13bbb37 100644
--- a/src/system/boot/loader/file_systems/hfs_plus/Jamfile
+++ b/src/system/boot/loader/file_systems/hfs_plus/Jamfile
@@ -6,7 +6,7 @@ UsePrivateHeaders kernel storage ;
 
 SubDirC++Flags -fno-rtti ;
 
-KernelStaticLibrary boot_hfs_plus :
+BootStaticLibrary boot_hfs_plus :
        hfs_plus.cpp
        : -fno-pic
        ;
diff --git a/src/system/boot/loader/file_systems/tarfs/Jamfile 
b/src/system/boot/loader/file_systems/tarfs/Jamfile
index 0b7008a..4e7f479 100644
--- a/src/system/boot/loader/file_systems/tarfs/Jamfile
+++ b/src/system/boot/loader/file_systems/tarfs/Jamfile
@@ -14,7 +14,7 @@ SubDirC++Flags -fno-rtti $(defines) ;
 SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src libs zlib ] ;
 
 
-KernelStaticLibrary boot_zlib :
+BootStaticLibrary boot_zlib :
        inflate.c
        inffast.c
        inftrees.c
@@ -25,7 +25,7 @@ KernelStaticLibrary boot_zlib :
        ;
 
 
-KernelStaticLibrary boot_tarfs :
+BootStaticLibrary boot_tarfs :
        tarfs.cpp
        : -fno-pic
        ;
diff --git a/src/system/boot/loader/net/Jamfile 
b/src/system/boot/loader/net/Jamfile
index dda66c0..5bb8291 100644
--- a/src/system/boot/loader/net/Jamfile
+++ b/src/system/boot/loader/net/Jamfile
@@ -12,7 +12,7 @@ if $(TARGET_ARCH) = ppc {
        iscsi = iSCSITarget.cpp ;
 }
 
-KernelStaticLibrary boot_net :
+BootStaticLibrary boot_net :
        ARP.cpp
        ChainBuffer.cpp
        Ethernet.cpp
diff --git a/src/system/boot/platform/amiga_m68k/Jamfile 
b/src/system/boot/platform/amiga_m68k/Jamfile
index 9f223dd..b867ef7 100644
--- a/src/system/boot/platform/amiga_m68k/Jamfile
+++ b/src/system/boot/platform/amiga_m68k/Jamfile
@@ -19,13 +19,13 @@ UsePrivateHeaders [ FDirName storage ] ;
 
 #SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ;
 
-KernelMergeObject boot_platform_amiga_m68k_shell.o :
+BootMergeObject boot_platform_amiga_m68k_shell.o :
        shell.S
        : -Wa,--pcrel
 ;
 
 
-KernelMergeObject boot_platform_amiga_m68k_other.o :
+BootMergeObject boot_platform_amiga_m68k_other.o :
 #      shell.S
        start.cpp
        rom_calls.cpp
@@ -54,7 +54,7 @@ KernelMergeObject boot_platform_amiga_m68k_other.o :
 ;
 
 
-KernelMergeObject boot_platform_amiga_m68k.o :
+BootMergeObject boot_platform_amiga_m68k.o :
        : :
        boot_platform_amiga_m68k_shell.o
        boot_platform_amiga_m68k_other.o
diff --git a/src/system/boot/platform/atari_m68k/Jamfile 
b/src/system/boot/platform/atari_m68k/Jamfile
index 287666b..b71de5a 100644
--- a/src/system/boot/platform/atari_m68k/Jamfile
+++ b/src/system/boot/platform/atari_m68k/Jamfile
@@ -19,7 +19,7 @@ UsePrivateHeaders [ FDirName storage ] ;
 
 #SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ;
 
-KernelMergeObject boot_platform_atari_m68k_shell.o :
+BootMergeObject boot_platform_atari_m68k_shell.o :
        shell.S
        : -Wa,--pcrel
 ;
@@ -30,7 +30,7 @@ KernelMergeObject boot_platform_atari_m68k_shell.o :
 # TODO: add 020+68851 support
 
 
-KernelMergeObject boot_platform_atari_m68k_other.o :
+BootMergeObject boot_platform_atari_m68k_other.o :
 #      shell.S
        start.cpp
        toscalls.cpp
@@ -59,7 +59,7 @@ KernelMergeObject boot_platform_atari_m68k_other.o :
 ;
 
 
-KernelMergeObject boot_platform_atari_m68k.o :
+BootMergeObject boot_platform_atari_m68k.o :
        : :
        boot_platform_atari_m68k_shell.o
        boot_platform_atari_m68k_other.o
diff --git a/src/system/boot/platform/bios_ia32/Jamfile 
b/src/system/boot/platform/bios_ia32/Jamfile
index 9219e5b..6c0c273 100644
--- a/src/system/boot/platform/bios_ia32/Jamfile
+++ b/src/system/boot/platform/bios_ia32/Jamfile
@@ -17,7 +17,7 @@ UsePrivateHeaders [ FDirName storage ] ;
 
 SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ;
 
-KernelMergeObject boot_platform_bios_ia32.o :
+BootMergeObject boot_platform_bios_ia32.o :
        shell.S
        start.cpp
        debug.cpp
diff --git a/src/system/boot/platform/bios_ia32/interrupts.cpp 
b/src/system/boot/platform/bios_ia32/interrupts.cpp
index 3b4505c..c5efc58 100644
--- a/src/system/boot/platform/bios_ia32/interrupts.cpp
+++ b/src/system/boot/platform/bios_ia32/interrupts.cpp
@@ -17,7 +17,7 @@
 #include <boot/platform/generic/text_console.h>
 
 #include <arch_cpu.h>
-#include <descriptors.h>
+#include <arch/x86/descriptors.h>
 
 #include "debug.h"
 #include "keyboard.h"
diff --git a/src/system/boot/platform/cfe/Jamfile 
b/src/system/boot/platform/cfe/Jamfile
index 8114492..7f54c77 100644
--- a/src/system/boot/platform/cfe/Jamfile
+++ b/src/system/boot/platform/cfe/Jamfile
@@ -6,7 +6,7 @@ UsePrivateHeaders [ FDirName graphics common ] ;
 
 SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ;
 
-KernelMergeObject boot_platform_cfe.o :
+BootMergeObject boot_platform_cfe.o :
        console.cpp
        debug.cpp
        devices.cpp
diff --git a/src/system/boot/platform/cfe/arch/ppc/Jamfile 
b/src/system/boot/platform/cfe/arch/ppc/Jamfile
index 14cc7e7..f740833 100644
--- a/src/system/boot/platform/cfe/arch/ppc/Jamfile
+++ b/src/system/boot/platform/cfe/arch/ppc/Jamfile
@@ -7,7 +7,7 @@ UsePrivateHeaders kernel [ FDirName kernel arch $(TARGET_ARCH) ]
 
 SubDirC++Flags -fno-rtti ;
 
-KernelStaticLibrary boot_platform_cfe_ppc :
+BootStaticLibrary boot_platform_cfe_ppc :
        arch_mmu.cpp
        arch_cpu_asm.S
        arch_start_kernel.S
diff --git a/src/system/boot/platform/generic/Jamfile 
b/src/system/boot/platform/generic/Jamfile
index 0ca4967..fad4f47 100644
--- a/src/system/boot/platform/generic/Jamfile
+++ b/src/system/boot/platform/generic/Jamfile
@@ -5,7 +5,7 @@ UsePrivateKernelHeaders ;
 
 SubDirC++Flags -D_BOOT_MODE -fno-rtti ;
 
-KernelStaticLibrary boot_platform_generic :
+BootStaticLibrary boot_platform_generic :
        text_menu.cpp
        video_blit.cpp
        video_splash.cpp
diff --git a/src/system/boot/platform/openfirmware/Jamfile 
b/src/system/boot/platform/openfirmware/Jamfile
index 227df03..43f2f2c 100644
--- a/src/system/boot/platform/openfirmware/Jamfile
+++ b/src/system/boot/platform/openfirmware/Jamfile
@@ -6,7 +6,7 @@ UsePrivateHeaders [ FDirName graphics common ] ;
 
 SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ;
 
-KernelMergeObject boot_platform_openfirmware.o :
+BootMergeObject boot_platform_openfirmware.o :
        console.cpp
        debug.cpp
        devices.cpp
diff --git a/src/system/boot/platform/openfirmware/arch/ppc/Jamfile 
b/src/system/boot/platform/openfirmware/arch/ppc/Jamfile
index 651d61c..a82fda7 100644
--- a/src/system/boot/platform/openfirmware/arch/ppc/Jamfile
+++ b/src/system/boot/platform/openfirmware/arch/ppc/Jamfile
@@ -7,7 +7,7 @@ UsePrivateHeaders kernel [ FDirName kernel arch $(TARGET_ARCH) ]
 
 SubDirC++Flags -fno-rtti ;
 
-KernelStaticLibrary boot_platform_openfirmware_ppc :
+BootStaticLibrary boot_platform_openfirmware_ppc :
        arch_mmu.cpp
        arch_cpu_asm.S
        arch_start_kernel.S
diff --git a/src/system/boot/platform/pxe_ia32/Jamfile 
b/src/system/boot/platform/pxe_ia32/Jamfile
index 73c75eb..fe59db7 100644
--- a/src/system/boot/platform/pxe_ia32/Jamfile
+++ b/src/system/boot/platform/pxe_ia32/Jamfile
@@ -45,7 +45,7 @@ local bios_ia32_edid_src =
 ;
 
 
-KernelMergeObject boot_platform_pxe_ia32.o :
+BootMergeObject boot_platform_pxe_ia32.o :
        pxe_stage2.S
        smp_trampoline.S
        pxe_bios.S
diff --git a/src/system/boot/platform/raspberrypi_arm/Jamfile 
b/src/system/boot/platform/raspberrypi_arm/Jamfile
index 179f0d5..9b4b72e 100644
--- a/src/system/boot/platform/raspberrypi_arm/Jamfile
+++ b/src/system/boot/platform/raspberrypi_arm/Jamfile
@@ -19,7 +19,7 @@ UsePrivateHeaders [ FDirName kernel arch $(TARGET_ARCH) board 
$(TARGET_BOOT_BOAR
 
 SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ;
 
-KernelMergeObject boot_platform_raspberrypi_arm.o :
+BootMergeObject boot_platform_raspberrypi_arm.o :
        entry.S
        start.c
        console.cpp
diff --git a/src/system/boot/platform/routerboard_mipsel/Jamfile 
b/src/system/boot/platform/routerboard_mipsel/Jamfile
index 94f292d..979e6fd 100644
--- a/src/system/boot/platform/routerboard_mipsel/Jamfile
+++ b/src/system/boot/platform/routerboard_mipsel/Jamfile
@@ -23,7 +23,7 @@ local genericPlatformSources =
 #      video_splash.cpp
 ;
 
-KernelMergeObject boot_platform_routerboard_mipsel.o :
+BootMergeObject boot_platform_routerboard_mipsel.o :
        console.cpp
        cpu.cpp
        debug.c
diff --git a/src/system/boot/platform/u-boot/Jamfile 
b/src/system/boot/platform/u-boot/Jamfile
index 17327b8..7d9ba93 100644
--- a/src/system/boot/platform/u-boot/Jamfile
+++ b/src/system/boot/platform/u-boot/Jamfile
@@ -29,7 +29,7 @@ local uImageFakeOS = "netbsd" ;
 SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ;
 
 # First build the non arch dependent parts
-KernelMergeObject boot_platform_u-boot_common.o :
+BootMergeObject boot_platform_u-boot_common.o :
        start.cpp
        debug.cpp
        console.cpp
@@ -48,7 +48,7 @@ KernelMergeObject boot_platform_u-boot_common.o :
        : boot_platform_generic.a
 ;
 
-KernelMergeObject boot_platform_u-boot.o :
+BootMergeObject boot_platform_u-boot.o :
        : :
        # must come first to have _start_* at correct locations
        boot_platform_u-boot_$(TARGET_ARCH).o
diff --git a/src/system/boot/platform/u-boot/arch/arm/Jamfile 
b/src/system/boot/platform/u-boot/arch/arm/Jamfile
index a81e46b..2bf09c1 100644
--- a/src/system/boot/platform/u-boot/arch/arm/Jamfile
+++ b/src/system/boot/platform/u-boot/arch/arm/Jamfile
@@ -8,7 +8,7 @@ UsePrivateHeaders [ FDirName kernel arch $(TARGET_ARCH) board 
$(TARGET_BOOT_BOAR
 
 SubDirC++Flags -fno-rtti ;
 
-KernelMergeObject boot_platform_u-boot_arm.o :
+BootMergeObject boot_platform_u-boot_arm.o :
        # must come first to have _start_* at correct locations
        shell.S
 
diff --git a/src/system/boot/platform/u-boot/arch/ppc/Jamfile 
b/src/system/boot/platform/u-boot/arch/ppc/Jamfile
index ad93d59..46848e7 100644
--- a/src/system/boot/platform/u-boot/arch/ppc/Jamfile
+++ b/src/system/boot/platform/u-boot/arch/ppc/Jamfile
@@ -8,7 +8,7 @@ UsePrivateHeaders [ FDirName kernel arch $(TARGET_ARCH) board 
$(TARGET_BOOT_BOAR
 
 SubDirC++Flags -fno-rtti ;
 
-KernelMergeObject boot_platform_u-boot_ppc.o :
+BootMergeObject boot_platform_u-boot_ppc.o :
        # must come first to have _start_* at correct locations
        shell.S
 
diff --git a/src/system/ldscripts/x86_64/boot_loader_bios_ia32.ld 
b/src/system/ldscripts/x86_64/boot_loader_bios_ia32.ld
new file mode 100644
index 0000000..6cc9efd
--- /dev/null
+++ b/src/system/ldscripts/x86_64/boot_loader_bios_ia32.ld
@@ -0,0 +1,33 @@
+OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
+OUTPUT_ARCH(i386)
+
+ENTRY(_start)
+SECTIONS
+{
+       . = 0x10000;
+
+       /* text/read-only data */
+       .text : { *(.text .gnu.linkonce.t.*) }
+
+       . = ALIGN(0x4);
+       __ctor_list = .;
+       .ctors : { *(.ctors) }
+       __ctor_end = .;
+
+       .rodata : { *(.rodata .rodata.*) }
+
+       /* writable data  */
+       . = ALIGN(0x1000);
+       __data_start = .;
+       .data : { *(.data .gnu.linkonce.d.*) }
+
+       /* uninitialized data (in same segment as writable data) */
+       __bss_start = .;
+       .bss : { *(.bss) }
+
+       . = ALIGN(0x1000);
+       _end = . ;
+
+       /* Strip unnecessary stuff */
+       /DISCARD/ : { *(.comment .note .eh_frame .dtors .stab .stabstr .debug*) 
}
+}
diff --git a/src/system/ldscripts/x86_64/boot_loader_pxe_ia32.ld 
b/src/system/ldscripts/x86_64/boot_loader_pxe_ia32.ld
new file mode 100644
index 0000000..6cc9efd
--- /dev/null
+++ b/src/system/ldscripts/x86_64/boot_loader_pxe_ia32.ld
@@ -0,0 +1,33 @@
+OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
+OUTPUT_ARCH(i386)
+
+ENTRY(_start)
+SECTIONS
+{
+       . = 0x10000;
+
+       /* text/read-only data */
+       .text : { *(.text .gnu.linkonce.t.*) }
+
+       . = ALIGN(0x4);
+       __ctor_list = .;
+       .ctors : { *(.ctors) }
+       __ctor_end = .;
+
+       .rodata : { *(.rodata .rodata.*) }
+
+       /* writable data  */
+       . = ALIGN(0x1000);
+       __data_start = .;
+       .data : { *(.data .gnu.linkonce.d.*) }
+
+       /* uninitialized data (in same segment as writable data) */
+       __bss_start = .;
+       .bss : { *(.bss) }
+
+       . = ALIGN(0x1000);
+       _end = . ;
+
+       /* Strip unnecessary stuff */
+       /DISCARD/ : { *(.comment .note .eh_frame .dtors .stab .stabstr .debug*) 
}
+}

############################################################################

Commit:      07b33113a3b3a0e3ace703c48d1ac39faad2c6c0
URL:         http://cgit.haiku-os.org/haiku/commit/?id=07b3311
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jun 11 11:01:35 2012 UTC

Merge branch 'master' into x86_64

----------------------------------------------------------------------------

############################################################################

Commit:      2f3e39bebf0690998c95bce82b26a6435d8bf053
URL:         http://cgit.haiku-os.org/haiku/commit/?id=2f3e39b
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jun 11 11:09:36 2012 UTC

Fixed copyright date on arch_config.h.

----------------------------------------------------------------------------

diff --git a/headers/private/system/arch/x86_64/arch_config.h 
b/headers/private/system/arch/x86_64/arch_config.h
index e788a33..2c4e643 100644
--- a/headers/private/system/arch/x86_64/arch_config.h
+++ b/headers/private/system/arch/x86_64/arch_config.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004, Alex Smith, alex@xxxxxxxxxxxxxxxxx
+ * Copyright 2012, Alex Smith, alex@xxxxxxxxxxxxxxxxx
  * Distributed under the terms of the MIT License.
  */
 #ifndef _KERNEL_ARCH_x86_64_CONFIG_H

############################################################################

Commit:      0d916c34c4d2c15f233fac8ffefa8ee41f074b18
URL:         http://cgit.haiku-os.org/haiku/commit/?id=0d916c3
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jun 11 11:49:14 2012 UTC

x86_64: added linker script for the kernel.

* Based on the x86 one, changes made to match the default GCC x86_64 linker
  script and correct kernel load address added.
* Not tested yet as the kernel doesn't fully compile.

----------------------------------------------------------------------------

diff --git a/src/system/ldscripts/x86_64/kernel.ld 
b/src/system/ldscripts/x86_64/kernel.ld
new file mode 100644
index 0000000..f3db82d
--- /dev/null
+++ b/src/system/ldscripts/x86_64/kernel.ld
@@ -0,0 +1,55 @@
+OUTPUT_FORMAT("elf64-x86-64")
+OUTPUT_ARCH("i386:x86-64")
+
+ENTRY(_start)
+SECTIONS
+{
+       . = 0xFFFFFF8000000000 + SIZEOF_HEADERS;
+
+       .interp : { *(.interp) }
+       .hash : { *(.hash) }
+       .dynsym : { *(.dynsym) }
+       .dynstr : { *(.dynstr) }
+       .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
+       .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
+       .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
+       .rela.got : { *(.rela.got) }
+       .rela.ctors : { *(.rela.ctors) }
+       .rela.dtors : { *(.rela.dtors) }
+       .rela.init : { *(.rela.init) }
+       .rela.fini : { *(.rela.fini) }
+       .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
+       .rela.plt : { *(.rela.plt) }
+       .init : { *(.init) } =0x90909090
+       .plt : { *(.plt) }
+
+       /* text/read-only data */
+       .text : { *(.text .text.* .gnu.linkonce.t.*) } =0x90909090
+
+       .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
+
+       /* writable data  */
+       . = ALIGN(0x1000);
+       __data_start = .;
+       .data : { *(.data .data.* .gnu.linkonce.d.*) }
+
+       . = ALIGN(0x4);
+       __ctor_list = .;
+       .ctors : { *(.ctors) }
+       __ctor_end = .;
+       __dtor_list = .;
+       .dtors : { *(.dtors) }
+       __dtor_end = .;
+       .got : { *(.got.plt) *(.got) }
+       .dynamic : { *(.dynamic) }
+       
+       /* uninitialized data (in same segment as writable data) */
+       __bss_start = .;
+       .bss : { *(.bss .bss.* .gnu.linkonce.b.*) }
+
+       . = ALIGN(0x1000);
+       _end = . ;
+
+       /* Strip unnecessary stuff */
+       /DISCARD/ : { *(.comment .note .eh_frame) }
+}

############################################################################

Commit:      23d878482ed22e55dad6d1fca1df7bea42eb157c
URL:         http://cgit.haiku-os.org/haiku/commit/?id=23d8784
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jun 13 16:00:57 2012 UTC

Made *_addr_t {,un}signed long rather than long long on x86_64.

* long is 64-bit on x86_64.
* Makes addr_t compatible with size_t.

----------------------------------------------------------------------------

diff --git a/headers/config/types.h b/headers/config/types.h
index 8420979..f0140a0 100644
--- a/headers/config/types.h
+++ b/headers/config/types.h
@@ -38,20 +38,20 @@ typedef __haiku_std_int64   __haiku_int64;
 typedef __haiku_std_uint64     __haiku_uint64;
 
 /* address types */
-#ifdef __HAIKU_ARCH_64_BIT
-       typedef __haiku_int64   __haiku_saddr_t;
-       typedef __haiku_uint64  __haiku_addr_t;
-#else
-       typedef __haiku_int32   __haiku_saddr_t;
-       typedef __haiku_uint32  __haiku_addr_t;
-#endif
+typedef signed long int                __haiku_saddr_t;
+typedef        unsigned long int       __haiku_addr_t;
 
 #ifdef __HAIKU_ARCH_PHYSICAL_64_BIT
-       typedef __haiku_int64   __haiku_phys_saddr_t;
-       typedef __haiku_uint64  __haiku_phys_addr_t;
+#      if __HAIKU_ARCH_64_BIT
+               typedef signed long int         __haiku_phys_saddr_t;
+               typedef unsigned long int       __haiku_phys_addr_t;
+#      else
+               typedef signed long long        __haiku_phys_saddr_t;
+               typedef unsigned long long      __haiku_phys_addr_t;
+#      endif
 #else
-       typedef __haiku_int32   __haiku_phys_saddr_t;
-       typedef __haiku_uint32  __haiku_phys_addr_t;
+       typedef signed long int                 __haiku_phys_saddr_t;
+       typedef unsigned long int               __haiku_phys_addr_t;
 #endif
 
 /* address type limits */
@@ -85,16 +85,12 @@ typedef __haiku_std_uint64  __haiku_uint64;
 #endif
 #define        __HAIKU_PRI_PREFIX_64           __HAIKU_STD_PRI_PREFIX_64
 
-#ifdef __HAIKU_ARCH_64_BIT
-#      define __HAIKU_PRI_PREFIX_ADDR  __HAIKU_PRI_PREFIX_64
-#else
-#      define __HAIKU_PRI_PREFIX_ADDR  __HAIKU_PRI_PREFIX_32
-#endif
+#define __HAIKU_PRI_PREFIX_ADDR        "l"
 
-#ifdef __HAIKU_ARCH_PHYSICAL_64_BIT
-#      define __HAIKU_PRI_PREFIX_PHYS_ADDR     __HAIKU_PRI_PREFIX_64
+#if __HAIKU_ARCH_PHYSICAL_64_BIT && !__HAIKU_ARCH_64_BIT
+#      define __HAIKU_PRI_PREFIX_PHYS_ADDR     "ll"
 #else
-#      define __HAIKU_PRI_PREFIX_PHYS_ADDR     __HAIKU_PRI_PREFIX_32
+#      define __HAIKU_PRI_PREFIX_PHYS_ADDR     "l"
 #endif
 
 

############################################################################

Commit:      0e88a887b4a9ecaaf1062078d9ca9bfca78fcf3a
URL:         http://cgit.haiku-os.org/haiku/commit/?id=0e88a88
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jun 13 16:42:46 2012 UTC

First round of 64-bit safety fixes in the kernel.

* Most of this is incorrect printf format strings. Changed all strings
  causing errors to use the B_PRI* format string definitions, which
  means the strings should be correct across all platforms.
* Some other fixes for errors, casts required, etc.

----------------------------------------------------------------------------

diff --git a/src/system/kernel/cache/block_cache.cpp 
b/src/system/kernel/cache/block_cache.cpp
index b49bf6e..6a02dad 100644
--- a/src/system/kernel/cache/block_cache.cpp
+++ b/src/system/kernel/cache/block_cache.cpp
@@ -290,8 +290,8 @@ public:
 
        virtual void AddDump(TraceOutput& out)
        {
-               out.Print("block cache %p, %s %Ld, %c%c%c transaction %ld "
-                       "(previous id %ld)\n", fCache, _Action(), fBlockNumber,
+               out.Print("block cache %p, %s %" B_PRIu64 ", %c%c%c transaction 
%" B_PRId32
+                       " (previous id %" B_PRId32 ")\n", fCache, _Action(), 
fBlockNumber,
                        fIsDirty ? 'd' : '-', fHasOriginal ? 'o' : '-',
                        fHasParent ? 'p' : '-', fTransactionID, fPreviousID);
        }
@@ -388,7 +388,7 @@ public:
 
        virtual void AddDump(TraceOutput& out)
        {
-               out.Print("block cache %p, error %Ld, %s%s%s",
+               out.Print("block cache %p, error %" B_PRIu64 ", %s%s%s",
                        fCache, fBlockNumber, fMessage, fStatus != B_OK ? ": " 
: "",
                        fStatus != B_OK ? strerror(fStatus) : "");
        }
@@ -430,7 +430,7 @@ public:
 
        virtual void AddDump(TraceOutput& out)
        {
-               out.Print("block cache %p, block %Ld, data %c%c%c: %s",
+               out.Print("block cache %p, block %" B_PRIu64 ", data %c%c%c: 
%s",
                        fCache, fBlockNumber, fCurrent != NULL ? 'c' : '-',
                        fParent != NULL ? 'p' : '-', fOriginal != NULL ? 'o' : 
'-',
                        fMessage);
@@ -456,7 +456,7 @@ public:
        void DumpBlock(uint32 which, uint32 offset, uint32 size)
        {
                if (offset > fSize) {
-                       kprintf("invalid offset (block size %lu)\n", fSize);
+                       kprintf("invalid offset (block size %" B_PRIu32 ")\n", 
fSize);
                        return;
                }
                if (offset + size > fSize)
@@ -477,7 +477,7 @@ public:
                } else
                        return;
 
-               kprintf("%s: offset %lu, %lu bytes\n", label, offset, size);
+               kprintf("%s: offset %" B_PRIu32 ", %" B_PRIu32 " bytes\n", 
label, offset, size);
 
                static const uint32 kBlockSize = 16;
                data += offset;
@@ -485,7 +485,7 @@ public:
                for (uint32 i = 0; i < size;) {
                        int start = i;
 
-                       kprintf("  %04lx ", i);
+                       kprintf("  %04" B_PRIx32 " ", i);
                        for (; i < start + kBlockSize; i++) {
                                if (!(i % 4))
                                        kprintf(" ");
@@ -559,9 +559,9 @@ public:
 
        virtual void AddDump(TraceOutput& out)
        {
-               out.Print("block cache %p, %s transaction %p (id %ld)%s"
-                       ", %ld/%ld blocks", fCache, fLabel, fTransaction, fID,
-                       fSub ? " sub" : "", fNumBlocks, fSubNumBlocks);
+               out.Print("block cache %p, %s transaction %p (id %" B_PRId32 
")%s"
+                       ", %" B_PRId32 "/%" B_PRId32 " blocks", fCache, fLabel, 
fTransaction,
+                       fID, fSub ? " sub" : "", fNumBlocks, fSubNumBlocks);
        }
 
 private:
@@ -591,8 +591,8 @@ public:
 
        virtual void AddDump(TraceOutput& out)
        {
-               out.Print("block cache %p, detach transaction %p (id %ld)"
-                       "from transaction %p (id %ld)%s",
+               out.Print("block cache %p, detach transaction %p (id %" 
B_PRId32 ")"
+                       "from transaction %p (id %" B_PRId32 ")%s",
                        fCache, fNewTransaction, fNewID, fTransaction, fID,
                        fSub ? " sub" : "");
        }
@@ -639,9 +639,9 @@ public:
        virtual void AddDump(TraceOutput& out)
        {
                out.Print("block cache %p, abort transaction "
-                       "%p (id %ld), blocks", fCache, fTransaction, fID);
+                       "%p (id %" B_PRId32 "), blocks", fCache, fTransaction, 
fID);
                for (int32 i = 0; i < fNumBlocks && !out.IsFull(); i++)
-                       out.Print(" %Ld", fBlocks[i]);
+                       out.Print(" %" B_PRIdOFF, fBlocks[i]);
        }
 
 #if KTRACE_PRINTF_STACK_TRACE
@@ -1200,7 +1200,7 @@ BlockWriter::_WriteBlock(cached_block* block)
 {
        ASSERT(block->busy_writing);
 
-       TRACE(("BlockWriter::_WriteBlock(block %Ld)\n", block->block_number));
+       TRACE(("BlockWriter::_WriteBlock(block %" B_PRIdOFF ")\n", 
block->block_number));
        TB(Write(fCache, block));
        TB2(BlockData(fCache, block, "before write"));
 
@@ -1211,7 +1211,7 @@ BlockWriter::_WriteBlock(cached_block* block)
 
        if (written != (ssize_t)blockSize) {
                TB(Error(fCache, block->block_number, "write failed", written));
-               FATAL(("could not write back block %Ld (%s)\n", 
block->block_number,
+               FATAL(("could not write back block %" B_PRIdOFF " (%s)\n", 
block->block_number,
                        strerror(errno)));
                if (written < 0)
                        return errno;
@@ -1253,7 +1253,7 @@ BlockWriter::_BlockDone(cached_block* block, 
hash_iterator* iterator)
 
                // Has the previous transation been finished with that write?
                if (--previous->num_blocks == 0) {
-                       TRACE(("cache transaction %ld finished!\n", 
previous->id));
+                       TRACE(("cache transaction %" B_PRId32 " finished!\n", 
previous->id));
                        T(Action("written", fCache, previous));
 
                        notify_transaction_listeners(fCache, previous,
@@ -1394,7 +1394,7 @@ block_cache::FreeBlock(cached_block* block)
        Free(block->current_data);
 
        if (block->original_data != NULL || block->parent_data != NULL) {
-               panic("block_cache::FreeBlock(): %Ld, original %p, parent %p\n",
+               panic("block_cache::FreeBlock(): %" B_PRIdOFF ", original %p, 
parent %p\n",
                        block->block_number, block->original_data, 
block->parent_data);
        }
 
@@ -1478,7 +1478,7 @@ block_cache::RemoveUnusedBlocks(int32 count, int32 
minSecondsOld)
                        continue;
 
                TB(Flush(this, block));
-               TRACE(("  remove block %Ld, last accessed %" B_PRId32 "\n",
+               TRACE(("  remove block %" B_PRIdOFF ", last accessed %" 
B_PRId32 "\n",
                        block->block_number, block->last_accessed));
 
                // this can only happen if no transactions are used
@@ -1533,7 +1533,7 @@ block_cache::DiscardBlock(cached_block* block)
 void
 block_cache::_LowMemoryHandler(void* data, uint32 resources, int32 level)
 {
-       TRACE(("block_cache: low memory handler called with level %ld\n", 
level));
+       TRACE(("block_cache: low memory handler called with level %" B_PRId32 
"\n", level));
 
        // free some blocks according to the low memory state
        // (if there is enough memory left, we don't free any)
@@ -1573,8 +1573,8 @@ block_cache::_LowMemoryHandler(void* data, uint32 
resources, int32 level)
 
        cache->RemoveUnusedBlocks(free, secondsOld);
 
-       TRACE(("block_cache::_LowMemoryHandler(): %p: unused: %lu -> %lu\n", 
cache,
-               oldUnused, cache->unused_block_count));
+       TRACE(("block_cache::_LowMemoryHandler(): %p: unused: %" B_PRIu32 " -> 
%" B_PRIu32 "\n",
+               cache, oldUnused, cache->unused_block_count));
 }
 
 
@@ -1775,7 +1775,7 @@ static void
 put_cached_block(block_cache* cache, off_t blockNumber)
 {
        if (blockNumber < 0 || blockNumber >= cache->max_blocks) {
-               panic("put_cached_block: invalid block number %lld (max %lld)",
+               panic("put_cached_block: invalid block number %" B_PRIdOFF " 
(max %" B_PRIdOFF ")",
                        blockNumber, cache->max_blocks - 1);
        }
 
@@ -1806,7 +1806,7 @@ get_cached_block(block_cache* cache, off_t blockNumber, 
bool* _allocated,
        ASSERT_LOCKED_MUTEX(&cache->lock);
 
        if (blockNumber < 0 || blockNumber >= cache->max_blocks) {
-               panic("get_cached_block: invalid block number %lld (max %lld)",
+               panic("get_cached_block: invalid block number %" B_PRIdOFF " 
(max %" B_PRIdOFF ")",
                        blockNumber, cache->max_blocks - 1);
                return NULL;
        }
@@ -1831,7 +1831,7 @@ retry:
        }
 
        if (block->unused) {
-               //TRACE(("remove block %Ld from unused\n", blockNumber));
+               //TRACE(("remove block %" B_PRIdOFF " from unused\n", 
blockNumber));
                block->unused = false;
                cache->unused_blocks.Remove(block);
                cache->unused_block_count--;
@@ -1852,7 +1852,7 @@ retry:
                        cache->RemoveBlock(block);
                        TB(Error(cache, blockNumber, "read failed", bytesRead));
 
-                       FATAL(("could not read block %Ld: bytesRead: %ld, 
error: %s\n",
+                       FATAL(("could not read block %" B_PRIdOFF ": bytesRead: 
%zd, error: %s\n",
                                blockNumber, bytesRead, strerror(errno)));
                        return NULL;
                }
@@ -1879,11 +1879,11 @@ static void*
 get_writable_cached_block(block_cache* cache, off_t blockNumber, off_t base,
        off_t length, int32 transactionID, bool cleared)
 {
-       TRACE(("get_writable_cached_block(blockNumber = %Ld, transaction = 
%ld)\n",
+       TRACE(("get_writable_cached_block(blockNumber = %" B_PRIdOFF ", 
transaction = %" B_PRId32 ")\n",
                blockNumber, transactionID));
 
        if (blockNumber < 0 || blockNumber >= cache->max_blocks) {
-               panic("get_writable_cached_block: invalid block number %lld 
(max %lld)",
+               panic("get_writable_cached_block: invalid block number %" 
B_PRIdOFF " (max %" B_PRIdOFF ")",
                        blockNumber, cache->max_blocks - 1);
        }
 
@@ -1927,7 +1927,8 @@ get_writable_cached_block(block_cache* cache, off_t 
blockNumber, off_t base,
        if (transaction != NULL && transaction->id != transactionID) {
                // TODO: we have to wait here until the other transaction is 
done.
                //      Maybe we should even panic, since we can't prevent any 
deadlocks.
-               panic("get_writable_cached_block(): asked to get busy writable 
block (transaction %ld)\n", block->transaction->id);
+               panic("get_writable_cached_block(): asked to get busy writable 
block (transaction %" B_PRId32 ")\n",
+                       block->transaction->id);
                put_cached_block(cache, block);
                return NULL;
        }
@@ -1935,7 +1936,7 @@ get_writable_cached_block(block_cache* cache, off_t 
blockNumber, off_t base,
                // get new transaction
                transaction = lookup_transaction(cache, transactionID);
                if (transaction == NULL) {
-                       panic("get_writable_cached_block(): invalid transaction 
%ld!\n",
+                       panic("get_writable_cached_block(): invalid transaction 
%" B_PRId32 "!\n",
                                transactionID);
                        put_cached_block(cache, block);
                        return NULL;
@@ -2025,7 +2026,8 @@ get_writable_cached_block(block_cache* cache, off_t 
blockNumber, off_t base,
 static void
 dump_block(cached_block* block)
 {
-       kprintf("%08lx %9Ld %08lx %08lx %08lx %5ld %6ld %c%c%c%c%c%c %08lx 
%08lx\n",
+       kprintf("%08lx %9" B_PRIdOFF " %08lx %08lx %08lx %5" B_PRId32 " %6" 
B_PRId32
+               " %c%c%c%c%c%c %08lx %08lx\n",
                (addr_t)block, block->block_number,
                (addr_t)block->current_data, (addr_t)block->original_data,
                (addr_t)block->parent_data, block->ref_count, 
block->LastAccess(),
@@ -2047,8 +2049,8 @@ dump_block_long(cached_block* block)
 #if BLOCK_CACHE_DEBUG_CHANGED
        kprintf(" compare data:  %p\n", block->compare);
 #endif
-       kprintf(" ref_count:     %ld\n", block->ref_count);
-       kprintf(" accessed:      %ld\n", block->LastAccess());
+       kprintf(" ref_count:     %" B_PRId32 "\n", block->ref_count);
+       kprintf(" accessed:      %" B_PRId32 "\n", block->LastAccess());
        kprintf(" flags:        ");
        if (block->busy_reading)
                kprintf(" busy_reading");
@@ -2064,15 +2066,15 @@ dump_block_long(cached_block* block)
                kprintf(" discard");
        kprintf("\n");
        if (block->transaction != NULL) {
-               kprintf(" transaction:   %p (%ld)\n", block->transaction,
+               kprintf(" transaction:   %p (%" B_PRId32 ")\n", 
block->transaction,
                        block->transaction->id);
                if (block->transaction_next != NULL) {
-                       kprintf(" next in transaction: %Ld\n",
+                       kprintf(" next in transaction: %" B_PRIdOFF "\n",
                                block->transaction_next->block_number);
                }
        }
        if (block->previous_transaction != NULL) {
-               kprintf(" previous transaction: %p (%ld)\n",
+               kprintf(" previous transaction: %p (%" B_PRId32 ")\n",
                        block->previous_transaction,
                        block->previous_transaction->id);
        }
@@ -2138,20 +2140,20 @@ dump_cache(int argc, char** argv)
                if (block != NULL)
                        dump_block_long(block);
                else
-                       kprintf("block %Ld not found\n", blockNumber);
+                       kprintf("block %" B_PRIdOFF " not found\n", 
blockNumber);
                return 0;
        }
 
        kprintf("BLOCK CACHE: %p\n", cache);
 
        kprintf(" fd:           %d\n", cache->fd);
-       kprintf(" max_blocks:   %Ld\n", cache->max_blocks);
-       kprintf(" block_size:   %lu\n", cache->block_size);
-       kprintf(" next_transaction_id: %ld\n", cache->next_transaction_id);
+       kprintf(" max_blocks:   %" B_PRIdOFF "\n", cache->max_blocks);
+       kprintf(" block_size:   %zu\n", cache->block_size);
+       kprintf(" next_transaction_id: %" B_PRId32 "\n", 
cache->next_transaction_id);
        kprintf(" buffer_cache: %p\n", cache->buffer_cache);
-       kprintf(" busy_reading: %lu, %s waiters\n", cache->busy_reading_count,
+       kprintf(" busy_reading: %" B_PRIu32 ", %s waiters\n", 
cache->busy_reading_count,
                cache->busy_reading_waiters ? "has" : "no");
-       kprintf(" busy_writing: %lu, %s waiters\n", cache->busy_writing_count,
+       kprintf(" busy_writing: %" B_PRIu32 ", %s waiters\n", 
cache->busy_writing_count,
                cache->busy_writing_waiters ? "has" : "no");
 
        if (!cache->pending_notifications.IsEmpty()) {
@@ -2162,7 +2164,7 @@ dump_cache(int argc, char** argv)
                while (iterator.HasNext()) {
                        cache_notification* notification = iterator.Next();
 
-                       kprintf("  %p %5lx %p - %p\n", notification,
+                       kprintf("  %p %5" B_PRIx32 " %p - %p\n", notification,
                                notification->events_pending, 
notification->hook,
                                notification->data);
                }
@@ -2178,8 +2180,8 @@ dump_cache(int argc, char** argv)
                cache_transaction* transaction;
                while ((transaction = (cache_transaction*)hash_next(
                                cache->transaction_hash, &iterator)) != NULL) {
-                       kprintf("%p %5ld %-7s %5ld %5ld %5ld\n", transaction,
-                               transaction->id, transaction->open ? "open" : 
"closed",
+                       kprintf("%p %5" B_PRId32 " %-7s %5" B_PRId32 " %5" 
B_PRId32 " %5" B_PRId32 "\n",
+                               transaction, transaction->id, transaction->open 
? "open" : "closed",
                                transaction->num_blocks, 
transaction->main_num_blocks,
                                transaction->sub_num_blocks);
                }
@@ -2211,9 +2213,10 @@ dump_cache(int argc, char** argv)
                count++;
        }
 
-       kprintf(" %ld blocks total, %ld dirty, %ld discarded, %ld referenced, 
%ld "
-               "busy, %" B_PRIu32 " in unused.\n", count, dirty, discarded, 
referenced,
-               cache->busy_reading_count, cache->unused_block_count);
+       kprintf(" %" B_PRIu32 " blocks total, %" B_PRIu32 " dirty, %" B_PRIu32 
" discarded"
+               ", %" B_PRIu32 " referenced, %" B_PRIu32 " busy, %" B_PRIu32 " 
in unused.\n",
+               count, dirty, discarded, referenced, cache->busy_reading_count,
+               cache->unused_block_count);
 
        hash_close(cache->hash, &iterator, false);
        return 0;
@@ -2244,20 +2247,20 @@ dump_transaction(int argc, char** argv)
                int32 id = parse_expression(argv[i + 1]);
                transaction = lookup_transaction(cache, id);
                if (transaction == NULL) {
-                       kprintf("No transaction with ID %ld found.\n", id);
+                       kprintf("No transaction with ID %" B_PRId32 " 
found.\n", id);
                        return 0;
                }
        }
 
        kprintf("TRANSACTION %p\n", transaction);
 
-       kprintf(" id:             %ld\n", transaction->id);
-       kprintf(" num block:      %ld\n", transaction->num_blocks);
-       kprintf(" main num block: %ld\n", transaction->main_num_blocks);
-       kprintf(" sub num block:  %ld\n", transaction->sub_num_blocks);
+       kprintf(" id:             %" B_PRId32 "\n", transaction->id);
+       kprintf(" num block:      %" B_PRId32 "\n", transaction->num_blocks);
+       kprintf(" main num block: %" B_PRId32 "\n", 
transaction->main_num_blocks);
+       kprintf(" sub num block:  %" B_PRId32 "\n", 
transaction->sub_num_blocks);
        kprintf(" has sub:        %d\n", transaction->has_sub_transaction);
        kprintf(" state:          %s\n", transaction->open ? "open" : "closed");
-       kprintf(" idle:           %Ld secs\n",
+       kprintf(" idle:           %" B_PRId64 " secs\n",
                (system_time() - transaction->last_used) / 1000000);
 
        kprintf(" listeners:\n");
@@ -2266,7 +2269,7 @@ dump_transaction(int argc, char** argv)
        while (iterator.HasNext()) {
                cache_listener* listener = iterator.Next();
 
-               kprintf("  %p %5lx %p - %p\n", listener, 
listener->events_pending,
+               kprintf("  %p %5" B_PRIx32 " %p - %p\n", listener, 
listener->events_pending,
                        listener->hook, listener->data);
        }
 
@@ -2400,7 +2403,7 @@ dump_block_data(int argc, char** argv)
                if (length > 0 && dump[length - 1] == '\n')
                        length--;
 
-               kprintf("%5ld. %.*s\n", index, length, dump);
+               kprintf("%5" B_PRId32 ". %.*s\n", index, length, dump);
 
                if (printStackTrace) {
                        out.Clear();
@@ -2673,7 +2676,7 @@ cache_start_transaction(void* _cache)
        TransactionLocker locker(cache);
 
        if (cache->last_transaction && cache->last_transaction->open) {
-               panic("last transaction (%ld) still open!\n",
+               panic("last transaction (%" B_PRId32 ") still open!\n",
                        cache->last_transaction->id);
        }
 
@@ -2684,7 +2687,7 @@ cache_start_transaction(void* _cache)
        transaction->id = atomic_add(&cache->next_transaction_id, 1);
        cache->last_transaction = transaction;
 
-       TRACE(("cache_start_transaction(): id %ld started\n", transaction->id));
+       TRACE(("cache_start_transaction(): id %" B_PRId32 " started\n", 
transaction->id));
        T(Action("start", cache, transaction));
 
        hash_insert_grow(cache->transaction_hash, transaction);
@@ -2699,7 +2702,7 @@ cache_sync_transaction(void* _cache, int32 id)
        block_cache* cache = (block_cache*)_cache;
        bool hadBusy;
 
-       TRACE(("cache_sync_transaction(id %ld)\n", id));
+       TRACE(("cache_sync_transaction(id %" B_PRId32 ")\n", id));
 
        do {
                TransactionLocker locker(cache);
@@ -2754,7 +2757,7 @@ cache_end_transaction(void* _cache, int32 id,
        block_cache* cache = (block_cache*)_cache;
        TransactionLocker locker(cache);
 
-       TRACE(("cache_end_transaction(id = %ld)\n", id));
+       TRACE(("cache_end_transaction(id = %" B_PRId32 ")\n", id));
 
        cache_transaction* transaction = lookup_transaction(cache, id);
        if (transaction == NULL) {
@@ -2830,7 +2833,7 @@ cache_abort_transaction(void* _cache, int32 id)
        block_cache* cache = (block_cache*)_cache;
        TransactionLocker locker(cache);
 
-       TRACE(("cache_abort_transaction(id = %ld)\n", id));
+       TRACE(("cache_abort_transaction(id = %" B_PRId32 ")\n", id));
 
        cache_transaction* transaction = lookup_transaction(cache, id);
        if (transaction == NULL) {
@@ -2849,8 +2852,8 @@ cache_abort_transaction(void* _cache, int32 id)
                next = block->transaction_next;
 
                if (block->original_data != NULL) {
-                       TRACE(("cache_abort_transaction(id = %ld): restored 
contents of "
-                               "block %Ld\n", transaction->id, 
block->block_number));
+                       TRACE(("cache_abort_transaction(id = %" B_PRId32 "): 
restored contents of "
+                               "block %" B_PRIdOFF "\n", transaction->id, 
block->block_number));
                        memcpy(block->current_data, block->original_data,
                                cache->block_size);
                        cache->Free(block->original_data);
@@ -2884,7 +2887,7 @@ cache_detach_sub_transaction(void* _cache, int32 id,
        block_cache* cache = (block_cache*)_cache;
        TransactionLocker locker(cache);
 
-       TRACE(("cache_detach_sub_transaction(id = %ld)\n", id));
+       TRACE(("cache_detach_sub_transaction(id = %" B_PRId32 ")\n", id));
 
        cache_transaction* transaction = lookup_transaction(cache, id);
        if (transaction == NULL) {
@@ -2995,7 +2998,7 @@ cache_abort_sub_transaction(void* _cache, int32 id)
        block_cache* cache = (block_cache*)_cache;
        TransactionLocker locker(cache);
 
-       TRACE(("cache_abort_sub_transaction(id = %ld)\n", id));
+       TRACE(("cache_abort_sub_transaction(id = %" B_PRId32 ")\n", id));
 
        cache_transaction* transaction = lookup_transaction(cache, id);
        if (transaction == NULL) {
@@ -3023,8 +3026,8 @@ cache_abort_sub_transaction(void* _cache, int32 id)
                                cache->block_size);
                } else if (block->parent_data != block->current_data) {
                        // the block has been changed and must be restored
-                       TRACE(("cache_abort_sub_transaction(id = %ld): restored 
contents "
-                               "of block %Ld\n", transaction->id, 
block->block_number));
+                       TRACE(("cache_abort_sub_transaction(id = %" B_PRId32 
"): restored contents "
+                               "of block %" B_PRIdOFF "\n", transaction->id, 
block->block_number));
                        memcpy(block->current_data, block->parent_data, 
cache->block_size);
                        cache->Free(block->parent_data);
                }
@@ -3047,11 +3050,11 @@ cache_start_sub_transaction(void* _cache, int32 id)
        block_cache* cache = (block_cache*)_cache;
        TransactionLocker locker(cache);
 
-       TRACE(("cache_start_sub_transaction(id = %ld)\n", id));
+       TRACE(("cache_start_sub_transaction(id = %" B_PRId32 ")\n", id));
 
        cache_transaction* transaction = lookup_transaction(cache, id);
        if (transaction == NULL) {
-               panic("cache_start_sub_transaction(): invalid transaction ID 
%ld\n",
+               panic("cache_start_sub_transaction(): invalid transaction ID %" 
B_PRId32 "\n",
                        id);
                return B_BAD_VALUE;
        }
@@ -3353,7 +3356,7 @@ block_cache_sync_etc(void* _cache, off_t blockNumber, 
size_t numBlocks)
        // transaction or no transaction only
 
        if (blockNumber < 0 || blockNumber >= cache->max_blocks) {
-               panic("block_cache_sync_etc: invalid block number %Ld (max 
%Ld)",
+               panic("block_cache_sync_etc: invalid block number %" B_PRIdOFF 
" (max %" B_PRIdOFF ")",
                        blockNumber, cache->max_blocks - 1);
                return B_BAD_VALUE;
        }
@@ -3424,7 +3427,7 @@ block_cache_discard(void* _cache, off_t blockNumber, 
size_t numBlocks)
                } else {
                        if (block->transaction != NULL && block->parent_data != 
NULL
                                && block->parent_data != block->current_data) {
-                               panic("Discarded block %Ld has already been 
changed in this "
+                               panic("Discarded block %" B_PRIdOFF " has 
already been changed in this "
                                        "transaction!", blockNumber);
                        }
 
@@ -3465,7 +3468,7 @@ block_cache_get_writable_etc(void* _cache, off_t 
blockNumber, off_t base,
        block_cache* cache = (block_cache*)_cache;
        MutexLocker locker(&cache->lock);
 
-       TRACE(("block_cache_get_writable_etc(block = %Ld, transaction = %ld)\n",
+       TRACE(("block_cache_get_writable_etc(block = %" B_PRIdOFF ", 
transaction = %" B_PRId32 ")\n",
                blockNumber, transaction));
        if (cache->read_only)
                panic("tried to get writable block on a read-only cache!");
@@ -3489,7 +3492,7 @@ block_cache_get_empty(void* _cache, off_t blockNumber, 
int32 transaction)
        block_cache* cache = (block_cache*)_cache;
        MutexLocker locker(&cache->lock);
 
-       TRACE(("block_cache_get_empty(block = %Ld, transaction = %ld)\n",
+       TRACE(("block_cache_get_empty(block = %" B_PRIdOFF ", transaction = %" 
B_PRId32 ")\n",
                blockNumber, transaction));
        if (cache->read_only)
                panic("tried to get empty writable block on a read-only 
cache!");
diff --git a/src/system/kernel/cache/file_cache.cpp 
b/src/system/kernel/cache/file_cache.cpp
index 2825ef1..01257d7 100644
--- a/src/system/kernel/cache/file_cache.cpp
+++ b/src/system/kernel/cache/file_cache.cpp
@@ -555,7 +555,7 @@ write_to_cache(file_cache_ref* ref, void* cookie, off_t 
offset,
                generic_addr_t last = vecs[vecCount - 1].base
                        + vecs[vecCount - 1].length - B_PAGE_SIZE;
 
-               if (offset + pageOffset + bufferSize == 
ref->cache->virtual_end) {
+               if ((off_t)(offset + pageOffset + bufferSize) == 
ref->cache->virtual_end) {
                        // the space in the page after this write action needs 
to be cleaned
                        vm_memset_physical(last + lastPageOffset, 0,
                                B_PAGE_SIZE - lastPageOffset);
@@ -724,7 +724,7 @@ cache_io(void* _cacheRef, void* cookie, off_t offset, 
addr_t buffer,
        size_t size = *_size;
        offset -= pageOffset;
 
-       if (offset + pageOffset + size > fileSize) {
+       if ((off_t)(offset + pageOffset + size) > fileSize) {
                // adapt size to be within the file's offsets
                size = fileSize - pageOffset - offset;
                *_size = size;
@@ -951,7 +951,7 @@ cache_prefetch_vnode(struct vnode* vnode, off_t offset, 
size_t size)
        file_cache_ref* ref = ((VMVnodeCache*)cache)->FileCacheRef();
        off_t fileSize = cache->virtual_end;
 
-       if (offset + size > fileSize)
+       if ((off_t)(offset + size) > fileSize)
                size = fileSize - offset;
 
        // "offset" and "size" are always aligned to B_PAGE_SIZE,
@@ -1088,7 +1088,7 @@ file_cache_init_post_boot_device(void)
 
        if (get_module("file_cache/launch_speedup/v1",
                        (module_info**)&sCacheModule) == B_OK) {
-               dprintf("** opened launch speedup: %Ld\n", system_time());
+               dprintf("** opened launch speedup: %" B_PRId64 "\n", 
system_time());
        }
        return B_OK;
 }
diff --git a/src/system/kernel/cache/file_map.cpp 
b/src/system/kernel/cache/file_map.cpp
index d9e0ddc..931bc0f 100644
--- a/src/system/kernel/cache/file_map.cpp
+++ b/src/system/kernel/cache/file_map.cpp
@@ -412,10 +412,10 @@ FileMap::Translate(off_t offset, size_t size, 
file_io_vec* vecs, size_t* _count,
                *_count = 0;
                return B_OK;
        }
-       if (offset + size > fSize) {
+       if ((off_t)(offset + size) > fSize) {
                if (align > 1) {
                        off_t alignedSize = (fSize + align - 1) & 
~(off_t)(align - 1);
-                       if (offset + size >= alignedSize)
+                       if ((off_t)(offset + size) >= alignedSize)
                                padLastVec = alignedSize - fSize;
                }
                size = fSize - offset;
@@ -441,7 +441,7 @@ FileMap::Translate(off_t offset, size_t size, file_io_vec* 
vecs, size_t* _count,
                vecs[0].offset = -1;
        vecs[0].length = fileExtent->disk.length - offset;
 
-       if (vecs[0].length >= size) {
+       if (vecs[0].length >= (off_t)size) {
                vecs[0].length = size + padLastVec;
                *_count = 1;
                return B_OK;
@@ -457,7 +457,7 @@ FileMap::Translate(off_t offset, size_t size, file_io_vec* 
vecs, size_t* _count,
 
                vecs[vecIndex++] = fileExtent->disk;
 
-               if (size <= fileExtent->disk.length) {
+               if ((off_t)size <= fileExtent->disk.length) {
                        vecs[vecIndex - 1].length = size + padLastVec;
                        break;
                }
@@ -499,7 +499,7 @@ dump_file_map(int argc, char** argv)
        }
 
        kprintf("FileMap %p\n", map);
-       kprintf("  size    %Ld\n", map->Size());
+       kprintf("  size    %" B_PRIdOFF "\n", map->Size());
        kprintf("  count   %lu\n", map->Count());
 
        if (!printExtents)
@@ -508,8 +508,9 @@ dump_file_map(int argc, char** argv)
        for (uint32 i = 0; i < map->Count(); i++) {
                file_extent* extent = map->ExtentAt(i);
 
-               kprintf("  [%lu] offset %Ld, disk offset %Ld, length %Ld\n",
-                       i, extent->offset, extent->disk.offset, 
extent->disk.length);
+               kprintf("  [%" B_PRIu32 "] offset %" B_PRIdOFF ", disk offset %"
+                       B_PRIdOFF ", length %" B_PRIdOFF "\n", i, 
extent->offset,
+                       extent->disk.offset, extent->disk.length);
        }
 
        return 0;
@@ -555,9 +556,10 @@ dump_file_map_stats(int argc, char** argv)
                count++;
        }
 
-       kprintf("%ld file maps (%ld empty), %Ld file bytes in total, %Ld bytes "
-               "cached, %lu extents\n", count, emptyCount, size, mapSize, 
extents);
-       kprintf("average %lu extents per map for %Ld bytes.\n",
+       kprintf("%" B_PRId32 " file maps (%" B_PRIu32 " empty), %" B_PRIdOFF " 
file"
+               " bytes in total, %" B_PRIdOFF " bytes cached, %" B_PRIu32 " 
extents\n",
+               count, emptyCount, size, mapSize, extents);
+       kprintf("average %" B_PRIu32 " extents per map for %" B_PRIdOFF " 
bytes.\n",
                extents / (count - emptyCount), mapSize / (count - emptyCount));
 
        return 0;
diff --git a/src/system/kernel/condition_variable.cpp 
b/src/system/kernel/condition_variable.cpp
index ef0dcd2..4721560 100644
--- a/src/system/kernel/condition_variable.cpp
+++ b/src/system/kernel/condition_variable.cpp
@@ -315,7 +315,7 @@ ConditionVariable::Dump() const
 
        for (EntryList::ConstIterator it = fEntries.GetIterator();
                 ConditionVariableEntry* entry = it.Next();) {
-               kprintf(" %ld", entry->fThread->id);
+               kprintf(" %" B_PRId32, entry->fThread->id);
        }
        kprintf("\n");
 }
@@ -330,7 +330,7 @@ ConditionVariable::_Notify(bool all, bool schedulerLocked, 
status_t result)
 
        if (!fEntries.IsEmpty()) {
                if (result > B_OK) {
-                       panic("tried to notify with invalid result %ld\n", 
result);
+                       panic("tried to notify with invalid result %" B_PRId32 
"\n", result);
                        result = B_ERROR;
                }
 
diff --git a/src/system/kernel/elf.cpp b/src/system/kernel/elf.cpp
index ad3c291..64dd51a 100644
--- a/src/system/kernel/elf.cpp
+++ b/src/system/kernel/elf.cpp
@@ -9,6 +9,8 @@
 
 /*!    Contains the ELF loader */
 
+#ifndef __x86_64__
+
 #include <elf.h>
 
 #include <OS.h>
@@ -2587,3 +2589,4 @@ _user_read_kernel_image_symbols(image_id id, struct 
Elf32_Sym* symbolTable,
 
        return B_OK;
 }
+#endif
\ No newline at end of file
diff --git a/src/system/kernel/heap.cpp b/src/system/kernel/heap.cpp
index 38c4dea..a2815bf 100644
--- a/src/system/kernel/heap.cpp
+++ b/src/system/kernel/heap.cpp
@@ -313,8 +313,9 @@ dump_page(heap_page *page)
                count++;
 
        kprintf("\t\tpage %p: bin_index: %u; free_count: %u; empty_index: %u; "
-               "free_list %p (%lu entr%s)\n", page, page->bin_index, 
page->free_count,
-               page->empty_index, page->free_list, count, count == 1 ? "y" : 
"ies");
+               "free_list %p (%" B_PRIu32 " entr%s)\n", page, page->bin_index,
+               page->free_count, page->empty_index, page->free_list, count,
+               count == 1 ? "y" : "ies");
 }
 
 
@@ -325,8 +326,9 @@ dump_bin(heap_bin *bin)
        for (heap_page *page = bin->page_list; page != NULL; page = page->next)
                count++;
 
-       kprintf("\telement_size: %lu; max_free_count: %u; page_list %p (%lu 
pages"
-               ");\n", bin->element_size, bin->max_free_count, bin->page_list, 
count);
+       kprintf("\telement_size: %" B_PRIu32 "; max_free_count: %u; page_list 
%p "
+               "(%" B_PRIu32 " pages);\n", bin->element_size, 
bin->max_free_count,
+               bin->page_list, count);
 
        for (heap_page *page = bin->page_list; page != NULL; page = page->next)
                dump_page(page);
@@ -347,10 +349,11 @@ dump_allocator_areas(heap_allocator *heap)
 {
        heap_area *area = heap->all_areas;
        while (area) {
-               kprintf("\tarea %p: area: %ld; base: 0x%08lx; size: %lu; 
page_count: "
-                       "%lu; free_pages: %p (%lu entr%s)\n", area, area->area, 
area->base,
-                       area->size, area->page_count, area->free_pages,
-                       area->free_page_count, area->free_page_count == 1 ? "y" 
: "ies");
+               kprintf("\tarea %p: area: %" B_PRId32 "; base: %p; size: %zu; 
page_count: "
+                       "%" B_PRIu32 "; free_pages: %p (%" B_PRIu32 " 
entr%s)\n", area,
+                       area->area, (void *)area->base, area->size, 
area->page_count,
+                       area->free_pages, area->free_page_count,
+                       area->free_page_count == 1 ? "y" : "ies");
                area = area->all_next;
        }
 
@@ -361,10 +364,11 @@ dump_allocator_areas(heap_allocator *heap)
 static void
 dump_allocator(heap_allocator *heap, bool areas, bool bins)
 {
-       kprintf("allocator %p: name: %s; page_size: %lu; bin_count: %lu; pages: 
"
-               "%lu; free_pages: %lu; empty_areas: %lu\n", heap, heap->name,
-               heap->page_size, heap->bin_count, heap->total_pages,
-               heap->total_free_pages, heap->empty_areas);
+       kprintf("allocator %p: name: %s; page_size: %" B_PRIu32 "; bin_count: "
+               "%" B_PRIu32 "; pages: %" B_PRIu32 "; free_pages: %" B_PRIu32 
"; "
+               "empty_areas: %" B_PRIu32 "\n", heap, heap->name, 
heap->page_size,
+               heap->bin_count, heap->total_pages, heap->total_free_pages,
+               heap->empty_areas);
 
        if (areas)
                dump_allocator_areas(heap);
@@ -481,8 +485,8 @@ dump_allocations(int argc, char **argv)
                                                        continue;
 
                                                if (!statsOnly) {
-                                                       kprintf("address: 
0x%08lx; size: %lu bytes\n",
-                                                               base, 
elementSize);
+                                                       kprintf("address: 0x%p; 
size: %lu bytes\n",
+                                                               (void *)base, 
elementSize);
                                                }
 
                                                totalSize += elementSize;
@@ -502,7 +506,7 @@ dump_allocations(int argc, char **argv)
                                        size_t size = pageCount * 
heap->page_size;
 
                                        if (!statsOnly) {
-                                               kprintf("address: 0x%08lx; 
size: %lu bytes\n", base,
+                                               kprintf("address: %p; size: %lu 
bytes\n", (void *)base,
                                                        size);
                                        }
 
@@ -521,7 +525,7 @@ dump_allocations(int argc, char **argv)
                        break;
        }
 
-       kprintf("total allocations: %lu; total bytes: %lu\n", totalCount, 
totalSize);
+       kprintf("total allocations: %" B_PRIu32 "; total bytes: %zu\n", 
totalCount, totalSize);
        return 0;
 }
 
@@ -1096,9 +1100,9 @@ heap_add_area(heap_allocator *heap, area_id areaID, 
addr_t base, size_t size)
        pageLocker.Unlock();
        areaWriteLocker.Unlock();
 
-       dprintf("heap_add_area: area %ld added to %s heap %p - usable range 
0x%08lx "
-               "- 0x%08lx\n", area->area, heap->name, heap, area->base,
-               area->base + area->size);
+       dprintf("heap_add_area: area %" B_PRId32 " added to %s heap %p - usable 
"
+               "range %p - %p\n", area->area, heap->name, heap, (void 
*)area->base,
+               (void *)(area->base + area->size));
 }
 
 
@@ -1142,9 +1146,9 @@ heap_remove_area(heap_allocator *heap, heap_area *area)
        heap->total_pages -= area->page_count;
        heap->total_free_pages -= area->free_page_count;
 
-       dprintf("heap_remove_area: area %ld with range 0x%08lx - 0x%08lx 
removed "
-               "from %s heap %p\n", area->area, area->base, area->base + 
area->size,
-               heap->name, heap);
+       dprintf("heap_remove_area: area %" B_PRId32 " with range %p - %p 
removed "
+               "from %s heap %p\n", area->area, (void *)area->base,
+               (void *)(area->base + area->size), heap->name, heap);
 
        return B_OK;
 }
@@ -1659,7 +1663,7 @@ heap_free(heap_allocator *heap, void *address)
                if (((addr_t)address - area->base - page->index
                        * heap->page_size) % bin->element_size != 0) {
                        panic("free(): passed invalid pointer %p supposed to be 
in bin for "
-                               "element size %ld\n", address, 
bin->element_size);
+                               "element size %" B_PRIu32 "\n", address, 
bin->element_size);
                        return B_ERROR;
                }
 
diff --git a/src/system/kernel/image.cpp b/src/system/kernel/image.cpp
index 05bd513..787124d 100644
--- a/src/system/kernel/image.cpp
+++ b/src/system/kernel/image.cpp
@@ -254,21 +254,22 @@ dump_images_list(int argc, char **argv)
                team_id id = strtol(argv[1], NULL, 0);
                team = team_get_team_struct_locked(id);
                if (team == NULL) {
-                       kprintf("No team with ID %ld found\n", id);
+                       kprintf("No team with ID %" B_PRId32 " found\n", id);
                        return 1;
                }
        } else
                team = thread_get_current_thread()->team;
 
-       kprintf("Registered images of team %ld\n", team->id);
+       kprintf("Registered images of team %" B_PRId32 "\n", team->id);
        kprintf("    ID text       size    data       size    name\n");
 
        while ((image = (struct image*)list_get_next_item(&team->image_list, 
image))
                        != NULL) {
                image_info *info = &image->info;
 
-               kprintf("%6ld %p %-7ld %p %-7ld %s\n", info->id, info->text, 
info->text_size,
-                       info->data, info->data_size, info->name);
+               kprintf("%6" B_PRId32 " %p %-7" B_PRId32 " %p %-7" B_PRId32 " 
%s\n",
+                       info->id, info->text, info->text_size, info->data, 
info->data_size,
+                       info->name);
        }
 
        return 0;
@@ -417,8 +418,8 @@ _user_image_relocated(image_id id)
        // get an image info
        error = _get_image_info(id, &info, sizeof(image_info));
        if (error != B_OK) {
-               dprintf("_user_image_relocated(%ld): Failed to get image info: 
%lx\n",
-                       id, error);
+               dprintf("_user_image_relocated(%" B_PRId32 "): Failed to get 
image "
+                       "info: %" B_PRIx32 "\n", id, error);
                return;
        }
 
diff --git a/src/system/kernel/int.cpp b/src/system/kernel/int.cpp
index d30b320..59c9671 100644
--- a/src/system/kernel/int.cpp
+++ b/src/system/kernel/int.cpp
@@ -80,7 +80,7 @@ dump_int_statistics(int argc, char **argv)
                        && sVectors[i].handler_list == NULL)
                        continue;
 
-               kprintf("int %3d, enabled %ld, handled %8lld, unhandled 
%8lld%s%s\n",
+               kprintf("int %3d, enabled %" B_PRId32 ", handled %8lld, 
unhandled %8lld%s%s\n",
                        i, sVectors[i].enable_count, sVectors[i].handled_count,
                        sVectors[i].unhandled_count,
                        B_SPINLOCK_IS_LOCKED(&sVectors[i].vector_lock) ? ", 
ACTIVE" : "",
diff --git a/src/system/kernel/low_resource_manager.cpp 
b/src/system/kernel/low_resource_manager.cpp
index d64b675..55962db 100644
--- a/src/system/kernel/low_resource_manager.cpp
+++ b/src/system/kernel/low_resource_manager.cpp
@@ -59,9 +59,9 @@ static off_t sWarnMemoryLimit;
 static off_t sCriticalMemoryLimit;
 
 // address space limits
-static const off_t kMinNoteSpaceLimit          = 128 * 1024 * 1024;
-static const off_t kMinWarnSpaceLimit          = 64 * 1024 * 1024;
-static const off_t kMinCriticalSpaceLimit      = 32 * 1024 * 1024;
+static const size_t kMinNoteSpaceLimit         = 128 * 1024 * 1024;
+static const size_t kMinWarnSpaceLimit         = 64 * 1024 * 1024;
+static const size_t kMinCriticalSpaceLimit     = 32 * 1024 * 1024;
 
 
 static int32 sLowPagesState = B_NO_LOW_RESOURCE;
@@ -310,8 +310,8 @@ dump_handlers(int argc, char** argv)
                        handler->resources & B_KERNEL_RESOURCE_SEMAPHORES ? 's' 
: ' ',
                        handler->resources & B_KERNEL_RESOURCE_ADDRESS_SPACE ? 
'a' : ' ');
 
-               kprintf("%p  %p   %s      %4ld  %s\n", handler->function, 
handler->data,
-                       resources, handler->priority, symbol);
+               kprintf("%p  %p   %s      %4" B_PRId32 "  %s\n", 
handler->function,
+                       handler->data, resources, handler->priority, symbol);
        }
 
        return 0;
diff --git a/src/system/kernel/main.cpp b/src/system/kernel/main.cpp
index a5797d8..6ce9648 100644
--- a/src/system/kernel/main.cpp
+++ b/src/system/kernel/main.cpp
@@ -361,7 +361,7 @@ main2(void *unused)
                        resume_thread(thread);
                        TRACE("Bootscript started\n");
                } else
-                       dprintf("error starting \"%s\" error = %ld \n", 
args[0], thread);
+                       dprintf("error starting \"%s\" error = %" B_PRId32 " 
\n", args[0], thread);
        }
 
        return 0;
diff --git a/src/system/kernel/module.cpp b/src/system/kernel/module.cpp
index 0c0be15..202fb7c 100644
--- a/src/system/kernel/module.cpp
+++ b/src/system/kernel/module.cpp
@@ -457,7 +457,7 @@ unload_module_image(module_image* moduleImage, bool remove)
        ASSERT_LOCKED_RECURSIVE(&sModulesLock);
 
        if (moduleImage->ref_count != 0) {
-               FATAL(("Can't unload %s due to ref_cnt = %ld\n", 
moduleImage->path,
+               FATAL(("Can't unload %s due to ref_cnt = %" B_PRId32 "\n", 
moduleImage->path,
                        moduleImage->ref_count));
                return B_ERROR;
        }
@@ -1172,8 +1172,8 @@ dump_modules(int argc, char** argv)
 
        while ((module = (struct module*)hash_next(sModulesHash, &iterator))
                        != NULL) {
-               kprintf("%p: \"%s\", \"%s\" (%ld), refcount = %ld, state = %d, "
-                       "mimage = %p\n", module, module->name,
+               kprintf("%p: \"%s\", \"%s\" (%" B_PRId32 "), refcount = %" 
B_PRId32 ", "
+                       "state = %d, mimage = %p\n", module, module->name,
                        module->module_image ? module->module_image->path : "",
                        module->offset, module->ref_count, module->state,
                        module->module_image);
@@ -1184,8 +1184,9 @@ dump_modules(int argc, char** argv)
 
        while ((image = (struct module_image*)hash_next(sModuleImagesHash,
                                &iterator)) != NULL) {
-               kprintf("%p: \"%s\" (image_id = %ld), info = %p, refcount = 
%ld\n",
-                       image, image->path, image->image, image->info, 
image->ref_count);
+               kprintf("%p: \"%s\" (image_id = %" B_PRId32 "), info = %p, 
refcount = "
+                       "%" B_PRId32 "\n", image, image->path, image->image, 
image->info,
+                       image->ref_count);
        }
        return 0;
 }
diff --git a/src/system/kernel/port.cpp b/src/system/kernel/port.cpp
index fd66ec2..26fb39d 100644
--- a/src/system/kernel/port.cpp
+++ b/src/system/kernel/port.cpp
@@ -403,8 +403,9 @@ dump_port_list(int argc, char** argv)
                        || (name != NULL && strstr(port->lock.name, name) == 
NULL))
                        continue;
 
-               kprintf("%p %8ld %4ld %9ld %9ld %8ld %6ld  %s\n", port,
-                       port->id, port->capacity, port->read_count, 
port->write_count,
+               kprintf("%p %8" B_PRId32 " %4" B_PRId32 " %9" B_PRIu32 " %9" 
B_PRId32
+                       " %8" B_PRId32 " %6" B_PRId32 "  %s\n", port, port->id,
+                       port->capacity, port->read_count, port->write_count,
                        port->total_count, port->owner, port->lock.name);
        }
 
@@ -416,20 +417,20 @@ static void
 _dump_port_info(Port* port)
 {
        kprintf("PORT: %p\n", port);
-       kprintf(" id:              %ld\n", port->id);
+       kprintf(" id:              %" B_PRId32 "\n", port->id);
        kprintf(" name:            \"%s\"\n", port->lock.name);
-       kprintf(" owner:           %ld\n", port->owner);
-       kprintf(" capacity:        %ld\n", port->capacity);
-       kprintf(" read_count:      %ld\n", port->read_count);
-       kprintf(" write_count:     %ld\n", port->write_count);
-       kprintf(" total count:     %ld\n", port->total_count);
+       kprintf(" owner:           %" B_PRId32 "\n", port->owner);
+       kprintf(" capacity:        %" B_PRId32 "\n", port->capacity);
+       kprintf(" read_count:      %" B_PRIu32 "\n", port->read_count);
+       kprintf(" write_count:     %" B_PRId32 "\n", port->write_count);
+       kprintf(" total count:     %" B_PRId32 "\n", port->total_count);
 
        if (!port->messages.IsEmpty()) {
                kprintf("messages:\n");
 
                MessageList::Iterator iterator = port->messages.GetIterator();
                while (port_message* message = iterator.Next()) {
-                       kprintf(" %p  %08lx  %ld\n", message, message->code, 
message->size);
+                       kprintf(" %p  %08" B_PRIx32 "  %ld\n", message, 
message->code, message->size);
                }
        }
 
@@ -463,7 +464,8 @@ dump_port_info(int argc, char** argv)
                int32 num = parse_expression(argv[1]);
                Port* port = sPorts.Lookup(num);
                if (port == NULL) {
-                       kprintf("port %ld (%#lx) doesn't exist!\n", num, num);
+                       kprintf("port %" B_PRId32 " (%#" B_PRIx32 ") doesn't 
exist!\n",
+                               num, num);
                        return 0;
                }
                _dump_port_info(port);
@@ -1180,7 +1182,7 @@ _get_port_message_info_etc(port_id id, port_message_info* 
info,
        // determine tail & get the length of the message
        port_message* message = port->messages.Head();
        if (message == NULL) {
-               panic("port %ld: no messages found\n", port->id);
+               panic("port %" B_PRId32 ": no messages found\n", port->id);
                return B_ERROR;
        }
 
@@ -1289,7 +1291,7 @@ read_port_etc(port_id id, int32* _code, void* buffer, 
size_t bufferSize,
        // determine tail & get the length of the message
        port_message* message = port->messages.Head();
        if (message == NULL) {
-               panic("port %ld: no messages found\n", port->id);
+               panic("port %" B_PRId32 ": no messages found\n", port->id);
                return B_ERROR;
        }
 
diff --git a/src/system/kernel/real_time_clock.cpp 
b/src/system/kernel/real_time_clock.cpp
index 6f99492..b73c8f9 100644
--- a/src/system/kernel/real_time_clock.cpp
+++ b/src/system/kernel/real_time_clock.cpp
@@ -86,7 +86,7 @@ rtc_debug(int argc, char **argv)
                currentTime = (systemTimeOffset + system_time()) / 1000000;
                dprintf("system_time:  %Ld\n", system_time());
                dprintf("system_time_offset:    %Ld\n", systemTimeOffset);
-               dprintf("current_time: %lu\n", currentTime);
+               dprintf("current_time: %" B_PRIu32 "\n", currentTime);
        } else {
                // If there was an argument, reset the system and hw time.
                set_real_time_clock(strtoul(argv[1], NULL, 10));
diff --git a/src/system/kernel/sem.cpp b/src/system/kernel/sem.cpp
index ad32ddd..5a5a20a 100644
--- a/src/system/kernel/sem.cpp
+++ b/src/system/kernel/sem.cpp
@@ -163,8 +163,8 @@ dump_sem_list(int argc, char** argv)
                        || (owner != -1 && sem->u.used.owner != owner))
                        continue;
 
-               kprintf("%p %6ld %5ld %6ld "
-                       "%6ld "
+               kprintf("%p %6" B_PRId32 " %5" B_PRId32 " %6" B_PRId32 " "
+                       "%6" B_PRId32 " "
                        " %s\n", sem, sem->id, sem->u.used.count,
                        sem->u.used.owner,
                        sem->u.used.last_acquirer > 0 ? 
sem->u.used.last_acquirer : 0,
@@ -179,16 +179,16 @@ static void
 dump_sem(struct sem_entry* sem)
 {
        kprintf("SEM: %p\n", sem);
-       kprintf("id:      %ld (%#lx)\n", sem->id, sem->id);
+       kprintf("id:      %" B_PRId32 " (%#" B_PRIx32 ")\n", sem->id, sem->id);
        if (sem->id >= 0) {
                kprintf("name:    '%s'\n", sem->u.used.name);
-               kprintf("owner:   %ld\n", sem->u.used.owner);
-               kprintf("count:   %ld\n", sem->u.used.count);
+               kprintf("owner:   %" B_PRId32 "\n", sem->u.used.owner);
+               kprintf("count:   %" B_PRId32 "\n", sem->u.used.count);
                kprintf("queue:  ");
                if (!sem->queue.IsEmpty()) {
                        ThreadQueue::Iterator it = sem->queue.GetIterator();
                        while (queued_thread* entry = it.Next())
-                               kprintf(" %ld", entry->thread->id);
+                               kprintf(" %" B_PRId32, entry->thread->id);
                        kprintf("\n");
                } else
                        kprintf(" -\n");
@@ -198,9 +198,9 @@ dump_sem(struct sem_entry* sem)
                set_debug_variable("_owner", sem->u.used.owner);
 
 #if DEBUG_SEM_LAST_ACQUIRER
-               kprintf("last acquired by: %ld, count: %ld\n",
+               kprintf("last acquired by: %" B_PRId32 ", count: %" B_PRId32 
"\n",
                        sem->u.used.last_acquirer, 
sem->u.used.last_acquire_count);
-               kprintf("last released by: %ld, count: %ld\n",
+               kprintf("last released by: %" B_PRId32 ", count: %" B_PRId32 
"\n",
                        sem->u.used.last_releaser, 
sem->u.used.last_release_count);
 
                if (sem->u.used.last_releaser != 0)
@@ -217,7 +217,7 @@ dump_sem(struct sem_entry* sem)
                        unset_debug_variable("_acquirer");
        } else {
                kprintf("next:    %p\n", sem->u.unused.next);
-               kprintf("next_id: %ld\n", sem->u.unused.next_id);
+               kprintf("next_id: %" B_PRId32 "\n", sem->u.unused.next_id);
        }
 }
 
@@ -378,8 +378,8 @@ delete_sem_internal(sem_id id, bool checkPermission)
                RELEASE_SEM_LOCK(sSems[slot]);
                RELEASE_SEM_LIST_LOCK();
                restore_interrupts(state);
-               dprintf("thread %ld tried to delete kernel semaphore %ld.\n",
-                       thread_get_current_thread_id(), id);
+               dprintf("thread %" B_PRId32 " tried to delete kernel semaphore "
+                       "%" B_PRId32 ".\n", thread_get_current_thread_id(), id);
                return B_NOT_ALLOWED;
        }
 
@@ -387,7 +387,7 @@ delete_sem_internal(sem_id id, bool checkPermission)
                list_remove_link(&sSems[slot].u.used.team_link);
                sSems[slot].u.used.owner = -1;
        } else
-               panic("sem %ld has no owner", id);
+               panic("sem %" B_PRId32 " has no owner", id);
 
        RELEASE_SEM_LIST_LOCK();
 
@@ -769,8 +769,8 @@ switch_sem_etc(sem_id semToBeReleased, sem_id id, int32 
count,
                return B_NO_MORE_SEMS;
 
        if (!are_interrupts_enabled()) {
-               panic("switch_sem_etc: called with interrupts disabled for sem 
%ld\n",
-                       id);
+               panic("switch_sem_etc: called with interrupts disabled for sem "
+                       "%" B_PRId32 "\n", id);
        }
 
        if (id < 0)
@@ -793,8 +793,8 @@ switch_sem_etc(sem_id semToBeReleased, sem_id id, int32 
count,
        //      doesn't have any use outside the kernel
        if ((flags & B_CHECK_PERMISSION) != 0
                && sSems[slot].u.used.owner == team_get_kernel_team_id()) {
-               dprintf("thread %ld tried to acquire kernel semaphore %ld.\n",
-                       thread_get_current_thread_id(), id);
+               dprintf("thread %" B_PRId32 " tried to acquire kernel semaphore 
"
+                       "%" B_PRId32 ".\n", thread_get_current_thread_id(), id);
                status = B_NOT_ALLOWED;
                goto err;
        }
@@ -945,7 +945,7 @@ release_sem_etc(sem_id id, int32 count, uint32 flags)
        //      doesn't have any use outside the kernel
        if ((flags & B_CHECK_PERMISSION) != 0
                && sSems[slot].u.used.owner == team_get_kernel_team_id()) {
-               dprintf("thread %ld tried to release kernel semaphore.\n",
+               dprintf("thread %" B_PRId32 " tried to release kernel 
semaphore.\n",
                        thread_get_current_thread_id());
                return B_NOT_ALLOWED;
        }
diff --git a/src/system/kernel/smp.cpp b/src/system/kernel/smp.cpp
index 899d81c..7c4a6b9 100644
--- a/src/system/kernel/smp.cpp
+++ b/src/system/kernel/smp.cpp
@@ -234,10 +234,10 @@ dump_ici_messages(int argc, char** argv)
                message = message->next;
        }
 
-       kprintf("ICI broadcast messages: %ld, first: %p\n", count,
+       kprintf("ICI broadcast messages: %" B_PRId32 ", first: %p\n", count,
                sBroadcastMessages);
-       kprintf("  done:         %ld\n", doneCount);
-       kprintf("  unreferenced: %ld\n", unreferencedCount);
+       kprintf("  done:         %" B_PRId32 "\n", doneCount);
+       kprintf("  unreferenced: %" B_PRId32 "\n", unreferencedCount);
 
        // count per-CPU messages
        for (int32 i = 0; i < sNumCPUs; i++) {
@@ -248,8 +248,8 @@ dump_ici_messages(int argc, char** argv)
                        message = message->next;
                }
 
-               kprintf("CPU %ld messages: %ld, first: %p\n", i, count,
-                       sCPUMessages[i]);
+               kprintf("CPU %" B_PRId32 " messages: %" B_PRId32 ", first: 
%p\n", i,
+                       count, sCPUMessages[i]);
        }
 
        return 0;
@@ -271,15 +271,15 @@ dump_ici_message(int argc, char** argv)
        smp_msg* message = (smp_msg*)(addr_t)address;
        kprintf("ICI message %p:\n", message);
        kprintf("  next:        %p\n", message->next);
-       kprintf("  message:     %ld\n", message->message);
-       kprintf("  data:        %ld\n", message->data);
-       kprintf("  data2:       %ld\n", message->data2);
-       kprintf("  data3:       %ld\n", message->data3);
+       kprintf("  message:     %" B_PRId32 "\n", message->message);
+       kprintf("  data:        %" B_PRIu32 "\n", message->data);
+       kprintf("  data2:       %" B_PRIu32 "\n", message->data2);
+       kprintf("  data3:       %" B_PRIu32 "\n", message->data3);
        kprintf("  data_ptr:    %p\n", message->data_ptr);
-       kprintf("  flags:       %lx\n", message->flags);
-       kprintf("  ref_count:   %lx\n", message->ref_count);
+       kprintf("  flags:       %" B_PRIx32 "\n", message->flags);
+       kprintf("  ref_count:   %" B_PRIx32 "\n", message->ref_count);
        kprintf("  done:        %s\n", message->done ? "true" : "false");
-       kprintf("  proc_bitmap: %lx\n", message->proc_bitmap);
+       kprintf("  proc_bitmap: %" B_PRIx32 "\n", message->proc_bitmap);
 
        return 0;
 }
@@ -361,7 +361,7 @@ acquire_spinlock(spinlock* lock)
                oldValue = atomic_or((int32*)lock, 1);
                if (oldValue != 0) {
                        panic("acquire_spinlock: attempt to acquire lock %p 
twice on "
-                               "non-SMP system (last caller: %p, value %ld)", 
lock,
+                               "non-SMP system (last caller: %p, value %" 
B_PRId32 ")", lock,
                                find_lock_caller(lock), oldValue);
                }
 
@@ -458,7 +458,7 @@ acquire_spinlock_cpu(int32 currentCPU, spinlock *lock)
                oldValue = atomic_or((int32*)lock, 1);
                if (oldValue != 0) {
                        panic("acquire_spinlock_cpu(): attempt to acquire lock 
%p twice on "
-                               "non-SMP system (last caller: %p, value %ld)", 
lock,
+                               "non-SMP system (last caller: %p, value %" 
B_PRId32 ")", lock,
                                find_lock_caller(lock), oldValue);
                }
 
@@ -755,8 +755,8 @@ process_pending_ici(int32 currentCPU)
                }
 
                default:
-                       dprintf("smp_intercpu_int_handler: got unknown message 
%ld\n",
-                               msg->message);
+                       dprintf("smp_intercpu_int_handler: got unknown message 
%" B_PRId32
+                               "\n", msg->message);
                        break;
        }
 
diff --git a/src/system/kernel/system_info.cpp 
b/src/system/kernel/system_info.cpp
index 0315c0d..a97cdca 100644
--- a/src/system/kernel/system_info.cpp
+++ b/src/system/kernel/system_info.cpp
@@ -50,20 +50,23 @@ dump_info(int argc, char **argv)
                __VERSION__);
        kprintf("revision: %s\n\n", get_haiku_revision());
 
-       kprintf("cpu count: %ld, active times:\n", smp_get_num_cpus());
+       kprintf("cpu count: %" B_PRId32 ", active times:\n", 
smp_get_num_cpus());
 
        for (int32 i = 0; i < smp_get_num_cpus(); i++)
-               kprintf("  [%ld] %Ld\n", i + 1, gCPU[i].active_time);
+               kprintf("  [%" B_PRId32 "] %" B_PRId64 "\n", i + 1, 
gCPU[i].active_time);
 
        // ToDo: Add page_faults
        kprintf("pages:\t\t%" B_PRIuPHYSADDR " (%" B_PRIuPHYSADDR " max)\n",
                vm_page_num_pages() - vm_page_num_free_pages(), 
vm_page_num_pages());
 
-       kprintf("sems:\t\t%ld (%ld max)\n", sem_used_sems(), sem_max_sems());
-       kprintf("ports:\t\t%ld (%ld max)\n", port_used_ports(), 
port_max_ports());
-       kprintf("threads:\t%ld (%ld max)\n", thread_used_threads(),
-               thread_max_threads());
-       kprintf("teams:\t\t%ld (%ld max)\n", team_used_teams(), 
team_max_teams());
+       kprintf("sems:\t\t%" B_PRId32 " (%" B_PRId32 " max)\n", sem_used_sems(),
+               sem_max_sems());
+       kprintf("ports:\t\t%" B_PRId32 " (%" B_PRId32 " max)\n", 
port_used_ports(),
+                       port_max_ports());
+       kprintf("threads:\t%" B_PRId32 " (%" B_PRId32 " max)\n",
+               thread_used_threads(), thread_max_threads());
+       kprintf("teams:\t\t%" B_PRId32 " (%" B_PRId32 " max)\n", 
team_used_teams(),
+               team_max_teams());
 
        return 0;
 }

############################################################################

Commit:      f76bc433e1582f4f5424cd5c95613cb247e15a98
URL:         http://cgit.haiku-os.org/haiku/commit/?id=f76bc43
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jun 13 16:45:22 2012 UTC

Added some x86_64 system/kernel headers and kernel Jamfiles.

* Not all of these headers are correct yet, just adding what's necessary
  to get things to compile for the time being.

----------------------------------------------------------------------------

diff --git a/headers/os/arch/x86_64/arch_debugger.h 
b/headers/os/arch/x86_64/arch_debugger.h
new file mode 100644
index 0000000..5b9220b
--- /dev/null
+++ b/headers/os/arch/x86_64/arch_debugger.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2005-2012, Haiku Inc.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _ARCH_X86_64_DEBUGGER_H
+#define _ARCH_X86_64_DEBUGGER_H
+
+
+typedef struct x86_64_fp_register {
+       uint8           value[10];
+       uint8           reserved[6];
+} x86_64_fp_register;
+
+
+typedef struct x86_64_xmm_register {
+       uint8           value[16];
+} x86_64_xmm_register;
+
+
+typedef struct x86_64_extended_registers {
+       uint16                                  control;
+       uint16                                  status;
+       uint8                                   tag;
+       uint8                                   reserved1;
+       uint16                                  opcode;
+       uint64                                  instruction_pointer;
+       uint64                                  data_pointer;
+       uint32                                  mxcsr;
+       uint32                                  mxcsr_mask;
+       union {
+               x86_64_fp_register      fp_registers[8];        // st0-st7
+               x86_64_fp_register      mmx_registers[8];       // mm0-mm7
+       };
+       x86_64_xmm_register             xmm_registers[16];      // xmm0-xmm15
+       uint8                                   reserved4[96];          // 416 
- 512
+} x86_64_extended_registers;
+
+
+struct x86_64_debug_cpu_state {
+       x86_64_extended_registers       extended_registers;
+
+       uint64  gs;
+       uint64  fs;
+       uint64  es;
+       uint64  ds;
+       uint64  r15;
+       uint64  r14;
+       uint64  r13;
+       uint64  r12;
+       uint64  r11;
+       uint64  r10;
+       uint64  r9;
+       uint64  r8;
+       uint64  rbp;
+       uint64  rsi;
+       uint64  rdi;
+       uint64  rdx;
+       uint64  rcx;
+       uint64  rbx;
+       uint64  rax;
+       uint64  vector;
+       uint64  error_code;
+       uint64  rip;
+       uint64  cs;

[ *** diff truncated: 777 lines dropped *** ]


############################################################################

Commit:      ced503713303009893b81f082ec12727095eb152
URL:         http://cgit.haiku-os.org/haiku/commit/?id=ced5037
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jun 13 16:47:34 2012 UTC

Merge branch 'master' into x86_64

----------------------------------------------------------------------------

############################################################################

Commit:      11d3892d285a72e161f5b13365dcce6e05a32374
URL:         http://cgit.haiku-os.org/haiku/commit/?id=11d3892
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Jun 14 12:06:55 2012 UTC

Changed ICI data argument types from uint32 to addr_t.

Since ICI arguments are used to send addresses in some places, uint32 is
not sufficient on x86_64. addr_t still refers to the same type as uint32
(unsigned long) on other platforms, so this change only really affects
x86_64.

----------------------------------------------------------------------------

############################################################################

Commit:      40e20c10768c3dcfc54074b8886e3e91455332e1
URL:         http://cgit.haiku-os.org/haiku/commit/?id=40e20c1
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Jun 14 13:18:50 2012 UTC

Added gensyscalls headers for x86_64.

----------------------------------------------------------------------------

############################################################################

Commit:      4be4fc6b1faddbd037146214a0011d320842b4f3
URL:         http://cgit.haiku-os.org/haiku/commit/?id=4be4fc6
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jun 15 15:04:20 2012 UTC

More 64-bit compilation/safety fixes.

----------------------------------------------------------------------------

############################################################################

Commit:      82b4b371721bb24f2697b5c17360380cf11aef9c
URL:         http://cgit.haiku-os.org/haiku/commit/?id=82b4b37
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jun 15 15:09:25 2012 UTC

Added a TODO in to say that {,u}int64 should be changed to long on x86_64.

----------------------------------------------------------------------------

############################################################################

Commit:      f4f0f79b669a05fe403054e6614d65c89c4eef1b
URL:         http://cgit.haiku-os.org/haiku/commit/?id=f4f0f79
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jun 15 15:10:53 2012 UTC

Merge branch 'master' into x86_64

----------------------------------------------------------------------------

############################################################################

Commit:      73f27ecd3a30c16c2363de51891534c09601ea6b
URL:         http://cgit.haiku-os.org/haiku/commit/?id=73f27ec
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jun 15 18:57:21 2012 UTC

Implementations of some libroot functions for x86_64.

These are the functions required by the kernel. These are all full
implementations except for system_time(), which will be implemented later.

----------------------------------------------------------------------------

############################################################################

Commit:      8c0e3c951a108d09b85b57dea3f793dc4eed24d5
URL:         http://cgit.haiku-os.org/haiku/commit/?id=8c0e3c9
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jun 15 19:05:25 2012 UTC

Add -mno-red-zone to the kernel CCFLAGS/C++FLAGS.

The red zone is a 128-byte area below the stack pointer specified by the
AMD64 ABI that can be used by leaf functions for their stack frame without
modifying the stack pointer. It is guaranteed not to be modified by signal
handlers. This cannot be used in kernel mode code, as an interrupt handler
could overwrite it, so stop GCC from generating code that uses it.

----------------------------------------------------------------------------

############################################################################

Commit:      146f966921d878727c3895b18dbee0ab3314bffc
URL:         http://cgit.haiku-os.org/haiku/commit/?id=146f966
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jun 15 21:31:24 2012 UTC

Fixed a mistake in 11d3892, changed a parameter type to addr_t that shouldn't 
have been changed.

----------------------------------------------------------------------------

############################################################################

Commit:      043c61dde5b257e2e094ffb2df82a303d234e5b4
URL:         http://cgit.haiku-os.org/haiku/commit/?id=043c61d
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jun 15 21:50:59 2012 UTC

Added stub versions of everything needed to build the kernel.

The whole kernel now builds and there are no undefined references when
linking, I just need to fix some strange relocation errors I'm getting
(probably a problem with the linker script) and then I'll have a kernel
image.

----------------------------------------------------------------------------

############################################################################

Commit:      6296722bc0d7b1cbe76111937ad147c850f9bfdc
URL:         http://cgit.haiku-os.org/haiku/commit/?id=6296722
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Jun 16 10:20:05 2012 UTC

Fixed incorrect link address in kernel linker script.

----------------------------------------------------------------------------

############################################################################

Commit:      e114f50ddd4eb9fa71c4d375e6c8cd7dfbc0b0f3
URL:         http://cgit.haiku-os.org/haiku/commit/?id=e114f50
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Tue Jun 19 19:38:53 2012 UTC

Fixed bootloader build under x86_64.

----------------------------------------------------------------------------

############################################################################

Commit:      7c488bff706843c85363614f024787024eebbb9b
URL:         http://cgit.haiku-os.org/haiku/commit/?id=7c488bf
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Tue Jun 19 20:36:13 2012 UTC

Modified the floppy boot image target so that it can be used to build an x86_64 
boot image.

* set_haiku_revision doesn't currently support ELF64, don't use a
  revisioned kernel image on x86_64 for now.
* Don't try to build add-ons for x86_64 yet.

----------------------------------------------------------------------------

############################################################################

Commit:      cfd1c1802f3c3250f96a14db3c65eed4667f09db
URL:         http://cgit.haiku-os.org/haiku/commit/?id=cfd1c18
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Tue Jun 19 20:54:40 2012 UTC

Add -march=pentium to boot {CC,C++}FLAGS on x86_64, prevents GCC from 
generating SSE code.

----------------------------------------------------------------------------

############################################################################

Commit:      7417d5ed8deef641a6941e5a17a47781b8f8959c
URL:         http://cgit.haiku-os.org/haiku/commit/?id=7417d5e
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jun 20 09:44:38 2012 UTC

Made the bootloader search for both kernel_x86 and kernel_x86_64 when built for 
x86 or x86_64.

----------------------------------------------------------------------------

############################################################################

Commit:      93cb9538be54a2dd4ab6097453ac7d521a9a0b6c
URL:         http://cgit.haiku-os.org/haiku/commit/?id=93cb953
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jun 20 10:53:47 2012 UTC

Don't store a KMessage in kernel_args for the boot volume, only the buffer 
address/size.

Pointers in kernel_args are going to be changed to unconditionally use 64-bit
storage (to make kernel_args compatible with both the x86 and x86_64 kernels).
KMessage stores a pointer to its buffer, however since KMessage is used
outside of the boot code it is undesirable to change it to use 64-bit storage
for the pointer as it may add additional overhead on 32-bit builds. Therefore,
only store the buffer address and size and then construct a KMessage from
those in the kernel.

----------------------------------------------------------------------------

############################################################################

Commit:      192af9e0afd2f3d0cbaf5c935480343a70c8ff53
URL:         http://cgit.haiku-os.org/haiku/commit/?id=192af9e
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jun 20 13:11:24 2012 UTC

Changed addr_range to use uint64.

I've tested this change on x86, causing no issues. I've checked over the code
for all other platforms and made the necessary changes and to the best of my
knowledge they should also still work, but I haven't actually built and
tested them. Once I've completed the kernel_args changes the other platforms
will need testing.

----------------------------------------------------------------------------

############################################################################

Commit:      d8efc6caf6babe278c48e8aa3277376fb68ff455
URL:         http://cgit.haiku-os.org/haiku/commit/?id=d8efc6c
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Jun 21 17:02:23 2012 UTC

Changes to kernel_args to make it identical for x86 and x86_64.

* Added a FixedWidthPointer template class which uses 64-bit storage to hold
  a pointer. This is used in place of raw pointers in kernel_args.
* Added __attribute__((packed)) to kernel_args and all structures contained
  within it. This is necessary due to different alignment behaviour for
  32-bit and 64-bit compilation with GCC.
* With these changes, kernel_args will now come out the same size for both
  the x86_64 kernel and the loader, excluding the preloaded_image structure
  which has not yet been changed.
* Tested both an x86 GCC2 and GCC4 build, no problems caused by these changes.

----------------------------------------------------------------------------

############################################################################

Commit:      5915eeb461026dabc5e2ccd61b650cd7fc0e40a7
URL:         http://cgit.haiku-os.org/haiku/commit/?id=5915eeb
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Jun 21 18:45:36 2012 UTC

Some improvements to the previous changes made to vfs_boot.cpp suggested by 
Ingo.

----------------------------------------------------------------------------

############################################################################

Commit:      17a3389882cee19532ddc99bc1f9aa1efd296749
URL:         http://cgit.haiku-os.org/haiku/commit/?id=17a3389
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Jun 21 18:48:03 2012 UTC

Remove phys_addr_range, just use addr_range for both virtual and physical 
address ranges (as requested by Ingo).

----------------------------------------------------------------------------

############################################################################

Commit:      1651dd72d9dbd14fa8e97a204b166c0f32d97e90
URL:         http://cgit.haiku-os.org/haiku/commit/?id=1651dd7
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Jun 21 18:48:43 2012 UTC

Merge branch 'master' into x86_64

----------------------------------------------------------------------------

############################################################################

Commit:      17e407e945f313ed8c2878ad7699ef9384f8a1a0
URL:         http://cgit.haiku-os.org/haiku/commit/?id=17e407e
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jun 22 09:53:08 2012 UTC

Proper implementation of arch_kernel.h for x86_64.

----------------------------------------------------------------------------

############################################################################

Commit:      6b87898af5966561770a79a17f13415c47c38aa0
URL:         http://cgit.haiku-os.org/haiku/commit/?id=6b87898
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jun 22 10:56:55 2012 UTC

Code style fixes.

----------------------------------------------------------------------------

############################################################################

Commit:      474aa3b76e4c661c259e2200db895712ded3f9d6
URL:         http://cgit.haiku-os.org/haiku/commit/?id=474aa3b
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jun 22 11:54:41 2012 UTC

Added ELF64 headers, common ELF32 and ELF64 definitions moved to elf_common.h.

----------------------------------------------------------------------------

############################################################################

Commit:      62d36f98331067e472188f6c020c2ccd808f48cf
URL:         http://cgit.haiku-os.org/haiku/commit/?id=62d36f9
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jun 22 15:56:56 2012 UTC

Removed the addr_t conversion operators from FixedWidthPointer which makes 
comparison against NULL work properly.

----------------------------------------------------------------------------

############################################################################

Commit:      f1244978152350f9cc010e766d09c2e9ad34dfce
URL:         http://cgit.haiku-os.org/haiku/commit/?id=f124497
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jun 22 18:24:51 2012 UTC

Added an ELF64 version of preloaded_image.

* There is now 2 structures, preloaded_elf32_image and preloaded_elf64_image,
  which both inherit from preloaded_image.
* For now I've just hardcoded in use of preloaded_elf32_image, but the
  bootloader ELF code will shortly be converted to use templates which use
  the appropriate structure. The kernel will be changed later when I add
  ELF64 support to it.
* All kernel_args data is now compatible between 32-bit and 64-bit kernels.

----------------------------------------------------------------------------

############################################################################

Commit:      3a2a3367dc9bec2a5fbcd4ac849da6ac65e74e79
URL:         http://cgit.haiku-os.org/haiku/commit/?id=3a2a336
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jun 22 18:55:38 2012 UTC

Support static_cast on FixedWidthPointer.

----------------------------------------------------------------------------

############################################################################

Commit:      ccadfaeeb577eb5f129adcc1441b92aaf9f5e443
URL:         http://cgit.haiku-os.org/haiku/commit/?id=ccadfae
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Jun 23 11:05:16 2012 UTC

Changed the boot ELF code to use templates and added ELF64 support.

The actual implementation of the ELF loading methods have been put into
an ELFLoader template class that takes a single template parameter, which
is a structure containing all the necessary ELF typedefs. It's a bit
verbose, but I thought it was a neater solution than using a bunch of
standalone functions with a huge number of template parameters. There is
no change to code outside of elf.cpp, the ELF32/ELF64 differences are
handled internally.

----------------------------------------------------------------------------

############################################################################

Commit:      69a8b95491c160f03a5b0dab0fa8d1899fe42d4b
URL:         http://cgit.haiku-os.org/haiku/commit/?id=69a8b95
Author:      Ingo Weinhold <ingo_weinhold@xxxxxx>
Date:        Sat Jun 23 21:49:32 2012 UTC
Committer:   Alex Smith <alex@xxxxxxxxxxxxxxxx>
Commit-Date: Sun Jun 24 14:26:00 2012 UTC

FixedWidthPointer: Fix ==/!= operators, remove OtherType casts

* FixedWidthPointer:
  - operators ==/!=: Change second operand type from void* to const
    Type*. Also add non-const version to resolve ambiguity warning when
    comparing with non-const pointer.
  - Add Pointer() getter.
  - Remove templatized cast operators. They are nice for casting the
    pointer directly to another pointer type, but result in ambiguity.
* Make preloaded_image::debug_string_table non-const. Avoids clashes of
  the const and non-coast FixedWidthPointer comparison operators. A
  cleaner (but more verbose) solution would be to spezialize
  FixedWidthPointer for const types.

----------------------------------------------------------------------------

############################################################################

Commit:      acda52f5e963b1c76fed2eca0409444cda4529b5
URL:         http://cgit.haiku-os.org/haiku/commit/?id=acda52f
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Jun 24 14:48:03 2012 UTC

Fixes for other platforms.

----------------------------------------------------------------------------

############################################################################

Commit:      035825cdfcf0f778a4e87c7a216c14ab5e9b8116
URL:         http://cgit.haiku-os.org/haiku/commit/?id=035825c
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Jun 24 16:19:48 2012 UTC

Align the start of the kernel .data to a 2MB boundary, prevents ld from merging 
the text and data PHDRs.

----------------------------------------------------------------------------

############################################################################

Commit:      c2656eb9bd735878c33f979c273ba59a1f96cc09
URL:         http://cgit.haiku-os.org/haiku/commit/?id=c2656eb
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Jun 24 16:51:05 2012 UTC

Improved elf_load_image() a bit.

After enabling BOOT_SUPPORT_ELF64 on x86 the x86 kernel could no longer be
booted because too many kernel_args allocations were taking place and filling
kernel_args_ranges. This was because for each image load it would check if
the image is ELF64, fail and fall back to ELF32 (each ELF64 check allocated
a preloaded_image). Changed elf_load_image() so that it only tries both when
loading the kernel image, and then for modules it will only try the same ELF
class as the kernel image.

----------------------------------------------------------------------------

############################################################################

Commit:      f6a3444449c452a63e0e0d91e8480f39bca81aed
URL:         http://cgit.haiku-os.org/haiku/commit/?id=f6a3444
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Jun 24 18:22:33 2012 UTC

Added x86_64 ELF64 relocation functions for the bootloader. All that's left to 
do now is handle the 64-bit load address properly.

----------------------------------------------------------------------------

############################################################################

Commit:      8846189866301c85683151a54ec88e809333ca7a
URL:         http://cgit.haiku-os.org/haiku/commit/?id=8846189
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Jun 24 21:57:48 2012 UTC

Handle 64-bit load addresses for ELF64 images in the bootloader.

The ELF loader now uses a new platform function, platform_allocate_elf_region,
which returns 2 addresses: the real load address and an address where the
region is mapped in the loader's address space. All of the ELF loading code
has been changed to access the load region through the mapped address rather
than the addresses contained in the ELF image. The ELF64 version of
platform_allocate_elf_region on x86 uses the existing MMU code, which maps
everything at 0x80000000, but returns the correct 64-bit address. The long
mode switch code will just set up the 64-bit address space with everything
remapped at the correct address.

----------------------------------------------------------------------------

############################################################################

Commit:      6f6d78e877c1a485d98de60395854a6d6de61c0d
URL:         http://cgit.haiku-os.org/haiku/commit/?id=6f6d78e
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jun 25 12:00:50 2012 UTC

Cleaned up ELF64 address handling.

* platform_allocate_elf_region() is removed, it is implemented in platform-
  independent code now (ELF*Class::AllocateRegion). For ELF64 it is now
  assumed that 64-bit addresses are mapped in the loader's 32-bit address space
  as (address - KERNEL_BASE_64BIT + KERNEL_BASE).
* mapped_delta field from preloaded_*_image removed, now handled compile-time
  using the ELF*Class::Map method.
* Also link the kernel with -z max-page-size=0x1000, removes the need for
  2MB alignment on the data segment (not going to map the kernel with large
  pages for the time being).

----------------------------------------------------------------------------

############################################################################

Commit:      f69dd487b1c4e0a3f35d6477e9a6720315e89f35
URL:         http://cgit.haiku-os.org/haiku/commit/?id=f69dd48
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jun 25 12:28:28 2012 UTC

Fixed x86 GCC2 build.

----------------------------------------------------------------------------

############################################################################

Commit:      5a17b2f1b272c71940a67474fc029fa5cf40cff6
URL:         http://cgit.haiku-os.org/haiku/commit/?id=5a17b2f
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Tue Jun 26 09:54:37 2012 UTC

Forgot to change driver_settings_file to use FixedWidthPointer.

----------------------------------------------------------------------------

############################################################################

Commit:      a820f12943d570cfcb6dbb78781dc587f56e0da8
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a820f12
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Tue Jun 26 09:59:03 2012 UTC

Style fixes to elf.cpp.

----------------------------------------------------------------------------

############################################################################

Commit:      e5fc2bfcab8c15a3ff7d33c358f9aa82ed73c823
URL:         http://cgit.haiku-os.org/haiku/commit/?id=e5fc2bf
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Tue Jun 26 10:01:23 2012 UTC

Implemented long mode setup/switch code, the bootloader can now start the 
64-bit kernel!

The setup procedure is fairly simple: create a 64-bit GDT and 64-bit page
tables that include all kernel mappings from the 32-bit address space, but at
the correct 64-bit address, then go through kernel_args and changes all virtual
addresses to 64-bit addresses, and finally switch to long mode and jump to the
kernel.

----------------------------------------------------------------------------

############################################################################

Commit:      991e5bee90ffd98a39f012f6ce4e0740eb620073
URL:         http://cgit.haiku-os.org/haiku/commit/?id=991e5be
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Tue Jun 26 10:27:00 2012 UTC

Pass correct kernel_args address to the kernel.

----------------------------------------------------------------------------

############################################################################

Commit:      b8a9a3a16073d8f474ee3415e208d04f4b58b4b0
URL:         http://cgit.haiku-os.org/haiku/commit/?id=b8a9a3a
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Tue Jun 26 10:42:28 2012 UTC

Copied the x86 debug console functions to x86_64.

Note that this is only temporary so that I have serial output from the kernel,
the x86 and x86_64 versions will be merged later.

----------------------------------------------------------------------------

############################################################################

Commit:      3f017e90611b6b53186f72bd9f6aa837d15e588a
URL:         http://cgit.haiku-os.org/haiku/commit/?id=3f017e9
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jun 27 09:33:31 2012 UTC

Also need to fix the kernel_args_range addresses.

----------------------------------------------------------------------------

############################################################################

Commit:      3403f23e81b7bd6e50c459d01ae7238c1f3f5984
URL:         http://cgit.haiku-os.org/haiku/commit/?id=3403f23
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jun 27 10:23:54 2012 UTC

Moved the common parts of arch_cpu.h between x86 and x86_64 to 
arch/common_x86/cpu.h.

----------------------------------------------------------------------------

############################################################################

Commit:      575a67c7a10915a89427432c777e38d14d84cc24
URL:         http://cgit.haiku-os.org/haiku/commit/?id=575a67c
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jun 27 10:28:28 2012 UTC

Merge branch 'master' into x86_64

----------------------------------------------------------------------------

############################################################################

Commit:      45e0e08aed9ff534cc6e90b71542ed272de100c1
URL:         http://cgit.haiku-os.org/haiku/commit/?id=45e0e08
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jun 27 14:07:45 2012 UTC

Made panic() safe to use before the current thread has been set.

----------------------------------------------------------------------------

############################################################################

Commit:      014f4403ee33035722b1414fda1e16bc6f7ef2be
URL:         http://cgit.haiku-os.org/haiku/commit/?id=014f440
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jun 27 14:11:06 2012 UTC

Use unsigned long, not uint32, for the 'l' qualifier in printf() - long is 
64-bit on x86_64.

----------------------------------------------------------------------------

############################################################################

Commit:      c9f6d2271fc105de01b1359d66c5304c75bd396d
URL:         http://cgit.haiku-os.org/haiku/commit/?id=c9f6d22
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jun 27 14:15:53 2012 UTC

x86_64: Implemented exception handling.

----------------------------------------------------------------------------

############################################################################

Commit:      0705884ac415022fb9c734da089fe3dd5a06873a
URL:         http://cgit.haiku-os.org/haiku/commit/?id=0705884
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jun 27 14:48:39 2012 UTC

Style fixes.

----------------------------------------------------------------------------

############################################################################

Commit:      294711f98c107cf2d9d05b7fc34cd863e87bd358
URL:         http://cgit.haiku-os.org/haiku/commit/?id=294711f
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Jun 28 11:36:45 2012 UTC

Changed {,u}int64 to be long rather than long long on x86_64.

----------------------------------------------------------------------------

############################################################################

Commit:      120585d54926388cc6527082082846d7ccdbcef9
URL:         http://cgit.haiku-os.org/haiku/commit/?id=120585d
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jul  2 08:39:42 2012 UTC

Merge branch 'master' into x86_64

----------------------------------------------------------------------------

############################################################################

Commit:      4f78437c0d5ba6c2904dd0b1f658f9711d397815
URL:         http://cgit.haiku-os.org/haiku/commit/?id=4f78437
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jul  2 09:13:37 2012 UTC

Style fix.

----------------------------------------------------------------------------

############################################################################

Commit:      da80a0500c33176998887bcae22828d9e997477f
URL:         http://cgit.haiku-os.org/haiku/commit/?id=da80a05
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jul  2 12:50:01 2012 UTC

Preparation for merge of x86 and x86_64 kernel sources.

Since x86 and x86_64 share a lot of common code, x86_64 kernel sources/headers
are going to reside under headers/private/kernel/arch/x86 and
src/system/kernel/arch/x86 along with the existing x86 code. This commit
changes the build system to handle this. A new variable, TARGET_KERNEL_ARCH,
has been added. This is the name of the kernel/boot architecture directory
name, set to x86 on both x86 and x86_64. This is now used in all places where
TARGET_ARCH was used to get to kernel arch sources/headers (I've changed
everything necessary as far as I can tell). Kernel won't build for x86_64
at the moment as the sources have not been merged, loader does.

----------------------------------------------------------------------------

############################################################################

Commit:      0897e314b79d09b04349d3cfe6093a3fd6220da1
URL:         http://cgit.haiku-os.org/haiku/commit/?id=0897e31
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jul  2 17:47:06 2012 UTC

Merged x86_64 headers into x86 headers.

Not many changes seeing as there's not much x86_64 stuff done yet. Small
differences are handled with ifdefs, large differences (descriptors.h,
struct iframe) have separate headers under arch/x86/32 and arch/x86/64.

----------------------------------------------------------------------------

############################################################################

Commit:      020a25ce46175de76c694ef395fa364b2b7df6c9
URL:         http://cgit.haiku-os.org/haiku/commit/?id=020a25c
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jul  2 19:56:27 2012 UTC

Fixed x86_64 kernel compilation.

For now I've just put all the stub functions that are needed to link the
kernel into a file called stubs.cpp. I've not yet moved across the interrupt
handling code or the ELF64 relocation code to the x86 directory. Once those
have been moved I can get rid of the x86_64 headers/source directories.

----------------------------------------------------------------------------

############################################################################

Commit:      90907c35ac51e760221470563fdcd90a9232cc51
URL:         http://cgit.haiku-os.org/haiku/commit/?id=90907c3
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Tue Jul  3 07:45:35 2012 UTC

Moved ELF64 relocation functions to x86 arch_elf.cpp.

----------------------------------------------------------------------------

############################################################################

Commit:      22fe9b20f536f82485d1bdf76284baeaeb0deb2a
URL:         http://cgit.haiku-os.org/haiku/commit/?id=22fe9b2
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Tue Jul  3 07:46:52 2012 UTC

Merge branch 'master' into x86_64

----------------------------------------------------------------------------

############################################################################

Commit:      4f419b518fca1017a0950eef8fb55cb07628f3d5
URL:         http://cgit.haiku-os.org/haiku/commit/?id=4f419b5
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Tue Jul  3 10:13:51 2012 UTC

Merged in the x86_64 exception handling.

I've split the 32-bit dependent IDT setup code and ASM interrupt handlers to
the 32 subdirectory, arch_int.cpp now contains only the generic hardware
interrupt handling code.

----------------------------------------------------------------------------

############################################################################

Commit:      c005e747ef9ea6ba091c72e3fa56f8318a4bf893
URL:         http://cgit.haiku-os.org/haiku/commit/?id=c005e74
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Tue Jul  3 10:17:56 2012 UTC

Removed the x86_64 headers/source directories, now all merged with x86.

----------------------------------------------------------------------------

############################################################################

Commit:      cbfe5fcd171cee34562e5f86ef9586c027a1dd30
URL:         http://cgit.haiku-os.org/haiku/commit/?id=cbfe5fc
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Tue Jul  3 16:38:18 2012 UTC

Removed redundant x86 sources/headers.

----------------------------------------------------------------------------

############################################################################

Commit:      4e8fbfb2d158de7b1cadd1c060acee51a7d67309
URL:         http://cgit.haiku-os.org/haiku/commit/?id=4e8fbfb
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Tue Jul  3 19:55:36 2012 UTC

x86_{read,write}_cr{0,4} can just be implemented as macros, put an x86_ prefix 
on the other read/write macros for consistency.

----------------------------------------------------------------------------

############################################################################

Commit:      4304bb9894335fe5e5bd667a1f27dc7605c2e5b9
URL:         http://cgit.haiku-os.org/haiku/commit/?id=4304bb9
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jul  4 13:06:46 2012 UTC

Added arch_cpu.cpp to the x86_64 build.

* Some things are currently ifndef'd out completely for x86_64 because
  they aren't implemented, there's a few other ifdef's to handle x86_64
  differences but most of the code works unchanged.
* Renamed some i386_* functions to x86_*.
* Added a temporary method for setting the current thread on x86_64
  (a global variable, not SMP safe). This will be changed to be done
  via the GS segment but I've not implemented that yet.

----------------------------------------------------------------------------

############################################################################

Commit:      428b9e758c30a95154f5ad0d974894ef9ae133d6
URL:         http://cgit.haiku-os.org/haiku/commit/?id=428b9e7
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jul  4 13:23:35 2012 UTC

Check whether gX86PagingMethod is NULL in 
arch_vm_translation_map_is_kernel_page_accessible.

This means that the kernel debugger won't cause a recursive panic if a
panic occurs before vm_init().

----------------------------------------------------------------------------

############################################################################

Commit:      4988ca58a0b6f12e48286fe17ee651be490e0f24
URL:         http://cgit.haiku-os.org/haiku/commit/?id=4988ca5
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jul  4 13:55:11 2012 UTC

Build arch_vm.cpp for x86_64. No changes required except for temporarily 
disabling bios_init call.

----------------------------------------------------------------------------

############################################################################

Commit:      950b24e32d8ddbc0d2a4e46de77c0fb4cc18b128
URL:         http://cgit.haiku-os.org/haiku/commit/?id=950b24e
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jul  4 16:02:58 2012 UTC

Begun work on VMTranslationMap implementation for x86_64.

* Added empty source files for all the 64-bit paging method code, and a
  stub implementation of X86PagingMethod64Bit.
* arch_vm_translation_map.cpp has been modified to use X86PagingMethod64Bit
  on x86_64.

----------------------------------------------------------------------------

############################################################################

Commit:      e70dd7e0af671e37378d68c241a081ebeaf8f659
URL:         http://cgit.haiku-os.org/haiku/commit/?id=e70dd7e
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jul  4 17:28:50 2012 UTC

Map all physical memory in the long mode paging setup.

Since x86_64 has such a large virtual address space all available physical
memory can be mapped in to it. The physical page mapper implementation for
x86_64 will use this mapping. Also changed the mapping code to map kernel
pages with the global flag.

----------------------------------------------------------------------------

############################################################################

Commit:      a8f85e6e48ec38ad16d9e1289f031e696220367e
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a8f85e6
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jul  4 17:33:21 2012 UTC

Removed accidently left in debug message.

----------------------------------------------------------------------------

############################################################################

Commit:      40aeaeb907f5390e3eeb2958aa5d8362652eca22
URL:         http://cgit.haiku-os.org/haiku/commit/?id=40aeaeb
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jul  4 17:39:23 2012 UTC

Should enable CR4.PGE while switching to the kernel.

----------------------------------------------------------------------------

############################################################################

Commit:      d687d8ac70249aa14a983002e52b643836f76b2d
URL:         http://cgit.haiku-os.org/haiku/commit/?id=d687d8a
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jul  4 18:57:48 2012 UTC

Implementation of VMPhysicalPageMapper for x86_64 using the permanent physical 
memory mapping.

----------------------------------------------------------------------------

############################################################################

Commit:      78d482e3b8a7b67ed37a7479fddeb735897f282d
URL:         http://cgit.haiku-os.org/haiku/commit/?id=78d482e
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Jul  5 08:10:50 2012 UTC

Style fixes.

----------------------------------------------------------------------------

############################################################################

Commit:      2f36ef5afe5aae9b150597d6281826a1c3ed2f3a
URL:         http://cgit.haiku-os.org/haiku/commit/?id=2f36ef5
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Jul  5 12:52:36 2012 UTC

Fixed the x86_64 setjmp implementation.

* typedef for jmp_buf was using int where it should be long.
* setjmp was clearing the buffer pointer rather than the signal mask before
  calling sigsetjmp.
* KDL now works without crashing on x86_64.

----------------------------------------------------------------------------

############################################################################

Commit:      0da10c8b51f9ec443a53873b37d07fab30a5734e
URL:         http://cgit.haiku-os.org/haiku/commit/?id=0da10c8
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Jul  5 12:55:59 2012 UTC

Some fixes to the long mode switch code.

* Wasn't storing the fixed virtual address of the PML4 in kernel_args.
* After switching to long mode, reload GDTR with the virtual address of
  the GDT. This was working fine until now because the physical address
  was identity mapped, but broke as soon as I removed the identity
  mapping.

----------------------------------------------------------------------------

############################################################################

Commit:      898b29e3628ba9252c527e6296b88cf71d37b863
URL:         http://cgit.haiku-os.org/haiku/commit/?id=898b29e
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Jul  5 14:35:43 2012 UTC

Added temporary stack trace function to x86_64.

Will be merged with the x86 one later on. Requires -fno-omit-frame-pointer on
the kernel build flags, GCC defaults to not generating stack frames on x86_64.

----------------------------------------------------------------------------

############################################################################

Commit:      1671cfdf2c488cd9265ccb76a3b8ee3a393b0d9e
URL:         http://cgit.haiku-os.org/haiku/commit/?id=1671cfd
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Jul  5 15:11:11 2012 UTC

Improved stack tracer, traces over iframes.

----------------------------------------------------------------------------

############################################################################

Commit:      11d35d1b9b453cf95392b2ae8fa0941266e85d78
URL:         http://cgit.haiku-os.org/haiku/commit/?id=11d35d1
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Jul  5 19:17:31 2012 UTC

Fixed tracing printf formats in VM code.

----------------------------------------------------------------------------

############################################################################

Commit:      e276cc0457a4ddb3f137504e220ee5e839f132d4
URL:         http://cgit.haiku-os.org/haiku/commit/?id=e276cc0
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jul  6 11:52:35 2012 UTC

Finished implementation of x86_64 paging.

* vm_init now runs up until create_preloaded_image_areas(), which needs
  fixing to handle ELF64.
* Not completely tested. I know Map(), Unmap() and Query() work fine, the
  other methods have not been tested as the kernel doesn't boot far enough
  for any of them to be called yet. As far as I know they're correct, though.
* Not yet implemented the destructor for X86VMTranslationMap64Bit or Init()
  for a user address space.

----------------------------------------------------------------------------

############################################################################

Commit:      ab7726a2c4bafe6e4d4937c1fb6c80f9281d9fbc
URL:         http://cgit.haiku-os.org/haiku/commit/?id=ab7726a
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jul  6 13:04:07 2012 UTC

Temporary fix for create_preloaded_image_areas. Will be replaced with a typedef 
later on.

----------------------------------------------------------------------------

############################################################################

Commit:      84bf29f97b5ff5f1ace8dfee48d035cba0b4fb75
URL:         http://cgit.haiku-os.org/haiku/commit/?id=84bf29f
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jul  6 13:17:48 2012 UTC

Compile in arch_platform.cpp for x86_64. The apm_init call is disabled for 
x86_64, APM is 32-bit only.

----------------------------------------------------------------------------

############################################################################

Commit:      15feb60325be086823e80a3468f7aab2bfbc9f7d
URL:         http://cgit.haiku-os.org/haiku/commit/?id=15feb60
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jul  6 13:34:50 2012 UTC

A few improvements suggested by Ingo.

----------------------------------------------------------------------------

############################################################################

Commit:      c15176264b7fa5b4e20b4692d30ed9403fd9c71b
URL:         http://cgit.haiku-os.org/haiku/commit/?id=c151762
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jul  6 14:24:02 2012 UTC

Compile APIC and timer code for x86_64, and create an area for the IDT.

----------------------------------------------------------------------------

############################################################################

Commit:      7444a55ce55af4fecf298a1749c1c23228305385
URL:         http://cgit.haiku-os.org/haiku/commit/?id=7444a55
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jul  6 14:55:59 2012 UTC

Merge branch 'master' into x86_64

----------------------------------------------------------------------------

############################################################################

Commit:      5c7d52183c2182761151ba2f8f72bb7b39e50053
URL:         http://cgit.haiku-os.org/haiku/commit/?id=5c7d521
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Jul  8 09:16:44 2012 UTC

Implemented system_time() for x86_64.

* Uses 64-bit multiplication, special handling for CPUs clocked < 1 GHz
  in system_time_nsecs() not required like on x86.
* Tested against a straight conversion of the x86 version, noticably
  faster with a large number of system_time() calls.

----------------------------------------------------------------------------

############################################################################

Commit:      cc248cf2b37b96f8f86d652e0121be105b23d192
URL:         http://cgit.haiku-os.org/haiku/commit/?id=cc248cf
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Jul  8 10:56:06 2012 UTC

A couple of bug fixes.

* mmu_get_virtual_mapping() should check that the page directory entry is
  present rather than assuming there's a page table there. This was resulting
  in some invalid mappings being created in the 64-bit virtual address space.
* arch_vm_init_end() should clear from KERNEL_LOAD_BASE to virtual_end, not
  from KERNEL_BASE. On x86_64 this was causing it to loop through ~512GB of
  address space, which obviously was taking quite a while.

----------------------------------------------------------------------------

############################################################################

Commit:      93cba1da96275eb617fcdc581ec4522e0b107adf
URL:         http://cgit.haiku-os.org/haiku/commit/?id=93cba1d
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Jul  8 14:03:23 2012 UTC

Fixed a bug resulting from a mistake in the boot 64-bit paging setup.

This was an interesting bug to find. Was getting spurious triple faults
in the slab allocator. The problem was that the boot paging setup code
was mapping all page tables it created into the virtual address space,
but in the kernel no areas were being created to cover them, so during
arch_vm_init_end() the pages for them ended up being freed and then
overwritten later on. Fixed by unmapping page tables after populating
them in long_mmu_init().

----------------------------------------------------------------------------

############################################################################

Commit:      bc3093488f72315d8474d45b3dfe34cdc15ef4d6
URL:         http://cgit.haiku-os.org/haiku/commit/?id=bc30934
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jul  9 08:03:11 2012 UTC

Changes suggested by Ingo: style fix, and a system_time optimization.

----------------------------------------------------------------------------

############################################################################

Commit:      3b802628b8e2aa14eb4c674d0a8cf900f522baa1
URL:         http://cgit.haiku-os.org/haiku/commit/?id=3b80262
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jul  9 10:11:38 2012 UTC

Support ELF64 in the kernel.

This has been done by adding typedefs in elf_common.h to the correct ELF
structures for the architecture, and changing all Elf32_* uses to those
types. I don't know whether image loading works as I cannot test it yet,
there may be some 64-bit safety issues around. However, symbol lookup for
the kernel is working correctly.

----------------------------------------------------------------------------

############################################################################

Commit:      ee7aba5117fea8aa4d292fb9c105dc483c67a2e2
URL:         http://cgit.haiku-os.org/haiku/commit/?id=ee7aba5
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jul  9 10:54:03 2012 UTC

Print symbol information in a stack trace.

----------------------------------------------------------------------------

############################################################################

Commit:      5e9bb17da7b9cdd76ff9072486fab90688cf8c36
URL:         http://cgit.haiku-os.org/haiku/commit/?id=5e9bb17
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jul  9 11:14:18 2012 UTC

Renamed remaining i386_* functions to x86_* for consistency.

----------------------------------------------------------------------------

############################################################################

Commit:      8c5e74719039c7275a5a80b236b830b7b4ba1be7
URL:         http://cgit.haiku-os.org/haiku/commit/?id=8c5e747
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jul  9 11:25:49 2012 UTC

Don't need to shift the factor in system_time(), just store the already shifted 
value.

----------------------------------------------------------------------------

############################################################################

Commit:      85d4a8bc4e248b992efcde8af001f156cd2c47a9
URL:         http://cgit.haiku-os.org/haiku/commit/?id=85d4a8b
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jul  9 13:35:01 2012 UTC

Fixed compilation of C code using ELF headers.

----------------------------------------------------------------------------

############################################################################

Commit:      b5c9d24abcc3599375153ed310b495ea944d46a0
URL:         http://cgit.haiku-os.org/haiku/commit/?id=b5c9d24
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jul  9 15:43:01 2012 UTC

Implemented threading for x86_64.

* Thread creation and switching is working fine, however threads do not yet
  get interrupted because I've not implemented hardware interrupt handling
  yet (I'll do that next).
* I've made some changes to struct iframe: I've removed the e/r prefixes
  from the member names for both 32/64, so now they're just named ip, ax,
  bp, etc. This makes it easier to write code that works with both 32/64
  without having to deal with different iframe member names.

----------------------------------------------------------------------------

############################################################################

Commit:      c8049a88a3ea4a5d8b4144f7f053d712815b75ce
URL:         http://cgit.haiku-os.org/haiku/commit/?id=c8049a8
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jul  9 16:42:34 2012 UTC

Enabled hardware interrupt handler, timers now work and threads are preempted.

----------------------------------------------------------------------------

############################################################################

Commit:      5670b0a8e4fe8e5504b2e57a958e1590f6024406
URL:         http://cgit.haiku-os.org/haiku/commit/?id=5670b0a
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jul  9 18:18:09 2012 UTC

Moved the 32-bit page fault handler to arch_int.cpp, use it for x86_64.

A proper page fault handler was required for areas that were not locked
into the kernel address space. This enables the boot process to get
up to the point of trying to find the boot volume.

----------------------------------------------------------------------------

############################################################################

Commit:      609b308e64d28acbcac1edde134b427f648914a4
URL:         http://cgit.haiku-os.org/haiku/commit/?id=609b308
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jul 11 11:23:18 2012 UTC

Return B_NOT_SUPPORTED for shutdown if ACPI is unavailable (no APM on x86_64).

----------------------------------------------------------------------------

############################################################################

Commit:      fc644104aca3b677ad2fdbc6aad44a4178b1b8d2
URL:         http://cgit.haiku-os.org/haiku/commit/?id=fc64410
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jul 11 11:24:47 2012 UTC

Merge branch 'master' into x86_64

----------------------------------------------------------------------------

############################################################################

Commit:      d776fd53f7fdf12f297838ca476948bc7083c82a
URL:         http://cgit.haiku-os.org/haiku/commit/?id=d776fd5
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jul 11 13:19:19 2012 UTC

Implemented arch_cpu_user_*() for x86_64, based on the x86 versions.

----------------------------------------------------------------------------

############################################################################

Commit:      659bacac269ec0992603008ef436ee20505bd67f
URL:         http://cgit.haiku-os.org/haiku/commit/?id=659baca
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jul 11 13:43:44 2012 UTC

Compile arch_real_time_clock.cpp and arch_system_info.cpp for x86_64.

----------------------------------------------------------------------------

############################################################################

Commit:      76a1175dbe1a314563ca18c0b7fb82695a9730cd
URL:         http://cgit.haiku-os.org/haiku/commit/?id=76a1175
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jul 11 17:29:15 2012 UTC

Support for SMP on x86_64.

No major changes to the kernel: just compiled in arch_smp.cpp and fixed the
IDT load in arch_cpu_init_percpu to use the correct limit for x86_64 (uses
sizeof(interrupt_descriptor)). In the boot loader, changed smp_boot_other_cpus
to construct a temporary GDT and get the page directory address from CR3, as
what's in kernel_args will be 64-bit stuff and will not work to switch the
CPUs into 32-bit mode in the trampoline code. Refactored 64-bit kernel entry
code to not use the stack after disabling paging, as the secondary CPUs are
given a 32-bit virtual stack address by the SMP trampoline code which will
no longer work.

----------------------------------------------------------------------------

############################################################################

Commit:      c3f0fd28cda13d70a8c092003609442e4e29cf78
URL:         http://cgit.haiku-os.org/haiku/commit/?id=c3f0fd2
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Jul 12 10:29:33 2012 UTC

Fixed formatting of output in some debugger commands.

Currently all debugger commands assume 32-bit pointers when formatting their
output. This means that on x86_64 the output is incorrectly formatted. Fixed
this by adding a B_PRINTF_POINTER_WIDTH definition (16 on 64-bit, 8 on
32-bit), and using this to correctly format the output. Not all commands have
been fixed yet, but all VM, slab, VFS, team, thread and image commands should
be correct.

----------------------------------------------------------------------------

############################################################################

Commit:      98614a96583c9c30f646a48617dcf2e670fe5586
URL:         http://cgit.haiku-os.org/haiku/commit/?id=98614a9
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Jul 12 10:33:39 2012 UTC

Merge branch 'master' into x86_64

----------------------------------------------------------------------------

############################################################################

Commit:      6ba74ba51c14e84609239758cb01f674ffa335e8
URL:         http://cgit.haiku-os.org/haiku/commit/?id=6ba74ba
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Jul 12 11:21:09 2012 UTC

Fixed compilation of the boot loader on GCC 2.

Not sure why but GCC 2 seems to be ignoring the extern "C" in smp.h when
compiling smp_boot_other_cpus() resulting in undefined references. Fixed
by putting extern "C" on the definition too.

----------------------------------------------------------------------------

############################################################################

Commit:      5774b5afa4f73fb010a7b7af03a9aa5f6deaec93
URL:         http://cgit.haiku-os.org/haiku/commit/?id=5774b5a
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Jul 12 11:22:48 2012 UTC

C++ified remaining C users of arch_cpu.h.

----------------------------------------------------------------------------

############################################################################

Commit:      d38f1301d1e3f4c56f6350b40be3275ceff478ee
URL:         http://cgit.haiku-os.org/haiku/commit/?id=d38f130
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Jul 12 12:55:03 2012 UTC

Cleaned up 32-bit descriptors.h.

----------------------------------------------------------------------------

############################################################################

Commit:      6e06fa6f7ea099cec5247fa2e8409c9c8ab3c983
URL:         http://cgit.haiku-os.org/haiku/commit/?id=6e06fa6
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Jul 12 13:06:29 2012 UTC

Added missing validity check on relocation address.

----------------------------------------------------------------------------

############################################################################

Commit:      4ebc6dfa682fa199a88ec06f0930df04369f34ac
URL:         http://cgit.haiku-os.org/haiku/commit/?id=4ebc6df
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Jul 12 13:23:55 2012 UTC

Moved some 32-bit specific stuff to the 32 subdirectory.

----------------------------------------------------------------------------

############################################################################

Commit:      8a65fedaaaf8fd4b8ac2819ab81b4a4f47693905
URL:         http://cgit.haiku-os.org/haiku/commit/?id=8a65fed
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Jul 12 15:32:12 2012 UTC

Merge branch 'master' into x86_64

Conflicts:
        src/system/kernel/arch/x86/arch_debug.cpp

----------------------------------------------------------------------------

############################################################################

Commit:      e690e5ab3b4adc583b94a27400b7fd12da80ce51
URL:         http://cgit.haiku-os.org/haiku/commit/?id=e690e5a
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Jul 12 16:16:17 2012 UTC

Proper fix for GCC 2 compilation error that was fixed earlier, cause pointed 
out by Ingo.

----------------------------------------------------------------------------

############################################################################

Commit:      bcb07a319b647eb0af60398e972525cc0a686aa9
URL:         http://cgit.haiku-os.org/haiku/commit/?id=bcb07a3
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jul 13 13:09:09 2012 UTC

Implemented the rest of the kernel debugger functions for x86_64.

Merged with the x86 implementations, mostly the same except for a
few differences. GDB stub is currently broken, will investigate
later.

----------------------------------------------------------------------------

############################################################################

Commit:      368f253347a896d239b1fd4c2f854fac37a7e994
URL:         http://cgit.haiku-os.org/haiku/commit/?id=368f253
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Jul 14 07:49:14 2012 UTC

Merge branch 'master' into x86_64

----------------------------------------------------------------------------

############################################################################

Commit:      b2cd72d8f3c4a3710fdbaf36802de3d6e74a4066
URL:         http://cgit.haiku-os.org/haiku/commit/?id=b2cd72d
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Jul 14 08:23:48 2012 UTC

Implemented arch_debug_call_with_fault_handler for x86_64.

----------------------------------------------------------------------------

############################################################################

Commit:      0cbce9aa4732e96acd9d593cb86ca0847a61d051
URL:         http://cgit.haiku-os.org/haiku/commit/?id=0cbce9a
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Jul 19 11:45:17 2012 UTC

A few 64-bit fixes for ELF/module code.

----------------------------------------------------------------------------

############################################################################

Commit:      385d69fc0177827257822eec1274f4286bc6600d
URL:         http://cgit.haiku-os.org/haiku/commit/?id=385d69f
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Jul 19 16:53:46 2012 UTC

Made it possible to build kernel modules for x86_64.

Added the necessary build flags for modules, and added a module (dpc)
to the floppy image for x86_64 builds for testing purposes. The module
gets loaded correctly and its code runs without issue. Only non-trivial
addition is the different method for generating kernel.so, this is
explained in the kernel Jamfile.

----------------------------------------------------------------------------

############################################################################

Commit:      2865db34c861fc7e72d1076885e671b5b2d0e7dc
URL:         http://cgit.haiku-os.org/haiku/commit/?id=2865db3
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jul 20 10:53:46 2012 UTC

Compile msi.cpp for x86_64.

Needed to link the PCI module, not enabling it yet though, I'm not
sure whether everything needed for it is in place yet.

----------------------------------------------------------------------------

############################################################################

Commit:      9d4e925cf02e98d5385b5253bce07683d378883d
URL:         http://cgit.haiku-os.org/haiku/commit/?id=9d4e925
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jul 20 10:56:15 2012 UTC

Support x86_64 in config_manager.

----------------------------------------------------------------------------

############################################################################

Commit:      12bd7812dd6b6eadb65789ca9fc2e270d7d66fd4
URL:         http://cgit.haiku-os.org/haiku/commit/?id=12bd781
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jul 20 11:00:20 2012 UTC

Ported PCI module to x86_64.

Uses the x86 architecture code, made fixes to printf formats and a
couple of 64-bit fixes. Only potentially intrusive change is that I've
changed PCI.h to use uint32 rather than ulong. I don't see any way
this would cause any issues, though.

----------------------------------------------------------------------------

############################################################################

Commit:      1b41387b5f54acc9ad4e71fc377d98eb63fbac74
URL:         http://cgit.haiku-os.org/haiku/commit/?id=1b41387
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jul 20 16:14:17 2012 UTC

Added missing packed attributes on disk_identifier.

----------------------------------------------------------------------------

############################################################################

Commit:      d7ec2fa3bfda5ba1674e97528fba2f4cfec00144
URL:         http://cgit.haiku-os.org/haiku/commit/?id=d7ec2fa
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jul 20 16:37:37 2012 UTC

A couple of format string fixes for tracing printfs.

----------------------------------------------------------------------------

############################################################################

Commit:      0063d2ba513ddb6bd54c329aa0d16c7e184862da
URL:         http://cgit.haiku-os.org/haiku/commit/?id=0063d2b
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jul 20 16:47:12 2012 UTC

Various 64-bit fixes to SCSI and ATA bus managers/drivers.

Mostly compilation fixes, as well as a few 64-bit safety fixes. I've
briefly looked through everything for any obvious issues and fixed
the ones I've found, and it seems like they're working properly, though
there could be some more well hidden ones that I've missed.

----------------------------------------------------------------------------

############################################################################

Commit:      7f7e76e4615a652686e68102907732d114968b58
URL:         http://cgit.haiku-os.org/haiku/commit/?id=7f7e76e
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jul 20 16:53:59 2012 UTC

64-bit compilation fixes for write_overlay and intel partitioning system 
modules.

----------------------------------------------------------------------------

############################################################################

Commit:      a9fdaec18aa39c5af3dd94a998325c520eb4423c
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a9fdaec
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jul 20 16:55:26 2012 UTC

Added disk drivers and CD file system modules to the boot image for x86_64.

This adds disk drivers, intel/session partitioning systems, and ISO9660
(+ write/attribute_overlay) modules to the CD/floppy boot image targets
for x86_64. The kernel now detects and mounts the boot CD, and runs up
to attempting to start the boot script.

----------------------------------------------------------------------------

############################################################################

Commit:      82694bd124728b847ff3e97ee961d1a6526659c9
URL:         http://cgit.haiku-os.org/haiku/commit/?id=82694bd
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jul 20 17:33:46 2012 UTC

Merge branch 'master' into x86_64

Conflicts:
        headers/posix/arch/x86_64/arch_setjmp.h
        src/system/kernel/cache/block_cache.cpp

----------------------------------------------------------------------------

############################################################################

Commit:      4451c47c644320b88fe18a89993a2cf5b0d919b1
URL:         http://cgit.haiku-os.org/haiku/commit/?id=4451c47
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Jul 21 07:32:07 2012 UTC

Compile generic_x86 CPU module for x86_64.

----------------------------------------------------------------------------

############################################################################

Commit:      6497f6b1ec4dd21d85ec01a18098138b03986a98
URL:         http://cgit.haiku-os.org/haiku/commit/?id=6497f6b
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Jul 21 08:11:09 2012 UTC

Moved the exception handling functions to arch_int.cpp, shared between x86 and 
x86_64.

----------------------------------------------------------------------------

############################################################################

Commit:      5234e66d32184c0843e7c5020c23e28f88e50569
URL:         http://cgit.haiku-os.org/haiku/commit/?id=5234e66
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Jul 21 10:55:13 2012 UTC

Optimized memcpy/memset for x86_64.

----------------------------------------------------------------------------

############################################################################

Commit:      5f6b522746281b81b67745cbf22093658b30a01f
URL:         http://cgit.haiku-os.org/haiku/commit/?id=5f6b522
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Jul 21 13:17:22 2012 UTC

Merge branch 'master' into x86_64

----------------------------------------------------------------------------

############################################################################

Commit:      195a0f350e3acd76856016f673c8a871ed687a07
URL:         http://cgit.haiku-os.org/haiku/commit/?id=195a0f3
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Jul 21 13:33:27 2012 UTC

Changed argument type of fcntl syscall from uint32 to size_t.

Since this argument may be used to pass pointers, uint32 is not
correct for 64-bit. Effectively no change on 32-bit targets, both
size_t and uint32 are unsigned long there.

----------------------------------------------------------------------------

############################################################################

Commit:      59ae45c1ab32476f1fa428dae22989f8387a1f9e
URL:         http://cgit.haiku-os.org/haiku/commit/?id=59ae45c
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Jul 21 15:18:10 2012 UTC

Fixed commpage for x86_64.

Since the commpage is at a kernel address, changed 64-bit paging code
to match x86's behaviour of allowing user-accessible mappings to be
created in the kernel portion of the address space. This is also
required by some drivers.

----------------------------------------------------------------------------

############################################################################

Commit:      1c24ebaa5fdc1d07cd40a296c59463c9477b8fbd
URL:         http://cgit.haiku-os.org/haiku/commit/?id=1c24eba
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Jul 22 09:42:35 2012 UTC

64-bit compilation fixes for BFS, add to x86_64 boot image.

----------------------------------------------------------------------------

############################################################################

Commit:      700c8d3078c1caf65667b7cbb955527d524ff07c
URL:         http://cgit.haiku-os.org/haiku/commit/?id=700c8d3
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Jul 22 10:36:50 2012 UTC

Support building images for x86_64.

Added a temporary Haiku64Image file that gets included instead of
HaikuImage when building for x86_64, which I will add to as I port
stuff. Images currently only include the boot loader, kernel and
a bunch of add-ons.

----------------------------------------------------------------------------

############################################################################

Commit:      5afce632f385fe750150f4b05f567f0f980a888e
URL:         http://cgit.haiku-os.org/haiku/commit/?id=5afce63
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Jul 22 11:13:04 2012 UTC

Demangle symbols in stack traces.

Since the demangle debugger extension now gets loaded when booting
from an image, use it in stack traces. Can't print argument values
like on x86, however, since x86_64 uses registers to pass the first
6 arguments rather than the stack we can't easily get to them.

----------------------------------------------------------------------------

############################################################################

Commit:      aef19e3c95ba3047d6d95b2731c6ea66dbbfddab
URL:         http://cgit.haiku-os.org/haiku/commit/?id=aef19e3
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Jul 22 12:07:44 2012 UTC

Implemented creation and destruction of user translation maps.

----------------------------------------------------------------------------

############################################################################

Commit:      fd9f32c0db56a5cebdda79c329b479355bdde87c
URL:         http://cgit.haiku-os.org/haiku/commit/?id=fd9f32c
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Jul 22 13:59:42 2012 UTC

Added some libroot bits for x86_64.

Still some parts missing (the glibc bits + fenv.c), plus the TLS
functions are only stubs.

----------------------------------------------------------------------------

############################################################################

Commit:      fe2e7327217d3e99738f88c2acd5beb45d6dbbed
URL:         http://cgit.haiku-os.org/haiku/commit/?id=fe2e732
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jul 23 13:18:54 2012 UTC

Avoid an unnecessary mov on syscalls with < 4 arguments.

----------------------------------------------------------------------------

############################################################################

Commit:      07c6bd65b8aa82eae10c036e674799c1c5d16be9
URL:         http://cgit.haiku-os.org/haiku/commit/?id=07c6bd6
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jul 23 13:20:29 2012 UTC

Format string fixes for TRACE_{THREAD,TEAM}.

----------------------------------------------------------------------------

############################################################################

Commit:      370ab57d49a208f79ce3c5e9f92be13b58c48f18
URL:         http://cgit.haiku-os.org/haiku/commit/?id=370ab57
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jul 23 16:12:12 2012 UTC

Initial userland support for x86_64.

Userland switch is implemented, as is basic system call support (using
SYSCALL/SYSRET). The system call handler is not yet complete: it doesn't
handle more than 6 arguments, and does not perform all the necessary kernel
entry/exit work (neither does the interrupt handler). However, this is
sufficient for runtime_loader to start and print some debug output.

----------------------------------------------------------------------------

############################################################################

Commit:      6f1f972cafca49b8d664492322065346c3a58aeb
URL:         http://cgit.haiku-os.org/haiku/commit/?id=6f1f972
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jul 25 07:56:47 2012 UTC

Finished system call handler.

The interrupt and system call handlers now perform all the necessary
kernel entry/exit work, and the system call handler now handles calls
with more than 6 arguments. Debugging and system call tracing hooks
are not yet called, will be added when user debugging gets implemented.

----------------------------------------------------------------------------

############################################################################

Commit:      ce35b7a68a5eb8d8f04416abafd5596a15805ab8
URL:         http://cgit.haiku-os.org/haiku/commit/?id=ce35b7a
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jul 25 14:00:50 2012 UTC

Fixed broken build for x86.

----------------------------------------------------------------------------

############################################################################

Commit:      e3ac2588e64059e0c140504e9acc8e73b3c36fdc
URL:         http://cgit.haiku-os.org/haiku/commit/?id=e3ac258
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Jul 25 14:05:21 2012 UTC

Changed runtime_loader to use elf_* typedefs over Elf32_*.

This means that it will be using ELF64 types on x86_64 rather than
ELF32. The next step for supporting x86_64 is to implement relocations.

----------------------------------------------------------------------------

############################################################################

Commit:      5f119ed78f400fbaec842d982fb7943a14d6b60e
URL:         http://cgit.haiku-os.org/haiku/commit/?id=5f119ed
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jul 27 08:22:54 2012 UTC

Added x86_64 glue code.

----------------------------------------------------------------------------

############################################################################

Commit:      3fde53501d6fd13daa168378d3f8ae8f3ca6bafd
URL:         http://cgit.haiku-os.org/haiku/commit/?id=3fde535
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jul 27 14:21:41 2012 UTC

Updated x86_64 fenv.h and added fenv.c.

----------------------------------------------------------------------------

############################################################################

Commit:      04c1e6d01744fb03ca322b42d70dc731c049afe4
URL:         http://cgit.haiku-os.org/haiku/commit/?id=04c1e6d
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Jul 27 17:15:28 2012 UTC

ASM code fixes for PIC compilation.

----------------------------------------------------------------------------

############################################################################

Commit:      a3210bbc769a6b62188759cd4d3fd6b1114b1682
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a3210bb
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Jul 28 11:23:47 2012 UTC

Added x86_64 math functions to libroot.

These have been pulled from glibc 2.10, the last version before a
bunch of changes were made that would have made porting more difficult.
None of this has been tested yet, it is not currently possible to do
so: I'm just trying to get libroot compiling so that I can work on the
runtime loader. I will test them when I am able to.

----------------------------------------------------------------------------

############################################################################

Commit:      c3b03e587739a9f9ea1017ac00b6d2ed383bac8d
URL:         http://cgit.haiku-os.org/haiku/commit/?id=c3b03e5
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Jul 28 12:02:34 2012 UTC

64-bit fixes to Hoard.

----------------------------------------------------------------------------

############################################################################

Commit:      e453c0f4a7d0014d73e9b499aa1fe813dc64c084
URL:         http://cgit.haiku-os.org/haiku/commit/?id=e453c0f
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Jul 28 12:40:09 2012 UTC

64-bit printf warning fixes in libroot.

----------------------------------------------------------------------------

############################################################################

Commit:      0efc5e72dc9502e0121dcd1aca8dfa0f4747d259
URL:         http://cgit.haiku-os.org/haiku/commit/?id=0efc5e7
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Jul 28 15:29:41 2012 UTC

Merge branch 'master' into x86_64

----------------------------------------------------------------------------

############################################################################

Commit:      bd8b78e6eedb24ab48771d18db6e091488cf53d3
URL:         http://cgit.haiku-os.org/haiku/commit/?id=bd8b78e
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Jul 28 15:54:30 2012 UTC

Added a dumb TLS implementation rather than printing an error.

Will properly implement TLS soon, for now a "working" implementation
is needed for anything to work properly.

----------------------------------------------------------------------------

############################################################################

Commit:      12b3e8a8a01e04da03da98410425695880e96347
URL:         http://cgit.haiku-os.org/haiku/commit/?id=12b3e8a
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Jul 28 15:57:56 2012 UTC

Support x86_64 in the runtime loader.

* Added x86_64 linker script and relocation code.
* Some 64-bit safety fixes to the heap code.
* Added runtime_loader, libroot and bash to the x86_64 image. The boot
  script will be launched, but will panic shortly after because fork
  is broken.

----------------------------------------------------------------------------

############################################################################

Commit:      6e2f6d1ace7490a200dcff70c52acf2af59c5bc3
URL:         http://cgit.haiku-os.org/haiku/commit/?id=6e2f6d1
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Jul 29 08:31:14 2012 UTC

Changed cookie type for get_next_area_info() to ssize_t.

The cookie is used to store the base address of the area that was just
visited. On 64-bit systems, int32 is not sufficient. Therefore, changed
to ssize_t which retains compatibility on x86 while expanding to a
sufficient size on x86_64.

----------------------------------------------------------------------------

############################################################################

Commit:      03add8e7c216a9ba83a2c565cb82962d6cdc53c4
URL:         http://cgit.haiku-os.org/haiku/commit/?id=03add8e
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Jul 29 10:39:01 2012 UTC

Implemented TLS for x86_64.

----------------------------------------------------------------------------

############################################################################

Commit:      afde37ff9b417de6e7e4b348a4df556c4d25de6f
URL:         http://cgit.haiku-os.org/haiku/commit/?id=afde37f
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Jul 29 13:31:11 2012 UTC

Prevent allocating address 0 when inserting an area with B_ANY_ADDRESS.

The USER_BASE_ANY definition exists to specify where to start searching
for B_ANY_ADDRESS allocations, but this was not being used correctly.
On x86_64, this was causing the runtime loader's heap to be allocated
at address 0 so NULL pointer accesses were not getting caught.

----------------------------------------------------------------------------

############################################################################

Commit:      e27109c167b6dd62e6ceba4008d685805e10121e
URL:         http://cgit.haiku-os.org/haiku/commit/?id=e27109c
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jul 30 07:24:31 2012 UTC

Merge branch 'master' into x86_64

----------------------------------------------------------------------------

############################################################################

Commit:      bd16f0dd82af89e53cb3f616a0bbc2d448b5266a
URL:         http://cgit.haiku-os.org/haiku/commit/?id=bd16f0d
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jul 30 07:25:16 2012 UTC

Fixed configure for legacy buildtools.

The elfedit tool doesn't exist with the old binutils, so configure was
failing when it tried to get the path to it. Only try to search for it
if building GCC 4.

----------------------------------------------------------------------------

############################################################################

Commit:      5568c5055cdb40225d2521f4dde75eb256e368d3
URL:         http://cgit.haiku-os.org/haiku/commit/?id=5568c50
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jul 30 07:59:19 2012 UTC

Added coreutils to the x86_64 image.

----------------------------------------------------------------------------

############################################################################

Commit:      c0d28c01990d8815dddc645177f44b9ce361d186
URL:         http://cgit.haiku-os.org/haiku/commit/?id=c0d28c0
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jul 30 12:52:51 2012 UTC

Implemented signals for x86_64.

----------------------------------------------------------------------------

############################################################################

Commit:      ef67788fba5d738eeb99768caea7b0e5170893f5
URL:         http://cgit.haiku-os.org/haiku/commit/?id=ef67788
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jul 30 13:37:28 2012 UTC

Ported ISA bus manager and PS/2 driver.

----------------------------------------------------------------------------

############################################################################

Commit:      9be774b553296a712704078314f2291ae5fc352c
URL:         http://cgit.haiku-os.org/haiku/commit/?id=9be774b
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jul 30 20:27:21 2012 UTC

Compilation and 64-bit fixes to libbe.so sources.

Fixed the usual issues - printf format strings, uint32 instead of
addr_t, etc. One thing that isn't so nice is several places where
BList is used to store (u)int32, these require a double cast to addr_t
then void* to silence a warning on x86_64.

----------------------------------------------------------------------------

############################################################################

Commit:      533f3bb494fc873564146561b6b954168021c6d1
URL:         http://cgit.haiku-os.org/haiku/commit/?id=533f3bb
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jul 30 20:34:05 2012 UTC

Support x86_64 in sysinfo.

Just changed all #ifdef __INTEL__ to __INTEL__ || __x86_64__, and
fixed all the printf format strings. The CPU detection code all
works the same.

----------------------------------------------------------------------------

############################################################################

Commit:      a1a38e8aba0970729979f9dc0b3af72bd7b56e61
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a1a38e8
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jul 30 20:38:47 2012 UTC

Retry a few times if opening keyboard fails in consoled.

I'm using consoled at the moment without input_server having been run,
so when it starts the input drivers will not have been loaded. Have to
retry a few times with delays so that the input devices have a chance
to appear.

----------------------------------------------------------------------------

############################################################################

Commit:      666b46e2e3260e85ca6af913a73e75df9a24ab27
URL:         http://cgit.haiku-os.org/haiku/commit/?id=666b46e
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jul 30 20:42:49 2012 UTC

Added libbe, ICU and consoled to the image.

The boot script now launches consoled instead if app_server does not
exist, so there is now an interactive Bash prompt! libbe requires ICU,
which is an optional package, so I've built the packages and they've
been uploaded to haiku-files.org (thanks umccullough).

----------------------------------------------------------------------------

############################################################################

Commit:      02dd3236d21fd322310a1f791bab69d7bc031434
URL:         http://cgit.haiku-os.org/haiku/commit/?id=02dd323
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Jul 30 20:56:50 2012 UTC

Better names for syscall/signal functions copied to the commpage.

----------------------------------------------------------------------------

############################################################################

Commit:      3cd66dda5e623130a5ef7560da6851d421fd591e
URL:         http://cgit.haiku-os.org/haiku/commit/?id=3cd66dd
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Tue Jul 31 09:12:33 2012 UTC

Fix CID 712419, 712420, 712421, 712422: Unintentional sign extension to 64 bits.

----------------------------------------------------------------------------

############################################################################

Commit:      d4ec857af317aeb2ffd928e4fc832b28b1aad8ba
URL:         http://cgit.haiku-os.org/haiku/commit/?id=d4ec857
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Tue Jul 31 11:10:24 2012 UTC

Merge branch 'master' into x86_64

----------------------------------------------------------------------------

############################################################################

Commit:      e6b3188fcb3a545684d2a26fc1200a77362da301
URL:         http://cgit.haiku-os.org/haiku/commit/?id=e6b3188
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Aug  1 09:44:38 2012 UTC

Merge branch 'master' into x86_64

----------------------------------------------------------------------------

############################################################################

Commit:      8110732b0350b7a9bc72e831a56fbc874a113695
URL:         http://cgit.haiku-os.org/haiku/commit/?id=8110732
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Aug  1 10:00:35 2012 UTC

Added some more binaries to the image.

----------------------------------------------------------------------------

############################################################################

Commit:      9a5503d01c41c7afc680c30256fba28700fc8b60
URL:         http://cgit.haiku-os.org/haiku/commit/?id=9a5503d
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Aug  1 10:13:14 2012 UTC

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.

----------------------------------------------------------------------------

############################################################################

Commit:      b77772725ccf08904ed1ed8e0e28500868093ef4
URL:         http://cgit.haiku-os.org/haiku/commit/?id=b777727
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Aug  1 10:46:44 2012 UTC

Changed x86_64 toolchain target to x86_64-unknown-haiku.

----------------------------------------------------------------------------

############################################################################

Commit:      d93ed095640345495ace3b653ea87b66815c7c81
URL:         http://cgit.haiku-os.org/haiku/commit/?id=d93ed09
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Aug  2 08:32:33 2012 UTC

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.

----------------------------------------------------------------------------

############################################################################

Commit:      50cedfd5b01a968c2da00bfd014360b24a3aac66
URL:         http://cgit.haiku-os.org/haiku/commit/?id=50cedfd
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Aug  2 09:45:42 2012 UTC

Build registrar for x86_64.

----------------------------------------------------------------------------

############################################################################

Commit:      a9ee7a51329c8a6c6e205e91907c2a753bb62495
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a9ee7a5
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Aug  3 14:42:30 2012 UTC

Added new BIOS module for calling BIOS interrupts.

This module provides an interface for drivers to use to perform calls
to the BIOS (only really for use by graphics drivers which need to use
the VESA BIOS). It uses the x86emu library from X.org which emulates
a real mode x86 CPU. This is necessary for x86_64 as virtual 8086 mode
no longer exists there.

----------------------------------------------------------------------------

############################################################################

Commit:      b28f734b1cd385194683bccf9f5c46a16a7644e7
URL:         http://cgit.haiku-os.org/haiku/commit/?id=b28f734
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Aug  3 15:18:49 2012 UTC

Remove line copied from old vm86 code that shouldn't be there.

----------------------------------------------------------------------------

############################################################################

Commit:      9f90e8a9649d7b63607e2d90f94717bed2b072b5
URL:         http://cgit.haiku-os.org/haiku/commit/?id=9f90e8a
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Aug  3 15:28:20 2012 UTC

Updated drivers to use BIOS module instead of vm86.

----------------------------------------------------------------------------

############################################################################

Commit:      74bda98cb236130b1d4f84795f7fafd5c8e540a9
URL:         http://cgit.haiku-os.org/haiku/commit/?id=74bda98
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Aug  3 15:49:15 2012 UTC

Killed off vm86 code, no longer being used.

----------------------------------------------------------------------------

############################################################################

Commit:      9bfe064799922abfaa9e139b8d59ce0a01914715
URL:         http://cgit.haiku-os.org/haiku/commit/?id=9bfe064
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Aug  3 16:12:53 2012 UTC

GCC 2 compilation fix for x86emu.

----------------------------------------------------------------------------

############################################################################

Commit:      54393c0379e2b22f7863c3434eb2705b746575bb
URL:         http://cgit.haiku-os.org/haiku/commit/?id=54393c0
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Aug  4 08:59:17 2012 UTC

Merge branch 'master' into x86_64

----------------------------------------------------------------------------

############################################################################

Commit:      92f09f1aebbed0b5a9a24925ff3edf2c5180e7ff
URL:         http://cgit.haiku-os.org/haiku/commit/?id=92f09f1
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Aug  4 09:14:22 2012 UTC

Added AHCI driver to image.

----------------------------------------------------------------------------

############################################################################

Commit:      70ee5a7efb6b566d840437a24edf0264e4d6c2ee
URL:         http://cgit.haiku-os.org/haiku/commit/?id=70ee5a7
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Aug  4 09:21:22 2012 UTC

Moved x86emu to {src,headers}/libs/.

----------------------------------------------------------------------------

############################################################################

Commit:      25871c6895b536640b3d9f453e95219a54b84d20
URL:         http://cgit.haiku-os.org/haiku/commit/?id=25871c6
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Aug  4 10:02:54 2012 UTC

Removed Thread::fault_callback, no longer necessary now that vm86 is gone.

----------------------------------------------------------------------------

############################################################################

Commit:      57ab0395ad31761e27ef6d5aa3af68cc3e4d71b2
URL:         http://cgit.haiku-os.org/haiku/commit/?id=57ab039
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Aug  4 15:10:00 2012 UTC

64-bit fixes for input_server.

----------------------------------------------------------------------------

############################################################################

Commit:      049d149cf760ee2c95b5f10032d39a9ade92525b
URL:         http://cgit.haiku-os.org/haiku/commit/?id=049d149
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Aug  4 17:58:26 2012 UTC

Handle 64-bit types correctly.

----------------------------------------------------------------------------

############################################################################

Commit:      f4294645358d2eeec007d93493f092581e9bb504
URL:         http://cgit.haiku-os.org/haiku/commit/?id=f429464
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Aug  5 07:12:39 2012 UTC

User symbol lookup works now on x86_64.

----------------------------------------------------------------------------

############################################################################

Commit:      3fed1a15f58e8d6fe6b492f3b94bb3625ffeddbd
URL:         http://cgit.haiku-os.org/haiku/commit/?id=3fed1a1
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Aug  5 07:46:30 2012 UTC

Ticket:      https://dev.haiku-os.org/ticket/8834

Get app_server working on x86_64.

With this commit, app_server now compiles and runs at boot! Nothing
particularly interesting happens, just the blue background and a mouse
pointer. Remote backends are broken and not compiled in, see #8834.
Note that it won't be possible to build this quite yet, need to get
the FreeType package uploaded.

----------------------------------------------------------------------------

############################################################################

Commit:      e5363c936abbfb22c0e76cf0f48aae3b7ab37433
URL:         http://cgit.haiku-os.org/haiku/commit/?id=e5363c9
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Aug  5 09:16:11 2012 UTC

Style fix.

----------------------------------------------------------------------------

############################################################################

Commit:      adf8818ec004e8a20614523f3e893303ea318642
URL:         http://cgit.haiku-os.org/haiku/commit/?id=adf8818
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Aug  5 09:24:22 2012 UTC

Compilation fixes for Terminal, add to image.

It runs, but has shown up various bugs: app_server crashes, kernel
panics, rendering problems. Working on fixing these now.

----------------------------------------------------------------------------

############################################################################

Commit:      284d75bd6a374d25aea846a0722e87685be5e15d
URL:         http://cgit.haiku-os.org/haiku/commit/?id=284d75b
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Aug  5 09:33:20 2012 UTC

Merge branch 'master' into x86_64

----------------------------------------------------------------------------

############################################################################

Commit:      e1be7d07d668af884caab7ff42e15cf95a609692
URL:         http://cgit.haiku-os.org/haiku/commit/?id=e1be7d0
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Aug  5 11:59:46 2012 UTC

Fixed a 64-bit calculation error.

----------------------------------------------------------------------------

############################################################################

Commit:      cc30eec43d7b2a525040edc8d3879f21bb1c0c2d
URL:         http://cgit.haiku-os.org/haiku/commit/?id=cc30eec
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Aug  5 13:20:37 2012 UTC

System call restart support.

----------------------------------------------------------------------------

############################################################################

Commit:      d8b4cfc9829119291e68cfe0152c239fd8850b3d
URL:         http://cgit.haiku-os.org/haiku/commit/?id=d8b4cfc
Author:      Rene Gollent <anevilyak@xxxxxxxxx>
Date:        Sat Aug  4 21:52:27 2012 UTC
Committer:   Alex Smith <alex@xxxxxxxxxxxxxxxx>
Commit-Date: Mon Aug  6 08:23:38 2012 UTC

Get USB functional on x86-64.

- Various changes to printf format specifiers to make them 32/64 safe.
- Adjustments to various descriptor structures since addr_t is not 32-bit
  on x86-64, and consequently this breaks the physical structure that's
  expected. Also adjusted padding to accomodate 32-byte boundaries when
  64-bit pointers are in use.
- Adjustments to make use of phys_addr_t where needed.

----------------------------------------------------------------------------

############################################################################

Commit:      abfb41a2ab657d91903615a269c2fb80eba80f31
URL:         http://cgit.haiku-os.org/haiku/commit/?id=abfb41a
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Aug  6 08:47:12 2012 UTC

Added USB modules to image.

----------------------------------------------------------------------------

############################################################################

Commit:      44672ada83568d55e0bc5bdf60ad932161e13e2c
URL:         http://cgit.haiku-os.org/haiku/commit/?id=44672ad
Author:      Rene Gollent <anevilyak@xxxxxxxxx>
Date:        Sun Aug  5 02:53:45 2012 UTC
Committer:   Alex Smith <alex@xxxxxxxxxxxxxxxx>
Commit-Date: Mon Aug  6 08:54:18 2012 UTC

Add usb_hid to image and get it building/working.

----------------------------------------------------------------------------

############################################################################

Commit:      2997a1912589c1b6c3276eaa4ab797040cd69230
URL:         http://cgit.haiku-os.org/haiku/commit/?id=2997a19
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Aug  6 11:29:12 2012 UTC

Fixed UHCI for x86_64.

----------------------------------------------------------------------------

############################################################################

Commit:      c802257bbba0cf2161957bcb0421290ff9eb1286
URL:         http://cgit.haiku-os.org/haiku/commit/?id=c802257
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Aug  6 11:34:03 2012 UTC

Merge branch 'master' into x86_64

----------------------------------------------------------------------------

############################################################################

Commit:      2b883e1977b1c420935c80b6fb9eb0067f112301
URL:         http://cgit.haiku-os.org/haiku/commit/?id=2b883e1
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Mon Aug  6 16:25:51 2012 UTC

Fix compilation of OHCI on x86.

Fixes were needed to go with the USB stack changes. Haven't tested it
yet because I don't have a a machine with OHCI, but I doubt there
will be any problems.

----------------------------------------------------------------------------

############################################################################

Commit:      8a1903353eedd95266c7241aada3a314c5d35a55
URL:         http://cgit.haiku-os.org/haiku/commit/?id=8a19033
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Tue Aug  7 19:20:42 2012 UTC

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.

----------------------------------------------------------------------------

############################################################################

Commit:      a731ad19e680a5ec387be3e4345445cadcd75fb4
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a731ad1
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Tue Aug  7 19:22:36 2012 UTC

ELF64 and x86_64 support in the debug kit.

----------------------------------------------------------------------------

############################################################################

Commit:      a3802ca96702d7011ad4967428c38f196b07480c
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a3802ca
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Tue Aug  7 19:24:55 2012 UTC

x86_64 support for GDB.

As mentioned in one of the previous commits, breakpoints don't work
properly yet, and I haven't done much extensive testing yet, but the
basic functionality works.

----------------------------------------------------------------------------

############################################################################

Commit:      a5e96a301e09c1c01d44450220f41911602520e8
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a5e96a3
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Aug  9 07:24:50 2012 UTC

Merge branch 'master' into x86_64

----------------------------------------------------------------------------

############################################################################

Commit:      f3e4f18be78e46d70a1883f750265a03f4fe0574
URL:         http://cgit.haiku-os.org/haiku/commit/?id=f3e4f18
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Aug  9 08:17:04 2012 UTC

Debugging fixes.

* INT3 had the wrong DPL set in the IDT, could not be raised from
  userland.
* Need the debug server running.

----------------------------------------------------------------------------

############################################################################

Commit:      fa6327c9f48f89f3be1f229d5aca749241b55bf0
URL:         http://cgit.haiku-os.org/haiku/commit/?id=fa6327c
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Aug  9 12:18:53 2012 UTC

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.

----------------------------------------------------------------------------

############################################################################

Commit:      c0166cf22a42fd1e778fff49d4243865da4c22d6
URL:         http://cgit.haiku-os.org/haiku/commit/?id=c0166cf
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Aug  9 13:06:29 2012 UTC

Should check for ELF_CLASS, not ELFCLASS32.

----------------------------------------------------------------------------

############################################################################

Commit:      4b8a51c34c81f8623fb5eb99e4be9ad606a56044
URL:         http://cgit.haiku-os.org/haiku/commit/?id=4b8a51c
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Aug  9 17:10:49 2012 UTC

Fixed incorrect sizeof in LinkReceiver::ReadRegion.

The type of BRegion::fCount is long, and ServerLink sends/receives it
with sizeof(long), but LinkReceiver was using sizeof(int32). Due to
long being 64 bit this was resulting in a mismatch. This fixes the
drawing problems on x86_64.

----------------------------------------------------------------------------

############################################################################

Commit:      e963289800007e623f4a120b27e7bd476230f57f
URL:         http://cgit.haiku-os.org/haiku/commit/?id=e963289
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Aug  9 18:36:52 2012 UTC

Added Tracker and Deskbar to x86_64 build.

----------------------------------------------------------------------------

############################################################################

Commit:      5084d0d451501f3c026d593dc109cbb76d7688fc
URL:         http://cgit.haiku-os.org/haiku/commit/?id=5084d0d
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Aug 10 08:32:54 2012 UTC

Added more things to x86_64 image.

Some preference apps, mount_server and AboutSystem. Removed the check
for x86_64 in the boot script, the normal path through the script will
work now. Also removed a temporary hack to workaround AboutSystem not
being there in build_haiku_image.

----------------------------------------------------------------------------

############################################################################

Commit:      81aad168f87486149f6e4ce8acc43e3e7a5de9e1
URL:         http://cgit.haiku-os.org/haiku/commit/?id=81aad16
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Aug 10 09:34:28 2012 UTC

Fixed type mismatch in picture data.

The size of an operation block was written as size_t by PictureDataWriter
but read as int32 by PicturePlayer. Fixes an app_server crash.

----------------------------------------------------------------------------

############################################################################

Commit:      2b861dd2a5a8129154c0c3003d816d2912890c27
URL:         http://cgit.haiku-os.org/haiku/commit/?id=2b861dd
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Aug 10 10:35:24 2012 UTC

Added translator add-ons.

----------------------------------------------------------------------------

############################################################################

Commit:      6d796a84bd484ccc4fb072a29c663b660180ae51
URL:         http://cgit.haiku-os.org/haiku/commit/?id=6d796a8
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Aug 10 13:30:54 2012 UTC

Fixed up network stack and drivers for x86_64.

* Various compilation fixes.
* Fixes to the FreeBSD compatibility layer (from comparing the x86-
  specific bits with the equivalent amd64 sources in FreeBSD).
* Compile all the Ethernet drivers except for sis900 and wb840, these
  require a bit more work to fix (will file a ticket soon). Tested
  ipro1000 and rtl81xx, no issues.

----------------------------------------------------------------------------

############################################################################

Commit:      ac4525b2a5a2f3fa3805efaf0c61f88fe1ff1e30
URL:         http://cgit.haiku-os.org/haiku/commit/?id=ac4525b
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Aug 10 15:22:51 2012 UTC

Changed BRegion to use int32 instead of long.

There is no need for fCount and fDataSize to be long, not going to have
more than 2^32 rectangles in a region. Thanks Axel for pointing that
out.

----------------------------------------------------------------------------

############################################################################

Commit:      8098ef47db1f499e149cd5757798687267813cc2
URL:         http://cgit.haiku-os.org/haiku/commit/?id=8098ef4
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Aug 10 15:55:53 2012 UTC

Added Network preferences.

----------------------------------------------------------------------------

############################################################################

Commit:      d384cac4439511a49ec1b0b0c673bbcb324e6fdb
URL:         http://cgit.haiku-os.org/haiku/commit/?id=d384cac
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Aug 11 08:17:15 2012 UTC

Support ELF64 in set_haiku_revision.

----------------------------------------------------------------------------

############################################################################

Commit:      e1c748e4c0509ffcc986faf39579c9c06179a1a6
URL:         http://cgit.haiku-os.org/haiku/commit/?id=e1c748e
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Aug 11 12:23:22 2012 UTC

Revert "Fixed type mismatch in picture data."

This reverts commit 81aad168f87486149f6e4ce8acc43e3e7a5de9e1.

----------------------------------------------------------------------------

############################################################################

Commit:      efffcb292feee3c2db4814d7e414910fe91876d9
URL:         http://cgit.haiku-os.org/haiku/commit/?id=efffcb2
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Aug 11 12:26:59 2012 UTC

Better fix for picture data type mismatch.

Should use a fixed-size type (int32) rather than a platform-dependent
one.

----------------------------------------------------------------------------

############################################################################

Commit:      b067b2878bc1f74c9f0d2f60b3d702830e61e8b2
URL:         http://cgit.haiku-os.org/haiku/commit/?id=b067b28
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Tue Aug 14 10:08:21 2012 UTC

Fix expr from coreutils on x86_64.

The coreutils sources get built against the regex.h included with
coreutils, but linked against the regex implementation in libroot. Some
of the types used by coreutils' regex implementation differ from those
in libroot's on 64-bit platforms meaning they are incompatible. Fixed by
building coreutils' own regex implementation rather than linking to
libroot's (GCC 2 still uses libroot though, coreutils' implementation
doesn't build with GCC 2).

----------------------------------------------------------------------------

############################################################################

Commit:      a53cfbf4911ef182672f5a37779a047cfa971221
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a53cfbf
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Tue Aug 14 15:03:33 2012 UTC

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).

----------------------------------------------------------------------------

############################################################################

Commit:      4efc3430a040f033cdda576d1b32a762252afc24
URL:         http://cgit.haiku-os.org/haiku/commit/?id=4efc343
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Tue Aug 14 16:46:09 2012 UTC

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.

----------------------------------------------------------------------------

############################################################################

Commit:      91899cd48db3b6f176e38a4bdac02b9a074948ac
URL:         http://cgit.haiku-os.org/haiku/commit/?id=91899cd
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Tue Aug 14 19:08:42 2012 UTC

Fix from glibc for possible crash when printf()'ing a long double.

----------------------------------------------------------------------------

############################################################################

Commit:      294818c5fdcfba4246c738f97bbe30bcf43fb9d2
URL:         http://cgit.haiku-os.org/haiku/commit/?id=294818c
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Wed Aug 15 14:40:32 2012 UTC

More x86_64 printf() fixes from glibc.

----------------------------------------------------------------------------

############################################################################

Commit:      c864ba1a2d8525aeabd6199c01675f70f5abd7bd
URL:         http://cgit.haiku-os.org/haiku/commit/?id=c864ba1
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Aug 16 12:47:49 2012 UTC

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.

----------------------------------------------------------------------------

############################################################################

Commit:      1eaa9e63cd2d8ce8ed11974e0314860bdd4eb621
URL:         http://cgit.haiku-os.org/haiku/commit/?id=1eaa9e6
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Aug 16 13:23:43 2012 UTC

Compilation fix for malloc_debug.

----------------------------------------------------------------------------

############################################################################

Commit:      aaeadfcb02fea79141251cd3a9f872d6f47fc244
URL:         http://cgit.haiku-os.org/haiku/commit/?id=aaeadfc
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Aug 16 16:38:01 2012 UTC

Do a separate libgcc build for the kernel as well.

Turns out that libgcc is needed, for some reason building the kernel
with -O0 does not end up referencing libgcc but -O2 does. A separate
build of it is done with -mno-red-zone, same reason as for libsupc++.
Ended up being easy to rebuild with different CFLAGS: previously I'd
tried doing `CFLAGS="-mno-red-zone" make` in the libgcc dir which
didn't override, the correct way is `make CFLAGS="-mno-red-zone"`

----------------------------------------------------------------------------

############################################################################

Commit:      602d9c96a5d92957e248f164ea47b365dfd32f91
URL:         http://cgit.haiku-os.org/haiku/commit/?id=602d9c9
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Aug 16 19:32:29 2012 UTC

Added some of the development optional packages.

This adds some of the development packages for x86_64. All of the
DevelopmentBase packages (gcc, make, jam, bison, flex, m4, mkdepend)
have been built and uploaded.

----------------------------------------------------------------------------

############################################################################

Commit:      e688bf23d48bfd1216a0cacbdbda5e35a1bcd779
URL:         http://cgit.haiku-os.org/haiku/commit/?id=e688bf2
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Aug 16 20:11:15 2012 UTC

Merge branch 'master' into x86_64

Conflicts:
        src/servers/app/ServerWindow.cpp

----------------------------------------------------------------------------

############################################################################

Commit:      55e16d9d4346c1447bea54f1f6d0d1c3b7adb2e2
URL:         http://cgit.haiku-os.org/haiku/commit/?id=55e16d9
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Aug 16 20:24:48 2012 UTC

Added OHCI to image (thanks mmlr), RTF-Translator -> RTFTranslator.

----------------------------------------------------------------------------

############################################################################

Commit:      3bf3aa2e2c4bc87076138e320877475397655853
URL:         http://cgit.haiku-os.org/haiku/commit/?id=3bf3aa2
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Aug 17 12:03:31 2012 UTC

Added the rest of the basic development packages.

Added autoconf, automake, libtool, texinfo, perl, gettext and nano.
Building an image with the nightly targets should give you an image
with these included.

----------------------------------------------------------------------------

############################################################################

Commit:      e993391e9c40a536550d8b3740d7ad2b743876e5
URL:         http://cgit.haiku-os.org/haiku/commit/?id=e993391
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Aug 17 12:37:05 2012 UTC

Fixed crypt() for 64-bit systems.

----------------------------------------------------------------------------

############################################################################

Commit:      9f629ef38e6655e1509dca6db587a2035243ccdb
URL:         http://cgit.haiku-os.org/haiku/commit/?id=9f629ef
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Aug 17 14:16:25 2012 UTC

Rename KERNEL_LOAD_BASE_64BIT to KERNEL_LOAD_BASE_64_BIT for consistency.

----------------------------------------------------------------------------

############################################################################

Commit:      173342c0ab918a72a12540ee1de8213720a2d3f5
URL:         http://cgit.haiku-os.org/haiku/commit/?id=173342c
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Aug 17 14:34:11 2012 UTC

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).

----------------------------------------------------------------------------

############################################################################

Commit:      7e5b39b67273ea3a49be51d0af33369f7f1284e4
URL:         http://cgit.haiku-os.org/haiku/commit/?id=7e5b39b
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Aug 18 09:27:52 2012 UTC

Fix printf format warnings that were missed earlier (CIDs 715645-715657).

----------------------------------------------------------------------------

############################################################################

Commit:      816aded4c161cb68946562c79e05c5a7eb145268
URL:         http://cgit.haiku-os.org/haiku/commit/?id=816aded
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Aug 18 09:36:00 2012 UTC

Added Installer and DriveSetup to image.

----------------------------------------------------------------------------

############################################################################

Commit:      79a1c3c6b8fca564bb1770832d8de15921d3e0f3
URL:         http://cgit.haiku-os.org/haiku/commit/?id=79a1c3c
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Aug 18 09:50:11 2012 UTC

Another missed printf string (CID 715659).

----------------------------------------------------------------------------

############################################################################

Commit:      660e7dd1c41a037fd51fa068be7091cdcb44a06e
URL:         http://cgit.haiku-os.org/haiku/commit/?id=660e7dd
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Aug 18 10:28:59 2012 UTC

CID 714542: Unintentional sign extension to 64 bits.

Fixed by changing type of val from u_long to u_int32_t. val only gets
passed to htonl which takes a uint32_t, so no need for it to be u_long.

----------------------------------------------------------------------------

############################################################################

Commit:      be2f57f0de2a6855db62bb713ef0a49edcc3f8d4
URL:         http://cgit.haiku-os.org/haiku/commit/?id=be2f57f
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Aug 18 10:47:03 2012 UTC

64-bit fixes for wb840 network driver.

----------------------------------------------------------------------------

############################################################################

Commit:      3c230971db0acee6542626751993e8c2de52d802
URL:         http://cgit.haiku-os.org/haiku/commit/?id=3c23097
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Aug 18 10:51:17 2012 UTC

64-bit fixes for sis900 network driver.

----------------------------------------------------------------------------

############################################################################

Commit:      6314232f4525b70a69d931c16817bbb61ce6bf0f
URL:         http://cgit.haiku-os.org/haiku/commit/?id=6314232
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Aug 18 11:12:36 2012 UTC

Added VirtualMemory preferences to image.

----------------------------------------------------------------------------

############################################################################

Commit:      f3780ae8b2dcd5ae3b30bb9c4ffc36cbac58f3fe
URL:         http://cgit.haiku-os.org/haiku/commit/?id=f3780ae
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Aug 18 11:24:09 2012 UTC

CID 715700, 715701: Fixed assumption of 4 byte pointer size.

----------------------------------------------------------------------------

############################################################################

Commit:      3ab9de3b68e5845cc4225f943e4fb93a7a8d98b3
URL:         http://cgit.haiku-os.org/haiku/commit/?id=3ab9de3
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Aug 18 12:39:37 2012 UTC

CID 714425: Operands don't affect result.

Result of a call to strtoul was stored in a uint32, then checked
against ULONG_MAX for error. If long is 64 bits, the error check
will never be true.

----------------------------------------------------------------------------

############################################################################

Commit:      d339b8398c3871f8c923979a4f5ae1c534d61a07
URL:         http://cgit.haiku-os.org/haiku/commit/?id=d339b83
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Aug 18 12:52:10 2012 UTC

Ticket:      https://dev.haiku-os.org/ticket/3747

CID 712424: Unintended sign extension.

Fix taken from glibc, glibc bug #3747.

----------------------------------------------------------------------------

############################################################################

Commit:      f16cf073d5b83dfcfe7f47b31943eab3db4284f1
URL:         http://cgit.haiku-os.org/haiku/commit/?id=f16cf07
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Aug 18 12:58:21 2012 UTC

CID 714526: Operands don't affect result.

Incorrect check of in_addr_t (uint32_t) against (unsigned long)-1
would never be true.

----------------------------------------------------------------------------

############################################################################

Commit:      423d8dfed30eaaf5ae2563c1b9cbf7237805fe03
URL:         http://cgit.haiku-os.org/haiku/commit/?id=423d8df
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Aug 18 13:02:58 2012 UTC

CID 714424: Operands don't affect result.

Storing size_t result of std::string::find_first_of in a uint32 then
checking against std::string::npos would never be true.

----------------------------------------------------------------------------

############################################################################

Commit:      dcd705cdedbf171ff19380417756ec42f7f6789f
URL:         http://cgit.haiku-os.org/haiku/commit/?id=dcd705c
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Aug 18 13:06:11 2012 UTC

CID 715610: Operands don't affect result.

Comparing a uint32 against ~0UL would always be false on 64-bit.

----------------------------------------------------------------------------

############################################################################

Commit:      d2a1be1c4e4a8ae3879d7f59b07a6924c62b4b14
URL:         http://cgit.haiku-os.org/haiku/commit/?id=d2a1be1
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Aug 18 16:32:59 2012 UTC

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.

----------------------------------------------------------------------------

############################################################################

Commit:      aecb9567e3f3bc996cb9ed60fab038e1de07c7f1
URL:         http://cgit.haiku-os.org/haiku/commit/?id=aecb956
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Aug 18 18:07:25 2012 UTC

Rebuilt flex package for x86_64.

The original package was cross-compiled to Haiku, turns out flex's
build system uses paths to stuff from the host system, so the package
was broken. Rebuilt from Haiku.

----------------------------------------------------------------------------

############################################################################

Commit:      4591ebc99ad545bab672417533b706d7104a9fac
URL:         http://cgit.haiku-os.org/haiku/commit/?id=4591ebc
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Aug 18 18:48:55 2012 UTC

Fixes for building Haiku x86_64 from itself.

----------------------------------------------------------------------------

############################################################################

Commit:      c3fa08a6c95c40d4e8385ba97ff58ab9da29e387
URL:         http://cgit.haiku-os.org/haiku/commit/?id=c3fa08a
Author:      Rene Gollent <anevilyak@xxxxxxxxx>
Date:        Tue Aug 21 22:52:39 2012 UTC
Committer:   Alex Smith <alex@xxxxxxxxxxxxxxxx>
Commit-Date: Tue Aug 28 09:11:53 2012 UTC

64-bit fixes for ProcessController.

----------------------------------------------------------------------------

############################################################################

Commit:      cdf25540df17e3fbb706d1c98c447689e8be4fe4
URL:         http://cgit.haiku-os.org/haiku/commit/?id=cdf2554
Author:      Rene Gollent <anevilyak@xxxxxxxxx>
Date:        Tue Aug 21 22:53:01 2012 UTC
Committer:   Alex Smith <alex@xxxxxxxxxxxxxxxx>
Commit-Date: Tue Aug 28 09:11:53 2012 UTC

64-bit fixes for StyledEdit.

----------------------------------------------------------------------------

############################################################################

Commit:      ceb29f6dac081684d42df562da43bd586c632e98
URL:         http://cgit.haiku-os.org/haiku/commit/?id=ceb29f6
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Thu Aug 30 15:19:06 2012 UTC

Add ProcessController, NetworkStatus and StyledEdit to image.

----------------------------------------------------------------------------

############################################################################

Commit:      c88f4908d84a819a170fae820c8e5bc230cddd20
URL:         http://cgit.haiku-os.org/haiku/commit/?id=c88f490
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Sep  8 08:33:13 2012 UTC

Ticket:      https://dev.haiku-os.org/ticket/8943

Added missing AHCI driver in FloppyBootImage, should fix #8943.

----------------------------------------------------------------------------

############################################################################

Commit:      11c9f9a1d649c006f9066ae9436372ab75728c4b
URL:         http://cgit.haiku-os.org/haiku/commit/?id=11c9f9a
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Nov 18 14:02:07 2012 UTC

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

----------------------------------------------------------------------------

############################################################################

Commit:      2913b1dbd264f80e37d485f0dc40f5dcf63c14b2
URL:         http://cgit.haiku-os.org/haiku/commit/?id=2913b1d
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Nov 18 15:48:47 2012 UTC

Compilation fixes for x86_64.

----------------------------------------------------------------------------

############################################################################

Commit:      5ccc0cb22416ee8df39961033f1b0d1fcff72fc6
URL:         http://cgit.haiku-os.org/haiku/commit/?id=5ccc0cb
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Nov 18 16:42:27 2012 UTC

Merge branch 'master' into x86_64

----------------------------------------------------------------------------

############################################################################

Commit:      5f4df83cbdc3be3a9e3a3cc5831478877bc1186a
URL:         http://cgit.haiku-os.org/haiku/commit/?id=5f4df83
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Nov 18 19:09:35 2012 UTC

Fixed ARM build.

----------------------------------------------------------------------------

############################################################################

Commit:      5196d5dad04ed2d7244ae432f65a39a959216f10
URL:         http://cgit.haiku-os.org/haiku/commit/?id=5196d5d
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Nov 18 19:18:00 2012 UTC

Merge branch 'master' into x86_64

Conflicts:
        build/jam/HaikuImage
        src/add-ons/kernel/generic/Jamfile

----------------------------------------------------------------------------

############################################################################

Revision:    hrev44862
Commit:      30afb18c8f2ac5d063924bc4e6239bf7c1c7d192
URL:         http://cgit.haiku-os.org/haiku/commit/?id=30afb18
Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Nov 18 19:45:44 2012 UTC

Merge branch 'x86_64'

----------------------------------------------------------------------------


Other related posts:

  • » [haiku-commits] haiku: hrev44862 - in src: libs/x86emu bin/gdb/bfd/config-x86_64 system/kernel/arch/x86 . system/libroot/posix/glibc/arch/generic - alex