Welcome to mirror list, hosted at ThFree Co, Russian Federation.

trap.c « iq2000 « libgloss - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 217cef233420b7cfa79b5bcb61b900f29560ab78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// Perform a system call.
// Unused parameters should be set to 0.
int __trap0(unsigned long func, unsigned long p1, unsigned long p2, unsigned long p3)
{
  int ret = 0;
  asm volatile ("nop\n\tor %%4,%%0,%0" : : "r"(func));
  asm volatile ("nop\n\tor %%5,%%0,%0" : : "r"(p1));
  asm volatile ("nop\n\tor %%6,%%0,%0" : : "r"(p2));
  asm volatile ("nop\n\tor %%7,%%0,%0" : : "r"(p3));
  asm volatile ("nop\n\tor %%11,%%0,%0" : : "r"(func));
  asm volatile ("syscall\n\tnop\n\tor %0,%%0,%%2" : "=r"(ret));
  return ret;
}