mirror of https://github.com/red-prig/fpPS4.git
This commit is contained in:
parent
545f823d4e
commit
ec674ce088
|
@ -266,12 +266,12 @@ asm
|
|||
pushq %rbp
|
||||
movq %rsp,%rbp
|
||||
|
||||
movqq %rax,-16(%rsp) //save rax
|
||||
movqq %rax,%r11 //save rax
|
||||
|
||||
lahf //load to AH
|
||||
lahf //load to AH
|
||||
shr $8,%rax
|
||||
andl $0xFF,%rax //filter
|
||||
movqq %rax,-8(%rsp) //save flags
|
||||
movqq %rax,%rcx //save flags
|
||||
|
||||
movqq %gs:teb.thread,%rax //curkthread
|
||||
test %rax,%rax
|
||||
|
@ -286,12 +286,12 @@ asm
|
|||
movqq %rdi,trapframe.tf_rdi(%rax)
|
||||
movqq %rsi,trapframe.tf_rsi(%rax)
|
||||
movqq %rdx,trapframe.tf_rdx(%rax)
|
||||
movqq %rcx,trapframe.tf_rcx(%rax)
|
||||
movqq $0,trapframe.tf_rcx(%rax)
|
||||
movqq %r8 ,trapframe.tf_r8 (%rax)
|
||||
movqq %r9 ,trapframe.tf_r9 (%rax)
|
||||
movqq %rbx,trapframe.tf_rbx(%rax)
|
||||
movqq %r10,trapframe.tf_r10(%rax)
|
||||
movqq %r11,trapframe.tf_r11(%rax)
|
||||
movqq $0,trapframe.tf_r11(%rax)
|
||||
movqq %r12,trapframe.tf_r12(%rax)
|
||||
movqq %r13,trapframe.tf_r13(%rax)
|
||||
movqq %r14,trapframe.tf_r14(%rax)
|
||||
|
@ -302,6 +302,9 @@ asm
|
|||
movqq $0,trapframe.tf_flags (%rax)
|
||||
movqq $5,trapframe.tf_err (%rax) //sizeof(call $32)
|
||||
|
||||
//get rax
|
||||
movqq %r11,trapframe.tf_rax(%rax)
|
||||
|
||||
movqq (%rsp),%r11 //get prev rbp
|
||||
movqq %r11,trapframe.tf_rbp(%rax)
|
||||
|
||||
|
@ -312,11 +315,8 @@ asm
|
|||
movqq 8(%rsp),%r11 //get prev rip
|
||||
movqq %r11,trapframe.tf_rip(%rax)
|
||||
|
||||
movqq -16(%rsp),%r11 //get rax
|
||||
movqq %r11,trapframe.tf_rax(%rax)
|
||||
|
||||
movqq -8(%rsp),%r11 //get flags
|
||||
movqq %r11,trapframe.tf_rflags(%rax)
|
||||
//get flags
|
||||
movqq %rcx,trapframe.tf_rflags(%rax)
|
||||
|
||||
movqq %gs:teb.thread,%rsp //curkthread
|
||||
movqq kthread.td_kstack(%rsp),%rsp //td_kstack (Implicit lock interrupt)
|
||||
|
@ -329,16 +329,15 @@ asm
|
|||
|
||||
_after_call:
|
||||
|
||||
movqq %gs:teb.thread,%rax //curkthread
|
||||
movqq %gs:teb.thread,%rcx //curkthread
|
||||
|
||||
//Requested full context restore
|
||||
testl PCB_FULL_IRET,kthread.pcb_flags(%rax)
|
||||
testl PCB_FULL_IRET,kthread.pcb_flags(%rcx)
|
||||
jnz _doreti
|
||||
|
||||
testl TDF_AST,kthread.td_flags(%rax)
|
||||
testl TDF_AST,kthread.td_flags(%rcx)
|
||||
jne _ast
|
||||
|
||||
movqq %gs:teb.thread,%rcx //curkthread
|
||||
movqq kthread.td_frame(%rcx),%rcx //td_frame
|
||||
|
||||
//Restore preserved registers.
|
||||
|
@ -366,12 +365,14 @@ asm
|
|||
//fail:
|
||||
_fail:
|
||||
|
||||
movqq -8(%rsp),%rax //get flags
|
||||
movqq %rcx,%rax //get flags
|
||||
shl $8,%rax
|
||||
or $1,%ah //CF
|
||||
sahf //restore flags
|
||||
|
||||
movqq $14,%rax //EFAULT
|
||||
movqq $0,%rcx
|
||||
movqq $0,%r11
|
||||
|
||||
popq %rbp
|
||||
ret
|
||||
|
@ -385,8 +386,8 @@ asm
|
|||
//doreti
|
||||
_doreti:
|
||||
|
||||
movqq %gs:teb.thread,%rax //curkthread
|
||||
testl TDF_AST,kthread.td_flags(%rax)
|
||||
//%rcx=curkthread
|
||||
testl TDF_AST,kthread.td_flags(%rcx)
|
||||
je _doreti_exit
|
||||
|
||||
call ast
|
||||
|
|
Loading…
Reference in New Issue