0

When Windows XP boots without AHCI drivers on a SATA system, you get a BSOD like 0x0000007b.

What I don't understand is why it can't load without AHCI drivers. Clearly it was already able to load the kernel code that gives you the BSOD, so why couldn't it load the rest of the OS the same way?

Alternatively: All forms of ATA support Programmed I/O, and IIRC Windows XP supported PIO as well. So they could've loaded the rest of the OS using PIO too... couldn't they?

user541686
  • 23,663
  • 46
  • 140
  • 214
  • Good question. I am *guessing* is used the firmware (e.g. BIOS of UEFI in CSM mode) to access the drive prior to switching over to internal drivers. – Hennes Jul 22 '17 at 18:38
  • @Hennes: Possibly. But again -- why couldn't it keep doing that? – user541686 Jul 22 '17 at 18:39
  • Internal drivers can be updated and probably perform much better. They also do not need a context switch via an interrupt every time you want to load a new sector. Not that I am guessing. It isa likely reason. I am curious if someone with hard facts will confirm this. – Hennes Jul 22 '17 at 18:42
  • @Hennes: Right, but that's only an argument for why internal drivers are better, not why they should be the only option. – user541686 Jul 22 '17 at 19:21

1 Answers1

4

Windows uses INT13h (BIOS) access to hard disks only at the very earliest stages. If during this time no suitable Windows driver for accessing the disk is loaded, the blue screen pops up.

INT13h is only available in Real Mode. Modern Windows, however, runs in Protected Mode or Long Mode (x64).

On native UEFI (as in: when not using the CSM), INT13h isn’t available. Windows (presumably) uses UEFI services to access disks in this environment.

Response to edit: Whether your SATA controller runs in AHCI mode or not is not controlled by the operating system. Instead, you select which to use in the firmware settings. The firmware sets the corresponding bits in the controller’s registers.

Virtual 8086 mode is just that: virtual. It does not provide access to real BIOS features. Instead, the host must emulate these features.

Although I’m no expert I find it very likely that switching back to Real Mode would discard important information in the MMU and whatnot, not to speak of the implications of halting all things Protected Mode just to access the disk.

Daniel B
  • 60,360
  • 9
  • 122
  • 163
  • So would the actual answer to the question be that they haven't implemented a switch back from protected mode into real mode? Because it's totally possible to do this and it's a little surprising to me if they weren't already doing it... – user541686 Jul 22 '17 at 19:08
  • It can’t switch back. All of Windows depends on Protected Mode features. – Daniel B Jul 22 '17 at 19:09
  • But you don't need all of Windows to run while the hard disk is being accessed, right? You could switch while accessing the disk and then switch back. And again: are you saying they're not already doing this for anything else? – user541686 Jul 22 '17 at 19:11
  • By the way, note that ATA (including SATA) also supports Programmed I/O, which Windows XP also supported. So they also had that mechanism available. So why was it so crucial to load AHCI drivers? – user541686 Jul 22 '17 at 19:14
  • If “all of Windows” were to stop whenever something accesses (slow!) storage, you’d probably throw your PC out the window. Pretty sure it isn’t possible for other reasons. too. What do you mean by “already doing this”? Whether your SATA controller runs in AHCI mode or not is not up to the OS. It’s a firmware setting. Also keep in mind that comments aren’t for extended discussion. – Daniel B Jul 22 '17 at 19:15
  • temporarily cripling the whole setup just to access a HDD. I guess they could do that rather than blue screening. But it certainly should not be a default. Instead it should use legacy mode (no switches and better performance) or proper AHCI (using all disk features). – Hennes Jul 22 '17 at 19:16
  • @Hennes: I mean, it would make the difference between trashing the OS install versus making it possible for users to install AHCI drivers after installation, which is a pretty crucial difference. By "already doing this", I meant was there anything that already required implementing a switch back to real mode? But even that's not necessary. XP already supported Virtual 8086 mode, which it could've used for this purpose too. It wouldn't need to switch back to real mode at all. I'm not trying to have an extended discussion in the comments, I'm saying these should be addressed in your answer. – user541686 Jul 22 '17 at 19:19
  • I am not sure how windows can switch modes. If possible it sounds less worse than blue screening. I am not 100% sure it is possible without loosing information (Basically crashing the running windows and best case going back to setup. Press F6 again and insert a floppy with a driver). – Hennes Jul 22 '17 at 19:20
  • Come on guys go to the chat room for this discussion – Ramhound Jul 22 '17 at 19:24