Hi Alan,

Can you get into kmdb, or take a dump?

max

alan zhang wrote:
Hi,

I'm experiencing a problem that I'm trying to intercept the time series 
function. I was interested when I noticed that open solaris is using a special 
fasttrap for fastening time retrieve.

The interesting part in my code is:

------------------ snip -------------------
static void     (*old_gethrestimef)(timestruc_t *) = NULL;
static hrtime_t (*old_gethrtimef)(void) = NULL;
extern void     (*gethrestimef)(timestruc_t *);
extern hrtime_t (*gethrtimef)(void);

static void dummy_gethrestime(timestruc_t *ts)
{
    cmn_err(CE_WARN, "gethrestime called\n");
    old_gethrestimef(ts);
}

static hrtime_t dummy_gethrtime(void)
{
    cmn_err(CE_WARN, "gethrtime called\n");
    return old_gethrtimef();
}

/* Device configuration entry points */
static int
dummy_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
{
    cmn_err(CE_NOTE, "Inside dummy_attach");
    switch(cmd) {

   case DDI_ATTACH:
        dummy_dip = dip;
        if (ddi_create_minor_node(dip, "0", S_IFCHR,
            ddi_get_instance(dip), DDI_PSEUDO,0)
            != DDI_SUCCESS) {
            cmn_err(CE_NOTE,
                "%s%d: attach: could not add character node.",
                "dummy", 0);
            return(DDI_FAILURE);
        } else {
            /* Here intercepting the time functions */
            old_gethrestimef = gethrestimef;
            gethrestimef = dummy_gethrestime;
            old_gethrtimef = gethrtimef;
            gethrtimef = dummy_gethrtime;
            return DDI_SUCCESS;
        }
    default:
        return DDI_FAILURE;
    }
}
---------- snip ------------------

The complete module source file is in the attachment.

After I loaded the module with `add_drv dummy', the kernel frozen. After some 
analysis, I found that if I only intercept gethrestimef only, everything is ok.

I'm running opensolaris snv_117 on a amd64 box.

Please help, I have stuck on this problem for a long time.
------------------------------------------------------------------------

_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to