Re: OS in-memory structure

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

 



Thank you Pei, I'm currently following a tutorial on asm programming on linux

On Oct 8, 2010, at 4:30 AM, Pei Lin wrote:

> 2010/10/8 Juan Rafael Garcia Blanco <jgblanco.mail@xxxxxxxxx>:
>> Well, I think it applies to all architectures, but I'm not sure, so take
>> with care. Also, I think this is something everybody knows, sorry.
>> The OS is mapped in every process address space, but its pages are protected
>> (check out this http://www.logix.cz/michal/doc/i386/chp05-02.htm#F-05-10). A
>> process cannot jump to a kernel address, because the process executes in
>> user mode and kernel addresses are therefore protected from being executed
>> by a user process. Then, a system call occurs and the kernel starts
>> executing through an interrupt (the famous 0x80 vector number).
> I think you are just confused by the parameters how to deliver to the
> kernel space.
> Because system call code runs in the kernel space and caller runs in
> the user space,  they use the different the
> stack. On i386, the parameters of a system call are transported via
> registers. The system call number goes into %eax, the first parameter
> in %ebx, the second in %ecx, the third in %edx, the fourth in %esi,
> the fifth in %edi, the sixth in %ebp. Parameters more than six, there
> will be on register to save the address of the structure in the user
> space, and in the system call routine will copy the parameters into
> the kernel stack.
> 
> The book <<Understanding the Linux Kernel By Daniel Pierre Bovet,
> Marco Cesatí>> will give you more details.
> http://books.google.com.hk/books?id=cbbMrRNiC4cC&pg=PT618&dq=system+call+parameter&hl=en&ei=AH-uTIbmBoayvgPOotndBg&sa=X&oi=book_result&ct=result&resnum=1&ved=0CCgQ6AEwAA#v=onepage&q=system%20call%20parameter&f=false
> 
>> The active
>> address space is the caller one, but now, since the kernel executes in
>> privileged, any address of any page can be reached. The kernel can throw to
>> the bus addresses from user space, cause it is actually using the process
>> address space.
>> I was confused mostly because I thought the kernel as a process, and I
>> didn't remember how a page table entry looks like. Besides, I have learnt
>> something: during an interrupt from an external device for example, the
>> kernel cannot use addresses from any user process memory map, because the
>> current address space may not be the correct one.
>> Thank you, and sorry for my English
>> On Oct 7, 2010, at 6:38 PM, hiren panchasara wrote:
>> 
>> 
>> On Thu, Oct 7, 2010 at 9:28 AM, Juan Rafael Garcia Blanco
>> <jgblanco.mail@xxxxxxxxx> wrote:
>>> 
>>> Hi, it has just been solved, thank you
>> 
>> Would you care to share?
>> 
>> Thanks.
>>> 
>>> On Oct 7, 2010, at 5:55 PM, Juan Rafael Garcia Blanco wrote:
>>> 
>>>> Hi.
>>>> During the boot process, Linux is loaded in main memory. When a system
>>>> call is done, the OS executes again. If the system call is accompanied by
>>>> some parameter, which is an address of the user process memory map, how can
>>>> the kernel access that variable which is in user process memory map? I mean,
>>>> when the kernel fires up an address, how is it translated? I can't find an
>>>> answer to my question in books nor in the internet.
>>>> 
>>>> Thank you very much
>>> 
>>> 
>>> --
>>> To unsubscribe from this list: send an email with
>>> "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
>>> Please read the FAQ at http://kernelnewbies.org/FAQ
>>> 
>> 
>> 
>> 
> 
> 
> 
> -- 
> Best Regards
> Lin


--
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