Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 09-13-2008, 11:58 PM   #1
LQ Newbie
Registered: Aug 2008
Location: tehran
Posts: 4

Rep: Reputation: 0
bios interrupt in linux assembly

I wrote a program with assembly 8086 and combile in dos, now I want to compile this program that is 32bit in linux that I wrote with assembly languege
How can I convert int 1ah (bios interruptt) to linux form, In fact; I want to detect pci and other hardwares in linux?
I give some changes that I think nesessary for my code when this code want compile in linux for example I convert int 21h to int 80h
now when I compile this code in linux (fedora8) give me this error:
#ld -s -o myfile myfile.o
myfile.o: In function `found`:
myfile.asm.+0x57d2):relocation truncated to fit: R_386_16 against`.`

please tell me my code has what problem
Old 09-14-2008, 04:50 PM   #2
Mr. C.
Senior Member
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 61
Oh, boy, you're in for a surprise.

The Linux kernel handles all interrupts, as these are privileged. You can't just convert a DOS program over to Unix/Linux and expect it to work. Your program won't ever see interrupts.

You're going to need to learn about the difference between user-space programs, and possiblly device drivers (depending upon what you are trying to do).

Your program will also need to conform to the standard C runtime, and be linked with the libc runtime loader libraries.

Unix/Linux is an entirely different world.

Last edited by Mr. C.; 09-14-2008 at 04:53 PM.
Old 09-14-2008, 04:51 PM   #3
Senior Member
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Rep: Reputation: 231Reputation: 231Reputation: 231
I don't know what is wrong with your code but you can't call Bios interupts from user space processes in a protected mode OS. You'll have to look into OS or library calls to return the information you want.

edit: Damn - that's twice Mr.C has beat me to it !!

Last edited by bgeddy; 09-14-2008 at 04:52 PM.
Old 09-14-2008, 04:53 PM   #4
Mr. C.
Senior Member
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 61
Originally Posted by bgeddy View Post
edit: Damn - that's twice Mr.C has beat me to it !!
Oops, I'll go get something to eat... brb. :-)
Old 09-14-2008, 10:41 PM   #5
LQ Guru
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

Like bgeddy and Mr. C said, you cannot invoke BIOS interrupts directly from a user-mode program. This is equally true for DOS as for Linux (and Solaris, BSD and any other contemporary, protected mode operating system).

"But I can call BIOS interrupts from a DOS prompt on Windows", you might reply. That's because a Windows DOS prompt *emulates* an entire DOS environment (within protected-mode Windows).

You can do the same thing in Linux, if you wish to. Here is one (of many) alternatives:

'Hope that helps .. PSM


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
control is not going to interrupt handler when interrupt comes in serial driver sateeshalla Linux - Kernel 1 05-04-2006 09:43 AM
Assembly on Linux asahlot Programming 2 11-12-2005 01:04 AM
How To Free Interrupt Line In Bios manz Linux - Hardware 2 03-10-2005 02:50 AM
Linux assembly Creep Programming 9 01-29-2004 04:40 AM
BIOS Interrupt wwnn1 Programming 8 05-23-2002 06:00 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:14 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration