dis_i386.c revision 038db8fb497789ea9b367f771544442507cede18
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright 2012 Joshua M. Clulow <josh@sysmgr.org>
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
*/
#include <libdisasm.h>
#include "dis_tables.h"
#include "libdisasm_impl.h"
typedef struct dis_handle_i386 {
int dhx_mode;
/*
* Returns true if we are near the end of a function. This is a cheap hack at
* detecting NULL padding between functions. If we're within a few bytes of the
* next function, or past the start, then return true.
*/
static int
check_func(void *data)
{
!= 0)
return (0);
return (1);
}
static int
{
sizeof (byte))
return (-1);
return ((int)byte);
}
static int
{
}
static void
{
}
static int
{
/*
* Validate architecture flags
*/
DIS_OCTAL | DIS_NOIMMSYM)) {
(void) dis_seterrno(E_DIS_INVALFLAG);
return (-1);
}
/*
* Create and initialize the internal structure
*/
(void) dis_seterrno(E_DIS_NOMEM);
return (-1);
}
/*
* Initialize x86-specific architecture structure
*/
else
return (0);
}
static int
{
/* DIS_NOIMMSYM might not be set until now, so update */
else
return (-1);
buflen);
return (0);
}
/* ARGSUSED */
static int
{
return (15);
}
/* ARGSUSED */
static int
{
return (1);
}
static int
{
return (1);
return (0);
}
static int
{
return (-1);
}
};