Commit Graph
100 Commits
Author SHA1 Message Date
Alex Smith a3802ca967 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.
2012-08-07 20:24:55 +01:00
Alex Smith a731ad19e6 ELF64 and x86_64 support in the debug kit. 2012-08-07 20:22:36 +01:00
Alex Smith 8a1903353e Implemented user debugging support for x86_64.
Reused x86 arch_user_debugger.cpp, with a few minor changes to make
the code work for both 32 and 64 bit. Something isn't quite working
right, if a breakpoint is hit the kernel will hang. Other than that
everything appears to work correctly.
2012-08-07 20:20:42 +01:00
Alex Smith 2b883e1977 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.
2012-08-06 17:25:51 +01:00
Alex Smith c802257bbb Merge branch 'master' into x86_64 2012-08-06 12:34:03 +01:00
Alex Smith 2997a19125 Fixed UHCI for x86_64. 2012-08-06 12:29:12 +01:00
Alex Smith abfb41a2ab Added USB modules to image. 2012-08-06 09:47:12 +01:00
Alex Smith cc30eec43d System call restart support. 2012-08-05 14:20:37 +01:00
Alex Smith e1be7d07d6 Fixed a 64-bit calculation error. 2012-08-05 12:59:46 +01:00
Alex Smith 284d75bd6a Merge branch 'master' into x86_64 2012-08-05 10:33:20 +01:00
Alex Smith adf8818ec0 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.
2012-08-05 10:24:22 +01:00
Alex Smith e5363c936a Style fix. 2012-08-05 10:16:11 +01:00
Alex Smith 3fed1a15f5 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.
2012-08-05 08:46:30 +01:00
Alex Smith f429464535 User symbol lookup works now on x86_64. 2012-08-05 08:12:39 +01:00
Alex Smith 049d149cf7 Handle 64-bit types correctly. 2012-08-04 18:58:26 +01:00
Alex Smith 57ab0395ad 64-bit fixes for input_server. 2012-08-04 16:10:00 +01:00
Alex Smith 25871c6895 Removed Thread::fault_callback, no longer necessary now that vm86 is gone. 2012-08-04 11:02:54 +01:00
Alex Smith 70ee5a7efb Moved x86emu to {src,headers}/libs/. 2012-08-04 10:21:22 +01:00
Alex Smith 92f09f1aeb Added AHCI driver to image. 2012-08-04 10:14:22 +01:00
Alex Smith 54393c0379 Merge branch 'master' into x86_64 2012-08-04 09:59:17 +01:00
Alex Smith e9e70c0f95 Fixed compilation of remote_disk_server on OS X hosts. 2012-08-03 17:48:02 +01:00
Alex Smith 9bfe064799 GCC 2 compilation fix for x86emu. 2012-08-03 17:12:53 +01:00
Alex Smith 74bda98cb2 Killed off vm86 code, no longer being used. 2012-08-03 16:49:15 +01:00
Alex Smith 9f90e8a964 Updated drivers to use BIOS module instead of vm86. 2012-08-03 16:28:20 +01:00
Alex Smith b28f734b1c Remove line copied from old vm86 code that shouldn't be there. 2012-08-03 16:18:49 +01:00
Alex Smith a9ee7a5132 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.
2012-08-03 15:42:30 +01:00
Alex Smith 50cedfd5b0 Build registrar for x86_64. 2012-08-02 10:45:42 +01:00
Alex Smith d93ed09564 Improved safety for user memory accesses.
* Changed IS_USER_ADDRESS to check an address using USER_BASE and
  USER_SIZE, rather than just !IS_KERNEL_ADDRESS. The old check would
  allow user buffers to point into the physical memory map area.
* Added an unmapped hole at the end of the bottom half of the address
  space which catches buffers that cross into the uncanonical address
  region. This also removes the need to check for uncanonical return
  addresses in the syscall handler, it is no longer possible for the
  return address to be uncanonical under normal circumstances. All
  cases in which the return address might be changed by the kernel
  are still handled via the IRET path.
2012-08-02 09:32:33 +01:00
Alex Smith b77772725c Changed x86_64 toolchain target to x86_64-unknown-haiku. 2012-08-01 11:46:44 +01:00
Alex Smith 9a5503d01c Different uname machine type for x86_64.
* Added B_64_BIT_PC_PLATFORM platform type.
* Return "x86_64" as the machine type for that platform in uname.
2012-08-01 11:13:14 +01:00
Alex Smith 8110732b03 Added some more binaries to the image. 2012-08-01 11:00:35 +01:00
Alex Smith e6b3188fcb Merge branch 'master' into x86_64 2012-08-01 10:44:38 +01:00
Alex Smith f7010474bb Changed resource alignment behaviour for ELF64 binaries.
The current behaviour of aligning to the maximum value of p_align seen
is problematic for x86_64, as the default segment alignment is 2MB.
This causes all x86_64 binaries to be padded to at least 2MB when
resources are added to them. There is no need to align to p_align in
the file itself (it's only an in-memory requirement), therefore
instead just align up to an 8-byte boundary. The current behaviour is
retained for ELF32, so this won't cause any compatibility problems
(there are no existing ELF64 BeOS/Haiku binaries to worry about).
2012-08-01 10:35:34 +01:00
Alex Smith bd97ee39e0 Style fix. 2012-07-31 12:15:26 +01:00
Alex Smith d4ec857af3 Merge branch 'master' into x86_64 2012-07-31 12:10:24 +01:00
Alex Smith caa1e8b742 Fix CID 712419, 712420, 712421, 712422: Unintentional sign extension to 64 bits. 2012-07-31 12:08:45 +01:00
Alex Smith 3cd66dda5e Fix CID 712419, 712420, 712421, 712422: Unintentional sign extension to 64 bits. 2012-07-31 10:12:33 +01:00
Alex Smith 02dd3236d2 Better names for syscall/signal functions copied to the commpage. 2012-07-30 21:56:50 +01:00
Alex Smith 666b46e2e3 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).
2012-07-30 21:42:49 +01:00
Alex Smith a1a38e8aba 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.
2012-07-30 21:38:47 +01:00
Alex Smith 533f3bb494 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.
2012-07-30 21:34:05 +01:00
Alex Smith 9be774b553 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.
2012-07-30 21:27:21 +01:00
Alex Smith ef67788fba Ported ISA bus manager and PS/2 driver. 2012-07-30 14:37:28 +01:00
Alex Smith c0d28c0199 Implemented signals for x86_64. 2012-07-30 13:52:51 +01:00
Alex Smith 5568c5055c Added coreutils to the x86_64 image. 2012-07-30 08:59:19 +01:00
Alex Smith bd16f0dd82 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.
2012-07-30 08:25:16 +01:00
Alex Smith e27109c167 Merge branch 'master' into x86_64 2012-07-30 08:24:31 +01:00
Alex Smith e715eca04c Worked around broken GCC 2 on OS X hosts.
GCC 2 built for OS X 10.7/10.8 was broken, the Haiku build would fail
with some strange errors. Forcing compilation of GCC 2 in 32-bit mode
results in a working GCC.
2012-07-29 21:03:14 +01:00
Alex Smith afde37ff9b 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.
2012-07-29 14:31:11 +01:00
Alex Smith 03add8e7c2 Implemented TLS for x86_64. 2012-07-29 11:39:01 +01:00
Alex Smith 6e2f6d1ace 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.
2012-07-29 09:31:14 +01:00
Alex Smith 12b3e8a8a0 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.
2012-07-28 17:00:52 +01:00
Alex Smith bd8b78e6ee 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.
2012-07-28 16:54:30 +01:00
Alex Smith 0efc5e72dc Merge branch 'master' into x86_64 2012-07-28 16:29:41 +01:00
Alex Smith 0d47dc5dd2 Fixed incorrect variable name in generated BuildConfig. 2012-07-28 16:26:07 +01:00
Alex Smith e453c0f4a7 64-bit printf warning fixes in libroot. 2012-07-28 13:40:09 +01:00
Alex Smith c3b03e5877 64-bit fixes to Hoard. 2012-07-28 13:02:34 +01:00
Alex Smith a3210bbc76 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.
2012-07-28 12:23:47 +01:00
Alex Smith 04c1e6d017 ASM code fixes for PIC compilation. 2012-07-27 18:16:19 +01:00
Alex Smith 3fde53501d Updated x86_64 fenv.h and added fenv.c. 2012-07-27 15:21:41 +01:00
Alex Smith 5f119ed78f Added x86_64 glue code. 2012-07-27 09:22:54 +01:00
Alex Smith e3ac2588e6 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.
2012-07-25 15:05:21 +01:00
Alex Smith ce35b7a68a Fixed broken build for x86. 2012-07-25 15:00:50 +01:00
Alex Smith 6f1f972caf 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.
2012-07-25 08:56:47 +01:00
Alex Smith 370ab57d49 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.
2012-07-23 17:12:12 +01:00
Alex Smith 07c6bd65b8 Format string fixes for TRACE_{THREAD,TEAM}. 2012-07-23 14:20:29 +01:00
Alex Smith fe2e732721 Avoid an unnecessary mov on syscalls with < 4 arguments. 2012-07-23 14:18:54 +01:00
Alex Smith fd9f32c0db Added some libroot bits for x86_64.
Still some parts missing (the glibc bits + fenv.c), plus the TLS
functions are only stubs.
2012-07-22 14:59:42 +01:00
Alex Smith aef19e3c95 Implemented creation and destruction of user translation maps. 2012-07-22 13:07:44 +01:00
Alex Smith 5afce632f3 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.
2012-07-22 12:13:04 +01:00
Alex Smith 700c8d3078 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.
2012-07-22 11:36:50 +01:00
Alex Smith 1c24ebaa5f 64-bit compilation fixes for BFS, add to x86_64 boot image. 2012-07-22 10:42:35 +01:00
Alex Smith 59ae45c1ab 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.
2012-07-21 16:18:10 +01:00
Alex Smith 195a0f350e 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.
2012-07-21 14:33:27 +01:00
Alex Smith 5f6b522746 Merge branch 'master' into x86_64 2012-07-21 14:17:22 +01:00
Alex Smith e6e6f56ccf Include compat/sys/kernel.h rather than "kernel.h".
Using "kernel.h" was pulling in the private kernel.h header instead,
which was causing a build failure on my branch since arch_cpu.h is
C++-only there.
2012-07-21 14:09:08 +01:00
Alex Smith 5234e66d32 Optimized memcpy/memset for x86_64. 2012-07-21 11:55:13 +01:00
Alex Smith 6497f6b1ec Moved the exception handling functions to arch_int.cpp, shared between x86 and x86_64. 2012-07-21 09:11:09 +01:00
Alex Smith 4451c47c64 Compile generic_x86 CPU module for x86_64. 2012-07-21 08:32:07 +01:00
Alex Smith 82694bd124 Merge branch 'master' into x86_64
Conflicts:
	headers/posix/arch/x86_64/arch_setjmp.h
	src/system/kernel/cache/block_cache.cpp
2012-07-20 18:33:46 +01:00
Alex Smith a9fdaec18a 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.
2012-07-20 17:55:26 +01:00
Alex Smith 7f7e76e461 64-bit compilation fixes for write_overlay and intel partitioning system modules. 2012-07-20 17:53:59 +01:00
Alex Smith 0063d2ba51 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.
2012-07-20 17:47:12 +01:00
Alex Smith d7ec2fa3bf A couple of format string fixes for tracing printfs. 2012-07-20 17:37:37 +01:00
Alex Smith 1b41387b5f Added missing packed attributes on disk_identifier. 2012-07-20 17:14:17 +01:00
Alex Smith 12bd7812dd 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.
2012-07-20 12:00:20 +01:00
Alex Smith 9d4e925cf0 Support x86_64 in config_manager. 2012-07-20 11:56:15 +01:00
Alex Smith 2865db34c8 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.
2012-07-20 11:53:46 +01:00
Alex Smith 385d69fc01 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.
2012-07-19 17:53:46 +01:00
Alex Smith 0cbce9aa47 A few 64-bit fixes for ELF/module code. 2012-07-19 12:45:17 +01:00
Alex Smith b2cd72d8f3 Implemented arch_debug_call_with_fault_handler for x86_64. 2012-07-14 09:23:48 +01:00
Alex Smith 368f253347 Merge branch 'master' into x86_64 2012-07-14 08:49:14 +01:00
Alex Smith bcb07a319b 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.
2012-07-13 14:09:09 +01:00
Alex Smith e690e5ab3b Proper fix for GCC 2 compilation error that was fixed earlier, cause pointed out by Ingo. 2012-07-12 17:16:17 +01:00
Alex Smith 8a65fedaaa Merge branch 'master' into x86_64
Conflicts:
	src/system/kernel/arch/x86/arch_debug.cpp
2012-07-12 16:32:12 +01:00
Alex Smith 7dc738b0fb Fixed ordering of registers in arch_debug_gdb_get_registers.
Current code was sending EAX, EBX, ECX, EDX..., GDB (all versions as far
as I can tell) expects EAX, ECX, EDX, EBX... Also added missing FS and GS.
2012-07-12 15:59:50 +01:00
Alex Smith 4ebc6dfa68 Moved some 32-bit specific stuff to the 32 subdirectory. 2012-07-12 14:23:55 +01:00
Alex Smith 6e06fa6f7e Added missing validity check on relocation address. 2012-07-12 14:06:29 +01:00
Alex Smith d38f1301d1 Cleaned up 32-bit descriptors.h. 2012-07-12 13:55:03 +01:00
Alex Smith 5774b5afa4 C++ified remaining C users of arch_cpu.h. 2012-07-12 13:54:18 +01:00