process.cc (11794:97eebddaae84) process.cc (11851:824055fe6b30)
1/*
2 * Copyright (c) 2010-2013, 2015 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

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

56#include "sim/syscall_emul.hh"
57#include "sim/system.hh"
58
59using namespace std;
60using namespace ArmISA;
61
62/// Target uname() handler.
63static SyscallReturn
1/*
2 * Copyright (c) 2010-2013, 2015 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

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

56#include "sim/syscall_emul.hh"
57#include "sim/system.hh"
58
59using namespace std;
60using namespace ArmISA;
61
62/// Target uname() handler.
63static SyscallReturn
64unameFunc32(SyscallDesc *desc, int callnum, LiveProcess *process,
64unameFunc32(SyscallDesc *desc, int callnum, Process *process,
65 ThreadContext *tc)
66{
67 int index = 0;
68 TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, index));
69
70 strcpy(name->sysname, "Linux");
71 strcpy(name->nodename, "m5.eecs.umich.edu");
72 strcpy(name->release, "3.0.0");
73 strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
74 strcpy(name->machine, "armv7l");
75
76 name.copyOut(tc->getMemProxy());
77 return 0;
78}
79
80/// Target uname() handler.
81static SyscallReturn
65 ThreadContext *tc)
66{
67 int index = 0;
68 TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, index));
69
70 strcpy(name->sysname, "Linux");
71 strcpy(name->nodename, "m5.eecs.umich.edu");
72 strcpy(name->release, "3.0.0");
73 strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
74 strcpy(name->machine, "armv7l");
75
76 name.copyOut(tc->getMemProxy());
77 return 0;
78}
79
80/// Target uname() handler.
81static SyscallReturn
82unameFunc64(SyscallDesc *desc, int callnum, LiveProcess *process,
82unameFunc64(SyscallDesc *desc, int callnum, Process *process,
83 ThreadContext *tc)
84{
85 int index = 0;
86 TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, index));
87
88 strcpy(name->sysname, "Linux");
89 strcpy(name->nodename, "gem5");
90 strcpy(name->release, "3.7.0+");
91 strcpy(name->version, "#1 SMP Sat Dec 1 00:00:00 GMT 2012");
92 strcpy(name->machine, "armv8l");
93
94 name.copyOut(tc->getMemProxy());
95 return 0;
96}
97
98/// Target set_tls() handler.
99static SyscallReturn
83 ThreadContext *tc)
84{
85 int index = 0;
86 TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, index));
87
88 strcpy(name->sysname, "Linux");
89 strcpy(name->nodename, "gem5");
90 strcpy(name->release, "3.7.0+");
91 strcpy(name->version, "#1 SMP Sat Dec 1 00:00:00 GMT 2012");
92 strcpy(name->machine, "armv8l");
93
94 name.copyOut(tc->getMemProxy());
95 return 0;
96}
97
98/// Target set_tls() handler.
99static SyscallReturn
100setTLSFunc32(SyscallDesc *desc, int callnum, LiveProcess *process,
100setTLSFunc32(SyscallDesc *desc, int callnum, Process *process,
101 ThreadContext *tc)
102{
103 int index = 0;
104 uint32_t tlsPtr = process->getSyscallArg(tc, index);
105
106 tc->getMemProxy().writeBlob(ArmLinuxProcess32::commPage + 0x0ff0,
107 (uint8_t *)&tlsPtr, sizeof(tlsPtr));
108 tc->setMiscReg(MISCREG_TPIDRURO,tlsPtr);
109 return 0;
110}
111
112static SyscallReturn
101 ThreadContext *tc)
102{
103 int index = 0;
104 uint32_t tlsPtr = process->getSyscallArg(tc, index);
105
106 tc->getMemProxy().writeBlob(ArmLinuxProcess32::commPage + 0x0ff0,
107 (uint8_t *)&tlsPtr, sizeof(tlsPtr));
108 tc->setMiscReg(MISCREG_TPIDRURO,tlsPtr);
109 return 0;
110}
111
112static SyscallReturn
113setTLSFunc64(SyscallDesc *desc, int callnum, LiveProcess *process,
113setTLSFunc64(SyscallDesc *desc, int callnum, Process *process,
114 ThreadContext *tc)
115{
116 int index = 0;
117 uint32_t tlsPtr = process->getSyscallArg(tc, index);
118
119 tc->setMiscReg(MISCREG_TPIDRRO_EL0, tlsPtr);
120 return 0;
121}

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

1584static SyscallDesc privSyscallDescs64[] = {
1585 /* 1 */ SyscallDesc("unallocated", unimplementedFunc),
1586 /* 2 */ SyscallDesc("cacheflush", unimplementedFunc),
1587 /* 3 */ SyscallDesc("unallocated", unimplementedFunc),
1588 /* 4 */ SyscallDesc("unallocated", unimplementedFunc),
1589 /* 5 */ SyscallDesc("set_tls", setTLSFunc64)
1590};
1591
114 ThreadContext *tc)
115{
116 int index = 0;
117 uint32_t tlsPtr = process->getSyscallArg(tc, index);
118
119 tc->setMiscReg(MISCREG_TPIDRRO_EL0, tlsPtr);
120 return 0;
121}

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

1584static SyscallDesc privSyscallDescs64[] = {
1585 /* 1 */ SyscallDesc("unallocated", unimplementedFunc),
1586 /* 2 */ SyscallDesc("cacheflush", unimplementedFunc),
1587 /* 3 */ SyscallDesc("unallocated", unimplementedFunc),
1588 /* 4 */ SyscallDesc("unallocated", unimplementedFunc),
1589 /* 5 */ SyscallDesc("set_tls", setTLSFunc64)
1590};
1591
1592ArmLinuxProcess32::ArmLinuxProcess32(LiveProcessParams * params,
1592ArmLinuxProcess32::ArmLinuxProcess32(ProcessParams * params,
1593 ObjectFile *objFile, ObjectFile::Arch _arch)
1593 ObjectFile *objFile, ObjectFile::Arch _arch)
1594 : ArmLiveProcess32(params, objFile, _arch)
1594 : ArmProcess32(params, objFile, _arch)
1595{
1596 SyscallTable table;
1597
1598 table.descs = syscallDescs32;
1599 table.size = sizeof(syscallDescs32) / sizeof(SyscallDesc);
1600 table.base = 0;
1601 syscallTables.push_back(table);
1602 table.base = 0x900000;
1603 syscallTables.push_back(table);
1604
1605 table.descs = privSyscallDescs32;
1606 table.size = sizeof(privSyscallDescs32) / sizeof(SyscallDesc);
1607 table.base = 0xf0001;
1608 syscallTables.push_back(table);
1609}
1610
1595{
1596 SyscallTable table;
1597
1598 table.descs = syscallDescs32;
1599 table.size = sizeof(syscallDescs32) / sizeof(SyscallDesc);
1600 table.base = 0;
1601 syscallTables.push_back(table);
1602 table.base = 0x900000;
1603 syscallTables.push_back(table);
1604
1605 table.descs = privSyscallDescs32;
1606 table.size = sizeof(privSyscallDescs32) / sizeof(SyscallDesc);
1607 table.base = 0xf0001;
1608 syscallTables.push_back(table);
1609}
1610
1611ArmLinuxProcess64::ArmLinuxProcess64(LiveProcessParams * params,
1611ArmLinuxProcess64::ArmLinuxProcess64(ProcessParams * params,
1612 ObjectFile *objFile, ObjectFile::Arch _arch)
1612 ObjectFile *objFile, ObjectFile::Arch _arch)
1613 : ArmLiveProcess64(params, objFile, _arch)
1613 : ArmProcess64(params, objFile, _arch)
1614{
1615 SyscallTable table;
1616
1617 table.descs = syscallDescs64;
1618 table.size = sizeof(syscallDescs64) / sizeof(SyscallDesc);
1619 table.base = 0;
1620 syscallTables.push_back(table);
1621 table.base = 0x900000;

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

1662ArmLinuxProcess64::getDesc(int callnum)
1663{
1664 return getLinuxDesc(callnum);
1665}
1666
1667void
1668ArmLinuxProcess32::initState()
1669{
1614{
1615 SyscallTable table;
1616
1617 table.descs = syscallDescs64;
1618 table.size = sizeof(syscallDescs64) / sizeof(SyscallDesc);
1619 table.base = 0;
1620 syscallTables.push_back(table);
1621 table.base = 0x900000;

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

1662ArmLinuxProcess64::getDesc(int callnum)
1663{
1664 return getLinuxDesc(callnum);
1665}
1666
1667void
1668ArmLinuxProcess32::initState()
1669{
1670 ArmLiveProcess32::initState();
1670 ArmProcess32::initState();
1671 allocateMem(commPage, PageBytes);
1672 ThreadContext *tc = system->getThreadContext(contextIds[0]);
1673
1674 uint8_t swiNeg1[] = {
1675 0xff, 0xff, 0xff, 0xef // swi -1
1676 };
1677
1678 // Fill this page with swi -1 so we'll no if we land in it somewhere.

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

1709 0x0e, 0xf0, 0xa0, 0xe1 // return
1710 };
1711 tc->getMemProxy().writeBlob(commPage + 0x0fe0, get_tls, sizeof(get_tls));
1712}
1713
1714void
1715ArmLinuxProcess64::initState()
1716{
1671 allocateMem(commPage, PageBytes);
1672 ThreadContext *tc = system->getThreadContext(contextIds[0]);
1673
1674 uint8_t swiNeg1[] = {
1675 0xff, 0xff, 0xff, 0xef // swi -1
1676 };
1677
1678 // Fill this page with swi -1 so we'll no if we land in it somewhere.

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

1709 0x0e, 0xf0, 0xa0, 0xe1 // return
1710 };
1711 tc->getMemProxy().writeBlob(commPage + 0x0fe0, get_tls, sizeof(get_tls));
1712}
1713
1714void
1715ArmLinuxProcess64::initState()
1716{
1717 ArmLiveProcess64::initState();
1717 ArmProcess64::initState();
1718 // The 64 bit equivalent of the comm page would be set up here.
1719}
1718 // The 64 bit equivalent of the comm page would be set up here.
1719}