Advertisement
Guest User

Untitled

a guest
Mar 17th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.95 KB | None | 0 0
  1. // 1. Hlavička v LibC
  2. int __PDCLIB_syscall open( int fd );
  3.  
  4. // 2. Wrapper v LibC
  5. int open( int fd ) {
  6.     int ret;
  7.     __dios__syscall( SYS_open, &ret, fd );
  8.     return ret;
  9. }
  10.  
  11. // 3. Hlavička v kernelu
  12. struct VFS {
  13.     int open( ind fd );
  14. }
  15.  
  16. // 4. Implementace v kernelu
  17. int VFS::open( int fd ) {
  18.     // ...
  19.     return 0;
  20. }
  21.  
  22. // 5. Enum syscallů - definice SYS_*
  23.  
  24. // 6. Tabulka reschedule
  25. const bool _SYS_SCHED[ MAX_SYSCALL ] = { ... }
  26.  
  27. // 7. Hlavička konfigračního wrapperu
  28. namespace configuration { namespace myConfig {
  29. void open( void *context, void *ret, void *err, va_list vl );
  30. }
  31.  
  32. // 8. Implementace konfigračního wrapperu
  33. namespace configuration { namespace myConfig {
  34. void open( void *context, void *ret, void *err, va_list vl ) {
  35.     // Unpack and call
  36.     *ret = getVFS(context).open( fd );
  37. }
  38. }
  39.  
  40. // 9. Tabulka syscallů pro konfiguraci
  41. namespace configuration { namespace myConfig {
  42. const _SC_IMPL syscalls[ MAX_SYSCALL ] = { ... }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement