* 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
syscall_dispatcher(uint32 call_num, void *args, uint64 *call_ret)
syscall_dispatcher(uint32 callIndex, void* args, uint64* _returnValue)
{
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",
// 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();
switch (call_num) {
switch (callIndex) {
// the cases are auto-generated
#include "syscall_dispatcher.h"
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;
}
+36 -29
View File
@@ -3,10 +3,13 @@
* Distributed under the terms of the MIT License.
*/
// Don't include arch_gensyscalls.h. It's only needed when creating the
// syscall vector.
#define DONT_INCLUDE_ARCH_GENSYSCALLS_H 1
#include "gensyscalls.h"
#include <cstdio>
#include <cstdlib>
#include <fstream>
@@ -14,7 +17,6 @@
#include <string.h>
#include <vector>
#include "gensyscalls.h"
#include "gensyscalls_common.h"
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,
const char* alignmentTypeName)
: fName(name),
:
fName(name),
fSize(size),
fUsedSize(usedSize),
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,
int size, int usedSize, int offset, const char* alignmentTypeName)
: Type(typeName, size, usedSize, alignmentTypeName),
:
Type(typeName, size, usedSize, alignmentTypeName),
fParameterName(parameterName),
fOffset(offset)
{
}
// Syscall
// #pragma mark - Syscall
// ParameterVector
struct Syscall::ParameterVector : public vector<Parameter*> {
};
// constructor
Syscall::Syscall(const char* name, const char* kernelName)
: fName(name),
:
fName(name),
fKernelName(kernelName),
fReturnType(NULL),
fParameters(new ParameterVector)
{
}
// destructor
Syscall::~Syscall()
{
delete fReturnType;
@@ -100,14 +105,14 @@ Syscall::~Syscall()
delete fParameters;
}
// ParameterAt
int
Syscall::CountParameters() const
{
return fParameters->size();
}
// ParameterAt
Parameter*
Syscall::ParameterAt(int index) const
{
@@ -117,14 +122,14 @@ Syscall::ParameterAt(int index) const
return (*fParameters)[index];
}
// LastParameter
Parameter*
Syscall::LastParameter() const
{
return ParameterAt(CountParameters() - 1);
}
// SetReturnType
Type*
Syscall::SetReturnType(const char* name, int size, int usedSize,
const char* alignmentTypeName)
@@ -133,7 +138,7 @@ Syscall::SetReturnType(const char* name, int size, int usedSize,
return fReturnType = new Type(name, size, usedSize, alignmentTypeName);
}
// AddParameter
Parameter*
Syscall::AddParameter(const char* typeName, const char* parameterName,
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*> {
};
// constructor
SyscallVector::SyscallVector()
: fSyscalls(new _SyscallVector)
:
fSyscalls(new _SyscallVector)
{
}
// destructor
SyscallVector::~SyscallVector()
{
int count = CountSyscalls();
@@ -166,21 +173,21 @@ SyscallVector::~SyscallVector()
delete fSyscalls;
}
// Create
SyscallVector*
SyscallVector::Create()
{
return new SyscallVector;
}
// CountSyscalls
int
SyscallVector::CountSyscalls() const
{
return fSyscalls->size();
}
// SyscallAt
Syscall*
SyscallVector::SyscallAt(int index) const
{
@@ -190,7 +197,7 @@ SyscallVector::SyscallAt(int index) const
return (*fSyscalls)[index];
}
// CreateSyscall
Syscall*
SyscallVector::CreateSyscall(const char* name, const char* kernelName)
{
@@ -202,10 +209,9 @@ SyscallVector::CreateSyscall(const char* name, const char* kernelName)
// #pragma mark -
// Main
class Main {
public:
int Run(int argc, char** argv)
{
// parse arguments
@@ -214,6 +220,7 @@ public:
const char* numbersFile = NULL;
const char* tableFile = NULL;
const char* straceFile = NULL;
for (int argi = 1; argi < argc; argi++) {
string arg(argv[argi]);
if (arg == "-h" || arg == "--help") {
@@ -312,7 +319,7 @@ public:
file << "case " << i << ":" << endl;
file << "\t";
if (string(syscall->ReturnType()->TypeName()) != "void")
file << "*call_ret = ";
file << "*_returnValue = ";
file << syscall->KernelName() << "(";
int paramCount = syscall->CountParameters();
if (paramCount > 0) {
@@ -605,7 +612,7 @@ private:
int fSyscallCount;
};
// main
int
main(int argc, char** argv)
{