Re: Doubts in System call mechanism in linux

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

 



On Tue, May 11, 2010 at 9:50 AM, Daniel (Youngwhan) Song
<breadncup@xxxxxxxxx> wrote:
> On 5/10/10 6:37 PM, Balachandar wrote:
>
> Hello,
>   We transit from ring3 to ring0 using 'int' or the new 'syscall/sysenter'
> instruction. Does that mean that the page tables and other stuffs that needs
> to be modified for the kernel is automatically done by the 'int' instruction
> or the interrupt handler for the 'int 0x80' will do the required stuff and
> jump to the respective system call.

IMHO, As you know 'int 0x80' is just an exception ( intel speak ). Under Linux
this 'slot' is chosen to switch to priviledge mode. So to answer your question,
setting up of kernel stack ( pointed bs TSS ) etc needs to be done by the
handler. Also remember, when bringing up the board (booting) we set up IDT and
all its slots greater than 32 to zero, and slowly pick up a slot and
assign duty
to it.

Thanks
>
> Also when returning from a system call, we again need to go to user space.
> For this we need to know the instruction address in the user space to
> continue the user application. Where is that address stored. Does the 'ret'
> instruction automatically changes the ring from ring3 to ring0 or where/how
> this ring changing mechanism takes place?
>
> Then, i read that changing from ring3 to ring0 is not as costly as changing
> from ring0 to ring3. Why is this so??
>
> Thanks,
>
> Bala
>
> Hi Bala,
>
> Have you referred this?
>
> http://tldp.org/HOWTO/html_single/Implement-Sys-Call-Linux-2.6-i386/
>
> http://www.ibm.com/developerworks/linux/library/l-system-calls/index.html
>
> Daniel
>

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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