Implement sahf

This commit is contained in:
Theodore Dubois 2018-08-12 18:56:26 -07:00
parent 9d7bf7025a
commit a02fe95b33
2 changed files with 14 additions and 7 deletions

View File

@ -75,14 +75,11 @@
.else; .ifc \cond,cz
check_cf
jnz \target
check_res
jz \target
res_or_flag z, ZF_RES, ZF_FLAG, \target
.else; .ifc \cond,s
check_res
js \target
res_or_flag s, SF_RES, SF_FLAG, \target
.else; .ifc \cond,p
check_res
jp \target
res_or_flag p, PF_RES, PF_FLAG, \target
.else; .ifc \cond,sxo
check_res
sets %r14b
@ -165,3 +162,13 @@
call helper_expand_flags
restore_c
gret
.gadget sahf
xchgb %ah, %al
movb %al, CPU_eflags(%_cpu)
xchgb %al, %ah
save_c
movq %_cpu, %rdi
call helper_expand_flags
restore_c
gret

View File

@ -249,7 +249,7 @@ static inline bool gen_op(struct gen_state *state, gadget_t *gadgets, enum arg a
#define PUSHF() g(pushf)
#define POPF() g(popf)
#define SAHF UNDEFINED
#define SAHF g(sahf)
#define CLD g(cld)
#define STD g(std)