schemix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Schemix-devel] Using AVCALL library to call random functions in the ker


From: Cory Cross
Subject: [Schemix-devel] Using AVCALL library to call random functions in the kernel
Date: Fri, 27 Oct 2006 01:43:03 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20060607 Debian/1.7.12-1.2

Hello everyone (anyone?),
    I stopped working on this a while ago after getting dead-locked on a
foreign-function-interface library but remained interested. I ran across
AVCALL many months ago and finally decided to make it work. I tried
libffi, but it has many userland dependencies.

Progress: Got compilation and primitive function of avcall.
Next steps: Bring in vacall. Make both access any given function in the
kernel. Integrate into Schemix's kernel-lambda. (Of course, I still need
to locate my old Schemix files somewhere...)

My steps:
1. Download attached files and place in separate directory mod-avcall
2. Download ffcall (I used version 1.10) and compile avcall
3. From avcall directory, copy avcall.h and .libs/libavcall.a to mod-avcall
4. Run "make" in mod-avcall
5. I added "V=1" to the Makefile for verbosity. The last thing "make"
does is link cory.o and cory.mod.o to create cory.ko. Copy this command,
then add "libavcall.a" to the end, in effect linking cory.o, cory.mod.o,
and libavcall.a to create a kernel module "cory.ko"

Cory Cross
#include <linux/module.h>
#include <linux/kernel.h>
#include "avcall.h"

static void cory_print( char* text ) {
  printk( KERN_ALERT "%s\n", text );
}

static int __init cory_init(void)
{
        char string[60] = "FFI works!";
        av_alist function_list;

        printk(KERN_ALERT "Hello, world\n");

        av_start_void( function_list, cory_print );
        av_ptr( function_list, char*, string );
        av_call( function_list );


        return 0;
}

static void __exit cory_exit(void)
{
  //    printk(KERN_ALERT "Da symbol:%lu\n",(unsigned long) __get_any_symbol( 
"donuttin" ) );
        printk(KERN_ALERT "Goodbye, world\n");
}

module_init(cory_init);
module_exit(cory_exit);
MODULE_LICENSE("GPL");
#MODULE := cory.ko

OBJS := cory.o libavcall.a

obj-m   := cory.o

#CFLAGS += -E
LDFLAGS = -v

all:
        make -C /lib/modules/$(shell uname -r)/build M=$(PWD) V=1 modules

clean:
        make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

reply via email to

[Prev in Thread] Current Thread [Next in Thread]