Sponsored Content
Full Discussion: Execute code in kernel mode.
Top Forums Programming Execute code in kernel mode. Post 302504480 by lilezek on Monday 14th of March 2011 05:45:25 PM
Old 03-14-2011
I'm forcing that function to print twice as the time that happened but nothing happens. To test, I added print("LOOOLAZO") but it doesn't print Smilie. Here is the code I'm using:

speed hack library:
Code:
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <dlfcn.h>
#include <stdio.h>

static timeval * timezero = 0;

typedef int (*go)(timeval *tv, timezone *tz);

int gettimeofday(timeval *tv, timezone *tz)
{
    // Testing purposes:
    printf("LOOOLAZO");
    go gettimeofday_orig;
    int val;
    gettimeofday_orig=(go)dlsym(RTLD_NEXT,"gettimeofday");
    if (!timezero)
    {
        timezero = new timeval;
        timezone tmp;
        val = gettimeofday_orig(timezero,&tmp);
        (*tv) = (*timezero);
        (*tz) = tmp;
        return val;
    }
    // Double speed:
    timezone tmpz;
    timeval tmpv;
    val = gettimeofday_orig(&tmpv,&tmpz);
    tmpv.tv_sec = 2*tmpv.tv_sec - timezero->tv_sec;
    tmpv.tv_usec = 2*tmpv.tv_usec - timezero->tv_usec;
    while(tmpv.tv_usec >= 1000000)
    {
        tmpv.tv_usec -= 1000000;
        tmpv.tv_sec += 1;
    }
    return val;
}

executable main.cpp:
Code:
#include <stdio.h>
#include <sys/time.h>

using namespace std;

int main(int argc, char ** argv)
{
    struct timezone tmpz;
    timeval tmpv;
    while (true)
    {
        gettimeofday(&tmpv,&tmpz);
        printf("S: %i MS: %i\n",tmpv.tv_sec, tmpv.tv_usec);
    }

    return 0;
}

Line export:

Code:
export LD_PRELOAD="/home/******/proyectos/cheat engine/bin/speedhacklib/speedhack.so"

Output:
Code:
S: 1300139092 MS: 722327
S: 1300139092 MS: 722330
S: 1300139092 MS: 722333
S: 1300139092 MS: 722336
S: 1300139092 MS: 722340
S: 1300139092 MS: 722343
S: 1300139092 MS: 722346
S: 1300139092 MS: 722349
S: 1300139092 MS: 722352
S: 1300139092 MS: 722355
S: 1300139092 MS: 722358
S: 1300139092 MS: 722361
S: 1300139092 MS: 722365

No LOOOLAZO anywhere. Any idea?

Thank you for reading.
 

9 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

k_trap - kernel mode trap type 0x0000000E

HELP is urgently required, I run on SCO Unix 3 and this is the panic message that I get every time that I reboot 10U k_trap - kernel mode trap type 0x0000000E I have checked the swap already having the following results: #swap -l path dev swaplo blocks free... (3 Replies)
Discussion started by: alex_slb
3 Replies

2. SCO

unexpected trap in kernel mode

hi, I am trying to install sco openserver 5.0.4 on an old system. However, l was not able to proceed after putting the bootstr l have this panic message of PANIC: K_trap - kernel mode trap tupe 0x00000006 will someone kindly help to decode this error kayode (1 Reply)
Discussion started by: kayode
1 Replies

3. Linux

Kernel panic - not syncing: cannot execute a PAE-enabled kernel on PAE-less CPU

ok so I just installed fedora core 6 on my dell inspiron 700m and I go to boot into linux and I get this error. Has anyone seen this before? I also had XP Pro and Vista installed on this pc prior to putting fedora core 6 on the machine. I'm trying to setup a triple boot system. Please Help... (2 Replies)
Discussion started by: dave043
2 Replies

4. Programming

Aplication user and kernel mode (data access)

Hi all, I am trying to setup a program to use a device driver and am confusing buffer access between User and Kernel mode. I think all applications running in User space have to communicate with the device drivers using io control calls and then have some functions called back from the driver... (1 Reply)
Discussion started by: Brendan Kennedy
1 Replies

5. UNIX for Dummies Questions & Answers

Kernel Mode

Hi all i have queastion. Can anybody pease help me what is user mode and kernel mode and the term "De-mountable volumes" means? Thanks Palash (2 Replies)
Discussion started by: palash2k
2 Replies

6. SCO

PANIC: k_trap - Kernel mode trap type 0x0000000E

Hi, i'm another question: I'm a directory /usr/data on my server sco unix 5.0.5: # du /usr/data 4386948 /usr/data I'm tried to connect to ftp directory /usr/data to this server and: PANIC: k_trap - Kernel mode trap type 0x0000000E Cannot dump 262040 pages to dumpdev hd(1/41):space... (3 Replies)
Discussion started by: sebpes
3 Replies

7. Programming

which function copies data from user to kernel mode

when transitionaning from user to kernel mode which function copies data from user mode buffer to kernel mode? (5 Replies)
Discussion started by: rupeshkp728
5 Replies

8. Programming

HELP!!: CPU resource allocation between kernel modules and user mode process

Hi,all: I run my program which consists of one kernel module and one user mode process on a dual core server. The problem here is the kernel module consumes 100% of one core while the user mode process only consumes 10% of the other core, is there any solution that I can assign some computing... (1 Reply)
Discussion started by: neyshule
1 Replies

9. UNIX for Advanced & Expert Users

Precaution to access user mode buffers from kernel

When accessing a user mode buffers from kernel space drivers what precautions must we take and how those precautions need to be implemented? (0 Replies)
Discussion started by: rupeshkp728
0 Replies
gettimeofday(2) 						System Calls Manual						   gettimeofday(2)

Name
       gettimeofday, settimeofday - get or set date and time

Syntax
       #include <sys/time.h>

       gettimeofday(tp, tzp)
       struct timeval *tp;
       struct timezone *tzp;

       settimeofday(tp, tzp)
       struct timeval *tp;
       struct timezone *tzp;

Description
       The  system  call returns the system's notion of the current Greenwich time and the current time zone.  Time returned is expressed relative
       in seconds and microseconds since midnight January 1, 1970.

       The structures pointed to by tp and tzp are defined in <sys/time.h> as:

       struct timeval {
	    long tv_sec;	/* seconds since Jan. 1, 1970 */
	    long tv_usec;  /* and microseconds */
       };

       struct timezone {
	    int  tz_minuteswest;     /* of Greenwich */
	    int  tz_dsttime;	/* type of dst correction to apply */
       };

       The timezone structure indicates the local time zone (measured in minutes of time westward from Greenwich), and a flag  that,  if  nonzero,
       indicates that Daylight Saving time applies locally during the appropriate part of the year.

       Only the superuser can set the time of day.

Return Values
       A  0  return  value  indicates  that  the call succeeded.  A -1 return value indicates an error occurred, and in this case an error code is
       stored into the global variable errno.

Diagnostics
       The call fails under the following conditions:

       [EFAULT]       An argument address referenced invalid memory.

       [EPERM]	      A user other than the superuser attempted to set the time.

See Also
       date(1), stime(2), ctime(3)

																   gettimeofday(2)
All times are GMT -4. The time now is 02:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy