From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752158AbcCTTMC (ORCPT ); Sun, 20 Mar 2016 15:12:02 -0400 Received: from mail.skyhub.de ([78.46.96.112]:55057 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750994AbcCTTMA (ORCPT ); Sun, 20 Mar 2016 15:12:00 -0400 Date: Sun, 20 Mar 2016 20:11:56 +0100 From: Borislav Petkov To: David Kaplan Cc: linux-kernel@vger.kernel.org Subject: Re: RtlCaptureContext equivalent Message-ID: <20160320191156.GA4691@pd.tnic> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 20, 2016 at 03:54:58PM +0200, David Kaplan wrote: > Hi all > > i'm looking for a function within the kernel (for x86_64/amd64) that I > can use from my module to save/load cpu context (something like > Windows' RtlCaptureContext fcn). > > I assume there's something like that available but having a hard time > tracking it down. Something like arch/x86/power/cpu.c::save_processor_state() maybe? I'm assuming you'll want to supply your own struct saved_context though... And it doesn't save arch regs. There's also __show_regs() which dumps arch regs and the rest but that is probably not what you want... -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply.