On 8/9/05, Deepak Joshi <deepak_cins@xxxxxxxxxxx> wrote: > Linking Module to the kernel > > I read the following blocks in Linux device driver > third edition for linking Module ( rmmod and insmod > commands ) > 1) blk_init_queue > 2) add_disk > 3) request > 4) del_gendisk > > i can't able to understand how the actual linking is > going on. > Actually this linking was shown in terms of the block devices ....... This is making things clear !!!! you will understand it as you go on to later chapters !!!!! On 8/9/05, Paul Duplys <kernel_newbie@xxxxxx> wrote: > Hi Deepak, > > > > > Also i read about user and kernel space as they have > > different memory mappings i.e. its own address space. > > What does it mean ? > > > > please help me in clearing all these concepts. > > > > Deepak Joshi. > > an address space is simply a list of memory locations from some minimum > (usually 0) to some maximum, which is associated with a process and which > that process can read and write. > > User programs always run in the user space. It is a virtual address space. > That means, a user programm "sees" an address space from address 0 to the > TASK_SIZE (that is defined in the include/asm-ARCH/process.h, I believe). > The MMU (Memory Management Unit) is responsible for mapping the virtual > addresses to the physical addresses (real ones). > > The kernel always runs in the kernel address space. AFAIK, there are no > memory mappings for the kernel processes at all, because they must work with > actual addresses. > AFAIK processors in protected mode like i386 Architecture deals with virtual addresses and after decoding those virutal addresses it goes through the page tables and finally generates a physical adress for the physical memory to access ....... So kernel generates virtual addresses and the correct page table entries to point to the physical location ..... For the Zone Normal of the kernel (0 - 896MB) kernel creates and keeps a direct mapping of virutal to physical addresses but for above 896MB it creates temporary mappings (tabel entries) in its 1GB of the virtual address space so that it points to correct physical address and after use unmaps it...... > The reason for separating the user and kernel address spaces is the fact, > that user programs could damage some important kernel data if they access > the memory region where the kernel saves and manipulates his data. > You can say as kernel operates at Ring-0 of the processor protection level and user space operates at Ring-3, so there must be separation between kernel and user address space ... And the most important thing is kernel address space won't be swapable in any case !!! but user space can ...... (CMIIW) -- Fawad Lateef -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/