C inline ASM IN/OUT operation

C inline ASM IN/OUT operation

Post by Shiuh Deh Lie » Fri, 19 Feb 1999 04:00:00


Enclosed is a sample program for setting the DTR of serial port one.  I
compiled it without errors with "gcc file.c -O2 -m386 -Wall"; however, it
causes "Segmentation fault" when run. It seems that the problem is at the
OUT operation, as it runs without producing "Segmentation fault" when OUT
is taken out.

Your help would be greatly appreciated.


void main()

   __asm__ __volatile__ ("mov  $0x3F8, %ax
                          push %ax        
                          push $1          
                          push %ax        
                          call ioperm      
                          add  $0xC, %sp  
                          mov  $0x3F8, %dx
                          mov  $1, %al    
                          out  %al,%dx");



1. More page outs than page ins?


Would anyone be kind enough to explain to me why systems usually have
more page-outs than page-ins? It has got me stumped for quite some
time. I would think that if 100mb is paged out from memory to disk,
then similarly 100mb should be paged-in back from disk to physical

Or is my understand of paging-in and paging-out wrong? i.e Page-outs
occur when a page is pushed from main memory to the paging space due
to a variety of reasons (lack of physical memory being one of them)
while page-ins' occur when there is free physical memory and these
pages are pushed back from disk back to the physical memory.


2. Building a Shared Library

3. Unix Libraries Ins/Outs

4. wrecked my rh6 boot up

5. inline asm errors when compiling linux-1.2.13 with gcc-2.7.1

6. Grrr...

7. inline asm

8. Change Max file's size to 4G bytes

9. gcc inline asm - short question

10. PIII-instruction SHUFPS with gcc-inline-asm

11. Linux-1.0-inline-asm uploaded

12. Inline asm on Ultrasparc: FP register pairs?

13. help with inline asm()