virtual-address-space

Why does Windows reserve 1Gb (or 2 Gb) for its system address space?

↘锁芯ラ 提交于 2019-12-03 08:40:36
问题 It's a known fact that Windows applications usually have 2Gb of private address space on a 32bit system. This space can be extended to 3Gb with the /3Gb switch. The operating system reserves itself the remaining of the 4Gb. My question is WHY? Code running in kernel mode (i.e. device driver code) has its own address space. Why, on top of a exclusive 4Gb address space, the operating system still want to reserve 2Gb of each user-mode process? I thought the reason is the transition between user

Where does the OS store argv and argc when a child process is executed?

时光怂恿深爱的人放手 提交于 2019-12-03 08:20:31
I'm having some difficulty understanding how the OS passes data from the address space of a parent process to the address space of a child process. Namely, in a C program, where is argc and argv stored upon being passed into main? I understand how argv is essentially a double pointer. What I'm not understanding is what the OS does with those values after loading them into the kernel. After creating an address space for the child process does it push these values on the stack of the new space? We obviously don't want to pass in pointers to another address space. For the record, I'm working with

Understanding virtual address and virtual address space

最后都变了- 提交于 2019-12-03 03:23:31
问题 I read that , "When a program executes an instruction like : MOV REG,1000 , it does so to copy the contents of the memory address 1000 to REG. Address can be generated using indexing,base registers,segment registers and other ways. These program generated address are called virtual address and form the virtual address space." Can anyone please explain me,what does it (These program generated address are called virtual address) mean ? 回答1: Programs and data are stored as numbers in memory

Why does Windows reserve 1Gb (or 2 Gb) for its system address space?

冷暖自知 提交于 2019-12-02 22:32:51
It's a known fact that Windows applications usually have 2Gb of private address space on a 32bit system. This space can be extended to 3Gb with the /3Gb switch. The operating system reserves itself the remaining of the 4Gb. My question is WHY? Code running in kernel mode (i.e. device driver code) has its own address space. Why, on top of a exclusive 4Gb address space, the operating system still want to reserve 2Gb of each user-mode process? I thought the reason is the transition between user-mode and kernel-mode call. For example, a call to NtWriteFile will need an address for the kernel

Understanding virtual address and virtual address space

倖福魔咒の 提交于 2019-12-02 16:52:27
I read that , "When a program executes an instruction like : MOV REG,1000 , it does so to copy the contents of the memory address 1000 to REG. Address can be generated using indexing,base registers,segment registers and other ways. These program generated address are called virtual address and form the virtual address space." Can anyone please explain me,what does it (These program generated address are called virtual address) mean ? Programs and data are stored as numbers in memory cells. Each memory cell has a unique number, called its address . The range of numbers representing valid

How are same virtual address for different processes mapped to different physical addresses

我怕爱的太早我们不能终老 提交于 2019-11-30 03:39:57
I have taken a course about Operating System design and concept and now I am trying to study Linux kernel thoroughly. I have a question that I cannot get rid of. In modern operating systems each process has own virtual address space(VAS) (eg, 0 to 2^32-1 in 32-bit systems). This provides many advantages. But in the implementation I am confused at some points. Let me explain it by giving an example: Let's say we have two processes p1, p2; p1 and p2 have their own VASes. An address 0x023f4a54 is mapped to different physical addresses(PA), how can it be? How is done this translation in this

Physical or virtual addressing is used in processors x86/x86_64 for caching in the L1, L2 and L3?

余生长醉 提交于 2019-11-29 20:11:30
Which addressing is used in processors x86/x86_64 for caching in the L1, L2 and L3(LLC) - physical or virtual(using PT/PTE and TLB ) and somehow does PAT(page attribute table) affect to it? And is there difference between the drivers(kernel-space) and applications(user-space) in this case? Short answer - Intel uses virtually indexed, physically tagged (VIPT) L1 caches: What will be used for data exchange between threads are executing on one Core with HT? L1 - Virtual addressing (in 8-way cache for define Set is required low 12 bits which are the same in virt & phys) L2 - Physical addressing

How remap_pfn_range remaps kernel memory to user space?

妖精的绣舞 提交于 2019-11-28 23:28:43
remap_pfn_range function (used in mmap call in driver) can be used to map kernel memory to user space. How is it done? Can anyone explain precise steps? Kernel Mode is a privileged mode (PM) while user space is non privileged (NPM). In PM CPU can access all memory while in NPM some memory is restricted - cannot be accessed by CPU. When remap_pfn_range is called, how is that range of memory which was restricted only to PM is now accessible to user space? Looking at remap_pfn_range code there is pgprot_t struct . This is protection mapping related struct. What is protection mapping? Is it the

Physical or virtual addressing is used in processors x86/x86_64 for caching in the L1, L2 and L3?

非 Y 不嫁゛ 提交于 2019-11-28 16:00:29
问题 Which addressing is used in processors x86/x86_64 for caching in the L1, L2 and L3(LLC) - physical or virtual(using PT/PTE and TLB) and somehow does PAT(page attribute table) affect to it? And is there difference between the drivers(kernel-space) and applications(user-space) in this case? Short answer - Intel uses virtually indexed, physically tagged (VIPT) L1 caches: What will be used for data exchange between threads are executing on one Core with HT? L1 - Virtual addressing (in 8-way cache

How to translate a virtual memory address to a physical address?

耗尽温柔 提交于 2019-11-28 04:44:59
In my C++ program (on Windows), I'm allocating a block of memory and can make sure it stays locked (unswapped and contiguous) in physical memory (i.e. using VirtualAllocEx(), MapUserPhysicalPages() etc). In the context of my process, I can get the VIRTUAL memory address of that block, but I need to find out the PHYSICAL memory address of it in order to pass it to some external device. 1. Is there any way I can translate the virtual address to the physical one within my program, in USER mode? 2. If not, I can find out this virtual to physical mapping only in KERNEL mode. I guess it means I have