Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1.  
  2. #include "common.h"
  3.  
  4. void usleep(u32 delay)
  5. {
  6.   if(!delay) delay++;
  7.   delay*=2000;
  8.  
  9.   asm __volatile__
  10.   (
  11.      "1:\n\t"
  12.       "xorl %%eax, %%eax \n\t"
  13.       "cpuid \n\t"
  14.       "decl %%edi \n\t"
  15.       "jnz 1b"
  16.       :
  17.       :"D"(delay)
  18.       :"eax","ebx","ecx","edx"
  19.   );
  20. }
  21.  
  22. u32 __PciApi(int cmd)
  23. {
  24.   u32 retval;
  25.  
  26.   asm __volatile__
  27.   (
  28.     "call *__imp__PciApi"
  29.     :"=eax" (retval)
  30.     :"a" (cmd)
  31.     :"memory"
  32.   );
  33.   return retval;
  34. };
  35.  
  36. /*
  37. u32 __RegService(char *name, srv_proc_t proc)
  38. {
  39.   u32 retval;
  40.  
  41.   asm __volatile__
  42.   (
  43.     "pushl %%eax \n\t"
  44.     "pushl %%ebx \n\t"
  45.     "call *__imp__RegService \n\t"
  46.     :"=eax" (retval)
  47.     :"a" (proc), "b" (name)
  48.     :"memory"
  49.   );
  50.   return retval;
  51. };
  52. */
  53.  
  54. void *__CreateObject(u32 pid, size_t size)
  55. {
  56.   void *retval;
  57.  
  58.   asm __volatile__
  59.   (
  60.     "call *__imp__CreateObject \n\t"
  61.     :"=eax" (retval)
  62.     :"a" (size),"b"(pid)
  63.     :"esi","edi", "memory"
  64.   );
  65.  
  66.   return retval;
  67. }
  68.  
  69. void *__DestroyObject(void *obj)
  70. {
  71.   asm __volatile__
  72.   (
  73.     "call *__imp__DestroyObject"
  74.     :
  75.     :"a" (obj)
  76.     :"ebx","edx","esi","edi", "memory"
  77.   );
  78. }
  79.