Skip to content

Commit

Permalink
Upgrade FEMU to use QEMU4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
huaicheng committed Oct 11, 2019
1 parent 2be5b9b commit 34b3567
Show file tree
Hide file tree
Showing 7,863 changed files with 1,920,137 additions and 287,912 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
99 changes: 95 additions & 4 deletions CODING_STYLE
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,45 @@ Spaces of course are superior to tabs because:

Do not leave whitespace dangling off the ends of lines.

1.1 Multiline Indent

There are several places where indent is necessary:

- if/else
- while/for
- function definition & call

When breaking up a long line to fit within line width, we need a proper indent
for the following lines.

In case of if/else, while/for, align the secondary lines just after the
opening parenthesis of the first.

For example:

if (a == 1 &&
b == 2) {

while (a == 1 &&
b == 2) {

In case of function, there are several variants:

* 4 spaces indent from the beginning
* align the secondary lines just after the opening parenthesis of the
first

For example:

do_something(x, y,
z);

do_something(x, y,
z);

do_something(x, do_another(y,
z));

2. Line width

Lines should be 80 characters; try not to make them longer.
Expand Down Expand Up @@ -108,10 +147,10 @@ block to a separate function altogether.
When comparing a variable for (in)equality with a constant, list the
constant on the right, as in:

if (a == 1) {
/* Reads like: "If a equals 1" */
do_something();
}
if (a == 1) {
/* Reads like: "If a equals 1" */
do_something();
}

Rationale: Yoda conditions (as in 'if (1 == a)') are awkward to read.
Besides, good compilers already warn users when '==' is mis-typed as '=',
Expand All @@ -123,3 +162,55 @@ We use traditional C-style /* */ comments and avoid // comments.

Rationale: The // form is valid in C99, so this is purely a matter of
consistency of style. The checkpatch script will warn you about this.

Multiline comment blocks should have a row of stars on the left,
and the initial /* and terminating */ both on their own lines:
/*
* like
* this
*/
This is the same format required by the Linux kernel coding style.

(Some of the existing comments in the codebase use the GNU Coding
Standards form which does not have stars on the left, or other
variations; avoid these when writing new comments, but don't worry
about converting to the preferred form unless you're editing that
comment anyway.)

Rationale: Consistency, and ease of visually picking out a multiline
comment from the surrounding code.

8. trace-events style

8.1 0x prefix

In trace-events files, use a '0x' prefix to specify hex numbers, as in:

some_trace(unsigned x, uint64_t y) "x 0x%x y 0x" PRIx64

An exception is made for groups of numbers that are hexadecimal by
convention and separated by the symbols '.', '/', ':', or ' ' (such as
PCI bus id):

another_trace(int cssid, int ssid, int dev_num) "bus id: %x.%x.%04x"

However, you can use '0x' for such groups if you want. Anyway, be sure that
it is obvious that numbers are in hex, ex.:

data_dump(uint8_t c1, uint8_t c2, uint8_t c3) "bytes (in hex): %02x %02x %02x"

Rationale: hex numbers are hard to read in logs when there is no 0x prefix,
especially when (occasionally) the representation doesn't contain any letters
and especially in one line with other decimal numbers. Number groups are allowed
to not use '0x' because for some things notations like %x.%x.%x are used not
only in Qemu. Also dumping raw data bytes with '0x' is less readable.

8.2 '#' printf flag

Do not use printf flag '#', like '%#x'.

Rationale: there are two ways to add a '0x' prefix to printed number: '0x%...'
and '%#...'. For consistency the only one way should be used. Arguments for
'0x%' are:
- it is more popular
- '%#' omits the 0x for the value 0 which makes output inconsistent
22 changes: 10 additions & 12 deletions COPYING.LIB
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
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 St, Fifth Floor, Boston, MA 02110-1301 USA
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

[This is the first released version of the Lesser GPL. It also counts
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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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

Expand All @@ -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 of the License, or (at your option) any later version.
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
Expand All @@ -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 St, Fifth Floor, Boston, MA 02110-1301 USA
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Also add information on how to contact you by electronic and paper mail.

Expand All @@ -500,5 +500,3 @@ necessary. Here is a sample; alter the names:
Ty Coon, President of Vice

That's all there is to it!


2 changes: 1 addition & 1 deletion Changelog
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
This file documents changes for QEMU releases 0.12 and earlier.
For changelog information for later releases, see
http://wiki.qemu-project.org/ChangeLog or look at the git history for
https://wiki.qemu.org/ChangeLog or look at the git history for
more detailed information.


Expand Down
9 changes: 9 additions & 0 deletions HACKING
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,15 @@ Please note that g_malloc will exit on allocation failure, so there
is no need to test for failure (as you would have to with malloc).
Calling g_malloc with a zero size is valid and will return NULL.

Prefer g_new(T, n) instead of g_malloc(sizeof(T) * n) for the following
reasons:

a. It catches multiplication overflowing size_t;
b. It returns T * instead of void *, letting compiler catch more type
errors.

Declarations like T *v = g_malloc(sizeof(*v)) are acceptable, though.

Memory allocated by qemu_memalign or qemu_blockalign must be freed with
qemu_vfree, since breaking this will cause problems on Win32.

Expand Down
36 changes: 36 additions & 0 deletions Kconfig.host
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# These are "proxy" symbols used to pass config-host.mak values
# down to Kconfig. See also MINIKCONF_ARGS in the Makefile:
# these two need to be kept in sync.

config KVM
bool

config LINUX
bool

config OPENGL
bool

config X11
bool

config SPICE
bool

config IVSHMEM
bool

config TPM
bool

config VHOST_USER
bool

config XEN
bool

config VIRTFS
bool

config PVRDMA
bool
21 changes: 13 additions & 8 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
The following points clarify the QEMU license:
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.

1) QEMU as a whole is released under the GNU General Public License,
version 2.
The following points clarify the license of the QEMU emulator:

2) Parts of QEMU 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.
1) The QEMU emulator as a whole is released under the GNU General
Public License, version 2.

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.

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
Expand Down
Loading

0 comments on commit 34b3567

Please sign in to comment.