This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Save CS segment register for ljmp instruction
On Mon, Oct 12, 2009 at 11:36 PM, Michael Snyder <msnyder@vmware.com> wrote:
> Could one of you write an assembly language testcase?
I paste the code from Linux kernel(2.6.24
arch/x86/kernel/head_32.S:278) as follows:
---- BEGIN
/*
* Enable paging
*/
movl $swapper_pg_dir-__PAGE_OFFSET,%eax
movl %eax,%cr3 /* set the page table pointer.. */
movl %cr0,%eax
orl $0x80000000,%eax
movl %eax,%cr0 /* ..and set paging (PG) bit */
ljmp $__BOOT_CS,$1f /* Clear prefetch and normalize %eip */
1:
/* Set up the stack pointer */
lss stack_start,%esp
---END
the CS changed in the code above, but I'm not sure the example is enough to
assure my patch's correctness.
Thank you!
>
> Hui Zhu wrote:
>>
>> Could you post some code to test the ljmp and cs? ?I am not sure about cs
>> part.
>>
>> Thanks,
>> Hui
>>
>> On Mon, Oct 12, 2009 at 10:24, Jiang Jilin <freephp@gmail.com> wrote:
>>>
>>> Hi Hui,
>>>
>>> I think CS register should be stored for ljmp instruction, but I'm
>>> not pretty sure, please help me confirm it.
>>>
>>> Thanks!
>>>
>>> 2009-10-12 ?Jiang Jilin ?<freephp@gmail.com>
>>>
>>> ? ? ? * i386-tdep.c (i386_process_record): Save CS segment register
>>> ? ? ? for ljmp instruction
>>> ---
>>> ?gdb/i386-tdep.c | ? ?3 +++
>>> ?1 files changed, 3 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
>>> index b4dc646..0145008 100644
>>> --- a/gdb/i386-tdep.c
>>> +++ b/gdb/i386-tdep.c
>>> @@ -3606,8 +3606,11 @@ reswitch:
>>> ? ? ? ? break;
>>> ? ? ? ? /* jmp */
>>> ? ? ? case 4:
>>> + ? ? ? ? I386_RECORD_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
>>> + ? ? ? ? break;
>>> ? ? ? ? /* ljmp */
>>> ? ? ? case 5:
>>> + ? ? ? ? I386_RECORD_ARCH_LIST_ADD_REG (X86_RECORD_CS_REGNUM);
>>> ? ? ? ? I386_RECORD_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
>>> ? ? ? ? break;
>>> ? ? ? ? /* push */
>>> --
>>> 1.5.4.3
>>>
>>>
>
>
--
Jiang