* 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:
parent
b3be7a4135
commit
23f179da55
@ -74,10 +74,10 @@ static int dump_syscall_tracing(int argc, char** argv);
|
||||
#endif
|
||||
|
||||
|
||||
static generic_syscall *
|
||||
find_generic_syscall(const char *subsystem)
|
||||
static generic_syscall*
|
||||
find_generic_syscall(const char* subsystem)
|
||||
{
|
||||
generic_syscall *syscall = NULL;
|
||||
generic_syscall* syscall = NULL;
|
||||
|
||||
ASSERT_LOCKED_MUTEX(&sGenericSyscallLock);
|
||||
|
||||
@ -98,8 +98,8 @@ find_generic_syscall(const char *subsystem)
|
||||
All other return codes are depending on the generic syscall implementation.
|
||||
*/
|
||||
static inline status_t
|
||||
_user_generic_syscall(const char *userSubsystem, uint32 function,
|
||||
void *buffer, size_t bufferSize)
|
||||
_user_generic_syscall(const char* userSubsystem, uint32 function,
|
||||
void* buffer, size_t bufferSize)
|
||||
{
|
||||
char subsystem[B_FILE_NAME_LENGTH];
|
||||
|
||||
@ -138,7 +138,7 @@ _user_generic_syscall(const char *userSubsystem, uint32 function,
|
||||
}
|
||||
|
||||
while (syscall != NULL) {
|
||||
generic_syscall *next;
|
||||
generic_syscall* next;
|
||||
|
||||
syscall->use_count++;
|
||||
locker.Unlock();
|
||||
@ -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;
|
||||
}
|
||||
@ -236,7 +236,7 @@ generic_syscall_init(void)
|
||||
|
||||
|
||||
status_t
|
||||
register_generic_syscall(const char *subsystem, syscall_hook hook,
|
||||
register_generic_syscall(const char* subsystem, syscall_hook hook,
|
||||
uint32 version, uint32 flags)
|
||||
{
|
||||
if (hook == NULL)
|
||||
@ -275,7 +275,7 @@ register_generic_syscall(const char *subsystem, syscall_hook hook,
|
||||
|
||||
|
||||
status_t
|
||||
unregister_generic_syscall(const char *subsystem, uint32 version)
|
||||
unregister_generic_syscall(const char* subsystem, uint32 version)
|
||||
{
|
||||
// TODO: we should only remove the syscall with the matching version
|
||||
|
||||
|
@ -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,18 +209,18 @@ SyscallVector::CreateSyscall(const char* name, const char* kernelName)
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
// Main
|
||||
|
||||
class Main {
|
||||
public:
|
||||
|
||||
int Run(int argc, char **argv)
|
||||
int Run(int argc, char** argv)
|
||||
{
|
||||
// parse arguments
|
||||
const char *syscallsFile = NULL;
|
||||
const char *dispatcherFile = NULL;
|
||||
const char *numbersFile = NULL;
|
||||
const char *tableFile = NULL;
|
||||
const char *straceFile = NULL;
|
||||
const char* syscallsFile = NULL;
|
||||
const char* dispatcherFile = NULL;
|
||||
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") {
|
||||
@ -275,7 +282,7 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
void _WriteSyscallsFile(const char *filename)
|
||||
void _WriteSyscallsFile(const char* filename)
|
||||
{
|
||||
// open the syscalls output file
|
||||
ofstream file(filename, ofstream::out | ofstream::trunc);
|
||||
@ -299,7 +306,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void _WriteDispatcherFile(const char *filename)
|
||||
void _WriteDispatcherFile(const char* filename)
|
||||
{
|
||||
// open the dispatcher output file
|
||||
ofstream file(filename, ofstream::out | ofstream::trunc);
|
||||
@ -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) {
|
||||
@ -344,7 +351,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void _WriteNumbersFile(const char *filename)
|
||||
void _WriteNumbersFile(const char* filename)
|
||||
{
|
||||
// open the syscall numbers output file
|
||||
ofstream file(filename, ofstream::out | ofstream::trunc);
|
||||
@ -352,7 +359,7 @@ public:
|
||||
throw IOException(string("Failed to open `") + filename + "'.");
|
||||
|
||||
// output the defines
|
||||
const char *prefix = "_user_";
|
||||
const char* prefix = "_user_";
|
||||
size_t prefixLen = strlen(prefix);
|
||||
for (int i = 0; i < fSyscallCount; i++) {
|
||||
const Syscall* syscall = fSyscallVector->SyscallAt(i);
|
||||
@ -371,7 +378,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void _WriteTableFile(const char *filename)
|
||||
void _WriteTableFile(const char* filename)
|
||||
{
|
||||
// open the syscall table output file
|
||||
ofstream file(filename, ofstream::out | ofstream::trunc);
|
||||
@ -452,7 +459,7 @@ public:
|
||||
file << "#endif // _ASSEMBLER" << endl;
|
||||
}
|
||||
|
||||
void _WriteSTraceFile(const char *filename)
|
||||
void _WriteSTraceFile(const char* filename)
|
||||
{
|
||||
// open the syscall table output file
|
||||
ofstream file(filename, ofstream::out | ofstream::trunc);
|
||||
@ -522,9 +529,9 @@ public:
|
||||
file << "}" << endl;
|
||||
}
|
||||
|
||||
static string _GetPointerType(const char *type)
|
||||
static string _GetPointerType(const char* type)
|
||||
{
|
||||
const char *parenthesis = strchr(type, ')');
|
||||
const char* parenthesis = strchr(type, ')');
|
||||
if (!parenthesis)
|
||||
return string(type) + "*";
|
||||
// function pointer type
|
||||
@ -605,9 +612,9 @@ private:
|
||||
int fSyscallCount;
|
||||
};
|
||||
|
||||
// main
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
try {
|
||||
return Main().Run(argc, argv);
|
||||
|
Loading…
Reference in New Issue
Block a user