emul_driver.hh (11624:9796e43e751d) | emul_driver.hh (11851:824055fe6b30) |
---|---|
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; --- 22 unchanged lines hidden (view full) --- 31#ifndef __SIM_EMUL_DRIVER_HH 32#define __SIM_EMUL_DRIVER_HH 33 34#include <string> 35 36#include "params/EmulatedDriver.hh" 37#include "sim/sim_object.hh" 38 | 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; --- 22 unchanged lines hidden (view full) --- 31#ifndef __SIM_EMUL_DRIVER_HH 32#define __SIM_EMUL_DRIVER_HH 33 34#include <string> 35 36#include "params/EmulatedDriver.hh" 37#include "sim/sim_object.hh" 38 |
39class LiveProcess; | 39class Process; |
40class ThreadContext; 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. --- 21 unchanged lines hidden (view full) --- 69 bool match(const std::string &s) const { return (s == filename); } 70 71 /** 72 * Abstract method, invoked when the user program calls open() on 73 * the device driver. The parameters are the same as those passed 74 * to openFunc() (q.v.). 75 * @return A newly allocated target fd, or -1 on error. 76 */ | 40class ThreadContext; 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. --- 21 unchanged lines hidden (view full) --- 69 bool match(const std::string &s) const { return (s == filename); } 70 71 /** 72 * Abstract method, invoked when the user program calls open() on 73 * the device driver. The parameters are the same as those passed 74 * to openFunc() (q.v.). 75 * @return A newly allocated target fd, or -1 on error. 76 */ |
77 virtual int open(LiveProcess *p, ThreadContext *tc, | 77 virtual int open(Process *p, ThreadContext *tc, |
78 int mode, int flags) = 0; 79 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 */ | 78 int mode, int flags) = 0; 79 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; | 87 virtual int ioctl(Process *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 */ | 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, | 96 virtual Addr mmap(Process *p, ThreadContext *tc, Addr start, |
97 uint64_t length, int prot, int tgtFlags, int tgtFd, 98 int offset) { return -EBADF; } 99}; 100 101#endif // __SIM_EMUL_DRIVER_HH | 97 uint64_t length, int prot, int tgtFlags, int tgtFd, 98 int offset) { return -EBADF; } 99}; 100 101#endif // __SIM_EMUL_DRIVER_HH |