Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Mostly C, VirtualBox?

Go to solution Solved by Sauron,

Virtualbox is not an emulator. QEMU, however, is. It's also mostly written in C.

 

What code is responsible for the ability to "emulate" the cpu when hardware virtualization isn't supported? Reason I ask is, I would like to look at it.

Link to post
Share on other sites

VirtualBox only emulates X86 systems, there is no case where hardware virtualisation is not native.

Main Rig:-

Ryzen 7 3800X | Asus ROG Strix X570-F Gaming | 16GB Team Group Dark Pro 3600Mhz | Corsair MP600 1TB PCIe Gen 4 | Sapphire 5700 XT Pulse | Corsair H115i Platinum | WD Black 1TB | WD Green 4TB | EVGA SuperNOVA G3 650W | Asus TUF GT501 | Samsung C27HG70 1440p 144hz HDR FreeSync 2 | Windows 10 Pro X64 |

 

Server:-

Intel NUC running Server 2019 + Synology DSM218+ with 2 x 4TB Toshiba NAS Ready HDDs (RAID0)

Link to post
Share on other sites
Just now, Master Disaster said:

VirtualBox only emulates X86 systems, there is no case where hardware virtualisation is not native.

I'm aware, I'm asking what part of the source code allows this to happen I realize that it only allows x86 OSes.

Link to post
Share on other sites
1 minute ago, Poet129 said:

I'm aware, I'm asking what part of the source code allows this to happen I realize that it only allows x86 OSes.

If I understand you correctly then its important to realise that VirtualBox isn't technically emulating anything. Its an X86 emulator running on an X86 platform, instructions from the guest machine are simply processed on the host CPU via hardware passthrough. For all intents and purposes the guest machine has access to cores on your physical CPU and uses them as if they were attached to it directly.

 

As for where that happens in the code, sorry I can't help with that.

Main Rig:-

Ryzen 7 3800X | Asus ROG Strix X570-F Gaming | 16GB Team Group Dark Pro 3600Mhz | Corsair MP600 1TB PCIe Gen 4 | Sapphire 5700 XT Pulse | Corsair H115i Platinum | WD Black 1TB | WD Green 4TB | EVGA SuperNOVA G3 650W | Asus TUF GT501 | Samsung C27HG70 1440p 144hz HDR FreeSync 2 | Windows 10 Pro X64 |

 

Server:-

Intel NUC running Server 2019 + Synology DSM218+ with 2 x 4TB Toshiba NAS Ready HDDs (RAID0)

Link to post
Share on other sites
17 minutes ago, Poet129 said:

What code is responsible for the ability to "emulate" the cpu when hardware virtualization isn't supported? Reason I ask is, I would like to look at it.

There is no one, neat single file, it's all a whole lot of interconnected stuff spread out into dozens of files.

6 minutes ago, Master Disaster said:

If I understand you correctly then its important to realise that VirtualBox isn't technically emulating anything. Its an X86 emulator running on an X86 platform, instructions from the guest machine are simply processed on the host CPU via hardware passthrough.

VirtualBox can emulate x86 without hardware-virtualization, but apparently only 32-bit systems.

Hand, n. A singular instrument worn at the end of the human arm and commonly thrust into somebody’s pocket.

Link to post
Share on other sites

Virtualbox is not an emulator. QEMU, however, is. It's also mostly written in C.

Don't ask to ask, just ask... please 🤨

sudo chmod -R 000 /*

What is scaling and how does it work? Asus PB287Q unboxing! Console alternatives :D Watch Netflix with Kodi on Arch Linux Sharing folders over the internet using SSH Beginner's Guide To LTT (by iamdarkyoshi)

Sauron'stm Product Scores:

Spoiler

Just a list of my personal scores for some products, in no particular order, with brief comments. I just got the idea to do them so they aren't many for now :)

Don't take these as complete reviews or final truths - they are just my personal impressions on products I may or may not have used, summed up in a couple of sentences and a rough score. All scores take into account the unit's price and time of release, heavily so, therefore don't expect absolute performance to be reflected here.

 

-Lenovo Thinkpad X220 - [8/10]

Spoiler

A durable and reliable machine that is relatively lightweight, has all the hardware it needs to never feel sluggish and has a great IPS matte screen. Downsides are mostly due to its age, most notably the screen resolution of 1366x768 and usb 2.0 ports.

 

-Apple Macbook (2015) - [Garbage -/10]

Spoiler

From my perspective, this product has no redeeming factors given its price and the competition. It is underpowered, overpriced, impractical due to its single port and is made redundant even by Apple's own iPad pro line.

 

-OnePlus X - [7/10]

Spoiler

A good phone for the price. It does everything I (and most people) need without being sluggish and has no particularly bad flaws. The lack of recent software updates and relatively barebones feature kit (most notably the lack of 5GHz wifi, biometric sensors and backlight for the capacitive buttons) prevent it from being exceptional.

 

-Microsoft Surface Book 2 - [Garbage - -/10]

Spoiler

Overpriced and rushed, offers nothing notable compared to the competition, doesn't come with an adequate charger despite the premium price. Worse than the Macbook for not even offering the small plus sides of having macOS. Buy a Razer Blade if you want high performance in a (relatively) light package.

 

-Intel Core i7 2600/k - [9/10]

Spoiler

Quite possibly Intel's best product launch ever. It had all the bleeding edge features of the time, it came with a very significant performance improvement over its predecessor and it had a soldered heatspreader, allowing for efficient cooling and great overclocking. Even the "locked" version could be overclocked through the multiplier within (quite reasonable) limits.

 

-Apple iPad Pro - [5/10]

Spoiler

A pretty good product, sunk by its price (plus the extra cost of the physical keyboard and the pencil). Buy it if you don't mind the Apple tax and are looking for a very light office machine with an excellent digitizer. Particularly good for rich students. Bad for cheap tinkerers like myself.

 

 

Link to post
Share on other sites
3 minutes ago, WereCatf said:

There is no one, neat single file, it's all a whole lot of interconnected stuff spread out into dozens of files.

Any chance it is contained in a neat folder?

Link to post
Share on other sites
4 minutes ago, WereCatf said:

There is no one, neat single file, it's all a whole lot of interconnected stuff spread out into dozens of files.

VirtualBox can emulate x86 without hardware-virtualization, but apparently only 32-bit systems.

Nah, it doesn't actually emulate anything, it uses a software virtualisation technique.

Quote

In the absence of hardware-assisted virtualization, VirtualBox adopts a standard software-based virtualization approach. This mode supports 32-bit guest OSs which run in rings 0 and 3 of the Intel ring architecture.

  • The system reconfigures the guest OS code, which would normally run in ring 0, to execute in ring 1 on the host hardware. Because this code contains many privileged instructions which cannot run natively in ring 1, VirtualBox employs a Code Scanning and Analysis Manager (CSAM) to scan the ring 0 code recursively before its first execution to identify problematic instructions and then calls the Patch Manager (PATM) to perform in-situ patching. This replaces the instruction with a jump to a VM-safe equivalent compiled code fragment in hypervisor memory.
  • The guest user-mode code, running in ring 3, generally runs directly on the host hardware in ring 3.

In both cases, VirtualBox uses CSAM and PATM to inspect and patch the offending instructions whenever a fault occurs. VirtualBox also contains a dynamic recompiler, based on QEMU to recompile any real mode or protected mode code entirely (e.g. BIOS code, a DOS guest, or any operating system startup).

Also this feature was dropped in VBox 6.1 and later.

Main Rig:-

Ryzen 7 3800X | Asus ROG Strix X570-F Gaming | 16GB Team Group Dark Pro 3600Mhz | Corsair MP600 1TB PCIe Gen 4 | Sapphire 5700 XT Pulse | Corsair H115i Platinum | WD Black 1TB | WD Green 4TB | EVGA SuperNOVA G3 650W | Asus TUF GT501 | Samsung C27HG70 1440p 144hz HDR FreeSync 2 | Windows 10 Pro X64 |

 

Server:-

Intel NUC running Server 2019 + Synology DSM218+ with 2 x 4TB Toshiba NAS Ready HDDs (RAID0)

Link to post
Share on other sites
6 minutes ago, Sauron said:

Virtualbox is not an emulator. QEMU, however, is. It's also mostly written in C.

Okay I will try this and post back later.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×