Date: Thu, 6 Aug 2015 13:24:34 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: TJ Lee <tjmaillists@gmx.com> Cc: freebsd-hackers@freebsd.org Subject: Re: Trying to understand kernel trap code Message-ID: <20150806102434.GH2072@kib.kiev.ua> In-Reply-To: <trinity-4e8adf72-5bc9-495d-be25-46f9379f1c9e-1438855745314@3capp-mailcom-bs01> References: <trinity-4e8adf72-5bc9-495d-be25-46f9379f1c9e-1438855745314@3capp-mailcom-bs01>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Aug 06, 2015 at 12:09:05PM +0200, TJ Lee wrote: > Hi, > > I just started looking at FreeBSD kernel code in more detail and > want to understand the low-level entry points into the kernel on a > x86-64 CPU. What I'd like to know is precisely what happens when I > execute a "syscall" instruction in user-land. More specifically, what > instruction in what assembly source file is RIP/CS loaded with on > executing syscall? Also where in the source code do we load the MSRs > with these values? > Read the sys/amd64/amd64/exception.S, fast_syscall entry point. Grep for MSR_*STAR msr names to see how syscall MSRs are configured, in particular, on BSP in hammer_time(), on AP in init_secondary(). You need to read the IA32 manual about syscall instruction to understand how it all plays together.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150806102434.GH2072>