* Cleanup, no functional change.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34237 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2009-11-25 11:48:39 +00:00
parent b3be7a4135
commit 23f179da55
2 changed files with 73 additions and 66 deletions
+6 -6
View File
@@ -185,28 +185,28 @@ _user_restore_signal_frame()
int32 int32
syscall_dispatcher(uint32 call_num, void *args, uint64 *call_ret) syscall_dispatcher(uint32 callIndex, void* args, uint64* _returnValue)
{ {
bigtime_t startTime; bigtime_t startTime;
// dprintf("syscall_dispatcher: thread 0x%x call 0x%x, arg0 0x%x, arg1 0x%x arg2 0x%x arg3 0x%x arg4 0x%x\n", // dprintf("syscall_dispatcher: thread 0x%x call 0x%x, arg0 0x%x, arg1 0x%x arg2 0x%x arg3 0x%x arg4 0x%x\n",
// thread_get_current_thread_id(), call_num, arg0, arg1, arg2, arg3, arg4); // thread_get_current_thread_id(), call_num, arg0, arg1, arg2, arg3, arg4);
user_debug_pre_syscall(call_num, args); user_debug_pre_syscall(callIndex, args);
startTime = system_time(); startTime = system_time();
switch (call_num) { switch (callIndex) {
// the cases are auto-generated // the cases are auto-generated
#include "syscall_dispatcher.h" #include "syscall_dispatcher.h"
default: default:
*call_ret = (uint64)B_BAD_VALUE; *_returnValue = (uint64)B_BAD_VALUE;
} }
user_debug_post_syscall(call_num, args, *call_ret, startTime); user_debug_post_syscall(callIndex, args, *_returnValue, startTime);
// dprintf("syscall_dispatcher: done with syscall 0x%x\n", call_num); // dprintf("syscall_dispatcher: done with syscall 0x%x\n", callIndex);
return B_HANDLED_INTERRUPT; return B_HANDLED_INTERRUPT;
} }
+36 -29
View File
@@ -3,10 +3,13 @@
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
// Don't include arch_gensyscalls.h. It's only needed when creating the // Don't include arch_gensyscalls.h. It's only needed when creating the
// syscall vector. // syscall vector.
#define DONT_INCLUDE_ARCH_GENSYSCALLS_H 1 #define DONT_INCLUDE_ARCH_GENSYSCALLS_H 1
#include "gensyscalls.h"
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
#include <fstream> #include <fstream>
@@ -14,7 +17,6 @@
#include <string.h> #include <string.h>
#include <vector> #include <vector>
#include "gensyscalls.h"
#include "gensyscalls_common.h" #include "gensyscalls_common.h"
using std::vector; using std::vector;
@@ -49,12 +51,13 @@ print_usage(bool error)
} }
// Type // #pragma mark - Type
// constructor
Type::Type(const char* name, int size, int usedSize, Type::Type(const char* name, int size, int usedSize,
const char* alignmentTypeName) const char* alignmentTypeName)
: fName(name), :
fName(name),
fSize(size), fSize(size),
fUsedSize(usedSize), fUsedSize(usedSize),
fAlignmentType(alignmentTypeName) fAlignmentType(alignmentTypeName)
@@ -62,34 +65,36 @@ Type::Type(const char* name, int size, int usedSize,
} }
// Parameter // #pragma mark - Parameter
// constructor
Parameter::Parameter(const char* typeName, const char* parameterName, Parameter::Parameter(const char* typeName, const char* parameterName,
int size, int usedSize, int offset, const char* alignmentTypeName) int size, int usedSize, int offset, const char* alignmentTypeName)
: Type(typeName, size, usedSize, alignmentTypeName), :
Type(typeName, size, usedSize, alignmentTypeName),
fParameterName(parameterName), fParameterName(parameterName),
fOffset(offset) fOffset(offset)
{ {
} }
// Syscall // #pragma mark - Syscall
// ParameterVector
struct Syscall::ParameterVector : public vector<Parameter*> { struct Syscall::ParameterVector : public vector<Parameter*> {
}; };
// constructor
Syscall::Syscall(const char* name, const char* kernelName) Syscall::Syscall(const char* name, const char* kernelName)
: fName(name), :
fName(name),
fKernelName(kernelName), fKernelName(kernelName),
fReturnType(NULL), fReturnType(NULL),
fParameters(new ParameterVector) fParameters(new ParameterVector)
{ {
} }
// destructor
Syscall::~Syscall() Syscall::~Syscall()
{ {
delete fReturnType; delete fReturnType;
@@ -100,14 +105,14 @@ Syscall::~Syscall()
delete fParameters; delete fParameters;
} }
// ParameterAt
int int
Syscall::CountParameters() const Syscall::CountParameters() const
{ {
return fParameters->size(); return fParameters->size();
} }
// ParameterAt
Parameter* Parameter*
Syscall::ParameterAt(int index) const Syscall::ParameterAt(int index) const
{ {
@@ -117,14 +122,14 @@ Syscall::ParameterAt(int index) const
return (*fParameters)[index]; return (*fParameters)[index];
} }
// LastParameter
Parameter* Parameter*
Syscall::LastParameter() const Syscall::LastParameter() const
{ {
return ParameterAt(CountParameters() - 1); return ParameterAt(CountParameters() - 1);
} }
// SetReturnType
Type* Type*
Syscall::SetReturnType(const char* name, int size, int usedSize, Syscall::SetReturnType(const char* name, int size, int usedSize,
const char* alignmentTypeName) const char* alignmentTypeName)
@@ -133,7 +138,7 @@ Syscall::SetReturnType(const char* name, int size, int usedSize,
return fReturnType = new Type(name, size, usedSize, alignmentTypeName); return fReturnType = new Type(name, size, usedSize, alignmentTypeName);
} }
// AddParameter
Parameter* Parameter*
Syscall::AddParameter(const char* typeName, const char* parameterName, Syscall::AddParameter(const char* typeName, const char* parameterName,
int size, int usedSize, int offset, const char* alignmentTypeName) int size, int usedSize, int offset, const char* alignmentTypeName)
@@ -145,19 +150,21 @@ Syscall::AddParameter(const char* typeName, const char* parameterName,
} }
// SyscallVector // #pragma mark - SyscallVector
struct SyscallVector::_SyscallVector : public vector<Syscall*> { struct SyscallVector::_SyscallVector : public vector<Syscall*> {
}; };
// constructor
SyscallVector::SyscallVector() SyscallVector::SyscallVector()
: fSyscalls(new _SyscallVector) :
fSyscalls(new _SyscallVector)
{ {
} }
// destructor
SyscallVector::~SyscallVector() SyscallVector::~SyscallVector()
{ {
int count = CountSyscalls(); int count = CountSyscalls();
@@ -166,21 +173,21 @@ SyscallVector::~SyscallVector()
delete fSyscalls; delete fSyscalls;
} }
// Create
SyscallVector* SyscallVector*
SyscallVector::Create() SyscallVector::Create()
{ {
return new SyscallVector; return new SyscallVector;
} }
// CountSyscalls
int int
SyscallVector::CountSyscalls() const SyscallVector::CountSyscalls() const
{ {
return fSyscalls->size(); return fSyscalls->size();
} }
// SyscallAt
Syscall* Syscall*
SyscallVector::SyscallAt(int index) const SyscallVector::SyscallAt(int index) const
{ {
@@ -190,7 +197,7 @@ SyscallVector::SyscallAt(int index) const
return (*fSyscalls)[index]; return (*fSyscalls)[index];
} }
// CreateSyscall
Syscall* Syscall*
SyscallVector::CreateSyscall(const char* name, const char* kernelName) SyscallVector::CreateSyscall(const char* name, const char* kernelName)
{ {
@@ -202,10 +209,9 @@ SyscallVector::CreateSyscall(const char* name, const char* kernelName)
// #pragma mark - // #pragma mark -
// Main
class Main { class Main {
public: public:
int Run(int argc, char** argv) int Run(int argc, char** argv)
{ {
// parse arguments // parse arguments
@@ -214,6 +220,7 @@ public:
const char* numbersFile = NULL; const char* numbersFile = NULL;
const char* tableFile = NULL; const char* tableFile = NULL;
const char* straceFile = NULL; const char* straceFile = NULL;
for (int argi = 1; argi < argc; argi++) { for (int argi = 1; argi < argc; argi++) {
string arg(argv[argi]); string arg(argv[argi]);
if (arg == "-h" || arg == "--help") { if (arg == "-h" || arg == "--help") {
@@ -312,7 +319,7 @@ public:
file << "case " << i << ":" << endl; file << "case " << i << ":" << endl;
file << "\t"; file << "\t";
if (string(syscall->ReturnType()->TypeName()) != "void") if (string(syscall->ReturnType()->TypeName()) != "void")
file << "*call_ret = "; file << "*_returnValue = ";
file << syscall->KernelName() << "("; file << syscall->KernelName() << "(";
int paramCount = syscall->CountParameters(); int paramCount = syscall->CountParameters();
if (paramCount > 0) { if (paramCount > 0) {
@@ -605,7 +612,7 @@ private:
int fSyscallCount; int fSyscallCount;
}; };
// main
int int
main(int argc, char** argv) main(int argc, char** argv)
{ {