@@ -86,7 +86,7 @@ option(UNICORN_FUZZ "Enable fuzzing" OFF)
86
86
option (UNICORN_LOGGING "Enable logging" OFF )
87
87
option (UNICORN_BUILD_TESTS "Build unicorn tests" ${PROJECT_IS_TOP_LEVEL} )
88
88
option (UNICORN_INSTALL "Enable unicorn installation" ${PROJECT_IS_TOP_LEVEL} )
89
- set (UNICORN_ARCH "x86;arm;aarch64;riscv;mips;sparc;m68k;ppc;s390x;tricore" CACHE STRING "Enabled unicorn architectures" )
89
+ set (UNICORN_ARCH "x86;arm;aarch64;riscv;mips;sparc;m68k;ppc;rh850; s390x;tricore;avr " CACHE STRING "Enabled unicorn architectures" )
90
90
option (UNICORN_TRACER "Trace unicorn execution" OFF )
91
91
option (UNICORN_INTERPRETER "Use interpreter mode" OFF )
92
92
@@ -274,6 +274,11 @@ else()
274
274
set (UNICORN_TARGET_ARCH "tricore" )
275
275
break ()
276
276
endif ()
277
+ string (FIND ${UC_COMPILER_MACRO} "__AVR__" UC_RET)
278
+ if (${UC_RET} GREATER_EQUAL "0" )
279
+ set (UNICORN_TARGET_ARCH "avr" )
280
+ break ()
281
+ endif ()
277
282
message (FATAL_ERROR "Unknown host compiler: ${CMAKE_C_COMPILER} ." )
278
283
endwhile (TRUE )
279
284
endif ()
@@ -304,6 +309,9 @@ else()
304
309
if (UNICORN_HAS_PPC)
305
310
set (EXTRA_CFLAGS "${EXTRA_CFLAGS} -DUNICORN_HAS_PPC " )
306
311
endif ()
312
+ if (UNICORN_HAS_RH850)
313
+ set (EXTRA_CFLAGS "${EXTRA_CFLAGS} -DUNICORN_HAS_RH850 " )
314
+ endif ()
307
315
if (UNICORN_HAS_RISCV)
308
316
set (EXTRA_CFLAGS "${EXTRA_CFLAGS} -DUNICORN_HAS_RISCV " )
309
317
endif ()
@@ -313,6 +321,9 @@ else()
313
321
if (UNICORN_HAS_TRICORE)
314
322
set (EXTRA_CFLAGS "${EXTRA_CFLAGS} -DUNICORN_HAS_TRICORE " )
315
323
endif ()
324
+ if (UNICORN_HAS_AVR)
325
+ set (EXTRA_CFLAGS "${EXTRA_CFLAGS} -DUNICORN_HAS_AVR " )
326
+ endif ()
316
327
317
328
set (EXTRA_CFLAGS "${EXTRA_CFLAGS} -fPIC" )
318
329
if (ANDROID_ABI)
@@ -355,6 +366,9 @@ else()
355
366
if (UNICORN_HAS_PPC)
356
367
set (TARGET_LIST "${TARGET_LIST} ppc-softmmu, ppc64-softmmu, " )
357
368
endif ()
369
+ if (UNICORN_HAS_RH850)
370
+ set (TARGET_LIST "${TARGET_LIST} rh850-softmmu, " )
371
+ endif ()
358
372
if (UNICORN_HAS_RISCV)
359
373
set (TARGET_LIST "${TARGET_LIST} riscv32-softmmu, riscv64-softmmu, " )
360
374
endif ()
@@ -364,6 +378,9 @@ else()
364
378
if (UNICORN_HAS_TRICORE)
365
379
set (TARGET_LIST "${TARGET_LIST} tricore-softmmu, " )
366
380
endif ()
381
+ if (UNICORN_HAS_AVR)
382
+ set (TARGET_LIST "${TARGET_LIST} avr-softmmu, " )
383
+ endif ()
367
384
set (TARGET_LIST "${TARGET_LIST} " )
368
385
369
386
# GEN config-host.mak & target directories
@@ -446,6 +463,12 @@ else()
446
463
OUTPUT_FILE ${CMAKE_BINARY_DIR} /ppc64-softmmu/config-target .h
447
464
)
448
465
endif ()
466
+ if (UNICORN_HAS_RH850)
467
+ execute_process (COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR} /qemu/scripts/create_config
468
+ INPUT_FILE ${CMAKE_BINARY_DIR} /rh850-softmmu/config-target .mak
469
+ OUTPUT_FILE ${CMAKE_BINARY_DIR} /rh850-softmmu/config-target .h
470
+ )
471
+ endif ()
449
472
if (UNICORN_HAS_RISCV)
450
473
execute_process (COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR} /qemu/scripts/create_config
451
474
INPUT_FILE ${CMAKE_BINARY_DIR} /riscv32-softmmu/config-target .mak
@@ -468,6 +491,12 @@ else()
468
491
OUTPUT_FILE ${CMAKE_BINARY_DIR} /tricore-softmmu/config-target .h
469
492
)
470
493
endif ()
494
+ if (UNICORN_HAS_AVR)
495
+ execute_process (COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR} /qemu/scripts/create_config
496
+ INPUT_FILE ${CMAKE_BINARY_DIR} /avr-softmmu/config-target .mak
497
+ OUTPUT_FILE ${CMAKE_BINARY_DIR} /avr-softmmu/config-target .h
498
+ )
499
+ endif ()
471
500
add_compile_options (
472
501
${UNICORN_CFLAGS}
473
502
-I${CMAKE_CURRENT_SOURCE_DIR} /qemu/tcg/${UNICORN_TARGET_ARCH}
@@ -1174,6 +1203,65 @@ endif()
1174
1203
endif ()
1175
1204
1176
1205
1206
+ if (UNICORN_HAS_AVR)
1207
+ add_library (avr-softmmu STATIC
1208
+ ${UNICORN_ARCH_COMMON}
1209
+
1210
+ qemu/target /avr/cpu.c
1211
+ qemu/target /avr/helper.c
1212
+ qemu/target /avr/translate.c
1213
+ qemu/target /avr/unicorn.c
1214
+ )
1215
+
1216
+ if (MSVC )
1217
+ target_compile_options (avr-softmmu PRIVATE
1218
+ -DNEED_CPU_H
1219
+ /FIavr.h
1220
+ /I${CMAKE_CURRENT_SOURCE_DIR} /msvc /avr-softmmu
1221
+ /I${CMAKE_CURRENT_SOURCE_DIR} /qemu/target /avr
1222
+ )
1223
+ else ()
1224
+ target_compile_options (avr-softmmu PRIVATE
1225
+ -DNEED_CPU_H
1226
+ -include avr.h
1227
+ -I${CMAKE_BINARY_DIR} /avr-softmmu
1228
+ -I${CMAKE_CURRENT_SOURCE_DIR} /qemu/target /avr
1229
+ )
1230
+ endif ()
1231
+ endif ()
1232
+
1233
+
1234
+ if (UNICORN_HAS_RH850)
1235
+ add_library (rh850-softmmu STATIC
1236
+ ${UNICORN_ARCH_COMMON}
1237
+
1238
+ qemu/target /rh850/cpu.c
1239
+ qemu/target /rh850/fpu_helper.c
1240
+ qemu/target /rh850/helper.c
1241
+ qemu/target /rh850/op_helper.c
1242
+ qemu/target /rh850/translate.c
1243
+ qemu/target /rh850/fpu_translate.c
1244
+ qemu/target /rh850/unicorn.c
1245
+ )
1246
+
1247
+
1248
+ if (MSVC )
1249
+ target_compile_options (rh850-softmmu PRIVATE
1250
+ -DNEED_CPU_H
1251
+ /FIrh850.h
1252
+ /I${CMAKE_CURRENT_SOURCE_DIR} /msvc /rh850-softmmu
1253
+ /I${CMAKE_CURRENT_SOURCE_DIR} /qemu/target /rh850
1254
+ )
1255
+ else ()
1256
+ target_compile_options (rh850-softmmu PRIVATE
1257
+ -DNEED_CPU_H
1258
+ -include rh850.h
1259
+ -I${CMAKE_BINARY_DIR} /rh850-softmmu
1260
+ -I${CMAKE_CURRENT_SOURCE_DIR} /qemu/target /rh850
1261
+ )
1262
+ endif ()
1263
+ endif ()
1264
+
1177
1265
set (UNICORN_SRCS
1178
1266
uc.c
1179
1267
@@ -1326,6 +1414,13 @@ if(UNICORN_HAS_PPC)
1326
1414
target_link_libraries (ppc64-softmmu PRIVATE unicorn-common)
1327
1415
set (UNICORN_TEST_FILE ${UNICORN_TEST_FILE} test_ppc)
1328
1416
endif ()
1417
+ if (UNICORN_HAS_RH850)
1418
+ set (UNICORN_COMPILE_OPTIONS ${UNICORN_COMPILE_OPTIONS} -DUNICORN_HAS_RH850)
1419
+ set (UNICORN_LINK_LIBRARIES ${UNICORN_LINK_LIBRARIES} rh850-softmmu rh850-softmmu)
1420
+ set (UNICORN_SAMPLE_FILE ${UNICORN_SAMPLE_FILE} sample_rh850)
1421
+ target_link_libraries (rh850-softmmu PRIVATE unicorn-common)
1422
+ set (UNICORN_TEST_FILE ${UNICORN_TEST_FILE} test_rh850)
1423
+ endif ()
1329
1424
if (UNICORN_HAS_RISCV)
1330
1425
set (UNICORN_COMPILE_OPTIONS ${UNICORN_COMPILE_OPTIONS} -DUNICORN_HAS_RISCV)
1331
1426
set (UNICORN_LINK_LIBRARIES ${UNICORN_LINK_LIBRARIES} riscv32-softmmu riscv64-softmmu)
@@ -1348,6 +1443,13 @@ if (UNICORN_HAS_TRICORE)
1348
1443
target_link_libraries (tricore-softmmu unicorn-common)
1349
1444
set (UNICORN_TEST_FILE ${UNICORN_TEST_FILE} test_tricore)
1350
1445
endif ()
1446
+ if (UNICORN_HAS_AVR)
1447
+ set (UNICORN_COMPILE_OPTIONS ${UNICORN_COMPILE_OPTIONS} -DUNICORN_HAS_AVR)
1448
+ set (UNICORN_LINK_LIBRARIES ${UNICORN_LINK_LIBRARIES} avr-softmmu)
1449
+ set (UNICORN_SAMPLE_FILE ${UNICORN_SAMPLE_FILE} sample_avr)
1450
+ target_link_libraries (avr-softmmu unicorn-common)
1451
+ set (UNICORN_TEST_FILE ${UNICORN_TEST_FILE} test_avr)
1452
+ endif ()
1351
1453
1352
1454
# Extra tests
1353
1455
set (UNICORN_TEST_FILE ${UNICORN_TEST_FILE} test_mem)
0 commit comments