Behind Windows x64's 44-bit virtual memory address limit

不羁岁月 提交于 2020-01-04 06:07:08
问题 I read the above post. The author explains why Windows x64 supports only 44-bit virtual memory address with singly linked list example. struct { // 8-byte header ULONGLONG Depth:16; ULONGLONG Sequence:9; ULONGLONG NextEntry:39; } Header8; The first sacrifice to make was to reduce the space for the sequence number to 9 bits instead of 16 bits, reducing the maximum sequence number the list could achieve. This still only left 39 bits for the pointer — a

x86-64: canonical addresses and actual available range

霸气de小男生 提交于 2019-12-21 17:04:03
问题 Intel and AMD documentation says that for 64 bit mode only 48 bits are actually available for virtual addresses, and bits from 48 to 63 must replicate bit 47 (sign-extension). As far as I know, all current CPU are implemented this way, but nothing (in theory) forbids to extend the available space in future implementations (and this won't break the binary compatibility). Is there a standard way to programatically determine the number of meaningful bits? (i.e. some specific CPUID, as happens

Multi-level page tables - hierarchical paging

為{幸葍}努か 提交于 2019-12-20 08:43:11
问题 Example question from a past operating system final, how do I calculate this kind of question? A computer has a 64-bit virtual address space and 2048-byte pages. A page table entry takes 4 bytes. A multi-level page table is used because each table must be contained within a page. How many levels are required? How would I calculate this? 回答1: Since page table must fit in a page, page table size is 2048 bytes and each entry is 4 bytes thus a table holds 2048/4=512 entries. To address 512

virtual memory concepts

前提是你 提交于 2019-12-19 11:40:16
问题 I am confused about some topics regarding virtual memory. So, i am going to pointwise list them and ask questions. While answering i will prefer if you also list some source where i can clear that doubt. I will be talking with reference to a linux elf executable file. I have heard that every process has the address space of 4gb in a 32 bit system. When i checked the objdump of one of my executable relocatable file i saw that it had limits from 00000000 to ffffffff. Also it contained the

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

让人想犯罪 __ 提交于 2019-12-18 11:27:38
问题 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

Understanding Virtual Address, Virtual Memory and Paging

好久不见. 提交于 2019-12-17 17:24:33
问题 I've been learning these topics and read many articles and books but they all lack some complementary information and confused me even more. So here, I’d like to explain what I know while I am asking my questions. Hopefully, this topic will be useful for many like me. I'd also like to learn validity of my knowledge and corrections if necessary. Virtual Memory Some articles say “Virtual Memory is some space of Hard Disk which emulates Physical Memory so that we can have more memory than we

Reasonable valid start address for mmap address hint so as to be gauranteed that things work

99封情书 提交于 2019-12-11 10:42:16
问题 In one of our assignments we are required to build a distributed shared memory between 2 machines, I was using a paging based technique such that the base addresses are different on both the machines. But there is this linked list test case which almost mandates that both address ranges are same. mmap's fixed address using MAP_FIXED causes the slave machine to crash( because the stack of the reply server thread was getting overwritten ), i figured that creating an address that is gauranteed

What is the difference between these two functions: `ioremap_uc()` and `set_memory_uc`?

♀尐吖头ヾ 提交于 2019-12-10 17:11:26
问题 When I want to mark memory region as Write Combined (to disable cacheable and use BIU) or Uncacheable through set PAT(Page attribute table - 7bit in PTE), then what do I must to use, and what is the difference between two these functions? Drivers should use ioremap_[uc|wc] to access PCI BARs with [uc|wc] access types: void __iomem *ioremap_wc(resource_size_t phys_addr, unsigned long size) Drivers should use set_memory_[uc|wc] to set access type for RAM ranges: int set_memory_uc(unsigned long

How does Windows give 4GB address space each to multiple processes when the total memory it can access is also limited to 4GB

拜拜、爱过 提交于 2019-12-06 08:58:18
问题 How does Windows give 4GB address space each to multiple processes when the total memory it can access is also limited to 4GB. The solution of above question i found in Windows Memory Management (Written by: Pankaj Garg) Solution: To achieve this Windows uses a feature of x86 processor (386 and above) known as paging. Paging allows the software to use a different memory address (known as logical address) than the physical memory address. The Processor’ paging unit translates this logical

Unit Testing for x86 LargeAddressAware compatibility

陌路散爱 提交于 2019-12-04 20:35:34
问题 For a win32 executable (x86) we can set the LargeAddressAware flag so it can access a virtual address space of 4 GB (instead of just 2 GB) when running on x64 Windows. This looks very appealing. However, there are risks involved. For example see: Drawbacks of using /LARGEADDRESSAWARE for 32 bit Windows executables? So let's go ahead and configure the system that is executing some unit tests with the system-wide registry switch AllocationPreference set to MEM_TOP_DOWN . That should do, shouldn