Changeset a4bd537 in mainline for tools/ew.py


Ignore:
Timestamp:
2019-04-06T13:39:58Z (5 years ago)
Author:
Petr Pavlu <setup@…>
Children:
f7842ef
Parents:
0d073b8
git-author:
Petr Pavlu <setup@…> (2019-03-31 14:09:57)
git-committer:
Petr Pavlu <setup@…> (2019-04-06 13:39:58)
Message:

arm64: Add support for the architecture

This changeset adds basic support to run HelenOS on AArch64, targeting
the QEMU virt platform.

Boot:

  • Boot relies on the EDK II firmware, GRUB2 for EFI and the HelenOS bootloader (UEFI application). EDK II loads GRUB2 from a CD, GRUB2 loads the HelenOS bootloader (via UEFI) which loads OS components.
  • UEFI applications use the PE/COFF format and must be relocatable. The first problem is solved by manually having the PE/COFF headers and tables written in assembler. The relocatable requirement is addressed by compiling the code with -fpic and having the bootloader relocate itself at its startup.

Kernel:

  • Kernel code for AArch64 consists mostly of stubbing out various architecture-specific hooks: virtual memory management, interrupt and exception handling, context switching (including FPU lazy switching), support for virtual timer, atomic sequences and barriers, cache and TLB maintenance, thread and process initialization.
  • The patch adds a kernel driver for GICv2 (interrupt controller).
  • The PL011 kernel driver is extended to allow userspace to take ownership of the console.
  • The current code is not able to dynamically obtain information about available devices on the underlying machine. The port instead implements a machine-func interface similar to the one implemented by arm32. It defines a machine for the QEMU AArch64 virt platform. The configuration (device addresses and IRQ numbers) is then baked into the machine definition.

User space:

  • Uspace code for AArch64 similarly mostly implements architecture-specific hooks: context saving/restoring, syscall support, TLS support.

The patchset allows to boot the system but user interaction with the OS
is not yet possible.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/ew.py

    r0d073b8 ra4bd537  
    9494        elif platform == 'arm32':
    9595                return 'system-arm', '-M integratorcp'
     96        elif platform == 'arm64':
     97                # Check that ROM image is present. Provide the user with
     98                # appropriate steps to fix this problem.
     99                if not os.path.exists('QEMU_EFI_ARM64.fd'):
     100                        sys.stderr.write('Could not find ' +
     101                            '\'QEMU_EFI_ARM64.fd\' which is expected to ' +
     102                            'contain EDK2 firmware image.\n')
     103                        sys.stderr.write('Pre-built image can be obtained by ' +
     104                            'running the following command:\n')
     105                        sys.stderr.write('$ wget http://snapshots.linaro.org/' +
     106                            'components/kernel/leg-virt-tianocore-edk2-' +
     107                            'upstream/latest/QEMU-AARCH64/RELEASE_GCC49/' +
     108                            'QEMU_EFI.fd -O QEMU_EFI_ARM64.fd\n')
     109                        raise Exception
     110                return 'system-aarch64', \
     111                    '-M virt -cpu cortex-a57 -m 1024 -bios QEMU_EFI_ARM64.fd'
    96112        elif platform == 'ia32':
    97113                return 'system-i386', pc_options(32)
     
    208224                cmdline += ' ' + options
    209225
    210         cmdline += qemu_bd_options()
    211 
     226        if (not 'hdd' in cfg.keys() or cfg['hdd']):
     227                cmdline += qemu_bd_options()
    212228        if (not 'net' in cfg.keys()) or cfg['net']:
    213229                cmdline += qemu_net_options()
     
    234250        if cfg['image'] == 'image.iso':
    235251                cmdline += ' -boot d -cdrom image.iso'
     252        elif cfg['image'] == 'image.iso@arm64':
     253                # Define image.iso cdrom backend.
     254                cmdline += ' -drive if=none,file=image.iso,id=cdrom,media=cdrom'
     255                # Define scsi bus.
     256                cmdline += ' -device virtio-scsi-device'
     257                # Define cdrom frontend connected to this scsi bus.
     258                cmdline += ' -device scsi-cd,drive=cdrom'
    236259        elif cfg['image'] == 'image.boot':
    237260                cmdline += ' -kernel image.boot'
     
    276299                        'xhci' : False,
    277300                        'tablet' : False
     301                }
     302        },
     303        'arm64' : {
     304                'virt' : {
     305                        'run' : qemu_run,
     306                        'image' : 'image.iso@arm64',
     307                        'audio' : False,
     308                        'console' : True,
     309                        'hdd' : False,
     310                        'net' : False,
     311                        'tablet' : False,
     312                        'usb' : False,
     313                        'xhci' : False
    278314                }
    279315        },
Note: See TracChangeset for help on using the changeset viewer.