Skip to content

Commit 5dc4337

Browse files
committed
system: Extract target-specific globals to their own compilation unit
We shouldn't use target specific globals for machine properties. These ones could be desugarized, as explained in [*]. While certainly doable, not trivial nor my priority for now. Just move them to a different file to clarify they are *globals*, like the generic globals residing in system/globals.c. Since arch_init.c was introduced using the MIT license (see commit ad96090), retain the same license for the new globals-target.c file. [*] https://lore.kernel.org/qemu-devel/[email protected]/ Signed-off-by: Philippe Mathieu-Daudé <[email protected]> Reviewed-by: Alex Bennée <[email protected]> Message-Id: <[email protected]>
1 parent 3a11b65 commit 5dc4337

File tree

3 files changed

+25
-14
lines changed

3 files changed

+25
-14
lines changed

system/arch_init.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,4 @@
2424
#include "qemu/osdep.h"
2525
#include "system/arch_init.h"
2626

27-
#ifdef TARGET_SPARC
28-
int graphic_width = 1024;
29-
int graphic_height = 768;
30-
int graphic_depth = 8;
31-
#elif defined(TARGET_M68K)
32-
int graphic_width = 800;
33-
int graphic_height = 600;
34-
int graphic_depth = 8;
35-
#else
36-
int graphic_width = 800;
37-
int graphic_height = 600;
38-
int graphic_depth = 32;
39-
#endif
40-
4127
const uint32_t arch_type = QEMU_ARCH;

system/globals-target.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Global variables that should not exist (target specific)
3+
*
4+
* Copyright (c) 2003-2008 Fabrice Bellard
5+
*
6+
* SPDX-License-Identifier: MIT
7+
*/
8+
9+
#include "qemu/osdep.h"
10+
#include "system/system.h"
11+
12+
#ifdef TARGET_SPARC
13+
int graphic_width = 1024;
14+
int graphic_height = 768;
15+
int graphic_depth = 8;
16+
#elif defined(TARGET_M68K)
17+
int graphic_width = 800;
18+
int graphic_height = 600;
19+
int graphic_depth = 8;
20+
#else
21+
int graphic_width = 800;
22+
int graphic_height = 600;
23+
int graphic_depth = 32;
24+
#endif

system/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: [files(
22
'arch_init.c',
33
'ioport.c',
4+
'globals-target.c',
45
'memory.c',
56
'physmem.c',
67
)])

0 commit comments

Comments
 (0)