dt_as.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <strings.h>
#include <stdlib.h>
#include <assert.h>
#include <dt_impl.h>
#include <dt_parser.h>
#include <dt_as.h>
void
{
}
void
{
}
}
void
{
else
}
{
}
/*ARGSUSED*/
static int
{
(*np)++; /* include variable in vartab */
return (0);
}
/*ARGSUSED*/
static int
{
return (0); /* omit variable from vartab */
if (stroff == -1L)
if (stroff > DIF_STROFF_MAX)
dvp->dtdv_flags = 0;
else
return (0);
}
static ssize_t
{
return (n);
}
static void
{
kind = "user";
kind = "primary kernel";
else
kind = "loadable kernel";
}
{
size_t n = 0;
uint_t i;
/*
* Select bitmasks based upon the desired symbol linking policy. We
* test (di_ident->di_flags & xmask) == xbits to determine if the
* symbol should have a relocation entry generated in the loop below.
*
* DT_LINK_KERNEL = kernel symbols static, user symbols dynamic
* DT_LINK_PRIMARY = primary kernel symbols static, others dynamic
* DT_LINK_DYNAMIC = all symbols dynamic
* DT_LINK_STATIC = all symbols static
*
* By 'static' we mean that we use the symbol's value at compile-time
* in the final DIF. By 'dynamic' we mean that we create a relocation
* table entry for the symbol's value so it can be relocated later.
*/
switch (dtp->dt_linkmode) {
case DT_LINK_KERNEL:
kmask = 0;
kbits = -1u;
break;
case DT_LINK_PRIMARY:
kbits = 0;
break;
case DT_LINK_DYNAMIC:
kbits = 0;
break;
case DT_LINK_STATIC:
break;
default:
dtp->dt_linkmode);
}
/*
* Make an initial pass through the instruction list, filling in the
* instruction buffer with valid instructions and skipping labeled nops.
* While doing this, we also fill in our labels[] translation table
* and we count up the number of relocation table entries we will need.
*/
continue; /* no relocation entry needed */
krel++;
urel++;
}
/*
* Make a second pass through the instructions, relocating each branch
* label to the index of the final instruction in the buffer and noting
* any other instruction-specific DIFO flags such as dtdo_destructive.
*/
if (op == DIF_OP_CALL) {
continue;
}
}
}
yypcb->pcb_asvidx = 0;
/*
* Allocate memory for the appropriate number of variable records and
* then fill in each variable record. As we populate the variable
* table we insert the corresponding variable names into the strtab.
*/
if (n != 0) {
}
/*
* Allocate memory for the appropriate number of relocation table
* entries based upon our kernel and user counts from the first pass.
*/
if (krel != 0) {
}
if (urel != 0) {
}
/*
* If any relocations are needed, make another pass through the
* instruction list and fill in the relocation table entries.
*/
i = 0; /* dtdo_buf[] index */
continue; /* skip label declarations */
i++; /* advance dtdo_buf[] index */
continue; /* no relocation entry needed */
} else
continue;
if (!nodef)
dt_as_undef(idp, i);
if (soff == -1L)
if (soff > DIF_STROFF_MAX)
sizeof (uint64_t);
}
}
/*
* Allocate memory for the compiled string table and then copy the
* chunks from the string table into the final string buffer.
*/
}
/*
* Allocate memory for the compiled integer table and then copy the
* integer constants from the table into the final integer buffer.
*/
}
/*
* Fill in the DIFO return type from the type associated with the
* node saved in pcb_dret, and then clear pcb_difo and pcb_dret
* now that the assembler has completed successfully.
*/
return (dp);
}