x86-alignment-check
x86-alignment-check is set ac flag in eflags on x86 or x86_64
Features
- set
acflag bit into ON, its includedeflagsofx86. x86_64are supported too.#![no_std]
Example 1: If your code is correctly controlled by alignment
First, add the following to Cargo.toml:
[target.'cfg(any(target_arch = "x86_64", target_arch = "x86"))'.dev-dependencies]
x86-alignment-check = "*"
Second, enclose your test code with x86_alignment_check() as follows:
use x86_alignment_check;
//
let old_flag = x86_alignment_check;
//
// here your test codes, processing anythings, a bus error may occur.
//
let _ = x86_alignment_check;
Finally execute cargo test
Example 2: call_once style
let val = ac_call_once;
assert_eq!;
For now, assertions such as assert_eq!() cannot be included inside FnOnce,
because of the rust runtime bug.
Example 3: call_once style, but not alignment check
let val = no_ac_call_once;
assert_eq!;
Changelogs
License
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.