13726b992SJérôme Gardou 23726b992SJérôme Gardou#include <asm.inc> 33726b992SJérôme Gardou 4*25336250STimo Kreuzer#include <ksamd64.inc> 5*25336250STimo Kreuzer 63726b992SJérôme Gardou.code64 73726b992SJérôme Gardou 83726b992SJérôme GardouPUBLIC KdbpStackSwitchAndCall 93726b992SJérôme GardouKdbpStackSwitchAndCall: 103726b992SJérôme Gardou 11*25336250STimo Kreuzer /* Save old stack */ 12*25336250STimo Kreuzer mov rax, rsp 13*25336250STimo Kreuzer 14*25336250STimo Kreuzer /* Set new stack */ 153726b992SJérôme Gardou mov rsp, rcx 163726b992SJérôme Gardou 17*25336250STimo Kreuzer /* Save old stack on new stack */ 18*25336250STimo Kreuzer push rax 19*25336250STimo Kreuzer 203726b992SJérôme Gardou /* Call function */ 213726b992SJérôme Gardou call rdx 223726b992SJérôme Gardou 23*25336250STimo Kreuzer /* Restore old stack */ 24*25336250STimo Kreuzer pop rax 25*25336250STimo Kreuzer mov rsp, rax 263726b992SJérôme Gardou 27*25336250STimo Kreuzer /* Return */ 28*25336250STimo Kreuzer ret 293726b992SJérôme Gardou 303726b992SJérôme GardouEND 31