iretq trap frame

msh1307·2023년 1월 29일
0

Kernel

목록 보기
6/9
user_rip
user_cs
user_rflags
user_rsp
user_ss

low -> high

struct trap_frame {
    uint64_t user_rip;
    uint64_t user_cs;
    uint64_t user_rflags;
    uint64_t user_rsp;
    uint64_t user_ss;
} __attribute__((packed)) tf;
void save_state(){
    __asm__ __volatile__ (
        ".intel_syntax noprefix;"
        "mov tf+16, cs;"
        "pushf;"
        "pop tf+24;"
        "mov tf+32, rsp;"
        "mov tf+40, ss;"
        ".att_syntax;"
    );
    tf.user_rip = (uint64_t)&shell;
}
profile
https://msh1307.kr

0개의 댓글