Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

HKG18-505 - QEMU in UEFI

181 vues

Publié le

"Session ID: HKG18-505
Session Name: HKG18-505 - QEMU in UEFI
Speaker: Alexander Graf
Track: LEG


★ Session Summary ★
UEFI is a firmware specification created by Intel with portability in mind. The UEFI way of doing that was to provide special UEFI byte code (EBC). Unfortunately nobody really cared so compiler, firmware support and providers of EBC option roms ceased and basically every UEFI option rom today contains native x86(_64) machine code.

If you now want to plug a PCIe card into your shiny ARM server, that means even though firmware would be compatible it still can't execute the option rom. Until you add QEMU to the mix.

Join me in exploring the depth of UEFI binary interfaces, marshalling between different architecture's function call ABIs on the fly and learn how to integrate all of this into a working firmware, running on real hardware, driving a real PCIe adapter.
---------------------------------------------------
★ Resources ★
Event Page: http://connect.linaro.org/resource/hkg18/hkg18-505/
Presentation: http://connect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-505.pdf
Video: http://connect.linaro.org.s3.amazonaws.com/hkg18/videos/hkg18-505.mp4
---------------------------------------------------
★ Event Details ★
Linaro Connect Hong Kong 2018 (HKG18)
19-23 March 2018
Regal Airport Hotel Hong Kong

---------------------------------------------------
Keyword: LEG
'http://www.linaro.org'
'http://connect.linaro.org'
---------------------------------------------------
Follow us on Social Media
https://www.facebook.com/LinaroOrg
https://www.youtube.com/user/linaroorg?sub_confirmation=1
https://www.linkedin.com/company/1026961"

Publié dans : Technologie
  • Soyez le premier à commenter

  • Soyez le premier à aimer ceci

HKG18-505 - QEMU in UEFI

  1. 1. in QEMU UEFI
  2. 2. About Me • Alexander Graf • KVM and QEMU developer for SUSE • Server class PowerPC KVM port • Nested SVM • Founding member of SUSE ARM team • U-Boot UEFI support
  3. 3. ARM x86
  4. 4. ARM x86
  5. 5. ARM x86 SASA
  6. 6. ARM x86 SASA
  7. 7. ARM x86 SASA X
  8. 8. ARM x86 SASA X x86
  9. 9. ARM x86 x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29 x30 xzr rax rbx rcx rdx rbp rsp rsi rdi r8 r9 r10 r11 r12 r13 r14 r15
  10. 10. ARM x86 x0 x1 rax rbx
  11. 11. ARM x86 x0 x1 rax rbx 48 89 c3 mov %rax,%rbxaa0003e1 mov x1, x0
  12. 12. ARM x86 x0 x1 rax rbx 48 89 c3 mov %rax,%rbxaa0003e1 mov x1, x0
  13. 13. virtual
  14. 14. virtual
  15. 15. Driver Driver Driver Driver
  16. 16. Driver Driver Driver Driver
  17. 17. Driver
  18. 18. Driver
  19. 19. Driver
  20. 20. Driver
  21. 21. Driver gBS->InstallMultipleProtocolInterfaces( )
  22. 22. Driver gBS->InstallMultipleProtocolInterfaces( ) efi_status_t (*supported)(…) efi_status_t (*start)(…) efi_status_t (*stop)(…) u32 version void *image_handle void *driver_handle
  23. 23. Driver
  24. 24. Driver PCI driver
  25. 25. Driver PCI driver
  26. 26. Driver efi_status_t (*supported)(…) efi_status_t (*start)(…) efi_status_t (*stop)(…) u32 version void *image_handle void *driver_handle
  27. 27. Driver efi_status_t (*supported)(…) efi_status_t (*start)(…) efi_status_t (*stop)(…) u32 version void *image_handle void *driver_handle
  28. 28. Driver efi_status_t (*supported)(…) efi_status_t (*start)(…) efi_status_t (*stop)(…) u32 version void *image_handle void *driver_handle
  29. 29. Driver gBS->InstallMultipleProtocolInterfaces( )
  30. 30. Driver gBS->InstallMultipleProtocolInterfaces( ) u64 revision struct block_io_media *m efi_status_t (*reset)(…) efi_status_t (*read)(…) efi_status_t (*write)(…) efi_status_t (*flush)(…)
  31. 31. u64 revision struct block_io_media *m efi_status_t (*reset)(…) efi_status_t (*read)(…) efi_status_t (*write)(…) efi_status_t (*flush)(…)
  32. 32. virtual u64 revision struct block_io_media *m efi_status_t (*reset)(…) efi_status_t (*read)(…) efi_status_t (*write)(…) efi_status_t (*flush)(…)
  33. 33. virtual u64 revision struct block_io_media *m efi_status_t (*reset)(…) efi_status_t (*read)(…) efi_status_t (*write)(…) efi_status_t (*flush)(…) 0x00: 01 00 00 00 00 00 00 00 0x08: f0 ee dd cc bb aa 99 88 0x10: 00 ee dd cc bb aa 99 88 0x18: 00 ed dd cc bb aa 99 88 0x20: 00 ec dd cc bb aa 99 88 0x28: 00 eb dd cc bb aa 99 88
  34. 34. virtual u64 revision struct block_io_media *m efi_status_t (*reset)(…) efi_status_t (*read)(…) efi_status_t (*write)(…) efi_status_t (*flush)(…) ARM x86 0x00: 01 00 00 00 00 00 00 00 0x08: f0 ee dd cc bb aa 99 88 0x10: 00 ee dd cc bb aa 99 88 0x18: 00 ed dd cc bb aa 99 88 0x20: 00 ec dd cc bb aa 99 88 0x28: 00 eb dd cc bb aa 99 88
  35. 35. u32 id efi_status_t (*reset)(…) 0x00: 01 00 00 00 XX XX XX XX 0x08: f0 ee dd cc bb aa 99 88 x86
  36. 36. u32 id efi_status_t (*reset)(…) 0x00: 01 00 00 00 XX XX XX XX 0x08: f0 ee dd cc bb aa 99 88 x86 XX XX XX XX
  37. 37. u32 id efi_status_t (*reset)(…) ARM x86 0x00: 01 00 00 00 XX XX XX XX 0x08: f0 ee dd cc bb aa 99 88
  38. 38. virtual u64 revision struct block_io_media *m efi_status_t (*reset)(…) efi_status_t (*read)(…) efi_status_t (*write)(…) efi_status_t (*flush)(…)
  39. 39. virtual u64 revision struct block_io_media *m efi_status_t (*reset)(…) efi_status_t (*read)(…) efi_status_t (*write)(…) efi_status_t (*flush)(…) ARM x86
  40. 40. efi_status_t (*read)(struct block_io *this, u32 media_id, u64 lba, ulong buffer_size, void*buffer)
  41. 41. efi_status_t (*read)(struct block_io *this, u32 media_id, u64 lba, ulong buffer_size, void*buffer) x0 x1 x2 x3 x4 Stack PC
  42. 42. efi_status_t (*read)(struct block_io *this, u32 media_id, u64 lba, ulong buffer_size, void*buffer) x0 x1 x2 x3 x4 Stack PC
  43. 43. efi_status_t (*read)(struct block_io *this, u32 media_id, u64 lba, ulong buffer_size, void*buffer) x0 x1 x2 x3 x4 PC Stack
  44. 44. efi_status_t (*read)(struct block_io *this, u32 media_id, u64 lba, ulong buffer_size, void*buffer) x0 x1 x2 x3 x4 PC Stack
  45. 45. efi_status_t (*read)(struct block_io *this, u32 media_id, u64 lba, ulong buffer_size, void*buffer) x0 x1 x2 x3 x4 PC Stack x86
  46. 46. NX
  47. 47. NX read, write, execute read, write, execute read, write, execute read, write, execute
  48. 48. NX read, write, execute read, write read, write, execute read, write, execute x86
  49. 49. efi_status_t (*read)(struct block_io *this, u32 media_id, u64 lba, ulong buffer_size, void*buffer) x0 x1 x2 x3 x4 PC Stack x86
  50. 50. efi_status_t (*read)(struct block_io *this, u32 media_id, u64 lba, ulong buffer_size, void*buffer) x0 x1 x2 x3 x4 PC Stack x86
  51. 51. x0 x1 x2 x3 x4 PC Stack virtual RIP x86 rcx rdx r8 r9
  52. 52. x4 Stack virtual RIP x86 rcx rdx r8 r9 x0 x1 x3x2 PC
  53. 53. x4 Stack virtual RIP x86 rcx rdx r8 r9 x0 x1 x3x2 PC Stack
  54. 54. Stack virtual RIP x86 rcx rdx r8 r9 x0 x1 x2 PC Stack x4x3
  55. 55. virtual x86
  56. 56. virtual x86 ARM x86 ARM ARM
  57. 57. virtual x86 ARM x86 ARM ARM
  58. 58. Stack virtual RIPrcx rdx r9 x0 x1 x2 PC Stack x4x3 r8
  59. 59. Stack virtual RIPrcx rdx r9 x0 x1 x2 PC Stack x4x3 r8
  60. 60. function level boundary
  61. 61. Why QEMU
  62. 62. Why QEMU • C • Isolated • LGPL • Supports x86_64
  63. 63. EBC
  64. 64. EBC • Cross-Bitness Bytecode • Invented by Intel • Shipped in Option Roms ~2005 + -
  65. 65. EBC • Cross-Bitness Bytecode • Invented by Intel • Shipped in Option Roms ~2005 + - • Compiler unsupported • Unused by now • MS will not sign • Bugs are the same as emulation • New porting effort
  66. 66. Native vs Emulation
  67. 67. Native vs Emulation • Native preferred • Make existing hardware work
  68. 68. How to Use
  69. 69. How to Use https://github.com/ardbiesheuvel/X86EmulatorPkg.git
  70. 70. How to Use $ git clone https://github.com/ardbiesheuvel/edk2.git $ cd edk2 $ git checkout origin/x86emu $ git submodule add https://github.com/ardbiesheuvel/X86EmulatorPkg.git $ echo " X86EmulatorPkg/X86Emulator.inf" >> ArmVirtPkg/ArmVirtQemu.dsc $ echo " INF X86EmulatorPkg/X86Emulator.inf" >> ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc $ make -C BaseTools $ . edksetup.sh $ export GCC5_AARCH64_PREFIX=... (if you are on a non-aarch64 system) $ build -a AARCH64 -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc -b RELEASE
  71. 71. Demo
  72. 72. Demo e1000 ARM x86
  73. 73. Thank You
  74. 74. Backup • Cache Coherency
  75. 75. OSA Icons Icons received from http://www.opensecurityarchitecture.org/cms/library/icon-library SA Contract SA MENU R
  76. 76. Other Icons http://findicons.com/icon/download/234261/clock/128/png http://findicons.com/icon/439269/button_power https://fosdem.org/2017/schedule/event/grub_new_maintainers/attachments/slides/1768/export/events/attachments/grub_new_maintainers/slides/1768/slides.pdf https://de.wikipedia.org/wiki/BeagleBoard#/media/File:Beagle_Board_big.jpg https://thenounproject.com/term/folder-tree/27307/ https://commons.wikimedia.org/wiki/File:Crystal_Project_Hardware.png http://findicons.com/icon/202613/folder_library
  77. 77. emojione Icons Icons received from http://www.opensecurityarchitecture.org/cms/library/icon-library
  78. 78. External Sources https://commons.wikimedia.org/wiki/File:Raspberry_Pi_B%2B_illustration.svg https://commons.wikimedia.org/wiki/File:Sd-card-1377140.svg http://eu.mophie.com/shop/media/catalog/product/cache/3/small_image/270x330/9df78eab33525d08d6e5fb8d27136e95/u/s/usb-micro3-40-blk_usb-tip-detail_front-back_540px.jpg https://commons.wikimedia.org/wiki/File:Circle-icons-submarine.svg https://commons.wikimedia.org/wiki/File:150-8-DIP.jpg https://commons.wikimedia.org/wiki/File:Hdd_icon.svg https://commons.wikimedia.org/wiki/File:ARM_CPU_icon.svg http://findicons.com/icon/177982/memory#

×