Skip to content

Commit 436bda7

Browse files
committed
Merge branch 'master' into next
2 parents fb8c5e5 + b56649d commit 436bda7

File tree

6 files changed

+104
-4
lines changed

6 files changed

+104
-4
lines changed

.github/workflows/release.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
8+
jobs:
9+
release:
10+
name: "Release"
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 15
13+
environment: crates_io_release
14+
15+
steps:
16+
- name: "Checkout Repository"
17+
uses: actions/checkout@v1
18+
19+
- name: "Install Python Libraries"
20+
run: python -m pip install --user -r requirements.txt
21+
working-directory: "scripts"
22+
23+
- name: "Run release script"
24+
run: "python3 scripts/ci-release.py"
25+
env:
26+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ license = "MIT/Apache-2.0"
2222
name = "x86_64"
2323
readme = "README.md"
2424
repository = "https://github.com/rust-osdev/x86_64"
25-
version = "0.14.3"
25+
version = "0.14.4"
2626
edition = "2018"
2727

2828
[dependencies]

Changelog.md

+31
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,36 @@
11
# Unreleased
22

3+
# 0.14.4 – 2021-07-19
4+
5+
- Add `instructions::tables::sgdt` ([#279](https://github.com/rust-osdev/x86_64/pull/279))
6+
- Improve control register bits ([#273](https://github.com/rust-osdev/x86_64/pull/273))
7+
- Add `Cr0` bits: `EXTENSION_TYPE` (ET)
8+
- Add `Cr4` bits:
9+
- `KEY_LOCKER` (KL)
10+
- `CONTROL_FLOW_ENFORCEMENT` (CET)
11+
- `PROTECTION_KEY_SUPERVISOR` (PKS)
12+
- Add `XCr0` bits: `BNDREG`, `BNDCSR`, `OPMASK`, `ZMM_HI256`, `HI16_ZMM`
13+
- Add consistency checks for `XCr0` bits
14+
- Add `SelectorErrorCode` for parsing interrupt error codes from `#TS`, `#NP`, `#SS`, and `#GP` ([#274](https://github.com/rust-osdev/x86_64/pull/274))
15+
- Make `addr::{align_up, align_down}` const ([#270](https://github.com/rust-osdev/x86_64/pull/270))
16+
- Make `structures::idt` available on stable Rust ([#271](https://github.com/rust-osdev/x86_64/pull/271))
17+
- Use dummy types for the `HandlerFunc`s if the `"abi_x86_interrupt"` feature is disabled
18+
- Add unsafe `set_handler_addr` that just takes a `VirtAddr`
19+
- Add common abstractions for x86 Segments ([#258](https://github.com/rust-osdev/x86_64/pull/258))
20+
- Add `SS`, `CS`, `DS`, `ES`, `FS`, `GS` marker types
21+
- Add `Segment` trait for reading/writing the segment register
22+
- Add `Segment64` trait for reading/writing the segment base
23+
- Add `GS::swap()`
24+
- Deprecate the corresponding free functions:
25+
- `cs`, `set_cs`
26+
- `swap_gs`
27+
- `load_{ss,ds,es,fs,gs}`
28+
- `{wr,rd}{fs,gs}base`
29+
- Bug fixes:
30+
- Corrected documentation typo ([#278](https://github.com/rust-osdev/x86_64/pull/278))
31+
- Avoided off-by-one error in `GlobalDescriptorTable::from_raw_slice` when `"const_fn"` is not enabled ([#269](https://github.com/rust-osdev/x86_64/pull/269))
32+
- Specify `sysv64` as the calling convention for the `"external_asm"` functions ([#267](https://github.com/rust-osdev/x86_64/pull/267))
33+
334
# 0.14.3 – 2021-05-14
435

536
- Make the following types aliases of the new `PortGeneric` type ([#248](https://github.com/rust-osdev/x86_64/pull/248)):

scripts/ci-release.py

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import toml
2+
import requests
3+
import subprocess
4+
5+
cargo_toml = toml.load("Cargo.toml")
6+
crate_version = cargo_toml["package"]["version"]
7+
print("Detected crate version " + crate_version)
8+
9+
api_url = "https://crates.io/api/v1/crates/x86_64/" + crate_version
10+
released_version = requests.get(api_url).json()
11+
12+
if "version" in released_version:
13+
version = released_version["version"]
14+
assert (version["crate"] == "x86_64")
15+
assert (version["num"] == crate_version)
16+
print("Version " + crate_version + " already exists on crates.io")
17+
18+
else:
19+
print("Could not find version " + crate_version +
20+
" on crates.io; creating a new release")
21+
22+
print(" Running `cargo publish`")
23+
subprocess.run(["cargo", "publish"], check=True)
24+
25+
tag_name = "v" + crate_version
26+
print(" Tagging commit as " + tag_name)
27+
sha = subprocess.run(["git", "rev-parse", "HEAD"], check=True,
28+
stdout=subprocess.PIPE).stdout.decode("utf-8").strip()
29+
subprocess.run([
30+
"gh", "api", "/repos/rust-osdev/x86_64/git/refs",
31+
"-X", "POST", "-H", "Accept: application/vnd.github.v3+json",
32+
"-F", "ref=refs/tags/" + tag_name,
33+
"-F", "sha="+sha
34+
])
35+
36+
print(" Done")

scripts/requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
toml

src/instructions/segmentation.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,14 @@ pub struct CS;
131131
impl Segment for CS {
132132
get_reg_impl!("cs", x86_64_asm_get_cs);
133133

134-
/// Note this is special since we cannot directly move to [`CS`]. Instead we
135-
/// push the new segment selector and return value on the stack and use
136-
/// `retfq` to reload [`CS`] and continue at the end of our function.
134+
/// Note this is special since we cannot directly move to [`CS`]; x86 requires the instruction
135+
/// pointer and [`CS`] to be set at the same time. To do this, we push the new segment selector
136+
/// and return value onto the stack and use a "far return" (`retfq`) to reload [`CS`] and
137+
/// continue at the end of our function.
138+
///
139+
/// Note we cannot use a "far call" (`lcall`) or "far jmp" (`ljmp`) to do this because then we
140+
/// would only be able to jump to 32-bit instruction pointers. Only Intel implements support
141+
/// for 64-bit far calls/jumps in long-mode, AMD does not.
137142
unsafe fn set_reg(sel: SegmentSelector) {
138143
#[cfg(feature = "inline_asm")]
139144
asm!(

0 commit comments

Comments
 (0)