How to reconcile the instruction pointer and the current line in GDB?

Viewed 68

I have two code segments: .multiboot.text and .text
They are located in memory as follows:
linker.ld

SECTIONS
{
    . = 0x00100000;
    /* The kernel will live at 3GB + 1MB in the virtual address space, */
    /* which will be mapped to 1MB in the physical address space. */

    _kernel_start = .;
    .multiboot.text : {
        *(.multiboot.text)
    }

    . += 0xC0000000;
    /* Add a symbol that indicates the start address of the kernel. */
    .text ALIGN (4K) : AT (ADDR (.text) - 0xC0000000)
    {
        *(.text)
    }
}

start.asm

section .multiboot.text
. . .
    ; Jump to higher half with an absolute jump.
    ; <breakpoint is successfully triggered here>
    ; <single>
    lea ecx, .higher_half
    jmp ecx

section .text
.higher_half:
    ; Unmap the identity mapping as it is now unnecessary.
    ; <breakpoint doesn't work here>
    mov [boot_page_directory + 0], DWORD 0

    ; Reload crc3 to force a TLB flush so the changes to take effect.
    mov ecx, cr3
    mov cr3, ecx
. . .

In my start.asm file, I pass control from the .multiboot.text segment to the .text and IP changes from 0x001????? on 0xC01????? and the debugger cannot reconcile this change with the current line
As a result of this, step-by-step debugging does not work for me
debugging works, but does not display the line

How can I help him with this?

I compile start.asm using nasm and the -g flag, which means debugging information is present
Pay attention to the fact that the code itself is physically located in the lower half of memory, however, such a difference in IP is due to virtual memory

0 Answers
Related