Commit Graph

6887 Commits

Author SHA1 Message Date
Alex Smith
c9f6d2271f x86_64: Implemented exception handling. 2012-06-27 15:18:10 +01:00
Alex Smith
575a67c7a1 Merge branch 'master' into x86_64 2012-06-27 11:28:28 +01:00
Alex Smith
3403f23e81 Moved the common parts of arch_cpu.h between x86 and x86_64 to arch/common_x86/cpu.h. 2012-06-27 11:23:54 +01:00
Alex Smith
e5fc2bfcab 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.
2012-06-26 11:08:21 +01:00
Alex Smith
5a17b2f1b2 Forgot to change driver_settings_file to use FixedWidthPointer. 2012-06-26 10:54:37 +01:00
Philippe Saint-Pierre
36784bbc2c StringForRate(): adjustments
* Make 1000.0f the default base
* Also use sizeof() in MediaPlayer to get the string size rather than hardcode.

Thanks Marcus
2012-06-25 13:43:53 -04:00
Philippe Saint-Pierre
8d87f2b43a StringForRate()
Introduce a function to generate the string representation of a bitrate
(kbps, mbps, gbps, etc..)

* Factor out the code from MediaPlayer InfoWindow
* Allow different bases (/1000 or /1024)
2012-06-25 13:29:22 -04:00
Alex Smith
f69dd487b1 Fixed x86 GCC2 build. 2012-06-25 13:28:28 +01:00
Alex Smith
6f6d78e877 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).
2012-06-25 13:00:50 +01:00
Alex Smith
8846189866 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.
2012-06-24 22:57:48 +01:00
Alex Smith
f6a3444449 Added x86_64 ELF64 relocation functions for the bootloader. All that's left to do now is handle the 64-bit load address properly. 2012-06-24 19:22:33 +01:00
Ryan Leavengood
9f5864ab09 Handle the scroll wheel changing over scrollbars.
* Extract the scrollbar change based on the mouse wheel delta into a protected
  method of BView.
* Call that method from BScrollBar's MessageReceived.

With this change it is now a bit easier to scroll horizontally around the
system by putting the mouse cursor over a horizontal scrollbar and using the
wheel.

Fixes #8631.
2012-06-24 10:50:42 -04:00
Ingo Weinhold
69a8b95491 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.
2012-06-24 15:26:00 +01:00
Michael Lotz
bfc18b1ecd Add missing space before opening brace. 2012-06-24 16:17:32 +02:00
Alex Smith
ccadfaeeb5 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.
2012-06-23 12:05:16 +01:00
Alex Smith
3a2a3367dc Support static_cast on FixedWidthPointer. 2012-06-22 19:55:38 +01:00
Alex Smith
f124497815 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.
2012-06-22 19:24:51 +01:00
Alex Smith
62d36f9833 Removed the addr_t conversion operators from FixedWidthPointer which makes comparison against NULL work properly. 2012-06-22 18:22:11 +01:00
Alex Smith
474aa3b76e Added ELF64 headers, common ELF32 and ELF64 definitions moved to elf_common.h. 2012-06-22 12:54:41 +01:00
Alex Smith
6b87898af5 Code style fixes. 2012-06-22 11:56:55 +01:00
Alex Smith
17e407e945 Proper implementation of arch_kernel.h for x86_64. 2012-06-22 10:53:08 +01:00
Alex Smith
17a3389882 Remove phys_addr_range, just use addr_range for both virtual and physical address ranges (as requested by Ingo). 2012-06-21 19:48:03 +01:00
Alex Smith
d8efc6caf6 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.
2012-06-21 18:02:23 +01:00
Alex Smith
192af9e0af 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.
2012-06-20 14:11:24 +01:00
Alex Smith
93cb9538be 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.
2012-06-20 11:53:47 +01:00
Alex Smith
e114f50ddd Fixed bootloader build under x86_64. 2012-06-19 20:38:53 +01:00
Alex Smith
043c61dde5 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.
2012-06-15 22:50:59 +01:00
Alex Smith
73f27ecd3a 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.
2012-06-15 19:57:21 +01:00
Alex Smith
82b4b37172 Added a TODO in to say that {,u}int64 should be changed to long on x86_64. 2012-06-15 16:09:25 +01:00
Alex Smith
11d3892d28 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.
2012-06-14 13:06:55 +01:00
Alex Smith
f76bc433e1 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.
2012-06-13 17:45:22 +01:00
Alex Smith
23d878482e 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.
2012-06-13 17:00:57 +01:00
Alex Smith
2f3e39bebf Fixed copyright date on arch_config.h. 2012-06-11 12:09:36 +01:00
Alex Smith
07b33113a3 Merge branch 'master' into x86_64 2012-06-11 12:01:35 +01:00
Alexander von Gluck IV
372863638f scsi: Add write same SCSI operation
* Will be used for TRIM
2012-06-10 18:47:12 -07:00
Alexander von Gluck IV
548b1a4988 cpuid: Rework AMD CPUID numbers
* If family is 0xF, we grab extended family and model
  like Intel does
* Idenfify AMD cpu's more correctly
2012-06-04 11:01:39 -05:00
François Revol
b837149e73 Sam460ex: Add cpu type and model defines to board_config.h
* we need this in arch_cpu.cpp in the bootloader.
2012-06-02 01:25:53 +02:00
Alexander von Gluck IV
0e8316cc90 intel_810: Style cleanup. No functional change
* I think the FunctionNames need to change to function_name
2012-05-30 16:11:09 -05:00
Gerald Zajac
e0ee3b7971 driver: New intel 810 video driver
* Introduced by Gerald Zajac in #8615
* Will need reviewed, tested, and some style cleanup
* Not in images until steps above complete
2012-05-30 15:21:18 -05:00
François Revol
9c02217342 PPC: Add PVR identifiers for 440 and 460 cpus
* from QEMU, 440EP is 0x4222.
* from the datasheet, 460EX is 0x1302.
2012-05-29 18:50:32 +02:00
Alex Smith
65ad1ba320 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.
2012-05-26 21:47:27 +01:00
Alexander von Gluck IV
361ec26f10 rPi MMU: Cleanup, add gPeripheralBase
* gPeripheralBase keeps track of the device
  peripherals before and after mmu_init
* Add ability to disable mmu for troubleshooting
* Remove static FB_BASE, we actually don't know
  where the FB is yet. (depends on firmware used)
2012-05-24 06:39:43 -05:00
Alexander von Gluck IV
f0ba7f9400 MMU: Clean up arm L1 MMU types
* Include map for each page table type
* Reduce MMU_TYPE define name length
2012-05-22 08:30:52 -05:00
Alexander von Gluck IV
9c5e60f656 rPi MMU: Fixes to hrev44189
* I had the wrong addresses, 0x20 was the physical
  address not a mapped one.
* Attempt to map uart in mmu post mmu_init.
2012-05-22 08:30:52 -05:00
Alexander von Gluck IV
b8733e36c7 rPi MMU: Working towards mapped memory
* BCM2708 defines no longer assume 0x20 address
  We will be throwing away the blob memory mapping
  and using our own.
* Use existing blob mapping to turn GPIO led on pre mmu_init
* Remap MMU hardware addresses from 0x7E. We could map each device,
  however the kernel will throw away the mappings again anyway. For
  now we just map the whole range and use offsets.
* Serial uart no longer works, however at least
  we know why now :). Serial driver now needs to
  use mapped address.
2012-05-18 10:16:30 -05:00
Alexander von Gluck IV
77591e9657 rPi: MMU Work
* Use U-Boot mmu code as base
* This will be factored out someday into common arch mmu
  code when we can read Flattened Device Trees
* Move mmu_init after serial_init.
  Temporary change as we will want serial_init to use
  memory mapped addresses... for debugging.
2012-05-18 06:36:53 -05:00
Alexander von Gluck IV
1f675a7fcb uart: Fix arm kernel build
* Make kernel use mmu_man's new UART code
* Remove no longer used uart.cpp / uart.h
2012-05-17 05:32:29 -05:00
François Revol
693b3532c7 Sam460ex: Add a Linux-type kernel entry point
* the onboard U-Booot and 2nd-stage loader only know a few OS types,
we'll try faking Linux there.
2012-05-17 17:36:19 +02:00
Alexander von Gluck IV
eb93f2661d uart: Style Cleanup, no functional change 2012-05-17 03:31:02 -05:00
Alexander von Gluck IV
182643f763 uart: Remove due to mmu's new (better) UART code 2012-05-17 03:15:56 -05:00