RE: Seek Help !!! (about getting a pointer to sys_call_table)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



well, the address in IDT is physical, in the below URL u can read about the
problem experienced by a guy who used the 
IDTR contents directly without mapping it and the proposed solution.
http://seclists.org/lists/linux-kernel/2002/Apr/0921.html


For that matter even the CR3 register which points to the page directory
holds the physical address and not the virtual address of the Page
Directory. Linux uses the term 'swapper_pg_dir' to refer to this page
directory and this is a virtual
address, but when it wants to store the address of the page directory in to
CR3 register it does as below

" kernel/process.c:314:   asm volatile("movl %0,%%cr3": :"r"
(__pa(swapper_pg_dir)));"

 Avoids the overhead for the processor to convert the virtual address to
physical address for referrring these tables

gop



-----Original Message-----
From: Dhiman, Gaurav [mailto:Gaurav.Dhiman@xxxxxx]
Sent: Friday, October 01, 2004 10:31 AM
To: Thekkedath, Gopakumar; Ashish Mishra
Cc: Kenel Newbies
Subject: RE: Seek Help !!! (about getting a pointer to sys_call_table)



NO, IDTR contains the virtual address of IDT, it also contains the
length of IDT in number of bytes.

Cheers !!
Gaurav


-----Original Message-----
From: Thekkedath, Gopakumar [mailto:Gopakumar.Thekkedath@xxxxxxx] 
Sent: Friday, October 01, 2004 9:32 AM
To: Dhiman, Gaurav; Ashish Mishra
Cc: Kenel Newbies
Subject: RE: Seek Help !!! (about getting a pointer to sys_call_table)



>1. - get the pointer to IDT (Interrupt Descriptor Table), using SIDT
>assembly instruction. This instruction will store the value of IDTR
>register of processor, which actually is a pointer to IDT in kernel.

>2. - Once you get the pointer to IDT, get to the 128th entry of IDT by
>multiplying 128 with 8 (as each entry in IDT is of 8 bytes) and adding
>that to the IDT pointer, which we got in first step. This is a pointer
>to the system gate through with system calls enter kernel mode.

	Just a thought, the IDTR holds the physical address of the IDT
in
memory right? so to use that in the kernel,
u may have to convert it to virtual address.

gop

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux