source: trunk/IPs/systemC/hierarchy_memory/sim2os/service/service_read.h @ 81

Last change on this file since 81 was 81, checked in by rosiere, 16 years ago
  • Finish Environment (and test)
  • Continue predictor_unit
  • Add external tools
  • svn keyword "Id" set
  • Property svn:keywords set to Id
File size: 1.3 KB
Line 
1#ifndef SERVICE_READ_H
2#define SERVICE_READ_H
3
4#include "../sim2os.h"
5
6namespace hierarchy_memory {
7  namespace sim2os {
8
9    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[ service_read ]~~~~~
10    void *
11    Sim2os ::
12    service_read ()
13    {
14      if (have_all_arguments(3) == false)
15        {
16          cerr << "<" << NAME << "> Usage : ssize_t read(int fd, void *buf, size_t count);" << endl;
17          return NULL;
18        }
19 
20      int         fd       = (int)          arguments[1];
21      void *      buf      = (void *)       convert_address(arguments[2]);
22      ssize_t     count    = (ssize_t)      arguments[3];
23      void *      result   = (void *)       read(fd,buf,count);
24
25      cout << "\n\t***** service : read          *****"        << endl;
26      cout << "\tfd        : " <<        (unsigned int) fd     << endl;
27      cout << "\tbuf       : " << hex << (unsigned int) buf    << endl;
28      //cout << "\tbuf       : " << dec << (char *)       buf    << endl;
29      cout << "\tcount     : " << dec << (unsigned int) count  << endl;
30      cout << "\tresult    : " <<        (unsigned int) result << endl;
31      cout << "\terrno     : " <<        (unsigned int) error  << endl;
32
33      error                = errno;
34      return      result;
35    }
36
37  };};
38#endif //SERVICE_READ_H
Note: See TracBrowser for help on using the repository browser.