home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.os.development      Operating system development chatter      4,255 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 2,398 of 4,255   
   antispam@math.uni.wroc.pl to muta...@gmail.com   
   Re: microsoft vs linux   
   01 Jul 21 12:46:26   
   
   muta...@gmail.com  wrote:   
   > Win32 executables, at least normal ones, do not have   
   > environmental dependencies like particular segment   
   > registers being set to certain values, or certain interrupt   
   > vectors being set to certain values.   
   >   
   > That means that an unprivileged program can set up   
   > the necessary environment to satisfy the Win32   
   > executable.   
   >   
   > Linux programs on the other hand do INT 80H calls,   
   > just as MSDOS programs do INT 21H calls. This   
   > means the calling environment needs sufficient   
   > privilege to set up at least one interrupt vector.   
      
   No.  First, both Linux and Windows programs do system   
   calls.  In Linux system call may be INT 80H (it was   
   in original i386 Linux) but can be done differently.   
   Whatever way system calls are done, in normal   
   operation of system they cause transition of priviledge   
   and setting receiver of system call frequently require   
   priviledge.  No Linux there is unpriviledged mechanizm   
   to intercept system calls.  There was so called "user level   
   Linux kernel", which was version of Linux kernel running   
   in user space, which used interception mechanizm to   
   receive system calls.  This kernel needed privilege   
   (root right) to perform privileged operations on   
   behalf of programs, but interception is availble   
   to ordinary users.  In moderm times this approach   
   is obsoleted by "virtualization extentions" present   
   in modern processors.   
      
   Concerning Windows, my impression was that there was   
   no comparable mechanizem on Windows.  AFAICS main   
   difference was that much of system call interface   
   of Windows was undocumented and many Windows   
   programmers were unaware that it exist at all.   
   OTOH there is a lot of info about Linux systems   
   calls.   
      
   You later wrote that you are interested in C90   
   programs.  "Well behaved" C90 program is supposed   
   to use library functions and to dynamically link   
   to C library, both on Windows and Linux.  On Linux   
   setting environment so that program uses your C   
   library instead of provided one require some effort   
   (there are several details that need to be done)   
   but is entirely unprivileged operation.   
      
   One more thing: on modern systems when program does   
   INT 80H (or say INT 21H) what happens is general   
   protection fault.  So it is enough to set up exactly   
   one interrupt vector, namly the one which handles   
   general protection fault.  But this handler must   
   handle a lot of things, which slows down handling   
   of system calls, so there is tendency to avoid   
   using INT instruction as system call interface.   
   However, if you want to stick to old ways and   
   use INT, that what you really want is that   
   system general protection fault handler recognizes   
   INT instruction and passes control to your program.   
   In Linux for INT 21H this is easy, because INT 21H   
   is treated as illegal instruction and system calls   
   appropriate signal handler in your program (if you   
   do not set up a hander your program would crash).   
   With INT 80H it is a bit more complicated, as   
   normally Linux fault handler would treat it as   
   system call.  But you can use system call interception   
   to handle system calls in your code.   
      
   --   
                                 Waldek Hebisch   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca