lkml.org 
[lkml]   [1999]   [Jun]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject"Interceptors" patch: I need help in porting.
Date
Hi,
I am now testing an "Interceptors" patch - i386 processor only :-(.
It provides the two functions:

enum handler_type
{ HT_CHRDEV, HT_BLKDEV, HT_BLK_REQUEST, HT_SYSCALL, HT_FS,
... };

prev = register_interceptor( handler, type );
unregister_interceptor( handler, type );

i.e., provides _SAFE_ way to intercept device requests,
syscalls, etc.

goals:
- simple STREAMS replacement (with almost ZERO
perfomance fee)
- compressed, encrypted, ... drives, antivirus modules,
etc.
- many existing external patches may now be distributed
as modules.

state:
character device interceptors - testing
block device interceptors - almost ready
syscall interceptors - in progress
FS and other possible types - stalled

I have some problems with portability:

1)
Can anybody please help me to port the following code to non-i386
processors:
/* include/asm-i386/snap.h */

#define SNAPPED_JMP_2P/* "jmp to double pointer" */ \
0xB8, 0, 0, 0, 0, /* mov eax, ... */ \
0xFF, 0x20 /* jmp [eax] */
#define SNAPPED_JMP_2P_SIZE 7
#define SNAPPED_JMP_2P_OPERAND 1

/* create "goto *pfunc" instruction in the buffer "dest" */
static void create_redir( char *dest, func_t **func )
{
static char redir0[] = { SNAPPED_REDIR };
memcpy( dest, redir0, SNAPPED_REDIR_SIZE );
*((func_t***) (dest + SNAPPED_REDIR_OPERAND)) = func;
}

2)
Is the following code portable for Linux kernel?
/* macros for scanning struct file_operation */
#define count_of_pointers(struc) sizeof(struc)/sizeof(func_t*)
#define get_fop(fops,i) ((func_t**)fops)[i]


Thank you.




Best regards.
Alexander.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:52    [W:0.024 / U:0.588 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site