emul_driver.hh (10496:0a5a8ecd0ec6) emul_driver.hh (11624:9796e43e751d)
1/*
2 * Copyright (c) 2014 Advanced Micro Devices, Inc.
3 * All rights reserved
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 32 unchanged lines hidden (view full) ---

41
42/**
43 * EmulatedDriver is an abstract base class for fake SE-mode device drivers.
44 *
45 * Specific drivers that allow applications to communicate with simulated
46 * hardware inside gem5 can be created by deriving from this class and
47 * overriding the abstract virtual methods.
48 *
1/*
2 * Copyright (c) 2014 Advanced Micro Devices, Inc.
3 * All rights reserved
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 32 unchanged lines hidden (view full) ---

41
42/**
43 * EmulatedDriver is an abstract base class for fake SE-mode device drivers.
44 *
45 * Specific drivers that allow applications to communicate with simulated
46 * hardware inside gem5 can be created by deriving from this class and
47 * overriding the abstract virtual methods.
48 *
49 * Currently only open() and ioctl() calls are supported, but other calls
50 * (e.g., read(), write(), mmap()) could be added as needed.
49 * Currently only open(), ioctl(), and mmap() calls are supported, but other
50 * calls (e.g., read(), write()) could be added as needed.
51 */
52class EmulatedDriver : public SimObject
53{
54 protected:
55 /**
56 * filename for opening this driver (under /dev)
57 */
58 const std::string &filename;

--- 21 unchanged lines hidden (view full) ---

80 /**
81 * Abstract method, invoked when the user program calls ioctl() on
82 * the file descriptor returned by a previous open(). The parameters
83 * are the same as those passed in to ioctlFunc() (q.v.).
84 * @return The return code for the ioctl, or the negation of the errno
85 * (see the SyscallReturn class).
86 */
87 virtual int ioctl(LiveProcess *p, ThreadContext *tc, unsigned req) = 0;
51 */
52class EmulatedDriver : public SimObject
53{
54 protected:
55 /**
56 * filename for opening this driver (under /dev)
57 */
58 const std::string &filename;

--- 21 unchanged lines hidden (view full) ---

80 /**
81 * Abstract method, invoked when the user program calls ioctl() on
82 * the file descriptor returned by a previous open(). The parameters
83 * are the same as those passed in to ioctlFunc() (q.v.).
84 * @return The return code for the ioctl, or the negation of the errno
85 * (see the SyscallReturn class).
86 */
87 virtual int ioctl(LiveProcess *p, ThreadContext *tc, unsigned req) = 0;
88
89 /**
90 * Virtual method, invoked when the user program calls mmap() on
91 * the file descriptor returned by a previous open(). The parameters
92 * are the same as those passed in to mmapFunc() (q.v.).
93 * @return The return ptr for the mmap, or the negation of the errno
94 * (see the SyscallReturn class).
95 */
96 virtual Addr mmap(LiveProcess *p, ThreadContext *tc, Addr start,
97 uint64_t length, int prot, int tgtFlags, int tgtFd,
98 int offset) { return -EBADF; }
88};
89
90#endif // __SIM_EMUL_DRIVER_HH
99};
100
101#endif // __SIM_EMUL_DRIVER_HH