How to do a call far (x86) to a given 32-bit address?

If memory is flat, i.e. , CS has a base of 0 and covers entire 32-bit address space.

Up vote 3 down vote favorite share g+ share fb share tw.

Ok, I need to perform a CALL FAR to the PCI BIOS service directory (32 bit mode) to verify that the PCI BIOS is present. NOTE: I am developing a simple disk driver for a simple operating system we are developing a college. I understand that this is very specific, but I will be doing all this from kernel code.

Suppose I already found the relevant address. What is the proper assembly language to perform a far call to a given address? Can someone post some assembly code that does a far call to a given 32-bit address?

The syntax of the examples I have seen so far has been confusing. Thanks! EDIT: In my specific case, I have already found the PCI BIOS service directory, which gives me the physical address (32-bit).

Given this 32-bit address, what type of far call will I need? For example, I was reading in the Intel manuals that far calls can change tasks and what not. How will I know what I have to do to far call this PCI BIOS service directory physical address?

UPDATE: Here is some code I found which is confusing me (inline): asm("lcall (%%edi)" : "=a" (return_code), "=b" (address), "=c" (length), "=d" (entry) : "0" (service), "1" (0), "D" (&bios32_indirect)); I found that in this source file: pell.portland.or.us/~orc/Code/Archive/li... I think what I want to do is the equivalent of the above inline in actual assembly. Assembly x86 link|improve this question edited May 1 '09 at 1:31 asked May 1 '09 at 0:18Mr. Shickadance1,078621 79% accept rate.

It'd help if you posted how they were confusing. Call should just work. – Michael May 1 '09 at 0:32 But doesn't that just perform a near call?

For instance, I thought you had to change the CS register. Off to do more reading... – Mr. Shickadance May 1 '09 at 0:35 You mentioned 32-bit mode which usually implies a flat address space with a descriptor covering the entire 4 GB. Why would you need to change CS then?

– Mihai Limb? An May 1 '09 at 1:01 Do you actually want to do a cross-segment call or just a 32-bit call? Call can jump to any 32-bit address.

– Michael May 1 '09 at 1:06 Mihai - You could do segmentation in 32-bit mode. No one really does. – Michael May 1 '09 at 1:07.

If memory is flat, i.e. , CS has a base of 0 and covers entire 32-bit address space call Where address is the 32-bit target address. EDIT: Ah, I see you have a physical address.

I'm presuming this is for a device driver running on Linux. I don't have any experience with the linux kernel, but I'd presume that this physical address isn't mapped 1:1 to a virtual address. You need to get it mapped to a virtual address (sorry, don't know how in Linux), and then call that virtual address.

But this raises the question of what PCI BIOS function you need, going directly to the BIOS outside of the OS is usually the wrong approach.

Ahh, I should have got into more detail. We are working on a simple operating system developed at college. My task is to develop a simple disk driver.

– Mr. Shickadance May 1 '09 at 1:32.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions