process.hh revision 13063
110810Sbr@bsdpad.com/*
210810Sbr@bsdpad.com * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com>
310810Sbr@bsdpad.com * All rights reserved.
410810Sbr@bsdpad.com *
510810Sbr@bsdpad.com * This software was developed by the University of Cambridge Computer
610810Sbr@bsdpad.com * Laboratory as part of the CTSRD Project, with support from the UK Higher
710810Sbr@bsdpad.com * Education Innovation Fund (HEIF).
810810Sbr@bsdpad.com *
910810Sbr@bsdpad.com * Redistribution and use in source and binary forms, with or without
1010810Sbr@bsdpad.com * modification, are permitted provided that the following conditions are
1110810Sbr@bsdpad.com * met: redistributions of source code must retain the above copyright
1210810Sbr@bsdpad.com * notice, this list of conditions and the following disclaimer;
1310810Sbr@bsdpad.com * redistributions in binary form must reproduce the above copyright
1410810Sbr@bsdpad.com * notice, this list of conditions and the following disclaimer in the
1510810Sbr@bsdpad.com * documentation and/or other materials provided with the distribution;
1610810Sbr@bsdpad.com * neither the name of the copyright holders nor the names of its
1710810Sbr@bsdpad.com * contributors may be used to endorse or promote products derived from
1810810Sbr@bsdpad.com * this software without specific prior written permission.
1910810Sbr@bsdpad.com *
2010810Sbr@bsdpad.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2110810Sbr@bsdpad.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2210810Sbr@bsdpad.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2310810Sbr@bsdpad.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2410810Sbr@bsdpad.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2510810Sbr@bsdpad.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2610810Sbr@bsdpad.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2710810Sbr@bsdpad.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2810810Sbr@bsdpad.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2910810Sbr@bsdpad.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3010810Sbr@bsdpad.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3110810Sbr@bsdpad.com */
3210810Sbr@bsdpad.com
3310810Sbr@bsdpad.com#ifndef __ARCH_ARM_FREEBSD_PROCESS_HH__
3410810Sbr@bsdpad.com#define __ARCH_ARM_FREEBSD_PROCESS_HH__
3510810Sbr@bsdpad.com
3610810Sbr@bsdpad.com#include <vector>
3710810Sbr@bsdpad.com
3810810Sbr@bsdpad.com#include "arch/arm/process.hh"
3910810Sbr@bsdpad.com
4010810Sbr@bsdpad.comclass ArmFreebsdProcessBits
4110810Sbr@bsdpad.com{
4210810Sbr@bsdpad.com  protected:
4310810Sbr@bsdpad.com    SyscallDesc* getFreebsdDesc(int callnum);
4410810Sbr@bsdpad.com
4510810Sbr@bsdpad.com    struct SyscallTable
4610810Sbr@bsdpad.com    {
4710810Sbr@bsdpad.com        int base;
4810810Sbr@bsdpad.com        SyscallDesc *descs;
4910810Sbr@bsdpad.com        int size;
5010810Sbr@bsdpad.com
5110810Sbr@bsdpad.com        SyscallDesc *getDesc(int offset) const;
5210810Sbr@bsdpad.com    };
5310810Sbr@bsdpad.com
5410810Sbr@bsdpad.com    std::vector<SyscallTable> syscallTables;
5510810Sbr@bsdpad.com};
5610810Sbr@bsdpad.com
5710810Sbr@bsdpad.com/// A process with emulated Arm/Freebsd syscalls.
5811851Sbrandon.potter@amd.comclass ArmFreebsdProcess32 : public ArmProcess32, public ArmFreebsdProcessBits
5910810Sbr@bsdpad.com{
6010810Sbr@bsdpad.com  public:
6111851Sbrandon.potter@amd.com    ArmFreebsdProcess32(ProcessParams * params, ObjectFile *objFile,
6211851Sbrandon.potter@amd.com                        ObjectFile::Arch _arch);
6310810Sbr@bsdpad.com
6410810Sbr@bsdpad.com    void initState();
6510810Sbr@bsdpad.com
6610810Sbr@bsdpad.com    /// Explicitly import the otherwise hidden getSyscallArg
6711851Sbrandon.potter@amd.com    using ArmProcess::getSyscallArg;
6810810Sbr@bsdpad.com
6910810Sbr@bsdpad.com    /// A page to hold "kernel" provided functions. The name might be wrong.
7010810Sbr@bsdpad.com    static const Addr commPage;
7110810Sbr@bsdpad.com
7210810Sbr@bsdpad.com    SyscallDesc* getDesc(int callnum);
7310810Sbr@bsdpad.com};
7410810Sbr@bsdpad.com
7510810Sbr@bsdpad.com/// A process with emulated Arm/Freebsd syscalls.
7611851Sbrandon.potter@amd.comclass ArmFreebsdProcess64 : public ArmProcess64, public ArmFreebsdProcessBits
7710810Sbr@bsdpad.com{
7810810Sbr@bsdpad.com  public:
7911851Sbrandon.potter@amd.com    ArmFreebsdProcess64(ProcessParams * params, ObjectFile *objFile,
8011851Sbrandon.potter@amd.com                        ObjectFile::Arch _arch);
8110810Sbr@bsdpad.com
8210810Sbr@bsdpad.com    void initState();
8310810Sbr@bsdpad.com    SyscallDesc* getDesc(int callnum);
8410810Sbr@bsdpad.com};
8510810Sbr@bsdpad.com
8610810Sbr@bsdpad.com#endif // __ARCH_ARM_FREEBSD_PROCESS_HH__
87