diff options
author | davidxu <davidxu@FreeBSD.org> | 2004-08-10 12:15:27 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2004-08-10 12:15:27 +0000 |
commit | 8c3963846d93d5f1e4ad1fcdca3778a739d8d552 (patch) | |
tree | 981d4570204224f29537b8090226fd3ddc95390b /sys/amd64 | |
parent | 87253c6200da295b1da2376e12fb1343ff81098a (diff) | |
download | FreeBSD-src-8c3963846d93d5f1e4ad1fcdca3778a739d8d552.zip FreeBSD-src-8c3963846d93d5f1e4ad1fcdca3778a739d8d552.tar.gz |
As AMD64 architecture volume 1 chapter 3.1.2 says, high 32 bits of %rflags
are resevered, they can be written with anything, but they always read
as zero, we should simulate it in set_regs() as we are reading/writting
real hardware %rflags register.
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/amd64/machdep.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index f8054e3..81c0949c 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1348,10 +1348,11 @@ set_regs(struct thread *td, struct reg *regs) { struct pcb *pcb; struct trapframe *tp; + register_t rflags; tp = td->td_frame; - if (!EFL_SECURE(regs->r_rflags, tp->tf_rflags) || - !CS_SECURE(regs->r_cs)) + rflags = regs->r_rflags & 0xffffffff; + if (!EFL_SECURE(rflags, tp->tf_rflags) || !CS_SECURE(regs->r_cs)) return (EINVAL); tp->tf_r15 = regs->r_r15; tp->tf_r14 = regs->r_r14; @@ -1370,7 +1371,7 @@ set_regs(struct thread *td, struct reg *regs) tp->tf_rax = regs->r_rax; tp->tf_rip = regs->r_rip; tp->tf_cs = regs->r_cs; - tp->tf_rflags = regs->r_rflags; + tp->tf_rflags = rflags; tp->tf_rsp = regs->r_rsp; tp->tf_ss = regs->r_ss; pcb = td->td_pcb; |