Skip to content

Commit 46ca346

Browse files
flierPhantomical
andauthored
upgrade to xed v2023.12.19 and mbuild v2022.07.28 (#64)
* upgrade xed to v2023.12.19 * rename XED_GIT_VERSION to XED_VERSION * Fix the copyright test --------- Co-authored-by: Phantomical <[email protected]>
1 parent 123160c commit 46ca346

File tree

5 files changed

+197
-28
lines changed

5 files changed

+197
-28
lines changed

build-tools/build-c2rust-bindings

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ clang -E -P -CC xed.c -o target/artifacts/xed-$triple.c -Itarget/install/include
2020
echo "\"command\": \"clang -c target/artifacts/xed-'$triple'.c -o target/artifacts/xed-$triple.o \","
2121
echo '"file": "target/artifacts/xed-'$triple'.c"'
2222
echo "}]"
23-
) > compile-commands.json
23+
) >compile-commands.json
2424
# echo '[{ "directory": ".", "command": "clang -c xed.c -o target/artifacts/xed-$triple.o -Itarget/install/include -Dstatic= -Dinline= -D__inline= -D__inline__=", "file": "xed.c" }]' > compile_commands.json
2525
c2rust transpile --overwrite-existing compile-commands.json
2626

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ mod _detail {
9090
};
9191

9292
assert_eq!(
93-
"Copyright (C) 2021, Intel Corporation. All rights reserved.",
93+
"Copyright (C) 2022, Intel Corporation. All rights reserved.",
9494
&copyright
9595
);
9696
}
@@ -101,7 +101,7 @@ mod _detail {
101101

102102
let version_cstr = unsafe { CStr::from_ptr(xed_get_version()) };
103103
let version = version_cstr.to_string_lossy();
104-
let git_version = CStr::from_bytes_with_nul(XED_GIT_VERSION)
104+
let git_version = CStr::from_bytes_with_nul(XED_VERSION)
105105
.unwrap()
106106
.to_string_lossy();
107107

src/xed-c2rust.rs

Lines changed: 192 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,17 @@ pub unsafe extern "C" fn xed3_operand_set_norex(
257257
(*d)._operands.norex = opval as uint8_t;
258258
}
259259
#[inline]
260+
pub unsafe extern "C" fn xed3_operand_get_norex2(mut d: *const xed_decoded_inst_t) -> xed_bits_t {
261+
return (*d)._operands.norex2 as xed_bits_t;
262+
}
263+
#[inline]
264+
pub unsafe extern "C" fn xed3_operand_set_norex2(
265+
mut d: *mut xed_decoded_inst_t,
266+
mut opval: xed_bits_t,
267+
) {
268+
(*d)._operands.norex2 = opval as uint8_t;
269+
}
270+
#[inline]
260271
pub unsafe extern "C" fn xed3_operand_get_needrex(mut d: *const xed_decoded_inst_t) -> xed_bits_t {
261272
return (*d)._operands.needrex as xed_bits_t;
262273
}
@@ -323,6 +334,61 @@ pub unsafe extern "C" fn xed3_operand_set_rexb(
323334
(*d)._operands.rexb = opval as uint8_t;
324335
}
325336
#[inline]
337+
pub unsafe extern "C" fn xed3_operand_get_rex2(mut d: *const xed_decoded_inst_t) -> xed_bits_t {
338+
return (*d)._operands.rex2 as xed_bits_t;
339+
}
340+
#[inline]
341+
pub unsafe extern "C" fn xed3_operand_set_rex2(
342+
mut d: *mut xed_decoded_inst_t,
343+
mut opval: xed_bits_t,
344+
) {
345+
(*d)._operands.rex2 = opval as uint8_t;
346+
}
347+
#[inline]
348+
pub unsafe extern "C" fn xed3_operand_get_rexb4(mut d: *const xed_decoded_inst_t) -> xed_bits_t {
349+
return (*d)._operands.rexb4 as xed_bits_t;
350+
}
351+
#[inline]
352+
pub unsafe extern "C" fn xed3_operand_set_rexb4(
353+
mut d: *mut xed_decoded_inst_t,
354+
mut opval: xed_bits_t,
355+
) {
356+
(*d)._operands.rexb4 = opval as uint8_t;
357+
}
358+
#[inline]
359+
pub unsafe extern "C" fn xed3_operand_get_rexx4(mut d: *const xed_decoded_inst_t) -> xed_bits_t {
360+
return (*d)._operands.rexx4 as xed_bits_t;
361+
}
362+
#[inline]
363+
pub unsafe extern "C" fn xed3_operand_set_rexx4(
364+
mut d: *mut xed_decoded_inst_t,
365+
mut opval: xed_bits_t,
366+
) {
367+
(*d)._operands.rexx4 = opval as uint8_t;
368+
}
369+
#[inline]
370+
pub unsafe extern "C" fn xed3_operand_get_rexr4(mut d: *const xed_decoded_inst_t) -> xed_bits_t {
371+
return (*d)._operands.rexr4 as xed_bits_t;
372+
}
373+
#[inline]
374+
pub unsafe extern "C" fn xed3_operand_set_rexr4(
375+
mut d: *mut xed_decoded_inst_t,
376+
mut opval: xed_bits_t,
377+
) {
378+
(*d)._operands.rexr4 = opval as uint8_t;
379+
}
380+
#[inline]
381+
pub unsafe extern "C" fn xed3_operand_get_has_egpr(mut d: *const xed_decoded_inst_t) -> xed_bits_t {
382+
return (*d)._operands.has_egpr as xed_bits_t;
383+
}
384+
#[inline]
385+
pub unsafe extern "C" fn xed3_operand_set_has_egpr(
386+
mut d: *mut xed_decoded_inst_t,
387+
mut opval: xed_bits_t,
388+
) {
389+
(*d)._operands.has_egpr = opval as uint8_t;
390+
}
391+
#[inline]
326392
pub unsafe extern "C" fn xed3_operand_get_rep(mut d: *const xed_decoded_inst_t) -> xed_bits_t {
327393
return (*d)._operands.rep as xed_bits_t;
328394
}
@@ -389,6 +455,17 @@ pub unsafe extern "C" fn xed3_operand_set_easz(
389455
(*d)._operands.easz = opval as uint8_t;
390456
}
391457
#[inline]
458+
pub unsafe extern "C" fn xed3_operand_get_skip_osz(mut d: *const xed_decoded_inst_t) -> xed_bits_t {
459+
return (*d)._operands.skip_osz as xed_bits_t;
460+
}
461+
#[inline]
462+
pub unsafe extern "C" fn xed3_operand_set_skip_osz(
463+
mut d: *mut xed_decoded_inst_t,
464+
mut opval: xed_bits_t,
465+
) {
466+
(*d)._operands.skip_osz = opval as uint8_t;
467+
}
468+
#[inline]
392469
pub unsafe extern "C" fn xed3_operand_get_mod(mut d: *const xed_decoded_inst_t) -> xed_bits_t {
393470
return (*d)._operands.mod_ as xed_bits_t;
394471
}
@@ -838,6 +915,17 @@ pub unsafe extern "C" fn xed3_operand_set_relbr(
838915
(*d)._operands.relbr = opval as uint8_t;
839916
}
840917
#[inline]
918+
pub unsafe extern "C" fn xed3_operand_get_absbr(mut d: *const xed_decoded_inst_t) -> xed_bits_t {
919+
return (*d)._operands.absbr as xed_bits_t;
920+
}
921+
#[inline]
922+
pub unsafe extern "C" fn xed3_operand_set_absbr(
923+
mut d: *mut xed_decoded_inst_t,
924+
mut opval: xed_bits_t,
925+
) {
926+
(*d)._operands.absbr = opval as uint8_t;
927+
}
928+
#[inline]
841929
pub unsafe extern "C" fn xed3_operand_get_ptr(mut d: *const xed_decoded_inst_t) -> xed_bits_t {
842930
return (*d)._operands.ptr as xed_bits_t;
843931
}
@@ -1334,6 +1422,39 @@ pub unsafe extern "C" fn xed3_operand_set_dummy(
13341422
(*d)._operands.dummy = opval as uint8_t;
13351423
}
13361424
#[inline]
1425+
pub unsafe extern "C" fn xed3_operand_get_no_evex(mut d: *const xed_decoded_inst_t) -> xed_bits_t {
1426+
return (*d)._operands.no_evex as xed_bits_t;
1427+
}
1428+
#[inline]
1429+
pub unsafe extern "C" fn xed3_operand_set_no_evex(
1430+
mut d: *mut xed_decoded_inst_t,
1431+
mut opval: xed_bits_t,
1432+
) {
1433+
(*d)._operands.no_evex = opval as uint8_t;
1434+
}
1435+
#[inline]
1436+
pub unsafe extern "C" fn xed3_operand_get_no_vex(mut d: *const xed_decoded_inst_t) -> xed_bits_t {
1437+
return (*d)._operands.no_vex as xed_bits_t;
1438+
}
1439+
#[inline]
1440+
pub unsafe extern "C" fn xed3_operand_set_no_vex(
1441+
mut d: *mut xed_decoded_inst_t,
1442+
mut opval: xed_bits_t,
1443+
) {
1444+
(*d)._operands.no_vex = opval as uint8_t;
1445+
}
1446+
#[inline]
1447+
pub unsafe extern "C" fn xed3_operand_get_no_apx(mut d: *const xed_decoded_inst_t) -> xed_bits_t {
1448+
return (*d)._operands.no_apx as xed_bits_t;
1449+
}
1450+
#[inline]
1451+
pub unsafe extern "C" fn xed3_operand_set_no_apx(
1452+
mut d: *mut xed_decoded_inst_t,
1453+
mut opval: xed_bits_t,
1454+
) {
1455+
(*d)._operands.no_apx = opval as uint8_t;
1456+
}
1457+
#[inline]
13371458
pub unsafe extern "C" fn xed3_operand_get_amd3dnow(mut d: *const xed_decoded_inst_t) -> xed_bits_t {
13381459
return (*d)._operands.amd3dnow as xed_bits_t;
13391460
}
@@ -1494,17 +1615,6 @@ pub unsafe extern "C" fn xed3_operand_set_bcrc(
14941615
(*d)._operands.bcrc = opval as uint8_t;
14951616
}
14961617
#[inline]
1497-
pub unsafe extern "C" fn xed3_operand_get_rexrr(mut d: *const xed_decoded_inst_t) -> xed_bits_t {
1498-
return (*d)._operands.rexrr as xed_bits_t;
1499-
}
1500-
#[inline]
1501-
pub unsafe extern "C" fn xed3_operand_set_rexrr(
1502-
mut d: *mut xed_decoded_inst_t,
1503-
mut opval: xed_bits_t,
1504-
) {
1505-
(*d)._operands.rexrr = opval as uint8_t;
1506-
}
1507-
#[inline]
15081618
pub unsafe extern "C" fn xed3_operand_get_vexdest4(mut d: *const xed_decoded_inst_t) -> xed_bits_t {
15091619
return (*d)._operands.vexdest4 as xed_bits_t;
15101620
}
@@ -1549,17 +1659,15 @@ pub unsafe extern "C" fn xed3_operand_set_sae(
15491659
(*d)._operands.sae = opval as uint8_t;
15501660
}
15511661
#[inline]
1552-
pub unsafe extern "C" fn xed3_operand_get_no_scale_disp8(
1553-
mut d: *const xed_decoded_inst_t,
1554-
) -> xed_bits_t {
1555-
return (*d)._operands.no_scale_disp8 as xed_bits_t;
1662+
pub unsafe extern "C" fn xed3_operand_get_vl_ign(mut d: *const xed_decoded_inst_t) -> xed_bits_t {
1663+
return (*d)._operands.vl_ign as xed_bits_t;
15561664
}
15571665
#[inline]
1558-
pub unsafe extern "C" fn xed3_operand_set_no_scale_disp8(
1666+
pub unsafe extern "C" fn xed3_operand_set_vl_ign(
15591667
mut d: *mut xed_decoded_inst_t,
15601668
mut opval: xed_bits_t,
15611669
) {
1562-
(*d)._operands.no_scale_disp8 = opval as uint8_t;
1670+
(*d)._operands.vl_ign = opval as uint8_t;
15631671
}
15641672
#[inline]
15651673
pub unsafe extern "C" fn xed3_operand_get_ubit(mut d: *const xed_decoded_inst_t) -> xed_bits_t {
@@ -1584,6 +1692,50 @@ pub unsafe extern "C" fn xed3_operand_set_wbnoinvd(
15841692
(*d)._operands.wbnoinvd = opval as uint8_t;
15851693
}
15861694
#[inline]
1695+
pub unsafe extern "C" fn xed3_operand_get_evvspace(mut d: *const xed_decoded_inst_t) -> xed_bits_t {
1696+
return (*d)._operands.evvspace as xed_bits_t;
1697+
}
1698+
#[inline]
1699+
pub unsafe extern "C" fn xed3_operand_set_evvspace(
1700+
mut d: *mut xed_decoded_inst_t,
1701+
mut opval: xed_bits_t,
1702+
) {
1703+
(*d)._operands.evvspace = opval as uint8_t;
1704+
}
1705+
#[inline]
1706+
pub unsafe extern "C" fn xed3_operand_get_nd(mut d: *const xed_decoded_inst_t) -> xed_bits_t {
1707+
return (*d)._operands.nd as xed_bits_t;
1708+
}
1709+
#[inline]
1710+
pub unsafe extern "C" fn xed3_operand_set_nd(
1711+
mut d: *mut xed_decoded_inst_t,
1712+
mut opval: xed_bits_t,
1713+
) {
1714+
(*d)._operands.nd = opval as uint8_t;
1715+
}
1716+
#[inline]
1717+
pub unsafe extern "C" fn xed3_operand_get_nf(mut d: *const xed_decoded_inst_t) -> xed_bits_t {
1718+
return (*d)._operands.nf as xed_bits_t;
1719+
}
1720+
#[inline]
1721+
pub unsafe extern "C" fn xed3_operand_set_nf(
1722+
mut d: *mut xed_decoded_inst_t,
1723+
mut opval: xed_bits_t,
1724+
) {
1725+
(*d)._operands.nf = opval as uint8_t;
1726+
}
1727+
#[inline]
1728+
pub unsafe extern "C" fn xed3_operand_get_scc(mut d: *const xed_decoded_inst_t) -> xed_bits_t {
1729+
return (*d)._operands.scc as xed_bits_t;
1730+
}
1731+
#[inline]
1732+
pub unsafe extern "C" fn xed3_operand_set_scc(
1733+
mut d: *mut xed_decoded_inst_t,
1734+
mut opval: xed_bits_t,
1735+
) {
1736+
(*d)._operands.scc = opval as uint8_t;
1737+
}
1738+
#[inline]
15871739
pub unsafe extern "C" fn xed_state_init(
15881740
mut p: *mut xed_state_t,
15891741
mut arg_mmode: xed_machine_mode_enum_t,
@@ -1717,7 +1869,24 @@ pub unsafe extern "C" fn xed_relbr(
17171869
},
17181870
width_bits: 0,
17191871
};
1720-
o.type_ = XED_ENCODER_OPERAND_TYPE_BRDISP;
1872+
o.type_ = XED_ENCODER_OPERAND_TYPE_REL_BRDISP;
1873+
o.u.brdisp = brdisp;
1874+
o.width_bits = width_bits;
1875+
return o;
1876+
}
1877+
#[inline]
1878+
pub unsafe extern "C" fn xed_absbr(
1879+
mut brdisp: int32_t,
1880+
mut width_bits: xed_uint_t,
1881+
) -> xed_encoder_operand_t {
1882+
let mut o: xed_encoder_operand_t = xed_encoder_operand_t {
1883+
type_: XED_ENCODER_OPERAND_TYPE_INVALID,
1884+
u: C2RustUnnamed_7 {
1885+
reg: XED_REG_INVALID,
1886+
},
1887+
width_bits: 0,
1888+
};
1889+
o.type_ = XED_ENCODER_OPERAND_TYPE_ABS_BRDISP;
17211890
o.u.brdisp = brdisp;
17221891
o.width_bits = width_bits;
17231892
return o;
@@ -2017,11 +2186,11 @@ pub unsafe extern "C" fn xed_addr(
20172186
}
20182187
#[inline]
20192188
pub unsafe extern "C" fn xed_rep(mut x: *mut xed_encoder_instruction_t) {
2020-
(*x).prefixes.s.set_rep(1 as libc::c_int as uint32_t);
2189+
((*x).prefixes.s).set_rep(1 as libc::c_int as uint32_t);
20212190
}
20222191
#[inline]
20232192
pub unsafe extern "C" fn xed_repne(mut x: *mut xed_encoder_instruction_t) {
2024-
(*x).prefixes.s.set_repne(1 as libc::c_int as uint32_t);
2193+
((*x).prefixes.s).set_repne(1 as libc::c_int as uint32_t);
20252194
}
20262195
#[inline]
20272196
pub unsafe extern "C" fn xed_inst0(
@@ -2155,7 +2324,7 @@ pub unsafe extern "C" fn xed_inst(
21552324
i = 0 as libc::c_int as xed_uint_t;
21562325
while i < number_of_operands {
21572326
(*inst).operands[i as usize] = *operand_array.offset(i as isize);
2158-
i = i.wrapping_add(1)
2327+
i = i.wrapping_add(1);
21592328
}
21602329
(*inst).noperands = number_of_operands;
21612330
}
@@ -2237,7 +2406,7 @@ pub unsafe extern "C" fn xed_decoded_inst_get_byte(
22372406
mut p: *const xed_decoded_inst_t,
22382407
mut byte_index: xed_uint_t,
22392408
) -> uint8_t {
2240-
let mut out: uint8_t = *(*p)._byte_array._dec.offset(byte_index as isize);
2409+
let mut out: uint8_t = *((*p)._byte_array._dec).offset(byte_index as isize);
22412410
return out;
22422411
}
22432412
#[inline]
@@ -2289,7 +2458,7 @@ pub unsafe extern "C" fn xed_decoded_inst_get_iform_enum(
22892458
pub unsafe extern "C" fn xed_decoded_inst_get_iform_enum_dispatch(
22902459
mut p: *const xed_decoded_inst_t,
22912460
) -> libc::c_uint {
2292-
return (xed_inst_iform_enum((*p)._inst) as libc::c_uint)
2461+
return (xed_inst_iform_enum((*p)._inst) as xed_uint_t)
22932462
.wrapping_sub(xed_iform_first_per_iclass(xed_inst_iclass((*p)._inst)));
22942463
}
22952464
#[inline]

xed

Submodule xed updated 1101 files

0 commit comments

Comments
 (0)