From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: deffo@gmx.de
Cc: gdb@sourceware.org
Subject: Re: GDB does not stop at assembly code address
Date: Tue, 18 Oct 2016 19:47:00 -0000 [thread overview]
Message-ID: <20161018194728.GA19800@host1.jankratochvil.net> (raw)
In-Reply-To: <trinity-155e70d9-b72e-49fd-86ca-815bb77c2481-1476458496665@3capp-gmx-bs30>
On Fri, 14 Oct 2016 17:21:36 +0200, deffo@gmx.de wrote:
> What does not work is the breakpoint on startup_32, which is still in
> Assembly land. GDB just jumps over it as if it wasn't called, but it is
> definitely called since it's the 32-bit kernel entrypoint.
>
> Is this due to some real-mode/protected-mode fiddlings?
On Tue, 18 Oct 2016 18:53:05 +0200, deffo@gmx.de wrote:
> (gdb) b startup_32
> Breakpoint 1 at 0xc1000000: file arch/x86/kernel/head_32.S, line 97.
It is because it is too early bootstap which does not yet run from virtual
addresses. 0xc1000000 is a virtual address - if it was a physical address
Linux kernel could not run on any machine with less than 3GB of RAM.
(Which it can - there did exist machines with less than 3GB RAM. :-) )
This startup_32 code sets up the virtual memory page tables where it later
jumps. But sure it does not jump to 0xc1000000 as it would dead-lock itself.
It is better written in the 64-bit startup code but the principle is the same:
arch/x86/kernel/head_64.S
63 * Since we may be loaded at an address different from what we were
64 * compiled to run at we first fixup the physical addresses in our page
65 * tables and then reload them.
Debugging any bootstrapping code usually has many pitfalls.
Jan
next prev parent reply other threads:[~2016-10-18 19:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-14 15:21 deffo
2016-10-17 11:46 ` Yao Qi
2016-10-18 19:47 ` Jan Kratochvil [this message]
2016-10-18 16:53 deffo
2016-10-18 19:19 ` Yao Qi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161018194728.GA19800@host1.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=deffo@gmx.de \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox