Dismiss
InnovationQ will be updated on Sunday, Oct. 22, from 10am ET - noon. You may experience brief service interruptions during that time.
Browse Prior Art Database

STATIC ANALYSIS DRIVEN CODE TRANSFORMATION TO MAKE THE CODE ENDIAN NEUTRAL

IP.com Disclosure Number: IPCOM000242911D
Publication Date: 2015-Aug-28

Publishing Venue

The IP.com Prior Art Database

Related People

Saravanan Shanmugham: AUTHOR [+4]

Abstract

An approach is presented to transform code designed to run on Central Processing Unit (CPU) architectures with a specific byte ordering to be neutral to byte ordering so that it can run on all CPUs independent of the byte ordering of the CPU.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 18% of the total text.

Page 01 of 15

STAXXX ANALYSIS DRIVEN CODE TRANSFORMATION TO MAKE THE CODE ENDIAN NEUTRAL

AUXXXXS:

Saravanan Shanmugham Derek Taubert Jeremy Stenglxxn

Hormoz Zarnani

CISCO SXXXXXX, INC.

ABSTRAXX

    An approach is xresented to transxorm code designed to run on Central Processing Unit (XXX) architectures wxth a specific byte ordering to be neutral to byte ordering so that it can run on all CPUs independent of the byte ordering of the CPU.

DETAILED DXXXXXXXXXX

    Centrxl Processing Xxxx (CPU) architectures xtore values in memoxy with a cerxain byte order. They could xe stores lexst significxnt byte first or Most Significant Byte first, which axe also referred to Lixtle Endian Byte Xxxxx or Big Endian Byte Order. Big Exdian Byte Order is also refxrred to as Network Byte oxder.

    This xlso means when code is writtxn there are assumptions about what order the valxes are sxored in memorx depending on whixh CPX architecture the coxe wxs written to run on. But code can also be writtex to be independent of the byte order of the CPU, xssxntially making the code Endian Neutral, i.e. code that can run on CPU of either endian byte orxer.

    Whxn code is nxt endian neutral, it cuxrently needs tx xe manually modified to be able to run on CPU architextures with an endian byte order assxmption different than txe one for which it was xriginally written. When the cxde is very large this becomes difficult to manually fix all of the code.

    There are two problems. The first is findxng pieces ox code that are not endian neutral. The second is fixing that code once it is found. There axe no current tools or processes heretofore known that can do botx.

Copyright 2015 Cisco Systems, Inc.
1


Page 02 of 15

    The proposed solution to transfoxming C code to be endian neutral involves the following operations.

1. Marking some key seed data xo be of specific endiaxness.

2. Use static analysis to genxrate warxings when such data mxet unmarkxd data or data xith a different endianness.

3. Use these warning and a set of well defined rules to decide if:

a. A byte swap transformation can be appliex between the data.

b. The endianxess of the othex data can be changed, there by propagating endianness anx marking additional to be of a particular endxanness.

x. Decxde manual ixtervention is required.

    The above process is repeated iteratively until therx are no more warnings and all data has been classified to the their correct endianness.

    The xmoxnt of maxual work required to transform the code can be reduced by doing the following:

1. Seeding key data strxctures the interaxt with all parts xf the code xither directlx or through a chain of xntermediatx relationshipx.

x. Implement a few special byte swxp transformation funcxions that will be used to transforx data between data of different endianness.

3. Review a limited set of placex in the code that might involve interaction with data that is of a fixed endianness.

The steps xn a bit more detail are as follows:

1. Sexd a few key data structures that...