mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 09:49:23 +02:00
Updated pcode tests for PIC30 issues.
This commit is contained in:
parent
05d9679a3d
commit
d7877b0353
8 changed files with 25 additions and 22 deletions
|
@ -404,7 +404,7 @@ TEST biopLogicOri1i1_Main()
|
|||
TEST biopDividi1i1_Main()
|
||||
{
|
||||
extern i1 biopDividi1i1(i1 lhs, i1 rhs);
|
||||
ASSERTI1(biopDividi1i1(0x01, 0x01), 1);
|
||||
ASSERTI1(biopDividi1i1(0x1, 0x1), 1);
|
||||
ASSERTI1(biopDividi1i1(I1_MAX, I1_MAX), 1);
|
||||
ASSERTI1(biopDividi1i1(I1_MIN, I1_MIN), 1);
|
||||
ASSERTI1(biopDividi1i1(I1_MAX, 1), I1_MAX);
|
||||
|
@ -465,7 +465,7 @@ TEST unopPlusi4_Main()
|
|||
TEST biopShtLfti2i2_Main()
|
||||
{
|
||||
extern i2 biopShtLfti2i2(i2 lhs, i2 rhs);
|
||||
ASSERTI2(biopShtLfti2i2(0x0101, 16), 0x0);
|
||||
ASSERTI2(biopShtLfti2i2(0x0101, 15), 0x8000);
|
||||
ASSERTI2(biopShtLfti2i2(0x0101, 8), 0x100);
|
||||
ASSERTI2(biopShtLfti2i2(0x0101, 0), 0x101);
|
||||
ASSERTI2(biopShtLfti2i2(2, 1), 4);
|
||||
|
@ -506,7 +506,7 @@ TEST biopMultu4u4_Main()
|
|||
TEST biopShtRhti2i2_Main()
|
||||
{
|
||||
extern i2 biopShtRhti2i2(i2 lhs, i2 rhs);
|
||||
ASSERTI2(biopShtRhti2i2(0x0101, 16), 0x0);
|
||||
ASSERTI2(biopShtRhti2i2(0x8fff, 15), 0xffff);
|
||||
ASSERTI2(biopShtRhti2i2(0x0101, 8), 0x1);
|
||||
ASSERTI2(biopShtRhti2i2(0x0101, 0), 0x0101);
|
||||
ASSERTI2(biopShtRhti2i2(2, 1), 1);
|
||||
|
|
|
@ -231,7 +231,6 @@ void assertU4(const char *file, int line, const char *func, u4 val, u4 expected)
|
|||
MainInfo.lastErrorLine = line;
|
||||
MainInfo.lastErrorFile = (char *) file;
|
||||
breakOnError();
|
||||
MainInfo.numfail++;
|
||||
}
|
||||
MainInfo.lastTestPos = line;
|
||||
DO_PRINT_UINT(val == expected);
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
typedef i4 (*entryFunc)(i4 * val);
|
||||
typedef i4 (*breakOn)(void);
|
||||
typedef i4 (*breakOnD)(const char *file, int line, const char *func);
|
||||
typedef i4 (*testFuncPtr)(void);
|
||||
|
||||
typedef struct PACKED_STRUCTURE FunctionInfo
|
||||
|
@ -47,7 +48,7 @@ typedef struct PACKED_STRUCTURE TestInfo
|
|||
u4 byteOrder; /* value 0x01020304 used to detect endianess */
|
||||
breakOn onPass; /* address of breakOnPass function, (where it goes on test pass) */
|
||||
breakOn onError; /* address of breakOnError function, (where it goes on test failure) */
|
||||
breakOn onDone; /* address of breakOnDone function, (where it goes when all test done) */
|
||||
breakOnD onDone; /* address of breakOnDone function, (where it goes when all test done) */
|
||||
u4 numpass; /* How many test passed */
|
||||
u4 numfail; /* How many test failed */
|
||||
u4 lastTestPos; /* Last test index number */
|
||||
|
|
|
@ -14,21 +14,29 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#if defined(__GNUC__) && !defined(__llvm__)
|
||||
#define HAS_GNU_ATTRIBUTES 1
|
||||
#define FUNCNAME __FUNCTION__
|
||||
|
||||
#define NO_OPTIMIZE __attribute__((optimize("O0")))
|
||||
#elif defined(__llvm__)
|
||||
#define HAS_GNU_ATTRIBUTES 1
|
||||
#define FUNCNAME __FUNCTION__
|
||||
#define NO_OPTIMIZE __attribute__((optimize("O0")))
|
||||
|
||||
#elif defined(__llvm__)
|
||||
|
||||
#define HAS_GNU_ATTRIBUTES 1
|
||||
#define FUNCNAME __FUNCTION__
|
||||
#define NO_OPTIMIZE __attribute__((optimize("O0")))
|
||||
|
||||
#elif defined(__SDCC)
|
||||
|
||||
#define FUNCNAME __func__
|
||||
#define NO_OPTIMIZE
|
||||
#define __VERSION__ "version"
|
||||
|
||||
#else
|
||||
#if !defined(__MSP430__)
|
||||
#define __VERSION__ "version"
|
||||
|
||||
#ifndef __VERSION__
|
||||
#define __VERSION__ "version"
|
||||
#endif
|
||||
|
||||
#define FUNCNAME __FUNCTION__
|
||||
#define NO_OPTIMIZE
|
||||
#endif
|
||||
|
@ -344,12 +352,6 @@ typedef i1 size_t;
|
|||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAS_LIBC
|
||||
void *memcpy(void *dest, const void *src, size_t n);
|
||||
void *memset(void *s, int c, size_t n);
|
||||
int memcmp(void *s1, void *s2, size_t n);
|
||||
#endif
|
||||
|
||||
#ifdef BUILD_EXE
|
||||
#ifndef HAS_LIBC
|
||||
void write(int fd, char *buf, int count);
|
||||
|
|
|
@ -8,7 +8,7 @@ PCodeTest.defaults.toolchain_root = '/local/ToolChains'
|
|||
PCodeTest.defaults.build_root = '/local/build-pcodetest'
|
||||
PCodeTest.defaults.gcc_version = '7.3.0'
|
||||
PCodeTest.defaults.skip_files = []
|
||||
PCodeTest.defaults.export_root = os.getcwd() + '/../../../../../../ghidra.bin/Ghidra/Test/TestResources/data/pcodetests/'
|
||||
PCodeTest.defaults.export_root = os.getcwd() + '/../../../../../ghidra.bin/Ghidra/Test/TestResources/data/pcodetests/'
|
||||
PCodeTest.defaults.pcodetest_src = os.getcwd() + '/c_src'
|
||||
|
||||
# PCodeTest.defaults that cannot be overridden on the command line
|
||||
|
|
|
@ -600,7 +600,7 @@ PCodeTest({
|
|||
# Currently the 'omitted' option is only supported by the SDCC toolchain!
|
||||
# Causes a bit of funk with tpp.py still including references to these
|
||||
# tests in cunit_main.c but the compiler accepts it with a warning.
|
||||
'omitted': {'PointerManipulation', 'StructUnionManipulation'},
|
||||
'skip_files': ['PointerManipulation.test', 'StructUnionManipulation.test'],
|
||||
# These tests are omitted because the SDCC compiler doesn't properly handle
|
||||
# structs in functions and requires a more strict format than ANSI C requires.
|
||||
})
|
||||
|
|
|
@ -49,7 +49,7 @@ class PCodeTest(BuildUtil):
|
|||
ce = 'can-export:%-5s' % ('yes' if self.config.can_export else 'no')
|
||||
ct = 'compiler-type:%-5s' % self.config.toolchain_type
|
||||
tc = 'Toolchain:%s' % self.config.toolchain
|
||||
return self.config.architecture.ljust(20) + cb + ce + ct + tc
|
||||
return self.config.name.ljust(20) + cb + ce + ct + tc
|
||||
|
||||
class PCodeTestBuild(BuildUtil):
|
||||
def __init__(self, pcode_test):
|
||||
|
@ -182,7 +182,7 @@ class PCodeTestBuild(BuildUtil):
|
|||
if not self.isfile(companion_file) or not self.isfile(body_file):
|
||||
self.log_info('Skipping %s %s build' % (companion_file, body_file))
|
||||
continue
|
||||
input_files = ['pcode_test.c', 'pcode_main.c', companion_file, body_file]
|
||||
input_files = ['pcode_test.c', 'pcode_main.c', 'builtin.c', companion_file, body_file]
|
||||
self.compile(input_files, opt_cflag, small_name)
|
||||
self.export_file(small_name+'.out', build_dir)
|
||||
|
||||
|
|
|
@ -3748,7 +3748,8 @@ define pcodeop isDivideOverflow;
|
|||
|
||||
@if defined(dsPIC30F) || defined(dsPIC33F) || defined(dsPIC33E)
|
||||
|
||||
:divf TOK_14_11_Wreg,TOK_3_0_Wreg is
|
||||
:repeat" 0x12 divf" TOK_14_11_Wreg,TOK_3_0_Wreg is
|
||||
OP_31_0=0x090011;
|
||||
OP_23_20=0xD & OP_19_16=0x9 & OP_15=0x0 &
|
||||
TOK_14_11_Wreg & OP_10_8=0x0 & OP_7_4=0x0 & TOK_3_0_Wreg {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue