Re: [PATCH] Linux Kernel Markers 0.2 for Linux 2.6.17

From: Mathieu Desnoyers
Date: Wed Sep 20 2006 - 13:19:49 EST


And here is the sample module to use my jump-marker symbols :

(yes, it works!)

Adresses are taken by hand from /proc/kallsyms for now.

---BEGIN---

/* test-mark.c
*
*/

#include <linux/marker.h>
#include <linux/module.h>

static void **__mark_subsys_mark1_call = (void**)0xf887580c;
static void **__mark_subsys_mark1_jump_over = (void**)0xf8875814;
static void **__mark_subsys_mark1_jump_call = (void*)0xf8875810;
static void *__this_mark_empty_function = (void*)0xf8875000;

static void *saved_over;

void do_mark1(const char *format, int value)
{
printk("value is %d\n", value);
}

int init_module(void)
{
*__mark_subsys_mark1_call = (void*)do_mark1;
saved_over = *__mark_subsys_mark1_jump_over;
*__mark_subsys_mark1_jump_over = *__mark_subsys_mark1_jump_call;

return 0;
}

void cleanup_module(void)
{
*__mark_subsys_mark1_jump_over = saved_over;
*__mark_subsys_mark1_call = __this_mark_empty_function;
}

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Mathieu Desnoyers");
MODULE_DESCRIPTION("Marker Test");

---END---




OpenPGP public key: http://krystal.dyndns.org:8080/key/compudj.gpg
Key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68

Attachment: signature.asc
Description: Digital signature