Compare commits
	
		
			1 Commits
		
	
	
		
			v6.0.0-rc2
			...
			release_0_
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					bebe39c387 | 
							
								
								
									
										165
									
								
								.cirrus.yml
									
									
									
									
									
								
							
							
						
						
									
										165
									
								
								.cirrus.yml
									
									
									
									
									
								
							@@ -1,165 +0,0 @@
 | 
			
		||||
env:
 | 
			
		||||
  CIRRUS_CLONE_DEPTH: 1
 | 
			
		||||
 | 
			
		||||
freebsd_12_task:
 | 
			
		||||
  freebsd_instance:
 | 
			
		||||
    image_family: freebsd-12-2
 | 
			
		||||
    cpu: 8
 | 
			
		||||
    memory: 8G
 | 
			
		||||
  install_script:
 | 
			
		||||
    - ASSUME_ALWAYS_YES=yes pkg bootstrap -f ;
 | 
			
		||||
    - pkg install -y bash curl cyrus-sasl git glib gmake gnutls gsed
 | 
			
		||||
          nettle perl5 pixman pkgconf png usbredir ninja
 | 
			
		||||
  script:
 | 
			
		||||
    - mkdir build
 | 
			
		||||
    - cd build
 | 
			
		||||
    # TODO: Enable gnutls again once FreeBSD's libtasn1 got fixed
 | 
			
		||||
    # See: https://gitlab.com/gnutls/libtasn1/-/merge_requests/71
 | 
			
		||||
    - ../configure --enable-werror --disable-gnutls
 | 
			
		||||
      || { cat config.log meson-logs/meson-log.txt; exit 1; }
 | 
			
		||||
    - gmake -j$(sysctl -n hw.ncpu)
 | 
			
		||||
    - gmake -j$(sysctl -n hw.ncpu) check V=1
 | 
			
		||||
 | 
			
		||||
macos_task:
 | 
			
		||||
  osx_instance:
 | 
			
		||||
    image: catalina-base
 | 
			
		||||
  install_script:
 | 
			
		||||
    - brew install pkg-config python gnu-sed glib pixman make sdl2 bash ninja
 | 
			
		||||
  script:
 | 
			
		||||
    - mkdir build
 | 
			
		||||
    - cd build
 | 
			
		||||
    - ../configure --python=/usr/local/bin/python3 --enable-werror
 | 
			
		||||
                   --extra-cflags='-Wno-error=deprecated-declarations'
 | 
			
		||||
                   || { cat config.log meson-logs/meson-log.txt; exit 1; }
 | 
			
		||||
    - gmake -j$(sysctl -n hw.ncpu)
 | 
			
		||||
    - gmake check-unit V=1
 | 
			
		||||
    - gmake check-block V=1
 | 
			
		||||
    - gmake check-qapi-schema V=1
 | 
			
		||||
    - gmake check-softfloat V=1
 | 
			
		||||
    - gmake check-qtest-x86_64 V=1
 | 
			
		||||
 | 
			
		||||
macos_xcode_task:
 | 
			
		||||
  osx_instance:
 | 
			
		||||
    # this is an alias for the latest Xcode
 | 
			
		||||
    image: catalina-xcode
 | 
			
		||||
  install_script:
 | 
			
		||||
    - brew install pkg-config gnu-sed glib pixman make sdl2 bash ninja
 | 
			
		||||
  script:
 | 
			
		||||
    - mkdir build
 | 
			
		||||
    - cd build
 | 
			
		||||
    - ../configure --extra-cflags='-Wno-error=deprecated-declarations' --enable-modules
 | 
			
		||||
                   --enable-werror --cc=clang || { cat config.log meson-logs/meson-log.txt; exit 1; }
 | 
			
		||||
    - gmake -j$(sysctl -n hw.ncpu)
 | 
			
		||||
    - gmake check-unit V=1
 | 
			
		||||
    - gmake check-block V=1
 | 
			
		||||
    - gmake check-qapi-schema V=1
 | 
			
		||||
    - gmake check-softfloat V=1
 | 
			
		||||
    - gmake check-qtest-x86_64 V=1
 | 
			
		||||
 | 
			
		||||
windows_msys2_task:
 | 
			
		||||
  timeout_in: 90m
 | 
			
		||||
  windows_container:
 | 
			
		||||
    image: cirrusci/windowsservercore:2019
 | 
			
		||||
    os_version: 2019
 | 
			
		||||
    cpu: 8
 | 
			
		||||
    memory: 8G
 | 
			
		||||
  env:
 | 
			
		||||
    CIRRUS_SHELL: powershell
 | 
			
		||||
    MSYS: winsymlinks:nativestrict
 | 
			
		||||
    MSYSTEM: MINGW64
 | 
			
		||||
    MSYS2_URL: https://github.com/msys2/msys2-installer/releases/download/2021-01-05/msys2-base-x86_64-20210105.sfx.exe
 | 
			
		||||
    MSYS2_FINGERPRINT: 0
 | 
			
		||||
    MSYS2_PACKAGES: "
 | 
			
		||||
      diffutils git grep make pkg-config sed
 | 
			
		||||
      mingw-w64-x86_64-python
 | 
			
		||||
      mingw-w64-x86_64-python-sphinx
 | 
			
		||||
      mingw-w64-x86_64-toolchain
 | 
			
		||||
      mingw-w64-x86_64-SDL2
 | 
			
		||||
      mingw-w64-x86_64-SDL2_image
 | 
			
		||||
      mingw-w64-x86_64-gtk3
 | 
			
		||||
      mingw-w64-x86_64-glib2
 | 
			
		||||
      mingw-w64-x86_64-ninja
 | 
			
		||||
      mingw-w64-x86_64-jemalloc
 | 
			
		||||
      mingw-w64-x86_64-lzo2
 | 
			
		||||
      mingw-w64-x86_64-zstd
 | 
			
		||||
      mingw-w64-x86_64-libjpeg-turbo
 | 
			
		||||
      mingw-w64-x86_64-pixman
 | 
			
		||||
      mingw-w64-x86_64-libgcrypt
 | 
			
		||||
      mingw-w64-x86_64-libpng
 | 
			
		||||
      mingw-w64-x86_64-libssh
 | 
			
		||||
      mingw-w64-x86_64-libxml2
 | 
			
		||||
      mingw-w64-x86_64-snappy
 | 
			
		||||
      mingw-w64-x86_64-libusb
 | 
			
		||||
      mingw-w64-x86_64-usbredir
 | 
			
		||||
      mingw-w64-x86_64-libtasn1
 | 
			
		||||
      mingw-w64-x86_64-nettle
 | 
			
		||||
      mingw-w64-x86_64-cyrus-sasl
 | 
			
		||||
      mingw-w64-x86_64-curl
 | 
			
		||||
      mingw-w64-x86_64-gnutls
 | 
			
		||||
      mingw-w64-x86_64-libnfs
 | 
			
		||||
    "
 | 
			
		||||
    CHERE_INVOKING: 1
 | 
			
		||||
  msys2_cache:
 | 
			
		||||
    folder: C:\tools\archive
 | 
			
		||||
    reupload_on_changes: false
 | 
			
		||||
    # These env variables are used to generate fingerprint to trigger the cache procedure
 | 
			
		||||
    # If wanna to force re-populate msys2, increase MSYS2_FINGERPRINT
 | 
			
		||||
    fingerprint_script:
 | 
			
		||||
      - |
 | 
			
		||||
        echo $env:CIRRUS_TASK_NAME
 | 
			
		||||
        echo $env:MSYS2_URL
 | 
			
		||||
        echo $env:MSYS2_FINGERPRINT
 | 
			
		||||
        echo $env:MSYS2_PACKAGES
 | 
			
		||||
    populate_script:
 | 
			
		||||
      - |
 | 
			
		||||
        md -Force C:\tools\archive\pkg
 | 
			
		||||
        $start_time = Get-Date
 | 
			
		||||
        bitsadmin /transfer msys_download /dynamic /download /priority FOREGROUND $env:MSYS2_URL C:\tools\archive\base.exe
 | 
			
		||||
        Write-Output "Download time taken: $((Get-Date).Subtract($start_time))"
 | 
			
		||||
        cd C:\tools
 | 
			
		||||
        C:\tools\archive\base.exe -y
 | 
			
		||||
        del -Force C:\tools\archive\base.exe
 | 
			
		||||
        Write-Output "Base install time taken: $((Get-Date).Subtract($start_time))"
 | 
			
		||||
        $start_time = Get-Date
 | 
			
		||||
 | 
			
		||||
        ((Get-Content -path C:\tools\msys64\etc\\post-install\\07-pacman-key.post -Raw) -replace '--refresh-keys', '--version') | Set-Content -Path C:\tools\msys64\etc\\post-install\\07-pacman-key.post
 | 
			
		||||
        C:\tools\msys64\usr\bin\bash.exe -lc "sed -i 's/^CheckSpace/#CheckSpace/g' /etc/pacman.conf"
 | 
			
		||||
        C:\tools\msys64\usr\bin\bash.exe -lc "export"
 | 
			
		||||
        C:\tools\msys64\usr\bin\pacman.exe --noconfirm -Sy
 | 
			
		||||
        echo Y | C:\tools\msys64\usr\bin\pacman.exe --noconfirm -Suu --overwrite=*
 | 
			
		||||
        taskkill /F /FI "MODULES eq msys-2.0.dll"
 | 
			
		||||
        tasklist
 | 
			
		||||
        C:\tools\msys64\usr\bin\bash.exe -lc "mv -f /etc/pacman.conf.pacnew /etc/pacman.conf || true"
 | 
			
		||||
        C:\tools\msys64\usr\bin\bash.exe -lc "pacman --noconfirm -Suu --overwrite=*"
 | 
			
		||||
        Write-Output "Core install time taken: $((Get-Date).Subtract($start_time))"
 | 
			
		||||
        $start_time = Get-Date
 | 
			
		||||
 | 
			
		||||
        C:\tools\msys64\usr\bin\bash.exe -lc "pacman --noconfirm -S --needed $env:MSYS2_PACKAGES"
 | 
			
		||||
        Write-Output "Package install time taken: $((Get-Date).Subtract($start_time))"
 | 
			
		||||
        $start_time = Get-Date
 | 
			
		||||
 | 
			
		||||
        del -Force -ErrorAction SilentlyContinue C:\tools\msys64\etc\mtab
 | 
			
		||||
        del -Force -ErrorAction SilentlyContinue C:\tools\msys64\dev\fd
 | 
			
		||||
        del -Force -ErrorAction SilentlyContinue C:\tools\msys64\dev\stderr
 | 
			
		||||
        del -Force -ErrorAction SilentlyContinue C:\tools\msys64\dev\stdin
 | 
			
		||||
        del -Force -ErrorAction SilentlyContinue C:\tools\msys64\dev\stdout
 | 
			
		||||
        del -Force -Recurse -ErrorAction SilentlyContinue C:\tools\msys64\var\cache\pacman\pkg
 | 
			
		||||
        tar cf C:\tools\archive\msys64.tar -C C:\tools\ msys64
 | 
			
		||||
 | 
			
		||||
        Write-Output "Package archive time taken: $((Get-Date).Subtract($start_time))"
 | 
			
		||||
        del -Force -Recurse -ErrorAction SilentlyContinue c:\tools\msys64 
 | 
			
		||||
  install_script:
 | 
			
		||||
    - |
 | 
			
		||||
      $start_time = Get-Date
 | 
			
		||||
      cd C:\tools
 | 
			
		||||
      ls C:\tools\archive\msys64.tar
 | 
			
		||||
      tar xf C:\tools\archive\msys64.tar
 | 
			
		||||
      Write-Output "Extract msys2 time taken: $((Get-Date).Subtract($start_time))"
 | 
			
		||||
  script:
 | 
			
		||||
    - C:\tools\msys64\usr\bin\bash.exe -lc "mkdir build"
 | 
			
		||||
    - C:\tools\msys64\usr\bin\bash.exe -lc "cd build && ../configure --python=python3"
 | 
			
		||||
    - C:\tools\msys64\usr\bin\bash.exe -lc "cd build && make -j8"
 | 
			
		||||
    - exit $LastExitCode
 | 
			
		||||
  test_script:
 | 
			
		||||
    - C:\tools\msys64\usr\bin\bash.exe -lc "cd build && make V=1 check"
 | 
			
		||||
    - exit $LastExitCode
 | 
			
		||||
							
								
								
									
										29
									
								
								.cvsignore
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								.cvsignore
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,29 @@
 | 
			
		||||
arm-user
 | 
			
		||||
arm-softmmu
 | 
			
		||||
armeb-user
 | 
			
		||||
config-host.*
 | 
			
		||||
dyngen
 | 
			
		||||
i386
 | 
			
		||||
i386-softmmu
 | 
			
		||||
i386-user
 | 
			
		||||
ppc-softmmu
 | 
			
		||||
ppc64-softmmu
 | 
			
		||||
ppc-user
 | 
			
		||||
qemu-doc.html
 | 
			
		||||
qemu-tech.html
 | 
			
		||||
qemu.1
 | 
			
		||||
qemu.pod
 | 
			
		||||
qemu-img.1
 | 
			
		||||
qemu-img.pod
 | 
			
		||||
sparc-user
 | 
			
		||||
qemu-img
 | 
			
		||||
sparc-softmmu
 | 
			
		||||
x86_64-softmmu
 | 
			
		||||
sparc64-user
 | 
			
		||||
sparc64-softmmu
 | 
			
		||||
mips-softmmu
 | 
			
		||||
mipsel-softmmu
 | 
			
		||||
mips-user
 | 
			
		||||
mipsel-user
 | 
			
		||||
sh4-user
 | 
			
		||||
sh4-softmmu
 | 
			
		||||
@@ -1,2 +0,0 @@
 | 
			
		||||
((c-mode . ((c-file-style . "stroustrup")
 | 
			
		||||
	    (indent-tabs-mode . nil))))
 | 
			
		||||
@@ -1,49 +0,0 @@
 | 
			
		||||
# EditorConfig is a file format and collection of text editor plugins
 | 
			
		||||
# for maintaining consistent coding styles between different editors
 | 
			
		||||
# and IDEs. Most popular editors support this either natively or via
 | 
			
		||||
# plugin.
 | 
			
		||||
#
 | 
			
		||||
# Check https://editorconfig.org for details.
 | 
			
		||||
#
 | 
			
		||||
# Emacs: you need https://github.com/10sr/editorconfig-custom-majormode-el
 | 
			
		||||
# to automatically enable the appropriate major-mode for your files
 | 
			
		||||
# that aren't already caught by your existing config.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
root = true
 | 
			
		||||
 | 
			
		||||
[*]
 | 
			
		||||
end_of_line = lf
 | 
			
		||||
insert_final_newline = true
 | 
			
		||||
charset = utf-8
 | 
			
		||||
 | 
			
		||||
[*.mak]
 | 
			
		||||
indent_style = tab
 | 
			
		||||
indent_size = 8
 | 
			
		||||
emacs_mode = makefile
 | 
			
		||||
 | 
			
		||||
[Makefile*]
 | 
			
		||||
indent_style = tab
 | 
			
		||||
indent_size = 8
 | 
			
		||||
emacs_mode = makefile
 | 
			
		||||
 | 
			
		||||
[*.{c,h,c.inc,h.inc}]
 | 
			
		||||
indent_style = space
 | 
			
		||||
indent_size = 4
 | 
			
		||||
emacs_mode = c
 | 
			
		||||
 | 
			
		||||
[*.sh]
 | 
			
		||||
indent_style = space
 | 
			
		||||
indent_size = 4
 | 
			
		||||
 | 
			
		||||
[*.{s,S}]
 | 
			
		||||
indent_style = tab
 | 
			
		||||
indent_size = 8
 | 
			
		||||
emacs_mode = asm
 | 
			
		||||
 | 
			
		||||
[*.{vert,frag}]
 | 
			
		||||
emacs_mode = glsl
 | 
			
		||||
 | 
			
		||||
[*.json]
 | 
			
		||||
indent_style = space
 | 
			
		||||
emacs_mode = python
 | 
			
		||||
							
								
								
									
										7
									
								
								.exrc
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								.exrc
									
									
									
									
									
								
							@@ -1,7 +0,0 @@
 | 
			
		||||
"VIM settings to match QEMU coding style.  They are activated by adding the
 | 
			
		||||
"following settings (without the " symbol) as last two lines in $HOME/.vimrc:
 | 
			
		||||
"set secure
 | 
			
		||||
"set exrc
 | 
			
		||||
set expandtab
 | 
			
		||||
set shiftwidth=4
 | 
			
		||||
set smarttab
 | 
			
		||||
							
								
								
									
										8
									
								
								.gdbinit
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								.gdbinit
									
									
									
									
									
								
							@@ -1,8 +0,0 @@
 | 
			
		||||
# GDB may have ./.gdbinit loading disabled by default.  In that case you can
 | 
			
		||||
# follow the instructions it prints.  They boil down to adding the following to
 | 
			
		||||
# your home directory's ~/.gdbinit file:
 | 
			
		||||
#
 | 
			
		||||
#   add-auto-load-safe-path /path/to/qemu/.gdbinit
 | 
			
		||||
 | 
			
		||||
# Load QEMU-specific sub-commands and settings
 | 
			
		||||
source scripts/qemu-gdb.py
 | 
			
		||||
							
								
								
									
										3
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							@@ -1,3 +0,0 @@
 | 
			
		||||
*.c.inc         diff=c
 | 
			
		||||
*.h.inc         diff=c
 | 
			
		||||
*.py            diff=python
 | 
			
		||||
							
								
								
									
										34
									
								
								.github/lockdown.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										34
									
								
								.github/lockdown.yml
									
									
									
									
										vendored
									
									
								
							@@ -1,34 +0,0 @@
 | 
			
		||||
# Configuration for Repo Lockdown - https://github.com/dessant/repo-lockdown
 | 
			
		||||
 | 
			
		||||
# Close issues and pull requests
 | 
			
		||||
close: true
 | 
			
		||||
 | 
			
		||||
# Lock issues and pull requests
 | 
			
		||||
lock: true
 | 
			
		||||
 | 
			
		||||
issues:
 | 
			
		||||
  comment: |
 | 
			
		||||
    Thank you for your interest in the QEMU project.
 | 
			
		||||
 | 
			
		||||
    This repository is a read-only mirror of the project's repostories hosted
 | 
			
		||||
    at https://gitlab.com/qemu-project/qemu.git.
 | 
			
		||||
    The project does not process issues filed on GitHub.
 | 
			
		||||
 | 
			
		||||
    The project issues are tracked on Launchpad:
 | 
			
		||||
    https://bugs.launchpad.net/qemu
 | 
			
		||||
 | 
			
		||||
    QEMU welcomes bug report contributions. You can file new ones on:
 | 
			
		||||
    https://bugs.launchpad.net/qemu/+filebug
 | 
			
		||||
 | 
			
		||||
pulls:
 | 
			
		||||
  comment: |
 | 
			
		||||
    Thank you for your interest in the QEMU project.
 | 
			
		||||
 | 
			
		||||
    This repository is a read-only mirror of the project's repostories hosted
 | 
			
		||||
    on https://gitlab.com/qemu-project/qemu.git.
 | 
			
		||||
    The project does not process merge requests filed on GitHub.
 | 
			
		||||
 | 
			
		||||
    QEMU welcomes contributions of code (either fixing bugs or adding new
 | 
			
		||||
    functionality). However, we get a lot of patches, and so we have some
 | 
			
		||||
    guidelines about contributing on the project website:
 | 
			
		||||
    https://www.qemu.org/contribute/
 | 
			
		||||
							
								
								
									
										15
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										15
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -1,15 +0,0 @@
 | 
			
		||||
/GNUmakefile
 | 
			
		||||
/build/
 | 
			
		||||
*.pyc
 | 
			
		||||
.sdk
 | 
			
		||||
.stgit-*
 | 
			
		||||
.git-submodule-status
 | 
			
		||||
cscope.*
 | 
			
		||||
tags
 | 
			
		||||
TAGS
 | 
			
		||||
GPATH
 | 
			
		||||
GRTAGS
 | 
			
		||||
GTAGS
 | 
			
		||||
*~
 | 
			
		||||
*.ast_raw
 | 
			
		||||
*.depend_raw
 | 
			
		||||
@@ -1,94 +0,0 @@
 | 
			
		||||
#!/usr/bin/env python3
 | 
			
		||||
#
 | 
			
		||||
# check-dco.py: validate all commits are signed off
 | 
			
		||||
#
 | 
			
		||||
# Copyright (C) 2020 Red Hat, Inc.
 | 
			
		||||
#
 | 
			
		||||
# SPDX-License-Identifier: GPL-2.0-or-later
 | 
			
		||||
 | 
			
		||||
import os
 | 
			
		||||
import os.path
 | 
			
		||||
import sys
 | 
			
		||||
import subprocess
 | 
			
		||||
 | 
			
		||||
namespace = "qemu-project"
 | 
			
		||||
if len(sys.argv) >= 2:
 | 
			
		||||
    namespace = sys.argv[1]
 | 
			
		||||
 | 
			
		||||
cwd = os.getcwd()
 | 
			
		||||
reponame = os.path.basename(cwd)
 | 
			
		||||
repourl = "https://gitlab.com/%s/%s.git" % (namespace, reponame)
 | 
			
		||||
 | 
			
		||||
subprocess.check_call(["git", "remote", "add", "check-dco", repourl])
 | 
			
		||||
subprocess.check_call(["git", "fetch", "check-dco", "master"],
 | 
			
		||||
                      stdout=subprocess.DEVNULL,
 | 
			
		||||
                      stderr=subprocess.DEVNULL)
 | 
			
		||||
 | 
			
		||||
ancestor = subprocess.check_output(["git", "merge-base",
 | 
			
		||||
                                    "check-dco/master", "HEAD"],
 | 
			
		||||
                                   universal_newlines=True)
 | 
			
		||||
 | 
			
		||||
ancestor = ancestor.strip()
 | 
			
		||||
 | 
			
		||||
subprocess.check_call(["git", "remote", "rm", "check-dco"])
 | 
			
		||||
 | 
			
		||||
errors = False
 | 
			
		||||
 | 
			
		||||
print("\nChecking for 'Signed-off-by: NAME <EMAIL>' " +
 | 
			
		||||
      "on all commits since %s...\n" % ancestor)
 | 
			
		||||
 | 
			
		||||
log = subprocess.check_output(["git", "log", "--format=%H %s",
 | 
			
		||||
                               ancestor + "..."],
 | 
			
		||||
                              universal_newlines=True)
 | 
			
		||||
 | 
			
		||||
if log == "":
 | 
			
		||||
    commits = []
 | 
			
		||||
else:
 | 
			
		||||
    commits = [[c[0:40], c[41:]] for c in log.strip().split("\n")]
 | 
			
		||||
 | 
			
		||||
for sha, subject in commits:
 | 
			
		||||
 | 
			
		||||
    msg = subprocess.check_output(["git", "show", "-s", sha],
 | 
			
		||||
                                  universal_newlines=True)
 | 
			
		||||
    lines = msg.strip().split("\n")
 | 
			
		||||
 | 
			
		||||
    print("🔍 %s %s" % (sha, subject))
 | 
			
		||||
    sob = False
 | 
			
		||||
    for line in lines:
 | 
			
		||||
        if "Signed-off-by:" in line:
 | 
			
		||||
            sob = True
 | 
			
		||||
            if "localhost" in line:
 | 
			
		||||
                print("    ❌ FAIL: bad email in %s" % line)
 | 
			
		||||
                errors = True
 | 
			
		||||
 | 
			
		||||
    if not sob:
 | 
			
		||||
        print("    ❌ FAIL missing Signed-off-by tag")
 | 
			
		||||
        errors = True
 | 
			
		||||
 | 
			
		||||
if errors:
 | 
			
		||||
    print("""
 | 
			
		||||
 | 
			
		||||
❌ ERROR: One or more commits are missing a valid Signed-off-By tag.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
This project requires all contributors to assert that their contributions
 | 
			
		||||
are provided in compliance with the terms of the Developer's Certificate
 | 
			
		||||
of Origin 1.1 (DCO):
 | 
			
		||||
 | 
			
		||||
  https://developercertificate.org/
 | 
			
		||||
 | 
			
		||||
To indicate acceptance of the DCO every commit must have a tag
 | 
			
		||||
 | 
			
		||||
  Signed-off-by: REAL NAME <EMAIL>
 | 
			
		||||
 | 
			
		||||
This can be achieved by passing the "-s" flag to the "git commit" command.
 | 
			
		||||
 | 
			
		||||
To bulk update all commits on current branch "git rebase" can be used:
 | 
			
		||||
 | 
			
		||||
  git rebase -i master -x 'git commit --amend --no-edit -s'
 | 
			
		||||
 | 
			
		||||
""")
 | 
			
		||||
 | 
			
		||||
    sys.exit(1)
 | 
			
		||||
 | 
			
		||||
sys.exit(0)
 | 
			
		||||
@@ -1,56 +0,0 @@
 | 
			
		||||
#!/usr/bin/env python3
 | 
			
		||||
#
 | 
			
		||||
# check-patch.py: run checkpatch.pl across all commits in a branch
 | 
			
		||||
#
 | 
			
		||||
# Copyright (C) 2020 Red Hat, Inc.
 | 
			
		||||
#
 | 
			
		||||
# SPDX-License-Identifier: GPL-2.0-or-later
 | 
			
		||||
 | 
			
		||||
import os
 | 
			
		||||
import os.path
 | 
			
		||||
import sys
 | 
			
		||||
import subprocess
 | 
			
		||||
 | 
			
		||||
namespace = "qemu-project"
 | 
			
		||||
if len(sys.argv) >= 2:
 | 
			
		||||
    namespace = sys.argv[1]
 | 
			
		||||
 | 
			
		||||
cwd = os.getcwd()
 | 
			
		||||
reponame = os.path.basename(cwd)
 | 
			
		||||
repourl = "https://gitlab.com/%s/%s.git" % (namespace, reponame)
 | 
			
		||||
 | 
			
		||||
# GitLab CI environment does not give us any direct info about the
 | 
			
		||||
# base for the user's branch. We thus need to figure out a common
 | 
			
		||||
# ancestor between the user's branch and current git master.
 | 
			
		||||
subprocess.check_call(["git", "remote", "add", "check-patch", repourl])
 | 
			
		||||
subprocess.check_call(["git", "fetch", "check-patch", "master"],
 | 
			
		||||
                      stdout=subprocess.DEVNULL,
 | 
			
		||||
                      stderr=subprocess.DEVNULL)
 | 
			
		||||
 | 
			
		||||
ancestor = subprocess.check_output(["git", "merge-base",
 | 
			
		||||
                                    "check-patch/master", "HEAD"],
 | 
			
		||||
                                   universal_newlines=True)
 | 
			
		||||
 | 
			
		||||
ancestor = ancestor.strip()
 | 
			
		||||
 | 
			
		||||
log = subprocess.check_output(["git", "log", "--format=%H %s",
 | 
			
		||||
                               ancestor + "..."],
 | 
			
		||||
                              universal_newlines=True)
 | 
			
		||||
 | 
			
		||||
subprocess.check_call(["git", "remote", "rm", "check-patch"])
 | 
			
		||||
 | 
			
		||||
if log == "":
 | 
			
		||||
    print("\nNo commits since %s, skipping checks\n" % ancestor)
 | 
			
		||||
    sys.exit(0)
 | 
			
		||||
 | 
			
		||||
errors = False
 | 
			
		||||
 | 
			
		||||
print("\nChecking all commits since %s...\n" % ancestor, flush=True)
 | 
			
		||||
 | 
			
		||||
ret = subprocess.run(["scripts/checkpatch.pl", "--terse", ancestor + "..."])
 | 
			
		||||
 | 
			
		||||
if ret.returncode != 0:
 | 
			
		||||
    print("    ❌ FAIL one or more commits failed scripts/checkpatch.pl")
 | 
			
		||||
    sys.exit(1)
 | 
			
		||||
 | 
			
		||||
sys.exit(0)
 | 
			
		||||
@@ -1,251 +0,0 @@
 | 
			
		||||
.container_job_template: &container_job_definition
 | 
			
		||||
  image: docker:stable
 | 
			
		||||
  stage: containers
 | 
			
		||||
  services:
 | 
			
		||||
    - docker:dind
 | 
			
		||||
  before_script:
 | 
			
		||||
    - export TAG="$CI_REGISTRY_IMAGE/qemu/$NAME:latest"
 | 
			
		||||
    - export COMMON_TAG="$CI_REGISTRY/qemu-project/qemu/$NAME:latest"
 | 
			
		||||
    - apk add python3
 | 
			
		||||
    - docker info
 | 
			
		||||
    - docker login $CI_REGISTRY -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD"
 | 
			
		||||
  script:
 | 
			
		||||
    - echo "TAG:$TAG"
 | 
			
		||||
    - echo "COMMON_TAG:$COMMON_TAG"
 | 
			
		||||
    - docker pull "$TAG" || docker pull "$COMMON_TAG" || true
 | 
			
		||||
    - ./tests/docker/docker.py --engine docker build
 | 
			
		||||
          -t "qemu/$NAME" -f "tests/docker/dockerfiles/$NAME.docker"
 | 
			
		||||
          -r $CI_REGISTRY_IMAGE
 | 
			
		||||
    - docker tag "qemu/$NAME" "$TAG"
 | 
			
		||||
    - docker push "$TAG"
 | 
			
		||||
  after_script:
 | 
			
		||||
    - docker logout
 | 
			
		||||
 | 
			
		||||
amd64-alpine-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: alpine
 | 
			
		||||
 | 
			
		||||
amd64-centos7-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: centos7
 | 
			
		||||
 | 
			
		||||
amd64-centos8-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: centos8
 | 
			
		||||
 | 
			
		||||
amd64-debian10-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: debian10
 | 
			
		||||
 | 
			
		||||
amd64-debian11-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: debian11
 | 
			
		||||
 | 
			
		||||
alpha-debian-cross-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  stage: containers-layer2
 | 
			
		||||
  needs: ['amd64-debian10-container']
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: debian-alpha-cross
 | 
			
		||||
 | 
			
		||||
amd64-debian-cross-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  stage: containers-layer2
 | 
			
		||||
  needs: ['amd64-debian10-container']
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: debian-amd64-cross
 | 
			
		||||
 | 
			
		||||
amd64-debian-user-cross-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  stage: containers-layer2
 | 
			
		||||
  needs: ['amd64-debian10-container']
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: debian-all-test-cross
 | 
			
		||||
 | 
			
		||||
amd64-debian-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  stage: containers-layer2
 | 
			
		||||
  needs: ['amd64-debian10-container']
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: debian-amd64
 | 
			
		||||
 | 
			
		||||
arm64-debian-cross-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  stage: containers-layer2
 | 
			
		||||
  needs: ['amd64-debian10-container']
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: debian-arm64-cross
 | 
			
		||||
 | 
			
		||||
arm64-test-debian-cross-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  stage: containers-layer2
 | 
			
		||||
  needs: ['amd64-debian11-container']
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: debian-arm64-test-cross
 | 
			
		||||
 | 
			
		||||
armel-debian-cross-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  stage: containers-layer2
 | 
			
		||||
  needs: ['amd64-debian10-container']
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: debian-armel-cross
 | 
			
		||||
 | 
			
		||||
armhf-debian-cross-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  stage: containers-layer2
 | 
			
		||||
  needs: ['amd64-debian10-container']
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: debian-armhf-cross
 | 
			
		||||
 | 
			
		||||
hppa-debian-cross-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  stage: containers-layer2
 | 
			
		||||
  needs: ['amd64-debian10-container']
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: debian-hppa-cross
 | 
			
		||||
 | 
			
		||||
m68k-debian-cross-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  stage: containers-layer2
 | 
			
		||||
  needs: ['amd64-debian10-container']
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: debian-m68k-cross
 | 
			
		||||
 | 
			
		||||
mips64-debian-cross-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  stage: containers-layer2
 | 
			
		||||
  needs: ['amd64-debian10-container']
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: debian-mips64-cross
 | 
			
		||||
 | 
			
		||||
mips64el-debian-cross-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  stage: containers-layer2
 | 
			
		||||
  needs: ['amd64-debian10-container']
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: debian-mips64el-cross
 | 
			
		||||
 | 
			
		||||
mips-debian-cross-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  stage: containers-layer2
 | 
			
		||||
  needs: ['amd64-debian10-container']
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: debian-mips-cross
 | 
			
		||||
 | 
			
		||||
mipsel-debian-cross-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  stage: containers-layer2
 | 
			
		||||
  needs: ['amd64-debian10-container']
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: debian-mipsel-cross
 | 
			
		||||
 | 
			
		||||
powerpc-debian-cross-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  stage: containers-layer2
 | 
			
		||||
  needs: ['amd64-debian10-container']
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: debian-powerpc-cross
 | 
			
		||||
 | 
			
		||||
ppc64-debian-cross-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  stage: containers-layer2
 | 
			
		||||
  needs: ['amd64-debian10-container']
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: debian-ppc64-cross
 | 
			
		||||
 | 
			
		||||
ppc64el-debian-cross-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  stage: containers-layer2
 | 
			
		||||
  needs: ['amd64-debian10-container']
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: debian-ppc64el-cross
 | 
			
		||||
 | 
			
		||||
riscv64-debian-cross-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  stage: containers-layer2
 | 
			
		||||
  needs: ['amd64-debian10-container']
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: debian-riscv64-cross
 | 
			
		||||
 | 
			
		||||
s390x-debian-cross-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  stage: containers-layer2
 | 
			
		||||
  needs: ['amd64-debian10-container']
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: debian-s390x-cross
 | 
			
		||||
 | 
			
		||||
sh4-debian-cross-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  stage: containers-layer2
 | 
			
		||||
  needs: ['amd64-debian10-container']
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: debian-sh4-cross
 | 
			
		||||
 | 
			
		||||
sparc64-debian-cross-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  stage: containers-layer2
 | 
			
		||||
  needs: ['amd64-debian10-container']
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: debian-sparc64-cross
 | 
			
		||||
 | 
			
		||||
tricore-debian-cross-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  stage: containers-layer2
 | 
			
		||||
  needs: ['amd64-debian10-container']
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: debian-tricore-cross
 | 
			
		||||
 | 
			
		||||
xtensa-debian-cross-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: debian-xtensa-cross
 | 
			
		||||
 | 
			
		||||
cris-fedora-cross-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: fedora-cris-cross
 | 
			
		||||
 | 
			
		||||
amd64-fedora-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: fedora
 | 
			
		||||
 | 
			
		||||
i386-fedora-cross-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: fedora-i386-cross
 | 
			
		||||
 | 
			
		||||
win32-fedora-cross-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: fedora-win32-cross
 | 
			
		||||
 | 
			
		||||
win64-fedora-cross-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: fedora-win64-cross
 | 
			
		||||
 | 
			
		||||
amd64-ubuntu1804-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: ubuntu1804
 | 
			
		||||
 | 
			
		||||
amd64-ubuntu2004-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: ubuntu2004
 | 
			
		||||
 | 
			
		||||
amd64-ubuntu-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: ubuntu
 | 
			
		||||
 | 
			
		||||
amd64-opensuse-leap-container:
 | 
			
		||||
  <<: *container_job_definition
 | 
			
		||||
  variables:
 | 
			
		||||
    NAME: opensuse-leap
 | 
			
		||||
@@ -1,209 +0,0 @@
 | 
			
		||||
.cross_system_build_job:
 | 
			
		||||
  stage: build
 | 
			
		||||
  image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
 | 
			
		||||
  timeout: 80m
 | 
			
		||||
  script:
 | 
			
		||||
    - mkdir build
 | 
			
		||||
    - cd build
 | 
			
		||||
    - PKG_CONFIG_PATH=$PKG_CONFIG_PATH
 | 
			
		||||
      ../configure --enable-werror --disable-docs $QEMU_CONFIGURE_OPTS
 | 
			
		||||
        --disable-user --target-list-exclude="arm-softmmu cris-softmmu
 | 
			
		||||
          i386-softmmu microblaze-softmmu mips-softmmu mipsel-softmmu
 | 
			
		||||
          mips64-softmmu ppc-softmmu sh4-softmmu xtensa-softmmu"
 | 
			
		||||
    - make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS
 | 
			
		||||
 | 
			
		||||
# Job to cross-build specific accelerators.
 | 
			
		||||
#
 | 
			
		||||
# Set the $ACCEL variable to select the specific accelerator (default to
 | 
			
		||||
# KVM), and set extra options (such disabling other accelerators) via the
 | 
			
		||||
# $ACCEL_CONFIGURE_OPTS variable.
 | 
			
		||||
.cross_accel_build_job:
 | 
			
		||||
  stage: build
 | 
			
		||||
  image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
 | 
			
		||||
  timeout: 30m
 | 
			
		||||
  script:
 | 
			
		||||
    - mkdir build
 | 
			
		||||
    - cd build
 | 
			
		||||
    - PKG_CONFIG_PATH=$PKG_CONFIG_PATH
 | 
			
		||||
      ../configure --enable-werror --disable-docs $QEMU_CONFIGURE_OPTS
 | 
			
		||||
        --disable-tools --enable-${ACCEL:-kvm} $ACCEL_CONFIGURE_OPTS
 | 
			
		||||
    - make -j$(expr $(nproc) + 1) all check-build
 | 
			
		||||
 | 
			
		||||
.cross_user_build_job:
 | 
			
		||||
  stage: build
 | 
			
		||||
  image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
 | 
			
		||||
  script:
 | 
			
		||||
    - mkdir build
 | 
			
		||||
    - cd build
 | 
			
		||||
    - PKG_CONFIG_PATH=$PKG_CONFIG_PATH
 | 
			
		||||
      ../configure --enable-werror --disable-docs $QEMU_CONFIGURE_OPTS
 | 
			
		||||
        --disable-system
 | 
			
		||||
    - make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS
 | 
			
		||||
 | 
			
		||||
cross-armel-system:
 | 
			
		||||
  extends: .cross_system_build_job
 | 
			
		||||
  needs:
 | 
			
		||||
    job: armel-debian-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-armel-cross
 | 
			
		||||
 | 
			
		||||
cross-armel-user:
 | 
			
		||||
  extends: .cross_user_build_job
 | 
			
		||||
  needs:
 | 
			
		||||
    job: armel-debian-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-armel-cross
 | 
			
		||||
 | 
			
		||||
cross-armhf-system:
 | 
			
		||||
  extends: .cross_system_build_job
 | 
			
		||||
  needs:
 | 
			
		||||
    job: armhf-debian-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-armhf-cross
 | 
			
		||||
 | 
			
		||||
cross-armhf-user:
 | 
			
		||||
  extends: .cross_user_build_job
 | 
			
		||||
  needs:
 | 
			
		||||
    job: armhf-debian-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-armhf-cross
 | 
			
		||||
 | 
			
		||||
cross-arm64-system:
 | 
			
		||||
  extends: .cross_system_build_job
 | 
			
		||||
  needs:
 | 
			
		||||
    job: arm64-debian-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-arm64-cross
 | 
			
		||||
 | 
			
		||||
cross-arm64-user:
 | 
			
		||||
  extends: .cross_user_build_job
 | 
			
		||||
  needs:
 | 
			
		||||
    job: arm64-debian-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-arm64-cross
 | 
			
		||||
 | 
			
		||||
cross-i386-system:
 | 
			
		||||
  extends: .cross_system_build_job
 | 
			
		||||
  needs:
 | 
			
		||||
    job: i386-fedora-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: fedora-i386-cross
 | 
			
		||||
    MAKE_CHECK_ARGS: check-qtest
 | 
			
		||||
 | 
			
		||||
cross-i386-user:
 | 
			
		||||
  extends: .cross_user_build_job
 | 
			
		||||
  needs:
 | 
			
		||||
    job: i386-fedora-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: fedora-i386-cross
 | 
			
		||||
    MAKE_CHECK_ARGS: check
 | 
			
		||||
 | 
			
		||||
cross-mips-system:
 | 
			
		||||
  extends: .cross_system_build_job
 | 
			
		||||
  needs:
 | 
			
		||||
    job: mips-debian-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-mips-cross
 | 
			
		||||
 | 
			
		||||
cross-mips-user:
 | 
			
		||||
  extends: .cross_user_build_job
 | 
			
		||||
  needs:
 | 
			
		||||
    job: mips-debian-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-mips-cross
 | 
			
		||||
 | 
			
		||||
cross-mipsel-system:
 | 
			
		||||
  extends: .cross_system_build_job
 | 
			
		||||
  needs:
 | 
			
		||||
    job: mipsel-debian-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-mipsel-cross
 | 
			
		||||
 | 
			
		||||
cross-mipsel-user:
 | 
			
		||||
  extends: .cross_user_build_job
 | 
			
		||||
  needs:
 | 
			
		||||
    job: mipsel-debian-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-mipsel-cross
 | 
			
		||||
 | 
			
		||||
cross-mips64el-system:
 | 
			
		||||
  extends: .cross_system_build_job
 | 
			
		||||
  needs:
 | 
			
		||||
    job: mips64el-debian-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-mips64el-cross
 | 
			
		||||
 | 
			
		||||
cross-mips64el-user:
 | 
			
		||||
  extends: .cross_user_build_job
 | 
			
		||||
  needs:
 | 
			
		||||
    job: mips64el-debian-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-mips64el-cross
 | 
			
		||||
 | 
			
		||||
cross-ppc64el-system:
 | 
			
		||||
  extends: .cross_system_build_job
 | 
			
		||||
  needs:
 | 
			
		||||
    job: ppc64el-debian-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-ppc64el-cross
 | 
			
		||||
 | 
			
		||||
cross-ppc64el-user:
 | 
			
		||||
  extends: .cross_user_build_job
 | 
			
		||||
  needs:
 | 
			
		||||
    job: ppc64el-debian-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-ppc64el-cross
 | 
			
		||||
 | 
			
		||||
cross-s390x-system:
 | 
			
		||||
  extends: .cross_system_build_job
 | 
			
		||||
  needs:
 | 
			
		||||
    job: s390x-debian-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-s390x-cross
 | 
			
		||||
 | 
			
		||||
cross-s390x-user:
 | 
			
		||||
  extends: .cross_user_build_job
 | 
			
		||||
  needs:
 | 
			
		||||
    job: s390x-debian-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-s390x-cross
 | 
			
		||||
 | 
			
		||||
cross-s390x-kvm-only:
 | 
			
		||||
  extends: .cross_accel_build_job
 | 
			
		||||
  needs:
 | 
			
		||||
    job: s390x-debian-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-s390x-cross
 | 
			
		||||
    ACCEL_CONFIGURE_OPTS: --disable-tcg
 | 
			
		||||
 | 
			
		||||
cross-win32-system:
 | 
			
		||||
  extends: .cross_system_build_job
 | 
			
		||||
  needs:
 | 
			
		||||
    job: win32-fedora-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: fedora-win32-cross
 | 
			
		||||
 | 
			
		||||
cross-win64-system:
 | 
			
		||||
  extends: .cross_system_build_job
 | 
			
		||||
  needs:
 | 
			
		||||
    job: win64-fedora-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: fedora-win64-cross
 | 
			
		||||
 | 
			
		||||
cross-amd64-xen-only:
 | 
			
		||||
  extends: .cross_accel_build_job
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-debian-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-amd64-cross
 | 
			
		||||
    ACCEL: xen
 | 
			
		||||
    ACCEL_CONFIGURE_OPTS: --disable-tcg --disable-kvm
 | 
			
		||||
 | 
			
		||||
cross-arm64-xen-only:
 | 
			
		||||
  extends: .cross_accel_build_job
 | 
			
		||||
  needs:
 | 
			
		||||
    job: arm64-debian-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-arm64-cross
 | 
			
		||||
    ACCEL: xen
 | 
			
		||||
    ACCEL_CONFIGURE_OPTS: --disable-tcg --disable-kvm
 | 
			
		||||
@@ -1,51 +0,0 @@
 | 
			
		||||
docker-edk2:
 | 
			
		||||
 stage: containers
 | 
			
		||||
 rules: # Only run this job when the Dockerfile is modified
 | 
			
		||||
 - changes:
 | 
			
		||||
   - .gitlab-ci.d/edk2.yml
 | 
			
		||||
   - .gitlab-ci.d/edk2/Dockerfile
 | 
			
		||||
   when: always
 | 
			
		||||
 image: docker:19.03.1
 | 
			
		||||
 services:
 | 
			
		||||
 - docker:19.03.1-dind
 | 
			
		||||
 variables:
 | 
			
		||||
  GIT_DEPTH: 3
 | 
			
		||||
  IMAGE_TAG: $CI_REGISTRY_IMAGE:edk2-cross-build
 | 
			
		||||
  # We don't use TLS
 | 
			
		||||
  DOCKER_HOST: tcp://docker:2375
 | 
			
		||||
  DOCKER_TLS_CERTDIR: ""
 | 
			
		||||
 before_script:
 | 
			
		||||
 - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
 | 
			
		||||
 script:
 | 
			
		||||
 - docker pull $IMAGE_TAG || true
 | 
			
		||||
 - docker build --cache-from $IMAGE_TAG --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
 | 
			
		||||
                                        --tag $IMAGE_TAG .gitlab-ci.d/edk2
 | 
			
		||||
 - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
 | 
			
		||||
 - docker push $IMAGE_TAG
 | 
			
		||||
 | 
			
		||||
build-edk2:
 | 
			
		||||
 stage: build
 | 
			
		||||
 needs: ['docker-edk2']
 | 
			
		||||
 rules: # Only run this job when ...
 | 
			
		||||
 - changes: # ... roms/edk2/ is modified (submodule updated)
 | 
			
		||||
   - roms/edk2/*
 | 
			
		||||
   when: always
 | 
			
		||||
 - if: '$CI_COMMIT_REF_NAME =~ /^edk2/' # or the branch/tag starts with 'edk2'
 | 
			
		||||
   when: always
 | 
			
		||||
 - if: '$CI_COMMIT_MESSAGE =~ /edk2/i' # or last commit description contains 'EDK2'
 | 
			
		||||
   when: always
 | 
			
		||||
 artifacts:
 | 
			
		||||
   paths: # 'artifacts.zip' will contains the following files:
 | 
			
		||||
   - pc-bios/edk2*bz2
 | 
			
		||||
   - pc-bios/edk2-licenses.txt
 | 
			
		||||
   - edk2-stdout.log
 | 
			
		||||
   - edk2-stderr.log
 | 
			
		||||
 image: $CI_REGISTRY_IMAGE:edk2-cross-build
 | 
			
		||||
 variables:
 | 
			
		||||
   GIT_DEPTH: 3
 | 
			
		||||
 script: # Clone the required submodules and build EDK2
 | 
			
		||||
 - git submodule update --init roms/edk2
 | 
			
		||||
 - git -C roms/edk2 submodule update --init
 | 
			
		||||
 - export JOBS=$(($(getconf _NPROCESSORS_ONLN) + 1))
 | 
			
		||||
 - echo "=== Using ${JOBS} simultaneous jobs ==="
 | 
			
		||||
 - make -j${JOBS} -C roms efi 2>&1 1>edk2-stdout.log | tee -a edk2-stderr.log >&2
 | 
			
		||||
@@ -1,27 +0,0 @@
 | 
			
		||||
#
 | 
			
		||||
# Docker image to cross-compile EDK2 firmware binaries
 | 
			
		||||
#
 | 
			
		||||
FROM ubuntu:16.04
 | 
			
		||||
 | 
			
		||||
MAINTAINER Philippe Mathieu-Daudé <philmd@redhat.com>
 | 
			
		||||
 | 
			
		||||
# Install packages required to build EDK2
 | 
			
		||||
RUN apt update \
 | 
			
		||||
    && \
 | 
			
		||||
    \
 | 
			
		||||
    DEBIAN_FRONTEND=noninteractive \
 | 
			
		||||
    apt install --assume-yes --no-install-recommends \
 | 
			
		||||
        build-essential \
 | 
			
		||||
        ca-certificates \
 | 
			
		||||
        dos2unix \
 | 
			
		||||
        gcc-aarch64-linux-gnu \
 | 
			
		||||
        gcc-arm-linux-gnueabi \
 | 
			
		||||
        git \
 | 
			
		||||
        iasl \
 | 
			
		||||
        make \
 | 
			
		||||
        nasm \
 | 
			
		||||
        python \
 | 
			
		||||
        uuid-dev \
 | 
			
		||||
    && \
 | 
			
		||||
    \
 | 
			
		||||
    rm -rf /var/lib/apt/lists/*
 | 
			
		||||
@@ -1,57 +0,0 @@
 | 
			
		||||
docker-opensbi:
 | 
			
		||||
 stage: containers
 | 
			
		||||
 rules: # Only run this job when the Dockerfile is modified
 | 
			
		||||
 - changes:
 | 
			
		||||
   - .gitlab-ci.d/opensbi.yml
 | 
			
		||||
   - .gitlab-ci.d/opensbi/Dockerfile
 | 
			
		||||
   when: always
 | 
			
		||||
 image: docker:19.03.1
 | 
			
		||||
 services:
 | 
			
		||||
 - docker:19.03.1-dind
 | 
			
		||||
 variables:
 | 
			
		||||
  GIT_DEPTH: 3
 | 
			
		||||
  IMAGE_TAG: $CI_REGISTRY_IMAGE:opensbi-cross-build
 | 
			
		||||
  # We don't use TLS
 | 
			
		||||
  DOCKER_HOST: tcp://docker:2375
 | 
			
		||||
  DOCKER_TLS_CERTDIR: ""
 | 
			
		||||
 before_script:
 | 
			
		||||
 - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
 | 
			
		||||
 script:
 | 
			
		||||
 - docker pull $IMAGE_TAG || true
 | 
			
		||||
 - docker build --cache-from $IMAGE_TAG --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
 | 
			
		||||
                                        --tag $IMAGE_TAG .gitlab-ci.d/opensbi
 | 
			
		||||
 - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
 | 
			
		||||
 - docker push $IMAGE_TAG
 | 
			
		||||
 | 
			
		||||
build-opensbi:
 | 
			
		||||
 stage: build
 | 
			
		||||
 needs: ['docker-opensbi']
 | 
			
		||||
 rules: # Only run this job when ...
 | 
			
		||||
 - changes: # ... roms/opensbi/ is modified (submodule updated)
 | 
			
		||||
   - roms/opensbi/*
 | 
			
		||||
   when: always
 | 
			
		||||
 - if: '$CI_COMMIT_REF_NAME =~ /^opensbi/' # or the branch/tag starts with 'opensbi'
 | 
			
		||||
   when: always
 | 
			
		||||
 - if: '$CI_COMMIT_MESSAGE =~ /opensbi/i' # or last commit description contains 'OpenSBI'
 | 
			
		||||
   when: always
 | 
			
		||||
 artifacts:
 | 
			
		||||
   paths: # 'artifacts.zip' will contains the following files:
 | 
			
		||||
   - pc-bios/opensbi-riscv32-generic-fw_dynamic.bin
 | 
			
		||||
   - pc-bios/opensbi-riscv32-generic-fw_dynamic.elf
 | 
			
		||||
   - pc-bios/opensbi-riscv64-generic-fw_dynamic.bin
 | 
			
		||||
   - pc-bios/opensbi-riscv64-generic-fw_dynamic.elf
 | 
			
		||||
   - opensbi32-generic-stdout.log
 | 
			
		||||
   - opensbi32-generic-stderr.log
 | 
			
		||||
   - opensbi64-generic-stdout.log
 | 
			
		||||
   - opensbi64-generic-stderr.log
 | 
			
		||||
 image: $CI_REGISTRY_IMAGE:opensbi-cross-build
 | 
			
		||||
 variables:
 | 
			
		||||
   GIT_DEPTH: 3
 | 
			
		||||
 script: # Clone the required submodules and build OpenSBI
 | 
			
		||||
 - git submodule update --init roms/opensbi
 | 
			
		||||
 - export JOBS=$(($(getconf _NPROCESSORS_ONLN) + 1))
 | 
			
		||||
 - echo "=== Using ${JOBS} simultaneous jobs ==="
 | 
			
		||||
 - make -j${JOBS} -C roms/opensbi clean
 | 
			
		||||
 - make -j${JOBS} -C roms opensbi32-generic 2>&1 1>opensbi32-generic-stdout.log | tee -a opensbi32-generic-stderr.log >&2
 | 
			
		||||
 - make -j${JOBS} -C roms/opensbi clean
 | 
			
		||||
 - make -j${JOBS} -C roms opensbi64-generic 2>&1 1>opensbi64-generic-stdout.log | tee -a opensbi64-generic-stderr.log >&2
 | 
			
		||||
@@ -1,33 +0,0 @@
 | 
			
		||||
#
 | 
			
		||||
# Docker image to cross-compile OpenSBI firmware binaries
 | 
			
		||||
#
 | 
			
		||||
FROM ubuntu:18.04
 | 
			
		||||
 | 
			
		||||
MAINTAINER Bin Meng <bmeng.cn@gmail.com>
 | 
			
		||||
 | 
			
		||||
# Install packages required to build OpenSBI
 | 
			
		||||
RUN apt update \
 | 
			
		||||
    && \
 | 
			
		||||
    \
 | 
			
		||||
    DEBIAN_FRONTEND=noninteractive \
 | 
			
		||||
    apt install --assume-yes --no-install-recommends \
 | 
			
		||||
        build-essential \
 | 
			
		||||
        ca-certificates \
 | 
			
		||||
        git \
 | 
			
		||||
        make \
 | 
			
		||||
        wget \
 | 
			
		||||
    && \
 | 
			
		||||
    \
 | 
			
		||||
    rm -rf /var/lib/apt/lists/*
 | 
			
		||||
 | 
			
		||||
# Manually install the kernel.org "Crosstool" based toolchains for gcc-8.3
 | 
			
		||||
RUN wget -O - \
 | 
			
		||||
    https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/8.3.0/x86_64-gcc-8.3.0-nolibc-riscv32-linux.tar.xz \
 | 
			
		||||
    | tar -C /opt -xJ
 | 
			
		||||
RUN wget -O - \
 | 
			
		||||
    https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/8.3.0/x86_64-gcc-8.3.0-nolibc-riscv64-linux.tar.xz \
 | 
			
		||||
    | tar -C /opt -xJ
 | 
			
		||||
 | 
			
		||||
# Export the toolchains to the system path
 | 
			
		||||
ENV PATH="/opt/gcc-8.3.0-nolibc/riscv32-linux/bin:${PATH}"
 | 
			
		||||
ENV PATH="/opt/gcc-8.3.0-nolibc/riscv64-linux/bin:${PATH}"
 | 
			
		||||
							
								
								
									
										837
									
								
								.gitlab-ci.yml
									
									
									
									
									
								
							
							
						
						
									
										837
									
								
								.gitlab-ci.yml
									
									
									
									
									
								
							@@ -1,837 +0,0 @@
 | 
			
		||||
# Currently we have two build stages after our containers are built:
 | 
			
		||||
#  - build (for traditional build and test or first stage build)
 | 
			
		||||
#  - test (for test stages, using build artefacts from a build stage)
 | 
			
		||||
stages:
 | 
			
		||||
  - containers
 | 
			
		||||
  - containers-layer2
 | 
			
		||||
  - build
 | 
			
		||||
  - test
 | 
			
		||||
 | 
			
		||||
include:
 | 
			
		||||
  - local: '/.gitlab-ci.d/edk2.yml'
 | 
			
		||||
  - local: '/.gitlab-ci.d/opensbi.yml'
 | 
			
		||||
  - local: '/.gitlab-ci.d/containers.yml'
 | 
			
		||||
  - local: '/.gitlab-ci.d/crossbuilds.yml'
 | 
			
		||||
 | 
			
		||||
.native_build_job_template: &native_build_job_definition
 | 
			
		||||
  stage: build
 | 
			
		||||
  image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
 | 
			
		||||
  before_script:
 | 
			
		||||
    - JOBS=$(expr $(nproc) + 1)
 | 
			
		||||
  script:
 | 
			
		||||
    - mkdir build
 | 
			
		||||
    - cd build
 | 
			
		||||
    - if test -n "$TARGETS";
 | 
			
		||||
      then
 | 
			
		||||
        ../configure --enable-werror --disable-docs $CONFIGURE_ARGS --target-list="$TARGETS" ;
 | 
			
		||||
      else
 | 
			
		||||
        ../configure --enable-werror --disable-docs $CONFIGURE_ARGS ;
 | 
			
		||||
      fi || { cat config.log meson-logs/meson-log.txt && exit 1; }
 | 
			
		||||
    - if test -n "$LD_JOBS";
 | 
			
		||||
      then
 | 
			
		||||
        meson configure . -Dbackend_max_links="$LD_JOBS" ;
 | 
			
		||||
      fi || exit 1;
 | 
			
		||||
    - make -j"$JOBS"
 | 
			
		||||
    - if test -n "$MAKE_CHECK_ARGS";
 | 
			
		||||
      then
 | 
			
		||||
        make -j"$JOBS" $MAKE_CHECK_ARGS ;
 | 
			
		||||
      fi
 | 
			
		||||
 | 
			
		||||
.native_test_job_template: &native_test_job_definition
 | 
			
		||||
  stage: test
 | 
			
		||||
  image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
 | 
			
		||||
  script:
 | 
			
		||||
    - scripts/git-submodule.sh update
 | 
			
		||||
        $(grep GIT_SUBMODULES build/config-host.mak | sed 's/GIT_SUBMODULES=//')
 | 
			
		||||
    - cd build
 | 
			
		||||
    - find . -type f -exec touch {} +
 | 
			
		||||
    # Avoid recompiling by hiding ninja with NINJA=":"
 | 
			
		||||
    - make NINJA=":" $MAKE_CHECK_ARGS
 | 
			
		||||
 | 
			
		||||
.acceptance_template: &acceptance_definition
 | 
			
		||||
  cache:
 | 
			
		||||
    key: "${CI_JOB_NAME}-cache"
 | 
			
		||||
    paths:
 | 
			
		||||
      - ${CI_PROJECT_DIR}/avocado-cache
 | 
			
		||||
    policy: pull-push
 | 
			
		||||
  artifacts:
 | 
			
		||||
    name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
 | 
			
		||||
    when: always
 | 
			
		||||
    expire_in: 2 days
 | 
			
		||||
    paths:
 | 
			
		||||
      - build/tests/results/latest/results.xml
 | 
			
		||||
      - build/tests/results/latest/test-results
 | 
			
		||||
    reports:
 | 
			
		||||
      junit: build/tests/results/latest/results.xml
 | 
			
		||||
  before_script:
 | 
			
		||||
    - mkdir -p ~/.config/avocado
 | 
			
		||||
    - echo "[datadir.paths]" > ~/.config/avocado/avocado.conf
 | 
			
		||||
    - echo "cache_dirs = ['${CI_PROJECT_DIR}/avocado-cache']"
 | 
			
		||||
           >> ~/.config/avocado/avocado.conf
 | 
			
		||||
    - echo -e '[job.output.testlogs]\nstatuses = ["FAIL", "INTERRUPT"]'
 | 
			
		||||
           >> ~/.config/avocado/avocado.conf
 | 
			
		||||
    - if [ -d ${CI_PROJECT_DIR}/avocado-cache ]; then
 | 
			
		||||
        du -chs ${CI_PROJECT_DIR}/avocado-cache ;
 | 
			
		||||
      fi
 | 
			
		||||
    - export AVOCADO_ALLOW_UNTRUSTED_CODE=1
 | 
			
		||||
  after_script:
 | 
			
		||||
    - cd build
 | 
			
		||||
    - du -chs ${CI_PROJECT_DIR}/avocado-cache
 | 
			
		||||
 | 
			
		||||
build-system-alpine:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    - job: amd64-alpine-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: alpine
 | 
			
		||||
    TARGETS: aarch64-softmmu alpha-softmmu cris-softmmu hppa-softmmu
 | 
			
		||||
      moxie-softmmu microblazeel-softmmu mips64el-softmmu
 | 
			
		||||
    MAKE_CHECK_ARGS: check-build
 | 
			
		||||
    CONFIGURE_ARGS: --enable-docs --enable-trace-backends=log,simple,syslog
 | 
			
		||||
  artifacts:
 | 
			
		||||
    expire_in: 2 days
 | 
			
		||||
    paths:
 | 
			
		||||
      - .git-submodule-status
 | 
			
		||||
      - build
 | 
			
		||||
 | 
			
		||||
check-system-alpine:
 | 
			
		||||
  <<: *native_test_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    - job: build-system-alpine
 | 
			
		||||
      artifacts: true
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: alpine
 | 
			
		||||
    MAKE_CHECK_ARGS: check
 | 
			
		||||
 | 
			
		||||
acceptance-system-alpine:
 | 
			
		||||
  <<: *native_test_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    - job: build-system-alpine
 | 
			
		||||
      artifacts: true
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: alpine
 | 
			
		||||
    MAKE_CHECK_ARGS: check-acceptance
 | 
			
		||||
  <<: *acceptance_definition
 | 
			
		||||
 | 
			
		||||
build-system-ubuntu:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-ubuntu2004-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: ubuntu2004
 | 
			
		||||
    CONFIGURE_ARGS: --enable-docs --enable-fdt=system --enable-slirp=system
 | 
			
		||||
    TARGETS: aarch64-softmmu alpha-softmmu cris-softmmu hppa-softmmu
 | 
			
		||||
      moxie-softmmu microblazeel-softmmu mips64el-softmmu
 | 
			
		||||
    MAKE_CHECK_ARGS: check-build
 | 
			
		||||
  artifacts:
 | 
			
		||||
    expire_in: 2 days
 | 
			
		||||
    paths:
 | 
			
		||||
      - build
 | 
			
		||||
 | 
			
		||||
check-system-ubuntu:
 | 
			
		||||
  <<: *native_test_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    - job: build-system-ubuntu
 | 
			
		||||
      artifacts: true
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: ubuntu2004
 | 
			
		||||
    MAKE_CHECK_ARGS: check
 | 
			
		||||
 | 
			
		||||
acceptance-system-ubuntu:
 | 
			
		||||
  <<: *native_test_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    - job: build-system-ubuntu
 | 
			
		||||
      artifacts: true
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: ubuntu2004
 | 
			
		||||
    MAKE_CHECK_ARGS: check-acceptance
 | 
			
		||||
  <<: *acceptance_definition
 | 
			
		||||
 | 
			
		||||
build-system-debian:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-debian-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-amd64
 | 
			
		||||
    CONFIGURE_ARGS: --enable-fdt=system
 | 
			
		||||
    TARGETS: arm-softmmu avr-softmmu i386-softmmu mipsel-softmmu
 | 
			
		||||
      riscv64-softmmu sh4eb-softmmu sparc-softmmu xtensaeb-softmmu
 | 
			
		||||
    MAKE_CHECK_ARGS: check-build
 | 
			
		||||
  artifacts:
 | 
			
		||||
    expire_in: 2 days
 | 
			
		||||
    paths:
 | 
			
		||||
      - build
 | 
			
		||||
 | 
			
		||||
check-system-debian:
 | 
			
		||||
  <<: *native_test_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    - job: build-system-debian
 | 
			
		||||
      artifacts: true
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-amd64
 | 
			
		||||
    MAKE_CHECK_ARGS: check
 | 
			
		||||
 | 
			
		||||
acceptance-system-debian:
 | 
			
		||||
  <<: *native_test_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    - job: build-system-debian
 | 
			
		||||
      artifacts: true
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-amd64
 | 
			
		||||
    MAKE_CHECK_ARGS: check-acceptance
 | 
			
		||||
  <<: *acceptance_definition
 | 
			
		||||
 | 
			
		||||
build-system-fedora:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-fedora-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: fedora
 | 
			
		||||
    CONFIGURE_ARGS: --disable-gcrypt --enable-nettle --enable-docs
 | 
			
		||||
             --enable-fdt=system --enable-slirp=system --enable-capstone=system
 | 
			
		||||
    TARGETS: tricore-softmmu microblaze-softmmu mips-softmmu
 | 
			
		||||
      xtensa-softmmu m68k-softmmu riscv32-softmmu ppc-softmmu sparc64-softmmu
 | 
			
		||||
    MAKE_CHECK_ARGS: check-build
 | 
			
		||||
  artifacts:
 | 
			
		||||
    expire_in: 2 days
 | 
			
		||||
    paths:
 | 
			
		||||
      - build
 | 
			
		||||
 | 
			
		||||
check-system-fedora:
 | 
			
		||||
  <<: *native_test_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    - job: build-system-fedora
 | 
			
		||||
      artifacts: true
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: fedora
 | 
			
		||||
    MAKE_CHECK_ARGS: check
 | 
			
		||||
 | 
			
		||||
acceptance-system-fedora:
 | 
			
		||||
  <<: *native_test_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    - job: build-system-fedora
 | 
			
		||||
      artifacts: true
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: fedora
 | 
			
		||||
    MAKE_CHECK_ARGS: check-acceptance
 | 
			
		||||
  <<: *acceptance_definition
 | 
			
		||||
 | 
			
		||||
build-system-centos:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-centos8-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: centos8
 | 
			
		||||
    CONFIGURE_ARGS: --disable-nettle --enable-gcrypt --enable-fdt=system
 | 
			
		||||
                    --enable-modules
 | 
			
		||||
    TARGETS: ppc64-softmmu or1k-softmmu s390x-softmmu
 | 
			
		||||
      x86_64-softmmu rx-softmmu sh4-softmmu nios2-softmmu
 | 
			
		||||
    MAKE_CHECK_ARGS: check-build
 | 
			
		||||
  artifacts:
 | 
			
		||||
    expire_in: 2 days
 | 
			
		||||
    paths:
 | 
			
		||||
      - build
 | 
			
		||||
 | 
			
		||||
check-system-centos:
 | 
			
		||||
  <<: *native_test_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    - job: build-system-centos
 | 
			
		||||
      artifacts: true
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: centos8
 | 
			
		||||
    MAKE_CHECK_ARGS: check
 | 
			
		||||
 | 
			
		||||
acceptance-system-centos:
 | 
			
		||||
  <<: *native_test_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    - job: build-system-centos
 | 
			
		||||
      artifacts: true
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: centos8
 | 
			
		||||
    MAKE_CHECK_ARGS: check-acceptance
 | 
			
		||||
  <<: *acceptance_definition
 | 
			
		||||
 | 
			
		||||
build-system-opensuse:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-opensuse-leap-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: opensuse-leap
 | 
			
		||||
    CONFIGURE_ARGS: --enable-fdt=system
 | 
			
		||||
    TARGETS: s390x-softmmu x86_64-softmmu aarch64-softmmu
 | 
			
		||||
    MAKE_CHECK_ARGS: check-build
 | 
			
		||||
  artifacts:
 | 
			
		||||
    expire_in: 2 days
 | 
			
		||||
    paths:
 | 
			
		||||
      - build
 | 
			
		||||
 | 
			
		||||
check-system-opensuse:
 | 
			
		||||
  <<: *native_test_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    - job: build-system-opensuse
 | 
			
		||||
      artifacts: true
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: opensuse-leap
 | 
			
		||||
    MAKE_CHECK_ARGS: check
 | 
			
		||||
 | 
			
		||||
acceptance-system-opensuse:
 | 
			
		||||
  <<: *native_test_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    - job: build-system-opensuse
 | 
			
		||||
      artifacts: true
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: opensuse-leap
 | 
			
		||||
    MAKE_CHECK_ARGS: check-acceptance
 | 
			
		||||
  <<: *acceptance_definition
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
build-disabled:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-fedora-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: fedora
 | 
			
		||||
    CONFIGURE_ARGS:
 | 
			
		||||
      --disable-attr
 | 
			
		||||
      --disable-auth-pam
 | 
			
		||||
      --disable-avx2
 | 
			
		||||
      --disable-bochs
 | 
			
		||||
      --disable-brlapi
 | 
			
		||||
      --disable-bzip2
 | 
			
		||||
      --disable-cap-ng
 | 
			
		||||
      --disable-capstone
 | 
			
		||||
      --disable-cloop
 | 
			
		||||
      --disable-coroutine-pool
 | 
			
		||||
      --disable-curl
 | 
			
		||||
      --disable-curses
 | 
			
		||||
      --disable-dmg
 | 
			
		||||
      --disable-docs
 | 
			
		||||
      --disable-gcrypt
 | 
			
		||||
      --disable-glusterfs
 | 
			
		||||
      --disable-gnutls
 | 
			
		||||
      --disable-gtk
 | 
			
		||||
      --disable-guest-agent
 | 
			
		||||
      --disable-iconv
 | 
			
		||||
      --disable-keyring
 | 
			
		||||
      --disable-kvm
 | 
			
		||||
      --disable-libiscsi
 | 
			
		||||
      --disable-libpmem
 | 
			
		||||
      --disable-libssh
 | 
			
		||||
      --disable-libudev
 | 
			
		||||
      --disable-libusb
 | 
			
		||||
      --disable-libxml2
 | 
			
		||||
      --disable-linux-aio
 | 
			
		||||
      --disable-live-block-migration
 | 
			
		||||
      --disable-lzo
 | 
			
		||||
      --disable-malloc-trim
 | 
			
		||||
      --disable-mpath
 | 
			
		||||
      --disable-nettle
 | 
			
		||||
      --disable-numa
 | 
			
		||||
      --disable-opengl
 | 
			
		||||
      --disable-parallels
 | 
			
		||||
      --disable-pie
 | 
			
		||||
      --disable-qcow1
 | 
			
		||||
      --disable-qed
 | 
			
		||||
      --disable-qom-cast-debug
 | 
			
		||||
      --disable-rbd
 | 
			
		||||
      --disable-rdma
 | 
			
		||||
      --disable-replication
 | 
			
		||||
      --disable-sdl
 | 
			
		||||
      --disable-seccomp
 | 
			
		||||
      --disable-sheepdog
 | 
			
		||||
      --disable-slirp
 | 
			
		||||
      --disable-smartcard
 | 
			
		||||
      --disable-snappy
 | 
			
		||||
      --disable-sparse
 | 
			
		||||
      --disable-spice
 | 
			
		||||
      --disable-strip
 | 
			
		||||
      --disable-tpm
 | 
			
		||||
      --disable-usb-redir
 | 
			
		||||
      --disable-vdi
 | 
			
		||||
      --disable-vhost-crypto
 | 
			
		||||
      --disable-vhost-net
 | 
			
		||||
      --disable-vhost-scsi
 | 
			
		||||
      --disable-vhost-kernel
 | 
			
		||||
      --disable-vhost-user
 | 
			
		||||
      --disable-vhost-vdpa
 | 
			
		||||
      --disable-vhost-vsock
 | 
			
		||||
      --disable-virglrenderer
 | 
			
		||||
      --disable-vnc
 | 
			
		||||
      --disable-vte
 | 
			
		||||
      --disable-vvfat
 | 
			
		||||
      --disable-xen
 | 
			
		||||
      --disable-zstd
 | 
			
		||||
    TARGETS: arm-softmmu i386-softmmu ppc64-softmmu mips64-softmmu
 | 
			
		||||
      s390x-softmmu i386-linux-user
 | 
			
		||||
    MAKE_CHECK_ARGS: check-qtest SPEED=slow
 | 
			
		||||
 | 
			
		||||
# This jobs explicitly disable TCG (--disable-tcg), KVM is detected by
 | 
			
		||||
# the configure script. The container doesn't contain Xen headers so
 | 
			
		||||
# Xen accelerator is not detected / selected. As result it build the
 | 
			
		||||
# i386-softmmu and x86_64-softmmu with KVM being the single accelerator
 | 
			
		||||
# available.
 | 
			
		||||
# Also use a different coroutine implementation (which is only really of
 | 
			
		||||
# interest to KVM users, i.e. with TCG disabled)
 | 
			
		||||
build-tcg-disabled:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-centos8-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: centos8
 | 
			
		||||
  script:
 | 
			
		||||
    - mkdir build
 | 
			
		||||
    - cd build
 | 
			
		||||
    - ../configure --disable-tcg --audio-drv-list="" --with-coroutine=ucontext
 | 
			
		||||
      || { cat config.log meson-logs/meson-log.txt && exit 1; }
 | 
			
		||||
    - make -j"$JOBS"
 | 
			
		||||
    - make check-unit
 | 
			
		||||
    - make check-qapi-schema
 | 
			
		||||
    - cd tests/qemu-iotests/
 | 
			
		||||
    - ./check -raw 001 002 003 004 005 008 009 010 011 012 021 025 032 033 048
 | 
			
		||||
            052 063 077 086 101 104 106 113 148 150 151 152 157 159 160 163
 | 
			
		||||
            170 171 183 184 192 194 197 208 215 221 222 226 227 236 253 277
 | 
			
		||||
    - ./check -qcow2 028 051 056 057 058 065 068 082 085 091 095 096 102 122
 | 
			
		||||
            124 132 139 142 144 145 151 152 155 157 165 194 196 197 200 202
 | 
			
		||||
            208 209 215 216 218 222 227 234 246 247 248 250 254 255 257 258
 | 
			
		||||
            260 261 262 263 264 270 272 273 277 279
 | 
			
		||||
 | 
			
		||||
build-user:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-debian-user-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-all-test-cross
 | 
			
		||||
    CONFIGURE_ARGS: --disable-tools --disable-system
 | 
			
		||||
    MAKE_CHECK_ARGS: check-tcg
 | 
			
		||||
 | 
			
		||||
build-user-static:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-debian-user-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-all-test-cross
 | 
			
		||||
    CONFIGURE_ARGS: --disable-tools --disable-system --static
 | 
			
		||||
    MAKE_CHECK_ARGS: check-tcg
 | 
			
		||||
 | 
			
		||||
# Only build the softmmu targets we have check-tcg tests for
 | 
			
		||||
build-some-softmmu:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-debian-user-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-all-test-cross
 | 
			
		||||
    CONFIGURE_ARGS: --disable-tools --enable-debug
 | 
			
		||||
    TARGETS: xtensa-softmmu arm-softmmu aarch64-softmmu alpha-softmmu
 | 
			
		||||
    MAKE_CHECK_ARGS: check-tcg
 | 
			
		||||
 | 
			
		||||
# Run check-tcg against linux-user (with plugins)
 | 
			
		||||
# we skip sparc64-linux-user until it has been fixed somewhat
 | 
			
		||||
# we skip cris-linux-user as it doesn't use the common run loop
 | 
			
		||||
build-user-plugins:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-debian-user-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-all-test-cross
 | 
			
		||||
    CONFIGURE_ARGS: --disable-tools --disable-system --enable-plugins --enable-debug-tcg --target-list-exclude=sparc64-linux-user,cris-linux-user
 | 
			
		||||
    MAKE_CHECK_ARGS: check-tcg
 | 
			
		||||
  timeout: 1h 30m
 | 
			
		||||
 | 
			
		||||
build-user-centos7:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-centos7-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: centos7
 | 
			
		||||
    CONFIGURE_ARGS: --disable-system --disable-tools --disable-docs
 | 
			
		||||
    MAKE_CHECK_ARGS: check-tcg
 | 
			
		||||
 | 
			
		||||
build-some-softmmu-plugins:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-debian-user-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-all-test-cross
 | 
			
		||||
    CONFIGURE_ARGS: --disable-tools --disable-user --enable-plugins --enable-debug-tcg
 | 
			
		||||
    TARGETS: xtensa-softmmu arm-softmmu aarch64-softmmu alpha-softmmu
 | 
			
		||||
    MAKE_CHECK_ARGS: check-tcg
 | 
			
		||||
 | 
			
		||||
clang-system:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-fedora-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: fedora
 | 
			
		||||
    CONFIGURE_ARGS: --cc=clang --cxx=clang++
 | 
			
		||||
      --extra-cflags=-fsanitize=undefined --extra-cflags=-fno-sanitize-recover=undefined
 | 
			
		||||
    TARGETS: alpha-softmmu arm-softmmu m68k-softmmu mips64-softmmu
 | 
			
		||||
      ppc-softmmu s390x-softmmu
 | 
			
		||||
    MAKE_CHECK_ARGS: check-qtest check-tcg
 | 
			
		||||
 | 
			
		||||
clang-user:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-debian-user-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-all-test-cross
 | 
			
		||||
    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --disable-system
 | 
			
		||||
      --target-list-exclude=microblazeel-linux-user,aarch64_be-linux-user,i386-linux-user,m68k-linux-user,mipsn32el-linux-user,xtensaeb-linux-user
 | 
			
		||||
      --extra-cflags=-fsanitize=undefined --extra-cflags=-fno-sanitize-recover=undefined
 | 
			
		||||
    MAKE_CHECK_ARGS: check-unit check-tcg
 | 
			
		||||
 | 
			
		||||
# Set LD_JOBS=1 because this requires LTO and ld consumes a large amount of memory.
 | 
			
		||||
# On gitlab runners, default value sometimes end up calling 2 lds concurrently and
 | 
			
		||||
# triggers an Out-Of-Memory error
 | 
			
		||||
#
 | 
			
		||||
# Since slirp callbacks are used in QEMU Timers, slirp needs to be compiled together
 | 
			
		||||
# with QEMU and linked as a static library to avoid false positives in CFI checks.
 | 
			
		||||
# This can be accomplished by using -enable-slirp=git, which avoids the use of
 | 
			
		||||
# a system-wide version of the library
 | 
			
		||||
#
 | 
			
		||||
# Split in three sets of build/check/acceptance to limit the execution time of each
 | 
			
		||||
# job
 | 
			
		||||
build-cfi-aarch64:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
  - job: amd64-fedora-container
 | 
			
		||||
  variables:
 | 
			
		||||
    LD_JOBS: 1
 | 
			
		||||
    AR: llvm-ar
 | 
			
		||||
    IMAGE: fedora
 | 
			
		||||
    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
 | 
			
		||||
      --enable-safe-stack --enable-slirp=git
 | 
			
		||||
    TARGETS: aarch64-softmmu
 | 
			
		||||
    MAKE_CHECK_ARGS: check-build
 | 
			
		||||
  timeout: 70m
 | 
			
		||||
  artifacts:
 | 
			
		||||
    expire_in: 2 days
 | 
			
		||||
    paths:
 | 
			
		||||
      - build
 | 
			
		||||
 | 
			
		||||
check-cfi-aarch64:
 | 
			
		||||
  <<: *native_test_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    - job: build-cfi-aarch64
 | 
			
		||||
      artifacts: true
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: fedora
 | 
			
		||||
    MAKE_CHECK_ARGS: check
 | 
			
		||||
 | 
			
		||||
acceptance-cfi-aarch64:
 | 
			
		||||
  <<: *native_test_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    - job: build-cfi-aarch64
 | 
			
		||||
      artifacts: true
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: fedora
 | 
			
		||||
    MAKE_CHECK_ARGS: check-acceptance
 | 
			
		||||
  <<: *acceptance_definition
 | 
			
		||||
 | 
			
		||||
build-cfi-ppc64-s390x:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
  - job: amd64-fedora-container
 | 
			
		||||
  variables:
 | 
			
		||||
    LD_JOBS: 1
 | 
			
		||||
    AR: llvm-ar
 | 
			
		||||
    IMAGE: fedora
 | 
			
		||||
    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
 | 
			
		||||
      --enable-safe-stack --enable-slirp=git
 | 
			
		||||
    TARGETS: ppc64-softmmu s390x-softmmu
 | 
			
		||||
    MAKE_CHECK_ARGS: check-build
 | 
			
		||||
  timeout: 70m
 | 
			
		||||
  artifacts:
 | 
			
		||||
    expire_in: 2 days
 | 
			
		||||
    paths:
 | 
			
		||||
      - build
 | 
			
		||||
 | 
			
		||||
check-cfi-ppc64-s390x:
 | 
			
		||||
  <<: *native_test_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    - job: build-cfi-ppc64-s390x
 | 
			
		||||
      artifacts: true
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: fedora
 | 
			
		||||
    MAKE_CHECK_ARGS: check
 | 
			
		||||
 | 
			
		||||
acceptance-cfi-ppc64-s390x:
 | 
			
		||||
  <<: *native_test_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    - job: build-cfi-ppc64-s390x
 | 
			
		||||
      artifacts: true
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: fedora
 | 
			
		||||
    MAKE_CHECK_ARGS: check-acceptance
 | 
			
		||||
  <<: *acceptance_definition
 | 
			
		||||
 | 
			
		||||
build-cfi-x86_64:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
  - job: amd64-fedora-container
 | 
			
		||||
  variables:
 | 
			
		||||
    LD_JOBS: 1
 | 
			
		||||
    AR: llvm-ar
 | 
			
		||||
    IMAGE: fedora
 | 
			
		||||
    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
 | 
			
		||||
      --enable-safe-stack --enable-slirp=git
 | 
			
		||||
    TARGETS: x86_64-softmmu
 | 
			
		||||
    MAKE_CHECK_ARGS: check-build
 | 
			
		||||
  timeout: 70m
 | 
			
		||||
  artifacts:
 | 
			
		||||
    expire_in: 2 days
 | 
			
		||||
    paths:
 | 
			
		||||
      - build
 | 
			
		||||
 | 
			
		||||
check-cfi-x86_64:
 | 
			
		||||
  <<: *native_test_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    - job: build-cfi-x86_64
 | 
			
		||||
      artifacts: true
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: fedora
 | 
			
		||||
    MAKE_CHECK_ARGS: check
 | 
			
		||||
 | 
			
		||||
acceptance-cfi-x86_64:
 | 
			
		||||
  <<: *native_test_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    - job: build-cfi-x86_64
 | 
			
		||||
      artifacts: true
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: fedora
 | 
			
		||||
    MAKE_CHECK_ARGS: check-acceptance
 | 
			
		||||
  <<: *acceptance_definition
 | 
			
		||||
 | 
			
		||||
tsan-build:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-ubuntu2004-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: ubuntu2004
 | 
			
		||||
    CONFIGURE_ARGS: --enable-tsan --cc=clang-10 --cxx=clang++-10
 | 
			
		||||
          --enable-trace-backends=ust --enable-fdt=system --enable-slirp=system
 | 
			
		||||
    TARGETS: x86_64-softmmu ppc64-softmmu riscv64-softmmu x86_64-linux-user
 | 
			
		||||
    MAKE_CHECK_ARGS: bench V=1
 | 
			
		||||
 | 
			
		||||
# These targets are on the way out
 | 
			
		||||
build-deprecated:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-debian-user-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-all-test-cross
 | 
			
		||||
    CONFIGURE_ARGS: --disable-tools
 | 
			
		||||
    MAKE_CHECK_ARGS: build-tcg
 | 
			
		||||
    TARGETS: ppc64abi32-linux-user lm32-softmmu unicore32-softmmu
 | 
			
		||||
  artifacts:
 | 
			
		||||
    expire_in: 2 days
 | 
			
		||||
    paths:
 | 
			
		||||
      - build
 | 
			
		||||
 | 
			
		||||
# We split the check-tcg step as test failures are expected but we still
 | 
			
		||||
# want to catch the build breaking.
 | 
			
		||||
check-deprecated:
 | 
			
		||||
  <<: *native_test_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    - job: build-deprecated
 | 
			
		||||
      artifacts: true
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-all-test-cross
 | 
			
		||||
    MAKE_CHECK_ARGS: check-tcg
 | 
			
		||||
  allow_failure: true
 | 
			
		||||
 | 
			
		||||
# gprof/gcov are GCC features
 | 
			
		||||
gprof-gcov:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-ubuntu2004-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: ubuntu2004
 | 
			
		||||
    CONFIGURE_ARGS: --enable-gprof --enable-gcov
 | 
			
		||||
    MAKE_CHECK_ARGS: check
 | 
			
		||||
    TARGETS: aarch64-softmmu ppc64-softmmu s390x-softmmu x86_64-softmmu
 | 
			
		||||
  timeout: 70m
 | 
			
		||||
  after_script:
 | 
			
		||||
    - ${CI_PROJECT_DIR}/scripts/ci/coverage-summary.sh
 | 
			
		||||
 | 
			
		||||
build-oss-fuzz:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-fedora-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: fedora
 | 
			
		||||
  script:
 | 
			
		||||
    - mkdir build-oss-fuzz
 | 
			
		||||
    - CC="clang" CXX="clang++" CFLAGS="-fsanitize=address"
 | 
			
		||||
      ./scripts/oss-fuzz/build.sh
 | 
			
		||||
    - export ASAN_OPTIONS="fast_unwind_on_malloc=0"
 | 
			
		||||
    - for fuzzer in $(find ./build-oss-fuzz/DEST_DIR/ -executable -type f
 | 
			
		||||
                      | grep -v slirp); do
 | 
			
		||||
        grep "LLVMFuzzerTestOneInput" ${fuzzer} > /dev/null 2>&1 || continue ;
 | 
			
		||||
        echo Testing ${fuzzer} ... ;
 | 
			
		||||
        "${fuzzer}" -runs=1 -seed=1 || exit 1 ;
 | 
			
		||||
      done
 | 
			
		||||
    # Unrelated to fuzzer: run some tests with -fsanitize=address
 | 
			
		||||
    - cd build-oss-fuzz && make check-qtest-i386 check-unit
 | 
			
		||||
 | 
			
		||||
build-tci:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-debian-user-cross-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-all-test-cross
 | 
			
		||||
  script:
 | 
			
		||||
    - TARGETS="aarch64 alpha arm hppa m68k microblaze moxie ppc64 s390x x86_64"
 | 
			
		||||
    - mkdir build
 | 
			
		||||
    - cd build
 | 
			
		||||
    - ../configure --enable-tcg-interpreter
 | 
			
		||||
        --target-list="$(for tg in $TARGETS; do echo -n ${tg}'-softmmu '; done)" || { cat config.log meson-logs/meson-log.txt && exit 1; }
 | 
			
		||||
    - make -j"$JOBS"
 | 
			
		||||
    - make tests/qtest/boot-serial-test tests/qtest/cdrom-test tests/qtest/pxe-test
 | 
			
		||||
    - for tg in $TARGETS ; do
 | 
			
		||||
        export QTEST_QEMU_BINARY="./qemu-system-${tg}" ;
 | 
			
		||||
        ./tests/qtest/boot-serial-test || exit 1 ;
 | 
			
		||||
        ./tests/qtest/cdrom-test || exit 1 ;
 | 
			
		||||
      done
 | 
			
		||||
    - QTEST_QEMU_BINARY="./qemu-system-x86_64" ./tests/qtest/pxe-test
 | 
			
		||||
    - QTEST_QEMU_BINARY="./qemu-system-s390x" ./tests/qtest/pxe-test -m slow
 | 
			
		||||
    - make check-tcg
 | 
			
		||||
 | 
			
		||||
# Alternate coroutines implementations are only really of interest to KVM users
 | 
			
		||||
# However we can't test against KVM on Gitlab-CI so we can only run unit tests
 | 
			
		||||
build-coroutine-sigaltstack:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-ubuntu2004-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: ubuntu2004
 | 
			
		||||
    CONFIGURE_ARGS: --with-coroutine=sigaltstack --disable-tcg
 | 
			
		||||
                    --enable-trace-backends=ftrace
 | 
			
		||||
    MAKE_CHECK_ARGS: check-unit
 | 
			
		||||
 | 
			
		||||
# Most jobs test latest gcrypt or nettle builds
 | 
			
		||||
#
 | 
			
		||||
# These jobs test old gcrypt and nettle from RHEL7
 | 
			
		||||
# which had some API differences.
 | 
			
		||||
crypto-old-nettle:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-centos7-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: centos7
 | 
			
		||||
    TARGETS: x86_64-softmmu x86_64-linux-user
 | 
			
		||||
    CONFIGURE_ARGS: --disable-gcrypt --enable-nettle
 | 
			
		||||
    MAKE_CHECK_ARGS: check
 | 
			
		||||
 | 
			
		||||
crypto-old-gcrypt:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-centos7-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: centos7
 | 
			
		||||
    TARGETS: x86_64-softmmu x86_64-linux-user
 | 
			
		||||
    CONFIGURE_ARGS: --disable-nettle --enable-gcrypt
 | 
			
		||||
    MAKE_CHECK_ARGS: check
 | 
			
		||||
 | 
			
		||||
crypto-only-gnutls:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-centos7-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: centos7
 | 
			
		||||
    TARGETS: x86_64-softmmu x86_64-linux-user
 | 
			
		||||
    CONFIGURE_ARGS: --disable-nettle --disable-gcrypt --enable-gnutls
 | 
			
		||||
    MAKE_CHECK_ARGS: check
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Check our reduced build configurations
 | 
			
		||||
build-without-default-devices:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-centos8-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: centos8
 | 
			
		||||
    CONFIGURE_ARGS: --without-default-devices --disable-user
 | 
			
		||||
 | 
			
		||||
build-without-default-features:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-debian-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-amd64
 | 
			
		||||
    CONFIGURE_ARGS: --without-default-features --disable-user
 | 
			
		||||
        --target-list-exclude=arm-softmmu,i386-softmmu,mipsel-softmmu,mips64-softmmu,ppc-softmmu
 | 
			
		||||
    MAKE_CHECK_ARGS: check-unit
 | 
			
		||||
 | 
			
		||||
check-patch:
 | 
			
		||||
  stage: build
 | 
			
		||||
  image: $CI_REGISTRY_IMAGE/qemu/centos8:latest
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-centos8-container
 | 
			
		||||
  script: .gitlab-ci.d/check-patch.py
 | 
			
		||||
  except:
 | 
			
		||||
    variables:
 | 
			
		||||
      - $CI_PROJECT_NAMESPACE == 'qemu-project' && $CI_COMMIT_BRANCH == 'master'
 | 
			
		||||
  variables:
 | 
			
		||||
    GIT_DEPTH: 1000
 | 
			
		||||
  allow_failure: true
 | 
			
		||||
 | 
			
		||||
check-dco:
 | 
			
		||||
  stage: build
 | 
			
		||||
  image: $CI_REGISTRY_IMAGE/qemu/centos8:latest
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-centos8-container
 | 
			
		||||
  script: .gitlab-ci.d/check-dco.py
 | 
			
		||||
  except:
 | 
			
		||||
    variables:
 | 
			
		||||
      - $CI_PROJECT_NAMESPACE == 'qemu-project' && $CI_COMMIT_BRANCH == 'master'
 | 
			
		||||
  variables:
 | 
			
		||||
    GIT_DEPTH: 1000
 | 
			
		||||
 | 
			
		||||
build-libvhost-user:
 | 
			
		||||
  stage: build
 | 
			
		||||
  image: $CI_REGISTRY_IMAGE/qemu/fedora:latest
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-fedora-container
 | 
			
		||||
  before_script:
 | 
			
		||||
    - dnf install -y meson ninja-build
 | 
			
		||||
  script:
 | 
			
		||||
    - mkdir subprojects/libvhost-user/build
 | 
			
		||||
    - cd subprojects/libvhost-user/build
 | 
			
		||||
    - meson
 | 
			
		||||
    - ninja
 | 
			
		||||
 | 
			
		||||
# No targets are built here, just tools, docs, and unit tests. This
 | 
			
		||||
# also feeds into the eventual documentation deployment steps later
 | 
			
		||||
build-tools-and-docs-debian:
 | 
			
		||||
  <<: *native_build_job_definition
 | 
			
		||||
  needs:
 | 
			
		||||
    job: amd64-debian-container
 | 
			
		||||
  variables:
 | 
			
		||||
    IMAGE: debian-amd64
 | 
			
		||||
    MAKE_CHECK_ARGS: check-unit check-softfloat ctags TAGS cscope
 | 
			
		||||
    CONFIGURE_ARGS: --disable-system --disable-user --enable-docs --enable-tools
 | 
			
		||||
  artifacts:
 | 
			
		||||
    expire_in: 2 days
 | 
			
		||||
    paths:
 | 
			
		||||
      - build
 | 
			
		||||
 | 
			
		||||
# Prepare for GitLab pages deployment. Anything copied into the
 | 
			
		||||
# "public" directory will be deployed to $USER.gitlab.io/$PROJECT
 | 
			
		||||
pages:
 | 
			
		||||
  image: $CI_REGISTRY_IMAGE/qemu/debian-amd64:latest
 | 
			
		||||
  stage: test
 | 
			
		||||
  needs:
 | 
			
		||||
    - job: build-tools-and-docs-debian
 | 
			
		||||
  script:
 | 
			
		||||
    - mkdir -p public
 | 
			
		||||
    # HTML-ised source tree
 | 
			
		||||
    - make gtags
 | 
			
		||||
    - htags -anT --tree-view=filetree -m qemu_init
 | 
			
		||||
        -t "Welcome to the QEMU sourcecode"
 | 
			
		||||
    - mv HTML public/src
 | 
			
		||||
    # Project documentation
 | 
			
		||||
    - make -C build install DESTDIR=$(pwd)/temp-install
 | 
			
		||||
    - mv temp-install/usr/local/share/doc/qemu/* public/
 | 
			
		||||
  artifacts:
 | 
			
		||||
    paths:
 | 
			
		||||
      - public
 | 
			
		||||
							
								
								
									
										66
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										66
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							@@ -1,66 +0,0 @@
 | 
			
		||||
[submodule "roms/seabios"]
 | 
			
		||||
	path = roms/seabios
 | 
			
		||||
	url = https://gitlab.com/qemu-project/seabios.git/
 | 
			
		||||
[submodule "roms/SLOF"]
 | 
			
		||||
	path = roms/SLOF
 | 
			
		||||
	url = https://gitlab.com/qemu-project/SLOF.git
 | 
			
		||||
[submodule "roms/ipxe"]
 | 
			
		||||
	path = roms/ipxe
 | 
			
		||||
	url = https://gitlab.com/qemu-project/ipxe.git
 | 
			
		||||
[submodule "roms/openbios"]
 | 
			
		||||
	path = roms/openbios
 | 
			
		||||
	url = https://gitlab.com/qemu-project/openbios.git
 | 
			
		||||
[submodule "roms/qemu-palcode"]
 | 
			
		||||
	path = roms/qemu-palcode
 | 
			
		||||
	url = https://gitlab.com/qemu-project/qemu-palcode.git
 | 
			
		||||
[submodule "roms/sgabios"]
 | 
			
		||||
	path = roms/sgabios
 | 
			
		||||
	url = https://gitlab.com/qemu-project/sgabios.git
 | 
			
		||||
[submodule "dtc"]
 | 
			
		||||
	path = dtc
 | 
			
		||||
	url = https://gitlab.com/qemu-project/dtc.git
 | 
			
		||||
[submodule "roms/u-boot"]
 | 
			
		||||
	path = roms/u-boot
 | 
			
		||||
	url = https://gitlab.com/qemu-project/u-boot.git
 | 
			
		||||
[submodule "roms/skiboot"]
 | 
			
		||||
	path = roms/skiboot
 | 
			
		||||
	url = https://gitlab.com/qemu-project/skiboot.git
 | 
			
		||||
[submodule "roms/QemuMacDrivers"]
 | 
			
		||||
	path = roms/QemuMacDrivers
 | 
			
		||||
	url = https://gitlab.com/qemu-project/QemuMacDrivers.git
 | 
			
		||||
[submodule "ui/keycodemapdb"]
 | 
			
		||||
	path = ui/keycodemapdb
 | 
			
		||||
	url = https://gitlab.com/qemu-project/keycodemapdb.git
 | 
			
		||||
[submodule "capstone"]
 | 
			
		||||
	path = capstone
 | 
			
		||||
	url = https://gitlab.com/qemu-project/capstone.git
 | 
			
		||||
[submodule "roms/seabios-hppa"]
 | 
			
		||||
	path = roms/seabios-hppa
 | 
			
		||||
	url = https://gitlab.com/qemu-project/seabios-hppa.git
 | 
			
		||||
[submodule "roms/u-boot-sam460ex"]
 | 
			
		||||
	path = roms/u-boot-sam460ex
 | 
			
		||||
	url = https://gitlab.com/qemu-project/u-boot-sam460ex.git
 | 
			
		||||
[submodule "tests/fp/berkeley-testfloat-3"]
 | 
			
		||||
	path = tests/fp/berkeley-testfloat-3
 | 
			
		||||
	url = https://gitlab.com/qemu-project/berkeley-testfloat-3.git
 | 
			
		||||
[submodule "tests/fp/berkeley-softfloat-3"]
 | 
			
		||||
	path = tests/fp/berkeley-softfloat-3
 | 
			
		||||
	url = https://gitlab.com/qemu-project/berkeley-softfloat-3.git
 | 
			
		||||
[submodule "roms/edk2"]
 | 
			
		||||
	path = roms/edk2
 | 
			
		||||
	url = https://gitlab.com/qemu-project/edk2.git
 | 
			
		||||
[submodule "slirp"]
 | 
			
		||||
	path = slirp
 | 
			
		||||
	url = https://gitlab.com/qemu-project/libslirp.git
 | 
			
		||||
[submodule "roms/opensbi"]
 | 
			
		||||
	path = roms/opensbi
 | 
			
		||||
	url = 	https://gitlab.com/qemu-project/opensbi.git
 | 
			
		||||
[submodule "roms/qboot"]
 | 
			
		||||
	path = roms/qboot
 | 
			
		||||
	url = https://gitlab.com/qemu-project/qboot.git
 | 
			
		||||
[submodule "meson"]
 | 
			
		||||
	path = meson
 | 
			
		||||
	url = https://gitlab.com/qemu-project/meson.git
 | 
			
		||||
[submodule "roms/vbootrom"]
 | 
			
		||||
	path = roms/vbootrom
 | 
			
		||||
	url = https://gitlab.com/qemu-project/vbootrom.git
 | 
			
		||||
							
								
								
									
										51
									
								
								.gitpublish
									
									
									
									
									
								
							
							
						
						
									
										51
									
								
								.gitpublish
									
									
									
									
									
								
							@@ -1,51 +0,0 @@
 | 
			
		||||
#
 | 
			
		||||
# Common git-publish profiles that can be used to send patches to QEMU upstream.
 | 
			
		||||
#
 | 
			
		||||
# See https://github.com/stefanha/git-publish for more information
 | 
			
		||||
#
 | 
			
		||||
[gitpublishprofile "default"]
 | 
			
		||||
base = master
 | 
			
		||||
to = qemu-devel@nongnu.org
 | 
			
		||||
cccmd = scripts/get_maintainer.pl --noroles --norolestats --nogit --nogit-fallback 2>/dev/null
 | 
			
		||||
 | 
			
		||||
[gitpublishprofile "rfc"]
 | 
			
		||||
base = master
 | 
			
		||||
prefix = RFC PATCH
 | 
			
		||||
to = qemu-devel@nongnu.org
 | 
			
		||||
cccmd = scripts/get_maintainer.pl --noroles --norolestats --nogit --nogit-fallback 2>/dev/null
 | 
			
		||||
 | 
			
		||||
[gitpublishprofile "stable"]
 | 
			
		||||
base = master
 | 
			
		||||
to = qemu-devel@nongnu.org
 | 
			
		||||
cc = qemu-stable@nongnu.org
 | 
			
		||||
cccmd = scripts/get_maintainer.pl --noroles --norolestats --nogit --nogit-fallback 2>/dev/null
 | 
			
		||||
 | 
			
		||||
[gitpublishprofile "trivial"]
 | 
			
		||||
base = master
 | 
			
		||||
to = qemu-devel@nongnu.org
 | 
			
		||||
cc = qemu-trivial@nongnu.org
 | 
			
		||||
cccmd = scripts/get_maintainer.pl --noroles --norolestats --nogit --nogit-fallback 2>/dev/null
 | 
			
		||||
 | 
			
		||||
[gitpublishprofile "block"]
 | 
			
		||||
base = master
 | 
			
		||||
to = qemu-devel@nongnu.org
 | 
			
		||||
cc = qemu-block@nongnu.org
 | 
			
		||||
cccmd = scripts/get_maintainer.pl --noroles --norolestats --nogit --nogit-fallback 2>/dev/null
 | 
			
		||||
 | 
			
		||||
[gitpublishprofile "arm"]
 | 
			
		||||
base = master
 | 
			
		||||
to = qemu-devel@nongnu.org
 | 
			
		||||
cc = qemu-arm@nongnu.org
 | 
			
		||||
cccmd = scripts/get_maintainer.pl --noroles --norolestats --nogit --nogit-fallback 2>/dev/null
 | 
			
		||||
 | 
			
		||||
[gitpublishprofile "s390"]
 | 
			
		||||
base = master
 | 
			
		||||
to = qemu-devel@nongnu.org
 | 
			
		||||
cc = qemu-s390@nongnu.org
 | 
			
		||||
cccmd = scripts/get_maintainer.pl --noroles --norolestats --nogit --nogit-fallback 2>/dev/null
 | 
			
		||||
 | 
			
		||||
[gitpublishprofile "ppc"]
 | 
			
		||||
base = master
 | 
			
		||||
to = qemu-devel@nongnu.org
 | 
			
		||||
cc = qemu-ppc@nongnu.org
 | 
			
		||||
cccmd = scripts/get_maintainer.pl --noroles --norolestats --nogit --nogit-fallback 2>/dev/null
 | 
			
		||||
							
								
								
									
										175
									
								
								.mailmap
									
									
									
									
									
								
							
							
						
						
									
										175
									
								
								.mailmap
									
									
									
									
									
								
							@@ -1,175 +0,0 @@
 | 
			
		||||
# This mailmap fixes up author names/addresses.
 | 
			
		||||
#
 | 
			
		||||
# If you are adding to this file consider if a similar change needs to
 | 
			
		||||
# be made to contrib/gitdm/aliases. They are not however completely
 | 
			
		||||
# analogous. .mailmap is concerned with fixing up damaged author
 | 
			
		||||
# fields where as the gitdm equivalent is more concerned with making
 | 
			
		||||
# sure multiple email addresses get mapped onto the same author.
 | 
			
		||||
#
 | 
			
		||||
# From man git-shortlog the forms are:
 | 
			
		||||
#
 | 
			
		||||
#  Proper Name <commit@email.xx>
 | 
			
		||||
#  <proper@email.xx> <commit@email.xx>
 | 
			
		||||
#  Proper Name <proper@email.xx> <commit@email.xx>
 | 
			
		||||
#  Proper Name <proper@email.xx> Commit Name <commit@email.xx>
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
# The first section translates weird addresses from the original git import
 | 
			
		||||
# into proper addresses so that they are counted properly by git shortlog.
 | 
			
		||||
Andrzej Zaborowski <balrogg@gmail.com> balrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>
 | 
			
		||||
Anthony Liguori <anthony@codemonkey.ws> aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>
 | 
			
		||||
Aurelien Jarno <aurelien@aurel32.net> aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>
 | 
			
		||||
Blue Swirl <blauwirbel@gmail.com> blueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>
 | 
			
		||||
Edgar E. Iglesias <edgar.iglesias@gmail.com> edgar_igl <edgar_igl@c046a42c-6fe2-441c-8c8c-71466251a162>
 | 
			
		||||
Fabrice Bellard <fabrice@bellard.org> bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
 | 
			
		||||
Jocelyn Mayer <l_indien@magic.fr> j_mayer <j_mayer@c046a42c-6fe2-441c-8c8c-71466251a162>
 | 
			
		||||
Paul Brook <paul@codesourcery.com> pbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>
 | 
			
		||||
Thiemo Seufer <ths@networkno.de> ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>
 | 
			
		||||
malc <av1474@comtv.ru> malc <malc@c046a42c-6fe2-441c-8c8c-71466251a162>
 | 
			
		||||
 | 
			
		||||
# There is also a:
 | 
			
		||||
#    (no author) <(no author)@c046a42c-6fe2-441c-8c8c-71466251a162>
 | 
			
		||||
# for the cvs2svn initialization commit e63c3dc74bf.
 | 
			
		||||
 | 
			
		||||
# Next, translate a few commits where mailman rewrote the From: line due
 | 
			
		||||
# to strict SPF, although we prefer to avoid adding more entries like that.
 | 
			
		||||
Ed Swierk <eswierk@skyportsystems.com> Ed Swierk via Qemu-devel <qemu-devel@nongnu.org>
 | 
			
		||||
Ian McKellar <ianloic@google.com> Ian McKellar via Qemu-devel <qemu-devel@nongnu.org>
 | 
			
		||||
Julia Suvorova <jusual@mail.ru> Julia Suvorova via Qemu-devel <qemu-devel@nongnu.org>
 | 
			
		||||
Justin Terry (VM) <juterry@microsoft.com> Justin Terry (VM) via Qemu-devel <qemu-devel@nongnu.org>
 | 
			
		||||
 | 
			
		||||
# Next, replace old addresses by a more recent one.
 | 
			
		||||
Aleksandar Markovic <aleksandar.qemu.devel@gmail.com> <aleksandar.markovic@mips.com>
 | 
			
		||||
Aleksandar Markovic <aleksandar.qemu.devel@gmail.com> <aleksandar.markovic@imgtec.com>
 | 
			
		||||
Aleksandar Markovic <aleksandar.qemu.devel@gmail.com> <amarkovic@wavecomp.com>
 | 
			
		||||
Aleksandar Rikalo <aleksandar.rikalo@syrmia.com> <arikalo@wavecomp.com>
 | 
			
		||||
Aleksandar Rikalo <aleksandar.rikalo@syrmia.com> <aleksandar.rikalo@rt-rk.com>
 | 
			
		||||
Alexander Graf <agraf@csgraf.de> <agraf@suse.de>
 | 
			
		||||
Anthony Liguori <anthony@codemonkey.ws> Anthony Liguori <aliguori@us.ibm.com>
 | 
			
		||||
Filip Bozuta <filip.bozuta@syrmia.com> <filip.bozuta@rt-rk.com.com>
 | 
			
		||||
Frederic Konrad <konrad@adacore.com> <fred.konrad@greensocs.com>
 | 
			
		||||
Greg Kurz <groug@kaod.org> <gkurz@linux.vnet.ibm.com>
 | 
			
		||||
Huacai Chen <chenhuacai@kernel.org> <chenhc@lemote.com>
 | 
			
		||||
Huacai Chen <chenhuacai@kernel.org> <chenhuacai@loongson.cn>
 | 
			
		||||
James Hogan <jhogan@kernel.org> <james.hogan@imgtec.com>
 | 
			
		||||
Leif Lindholm <leif@nuviainc.com> <leif.lindholm@linaro.org>
 | 
			
		||||
Radoslaw Biernacki <rad@semihalf.com> <radoslaw.biernacki@linaro.org>
 | 
			
		||||
Paul Burton <paulburton@kernel.org> <paul.burton@mips.com>
 | 
			
		||||
Paul Burton <paulburton@kernel.org> <paul.burton@imgtec.com>
 | 
			
		||||
Paul Burton <paulburton@kernel.org> <paul@archlinuxmips.org>
 | 
			
		||||
Paul Burton <paulburton@kernel.org> <pburton@wavecomp.com>
 | 
			
		||||
Stefan Brankovic <stefan.brankovic@syrmia.com> <stefan.brankovic@rt-rk.com.com>
 | 
			
		||||
Yongbok Kim <yongbok.kim@mips.com> <yongbok.kim@imgtec.com>
 | 
			
		||||
 | 
			
		||||
# Also list preferred name forms where people have changed their
 | 
			
		||||
# git author config, or had utf8/latin1 encoding issues.
 | 
			
		||||
Aaron Lindsay <aaron@os.amperecomputing.com>
 | 
			
		||||
Alexey Gerasimenko <x1917x@gmail.com>
 | 
			
		||||
Alex Ivanov <void@aleksoft.net>
 | 
			
		||||
Andreas Färber <afaerber@suse.de>
 | 
			
		||||
Bandan Das <bsd@redhat.com>
 | 
			
		||||
Benjamin MARSILI <mlspirat42@gmail.com>
 | 
			
		||||
Benoît Canet <benoit.canet@gmail.com>
 | 
			
		||||
Benoît Canet <benoit.canet@irqsave.net>
 | 
			
		||||
Benoît Canet <benoit.canet@nodalink.com>
 | 
			
		||||
Boqun Feng <boqun.feng@gmail.com>
 | 
			
		||||
Boqun Feng <boqun.feng@intel.com>
 | 
			
		||||
Brad Smith <brad@comstyle.com>
 | 
			
		||||
Brijesh Singh <brijesh.singh@amd.com>
 | 
			
		||||
Brilly Wu <brillywu@viatech.com.cn>
 | 
			
		||||
Cédric Vincent <cedric.vincent@st.com>
 | 
			
		||||
CheneyLin <linzc@zju.edu.cn>
 | 
			
		||||
Chen Gang <chengang@emindsoft.com.cn>
 | 
			
		||||
Chen Gang <gang.chen.5i5j@gmail.com>
 | 
			
		||||
Chen Gang <gang.chen@sunrus.com.cn>
 | 
			
		||||
Chen Wei-Ren <chenwj@iis.sinica.edu.tw>
 | 
			
		||||
Christophe Lyon <christophe.lyon@st.com>
 | 
			
		||||
Collin L. Walling <walling@linux.ibm.com>
 | 
			
		||||
Daniel P. Berrangé <berrange@redhat.com>
 | 
			
		||||
Eduardo Otubo <otubo@redhat.com>
 | 
			
		||||
Erik Smit <erik.lucas.smit@gmail.com>
 | 
			
		||||
Fabrice Desclaux <fabrice.desclaux@cea.fr>
 | 
			
		||||
Fernando Luis Vázquez Cao <fernando_b1@lab.ntt.co.jp>
 | 
			
		||||
Fernando Luis Vázquez Cao <fernando@oss.ntt.co.jp>
 | 
			
		||||
Gautham R. Shenoy <ego@in.ibm.com>
 | 
			
		||||
Gautham R. Shenoy <ego@linux.vnet.ibm.com>
 | 
			
		||||
Gonglei (Arei) <arei.gonglei@huawei.com>
 | 
			
		||||
Guang Wang <wang.guang55@zte.com.cn>
 | 
			
		||||
Hailiang Zhang <zhang.zhanghailiang@huawei.com>
 | 
			
		||||
Hervé Poussineau <hpoussin@reactos.org>
 | 
			
		||||
Jakub Jermář <jakub@jermar.eu>
 | 
			
		||||
Jakub Jermář <jakub.jermar@kernkonzept.com>
 | 
			
		||||
Jean-Christophe Dubois <jcd@tribudubois.net>
 | 
			
		||||
Jindřich Makovička <makovick@gmail.com>
 | 
			
		||||
John Arbuckle <programmingkidx@gmail.com>
 | 
			
		||||
Juha Riihimäki <juha.riihimaki@nokia.com>
 | 
			
		||||
Juha Riihimäki <Juha.Riihimaki@nokia.com>
 | 
			
		||||
Jun Li <junmuzi@gmail.com>
 | 
			
		||||
Laurent Vivier <Laurent@lvivier.info>
 | 
			
		||||
Leandro Lupori <leandro.lupori@gmail.com>
 | 
			
		||||
Li Guang <lig.fnst@cn.fujitsu.com>
 | 
			
		||||
Liming Wang <walimisdev@gmail.com>
 | 
			
		||||
linzhecheng <linzc@zju.edu.cn>
 | 
			
		||||
Liran Schour <lirans@il.ibm.com>
 | 
			
		||||
Liu Yu <yu.liu@freescale.com>
 | 
			
		||||
Liu Yu <Yu.Liu@freescale.com>
 | 
			
		||||
Li Zhang <zhlcindy@gmail.com>
 | 
			
		||||
Li Zhang <zhlcindy@linux.vnet.ibm.com>
 | 
			
		||||
Lluís Vilanova <vilanova@ac.upc.edu>
 | 
			
		||||
Lluís Vilanova <xscript@gmx.net>
 | 
			
		||||
Longpeng (Mike) <longpeng2@huawei.com>
 | 
			
		||||
Luc Michel <luc.michel@git.antfield.fr>
 | 
			
		||||
Luc Michel <luc.michel@greensocs.com>
 | 
			
		||||
Marc Marí <marc.mari.barcelo@gmail.com>
 | 
			
		||||
Marc Marí <markmb@redhat.com>
 | 
			
		||||
Michael Avdienko <whitearchey@gmail.com>
 | 
			
		||||
Michael S. Tsirkin <mst@redhat.com>
 | 
			
		||||
Munkyu Im <munkyu.im@samsung.com>
 | 
			
		||||
Nicholas Bellinger <nab@linux-iscsi.org>
 | 
			
		||||
Nicholas Thomas <nick@bytemark.co.uk>
 | 
			
		||||
Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
 | 
			
		||||
Orit Wasserman <owasserm@redhat.com>
 | 
			
		||||
Paolo Bonzini <pbonzini@redhat.com>
 | 
			
		||||
Pavel Dovgaluk <dovgaluk@ispras.ru>
 | 
			
		||||
Pavel Dovgaluk <pavel.dovgaluk@gmail.com>
 | 
			
		||||
Pavel Dovgaluk <Pavel.Dovgaluk@ispras.ru>
 | 
			
		||||
Peter Crosthwaite <crosthwaite.peter@gmail.com>
 | 
			
		||||
Peter Crosthwaite <peter.crosthwaite@petalogix.com>
 | 
			
		||||
Peter Crosthwaite <peter.crosthwaite@xilinx.com>
 | 
			
		||||
Prasad J Pandit <pjp@fedoraproject.org>
 | 
			
		||||
Prasad J Pandit <ppandit@redhat.com>
 | 
			
		||||
Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
 | 
			
		||||
Reimar Döffinger <Reimar.Doeffinger@gmx.de>
 | 
			
		||||
Remy Noel <remy.noel@blade-group.com>
 | 
			
		||||
Roger Pau Monné <roger.pau@citrix.com>
 | 
			
		||||
Shin'ichiro Kawasaki <kawasaki@juno.dti.ne.jp>
 | 
			
		||||
Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
 | 
			
		||||
Sochin Jiang <sochin.jiang@huawei.com>
 | 
			
		||||
Stefan Berger <stefanb@linux.vnet.ibm.com> <stefanb@linux.ibm.com>
 | 
			
		||||
Takashi Yoshii <takasi-y@ops.dti.ne.jp>
 | 
			
		||||
Thomas Huth <thuth@redhat.com>
 | 
			
		||||
Thomas Knych <thomaswk@google.com>
 | 
			
		||||
Timothy Baldwin <T.E.Baldwin99@members.leeds.ac.uk>
 | 
			
		||||
Tony Nguyen <tony.nguyen@bt.com>
 | 
			
		||||
Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
 | 
			
		||||
Vibi Sreenivasan <vibi_sreenivasan@cms.com>
 | 
			
		||||
Vijaya Kumar K <vijayak@cavium.com>
 | 
			
		||||
Vijaya Kumar K <Vijaya.Kumar@cavium.com>
 | 
			
		||||
Vijay Kumar <vijaykumar@bravegnu.org>
 | 
			
		||||
Vijay Kumar <vijaykumar@zilogic.com>
 | 
			
		||||
Wang Guang <wang.guang55@zte.com.cn>
 | 
			
		||||
Wenchao Xia <xiawenc@linux.vnet.ibm.com>
 | 
			
		||||
Wenshuang Ma <kevinnma@tencent.com>
 | 
			
		||||
Xiaoqiang Zhao <zxq_yx_007@163.com>
 | 
			
		||||
Xinhua Cao <caoxinhua@huawei.com>
 | 
			
		||||
Xiong Zhang <xiong.y.zhang@intel.com>
 | 
			
		||||
Yin Yin <yin.yin@cs2c.com.cn>
 | 
			
		||||
Yu-Chen Lin <npes87184@gmail.com>
 | 
			
		||||
Yu-Chen Lin <npes87184@gmail.com> <yuchenlin@synology.com>
 | 
			
		||||
YunQiang Su <syq@debian.org>
 | 
			
		||||
YunQiang Su <ysu@wavecomp.com>
 | 
			
		||||
Yuri Pudgorodskiy <yur@virtuozzo.com>
 | 
			
		||||
Zhengui Li <lizhengui@huawei.com>
 | 
			
		||||
Zhenwei Pi <pizhenwei@bytedance.com>
 | 
			
		||||
Zhenwei Pi <zhenwei.pi@youruncloud.com>
 | 
			
		||||
Zhuang Yanying <ann.zhuangyanying@huawei.com>
 | 
			
		||||
							
								
								
									
										302
									
								
								.patchew.yml
									
									
									
									
									
								
							
							
						
						
									
										302
									
								
								.patchew.yml
									
									
									
									
									
								
							@@ -1,302 +0,0 @@
 | 
			
		||||
---
 | 
			
		||||
# Note: this file is still unused.  It serves as a documentation for the
 | 
			
		||||
# Patchew configuration in case patchew.org disappears or has to be
 | 
			
		||||
# reinstalled.
 | 
			
		||||
#
 | 
			
		||||
# Patchew configuration is available to project administrators at
 | 
			
		||||
# https://patchew.org/api/v1/projects/1/config/ and can be configured
 | 
			
		||||
# to YAML using the following Python script:
 | 
			
		||||
#
 | 
			
		||||
#     import json
 | 
			
		||||
#     import sys
 | 
			
		||||
#     import ruamel.yaml
 | 
			
		||||
#
 | 
			
		||||
#     json_str = sys.stdin.read()
 | 
			
		||||
#     yaml = ruamel.yaml.YAML()
 | 
			
		||||
#     yaml.explicit_start = True
 | 
			
		||||
#     data = json.loads(json_str, object_pairs_hook=ruamel.yaml.comments.CommentedMap)
 | 
			
		||||
#     ruamel.yaml.scalarstring.walk_tree(data)
 | 
			
		||||
#     yaml.dump(data, sys.stdout)
 | 
			
		||||
 | 
			
		||||
email:
 | 
			
		||||
  notifications:
 | 
			
		||||
    timeouts:
 | 
			
		||||
      event: TestingReport
 | 
			
		||||
      enabled: true
 | 
			
		||||
      to_user: false
 | 
			
		||||
      reply_subject: true
 | 
			
		||||
      set_reply_to: true
 | 
			
		||||
      in_reply_to: true
 | 
			
		||||
      reply_to_all: false
 | 
			
		||||
      subject_template: none
 | 
			
		||||
      to: fam@euphon.net
 | 
			
		||||
      cc: ''
 | 
			
		||||
      body_template: |
 | 
			
		||||
        {% if not is_timeout %} {{ cancel }} {% endif %}
 | 
			
		||||
 | 
			
		||||
        Test '{{ test }}' timeout, log:
 | 
			
		||||
 | 
			
		||||
        {{ log }}
 | 
			
		||||
    ENOSPC:
 | 
			
		||||
      event: TestingReport
 | 
			
		||||
      enabled: true
 | 
			
		||||
      to_user: false
 | 
			
		||||
      reply_subject: false
 | 
			
		||||
      set_reply_to: false
 | 
			
		||||
      in_reply_to: true
 | 
			
		||||
      reply_to_all: false
 | 
			
		||||
      subject_template: Out of space error
 | 
			
		||||
      to: fam@euphon.net
 | 
			
		||||
      cc: ''
 | 
			
		||||
      body_template: |
 | 
			
		||||
        {% if passed %}
 | 
			
		||||
          {{ cancel }}
 | 
			
		||||
        {% endif %}
 | 
			
		||||
 | 
			
		||||
        {% if 'No space left on device' in log %}
 | 
			
		||||
        Tester {{ tester }} out of space when running {{ test }}
 | 
			
		||||
 | 
			
		||||
          {{ log }}
 | 
			
		||||
        {% else %}
 | 
			
		||||
          {{ cancel }}
 | 
			
		||||
        {% endif %}
 | 
			
		||||
    FailureShort:
 | 
			
		||||
      event: TestingReport
 | 
			
		||||
      enabled: true
 | 
			
		||||
      to_user: false
 | 
			
		||||
      reply_subject: true
 | 
			
		||||
      set_reply_to: true
 | 
			
		||||
      in_reply_to: true
 | 
			
		||||
      reply_to_all: true
 | 
			
		||||
      subject_template: Testing failed
 | 
			
		||||
      to: ''
 | 
			
		||||
      cc: ''
 | 
			
		||||
      body_template: |
 | 
			
		||||
        {% if passed or not obj.message_id or is_timeout %}
 | 
			
		||||
          {{ cancel }}
 | 
			
		||||
        {% endif %}
 | 
			
		||||
        {% if 'No space left on device' in log %}
 | 
			
		||||
          {{ cancel }}
 | 
			
		||||
        {% endif %}
 | 
			
		||||
        Patchew URL: https://patchew.org/QEMU/{{ obj.message_id }}/
 | 
			
		||||
 | 
			
		||||
        {% ansi2text log as logtext %}
 | 
			
		||||
        {% if test == "checkpatch" %}
 | 
			
		||||
        Hi,
 | 
			
		||||
 | 
			
		||||
        This series seems to have some coding style problems. See output below for
 | 
			
		||||
        more information:
 | 
			
		||||
 | 
			
		||||
        {{ logtext }}
 | 
			
		||||
        {% elif test == "docker-mingw@fedora" or test == "docker-quick@centos7" or test == "asan" %}
 | 
			
		||||
        Hi,
 | 
			
		||||
 | 
			
		||||
        This series failed the {{ test }} build test. Please find the testing commands and
 | 
			
		||||
        their output below. If you have Docker installed, you can probably reproduce it
 | 
			
		||||
        locally.
 | 
			
		||||
 | 
			
		||||
        {% lines_between logtext start="^=== TEST SCRIPT BEGIN ===$" stop="^=== TEST SCRIPT END ===$" %}
 | 
			
		||||
        {% lines_between logtext start="^=== OUTPUT BEGIN ===$" stop="=== OUTPUT END ===$" as output %}
 | 
			
		||||
        {% grep_C output regex="\b(FAIL|XPASS|ERROR|WARN|error:|warning:)" n=3 %}
 | 
			
		||||
        {% elif test == "s390x" or test == "FreeBSD" or test == "ppcle" or test == "ppcbe" %}
 | 
			
		||||
        Hi,
 | 
			
		||||
 | 
			
		||||
        This series failed build test on {{test}} host. Please find the details below.
 | 
			
		||||
 | 
			
		||||
        {% lines_between logtext start="^=== TEST SCRIPT BEGIN ===$" stop="^=== TEST SCRIPT END ===$" %}
 | 
			
		||||
        {% lines_between logtext start="^=== OUTPUT BEGIN ===$" stop="=== OUTPUT END ===$" as output %}
 | 
			
		||||
        {% grep_C output regex="\b(FAIL|XPASS|ERROR|WARN|error:|warning:)" n=3 %}
 | 
			
		||||
        {% else %}
 | 
			
		||||
        {{ cancel }}
 | 
			
		||||
        {% endif %}
 | 
			
		||||
 | 
			
		||||
        The full log is available at
 | 
			
		||||
        {{ log_url }}.
 | 
			
		||||
        ---
 | 
			
		||||
        Email generated automatically by Patchew [https://patchew.org/].
 | 
			
		||||
        Please send your feedback to patchew-devel@redhat.com
 | 
			
		||||
testing:
 | 
			
		||||
  tests:
 | 
			
		||||
    asan:
 | 
			
		||||
      enabled: true
 | 
			
		||||
      requirements: docker
 | 
			
		||||
      timeout: 3600
 | 
			
		||||
      script: |
 | 
			
		||||
        #!/bin/bash
 | 
			
		||||
        time make docker-test-debug@fedora TARGET_LIST=x86_64-softmmu J=14 NETWORK=1
 | 
			
		||||
    docker-quick@centos7:
 | 
			
		||||
      enabled: false
 | 
			
		||||
      requirements: docker,x86_64
 | 
			
		||||
      timeout: 3600
 | 
			
		||||
      script: |
 | 
			
		||||
        #!/bin/bash
 | 
			
		||||
        time make docker-test-quick@centos7 SHOW_ENV=1 J=14 NETWORK=1
 | 
			
		||||
    checkpatch:
 | 
			
		||||
      enabled: true
 | 
			
		||||
      requirements: ''
 | 
			
		||||
      timeout: 600
 | 
			
		||||
      script: |
 | 
			
		||||
        #!/bin/bash
 | 
			
		||||
        git rev-parse base > /dev/null || exit 0
 | 
			
		||||
        git config --local diff.renamelimit 0
 | 
			
		||||
        git config --local diff.renames True
 | 
			
		||||
        git config --local diff.algorithm histogram
 | 
			
		||||
        ./scripts/checkpatch.pl --mailback base..
 | 
			
		||||
    docker-mingw@fedora:
 | 
			
		||||
      enabled: true
 | 
			
		||||
      requirements: docker,x86_64
 | 
			
		||||
      timeout: 3600
 | 
			
		||||
      script: |
 | 
			
		||||
        #! /bin/bash
 | 
			
		||||
        test "$(uname -m)" = "x86_64"
 | 
			
		||||
    ppcle:
 | 
			
		||||
      enabled: false
 | 
			
		||||
      requirements: ppcle
 | 
			
		||||
      timeout: 3600
 | 
			
		||||
      script: |
 | 
			
		||||
        #!/bin/bash
 | 
			
		||||
        # Testing script will be invoked under the git checkout with
 | 
			
		||||
        # HEAD pointing to a commit that has the patches applied on top of "base"
 | 
			
		||||
        # branch
 | 
			
		||||
        set -e
 | 
			
		||||
        CC=$HOME/bin/cc
 | 
			
		||||
        INSTALL=$PWD/install
 | 
			
		||||
        BUILD=$PWD/build
 | 
			
		||||
        mkdir -p $BUILD $INSTALL
 | 
			
		||||
        SRC=$PWD
 | 
			
		||||
        cd $BUILD
 | 
			
		||||
        $SRC/configure --cc=$CC --prefix=$INSTALL
 | 
			
		||||
        make -j4
 | 
			
		||||
        # XXX: we need reliable clean up
 | 
			
		||||
        # make check -j4 V=1
 | 
			
		||||
        make install
 | 
			
		||||
 | 
			
		||||
        echo
 | 
			
		||||
        echo "=== ENV ==="
 | 
			
		||||
        env
 | 
			
		||||
 | 
			
		||||
        echo
 | 
			
		||||
        echo "=== PACKAGES ==="
 | 
			
		||||
        rpm -qa
 | 
			
		||||
    ppcbe:
 | 
			
		||||
      enabled: false
 | 
			
		||||
      requirements: ppcbe
 | 
			
		||||
      timeout: 3600
 | 
			
		||||
      script: |
 | 
			
		||||
        #!/bin/bash
 | 
			
		||||
        # Testing script will be invoked under the git checkout with
 | 
			
		||||
        # HEAD pointing to a commit that has the patches applied on top of "base"
 | 
			
		||||
        # branch
 | 
			
		||||
        set -e
 | 
			
		||||
        CC=$HOME/bin/cc
 | 
			
		||||
        INSTALL=$PWD/install
 | 
			
		||||
        BUILD=$PWD/build
 | 
			
		||||
        mkdir -p $BUILD $INSTALL
 | 
			
		||||
        SRC=$PWD
 | 
			
		||||
        cd $BUILD
 | 
			
		||||
        $SRC/configure --cc=$CC --prefix=$INSTALL
 | 
			
		||||
        make -j4
 | 
			
		||||
        # XXX: we need reliable clean up
 | 
			
		||||
        # make check -j4 V=1
 | 
			
		||||
        make install
 | 
			
		||||
 | 
			
		||||
        echo
 | 
			
		||||
        echo "=== ENV ==="
 | 
			
		||||
        env
 | 
			
		||||
 | 
			
		||||
        echo
 | 
			
		||||
        echo "=== PACKAGES ==="
 | 
			
		||||
        rpm -qa
 | 
			
		||||
    FreeBSD:
 | 
			
		||||
      enabled: true
 | 
			
		||||
      requirements: qemu-x86,x86_64,git
 | 
			
		||||
      timeout: 3600
 | 
			
		||||
      script: |
 | 
			
		||||
        #!/bin/bash
 | 
			
		||||
        # Testing script will be invoked under the git checkout with
 | 
			
		||||
        # HEAD pointing to a commit that has the patches applied on top of "base"
 | 
			
		||||
        # branch
 | 
			
		||||
        if qemu-system-x86_64 --help >/dev/null 2>&1; then
 | 
			
		||||
          QEMU=qemu-system-x86_64
 | 
			
		||||
        elif /usr/libexec/qemu-kvm --help >/dev/null 2>&1; then
 | 
			
		||||
          QEMU=/usr/libexec/qemu-kvm
 | 
			
		||||
        else
 | 
			
		||||
          exit 1
 | 
			
		||||
        fi
 | 
			
		||||
        make vm-build-freebsd J=21 QEMU=$QEMU
 | 
			
		||||
        exit 0
 | 
			
		||||
    docker-clang@ubuntu:
 | 
			
		||||
      enabled: true
 | 
			
		||||
      requirements: docker,x86_64
 | 
			
		||||
      timeout: 3600
 | 
			
		||||
      script: |
 | 
			
		||||
        #!/bin/bash
 | 
			
		||||
        time make docker-test-clang@ubuntu SHOW_ENV=1 J=14 NETWORK=1
 | 
			
		||||
    s390x:
 | 
			
		||||
      enabled: true
 | 
			
		||||
      requirements: s390x
 | 
			
		||||
      timeout: 3600
 | 
			
		||||
      script: |
 | 
			
		||||
        #!/bin/bash
 | 
			
		||||
        # Testing script will be invoked under the git checkout with
 | 
			
		||||
        # HEAD pointing to a commit that has the patches applied on top of "base"
 | 
			
		||||
        # branch
 | 
			
		||||
        set -e
 | 
			
		||||
        CC=$HOME/bin/cc
 | 
			
		||||
        INSTALL=$PWD/install
 | 
			
		||||
        BUILD=$PWD/build
 | 
			
		||||
        mkdir -p $BUILD $INSTALL
 | 
			
		||||
        SRC=$PWD
 | 
			
		||||
        cd $BUILD
 | 
			
		||||
        $SRC/configure --cc=$CC --prefix=$INSTALL
 | 
			
		||||
        make -j4
 | 
			
		||||
        # XXX: we need reliable clean up
 | 
			
		||||
        # make check -j4 V=1
 | 
			
		||||
        make install
 | 
			
		||||
 | 
			
		||||
        echo
 | 
			
		||||
        echo "=== ENV ==="
 | 
			
		||||
        env
 | 
			
		||||
 | 
			
		||||
        echo
 | 
			
		||||
        echo "=== PACKAGES ==="
 | 
			
		||||
        rpm -qa
 | 
			
		||||
  requirements:
 | 
			
		||||
    x86_64:
 | 
			
		||||
      script: |
 | 
			
		||||
        #! /bin/bash
 | 
			
		||||
        test "$(uname -m)" = "x86_64"
 | 
			
		||||
    qemu-x86:
 | 
			
		||||
      script: |
 | 
			
		||||
        #!/bin/bash
 | 
			
		||||
        if qemu-system-x86_64 --help >/dev/null 2>&1; then
 | 
			
		||||
          :
 | 
			
		||||
        elif /usr/libexec/qemu-kvm --help >/dev/null 2>&1; then
 | 
			
		||||
          :
 | 
			
		||||
        else
 | 
			
		||||
          exit 1
 | 
			
		||||
        fi
 | 
			
		||||
    ppcle:
 | 
			
		||||
      script: |
 | 
			
		||||
        #!/bin/bash
 | 
			
		||||
        test "$(uname -m)" = "ppc64le"
 | 
			
		||||
    ppcbe:
 | 
			
		||||
      script: |
 | 
			
		||||
        #!/bin/bash
 | 
			
		||||
        test "$(uname -m)" = "ppc64"
 | 
			
		||||
    git:
 | 
			
		||||
      script: |
 | 
			
		||||
        #! /bin/bash
 | 
			
		||||
        git config user.name > /dev/null 2>&1
 | 
			
		||||
    docker:
 | 
			
		||||
      script: |
 | 
			
		||||
        #!/bin/bash
 | 
			
		||||
        docker ps || sudo -n docker ps
 | 
			
		||||
    s390x:
 | 
			
		||||
      script: |
 | 
			
		||||
        #!/bin/bash
 | 
			
		||||
        test "$(uname -m)" = "s390x"
 | 
			
		||||
git:
 | 
			
		||||
  push_to: git@github.com:patchew-project/qemu
 | 
			
		||||
  public_repo: https://github.com/patchew-project/qemu
 | 
			
		||||
  url_template: https://github.com/patchew-project/qemu/tree/%t
 | 
			
		||||
@@ -1,20 +0,0 @@
 | 
			
		||||
# .readthedocs.yml
 | 
			
		||||
# Read the Docs configuration file
 | 
			
		||||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
 | 
			
		||||
 | 
			
		||||
# Required
 | 
			
		||||
version: 2
 | 
			
		||||
 | 
			
		||||
# Build documentation in the docs/ directory with Sphinx
 | 
			
		||||
sphinx:
 | 
			
		||||
  configuration: docs/conf.py
 | 
			
		||||
 | 
			
		||||
# We want all the document formats
 | 
			
		||||
formats: all
 | 
			
		||||
 | 
			
		||||
# For consistency, we require that QEMU's Sphinx extensions
 | 
			
		||||
# run with at least the same minimum version of Python that
 | 
			
		||||
# we require for other Python in our codebase (our conf.py
 | 
			
		||||
# enforces this, and some code needs it.)
 | 
			
		||||
python:
 | 
			
		||||
  version: 3.6
 | 
			
		||||
							
								
								
									
										330
									
								
								.travis.yml
									
									
									
									
									
								
							
							
						
						
									
										330
									
								
								.travis.yml
									
									
									
									
									
								
							@@ -1,330 +0,0 @@
 | 
			
		||||
# The current Travis default is a VM based 16.04 Xenial on GCE
 | 
			
		||||
# Additional builds with specific requirements for a full VM need to
 | 
			
		||||
# be added as additional matrix: entries later on
 | 
			
		||||
os: linux
 | 
			
		||||
dist: focal
 | 
			
		||||
language: c
 | 
			
		||||
compiler:
 | 
			
		||||
  - gcc
 | 
			
		||||
cache:
 | 
			
		||||
  # There is one cache per branch and compiler version.
 | 
			
		||||
  # characteristics of each job are used to identify the cache:
 | 
			
		||||
  # - OS name (currently only linux)
 | 
			
		||||
  # - OS distribution (for Linux, bionic or focal)
 | 
			
		||||
  # - Names and values of visible environment variables set in .travis.yml or Settings panel
 | 
			
		||||
  timeout: 1200
 | 
			
		||||
  ccache: true
 | 
			
		||||
  pip: true
 | 
			
		||||
  directories:
 | 
			
		||||
  - $HOME/avocado/data/cache
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
addons:
 | 
			
		||||
  apt:
 | 
			
		||||
    packages:
 | 
			
		||||
      # Build dependencies
 | 
			
		||||
      - libaio-dev
 | 
			
		||||
      - libattr1-dev
 | 
			
		||||
      - libbrlapi-dev
 | 
			
		||||
      - libcap-ng-dev
 | 
			
		||||
      - libgcc-7-dev
 | 
			
		||||
      - libgnutls28-dev
 | 
			
		||||
      - libgtk-3-dev
 | 
			
		||||
      - libiscsi-dev
 | 
			
		||||
      - liblttng-ust-dev
 | 
			
		||||
      - libncurses5-dev
 | 
			
		||||
      - libnfs-dev
 | 
			
		||||
      - libnss3-dev
 | 
			
		||||
      - libpixman-1-dev
 | 
			
		||||
      - libpng-dev
 | 
			
		||||
      - librados-dev
 | 
			
		||||
      - libsdl2-dev
 | 
			
		||||
      - libsdl2-image-dev
 | 
			
		||||
      - libseccomp-dev
 | 
			
		||||
      - libspice-protocol-dev
 | 
			
		||||
      - libspice-server-dev
 | 
			
		||||
      - libssh-dev
 | 
			
		||||
      - liburcu-dev
 | 
			
		||||
      - libusb-1.0-0-dev
 | 
			
		||||
      - libvdeplug-dev
 | 
			
		||||
      - libvte-2.91-dev
 | 
			
		||||
      - libzstd-dev
 | 
			
		||||
      - ninja-build
 | 
			
		||||
      - sparse
 | 
			
		||||
      - uuid-dev
 | 
			
		||||
      # Tests dependencies
 | 
			
		||||
      - genisoimage
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# The channel name "irc.oftc.net#qemu" is encrypted against qemu/qemu
 | 
			
		||||
# to prevent IRC notifications from forks. This was created using:
 | 
			
		||||
# $ travis encrypt -r "qemu/qemu" "irc.oftc.net#qemu"
 | 
			
		||||
notifications:
 | 
			
		||||
  irc:
 | 
			
		||||
    channels:
 | 
			
		||||
      - secure: "F7GDRgjuOo5IUyRLqSkmDL7kvdU4UcH3Lm/W2db2JnDHTGCqgEdaYEYKciyCLZ57vOTsTsOgesN8iUT7hNHBd1KWKjZe9KDTZWppWRYVwAwQMzVeSOsbbU4tRoJ6Pp+3qhH1Z0eGYR9ZgKYAoTumDFgSAYRp4IscKS8jkoedOqM="
 | 
			
		||||
    on_success: change
 | 
			
		||||
    on_failure: always
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
env:
 | 
			
		||||
  global:
 | 
			
		||||
    - SRC_DIR=".."
 | 
			
		||||
    - BUILD_DIR="build"
 | 
			
		||||
    - BASE_CONFIG="--disable-docs --disable-tools"
 | 
			
		||||
    - TEST_BUILD_CMD=""
 | 
			
		||||
    - TEST_CMD="make check V=1"
 | 
			
		||||
    # This is broadly a list of "mainline" softmmu targets which have support across the major distros
 | 
			
		||||
    - MAIN_SOFTMMU_TARGETS="aarch64-softmmu,mips64-softmmu,ppc64-softmmu,riscv64-softmmu,s390x-softmmu,x86_64-softmmu"
 | 
			
		||||
    - CCACHE_SLOPPINESS="include_file_ctime,include_file_mtime"
 | 
			
		||||
    - CCACHE_MAXSIZE=1G
 | 
			
		||||
    - G_MESSAGES_DEBUG=error
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
git:
 | 
			
		||||
  # we want to do this ourselves
 | 
			
		||||
  submodules: false
 | 
			
		||||
 | 
			
		||||
# Common first phase for all steps
 | 
			
		||||
# We no longer use nproc to calculate jobs:
 | 
			
		||||
# https://travis-ci.community/t/nproc-reports-32-cores-on-arm64/5851
 | 
			
		||||
before_install:
 | 
			
		||||
  - if command -v ccache ; then ccache --zero-stats ; fi
 | 
			
		||||
  - export JOBS=3
 | 
			
		||||
  - echo "=== Using ${JOBS} simultaneous jobs ==="
 | 
			
		||||
 | 
			
		||||
# Configure step - may be overridden
 | 
			
		||||
before_script:
 | 
			
		||||
  - mkdir -p ${BUILD_DIR} && cd ${BUILD_DIR}
 | 
			
		||||
  - ${SRC_DIR}/configure ${BASE_CONFIG} ${CONFIG} || { cat config.log meson-logs/meson-log.txt && exit 1; }
 | 
			
		||||
 | 
			
		||||
# Main build & test - rarely overridden - controlled by TEST_CMD
 | 
			
		||||
script:
 | 
			
		||||
  - BUILD_RC=0 && make -j${JOBS} || BUILD_RC=$?
 | 
			
		||||
  - |
 | 
			
		||||
    if [ "$BUILD_RC" -eq 0 ] && [ -n "$TEST_BUILD_CMD" ]; then
 | 
			
		||||
        ${TEST_BUILD_CMD} || BUILD_RC=$?
 | 
			
		||||
    else
 | 
			
		||||
        $(exit $BUILD_RC);
 | 
			
		||||
    fi
 | 
			
		||||
  - |
 | 
			
		||||
    if [ "$BUILD_RC" -eq 0 ] ; then
 | 
			
		||||
        ${TEST_CMD} ;
 | 
			
		||||
    else
 | 
			
		||||
        $(exit $BUILD_RC);
 | 
			
		||||
    fi
 | 
			
		||||
after_script:
 | 
			
		||||
  - df -h
 | 
			
		||||
  - if command -v ccache ; then ccache --show-stats ; fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  include:
 | 
			
		||||
 | 
			
		||||
    - name: "[aarch64] GCC check-tcg"
 | 
			
		||||
      arch: arm64
 | 
			
		||||
      dist: focal
 | 
			
		||||
      addons:
 | 
			
		||||
        apt_packages:
 | 
			
		||||
          - libaio-dev
 | 
			
		||||
          - libattr1-dev
 | 
			
		||||
          - libbrlapi-dev
 | 
			
		||||
          - libcap-ng-dev
 | 
			
		||||
          - libgcrypt20-dev
 | 
			
		||||
          - libgnutls28-dev
 | 
			
		||||
          - libgtk-3-dev
 | 
			
		||||
          - libiscsi-dev
 | 
			
		||||
          - liblttng-ust-dev
 | 
			
		||||
          - libncurses5-dev
 | 
			
		||||
          - libnfs-dev
 | 
			
		||||
          - libnss3-dev
 | 
			
		||||
          - libpixman-1-dev
 | 
			
		||||
          - libpng-dev
 | 
			
		||||
          - librados-dev
 | 
			
		||||
          - libsdl2-dev
 | 
			
		||||
          - libseccomp-dev
 | 
			
		||||
          - liburcu-dev
 | 
			
		||||
          - libusb-1.0-0-dev
 | 
			
		||||
          - libvdeplug-dev
 | 
			
		||||
          - libvte-2.91-dev
 | 
			
		||||
          - ninja-build
 | 
			
		||||
          # Tests dependencies
 | 
			
		||||
          - genisoimage
 | 
			
		||||
      env:
 | 
			
		||||
        - TEST_CMD="make check check-tcg V=1"
 | 
			
		||||
        - CONFIG="--disable-containers --target-list=${MAIN_SOFTMMU_TARGETS} --cxx=/bin/false"
 | 
			
		||||
        - UNRELIABLE=true
 | 
			
		||||
 | 
			
		||||
    - name: "[ppc64] GCC check-tcg"
 | 
			
		||||
      arch: ppc64le
 | 
			
		||||
      dist: focal
 | 
			
		||||
      addons:
 | 
			
		||||
        apt_packages:
 | 
			
		||||
          - libaio-dev
 | 
			
		||||
          - libattr1-dev
 | 
			
		||||
          - libbrlapi-dev
 | 
			
		||||
          - libcap-ng-dev
 | 
			
		||||
          - libgcrypt20-dev
 | 
			
		||||
          - libgnutls28-dev
 | 
			
		||||
          - libgtk-3-dev
 | 
			
		||||
          - libiscsi-dev
 | 
			
		||||
          - liblttng-ust-dev
 | 
			
		||||
          - libncurses5-dev
 | 
			
		||||
          - libnfs-dev
 | 
			
		||||
          - libnss3-dev
 | 
			
		||||
          - libpixman-1-dev
 | 
			
		||||
          - libpng-dev
 | 
			
		||||
          - librados-dev
 | 
			
		||||
          - libsdl2-dev
 | 
			
		||||
          - libseccomp-dev
 | 
			
		||||
          - liburcu-dev
 | 
			
		||||
          - libusb-1.0-0-dev
 | 
			
		||||
          - libvdeplug-dev
 | 
			
		||||
          - libvte-2.91-dev
 | 
			
		||||
          - ninja-build
 | 
			
		||||
          # Tests dependencies
 | 
			
		||||
          - genisoimage
 | 
			
		||||
      env:
 | 
			
		||||
        - TEST_CMD="make check check-tcg V=1"
 | 
			
		||||
        - CONFIG="--disable-containers --target-list=ppc64-softmmu,ppc64le-linux-user"
 | 
			
		||||
 | 
			
		||||
    - name: "[s390x] GCC check-tcg"
 | 
			
		||||
      arch: s390x
 | 
			
		||||
      dist: bionic
 | 
			
		||||
      addons:
 | 
			
		||||
        apt_packages:
 | 
			
		||||
          - libaio-dev
 | 
			
		||||
          - libattr1-dev
 | 
			
		||||
          - libbrlapi-dev
 | 
			
		||||
          - libcap-ng-dev
 | 
			
		||||
          - libgcrypt20-dev
 | 
			
		||||
          - libgnutls28-dev
 | 
			
		||||
          - libgtk-3-dev
 | 
			
		||||
          - libiscsi-dev
 | 
			
		||||
          - liblttng-ust-dev
 | 
			
		||||
          - libncurses5-dev
 | 
			
		||||
          - libnfs-dev
 | 
			
		||||
          - libnss3-dev
 | 
			
		||||
          - libpixman-1-dev
 | 
			
		||||
          - libpng-dev
 | 
			
		||||
          - librados-dev
 | 
			
		||||
          - libsdl2-dev
 | 
			
		||||
          - libseccomp-dev
 | 
			
		||||
          - liburcu-dev
 | 
			
		||||
          - libusb-1.0-0-dev
 | 
			
		||||
          - libvdeplug-dev
 | 
			
		||||
          - libvte-2.91-dev
 | 
			
		||||
          - ninja-build
 | 
			
		||||
          # Tests dependencies
 | 
			
		||||
          - genisoimage
 | 
			
		||||
      env:
 | 
			
		||||
        - TEST_CMD="make check check-tcg V=1"
 | 
			
		||||
        - CONFIG="--disable-containers --target-list=${MAIN_SOFTMMU_TARGETS},s390x-linux-user"
 | 
			
		||||
        - UNRELIABLE=true
 | 
			
		||||
      script:
 | 
			
		||||
        - BUILD_RC=0 && make -j${JOBS} || BUILD_RC=$?
 | 
			
		||||
        - |
 | 
			
		||||
          if [ "$BUILD_RC" -eq 0 ] ; then
 | 
			
		||||
              mv pc-bios/s390-ccw/*.img pc-bios/ ;
 | 
			
		||||
              ${TEST_CMD} ;
 | 
			
		||||
          else
 | 
			
		||||
              $(exit $BUILD_RC);
 | 
			
		||||
          fi
 | 
			
		||||
 | 
			
		||||
    - name: "[s390x] GCC (other-softmmu)"
 | 
			
		||||
      arch: s390x
 | 
			
		||||
      dist: bionic
 | 
			
		||||
      addons:
 | 
			
		||||
        apt_packages:
 | 
			
		||||
          - libaio-dev
 | 
			
		||||
          - libattr1-dev
 | 
			
		||||
          - libcap-ng-dev
 | 
			
		||||
          - libgnutls28-dev
 | 
			
		||||
          - libiscsi-dev
 | 
			
		||||
          - liblttng-ust-dev
 | 
			
		||||
          - liblzo2-dev
 | 
			
		||||
          - libncurses-dev
 | 
			
		||||
          - libnfs-dev
 | 
			
		||||
          - libnss3-dev
 | 
			
		||||
          - libpixman-1-dev
 | 
			
		||||
          - libsdl2-dev
 | 
			
		||||
          - libsdl2-image-dev
 | 
			
		||||
          - libseccomp-dev
 | 
			
		||||
          - libsnappy-dev
 | 
			
		||||
          - libzstd-dev
 | 
			
		||||
          - nettle-dev
 | 
			
		||||
          - xfslibs-dev
 | 
			
		||||
          - ninja-build
 | 
			
		||||
          # Tests dependencies
 | 
			
		||||
          - genisoimage
 | 
			
		||||
      env:
 | 
			
		||||
        - CONFIG="--disable-containers --audio-drv-list=sdl --disable-user
 | 
			
		||||
                  --target-list-exclude=${MAIN_SOFTMMU_TARGETS}"
 | 
			
		||||
 | 
			
		||||
    - name: "[s390x] GCC (user)"
 | 
			
		||||
      arch: s390x
 | 
			
		||||
      dist: bionic
 | 
			
		||||
      addons:
 | 
			
		||||
        apt_packages:
 | 
			
		||||
          - libgcrypt20-dev
 | 
			
		||||
          - libgnutls28-dev
 | 
			
		||||
          - ninja-build
 | 
			
		||||
      env:
 | 
			
		||||
        - CONFIG="--disable-containers --disable-system"
 | 
			
		||||
 | 
			
		||||
    - name: "[s390x] Clang (disable-tcg)"
 | 
			
		||||
      arch: s390x
 | 
			
		||||
      dist: bionic
 | 
			
		||||
      compiler: clang
 | 
			
		||||
      addons:
 | 
			
		||||
        apt_packages:
 | 
			
		||||
          - libaio-dev
 | 
			
		||||
          - libattr1-dev
 | 
			
		||||
          - libbrlapi-dev
 | 
			
		||||
          - libcap-ng-dev
 | 
			
		||||
          - libgcrypt20-dev
 | 
			
		||||
          - libgnutls28-dev
 | 
			
		||||
          - libgtk-3-dev
 | 
			
		||||
          - libiscsi-dev
 | 
			
		||||
          - liblttng-ust-dev
 | 
			
		||||
          - libncurses5-dev
 | 
			
		||||
          - libnfs-dev
 | 
			
		||||
          - libnss3-dev
 | 
			
		||||
          - libpixman-1-dev
 | 
			
		||||
          - libpng-dev
 | 
			
		||||
          - librados-dev
 | 
			
		||||
          - libsdl2-dev
 | 
			
		||||
          - libseccomp-dev
 | 
			
		||||
          - liburcu-dev
 | 
			
		||||
          - libusb-1.0-0-dev
 | 
			
		||||
          - libvdeplug-dev
 | 
			
		||||
          - libvte-2.91-dev
 | 
			
		||||
          - ninja-build
 | 
			
		||||
      env:
 | 
			
		||||
        - TEST_CMD="make check-unit"
 | 
			
		||||
        - CONFIG="--disable-containers --disable-tcg --enable-kvm
 | 
			
		||||
                  --disable-tools --host-cc=clang --cxx=clang++"
 | 
			
		||||
        - UNRELIABLE=true
 | 
			
		||||
 | 
			
		||||
    # Release builds
 | 
			
		||||
    # The make-release script expect a QEMU version, so our tag must start with a 'v'.
 | 
			
		||||
    # This is the case when release candidate tags are created.
 | 
			
		||||
    - name: "Release tarball"
 | 
			
		||||
      if: tag IS present AND tag =~ /^v\d+\.\d+(\.\d+)?(-\S*)?$/
 | 
			
		||||
      env:
 | 
			
		||||
        # We want to build from the release tarball
 | 
			
		||||
        - BUILD_DIR="release/build/dir" SRC_DIR="../../.."
 | 
			
		||||
        - BASE_CONFIG="--prefix=$PWD/dist"
 | 
			
		||||
        - CONFIG="--target-list=x86_64-softmmu,aarch64-softmmu,armeb-linux-user,ppc-linux-user"
 | 
			
		||||
        - TEST_CMD="make install -j${JOBS}"
 | 
			
		||||
        - QEMU_VERSION="${TRAVIS_TAG:1}"
 | 
			
		||||
        - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-default"
 | 
			
		||||
      script:
 | 
			
		||||
        - make -C ${SRC_DIR} qemu-${QEMU_VERSION}.tar.bz2
 | 
			
		||||
        - ls -l ${SRC_DIR}/qemu-${QEMU_VERSION}.tar.bz2
 | 
			
		||||
        - tar -xf ${SRC_DIR}/qemu-${QEMU_VERSION}.tar.bz2 && cd qemu-${QEMU_VERSION}
 | 
			
		||||
        - mkdir -p release-build && cd release-build
 | 
			
		||||
        - ../configure ${BASE_CONFIG} ${CONFIG} || { cat config.log meson-logs/meson-log.txt && exit 1; }
 | 
			
		||||
        - make install
 | 
			
		||||
  allow_failures:
 | 
			
		||||
    - env: UNRELIABLE=true
 | 
			
		||||
							
								
								
									
										18
									
								
								COPYING
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								COPYING
									
									
									
									
									
								
							@@ -1,8 +1,8 @@
 | 
			
		||||
		    GNU GENERAL PUBLIC LICENSE
 | 
			
		||||
		       Version 2, June 1991
 | 
			
		||||
 | 
			
		||||
 Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
 | 
			
		||||
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 | 
			
		||||
 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
 | 
			
		||||
                          675 Mass Ave, Cambridge, MA 02139, USA
 | 
			
		||||
 Everyone is permitted to copy and distribute verbatim copies
 | 
			
		||||
 of this license document, but changing it is not allowed.
 | 
			
		||||
 | 
			
		||||
@@ -15,7 +15,7 @@ software--to make sure the software is free for all its users.  This
 | 
			
		||||
General Public License applies to most of the Free Software
 | 
			
		||||
Foundation's software and to any other program whose authors commit to
 | 
			
		||||
using it.  (Some other Free Software Foundation software is covered by
 | 
			
		||||
the GNU Lesser General Public License instead.)  You can apply it to
 | 
			
		||||
the GNU Library General Public License instead.)  You can apply it to
 | 
			
		||||
your programs, too.
 | 
			
		||||
 | 
			
		||||
  When we speak of free software, we are referring to freedom, not
 | 
			
		||||
@@ -291,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least
 | 
			
		||||
the "copyright" line and a pointer to where the full notice is found.
 | 
			
		||||
 | 
			
		||||
    <one line to give the program's name and a brief idea of what it does.>
 | 
			
		||||
    Copyright (C) <year>  <name of author>
 | 
			
		||||
    Copyright (C) 19yy  <name of author>
 | 
			
		||||
 | 
			
		||||
    This program is free software; you can redistribute it and/or modify
 | 
			
		||||
    it under the terms of the GNU General Public License as published by
 | 
			
		||||
@@ -303,16 +303,16 @@ the "copyright" line and a pointer to where the full notice is found.
 | 
			
		||||
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
    GNU General Public License for more details.
 | 
			
		||||
 | 
			
		||||
    You should have received a copy of the GNU General Public License along
 | 
			
		||||
    with this program; if not, write to the Free Software Foundation, Inc.,
 | 
			
		||||
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 | 
			
		||||
    You should have received a copy of the GNU General Public License
 | 
			
		||||
    along with this program; if not, write to the Free Software
 | 
			
		||||
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 | 
			
		||||
 | 
			
		||||
Also add information on how to contact you by electronic and paper mail.
 | 
			
		||||
 | 
			
		||||
If the program is interactive, make it output a short notice like this
 | 
			
		||||
when it starts in an interactive mode:
 | 
			
		||||
 | 
			
		||||
    Gnomovision version 69, Copyright (C) year name of author
 | 
			
		||||
    Gnomovision version 69, Copyright (C) 19yy name of author
 | 
			
		||||
    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
 | 
			
		||||
    This is free software, and you are welcome to redistribute it
 | 
			
		||||
    under certain conditions; type `show c' for details.
 | 
			
		||||
@@ -335,5 +335,5 @@ necessary.  Here is a sample; alter the names:
 | 
			
		||||
This General Public License does not permit incorporating your program into
 | 
			
		||||
proprietary programs.  If your program is a subroutine library, you may
 | 
			
		||||
consider it more useful to permit linking proprietary applications with the
 | 
			
		||||
library.  If this is what you want to do, use the GNU Lesser General
 | 
			
		||||
library.  If this is what you want to do, use the GNU Library General
 | 
			
		||||
Public License instead of this License.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										22
									
								
								COPYING.LIB
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								COPYING.LIB
									
									
									
									
									
								
							@@ -1,8 +1,8 @@
 | 
			
		||||
                  GNU LESSER GENERAL PUBLIC LICENSE
 | 
			
		||||
                       Version 2.1, February 1999
 | 
			
		||||
		  GNU LESSER GENERAL PUBLIC LICENSE
 | 
			
		||||
		       Version 2.1, February 1999
 | 
			
		||||
 | 
			
		||||
 Copyright (C) 1991, 1999 Free Software Foundation, Inc.
 | 
			
		||||
 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 | 
			
		||||
     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 | 
			
		||||
 Everyone is permitted to copy and distribute verbatim copies
 | 
			
		||||
 of this license document, but changing it is not allowed.
 | 
			
		||||
 | 
			
		||||
@@ -10,7 +10,7 @@
 | 
			
		||||
 as the successor of the GNU Library Public License, version 2, hence
 | 
			
		||||
 the version number 2.1.]
 | 
			
		||||
 | 
			
		||||
                            Preamble
 | 
			
		||||
			    Preamble
 | 
			
		||||
 | 
			
		||||
  The licenses for most software are designed to take away your
 | 
			
		||||
freedom to share and change it.  By contrast, the GNU General Public
 | 
			
		||||
@@ -112,7 +112,7 @@ modification follow.  Pay close attention to the difference between a
 | 
			
		||||
former contains code derived from the library, whereas the latter must
 | 
			
		||||
be combined with the library in order to run.
 | 
			
		||||
 | 
			
		||||
                  GNU LESSER GENERAL PUBLIC LICENSE
 | 
			
		||||
		  GNU LESSER GENERAL PUBLIC LICENSE
 | 
			
		||||
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 | 
			
		||||
 | 
			
		||||
  0. This License Agreement applies to any software library or other
 | 
			
		||||
@@ -146,7 +146,7 @@ such a program is covered only if its contents constitute a work based
 | 
			
		||||
on the Library (independent of the use of the Library in a tool for
 | 
			
		||||
writing it).  Whether that is true depends on what the Library does
 | 
			
		||||
and what the program that uses the Library does.
 | 
			
		||||
 | 
			
		||||
  
 | 
			
		||||
  1. You may copy and distribute verbatim copies of the Library's
 | 
			
		||||
complete source code as you receive it, in any medium, provided that
 | 
			
		||||
you conspicuously and appropriately publish on each copy an
 | 
			
		||||
@@ -432,7 +432,7 @@ decision will be guided by the two goals of preserving the free status
 | 
			
		||||
of all derivatives of our free software and of promoting the sharing
 | 
			
		||||
and reuse of software generally.
 | 
			
		||||
 | 
			
		||||
                            NO WARRANTY
 | 
			
		||||
			    NO WARRANTY
 | 
			
		||||
 | 
			
		||||
  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
 | 
			
		||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
 | 
			
		||||
@@ -455,7 +455,7 @@ FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
 | 
			
		||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
 | 
			
		||||
DAMAGES.
 | 
			
		||||
 | 
			
		||||
                     END OF TERMS AND CONDITIONS
 | 
			
		||||
		     END OF TERMS AND CONDITIONS
 | 
			
		||||
 | 
			
		||||
           How to Apply These Terms to Your New Libraries
 | 
			
		||||
 | 
			
		||||
@@ -476,7 +476,7 @@ convey the exclusion of warranty; and each file should have at least the
 | 
			
		||||
    This library is free software; you can redistribute it and/or
 | 
			
		||||
    modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
    License as published by the Free Software Foundation; either
 | 
			
		||||
    version 2.1 of the License, or (at your option) any later version.
 | 
			
		||||
    version 2 of the License, or (at your option) any later version.
 | 
			
		||||
 | 
			
		||||
    This library is distributed in the hope that it will be useful,
 | 
			
		||||
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
@@ -485,7 +485,7 @@ convey the exclusion of warranty; and each file should have at least the
 | 
			
		||||
 | 
			
		||||
    You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
    License along with this library; if not, write to the Free Software
 | 
			
		||||
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 | 
			
		||||
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 | 
			
		||||
 | 
			
		||||
Also add information on how to contact you by electronic and paper mail.
 | 
			
		||||
 | 
			
		||||
@@ -500,3 +500,5 @@ necessary.  Here is a sample; alter the names:
 | 
			
		||||
  Ty Coon, President of Vice
 | 
			
		||||
 | 
			
		||||
That's all there is to it!
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										376
									
								
								Changelog
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										376
									
								
								Changelog
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,376 @@
 | 
			
		||||
version 0.8.1:
 | 
			
		||||
 | 
			
		||||
  - USB tablet support (Brad Campbell, Anthony Liguori)
 | 
			
		||||
  - win32 host serial support (Kazu)
 | 
			
		||||
  - PC speaker support (Joachim Henke)
 | 
			
		||||
  - IDE LBA48 support (Jens Axboe)
 | 
			
		||||
  - SSE3 support
 | 
			
		||||
  - Solaris port (Ben Taylor)
 | 
			
		||||
  - Preliminary SH4 target (Samuel Tardieu)
 | 
			
		||||
  - VNC server (Anthony Liguori)
 | 
			
		||||
  - slirp fixes (Ed Swierk et al.)
 | 
			
		||||
  - USB fixes
 | 
			
		||||
  - ARM Versatile Platform Baseboard emulation (Paul Brook)
 | 
			
		||||
 | 
			
		||||
version 0.8.0:
 | 
			
		||||
 | 
			
		||||
  - ARM system emulation: Arm Integrator/CP board with an arm1026ej-s
 | 
			
		||||
    cpu (Paul Brook)
 | 
			
		||||
  - SMP support
 | 
			
		||||
  - Mac OS X cocoa improvements (Mike Kronenberg)
 | 
			
		||||
  - Mac OS X CoreAudio driver (Mike Kronenberg)
 | 
			
		||||
  - DirectSound driver (malc)
 | 
			
		||||
  - ALSA audio driver (malc)
 | 
			
		||||
  - new audio options: '-soundhw' and '-audio-help' (malc)
 | 
			
		||||
  - ES1370 PCI audio device (malc)
 | 
			
		||||
  - Initial USB support
 | 
			
		||||
  - Linux host serial port access
 | 
			
		||||
  - Linux host low level parallel port access
 | 
			
		||||
  - New network emulation code supporting VLANs.
 | 
			
		||||
  - MIPS and MIPSel User Linux emulation
 | 
			
		||||
  - MIPS fixes to boot Linux (Daniel Jacobowitz)
 | 
			
		||||
  - NX bit support
 | 
			
		||||
  - Initial SPARC SMP support (Blue Swirl)
 | 
			
		||||
  - Major overhaul of the virtual FAT driver for read/write support
 | 
			
		||||
    (Johannes Schindelin)
 | 
			
		||||
 | 
			
		||||
version 0.7.2:
 | 
			
		||||
  
 | 
			
		||||
  - x86_64 fixes (Win2000 and Linux 2.6 boot in 32 bit)
 | 
			
		||||
  - merge self modifying code handling in dirty ram page mecanism.
 | 
			
		||||
  - MIPS fixes (Ralf Baechle)
 | 
			
		||||
  - better user net performances
 | 
			
		||||
 | 
			
		||||
version 0.7.1:
 | 
			
		||||
 | 
			
		||||
  - read-only Virtual FAT support (Johannes Schindelin)
 | 
			
		||||
  - Windows 2000 install disk full hack (original idea from Vladimir
 | 
			
		||||
    N. Oleynik)
 | 
			
		||||
  - VMDK disk image creation (Filip Navara)
 | 
			
		||||
  - SPARC64 progress (Blue Swirl)
 | 
			
		||||
  - initial MIPS support (Jocelyn mayer)
 | 
			
		||||
  - MIPS improvements (Ralf Baechle)
 | 
			
		||||
  - 64 bit fixes in user networking (initial patch by Gwenole Beauchesne)
 | 
			
		||||
  - IOAPIC support (Filip Navara)
 | 
			
		||||
 | 
			
		||||
version 0.7.0:
 | 
			
		||||
 | 
			
		||||
  - better BIOS translation and HDD geometry auto-detection
 | 
			
		||||
  - user mode networking bug fix
 | 
			
		||||
  - undocumented FPU ops support
 | 
			
		||||
  - Cirrus VGA: support for 1280x1024x[8,15,16] modes
 | 
			
		||||
  - 'pidfile' option
 | 
			
		||||
  - .dmg disk image format support (Johannes Schindelin)
 | 
			
		||||
  - keymaps support (initial patch by Johannes Schindelin)
 | 
			
		||||
  - big endian ARM support (Lennert Buytenhek)
 | 
			
		||||
  - added generic 64 bit target support
 | 
			
		||||
  - x86_64 target support
 | 
			
		||||
  - initial APIC support
 | 
			
		||||
  - MMX/SSE/SSE2/PNI support
 | 
			
		||||
  - PC parallel port support (Mark Jonckheere)
 | 
			
		||||
  - initial SPARC64 support (Blue Swirl)
 | 
			
		||||
  - SPARC target boots Linux (Blue Swirl)
 | 
			
		||||
  - armv5te user mode support (Paul Brook)
 | 
			
		||||
  - ARM VFP support (Paul Brook)
 | 
			
		||||
  - ARM "Angel" semihosting syscalls (Paul Brook)
 | 
			
		||||
  - user mode gdb stub support (Paul Brook)
 | 
			
		||||
  - Samba 3 support
 | 
			
		||||
  - initial Cocoa support (Pierre d'Herbemont)
 | 
			
		||||
  - generic FPU emulation code
 | 
			
		||||
  - Virtual PC read-only disk image support (Alex Beregszaszi)
 | 
			
		||||
 | 
			
		||||
version 0.6.1:
 | 
			
		||||
 | 
			
		||||
  - Mac OS X port (Pierre d'Herbemont)
 | 
			
		||||
  - Virtual console support
 | 
			
		||||
  - Better monitor line edition
 | 
			
		||||
  - New block device layer 
 | 
			
		||||
  - New 'qcow' growable disk image support with AES encryption and
 | 
			
		||||
    transparent decompression
 | 
			
		||||
  - VMware 3 and 4 read-only disk image support (untested)
 | 
			
		||||
  - Support for up to 4 serial ports
 | 
			
		||||
  - TFTP server support (Magnus Damm)
 | 
			
		||||
  - Port redirection support in user mode networking
 | 
			
		||||
  - Support for not executable data sections
 | 
			
		||||
  - Compressed loop disk image support (Johannes Schindelin)
 | 
			
		||||
  - Level triggered IRQ fix (aka NE2000 PCI performance fix) (Steve
 | 
			
		||||
    Wormley)
 | 
			
		||||
  - Fixed Fedora Core 2 problems (now you can run qemu without any
 | 
			
		||||
    LD_ASSUME_KERNEL tricks on FC2)
 | 
			
		||||
  - DHCP fix for Windows (accept DHCPREQUEST alone)
 | 
			
		||||
  - SPARC system emulation (Blue Swirl)
 | 
			
		||||
  - Automatic Samba configuration for host file access from Windows.
 | 
			
		||||
  - '-loadvm' and '-full-screen' options
 | 
			
		||||
  - ne2000 savevm support (Johannes Schindelin)
 | 
			
		||||
  - Ctrl-Alt is now the default grab key. Ctrl-Alt-[0-9] switches to
 | 
			
		||||
    the virtual consoles.
 | 
			
		||||
  - BIOS floppy fix for NT4 (Mike Nordell, Derek Fawcus, Volker Ruppert)
 | 
			
		||||
  - Floppy fixes for NT4 and NT5 (Mike Nordell)
 | 
			
		||||
  - NT4 IDE fixes (Ben Pfaf, Mike Nordell)
 | 
			
		||||
  - SDL Audio support and SB16 fixes (malc)
 | 
			
		||||
  - ENTER instruction bug fix (initial patch by Stefan Kisdaroczi)
 | 
			
		||||
  - VGA font change fix
 | 
			
		||||
  - VGA read-only CRTC register fix
 | 
			
		||||
 | 
			
		||||
version 0.6.0:
 | 
			
		||||
 | 
			
		||||
  - minimalist FPU exception support (NetBSD FPU probe fix)
 | 
			
		||||
  - cr0.ET fix (Win95 boot)
 | 
			
		||||
  - *BSD port (Markus Niemisto)
 | 
			
		||||
  - I/O access fix (signaled by Mark Jonckheere)
 | 
			
		||||
  - IDE drives serial number fix (Mike Nordell)
 | 
			
		||||
  - int13 CDROM BIOS fix (aka Solaris x86 install CD fix)
 | 
			
		||||
  - int15, ah=86 BIOS fix (aka Solaris x86 hardware probe hang up fix)
 | 
			
		||||
  - BSR/BSF "undefined behaviour" fix
 | 
			
		||||
  - vmdk2raw: convert VMware disk images to raw images
 | 
			
		||||
  - PCI support
 | 
			
		||||
  - NE2K PCI support
 | 
			
		||||
  - dummy VGA PCI support
 | 
			
		||||
  - VGA font selection fix (Daniel Serpell)
 | 
			
		||||
  - PIC reset fix (Hidemi KAWAI)
 | 
			
		||||
  - PIC spurious irq support (aka Solaris install bug)
 | 
			
		||||
  - added '-localtime' option
 | 
			
		||||
  - Cirrus CL-GD54xx VGA support (initial patch by Makoto Suzuki (suzu))
 | 
			
		||||
  - APM and system shutdown support
 | 
			
		||||
  - Fixed system reset
 | 
			
		||||
  - Support for other PC BIOSes
 | 
			
		||||
  - Initial PowerMac hardware emulation
 | 
			
		||||
  - PowerMac/PREP OpenFirmware compatible BIOS (Jocelyn Mayer)
 | 
			
		||||
  - initial IDE BMDMA support (needed for Darwin x86)
 | 
			
		||||
  - Set the default memory size for PC emulation to 128 MB
 | 
			
		||||
 | 
			
		||||
version 0.5.5:
 | 
			
		||||
 | 
			
		||||
  - SDL full screen support (initial patch by malc)
 | 
			
		||||
  - VGA support on PowerPC PREP
 | 
			
		||||
  - VBE fixes (Matthew Mastracci)
 | 
			
		||||
  - PIT fixes (aka Win98 hardware probe and "VGA slowness" bug)
 | 
			
		||||
  - IDE master only fixes (aka Win98 CD-ROM probe bug)
 | 
			
		||||
  - ARM load/store half word fix (Ulrich Hecht)
 | 
			
		||||
  - FDC fixes for Win98
 | 
			
		||||
 | 
			
		||||
version 0.5.4:
 | 
			
		||||
  
 | 
			
		||||
  - qemu-fast fixes
 | 
			
		||||
  - BIOS area protection fix (aka EMM386.EXE fix) (Mike Nordell)
 | 
			
		||||
  - keyboard/mouse fix (Mike Nordell)
 | 
			
		||||
  - IDE fixes (Linux did not recognized slave drivers)
 | 
			
		||||
  - VM86 EIP masking fix (aka NT5 install fix) (Mike Nordell)
 | 
			
		||||
  - QEMU can now boot a PowerPC Linux kernel (Jocelyn Mayer)
 | 
			
		||||
  - User mode network stack
 | 
			
		||||
  - imul imm8 fix + 0x82 opcode support (Hidemi KAWAI)
 | 
			
		||||
  - precise self modifying code (aka BeOS install bug)
 | 
			
		||||
 | 
			
		||||
version 0.5.3:
 | 
			
		||||
 | 
			
		||||
  - added Bochs VESA VBE support
 | 
			
		||||
  - VGA memory map mode 3 access fix (OS/2 install fix)
 | 
			
		||||
  - IDE fixes (Jens Axboe)
 | 
			
		||||
  - CPU interrupt fixes
 | 
			
		||||
  - fixed various TLB invalidation cases (NT install)
 | 
			
		||||
  - fixed cr0.WP semantics (XP install)
 | 
			
		||||
  - direct chaining support for SPARC and PowerPC (faster)
 | 
			
		||||
  - ARM NWFPE support (initial patch by Ulrich Hecht)
 | 
			
		||||
  - added specific x86 to x86 translator (close to native performance
 | 
			
		||||
    in qemu-i386 and qemu-fast)
 | 
			
		||||
  - shm syscalls support (Paul McKerras)
 | 
			
		||||
  - added accurate CR0.MP/ME/TS emulation
 | 
			
		||||
  - fixed DMA memory write access (Win95 boot floppy fix)
 | 
			
		||||
  - graphical x86 linux loader
 | 
			
		||||
  - command line monitor 
 | 
			
		||||
  - generic removable device support
 | 
			
		||||
  - support of CD-ROM change
 | 
			
		||||
  - multiple network interface support
 | 
			
		||||
  - initial x86-64 host support (Gwenole Beauchesne)
 | 
			
		||||
  - lret to outer priviledge fix (OS/2 install fix)
 | 
			
		||||
  - task switch fixes (SkyOS boot)
 | 
			
		||||
  - VM save/restore commands
 | 
			
		||||
  - new timer API
 | 
			
		||||
  - more precise RTC emulation (periodic timers + time updates)
 | 
			
		||||
  - Win32 port (initial patch by Kazu)
 | 
			
		||||
 | 
			
		||||
version 0.5.2:
 | 
			
		||||
 | 
			
		||||
  - improved soft MMU speed (assembly functions and specializing)
 | 
			
		||||
  - improved multitasking speed by avoiding flushing TBs when
 | 
			
		||||
    switching tasks
 | 
			
		||||
  - improved qemu-fast speed
 | 
			
		||||
  - improved self modifying code handling (big performance gain in
 | 
			
		||||
    softmmu mode).
 | 
			
		||||
  - fixed IO checking
 | 
			
		||||
  - fixed CD-ROM detection (win98 install CD)
 | 
			
		||||
  - fixed addseg real mode bug (GRUB boot fix)
 | 
			
		||||
  - added ROM memory support (win98 boot)
 | 
			
		||||
  - fixed 'call Ev' in case of paging exception
 | 
			
		||||
  - updated the script 'qemu-binfmt-conf.sh' to use QEMU automagically
 | 
			
		||||
    when launching executables for the supported target CPUs.
 | 
			
		||||
  - PowerPC system emulation update (Jocelyn Mayer)
 | 
			
		||||
  - PC floppy emulation and DMA fixes (Jocelyn Mayer)
 | 
			
		||||
  - polled mode for PIC (Jocelyn Mayer)
 | 
			
		||||
  - fixed PTE dirty bit handling
 | 
			
		||||
  - fixed xadd same reg bug
 | 
			
		||||
  - fixed cmpxchg exception safeness
 | 
			
		||||
  - access to virtual memory in gdb stub
 | 
			
		||||
  - task gate and NT flag fixes
 | 
			
		||||
  - eflags optimisation fix for string operations
 | 
			
		||||
 | 
			
		||||
version 0.5.1:
 | 
			
		||||
  
 | 
			
		||||
  - float access fixes when using soft mmu
 | 
			
		||||
  - PC emulation support on PowerPC
 | 
			
		||||
  - A20 support
 | 
			
		||||
  - IDE CD-ROM emulation
 | 
			
		||||
  - ARM fixes (Ulrich Hecht)
 | 
			
		||||
  - SB16 emulation (malc)
 | 
			
		||||
  - IRET and INT fixes in VM86 mode with IOPL=3
 | 
			
		||||
  - Port I/Os use TSS io map
 | 
			
		||||
  - Full task switching/task gate support
 | 
			
		||||
  - added verr, verw, arpl, fcmovxx
 | 
			
		||||
  - PowerPC target support (Jocelyn Mayer)
 | 
			
		||||
  - Major SPARC target fixes (dynamically linked programs begin to work)
 | 
			
		||||
 | 
			
		||||
version 0.5.0:
 | 
			
		||||
  
 | 
			
		||||
  - full hardware level VGA emulation
 | 
			
		||||
  - graphical display with SDL
 | 
			
		||||
  - added PS/2 mouse and keyboard emulation
 | 
			
		||||
  - popw (%esp) fix
 | 
			
		||||
  - mov to/from segment data width fix
 | 
			
		||||
  - added real mode support
 | 
			
		||||
  - added Bochs BIOS and LGPL'ed VGA BIOS loader in qemu
 | 
			
		||||
  - m68k host port (Richard Zidlicky)
 | 
			
		||||
  - partial soft MMU support for memory mapped I/Os
 | 
			
		||||
  - multi-target build
 | 
			
		||||
  - fixed: no error code in hardware interrupts
 | 
			
		||||
  - fixed: pop ss, mov ss, x and sti disable hardware irqs for the next insn
 | 
			
		||||
  - correct single stepping thru string operations
 | 
			
		||||
  - preliminary SPARC target support (Thomas M. Ogrisegg)
 | 
			
		||||
  - tun-fd option (Rusty Russell)
 | 
			
		||||
  - automatic IDE geometry detection
 | 
			
		||||
  - renamed 'vl' to qemu[-fast] and user qemu to qemu-{cpu}.
 | 
			
		||||
  - added man page
 | 
			
		||||
  - added full soft mmu mode to launch unpatched OSes.
 | 
			
		||||
 | 
			
		||||
version 0.4.3:
 | 
			
		||||
 | 
			
		||||
  - x86 exception fix in case of nop instruction.
 | 
			
		||||
  - gcc 3.2.2 bug workaround (RedHat 9 fix)
 | 
			
		||||
  - sparc and Alpha host fixes
 | 
			
		||||
  - many ARM target fixes: 'ls' and 'bash' can be launched.
 | 
			
		||||
 | 
			
		||||
version 0.4.2:
 | 
			
		||||
 | 
			
		||||
 - many exception handling fixes (can compile a Linux kernel inside vl)
 | 
			
		||||
 - IDE emulation support
 | 
			
		||||
 - initial GDB stub support
 | 
			
		||||
 - deferred update support for disk images (Rusty Russell)
 | 
			
		||||
 - accept User Mode Linux Copy On Write disk images
 | 
			
		||||
 - SMP kernels can at least be booted
 | 
			
		||||
 | 
			
		||||
version 0.4.1:
 | 
			
		||||
  
 | 
			
		||||
 - more accurate timer support in vl.
 | 
			
		||||
 - more reliable NE2000 probe in vl.
 | 
			
		||||
 - added 2.5.66 kernel in vl-test.
 | 
			
		||||
 - added VLTMPDIR environment variable in vl.
 | 
			
		||||
 | 
			
		||||
version 0.4:
 | 
			
		||||
 | 
			
		||||
 - initial support for ring 0 x86 processor emulation
 | 
			
		||||
 - fixed signal handling for correct dosemu DPMI emulation
 | 
			
		||||
 - fast x86 MMU emulation with mmap()
 | 
			
		||||
 - fixed popl (%esp) case
 | 
			
		||||
 - Linux kernel can be executed by QEMU with the 'vl' command.
 | 
			
		||||
 | 
			
		||||
version 0.3:
 | 
			
		||||
 | 
			
		||||
 - initial support for ARM emulation
 | 
			
		||||
 - added fnsave, frstor, fnstenv, fldenv FPU instructions
 | 
			
		||||
 - added FPU register save in signal emulation
 | 
			
		||||
 - initial ARM port
 | 
			
		||||
 - Sparc and Alpha ports work on the regression test
 | 
			
		||||
 - generic ioctl number conversion
 | 
			
		||||
 - fixed ioctl type conversion
 | 
			
		||||
 | 
			
		||||
version 0.2:
 | 
			
		||||
 | 
			
		||||
 - PowerPC disassembly and ELF symbols output (Rusty Russell)
 | 
			
		||||
 - flock support (Rusty Russell)
 | 
			
		||||
 - ugetrlimit support (Rusty Russell)
 | 
			
		||||
 - fstat64 fix (Rusty Russell)
 | 
			
		||||
 - initial Alpha port (Falk Hueffner)
 | 
			
		||||
 - initial IA64 port (Matt Wilson)
 | 
			
		||||
 - initial Sparc and Sparc64 port (David S. Miller)
 | 
			
		||||
 - added HLT instruction
 | 
			
		||||
 - LRET instruction fix.
 | 
			
		||||
 - added GPF generation for I/Os.
 | 
			
		||||
 - added INT3 and TF flag support.
 | 
			
		||||
 - SHL instruction C flag fix.
 | 
			
		||||
 - mmap emulation for host page size > 4KB
 | 
			
		||||
 - self-modifying code support
 | 
			
		||||
 - better VM86 support (dosemu works on non trivial programs)
 | 
			
		||||
 - precise exception support (EIP is computed correctly in most cases)
 | 
			
		||||
 - more precise LDT/GDT/IDT emulation
 | 
			
		||||
 - faster segment load in vm86 mode
 | 
			
		||||
 - direct chaining of basic blocks (faster emulation)
 | 
			
		||||
 | 
			
		||||
version 0.1.6:
 | 
			
		||||
 | 
			
		||||
 - automatic library search system. QEMU can now work with unpatched
 | 
			
		||||
   ELF dynamic loader and libc (Rusty Russell).
 | 
			
		||||
 - ISO C warning fixes (Alistair Strachan)
 | 
			
		||||
 - first self-virtualizable version (works only as long as the
 | 
			
		||||
   translation cache is not flushed)
 | 
			
		||||
 - RH9 fixes
 | 
			
		||||
 | 
			
		||||
version 0.1.5:
 | 
			
		||||
 | 
			
		||||
 - ppc64 support + personality() patch (Rusty Russell)
 | 
			
		||||
 - first Alpha CPU patches (Falk Hueffner)
 | 
			
		||||
 - removed bfd.h dependancy
 | 
			
		||||
 - fixed shrd, shld, idivl and divl on PowerPC.
 | 
			
		||||
 - fixed buggy glibc PowerPC rint() function (test-i386 passes now on PowerPC).
 | 
			
		||||
 | 
			
		||||
version 0.1.4:
 | 
			
		||||
 | 
			
		||||
 - more accurate VM86 emulation (can launch small DOS 16 bit
 | 
			
		||||
   executables in wine).
 | 
			
		||||
 - fixed push/pop fs/gs
 | 
			
		||||
 - added iret instruction.
 | 
			
		||||
 - added times() syscall and SIOCATMARK ioctl.
 | 
			
		||||
 | 
			
		||||
version 0.1.3:
 | 
			
		||||
 | 
			
		||||
 - S390 support (Ulrich Weigand)
 | 
			
		||||
 - glibc 2.3.x compile fix (Ulrich Weigand)
 | 
			
		||||
 - socketcall endian fix (Ulrich Weigand)
 | 
			
		||||
 - struct sockaddr endian fix (Ulrich Weigand)
 | 
			
		||||
 - sendmsg/recvmsg endian fix (Ulrich Weigand)
 | 
			
		||||
 - execve endian fix (Ulrich Weigand)
 | 
			
		||||
 - fdset endian fix (Ulrich Weigand)
 | 
			
		||||
 - partial setsockopt syscall support (Ulrich Weigand)
 | 
			
		||||
 - more accurate pushf/popf emulation
 | 
			
		||||
 - first partial vm86() syscall support (can be used with runcom example).
 | 
			
		||||
 - added bound, cmpxchg8b, cpuid instructions
 | 
			
		||||
 - added 16 bit addressing support/override for string operations
 | 
			
		||||
 - poll() fix
 | 
			
		||||
 
 | 
			
		||||
version 0.1.2:
 | 
			
		||||
 | 
			
		||||
 - compile fixes
 | 
			
		||||
 - xlat instruction
 | 
			
		||||
 - xchg instruction memory lock
 | 
			
		||||
 - added simple vm86 example (not working with QEMU yet). The 54 byte
 | 
			
		||||
   DOS executable 'pi_10.com' program was released by Bertram
 | 
			
		||||
   Felgenhauer (more information at http://www.boo.net/~jasonp/pipage.html).
 | 
			
		||||
 | 
			
		||||
version 0.1.1:
 | 
			
		||||
 | 
			
		||||
 - glibc 2.2 compilation fixes
 | 
			
		||||
 - added -s and -L options
 | 
			
		||||
 - binary distribution of x86 glibc and wine
 | 
			
		||||
 - big endian fixes in ELF loader and getdents.
 | 
			
		||||
 | 
			
		||||
version 0.1:
 | 
			
		||||
 | 
			
		||||
 - initial public release.
 | 
			
		||||
							
								
								
									
										5
									
								
								Kconfig
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								Kconfig
									
									
									
									
									
								
							@@ -1,5 +0,0 @@
 | 
			
		||||
source Kconfig.host
 | 
			
		||||
source backends/Kconfig
 | 
			
		||||
source accel/Kconfig
 | 
			
		||||
source hw/Kconfig
 | 
			
		||||
source semihosting/Kconfig
 | 
			
		||||
							
								
								
									
										43
									
								
								Kconfig.host
									
									
									
									
									
								
							
							
						
						
									
										43
									
								
								Kconfig.host
									
									
									
									
									
								
							@@ -1,43 +0,0 @@
 | 
			
		||||
# These are "proxy" symbols used to pass config-host.mak values
 | 
			
		||||
# down to Kconfig.  See also kconfig_external_symbols in
 | 
			
		||||
# meson.build: these two need to be kept in sync.
 | 
			
		||||
 | 
			
		||||
config LINUX
 | 
			
		||||
    bool
 | 
			
		||||
 | 
			
		||||
config OPENGL
 | 
			
		||||
    bool
 | 
			
		||||
 | 
			
		||||
config X11
 | 
			
		||||
    bool
 | 
			
		||||
 | 
			
		||||
config SPICE
 | 
			
		||||
    bool
 | 
			
		||||
 | 
			
		||||
config IVSHMEM
 | 
			
		||||
    bool
 | 
			
		||||
 | 
			
		||||
config TPM
 | 
			
		||||
    bool
 | 
			
		||||
 | 
			
		||||
config VHOST_USER
 | 
			
		||||
    bool
 | 
			
		||||
    select VHOST
 | 
			
		||||
 | 
			
		||||
config VHOST_VDPA
 | 
			
		||||
    bool
 | 
			
		||||
    select VHOST
 | 
			
		||||
 | 
			
		||||
config VHOST_KERNEL
 | 
			
		||||
    bool
 | 
			
		||||
    select VHOST
 | 
			
		||||
 | 
			
		||||
config VIRTFS
 | 
			
		||||
    bool
 | 
			
		||||
 | 
			
		||||
config PVRDMA
 | 
			
		||||
    bool
 | 
			
		||||
 | 
			
		||||
config MULTIPROCESS_ALLOWED
 | 
			
		||||
    bool
 | 
			
		||||
    imply MULTIPROCESS
 | 
			
		||||
							
								
								
									
										31
									
								
								LICENSE
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								LICENSE
									
									
									
									
									
								
							@@ -1,27 +1,12 @@
 | 
			
		||||
The QEMU distribution includes both the QEMU emulator and
 | 
			
		||||
various firmware files.  These are separate programs that are
 | 
			
		||||
distributed together for our users' convenience, and they have
 | 
			
		||||
separate licenses.
 | 
			
		||||
The following points clarify the QEMU licenses:
 | 
			
		||||
 | 
			
		||||
The following points clarify the license of the QEMU emulator:
 | 
			
		||||
1) The QEMU virtual CPU core library (libqemu.a) and the QEMU PC
 | 
			
		||||
   system emulator are released under the GNU Lesser General Public
 | 
			
		||||
   License.
 | 
			
		||||
 | 
			
		||||
1) The QEMU emulator as a whole is released under the GNU General
 | 
			
		||||
Public License, version 2.
 | 
			
		||||
2) The Linux user mode QEMU emulator is released under the GNU General
 | 
			
		||||
   Public License.
 | 
			
		||||
 | 
			
		||||
2) Parts of the QEMU emulator have specific licenses which are compatible
 | 
			
		||||
with the GNU General Public License, version 2. Hence each source file
 | 
			
		||||
contains its own licensing information.  Source files with no licensing
 | 
			
		||||
information are released under the GNU General Public License, version
 | 
			
		||||
2 or (at your option) any later version.
 | 
			
		||||
3) QEMU is a trademark of Fabrice Bellard.
 | 
			
		||||
 | 
			
		||||
As of July 2013, contributions under version 2 of the GNU General Public
 | 
			
		||||
License (and no later version) are only accepted for the following files
 | 
			
		||||
or directories: bsd-user/, linux-user/, hw/vfio/, hw/xen/xen_pt*.
 | 
			
		||||
 | 
			
		||||
3) The Tiny Code Generator (TCG) is mostly under the BSD or MIT licenses;
 | 
			
		||||
   but some parts may be GPLv2 or other licenses. Again, see the
 | 
			
		||||
   specific licensing information in each source file.
 | 
			
		||||
 | 
			
		||||
4) QEMU is a trademark of Fabrice Bellard.
 | 
			
		||||
 | 
			
		||||
Fabrice Bellard and the QEMU team
 | 
			
		||||
Fabrice Bellard.
 | 
			
		||||
							
								
								
									
										3402
									
								
								MAINTAINERS
									
									
									
									
									
								
							
							
						
						
									
										3402
									
								
								MAINTAINERS
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										425
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										425
									
								
								Makefile
									
									
									
									
									
								
							@@ -1,327 +1,146 @@
 | 
			
		||||
# Makefile for QEMU.
 | 
			
		||||
 | 
			
		||||
ifneq ($(words $(subst :, ,$(CURDIR))), 1)
 | 
			
		||||
  $(error main directory cannot contain spaces nor colons)
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
# Always point to the root of the build tree (needs GNU make).
 | 
			
		||||
BUILD_DIR=$(CURDIR)
 | 
			
		||||
 | 
			
		||||
# Before including a proper config-host.mak, assume we are in the source tree
 | 
			
		||||
SRC_PATH=.
 | 
			
		||||
 | 
			
		||||
# Don't use implicit rules or variables
 | 
			
		||||
# we have explicit rules for everything
 | 
			
		||||
MAKEFLAGS += -rR
 | 
			
		||||
 | 
			
		||||
SHELL = /usr/bin/env bash -o pipefail
 | 
			
		||||
 | 
			
		||||
# Usage: $(call quiet-command,command and args,"NAME","args to print")
 | 
			
		||||
# This will run "command and args", and either:
 | 
			
		||||
#  if V=1 just print the whole command and args
 | 
			
		||||
#  otherwise print the 'quiet' output in the format "  NAME     args to print"
 | 
			
		||||
# NAME should be a short name of the command, 7 letters or fewer.
 | 
			
		||||
# If called with only a single argument, will print nothing in quiet mode.
 | 
			
		||||
quiet-command-run = $(if $(V),,$(if $2,printf "  %-7s %s\n" $2 $3 && ))$1
 | 
			
		||||
quiet-@ = $(if $(V),,@)
 | 
			
		||||
quiet-command = $(quiet-@)$(call quiet-command-run,$1,$2,$3)
 | 
			
		||||
 | 
			
		||||
UNCHECKED_GOALS := %clean TAGS cscope ctags dist \
 | 
			
		||||
    help check-help print-% \
 | 
			
		||||
    docker docker-% vm-help vm-test vm-build-%
 | 
			
		||||
 | 
			
		||||
all:
 | 
			
		||||
.PHONY: all clean distclean recurse-all dist msi FORCE
 | 
			
		||||
 | 
			
		||||
# Don't try to regenerate Makefile or configure
 | 
			
		||||
# We don't generate any of them
 | 
			
		||||
Makefile: ;
 | 
			
		||||
configure: ;
 | 
			
		||||
 | 
			
		||||
# All following code might depend on configuration variables
 | 
			
		||||
ifneq ($(wildcard config-host.mak),)
 | 
			
		||||
include config-host.mak
 | 
			
		||||
 | 
			
		||||
git-submodule-update:
 | 
			
		||||
.git-submodule-status: git-submodule-update config-host.mak
 | 
			
		||||
Makefile: .git-submodule-status
 | 
			
		||||
 | 
			
		||||
.PHONY: git-submodule-update
 | 
			
		||||
git-submodule-update:
 | 
			
		||||
	$(call quiet-command, \
 | 
			
		||||
		(GIT="$(GIT)" "$(SRC_PATH)/scripts/git-submodule.sh" $(GIT_SUBMODULES_ACTION) $(GIT_SUBMODULES)), \
 | 
			
		||||
		"GIT","$(GIT_SUBMODULES)")
 | 
			
		||||
 | 
			
		||||
# 0. ensure the build tree is okay
 | 
			
		||||
 | 
			
		||||
# Check that we're not trying to do an out-of-tree build from
 | 
			
		||||
# a tree that's been used for an in-tree build.
 | 
			
		||||
ifneq ($(realpath $(SRC_PATH)),$(realpath .))
 | 
			
		||||
ifneq ($(wildcard $(SRC_PATH)/config-host.mak),)
 | 
			
		||||
$(error This is an out of tree build but your source tree ($(SRC_PATH)) \
 | 
			
		||||
seems to have been used for an in-tree build. You can fix this by running \
 | 
			
		||||
"$(MAKE) distclean && rm -rf *-linux-user *-softmmu" in your source tree)
 | 
			
		||||
CFLAGS=-Wall -O2 -g -fno-strict-aliasing -I.
 | 
			
		||||
ifdef CONFIG_DARWIN
 | 
			
		||||
CFLAGS+= -mdynamic-no-pic
 | 
			
		||||
endif
 | 
			
		||||
LDFLAGS=-g
 | 
			
		||||
LIBS=
 | 
			
		||||
DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
 | 
			
		||||
TOOLS=qemu-img$(EXESUF)
 | 
			
		||||
ifdef CONFIG_STATIC
 | 
			
		||||
LDFLAGS+=-static
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
# force a rerun of configure if config-host.mak is too old or corrupted
 | 
			
		||||
ifeq ($(MESON),)
 | 
			
		||||
.PHONY: config-host.mak
 | 
			
		||||
x := $(shell rm -rf meson-private meson-info meson-logs)
 | 
			
		||||
endif
 | 
			
		||||
ifeq ($(NINJA),)
 | 
			
		||||
.PHONY: config-host.mak
 | 
			
		||||
x := $(shell rm -rf meson-private meson-info meson-logs)
 | 
			
		||||
ifdef BUILD_DOCS
 | 
			
		||||
DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1
 | 
			
		||||
else
 | 
			
		||||
export NINJA
 | 
			
		||||
endif
 | 
			
		||||
ifeq ($(wildcard build.ninja),)
 | 
			
		||||
.PHONY: config-host.mak
 | 
			
		||||
x := $(shell rm -rf meson-private meson-info meson-logs)
 | 
			
		||||
endif
 | 
			
		||||
ifeq ($(origin prefix),file)
 | 
			
		||||
.PHONY: config-host.mak
 | 
			
		||||
x := $(shell rm -rf meson-private meson-info meson-logs)
 | 
			
		||||
DOCS=
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
# 1. ensure config-host.mak is up-to-date
 | 
			
		||||
config-host.mak: $(SRC_PATH)/configure $(SRC_PATH)/pc-bios $(SRC_PATH)/VERSION
 | 
			
		||||
	@echo config-host.mak is out-of-date, running configure
 | 
			
		||||
	@if test -f meson-private/coredata.dat; then \
 | 
			
		||||
	  ./config.status --skip-meson; \
 | 
			
		||||
	else \
 | 
			
		||||
	  ./config.status && touch build.ninja.stamp; \
 | 
			
		||||
	fi
 | 
			
		||||
all: dyngen$(EXESUF) $(TOOLS) $(DOCS)
 | 
			
		||||
	for d in $(TARGET_DIRS); do \
 | 
			
		||||
	$(MAKE) -C $$d $@ || exit 1 ; \
 | 
			
		||||
        done
 | 
			
		||||
 | 
			
		||||
# 2. meson.stamp exists if meson has run at least once (so ninja reconfigure
 | 
			
		||||
# works), but otherwise never needs to be updated
 | 
			
		||||
meson-private/coredata.dat: meson.stamp
 | 
			
		||||
meson.stamp: config-host.mak
 | 
			
		||||
	@touch meson.stamp
 | 
			
		||||
qemu-img$(EXESUF): qemu-img.c block.c block-cow.c block-qcow.c aes.c block-vmdk.c block-cloop.c block-dmg.c block-bochs.c block-vpc.c block-vvfat.c
 | 
			
		||||
	$(CC) -DQEMU_TOOL $(CFLAGS) $(LDFLAGS) $(DEFINES) -o $@ $^ -lz $(LIBS)
 | 
			
		||||
 | 
			
		||||
# 3. ensure generated build files are up-to-date
 | 
			
		||||
dyngen$(EXESUF): dyngen.c
 | 
			
		||||
	$(HOST_CC) $(CFLAGS) $(DEFINES) -o $@ $^
 | 
			
		||||
 | 
			
		||||
ifneq ($(NINJA),)
 | 
			
		||||
Makefile.ninja: build.ninja
 | 
			
		||||
	$(quiet-@){ \
 | 
			
		||||
	  echo 'ninja-targets = \'; \
 | 
			
		||||
	  $(NINJA) -t targets all | sed 's/:.*//; $$!s/$$/ \\/'; \
 | 
			
		||||
	  echo 'build-files = \'; \
 | 
			
		||||
	  $(NINJA) -t query build.ninja | sed -n '1,/^  input:/d; /^  outputs:/q; s/$$/ \\/p'; \
 | 
			
		||||
	} > $@.tmp && mv $@.tmp $@
 | 
			
		||||
-include Makefile.ninja
 | 
			
		||||
 | 
			
		||||
# A separate rule is needed for Makefile dependencies to avoid -n
 | 
			
		||||
build.ninja: build.ninja.stamp
 | 
			
		||||
$(build-files):
 | 
			
		||||
build.ninja.stamp: meson.stamp $(build-files)
 | 
			
		||||
	$(NINJA) $(if $V,-v,) build.ninja && touch $@
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifneq ($(MESON),)
 | 
			
		||||
Makefile.mtest: build.ninja scripts/mtest2make.py
 | 
			
		||||
	$(MESON) introspect --targets --tests --benchmarks | $(PYTHON) scripts/mtest2make.py > $@
 | 
			
		||||
-include Makefile.mtest
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
# 4. Rules to bridge to other makefiles
 | 
			
		||||
 | 
			
		||||
ifneq ($(NINJA),)
 | 
			
		||||
MAKE.n = $(findstring n,$(firstword $(MAKEFLAGS)))
 | 
			
		||||
MAKE.k = $(findstring k,$(firstword $(MAKEFLAGS)))
 | 
			
		||||
MAKE.q = $(findstring q,$(firstword $(MAKEFLAGS)))
 | 
			
		||||
MAKE.nq = $(if $(word 2, $(MAKE.n) $(MAKE.q)),nq)
 | 
			
		||||
NINJAFLAGS = $(if $V,-v) $(if $(MAKE.n), -n) $(if $(MAKE.k), -k0) \
 | 
			
		||||
        $(filter-out -j, $(lastword -j1 $(filter -l% -j%, $(MAKEFLAGS)))) \
 | 
			
		||||
 | 
			
		||||
ninja-cmd-goals = $(or $(MAKECMDGOALS), all)
 | 
			
		||||
ninja-cmd-goals += $(foreach t, $(.tests), $(.test.deps.$t))
 | 
			
		||||
 | 
			
		||||
makefile-targets := build.ninja ctags TAGS cscope dist clean uninstall
 | 
			
		||||
# "ninja -t targets" also lists all prerequisites.  If build system
 | 
			
		||||
# files are marked as PHONY, however, Make will always try to execute
 | 
			
		||||
# "ninja build.ninja".
 | 
			
		||||
ninja-targets := $(filter-out $(build-files) $(makefile-targets), $(ninja-targets))
 | 
			
		||||
.PHONY: $(ninja-targets) run-ninja
 | 
			
		||||
$(ninja-targets): run-ninja
 | 
			
		||||
 | 
			
		||||
# Use "| cat" to give Ninja a more "make-y" output.  Use "+" to bypass the
 | 
			
		||||
# --output-sync line.
 | 
			
		||||
run-ninja: config-host.mak
 | 
			
		||||
ifneq ($(filter $(ninja-targets), $(ninja-cmd-goals)),)
 | 
			
		||||
	+$(quiet-@)$(if $(MAKE.nq),@:, $(NINJA) -d keepdepfile \
 | 
			
		||||
	   $(NINJAFLAGS) $(sort $(filter $(ninja-targets), $(ninja-cmd-goals))) | cat)
 | 
			
		||||
endif
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
# Force configure to re-run if the API symbols are updated
 | 
			
		||||
ifeq ($(CONFIG_PLUGIN),y)
 | 
			
		||||
config-host.mak: $(SRC_PATH)/plugins/qemu-plugins.symbols
 | 
			
		||||
 | 
			
		||||
.PHONY: plugins
 | 
			
		||||
plugins:
 | 
			
		||||
	$(call quiet-command,\
 | 
			
		||||
		$(MAKE) $(SUBDIR_MAKEFLAGS) -C contrib/plugins V="$(V)", \
 | 
			
		||||
		"BUILD", "example plugins")
 | 
			
		||||
endif # $(CONFIG_PLUGIN)
 | 
			
		||||
 | 
			
		||||
else # config-host.mak does not exist
 | 
			
		||||
config-host.mak:
 | 
			
		||||
ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
 | 
			
		||||
	@echo "Please call configure before running make!"
 | 
			
		||||
	@exit 1
 | 
			
		||||
endif
 | 
			
		||||
endif # config-host.mak does not exist
 | 
			
		||||
 | 
			
		||||
SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory --quiet)
 | 
			
		||||
 | 
			
		||||
include $(SRC_PATH)/tests/Makefile.include
 | 
			
		||||
 | 
			
		||||
all: recurse-all
 | 
			
		||||
 | 
			
		||||
ROM_DIRS = $(addprefix pc-bios/, $(ROMS))
 | 
			
		||||
ROM_DIRS_RULES=$(foreach t, all clean, $(addsuffix /$(t), $(ROM_DIRS)))
 | 
			
		||||
# Only keep -O and -g cflags
 | 
			
		||||
.PHONY: $(ROM_DIRS_RULES)
 | 
			
		||||
$(ROM_DIRS_RULES):
 | 
			
		||||
	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" $(notdir $@),)
 | 
			
		||||
 | 
			
		||||
.PHONY: recurse-all recurse-clean
 | 
			
		||||
recurse-all: $(addsuffix /all, $(ROM_DIRS))
 | 
			
		||||
recurse-clean: $(addsuffix /clean, $(ROM_DIRS))
 | 
			
		||||
 | 
			
		||||
######################################################################
 | 
			
		||||
 | 
			
		||||
clean: recurse-clean
 | 
			
		||||
	-$(quiet-@)test -f build.ninja && $(NINJA) $(NINJAFLAGS) -t clean || :
 | 
			
		||||
	-$(quiet-@)test -f build.ninja && $(NINJA) $(NINJAFLAGS) clean-ctlist || :
 | 
			
		||||
clean:
 | 
			
		||||
# avoid old build problems by removing potentially incorrect old files
 | 
			
		||||
	rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
 | 
			
		||||
	find . \( -name '*.so' -o -name '*.dll' -o -name '*.[oda]' \) -type f \
 | 
			
		||||
		! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-aarch64.a \
 | 
			
		||||
		! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-arm.a \
 | 
			
		||||
		-exec rm {} +
 | 
			
		||||
	rm -f TAGS cscope.* *.pod *~ */*~
 | 
			
		||||
	rm -f fsdev/*.pod scsi/*.pod
 | 
			
		||||
 | 
			
		||||
VERSION = $(shell cat $(SRC_PATH)/VERSION)
 | 
			
		||||
 | 
			
		||||
dist: qemu-$(VERSION).tar.bz2
 | 
			
		||||
 | 
			
		||||
qemu-%.tar.bz2:
 | 
			
		||||
	$(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
 | 
			
		||||
	rm -f config.mak config.h op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h 
 | 
			
		||||
	rm -f *.o *.a $(TOOLS) dyngen$(EXESUF) TAGS *.pod *~ */*~
 | 
			
		||||
	$(MAKE) -C tests clean
 | 
			
		||||
	for d in $(TARGET_DIRS); do \
 | 
			
		||||
	$(MAKE) -C $$d $@ || exit 1 ; \
 | 
			
		||||
        done
 | 
			
		||||
 | 
			
		||||
distclean: clean
 | 
			
		||||
	-$(quiet-@)test -f build.ninja && $(NINJA) $(NINJAFLAGS) -t clean -g || :
 | 
			
		||||
	rm -f config-host.mak config-host.h*
 | 
			
		||||
	rm -f tests/tcg/config-*.mak
 | 
			
		||||
	rm -f config-all-disas.mak config.status
 | 
			
		||||
	rm -f roms/seabios/config.mak roms/vgabios/config.mak
 | 
			
		||||
	rm -f qemu-plugins-ld.symbols qemu-plugins-ld64.symbols
 | 
			
		||||
	rm -f *-config-target.h *-config-devices.mak *-config-devices.h
 | 
			
		||||
	rm -rf meson-private meson-logs meson-info compile_commands.json
 | 
			
		||||
	rm -f Makefile.ninja Makefile.mtest build.ninja.stamp meson.stamp
 | 
			
		||||
	rm -f config.log
 | 
			
		||||
	rm -f linux-headers/asm
 | 
			
		||||
	rm -Rf .sdk
 | 
			
		||||
	rm -f config-host.mak config-host.h $(DOCS)
 | 
			
		||||
	for d in $(TARGET_DIRS); do \
 | 
			
		||||
	rm -rf $$d || exit 1 ; \
 | 
			
		||||
        done
 | 
			
		||||
 | 
			
		||||
find-src-path = find "$(SRC_PATH)/" -path "$(SRC_PATH)/meson" -prune -o \( -name "*.[chsS]" -o -name "*.[ch].inc" \)
 | 
			
		||||
KEYMAPS=da     en-gb  et  fr     fr-ch  is  lt  modifiers  no  pt-br  sv \
 | 
			
		||||
ar      de     en-us  fi  fr-be  hr     it  lv  nl         pl  ru     th \
 | 
			
		||||
common  de-ch  es     fo  fr-ca  hu     ja  mk  nl-be      pt  sl     tr
 | 
			
		||||
 | 
			
		||||
.PHONY: ctags
 | 
			
		||||
ctags:
 | 
			
		||||
	$(call quiet-command, 			\
 | 
			
		||||
		rm -f "$(SRC_PATH)/"tags, 	\
 | 
			
		||||
		"CTAGS", "Remove old tags")
 | 
			
		||||
	$(call quiet-command, \
 | 
			
		||||
		$(find-src-path) -exec ctags 		\
 | 
			
		||||
		-f "$(SRC_PATH)/"tags --append {} +,	\
 | 
			
		||||
		"CTAGS", "Re-index $(SRC_PATH)")
 | 
			
		||||
install-doc: $(DOCS)
 | 
			
		||||
	mkdir -p "$(DESTDIR)$(docdir)"
 | 
			
		||||
	$(INSTALL) -m 644 qemu-doc.html  qemu-tech.html "$(DESTDIR)$(docdir)"
 | 
			
		||||
ifndef CONFIG_WIN32
 | 
			
		||||
	mkdir -p "$(DESTDIR)$(mandir)/man1"
 | 
			
		||||
	$(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
.PHONY: gtags
 | 
			
		||||
gtags:
 | 
			
		||||
	$(call quiet-command, 			\
 | 
			
		||||
		rm -f "$(SRC_PATH)/"GTAGS; 	\
 | 
			
		||||
		rm -f "$(SRC_PATH)/"GRTAGS; 	\
 | 
			
		||||
		rm -f "$(SRC_PATH)/"GPATH, 	\
 | 
			
		||||
		"GTAGS", "Remove old $@ files")
 | 
			
		||||
	$(call quiet-command, 				\
 | 
			
		||||
	        (cd $(SRC_PATH) && 			\
 | 
			
		||||
		 $(find-src-path) | gtags -f -), 	\
 | 
			
		||||
		"GTAGS", "Re-index $(SRC_PATH)")
 | 
			
		||||
install: all $(if $(BUILD_DOCS),install-doc)
 | 
			
		||||
	mkdir -p "$(DESTDIR)$(bindir)"
 | 
			
		||||
	$(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
 | 
			
		||||
	mkdir -p "$(DESTDIR)$(datadir)"
 | 
			
		||||
	for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
 | 
			
		||||
			video.x proll.elf linux_boot.bin; do \
 | 
			
		||||
		$(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
 | 
			
		||||
	done
 | 
			
		||||
ifndef CONFIG_WIN32
 | 
			
		||||
	mkdir -p "$(DESTDIR)$(datadir)/keymaps"
 | 
			
		||||
	for x in $(KEYMAPS); do \
 | 
			
		||||
		$(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
 | 
			
		||||
	done
 | 
			
		||||
endif
 | 
			
		||||
	for d in $(TARGET_DIRS); do \
 | 
			
		||||
	$(MAKE) -C $$d $@ || exit 1 ; \
 | 
			
		||||
        done
 | 
			
		||||
 | 
			
		||||
.PHONY: TAGS
 | 
			
		||||
TAGS:
 | 
			
		||||
	$(call quiet-command, 			\
 | 
			
		||||
		rm -f "$(SRC_PATH)/"TAGS,	\
 | 
			
		||||
		"TAGS", "Remove old $@")
 | 
			
		||||
	$(call quiet-command, 				\
 | 
			
		||||
		$(find-src-path) -exec etags 		\
 | 
			
		||||
		-f "$(SRC_PATH)/"TAGS --append {} +, 	\
 | 
			
		||||
		"TAGS", "Re-index $(SRC_PATH)")
 | 
			
		||||
# various test targets
 | 
			
		||||
test speed test2: all
 | 
			
		||||
	$(MAKE) -C tests $@
 | 
			
		||||
 | 
			
		||||
TAGS: 
 | 
			
		||||
	etags *.[ch] tests/*.[ch]
 | 
			
		||||
 | 
			
		||||
.PHONY: cscope
 | 
			
		||||
cscope:
 | 
			
		||||
	$(call quiet-command,			\
 | 
			
		||||
		rm -f "$(SRC_PATH)/"cscope.* ,	\
 | 
			
		||||
		"cscope", "Remove old $@ files")
 | 
			
		||||
	$(call quiet-command, 					\
 | 
			
		||||
		($(find-src-path) -print | sed -e 's,^\./,,'    \
 | 
			
		||||
		> "$(SRC_PATH)/cscope.files"), 			\
 | 
			
		||||
		"cscope", "Create file list")
 | 
			
		||||
	$(call quiet-command, 				\
 | 
			
		||||
		cscope -b -i"$(SRC_PATH)/cscope.files" 	\
 | 
			
		||||
		-f"$(SRC_PATH)"/cscope.out, 		\
 | 
			
		||||
		"cscope", "Re-index $(SRC_PATH)")
 | 
			
		||||
	rm -f ./cscope.*
 | 
			
		||||
	find . -name "*.[ch]" -print > ./cscope.files
 | 
			
		||||
	cscope -b
 | 
			
		||||
 | 
			
		||||
# Needed by "meson install"
 | 
			
		||||
export DESTDIR
 | 
			
		||||
# documentation
 | 
			
		||||
%.html: %.texi
 | 
			
		||||
	texi2html -monolithic -number $<
 | 
			
		||||
 | 
			
		||||
include $(SRC_PATH)/tests/docker/Makefile.include
 | 
			
		||||
include $(SRC_PATH)/tests/vm/Makefile.include
 | 
			
		||||
%.info: %.texi
 | 
			
		||||
	makeinfo $< -o $@
 | 
			
		||||
 | 
			
		||||
print-help-run = printf "  %-30s - %s\\n" "$1" "$2"
 | 
			
		||||
print-help = @$(call print-help-run,$1,$2)
 | 
			
		||||
%.dvi: %.texi
 | 
			
		||||
	texi2dvi $<
 | 
			
		||||
 | 
			
		||||
.PHONY: help
 | 
			
		||||
help:
 | 
			
		||||
	@echo  'Generic targets:'
 | 
			
		||||
	$(call print-help,all,Build all)
 | 
			
		||||
	$(call print-help,dir/file.o,Build specified target only)
 | 
			
		||||
	$(call print-help,install,Install QEMU, documentation and tools)
 | 
			
		||||
	$(call print-help,ctags/gtags/TAGS,Generate tags file for editors)
 | 
			
		||||
	$(call print-help,cscope,Generate cscope index)
 | 
			
		||||
	$(call print-help,sparse,Run sparse on the QEMU source)
 | 
			
		||||
	@echo  ''
 | 
			
		||||
ifeq ($(CONFIG_PLUGIN),y)
 | 
			
		||||
	@echo  'Plugin targets:'
 | 
			
		||||
	$(call print-help,plugins,Build the example TCG plugins)
 | 
			
		||||
	@echo  ''
 | 
			
		||||
qemu.1: qemu-doc.texi
 | 
			
		||||
	$(SRC_PATH)/texi2pod.pl $< qemu.pod
 | 
			
		||||
	pod2man --section=1 --center=" " --release=" " qemu.pod > $@
 | 
			
		||||
 | 
			
		||||
qemu-img.1: qemu-img.texi
 | 
			
		||||
	$(SRC_PATH)/texi2pod.pl $< qemu-img.pod
 | 
			
		||||
	pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@
 | 
			
		||||
 | 
			
		||||
FILE=qemu-$(shell cat VERSION)
 | 
			
		||||
 | 
			
		||||
# tar release (use 'make -k tar' on a checkouted tree)
 | 
			
		||||
tar:
 | 
			
		||||
	rm -rf /tmp/$(FILE)
 | 
			
		||||
	cp -r . /tmp/$(FILE)
 | 
			
		||||
	( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
 | 
			
		||||
	rm -rf /tmp/$(FILE)
 | 
			
		||||
 | 
			
		||||
# generate a binary distribution
 | 
			
		||||
tarbin:
 | 
			
		||||
	( cd / ; tar zcvf ~/qemu-$(VERSION)-i386.tar.gz \
 | 
			
		||||
	$(bindir)/qemu \
 | 
			
		||||
	$(bindir)/qemu-system-ppc \
 | 
			
		||||
	$(bindir)/qemu-system-sparc \
 | 
			
		||||
	$(bindir)/qemu-system-x86_64 \
 | 
			
		||||
	$(bindir)/qemu-system-mips \
 | 
			
		||||
	$(bindir)/qemu-system-mipsel \
 | 
			
		||||
	$(bindir)/qemu-system-arm \
 | 
			
		||||
	$(bindir)/qemu-i386 \
 | 
			
		||||
        $(bindir)/qemu-arm \
 | 
			
		||||
        $(bindir)/qemu-armeb \
 | 
			
		||||
        $(bindir)/qemu-sparc \
 | 
			
		||||
        $(bindir)/qemu-ppc \
 | 
			
		||||
        $(bindir)/qemu-mips \
 | 
			
		||||
        $(bindir)/qemu-mipsel \
 | 
			
		||||
        $(bindir)/qemu-img \
 | 
			
		||||
	$(datadir)/bios.bin \
 | 
			
		||||
	$(datadir)/vgabios.bin \
 | 
			
		||||
	$(datadir)/vgabios-cirrus.bin \
 | 
			
		||||
	$(datadir)/ppc_rom.bin \
 | 
			
		||||
	$(datadir)/video.x \
 | 
			
		||||
	$(datadir)/proll.elf \
 | 
			
		||||
	$(datadir)/linux_boot.bin \
 | 
			
		||||
	$(docdir)/qemu-doc.html \
 | 
			
		||||
	$(docdir)/qemu-tech.html \
 | 
			
		||||
	$(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 )
 | 
			
		||||
 | 
			
		||||
ifneq ($(wildcard .depend),)
 | 
			
		||||
include .depend
 | 
			
		||||
endif
 | 
			
		||||
	@echo  'Cleaning targets:'
 | 
			
		||||
	$(call print-help,clean,Remove most generated files but keep the config)
 | 
			
		||||
	$(call print-help,distclean,Remove all generated files)
 | 
			
		||||
	$(call print-help,dist,Build a distributable tarball)
 | 
			
		||||
	@echo  ''
 | 
			
		||||
	@echo  'Test targets:'
 | 
			
		||||
	$(call print-help,check,Run all tests (check-help for details))
 | 
			
		||||
	$(call print-help,bench,Run all benchmarks)
 | 
			
		||||
	$(call print-help,docker-help,Help about targets running tests inside containers)
 | 
			
		||||
	$(call print-help,vm-help,Help about targets running tests inside VM)
 | 
			
		||||
	@echo  ''
 | 
			
		||||
	@echo  'Documentation targets:'
 | 
			
		||||
	$(call print-help,html man,Build documentation in specified format)
 | 
			
		||||
	@echo  ''
 | 
			
		||||
ifdef CONFIG_WIN32
 | 
			
		||||
	@echo  'Windows targets:'
 | 
			
		||||
	$(call print-help,installer,Build NSIS-based installer for QEMU)
 | 
			
		||||
	$(call print-help,msi,Build MSI-based installer for qemu-ga)
 | 
			
		||||
	@echo  ''
 | 
			
		||||
endif
 | 
			
		||||
	$(call print-help,$(MAKE) [targets],(quiet build, default))
 | 
			
		||||
	$(call print-help,$(MAKE) V=1 [targets],(verbose build))
 | 
			
		||||
 | 
			
		||||
# will delete the target of a rule if commands exit with a nonzero exit status
 | 
			
		||||
.DELETE_ON_ERROR:
 | 
			
		||||
 | 
			
		||||
print-%:
 | 
			
		||||
	@echo '$*=$($*)'
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										506
									
								
								Makefile.target
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										506
									
								
								Makefile.target
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,506 @@
 | 
			
		||||
include config.mak
 | 
			
		||||
 | 
			
		||||
TARGET_BASE_ARCH:=$(TARGET_ARCH)
 | 
			
		||||
ifeq ($(TARGET_ARCH), x86_64)
 | 
			
		||||
TARGET_BASE_ARCH:=i386
 | 
			
		||||
endif
 | 
			
		||||
ifeq ($(TARGET_ARCH), ppc64)
 | 
			
		||||
TARGET_BASE_ARCH:=ppc
 | 
			
		||||
endif
 | 
			
		||||
ifeq ($(TARGET_ARCH), sparc64)
 | 
			
		||||
TARGET_BASE_ARCH:=sparc
 | 
			
		||||
endif
 | 
			
		||||
TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
 | 
			
		||||
VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/audio
 | 
			
		||||
DEFINES=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH)
 | 
			
		||||
ifdef CONFIG_USER_ONLY
 | 
			
		||||
VPATH+=:$(SRC_PATH)/linux-user
 | 
			
		||||
DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
 | 
			
		||||
endif
 | 
			
		||||
CFLAGS=-Wall -O2 -g -fno-strict-aliasing
 | 
			
		||||
#CFLAGS+=-Werror
 | 
			
		||||
LDFLAGS=-g
 | 
			
		||||
LIBS=
 | 
			
		||||
HELPER_CFLAGS=$(CFLAGS)
 | 
			
		||||
DYNGEN=../dyngen$(EXESUF)
 | 
			
		||||
# user emulator name
 | 
			
		||||
TARGET_ARCH2=$(TARGET_ARCH)
 | 
			
		||||
ifeq ($(TARGET_ARCH),arm)
 | 
			
		||||
  ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
 | 
			
		||||
    TARGET_ARCH2=armeb
 | 
			
		||||
  endif
 | 
			
		||||
endif
 | 
			
		||||
ifeq ($(TARGET_ARCH),mips)
 | 
			
		||||
  ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
 | 
			
		||||
    TARGET_ARCH2=mipsel
 | 
			
		||||
  endif
 | 
			
		||||
endif
 | 
			
		||||
QEMU_USER=qemu-$(TARGET_ARCH2)
 | 
			
		||||
# system emulator name
 | 
			
		||||
ifdef CONFIG_SOFTMMU
 | 
			
		||||
ifeq ($(TARGET_ARCH), i386)
 | 
			
		||||
QEMU_SYSTEM=qemu$(EXESUF)
 | 
			
		||||
else
 | 
			
		||||
QEMU_SYSTEM=qemu-system-$(TARGET_ARCH2)$(EXESUF)
 | 
			
		||||
endif
 | 
			
		||||
else
 | 
			
		||||
QEMU_SYSTEM=qemu-fast
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifdef CONFIG_USER_ONLY
 | 
			
		||||
PROGS=$(QEMU_USER)
 | 
			
		||||
else
 | 
			
		||||
PROGS+=$(QEMU_SYSTEM)
 | 
			
		||||
ifndef CONFIG_SOFTMMU
 | 
			
		||||
CONFIG_STATIC=y
 | 
			
		||||
endif
 | 
			
		||||
endif # !CONFIG_USER_ONLY
 | 
			
		||||
 | 
			
		||||
ifdef CONFIG_STATIC
 | 
			
		||||
LDFLAGS+=-static
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(ARCH),i386)
 | 
			
		||||
CFLAGS+=-fomit-frame-pointer
 | 
			
		||||
OP_CFLAGS=$(CFLAGS) -mpreferred-stack-boundary=2
 | 
			
		||||
ifeq ($(HAVE_GCC3_OPTIONS),yes)
 | 
			
		||||
OP_CFLAGS+= -falign-functions=0 -fno-gcse
 | 
			
		||||
else
 | 
			
		||||
OP_CFLAGS+= -malign-functions=0
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifdef TARGET_GPROF
 | 
			
		||||
USE_I386_LD=y
 | 
			
		||||
endif
 | 
			
		||||
ifdef CONFIG_STATIC
 | 
			
		||||
USE_I386_LD=y
 | 
			
		||||
endif
 | 
			
		||||
ifdef USE_I386_LD
 | 
			
		||||
LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386.ld
 | 
			
		||||
else
 | 
			
		||||
# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
 | 
			
		||||
# that the kernel ELF loader considers as an executable. I think this
 | 
			
		||||
# is the simplest way to make it self virtualizable!
 | 
			
		||||
LDFLAGS+=-Wl,-shared
 | 
			
		||||
endif
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(ARCH),x86_64)
 | 
			
		||||
OP_CFLAGS=$(CFLAGS) -falign-functions=0
 | 
			
		||||
LDFLAGS+=-Wl,-T,$(SRC_PATH)/x86_64.ld
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(ARCH),ppc)
 | 
			
		||||
CFLAGS+= -D__powerpc__
 | 
			
		||||
OP_CFLAGS=$(CFLAGS)
 | 
			
		||||
LDFLAGS+=-Wl,-T,$(SRC_PATH)/ppc.ld
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(ARCH),s390)
 | 
			
		||||
OP_CFLAGS=$(CFLAGS)
 | 
			
		||||
LDFLAGS+=-Wl,-T,$(SRC_PATH)/s390.ld
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(ARCH),sparc)
 | 
			
		||||
CFLAGS+=-m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
 | 
			
		||||
LDFLAGS+=-m32
 | 
			
		||||
OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
 | 
			
		||||
HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
 | 
			
		||||
# -static is used to avoid g1/g3 usage by the dynamic linker
 | 
			
		||||
LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc.ld -static
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(ARCH),sparc64)
 | 
			
		||||
CFLAGS+=-m64 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
 | 
			
		||||
LDFLAGS+=-m64
 | 
			
		||||
OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(ARCH),alpha)
 | 
			
		||||
# -msmall-data is not used because we want two-instruction relocations
 | 
			
		||||
# for the constant constructions
 | 
			
		||||
OP_CFLAGS=-Wall -O2 -g
 | 
			
		||||
# Ensure there's only a single GP
 | 
			
		||||
CFLAGS += -msmall-data
 | 
			
		||||
LDFLAGS+=-Wl,-T,$(SRC_PATH)/alpha.ld
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(ARCH),ia64)
 | 
			
		||||
CFLAGS += -mno-sdata
 | 
			
		||||
OP_CFLAGS=$(CFLAGS)
 | 
			
		||||
LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(ARCH),arm)
 | 
			
		||||
OP_CFLAGS=$(CFLAGS) -mno-sched-prolog -fno-omit-frame-pointer
 | 
			
		||||
LDFLAGS+=-Wl,-T,$(SRC_PATH)/arm.ld
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(ARCH),m68k)
 | 
			
		||||
OP_CFLAGS=$(CFLAGS) -fomit-frame-pointer
 | 
			
		||||
LDFLAGS+=-Wl,-T,m68k.ld
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(HAVE_GCC3_OPTIONS),yes)
 | 
			
		||||
# very important to generate a return at the end of every operation
 | 
			
		||||
OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(CONFIG_DARWIN),yes)
 | 
			
		||||
OP_CFLAGS+= -mdynamic-no-pic
 | 
			
		||||
LIBS+=-lmx
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
#########################################################
 | 
			
		||||
 | 
			
		||||
DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
 | 
			
		||||
LIBS+=-lm
 | 
			
		||||
ifndef CONFIG_USER_ONLY
 | 
			
		||||
LIBS+=-lz
 | 
			
		||||
endif
 | 
			
		||||
ifdef CONFIG_WIN32
 | 
			
		||||
LIBS+=-lwinmm -lws2_32 -liphlpapi
 | 
			
		||||
endif
 | 
			
		||||
ifdef CONFIG_SOLARIS
 | 
			
		||||
LIBS+=-lsocket -lnsl -lresolv
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
# profiling code
 | 
			
		||||
ifdef TARGET_GPROF
 | 
			
		||||
LDFLAGS+=-p
 | 
			
		||||
main.o: CFLAGS+=-p
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
OBJS= elfload.o main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o 
 | 
			
		||||
ifeq ($(TARGET_ARCH), i386)
 | 
			
		||||
OBJS+= vm86.o
 | 
			
		||||
endif
 | 
			
		||||
ifeq ($(TARGET_ARCH), arm)
 | 
			
		||||
OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
 | 
			
		||||
nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
 | 
			
		||||
 nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o
 | 
			
		||||
endif
 | 
			
		||||
SRCS:= $(OBJS:.o=.c)
 | 
			
		||||
OBJS+= libqemu.a
 | 
			
		||||
 | 
			
		||||
# cpu emulator library
 | 
			
		||||
LIBOBJS=exec.o kqemu.o translate-op.o translate-all.o cpu-exec.o\
 | 
			
		||||
        translate.o op.o 
 | 
			
		||||
ifdef CONFIG_SOFTFLOAT
 | 
			
		||||
LIBOBJS+=fpu/softfloat.o
 | 
			
		||||
else
 | 
			
		||||
LIBOBJS+=fpu/softfloat-native.o
 | 
			
		||||
endif
 | 
			
		||||
DEFINES+=-I$(SRC_PATH)/fpu
 | 
			
		||||
 | 
			
		||||
ifeq ($(TARGET_ARCH), i386)
 | 
			
		||||
LIBOBJS+=helper.o helper2.o
 | 
			
		||||
ifeq ($(ARCH), i386)
 | 
			
		||||
LIBOBJS+=translate-copy.o
 | 
			
		||||
endif
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(TARGET_ARCH), x86_64)
 | 
			
		||||
LIBOBJS+=helper.o helper2.o
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(TARGET_BASE_ARCH), ppc)
 | 
			
		||||
LIBOBJS+= op_helper.o helper.o
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(TARGET_ARCH), mips)
 | 
			
		||||
LIBOBJS+= op_helper.o helper.o
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(TARGET_BASE_ARCH), sparc)
 | 
			
		||||
LIBOBJS+= op_helper.o helper.o
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(TARGET_BASE_ARCH), arm)
 | 
			
		||||
LIBOBJS+= op_helper.o helper.o
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(TARGET_BASE_ARCH), sh4)
 | 
			
		||||
LIBOBJS+= op_helper.o helper.o
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
# NOTE: the disassembler code is only needed for debugging
 | 
			
		||||
LIBOBJS+=disas.o 
 | 
			
		||||
ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
 | 
			
		||||
USE_I386_DIS=y
 | 
			
		||||
endif
 | 
			
		||||
ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
 | 
			
		||||
USE_I386_DIS=y
 | 
			
		||||
endif
 | 
			
		||||
ifdef USE_I386_DIS
 | 
			
		||||
LIBOBJS+=i386-dis.o
 | 
			
		||||
endif
 | 
			
		||||
ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
 | 
			
		||||
LIBOBJS+=alpha-dis.o
 | 
			
		||||
endif
 | 
			
		||||
ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
 | 
			
		||||
LIBOBJS+=ppc-dis.o
 | 
			
		||||
endif
 | 
			
		||||
ifeq ($(findstring mips, $(TARGET_ARCH) $(ARCH)),mips)
 | 
			
		||||
LIBOBJS+=mips-dis.o
 | 
			
		||||
endif
 | 
			
		||||
ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
 | 
			
		||||
LIBOBJS+=sparc-dis.o
 | 
			
		||||
endif
 | 
			
		||||
ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
 | 
			
		||||
LIBOBJS+=arm-dis.o
 | 
			
		||||
endif
 | 
			
		||||
ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
 | 
			
		||||
LIBOBJS+=m68k-dis.o
 | 
			
		||||
endif
 | 
			
		||||
ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
 | 
			
		||||
LIBOBJS+=sh4-dis.o
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifdef CONFIG_GDBSTUB
 | 
			
		||||
OBJS+=gdbstub.o
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
all: $(PROGS)
 | 
			
		||||
 | 
			
		||||
$(QEMU_USER): $(OBJS)
 | 
			
		||||
	$(CC) $(LDFLAGS) -o $@ $^  $(LIBS)
 | 
			
		||||
ifeq ($(ARCH),alpha)
 | 
			
		||||
# Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
 | 
			
		||||
# the address space (31 bit so sign extending doesn't matter)
 | 
			
		||||
	echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
# must use static linking to avoid leaving stuff in virtual address space
 | 
			
		||||
VL_OBJS=vl.o osdep.o block.o readline.o monitor.o pci.o console.o loader.o
 | 
			
		||||
VL_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o block-dmg.o block-bochs.o block-vpc.o block-vvfat.o
 | 
			
		||||
ifdef CONFIG_WIN32
 | 
			
		||||
VL_OBJS+=tap-win32.o
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
SOUND_HW = sb16.o es1370.o
 | 
			
		||||
AUDIODRV = audio.o noaudio.o wavaudio.o
 | 
			
		||||
ifdef CONFIG_SDL
 | 
			
		||||
AUDIODRV += sdlaudio.o
 | 
			
		||||
endif
 | 
			
		||||
ifdef CONFIG_OSS
 | 
			
		||||
AUDIODRV += ossaudio.o
 | 
			
		||||
endif
 | 
			
		||||
ifdef CONFIG_COREAUDIO
 | 
			
		||||
AUDIODRV += coreaudio.o
 | 
			
		||||
endif
 | 
			
		||||
ifdef CONFIG_ALSA
 | 
			
		||||
AUDIODRV += alsaaudio.o
 | 
			
		||||
LIBS += -lasound
 | 
			
		||||
endif
 | 
			
		||||
ifdef CONFIG_DSOUND
 | 
			
		||||
AUDIODRV += dsoundaudio.o
 | 
			
		||||
LIBS += -lole32 -ldxguid
 | 
			
		||||
endif
 | 
			
		||||
ifdef CONFIG_FMOD
 | 
			
		||||
AUDIODRV += fmodaudio.o
 | 
			
		||||
audio.o fmodaudio.o: DEFINES := -I$(CONFIG_FMOD_INC) $(DEFINES)
 | 
			
		||||
LIBS += $(CONFIG_FMOD_LIB)
 | 
			
		||||
endif
 | 
			
		||||
ifdef CONFIG_ADLIB
 | 
			
		||||
SOUND_HW += fmopl.o adlib.o
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
# USB layer
 | 
			
		||||
VL_OBJS+= usb.o usb-hub.o usb-uhci.o usb-linux.o usb-hid.o
 | 
			
		||||
 | 
			
		||||
# PCI network cards
 | 
			
		||||
VL_OBJS+= ne2000.o rtl8139.o
 | 
			
		||||
 | 
			
		||||
ifeq ($(TARGET_BASE_ARCH), i386)
 | 
			
		||||
# Hardware support
 | 
			
		||||
VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
 | 
			
		||||
VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
 | 
			
		||||
VL_OBJS+= cirrus_vga.o mixeng.o apic.o parallel.o
 | 
			
		||||
DEFINES += -DHAS_AUDIO
 | 
			
		||||
endif
 | 
			
		||||
ifeq ($(TARGET_BASE_ARCH), ppc)
 | 
			
		||||
VL_OBJS+= ppc.o ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
 | 
			
		||||
VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o
 | 
			
		||||
VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o openpic.o heathrow_pic.o mixeng.o
 | 
			
		||||
DEFINES += -DHAS_AUDIO
 | 
			
		||||
endif
 | 
			
		||||
ifeq ($(TARGET_ARCH), mips)
 | 
			
		||||
VL_OBJS+= mips_r4k.o dma.o vga.o serial.o i8254.o i8259.o
 | 
			
		||||
#VL_OBJS+= #ide.o pckbd.o fdc.o m48t59.o
 | 
			
		||||
endif
 | 
			
		||||
ifeq ($(TARGET_BASE_ARCH), sparc)
 | 
			
		||||
ifeq ($(TARGET_ARCH), sparc64)
 | 
			
		||||
VL_OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o
 | 
			
		||||
VL_OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
 | 
			
		||||
VL_OBJS+= cirrus_vga.o parallel.o
 | 
			
		||||
else
 | 
			
		||||
VL_OBJS+= sun4m.o tcx.o lance.o iommu.o m48t59.o slavio_intctl.o
 | 
			
		||||
VL_OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o esp.o
 | 
			
		||||
endif
 | 
			
		||||
endif
 | 
			
		||||
ifeq ($(TARGET_BASE_ARCH), arm)
 | 
			
		||||
VL_OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
 | 
			
		||||
VL_OBJS+= arm_boot.o pl011.o pl050.o pl080.o pl110.o pl190.o
 | 
			
		||||
endif
 | 
			
		||||
ifeq ($(TARGET_BASE_ARCH), sh4)
 | 
			
		||||
VL_OBJS+= shix.o sh7750.o sh7750_regnames.o tc58128.o
 | 
			
		||||
endif
 | 
			
		||||
ifdef CONFIG_GDBSTUB
 | 
			
		||||
VL_OBJS+=gdbstub.o 
 | 
			
		||||
endif
 | 
			
		||||
ifdef CONFIG_SDL
 | 
			
		||||
VL_OBJS+=sdl.o
 | 
			
		||||
endif
 | 
			
		||||
VL_OBJS+=vnc.o
 | 
			
		||||
ifdef CONFIG_COCOA
 | 
			
		||||
VL_OBJS+=cocoa.o
 | 
			
		||||
COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
 | 
			
		||||
ifdef CONFIG_COREAUDIO
 | 
			
		||||
COCOA_LIBS+=-framework CoreAudio
 | 
			
		||||
endif
 | 
			
		||||
endif
 | 
			
		||||
ifdef CONFIG_SLIRP
 | 
			
		||||
DEFINES+=-I$(SRC_PATH)/slirp
 | 
			
		||||
SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
 | 
			
		||||
slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
 | 
			
		||||
tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
 | 
			
		||||
VL_OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
VL_LDFLAGS=
 | 
			
		||||
# specific flags are needed for non soft mmu emulator
 | 
			
		||||
ifdef CONFIG_STATIC
 | 
			
		||||
VL_LDFLAGS+=-static
 | 
			
		||||
endif
 | 
			
		||||
ifndef CONFIG_SOFTMMU
 | 
			
		||||
VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld 
 | 
			
		||||
endif
 | 
			
		||||
ifndef CONFIG_DARWIN
 | 
			
		||||
ifndef CONFIG_WIN32
 | 
			
		||||
ifndef CONFIG_SOLARIS
 | 
			
		||||
VL_LIBS=-lutil
 | 
			
		||||
endif
 | 
			
		||||
endif
 | 
			
		||||
endif
 | 
			
		||||
ifdef TARGET_GPROF
 | 
			
		||||
vl.o: CFLAGS+=-p
 | 
			
		||||
VL_LDFLAGS+=-p
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(ARCH),ia64)
 | 
			
		||||
VL_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifdef CONFIG_WIN32
 | 
			
		||||
SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
$(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
 | 
			
		||||
	$(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
 | 
			
		||||
 | 
			
		||||
cocoa.o: cocoa.m
 | 
			
		||||
	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
 | 
			
		||||
 | 
			
		||||
sdl.o: sdl.c keymaps.c sdl_keysym.h
 | 
			
		||||
	$(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
 | 
			
		||||
 | 
			
		||||
vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h
 | 
			
		||||
	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
 | 
			
		||||
 | 
			
		||||
sdlaudio.o: sdlaudio.c
 | 
			
		||||
	$(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
 | 
			
		||||
 | 
			
		||||
depend: $(SRCS)
 | 
			
		||||
	$(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
 | 
			
		||||
 | 
			
		||||
vldepend: $(VL_OBJS:.o=.c)
 | 
			
		||||
	$(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
 | 
			
		||||
 | 
			
		||||
# libqemu 
 | 
			
		||||
 | 
			
		||||
libqemu.a: $(LIBOBJS)
 | 
			
		||||
	rm -f $@
 | 
			
		||||
	$(AR) rcs $@ $(LIBOBJS)
 | 
			
		||||
 | 
			
		||||
translate.o: translate.c gen-op.h opc.h cpu.h
 | 
			
		||||
 | 
			
		||||
translate-all.o: translate-all.c opc.h cpu.h
 | 
			
		||||
 | 
			
		||||
translate-op.o: translate-all.c op.h opc.h cpu.h
 | 
			
		||||
 | 
			
		||||
op.h: op.o $(DYNGEN)
 | 
			
		||||
	$(DYNGEN) -o $@ $<
 | 
			
		||||
 | 
			
		||||
opc.h: op.o $(DYNGEN)
 | 
			
		||||
	$(DYNGEN) -c -o $@ $<
 | 
			
		||||
 | 
			
		||||
gen-op.h: op.o $(DYNGEN)
 | 
			
		||||
	$(DYNGEN) -g -o $@ $<
 | 
			
		||||
 | 
			
		||||
op.o: op.c
 | 
			
		||||
	$(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
 | 
			
		||||
 | 
			
		||||
helper.o: helper.c
 | 
			
		||||
	$(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
 | 
			
		||||
 | 
			
		||||
ifeq ($(TARGET_BASE_ARCH), i386)
 | 
			
		||||
op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(TARGET_ARCH), arm)
 | 
			
		||||
op.o: op.c op_template.h
 | 
			
		||||
pl110.o: pl110_template.h
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(TARGET_BASE_ARCH), sparc)
 | 
			
		||||
op.o: op.c op_template.h op_mem.h fop_template.h fbranch_template.h
 | 
			
		||||
magic_load.o: elf_op.h
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(TARGET_BASE_ARCH), ppc)
 | 
			
		||||
op.o: op.c op_template.h op_mem.h
 | 
			
		||||
op_helper.o: op_helper_mem.h
 | 
			
		||||
translate.o: translate.c translate_init.c
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(TARGET_ARCH), mips)
 | 
			
		||||
op.o: op.c op_template.c op_mem.c
 | 
			
		||||
op_helper.o: op_helper_mem.c
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
loader.o: loader.c elf_ops.h
 | 
			
		||||
 | 
			
		||||
ifeq ($(TARGET_ARCH), sh4)
 | 
			
		||||
op.o: op.c op_mem.c cpu.h
 | 
			
		||||
op_helper.o: op_helper.c exec.h cpu.h
 | 
			
		||||
helper.o: helper.c exec.h cpu.h
 | 
			
		||||
sh7750.o: sh7750.c sh7750_regs.h sh7750_regnames.h cpu.h
 | 
			
		||||
shix.o: shix.c sh7750_regs.h sh7750_regnames.h
 | 
			
		||||
sh7750_regnames.o: sh7750_regnames.c sh7750_regnames.h sh7750_regs.h
 | 
			
		||||
tc58128.o: tc58128.c
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
%.o: %.c
 | 
			
		||||
	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
 | 
			
		||||
 | 
			
		||||
%.o: %.S
 | 
			
		||||
	$(CC) $(DEFINES) -c -o $@ $<
 | 
			
		||||
 | 
			
		||||
clean:
 | 
			
		||||
	rm -f *.o  *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o fpu/*.o
 | 
			
		||||
 | 
			
		||||
install: all 
 | 
			
		||||
ifneq ($(PROGS),)
 | 
			
		||||
	$(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifneq ($(wildcard .depend),)
 | 
			
		||||
include .depend
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq (1, 0)
 | 
			
		||||
audio.o sdlaudio.o dsoundaudio.o ossaudio.o wavaudio.o noaudio.o \
 | 
			
		||||
fmodaudio.o alsaaudio.o mixeng.o sb16.o es1370.o gus.o adlib.o: \
 | 
			
		||||
CFLAGS := $(CFLAGS) -Wall -Werror -W -Wsign-compare
 | 
			
		||||
endif
 | 
			
		||||
							
								
								
									
										3
									
								
								README
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								README
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
Read the documentation in qemu-doc.html.
 | 
			
		||||
 | 
			
		||||
Fabrice Bellard.
 | 
			
		||||
							
								
								
									
										16
									
								
								README.distrib
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								README.distrib
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
Information about the various packages used to build the current qemu
 | 
			
		||||
x86 binary distribution:
 | 
			
		||||
 | 
			
		||||
* gcc 2.95.2 was used for the build. A glibc 2.1.3 Debian distribution
 | 
			
		||||
  was used to get most of the binary packages.
 | 
			
		||||
 | 
			
		||||
* wine-20020411 tarball
 | 
			
		||||
 | 
			
		||||
  ./configure --prefix=/usr/local/wine-i386
 | 
			
		||||
  
 | 
			
		||||
  All exe and libs were stripped. Some compile time tools and the
 | 
			
		||||
  includes were deleted.
 | 
			
		||||
 | 
			
		||||
* ldconfig was launched to build the library links:
 | 
			
		||||
 | 
			
		||||
  qemu-i386 /usr/gnemul/qemu-i386/bin/ldconfig-i386 -C /usr/gnemul/qemu-i386/etc/ld.so.cache
 | 
			
		||||
							
								
								
									
										171
									
								
								README.rst
									
									
									
									
									
								
							
							
						
						
									
										171
									
								
								README.rst
									
									
									
									
									
								
							@@ -1,171 +0,0 @@
 | 
			
		||||
===========
 | 
			
		||||
QEMU README
 | 
			
		||||
===========
 | 
			
		||||
 | 
			
		||||
QEMU is a generic and open source machine & userspace emulator and
 | 
			
		||||
virtualizer.
 | 
			
		||||
 | 
			
		||||
QEMU is capable of emulating a complete machine in software without any
 | 
			
		||||
need for hardware virtualization support. By using dynamic translation,
 | 
			
		||||
it achieves very good performance. QEMU can also integrate with the Xen
 | 
			
		||||
and KVM hypervisors to provide emulated hardware while allowing the
 | 
			
		||||
hypervisor to manage the CPU. With hypervisor support, QEMU can achieve
 | 
			
		||||
near native performance for CPUs. When QEMU emulates CPUs directly it is
 | 
			
		||||
capable of running operating systems made for one machine (e.g. an ARMv7
 | 
			
		||||
board) on a different machine (e.g. an x86_64 PC board).
 | 
			
		||||
 | 
			
		||||
QEMU is also capable of providing userspace API virtualization for Linux
 | 
			
		||||
and BSD kernel interfaces. This allows binaries compiled against one
 | 
			
		||||
architecture ABI (e.g. the Linux PPC64 ABI) to be run on a host using a
 | 
			
		||||
different architecture ABI (e.g. the Linux x86_64 ABI). This does not
 | 
			
		||||
involve any hardware emulation, simply CPU and syscall emulation.
 | 
			
		||||
 | 
			
		||||
QEMU aims to fit into a variety of use cases. It can be invoked directly
 | 
			
		||||
by users wishing to have full control over its behaviour and settings.
 | 
			
		||||
It also aims to facilitate integration into higher level management
 | 
			
		||||
layers, by providing a stable command line interface and monitor API.
 | 
			
		||||
It is commonly invoked indirectly via the libvirt library when using
 | 
			
		||||
open source applications such as oVirt, OpenStack and virt-manager.
 | 
			
		||||
 | 
			
		||||
QEMU as a whole is released under the GNU General Public License,
 | 
			
		||||
version 2. For full licensing details, consult the LICENSE file.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Documentation
 | 
			
		||||
=============
 | 
			
		||||
 | 
			
		||||
Documentation can be found hosted online at
 | 
			
		||||
`<https://www.qemu.org/documentation/>`_. The documentation for the
 | 
			
		||||
current development version that is available at
 | 
			
		||||
`<https://www.qemu.org/docs/master/>`_ is generated from the ``docs/``
 | 
			
		||||
folder in the source tree, and is built by `Sphinx
 | 
			
		||||
<https://www.sphinx-doc.org/en/master/>_`.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Building
 | 
			
		||||
========
 | 
			
		||||
 | 
			
		||||
QEMU is multi-platform software intended to be buildable on all modern
 | 
			
		||||
Linux platforms, OS-X, Win32 (via the Mingw64 toolchain) and a variety
 | 
			
		||||
of other UNIX targets. The simple steps to build QEMU are:
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
.. code-block:: shell
 | 
			
		||||
 | 
			
		||||
  mkdir build
 | 
			
		||||
  cd build
 | 
			
		||||
  ../configure
 | 
			
		||||
  make
 | 
			
		||||
 | 
			
		||||
Additional information can also be found online via the QEMU website:
 | 
			
		||||
 | 
			
		||||
* `<https://qemu.org/Hosts/Linux>`_
 | 
			
		||||
* `<https://qemu.org/Hosts/Mac>`_
 | 
			
		||||
* `<https://qemu.org/Hosts/W32>`_
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Submitting patches
 | 
			
		||||
==================
 | 
			
		||||
 | 
			
		||||
The QEMU source code is maintained under the GIT version control system.
 | 
			
		||||
 | 
			
		||||
.. code-block:: shell
 | 
			
		||||
 | 
			
		||||
   git clone https://gitlab.com/qemu-project/qemu.git
 | 
			
		||||
 | 
			
		||||
When submitting patches, one common approach is to use 'git
 | 
			
		||||
format-patch' and/or 'git send-email' to format & send the mail to the
 | 
			
		||||
qemu-devel@nongnu.org mailing list. All patches submitted must contain
 | 
			
		||||
a 'Signed-off-by' line from the author. Patches should follow the
 | 
			
		||||
guidelines set out in the `style section
 | 
			
		||||
<https://www.qemu.org/docs/master/devel/style.html>` of
 | 
			
		||||
the Developers Guide.
 | 
			
		||||
 | 
			
		||||
Additional information on submitting patches can be found online via
 | 
			
		||||
the QEMU website
 | 
			
		||||
 | 
			
		||||
* `<https://qemu.org/Contribute/SubmitAPatch>`_
 | 
			
		||||
* `<https://qemu.org/Contribute/TrivialPatches>`_
 | 
			
		||||
 | 
			
		||||
The QEMU website is also maintained under source control.
 | 
			
		||||
 | 
			
		||||
.. code-block:: shell
 | 
			
		||||
 | 
			
		||||
  git clone https://gitlab.com/qemu-project/qemu-web.git
 | 
			
		||||
 | 
			
		||||
* `<https://www.qemu.org/2017/02/04/the-new-qemu-website-is-up/>`_
 | 
			
		||||
 | 
			
		||||
A 'git-publish' utility was created to make above process less
 | 
			
		||||
cumbersome, and is highly recommended for making regular contributions,
 | 
			
		||||
or even just for sending consecutive patch series revisions. It also
 | 
			
		||||
requires a working 'git send-email' setup, and by default doesn't
 | 
			
		||||
automate everything, so you may want to go through the above steps
 | 
			
		||||
manually for once.
 | 
			
		||||
 | 
			
		||||
For installation instructions, please go to
 | 
			
		||||
 | 
			
		||||
*  `<https://github.com/stefanha/git-publish>`_
 | 
			
		||||
 | 
			
		||||
The workflow with 'git-publish' is:
 | 
			
		||||
 | 
			
		||||
.. code-block:: shell
 | 
			
		||||
 | 
			
		||||
  $ git checkout master -b my-feature
 | 
			
		||||
  $ # work on new commits, add your 'Signed-off-by' lines to each
 | 
			
		||||
  $ git publish
 | 
			
		||||
 | 
			
		||||
Your patch series will be sent and tagged as my-feature-v1 if you need to refer
 | 
			
		||||
back to it in the future.
 | 
			
		||||
 | 
			
		||||
Sending v2:
 | 
			
		||||
 | 
			
		||||
.. code-block:: shell
 | 
			
		||||
 | 
			
		||||
  $ git checkout my-feature # same topic branch
 | 
			
		||||
  $ # making changes to the commits (using 'git rebase', for example)
 | 
			
		||||
  $ git publish
 | 
			
		||||
 | 
			
		||||
Your patch series will be sent with 'v2' tag in the subject and the git tip
 | 
			
		||||
will be tagged as my-feature-v2.
 | 
			
		||||
 | 
			
		||||
Bug reporting
 | 
			
		||||
=============
 | 
			
		||||
 | 
			
		||||
The QEMU project uses Launchpad as its primary upstream bug tracker. Bugs
 | 
			
		||||
found when running code built from QEMU git or upstream released sources
 | 
			
		||||
should be reported via:
 | 
			
		||||
 | 
			
		||||
* `<https://bugs.launchpad.net/qemu/>`_
 | 
			
		||||
 | 
			
		||||
If using QEMU via an operating system vendor pre-built binary package, it
 | 
			
		||||
is preferable to report bugs to the vendor's own bug tracker first. If
 | 
			
		||||
the bug is also known to affect latest upstream code, it can also be
 | 
			
		||||
reported via launchpad.
 | 
			
		||||
 | 
			
		||||
For additional information on bug reporting consult:
 | 
			
		||||
 | 
			
		||||
* `<https://qemu.org/Contribute/ReportABug>`_
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ChangeLog
 | 
			
		||||
=========
 | 
			
		||||
 | 
			
		||||
For version history and release notes, please visit
 | 
			
		||||
`<https://wiki.qemu.org/ChangeLog/>`_ or look at the git history for
 | 
			
		||||
more detailed information.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Contact
 | 
			
		||||
=======
 | 
			
		||||
 | 
			
		||||
The QEMU community can be contacted in a number of ways, with the two
 | 
			
		||||
main methods being email and IRC
 | 
			
		||||
 | 
			
		||||
* `<mailto:qemu-devel@nongnu.org>`_
 | 
			
		||||
* `<https://lists.nongnu.org/mailman/listinfo/qemu-devel>`_
 | 
			
		||||
* #qemu on irc.oftc.net
 | 
			
		||||
 | 
			
		||||
Information on additional methods of contacting the community can be
 | 
			
		||||
found online via the QEMU website:
 | 
			
		||||
 | 
			
		||||
* `<https://qemu.org/Contribute/StartHere>`_
 | 
			
		||||
							
								
								
									
										61
									
								
								TODO
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								TODO
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,61 @@
 | 
			
		||||
short term:
 | 
			
		||||
----------
 | 
			
		||||
- support variable tsc freq
 | 
			
		||||
- cpu_interrupt() win32/SMP fix
 | 
			
		||||
- USB host async
 | 
			
		||||
- IDE async
 | 
			
		||||
- debug option in 'configure' script + disable -fomit-frame-pointer
 | 
			
		||||
- Precise VGA timings for old games/demos (malc patch)
 | 
			
		||||
- merge PIC spurious interrupt patch
 | 
			
		||||
- merge Solaris patch
 | 
			
		||||
- warning for OS/2: must not use 128 MB memory (merge bochs cmos patch ?)
 | 
			
		||||
- config file (at least for windows/Mac OS X)
 | 
			
		||||
- commit message if execution of code in IO memory
 | 
			
		||||
- update doc: PCI infos.
 | 
			
		||||
- VNC patch + Synaptic patch.
 | 
			
		||||
- basic VGA optimizations
 | 
			
		||||
- physical memory cache (reduce qemu-fast address space size to about 32 MB)
 | 
			
		||||
- better code fetch (different exception handling + CS.limit support)
 | 
			
		||||
- do not resize vga if invalid size.
 | 
			
		||||
- avoid looping if only exceptions
 | 
			
		||||
- cycle counter for all archs
 | 
			
		||||
- TLB code protection support for PPC
 | 
			
		||||
- see openMosix Doc 
 | 
			
		||||
- disable SMC handling for ARM/SPARC/PPC (not finished)
 | 
			
		||||
- see undefined flags for BTx insn
 | 
			
		||||
- user/kernel PUSHL/POPL in helper.c
 | 
			
		||||
- keyboard output buffer filling timing emulation
 | 
			
		||||
- return UD exception if LOCK prefix incorrectly used
 | 
			
		||||
- test ldt limit < 7 ?
 | 
			
		||||
- tests for each target CPU
 | 
			
		||||
- fix CCOP optimisation
 | 
			
		||||
- fix all remaining thread lock issues (must put TBs in a specific invalid
 | 
			
		||||
  state, find a solution for tb_flush()).
 | 
			
		||||
- fix arm fpu rounding (at least for float->integer conversions)
 | 
			
		||||
 | 
			
		||||
ppc specific:
 | 
			
		||||
------------
 | 
			
		||||
- TLB invalidate not needed if msr_pr changes
 | 
			
		||||
- SPR_ENCODE() not useful
 | 
			
		||||
- enable shift optimizations ?
 | 
			
		||||
 | 
			
		||||
linux-user specific:
 | 
			
		||||
-------------------
 | 
			
		||||
- add IPC syscalls
 | 
			
		||||
- handle rare page fault cases (in particular if page fault in helpers or
 | 
			
		||||
  in syscall emulation code).
 | 
			
		||||
- more syscalls (in particular all 64 bit ones, IPCs, fix 64 bit
 | 
			
		||||
  issues, fix 16 bit uid issues)
 | 
			
		||||
- use page_unprotect_range in every suitable syscall to handle all
 | 
			
		||||
  cases of self modifying code.
 | 
			
		||||
- fix thread stack freeing (use kernel 2.5.x CLONE_CHILD_CLEARTID)
 | 
			
		||||
- use kernel traps for unaligned accesses on ARM ?
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
lower priority:
 | 
			
		||||
--------------
 | 
			
		||||
- int15 ah=86: use better timing
 | 
			
		||||
- suppress shift_mem ops
 | 
			
		||||
- fix some 16 bit sp push/pop overflow (pusha/popa, lcall lret)
 | 
			
		||||
- optimize FPU operations (evaluate x87 stack pointer statically)
 | 
			
		||||
- use -msoft-float on ARM
 | 
			
		||||
							
								
								
									
										431
									
								
								a.out.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										431
									
								
								a.out.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,431 @@
 | 
			
		||||
/* a.out.h
 | 
			
		||||
 | 
			
		||||
   Copyright 1997, 1998, 1999, 2001 Red Hat, Inc.
 | 
			
		||||
 | 
			
		||||
This file is part of Cygwin.
 | 
			
		||||
 | 
			
		||||
This software is a copyrighted work licensed under the terms of the
 | 
			
		||||
Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
 | 
			
		||||
details. */
 | 
			
		||||
 | 
			
		||||
#ifndef _A_OUT_H_
 | 
			
		||||
#define _A_OUT_H_
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
#define COFF_IMAGE_WITH_PE
 | 
			
		||||
#define COFF_LONG_SECTION_NAMES
 | 
			
		||||
 | 
			
		||||
/*** coff information for Intel 386/486.  */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/********************** FILE HEADER **********************/
 | 
			
		||||
 | 
			
		||||
struct external_filehdr {
 | 
			
		||||
  short f_magic;	/* magic number			*/
 | 
			
		||||
  short f_nscns;	/* number of sections		*/
 | 
			
		||||
  unsigned long f_timdat;	/* time & date stamp		*/
 | 
			
		||||
  unsigned long f_symptr;	/* file pointer to symtab	*/
 | 
			
		||||
  unsigned long f_nsyms;	/* number of symtab entries	*/
 | 
			
		||||
  short f_opthdr;	/* sizeof(optional hdr)		*/
 | 
			
		||||
  short f_flags;	/* flags			*/
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/* Bits for f_flags:
 | 
			
		||||
 *	F_RELFLG	relocation info stripped from file
 | 
			
		||||
 *	F_EXEC		file is executable (no unresolved external references)
 | 
			
		||||
 *	F_LNNO		line numbers stripped from file
 | 
			
		||||
 *	F_LSYMS		local symbols stripped from file
 | 
			
		||||
 *	F_AR32WR	file has byte ordering of an AR32WR machine (e.g. vax)
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#define F_RELFLG	(0x0001)
 | 
			
		||||
#define F_EXEC		(0x0002)
 | 
			
		||||
#define F_LNNO		(0x0004)
 | 
			
		||||
#define F_LSYMS		(0x0008)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define	I386MAGIC	0x14c
 | 
			
		||||
#define I386PTXMAGIC	0x154
 | 
			
		||||
#define I386AIXMAGIC	0x175
 | 
			
		||||
 | 
			
		||||
/* This is Lynx's all-platform magic number for executables. */
 | 
			
		||||
 | 
			
		||||
#define LYNXCOFFMAGIC	0415
 | 
			
		||||
 | 
			
		||||
#define I386BADMAG(x) (((x).f_magic != I386MAGIC) \
 | 
			
		||||
		       && (x).f_magic != I386AIXMAGIC \
 | 
			
		||||
		       && (x).f_magic != I386PTXMAGIC \
 | 
			
		||||
		       && (x).f_magic != LYNXCOFFMAGIC)
 | 
			
		||||
 | 
			
		||||
#define	FILHDR	struct external_filehdr
 | 
			
		||||
#define	FILHSZ	20
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/********************** AOUT "OPTIONAL HEADER"=
 | 
			
		||||
 **********************/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
  unsigned short magic;		/* type of file				*/
 | 
			
		||||
  unsigned short vstamp;	/* version stamp			*/
 | 
			
		||||
  unsigned long	tsize;		/* text size in bytes, padded to FW bdry*/
 | 
			
		||||
  unsigned long	dsize;		/* initialized data "  "		*/
 | 
			
		||||
  unsigned long	bsize;		/* uninitialized data "   "		*/
 | 
			
		||||
  unsigned long	entry;		/* entry pt.				*/
 | 
			
		||||
  unsigned long text_start;	/* base of text used for this file */
 | 
			
		||||
  unsigned long data_start;	/* base of data used for this file=
 | 
			
		||||
 */
 | 
			
		||||
}
 | 
			
		||||
AOUTHDR;
 | 
			
		||||
 | 
			
		||||
#define AOUTSZ 28
 | 
			
		||||
#define AOUTHDRSZ 28
 | 
			
		||||
 | 
			
		||||
#define OMAGIC          0404    /* object files, eg as output */
 | 
			
		||||
#define ZMAGIC          0413    /* demand load format, eg normal ld output */
 | 
			
		||||
#define STMAGIC		0401	/* target shlib */
 | 
			
		||||
#define SHMAGIC		0443	/* host   shlib */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* define some NT default values */
 | 
			
		||||
/*  #define NT_IMAGE_BASE        0x400000 moved to internal.h */
 | 
			
		||||
#define NT_SECTION_ALIGNMENT 0x1000
 | 
			
		||||
#define NT_FILE_ALIGNMENT    0x200
 | 
			
		||||
#define NT_DEF_RESERVE       0x100000
 | 
			
		||||
#define NT_DEF_COMMIT        0x1000
 | 
			
		||||
 | 
			
		||||
/********************** SECTION HEADER **********************/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
struct external_scnhdr {
 | 
			
		||||
  char		s_name[8];	/* section name			*/
 | 
			
		||||
  unsigned long	s_paddr;	/* physical address, offset
 | 
			
		||||
				   of last addr in scn */
 | 
			
		||||
  unsigned long	s_vaddr;	/* virtual address		*/
 | 
			
		||||
  unsigned long	s_size;		/* section size			*/
 | 
			
		||||
  unsigned long	s_scnptr;	/* file ptr to raw data for section */
 | 
			
		||||
  unsigned long	s_relptr;	/* file ptr to relocation	*/
 | 
			
		||||
  unsigned long	s_lnnoptr;	/* file ptr to line numbers	*/
 | 
			
		||||
  unsigned short s_nreloc;	/* number of relocation entries	*/
 | 
			
		||||
  unsigned short s_nlnno;	/* number of line number entries*/
 | 
			
		||||
  unsigned long	s_flags;	/* flags			*/
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define	SCNHDR	struct external_scnhdr
 | 
			
		||||
#define	SCNHSZ	40
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * names of "special" sections
 | 
			
		||||
 */
 | 
			
		||||
#define _TEXT	".text"
 | 
			
		||||
#define _DATA	".data"
 | 
			
		||||
#define _BSS	".bss"
 | 
			
		||||
#define _COMMENT ".comment"
 | 
			
		||||
#define _LIB ".lib"
 | 
			
		||||
 | 
			
		||||
/********************** LINE NUMBERS **********************/
 | 
			
		||||
 | 
			
		||||
/* 1 line number entry for every "breakpointable" source line in a section.
 | 
			
		||||
 * Line numbers are grouped on a per function basis; first entry in a function
 | 
			
		||||
 * grouping will have l_lnno = 0 and in place of physical address will be the
 | 
			
		||||
 * symbol table index of the function name.
 | 
			
		||||
 */
 | 
			
		||||
struct external_lineno {
 | 
			
		||||
  union {
 | 
			
		||||
    unsigned long l_symndx; /* function name symbol index, iff l_lnno 0 */
 | 
			
		||||
    unsigned long l_paddr;	/* (physical) address of line number	*/
 | 
			
		||||
  } l_addr;
 | 
			
		||||
  unsigned short l_lnno;	/* line number		*/
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define	LINENO	struct external_lineno
 | 
			
		||||
#define	LINESZ	6
 | 
			
		||||
 | 
			
		||||
/********************** SYMBOLS **********************/
 | 
			
		||||
 | 
			
		||||
#define E_SYMNMLEN	8	/* # characters in a symbol name	*/
 | 
			
		||||
#define E_FILNMLEN	14	/* # characters in a file name		*/
 | 
			
		||||
#define E_DIMNUM	4	/* # array dimensions in auxiliary entry */
 | 
			
		||||
 | 
			
		||||
struct __attribute__((packed)) external_syment
 | 
			
		||||
{
 | 
			
		||||
  union {
 | 
			
		||||
    char e_name[E_SYMNMLEN];
 | 
			
		||||
    struct {
 | 
			
		||||
      unsigned long e_zeroes;
 | 
			
		||||
      unsigned long e_offset;
 | 
			
		||||
    } e;
 | 
			
		||||
  } e;
 | 
			
		||||
  unsigned long e_value;
 | 
			
		||||
  unsigned short e_scnum;
 | 
			
		||||
  unsigned short e_type;
 | 
			
		||||
  char e_sclass[1];
 | 
			
		||||
  char e_numaux[1];
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define N_BTMASK	(0xf)
 | 
			
		||||
#define N_TMASK		(0x30)
 | 
			
		||||
#define N_BTSHFT	(4)
 | 
			
		||||
#define N_TSHIFT	(2)
 | 
			
		||||
 | 
			
		||||
union external_auxent {
 | 
			
		||||
  struct {
 | 
			
		||||
    unsigned long x_tagndx;	/* str, un, or enum tag indx */
 | 
			
		||||
    union {
 | 
			
		||||
      struct {
 | 
			
		||||
	unsigned short  x_lnno; /* declaration line number */
 | 
			
		||||
	unsigned short  x_size; /* str/union/array size */
 | 
			
		||||
      } x_lnsz;
 | 
			
		||||
      unsigned long x_fsize;	/* size of function */
 | 
			
		||||
    } x_misc;
 | 
			
		||||
    union {
 | 
			
		||||
      struct {			/* if ISFCN, tag, or .bb */
 | 
			
		||||
	unsigned long x_lnnoptr;/* ptr to fcn line # */
 | 
			
		||||
	unsigned long x_endndx;	/* entry ndx past block end */
 | 
			
		||||
      } x_fcn;
 | 
			
		||||
      struct {			/* if ISARY, up to 4 dimen. */
 | 
			
		||||
	char x_dimen[E_DIMNUM][2];
 | 
			
		||||
      } x_ary;
 | 
			
		||||
    } x_fcnary;
 | 
			
		||||
    unsigned short x_tvndx;	/* tv index */
 | 
			
		||||
  } x_sym;
 | 
			
		||||
 | 
			
		||||
  union {
 | 
			
		||||
    char x_fname[E_FILNMLEN];
 | 
			
		||||
    struct {
 | 
			
		||||
      unsigned long x_zeroes;
 | 
			
		||||
      unsigned long x_offset;
 | 
			
		||||
    } x_n;
 | 
			
		||||
  } x_file;
 | 
			
		||||
 | 
			
		||||
  struct {
 | 
			
		||||
    unsigned long x_scnlen;	/* section length */
 | 
			
		||||
    unsigned short x_nreloc;	/* # relocation entries */
 | 
			
		||||
    unsigned short x_nlinno;	/* # line numbers */
 | 
			
		||||
    unsigned long x_checksum;	/* section COMDAT checksum */
 | 
			
		||||
    unsigned short x_associated;/* COMDAT associated section index */
 | 
			
		||||
    char x_comdat[1];		/* COMDAT selection number */
 | 
			
		||||
  } x_scn;
 | 
			
		||||
 | 
			
		||||
  struct {
 | 
			
		||||
    unsigned long x_tvfill;	/* tv fill value */
 | 
			
		||||
    unsigned short x_tvlen;	/* length of .tv */
 | 
			
		||||
    char x_tvran[2][2];		/* tv range */
 | 
			
		||||
  } x_tv;	/* info about .tv section (in auxent of symbol .tv)) */
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define	SYMENT	struct external_syment
 | 
			
		||||
#define	SYMESZ	18
 | 
			
		||||
#define	AUXENT	union external_auxent
 | 
			
		||||
#define	AUXESZ	18
 | 
			
		||||
 | 
			
		||||
#define _ETEXT	"etext"
 | 
			
		||||
 | 
			
		||||
/********************** RELOCATION DIRECTIVES **********************/
 | 
			
		||||
 | 
			
		||||
struct external_reloc {
 | 
			
		||||
  char r_vaddr[4];
 | 
			
		||||
  char r_symndx[4];
 | 
			
		||||
  char r_type[2];
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define RELOC struct external_reloc
 | 
			
		||||
#define RELSZ 10
 | 
			
		||||
 | 
			
		||||
/* end of coff/i386.h */
 | 
			
		||||
 | 
			
		||||
/* PE COFF header information */
 | 
			
		||||
 | 
			
		||||
#ifndef _PE_H
 | 
			
		||||
#define _PE_H
 | 
			
		||||
 | 
			
		||||
/* NT specific file attributes */
 | 
			
		||||
#define IMAGE_FILE_RELOCS_STRIPPED           0x0001
 | 
			
		||||
#define IMAGE_FILE_EXECUTABLE_IMAGE          0x0002
 | 
			
		||||
#define IMAGE_FILE_LINE_NUMS_STRIPPED        0x0004
 | 
			
		||||
#define IMAGE_FILE_LOCAL_SYMS_STRIPPED       0x0008
 | 
			
		||||
#define IMAGE_FILE_BYTES_REVERSED_LO         0x0080
 | 
			
		||||
#define IMAGE_FILE_32BIT_MACHINE             0x0100
 | 
			
		||||
#define IMAGE_FILE_DEBUG_STRIPPED            0x0200
 | 
			
		||||
#define IMAGE_FILE_SYSTEM                    0x1000
 | 
			
		||||
#define IMAGE_FILE_DLL                       0x2000
 | 
			
		||||
#define IMAGE_FILE_BYTES_REVERSED_HI         0x8000
 | 
			
		||||
 | 
			
		||||
/* additional flags to be set for section headers to allow the NT loader to
 | 
			
		||||
   read and write to the section data (to replace the addresses of data in
 | 
			
		||||
   dlls for one thing); also to execute the section in .text's case=
 | 
			
		||||
 */
 | 
			
		||||
#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
 | 
			
		||||
#define IMAGE_SCN_MEM_EXECUTE     0x20000000
 | 
			
		||||
#define IMAGE_SCN_MEM_READ        0x40000000
 | 
			
		||||
#define IMAGE_SCN_MEM_WRITE       0x80000000
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Section characteristics added for ppc-nt
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#define IMAGE_SCN_TYPE_NO_PAD                0x00000008  /* Reserved.  */
 | 
			
		||||
 | 
			
		||||
#define IMAGE_SCN_CNT_CODE                   0x00000020  /* Section contains code. */
 | 
			
		||||
#define IMAGE_SCN_CNT_INITIALIZED_DATA       0x00000040  /* Section contains initialized data. */
 | 
			
		||||
#define IMAGE_SCN_CNT_UNINITIALIZED_DATA     0x00000080  /* Section contains uninitialized data. */
 | 
			
		||||
 | 
			
		||||
#define IMAGE_SCN_LNK_OTHER                  0x00000100  /* Reserved.  */
 | 
			
		||||
#define IMAGE_SCN_LNK_INFO                   0x00000200  /* Section contains comments or some other type of information. */
 | 
			
		||||
#define IMAGE_SCN_LNK_REMOVE                 0x00000800  /* Section contents will not become part of image. */
 | 
			
		||||
#define IMAGE_SCN_LNK_COMDAT                 0x00001000  /* Section contents comdat. */
 | 
			
		||||
 | 
			
		||||
#define IMAGE_SCN_MEM_FARDATA                0x00008000
 | 
			
		||||
 | 
			
		||||
#define IMAGE_SCN_MEM_PURGEABLE              0x00020000
 | 
			
		||||
#define IMAGE_SCN_MEM_16BIT                  0x00020000
 | 
			
		||||
#define IMAGE_SCN_MEM_LOCKED                 0x00040000
 | 
			
		||||
#define IMAGE_SCN_MEM_PRELOAD                0x00080000
 | 
			
		||||
 | 
			
		||||
#define IMAGE_SCN_ALIGN_1BYTES               0x00100000
 | 
			
		||||
#define IMAGE_SCN_ALIGN_2BYTES               0x00200000
 | 
			
		||||
#define IMAGE_SCN_ALIGN_4BYTES               0x00300000
 | 
			
		||||
#define IMAGE_SCN_ALIGN_8BYTES               0x00400000
 | 
			
		||||
#define IMAGE_SCN_ALIGN_16BYTES              0x00500000  /* Default alignment if no others are specified. */
 | 
			
		||||
#define IMAGE_SCN_ALIGN_32BYTES              0x00600000
 | 
			
		||||
#define IMAGE_SCN_ALIGN_64BYTES              0x00700000
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define IMAGE_SCN_LNK_NRELOC_OVFL            0x01000000  /* Section contains extended relocations. */
 | 
			
		||||
#define IMAGE_SCN_MEM_NOT_CACHED             0x04000000  /* Section is not cachable.               */
 | 
			
		||||
#define IMAGE_SCN_MEM_NOT_PAGED              0x08000000  /* Section is not pageable.               */
 | 
			
		||||
#define IMAGE_SCN_MEM_SHARED                 0x10000000  /* Section is shareable.                  */
 | 
			
		||||
 | 
			
		||||
/* COMDAT selection codes.  */
 | 
			
		||||
 | 
			
		||||
#define IMAGE_COMDAT_SELECT_NODUPLICATES     (1) /* Warn if duplicates.  */
 | 
			
		||||
#define IMAGE_COMDAT_SELECT_ANY		     (2) /* No warning.  */
 | 
			
		||||
#define IMAGE_COMDAT_SELECT_SAME_SIZE	     (3) /* Warn if different size.  */
 | 
			
		||||
#define IMAGE_COMDAT_SELECT_EXACT_MATCH	     (4) /* Warn if different.  */
 | 
			
		||||
#define IMAGE_COMDAT_SELECT_ASSOCIATIVE	     (5) /* Base on other section.  */
 | 
			
		||||
 | 
			
		||||
/* Magic values that are true for all dos/nt implementations */
 | 
			
		||||
#define DOSMAGIC       0x5a4d
 | 
			
		||||
#define NT_SIGNATURE   0x00004550
 | 
			
		||||
 | 
			
		||||
/* NT allows long filenames, we want to accommodate this.  This may break
 | 
			
		||||
     some of the bfd functions */
 | 
			
		||||
#undef  FILNMLEN
 | 
			
		||||
#define FILNMLEN	18	/* # characters in a file name		*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifdef COFF_IMAGE_WITH_PE
 | 
			
		||||
/* The filehdr is only weired in images */
 | 
			
		||||
 | 
			
		||||
#undef FILHDR
 | 
			
		||||
struct external_PE_filehdr
 | 
			
		||||
{
 | 
			
		||||
  /* DOS header fields */
 | 
			
		||||
  unsigned short e_magic;	/* Magic number, 0x5a4d */
 | 
			
		||||
  unsigned short e_cblp;	/* Bytes on last page of file, 0x90 */
 | 
			
		||||
  unsigned short e_cp;		/* Pages in file, 0x3 */
 | 
			
		||||
  unsigned short e_crlc;	/* Relocations, 0x0 */
 | 
			
		||||
  unsigned short e_cparhdr;	/* Size of header in paragraphs, 0x4 */
 | 
			
		||||
  unsigned short e_minalloc;	/* Minimum extra paragraphs needed, 0x0 */
 | 
			
		||||
  unsigned short e_maxalloc;	/* Maximum extra paragraphs needed, 0xFFFF */
 | 
			
		||||
  unsigned short e_ss;		/* Initial (relative) SS value, 0x0 */
 | 
			
		||||
  unsigned short e_sp;		/* Initial SP value, 0xb8 */
 | 
			
		||||
  unsigned short e_csum;	/* Checksum, 0x0 */
 | 
			
		||||
  unsigned short e_ip;		/* Initial IP value, 0x0 */
 | 
			
		||||
  unsigned short e_cs;		/* Initial (relative) CS value, 0x0 */
 | 
			
		||||
  unsigned short e_lfarlc;	/* File address of relocation table, 0x40 */
 | 
			
		||||
  unsigned short e_ovno;	/* Overlay number, 0x0 */
 | 
			
		||||
  char e_res[4][2];		/* Reserved words, all 0x0 */
 | 
			
		||||
  unsigned short e_oemid;	/* OEM identifier (for e_oeminfo), 0x0 */
 | 
			
		||||
  unsigned short e_oeminfo;	/* OEM information; e_oemid specific, 0x0 */
 | 
			
		||||
  char e_res2[10][2];		/* Reserved words, all 0x0 */
 | 
			
		||||
  unsigned long e_lfanew;	/* File address of new exe header, 0x80 */
 | 
			
		||||
  char dos_message[16][4];	/* other stuff, always follow DOS header */
 | 
			
		||||
  unsigned int nt_signature;	/* required NT signature, 0x4550 */
 | 
			
		||||
 | 
			
		||||
  /* From standard header */
 | 
			
		||||
 | 
			
		||||
  unsigned short f_magic;	/* magic number			*/
 | 
			
		||||
  unsigned short f_nscns;	/* number of sections		*/
 | 
			
		||||
  unsigned long f_timdat;	/* time & date stamp		*/
 | 
			
		||||
  unsigned long f_symptr;	/* file pointer to symtab	*/
 | 
			
		||||
  unsigned long f_nsyms;	/* number of symtab entries	*/
 | 
			
		||||
  unsigned short f_opthdr;	/* sizeof(optional hdr)		*/
 | 
			
		||||
  unsigned short f_flags;	/* flags			*/
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define FILHDR struct external_PE_filehdr
 | 
			
		||||
#undef FILHSZ
 | 
			
		||||
#define FILHSZ 152
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
  unsigned short magic;		/* type of file				*/
 | 
			
		||||
  unsigned short vstamp;	/* version stamp			*/
 | 
			
		||||
  unsigned long	tsize;		/* text size in bytes, padded to FW bdry*/
 | 
			
		||||
  unsigned long	dsize;		/* initialized data "  "		*/
 | 
			
		||||
  unsigned long	bsize;		/* uninitialized data "   "		*/
 | 
			
		||||
  unsigned long	entry;		/* entry pt.				*/
 | 
			
		||||
  unsigned long text_start;	/* base of text used for this file */
 | 
			
		||||
  unsigned long data_start;	/* base of all data used for this file */
 | 
			
		||||
 | 
			
		||||
  /* NT extra fields; see internal.h for descriptions */
 | 
			
		||||
  unsigned long  ImageBase;
 | 
			
		||||
  unsigned long  SectionAlignment;
 | 
			
		||||
  unsigned long  FileAlignment;
 | 
			
		||||
  unsigned short  MajorOperatingSystemVersion;
 | 
			
		||||
  unsigned short  MinorOperatingSystemVersion;
 | 
			
		||||
  unsigned short  MajorImageVersion;
 | 
			
		||||
  unsigned short  MinorImageVersion;
 | 
			
		||||
  unsigned short  MajorSubsystemVersion;
 | 
			
		||||
  unsigned short  MinorSubsystemVersion;
 | 
			
		||||
  char  Reserved1[4];
 | 
			
		||||
  unsigned long  SizeOfImage;
 | 
			
		||||
  unsigned long  SizeOfHeaders;
 | 
			
		||||
  unsigned long  CheckSum;
 | 
			
		||||
  unsigned short Subsystem;
 | 
			
		||||
  unsigned short DllCharacteristics;
 | 
			
		||||
  unsigned long  SizeOfStackReserve;
 | 
			
		||||
  unsigned long  SizeOfStackCommit;
 | 
			
		||||
  unsigned long  SizeOfHeapReserve;
 | 
			
		||||
  unsigned long  SizeOfHeapCommit;
 | 
			
		||||
  unsigned long  LoaderFlags;
 | 
			
		||||
  unsigned long  NumberOfRvaAndSizes;
 | 
			
		||||
  /* IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; */
 | 
			
		||||
  char  DataDirectory[16][2][4]; /* 16 entries, 2 elements/entry, 4 chars */
 | 
			
		||||
 | 
			
		||||
} PEAOUTHDR;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#undef AOUTSZ
 | 
			
		||||
#define AOUTSZ (AOUTHDRSZ + 196)
 | 
			
		||||
 | 
			
		||||
#undef  E_FILNMLEN
 | 
			
		||||
#define E_FILNMLEN	18	/* # characters in a file name		*/
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* end of coff/pe.h */
 | 
			
		||||
 | 
			
		||||
#define DT_NON		(0)	/* no derived type */
 | 
			
		||||
#define DT_PTR		(1)	/* pointer */
 | 
			
		||||
#define DT_FCN		(2)	/* function */
 | 
			
		||||
#define DT_ARY		(3)	/* array */
 | 
			
		||||
 | 
			
		||||
#define ISPTR(x)	(((x) & N_TMASK) == (DT_PTR << N_BTSHFT))
 | 
			
		||||
#define ISFCN(x)	(((x) & N_TMASK) == (DT_FCN << N_BTSHFT))
 | 
			
		||||
#define ISARY(x)	(((x) & N_TMASK) == (DT_ARY << N_BTSHFT))
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif /* _A_OUT_H_ */
 | 
			
		||||
 | 
			
		||||
@@ -1,18 +0,0 @@
 | 
			
		||||
config WHPX
 | 
			
		||||
    bool
 | 
			
		||||
 | 
			
		||||
config HAX
 | 
			
		||||
    bool
 | 
			
		||||
 | 
			
		||||
config HVF
 | 
			
		||||
    bool
 | 
			
		||||
 | 
			
		||||
config TCG
 | 
			
		||||
    bool
 | 
			
		||||
 | 
			
		||||
config KVM
 | 
			
		||||
    bool
 | 
			
		||||
 | 
			
		||||
config XEN
 | 
			
		||||
    bool
 | 
			
		||||
    select FSDEV_9P if VIRTFS
 | 
			
		||||
@@ -1,105 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * QEMU accel class, components common to system emulation and user mode
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) 2003-2008 Fabrice Bellard
 | 
			
		||||
 * Copyright (c) 2014 Red Hat Inc.
 | 
			
		||||
 *
 | 
			
		||||
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
 * of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
 * in the Software without restriction, including without limitation the rights
 | 
			
		||||
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
 * copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
 * furnished to do so, subject to the following conditions:
 | 
			
		||||
 *
 | 
			
		||||
 * The above copyright notice and this permission notice shall be included in
 | 
			
		||||
 * all copies or substantial portions of the Software.
 | 
			
		||||
 *
 | 
			
		||||
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 | 
			
		||||
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 | 
			
		||||
 * THE SOFTWARE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "qemu/osdep.h"
 | 
			
		||||
#include "qemu/accel.h"
 | 
			
		||||
 | 
			
		||||
#include "cpu.h"
 | 
			
		||||
#include "hw/core/accel-cpu.h"
 | 
			
		||||
 | 
			
		||||
#ifndef CONFIG_USER_ONLY
 | 
			
		||||
#include "accel-softmmu.h"
 | 
			
		||||
#endif /* !CONFIG_USER_ONLY */
 | 
			
		||||
 | 
			
		||||
static const TypeInfo accel_type = {
 | 
			
		||||
    .name = TYPE_ACCEL,
 | 
			
		||||
    .parent = TYPE_OBJECT,
 | 
			
		||||
    .class_size = sizeof(AccelClass),
 | 
			
		||||
    .instance_size = sizeof(AccelState),
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/* Lookup AccelClass from opt_name. Returns NULL if not found */
 | 
			
		||||
AccelClass *accel_find(const char *opt_name)
 | 
			
		||||
{
 | 
			
		||||
    char *class_name = g_strdup_printf(ACCEL_CLASS_NAME("%s"), opt_name);
 | 
			
		||||
    AccelClass *ac = ACCEL_CLASS(object_class_by_name(class_name));
 | 
			
		||||
    g_free(class_name);
 | 
			
		||||
    return ac;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void accel_init_cpu_int_aux(ObjectClass *klass, void *opaque)
 | 
			
		||||
{
 | 
			
		||||
    CPUClass *cc = CPU_CLASS(klass);
 | 
			
		||||
    AccelCPUClass *accel_cpu = opaque;
 | 
			
		||||
 | 
			
		||||
    cc->accel_cpu = accel_cpu;
 | 
			
		||||
    if (accel_cpu->cpu_class_init) {
 | 
			
		||||
        accel_cpu->cpu_class_init(cc);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* initialize the arch-specific accel CpuClass interfaces */
 | 
			
		||||
static void accel_init_cpu_interfaces(AccelClass *ac)
 | 
			
		||||
{
 | 
			
		||||
    const char *ac_name; /* AccelClass name */
 | 
			
		||||
    char *acc_name;      /* AccelCPUClass name */
 | 
			
		||||
    ObjectClass *acc;    /* AccelCPUClass */
 | 
			
		||||
 | 
			
		||||
    ac_name = object_class_get_name(OBJECT_CLASS(ac));
 | 
			
		||||
    g_assert(ac_name != NULL);
 | 
			
		||||
 | 
			
		||||
    acc_name = g_strdup_printf("%s-%s", ac_name, CPU_RESOLVING_TYPE);
 | 
			
		||||
    acc = object_class_by_name(acc_name);
 | 
			
		||||
    g_free(acc_name);
 | 
			
		||||
 | 
			
		||||
    if (acc) {
 | 
			
		||||
        object_class_foreach(accel_init_cpu_int_aux,
 | 
			
		||||
                             CPU_RESOLVING_TYPE, false, acc);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void accel_init_interfaces(AccelClass *ac)
 | 
			
		||||
{
 | 
			
		||||
#ifndef CONFIG_USER_ONLY
 | 
			
		||||
    accel_init_ops_interfaces(ac);
 | 
			
		||||
#endif /* !CONFIG_USER_ONLY */
 | 
			
		||||
 | 
			
		||||
    accel_init_cpu_interfaces(ac);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const TypeInfo accel_cpu_type = {
 | 
			
		||||
    .name = TYPE_ACCEL_CPU,
 | 
			
		||||
    .parent = TYPE_OBJECT,
 | 
			
		||||
    .abstract = true,
 | 
			
		||||
    .class_size = sizeof(AccelCPUClass),
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static void register_accel_types(void)
 | 
			
		||||
{
 | 
			
		||||
    type_register_static(&accel_type);
 | 
			
		||||
    type_register_static(&accel_cpu_type);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type_init(register_accel_types);
 | 
			
		||||
@@ -1,100 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * QEMU accel class, system emulation components
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) 2003-2008 Fabrice Bellard
 | 
			
		||||
 * Copyright (c) 2014 Red Hat Inc.
 | 
			
		||||
 *
 | 
			
		||||
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
 * of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
 * in the Software without restriction, including without limitation the rights
 | 
			
		||||
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
 * copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
 * furnished to do so, subject to the following conditions:
 | 
			
		||||
 *
 | 
			
		||||
 * The above copyright notice and this permission notice shall be included in
 | 
			
		||||
 * all copies or substantial portions of the Software.
 | 
			
		||||
 *
 | 
			
		||||
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 | 
			
		||||
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 | 
			
		||||
 * THE SOFTWARE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "qemu/osdep.h"
 | 
			
		||||
#include "qemu/accel.h"
 | 
			
		||||
#include "hw/boards.h"
 | 
			
		||||
#include "sysemu/cpus.h"
 | 
			
		||||
 | 
			
		||||
#include "accel-softmmu.h"
 | 
			
		||||
 | 
			
		||||
int accel_init_machine(AccelState *accel, MachineState *ms)
 | 
			
		||||
{
 | 
			
		||||
    AccelClass *acc = ACCEL_GET_CLASS(accel);
 | 
			
		||||
    int ret;
 | 
			
		||||
    ms->accelerator = accel;
 | 
			
		||||
    *(acc->allowed) = true;
 | 
			
		||||
    ret = acc->init_machine(ms);
 | 
			
		||||
    if (ret < 0) {
 | 
			
		||||
        ms->accelerator = NULL;
 | 
			
		||||
        *(acc->allowed) = false;
 | 
			
		||||
        object_unref(OBJECT(accel));
 | 
			
		||||
    } else {
 | 
			
		||||
        object_set_accelerator_compat_props(acc->compat_props);
 | 
			
		||||
    }
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
AccelState *current_accel(void)
 | 
			
		||||
{
 | 
			
		||||
    return current_machine->accelerator;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void accel_setup_post(MachineState *ms)
 | 
			
		||||
{
 | 
			
		||||
    AccelState *accel = ms->accelerator;
 | 
			
		||||
    AccelClass *acc = ACCEL_GET_CLASS(accel);
 | 
			
		||||
    if (acc->setup_post) {
 | 
			
		||||
        acc->setup_post(ms, accel);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* initialize the arch-independent accel operation interfaces */
 | 
			
		||||
void accel_init_ops_interfaces(AccelClass *ac)
 | 
			
		||||
{
 | 
			
		||||
    const char *ac_name;
 | 
			
		||||
    char *ops_name;
 | 
			
		||||
    AccelOpsClass *ops;
 | 
			
		||||
 | 
			
		||||
    ac_name = object_class_get_name(OBJECT_CLASS(ac));
 | 
			
		||||
    g_assert(ac_name != NULL);
 | 
			
		||||
 | 
			
		||||
    ops_name = g_strdup_printf("%s" ACCEL_OPS_SUFFIX, ac_name);
 | 
			
		||||
    ops = ACCEL_OPS_CLASS(object_class_by_name(ops_name));
 | 
			
		||||
    g_free(ops_name);
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
     * all accelerators need to define ops, providing at least a mandatory
 | 
			
		||||
     * non-NULL create_vcpu_thread operation.
 | 
			
		||||
     */
 | 
			
		||||
    g_assert(ops != NULL);
 | 
			
		||||
    if (ops->ops_init) {
 | 
			
		||||
        ops->ops_init(ops);
 | 
			
		||||
    }
 | 
			
		||||
    cpus_register_accel(ops);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const TypeInfo accel_ops_type_info = {
 | 
			
		||||
    .name = TYPE_ACCEL_OPS,
 | 
			
		||||
    .parent = TYPE_OBJECT,
 | 
			
		||||
    .abstract = true,
 | 
			
		||||
    .class_size = sizeof(AccelOpsClass),
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static void accel_softmmu_register_types(void)
 | 
			
		||||
{
 | 
			
		||||
    type_register_static(&accel_ops_type_info);
 | 
			
		||||
}
 | 
			
		||||
type_init(accel_softmmu_register_types);
 | 
			
		||||
@@ -1,15 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * QEMU System Emulation accel internal functions
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright 2021 SUSE LLC
 | 
			
		||||
 *
 | 
			
		||||
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 | 
			
		||||
 * See the COPYING file in the top-level directory.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef ACCEL_SOFTMMU_H
 | 
			
		||||
#define ACCEL_SOFTMMU_H
 | 
			
		||||
 | 
			
		||||
void accel_init_ops_interfaces(AccelClass *ac);
 | 
			
		||||
 | 
			
		||||
#endif /* ACCEL_SOFTMMU_H */
 | 
			
		||||
@@ -1,24 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * QEMU accel class, user-mode components
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright 2021 SUSE LLC
 | 
			
		||||
 *
 | 
			
		||||
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 | 
			
		||||
 * See the COPYING file in the top-level directory.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "qemu/osdep.h"
 | 
			
		||||
#include "qemu/accel.h"
 | 
			
		||||
 | 
			
		||||
AccelState *current_accel(void)
 | 
			
		||||
{
 | 
			
		||||
    static AccelState *accel;
 | 
			
		||||
 | 
			
		||||
    if (!accel) {
 | 
			
		||||
        AccelClass *ac = accel_find("tcg");
 | 
			
		||||
 | 
			
		||||
        g_assert(ac != NULL);
 | 
			
		||||
        accel = ACCEL(object_new_with_class(OBJECT_CLASS(ac)));
 | 
			
		||||
    }
 | 
			
		||||
    return accel;
 | 
			
		||||
}
 | 
			
		||||
@@ -1,72 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Dummy cpu thread code
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright IBM, Corp. 2011
 | 
			
		||||
 *
 | 
			
		||||
 * Authors:
 | 
			
		||||
 *  Anthony Liguori   <aliguori@us.ibm.com>
 | 
			
		||||
 *
 | 
			
		||||
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 | 
			
		||||
 * See the COPYING file in the top-level directory.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "qemu/osdep.h"
 | 
			
		||||
#include "qemu/rcu.h"
 | 
			
		||||
#include "sysemu/cpus.h"
 | 
			
		||||
#include "qemu/guest-random.h"
 | 
			
		||||
#include "qemu/main-loop.h"
 | 
			
		||||
#include "hw/core/cpu.h"
 | 
			
		||||
 | 
			
		||||
static void *dummy_cpu_thread_fn(void *arg)
 | 
			
		||||
{
 | 
			
		||||
    CPUState *cpu = arg;
 | 
			
		||||
    sigset_t waitset;
 | 
			
		||||
    int r;
 | 
			
		||||
 | 
			
		||||
    rcu_register_thread();
 | 
			
		||||
 | 
			
		||||
    qemu_mutex_lock_iothread();
 | 
			
		||||
    qemu_thread_get_self(cpu->thread);
 | 
			
		||||
    cpu->thread_id = qemu_get_thread_id();
 | 
			
		||||
    cpu->can_do_io = 1;
 | 
			
		||||
    current_cpu = cpu;
 | 
			
		||||
 | 
			
		||||
    sigemptyset(&waitset);
 | 
			
		||||
    sigaddset(&waitset, SIG_IPI);
 | 
			
		||||
 | 
			
		||||
    /* signal CPU creation */
 | 
			
		||||
    cpu_thread_signal_created(cpu);
 | 
			
		||||
    qemu_guest_random_seed_thread_part2(cpu->random_seed);
 | 
			
		||||
 | 
			
		||||
    do {
 | 
			
		||||
        qemu_mutex_unlock_iothread();
 | 
			
		||||
        do {
 | 
			
		||||
            int sig;
 | 
			
		||||
            r = sigwait(&waitset, &sig);
 | 
			
		||||
        } while (r == -1 && (errno == EAGAIN || errno == EINTR));
 | 
			
		||||
        if (r == -1) {
 | 
			
		||||
            perror("sigwait");
 | 
			
		||||
            exit(1);
 | 
			
		||||
        }
 | 
			
		||||
        qemu_mutex_lock_iothread();
 | 
			
		||||
        qemu_wait_io_event(cpu);
 | 
			
		||||
    } while (!cpu->unplug);
 | 
			
		||||
 | 
			
		||||
    qemu_mutex_unlock_iothread();
 | 
			
		||||
    rcu_unregister_thread();
 | 
			
		||||
    return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void dummy_start_vcpu_thread(CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
    char thread_name[VCPU_THREAD_NAME_SIZE];
 | 
			
		||||
 | 
			
		||||
    cpu->thread = g_malloc0(sizeof(QemuThread));
 | 
			
		||||
    cpu->halt_cond = g_malloc0(sizeof(QemuCond));
 | 
			
		||||
    qemu_cond_init(cpu->halt_cond);
 | 
			
		||||
    snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/DUMMY",
 | 
			
		||||
             cpu->cpu_index);
 | 
			
		||||
    qemu_thread_create(cpu->thread, thread_name, dummy_cpu_thread_fn, cpu,
 | 
			
		||||
                       QEMU_THREAD_JOINABLE);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,8 +0,0 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 | 
			
		||||
<plist version="1.0">
 | 
			
		||||
<dict>
 | 
			
		||||
    <key>com.apple.security.hypervisor</key>
 | 
			
		||||
    <true/>
 | 
			
		||||
</dict>
 | 
			
		||||
</plist>
 | 
			
		||||
@@ -1,100 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * QEMU KVM support
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright IBM, Corp. 2008
 | 
			
		||||
 *           Red Hat, Inc. 2008
 | 
			
		||||
 *
 | 
			
		||||
 * Authors:
 | 
			
		||||
 *  Anthony Liguori   <aliguori@us.ibm.com>
 | 
			
		||||
 *  Glauber Costa     <gcosta@redhat.com>
 | 
			
		||||
 *
 | 
			
		||||
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 | 
			
		||||
 * See the COPYING file in the top-level directory.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "qemu/osdep.h"
 | 
			
		||||
#include "qemu/error-report.h"
 | 
			
		||||
#include "qemu/main-loop.h"
 | 
			
		||||
#include "sysemu/kvm_int.h"
 | 
			
		||||
#include "sysemu/runstate.h"
 | 
			
		||||
#include "sysemu/cpus.h"
 | 
			
		||||
#include "qemu/guest-random.h"
 | 
			
		||||
#include "qapi/error.h"
 | 
			
		||||
 | 
			
		||||
#include "kvm-cpus.h"
 | 
			
		||||
 | 
			
		||||
static void *kvm_vcpu_thread_fn(void *arg)
 | 
			
		||||
{
 | 
			
		||||
    CPUState *cpu = arg;
 | 
			
		||||
    int r;
 | 
			
		||||
 | 
			
		||||
    rcu_register_thread();
 | 
			
		||||
 | 
			
		||||
    qemu_mutex_lock_iothread();
 | 
			
		||||
    qemu_thread_get_self(cpu->thread);
 | 
			
		||||
    cpu->thread_id = qemu_get_thread_id();
 | 
			
		||||
    cpu->can_do_io = 1;
 | 
			
		||||
    current_cpu = cpu;
 | 
			
		||||
 | 
			
		||||
    r = kvm_init_vcpu(cpu, &error_fatal);
 | 
			
		||||
    kvm_init_cpu_signals(cpu);
 | 
			
		||||
 | 
			
		||||
    /* signal CPU creation */
 | 
			
		||||
    cpu_thread_signal_created(cpu);
 | 
			
		||||
    qemu_guest_random_seed_thread_part2(cpu->random_seed);
 | 
			
		||||
 | 
			
		||||
    do {
 | 
			
		||||
        if (cpu_can_run(cpu)) {
 | 
			
		||||
            r = kvm_cpu_exec(cpu);
 | 
			
		||||
            if (r == EXCP_DEBUG) {
 | 
			
		||||
                cpu_handle_guest_debug(cpu);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        qemu_wait_io_event(cpu);
 | 
			
		||||
    } while (!cpu->unplug || cpu_can_run(cpu));
 | 
			
		||||
 | 
			
		||||
    kvm_destroy_vcpu(cpu);
 | 
			
		||||
    cpu_thread_signal_destroyed(cpu);
 | 
			
		||||
    qemu_mutex_unlock_iothread();
 | 
			
		||||
    rcu_unregister_thread();
 | 
			
		||||
    return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void kvm_start_vcpu_thread(CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
    char thread_name[VCPU_THREAD_NAME_SIZE];
 | 
			
		||||
 | 
			
		||||
    cpu->thread = g_malloc0(sizeof(QemuThread));
 | 
			
		||||
    cpu->halt_cond = g_malloc0(sizeof(QemuCond));
 | 
			
		||||
    qemu_cond_init(cpu->halt_cond);
 | 
			
		||||
    snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/KVM",
 | 
			
		||||
             cpu->cpu_index);
 | 
			
		||||
    qemu_thread_create(cpu->thread, thread_name, kvm_vcpu_thread_fn,
 | 
			
		||||
                       cpu, QEMU_THREAD_JOINABLE);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void kvm_accel_ops_class_init(ObjectClass *oc, void *data)
 | 
			
		||||
{
 | 
			
		||||
    AccelOpsClass *ops = ACCEL_OPS_CLASS(oc);
 | 
			
		||||
 | 
			
		||||
    ops->create_vcpu_thread = kvm_start_vcpu_thread;
 | 
			
		||||
    ops->synchronize_post_reset = kvm_cpu_synchronize_post_reset;
 | 
			
		||||
    ops->synchronize_post_init = kvm_cpu_synchronize_post_init;
 | 
			
		||||
    ops->synchronize_state = kvm_cpu_synchronize_state;
 | 
			
		||||
    ops->synchronize_pre_loadvm = kvm_cpu_synchronize_pre_loadvm;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const TypeInfo kvm_accel_ops_type = {
 | 
			
		||||
    .name = ACCEL_OPS_NAME("kvm"),
 | 
			
		||||
 | 
			
		||||
    .parent = TYPE_ACCEL_OPS,
 | 
			
		||||
    .class_init = kvm_accel_ops_class_init,
 | 
			
		||||
    .abstract = true,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static void kvm_accel_ops_register_types(void)
 | 
			
		||||
{
 | 
			
		||||
    type_register_static(&kvm_accel_ops_type);
 | 
			
		||||
}
 | 
			
		||||
type_init(kvm_accel_ops_register_types);
 | 
			
		||||
							
								
								
									
										3216
									
								
								accel/kvm/kvm-all.c
									
									
									
									
									
								
							
							
						
						
									
										3216
									
								
								accel/kvm/kvm-all.c
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,22 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Accelerator CPUS Interface
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright 2020 SUSE LLC
 | 
			
		||||
 *
 | 
			
		||||
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 | 
			
		||||
 * See the COPYING file in the top-level directory.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef KVM_CPUS_H
 | 
			
		||||
#define KVM_CPUS_H
 | 
			
		||||
 | 
			
		||||
#include "sysemu/cpus.h"
 | 
			
		||||
 | 
			
		||||
int kvm_init_vcpu(CPUState *cpu, Error **errp);
 | 
			
		||||
int kvm_cpu_exec(CPUState *cpu);
 | 
			
		||||
void kvm_destroy_vcpu(CPUState *cpu);
 | 
			
		||||
void kvm_cpu_synchronize_post_reset(CPUState *cpu);
 | 
			
		||||
void kvm_cpu_synchronize_post_init(CPUState *cpu);
 | 
			
		||||
void kvm_cpu_synchronize_pre_loadvm(CPUState *cpu);
 | 
			
		||||
 | 
			
		||||
#endif /* KVM_CPUS_H */
 | 
			
		||||
@@ -1,8 +0,0 @@
 | 
			
		||||
kvm_ss = ss.source_set()
 | 
			
		||||
kvm_ss.add(files(
 | 
			
		||||
  'kvm-all.c',
 | 
			
		||||
  'kvm-accel-ops.c',
 | 
			
		||||
))
 | 
			
		||||
kvm_ss.add(when: 'CONFIG_SEV', if_false: files('sev-stub.c'))
 | 
			
		||||
 | 
			
		||||
specific_ss.add_all(when: 'CONFIG_KVM', if_true: kvm_ss)
 | 
			
		||||
@@ -1,22 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * QEMU SEV stub
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright Advanced Micro Devices 2018
 | 
			
		||||
 *
 | 
			
		||||
 * Authors:
 | 
			
		||||
 *      Brijesh Singh <brijesh.singh@amd.com>
 | 
			
		||||
 *
 | 
			
		||||
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 | 
			
		||||
 * See the COPYING file in the top-level directory.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "qemu/osdep.h"
 | 
			
		||||
#include "qemu-common.h"
 | 
			
		||||
#include "sysemu/sev.h"
 | 
			
		||||
 | 
			
		||||
int sev_kvm_init(ConfidentialGuestSupport *cgs, Error **errp)
 | 
			
		||||
{
 | 
			
		||||
    /* If we get here, cgs must be some non-SEV thing */
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
@@ -1,21 +0,0 @@
 | 
			
		||||
# See docs/devel/tracing.txt for syntax documentation.
 | 
			
		||||
 | 
			
		||||
# kvm-all.c
 | 
			
		||||
kvm_ioctl(int type, void *arg) "type 0x%x, arg %p"
 | 
			
		||||
kvm_vm_ioctl(int type, void *arg) "type 0x%x, arg %p"
 | 
			
		||||
kvm_vcpu_ioctl(int cpu_index, int type, void *arg) "cpu_index %d, type 0x%x, arg %p"
 | 
			
		||||
kvm_run_exit(int cpu_index, uint32_t reason) "cpu_index %d, reason %d"
 | 
			
		||||
kvm_device_ioctl(int fd, int type, void *arg) "dev fd %d, type 0x%x, arg %p"
 | 
			
		||||
kvm_failed_reg_get(uint64_t id, const char *msg) "Warning: Unable to retrieve ONEREG %" PRIu64 " from KVM: %s"
 | 
			
		||||
kvm_failed_reg_set(uint64_t id, const char *msg) "Warning: Unable to set ONEREG %" PRIu64 " to KVM: %s"
 | 
			
		||||
kvm_init_vcpu(int cpu_index, unsigned long arch_cpu_id) "index: %d id: %lu"
 | 
			
		||||
kvm_irqchip_commit_routes(void) ""
 | 
			
		||||
kvm_irqchip_add_msi_route(char *name, int vector, int virq) "dev %s vector %d virq %d"
 | 
			
		||||
kvm_irqchip_update_msi_route(int virq) "Updating MSI route virq=%d"
 | 
			
		||||
kvm_irqchip_release_virq(int virq) "virq %d"
 | 
			
		||||
kvm_set_ioeventfd_mmio(int fd, uint64_t addr, uint32_t val, bool assign, uint32_t size, bool datamatch) "fd: %d @0x%" PRIx64 " val=0x%x assign: %d size: %d match: %d"
 | 
			
		||||
kvm_set_ioeventfd_pio(int fd, uint16_t addr, uint32_t val, bool assign, uint32_t size, bool datamatch) "fd: %d @0x%x val=0x%x assign: %d size: %d match: %d"
 | 
			
		||||
kvm_set_user_memory(uint32_t slot, uint32_t flags, uint64_t guest_phys_addr, uint64_t memory_size, uint64_t userspace_addr, int ret) "Slot#%d flags=0x%x gpa=0x%"PRIx64 " size=0x%"PRIx64 " ua=0x%"PRIx64 " ret=%d"
 | 
			
		||||
kvm_clear_dirty_log(uint32_t slot, uint64_t start, uint32_t size) "slot#%"PRId32" start 0x%"PRIx64" size 0x%"PRIx32
 | 
			
		||||
kvm_resample_fd_notify(int gsi) "gsi %d"
 | 
			
		||||
 | 
			
		||||
@@ -1 +0,0 @@
 | 
			
		||||
#include "trace/trace-accel_kvm.h"
 | 
			
		||||
@@ -1,17 +0,0 @@
 | 
			
		||||
specific_ss.add(files('accel-common.c'))
 | 
			
		||||
softmmu_ss.add(files('accel-softmmu.c'))
 | 
			
		||||
user_ss.add(files('accel-user.c'))
 | 
			
		||||
 | 
			
		||||
subdir('qtest')
 | 
			
		||||
subdir('kvm')
 | 
			
		||||
subdir('tcg')
 | 
			
		||||
subdir('xen')
 | 
			
		||||
subdir('stubs')
 | 
			
		||||
 | 
			
		||||
dummy_ss = ss.source_set()
 | 
			
		||||
dummy_ss.add(files(
 | 
			
		||||
  'dummy-cpus.c',
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
specific_ss.add_all(when: ['CONFIG_SOFTMMU', 'CONFIG_POSIX'], if_true: dummy_ss)
 | 
			
		||||
specific_ss.add_all(when: ['CONFIG_XEN'], if_true: dummy_ss)
 | 
			
		||||
@@ -1,6 +0,0 @@
 | 
			
		||||
qtest_ss = ss.source_set()
 | 
			
		||||
qtest_ss.add(files(
 | 
			
		||||
  'qtest.c',
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
specific_ss.add_all(when: ['CONFIG_SOFTMMU', 'CONFIG_POSIX'], if_true: qtest_ss)
 | 
			
		||||
@@ -1,71 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * QTest accelerator code
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright IBM, Corp. 2011
 | 
			
		||||
 *
 | 
			
		||||
 * Authors:
 | 
			
		||||
 *  Anthony Liguori   <aliguori@us.ibm.com>
 | 
			
		||||
 *
 | 
			
		||||
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 | 
			
		||||
 * See the COPYING file in the top-level directory.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "qemu/osdep.h"
 | 
			
		||||
#include "qemu/rcu.h"
 | 
			
		||||
#include "qapi/error.h"
 | 
			
		||||
#include "qemu/module.h"
 | 
			
		||||
#include "qemu/option.h"
 | 
			
		||||
#include "qemu/config-file.h"
 | 
			
		||||
#include "qemu/accel.h"
 | 
			
		||||
#include "sysemu/qtest.h"
 | 
			
		||||
#include "sysemu/cpus.h"
 | 
			
		||||
#include "sysemu/cpu-timers.h"
 | 
			
		||||
#include "qemu/guest-random.h"
 | 
			
		||||
#include "qemu/main-loop.h"
 | 
			
		||||
#include "hw/core/cpu.h"
 | 
			
		||||
 | 
			
		||||
static int qtest_init_accel(MachineState *ms)
 | 
			
		||||
{
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void qtest_accel_class_init(ObjectClass *oc, void *data)
 | 
			
		||||
{
 | 
			
		||||
    AccelClass *ac = ACCEL_CLASS(oc);
 | 
			
		||||
    ac->name = "QTest";
 | 
			
		||||
    ac->init_machine = qtest_init_accel;
 | 
			
		||||
    ac->allowed = &qtest_allowed;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define TYPE_QTEST_ACCEL ACCEL_CLASS_NAME("qtest")
 | 
			
		||||
 | 
			
		||||
static const TypeInfo qtest_accel_type = {
 | 
			
		||||
    .name = TYPE_QTEST_ACCEL,
 | 
			
		||||
    .parent = TYPE_ACCEL,
 | 
			
		||||
    .class_init = qtest_accel_class_init,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static void qtest_accel_ops_class_init(ObjectClass *oc, void *data)
 | 
			
		||||
{
 | 
			
		||||
    AccelOpsClass *ops = ACCEL_OPS_CLASS(oc);
 | 
			
		||||
 | 
			
		||||
    ops->create_vcpu_thread = dummy_start_vcpu_thread;
 | 
			
		||||
    ops->get_virtual_clock = qtest_get_virtual_clock;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const TypeInfo qtest_accel_ops_type = {
 | 
			
		||||
    .name = ACCEL_OPS_NAME("qtest"),
 | 
			
		||||
 | 
			
		||||
    .parent = TYPE_ACCEL_OPS,
 | 
			
		||||
    .class_init = qtest_accel_ops_class_init,
 | 
			
		||||
    .abstract = true,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static void qtest_type_init(void)
 | 
			
		||||
{
 | 
			
		||||
    type_register_static(&qtest_accel_type);
 | 
			
		||||
    type_register_static(&qtest_accel_ops_type);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type_init(qtest_type_init);
 | 
			
		||||
@@ -1,22 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * QEMU HAXM support
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) 2015, Intel Corporation
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright 2016 Google, Inc.
 | 
			
		||||
 *
 | 
			
		||||
 * This software is licensed under the terms of the GNU General Public
 | 
			
		||||
 * License version 2, as published by the Free Software Foundation, and
 | 
			
		||||
 * may be copied, distributed, and modified under those terms.
 | 
			
		||||
 *
 | 
			
		||||
 * See the COPYING file in the top-level directory.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "qemu/osdep.h"
 | 
			
		||||
#include "sysemu/hax.h"
 | 
			
		||||
 | 
			
		||||
int hax_sync_vcpus(void)
 | 
			
		||||
{
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
@@ -1,151 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * QEMU KVM stub
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright Red Hat, Inc. 2010
 | 
			
		||||
 *
 | 
			
		||||
 * Author: Paolo Bonzini     <pbonzini@redhat.com>
 | 
			
		||||
 *
 | 
			
		||||
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 | 
			
		||||
 * See the COPYING file in the top-level directory.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "qemu/osdep.h"
 | 
			
		||||
#include "cpu.h"
 | 
			
		||||
#include "sysemu/kvm.h"
 | 
			
		||||
 | 
			
		||||
#ifndef CONFIG_USER_ONLY
 | 
			
		||||
#include "hw/pci/msi.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
KVMState *kvm_state;
 | 
			
		||||
bool kvm_kernel_irqchip;
 | 
			
		||||
bool kvm_async_interrupts_allowed;
 | 
			
		||||
bool kvm_eventfds_allowed;
 | 
			
		||||
bool kvm_irqfds_allowed;
 | 
			
		||||
bool kvm_resamplefds_allowed;
 | 
			
		||||
bool kvm_msi_via_irqfd_allowed;
 | 
			
		||||
bool kvm_gsi_routing_allowed;
 | 
			
		||||
bool kvm_gsi_direct_mapping;
 | 
			
		||||
bool kvm_allowed;
 | 
			
		||||
bool kvm_readonly_mem_allowed;
 | 
			
		||||
bool kvm_ioeventfd_any_length_allowed;
 | 
			
		||||
bool kvm_msi_use_devid;
 | 
			
		||||
 | 
			
		||||
void kvm_flush_coalesced_mmio_buffer(void)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void kvm_cpu_synchronize_state(CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool kvm_has_sync_mmu(void)
 | 
			
		||||
{
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int kvm_has_many_ioeventfds(void)
 | 
			
		||||
{
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int kvm_update_guest_debug(CPUState *cpu, unsigned long reinject_trap)
 | 
			
		||||
{
 | 
			
		||||
    return -ENOSYS;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int kvm_insert_breakpoint(CPUState *cpu, target_ulong addr,
 | 
			
		||||
                          target_ulong len, int type)
 | 
			
		||||
{
 | 
			
		||||
    return -EINVAL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int kvm_remove_breakpoint(CPUState *cpu, target_ulong addr,
 | 
			
		||||
                          target_ulong len, int type)
 | 
			
		||||
{
 | 
			
		||||
    return -EINVAL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void kvm_remove_all_breakpoints(CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int kvm_on_sigbus_vcpu(CPUState *cpu, int code, void *addr)
 | 
			
		||||
{
 | 
			
		||||
    return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int kvm_on_sigbus(int code, void *addr)
 | 
			
		||||
{
 | 
			
		||||
    return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifndef CONFIG_USER_ONLY
 | 
			
		||||
int kvm_irqchip_add_msi_route(KVMState *s, int vector, PCIDevice *dev)
 | 
			
		||||
{
 | 
			
		||||
    return -ENOSYS;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void kvm_init_irq_routing(KVMState *s)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void kvm_irqchip_release_virq(KVMState *s, int virq)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int kvm_irqchip_update_msi_route(KVMState *s, int virq, MSIMessage msg,
 | 
			
		||||
                                 PCIDevice *dev)
 | 
			
		||||
{
 | 
			
		||||
    return -ENOSYS;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void kvm_irqchip_commit_routes(KVMState *s)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void kvm_irqchip_add_change_notifier(Notifier *n)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void kvm_irqchip_remove_change_notifier(Notifier *n)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void kvm_irqchip_change_notify(void)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int kvm_irqchip_add_adapter_route(KVMState *s, AdapterInfo *adapter)
 | 
			
		||||
{
 | 
			
		||||
    return -ENOSYS;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int kvm_irqchip_add_irqfd_notifier_gsi(KVMState *s, EventNotifier *n,
 | 
			
		||||
                                       EventNotifier *rn, int virq)
 | 
			
		||||
{
 | 
			
		||||
    return -ENOSYS;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int kvm_irqchip_remove_irqfd_notifier_gsi(KVMState *s, EventNotifier *n,
 | 
			
		||||
                                          int virq)
 | 
			
		||||
{
 | 
			
		||||
    return -ENOSYS;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool kvm_has_free_slot(MachineState *ms)
 | 
			
		||||
{
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void kvm_init_cpu_signals(CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
    abort();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool kvm_arm_supports_user_irq(void)
 | 
			
		||||
{
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1,4 +0,0 @@
 | 
			
		||||
specific_ss.add(when: 'CONFIG_HAX', if_false: files('hax-stub.c'))
 | 
			
		||||
specific_ss.add(when: 'CONFIG_XEN', if_false: files('xen-stub.c'))
 | 
			
		||||
specific_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c'))
 | 
			
		||||
specific_ss.add(when: 'CONFIG_TCG', if_false: files('tcg-stub.c'))
 | 
			
		||||
@@ -1,40 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * QEMU TCG accelerator stub
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright Red Hat, Inc. 2013
 | 
			
		||||
 *
 | 
			
		||||
 * Author: Paolo Bonzini     <pbonzini@redhat.com>
 | 
			
		||||
 *
 | 
			
		||||
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 | 
			
		||||
 * See the COPYING file in the top-level directory.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "qemu/osdep.h"
 | 
			
		||||
#include "cpu.h"
 | 
			
		||||
#include "exec/exec-all.h"
 | 
			
		||||
 | 
			
		||||
void tb_flush(CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void tlb_set_dirty(CPUState *cpu, target_ulong vaddr)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void *probe_access(CPUArchState *env, target_ulong addr, int size,
 | 
			
		||||
                   MMUAccessType access_type, int mmu_idx, uintptr_t retaddr)
 | 
			
		||||
{
 | 
			
		||||
     /* Handled by hardware accelerator. */
 | 
			
		||||
     g_assert_not_reached();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void QEMU_NORETURN cpu_loop_exit(CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
    g_assert_not_reached();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void QEMU_NORETURN cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc)
 | 
			
		||||
{
 | 
			
		||||
    g_assert_not_reached();
 | 
			
		||||
}
 | 
			
		||||
@@ -1,16 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2014       Citrix Systems UK Ltd.
 | 
			
		||||
 *
 | 
			
		||||
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 | 
			
		||||
 * See the COPYING file in the top-level directory.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "qemu/osdep.h"
 | 
			
		||||
#include "sysemu/xen.h"
 | 
			
		||||
#include "qapi/qapi-commands-migration.h"
 | 
			
		||||
 | 
			
		||||
bool xen_allowed;
 | 
			
		||||
 | 
			
		||||
void qmp_xen_set_global_dirty_log(bool enable, Error **errp)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
@@ -1,54 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Common Atomic Helper Functions
 | 
			
		||||
 *
 | 
			
		||||
 * This file should be included before the various instantiations of
 | 
			
		||||
 * the atomic_template.h helpers.
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) 2019 Linaro
 | 
			
		||||
 * Written by Alex Bennée <alex.bennee@linaro.org>
 | 
			
		||||
 *
 | 
			
		||||
 * SPDX-License-Identifier: GPL-2.0-or-later
 | 
			
		||||
 *
 | 
			
		||||
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 | 
			
		||||
 * See the COPYING file in the top-level directory.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
static inline
 | 
			
		||||
void atomic_trace_rmw_pre(CPUArchState *env, target_ulong addr, uint16_t info)
 | 
			
		||||
{
 | 
			
		||||
    CPUState *cpu = env_cpu(env);
 | 
			
		||||
 | 
			
		||||
    trace_guest_mem_before_exec(cpu, addr, info);
 | 
			
		||||
    trace_guest_mem_before_exec(cpu, addr, info | TRACE_MEM_ST);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline void
 | 
			
		||||
atomic_trace_rmw_post(CPUArchState *env, target_ulong addr, uint16_t info)
 | 
			
		||||
{
 | 
			
		||||
    qemu_plugin_vcpu_mem_cb(env_cpu(env), addr, info);
 | 
			
		||||
    qemu_plugin_vcpu_mem_cb(env_cpu(env), addr, info | TRACE_MEM_ST);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline
 | 
			
		||||
void atomic_trace_ld_pre(CPUArchState *env, target_ulong addr, uint16_t info)
 | 
			
		||||
{
 | 
			
		||||
    trace_guest_mem_before_exec(env_cpu(env), addr, info);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline
 | 
			
		||||
void atomic_trace_ld_post(CPUArchState *env, target_ulong addr, uint16_t info)
 | 
			
		||||
{
 | 
			
		||||
    qemu_plugin_vcpu_mem_cb(env_cpu(env), addr, info);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline
 | 
			
		||||
void atomic_trace_st_pre(CPUArchState *env, target_ulong addr, uint16_t info)
 | 
			
		||||
{
 | 
			
		||||
    trace_guest_mem_before_exec(env_cpu(env), addr, info);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline
 | 
			
		||||
void atomic_trace_st_post(CPUArchState *env, target_ulong addr, uint16_t info)
 | 
			
		||||
{
 | 
			
		||||
    qemu_plugin_vcpu_mem_cb(env_cpu(env), addr, info);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,371 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Atomic helper templates
 | 
			
		||||
 * Included from tcg-runtime.c and cputlb.c.
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) 2016 Red Hat, Inc
 | 
			
		||||
 *
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
 * License as published by the Free Software Foundation; either
 | 
			
		||||
 * version 2.1 of the License, or (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This library is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "qemu/plugin.h"
 | 
			
		||||
#include "trace/mem.h"
 | 
			
		||||
 | 
			
		||||
#if DATA_SIZE == 16
 | 
			
		||||
# define SUFFIX     o
 | 
			
		||||
# define DATA_TYPE  Int128
 | 
			
		||||
# define BSWAP      bswap128
 | 
			
		||||
# define SHIFT      4
 | 
			
		||||
#elif DATA_SIZE == 8
 | 
			
		||||
# define SUFFIX     q
 | 
			
		||||
# define DATA_TYPE  uint64_t
 | 
			
		||||
# define SDATA_TYPE int64_t
 | 
			
		||||
# define BSWAP      bswap64
 | 
			
		||||
# define SHIFT      3
 | 
			
		||||
#elif DATA_SIZE == 4
 | 
			
		||||
# define SUFFIX     l
 | 
			
		||||
# define DATA_TYPE  uint32_t
 | 
			
		||||
# define SDATA_TYPE int32_t
 | 
			
		||||
# define BSWAP      bswap32
 | 
			
		||||
# define SHIFT      2
 | 
			
		||||
#elif DATA_SIZE == 2
 | 
			
		||||
# define SUFFIX     w
 | 
			
		||||
# define DATA_TYPE  uint16_t
 | 
			
		||||
# define SDATA_TYPE int16_t
 | 
			
		||||
# define BSWAP      bswap16
 | 
			
		||||
# define SHIFT      1
 | 
			
		||||
#elif DATA_SIZE == 1
 | 
			
		||||
# define SUFFIX     b
 | 
			
		||||
# define DATA_TYPE  uint8_t
 | 
			
		||||
# define SDATA_TYPE int8_t
 | 
			
		||||
# define BSWAP
 | 
			
		||||
# define SHIFT      0
 | 
			
		||||
#else
 | 
			
		||||
# error unsupported data size
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if DATA_SIZE >= 4
 | 
			
		||||
# define ABI_TYPE  DATA_TYPE
 | 
			
		||||
#else
 | 
			
		||||
# define ABI_TYPE  uint32_t
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* Define host-endian atomic operations.  Note that END is used within
 | 
			
		||||
   the ATOMIC_NAME macro, and redefined below.  */
 | 
			
		||||
#if DATA_SIZE == 1
 | 
			
		||||
# define END
 | 
			
		||||
#elif defined(HOST_WORDS_BIGENDIAN)
 | 
			
		||||
# define END  _be
 | 
			
		||||
#else
 | 
			
		||||
# define END  _le
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
ABI_TYPE ATOMIC_NAME(cmpxchg)(CPUArchState *env, target_ulong addr,
 | 
			
		||||
                              ABI_TYPE cmpv, ABI_TYPE newv EXTRA_ARGS)
 | 
			
		||||
{
 | 
			
		||||
    ATOMIC_MMU_DECLS;
 | 
			
		||||
    DATA_TYPE *haddr = ATOMIC_MMU_LOOKUP;
 | 
			
		||||
    DATA_TYPE ret;
 | 
			
		||||
    uint16_t info = trace_mem_build_info(SHIFT, false, 0, false,
 | 
			
		||||
                                         ATOMIC_MMU_IDX);
 | 
			
		||||
 | 
			
		||||
    atomic_trace_rmw_pre(env, addr, info);
 | 
			
		||||
#if DATA_SIZE == 16
 | 
			
		||||
    ret = atomic16_cmpxchg(haddr, cmpv, newv);
 | 
			
		||||
#else
 | 
			
		||||
    ret = qatomic_cmpxchg__nocheck(haddr, cmpv, newv);
 | 
			
		||||
#endif
 | 
			
		||||
    ATOMIC_MMU_CLEANUP;
 | 
			
		||||
    atomic_trace_rmw_post(env, addr, info);
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if DATA_SIZE >= 16
 | 
			
		||||
#if HAVE_ATOMIC128
 | 
			
		||||
ABI_TYPE ATOMIC_NAME(ld)(CPUArchState *env, target_ulong addr EXTRA_ARGS)
 | 
			
		||||
{
 | 
			
		||||
    ATOMIC_MMU_DECLS;
 | 
			
		||||
    DATA_TYPE val, *haddr = ATOMIC_MMU_LOOKUP;
 | 
			
		||||
    uint16_t info = trace_mem_build_info(SHIFT, false, 0, false,
 | 
			
		||||
                                         ATOMIC_MMU_IDX);
 | 
			
		||||
 | 
			
		||||
    atomic_trace_ld_pre(env, addr, info);
 | 
			
		||||
    val = atomic16_read(haddr);
 | 
			
		||||
    ATOMIC_MMU_CLEANUP;
 | 
			
		||||
    atomic_trace_ld_post(env, addr, info);
 | 
			
		||||
    return val;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ATOMIC_NAME(st)(CPUArchState *env, target_ulong addr,
 | 
			
		||||
                     ABI_TYPE val EXTRA_ARGS)
 | 
			
		||||
{
 | 
			
		||||
    ATOMIC_MMU_DECLS;
 | 
			
		||||
    DATA_TYPE *haddr = ATOMIC_MMU_LOOKUP;
 | 
			
		||||
    uint16_t info = trace_mem_build_info(SHIFT, false, 0, true,
 | 
			
		||||
                                         ATOMIC_MMU_IDX);
 | 
			
		||||
 | 
			
		||||
    atomic_trace_st_pre(env, addr, info);
 | 
			
		||||
    atomic16_set(haddr, val);
 | 
			
		||||
    ATOMIC_MMU_CLEANUP;
 | 
			
		||||
    atomic_trace_st_post(env, addr, info);
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
#else
 | 
			
		||||
ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, target_ulong addr,
 | 
			
		||||
                           ABI_TYPE val EXTRA_ARGS)
 | 
			
		||||
{
 | 
			
		||||
    ATOMIC_MMU_DECLS;
 | 
			
		||||
    DATA_TYPE *haddr = ATOMIC_MMU_LOOKUP;
 | 
			
		||||
    DATA_TYPE ret;
 | 
			
		||||
    uint16_t info = trace_mem_build_info(SHIFT, false, 0, false,
 | 
			
		||||
                                         ATOMIC_MMU_IDX);
 | 
			
		||||
 | 
			
		||||
    atomic_trace_rmw_pre(env, addr, info);
 | 
			
		||||
    ret = qatomic_xchg__nocheck(haddr, val);
 | 
			
		||||
    ATOMIC_MMU_CLEANUP;
 | 
			
		||||
    atomic_trace_rmw_post(env, addr, info);
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define GEN_ATOMIC_HELPER(X)                                        \
 | 
			
		||||
ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulong addr,       \
 | 
			
		||||
                        ABI_TYPE val EXTRA_ARGS)                    \
 | 
			
		||||
{                                                                   \
 | 
			
		||||
    ATOMIC_MMU_DECLS;                                               \
 | 
			
		||||
    DATA_TYPE *haddr = ATOMIC_MMU_LOOKUP;                           \
 | 
			
		||||
    DATA_TYPE ret;                                                  \
 | 
			
		||||
    uint16_t info = trace_mem_build_info(SHIFT, false, 0, false,    \
 | 
			
		||||
                                         ATOMIC_MMU_IDX);           \
 | 
			
		||||
    atomic_trace_rmw_pre(env, addr, info);                          \
 | 
			
		||||
    ret = qatomic_##X(haddr, val);                                  \
 | 
			
		||||
    ATOMIC_MMU_CLEANUP;                                             \
 | 
			
		||||
    atomic_trace_rmw_post(env, addr, info);                         \
 | 
			
		||||
    return ret;                                                     \
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GEN_ATOMIC_HELPER(fetch_add)
 | 
			
		||||
GEN_ATOMIC_HELPER(fetch_and)
 | 
			
		||||
GEN_ATOMIC_HELPER(fetch_or)
 | 
			
		||||
GEN_ATOMIC_HELPER(fetch_xor)
 | 
			
		||||
GEN_ATOMIC_HELPER(add_fetch)
 | 
			
		||||
GEN_ATOMIC_HELPER(and_fetch)
 | 
			
		||||
GEN_ATOMIC_HELPER(or_fetch)
 | 
			
		||||
GEN_ATOMIC_HELPER(xor_fetch)
 | 
			
		||||
 | 
			
		||||
#undef GEN_ATOMIC_HELPER
 | 
			
		||||
 | 
			
		||||
/* These helpers are, as a whole, full barriers.  Within the helper,
 | 
			
		||||
 * the leading barrier is explicit and the trailing barrier is within
 | 
			
		||||
 * cmpxchg primitive.
 | 
			
		||||
 *
 | 
			
		||||
 * Trace this load + RMW loop as a single RMW op. This way, regardless
 | 
			
		||||
 * of CF_PARALLEL's value, we'll trace just a read and a write.
 | 
			
		||||
 */
 | 
			
		||||
#define GEN_ATOMIC_HELPER_FN(X, FN, XDATA_TYPE, RET)                \
 | 
			
		||||
ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulong addr,       \
 | 
			
		||||
                        ABI_TYPE xval EXTRA_ARGS)                   \
 | 
			
		||||
{                                                                   \
 | 
			
		||||
    ATOMIC_MMU_DECLS;                                               \
 | 
			
		||||
    XDATA_TYPE *haddr = ATOMIC_MMU_LOOKUP;                          \
 | 
			
		||||
    XDATA_TYPE cmp, old, new, val = xval;                           \
 | 
			
		||||
    uint16_t info = trace_mem_build_info(SHIFT, false, 0, false,    \
 | 
			
		||||
                                         ATOMIC_MMU_IDX);           \
 | 
			
		||||
    atomic_trace_rmw_pre(env, addr, info);                          \
 | 
			
		||||
    smp_mb();                                                       \
 | 
			
		||||
    cmp = qatomic_read__nocheck(haddr);                             \
 | 
			
		||||
    do {                                                            \
 | 
			
		||||
        old = cmp; new = FN(old, val);                              \
 | 
			
		||||
        cmp = qatomic_cmpxchg__nocheck(haddr, old, new);            \
 | 
			
		||||
    } while (cmp != old);                                           \
 | 
			
		||||
    ATOMIC_MMU_CLEANUP;                                             \
 | 
			
		||||
    atomic_trace_rmw_post(env, addr, info);                         \
 | 
			
		||||
    return RET;                                                     \
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GEN_ATOMIC_HELPER_FN(fetch_smin, MIN, SDATA_TYPE, old)
 | 
			
		||||
GEN_ATOMIC_HELPER_FN(fetch_umin, MIN,  DATA_TYPE, old)
 | 
			
		||||
GEN_ATOMIC_HELPER_FN(fetch_smax, MAX, SDATA_TYPE, old)
 | 
			
		||||
GEN_ATOMIC_HELPER_FN(fetch_umax, MAX,  DATA_TYPE, old)
 | 
			
		||||
 | 
			
		||||
GEN_ATOMIC_HELPER_FN(smin_fetch, MIN, SDATA_TYPE, new)
 | 
			
		||||
GEN_ATOMIC_HELPER_FN(umin_fetch, MIN,  DATA_TYPE, new)
 | 
			
		||||
GEN_ATOMIC_HELPER_FN(smax_fetch, MAX, SDATA_TYPE, new)
 | 
			
		||||
GEN_ATOMIC_HELPER_FN(umax_fetch, MAX,  DATA_TYPE, new)
 | 
			
		||||
 | 
			
		||||
#undef GEN_ATOMIC_HELPER_FN
 | 
			
		||||
#endif /* DATA SIZE >= 16 */
 | 
			
		||||
 | 
			
		||||
#undef END
 | 
			
		||||
 | 
			
		||||
#if DATA_SIZE > 1
 | 
			
		||||
 | 
			
		||||
/* Define reverse-host-endian atomic operations.  Note that END is used
 | 
			
		||||
   within the ATOMIC_NAME macro.  */
 | 
			
		||||
#ifdef HOST_WORDS_BIGENDIAN
 | 
			
		||||
# define END  _le
 | 
			
		||||
#else
 | 
			
		||||
# define END  _be
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
ABI_TYPE ATOMIC_NAME(cmpxchg)(CPUArchState *env, target_ulong addr,
 | 
			
		||||
                              ABI_TYPE cmpv, ABI_TYPE newv EXTRA_ARGS)
 | 
			
		||||
{
 | 
			
		||||
    ATOMIC_MMU_DECLS;
 | 
			
		||||
    DATA_TYPE *haddr = ATOMIC_MMU_LOOKUP;
 | 
			
		||||
    DATA_TYPE ret;
 | 
			
		||||
    uint16_t info = trace_mem_build_info(SHIFT, false, MO_BSWAP, false,
 | 
			
		||||
                                         ATOMIC_MMU_IDX);
 | 
			
		||||
 | 
			
		||||
    atomic_trace_rmw_pre(env, addr, info);
 | 
			
		||||
#if DATA_SIZE == 16
 | 
			
		||||
    ret = atomic16_cmpxchg(haddr, BSWAP(cmpv), BSWAP(newv));
 | 
			
		||||
#else
 | 
			
		||||
    ret = qatomic_cmpxchg__nocheck(haddr, BSWAP(cmpv), BSWAP(newv));
 | 
			
		||||
#endif
 | 
			
		||||
    ATOMIC_MMU_CLEANUP;
 | 
			
		||||
    atomic_trace_rmw_post(env, addr, info);
 | 
			
		||||
    return BSWAP(ret);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if DATA_SIZE >= 16
 | 
			
		||||
#if HAVE_ATOMIC128
 | 
			
		||||
ABI_TYPE ATOMIC_NAME(ld)(CPUArchState *env, target_ulong addr EXTRA_ARGS)
 | 
			
		||||
{
 | 
			
		||||
    ATOMIC_MMU_DECLS;
 | 
			
		||||
    DATA_TYPE val, *haddr = ATOMIC_MMU_LOOKUP;
 | 
			
		||||
    uint16_t info = trace_mem_build_info(SHIFT, false, MO_BSWAP, false,
 | 
			
		||||
                                         ATOMIC_MMU_IDX);
 | 
			
		||||
 | 
			
		||||
    atomic_trace_ld_pre(env, addr, info);
 | 
			
		||||
    val = atomic16_read(haddr);
 | 
			
		||||
    ATOMIC_MMU_CLEANUP;
 | 
			
		||||
    atomic_trace_ld_post(env, addr, info);
 | 
			
		||||
    return BSWAP(val);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ATOMIC_NAME(st)(CPUArchState *env, target_ulong addr,
 | 
			
		||||
                     ABI_TYPE val EXTRA_ARGS)
 | 
			
		||||
{
 | 
			
		||||
    ATOMIC_MMU_DECLS;
 | 
			
		||||
    DATA_TYPE *haddr = ATOMIC_MMU_LOOKUP;
 | 
			
		||||
    uint16_t info = trace_mem_build_info(SHIFT, false, MO_BSWAP, true,
 | 
			
		||||
                                         ATOMIC_MMU_IDX);
 | 
			
		||||
 | 
			
		||||
    val = BSWAP(val);
 | 
			
		||||
    atomic_trace_st_pre(env, addr, info);
 | 
			
		||||
    val = BSWAP(val);
 | 
			
		||||
    atomic16_set(haddr, val);
 | 
			
		||||
    ATOMIC_MMU_CLEANUP;
 | 
			
		||||
    atomic_trace_st_post(env, addr, info);
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
#else
 | 
			
		||||
ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, target_ulong addr,
 | 
			
		||||
                           ABI_TYPE val EXTRA_ARGS)
 | 
			
		||||
{
 | 
			
		||||
    ATOMIC_MMU_DECLS;
 | 
			
		||||
    DATA_TYPE *haddr = ATOMIC_MMU_LOOKUP;
 | 
			
		||||
    ABI_TYPE ret;
 | 
			
		||||
    uint16_t info = trace_mem_build_info(SHIFT, false, MO_BSWAP, false,
 | 
			
		||||
                                         ATOMIC_MMU_IDX);
 | 
			
		||||
 | 
			
		||||
    atomic_trace_rmw_pre(env, addr, info);
 | 
			
		||||
    ret = qatomic_xchg__nocheck(haddr, BSWAP(val));
 | 
			
		||||
    ATOMIC_MMU_CLEANUP;
 | 
			
		||||
    atomic_trace_rmw_post(env, addr, info);
 | 
			
		||||
    return BSWAP(ret);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define GEN_ATOMIC_HELPER(X)                                        \
 | 
			
		||||
ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulong addr,       \
 | 
			
		||||
                        ABI_TYPE val EXTRA_ARGS)                    \
 | 
			
		||||
{                                                                   \
 | 
			
		||||
    ATOMIC_MMU_DECLS;                                               \
 | 
			
		||||
    DATA_TYPE *haddr = ATOMIC_MMU_LOOKUP;                           \
 | 
			
		||||
    DATA_TYPE ret;                                                  \
 | 
			
		||||
    uint16_t info = trace_mem_build_info(SHIFT, false, MO_BSWAP,    \
 | 
			
		||||
                                         false, ATOMIC_MMU_IDX);    \
 | 
			
		||||
    atomic_trace_rmw_pre(env, addr, info);                          \
 | 
			
		||||
    ret = qatomic_##X(haddr, BSWAP(val));                           \
 | 
			
		||||
    ATOMIC_MMU_CLEANUP;                                             \
 | 
			
		||||
    atomic_trace_rmw_post(env, addr, info);                         \
 | 
			
		||||
    return BSWAP(ret);                                              \
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GEN_ATOMIC_HELPER(fetch_and)
 | 
			
		||||
GEN_ATOMIC_HELPER(fetch_or)
 | 
			
		||||
GEN_ATOMIC_HELPER(fetch_xor)
 | 
			
		||||
GEN_ATOMIC_HELPER(and_fetch)
 | 
			
		||||
GEN_ATOMIC_HELPER(or_fetch)
 | 
			
		||||
GEN_ATOMIC_HELPER(xor_fetch)
 | 
			
		||||
 | 
			
		||||
#undef GEN_ATOMIC_HELPER
 | 
			
		||||
 | 
			
		||||
/* These helpers are, as a whole, full barriers.  Within the helper,
 | 
			
		||||
 * the leading barrier is explicit and the trailing barrier is within
 | 
			
		||||
 * cmpxchg primitive.
 | 
			
		||||
 *
 | 
			
		||||
 * Trace this load + RMW loop as a single RMW op. This way, regardless
 | 
			
		||||
 * of CF_PARALLEL's value, we'll trace just a read and a write.
 | 
			
		||||
 */
 | 
			
		||||
#define GEN_ATOMIC_HELPER_FN(X, FN, XDATA_TYPE, RET)                \
 | 
			
		||||
ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulong addr,       \
 | 
			
		||||
                        ABI_TYPE xval EXTRA_ARGS)                   \
 | 
			
		||||
{                                                                   \
 | 
			
		||||
    ATOMIC_MMU_DECLS;                                               \
 | 
			
		||||
    XDATA_TYPE *haddr = ATOMIC_MMU_LOOKUP;                          \
 | 
			
		||||
    XDATA_TYPE ldo, ldn, old, new, val = xval;                      \
 | 
			
		||||
    uint16_t info = trace_mem_build_info(SHIFT, false, MO_BSWAP,    \
 | 
			
		||||
                                         false, ATOMIC_MMU_IDX);    \
 | 
			
		||||
    atomic_trace_rmw_pre(env, addr, info);                          \
 | 
			
		||||
    smp_mb();                                                       \
 | 
			
		||||
    ldn = qatomic_read__nocheck(haddr);                             \
 | 
			
		||||
    do {                                                            \
 | 
			
		||||
        ldo = ldn; old = BSWAP(ldo); new = FN(old, val);            \
 | 
			
		||||
        ldn = qatomic_cmpxchg__nocheck(haddr, ldo, BSWAP(new));     \
 | 
			
		||||
    } while (ldo != ldn);                                           \
 | 
			
		||||
    ATOMIC_MMU_CLEANUP;                                             \
 | 
			
		||||
    atomic_trace_rmw_post(env, addr, info);                         \
 | 
			
		||||
    return RET;                                                     \
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GEN_ATOMIC_HELPER_FN(fetch_smin, MIN, SDATA_TYPE, old)
 | 
			
		||||
GEN_ATOMIC_HELPER_FN(fetch_umin, MIN,  DATA_TYPE, old)
 | 
			
		||||
GEN_ATOMIC_HELPER_FN(fetch_smax, MAX, SDATA_TYPE, old)
 | 
			
		||||
GEN_ATOMIC_HELPER_FN(fetch_umax, MAX,  DATA_TYPE, old)
 | 
			
		||||
 | 
			
		||||
GEN_ATOMIC_HELPER_FN(smin_fetch, MIN, SDATA_TYPE, new)
 | 
			
		||||
GEN_ATOMIC_HELPER_FN(umin_fetch, MIN,  DATA_TYPE, new)
 | 
			
		||||
GEN_ATOMIC_HELPER_FN(smax_fetch, MAX, SDATA_TYPE, new)
 | 
			
		||||
GEN_ATOMIC_HELPER_FN(umax_fetch, MAX,  DATA_TYPE, new)
 | 
			
		||||
 | 
			
		||||
/* Note that for addition, we need to use a separate cmpxchg loop instead
 | 
			
		||||
   of bswaps for the reverse-host-endian helpers.  */
 | 
			
		||||
#define ADD(X, Y)   (X + Y)
 | 
			
		||||
GEN_ATOMIC_HELPER_FN(fetch_add, ADD, DATA_TYPE, old)
 | 
			
		||||
GEN_ATOMIC_HELPER_FN(add_fetch, ADD, DATA_TYPE, new)
 | 
			
		||||
#undef ADD
 | 
			
		||||
 | 
			
		||||
#undef GEN_ATOMIC_HELPER_FN
 | 
			
		||||
#endif /* DATA_SIZE >= 16 */
 | 
			
		||||
 | 
			
		||||
#undef END
 | 
			
		||||
#endif /* DATA_SIZE > 1 */
 | 
			
		||||
 | 
			
		||||
#undef BSWAP
 | 
			
		||||
#undef ABI_TYPE
 | 
			
		||||
#undef DATA_TYPE
 | 
			
		||||
#undef SDATA_TYPE
 | 
			
		||||
#undef SUFFIX
 | 
			
		||||
#undef DATA_SIZE
 | 
			
		||||
#undef SHIFT
 | 
			
		||||
@@ -1,84 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  emulator main execution loop
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2003-2005 Fabrice Bellard
 | 
			
		||||
 *
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
 * License as published by the Free Software Foundation; either
 | 
			
		||||
 * version 2.1 of the License, or (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This library is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "qemu/osdep.h"
 | 
			
		||||
#include "cpu.h"
 | 
			
		||||
#include "sysemu/cpus.h"
 | 
			
		||||
#include "sysemu/tcg.h"
 | 
			
		||||
#include "exec/exec-all.h"
 | 
			
		||||
 | 
			
		||||
bool tcg_allowed;
 | 
			
		||||
 | 
			
		||||
/* exit the current TB, but without causing any exception to be raised */
 | 
			
		||||
void cpu_loop_exit_noexc(CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
    cpu->exception_index = -1;
 | 
			
		||||
    cpu_loop_exit(cpu);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if defined(CONFIG_SOFTMMU)
 | 
			
		||||
void cpu_reloading_memory_map(void)
 | 
			
		||||
{
 | 
			
		||||
    if (qemu_in_vcpu_thread() && current_cpu->running) {
 | 
			
		||||
        /* The guest can in theory prolong the RCU critical section as long
 | 
			
		||||
         * as it feels like. The major problem with this is that because it
 | 
			
		||||
         * can do multiple reconfigurations of the memory map within the
 | 
			
		||||
         * critical section, we could potentially accumulate an unbounded
 | 
			
		||||
         * collection of memory data structures awaiting reclamation.
 | 
			
		||||
         *
 | 
			
		||||
         * Because the only thing we're currently protecting with RCU is the
 | 
			
		||||
         * memory data structures, it's sufficient to break the critical section
 | 
			
		||||
         * in this callback, which we know will get called every time the
 | 
			
		||||
         * memory map is rearranged.
 | 
			
		||||
         *
 | 
			
		||||
         * (If we add anything else in the system that uses RCU to protect
 | 
			
		||||
         * its data structures, we will need to implement some other mechanism
 | 
			
		||||
         * to force TCG CPUs to exit the critical section, at which point this
 | 
			
		||||
         * part of this callback might become unnecessary.)
 | 
			
		||||
         *
 | 
			
		||||
         * This pair matches cpu_exec's rcu_read_lock()/rcu_read_unlock(), which
 | 
			
		||||
         * only protects cpu->as->dispatch. Since we know our caller is about
 | 
			
		||||
         * to reload it, it's safe to split the critical section.
 | 
			
		||||
         */
 | 
			
		||||
        rcu_read_unlock();
 | 
			
		||||
        rcu_read_lock();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
void cpu_loop_exit(CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
    /* Undo the setting in cpu_tb_exec.  */
 | 
			
		||||
    cpu->can_do_io = 1;
 | 
			
		||||
    siglongjmp(cpu->jmp_env, 1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc)
 | 
			
		||||
{
 | 
			
		||||
    if (pc) {
 | 
			
		||||
        cpu_restore_state(cpu, pc, true);
 | 
			
		||||
    }
 | 
			
		||||
    cpu_loop_exit(cpu);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc)
 | 
			
		||||
{
 | 
			
		||||
    cpu->exception_index = EXCP_ATOMIC;
 | 
			
		||||
    cpu_loop_exit_restore(cpu, pc);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,860 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  emulator main execution loop
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2003-2005 Fabrice Bellard
 | 
			
		||||
 *
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
 * License as published by the Free Software Foundation; either
 | 
			
		||||
 * version 2.1 of the License, or (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This library is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "qemu/osdep.h"
 | 
			
		||||
#include "qemu-common.h"
 | 
			
		||||
#include "qemu/qemu-print.h"
 | 
			
		||||
#include "cpu.h"
 | 
			
		||||
#include "hw/core/tcg-cpu-ops.h"
 | 
			
		||||
#include "trace.h"
 | 
			
		||||
#include "disas/disas.h"
 | 
			
		||||
#include "exec/exec-all.h"
 | 
			
		||||
#include "tcg/tcg.h"
 | 
			
		||||
#include "qemu/atomic.h"
 | 
			
		||||
#include "qemu/compiler.h"
 | 
			
		||||
#include "qemu/timer.h"
 | 
			
		||||
#include "qemu/rcu.h"
 | 
			
		||||
#include "exec/tb-hash.h"
 | 
			
		||||
#include "exec/tb-lookup.h"
 | 
			
		||||
#include "exec/log.h"
 | 
			
		||||
#include "qemu/main-loop.h"
 | 
			
		||||
#if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY)
 | 
			
		||||
#include "hw/i386/apic.h"
 | 
			
		||||
#endif
 | 
			
		||||
#include "sysemu/cpus.h"
 | 
			
		||||
#include "exec/cpu-all.h"
 | 
			
		||||
#include "sysemu/cpu-timers.h"
 | 
			
		||||
#include "sysemu/replay.h"
 | 
			
		||||
#include "internal.h"
 | 
			
		||||
 | 
			
		||||
/* -icount align implementation. */
 | 
			
		||||
 | 
			
		||||
typedef struct SyncClocks {
 | 
			
		||||
    int64_t diff_clk;
 | 
			
		||||
    int64_t last_cpu_icount;
 | 
			
		||||
    int64_t realtime_clock;
 | 
			
		||||
} SyncClocks;
 | 
			
		||||
 | 
			
		||||
#if !defined(CONFIG_USER_ONLY)
 | 
			
		||||
/* Allow the guest to have a max 3ms advance.
 | 
			
		||||
 * The difference between the 2 clocks could therefore
 | 
			
		||||
 * oscillate around 0.
 | 
			
		||||
 */
 | 
			
		||||
#define VM_CLOCK_ADVANCE 3000000
 | 
			
		||||
#define THRESHOLD_REDUCE 1.5
 | 
			
		||||
#define MAX_DELAY_PRINT_RATE 2000000000LL
 | 
			
		||||
#define MAX_NB_PRINTS 100
 | 
			
		||||
 | 
			
		||||
static int64_t max_delay;
 | 
			
		||||
static int64_t max_advance;
 | 
			
		||||
 | 
			
		||||
static void align_clocks(SyncClocks *sc, CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
    int64_t cpu_icount;
 | 
			
		||||
 | 
			
		||||
    if (!icount_align_option) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    cpu_icount = cpu->icount_extra + cpu_neg(cpu)->icount_decr.u16.low;
 | 
			
		||||
    sc->diff_clk += icount_to_ns(sc->last_cpu_icount - cpu_icount);
 | 
			
		||||
    sc->last_cpu_icount = cpu_icount;
 | 
			
		||||
 | 
			
		||||
    if (sc->diff_clk > VM_CLOCK_ADVANCE) {
 | 
			
		||||
#ifndef _WIN32
 | 
			
		||||
        struct timespec sleep_delay, rem_delay;
 | 
			
		||||
        sleep_delay.tv_sec = sc->diff_clk / 1000000000LL;
 | 
			
		||||
        sleep_delay.tv_nsec = sc->diff_clk % 1000000000LL;
 | 
			
		||||
        if (nanosleep(&sleep_delay, &rem_delay) < 0) {
 | 
			
		||||
            sc->diff_clk = rem_delay.tv_sec * 1000000000LL + rem_delay.tv_nsec;
 | 
			
		||||
        } else {
 | 
			
		||||
            sc->diff_clk = 0;
 | 
			
		||||
        }
 | 
			
		||||
#else
 | 
			
		||||
        Sleep(sc->diff_clk / SCALE_MS);
 | 
			
		||||
        sc->diff_clk = 0;
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void print_delay(const SyncClocks *sc)
 | 
			
		||||
{
 | 
			
		||||
    static float threshold_delay;
 | 
			
		||||
    static int64_t last_realtime_clock;
 | 
			
		||||
    static int nb_prints;
 | 
			
		||||
 | 
			
		||||
    if (icount_align_option &&
 | 
			
		||||
        sc->realtime_clock - last_realtime_clock >= MAX_DELAY_PRINT_RATE &&
 | 
			
		||||
        nb_prints < MAX_NB_PRINTS) {
 | 
			
		||||
        if ((-sc->diff_clk / (float)1000000000LL > threshold_delay) ||
 | 
			
		||||
            (-sc->diff_clk / (float)1000000000LL <
 | 
			
		||||
             (threshold_delay - THRESHOLD_REDUCE))) {
 | 
			
		||||
            threshold_delay = (-sc->diff_clk / 1000000000LL) + 1;
 | 
			
		||||
            qemu_printf("Warning: The guest is now late by %.1f to %.1f seconds\n",
 | 
			
		||||
                        threshold_delay - 1,
 | 
			
		||||
                        threshold_delay);
 | 
			
		||||
            nb_prints++;
 | 
			
		||||
            last_realtime_clock = sc->realtime_clock;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void init_delay_params(SyncClocks *sc, CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
    if (!icount_align_option) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    sc->realtime_clock = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL_RT);
 | 
			
		||||
    sc->diff_clk = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - sc->realtime_clock;
 | 
			
		||||
    sc->last_cpu_icount
 | 
			
		||||
        = cpu->icount_extra + cpu_neg(cpu)->icount_decr.u16.low;
 | 
			
		||||
    if (sc->diff_clk < max_delay) {
 | 
			
		||||
        max_delay = sc->diff_clk;
 | 
			
		||||
    }
 | 
			
		||||
    if (sc->diff_clk > max_advance) {
 | 
			
		||||
        max_advance = sc->diff_clk;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* Print every 2s max if the guest is late. We limit the number
 | 
			
		||||
       of printed messages to NB_PRINT_MAX(currently 100) */
 | 
			
		||||
    print_delay(sc);
 | 
			
		||||
}
 | 
			
		||||
#else
 | 
			
		||||
static void align_clocks(SyncClocks *sc, const CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void init_delay_params(SyncClocks *sc, const CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
#endif /* CONFIG USER ONLY */
 | 
			
		||||
 | 
			
		||||
/* Execute a TB, and fix up the CPU state afterwards if necessary */
 | 
			
		||||
/*
 | 
			
		||||
 * Disable CFI checks.
 | 
			
		||||
 * TCG creates binary blobs at runtime, with the transformed code.
 | 
			
		||||
 * A TB is a blob of binary code, created at runtime and called with an
 | 
			
		||||
 * indirect function call. Since such function did not exist at compile time,
 | 
			
		||||
 * the CFI runtime has no way to verify its signature and would fail.
 | 
			
		||||
 * TCG is not considered a security-sensitive part of QEMU so this does not
 | 
			
		||||
 * affect the impact of CFI in environment with high security requirements
 | 
			
		||||
 */
 | 
			
		||||
static inline TranslationBlock * QEMU_DISABLE_CFI
 | 
			
		||||
cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit)
 | 
			
		||||
{
 | 
			
		||||
    CPUArchState *env = cpu->env_ptr;
 | 
			
		||||
    uintptr_t ret;
 | 
			
		||||
    TranslationBlock *last_tb;
 | 
			
		||||
    const void *tb_ptr = itb->tc.ptr;
 | 
			
		||||
 | 
			
		||||
    qemu_log_mask_and_addr(CPU_LOG_EXEC, itb->pc,
 | 
			
		||||
                           "Trace %d: %p ["
 | 
			
		||||
                           TARGET_FMT_lx "/" TARGET_FMT_lx "/%#x] %s\n",
 | 
			
		||||
                           cpu->cpu_index, itb->tc.ptr,
 | 
			
		||||
                           itb->cs_base, itb->pc, itb->flags,
 | 
			
		||||
                           lookup_symbol(itb->pc));
 | 
			
		||||
 | 
			
		||||
#if defined(DEBUG_DISAS)
 | 
			
		||||
    if (qemu_loglevel_mask(CPU_LOG_TB_CPU)
 | 
			
		||||
        && qemu_log_in_addr_range(itb->pc)) {
 | 
			
		||||
        FILE *logfile = qemu_log_lock();
 | 
			
		||||
        int flags = 0;
 | 
			
		||||
        if (qemu_loglevel_mask(CPU_LOG_TB_FPU)) {
 | 
			
		||||
            flags |= CPU_DUMP_FPU;
 | 
			
		||||
        }
 | 
			
		||||
#if defined(TARGET_I386)
 | 
			
		||||
        flags |= CPU_DUMP_CCOP;
 | 
			
		||||
#endif
 | 
			
		||||
        log_cpu_state(cpu, flags);
 | 
			
		||||
        qemu_log_unlock(logfile);
 | 
			
		||||
    }
 | 
			
		||||
#endif /* DEBUG_DISAS */
 | 
			
		||||
 | 
			
		||||
    qemu_thread_jit_execute();
 | 
			
		||||
    ret = tcg_qemu_tb_exec(env, tb_ptr);
 | 
			
		||||
    cpu->can_do_io = 1;
 | 
			
		||||
    /*
 | 
			
		||||
     * TODO: Delay swapping back to the read-write region of the TB
 | 
			
		||||
     * until we actually need to modify the TB.  The read-only copy,
 | 
			
		||||
     * coming from the rx region, shares the same host TLB entry as
 | 
			
		||||
     * the code that executed the exit_tb opcode that arrived here.
 | 
			
		||||
     * If we insist on touching both the RX and the RW pages, we
 | 
			
		||||
     * double the host TLB pressure.
 | 
			
		||||
     */
 | 
			
		||||
    last_tb = tcg_splitwx_to_rw((void *)(ret & ~TB_EXIT_MASK));
 | 
			
		||||
    *tb_exit = ret & TB_EXIT_MASK;
 | 
			
		||||
 | 
			
		||||
    trace_exec_tb_exit(last_tb, *tb_exit);
 | 
			
		||||
 | 
			
		||||
    if (*tb_exit > TB_EXIT_IDX1) {
 | 
			
		||||
        /* We didn't start executing this TB (eg because the instruction
 | 
			
		||||
         * counter hit zero); we must restore the guest PC to the address
 | 
			
		||||
         * of the start of the TB.
 | 
			
		||||
         */
 | 
			
		||||
        CPUClass *cc = CPU_GET_CLASS(cpu);
 | 
			
		||||
        qemu_log_mask_and_addr(CPU_LOG_EXEC, last_tb->pc,
 | 
			
		||||
                               "Stopped execution of TB chain before %p ["
 | 
			
		||||
                               TARGET_FMT_lx "] %s\n",
 | 
			
		||||
                               last_tb->tc.ptr, last_tb->pc,
 | 
			
		||||
                               lookup_symbol(last_tb->pc));
 | 
			
		||||
        if (cc->tcg_ops->synchronize_from_tb) {
 | 
			
		||||
            cc->tcg_ops->synchronize_from_tb(cpu, last_tb);
 | 
			
		||||
        } else {
 | 
			
		||||
            assert(cc->set_pc);
 | 
			
		||||
            cc->set_pc(cpu, last_tb->pc);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return last_tb;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void cpu_exec_enter(CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
    CPUClass *cc = CPU_GET_CLASS(cpu);
 | 
			
		||||
 | 
			
		||||
    if (cc->tcg_ops->cpu_exec_enter) {
 | 
			
		||||
        cc->tcg_ops->cpu_exec_enter(cpu);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void cpu_exec_exit(CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
    CPUClass *cc = CPU_GET_CLASS(cpu);
 | 
			
		||||
 | 
			
		||||
    if (cc->tcg_ops->cpu_exec_exit) {
 | 
			
		||||
        cc->tcg_ops->cpu_exec_exit(cpu);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void cpu_exec_step_atomic(CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
    CPUArchState *env = (CPUArchState *)cpu->env_ptr;
 | 
			
		||||
    TranslationBlock *tb;
 | 
			
		||||
    target_ulong cs_base, pc;
 | 
			
		||||
    uint32_t flags;
 | 
			
		||||
    uint32_t cflags = (curr_cflags(cpu) & ~CF_PARALLEL) | 1;
 | 
			
		||||
    int tb_exit;
 | 
			
		||||
 | 
			
		||||
    if (sigsetjmp(cpu->jmp_env, 0) == 0) {
 | 
			
		||||
        start_exclusive();
 | 
			
		||||
        g_assert(cpu == current_cpu);
 | 
			
		||||
        g_assert(!cpu->running);
 | 
			
		||||
        cpu->running = true;
 | 
			
		||||
 | 
			
		||||
        cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags);
 | 
			
		||||
        tb = tb_lookup(cpu, pc, cs_base, flags, cflags);
 | 
			
		||||
 | 
			
		||||
        if (tb == NULL) {
 | 
			
		||||
            mmap_lock();
 | 
			
		||||
            tb = tb_gen_code(cpu, pc, cs_base, flags, cflags);
 | 
			
		||||
            mmap_unlock();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        cpu_exec_enter(cpu);
 | 
			
		||||
        /* execute the generated code */
 | 
			
		||||
        trace_exec_tb(tb, pc);
 | 
			
		||||
        cpu_tb_exec(cpu, tb, &tb_exit);
 | 
			
		||||
        cpu_exec_exit(cpu);
 | 
			
		||||
    } else {
 | 
			
		||||
        /*
 | 
			
		||||
         * The mmap_lock is dropped by tb_gen_code if it runs out of
 | 
			
		||||
         * memory.
 | 
			
		||||
         */
 | 
			
		||||
#ifndef CONFIG_SOFTMMU
 | 
			
		||||
        tcg_debug_assert(!have_mmap_lock());
 | 
			
		||||
#endif
 | 
			
		||||
        if (qemu_mutex_iothread_locked()) {
 | 
			
		||||
            qemu_mutex_unlock_iothread();
 | 
			
		||||
        }
 | 
			
		||||
        assert_no_pages_locked();
 | 
			
		||||
        qemu_plugin_disable_mem_helpers(cpu);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
     * As we start the exclusive region before codegen we must still
 | 
			
		||||
     * be in the region if we longjump out of either the codegen or
 | 
			
		||||
     * the execution.
 | 
			
		||||
     */
 | 
			
		||||
    g_assert(cpu_in_exclusive_context(cpu));
 | 
			
		||||
    cpu->running = false;
 | 
			
		||||
    end_exclusive();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct tb_desc {
 | 
			
		||||
    target_ulong pc;
 | 
			
		||||
    target_ulong cs_base;
 | 
			
		||||
    CPUArchState *env;
 | 
			
		||||
    tb_page_addr_t phys_page1;
 | 
			
		||||
    uint32_t flags;
 | 
			
		||||
    uint32_t cflags;
 | 
			
		||||
    uint32_t trace_vcpu_dstate;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static bool tb_lookup_cmp(const void *p, const void *d)
 | 
			
		||||
{
 | 
			
		||||
    const TranslationBlock *tb = p;
 | 
			
		||||
    const struct tb_desc *desc = d;
 | 
			
		||||
 | 
			
		||||
    if (tb->pc == desc->pc &&
 | 
			
		||||
        tb->page_addr[0] == desc->phys_page1 &&
 | 
			
		||||
        tb->cs_base == desc->cs_base &&
 | 
			
		||||
        tb->flags == desc->flags &&
 | 
			
		||||
        tb->trace_vcpu_dstate == desc->trace_vcpu_dstate &&
 | 
			
		||||
        tb_cflags(tb) == desc->cflags) {
 | 
			
		||||
        /* check next page if needed */
 | 
			
		||||
        if (tb->page_addr[1] == -1) {
 | 
			
		||||
            return true;
 | 
			
		||||
        } else {
 | 
			
		||||
            tb_page_addr_t phys_page2;
 | 
			
		||||
            target_ulong virt_page2;
 | 
			
		||||
 | 
			
		||||
            virt_page2 = (desc->pc & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE;
 | 
			
		||||
            phys_page2 = get_page_addr_code(desc->env, virt_page2);
 | 
			
		||||
            if (tb->page_addr[1] == phys_page2) {
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TranslationBlock *tb_htable_lookup(CPUState *cpu, target_ulong pc,
 | 
			
		||||
                                   target_ulong cs_base, uint32_t flags,
 | 
			
		||||
                                   uint32_t cflags)
 | 
			
		||||
{
 | 
			
		||||
    tb_page_addr_t phys_pc;
 | 
			
		||||
    struct tb_desc desc;
 | 
			
		||||
    uint32_t h;
 | 
			
		||||
 | 
			
		||||
    desc.env = (CPUArchState *)cpu->env_ptr;
 | 
			
		||||
    desc.cs_base = cs_base;
 | 
			
		||||
    desc.flags = flags;
 | 
			
		||||
    desc.cflags = cflags;
 | 
			
		||||
    desc.trace_vcpu_dstate = *cpu->trace_dstate;
 | 
			
		||||
    desc.pc = pc;
 | 
			
		||||
    phys_pc = get_page_addr_code(desc.env, pc);
 | 
			
		||||
    if (phys_pc == -1) {
 | 
			
		||||
        return NULL;
 | 
			
		||||
    }
 | 
			
		||||
    desc.phys_page1 = phys_pc & TARGET_PAGE_MASK;
 | 
			
		||||
    h = tb_hash_func(phys_pc, pc, flags, cflags, *cpu->trace_dstate);
 | 
			
		||||
    return qht_lookup_custom(&tb_ctx.htable, &desc, h, tb_lookup_cmp);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void tb_set_jmp_target(TranslationBlock *tb, int n, uintptr_t addr)
 | 
			
		||||
{
 | 
			
		||||
    if (TCG_TARGET_HAS_direct_jump) {
 | 
			
		||||
        uintptr_t offset = tb->jmp_target_arg[n];
 | 
			
		||||
        uintptr_t tc_ptr = (uintptr_t)tb->tc.ptr;
 | 
			
		||||
        uintptr_t jmp_rx = tc_ptr + offset;
 | 
			
		||||
        uintptr_t jmp_rw = jmp_rx - tcg_splitwx_diff;
 | 
			
		||||
        tb_target_set_jmp_target(tc_ptr, jmp_rx, jmp_rw, addr);
 | 
			
		||||
    } else {
 | 
			
		||||
        tb->jmp_target_arg[n] = addr;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline void tb_add_jump(TranslationBlock *tb, int n,
 | 
			
		||||
                               TranslationBlock *tb_next)
 | 
			
		||||
{
 | 
			
		||||
    uintptr_t old;
 | 
			
		||||
 | 
			
		||||
    qemu_thread_jit_write();
 | 
			
		||||
    assert(n < ARRAY_SIZE(tb->jmp_list_next));
 | 
			
		||||
    qemu_spin_lock(&tb_next->jmp_lock);
 | 
			
		||||
 | 
			
		||||
    /* make sure the destination TB is valid */
 | 
			
		||||
    if (tb_next->cflags & CF_INVALID) {
 | 
			
		||||
        goto out_unlock_next;
 | 
			
		||||
    }
 | 
			
		||||
    /* Atomically claim the jump destination slot only if it was NULL */
 | 
			
		||||
    old = qatomic_cmpxchg(&tb->jmp_dest[n], (uintptr_t)NULL,
 | 
			
		||||
                          (uintptr_t)tb_next);
 | 
			
		||||
    if (old) {
 | 
			
		||||
        goto out_unlock_next;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* patch the native jump address */
 | 
			
		||||
    tb_set_jmp_target(tb, n, (uintptr_t)tb_next->tc.ptr);
 | 
			
		||||
 | 
			
		||||
    /* add in TB jmp list */
 | 
			
		||||
    tb->jmp_list_next[n] = tb_next->jmp_list_head;
 | 
			
		||||
    tb_next->jmp_list_head = (uintptr_t)tb | n;
 | 
			
		||||
 | 
			
		||||
    qemu_spin_unlock(&tb_next->jmp_lock);
 | 
			
		||||
 | 
			
		||||
    qemu_log_mask_and_addr(CPU_LOG_EXEC, tb->pc,
 | 
			
		||||
                           "Linking TBs %p [" TARGET_FMT_lx
 | 
			
		||||
                           "] index %d -> %p [" TARGET_FMT_lx "]\n",
 | 
			
		||||
                           tb->tc.ptr, tb->pc, n,
 | 
			
		||||
                           tb_next->tc.ptr, tb_next->pc);
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
 out_unlock_next:
 | 
			
		||||
    qemu_spin_unlock(&tb_next->jmp_lock);
 | 
			
		||||
    return;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline TranslationBlock *tb_find(CPUState *cpu,
 | 
			
		||||
                                        TranslationBlock *last_tb,
 | 
			
		||||
                                        int tb_exit, uint32_t cflags)
 | 
			
		||||
{
 | 
			
		||||
    CPUArchState *env = (CPUArchState *)cpu->env_ptr;
 | 
			
		||||
    TranslationBlock *tb;
 | 
			
		||||
    target_ulong cs_base, pc;
 | 
			
		||||
    uint32_t flags;
 | 
			
		||||
 | 
			
		||||
    cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags);
 | 
			
		||||
 | 
			
		||||
    tb = tb_lookup(cpu, pc, cs_base, flags, cflags);
 | 
			
		||||
    if (tb == NULL) {
 | 
			
		||||
        mmap_lock();
 | 
			
		||||
        tb = tb_gen_code(cpu, pc, cs_base, flags, cflags);
 | 
			
		||||
        mmap_unlock();
 | 
			
		||||
        /* We add the TB in the virtual pc hash table for the fast lookup */
 | 
			
		||||
        qatomic_set(&cpu->tb_jmp_cache[tb_jmp_cache_hash_func(pc)], tb);
 | 
			
		||||
    }
 | 
			
		||||
#ifndef CONFIG_USER_ONLY
 | 
			
		||||
    /* We don't take care of direct jumps when address mapping changes in
 | 
			
		||||
     * system emulation. So it's not safe to make a direct jump to a TB
 | 
			
		||||
     * spanning two pages because the mapping for the second page can change.
 | 
			
		||||
     */
 | 
			
		||||
    if (tb->page_addr[1] != -1) {
 | 
			
		||||
        last_tb = NULL;
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
    /* See if we can patch the calling TB. */
 | 
			
		||||
    if (last_tb) {
 | 
			
		||||
        tb_add_jump(last_tb, tb_exit, tb);
 | 
			
		||||
    }
 | 
			
		||||
    return tb;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline bool cpu_handle_halt(CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
    if (cpu->halted) {
 | 
			
		||||
#if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY)
 | 
			
		||||
        if (cpu->interrupt_request & CPU_INTERRUPT_POLL) {
 | 
			
		||||
            X86CPU *x86_cpu = X86_CPU(cpu);
 | 
			
		||||
            qemu_mutex_lock_iothread();
 | 
			
		||||
            apic_poll_irq(x86_cpu->apic_state);
 | 
			
		||||
            cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL);
 | 
			
		||||
            qemu_mutex_unlock_iothread();
 | 
			
		||||
        }
 | 
			
		||||
#endif
 | 
			
		||||
        if (!cpu_has_work(cpu)) {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        cpu->halted = 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline void cpu_handle_debug_exception(CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
    CPUClass *cc = CPU_GET_CLASS(cpu);
 | 
			
		||||
    CPUWatchpoint *wp;
 | 
			
		||||
 | 
			
		||||
    if (!cpu->watchpoint_hit) {
 | 
			
		||||
        QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) {
 | 
			
		||||
            wp->flags &= ~BP_WATCHPOINT_HIT;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (cc->tcg_ops->debug_excp_handler) {
 | 
			
		||||
        cc->tcg_ops->debug_excp_handler(cpu);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline bool cpu_handle_exception(CPUState *cpu, int *ret)
 | 
			
		||||
{
 | 
			
		||||
    if (cpu->exception_index < 0) {
 | 
			
		||||
#ifndef CONFIG_USER_ONLY
 | 
			
		||||
        if (replay_has_exception()
 | 
			
		||||
            && cpu_neg(cpu)->icount_decr.u16.low + cpu->icount_extra == 0) {
 | 
			
		||||
            /* Execute just one insn to trigger exception pending in the log */
 | 
			
		||||
            cpu->cflags_next_tb = (curr_cflags(cpu) & ~CF_USE_ICOUNT) | 1;
 | 
			
		||||
        }
 | 
			
		||||
#endif
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
    if (cpu->exception_index >= EXCP_INTERRUPT) {
 | 
			
		||||
        /* exit request from the cpu execution loop */
 | 
			
		||||
        *ret = cpu->exception_index;
 | 
			
		||||
        if (*ret == EXCP_DEBUG) {
 | 
			
		||||
            cpu_handle_debug_exception(cpu);
 | 
			
		||||
        }
 | 
			
		||||
        cpu->exception_index = -1;
 | 
			
		||||
        return true;
 | 
			
		||||
    } else {
 | 
			
		||||
#if defined(CONFIG_USER_ONLY)
 | 
			
		||||
        /* if user mode only, we simulate a fake exception
 | 
			
		||||
           which will be handled outside the cpu execution
 | 
			
		||||
           loop */
 | 
			
		||||
#if defined(TARGET_I386)
 | 
			
		||||
        CPUClass *cc = CPU_GET_CLASS(cpu);
 | 
			
		||||
        cc->tcg_ops->do_interrupt(cpu);
 | 
			
		||||
#endif
 | 
			
		||||
        *ret = cpu->exception_index;
 | 
			
		||||
        cpu->exception_index = -1;
 | 
			
		||||
        return true;
 | 
			
		||||
#else
 | 
			
		||||
        if (replay_exception()) {
 | 
			
		||||
            CPUClass *cc = CPU_GET_CLASS(cpu);
 | 
			
		||||
            qemu_mutex_lock_iothread();
 | 
			
		||||
            cc->tcg_ops->do_interrupt(cpu);
 | 
			
		||||
            qemu_mutex_unlock_iothread();
 | 
			
		||||
            cpu->exception_index = -1;
 | 
			
		||||
 | 
			
		||||
            if (unlikely(cpu->singlestep_enabled)) {
 | 
			
		||||
                /*
 | 
			
		||||
                 * After processing the exception, ensure an EXCP_DEBUG is
 | 
			
		||||
                 * raised when single-stepping so that GDB doesn't miss the
 | 
			
		||||
                 * next instruction.
 | 
			
		||||
                 */
 | 
			
		||||
                *ret = EXCP_DEBUG;
 | 
			
		||||
                cpu_handle_debug_exception(cpu);
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
        } else if (!replay_has_interrupt()) {
 | 
			
		||||
            /* give a chance to iothread in replay mode */
 | 
			
		||||
            *ret = EXCP_INTERRUPT;
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * CPU_INTERRUPT_POLL is a virtual event which gets converted into a
 | 
			
		||||
 * "real" interrupt event later. It does not need to be recorded for
 | 
			
		||||
 * replay purposes.
 | 
			
		||||
 */
 | 
			
		||||
static inline bool need_replay_interrupt(int interrupt_request)
 | 
			
		||||
{
 | 
			
		||||
#if defined(TARGET_I386)
 | 
			
		||||
    return !(interrupt_request & CPU_INTERRUPT_POLL);
 | 
			
		||||
#else
 | 
			
		||||
    return true;
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline bool cpu_handle_interrupt(CPUState *cpu,
 | 
			
		||||
                                        TranslationBlock **last_tb)
 | 
			
		||||
{
 | 
			
		||||
    CPUClass *cc = CPU_GET_CLASS(cpu);
 | 
			
		||||
 | 
			
		||||
    /* Clear the interrupt flag now since we're processing
 | 
			
		||||
     * cpu->interrupt_request and cpu->exit_request.
 | 
			
		||||
     * Ensure zeroing happens before reading cpu->exit_request or
 | 
			
		||||
     * cpu->interrupt_request (see also smp_wmb in cpu_exit())
 | 
			
		||||
     */
 | 
			
		||||
    qatomic_mb_set(&cpu_neg(cpu)->icount_decr.u16.high, 0);
 | 
			
		||||
 | 
			
		||||
    if (unlikely(qatomic_read(&cpu->interrupt_request))) {
 | 
			
		||||
        int interrupt_request;
 | 
			
		||||
        qemu_mutex_lock_iothread();
 | 
			
		||||
        interrupt_request = cpu->interrupt_request;
 | 
			
		||||
        if (unlikely(cpu->singlestep_enabled & SSTEP_NOIRQ)) {
 | 
			
		||||
            /* Mask out external interrupts for this step. */
 | 
			
		||||
            interrupt_request &= ~CPU_INTERRUPT_SSTEP_MASK;
 | 
			
		||||
        }
 | 
			
		||||
        if (interrupt_request & CPU_INTERRUPT_DEBUG) {
 | 
			
		||||
            cpu->interrupt_request &= ~CPU_INTERRUPT_DEBUG;
 | 
			
		||||
            cpu->exception_index = EXCP_DEBUG;
 | 
			
		||||
            qemu_mutex_unlock_iothread();
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
        if (replay_mode == REPLAY_MODE_PLAY && !replay_has_interrupt()) {
 | 
			
		||||
            /* Do nothing */
 | 
			
		||||
        } else if (interrupt_request & CPU_INTERRUPT_HALT) {
 | 
			
		||||
            replay_interrupt();
 | 
			
		||||
            cpu->interrupt_request &= ~CPU_INTERRUPT_HALT;
 | 
			
		||||
            cpu->halted = 1;
 | 
			
		||||
            cpu->exception_index = EXCP_HLT;
 | 
			
		||||
            qemu_mutex_unlock_iothread();
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
#if defined(TARGET_I386)
 | 
			
		||||
        else if (interrupt_request & CPU_INTERRUPT_INIT) {
 | 
			
		||||
            X86CPU *x86_cpu = X86_CPU(cpu);
 | 
			
		||||
            CPUArchState *env = &x86_cpu->env;
 | 
			
		||||
            replay_interrupt();
 | 
			
		||||
            cpu_svm_check_intercept_param(env, SVM_EXIT_INIT, 0, 0);
 | 
			
		||||
            do_cpu_init(x86_cpu);
 | 
			
		||||
            cpu->exception_index = EXCP_HALTED;
 | 
			
		||||
            qemu_mutex_unlock_iothread();
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
#else
 | 
			
		||||
        else if (interrupt_request & CPU_INTERRUPT_RESET) {
 | 
			
		||||
            replay_interrupt();
 | 
			
		||||
            cpu_reset(cpu);
 | 
			
		||||
            qemu_mutex_unlock_iothread();
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
#endif
 | 
			
		||||
        /* The target hook has 3 exit conditions:
 | 
			
		||||
           False when the interrupt isn't processed,
 | 
			
		||||
           True when it is, and we should restart on a new TB,
 | 
			
		||||
           and via longjmp via cpu_loop_exit.  */
 | 
			
		||||
        else {
 | 
			
		||||
            if (cc->tcg_ops->cpu_exec_interrupt &&
 | 
			
		||||
                cc->tcg_ops->cpu_exec_interrupt(cpu, interrupt_request)) {
 | 
			
		||||
                if (need_replay_interrupt(interrupt_request)) {
 | 
			
		||||
                    replay_interrupt();
 | 
			
		||||
                }
 | 
			
		||||
                /*
 | 
			
		||||
                 * After processing the interrupt, ensure an EXCP_DEBUG is
 | 
			
		||||
                 * raised when single-stepping so that GDB doesn't miss the
 | 
			
		||||
                 * next instruction.
 | 
			
		||||
                 */
 | 
			
		||||
                cpu->exception_index =
 | 
			
		||||
                    (cpu->singlestep_enabled ? EXCP_DEBUG : -1);
 | 
			
		||||
                *last_tb = NULL;
 | 
			
		||||
            }
 | 
			
		||||
            /* The target hook may have updated the 'cpu->interrupt_request';
 | 
			
		||||
             * reload the 'interrupt_request' value */
 | 
			
		||||
            interrupt_request = cpu->interrupt_request;
 | 
			
		||||
        }
 | 
			
		||||
        if (interrupt_request & CPU_INTERRUPT_EXITTB) {
 | 
			
		||||
            cpu->interrupt_request &= ~CPU_INTERRUPT_EXITTB;
 | 
			
		||||
            /* ensure that no TB jump will be modified as
 | 
			
		||||
               the program flow was changed */
 | 
			
		||||
            *last_tb = NULL;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /* If we exit via cpu_loop_exit/longjmp it is reset in cpu_exec */
 | 
			
		||||
        qemu_mutex_unlock_iothread();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* Finally, check if we need to exit to the main loop.  */
 | 
			
		||||
    if (unlikely(qatomic_read(&cpu->exit_request))
 | 
			
		||||
        || (icount_enabled()
 | 
			
		||||
            && (cpu->cflags_next_tb == -1 || cpu->cflags_next_tb & CF_USE_ICOUNT)
 | 
			
		||||
            && cpu_neg(cpu)->icount_decr.u16.low + cpu->icount_extra == 0)) {
 | 
			
		||||
        qatomic_set(&cpu->exit_request, 0);
 | 
			
		||||
        if (cpu->exception_index == -1) {
 | 
			
		||||
            cpu->exception_index = EXCP_INTERRUPT;
 | 
			
		||||
        }
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline void cpu_loop_exec_tb(CPUState *cpu, TranslationBlock *tb,
 | 
			
		||||
                                    TranslationBlock **last_tb, int *tb_exit)
 | 
			
		||||
{
 | 
			
		||||
    int32_t insns_left;
 | 
			
		||||
 | 
			
		||||
    trace_exec_tb(tb, tb->pc);
 | 
			
		||||
    tb = cpu_tb_exec(cpu, tb, tb_exit);
 | 
			
		||||
    if (*tb_exit != TB_EXIT_REQUESTED) {
 | 
			
		||||
        *last_tb = tb;
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    *last_tb = NULL;
 | 
			
		||||
    insns_left = qatomic_read(&cpu_neg(cpu)->icount_decr.u32);
 | 
			
		||||
    if (insns_left < 0) {
 | 
			
		||||
        /* Something asked us to stop executing chained TBs; just
 | 
			
		||||
         * continue round the main loop. Whatever requested the exit
 | 
			
		||||
         * will also have set something else (eg exit_request or
 | 
			
		||||
         * interrupt_request) which will be handled by
 | 
			
		||||
         * cpu_handle_interrupt.  cpu_handle_interrupt will also
 | 
			
		||||
         * clear cpu->icount_decr.u16.high.
 | 
			
		||||
         */
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* Instruction counter expired.  */
 | 
			
		||||
    assert(icount_enabled());
 | 
			
		||||
#ifndef CONFIG_USER_ONLY
 | 
			
		||||
    /* Ensure global icount has gone forward */
 | 
			
		||||
    icount_update(cpu);
 | 
			
		||||
    /* Refill decrementer and continue execution.  */
 | 
			
		||||
    insns_left = MIN(CF_COUNT_MASK, cpu->icount_budget);
 | 
			
		||||
    cpu_neg(cpu)->icount_decr.u16.low = insns_left;
 | 
			
		||||
    cpu->icount_extra = cpu->icount_budget - insns_left;
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
     * If the next tb has more instructions than we have left to
 | 
			
		||||
     * execute we need to ensure we find/generate a TB with exactly
 | 
			
		||||
     * insns_left instructions in it.
 | 
			
		||||
     */
 | 
			
		||||
    if (!cpu->icount_extra && insns_left > 0 && insns_left < tb->icount)  {
 | 
			
		||||
        cpu->cflags_next_tb = (tb->cflags & ~CF_COUNT_MASK) | insns_left;
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* main execution loop */
 | 
			
		||||
 | 
			
		||||
int cpu_exec(CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
    CPUClass *cc = CPU_GET_CLASS(cpu);
 | 
			
		||||
    int ret;
 | 
			
		||||
    SyncClocks sc = { 0 };
 | 
			
		||||
 | 
			
		||||
    /* replay_interrupt may need current_cpu */
 | 
			
		||||
    current_cpu = cpu;
 | 
			
		||||
 | 
			
		||||
    if (cpu_handle_halt(cpu)) {
 | 
			
		||||
        return EXCP_HALTED;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    rcu_read_lock();
 | 
			
		||||
 | 
			
		||||
    cpu_exec_enter(cpu);
 | 
			
		||||
 | 
			
		||||
    /* Calculate difference between guest clock and host clock.
 | 
			
		||||
     * This delay includes the delay of the last cycle, so
 | 
			
		||||
     * what we have to do is sleep until it is 0. As for the
 | 
			
		||||
     * advance/delay we gain here, we try to fix it next time.
 | 
			
		||||
     */
 | 
			
		||||
    init_delay_params(&sc, cpu);
 | 
			
		||||
 | 
			
		||||
    /* prepare setjmp context for exception handling */
 | 
			
		||||
    if (sigsetjmp(cpu->jmp_env, 0) != 0) {
 | 
			
		||||
#if defined(__clang__)
 | 
			
		||||
        /*
 | 
			
		||||
         * Some compilers wrongly smash all local variables after
 | 
			
		||||
         * siglongjmp (the spec requires that only non-volatile locals
 | 
			
		||||
         * which are changed between the sigsetjmp and siglongjmp are
 | 
			
		||||
         * permitted to be trashed). There were bug reports for gcc
 | 
			
		||||
         * 4.5.0 and clang.  The bug is fixed in all versions of gcc
 | 
			
		||||
         * that we support, but is still unfixed in clang:
 | 
			
		||||
         *   https://bugs.llvm.org/show_bug.cgi?id=21183
 | 
			
		||||
         *
 | 
			
		||||
         * Reload essential local variables here for those compilers.
 | 
			
		||||
         * Newer versions of gcc would complain about this code (-Wclobbered),
 | 
			
		||||
         * so we only perform the workaround for clang.
 | 
			
		||||
         */
 | 
			
		||||
        cpu = current_cpu;
 | 
			
		||||
        cc = CPU_GET_CLASS(cpu);
 | 
			
		||||
#else
 | 
			
		||||
        /*
 | 
			
		||||
         * Non-buggy compilers preserve these locals; assert that
 | 
			
		||||
         * they have the correct value.
 | 
			
		||||
         */
 | 
			
		||||
        g_assert(cpu == current_cpu);
 | 
			
		||||
        g_assert(cc == CPU_GET_CLASS(cpu));
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef CONFIG_SOFTMMU
 | 
			
		||||
        tcg_debug_assert(!have_mmap_lock());
 | 
			
		||||
#endif
 | 
			
		||||
        if (qemu_mutex_iothread_locked()) {
 | 
			
		||||
            qemu_mutex_unlock_iothread();
 | 
			
		||||
        }
 | 
			
		||||
        qemu_plugin_disable_mem_helpers(cpu);
 | 
			
		||||
 | 
			
		||||
        assert_no_pages_locked();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* if an exception is pending, we execute it here */
 | 
			
		||||
    while (!cpu_handle_exception(cpu, &ret)) {
 | 
			
		||||
        TranslationBlock *last_tb = NULL;
 | 
			
		||||
        int tb_exit = 0;
 | 
			
		||||
 | 
			
		||||
        while (!cpu_handle_interrupt(cpu, &last_tb)) {
 | 
			
		||||
            uint32_t cflags = cpu->cflags_next_tb;
 | 
			
		||||
            TranslationBlock *tb;
 | 
			
		||||
 | 
			
		||||
            /* When requested, use an exact setting for cflags for the next
 | 
			
		||||
               execution.  This is used for icount, precise smc, and stop-
 | 
			
		||||
               after-access watchpoints.  Since this request should never
 | 
			
		||||
               have CF_INVALID set, -1 is a convenient invalid value that
 | 
			
		||||
               does not require tcg headers for cpu_common_reset.  */
 | 
			
		||||
            if (cflags == -1) {
 | 
			
		||||
                cflags = curr_cflags(cpu);
 | 
			
		||||
            } else {
 | 
			
		||||
                cpu->cflags_next_tb = -1;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            tb = tb_find(cpu, last_tb, tb_exit, cflags);
 | 
			
		||||
            cpu_loop_exec_tb(cpu, tb, &last_tb, &tb_exit);
 | 
			
		||||
            /* Try to align the host and virtual clocks
 | 
			
		||||
               if the guest is in advance */
 | 
			
		||||
            align_clocks(&sc, cpu);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    cpu_exec_exit(cpu);
 | 
			
		||||
    rcu_read_unlock();
 | 
			
		||||
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void tcg_exec_realizefn(CPUState *cpu, Error **errp)
 | 
			
		||||
{
 | 
			
		||||
    static bool tcg_target_initialized;
 | 
			
		||||
    CPUClass *cc = CPU_GET_CLASS(cpu);
 | 
			
		||||
 | 
			
		||||
    if (!tcg_target_initialized) {
 | 
			
		||||
        cc->tcg_ops->initialize();
 | 
			
		||||
        tcg_target_initialized = true;
 | 
			
		||||
    }
 | 
			
		||||
    tlb_init(cpu);
 | 
			
		||||
    qemu_plugin_vcpu_init_hook(cpu);
 | 
			
		||||
 | 
			
		||||
#ifndef CONFIG_USER_ONLY
 | 
			
		||||
    tcg_iommu_init_notifier_list(cpu);
 | 
			
		||||
#endif /* !CONFIG_USER_ONLY */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* undo the initializations in reverse order */
 | 
			
		||||
void tcg_exec_unrealizefn(CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
#ifndef CONFIG_USER_ONLY
 | 
			
		||||
    tcg_iommu_free_notifier_list(cpu);
 | 
			
		||||
#endif /* !CONFIG_USER_ONLY */
 | 
			
		||||
 | 
			
		||||
    qemu_plugin_vcpu_exit_hook(cpu);
 | 
			
		||||
    tlb_destroy(cpu);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifndef CONFIG_USER_ONLY
 | 
			
		||||
 | 
			
		||||
void dump_drift_info(void)
 | 
			
		||||
{
 | 
			
		||||
    if (!icount_enabled()) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    qemu_printf("Host - Guest clock  %"PRIi64" ms\n",
 | 
			
		||||
                (cpu_get_clock() - icount_get()) / SCALE_MS);
 | 
			
		||||
    if (icount_align_option) {
 | 
			
		||||
        qemu_printf("Max guest delay     %"PRIi64" ms\n",
 | 
			
		||||
                    -max_delay / SCALE_MS);
 | 
			
		||||
        qemu_printf("Max guest advance   %"PRIi64" ms\n",
 | 
			
		||||
                    max_advance / SCALE_MS);
 | 
			
		||||
    } else {
 | 
			
		||||
        qemu_printf("Max guest delay     NA\n");
 | 
			
		||||
        qemu_printf("Max guest advance   NA\n");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif /* !CONFIG_USER_ONLY */
 | 
			
		||||
							
								
								
									
										2774
									
								
								accel/tcg/cputlb.c
									
									
									
									
									
								
							
							
						
						
									
										2774
									
								
								accel/tcg/cputlb.c
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,20 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Internal execution defines for qemu
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2003 Fabrice Bellard
 | 
			
		||||
 *
 | 
			
		||||
 * SPDX-License-Identifier: LGPL-2.1-or-later
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef ACCEL_TCG_INTERNAL_H
 | 
			
		||||
#define ACCEL_TCG_INTERNAL_H
 | 
			
		||||
 | 
			
		||||
#include "exec/exec-all.h"
 | 
			
		||||
 | 
			
		||||
TranslationBlock *tb_gen_code(CPUState *cpu, target_ulong pc,
 | 
			
		||||
                              target_ulong cs_base, uint32_t flags,
 | 
			
		||||
                              int cflags);
 | 
			
		||||
 | 
			
		||||
void QEMU_NORETURN cpu_io_recompile(CPUState *cpu, uintptr_t retaddr);
 | 
			
		||||
 | 
			
		||||
#endif /* ACCEL_TCG_INTERNAL_H */
 | 
			
		||||
@@ -1,22 +0,0 @@
 | 
			
		||||
tcg_ss = ss.source_set()
 | 
			
		||||
tcg_ss.add(files(
 | 
			
		||||
  'tcg-all.c',
 | 
			
		||||
  'cpu-exec-common.c',
 | 
			
		||||
  'cpu-exec.c',
 | 
			
		||||
  'tcg-runtime-gvec.c',
 | 
			
		||||
  'tcg-runtime.c',
 | 
			
		||||
  'translate-all.c',
 | 
			
		||||
  'translator.c',
 | 
			
		||||
))
 | 
			
		||||
tcg_ss.add(when: 'CONFIG_USER_ONLY', if_true: files('user-exec.c'))
 | 
			
		||||
tcg_ss.add(when: 'CONFIG_SOFTMMU', if_false: files('user-exec-stub.c'))
 | 
			
		||||
tcg_ss.add(when: 'CONFIG_PLUGIN', if_true: [files('plugin-gen.c'), libdl])
 | 
			
		||||
specific_ss.add_all(when: 'CONFIG_TCG', if_true: tcg_ss)
 | 
			
		||||
 | 
			
		||||
specific_ss.add(when: ['CONFIG_SOFTMMU', 'CONFIG_TCG'], if_true: files(
 | 
			
		||||
  'cputlb.c',
 | 
			
		||||
  'tcg-accel-ops.c',
 | 
			
		||||
  'tcg-accel-ops-mttcg.c',
 | 
			
		||||
  'tcg-accel-ops-icount.c',
 | 
			
		||||
  'tcg-accel-ops-rr.c'
 | 
			
		||||
))
 | 
			
		||||
@@ -1,918 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * plugin-gen.c - TCG-related bits of plugin infrastructure
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (C) 2018, Emilio G. Cota <cota@braap.org>
 | 
			
		||||
 * License: GNU GPL, version 2 or later.
 | 
			
		||||
 *   See the COPYING file in the top-level directory.
 | 
			
		||||
 *
 | 
			
		||||
 * We support instrumentation at an instruction granularity. That is,
 | 
			
		||||
 * if a plugin wants to instrument the memory accesses performed by a
 | 
			
		||||
 * particular instruction, it can just do that instead of instrumenting
 | 
			
		||||
 * all memory accesses. Thus, in order to do this we first have to
 | 
			
		||||
 * translate a TB, so that plugins can decide what/where to instrument.
 | 
			
		||||
 *
 | 
			
		||||
 * Injecting the desired instrumentation could be done with a second
 | 
			
		||||
 * translation pass that combined the instrumentation requests, but that
 | 
			
		||||
 * would be ugly and inefficient since we would decode the guest code twice.
 | 
			
		||||
 * Instead, during TB translation we add "empty" instrumentation calls for all
 | 
			
		||||
 * possible instrumentation events, and then once we collect the instrumentation
 | 
			
		||||
 * requests from plugins, we either "fill in" those empty events or remove them
 | 
			
		||||
 * if they have no requests.
 | 
			
		||||
 *
 | 
			
		||||
 * When "filling in" an event we first copy the empty callback's TCG ops. This
 | 
			
		||||
 * might seem unnecessary, but it is done to support an arbitrary number
 | 
			
		||||
 * of callbacks per event. Take for example a regular instruction callback.
 | 
			
		||||
 * We first generate a callback to an empty helper function. Then, if two
 | 
			
		||||
 * plugins register one callback each for this instruction, we make two copies
 | 
			
		||||
 * of the TCG ops generated for the empty callback, substituting the function
 | 
			
		||||
 * pointer that points to the empty helper function with the plugins' desired
 | 
			
		||||
 * callback functions. After that we remove the empty callback's ops.
 | 
			
		||||
 *
 | 
			
		||||
 * Note that the location in TCGOp.args[] of the pointer to a helper function
 | 
			
		||||
 * varies across different guest and host architectures. Instead of duplicating
 | 
			
		||||
 * the logic that figures this out, we rely on the fact that the empty
 | 
			
		||||
 * callbacks point to empty functions that are unique pointers in the program.
 | 
			
		||||
 * Thus, to find the right location we just have to look for a match in
 | 
			
		||||
 * TCGOp.args[]. This is the main reason why we first copy an empty callback's
 | 
			
		||||
 * TCG ops and then fill them in; regardless of whether we have one or many
 | 
			
		||||
 * callbacks for that event, the logic to add all of them is the same.
 | 
			
		||||
 *
 | 
			
		||||
 * When generating more than one callback per event, we make a small
 | 
			
		||||
 * optimization to avoid generating redundant operations. For instance, for the
 | 
			
		||||
 * second and all subsequent callbacks of an event, we do not need to reload the
 | 
			
		||||
 * CPU's index into a TCG temp, since the first callback did it already.
 | 
			
		||||
 */
 | 
			
		||||
#include "qemu/osdep.h"
 | 
			
		||||
#include "cpu.h"
 | 
			
		||||
#include "tcg/tcg.h"
 | 
			
		||||
#include "tcg/tcg-op.h"
 | 
			
		||||
#include "trace/mem.h"
 | 
			
		||||
#include "exec/exec-all.h"
 | 
			
		||||
#include "exec/plugin-gen.h"
 | 
			
		||||
#include "exec/translator.h"
 | 
			
		||||
 | 
			
		||||
#ifdef CONFIG_SOFTMMU
 | 
			
		||||
# define CONFIG_SOFTMMU_GATE 1
 | 
			
		||||
#else
 | 
			
		||||
# define CONFIG_SOFTMMU_GATE 0
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * plugin_cb_start TCG op args[]:
 | 
			
		||||
 * 0: enum plugin_gen_from
 | 
			
		||||
 * 1: enum plugin_gen_cb
 | 
			
		||||
 * 2: set to 1 for mem callback that is a write, 0 otherwise.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
enum plugin_gen_from {
 | 
			
		||||
    PLUGIN_GEN_FROM_TB,
 | 
			
		||||
    PLUGIN_GEN_FROM_INSN,
 | 
			
		||||
    PLUGIN_GEN_FROM_MEM,
 | 
			
		||||
    PLUGIN_GEN_AFTER_INSN,
 | 
			
		||||
    PLUGIN_GEN_N_FROMS,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum plugin_gen_cb {
 | 
			
		||||
    PLUGIN_GEN_CB_UDATA,
 | 
			
		||||
    PLUGIN_GEN_CB_INLINE,
 | 
			
		||||
    PLUGIN_GEN_CB_MEM,
 | 
			
		||||
    PLUGIN_GEN_ENABLE_MEM_HELPER,
 | 
			
		||||
    PLUGIN_GEN_DISABLE_MEM_HELPER,
 | 
			
		||||
    PLUGIN_GEN_N_CBS,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * These helpers are stubs that get dynamically switched out for calls
 | 
			
		||||
 * direct to the plugin if they are subscribed to.
 | 
			
		||||
 */
 | 
			
		||||
void HELPER(plugin_vcpu_udata_cb)(uint32_t cpu_index, void *udata)
 | 
			
		||||
{ }
 | 
			
		||||
 | 
			
		||||
void HELPER(plugin_vcpu_mem_cb)(unsigned int vcpu_index,
 | 
			
		||||
                                qemu_plugin_meminfo_t info, uint64_t vaddr,
 | 
			
		||||
                                void *userdata)
 | 
			
		||||
{ }
 | 
			
		||||
 | 
			
		||||
static void do_gen_mem_cb(TCGv vaddr, uint32_t info)
 | 
			
		||||
{
 | 
			
		||||
    TCGv_i32 cpu_index = tcg_temp_new_i32();
 | 
			
		||||
    TCGv_i32 meminfo = tcg_const_i32(info);
 | 
			
		||||
    TCGv_i64 vaddr64 = tcg_temp_new_i64();
 | 
			
		||||
    TCGv_ptr udata = tcg_const_ptr(NULL);
 | 
			
		||||
 | 
			
		||||
    tcg_gen_ld_i32(cpu_index, cpu_env,
 | 
			
		||||
                   -offsetof(ArchCPU, env) + offsetof(CPUState, cpu_index));
 | 
			
		||||
    tcg_gen_extu_tl_i64(vaddr64, vaddr);
 | 
			
		||||
 | 
			
		||||
    gen_helper_plugin_vcpu_mem_cb(cpu_index, meminfo, vaddr64, udata);
 | 
			
		||||
 | 
			
		||||
    tcg_temp_free_ptr(udata);
 | 
			
		||||
    tcg_temp_free_i64(vaddr64);
 | 
			
		||||
    tcg_temp_free_i32(meminfo);
 | 
			
		||||
    tcg_temp_free_i32(cpu_index);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void gen_empty_udata_cb(void)
 | 
			
		||||
{
 | 
			
		||||
    TCGv_i32 cpu_index = tcg_temp_new_i32();
 | 
			
		||||
    TCGv_ptr udata = tcg_const_ptr(NULL); /* will be overwritten later */
 | 
			
		||||
 | 
			
		||||
    tcg_gen_ld_i32(cpu_index, cpu_env,
 | 
			
		||||
                   -offsetof(ArchCPU, env) + offsetof(CPUState, cpu_index));
 | 
			
		||||
    gen_helper_plugin_vcpu_udata_cb(cpu_index, udata);
 | 
			
		||||
 | 
			
		||||
    tcg_temp_free_ptr(udata);
 | 
			
		||||
    tcg_temp_free_i32(cpu_index);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * For now we only support addi_i64.
 | 
			
		||||
 * When we support more ops, we can generate one empty inline cb for each.
 | 
			
		||||
 */
 | 
			
		||||
static void gen_empty_inline_cb(void)
 | 
			
		||||
{
 | 
			
		||||
    TCGv_i64 val = tcg_temp_new_i64();
 | 
			
		||||
    TCGv_ptr ptr = tcg_const_ptr(NULL); /* overwritten later */
 | 
			
		||||
 | 
			
		||||
    tcg_gen_ld_i64(val, ptr, 0);
 | 
			
		||||
    /* pass an immediate != 0 so that it doesn't get optimized away */
 | 
			
		||||
    tcg_gen_addi_i64(val, val, 0xdeadface);
 | 
			
		||||
    tcg_gen_st_i64(val, ptr, 0);
 | 
			
		||||
    tcg_temp_free_ptr(ptr);
 | 
			
		||||
    tcg_temp_free_i64(val);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void gen_empty_mem_cb(TCGv addr, uint32_t info)
 | 
			
		||||
{
 | 
			
		||||
    do_gen_mem_cb(addr, info);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Share the same function for enable/disable. When enabling, the NULL
 | 
			
		||||
 * pointer will be overwritten later.
 | 
			
		||||
 */
 | 
			
		||||
static void gen_empty_mem_helper(void)
 | 
			
		||||
{
 | 
			
		||||
    TCGv_ptr ptr;
 | 
			
		||||
 | 
			
		||||
    ptr = tcg_const_ptr(NULL);
 | 
			
		||||
    tcg_gen_st_ptr(ptr, cpu_env, offsetof(CPUState, plugin_mem_cbs) -
 | 
			
		||||
                                 offsetof(ArchCPU, env));
 | 
			
		||||
    tcg_temp_free_ptr(ptr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline
 | 
			
		||||
void gen_plugin_cb_start(enum plugin_gen_from from,
 | 
			
		||||
                         enum plugin_gen_cb type, unsigned wr)
 | 
			
		||||
{
 | 
			
		||||
    TCGOp *op;
 | 
			
		||||
 | 
			
		||||
    tcg_gen_plugin_cb_start(from, type, wr);
 | 
			
		||||
    op = tcg_last_op();
 | 
			
		||||
    QSIMPLEQ_INSERT_TAIL(&tcg_ctx->plugin_ops, op, plugin_link);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void gen_wrapped(enum plugin_gen_from from,
 | 
			
		||||
                        enum plugin_gen_cb type, void (*func)(void))
 | 
			
		||||
{
 | 
			
		||||
    gen_plugin_cb_start(from, type, 0);
 | 
			
		||||
    func();
 | 
			
		||||
    tcg_gen_plugin_cb_end();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline void plugin_gen_empty_callback(enum plugin_gen_from from)
 | 
			
		||||
{
 | 
			
		||||
    switch (from) {
 | 
			
		||||
    case PLUGIN_GEN_AFTER_INSN:
 | 
			
		||||
        gen_wrapped(from, PLUGIN_GEN_DISABLE_MEM_HELPER,
 | 
			
		||||
                    gen_empty_mem_helper);
 | 
			
		||||
        break;
 | 
			
		||||
    case PLUGIN_GEN_FROM_INSN:
 | 
			
		||||
        /*
 | 
			
		||||
         * Note: plugin_gen_inject() relies on ENABLE_MEM_HELPER being
 | 
			
		||||
         * the first callback of an instruction
 | 
			
		||||
         */
 | 
			
		||||
        gen_wrapped(from, PLUGIN_GEN_ENABLE_MEM_HELPER,
 | 
			
		||||
                    gen_empty_mem_helper);
 | 
			
		||||
        /* fall through */
 | 
			
		||||
    case PLUGIN_GEN_FROM_TB:
 | 
			
		||||
        gen_wrapped(from, PLUGIN_GEN_CB_UDATA, gen_empty_udata_cb);
 | 
			
		||||
        gen_wrapped(from, PLUGIN_GEN_CB_INLINE, gen_empty_inline_cb);
 | 
			
		||||
        break;
 | 
			
		||||
    default:
 | 
			
		||||
        g_assert_not_reached();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
union mem_gen_fn {
 | 
			
		||||
    void (*mem_fn)(TCGv, uint32_t);
 | 
			
		||||
    void (*inline_fn)(void);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static void gen_mem_wrapped(enum plugin_gen_cb type,
 | 
			
		||||
                            const union mem_gen_fn *f, TCGv addr,
 | 
			
		||||
                            uint32_t info, bool is_mem)
 | 
			
		||||
{
 | 
			
		||||
    int wr = !!(info & TRACE_MEM_ST);
 | 
			
		||||
 | 
			
		||||
    gen_plugin_cb_start(PLUGIN_GEN_FROM_MEM, type, wr);
 | 
			
		||||
    if (is_mem) {
 | 
			
		||||
        f->mem_fn(addr, info);
 | 
			
		||||
    } else {
 | 
			
		||||
        f->inline_fn();
 | 
			
		||||
    }
 | 
			
		||||
    tcg_gen_plugin_cb_end();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void plugin_gen_empty_mem_callback(TCGv addr, uint32_t info)
 | 
			
		||||
{
 | 
			
		||||
    union mem_gen_fn fn;
 | 
			
		||||
 | 
			
		||||
    fn.mem_fn = gen_empty_mem_cb;
 | 
			
		||||
    gen_mem_wrapped(PLUGIN_GEN_CB_MEM, &fn, addr, info, true);
 | 
			
		||||
 | 
			
		||||
    fn.inline_fn = gen_empty_inline_cb;
 | 
			
		||||
    gen_mem_wrapped(PLUGIN_GEN_CB_INLINE, &fn, 0, info, false);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static TCGOp *find_op(TCGOp *op, TCGOpcode opc)
 | 
			
		||||
{
 | 
			
		||||
    while (op) {
 | 
			
		||||
        if (op->opc == opc) {
 | 
			
		||||
            return op;
 | 
			
		||||
        }
 | 
			
		||||
        op = QTAILQ_NEXT(op, link);
 | 
			
		||||
    }
 | 
			
		||||
    return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static TCGOp *rm_ops_range(TCGOp *begin, TCGOp *end)
 | 
			
		||||
{
 | 
			
		||||
    TCGOp *ret = QTAILQ_NEXT(end, link);
 | 
			
		||||
 | 
			
		||||
    QTAILQ_REMOVE_SEVERAL(&tcg_ctx->ops, begin, end, link);
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* remove all ops until (and including) plugin_cb_end */
 | 
			
		||||
static TCGOp *rm_ops(TCGOp *op)
 | 
			
		||||
{
 | 
			
		||||
    TCGOp *end_op = find_op(op, INDEX_op_plugin_cb_end);
 | 
			
		||||
 | 
			
		||||
    tcg_debug_assert(end_op);
 | 
			
		||||
    return rm_ops_range(op, end_op);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static TCGOp *copy_op_nocheck(TCGOp **begin_op, TCGOp *op)
 | 
			
		||||
{
 | 
			
		||||
    *begin_op = QTAILQ_NEXT(*begin_op, link);
 | 
			
		||||
    tcg_debug_assert(*begin_op);
 | 
			
		||||
    op = tcg_op_insert_after(tcg_ctx, op, (*begin_op)->opc);
 | 
			
		||||
    memcpy(op->args, (*begin_op)->args, sizeof(op->args));
 | 
			
		||||
    return op;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static TCGOp *copy_op(TCGOp **begin_op, TCGOp *op, TCGOpcode opc)
 | 
			
		||||
{
 | 
			
		||||
    op = copy_op_nocheck(begin_op, op);
 | 
			
		||||
    tcg_debug_assert((*begin_op)->opc == opc);
 | 
			
		||||
    return op;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static TCGOp *copy_extu_i32_i64(TCGOp **begin_op, TCGOp *op)
 | 
			
		||||
{
 | 
			
		||||
    if (TCG_TARGET_REG_BITS == 32) {
 | 
			
		||||
        /* mov_i32 */
 | 
			
		||||
        op = copy_op(begin_op, op, INDEX_op_mov_i32);
 | 
			
		||||
        /* mov_i32 w/ $0 */
 | 
			
		||||
        op = copy_op(begin_op, op, INDEX_op_mov_i32);
 | 
			
		||||
    } else {
 | 
			
		||||
        /* extu_i32_i64 */
 | 
			
		||||
        op = copy_op(begin_op, op, INDEX_op_extu_i32_i64);
 | 
			
		||||
    }
 | 
			
		||||
    return op;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static TCGOp *copy_mov_i64(TCGOp **begin_op, TCGOp *op)
 | 
			
		||||
{
 | 
			
		||||
    if (TCG_TARGET_REG_BITS == 32) {
 | 
			
		||||
        /* 2x mov_i32 */
 | 
			
		||||
        op = copy_op(begin_op, op, INDEX_op_mov_i32);
 | 
			
		||||
        op = copy_op(begin_op, op, INDEX_op_mov_i32);
 | 
			
		||||
    } else {
 | 
			
		||||
        /* mov_i64 */
 | 
			
		||||
        op = copy_op(begin_op, op, INDEX_op_mov_i64);
 | 
			
		||||
    }
 | 
			
		||||
    return op;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static TCGOp *copy_const_ptr(TCGOp **begin_op, TCGOp *op, void *ptr)
 | 
			
		||||
{
 | 
			
		||||
    if (UINTPTR_MAX == UINT32_MAX) {
 | 
			
		||||
        /* mov_i32 */
 | 
			
		||||
        op = copy_op(begin_op, op, INDEX_op_mov_i32);
 | 
			
		||||
        op->args[1] = tcgv_i32_arg(tcg_constant_i32((uintptr_t)ptr));
 | 
			
		||||
    } else {
 | 
			
		||||
        /* mov_i64 */
 | 
			
		||||
        op = copy_op(begin_op, op, INDEX_op_mov_i64);
 | 
			
		||||
        op->args[1] = tcgv_i64_arg(tcg_constant_i64((uintptr_t)ptr));
 | 
			
		||||
    }
 | 
			
		||||
    return op;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static TCGOp *copy_extu_tl_i64(TCGOp **begin_op, TCGOp *op)
 | 
			
		||||
{
 | 
			
		||||
    if (TARGET_LONG_BITS == 32) {
 | 
			
		||||
        /* extu_i32_i64 */
 | 
			
		||||
        op = copy_extu_i32_i64(begin_op, op);
 | 
			
		||||
    } else {
 | 
			
		||||
        /* mov_i64 */
 | 
			
		||||
        op = copy_mov_i64(begin_op, op);
 | 
			
		||||
    }
 | 
			
		||||
    return op;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static TCGOp *copy_ld_i64(TCGOp **begin_op, TCGOp *op)
 | 
			
		||||
{
 | 
			
		||||
    if (TCG_TARGET_REG_BITS == 32) {
 | 
			
		||||
        /* 2x ld_i32 */
 | 
			
		||||
        op = copy_op(begin_op, op, INDEX_op_ld_i32);
 | 
			
		||||
        op = copy_op(begin_op, op, INDEX_op_ld_i32);
 | 
			
		||||
    } else {
 | 
			
		||||
        /* ld_i64 */
 | 
			
		||||
        op = copy_op(begin_op, op, INDEX_op_ld_i64);
 | 
			
		||||
    }
 | 
			
		||||
    return op;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static TCGOp *copy_st_i64(TCGOp **begin_op, TCGOp *op)
 | 
			
		||||
{
 | 
			
		||||
    if (TCG_TARGET_REG_BITS == 32) {
 | 
			
		||||
        /* 2x st_i32 */
 | 
			
		||||
        op = copy_op(begin_op, op, INDEX_op_st_i32);
 | 
			
		||||
        op = copy_op(begin_op, op, INDEX_op_st_i32);
 | 
			
		||||
    } else {
 | 
			
		||||
        /* st_i64 */
 | 
			
		||||
        op = copy_op(begin_op, op, INDEX_op_st_i64);
 | 
			
		||||
    }
 | 
			
		||||
    return op;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static TCGOp *copy_add_i64(TCGOp **begin_op, TCGOp *op, uint64_t v)
 | 
			
		||||
{
 | 
			
		||||
    if (TCG_TARGET_REG_BITS == 32) {
 | 
			
		||||
        /* all 32-bit backends must implement add2_i32 */
 | 
			
		||||
        g_assert(TCG_TARGET_HAS_add2_i32);
 | 
			
		||||
        op = copy_op(begin_op, op, INDEX_op_add2_i32);
 | 
			
		||||
        op->args[4] = tcgv_i32_arg(tcg_constant_i32(v));
 | 
			
		||||
        op->args[5] = tcgv_i32_arg(tcg_constant_i32(v >> 32));
 | 
			
		||||
    } else {
 | 
			
		||||
        op = copy_op(begin_op, op, INDEX_op_add_i64);
 | 
			
		||||
        op->args[2] = tcgv_i64_arg(tcg_constant_i64(v));
 | 
			
		||||
    }
 | 
			
		||||
    return op;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static TCGOp *copy_st_ptr(TCGOp **begin_op, TCGOp *op)
 | 
			
		||||
{
 | 
			
		||||
    if (UINTPTR_MAX == UINT32_MAX) {
 | 
			
		||||
        /* st_i32 */
 | 
			
		||||
        op = copy_op(begin_op, op, INDEX_op_st_i32);
 | 
			
		||||
    } else {
 | 
			
		||||
        /* st_i64 */
 | 
			
		||||
        op = copy_st_i64(begin_op, op);
 | 
			
		||||
    }
 | 
			
		||||
    return op;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static TCGOp *copy_call(TCGOp **begin_op, TCGOp *op, void *empty_func,
 | 
			
		||||
                        void *func, unsigned tcg_flags, int *cb_idx)
 | 
			
		||||
{
 | 
			
		||||
    /* copy all ops until the call */
 | 
			
		||||
    do {
 | 
			
		||||
        op = copy_op_nocheck(begin_op, op);
 | 
			
		||||
    } while (op->opc != INDEX_op_call);
 | 
			
		||||
 | 
			
		||||
    /* fill in the op call */
 | 
			
		||||
    op->param1 = (*begin_op)->param1;
 | 
			
		||||
    op->param2 = (*begin_op)->param2;
 | 
			
		||||
    tcg_debug_assert(op->life == 0);
 | 
			
		||||
    if (*cb_idx == -1) {
 | 
			
		||||
        int i;
 | 
			
		||||
 | 
			
		||||
        /*
 | 
			
		||||
         * Instead of working out the position of the callback in args[], just
 | 
			
		||||
         * look for @empty_func, since it should be a unique pointer.
 | 
			
		||||
         */
 | 
			
		||||
        for (i = 0; i < MAX_OPC_PARAM_ARGS; i++) {
 | 
			
		||||
            if ((uintptr_t)(*begin_op)->args[i] == (uintptr_t)empty_func) {
 | 
			
		||||
                *cb_idx = i;
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        tcg_debug_assert(i < MAX_OPC_PARAM_ARGS);
 | 
			
		||||
    }
 | 
			
		||||
    op->args[*cb_idx] = (uintptr_t)func;
 | 
			
		||||
    op->args[*cb_idx + 1] = tcg_flags;
 | 
			
		||||
 | 
			
		||||
    return op;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * When we append/replace ops here we are sensitive to changing patterns of
 | 
			
		||||
 * TCGOps generated by the tcg_gen_FOO calls when we generated the
 | 
			
		||||
 * empty callbacks. This will assert very quickly in a debug build as
 | 
			
		||||
 * we assert the ops we are replacing are the correct ones.
 | 
			
		||||
 */
 | 
			
		||||
static TCGOp *append_udata_cb(const struct qemu_plugin_dyn_cb *cb,
 | 
			
		||||
                              TCGOp *begin_op, TCGOp *op, int *cb_idx)
 | 
			
		||||
{
 | 
			
		||||
    /* const_ptr */
 | 
			
		||||
    op = copy_const_ptr(&begin_op, op, cb->userp);
 | 
			
		||||
 | 
			
		||||
    /* copy the ld_i32, but note that we only have to copy it once */
 | 
			
		||||
    begin_op = QTAILQ_NEXT(begin_op, link);
 | 
			
		||||
    tcg_debug_assert(begin_op && begin_op->opc == INDEX_op_ld_i32);
 | 
			
		||||
    if (*cb_idx == -1) {
 | 
			
		||||
        op = tcg_op_insert_after(tcg_ctx, op, INDEX_op_ld_i32);
 | 
			
		||||
        memcpy(op->args, begin_op->args, sizeof(op->args));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* call */
 | 
			
		||||
    op = copy_call(&begin_op, op, HELPER(plugin_vcpu_udata_cb),
 | 
			
		||||
                   cb->f.vcpu_udata, cb->tcg_flags, cb_idx);
 | 
			
		||||
 | 
			
		||||
    return op;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static TCGOp *append_inline_cb(const struct qemu_plugin_dyn_cb *cb,
 | 
			
		||||
                               TCGOp *begin_op, TCGOp *op,
 | 
			
		||||
                               int *unused)
 | 
			
		||||
{
 | 
			
		||||
    /* const_ptr */
 | 
			
		||||
    op = copy_const_ptr(&begin_op, op, cb->userp);
 | 
			
		||||
 | 
			
		||||
    /* ld_i64 */
 | 
			
		||||
    op = copy_ld_i64(&begin_op, op);
 | 
			
		||||
 | 
			
		||||
    /* add_i64 */
 | 
			
		||||
    op = copy_add_i64(&begin_op, op, cb->inline_insn.imm);
 | 
			
		||||
 | 
			
		||||
    /* st_i64 */
 | 
			
		||||
    op = copy_st_i64(&begin_op, op);
 | 
			
		||||
 | 
			
		||||
    return op;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static TCGOp *append_mem_cb(const struct qemu_plugin_dyn_cb *cb,
 | 
			
		||||
                            TCGOp *begin_op, TCGOp *op, int *cb_idx)
 | 
			
		||||
{
 | 
			
		||||
    enum plugin_gen_cb type = begin_op->args[1];
 | 
			
		||||
 | 
			
		||||
    tcg_debug_assert(type == PLUGIN_GEN_CB_MEM);
 | 
			
		||||
 | 
			
		||||
    /* const_i32 == mov_i32 ("info", so it remains as is) */
 | 
			
		||||
    op = copy_op(&begin_op, op, INDEX_op_mov_i32);
 | 
			
		||||
 | 
			
		||||
    /* const_ptr */
 | 
			
		||||
    op = copy_const_ptr(&begin_op, op, cb->userp);
 | 
			
		||||
 | 
			
		||||
    /* copy the ld_i32, but note that we only have to copy it once */
 | 
			
		||||
    begin_op = QTAILQ_NEXT(begin_op, link);
 | 
			
		||||
    tcg_debug_assert(begin_op && begin_op->opc == INDEX_op_ld_i32);
 | 
			
		||||
    if (*cb_idx == -1) {
 | 
			
		||||
        op = tcg_op_insert_after(tcg_ctx, op, INDEX_op_ld_i32);
 | 
			
		||||
        memcpy(op->args, begin_op->args, sizeof(op->args));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* extu_tl_i64 */
 | 
			
		||||
    op = copy_extu_tl_i64(&begin_op, op);
 | 
			
		||||
 | 
			
		||||
    if (type == PLUGIN_GEN_CB_MEM) {
 | 
			
		||||
        /* call */
 | 
			
		||||
        op = copy_call(&begin_op, op, HELPER(plugin_vcpu_mem_cb),
 | 
			
		||||
                       cb->f.vcpu_udata, cb->tcg_flags, cb_idx);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return op;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
typedef TCGOp *(*inject_fn)(const struct qemu_plugin_dyn_cb *cb,
 | 
			
		||||
                            TCGOp *begin_op, TCGOp *op, int *intp);
 | 
			
		||||
typedef bool (*op_ok_fn)(const TCGOp *op, const struct qemu_plugin_dyn_cb *cb);
 | 
			
		||||
 | 
			
		||||
static bool op_ok(const TCGOp *op, const struct qemu_plugin_dyn_cb *cb)
 | 
			
		||||
{
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static bool op_rw(const TCGOp *op, const struct qemu_plugin_dyn_cb *cb)
 | 
			
		||||
{
 | 
			
		||||
    int w;
 | 
			
		||||
 | 
			
		||||
    w = op->args[2];
 | 
			
		||||
    return !!(cb->rw & (w + 1));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline
 | 
			
		||||
void inject_cb_type(const GArray *cbs, TCGOp *begin_op, inject_fn inject,
 | 
			
		||||
                    op_ok_fn ok)
 | 
			
		||||
{
 | 
			
		||||
    TCGOp *end_op;
 | 
			
		||||
    TCGOp *op;
 | 
			
		||||
    int cb_idx = -1;
 | 
			
		||||
    int i;
 | 
			
		||||
 | 
			
		||||
    if (!cbs || cbs->len == 0) {
 | 
			
		||||
        rm_ops(begin_op);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    end_op = find_op(begin_op, INDEX_op_plugin_cb_end);
 | 
			
		||||
    tcg_debug_assert(end_op);
 | 
			
		||||
 | 
			
		||||
    op = end_op;
 | 
			
		||||
    for (i = 0; i < cbs->len; i++) {
 | 
			
		||||
        struct qemu_plugin_dyn_cb *cb =
 | 
			
		||||
            &g_array_index(cbs, struct qemu_plugin_dyn_cb, i);
 | 
			
		||||
 | 
			
		||||
        if (!ok(begin_op, cb)) {
 | 
			
		||||
            continue;
 | 
			
		||||
        }
 | 
			
		||||
        op = inject(cb, begin_op, op, &cb_idx);
 | 
			
		||||
    }
 | 
			
		||||
    rm_ops_range(begin_op, end_op);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
inject_udata_cb(const GArray *cbs, TCGOp *begin_op)
 | 
			
		||||
{
 | 
			
		||||
    inject_cb_type(cbs, begin_op, append_udata_cb, op_ok);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
inject_inline_cb(const GArray *cbs, TCGOp *begin_op, op_ok_fn ok)
 | 
			
		||||
{
 | 
			
		||||
    inject_cb_type(cbs, begin_op, append_inline_cb, ok);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
inject_mem_cb(const GArray *cbs, TCGOp *begin_op)
 | 
			
		||||
{
 | 
			
		||||
    inject_cb_type(cbs, begin_op, append_mem_cb, op_rw);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* we could change the ops in place, but we can reuse more code by copying */
 | 
			
		||||
static void inject_mem_helper(TCGOp *begin_op, GArray *arr)
 | 
			
		||||
{
 | 
			
		||||
    TCGOp *orig_op = begin_op;
 | 
			
		||||
    TCGOp *end_op;
 | 
			
		||||
    TCGOp *op;
 | 
			
		||||
 | 
			
		||||
    end_op = find_op(begin_op, INDEX_op_plugin_cb_end);
 | 
			
		||||
    tcg_debug_assert(end_op);
 | 
			
		||||
 | 
			
		||||
    /* const ptr */
 | 
			
		||||
    op = copy_const_ptr(&begin_op, end_op, arr);
 | 
			
		||||
 | 
			
		||||
    /* st_ptr */
 | 
			
		||||
    op = copy_st_ptr(&begin_op, op);
 | 
			
		||||
 | 
			
		||||
    rm_ops_range(orig_op, end_op);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Tracking memory accesses performed from helpers requires extra work.
 | 
			
		||||
 * If an instruction is emulated with helpers, we do two things:
 | 
			
		||||
 * (1) copy the CB descriptors, and keep track of it so that they can be
 | 
			
		||||
 * freed later on, and (2) point CPUState.plugin_mem_cbs to the descriptors, so
 | 
			
		||||
 * that we can read them at run-time (i.e. when the helper executes).
 | 
			
		||||
 * This run-time access is performed from qemu_plugin_vcpu_mem_cb.
 | 
			
		||||
 *
 | 
			
		||||
 * Note that plugin_gen_disable_mem_helpers undoes (2). Since it
 | 
			
		||||
 * is possible that the code we generate after the instruction is
 | 
			
		||||
 * dead, we also add checks before generating tb_exit etc.
 | 
			
		||||
 */
 | 
			
		||||
static void inject_mem_enable_helper(struct qemu_plugin_insn *plugin_insn,
 | 
			
		||||
                                     TCGOp *begin_op)
 | 
			
		||||
{
 | 
			
		||||
    GArray *cbs[2];
 | 
			
		||||
    GArray *arr;
 | 
			
		||||
    size_t n_cbs, i;
 | 
			
		||||
 | 
			
		||||
    cbs[0] = plugin_insn->cbs[PLUGIN_CB_MEM][PLUGIN_CB_REGULAR];
 | 
			
		||||
    cbs[1] = plugin_insn->cbs[PLUGIN_CB_MEM][PLUGIN_CB_INLINE];
 | 
			
		||||
 | 
			
		||||
    n_cbs = 0;
 | 
			
		||||
    for (i = 0; i < ARRAY_SIZE(cbs); i++) {
 | 
			
		||||
        n_cbs += cbs[i]->len;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    plugin_insn->mem_helper = plugin_insn->calls_helpers && n_cbs;
 | 
			
		||||
    if (likely(!plugin_insn->mem_helper)) {
 | 
			
		||||
        rm_ops(begin_op);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    arr = g_array_sized_new(false, false,
 | 
			
		||||
                            sizeof(struct qemu_plugin_dyn_cb), n_cbs);
 | 
			
		||||
 | 
			
		||||
    for (i = 0; i < ARRAY_SIZE(cbs); i++) {
 | 
			
		||||
        g_array_append_vals(arr, cbs[i]->data, cbs[i]->len);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    qemu_plugin_add_dyn_cb_arr(arr);
 | 
			
		||||
    inject_mem_helper(begin_op, arr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void inject_mem_disable_helper(struct qemu_plugin_insn *plugin_insn,
 | 
			
		||||
                                      TCGOp *begin_op)
 | 
			
		||||
{
 | 
			
		||||
    if (likely(!plugin_insn->mem_helper)) {
 | 
			
		||||
        rm_ops(begin_op);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    inject_mem_helper(begin_op, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* called before finishing a TB with exit_tb, goto_tb or goto_ptr */
 | 
			
		||||
void plugin_gen_disable_mem_helpers(void)
 | 
			
		||||
{
 | 
			
		||||
    TCGv_ptr ptr;
 | 
			
		||||
 | 
			
		||||
    if (likely(tcg_ctx->plugin_insn == NULL ||
 | 
			
		||||
               !tcg_ctx->plugin_insn->mem_helper)) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    ptr = tcg_const_ptr(NULL);
 | 
			
		||||
    tcg_gen_st_ptr(ptr, cpu_env, offsetof(CPUState, plugin_mem_cbs) -
 | 
			
		||||
                                 offsetof(ArchCPU, env));
 | 
			
		||||
    tcg_temp_free_ptr(ptr);
 | 
			
		||||
    tcg_ctx->plugin_insn->mem_helper = false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void plugin_gen_tb_udata(const struct qemu_plugin_tb *ptb,
 | 
			
		||||
                                TCGOp *begin_op)
 | 
			
		||||
{
 | 
			
		||||
    inject_udata_cb(ptb->cbs[PLUGIN_CB_REGULAR], begin_op);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void plugin_gen_tb_inline(const struct qemu_plugin_tb *ptb,
 | 
			
		||||
                                 TCGOp *begin_op)
 | 
			
		||||
{
 | 
			
		||||
    inject_inline_cb(ptb->cbs[PLUGIN_CB_INLINE], begin_op, op_ok);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void plugin_gen_insn_udata(const struct qemu_plugin_tb *ptb,
 | 
			
		||||
                                  TCGOp *begin_op, int insn_idx)
 | 
			
		||||
{
 | 
			
		||||
    struct qemu_plugin_insn *insn = g_ptr_array_index(ptb->insns, insn_idx);
 | 
			
		||||
 | 
			
		||||
    inject_udata_cb(insn->cbs[PLUGIN_CB_INSN][PLUGIN_CB_REGULAR], begin_op);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void plugin_gen_insn_inline(const struct qemu_plugin_tb *ptb,
 | 
			
		||||
                                   TCGOp *begin_op, int insn_idx)
 | 
			
		||||
{
 | 
			
		||||
    struct qemu_plugin_insn *insn = g_ptr_array_index(ptb->insns, insn_idx);
 | 
			
		||||
    inject_inline_cb(insn->cbs[PLUGIN_CB_INSN][PLUGIN_CB_INLINE],
 | 
			
		||||
                     begin_op, op_ok);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void plugin_gen_mem_regular(const struct qemu_plugin_tb *ptb,
 | 
			
		||||
                                   TCGOp *begin_op, int insn_idx)
 | 
			
		||||
{
 | 
			
		||||
    struct qemu_plugin_insn *insn = g_ptr_array_index(ptb->insns, insn_idx);
 | 
			
		||||
    inject_mem_cb(insn->cbs[PLUGIN_CB_MEM][PLUGIN_CB_REGULAR], begin_op);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void plugin_gen_mem_inline(const struct qemu_plugin_tb *ptb,
 | 
			
		||||
                                  TCGOp *begin_op, int insn_idx)
 | 
			
		||||
{
 | 
			
		||||
    const GArray *cbs;
 | 
			
		||||
    struct qemu_plugin_insn *insn = g_ptr_array_index(ptb->insns, insn_idx);
 | 
			
		||||
 | 
			
		||||
    cbs = insn->cbs[PLUGIN_CB_MEM][PLUGIN_CB_INLINE];
 | 
			
		||||
    inject_inline_cb(cbs, begin_op, op_rw);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void plugin_gen_enable_mem_helper(const struct qemu_plugin_tb *ptb,
 | 
			
		||||
                                         TCGOp *begin_op, int insn_idx)
 | 
			
		||||
{
 | 
			
		||||
    struct qemu_plugin_insn *insn = g_ptr_array_index(ptb->insns, insn_idx);
 | 
			
		||||
    inject_mem_enable_helper(insn, begin_op);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void plugin_gen_disable_mem_helper(const struct qemu_plugin_tb *ptb,
 | 
			
		||||
                                          TCGOp *begin_op, int insn_idx)
 | 
			
		||||
{
 | 
			
		||||
    struct qemu_plugin_insn *insn = g_ptr_array_index(ptb->insns, insn_idx);
 | 
			
		||||
    inject_mem_disable_helper(insn, begin_op);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void plugin_inject_cb(const struct qemu_plugin_tb *ptb, TCGOp *begin_op,
 | 
			
		||||
                             int insn_idx)
 | 
			
		||||
{
 | 
			
		||||
    enum plugin_gen_from from = begin_op->args[0];
 | 
			
		||||
    enum plugin_gen_cb type = begin_op->args[1];
 | 
			
		||||
 | 
			
		||||
    switch (from) {
 | 
			
		||||
    case PLUGIN_GEN_FROM_TB:
 | 
			
		||||
        switch (type) {
 | 
			
		||||
        case PLUGIN_GEN_CB_UDATA:
 | 
			
		||||
            plugin_gen_tb_udata(ptb, begin_op);
 | 
			
		||||
            return;
 | 
			
		||||
        case PLUGIN_GEN_CB_INLINE:
 | 
			
		||||
            plugin_gen_tb_inline(ptb, begin_op);
 | 
			
		||||
            return;
 | 
			
		||||
        default:
 | 
			
		||||
            g_assert_not_reached();
 | 
			
		||||
        }
 | 
			
		||||
    case PLUGIN_GEN_FROM_INSN:
 | 
			
		||||
        switch (type) {
 | 
			
		||||
        case PLUGIN_GEN_CB_UDATA:
 | 
			
		||||
            plugin_gen_insn_udata(ptb, begin_op, insn_idx);
 | 
			
		||||
            return;
 | 
			
		||||
        case PLUGIN_GEN_CB_INLINE:
 | 
			
		||||
            plugin_gen_insn_inline(ptb, begin_op, insn_idx);
 | 
			
		||||
            return;
 | 
			
		||||
        case PLUGIN_GEN_ENABLE_MEM_HELPER:
 | 
			
		||||
            plugin_gen_enable_mem_helper(ptb, begin_op, insn_idx);
 | 
			
		||||
            return;
 | 
			
		||||
        default:
 | 
			
		||||
            g_assert_not_reached();
 | 
			
		||||
        }
 | 
			
		||||
    case PLUGIN_GEN_FROM_MEM:
 | 
			
		||||
        switch (type) {
 | 
			
		||||
        case PLUGIN_GEN_CB_MEM:
 | 
			
		||||
            plugin_gen_mem_regular(ptb, begin_op, insn_idx);
 | 
			
		||||
            return;
 | 
			
		||||
        case PLUGIN_GEN_CB_INLINE:
 | 
			
		||||
            plugin_gen_mem_inline(ptb, begin_op, insn_idx);
 | 
			
		||||
            return;
 | 
			
		||||
        default:
 | 
			
		||||
            g_assert_not_reached();
 | 
			
		||||
        }
 | 
			
		||||
    case PLUGIN_GEN_AFTER_INSN:
 | 
			
		||||
        switch (type) {
 | 
			
		||||
        case PLUGIN_GEN_DISABLE_MEM_HELPER:
 | 
			
		||||
            plugin_gen_disable_mem_helper(ptb, begin_op, insn_idx);
 | 
			
		||||
            return;
 | 
			
		||||
        default:
 | 
			
		||||
            g_assert_not_reached();
 | 
			
		||||
        }
 | 
			
		||||
    default:
 | 
			
		||||
        g_assert_not_reached();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* #define DEBUG_PLUGIN_GEN_OPS */
 | 
			
		||||
static void pr_ops(void)
 | 
			
		||||
{
 | 
			
		||||
#ifdef DEBUG_PLUGIN_GEN_OPS
 | 
			
		||||
    TCGOp *op;
 | 
			
		||||
    int i = 0;
 | 
			
		||||
 | 
			
		||||
    QTAILQ_FOREACH(op, &tcg_ctx->ops, link) {
 | 
			
		||||
        const char *name = "";
 | 
			
		||||
        const char *type = "";
 | 
			
		||||
 | 
			
		||||
        if (op->opc == INDEX_op_plugin_cb_start) {
 | 
			
		||||
            switch (op->args[0]) {
 | 
			
		||||
            case PLUGIN_GEN_FROM_TB:
 | 
			
		||||
                name = "tb";
 | 
			
		||||
                break;
 | 
			
		||||
            case PLUGIN_GEN_FROM_INSN:
 | 
			
		||||
                name = "insn";
 | 
			
		||||
                break;
 | 
			
		||||
            case PLUGIN_GEN_FROM_MEM:
 | 
			
		||||
                name = "mem";
 | 
			
		||||
                break;
 | 
			
		||||
            case PLUGIN_GEN_AFTER_INSN:
 | 
			
		||||
                name = "after insn";
 | 
			
		||||
                break;
 | 
			
		||||
            default:
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
            switch (op->args[1]) {
 | 
			
		||||
            case PLUGIN_GEN_CB_UDATA:
 | 
			
		||||
                type = "udata";
 | 
			
		||||
                break;
 | 
			
		||||
            case PLUGIN_GEN_CB_INLINE:
 | 
			
		||||
                type = "inline";
 | 
			
		||||
                break;
 | 
			
		||||
            case PLUGIN_GEN_CB_MEM:
 | 
			
		||||
                type = "mem";
 | 
			
		||||
                break;
 | 
			
		||||
            case PLUGIN_GEN_ENABLE_MEM_HELPER:
 | 
			
		||||
                type = "enable mem helper";
 | 
			
		||||
                break;
 | 
			
		||||
            case PLUGIN_GEN_DISABLE_MEM_HELPER:
 | 
			
		||||
                type = "disable mem helper";
 | 
			
		||||
                break;
 | 
			
		||||
            default:
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        printf("op[%2i]: %s %s %s\n", i, tcg_op_defs[op->opc].name, name, type);
 | 
			
		||||
        i++;
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void plugin_gen_inject(const struct qemu_plugin_tb *plugin_tb)
 | 
			
		||||
{
 | 
			
		||||
    TCGOp *op;
 | 
			
		||||
    int insn_idx;
 | 
			
		||||
 | 
			
		||||
    pr_ops();
 | 
			
		||||
    insn_idx = -1;
 | 
			
		||||
    QSIMPLEQ_FOREACH(op, &tcg_ctx->plugin_ops, plugin_link) {
 | 
			
		||||
        enum plugin_gen_from from = op->args[0];
 | 
			
		||||
        enum plugin_gen_cb type = op->args[1];
 | 
			
		||||
 | 
			
		||||
        tcg_debug_assert(op->opc == INDEX_op_plugin_cb_start);
 | 
			
		||||
        /* ENABLE_MEM_HELPER is the first callback of an instruction */
 | 
			
		||||
        if (from == PLUGIN_GEN_FROM_INSN &&
 | 
			
		||||
            type == PLUGIN_GEN_ENABLE_MEM_HELPER) {
 | 
			
		||||
            insn_idx++;
 | 
			
		||||
        }
 | 
			
		||||
        plugin_inject_cb(plugin_tb, op, insn_idx);
 | 
			
		||||
    }
 | 
			
		||||
    pr_ops();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool plugin_gen_tb_start(CPUState *cpu, const TranslationBlock *tb, bool mem_only)
 | 
			
		||||
{
 | 
			
		||||
    struct qemu_plugin_tb *ptb = tcg_ctx->plugin_tb;
 | 
			
		||||
    bool ret = false;
 | 
			
		||||
 | 
			
		||||
    if (test_bit(QEMU_PLUGIN_EV_VCPU_TB_TRANS, cpu->plugin_mask)) {
 | 
			
		||||
        ret = true;
 | 
			
		||||
 | 
			
		||||
        QSIMPLEQ_INIT(&tcg_ctx->plugin_ops);
 | 
			
		||||
        ptb->vaddr = tb->pc;
 | 
			
		||||
        ptb->vaddr2 = -1;
 | 
			
		||||
        get_page_addr_code_hostp(cpu->env_ptr, tb->pc, &ptb->haddr1);
 | 
			
		||||
        ptb->haddr2 = NULL;
 | 
			
		||||
        ptb->mem_only = mem_only;
 | 
			
		||||
 | 
			
		||||
        plugin_gen_empty_callback(PLUGIN_GEN_FROM_TB);
 | 
			
		||||
    }
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void plugin_gen_insn_start(CPUState *cpu, const DisasContextBase *db)
 | 
			
		||||
{
 | 
			
		||||
    struct qemu_plugin_tb *ptb = tcg_ctx->plugin_tb;
 | 
			
		||||
    struct qemu_plugin_insn *pinsn;
 | 
			
		||||
 | 
			
		||||
    pinsn = qemu_plugin_tb_insn_get(ptb);
 | 
			
		||||
    tcg_ctx->plugin_insn = pinsn;
 | 
			
		||||
    pinsn->vaddr = db->pc_next;
 | 
			
		||||
    plugin_gen_empty_callback(PLUGIN_GEN_FROM_INSN);
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
     * Detect page crossing to get the new host address.
 | 
			
		||||
     * Note that we skip this when haddr1 == NULL, e.g. when we're
 | 
			
		||||
     * fetching instructions from a region not backed by RAM.
 | 
			
		||||
     */
 | 
			
		||||
    if (likely(ptb->haddr1 != NULL && ptb->vaddr2 == -1) &&
 | 
			
		||||
        unlikely((db->pc_next & TARGET_PAGE_MASK) !=
 | 
			
		||||
                 (db->pc_first & TARGET_PAGE_MASK))) {
 | 
			
		||||
        get_page_addr_code_hostp(cpu->env_ptr, db->pc_next,
 | 
			
		||||
                                 &ptb->haddr2);
 | 
			
		||||
        ptb->vaddr2 = db->pc_next;
 | 
			
		||||
    }
 | 
			
		||||
    if (likely(ptb->vaddr2 == -1)) {
 | 
			
		||||
        pinsn->haddr = ptb->haddr1 + pinsn->vaddr - ptb->vaddr;
 | 
			
		||||
    } else {
 | 
			
		||||
        pinsn->haddr = ptb->haddr2 + pinsn->vaddr - ptb->vaddr2;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void plugin_gen_insn_end(void)
 | 
			
		||||
{
 | 
			
		||||
    plugin_gen_empty_callback(PLUGIN_GEN_AFTER_INSN);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void plugin_gen_tb_end(CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
    struct qemu_plugin_tb *ptb = tcg_ctx->plugin_tb;
 | 
			
		||||
    int i;
 | 
			
		||||
 | 
			
		||||
    /* collect instrumentation requests */
 | 
			
		||||
    qemu_plugin_tb_trans_cb(cpu, ptb);
 | 
			
		||||
 | 
			
		||||
    /* inject the instrumentation at the appropriate places */
 | 
			
		||||
    plugin_gen_inject(ptb);
 | 
			
		||||
 | 
			
		||||
    /* clean up */
 | 
			
		||||
    for (i = 0; i < PLUGIN_N_CB_SUBTYPES; i++) {
 | 
			
		||||
        if (ptb->cbs[i]) {
 | 
			
		||||
            g_array_set_size(ptb->cbs[i], 0);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    ptb->n = 0;
 | 
			
		||||
    tcg_ctx->plugin_insn = NULL;
 | 
			
		||||
}
 | 
			
		||||
@@ -1,5 +0,0 @@
 | 
			
		||||
#ifdef CONFIG_PLUGIN
 | 
			
		||||
/* Note: no TCG flags because those are overwritten later */
 | 
			
		||||
DEF_HELPER_2(plugin_vcpu_udata_cb, void, i32, ptr)
 | 
			
		||||
DEF_HELPER_4(plugin_vcpu_mem_cb, void, i32, i32, i64, ptr)
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1,144 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * QEMU TCG Single Threaded vCPUs implementation using instruction counting
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) 2003-2008 Fabrice Bellard
 | 
			
		||||
 * Copyright (c) 2014 Red Hat Inc.
 | 
			
		||||
 *
 | 
			
		||||
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
 * of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
 * in the Software without restriction, including without limitation the rights
 | 
			
		||||
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
 * copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
 * furnished to do so, subject to the following conditions:
 | 
			
		||||
 *
 | 
			
		||||
 * The above copyright notice and this permission notice shall be included in
 | 
			
		||||
 * all copies or substantial portions of the Software.
 | 
			
		||||
 *
 | 
			
		||||
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 | 
			
		||||
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 | 
			
		||||
 * THE SOFTWARE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "qemu/osdep.h"
 | 
			
		||||
#include "qemu-common.h"
 | 
			
		||||
#include "sysemu/tcg.h"
 | 
			
		||||
#include "sysemu/replay.h"
 | 
			
		||||
#include "qemu/main-loop.h"
 | 
			
		||||
#include "qemu/guest-random.h"
 | 
			
		||||
#include "exec/exec-all.h"
 | 
			
		||||
#include "hw/boards.h"
 | 
			
		||||
 | 
			
		||||
#include "tcg-accel-ops.h"
 | 
			
		||||
#include "tcg-accel-ops-icount.h"
 | 
			
		||||
#include "tcg-accel-ops-rr.h"
 | 
			
		||||
 | 
			
		||||
static int64_t icount_get_limit(void)
 | 
			
		||||
{
 | 
			
		||||
    int64_t deadline;
 | 
			
		||||
 | 
			
		||||
    if (replay_mode != REPLAY_MODE_PLAY) {
 | 
			
		||||
        /*
 | 
			
		||||
         * Include all the timers, because they may need an attention.
 | 
			
		||||
         * Too long CPU execution may create unnecessary delay in UI.
 | 
			
		||||
         */
 | 
			
		||||
        deadline = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL,
 | 
			
		||||
                                              QEMU_TIMER_ATTR_ALL);
 | 
			
		||||
        /* Check realtime timers, because they help with input processing */
 | 
			
		||||
        deadline = qemu_soonest_timeout(deadline,
 | 
			
		||||
                qemu_clock_deadline_ns_all(QEMU_CLOCK_REALTIME,
 | 
			
		||||
                                           QEMU_TIMER_ATTR_ALL));
 | 
			
		||||
 | 
			
		||||
        /*
 | 
			
		||||
         * Maintain prior (possibly buggy) behaviour where if no deadline
 | 
			
		||||
         * was set (as there is no QEMU_CLOCK_VIRTUAL timer) or it is more than
 | 
			
		||||
         * INT32_MAX nanoseconds ahead, we still use INT32_MAX
 | 
			
		||||
         * nanoseconds.
 | 
			
		||||
         */
 | 
			
		||||
        if ((deadline < 0) || (deadline > INT32_MAX)) {
 | 
			
		||||
            deadline = INT32_MAX;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return icount_round(deadline);
 | 
			
		||||
    } else {
 | 
			
		||||
        return replay_get_instructions();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void icount_notify_aio_contexts(void)
 | 
			
		||||
{
 | 
			
		||||
    /* Wake up other AioContexts.  */
 | 
			
		||||
    qemu_clock_notify(QEMU_CLOCK_VIRTUAL);
 | 
			
		||||
    qemu_clock_run_timers(QEMU_CLOCK_VIRTUAL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void icount_handle_deadline(void)
 | 
			
		||||
{
 | 
			
		||||
    assert(qemu_in_vcpu_thread());
 | 
			
		||||
    int64_t deadline = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL,
 | 
			
		||||
                                                  QEMU_TIMER_ATTR_ALL);
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
     * Instructions, interrupts, and exceptions are processed in cpu-exec.
 | 
			
		||||
     * Don't interrupt cpu thread, when these events are waiting
 | 
			
		||||
     * (i.e., there is no checkpoint)
 | 
			
		||||
     */
 | 
			
		||||
    if (deadline == 0
 | 
			
		||||
        && (replay_mode != REPLAY_MODE_PLAY || replay_has_checkpoint())) {
 | 
			
		||||
        icount_notify_aio_contexts();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void icount_prepare_for_run(CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
    int insns_left;
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
     * These should always be cleared by icount_process_data after
 | 
			
		||||
     * each vCPU execution. However u16.high can be raised
 | 
			
		||||
     * asynchronously by cpu_exit/cpu_interrupt/tcg_handle_interrupt
 | 
			
		||||
     */
 | 
			
		||||
    g_assert(cpu_neg(cpu)->icount_decr.u16.low == 0);
 | 
			
		||||
    g_assert(cpu->icount_extra == 0);
 | 
			
		||||
 | 
			
		||||
    cpu->icount_budget = icount_get_limit();
 | 
			
		||||
    insns_left = MIN(0xffff, cpu->icount_budget);
 | 
			
		||||
    cpu_neg(cpu)->icount_decr.u16.low = insns_left;
 | 
			
		||||
    cpu->icount_extra = cpu->icount_budget - insns_left;
 | 
			
		||||
 | 
			
		||||
    replay_mutex_lock();
 | 
			
		||||
 | 
			
		||||
    if (cpu->icount_budget == 0 && replay_has_checkpoint()) {
 | 
			
		||||
        icount_notify_aio_contexts();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void icount_process_data(CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
    /* Account for executed instructions */
 | 
			
		||||
    icount_update(cpu);
 | 
			
		||||
 | 
			
		||||
    /* Reset the counters */
 | 
			
		||||
    cpu_neg(cpu)->icount_decr.u16.low = 0;
 | 
			
		||||
    cpu->icount_extra = 0;
 | 
			
		||||
    cpu->icount_budget = 0;
 | 
			
		||||
 | 
			
		||||
    replay_account_executed_instructions();
 | 
			
		||||
 | 
			
		||||
    replay_mutex_unlock();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void icount_handle_interrupt(CPUState *cpu, int mask)
 | 
			
		||||
{
 | 
			
		||||
    int old_mask = cpu->interrupt_request;
 | 
			
		||||
 | 
			
		||||
    tcg_handle_interrupt(cpu, mask);
 | 
			
		||||
    if (qemu_cpu_is_self(cpu) &&
 | 
			
		||||
        !cpu->can_do_io
 | 
			
		||||
        && (mask & ~old_mask) != 0) {
 | 
			
		||||
        cpu_abort(cpu, "Raised interrupt while not in I/O function");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,19 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * QEMU TCG Single Threaded vCPUs implementation using instruction counting
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright 2020 SUSE LLC
 | 
			
		||||
 *
 | 
			
		||||
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 | 
			
		||||
 * See the COPYING file in the top-level directory.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef TCG_CPUS_ICOUNT_H
 | 
			
		||||
#define TCG_CPUS_ICOUNT_H
 | 
			
		||||
 | 
			
		||||
void icount_handle_deadline(void);
 | 
			
		||||
void icount_prepare_for_run(CPUState *cpu);
 | 
			
		||||
void icount_process_data(CPUState *cpu);
 | 
			
		||||
 | 
			
		||||
void icount_handle_interrupt(CPUState *cpu, int mask);
 | 
			
		||||
 | 
			
		||||
#endif /* TCG_CPUS_ICOUNT_H */
 | 
			
		||||
@@ -1,133 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * QEMU TCG Multi Threaded vCPUs implementation
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) 2003-2008 Fabrice Bellard
 | 
			
		||||
 * Copyright (c) 2014 Red Hat Inc.
 | 
			
		||||
 *
 | 
			
		||||
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
 * of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
 * in the Software without restriction, including without limitation the rights
 | 
			
		||||
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
 * copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
 * furnished to do so, subject to the following conditions:
 | 
			
		||||
 *
 | 
			
		||||
 * The above copyright notice and this permission notice shall be included in
 | 
			
		||||
 * all copies or substantial portions of the Software.
 | 
			
		||||
 *
 | 
			
		||||
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 | 
			
		||||
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 | 
			
		||||
 * THE SOFTWARE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "qemu/osdep.h"
 | 
			
		||||
#include "qemu-common.h"
 | 
			
		||||
#include "sysemu/tcg.h"
 | 
			
		||||
#include "sysemu/replay.h"
 | 
			
		||||
#include "qemu/main-loop.h"
 | 
			
		||||
#include "qemu/guest-random.h"
 | 
			
		||||
#include "exec/exec-all.h"
 | 
			
		||||
#include "hw/boards.h"
 | 
			
		||||
 | 
			
		||||
#include "tcg-accel-ops.h"
 | 
			
		||||
#include "tcg-accel-ops-mttcg.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * In the multi-threaded case each vCPU has its own thread. The TLS
 | 
			
		||||
 * variable current_cpu can be used deep in the code to find the
 | 
			
		||||
 * current CPUState for a given thread.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
static void *mttcg_cpu_thread_fn(void *arg)
 | 
			
		||||
{
 | 
			
		||||
    CPUState *cpu = arg;
 | 
			
		||||
 | 
			
		||||
    assert(tcg_enabled());
 | 
			
		||||
    g_assert(!icount_enabled());
 | 
			
		||||
 | 
			
		||||
    rcu_register_thread();
 | 
			
		||||
    tcg_register_thread();
 | 
			
		||||
 | 
			
		||||
    qemu_mutex_lock_iothread();
 | 
			
		||||
    qemu_thread_get_self(cpu->thread);
 | 
			
		||||
 | 
			
		||||
    cpu->thread_id = qemu_get_thread_id();
 | 
			
		||||
    cpu->can_do_io = 1;
 | 
			
		||||
    current_cpu = cpu;
 | 
			
		||||
    cpu_thread_signal_created(cpu);
 | 
			
		||||
    qemu_guest_random_seed_thread_part2(cpu->random_seed);
 | 
			
		||||
 | 
			
		||||
    /* process any pending work */
 | 
			
		||||
    cpu->exit_request = 1;
 | 
			
		||||
 | 
			
		||||
    do {
 | 
			
		||||
        if (cpu_can_run(cpu)) {
 | 
			
		||||
            int r;
 | 
			
		||||
            qemu_mutex_unlock_iothread();
 | 
			
		||||
            r = tcg_cpus_exec(cpu);
 | 
			
		||||
            qemu_mutex_lock_iothread();
 | 
			
		||||
            switch (r) {
 | 
			
		||||
            case EXCP_DEBUG:
 | 
			
		||||
                cpu_handle_guest_debug(cpu);
 | 
			
		||||
                break;
 | 
			
		||||
            case EXCP_HALTED:
 | 
			
		||||
                /*
 | 
			
		||||
                 * during start-up the vCPU is reset and the thread is
 | 
			
		||||
                 * kicked several times. If we don't ensure we go back
 | 
			
		||||
                 * to sleep in the halted state we won't cleanly
 | 
			
		||||
                 * start-up when the vCPU is enabled.
 | 
			
		||||
                 *
 | 
			
		||||
                 * cpu->halted should ensure we sleep in wait_io_event
 | 
			
		||||
                 */
 | 
			
		||||
                g_assert(cpu->halted);
 | 
			
		||||
                break;
 | 
			
		||||
            case EXCP_ATOMIC:
 | 
			
		||||
                qemu_mutex_unlock_iothread();
 | 
			
		||||
                cpu_exec_step_atomic(cpu);
 | 
			
		||||
                qemu_mutex_lock_iothread();
 | 
			
		||||
            default:
 | 
			
		||||
                /* Ignore everything else? */
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        qatomic_mb_set(&cpu->exit_request, 0);
 | 
			
		||||
        qemu_wait_io_event(cpu);
 | 
			
		||||
    } while (!cpu->unplug || cpu_can_run(cpu));
 | 
			
		||||
 | 
			
		||||
    tcg_cpus_destroy(cpu);
 | 
			
		||||
    qemu_mutex_unlock_iothread();
 | 
			
		||||
    rcu_unregister_thread();
 | 
			
		||||
    return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void mttcg_kick_vcpu_thread(CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
    cpu_exit(cpu);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void mttcg_start_vcpu_thread(CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
    char thread_name[VCPU_THREAD_NAME_SIZE];
 | 
			
		||||
 | 
			
		||||
    g_assert(tcg_enabled());
 | 
			
		||||
    tcg_cpu_init_cflags(cpu, current_machine->smp.max_cpus > 1);
 | 
			
		||||
 | 
			
		||||
    cpu->thread = g_malloc0(sizeof(QemuThread));
 | 
			
		||||
    cpu->halt_cond = g_malloc0(sizeof(QemuCond));
 | 
			
		||||
    qemu_cond_init(cpu->halt_cond);
 | 
			
		||||
 | 
			
		||||
    /* create a thread per vCPU with TCG (MTTCG) */
 | 
			
		||||
    snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/TCG",
 | 
			
		||||
             cpu->cpu_index);
 | 
			
		||||
 | 
			
		||||
    qemu_thread_create(cpu->thread, thread_name, mttcg_cpu_thread_fn,
 | 
			
		||||
                       cpu, QEMU_THREAD_JOINABLE);
 | 
			
		||||
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
    cpu->hThread = qemu_thread_get_handle(cpu->thread);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
@@ -1,19 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * QEMU TCG Multi Threaded vCPUs implementation
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright 2021 SUSE LLC
 | 
			
		||||
 *
 | 
			
		||||
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 | 
			
		||||
 * See the COPYING file in the top-level directory.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef TCG_CPUS_MTTCG_H
 | 
			
		||||
#define TCG_CPUS_MTTCG_H
 | 
			
		||||
 | 
			
		||||
/* kick MTTCG vCPU thread */
 | 
			
		||||
void mttcg_kick_vcpu_thread(CPUState *cpu);
 | 
			
		||||
 | 
			
		||||
/* start an mttcg vCPU thread */
 | 
			
		||||
void mttcg_start_vcpu_thread(CPUState *cpu);
 | 
			
		||||
 | 
			
		||||
#endif /* TCG_CPUS_MTTCG_H */
 | 
			
		||||
@@ -1,298 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * QEMU TCG Single Threaded vCPUs implementation
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) 2003-2008 Fabrice Bellard
 | 
			
		||||
 * Copyright (c) 2014 Red Hat Inc.
 | 
			
		||||
 *
 | 
			
		||||
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
 * of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
 * in the Software without restriction, including without limitation the rights
 | 
			
		||||
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
 * copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
 * furnished to do so, subject to the following conditions:
 | 
			
		||||
 *
 | 
			
		||||
 * The above copyright notice and this permission notice shall be included in
 | 
			
		||||
 * all copies or substantial portions of the Software.
 | 
			
		||||
 *
 | 
			
		||||
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 | 
			
		||||
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 | 
			
		||||
 * THE SOFTWARE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "qemu/osdep.h"
 | 
			
		||||
#include "qemu-common.h"
 | 
			
		||||
#include "sysemu/tcg.h"
 | 
			
		||||
#include "sysemu/replay.h"
 | 
			
		||||
#include "qemu/main-loop.h"
 | 
			
		||||
#include "qemu/guest-random.h"
 | 
			
		||||
#include "exec/exec-all.h"
 | 
			
		||||
#include "hw/boards.h"
 | 
			
		||||
 | 
			
		||||
#include "tcg-accel-ops.h"
 | 
			
		||||
#include "tcg-accel-ops-rr.h"
 | 
			
		||||
#include "tcg-accel-ops-icount.h"
 | 
			
		||||
 | 
			
		||||
/* Kick all RR vCPUs */
 | 
			
		||||
void rr_kick_vcpu_thread(CPUState *unused)
 | 
			
		||||
{
 | 
			
		||||
    CPUState *cpu;
 | 
			
		||||
 | 
			
		||||
    CPU_FOREACH(cpu) {
 | 
			
		||||
        cpu_exit(cpu);
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * TCG vCPU kick timer
 | 
			
		||||
 *
 | 
			
		||||
 * The kick timer is responsible for moving single threaded vCPU
 | 
			
		||||
 * emulation on to the next vCPU. If more than one vCPU is running a
 | 
			
		||||
 * timer event with force a cpu->exit so the next vCPU can get
 | 
			
		||||
 * scheduled.
 | 
			
		||||
 *
 | 
			
		||||
 * The timer is removed if all vCPUs are idle and restarted again once
 | 
			
		||||
 * idleness is complete.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
static QEMUTimer *rr_kick_vcpu_timer;
 | 
			
		||||
static CPUState *rr_current_cpu;
 | 
			
		||||
 | 
			
		||||
#define TCG_KICK_PERIOD (NANOSECONDS_PER_SECOND / 10)
 | 
			
		||||
 | 
			
		||||
static inline int64_t rr_next_kick_time(void)
 | 
			
		||||
{
 | 
			
		||||
    return qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + TCG_KICK_PERIOD;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Kick the currently round-robin scheduled vCPU to next */
 | 
			
		||||
static void rr_kick_next_cpu(void)
 | 
			
		||||
{
 | 
			
		||||
    CPUState *cpu;
 | 
			
		||||
    do {
 | 
			
		||||
        cpu = qatomic_mb_read(&rr_current_cpu);
 | 
			
		||||
        if (cpu) {
 | 
			
		||||
            cpu_exit(cpu);
 | 
			
		||||
        }
 | 
			
		||||
    } while (cpu != qatomic_mb_read(&rr_current_cpu));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void rr_kick_thread(void *opaque)
 | 
			
		||||
{
 | 
			
		||||
    timer_mod(rr_kick_vcpu_timer, rr_next_kick_time());
 | 
			
		||||
    rr_kick_next_cpu();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void rr_start_kick_timer(void)
 | 
			
		||||
{
 | 
			
		||||
    if (!rr_kick_vcpu_timer && CPU_NEXT(first_cpu)) {
 | 
			
		||||
        rr_kick_vcpu_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL,
 | 
			
		||||
                                           rr_kick_thread, NULL);
 | 
			
		||||
    }
 | 
			
		||||
    if (rr_kick_vcpu_timer && !timer_pending(rr_kick_vcpu_timer)) {
 | 
			
		||||
        timer_mod(rr_kick_vcpu_timer, rr_next_kick_time());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void rr_stop_kick_timer(void)
 | 
			
		||||
{
 | 
			
		||||
    if (rr_kick_vcpu_timer && timer_pending(rr_kick_vcpu_timer)) {
 | 
			
		||||
        timer_del(rr_kick_vcpu_timer);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void rr_wait_io_event(void)
 | 
			
		||||
{
 | 
			
		||||
    CPUState *cpu;
 | 
			
		||||
 | 
			
		||||
    while (all_cpu_threads_idle()) {
 | 
			
		||||
        rr_stop_kick_timer();
 | 
			
		||||
        qemu_cond_wait_iothread(first_cpu->halt_cond);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    rr_start_kick_timer();
 | 
			
		||||
 | 
			
		||||
    CPU_FOREACH(cpu) {
 | 
			
		||||
        qemu_wait_io_event_common(cpu);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Destroy any remaining vCPUs which have been unplugged and have
 | 
			
		||||
 * finished running
 | 
			
		||||
 */
 | 
			
		||||
static void rr_deal_with_unplugged_cpus(void)
 | 
			
		||||
{
 | 
			
		||||
    CPUState *cpu;
 | 
			
		||||
 | 
			
		||||
    CPU_FOREACH(cpu) {
 | 
			
		||||
        if (cpu->unplug && !cpu_can_run(cpu)) {
 | 
			
		||||
            tcg_cpus_destroy(cpu);
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * In the single-threaded case each vCPU is simulated in turn. If
 | 
			
		||||
 * there is more than a single vCPU we create a simple timer to kick
 | 
			
		||||
 * the vCPU and ensure we don't get stuck in a tight loop in one vCPU.
 | 
			
		||||
 * This is done explicitly rather than relying on side-effects
 | 
			
		||||
 * elsewhere.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
static void *rr_cpu_thread_fn(void *arg)
 | 
			
		||||
{
 | 
			
		||||
    CPUState *cpu = arg;
 | 
			
		||||
 | 
			
		||||
    assert(tcg_enabled());
 | 
			
		||||
    rcu_register_thread();
 | 
			
		||||
    tcg_register_thread();
 | 
			
		||||
 | 
			
		||||
    qemu_mutex_lock_iothread();
 | 
			
		||||
    qemu_thread_get_self(cpu->thread);
 | 
			
		||||
 | 
			
		||||
    cpu->thread_id = qemu_get_thread_id();
 | 
			
		||||
    cpu->can_do_io = 1;
 | 
			
		||||
    cpu_thread_signal_created(cpu);
 | 
			
		||||
    qemu_guest_random_seed_thread_part2(cpu->random_seed);
 | 
			
		||||
 | 
			
		||||
    /* wait for initial kick-off after machine start */
 | 
			
		||||
    while (first_cpu->stopped) {
 | 
			
		||||
        qemu_cond_wait_iothread(first_cpu->halt_cond);
 | 
			
		||||
 | 
			
		||||
        /* process any pending work */
 | 
			
		||||
        CPU_FOREACH(cpu) {
 | 
			
		||||
            current_cpu = cpu;
 | 
			
		||||
            qemu_wait_io_event_common(cpu);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    rr_start_kick_timer();
 | 
			
		||||
 | 
			
		||||
    cpu = first_cpu;
 | 
			
		||||
 | 
			
		||||
    /* process any pending work */
 | 
			
		||||
    cpu->exit_request = 1;
 | 
			
		||||
 | 
			
		||||
    while (1) {
 | 
			
		||||
        qemu_mutex_unlock_iothread();
 | 
			
		||||
        replay_mutex_lock();
 | 
			
		||||
        qemu_mutex_lock_iothread();
 | 
			
		||||
 | 
			
		||||
        if (icount_enabled()) {
 | 
			
		||||
            /* Account partial waits to QEMU_CLOCK_VIRTUAL.  */
 | 
			
		||||
            icount_account_warp_timer();
 | 
			
		||||
            /*
 | 
			
		||||
             * Run the timers here.  This is much more efficient than
 | 
			
		||||
             * waking up the I/O thread and waiting for completion.
 | 
			
		||||
             */
 | 
			
		||||
            icount_handle_deadline();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        replay_mutex_unlock();
 | 
			
		||||
 | 
			
		||||
        if (!cpu) {
 | 
			
		||||
            cpu = first_cpu;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        while (cpu && cpu_work_list_empty(cpu) && !cpu->exit_request) {
 | 
			
		||||
 | 
			
		||||
            qatomic_mb_set(&rr_current_cpu, cpu);
 | 
			
		||||
            current_cpu = cpu;
 | 
			
		||||
 | 
			
		||||
            qemu_clock_enable(QEMU_CLOCK_VIRTUAL,
 | 
			
		||||
                              (cpu->singlestep_enabled & SSTEP_NOTIMER) == 0);
 | 
			
		||||
 | 
			
		||||
            if (cpu_can_run(cpu)) {
 | 
			
		||||
                int r;
 | 
			
		||||
 | 
			
		||||
                qemu_mutex_unlock_iothread();
 | 
			
		||||
                if (icount_enabled()) {
 | 
			
		||||
                    icount_prepare_for_run(cpu);
 | 
			
		||||
                }
 | 
			
		||||
                r = tcg_cpus_exec(cpu);
 | 
			
		||||
                if (icount_enabled()) {
 | 
			
		||||
                    icount_process_data(cpu);
 | 
			
		||||
                }
 | 
			
		||||
                qemu_mutex_lock_iothread();
 | 
			
		||||
 | 
			
		||||
                if (r == EXCP_DEBUG) {
 | 
			
		||||
                    cpu_handle_guest_debug(cpu);
 | 
			
		||||
                    break;
 | 
			
		||||
                } else if (r == EXCP_ATOMIC) {
 | 
			
		||||
                    qemu_mutex_unlock_iothread();
 | 
			
		||||
                    cpu_exec_step_atomic(cpu);
 | 
			
		||||
                    qemu_mutex_lock_iothread();
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
            } else if (cpu->stop) {
 | 
			
		||||
                if (cpu->unplug) {
 | 
			
		||||
                    cpu = CPU_NEXT(cpu);
 | 
			
		||||
                }
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            cpu = CPU_NEXT(cpu);
 | 
			
		||||
        } /* while (cpu && !cpu->exit_request).. */
 | 
			
		||||
 | 
			
		||||
        /* Does not need qatomic_mb_set because a spurious wakeup is okay.  */
 | 
			
		||||
        qatomic_set(&rr_current_cpu, NULL);
 | 
			
		||||
 | 
			
		||||
        if (cpu && cpu->exit_request) {
 | 
			
		||||
            qatomic_mb_set(&cpu->exit_request, 0);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (icount_enabled() && all_cpu_threads_idle()) {
 | 
			
		||||
            /*
 | 
			
		||||
             * When all cpus are sleeping (e.g in WFI), to avoid a deadlock
 | 
			
		||||
             * in the main_loop, wake it up in order to start the warp timer.
 | 
			
		||||
             */
 | 
			
		||||
            qemu_notify_event();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        rr_wait_io_event();
 | 
			
		||||
        rr_deal_with_unplugged_cpus();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    rcu_unregister_thread();
 | 
			
		||||
    return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void rr_start_vcpu_thread(CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
    char thread_name[VCPU_THREAD_NAME_SIZE];
 | 
			
		||||
    static QemuCond *single_tcg_halt_cond;
 | 
			
		||||
    static QemuThread *single_tcg_cpu_thread;
 | 
			
		||||
 | 
			
		||||
    g_assert(tcg_enabled());
 | 
			
		||||
    tcg_cpu_init_cflags(cpu, false);
 | 
			
		||||
 | 
			
		||||
    if (!single_tcg_cpu_thread) {
 | 
			
		||||
        cpu->thread = g_malloc0(sizeof(QemuThread));
 | 
			
		||||
        cpu->halt_cond = g_malloc0(sizeof(QemuCond));
 | 
			
		||||
        qemu_cond_init(cpu->halt_cond);
 | 
			
		||||
 | 
			
		||||
        /* share a single thread for all cpus with TCG */
 | 
			
		||||
        snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "ALL CPUs/TCG");
 | 
			
		||||
        qemu_thread_create(cpu->thread, thread_name,
 | 
			
		||||
                           rr_cpu_thread_fn,
 | 
			
		||||
                           cpu, QEMU_THREAD_JOINABLE);
 | 
			
		||||
 | 
			
		||||
        single_tcg_halt_cond = cpu->halt_cond;
 | 
			
		||||
        single_tcg_cpu_thread = cpu->thread;
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
        cpu->hThread = qemu_thread_get_handle(cpu->thread);
 | 
			
		||||
#endif
 | 
			
		||||
    } else {
 | 
			
		||||
        /* we share the thread */
 | 
			
		||||
        cpu->thread = single_tcg_cpu_thread;
 | 
			
		||||
        cpu->halt_cond = single_tcg_halt_cond;
 | 
			
		||||
        cpu->thread_id = first_cpu->thread_id;
 | 
			
		||||
        cpu->can_do_io = 1;
 | 
			
		||||
        cpu->created = true;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,21 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * QEMU TCG Single Threaded vCPUs implementation
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright 2020 SUSE LLC
 | 
			
		||||
 *
 | 
			
		||||
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 | 
			
		||||
 * See the COPYING file in the top-level directory.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef TCG_CPUS_RR_H
 | 
			
		||||
#define TCG_CPUS_RR_H
 | 
			
		||||
 | 
			
		||||
#define TCG_KICK_PERIOD (NANOSECONDS_PER_SECOND / 10)
 | 
			
		||||
 | 
			
		||||
/* Kick all RR vCPUs. */
 | 
			
		||||
void rr_kick_vcpu_thread(CPUState *unused);
 | 
			
		||||
 | 
			
		||||
/* start the round robin vcpu thread */
 | 
			
		||||
void rr_start_vcpu_thread(CPUState *cpu);
 | 
			
		||||
 | 
			
		||||
#endif /* TCG_CPUS_RR_H */
 | 
			
		||||
@@ -1,133 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * QEMU TCG vCPU common functionality
 | 
			
		||||
 *
 | 
			
		||||
 * Functionality common to all TCG vCPU variants: mttcg, rr and icount.
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) 2003-2008 Fabrice Bellard
 | 
			
		||||
 * Copyright (c) 2014 Red Hat Inc.
 | 
			
		||||
 *
 | 
			
		||||
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
 * of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
 * in the Software without restriction, including without limitation the rights
 | 
			
		||||
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
 * copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
 * furnished to do so, subject to the following conditions:
 | 
			
		||||
 *
 | 
			
		||||
 * The above copyright notice and this permission notice shall be included in
 | 
			
		||||
 * all copies or substantial portions of the Software.
 | 
			
		||||
 *
 | 
			
		||||
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 | 
			
		||||
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 | 
			
		||||
 * THE SOFTWARE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "qemu/osdep.h"
 | 
			
		||||
#include "qemu-common.h"
 | 
			
		||||
#include "sysemu/tcg.h"
 | 
			
		||||
#include "sysemu/replay.h"
 | 
			
		||||
#include "qemu/main-loop.h"
 | 
			
		||||
#include "qemu/guest-random.h"
 | 
			
		||||
#include "exec/exec-all.h"
 | 
			
		||||
#include "hw/boards.h"
 | 
			
		||||
 | 
			
		||||
#include "tcg-accel-ops.h"
 | 
			
		||||
#include "tcg-accel-ops-mttcg.h"
 | 
			
		||||
#include "tcg-accel-ops-rr.h"
 | 
			
		||||
#include "tcg-accel-ops-icount.h"
 | 
			
		||||
 | 
			
		||||
/* common functionality among all TCG variants */
 | 
			
		||||
 | 
			
		||||
void tcg_cpu_init_cflags(CPUState *cpu, bool parallel)
 | 
			
		||||
{
 | 
			
		||||
    uint32_t cflags = cpu->cluster_index << CF_CLUSTER_SHIFT;
 | 
			
		||||
    cflags |= parallel ? CF_PARALLEL : 0;
 | 
			
		||||
    cflags |= icount_enabled() ? CF_USE_ICOUNT : 0;
 | 
			
		||||
    cpu->tcg_cflags = cflags;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void tcg_cpus_destroy(CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
    cpu_thread_signal_destroyed(cpu);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int tcg_cpus_exec(CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
    int ret;
 | 
			
		||||
#ifdef CONFIG_PROFILER
 | 
			
		||||
    int64_t ti;
 | 
			
		||||
#endif
 | 
			
		||||
    assert(tcg_enabled());
 | 
			
		||||
#ifdef CONFIG_PROFILER
 | 
			
		||||
    ti = profile_getclock();
 | 
			
		||||
#endif
 | 
			
		||||
    cpu_exec_start(cpu);
 | 
			
		||||
    ret = cpu_exec(cpu);
 | 
			
		||||
    cpu_exec_end(cpu);
 | 
			
		||||
#ifdef CONFIG_PROFILER
 | 
			
		||||
    qatomic_set(&tcg_ctx->prof.cpu_exec_time,
 | 
			
		||||
                tcg_ctx->prof.cpu_exec_time + profile_getclock() - ti);
 | 
			
		||||
#endif
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* mask must never be zero, except for A20 change call */
 | 
			
		||||
void tcg_handle_interrupt(CPUState *cpu, int mask)
 | 
			
		||||
{
 | 
			
		||||
    g_assert(qemu_mutex_iothread_locked());
 | 
			
		||||
 | 
			
		||||
    cpu->interrupt_request |= mask;
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
     * If called from iothread context, wake the target cpu in
 | 
			
		||||
     * case its halted.
 | 
			
		||||
     */
 | 
			
		||||
    if (!qemu_cpu_is_self(cpu)) {
 | 
			
		||||
        qemu_cpu_kick(cpu);
 | 
			
		||||
    } else {
 | 
			
		||||
        qatomic_set(&cpu_neg(cpu)->icount_decr.u16.high, -1);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void tcg_accel_ops_init(AccelOpsClass *ops)
 | 
			
		||||
{
 | 
			
		||||
    if (qemu_tcg_mttcg_enabled()) {
 | 
			
		||||
        ops->create_vcpu_thread = mttcg_start_vcpu_thread;
 | 
			
		||||
        ops->kick_vcpu_thread = mttcg_kick_vcpu_thread;
 | 
			
		||||
        ops->handle_interrupt = tcg_handle_interrupt;
 | 
			
		||||
    } else if (icount_enabled()) {
 | 
			
		||||
        ops->create_vcpu_thread = rr_start_vcpu_thread;
 | 
			
		||||
        ops->kick_vcpu_thread = rr_kick_vcpu_thread;
 | 
			
		||||
        ops->handle_interrupt = icount_handle_interrupt;
 | 
			
		||||
        ops->get_virtual_clock = icount_get;
 | 
			
		||||
        ops->get_elapsed_ticks = icount_get;
 | 
			
		||||
    } else {
 | 
			
		||||
        ops->create_vcpu_thread = rr_start_vcpu_thread;
 | 
			
		||||
        ops->kick_vcpu_thread = rr_kick_vcpu_thread;
 | 
			
		||||
        ops->handle_interrupt = tcg_handle_interrupt;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void tcg_accel_ops_class_init(ObjectClass *oc, void *data)
 | 
			
		||||
{
 | 
			
		||||
    AccelOpsClass *ops = ACCEL_OPS_CLASS(oc);
 | 
			
		||||
 | 
			
		||||
    ops->ops_init = tcg_accel_ops_init;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const TypeInfo tcg_accel_ops_type = {
 | 
			
		||||
    .name = ACCEL_OPS_NAME("tcg"),
 | 
			
		||||
 | 
			
		||||
    .parent = TYPE_ACCEL_OPS,
 | 
			
		||||
    .class_init = tcg_accel_ops_class_init,
 | 
			
		||||
    .abstract = true,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static void tcg_accel_ops_register_types(void)
 | 
			
		||||
{
 | 
			
		||||
    type_register_static(&tcg_accel_ops_type);
 | 
			
		||||
}
 | 
			
		||||
type_init(tcg_accel_ops_register_types);
 | 
			
		||||
@@ -1,22 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * QEMU TCG vCPU common functionality
 | 
			
		||||
 *
 | 
			
		||||
 * Functionality common to all TCG vcpu variants: mttcg, rr and icount.
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright 2020 SUSE LLC
 | 
			
		||||
 *
 | 
			
		||||
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 | 
			
		||||
 * See the COPYING file in the top-level directory.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef TCG_CPUS_H
 | 
			
		||||
#define TCG_CPUS_H
 | 
			
		||||
 | 
			
		||||
#include "sysemu/cpus.h"
 | 
			
		||||
 | 
			
		||||
void tcg_cpus_destroy(CPUState *cpu);
 | 
			
		||||
int tcg_cpus_exec(CPUState *cpu);
 | 
			
		||||
void tcg_handle_interrupt(CPUState *cpu, int mask);
 | 
			
		||||
void tcg_cpu_init_cflags(CPUState *cpu, bool parallel);
 | 
			
		||||
 | 
			
		||||
#endif /* TCG_CPUS_H */
 | 
			
		||||
@@ -1,235 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * QEMU System Emulator, accelerator interfaces
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) 2003-2008 Fabrice Bellard
 | 
			
		||||
 * Copyright (c) 2014 Red Hat Inc.
 | 
			
		||||
 *
 | 
			
		||||
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
 * of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
 * in the Software without restriction, including without limitation the rights
 | 
			
		||||
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
 * copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
 * furnished to do so, subject to the following conditions:
 | 
			
		||||
 *
 | 
			
		||||
 * The above copyright notice and this permission notice shall be included in
 | 
			
		||||
 * all copies or substantial portions of the Software.
 | 
			
		||||
 *
 | 
			
		||||
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 | 
			
		||||
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 | 
			
		||||
 * THE SOFTWARE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "qemu/osdep.h"
 | 
			
		||||
#include "qemu-common.h"
 | 
			
		||||
#include "sysemu/tcg.h"
 | 
			
		||||
#include "sysemu/cpu-timers.h"
 | 
			
		||||
#include "tcg/tcg.h"
 | 
			
		||||
#include "qapi/error.h"
 | 
			
		||||
#include "qemu/error-report.h"
 | 
			
		||||
#include "qemu/accel.h"
 | 
			
		||||
#include "qapi/qapi-builtin-visit.h"
 | 
			
		||||
 | 
			
		||||
struct TCGState {
 | 
			
		||||
    AccelState parent_obj;
 | 
			
		||||
 | 
			
		||||
    bool mttcg_enabled;
 | 
			
		||||
    int splitwx_enabled;
 | 
			
		||||
    unsigned long tb_size;
 | 
			
		||||
};
 | 
			
		||||
typedef struct TCGState TCGState;
 | 
			
		||||
 | 
			
		||||
#define TYPE_TCG_ACCEL ACCEL_CLASS_NAME("tcg")
 | 
			
		||||
 | 
			
		||||
DECLARE_INSTANCE_CHECKER(TCGState, TCG_STATE,
 | 
			
		||||
                         TYPE_TCG_ACCEL)
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * We default to false if we know other options have been enabled
 | 
			
		||||
 * which are currently incompatible with MTTCG. Otherwise when each
 | 
			
		||||
 * guest (target) has been updated to support:
 | 
			
		||||
 *   - atomic instructions
 | 
			
		||||
 *   - memory ordering primitives (barriers)
 | 
			
		||||
 * they can set the appropriate CONFIG flags in ${target}-softmmu.mak
 | 
			
		||||
 *
 | 
			
		||||
 * Once a guest architecture has been converted to the new primitives
 | 
			
		||||
 * there are two remaining limitations to check.
 | 
			
		||||
 *
 | 
			
		||||
 * - The guest can't be oversized (e.g. 64 bit guest on 32 bit host)
 | 
			
		||||
 * - The host must have a stronger memory order than the guest
 | 
			
		||||
 *
 | 
			
		||||
 * It may be possible in future to support strong guests on weak hosts
 | 
			
		||||
 * but that will require tagging all load/stores in a guest with their
 | 
			
		||||
 * implicit memory order requirements which would likely slow things
 | 
			
		||||
 * down a lot.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
static bool check_tcg_memory_orders_compatible(void)
 | 
			
		||||
{
 | 
			
		||||
#if defined(TCG_GUEST_DEFAULT_MO) && defined(TCG_TARGET_DEFAULT_MO)
 | 
			
		||||
    return (TCG_GUEST_DEFAULT_MO & ~TCG_TARGET_DEFAULT_MO) == 0;
 | 
			
		||||
#else
 | 
			
		||||
    return false;
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static bool default_mttcg_enabled(void)
 | 
			
		||||
{
 | 
			
		||||
    if (icount_enabled() || TCG_OVERSIZED_GUEST) {
 | 
			
		||||
        return false;
 | 
			
		||||
    } else {
 | 
			
		||||
#ifdef TARGET_SUPPORTS_MTTCG
 | 
			
		||||
        return check_tcg_memory_orders_compatible();
 | 
			
		||||
#else
 | 
			
		||||
        return false;
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void tcg_accel_instance_init(Object *obj)
 | 
			
		||||
{
 | 
			
		||||
    TCGState *s = TCG_STATE(obj);
 | 
			
		||||
 | 
			
		||||
    s->mttcg_enabled = default_mttcg_enabled();
 | 
			
		||||
 | 
			
		||||
    /* If debugging enabled, default "auto on", otherwise off. */
 | 
			
		||||
#if defined(CONFIG_DEBUG_TCG) && !defined(CONFIG_USER_ONLY)
 | 
			
		||||
    s->splitwx_enabled = -1;
 | 
			
		||||
#else
 | 
			
		||||
    s->splitwx_enabled = 0;
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool mttcg_enabled;
 | 
			
		||||
 | 
			
		||||
static int tcg_init(MachineState *ms)
 | 
			
		||||
{
 | 
			
		||||
    TCGState *s = TCG_STATE(current_accel());
 | 
			
		||||
 | 
			
		||||
    tcg_exec_init(s->tb_size * 1024 * 1024, s->splitwx_enabled);
 | 
			
		||||
    mttcg_enabled = s->mttcg_enabled;
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
     * Initialize TCG regions only for softmmu.
 | 
			
		||||
     *
 | 
			
		||||
     * This needs to be done later for user mode, because the prologue
 | 
			
		||||
     * generation needs to be delayed so that GUEST_BASE is already set.
 | 
			
		||||
     */
 | 
			
		||||
#ifndef CONFIG_USER_ONLY
 | 
			
		||||
    tcg_region_init();
 | 
			
		||||
#endif /* !CONFIG_USER_ONLY */
 | 
			
		||||
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static char *tcg_get_thread(Object *obj, Error **errp)
 | 
			
		||||
{
 | 
			
		||||
    TCGState *s = TCG_STATE(obj);
 | 
			
		||||
 | 
			
		||||
    return g_strdup(s->mttcg_enabled ? "multi" : "single");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void tcg_set_thread(Object *obj, const char *value, Error **errp)
 | 
			
		||||
{
 | 
			
		||||
    TCGState *s = TCG_STATE(obj);
 | 
			
		||||
 | 
			
		||||
    if (strcmp(value, "multi") == 0) {
 | 
			
		||||
        if (TCG_OVERSIZED_GUEST) {
 | 
			
		||||
            error_setg(errp, "No MTTCG when guest word size > hosts");
 | 
			
		||||
        } else if (icount_enabled()) {
 | 
			
		||||
            error_setg(errp, "No MTTCG when icount is enabled");
 | 
			
		||||
        } else {
 | 
			
		||||
#ifndef TARGET_SUPPORTS_MTTCG
 | 
			
		||||
            warn_report("Guest not yet converted to MTTCG - "
 | 
			
		||||
                        "you may get unexpected results");
 | 
			
		||||
#endif
 | 
			
		||||
            if (!check_tcg_memory_orders_compatible()) {
 | 
			
		||||
                warn_report("Guest expects a stronger memory ordering "
 | 
			
		||||
                            "than the host provides");
 | 
			
		||||
                error_printf("This may cause strange/hard to debug errors\n");
 | 
			
		||||
            }
 | 
			
		||||
            s->mttcg_enabled = true;
 | 
			
		||||
        }
 | 
			
		||||
    } else if (strcmp(value, "single") == 0) {
 | 
			
		||||
        s->mttcg_enabled = false;
 | 
			
		||||
    } else {
 | 
			
		||||
        error_setg(errp, "Invalid 'thread' setting %s", value);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void tcg_get_tb_size(Object *obj, Visitor *v,
 | 
			
		||||
                            const char *name, void *opaque,
 | 
			
		||||
                            Error **errp)
 | 
			
		||||
{
 | 
			
		||||
    TCGState *s = TCG_STATE(obj);
 | 
			
		||||
    uint32_t value = s->tb_size;
 | 
			
		||||
 | 
			
		||||
    visit_type_uint32(v, name, &value, errp);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void tcg_set_tb_size(Object *obj, Visitor *v,
 | 
			
		||||
                            const char *name, void *opaque,
 | 
			
		||||
                            Error **errp)
 | 
			
		||||
{
 | 
			
		||||
    TCGState *s = TCG_STATE(obj);
 | 
			
		||||
    uint32_t value;
 | 
			
		||||
 | 
			
		||||
    if (!visit_type_uint32(v, name, &value, errp)) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    s->tb_size = value;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static bool tcg_get_splitwx(Object *obj, Error **errp)
 | 
			
		||||
{
 | 
			
		||||
    TCGState *s = TCG_STATE(obj);
 | 
			
		||||
    return s->splitwx_enabled;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void tcg_set_splitwx(Object *obj, bool value, Error **errp)
 | 
			
		||||
{
 | 
			
		||||
    TCGState *s = TCG_STATE(obj);
 | 
			
		||||
    s->splitwx_enabled = value;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void tcg_accel_class_init(ObjectClass *oc, void *data)
 | 
			
		||||
{
 | 
			
		||||
    AccelClass *ac = ACCEL_CLASS(oc);
 | 
			
		||||
    ac->name = "tcg";
 | 
			
		||||
    ac->init_machine = tcg_init;
 | 
			
		||||
    ac->allowed = &tcg_allowed;
 | 
			
		||||
 | 
			
		||||
    object_class_property_add_str(oc, "thread",
 | 
			
		||||
                                  tcg_get_thread,
 | 
			
		||||
                                  tcg_set_thread);
 | 
			
		||||
 | 
			
		||||
    object_class_property_add(oc, "tb-size", "int",
 | 
			
		||||
        tcg_get_tb_size, tcg_set_tb_size,
 | 
			
		||||
        NULL, NULL);
 | 
			
		||||
    object_class_property_set_description(oc, "tb-size",
 | 
			
		||||
        "TCG translation block cache size");
 | 
			
		||||
 | 
			
		||||
    object_class_property_add_bool(oc, "split-wx",
 | 
			
		||||
        tcg_get_splitwx, tcg_set_splitwx);
 | 
			
		||||
    object_class_property_set_description(oc, "split-wx",
 | 
			
		||||
        "Map jit pages into separate RW and RX regions");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const TypeInfo tcg_accel_type = {
 | 
			
		||||
    .name = TYPE_TCG_ACCEL,
 | 
			
		||||
    .parent = TYPE_ACCEL,
 | 
			
		||||
    .instance_init = tcg_accel_instance_init,
 | 
			
		||||
    .class_init = tcg_accel_class_init,
 | 
			
		||||
    .instance_size = sizeof(TCGState),
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static void register_accel_types(void)
 | 
			
		||||
{
 | 
			
		||||
    type_register_static(&tcg_accel_type);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type_init(register_accel_types);
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,172 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Tiny Code Generator for QEMU
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) 2008 Fabrice Bellard
 | 
			
		||||
 *
 | 
			
		||||
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
 * of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
 * in the Software without restriction, including without limitation the rights
 | 
			
		||||
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
 * copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
 * furnished to do so, subject to the following conditions:
 | 
			
		||||
 *
 | 
			
		||||
 * The above copyright notice and this permission notice shall be included in
 | 
			
		||||
 * all copies or substantial portions of the Software.
 | 
			
		||||
 *
 | 
			
		||||
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 | 
			
		||||
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 | 
			
		||||
 * THE SOFTWARE.
 | 
			
		||||
 */
 | 
			
		||||
#include "qemu/osdep.h"
 | 
			
		||||
#include "qemu/host-utils.h"
 | 
			
		||||
#include "cpu.h"
 | 
			
		||||
#include "exec/helper-proto.h"
 | 
			
		||||
#include "exec/cpu_ldst.h"
 | 
			
		||||
#include "exec/exec-all.h"
 | 
			
		||||
#include "disas/disas.h"
 | 
			
		||||
#include "exec/log.h"
 | 
			
		||||
#include "tcg/tcg.h"
 | 
			
		||||
#include "exec/tb-lookup.h"
 | 
			
		||||
 | 
			
		||||
/* 32-bit helpers */
 | 
			
		||||
 | 
			
		||||
int32_t HELPER(div_i32)(int32_t arg1, int32_t arg2)
 | 
			
		||||
{
 | 
			
		||||
    return arg1 / arg2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int32_t HELPER(rem_i32)(int32_t arg1, int32_t arg2)
 | 
			
		||||
{
 | 
			
		||||
    return arg1 % arg2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32_t HELPER(divu_i32)(uint32_t arg1, uint32_t arg2)
 | 
			
		||||
{
 | 
			
		||||
    return arg1 / arg2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32_t HELPER(remu_i32)(uint32_t arg1, uint32_t arg2)
 | 
			
		||||
{
 | 
			
		||||
    return arg1 % arg2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* 64-bit helpers */
 | 
			
		||||
 | 
			
		||||
uint64_t HELPER(shl_i64)(uint64_t arg1, uint64_t arg2)
 | 
			
		||||
{
 | 
			
		||||
    return arg1 << arg2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint64_t HELPER(shr_i64)(uint64_t arg1, uint64_t arg2)
 | 
			
		||||
{
 | 
			
		||||
    return arg1 >> arg2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int64_t HELPER(sar_i64)(int64_t arg1, int64_t arg2)
 | 
			
		||||
{
 | 
			
		||||
    return arg1 >> arg2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int64_t HELPER(div_i64)(int64_t arg1, int64_t arg2)
 | 
			
		||||
{
 | 
			
		||||
    return arg1 / arg2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int64_t HELPER(rem_i64)(int64_t arg1, int64_t arg2)
 | 
			
		||||
{
 | 
			
		||||
    return arg1 % arg2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint64_t HELPER(divu_i64)(uint64_t arg1, uint64_t arg2)
 | 
			
		||||
{
 | 
			
		||||
    return arg1 / arg2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint64_t HELPER(remu_i64)(uint64_t arg1, uint64_t arg2)
 | 
			
		||||
{
 | 
			
		||||
    return arg1 % arg2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint64_t HELPER(muluh_i64)(uint64_t arg1, uint64_t arg2)
 | 
			
		||||
{
 | 
			
		||||
    uint64_t l, h;
 | 
			
		||||
    mulu64(&l, &h, arg1, arg2);
 | 
			
		||||
    return h;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int64_t HELPER(mulsh_i64)(int64_t arg1, int64_t arg2)
 | 
			
		||||
{
 | 
			
		||||
    uint64_t l, h;
 | 
			
		||||
    muls64(&l, &h, arg1, arg2);
 | 
			
		||||
    return h;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32_t HELPER(clz_i32)(uint32_t arg, uint32_t zero_val)
 | 
			
		||||
{
 | 
			
		||||
    return arg ? clz32(arg) : zero_val;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32_t HELPER(ctz_i32)(uint32_t arg, uint32_t zero_val)
 | 
			
		||||
{
 | 
			
		||||
    return arg ? ctz32(arg) : zero_val;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint64_t HELPER(clz_i64)(uint64_t arg, uint64_t zero_val)
 | 
			
		||||
{
 | 
			
		||||
    return arg ? clz64(arg) : zero_val;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint64_t HELPER(ctz_i64)(uint64_t arg, uint64_t zero_val)
 | 
			
		||||
{
 | 
			
		||||
    return arg ? ctz64(arg) : zero_val;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32_t HELPER(clrsb_i32)(uint32_t arg)
 | 
			
		||||
{
 | 
			
		||||
    return clrsb32(arg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint64_t HELPER(clrsb_i64)(uint64_t arg)
 | 
			
		||||
{
 | 
			
		||||
    return clrsb64(arg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32_t HELPER(ctpop_i32)(uint32_t arg)
 | 
			
		||||
{
 | 
			
		||||
    return ctpop32(arg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint64_t HELPER(ctpop_i64)(uint64_t arg)
 | 
			
		||||
{
 | 
			
		||||
    return ctpop64(arg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const void *HELPER(lookup_tb_ptr)(CPUArchState *env)
 | 
			
		||||
{
 | 
			
		||||
    CPUState *cpu = env_cpu(env);
 | 
			
		||||
    TranslationBlock *tb;
 | 
			
		||||
    target_ulong cs_base, pc;
 | 
			
		||||
    uint32_t flags;
 | 
			
		||||
 | 
			
		||||
    cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags);
 | 
			
		||||
 | 
			
		||||
    tb = tb_lookup(cpu, pc, cs_base, flags, curr_cflags(cpu));
 | 
			
		||||
    if (tb == NULL) {
 | 
			
		||||
        return tcg_code_gen_epilogue;
 | 
			
		||||
    }
 | 
			
		||||
    qemu_log_mask_and_addr(CPU_LOG_EXEC, pc,
 | 
			
		||||
                           "Chain %d: %p ["
 | 
			
		||||
                           TARGET_FMT_lx "/" TARGET_FMT_lx "/%#x] %s\n",
 | 
			
		||||
                           cpu->cpu_index, tb->tc.ptr, cs_base, pc, flags,
 | 
			
		||||
                           lookup_symbol(pc));
 | 
			
		||||
    return tb->tc.ptr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void HELPER(exit_atomic)(CPUArchState *env)
 | 
			
		||||
{
 | 
			
		||||
    cpu_loop_exit_atomic(env_cpu(env), GETPC());
 | 
			
		||||
}
 | 
			
		||||
@@ -1,333 +0,0 @@
 | 
			
		||||
DEF_HELPER_FLAGS_2(div_i32, TCG_CALL_NO_RWG_SE, s32, s32, s32)
 | 
			
		||||
DEF_HELPER_FLAGS_2(rem_i32, TCG_CALL_NO_RWG_SE, s32, s32, s32)
 | 
			
		||||
DEF_HELPER_FLAGS_2(divu_i32, TCG_CALL_NO_RWG_SE, i32, i32, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_2(remu_i32, TCG_CALL_NO_RWG_SE, i32, i32, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_2(div_i64, TCG_CALL_NO_RWG_SE, s64, s64, s64)
 | 
			
		||||
DEF_HELPER_FLAGS_2(rem_i64, TCG_CALL_NO_RWG_SE, s64, s64, s64)
 | 
			
		||||
DEF_HELPER_FLAGS_2(divu_i64, TCG_CALL_NO_RWG_SE, i64, i64, i64)
 | 
			
		||||
DEF_HELPER_FLAGS_2(remu_i64, TCG_CALL_NO_RWG_SE, i64, i64, i64)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_2(shl_i64, TCG_CALL_NO_RWG_SE, i64, i64, i64)
 | 
			
		||||
DEF_HELPER_FLAGS_2(shr_i64, TCG_CALL_NO_RWG_SE, i64, i64, i64)
 | 
			
		||||
DEF_HELPER_FLAGS_2(sar_i64, TCG_CALL_NO_RWG_SE, s64, s64, s64)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_2(mulsh_i64, TCG_CALL_NO_RWG_SE, s64, s64, s64)
 | 
			
		||||
DEF_HELPER_FLAGS_2(muluh_i64, TCG_CALL_NO_RWG_SE, i64, i64, i64)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_2(clz_i32, TCG_CALL_NO_RWG_SE, i32, i32, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_2(ctz_i32, TCG_CALL_NO_RWG_SE, i32, i32, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_2(clz_i64, TCG_CALL_NO_RWG_SE, i64, i64, i64)
 | 
			
		||||
DEF_HELPER_FLAGS_2(ctz_i64, TCG_CALL_NO_RWG_SE, i64, i64, i64)
 | 
			
		||||
DEF_HELPER_FLAGS_1(clrsb_i32, TCG_CALL_NO_RWG_SE, i32, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_1(clrsb_i64, TCG_CALL_NO_RWG_SE, i64, i64)
 | 
			
		||||
DEF_HELPER_FLAGS_1(ctpop_i32, TCG_CALL_NO_RWG_SE, i32, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_1(ctpop_i64, TCG_CALL_NO_RWG_SE, i64, i64)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_1(lookup_tb_ptr, TCG_CALL_NO_WG_SE, cptr, env)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_1(exit_atomic, TCG_CALL_NO_WG, noreturn, env)
 | 
			
		||||
 | 
			
		||||
#ifndef IN_HELPER_PROTO
 | 
			
		||||
/*
 | 
			
		||||
 * Pass calls to memset directly to libc, without a thunk in qemu.
 | 
			
		||||
 * Do not re-declare memset, especially since we fudge the type here;
 | 
			
		||||
 * we assume sizeof(void *) == sizeof(size_t), which is true for
 | 
			
		||||
 * all supported hosts.
 | 
			
		||||
 */
 | 
			
		||||
#define helper_memset memset
 | 
			
		||||
DEF_HELPER_FLAGS_3(memset, TCG_CALL_NO_RWG, ptr, ptr, int, ptr)
 | 
			
		||||
#endif /* IN_HELPER_PROTO */
 | 
			
		||||
 | 
			
		||||
#ifdef CONFIG_SOFTMMU
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_5(atomic_cmpxchgb, TCG_CALL_NO_WG,
 | 
			
		||||
                   i32, env, tl, i32, i32, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_5(atomic_cmpxchgw_be, TCG_CALL_NO_WG,
 | 
			
		||||
                   i32, env, tl, i32, i32, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_5(atomic_cmpxchgw_le, TCG_CALL_NO_WG,
 | 
			
		||||
                   i32, env, tl, i32, i32, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_5(atomic_cmpxchgl_be, TCG_CALL_NO_WG,
 | 
			
		||||
                   i32, env, tl, i32, i32, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_5(atomic_cmpxchgl_le, TCG_CALL_NO_WG,
 | 
			
		||||
                   i32, env, tl, i32, i32, i32)
 | 
			
		||||
#ifdef CONFIG_ATOMIC64
 | 
			
		||||
DEF_HELPER_FLAGS_5(atomic_cmpxchgq_be, TCG_CALL_NO_WG,
 | 
			
		||||
                   i64, env, tl, i64, i64, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_5(atomic_cmpxchgq_le, TCG_CALL_NO_WG,
 | 
			
		||||
                   i64, env, tl, i64, i64, i32)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef CONFIG_ATOMIC64
 | 
			
		||||
#define GEN_ATOMIC_HELPERS(NAME)                                  \
 | 
			
		||||
    DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), b),              \
 | 
			
		||||
                       TCG_CALL_NO_WG, i32, env, tl, i32, i32)    \
 | 
			
		||||
    DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), w_le),           \
 | 
			
		||||
                       TCG_CALL_NO_WG, i32, env, tl, i32, i32)    \
 | 
			
		||||
    DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), w_be),           \
 | 
			
		||||
                       TCG_CALL_NO_WG, i32, env, tl, i32, i32)    \
 | 
			
		||||
    DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), l_le),           \
 | 
			
		||||
                       TCG_CALL_NO_WG, i32, env, tl, i32, i32)    \
 | 
			
		||||
    DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), l_be),           \
 | 
			
		||||
                       TCG_CALL_NO_WG, i32, env, tl, i32, i32)    \
 | 
			
		||||
    DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), q_le),           \
 | 
			
		||||
                       TCG_CALL_NO_WG, i64, env, tl, i64, i32)    \
 | 
			
		||||
    DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), q_be),           \
 | 
			
		||||
                       TCG_CALL_NO_WG, i64, env, tl, i64, i32)
 | 
			
		||||
#else
 | 
			
		||||
#define GEN_ATOMIC_HELPERS(NAME)                                  \
 | 
			
		||||
    DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), b),              \
 | 
			
		||||
                       TCG_CALL_NO_WG, i32, env, tl, i32, i32)    \
 | 
			
		||||
    DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), w_le),           \
 | 
			
		||||
                       TCG_CALL_NO_WG, i32, env, tl, i32, i32)    \
 | 
			
		||||
    DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), w_be),           \
 | 
			
		||||
                       TCG_CALL_NO_WG, i32, env, tl, i32, i32)    \
 | 
			
		||||
    DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), l_le),           \
 | 
			
		||||
                       TCG_CALL_NO_WG, i32, env, tl, i32, i32)    \
 | 
			
		||||
    DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), l_be),           \
 | 
			
		||||
                       TCG_CALL_NO_WG, i32, env, tl, i32, i32)
 | 
			
		||||
#endif /* CONFIG_ATOMIC64 */
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_4(atomic_cmpxchgb, TCG_CALL_NO_WG, i32, env, tl, i32, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(atomic_cmpxchgw_be, TCG_CALL_NO_WG, i32, env, tl, i32, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(atomic_cmpxchgw_le, TCG_CALL_NO_WG, i32, env, tl, i32, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(atomic_cmpxchgl_be, TCG_CALL_NO_WG, i32, env, tl, i32, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(atomic_cmpxchgl_le, TCG_CALL_NO_WG, i32, env, tl, i32, i32)
 | 
			
		||||
#ifdef CONFIG_ATOMIC64
 | 
			
		||||
DEF_HELPER_FLAGS_4(atomic_cmpxchgq_be, TCG_CALL_NO_WG, i64, env, tl, i64, i64)
 | 
			
		||||
DEF_HELPER_FLAGS_4(atomic_cmpxchgq_le, TCG_CALL_NO_WG, i64, env, tl, i64, i64)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef CONFIG_ATOMIC64
 | 
			
		||||
#define GEN_ATOMIC_HELPERS(NAME)                             \
 | 
			
		||||
    DEF_HELPER_FLAGS_3(glue(glue(atomic_, NAME), b),         \
 | 
			
		||||
                       TCG_CALL_NO_WG, i32, env, tl, i32)    \
 | 
			
		||||
    DEF_HELPER_FLAGS_3(glue(glue(atomic_, NAME), w_le),      \
 | 
			
		||||
                       TCG_CALL_NO_WG, i32, env, tl, i32)    \
 | 
			
		||||
    DEF_HELPER_FLAGS_3(glue(glue(atomic_, NAME), w_be),      \
 | 
			
		||||
                       TCG_CALL_NO_WG, i32, env, tl, i32)    \
 | 
			
		||||
    DEF_HELPER_FLAGS_3(glue(glue(atomic_, NAME), l_le),      \
 | 
			
		||||
                       TCG_CALL_NO_WG, i32, env, tl, i32)    \
 | 
			
		||||
    DEF_HELPER_FLAGS_3(glue(glue(atomic_, NAME), l_be),      \
 | 
			
		||||
                       TCG_CALL_NO_WG, i32, env, tl, i32)    \
 | 
			
		||||
    DEF_HELPER_FLAGS_3(glue(glue(atomic_, NAME), q_le),      \
 | 
			
		||||
                       TCG_CALL_NO_WG, i64, env, tl, i64)    \
 | 
			
		||||
    DEF_HELPER_FLAGS_3(glue(glue(atomic_, NAME), q_be),      \
 | 
			
		||||
                       TCG_CALL_NO_WG, i64, env, tl, i64)
 | 
			
		||||
#else
 | 
			
		||||
#define GEN_ATOMIC_HELPERS(NAME)                             \
 | 
			
		||||
    DEF_HELPER_FLAGS_3(glue(glue(atomic_, NAME), b),         \
 | 
			
		||||
                       TCG_CALL_NO_WG, i32, env, tl, i32)    \
 | 
			
		||||
    DEF_HELPER_FLAGS_3(glue(glue(atomic_, NAME), w_le),      \
 | 
			
		||||
                       TCG_CALL_NO_WG, i32, env, tl, i32)    \
 | 
			
		||||
    DEF_HELPER_FLAGS_3(glue(glue(atomic_, NAME), w_be),      \
 | 
			
		||||
                       TCG_CALL_NO_WG, i32, env, tl, i32)    \
 | 
			
		||||
    DEF_HELPER_FLAGS_3(glue(glue(atomic_, NAME), l_le),      \
 | 
			
		||||
                       TCG_CALL_NO_WG, i32, env, tl, i32)    \
 | 
			
		||||
    DEF_HELPER_FLAGS_3(glue(glue(atomic_, NAME), l_be),      \
 | 
			
		||||
                       TCG_CALL_NO_WG, i32, env, tl, i32)
 | 
			
		||||
#endif /* CONFIG_ATOMIC64 */
 | 
			
		||||
 | 
			
		||||
#endif /* CONFIG_SOFTMMU */
 | 
			
		||||
 | 
			
		||||
GEN_ATOMIC_HELPERS(fetch_add)
 | 
			
		||||
GEN_ATOMIC_HELPERS(fetch_and)
 | 
			
		||||
GEN_ATOMIC_HELPERS(fetch_or)
 | 
			
		||||
GEN_ATOMIC_HELPERS(fetch_xor)
 | 
			
		||||
GEN_ATOMIC_HELPERS(fetch_smin)
 | 
			
		||||
GEN_ATOMIC_HELPERS(fetch_umin)
 | 
			
		||||
GEN_ATOMIC_HELPERS(fetch_smax)
 | 
			
		||||
GEN_ATOMIC_HELPERS(fetch_umax)
 | 
			
		||||
 | 
			
		||||
GEN_ATOMIC_HELPERS(add_fetch)
 | 
			
		||||
GEN_ATOMIC_HELPERS(and_fetch)
 | 
			
		||||
GEN_ATOMIC_HELPERS(or_fetch)
 | 
			
		||||
GEN_ATOMIC_HELPERS(xor_fetch)
 | 
			
		||||
GEN_ATOMIC_HELPERS(smin_fetch)
 | 
			
		||||
GEN_ATOMIC_HELPERS(umin_fetch)
 | 
			
		||||
GEN_ATOMIC_HELPERS(smax_fetch)
 | 
			
		||||
GEN_ATOMIC_HELPERS(umax_fetch)
 | 
			
		||||
 | 
			
		||||
GEN_ATOMIC_HELPERS(xchg)
 | 
			
		||||
 | 
			
		||||
#undef GEN_ATOMIC_HELPERS
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_mov, TCG_CALL_NO_RWG, void, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_dup8, TCG_CALL_NO_RWG, void, ptr, i32, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_dup16, TCG_CALL_NO_RWG, void, ptr, i32, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_dup32, TCG_CALL_NO_RWG, void, ptr, i32, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_dup64, TCG_CALL_NO_RWG, void, ptr, i32, i64)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_add8, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_add16, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_add32, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_add64, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_adds8, TCG_CALL_NO_RWG, void, ptr, ptr, i64, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_adds16, TCG_CALL_NO_RWG, void, ptr, ptr, i64, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_adds32, TCG_CALL_NO_RWG, void, ptr, ptr, i64, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_adds64, TCG_CALL_NO_RWG, void, ptr, ptr, i64, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_sub8, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_sub16, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_sub32, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_sub64, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_subs8, TCG_CALL_NO_RWG, void, ptr, ptr, i64, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_subs16, TCG_CALL_NO_RWG, void, ptr, ptr, i64, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_subs32, TCG_CALL_NO_RWG, void, ptr, ptr, i64, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_subs64, TCG_CALL_NO_RWG, void, ptr, ptr, i64, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_mul8, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_mul16, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_mul32, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_mul64, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_muls8, TCG_CALL_NO_RWG, void, ptr, ptr, i64, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_muls16, TCG_CALL_NO_RWG, void, ptr, ptr, i64, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_muls32, TCG_CALL_NO_RWG, void, ptr, ptr, i64, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_muls64, TCG_CALL_NO_RWG, void, ptr, ptr, i64, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_ssadd8, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_ssadd16, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_ssadd32, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_ssadd64, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_sssub8, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_sssub16, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_sssub32, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_sssub64, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_usadd8, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_usadd16, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_usadd32, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_usadd64, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_ussub8, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_ussub16, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_ussub32, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_ussub64, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_smin8, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_smin16, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_smin32, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_smin64, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_smax8, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_smax16, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_smax32, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_smax64, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_umin8, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_umin16, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_umin32, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_umin64, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_umax8, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_umax16, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_umax32, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_umax64, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_neg8, TCG_CALL_NO_RWG, void, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_neg16, TCG_CALL_NO_RWG, void, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_neg32, TCG_CALL_NO_RWG, void, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_neg64, TCG_CALL_NO_RWG, void, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_abs8, TCG_CALL_NO_RWG, void, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_abs16, TCG_CALL_NO_RWG, void, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_abs32, TCG_CALL_NO_RWG, void, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_abs64, TCG_CALL_NO_RWG, void, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_not, TCG_CALL_NO_RWG, void, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_and, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_or, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_xor, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_andc, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_orc, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_nand, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_nor, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_eqv, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_ands, TCG_CALL_NO_RWG, void, ptr, ptr, i64, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_xors, TCG_CALL_NO_RWG, void, ptr, ptr, i64, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_ors, TCG_CALL_NO_RWG, void, ptr, ptr, i64, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_shl8i, TCG_CALL_NO_RWG, void, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_shl16i, TCG_CALL_NO_RWG, void, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_shl32i, TCG_CALL_NO_RWG, void, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_shl64i, TCG_CALL_NO_RWG, void, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_shr8i, TCG_CALL_NO_RWG, void, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_shr16i, TCG_CALL_NO_RWG, void, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_shr32i, TCG_CALL_NO_RWG, void, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_shr64i, TCG_CALL_NO_RWG, void, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_sar8i, TCG_CALL_NO_RWG, void, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_sar16i, TCG_CALL_NO_RWG, void, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_sar32i, TCG_CALL_NO_RWG, void, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_sar64i, TCG_CALL_NO_RWG, void, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_rotl8i, TCG_CALL_NO_RWG, void, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_rotl16i, TCG_CALL_NO_RWG, void, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_rotl32i, TCG_CALL_NO_RWG, void, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_3(gvec_rotl64i, TCG_CALL_NO_RWG, void, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_shl8v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_shl16v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_shl32v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_shl64v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_shr8v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_shr16v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_shr32v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_shr64v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_sar8v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_sar16v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_sar32v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_sar64v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_rotl8v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_rotl16v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_rotl32v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_rotl64v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_rotr8v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_rotr16v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_rotr32v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_rotr64v, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_eq8, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_eq16, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_eq32, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_eq64, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_ne8, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_ne16, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_ne32, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_ne64, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_lt8, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_lt16, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_lt32, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_lt64, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_le8, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_le16, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_le32, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_le64, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_ltu8, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_ltu16, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_ltu32, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_ltu64, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_leu8, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_leu16, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_leu32, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
DEF_HELPER_FLAGS_4(gvec_leu64, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 | 
			
		||||
 | 
			
		||||
DEF_HELPER_FLAGS_5(gvec_bitsel, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)
 | 
			
		||||
@@ -1,10 +0,0 @@
 | 
			
		||||
# See docs/devel/tracing.txt for syntax documentation.
 | 
			
		||||
 | 
			
		||||
# TCG related tracing
 | 
			
		||||
# cpu-exec.c
 | 
			
		||||
exec_tb(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR
 | 
			
		||||
exec_tb_nocache(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR
 | 
			
		||||
exec_tb_exit(void *last_tb, unsigned int flags) "tb:%p flags=0x%x"
 | 
			
		||||
 | 
			
		||||
# translate-all.c
 | 
			
		||||
translate_block(void *tb, uintptr_t pc, const void *tb_code) "tb:%p, pc:0x%"PRIxPTR", tb_code:%p"
 | 
			
		||||
@@ -1 +0,0 @@
 | 
			
		||||
#include "trace/trace-accel_tcg.h"
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,152 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Generic intermediate code generation.
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (C) 2016-2017 Lluís Vilanova <vilanova@ac.upc.edu>
 | 
			
		||||
 *
 | 
			
		||||
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 | 
			
		||||
 * See the COPYING file in the top-level directory.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "qemu/osdep.h"
 | 
			
		||||
#include "qemu/error-report.h"
 | 
			
		||||
#include "cpu.h"
 | 
			
		||||
#include "tcg/tcg.h"
 | 
			
		||||
#include "tcg/tcg-op.h"
 | 
			
		||||
#include "exec/exec-all.h"
 | 
			
		||||
#include "exec/gen-icount.h"
 | 
			
		||||
#include "exec/log.h"
 | 
			
		||||
#include "exec/translator.h"
 | 
			
		||||
#include "exec/plugin-gen.h"
 | 
			
		||||
#include "sysemu/replay.h"
 | 
			
		||||
 | 
			
		||||
/* Pairs with tcg_clear_temp_count.
 | 
			
		||||
   To be called by #TranslatorOps.{translate_insn,tb_stop} if
 | 
			
		||||
   (1) the target is sufficiently clean to support reporting,
 | 
			
		||||
   (2) as and when all temporaries are known to be consumed.
 | 
			
		||||
   For most targets, (2) is at the end of translate_insn.  */
 | 
			
		||||
void translator_loop_temp_check(DisasContextBase *db)
 | 
			
		||||
{
 | 
			
		||||
    if (tcg_check_temp_count()) {
 | 
			
		||||
        qemu_log("warning: TCG temporary leaks before "
 | 
			
		||||
                 TARGET_FMT_lx "\n", db->pc_next);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void translator_loop(const TranslatorOps *ops, DisasContextBase *db,
 | 
			
		||||
                     CPUState *cpu, TranslationBlock *tb, int max_insns)
 | 
			
		||||
{
 | 
			
		||||
    int bp_insn = 0;
 | 
			
		||||
    bool plugin_enabled;
 | 
			
		||||
 | 
			
		||||
    /* Initialize DisasContext */
 | 
			
		||||
    db->tb = tb;
 | 
			
		||||
    db->pc_first = tb->pc;
 | 
			
		||||
    db->pc_next = db->pc_first;
 | 
			
		||||
    db->is_jmp = DISAS_NEXT;
 | 
			
		||||
    db->num_insns = 0;
 | 
			
		||||
    db->max_insns = max_insns;
 | 
			
		||||
    db->singlestep_enabled = cpu->singlestep_enabled;
 | 
			
		||||
 | 
			
		||||
    ops->init_disas_context(db, cpu);
 | 
			
		||||
    tcg_debug_assert(db->is_jmp == DISAS_NEXT);  /* no early exit */
 | 
			
		||||
 | 
			
		||||
    /* Reset the temp count so that we can identify leaks */
 | 
			
		||||
    tcg_clear_temp_count();
 | 
			
		||||
 | 
			
		||||
    /* Start translating.  */
 | 
			
		||||
    gen_tb_start(db->tb);
 | 
			
		||||
    ops->tb_start(db, cpu);
 | 
			
		||||
    tcg_debug_assert(db->is_jmp == DISAS_NEXT);  /* no early exit */
 | 
			
		||||
 | 
			
		||||
    plugin_enabled = plugin_gen_tb_start(cpu, tb,
 | 
			
		||||
                                         tb_cflags(db->tb) & CF_MEMI_ONLY);
 | 
			
		||||
 | 
			
		||||
    while (true) {
 | 
			
		||||
        db->num_insns++;
 | 
			
		||||
        ops->insn_start(db, cpu);
 | 
			
		||||
        tcg_debug_assert(db->is_jmp == DISAS_NEXT);  /* no early exit */
 | 
			
		||||
 | 
			
		||||
        if (plugin_enabled) {
 | 
			
		||||
            plugin_gen_insn_start(cpu, db);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /* Pass breakpoint hits to target for further processing */
 | 
			
		||||
        if (!db->singlestep_enabled
 | 
			
		||||
            && unlikely(!QTAILQ_EMPTY(&cpu->breakpoints))) {
 | 
			
		||||
            CPUBreakpoint *bp;
 | 
			
		||||
            QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) {
 | 
			
		||||
                if (bp->pc == db->pc_next) {
 | 
			
		||||
                    if (ops->breakpoint_check(db, cpu, bp)) {
 | 
			
		||||
                        bp_insn = 1;
 | 
			
		||||
                        break;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            /* The breakpoint_check hook may use DISAS_TOO_MANY to indicate
 | 
			
		||||
               that only one more instruction is to be executed.  Otherwise
 | 
			
		||||
               it should use DISAS_NORETURN when generating an exception,
 | 
			
		||||
               but may use a DISAS_TARGET_* value for Something Else.  */
 | 
			
		||||
            if (db->is_jmp > DISAS_TOO_MANY) {
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /* Disassemble one instruction.  The translate_insn hook should
 | 
			
		||||
           update db->pc_next and db->is_jmp to indicate what should be
 | 
			
		||||
           done next -- either exiting this loop or locate the start of
 | 
			
		||||
           the next instruction.  */
 | 
			
		||||
        if (db->num_insns == db->max_insns
 | 
			
		||||
            && (tb_cflags(db->tb) & CF_LAST_IO)) {
 | 
			
		||||
            /* Accept I/O on the last instruction.  */
 | 
			
		||||
            gen_io_start();
 | 
			
		||||
            ops->translate_insn(db, cpu);
 | 
			
		||||
        } else {
 | 
			
		||||
            /* we should only see CF_MEMI_ONLY for io_recompile */
 | 
			
		||||
            tcg_debug_assert(!(tb_cflags(db->tb) & CF_MEMI_ONLY));
 | 
			
		||||
            ops->translate_insn(db, cpu);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /* Stop translation if translate_insn so indicated.  */
 | 
			
		||||
        if (db->is_jmp != DISAS_NEXT) {
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /*
 | 
			
		||||
         * We can't instrument after instructions that change control
 | 
			
		||||
         * flow although this only really affects post-load operations.
 | 
			
		||||
         */
 | 
			
		||||
        if (plugin_enabled) {
 | 
			
		||||
            plugin_gen_insn_end();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /* Stop translation if the output buffer is full,
 | 
			
		||||
           or we have executed all of the allowed instructions.  */
 | 
			
		||||
        if (tcg_op_buf_full() || db->num_insns >= db->max_insns) {
 | 
			
		||||
            db->is_jmp = DISAS_TOO_MANY;
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* Emit code to exit the TB, as indicated by db->is_jmp.  */
 | 
			
		||||
    ops->tb_stop(db, cpu);
 | 
			
		||||
    gen_tb_end(db->tb, db->num_insns - bp_insn);
 | 
			
		||||
 | 
			
		||||
    if (plugin_enabled) {
 | 
			
		||||
        plugin_gen_tb_end(cpu);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* The disas_log hook may use these values rather than recompute.  */
 | 
			
		||||
    tb->size = db->pc_next - db->pc_first;
 | 
			
		||||
    tb->icount = db->num_insns;
 | 
			
		||||
 | 
			
		||||
#ifdef DEBUG_DISAS
 | 
			
		||||
    if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)
 | 
			
		||||
        && qemu_log_in_addr_range(db->pc_first)) {
 | 
			
		||||
        FILE *logfile = qemu_log_lock();
 | 
			
		||||
        qemu_log("----------------\n");
 | 
			
		||||
        ops->disas_log(db, cpu);
 | 
			
		||||
        qemu_log("\n");
 | 
			
		||||
        qemu_log_unlock(logfile);
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
@@ -1,40 +0,0 @@
 | 
			
		||||
#include "qemu/osdep.h"
 | 
			
		||||
#include "hw/core/cpu.h"
 | 
			
		||||
#include "sysemu/replay.h"
 | 
			
		||||
#include "sysemu/sysemu.h"
 | 
			
		||||
 | 
			
		||||
bool enable_cpu_pm = false;
 | 
			
		||||
 | 
			
		||||
void cpu_resume(CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void cpu_remove_sync(CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void qemu_init_vcpu(CPUState *cpu)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* User mode emulation does not support record/replay yet.  */
 | 
			
		||||
 | 
			
		||||
bool replay_exception(void)
 | 
			
		||||
{
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool replay_has_exception(void)
 | 
			
		||||
{
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool replay_interrupt(void)
 | 
			
		||||
{
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool replay_has_interrupt(void)
 | 
			
		||||
{
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1 +0,0 @@
 | 
			
		||||
specific_ss.add(when: 'CONFIG_XEN', if_true: files('xen-all.c'))
 | 
			
		||||
@@ -1,238 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2014       Citrix Systems UK Ltd.
 | 
			
		||||
 *
 | 
			
		||||
 * This work is licensed under the terms of the GNU GPL, version 2.  See
 | 
			
		||||
 * the COPYING file in the top-level directory.
 | 
			
		||||
 *
 | 
			
		||||
 * Contributions after 2012-01-13 are licensed under the terms of the
 | 
			
		||||
 * GNU GPL, version 2 or (at your option) any later version.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "qemu/osdep.h"
 | 
			
		||||
#include "qemu/error-report.h"
 | 
			
		||||
#include "qemu/module.h"
 | 
			
		||||
#include "qapi/error.h"
 | 
			
		||||
#include "hw/xen/xen-legacy-backend.h"
 | 
			
		||||
#include "hw/xen/xen_pt.h"
 | 
			
		||||
#include "chardev/char.h"
 | 
			
		||||
#include "qemu/accel.h"
 | 
			
		||||
#include "sysemu/cpus.h"
 | 
			
		||||
#include "sysemu/xen.h"
 | 
			
		||||
#include "sysemu/runstate.h"
 | 
			
		||||
#include "migration/misc.h"
 | 
			
		||||
#include "migration/global_state.h"
 | 
			
		||||
#include "hw/boards.h"
 | 
			
		||||
 | 
			
		||||
//#define DEBUG_XEN
 | 
			
		||||
 | 
			
		||||
#ifdef DEBUG_XEN
 | 
			
		||||
#define DPRINTF(fmt, ...) \
 | 
			
		||||
    do { fprintf(stderr, "xen: " fmt, ## __VA_ARGS__); } while (0)
 | 
			
		||||
#else
 | 
			
		||||
#define DPRINTF(fmt, ...) \
 | 
			
		||||
    do { } while (0)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
bool xen_allowed;
 | 
			
		||||
 | 
			
		||||
xc_interface *xen_xc;
 | 
			
		||||
xenforeignmemory_handle *xen_fmem;
 | 
			
		||||
xendevicemodel_handle *xen_dmod;
 | 
			
		||||
 | 
			
		||||
static int store_dev_info(int domid, Chardev *cs, const char *string)
 | 
			
		||||
{
 | 
			
		||||
    struct xs_handle *xs = NULL;
 | 
			
		||||
    char *path = NULL;
 | 
			
		||||
    char *newpath = NULL;
 | 
			
		||||
    char *pts = NULL;
 | 
			
		||||
    int ret = -1;
 | 
			
		||||
 | 
			
		||||
    /* Only continue if we're talking to a pty. */
 | 
			
		||||
    if (!CHARDEV_IS_PTY(cs)) {
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
    pts = cs->filename + 4;
 | 
			
		||||
 | 
			
		||||
    /* We now have everything we need to set the xenstore entry. */
 | 
			
		||||
    xs = xs_open(0);
 | 
			
		||||
    if (xs == NULL) {
 | 
			
		||||
        fprintf(stderr, "Could not contact XenStore\n");
 | 
			
		||||
        goto out;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    path = xs_get_domain_path(xs, domid);
 | 
			
		||||
    if (path == NULL) {
 | 
			
		||||
        fprintf(stderr, "xs_get_domain_path() error\n");
 | 
			
		||||
        goto out;
 | 
			
		||||
    }
 | 
			
		||||
    newpath = realloc(path, (strlen(path) + strlen(string) +
 | 
			
		||||
                strlen("/tty") + 1));
 | 
			
		||||
    if (newpath == NULL) {
 | 
			
		||||
        fprintf(stderr, "realloc error\n");
 | 
			
		||||
        goto out;
 | 
			
		||||
    }
 | 
			
		||||
    path = newpath;
 | 
			
		||||
 | 
			
		||||
    strcat(path, string);
 | 
			
		||||
    strcat(path, "/tty");
 | 
			
		||||
    if (!xs_write(xs, XBT_NULL, path, pts, strlen(pts))) {
 | 
			
		||||
        fprintf(stderr, "xs_write for '%s' fail", string);
 | 
			
		||||
        goto out;
 | 
			
		||||
    }
 | 
			
		||||
    ret = 0;
 | 
			
		||||
 | 
			
		||||
out:
 | 
			
		||||
    free(path);
 | 
			
		||||
    xs_close(xs);
 | 
			
		||||
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void xenstore_store_pv_console_info(int i, Chardev *chr)
 | 
			
		||||
{
 | 
			
		||||
    if (i == 0) {
 | 
			
		||||
        store_dev_info(xen_domid, chr, "/console");
 | 
			
		||||
    } else {
 | 
			
		||||
        char buf[32];
 | 
			
		||||
        snprintf(buf, sizeof(buf), "/device/console/%d", i);
 | 
			
		||||
        store_dev_info(xen_domid, chr, buf);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void xenstore_record_dm_state(struct xs_handle *xs, const char *state)
 | 
			
		||||
{
 | 
			
		||||
    char path[50];
 | 
			
		||||
 | 
			
		||||
    if (xs == NULL) {
 | 
			
		||||
        error_report("xenstore connection not initialized");
 | 
			
		||||
        exit(1);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    snprintf(path, sizeof (path), "device-model/%u/state", xen_domid);
 | 
			
		||||
    /*
 | 
			
		||||
     * This call may fail when running restricted so don't make it fatal in
 | 
			
		||||
     * that case. Toolstacks should instead use QMP to listen for state changes.
 | 
			
		||||
     */
 | 
			
		||||
    if (!xs_write(xs, XBT_NULL, path, state, strlen(state)) &&
 | 
			
		||||
            !xen_domid_restrict) {
 | 
			
		||||
        error_report("error recording dm state");
 | 
			
		||||
        exit(1);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void xen_change_state_handler(void *opaque, bool running,
 | 
			
		||||
                                     RunState state)
 | 
			
		||||
{
 | 
			
		||||
    if (running) {
 | 
			
		||||
        /* record state running */
 | 
			
		||||
        xenstore_record_dm_state(xenstore, "running");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static bool xen_get_igd_gfx_passthru(Object *obj, Error **errp)
 | 
			
		||||
{
 | 
			
		||||
    return xen_igd_gfx_pt_enabled();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void xen_set_igd_gfx_passthru(Object *obj, bool value, Error **errp)
 | 
			
		||||
{
 | 
			
		||||
    xen_igd_gfx_pt_set(value, errp);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void xen_setup_post(MachineState *ms, AccelState *accel)
 | 
			
		||||
{
 | 
			
		||||
    int rc;
 | 
			
		||||
 | 
			
		||||
    if (xen_domid_restrict) {
 | 
			
		||||
        rc = xen_restrict(xen_domid);
 | 
			
		||||
        if (rc < 0) {
 | 
			
		||||
            perror("xen: failed to restrict");
 | 
			
		||||
            exit(1);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int xen_init(MachineState *ms)
 | 
			
		||||
{
 | 
			
		||||
    MachineClass *mc = MACHINE_GET_CLASS(ms);
 | 
			
		||||
 | 
			
		||||
    xen_xc = xc_interface_open(0, 0, 0);
 | 
			
		||||
    if (xen_xc == NULL) {
 | 
			
		||||
        xen_pv_printf(NULL, 0, "can't open xen interface\n");
 | 
			
		||||
        return -1;
 | 
			
		||||
    }
 | 
			
		||||
    xen_fmem = xenforeignmemory_open(0, 0);
 | 
			
		||||
    if (xen_fmem == NULL) {
 | 
			
		||||
        xen_pv_printf(NULL, 0, "can't open xen fmem interface\n");
 | 
			
		||||
        xc_interface_close(xen_xc);
 | 
			
		||||
        return -1;
 | 
			
		||||
    }
 | 
			
		||||
    xen_dmod = xendevicemodel_open(0, 0);
 | 
			
		||||
    if (xen_dmod == NULL) {
 | 
			
		||||
        xen_pv_printf(NULL, 0, "can't open xen devicemodel interface\n");
 | 
			
		||||
        xenforeignmemory_close(xen_fmem);
 | 
			
		||||
        xc_interface_close(xen_xc);
 | 
			
		||||
        return -1;
 | 
			
		||||
    }
 | 
			
		||||
    qemu_add_vm_change_state_handler(xen_change_state_handler, NULL);
 | 
			
		||||
    /*
 | 
			
		||||
     * opt out of system RAM being allocated by generic code
 | 
			
		||||
     */
 | 
			
		||||
    mc->default_ram_id = NULL;
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void xen_accel_class_init(ObjectClass *oc, void *data)
 | 
			
		||||
{
 | 
			
		||||
    AccelClass *ac = ACCEL_CLASS(oc);
 | 
			
		||||
    static GlobalProperty compat[] = {
 | 
			
		||||
        { "migration", "store-global-state", "off" },
 | 
			
		||||
        { "migration", "send-configuration", "off" },
 | 
			
		||||
        { "migration", "send-section-footer", "off" },
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    ac->name = "Xen";
 | 
			
		||||
    ac->init_machine = xen_init;
 | 
			
		||||
    ac->setup_post = xen_setup_post;
 | 
			
		||||
    ac->allowed = &xen_allowed;
 | 
			
		||||
    ac->compat_props = g_ptr_array_new();
 | 
			
		||||
 | 
			
		||||
    compat_props_add(ac->compat_props, compat, G_N_ELEMENTS(compat));
 | 
			
		||||
 | 
			
		||||
    object_class_property_add_bool(oc, "igd-passthru",
 | 
			
		||||
        xen_get_igd_gfx_passthru, xen_set_igd_gfx_passthru);
 | 
			
		||||
    object_class_property_set_description(oc, "igd-passthru",
 | 
			
		||||
        "Set on/off to enable/disable igd passthrou");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define TYPE_XEN_ACCEL ACCEL_CLASS_NAME("xen")
 | 
			
		||||
 | 
			
		||||
static const TypeInfo xen_accel_type = {
 | 
			
		||||
    .name = TYPE_XEN_ACCEL,
 | 
			
		||||
    .parent = TYPE_ACCEL,
 | 
			
		||||
    .class_init = xen_accel_class_init,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static void xen_accel_ops_class_init(ObjectClass *oc, void *data)
 | 
			
		||||
{
 | 
			
		||||
    AccelOpsClass *ops = ACCEL_OPS_CLASS(oc);
 | 
			
		||||
 | 
			
		||||
    ops->create_vcpu_thread = dummy_start_vcpu_thread;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const TypeInfo xen_accel_ops_type = {
 | 
			
		||||
    .name = ACCEL_OPS_NAME("xen"),
 | 
			
		||||
 | 
			
		||||
    .parent = TYPE_ACCEL_OPS,
 | 
			
		||||
    .class_init = xen_accel_ops_class_init,
 | 
			
		||||
    .abstract = true,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static void xen_type_init(void)
 | 
			
		||||
{
 | 
			
		||||
    type_register_static(&xen_accel_type);
 | 
			
		||||
    type_register_static(&xen_accel_ops_type);
 | 
			
		||||
}
 | 
			
		||||
type_init(xen_type_init);
 | 
			
		||||
							
								
								
									
										26
									
								
								aes.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								aes.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
			
		||||
#ifndef QEMU_AES_H
 | 
			
		||||
#define QEMU_AES_H
 | 
			
		||||
 | 
			
		||||
#define AES_MAXNR 14
 | 
			
		||||
#define AES_BLOCK_SIZE 16
 | 
			
		||||
 | 
			
		||||
struct aes_key_st {
 | 
			
		||||
    uint32_t rd_key[4 *(AES_MAXNR + 1)];
 | 
			
		||||
    int rounds;
 | 
			
		||||
};
 | 
			
		||||
typedef struct aes_key_st AES_KEY;
 | 
			
		||||
 | 
			
		||||
int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
 | 
			
		||||
	AES_KEY *key);
 | 
			
		||||
int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
 | 
			
		||||
	AES_KEY *key);
 | 
			
		||||
 | 
			
		||||
void AES_encrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
	const AES_KEY *key);
 | 
			
		||||
void AES_decrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
	const AES_KEY *key);
 | 
			
		||||
void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
		     const unsigned long length, const AES_KEY *key,
 | 
			
		||||
		     unsigned char *ivec, const int enc);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										1960
									
								
								alpha-dis.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1960
									
								
								alpha-dis.c
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										128
									
								
								alpha.ld
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										128
									
								
								alpha.ld
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,128 @@
 | 
			
		||||
OUTPUT_FORMAT("elf64-alpha", "elf64-alpha",
 | 
			
		||||
	      "elf64-alpha")
 | 
			
		||||
OUTPUT_ARCH(alpha)
 | 
			
		||||
ENTRY(__start)
 | 
			
		||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/alpha-unknown-linux-gnu/lib);
 | 
			
		||||
SECTIONS
 | 
			
		||||
{
 | 
			
		||||
  /* Read-only sections, merged into text segment: */
 | 
			
		||||
  . = 0x60000000 + SIZEOF_HEADERS;
 | 
			
		||||
  .interp     : { *(.interp) 	}
 | 
			
		||||
  .hash          : { *(.hash)		}
 | 
			
		||||
  .dynsym        : { *(.dynsym)		}
 | 
			
		||||
  .dynstr        : { *(.dynstr)		}
 | 
			
		||||
  .gnu.version   : { *(.gnu.version)	}
 | 
			
		||||
  .gnu.version_d   : { *(.gnu.version_d)	}
 | 
			
		||||
  .gnu.version_r   : { *(.gnu.version_r)	}
 | 
			
		||||
  .rel.text      :
 | 
			
		||||
    { *(.rel.text) *(.rel.gnu.linkonce.t*) }
 | 
			
		||||
  .rela.text     :
 | 
			
		||||
    { *(.rela.text) *(.rela.gnu.linkonce.t*) }
 | 
			
		||||
  .rel.data      :
 | 
			
		||||
    { *(.rel.data) *(.rel.gnu.linkonce.d*) }
 | 
			
		||||
  .rela.data     :
 | 
			
		||||
    { *(.rela.data) *(.rela.gnu.linkonce.d*) }
 | 
			
		||||
  .rel.rodata    :
 | 
			
		||||
    { *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
 | 
			
		||||
  .rela.rodata   :
 | 
			
		||||
    { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
 | 
			
		||||
  .rel.got       : { *(.rel.got)		}
 | 
			
		||||
  .rela.got      : { *(.rela.got)		}
 | 
			
		||||
  .rel.ctors     : { *(.rel.ctors)	}
 | 
			
		||||
  .rela.ctors    : { *(.rela.ctors)	}
 | 
			
		||||
  .rel.dtors     : { *(.rel.dtors)	}
 | 
			
		||||
  .rela.dtors    : { *(.rela.dtors)	}
 | 
			
		||||
  .rel.init      : { *(.rel.init)	}
 | 
			
		||||
  .rela.init     : { *(.rela.init)	}
 | 
			
		||||
  .rel.fini      : { *(.rel.fini)	}
 | 
			
		||||
  .rela.fini     : { *(.rela.fini)	}
 | 
			
		||||
  .rel.bss       : { *(.rel.bss)		}
 | 
			
		||||
  .rela.bss      : { *(.rela.bss)		}
 | 
			
		||||
  .rel.plt       : { *(.rel.plt)		}
 | 
			
		||||
  .rela.plt      : { *(.rela.plt)		}
 | 
			
		||||
  .init          : { *(.init)	} =0x47ff041f
 | 
			
		||||
  .text      :
 | 
			
		||||
  {
 | 
			
		||||
    *(.text)
 | 
			
		||||
    /* .gnu.warning sections are handled specially by elf32.em.  */
 | 
			
		||||
    *(.gnu.warning)
 | 
			
		||||
    *(.gnu.linkonce.t*)
 | 
			
		||||
  } =0x47ff041f
 | 
			
		||||
  _etext = .;
 | 
			
		||||
  PROVIDE (etext = .);
 | 
			
		||||
  .fini      : { *(.fini)    } =0x47ff041f
 | 
			
		||||
  .rodata    : { *(.rodata) *(.gnu.linkonce.r*) }
 | 
			
		||||
  .rodata1   : { *(.rodata1) }
 | 
			
		||||
  .reginfo : { *(.reginfo) }
 | 
			
		||||
  /* Adjust the address for the data segment.  We want to adjust up to
 | 
			
		||||
     the same address within the page on the next page up.  */
 | 
			
		||||
  . = ALIGN(0x100000) + (. & (0x100000 - 1));
 | 
			
		||||
  .data    :
 | 
			
		||||
  {
 | 
			
		||||
    *(.data)
 | 
			
		||||
    *(.gnu.linkonce.d*)
 | 
			
		||||
    CONSTRUCTORS
 | 
			
		||||
  }
 | 
			
		||||
  .data1   : { *(.data1) }
 | 
			
		||||
  .ctors         :
 | 
			
		||||
  {
 | 
			
		||||
    *(.ctors)
 | 
			
		||||
  }
 | 
			
		||||
  .dtors         :
 | 
			
		||||
  {
 | 
			
		||||
    *(.dtors)
 | 
			
		||||
  }
 | 
			
		||||
  .plt      : { *(.plt)	}
 | 
			
		||||
  .got           : { *(.got.plt) *(.got) }
 | 
			
		||||
  .dynamic       : { *(.dynamic) }
 | 
			
		||||
  /* We want the small data sections together, so single-instruction offsets
 | 
			
		||||
     can access them all, and initialized data all before uninitialized, so
 | 
			
		||||
     we can shorten the on-disk segment size.  */
 | 
			
		||||
  .sdata     : { *(.sdata) }
 | 
			
		||||
  _edata  =  .;
 | 
			
		||||
  PROVIDE (edata = .);
 | 
			
		||||
  __bss_start = .;
 | 
			
		||||
  .sbss      : { *(.sbss) *(.scommon) }
 | 
			
		||||
  .bss       :
 | 
			
		||||
  {
 | 
			
		||||
   *(.dynbss)
 | 
			
		||||
   *(.bss)
 | 
			
		||||
   *(COMMON)
 | 
			
		||||
  }
 | 
			
		||||
  _end = . ;
 | 
			
		||||
  PROVIDE (end = .);
 | 
			
		||||
  /* Stabs debugging sections.  */
 | 
			
		||||
  .stab 0 : { *(.stab) }
 | 
			
		||||
  .stabstr 0 : { *(.stabstr) }
 | 
			
		||||
  .stab.excl 0 : { *(.stab.excl) }
 | 
			
		||||
  .stab.exclstr 0 : { *(.stab.exclstr) }
 | 
			
		||||
  .stab.index 0 : { *(.stab.index) }
 | 
			
		||||
  .stab.indexstr 0 : { *(.stab.indexstr) }
 | 
			
		||||
  .comment 0 : { *(.comment) }
 | 
			
		||||
  /* DWARF debug sections.
 | 
			
		||||
     Symbols in the DWARF debugging sections are relative to the beginning
 | 
			
		||||
     of the section so we begin them at 0.  */
 | 
			
		||||
  /* DWARF 1 */
 | 
			
		||||
  .debug          0 : { *(.debug) }
 | 
			
		||||
  .line           0 : { *(.line) }
 | 
			
		||||
  /* GNU DWARF 1 extensions */
 | 
			
		||||
  .debug_srcinfo  0 : { *(.debug_srcinfo) }
 | 
			
		||||
  .debug_sfnames  0 : { *(.debug_sfnames) }
 | 
			
		||||
  /* DWARF 1.1 and DWARF 2 */
 | 
			
		||||
  .debug_aranges  0 : { *(.debug_aranges) }
 | 
			
		||||
  .debug_pubnames 0 : { *(.debug_pubnames) }
 | 
			
		||||
  /* DWARF 2 */
 | 
			
		||||
  .debug_info     0 : { *(.debug_info) }
 | 
			
		||||
  .debug_abbrev   0 : { *(.debug_abbrev) }
 | 
			
		||||
  .debug_line     0 : { *(.debug_line) }
 | 
			
		||||
  .debug_frame    0 : { *(.debug_frame) }
 | 
			
		||||
  .debug_str      0 : { *(.debug_str) }
 | 
			
		||||
  .debug_loc      0 : { *(.debug_loc) }
 | 
			
		||||
  .debug_macinfo  0 : { *(.debug_macinfo) }
 | 
			
		||||
  /* SGI/MIPS DWARF 2 extensions */
 | 
			
		||||
  .debug_weaknames 0 : { *(.debug_weaknames) }
 | 
			
		||||
  .debug_funcnames 0 : { *(.debug_funcnames) }
 | 
			
		||||
  .debug_typenames 0 : { *(.debug_typenames) }
 | 
			
		||||
  .debug_varnames  0 : { *(.debug_varnames) }
 | 
			
		||||
  /* These must appear regardless of  .  */
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										128
									
								
								arm.ld
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										128
									
								
								arm.ld
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,128 @@
 | 
			
		||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm",
 | 
			
		||||
	      "elf32-littlearm")
 | 
			
		||||
OUTPUT_ARCH(arm)
 | 
			
		||||
ENTRY(_start)
 | 
			
		||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/alpha-unknown-linux-gnu/lib);
 | 
			
		||||
SECTIONS
 | 
			
		||||
{
 | 
			
		||||
  /* Read-only sections, merged into text segment: */
 | 
			
		||||
  . = 0x60000000 + SIZEOF_HEADERS;
 | 
			
		||||
  .interp     : { *(.interp) 	}
 | 
			
		||||
  .hash          : { *(.hash)		}
 | 
			
		||||
  .dynsym        : { *(.dynsym)		}
 | 
			
		||||
  .dynstr        : { *(.dynstr)		}
 | 
			
		||||
  .gnu.version   : { *(.gnu.version)	}
 | 
			
		||||
  .gnu.version_d   : { *(.gnu.version_d)	}
 | 
			
		||||
  .gnu.version_r   : { *(.gnu.version_r)	}
 | 
			
		||||
  .rel.text      :
 | 
			
		||||
    { *(.rel.text) *(.rel.gnu.linkonce.t*) }
 | 
			
		||||
  .rela.text     :
 | 
			
		||||
    { *(.rela.text) *(.rela.gnu.linkonce.t*) }
 | 
			
		||||
  .rel.data      :
 | 
			
		||||
    { *(.rel.data) *(.rel.gnu.linkonce.d*) }
 | 
			
		||||
  .rela.data     :
 | 
			
		||||
    { *(.rela.data) *(.rela.gnu.linkonce.d*) }
 | 
			
		||||
  .rel.rodata    :
 | 
			
		||||
    { *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
 | 
			
		||||
  .rela.rodata   :
 | 
			
		||||
    { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
 | 
			
		||||
  .rel.got       : { *(.rel.got)		}
 | 
			
		||||
  .rela.got      : { *(.rela.got)		}
 | 
			
		||||
  .rel.ctors     : { *(.rel.ctors)	}
 | 
			
		||||
  .rela.ctors    : { *(.rela.ctors)	}
 | 
			
		||||
  .rel.dtors     : { *(.rel.dtors)	}
 | 
			
		||||
  .rela.dtors    : { *(.rela.dtors)	}
 | 
			
		||||
  .rel.init      : { *(.rel.init)	}
 | 
			
		||||
  .rela.init     : { *(.rela.init)	}
 | 
			
		||||
  .rel.fini      : { *(.rel.fini)	}
 | 
			
		||||
  .rela.fini     : { *(.rela.fini)	}
 | 
			
		||||
  .rel.bss       : { *(.rel.bss)		}
 | 
			
		||||
  .rela.bss      : { *(.rela.bss)		}
 | 
			
		||||
  .rel.plt       : { *(.rel.plt)		}
 | 
			
		||||
  .rela.plt      : { *(.rela.plt)		}
 | 
			
		||||
  .init          : { *(.init)	} =0x47ff041f
 | 
			
		||||
  .text      :
 | 
			
		||||
  {
 | 
			
		||||
    *(.text)
 | 
			
		||||
    /* .gnu.warning sections are handled specially by elf32.em.  */
 | 
			
		||||
    *(.gnu.warning)
 | 
			
		||||
    *(.gnu.linkonce.t*)
 | 
			
		||||
  } =0x47ff041f
 | 
			
		||||
  _etext = .;
 | 
			
		||||
  PROVIDE (etext = .);
 | 
			
		||||
  .fini      : { *(.fini)    } =0x47ff041f
 | 
			
		||||
  .rodata    : { *(.rodata) *(.gnu.linkonce.r*) }
 | 
			
		||||
  .rodata1   : { *(.rodata1) }
 | 
			
		||||
  .reginfo : { *(.reginfo) }
 | 
			
		||||
  /* Adjust the address for the data segment.  We want to adjust up to
 | 
			
		||||
     the same address within the page on the next page up.  */
 | 
			
		||||
  . = ALIGN(0x100000) + (. & (0x100000 - 1));
 | 
			
		||||
  .data    :
 | 
			
		||||
  {
 | 
			
		||||
    *(.data)
 | 
			
		||||
    *(.gnu.linkonce.d*)
 | 
			
		||||
    CONSTRUCTORS
 | 
			
		||||
  }
 | 
			
		||||
  .data1   : { *(.data1) }
 | 
			
		||||
  .ctors         :
 | 
			
		||||
  {
 | 
			
		||||
    *(.ctors)
 | 
			
		||||
  }
 | 
			
		||||
  .dtors         :
 | 
			
		||||
  {
 | 
			
		||||
    *(.dtors)
 | 
			
		||||
  }
 | 
			
		||||
  .plt      : { *(.plt)	}
 | 
			
		||||
  .got           : { *(.got.plt) *(.got) }
 | 
			
		||||
  .dynamic       : { *(.dynamic) }
 | 
			
		||||
  /* We want the small data sections together, so single-instruction offsets
 | 
			
		||||
     can access them all, and initialized data all before uninitialized, so
 | 
			
		||||
     we can shorten the on-disk segment size.  */
 | 
			
		||||
  .sdata     : { *(.sdata) }
 | 
			
		||||
  _edata  =  .;
 | 
			
		||||
  PROVIDE (edata = .);
 | 
			
		||||
  __bss_start = .;
 | 
			
		||||
  .sbss      : { *(.sbss) *(.scommon) }
 | 
			
		||||
  .bss       :
 | 
			
		||||
  {
 | 
			
		||||
   *(.dynbss)
 | 
			
		||||
   *(.bss)
 | 
			
		||||
   *(COMMON)
 | 
			
		||||
  }
 | 
			
		||||
  _end = . ;
 | 
			
		||||
  PROVIDE (end = .);
 | 
			
		||||
  /* Stabs debugging sections.  */
 | 
			
		||||
  .stab 0 : { *(.stab) }
 | 
			
		||||
  .stabstr 0 : { *(.stabstr) }
 | 
			
		||||
  .stab.excl 0 : { *(.stab.excl) }
 | 
			
		||||
  .stab.exclstr 0 : { *(.stab.exclstr) }
 | 
			
		||||
  .stab.index 0 : { *(.stab.index) }
 | 
			
		||||
  .stab.indexstr 0 : { *(.stab.indexstr) }
 | 
			
		||||
  .comment 0 : { *(.comment) }
 | 
			
		||||
  /* DWARF debug sections.
 | 
			
		||||
     Symbols in the DWARF debugging sections are relative to the beginning
 | 
			
		||||
     of the section so we begin them at 0.  */
 | 
			
		||||
  /* DWARF 1 */
 | 
			
		||||
  .debug          0 : { *(.debug) }
 | 
			
		||||
  .line           0 : { *(.line) }
 | 
			
		||||
  /* GNU DWARF 1 extensions */
 | 
			
		||||
  .debug_srcinfo  0 : { *(.debug_srcinfo) }
 | 
			
		||||
  .debug_sfnames  0 : { *(.debug_sfnames) }
 | 
			
		||||
  /* DWARF 1.1 and DWARF 2 */
 | 
			
		||||
  .debug_aranges  0 : { *(.debug_aranges) }
 | 
			
		||||
  .debug_pubnames 0 : { *(.debug_pubnames) }
 | 
			
		||||
  /* DWARF 2 */
 | 
			
		||||
  .debug_info     0 : { *(.debug_info) }
 | 
			
		||||
  .debug_abbrev   0 : { *(.debug_abbrev) }
 | 
			
		||||
  .debug_line     0 : { *(.debug_line) }
 | 
			
		||||
  .debug_frame    0 : { *(.debug_frame) }
 | 
			
		||||
  .debug_str      0 : { *(.debug_str) }
 | 
			
		||||
  .debug_loc      0 : { *(.debug_loc) }
 | 
			
		||||
  .debug_macinfo  0 : { *(.debug_macinfo) }
 | 
			
		||||
  /* SGI/MIPS DWARF 2 extensions */
 | 
			
		||||
  .debug_weaknames 0 : { *(.debug_weaknames) }
 | 
			
		||||
  .debug_funcnames 0 : { *(.debug_funcnames) }
 | 
			
		||||
  .debug_typenames 0 : { *(.debug_typenames) }
 | 
			
		||||
  .debug_varnames  0 : { *(.debug_varnames) }
 | 
			
		||||
  /* These must appear regardless of  .  */
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										1119
									
								
								audio/alsaaudio.c
									
									
									
									
									
								
							
							
						
						
									
										1119
									
								
								audio/alsaaudio.c
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										2414
									
								
								audio/audio.c
									
									
									
									
									
								
							
							
						
						
									
										2414
									
								
								audio/audio.c
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										152
									
								
								audio/audio.h
									
									
									
									
									
								
							
							
						
						
									
										152
									
								
								audio/audio.h
									
									
									
									
									
								
							@@ -21,100 +21,64 @@
 | 
			
		||||
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 | 
			
		||||
 * THE SOFTWARE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef QEMU_AUDIO_H
 | 
			
		||||
#define QEMU_AUDIO_H
 | 
			
		||||
 | 
			
		||||
#include "qemu/queue.h"
 | 
			
		||||
#include "qapi/qapi-types-audio.h"
 | 
			
		||||
#include "hw/qdev-properties.h"
 | 
			
		||||
#include "hw/qdev-properties-system.h"
 | 
			
		||||
#include "sys-queue.h"
 | 
			
		||||
 | 
			
		||||
typedef void (*audio_callback_fn) (void *opaque, int avail);
 | 
			
		||||
 | 
			
		||||
#ifdef HOST_WORDS_BIGENDIAN
 | 
			
		||||
#define AUDIO_HOST_ENDIANNESS 1
 | 
			
		||||
#else
 | 
			
		||||
#define AUDIO_HOST_ENDIANNESS 0
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
typedef struct audsettings {
 | 
			
		||||
    int freq;
 | 
			
		||||
    int nchannels;
 | 
			
		||||
    AudioFormat fmt;
 | 
			
		||||
    int endianness;
 | 
			
		||||
} audsettings;
 | 
			
		||||
 | 
			
		||||
audsettings audiodev_to_audsettings(AudiodevPerDirectionOptions *pdo);
 | 
			
		||||
int audioformat_bytes_per_sample(AudioFormat fmt);
 | 
			
		||||
int audio_buffer_frames(AudiodevPerDirectionOptions *pdo,
 | 
			
		||||
                        audsettings *as, int def_usecs);
 | 
			
		||||
int audio_buffer_samples(AudiodevPerDirectionOptions *pdo,
 | 
			
		||||
                         audsettings *as, int def_usecs);
 | 
			
		||||
int audio_buffer_bytes(AudiodevPerDirectionOptions *pdo,
 | 
			
		||||
                       audsettings *as, int def_usecs);
 | 
			
		||||
typedef void (*audio_callback_fn_t) (void *opaque, int avail);
 | 
			
		||||
 | 
			
		||||
typedef enum {
 | 
			
		||||
    AUD_CNOTIFY_ENABLE,
 | 
			
		||||
    AUD_CNOTIFY_DISABLE
 | 
			
		||||
} audcnotification_e;
 | 
			
		||||
    AUD_FMT_U8,
 | 
			
		||||
    AUD_FMT_S8,
 | 
			
		||||
    AUD_FMT_U16,
 | 
			
		||||
    AUD_FMT_S16
 | 
			
		||||
} audfmt_e;
 | 
			
		||||
 | 
			
		||||
struct audio_capture_ops {
 | 
			
		||||
    void (*notify) (void *opaque, audcnotification_e cmd);
 | 
			
		||||
    void (*capture) (void *opaque, const void *buf, int size);
 | 
			
		||||
    void (*destroy) (void *opaque);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct capture_ops {
 | 
			
		||||
    void (*info) (void *opaque);
 | 
			
		||||
    void (*destroy) (void *opaque);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
typedef struct CaptureState {
 | 
			
		||||
    void *opaque;
 | 
			
		||||
    struct capture_ops ops;
 | 
			
		||||
    QLIST_ENTRY (CaptureState) entries;
 | 
			
		||||
} CaptureState;
 | 
			
		||||
 | 
			
		||||
typedef struct SWVoiceOut SWVoiceOut;
 | 
			
		||||
typedef struct CaptureVoiceOut CaptureVoiceOut;
 | 
			
		||||
typedef struct SWVoiceIn SWVoiceIn;
 | 
			
		||||
typedef struct {
 | 
			
		||||
    int freq;
 | 
			
		||||
    int nchannels;
 | 
			
		||||
    audfmt_e fmt;
 | 
			
		||||
} audsettings_t;
 | 
			
		||||
 | 
			
		||||
typedef struct AudioState AudioState;
 | 
			
		||||
typedef struct SWVoiceOut SWVoiceOut;
 | 
			
		||||
typedef struct SWVoiceIn SWVoiceIn;
 | 
			
		||||
 | 
			
		||||
typedef struct QEMUSoundCard {
 | 
			
		||||
    AudioState *audio;
 | 
			
		||||
    char *name;
 | 
			
		||||
    AudioState *state;
 | 
			
		||||
    QLIST_ENTRY (QEMUSoundCard) entries;
 | 
			
		||||
    LIST_ENTRY (QEMUSoundCard) entries;
 | 
			
		||||
} QEMUSoundCard;
 | 
			
		||||
 | 
			
		||||
typedef struct QEMUAudioTimeStamp {
 | 
			
		||||
    uint64_t old_ts;
 | 
			
		||||
} QEMUAudioTimeStamp;
 | 
			
		||||
 | 
			
		||||
void AUD_vlog (const char *cap, const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0);
 | 
			
		||||
void AUD_log (const char *cap, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
 | 
			
		||||
void AUD_vlog (const char *cap, const char *fmt, va_list ap);
 | 
			
		||||
void AUD_log (const char *cap, const char *fmt, ...)
 | 
			
		||||
#ifdef __GNUC__
 | 
			
		||||
    __attribute__ ((__format__ (__printf__, 2, 3)))
 | 
			
		||||
#endif
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
void AUD_register_card (const char *name, QEMUSoundCard *card);
 | 
			
		||||
AudioState *AUD_init (void);
 | 
			
		||||
void AUD_help (void);
 | 
			
		||||
void AUD_register_card (AudioState *s, const char *name, QEMUSoundCard *card);
 | 
			
		||||
void AUD_remove_card (QEMUSoundCard *card);
 | 
			
		||||
CaptureVoiceOut *AUD_add_capture(
 | 
			
		||||
    AudioState *s,
 | 
			
		||||
    struct audsettings *as,
 | 
			
		||||
    struct audio_capture_ops *ops,
 | 
			
		||||
    void *opaque
 | 
			
		||||
    );
 | 
			
		||||
void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque);
 | 
			
		||||
 | 
			
		||||
SWVoiceOut *AUD_open_out (
 | 
			
		||||
    QEMUSoundCard *card,
 | 
			
		||||
    SWVoiceOut *sw,
 | 
			
		||||
    const char *name,
 | 
			
		||||
    void *callback_opaque,
 | 
			
		||||
    audio_callback_fn callback_fn,
 | 
			
		||||
    struct audsettings *settings
 | 
			
		||||
    audio_callback_fn_t callback_fn,
 | 
			
		||||
    audsettings_t *settings,
 | 
			
		||||
    int sw_endian
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
void AUD_close_out (QEMUSoundCard *card, SWVoiceOut *sw);
 | 
			
		||||
size_t AUD_write (SWVoiceOut *sw, void *pcm_buf, size_t size);
 | 
			
		||||
int  AUD_write (SWVoiceOut *sw, void *pcm_buf, int size);
 | 
			
		||||
int  AUD_get_buffer_size_out (SWVoiceOut *sw);
 | 
			
		||||
void AUD_set_active_out (SWVoiceOut *sw, int on);
 | 
			
		||||
int  AUD_is_active_out (SWVoiceOut *sw);
 | 
			
		||||
@@ -122,30 +86,18 @@ int  AUD_is_active_out (SWVoiceOut *sw);
 | 
			
		||||
void     AUD_init_time_stamp_out (SWVoiceOut *sw, QEMUAudioTimeStamp *ts);
 | 
			
		||||
uint64_t AUD_get_elapsed_usec_out (SWVoiceOut *sw, QEMUAudioTimeStamp *ts);
 | 
			
		||||
 | 
			
		||||
void AUD_set_volume_out (SWVoiceOut *sw, int mute, uint8_t lvol, uint8_t rvol);
 | 
			
		||||
void AUD_set_volume_in (SWVoiceIn *sw, int mute, uint8_t lvol, uint8_t rvol);
 | 
			
		||||
 | 
			
		||||
#define AUDIO_MAX_CHANNELS 16
 | 
			
		||||
typedef struct Volume {
 | 
			
		||||
    bool mute;
 | 
			
		||||
    int channels;
 | 
			
		||||
    uint8_t vol[AUDIO_MAX_CHANNELS];
 | 
			
		||||
} Volume;
 | 
			
		||||
 | 
			
		||||
void audio_set_volume_out(SWVoiceOut *sw, Volume *vol);
 | 
			
		||||
void audio_set_volume_in(SWVoiceIn *sw, Volume *vol);
 | 
			
		||||
 | 
			
		||||
SWVoiceIn *AUD_open_in (
 | 
			
		||||
    QEMUSoundCard *card,
 | 
			
		||||
    SWVoiceIn *sw,
 | 
			
		||||
    const char *name,
 | 
			
		||||
    void *callback_opaque,
 | 
			
		||||
    audio_callback_fn callback_fn,
 | 
			
		||||
    struct audsettings *settings
 | 
			
		||||
    audio_callback_fn_t callback_fn,
 | 
			
		||||
    audsettings_t *settings,
 | 
			
		||||
    int sw_endian
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
void AUD_close_in (QEMUSoundCard *card, SWVoiceIn *sw);
 | 
			
		||||
size_t AUD_read (SWVoiceIn *sw, void *pcm_buf, size_t size);
 | 
			
		||||
int  AUD_read (SWVoiceIn *sw, void *pcm_buf, int size);
 | 
			
		||||
void AUD_set_active_in (SWVoiceIn *sw, int on);
 | 
			
		||||
int  AUD_is_active_in (SWVoiceIn *sw);
 | 
			
		||||
 | 
			
		||||
@@ -158,24 +110,24 @@ static inline void *advance (void *p, int incr)
 | 
			
		||||
    return (d + incr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int wav_start_capture(AudioState *state, CaptureState *s, const char *path,
 | 
			
		||||
                      int freq, int bits, int nchannels);
 | 
			
		||||
uint32_t popcount (uint32_t u);
 | 
			
		||||
inline uint32_t lsbindex (uint32_t u);
 | 
			
		||||
 | 
			
		||||
void audio_cleanup(void);
 | 
			
		||||
#ifdef __GNUC__
 | 
			
		||||
#define audio_MIN(a, b) ( __extension__ ({      \
 | 
			
		||||
    __typeof (a) ta = a;                        \
 | 
			
		||||
    __typeof (b) tb = b;                        \
 | 
			
		||||
    ((ta)>(tb)?(tb):(ta));                      \
 | 
			
		||||
}))
 | 
			
		||||
 | 
			
		||||
void audio_sample_to_uint64(const void *samples, int pos,
 | 
			
		||||
                            uint64_t *left, uint64_t *right);
 | 
			
		||||
void audio_sample_from_uint64(void *samples, int pos,
 | 
			
		||||
                            uint64_t left, uint64_t right);
 | 
			
		||||
#define audio_MAX(a, b) ( __extension__ ({      \
 | 
			
		||||
    __typeof (a) ta = a;                        \
 | 
			
		||||
    __typeof (b) tb = b;                        \
 | 
			
		||||
    ((ta)<(tb)?(tb):(ta));                      \
 | 
			
		||||
}))
 | 
			
		||||
#else
 | 
			
		||||
#define audio_MIN(a, b) ((a)>(b)?(b):(a))
 | 
			
		||||
#define audio_MAX(a, b) ((a)<(b)?(b):(a))
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
void audio_parse_option(const char *opt);
 | 
			
		||||
void audio_init_audiodevs(void);
 | 
			
		||||
void audio_legacy_help(void);
 | 
			
		||||
 | 
			
		||||
AudioState *audio_state_by_name(const char *name);
 | 
			
		||||
const char *audio_get_id(QEMUSoundCard *card);
 | 
			
		||||
 | 
			
		||||
#define DEFINE_AUDIO_PROPERTIES(_s, _f)         \
 | 
			
		||||
    DEFINE_PROP_AUDIODEV("audiodev", _s, _f)
 | 
			
		||||
 | 
			
		||||
#endif /* QEMU_AUDIO_H */
 | 
			
		||||
#endif  /* audio.h */
 | 
			
		||||
 
 | 
			
		||||
@@ -21,11 +21,10 @@
 | 
			
		||||
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 | 
			
		||||
 * THE SOFTWARE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef QEMU_AUDIO_INT_H
 | 
			
		||||
#define QEMU_AUDIO_INT_H
 | 
			
		||||
 | 
			
		||||
#ifdef CONFIG_AUDIO_COREAUDIO
 | 
			
		||||
#ifdef CONFIG_COREAUDIO
 | 
			
		||||
#define FLOAT_MIXENG
 | 
			
		||||
/* #define RECIPROCAL */
 | 
			
		||||
#endif
 | 
			
		||||
@@ -33,112 +32,111 @@
 | 
			
		||||
 | 
			
		||||
struct audio_pcm_ops;
 | 
			
		||||
 | 
			
		||||
typedef enum {
 | 
			
		||||
    AUD_OPT_INT,
 | 
			
		||||
    AUD_OPT_FMT,
 | 
			
		||||
    AUD_OPT_STR,
 | 
			
		||||
    AUD_OPT_BOOL
 | 
			
		||||
} audio_option_tag_e;
 | 
			
		||||
 | 
			
		||||
struct audio_option {
 | 
			
		||||
    const char *name;
 | 
			
		||||
    audio_option_tag_e tag;
 | 
			
		||||
    void *valp;
 | 
			
		||||
    const char *descr;
 | 
			
		||||
    int *overridenp;
 | 
			
		||||
    int overriden;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct audio_callback {
 | 
			
		||||
    void *opaque;
 | 
			
		||||
    audio_callback_fn fn;
 | 
			
		||||
    audio_callback_fn_t fn;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct audio_pcm_info {
 | 
			
		||||
    int bits;
 | 
			
		||||
    bool is_signed;
 | 
			
		||||
    bool is_float;
 | 
			
		||||
    int sign;
 | 
			
		||||
    int freq;
 | 
			
		||||
    int nchannels;
 | 
			
		||||
    int bytes_per_frame;
 | 
			
		||||
    int align;
 | 
			
		||||
    int shift;
 | 
			
		||||
    int bytes_per_second;
 | 
			
		||||
    int swap_endianness;
 | 
			
		||||
    int swap_endian;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
typedef struct AudioState AudioState;
 | 
			
		||||
typedef struct SWVoiceCap SWVoiceCap;
 | 
			
		||||
 | 
			
		||||
typedef struct STSampleBuffer {
 | 
			
		||||
    size_t pos, size;
 | 
			
		||||
    st_sample samples[];
 | 
			
		||||
} STSampleBuffer;
 | 
			
		||||
 | 
			
		||||
typedef struct HWVoiceOut {
 | 
			
		||||
    AudioState *s;
 | 
			
		||||
    int enabled;
 | 
			
		||||
    int poll_mode;
 | 
			
		||||
    int pending_disable;
 | 
			
		||||
    int valid;
 | 
			
		||||
    struct audio_pcm_info info;
 | 
			
		||||
 | 
			
		||||
    f_sample *clip;
 | 
			
		||||
 | 
			
		||||
    int rpos;
 | 
			
		||||
    uint64_t ts_helper;
 | 
			
		||||
 | 
			
		||||
    STSampleBuffer *mix_buf;
 | 
			
		||||
    void *buf_emul;
 | 
			
		||||
    size_t pos_emul, pending_emul, size_emul;
 | 
			
		||||
    st_sample_t *mix_buf;
 | 
			
		||||
 | 
			
		||||
    size_t samples;
 | 
			
		||||
    QLIST_HEAD (sw_out_listhead, SWVoiceOut) sw_head;
 | 
			
		||||
    QLIST_HEAD (sw_cap_listhead, SWVoiceCap) cap_head;
 | 
			
		||||
    int samples;
 | 
			
		||||
    LIST_HEAD (sw_out_listhead, SWVoiceOut) sw_head;
 | 
			
		||||
    struct audio_pcm_ops *pcm_ops;
 | 
			
		||||
    QLIST_ENTRY (HWVoiceOut) entries;
 | 
			
		||||
    LIST_ENTRY (HWVoiceOut) entries;
 | 
			
		||||
} HWVoiceOut;
 | 
			
		||||
 | 
			
		||||
typedef struct HWVoiceIn {
 | 
			
		||||
    AudioState *s;
 | 
			
		||||
    int enabled;
 | 
			
		||||
    int poll_mode;
 | 
			
		||||
    struct audio_pcm_info info;
 | 
			
		||||
 | 
			
		||||
    t_sample *conv;
 | 
			
		||||
 | 
			
		||||
    size_t total_samples_captured;
 | 
			
		||||
    int wpos;
 | 
			
		||||
    int total_samples_captured;
 | 
			
		||||
    uint64_t ts_helper;
 | 
			
		||||
 | 
			
		||||
    STSampleBuffer *conv_buf;
 | 
			
		||||
    void *buf_emul;
 | 
			
		||||
    size_t pos_emul, pending_emul, size_emul;
 | 
			
		||||
    st_sample_t *conv_buf;
 | 
			
		||||
 | 
			
		||||
    size_t samples;
 | 
			
		||||
    QLIST_HEAD (sw_in_listhead, SWVoiceIn) sw_head;
 | 
			
		||||
    int samples;
 | 
			
		||||
    LIST_HEAD (sw_in_listhead, SWVoiceIn) sw_head;
 | 
			
		||||
    struct audio_pcm_ops *pcm_ops;
 | 
			
		||||
    QLIST_ENTRY (HWVoiceIn) entries;
 | 
			
		||||
    LIST_ENTRY (HWVoiceIn) entries;
 | 
			
		||||
} HWVoiceIn;
 | 
			
		||||
 | 
			
		||||
struct SWVoiceOut {
 | 
			
		||||
    QEMUSoundCard *card;
 | 
			
		||||
    AudioState *s;
 | 
			
		||||
    struct audio_pcm_info info;
 | 
			
		||||
    t_sample *conv;
 | 
			
		||||
    int64_t ratio;
 | 
			
		||||
    struct st_sample *buf;
 | 
			
		||||
    st_sample_t *buf;
 | 
			
		||||
    void *rate;
 | 
			
		||||
    size_t total_hw_samples_mixed;
 | 
			
		||||
    int total_hw_samples_mixed;
 | 
			
		||||
    int active;
 | 
			
		||||
    int empty;
 | 
			
		||||
    HWVoiceOut *hw;
 | 
			
		||||
    char *name;
 | 
			
		||||
    struct mixeng_volume vol;
 | 
			
		||||
    volume_t vol;
 | 
			
		||||
    struct audio_callback callback;
 | 
			
		||||
    QLIST_ENTRY (SWVoiceOut) entries;
 | 
			
		||||
    LIST_ENTRY (SWVoiceOut) entries;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct SWVoiceIn {
 | 
			
		||||
    QEMUSoundCard *card;
 | 
			
		||||
    AudioState *s;
 | 
			
		||||
    int active;
 | 
			
		||||
    struct audio_pcm_info info;
 | 
			
		||||
    int64_t ratio;
 | 
			
		||||
    void *rate;
 | 
			
		||||
    size_t total_hw_samples_acquired;
 | 
			
		||||
    struct st_sample *buf;
 | 
			
		||||
    int total_hw_samples_acquired;
 | 
			
		||||
    st_sample_t *buf;
 | 
			
		||||
    f_sample *clip;
 | 
			
		||||
    HWVoiceIn *hw;
 | 
			
		||||
    char *name;
 | 
			
		||||
    struct mixeng_volume vol;
 | 
			
		||||
    volume_t vol;
 | 
			
		||||
    struct audio_callback callback;
 | 
			
		||||
    QLIST_ENTRY (SWVoiceIn) entries;
 | 
			
		||||
    LIST_ENTRY (SWVoiceIn) entries;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
typedef struct audio_driver audio_driver;
 | 
			
		||||
struct audio_driver {
 | 
			
		||||
    const char *name;
 | 
			
		||||
    const char *descr;
 | 
			
		||||
    void *(*init) (Audiodev *);
 | 
			
		||||
    struct audio_option *options;
 | 
			
		||||
    void *(*init) (void);
 | 
			
		||||
    void (*fini) (void *);
 | 
			
		||||
    struct audio_pcm_ops *pcm_ops;
 | 
			
		||||
    int can_be_default;
 | 
			
		||||
@@ -146,140 +144,125 @@ struct audio_driver {
 | 
			
		||||
    int max_voices_in;
 | 
			
		||||
    int voice_size_out;
 | 
			
		||||
    int voice_size_in;
 | 
			
		||||
    QLIST_ENTRY(audio_driver) next;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct audio_pcm_ops {
 | 
			
		||||
    int    (*init_out)(HWVoiceOut *hw, audsettings *as, void *drv_opaque);
 | 
			
		||||
    void   (*fini_out)(HWVoiceOut *hw);
 | 
			
		||||
    size_t (*write)   (HWVoiceOut *hw, void *buf, size_t size);
 | 
			
		||||
    void   (*run_buffer_out)(HWVoiceOut *hw);
 | 
			
		||||
    /*
 | 
			
		||||
     * get a buffer that after later can be passed to put_buffer_out; optional
 | 
			
		||||
     * returns the buffer, and writes it's size to size (in bytes)
 | 
			
		||||
     * this is unrelated to the above buffer_size_out function
 | 
			
		||||
     */
 | 
			
		||||
    void  *(*get_buffer_out)(HWVoiceOut *hw, size_t *size);
 | 
			
		||||
    /*
 | 
			
		||||
     * put back the buffer returned by get_buffer_out; optional
 | 
			
		||||
     * buf must be equal the pointer returned by get_buffer_out,
 | 
			
		||||
     * size may be smaller
 | 
			
		||||
     */
 | 
			
		||||
    size_t (*put_buffer_out)(HWVoiceOut *hw, void *buf, size_t size);
 | 
			
		||||
    void   (*enable_out)(HWVoiceOut *hw, bool enable);
 | 
			
		||||
    void   (*volume_out)(HWVoiceOut *hw, Volume *vol);
 | 
			
		||||
    int  (*init_out)(HWVoiceOut *hw, audsettings_t *as);
 | 
			
		||||
    void (*fini_out)(HWVoiceOut *hw);
 | 
			
		||||
    int  (*run_out) (HWVoiceOut *hw);
 | 
			
		||||
    int  (*write)   (SWVoiceOut *sw, void *buf, int size);
 | 
			
		||||
    int  (*ctl_out) (HWVoiceOut *hw, int cmd, ...);
 | 
			
		||||
 | 
			
		||||
    int    (*init_in) (HWVoiceIn *hw, audsettings *as, void *drv_opaque);
 | 
			
		||||
    void   (*fini_in) (HWVoiceIn *hw);
 | 
			
		||||
    size_t (*read)    (HWVoiceIn *hw, void *buf, size_t size);
 | 
			
		||||
    void   (*run_buffer_in)(HWVoiceIn *hw);
 | 
			
		||||
    void  *(*get_buffer_in)(HWVoiceIn *hw, size_t *size);
 | 
			
		||||
    void   (*put_buffer_in)(HWVoiceIn *hw, void *buf, size_t size);
 | 
			
		||||
    void   (*enable_in)(HWVoiceIn *hw, bool enable);
 | 
			
		||||
    void   (*volume_in)(HWVoiceIn *hw, Volume *vol);
 | 
			
		||||
    int  (*init_in) (HWVoiceIn *hw, audsettings_t *as);
 | 
			
		||||
    void (*fini_in) (HWVoiceIn *hw);
 | 
			
		||||
    int  (*run_in)  (HWVoiceIn *hw);
 | 
			
		||||
    int  (*read)    (SWVoiceIn *sw, void *buf, int size);
 | 
			
		||||
    int  (*ctl_in)  (HWVoiceIn *hw, int cmd, ...);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void audio_generic_run_buffer_in(HWVoiceIn *hw);
 | 
			
		||||
void *audio_generic_get_buffer_in(HWVoiceIn *hw, size_t *size);
 | 
			
		||||
void audio_generic_put_buffer_in(HWVoiceIn *hw, void *buf, size_t size);
 | 
			
		||||
void audio_generic_run_buffer_out(HWVoiceOut *hw);
 | 
			
		||||
void *audio_generic_get_buffer_out(HWVoiceOut *hw, size_t *size);
 | 
			
		||||
size_t audio_generic_put_buffer_out(HWVoiceOut *hw, void *buf, size_t size);
 | 
			
		||||
size_t audio_generic_write(HWVoiceOut *hw, void *buf, size_t size);
 | 
			
		||||
size_t audio_generic_read(HWVoiceIn *hw, void *buf, size_t size);
 | 
			
		||||
 | 
			
		||||
struct capture_callback {
 | 
			
		||||
    struct audio_capture_ops ops;
 | 
			
		||||
    void *opaque;
 | 
			
		||||
    QLIST_ENTRY (capture_callback) entries;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct CaptureVoiceOut {
 | 
			
		||||
    HWVoiceOut hw;
 | 
			
		||||
    void *buf;
 | 
			
		||||
    QLIST_HEAD (cb_listhead, capture_callback) cb_head;
 | 
			
		||||
    QLIST_ENTRY (CaptureVoiceOut) entries;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct SWVoiceCap {
 | 
			
		||||
    SWVoiceOut sw;
 | 
			
		||||
    CaptureVoiceOut *cap;
 | 
			
		||||
    QLIST_ENTRY (SWVoiceCap) entries;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
typedef struct AudioState {
 | 
			
		||||
struct AudioState {
 | 
			
		||||
    struct audio_driver *drv;
 | 
			
		||||
    Audiodev *dev;
 | 
			
		||||
    void *drv_opaque;
 | 
			
		||||
 | 
			
		||||
    QEMUTimer *ts;
 | 
			
		||||
    QLIST_HEAD (card_listhead, QEMUSoundCard) card_head;
 | 
			
		||||
    QLIST_HEAD (hw_in_listhead, HWVoiceIn) hw_head_in;
 | 
			
		||||
    QLIST_HEAD (hw_out_listhead, HWVoiceOut) hw_head_out;
 | 
			
		||||
    QLIST_HEAD (cap_listhead, CaptureVoiceOut) cap_head;
 | 
			
		||||
    LIST_HEAD (card_head, QEMUSoundCard) card_head;
 | 
			
		||||
    LIST_HEAD (hw_in_listhead, HWVoiceIn) hw_head_in;
 | 
			
		||||
    LIST_HEAD (hw_out_listhead, HWVoiceOut) hw_head_out;
 | 
			
		||||
    int nb_hw_voices_out;
 | 
			
		||||
    int nb_hw_voices_in;
 | 
			
		||||
    int vm_running;
 | 
			
		||||
    int64_t period_ticks;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
    bool timer_running;
 | 
			
		||||
    uint64_t timer_last;
 | 
			
		||||
extern struct audio_driver no_audio_driver;
 | 
			
		||||
extern struct audio_driver oss_audio_driver;
 | 
			
		||||
extern struct audio_driver sdl_audio_driver;
 | 
			
		||||
extern struct audio_driver wav_audio_driver;
 | 
			
		||||
extern struct audio_driver fmod_audio_driver;
 | 
			
		||||
extern struct audio_driver alsa_audio_driver;
 | 
			
		||||
extern struct audio_driver coreaudio_audio_driver;
 | 
			
		||||
extern struct audio_driver dsound_audio_driver;
 | 
			
		||||
extern volume_t nominal_volume;
 | 
			
		||||
 | 
			
		||||
    QTAILQ_ENTRY(AudioState) list;
 | 
			
		||||
} AudioState;
 | 
			
		||||
 | 
			
		||||
extern const struct mixeng_volume nominal_volume;
 | 
			
		||||
 | 
			
		||||
extern const char *audio_prio_list[];
 | 
			
		||||
 | 
			
		||||
void audio_driver_register(audio_driver *drv);
 | 
			
		||||
audio_driver *audio_driver_lookup(const char *name);
 | 
			
		||||
 | 
			
		||||
void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings *as);
 | 
			
		||||
void audio_pcm_init_info (struct audio_pcm_info *info, audsettings_t *as,
 | 
			
		||||
                          int swap_endian);
 | 
			
		||||
void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int len);
 | 
			
		||||
 | 
			
		||||
int  audio_pcm_sw_write (SWVoiceOut *sw, void *buf, int len);
 | 
			
		||||
int  audio_pcm_hw_get_live_in (HWVoiceIn *hw);
 | 
			
		||||
 | 
			
		||||
int  audio_pcm_sw_read (SWVoiceIn *sw, void *buf, int len);
 | 
			
		||||
int  audio_pcm_hw_get_live_out (HWVoiceOut *hw);
 | 
			
		||||
int  audio_pcm_hw_get_live_out2 (HWVoiceOut *hw, int *nb_live);
 | 
			
		||||
 | 
			
		||||
int audio_bug (const char *funcname, int cond);
 | 
			
		||||
void *audio_calloc (const char *funcname, int nmemb, size_t size);
 | 
			
		||||
 | 
			
		||||
void audio_run(AudioState *s, const char *msg);
 | 
			
		||||
#define VOICE_ENABLE 1
 | 
			
		||||
#define VOICE_DISABLE 2
 | 
			
		||||
 | 
			
		||||
typedef struct RateCtl {
 | 
			
		||||
    int64_t start_ticks;
 | 
			
		||||
    int64_t bytes_sent;
 | 
			
		||||
} RateCtl;
 | 
			
		||||
 | 
			
		||||
void audio_rate_start(RateCtl *rate);
 | 
			
		||||
size_t audio_rate_get_bytes(struct audio_pcm_info *info, RateCtl *rate,
 | 
			
		||||
                            size_t bytes_avail);
 | 
			
		||||
 | 
			
		||||
static inline size_t audio_ring_dist(size_t dst, size_t src, size_t len)
 | 
			
		||||
static inline int audio_ring_dist (int dst, int src, int len)
 | 
			
		||||
{
 | 
			
		||||
    return (dst >= src) ? (dst - src) : (len - src + dst);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define dolog(fmt, ...) AUD_log(AUDIO_CAP, fmt, ## __VA_ARGS__)
 | 
			
		||||
static inline int audio_need_to_swap_endian (int endianness)
 | 
			
		||||
{
 | 
			
		||||
#ifdef WORDS_BIGENDIAN
 | 
			
		||||
    return endianness != 1;
 | 
			
		||||
#else
 | 
			
		||||
    return endianness != 0;
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if defined __GNUC__
 | 
			
		||||
#define GCC_ATTR __attribute__ ((__unused__, __format__ (__printf__, 1, 2)))
 | 
			
		||||
#define INIT_FIELD(f) . f
 | 
			
		||||
#define GCC_FMT_ATTR(n, m) __attribute__ ((__format__ (__printf__, n, m)))
 | 
			
		||||
#else
 | 
			
		||||
#define GCC_ATTR /**/
 | 
			
		||||
#define INIT_FIELD(f) /**/
 | 
			
		||||
#define GCC_FMT_ATTR(n, m)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
static void GCC_ATTR dolog (const char *fmt, ...)
 | 
			
		||||
{
 | 
			
		||||
    va_list ap;
 | 
			
		||||
 | 
			
		||||
    va_start (ap, fmt);
 | 
			
		||||
    AUD_vlog (AUDIO_CAP, fmt, ap);
 | 
			
		||||
    va_end (ap);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
#define ldebug(fmt, ...) AUD_log(AUDIO_CAP, fmt, ## __VA_ARGS__)
 | 
			
		||||
static void GCC_ATTR ldebug (const char *fmt, ...)
 | 
			
		||||
{
 | 
			
		||||
    va_list ap;
 | 
			
		||||
 | 
			
		||||
    va_start (ap, fmt);
 | 
			
		||||
    AUD_vlog (AUDIO_CAP, fmt, ap);
 | 
			
		||||
    va_end (ap);
 | 
			
		||||
}
 | 
			
		||||
#else
 | 
			
		||||
#define ldebug(fmt, ...) (void)0
 | 
			
		||||
#if defined NDEBUG && defined __GNUC__
 | 
			
		||||
#define ldebug(...)
 | 
			
		||||
#elif defined NDEBUG && defined _MSC_VER
 | 
			
		||||
#define ldebug __noop
 | 
			
		||||
#else
 | 
			
		||||
static void GCC_ATTR ldebug (const char *fmt, ...)
 | 
			
		||||
{
 | 
			
		||||
    (void) fmt;
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#undef GCC_ATTR
 | 
			
		||||
 | 
			
		||||
#define AUDIO_STRINGIFY_(n) #n
 | 
			
		||||
#define AUDIO_STRINGIFY(n) AUDIO_STRINGIFY_(n)
 | 
			
		||||
 | 
			
		||||
typedef struct AudiodevListEntry {
 | 
			
		||||
    Audiodev *dev;
 | 
			
		||||
    QSIMPLEQ_ENTRY(AudiodevListEntry) next;
 | 
			
		||||
} AudiodevListEntry;
 | 
			
		||||
#if defined _MSC_VER || defined __GNUC__
 | 
			
		||||
#define AUDIO_FUNC __FUNCTION__
 | 
			
		||||
#else
 | 
			
		||||
#define AUDIO_FUNC __FILE__ ":" AUDIO_STRINGIFY (__LINE__)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
typedef QSIMPLEQ_HEAD(, AudiodevListEntry) AudiodevListHead;
 | 
			
		||||
AudiodevListHead audio_handle_legacy_opts(void);
 | 
			
		||||
 | 
			
		||||
void audio_free_audiodev_list(AudiodevListHead *head);
 | 
			
		||||
 | 
			
		||||
void audio_create_pdos(Audiodev *dev);
 | 
			
		||||
AudiodevPerDirectionOptions *audio_get_pdo_in(Audiodev *dev);
 | 
			
		||||
AudiodevPerDirectionOptions *audio_get_pdo_out(Audiodev *dev);
 | 
			
		||||
 | 
			
		||||
#endif /* QEMU_AUDIO_INT_H */
 | 
			
		||||
#endif /* audio_int.h */
 | 
			
		||||
 
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user