Can a virtual address be remapped to different physical addresses while process is running? - virtual-memory

Is it theoretically possible and does any OS actually use it? If yes, what is the purpose?

It happens all the time. The OS may need the physical memory in question so it unmaps and later remaps.

Related

Any way to detect page swap from kernel or user mode

I want to build simple emulator using Intel VT-x.
Suppose we've allocated memory (guest RAM), of course from paged pool, and built EPT.
Everything working.
Now host OS (Win10 x64) decide to swap out those pages or move or smth else, so physical addresses in EPT are not valid anymore. VMM needs to update EPT entries accordinly (not present), and when guest will use such page, an EPT violation will happen. Then VMM performs a dummy read, so host OS will swap page back to memory, and updates EPT entry as present.
So the question: is there any way do detect swap or physical address change for particual linear addresses range of the current thread? Kernel or user mode. I've googled couple of days, but found nothing.
If there is no such way, what approach I can use in this situation? Where I can read about that?
Thanks in advance!

How to split RAM for each Windows OS and my application?

I want to split RAM in my PC into two parts; half for my Windows OS and the other half for an image buffer for my application. For example, my desktop has 32GB memory, and I want to assign 16GB for Windows and assign another 16GB for my application access only. Windows doesn't touch the other 16GB but my application should use that 16GB image buffer. I know how to do this in Linux, but I need to do this in Windows OS. I think I have to configure the BIOS and need to implement a page remap Windows driver of image buffer for my application access.
Is there any good way to do this?
You can do this with the Address Windowing Extensions API. Although this was originally designed for 32-bit applications, it is still available to 64-bit applications, and memory allocated this way is not available to the virtual memory management system.
However, you should note that in most cases allowing the virtual memory manager to do its job will result in better overall performance than explicitly locking down memory will.

How does a computer know where in the filesystem the bootloader is located?

How does a computer know where in the filesystem the bootloader is located? Is there a common file among all operating systems and all computers (maybe not all computers, but all architectures) that points to the bootloader? I know Raspberry Pi always loads bootcode.bin from the first partition of the SD card. Do PCs share a common file like this?
The Master Boot Record occupies the first 512 bytes of the first hard disk, and is the first thing loaded by the BIOS to hand over control to a program capable of booting the desired operating system. In general, a bootloader gets installed in the MBR, removing its previous content. It is (in dual boot cases) possible for them to live in co-existence, which is known as multi-booting.
It is different among different architectures. But usually there is a register the cpu reads its first instruction from after reset to begin execution. This register is often contains the bits for an assembly jump operation to another memory address which is the address of the boot code. On the next clock cycle it will fetch the operation at that address and so on.
The hardware designer will have to determine how this is implemented. For example the first instruction could be to read from a memory address on an eeprom chip that contains the boot code.
As far as PC's go the motherboard has its own boot process which will load the OS bootloader. Hence the reason you can still startup a pc and see the BIOS without an OS installed
Or at least thats what I remember from my Comp. Arch. class forever ago.

CPU identifier under windows, gnu/linux, macosx

In order to recognize a computer in a certain manner (MAC adress not appropriate for some cases, disk ID or hostname neither etc.), I would like to detect a CPU id (or first CPU core id)... How can I achieve this on different platforms? (not necessarily in manner that is robust to OS change on the same computer)
Thanks
The CPU id identifies the processor model, and isn't unique to each computer. See: http://en.wikipedia.org/wiki/CPUID
The MAC address is usually the best way to uniquely identify a system.

Increase memory for shared memory

When trying to get shared memory, shmget() often fails because being unable to allocate memory. The physical size of RAM really shouldn't be the problem (4GB is enough, I think).
Rather there's probably anywhere in the systems properties a limit for allocating shared memory set. Does anyone know, where I can find this property?
I'm using Mac OS X Version 10.6
Depends on the OS. PostgreSQL documentation has tips for changing the shared memory limit on various platforms.

Resources