SlideServe
Menu
Préférences
© SlideServe · v2026

Launching Procedure in 64-Bit Code Relocation Environment

beverlymartinez avatar
14 diapositives · 201 Views · Jan 05, 2020

Explore how to execute a procedure in 64-bit mode residing at a high virtual address space. Learn about canonical and non-canonical addresses, page mapping, and how to handle relocations using linker scripts.

Launching Procedure in 64-Bit Code Relocation Environment - slide 1
01 / 14Launching Procedure in 64-Bit Code Relocation Environment
1 / 17

Télécharger la présentation

Launching Procedure in 64-Bit Code Relocation Environment
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. On 64-bit ‘code-relocation’ How we can launch a procedure in 64-bit mode that resides in a page-frame at a high address

  2. 64-bit virtual address-space 0xFFFFFFFFFFFFFFFF Invalid address range valid addresses negative canonical addresses (128 TeraBytes) 0xFFFF800000000000 Total number of locations having ‘canonical’ 64-bit addresses is 248 Bytes (= 256 TeraBytes) ‘non-canonical’ 64-bit addresses 0x00007FFFFFFFFFFF valid addresses positive canonical addresses (128 TeraBytes) 0x0000000000000000

  3. The ‘canonical’ addresses • In a 64-bit ‘canonical’ virtual address, the uppermost 16-bits are identical to bit 47 • The number of distinct virtual addresses actually implemented is 248 (= 256 TB) 64-bits sign-extension 48-bits

  4. Our ‘highcode.s’ demo • We have created a demo-program which loads and executes a procedure that will reside at a very high location within the processor’s 64-bit virtual address space • Some aspects of our design were shaped by limitations of our GNU software tools, and by our desire to keep the addressing ‘page-map’ tables as simple as possible

  5. Two components Non- canonical addresses highdraw.b 0xFFFFFFFFC0000000 highcode.b 0x0000000000010000 virtual address space

  6. Subfields of 64-bit address 1111111111111111 111111111 111111111 000000000 000000000 000000000000 index into page-directory pointer table (9-bits) sign-extension (16-bits) index into page-table (9-bits) index into the page-map level4 table (9-bits) offset into page frame (12-bits) index into page-directory (9-bits)

  7. 4-level page-mapping tables page directory pointer tables page-map level4 table page directories page tables page frames CR3

  8. Disk-partition’s layout /dev/sda4 0 1 127 128 254 255 … unused The ‘highdraw.b’ program-component goes here The ‘highcode.b’ program-component goes here Our ‘cs686ipl.b’ boot-loader goes here (in ‘boot-sector’ of this disk-partition)

  9. ‘ld’ handles 32-bit relocations • We use a special linker-script to ‘relocate’ symbolic addresses used in ‘highdraw.s’ OUTPUT_FORMAT(binary); SECTIONS { . = 0xFFFFFFFFC0000000; .text : { *(.text) } =0x90909090 .data : { *(.data) } = 0x00000000 .bss : { *(.bss) } = 0x00000000 }

  10. assembly commands • Assemble the ‘highcode.s’ component: $ as highcode.s –o highcode.o • Assemble the ‘highdraw.s’ component: $ as highdraw.s -o highdraw.o

  11. Linker commands • Link the ‘highcode.o’ component: $ ld highcode.o -T ldscript -o highcode.b • Assemble the ‘highdraw.s’ component: $ ld highdraw.o -T hiscript -o highdraw.b

  12. Installation commands • Install the ‘highcode.b’ component: $ dd if=highcode.b of=/dev/sda4 seek=1 • Assemble the ‘highdraw.s’ component: $ dd if=highdraw.b of=/dev/sda4 seek=128

  13. Addition to ‘cs686ipl.s’ • We made a small but useful enhancement to our ‘cs686ipl.s’ boot-loader program, so subsequent program components will not need to repeat the search for the starting Logical Block Address of the disk-partition • That block-number is left in register EBX, where the next component can find it • It’s also written to the ROM-BIOS ‘mailbox’

  14. In-class exercise • After you have successfully downloaded, assembled, linked, installed, and executed the ‘highcode.s’ demo-program, see if you can modify it so that its ‘highdraw’ code- component will reside at an even higher virtual address, namely: 0xFFFFFFFFFFE00000 instead of: 0xFFFFFFFFC0000000