EzDevInfo.com

bios interview questions

Top bios frequently asked interview questions

Oracle VirtualBox "VT-x is disabled in the BIOS"

I'm getting this error while loading an image from a Oracle virtual box. How can I fix it? I installed virtual box 4.3.12 via a remote desktop connection to a Windows 7 64-bit, 32G RAM computer.

enter image description here

I have checked the Intel Visualization Setting, it says yes to hardware visualization. enter image description here

I saw this questions up online looks like the same issue. But I am using remote desktop control so I would not be able to change the setting at the restart page. I will be automatically logged off when I restart the this computer.

VERR_VMX_MSR_VMXON_DISABLED when starting an image from Oracle virtual box


Source: (StackOverflow)

How to perform low-level IO with a USB flash drive under the BIOS (compared to a floppy)?

I have recently been studying some bootstrap code which was intended for use with a floppy drive. My goal is to modify the program so that it uses my USB flash drive. Now I see how the INT 13H function has been used with the floppy device, but I guess my question is, how will communicating with the USB drive differ?

For example, here is a snippet of the floppy code (GNU assembler):

    movb    $0x00,%dl       /* select 1st floppy */

    /* later */

    movw    sec,%cx     /* get sector number */
    movw    head,%dx    /* get head number */

    movw    $0x0201,%ax /* read 1 sector */
    int $0x13

Now I have read that moving 0x80 into %dl will select the first HDD in the BIOS. In my particular bios I can change the drive order, which would include a USB drive. I am quite sure this is becoming BIOS dependant, but I was thinking that the order listed in the BIOS could correspond to the value I move into %dl. I need to track down some documentation...

I am really unfamiliar with working with block devices as it is, can someone point me to a good place to start learning more?

Thanks!


Source: (StackOverflow)

Advertisements

Modifying the ia32 feature control register on Asus Z170 board with buggy BIOS

I'm in the unlucky situation that I need to use a CPU feature that the BIOS hasn't enabled in the ia32 feature control MSR register. The BIOS does set the lock bit so I can't set the bit myself. The BIOS (Asus UEFI BIOS) has no option to change the behavior. Question is, is there any way I can set this bit? I'm thinking if it is possible to write an UEFI extension or some program I could execute from the UEFI shell. But I'm not sure if the register is locked before this would be execute (I know very little about UEFI and its programming environment). Alternatively, is it possible to patch the BIOS update image or modify it using standard tools? Anyone who heard of success stores in this area?

The feature in question is SGX (Software Guard Extensions). The board is Asus Z170-K. Everything is in place to support SGX, except that the BIOS is unable to set this bit.

Update May 22th: I just updated the Asus Z170-K to the newly released BIOS 1803 (released 20th of May). It was a big jump in version number so I was hopeful. Sadly, SGX support still isn't there. I've now filed a new request with Asus and this time I plan not to be just brushed off. I think it is outright amateurish this is not supported from the beginning - it is part and parcel of supporting a Skylake CPU so I think all customers requiring this should try and pursue a refund (I know I'm gonna do that).


Source: (StackOverflow)

How to query BIOS using GRUB?

I am trying to make a small kernel for 80386 processor mainly for learning purpose and want to get the full memory map of the available RAM.

I have read that it is possible and better to do so with the help of GRUB than directly querying the BIOS.

Can anybody tell me how do I do it ?

Particularly, for using bios functionality in real mode we use bios interrupts and get the desired values in some registers , what is the actual equivalent way when we want to use GRUB provided functions ?


Source: (StackOverflow)

Where is there good information about low level PC booting?

I'm interested in writing a boot loader for USB sticks that looks for a directory of ISOs and gives you the option to boot one of them as if it were a bootable CD. This is basically so I have a menu driven program that allows me to install one of several different distributions off of a USB stick.

Where would I go to figure out how to make this work? Do I need to install some kind of BIOS hack to allow remapping of CD blocks to blocks in the filesystem? How would that work once the boot from the CD had enough marbles to start trying to access the device directly?


Source: (StackOverflow)

How is the BIOS used by a modern OS?

What's the function of the BIOS in a modern OS? Is it still used after booting? And is there some kind of BIOS API?


Source: (StackOverflow)

Check if my computer has bios password (via VB / C#)

Im doing a checklist in my domain. I was wondering if there's a way to obtain the BIOS status of Computer, particularly BIOS Password status, I want to know if a Computer has BIOS password or not without shutting down.


Source: (StackOverflow)

I don't understand how to use Interrupt 21, AH=0ah

My information is coming from here. The assignment asks for a program that reads in no more than 20 characters, converts those characters to upper case, and then prints the input as capitals.

I have no idea how to access the input from int21/AH=0ah. I really can't ask a more precise question unless I understand what is linked above. Can someone explain? Also, I'm using TASM if that makes any difference. Also, I'm testing this on freedos.

UPDATE1:

Alright, thanks to your help, I believe I understand how the interrupt needs to be set up and behaves.

Setup: I have to designate a ds:dx where I want this buffer to exist

I have to set ds:dx to 20 (which sets the max number of characters the buffer can hold)

I have to set ds:dx+1 to 0 (which I think somehow set a min number of characters to read in)

Actually call int21/AH=0ah, which will go to ds:dx and interpret the preset bytes. It will halt the program while it waits for input

int21/AH=0ah will fill from ds:dx+2+n with my input (where n is the number of characters input including '\r')

My question is now, how do I do this. I've just looked through the x86 Assembly Language Reference again, but haven't been able to find anything helpful yet.

Code I've got so far

           assume          cs:code,ds:code
code       segment
start:

           mov  ax,code ;moves code segment into reg AX
           mov  ds,ax   ;makes ds point to code segment

           mov  ah,0ah
           int  21h
           mov  ax,1234h  ;breakpoint

           mov  ah,9
           mov  dx,offset message
           int  21h

endNow:
           ;;;;;;;;;;ends program;;;;;;;;;;
           mov  ah,0  ;terminate program
           int  21h   ;program ends

message    db   'Hello world!!!',13,10,'$'
code       ends
           end  start

Source: (StackOverflow)

PC boot: dl register and drive number

I read somewhere in the internet that, before jumping to 0x7c00, the BIOS loads into %dl the "drive number" of the booted device. But what is this "drive number"? Each device attached to the computer is assigned a number by the BIOS? If so, how can I know which number is a given device assigned to?

Reading GRUB's source code I found when %dl has bits 0x80 and 0x70 set, it overwrites the whole register with 0x80. Why is that? Here is the code:

jmp 3f      /* grub-setup may overwrite this jump */
testb $0x80, %dl
jz 2f
3:
/* Ignore %dl different from 0-0x0f and 0x80-0x8f.  */
testb $0x70, %dl
jz 1f
2:     
movb $0x80, %dl
1:

By the way. Is there any detailed resource on the boot process of PC's in the web? Specially about what the BIOS does before giving the control to the bootloader and also the standard codes used to communicate with it (like that "drive numer"). I was hoping to write my own bootloader and everything I found is a bit too vague, not technical enough to the point of informing of the exact state of the computer when my bootloader starts to run.


Source: (StackOverflow)

BIOS INT 13H with AH=2 can only read 72 sectors each time. Why?

I am using Bochs 2.4.5 to write a boot sector code. I use the INT 13H to read sectors from floppy. But I found that if the sector count to read > 72, the INT13 will fail. And the return code is AH=1. Below's the code and here is the INT13. The return code is AH=1.

Why can't the INT 13H read more than 72 sectors?

   xorb %ah, %ah
   xorb %dl, %dl
   int $0x13      # reset the floppy

   movw $0x8000, %ax
   movw %ax,%es        
   movw $0, %bx  # ES:BX is the buffer  
   movb $0x02, %ah
   movb $73, %al # how many sectors to read. 72 is ok, but >=73 is wrong.
   movb $0, %ch
   movb $1, %cl
   movb $0, %dh
   movb $0, %dl

   int $0x13

Thanks for any help.

Update

Following Matthew Slattery's instruction, I found the corresponding code. I listed it here for others as confused as me. The full code is located here.

7220       if ((drive > 1) || (head > 1) || (sector == 0) ||
7221           (num_sectors == 0) || (num_sectors > 72)) {
7222         BX_INFO("int13_diskette: read/write/verify: parameter out of range\n");
7223         SET_AH(1);
7224         set_diskette_ret_status(1);
7225         SET_AL(0); // no sectors read
7226         SET_CF(); // error occurred
7227         return;
7228       }

Source: (StackOverflow)

Real-Mode x86 ASM: How are the Basics Done?

I'm currently reading the boot.s file in the source for the first ever Linux kernel (assuming that 0.01 is indeed the first public release).

I know C and ASM, the latter considerably less than the former. Even so, I seem to be able to understand and essentially grasp the code in the source files.

This file has me confused though. I now realise that's because it's in real mode, not protected mode. Needless to say, I've never seen ASM code written in real mode before. Protected mode was the defacto mode x86 OSes ran on before I was even born, so it's to be expected.

Here's a routine I want to comprehend better:

/*
 * This procedure turns off the floppy drive motor, so
 * that we enter the kernel in a known state, and
 * don't have to worry about it later.
 */
kill_motor:
    push dx
    mov dx,#0x3f2
    mov al,#0
    outb
    pop dx
    ret

Looking up outb, I find it's used to pass bytes to ports on the computer. I'll hazard a guess based on C documentation that this scenario passes the 'stop motor' byte as the first argument, and as the floppy drive port number as the second.

Is this interface provided by the BIOS? Or by the floppy drive directly? I'm assuming the BIOS has frugal 'drivers' for very basic operation of all the fundamental devices.

Here's where I'm stumped: it seems that numbers like #0x3f2 are being pulled out of thin air. They're clearly hardware port numbers or something. This file is sprinkled with such numbers, with no explanation what they're referring to. Where can I find a comprehensive reference that shows all the hardware ports and control numbers they can receive from real mode? Also, it seems the file moves the kernel around in memory throughout the booting processes, with hard-coded memory addresses. Where can I find a guide for what memory address ranges are available to write over during real mode?

I also read a comment by Linus about reprogramming interrupts to avoid a collision between the BIOS and internal hardware interrupts. I'm not going to lie, that went right over my head.

Help would be great; Google seems sparse on the topic, in case you're wondering.


Source: (StackOverflow)

Changing bios code/flashing the bios

I've spent a lot of time developing an operating system and working on my low level boot loader. But now I want to take some time off my operating system while not leaving the low-level environment and doing something involving security.

So I chose to build my own standard password utility following the pre-boot authentication scheme. Since I want the software to be at least a little portable I want it to use as little external support as is possible. I figured that I'd be best if I somehow managed to 'hook' into the bios somewhere between the self checks and the int 19 bootstrap from within a running real mode OS.

However finding information on how to modify the bios code proved to be impossible. I've found nothing on how to achieve the before mentioned. I have only found pages describing how to flash your bios.

Does anyone know how I can read/write bios code? Or can someone provide links to pages that describe this?

I know that it's not only possible to brick my device but it is also likely, I'm aware of the risk and willing to take it.


Source: (StackOverflow)

Is it possible to call Windows libraries that will live on the hard disk from a program that lives in the BIOS?

I'm trying to write a program that will be a BIOS option (after POST). I'd like the application to have a nice GUI instead of being text based (there are multiple reasons for this, localization being one of them).

My problem is that we are constrained by the size of the application that we can flash to the BIOS.

Is it possible using MASM32 to "Link" to the dll's on the hard disk so that we can use the Windows API's to develop the GUI?

Or is there an API that is availible to us to create the GUI that can be linked into the final executable? (60K size constraint on the final program executable)

Any help you can give would be greatly appreciated, thanks in advance.


Source: (StackOverflow)

How to write BIOS program that connects to the internet?

I am aware that there are programs out there like lojack for laptops that get installed on the BIOS, but I'm still a little confused. When reading about lojack, it seems to me that they can't fully located the laptop's location until the user logs in and tries to access the internet. So I'm thinking that it's a BIOS application so that it wouldn't matter if the thief reformats the HD.

So my question is, does anyone have any ideas of how an internet enables BIOS application would be written. I'm not looking for full answers -- just ideas or resources to get started. For example, is such a thing written in assembly? Once one such app is written, how does it get transfered to the BIOS. Does the BIOS program itself recognize that there is an internet connection (when the thief logs on to the OS). Or upon logon, does additional processes get spawned? Are there any resources/websites that anyone can direct me too?


Source: (StackOverflow)

How does UEFI work?

I was studying about bootloaders when exactly came upon the term UEFI. I can understand some things about UEFI. But still, In what mode(Real,Protected,Long) does a system with UEFI start? If normal boot loaders cant work with UEFI, Then what is the alternate of boot loader while dealing with UEFI? And do I need any other programming to create one, than assembly?


Source: (StackOverflow)