Unix has protection againist user calling BIOS INTerrupts?

Unix has protection againist user calling BIOS INTerrupts?

Post by Evin C Robertso » Thu, 07 May 1998 04:00:00



Excerpts from netnews.comp.lang.asm.x86: 6-May-98 Unix has protection

Quote:> Can anyone tell me if it is true that Unix(x86) has protection
> againist user calling BIOS interrupts... I am currently trying to learn
> writting Assembly codes under Linux..(w/ NASM).. but for whatever reason
> I always get "Segmentation fault (core dumped)" after running the
> executable.
> someone told me it was because Unixes has protection againist user calling
> BIOS interrupts..If that's true, does anyone know of a way to go above it?
> I dun want to boot to my MSDOS just to do assembly coding...

Yep.  You can't call the bios from under unix.  It would be a lot of
work to rewrite all of the bios in protected mode for x86 unix.  It
would also be a security risk and it defeats all ideas of portability.

If you want to call bios interrupts from under unix, look at dosemu.

 
 
 

Unix has protection againist user calling BIOS INTerrupts?

Post by Evin C Robertso » Thu, 07 May 1998 04:00:00


Excerpts from netnews.comp.lang.asm.x86: 6-May-98 Unix has protection

Quote:> Can anyone tell me if it is true that Unix(x86) has protection
> againist user calling BIOS interrupts... I am currently trying to learn
> writting Assembly codes under Linux..(w/ NASM).. but for whatever reason
> I always get "Segmentation fault (core dumped)" after running the
> executable.
> someone told me it was because Unixes has protection againist user calling
> BIOS interrupts..If that's true, does anyone know of a way to go above it?
> I dun want to boot to my MSDOS just to do assembly coding...

Yep.  You can't call the bios from under unix.  It would be a lot of
work to rewrite all of the bios in protected mode for x86 unix.  It
would also be a security risk and it defeats all ideas of portability.

If you want to call bios interrupts from under unix, look at dosemu.

 
 
 

Unix has protection againist user calling BIOS INTerrupts?

Post by Herman Dulli » Thu, 07 May 1998 04:00:00


Quote:>     Can anyone tell me if it is true that Unix(x86) has protection
>againist user calling BIOS interrupts...

More or less, YES. BIOS and Unix aren't designed to co-operate.
If you want to use BIOS functions, try a DOS emulator.
If you just want to use assembler, create a similar C program, compile
it with the -s option so an assembler file is created. Use this
generated piece of code to see how assembly looks like on Unix
environments. It basically comes down to calling system and library
functions which are written in C.
For this reason, it's much better to program in C and use in-line
assembly where needed.

Herman

 
 
 

Unix has protection againist user calling BIOS INTerrupts?

Post by Eric J. Korpe » Thu, 07 May 1998 04:00:00




>Hi,
>     Can anyone tell me if it is true that Unix(x86) has protection
>againist user calling BIOS interrupts.

Yes.

Quote:>                 If that's true, does anyone know of a way to go above it?

Learn a lot about writing extensions to the Unix kernel or device drivers.
In a few years you may jest be able to do it.

Quote:>I dun want to boot to my MSDOS just to do assembly coding...

You don't need to.  You just need to use unix system calls or the standard
libraries.

Quote:

>TIA
>PS: here's my code..(maybe it's the problem w/ my code?)

There are many problems with you code...

Quote:>_start:

In unix, the standard startup function is called _main: not _start:

Quote:>  mov ah, 0ah
>  mov dl, 42h
>  mov cx, 1
>  int 10h
>  mov eax, 1
>  int 0x80
>It is suppose to print "A" and the exit

Well, there are a lot of ways to do that depending upon which UNIX you
use...  (Warning: AT&T assembly follows!)

_main:
        leal 20(__iob),%eax   ; need to check stdio.h for the real definition
        pushl %eax            ; of stdout.
        pushl $65
        call _fputc
        add $8,%esp
        xor %eax,%eax
        ret

or

_a:     .ascii "A\0"
_main:  
        pushl $_a
        call _printf
        add $4,%esp
        xor %eax,%eax
        ret

or

_a:     .ascii "A"
_main:  pushl $1
        pushl $_a
        pushl $1
        call _write
        xor %eax,%eax
        ret

Eric
--
Eric Korpela                        |  An object at rest can never be

<a href="http://sag-www.ssl.berkeley.edu/~korpela">Click for home page.</a>

 
 
 

Unix has protection againist user calling BIOS INTerrupts?

Post by Jens Dittm » Fri, 08 May 1998 04:00:00


>>>>> Eric J Korpela writes:


>> Hi, Can anyone tell me if it is true that Unix(x86) has protection
>> againist user calling BIOS interrupts.
> Yes.

 I wouldn't call it 'protection', rather say the BIOS doesn't exist like it
does under DOS, if you define it by the interrupt calling mechanism.

Quote:>> If that's true, does anyone know of a way to go above it?

 Actually there is no need to call for BIOS code since Unix does all the
hardware related handling itself. That's its job. :)

Quote:> Learn a lot about writing extensions to the Unix kernel or device
> drivers.  In a few years you may jest be able to do it.

 Sounds like: 'Write a device driver for BIOS calls' firmwarecall(2),
calling BIOS interrupts on the Intel-PC or running OpenBoot (sp?) functions
on Sun and so on. =:)

SCNR
        Jens
--
Why does the dog* his balls?
Because he can!

 
 
 

Unix has protection againist user calling BIOS INTerrupts?

Post by Steven Bro » Fri, 08 May 1998 04:00:00





>>Hi,
>>         Can anyone tell me if it is true that Unix(x86) has protection
>>againist user calling BIOS interrupts.

>Yes.

>>                 If that's true, does anyone know of a way to go above it?

>Learn a lot about writing extensions to the Unix kernel or device drivers.
>In a few years you may jest be able to do it.

>>I dun want to boot to my MSDOS just to do assembly coding...

>You don't need to.  You just need to use unix system calls or the standard
>libraries.

>>TIA
>>PS: here's my code..(maybe it's the problem w/ my code?)

>There are many problems with you code...

>>_start:

>In unix, the standard startup function is called _main: not _start:

Actually, it's just 'main' on most modern systems.  '_main' is an old a.out
thing you still see on systems that are too lazy to upgrade like FreeBSD.
 
 
 

Unix has protection againist user calling BIOS INTerrupts?

Post by Eric J. Korpe » Fri, 08 May 1998 04:00:00


Oops, forgot to adjust the stack pointer after the write call.



Quote:

>_a:     .ascii "A"
>_main:  pushl $1
>        pushl $_a
>        pushl $1
>        call _write

         addl $12,%esp

Quote:>        xor %eax,%eax
>        ret

--
Eric Korpela                        |  An object at rest can never be

<a href="http://sag-www.ssl.berkeley.edu/~korpela">Click for home page.</a>
 
 
 

1. ? Calling BIOS interrupts from linux user code

Hi all; is there any way to call interrupts from user code
(as opposed to within the kernel)?  (I assume the program
would be run as root, that's no problem.)

A library function called "int()" would be ideal, but I
couldn't find any such thing.

I'm trying to develop code to talk to the power-management
layer in my laptop's BIOS.

ADVthanxANCE,

        -ed falk
--

See http://www.rahul.net/falk/whatToDo.html *#**************F******!******!*!!**
and read 12 Simple Things You Can Do        ********!***************************
to Save the Internet                        #****#******#*********!**WW*W**W

2. I have a question

3. Calling a BIOS interrupt

4. Display not getting set (Intel 810 chipset problem ?)

5. Calling semop() after signal interrupts blocking semop() call

6. Portscan help

7. "Interrupted system call" at "low level" - system calls

8. IP Alias problem

9. Apache: Having "/home/user/ do the same as ~user

10. password protection on the bios only

11. having interrupt conflicts between video card and ethernet card.