Skip to content

Commit cbf0cb2

Browse files
authored
Merge pull request #216 from rust-osdev/read-rip-virt-addr
Change return type of `read_rip` to `VirtAddr`
2 parents 9343bbc + 1b96f95 commit cbf0cb2

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- `VirtAddr::new_unchecked`
1111
- `interrupts::enable_interrupts_and_hlt`
1212
- **Breaking:** Make `DescriptorTablePointer::base` a `VirtAddr` ([#215](https://github.com/rust-osdev/x86_64/pull/215))
13+
- **Breaking:** Change return type of `read_rip` to `VirtAddr` ([#216](https://github.com/rust-osdev/x86_64/pull/216))
1314
- Relaxe `Sized` requirement for `FrameAllocator` in `Mapper::map_to` ([204](https://github.com/rust-osdev/x86_64/pull/204))
1415

1516
# 0.12.3 – 2020-10-31

src/instructions/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
//! Special x86_64 instructions.
44
5+
use crate::VirtAddr;
6+
57
pub mod interrupts;
68
pub mod port;
79
pub mod random;
@@ -56,12 +58,12 @@ pub fn bochs_breakpoint() {
5658
/// instructions to execute.
5759
#[cfg(feature = "inline_asm")]
5860
#[inline(always)]
59-
pub fn read_rip() -> u64 {
61+
pub fn read_rip() -> VirtAddr {
6062
let rip: u64;
6163
unsafe {
6264
asm!(
6365
"lea {}, [rip]", out(reg) rip, options(nostack, nomem)
6466
);
6567
}
66-
rip
68+
VirtAddr::new(rip)
6769
}

0 commit comments

Comments
 (0)