Initial commit

This commit is contained in:
2025-10-06 00:14:04 -04:00
commit d98bdabb74
553 changed files with 32764 additions and 0 deletions

51
p1-check/Makefile Normal file
View File

@@ -0,0 +1,51 @@
#
# Simple Makefile
# Mike Lam, James Madison University, August 2016
#
# This makefile builds a simple application that contains a main module
# (specified by the EXE variable) and a predefined list of additional modules
# (specified by the MODS variable). If there are any external library
# dependencies (e.g., the math library, "-lm"), list them in the LIBS variable.
# If there are any precompiled object files, list them in the OBJS variable.
#
# By default, this makefile will build the project with debugging symbols and
# without optimization. To change this, edit or remove the "-g" and "-O0"
# options in CFLAGS and LDFLAGS accordingly.
#
# By default, this makefile build the application using the GNU C compiler,
# adhering to the C99 standard with all warnings enabled.
# application-specific settings and run target
EXE=y86
MODS=p1-check.o
OBJS=
LIBS=
default: $(EXE)
test: $(EXE)
TPREFIX=tests/ make -C tests test
# compiler/linker settings
CC=gcc
CFLAGS=-g -O0 -Wall --std=c99 -pedantic
LDFLAGS=-g -O0
# build targets
$(EXE): main.o $(MODS) $(OBJS)
$(CC) $(LDFLAGS) -o $(EXE) $^ $(LIBS)
%.o: %.c
$(CC) -c $(CFLAGS) $<
clean:
rm -f $(EXE) main.o $(MODS)
make -C tests clean
.PHONY: default clean

57
p1-check/elf.h Normal file
View File

@@ -0,0 +1,57 @@
#ifndef __CS261_ELF__
#define __CS261_ELF__
#include <stdio.h>
#include <stdint.h>
/*
Mini-ELF file format (byte 0 = first byte of the file)
+----------------------------------------------+
| header (elf_hdr_t) - 16 bytes |
+----------------------------------------------+
| program headers (elf_phdr_t) - 20 bytes each |
+----------------------------------------------+
| program segments - variable length of bytes |
+----------------------------------------------+
| symbol table - each entry is 4 bytes each |
+----------------------------------------------+
| string table - variable length of strings |
+----------------------------------------------+
ELF header structure:
+----------------------------------------------------------------------------+
| 0 1 | 2 3 | 4 5 | 6 7 | 8 9 | 10 11 | 12 13 14 15 |
| version | entry | phdr | numphdr | symtab | strtab | magic number |
+----------------------------------------------------------------------------+
Sample ELF header (all entries in hex, format is little endian):
+----------------------------------------------------------------------------+
| 01 00 | 00 01 | 10 00 | 02 00 | 58 00 | 70 00 | 45 4c 46 00 |
| version | entry | phdr | numphdr | symtab | strtab | magic number |
+----------------------------------------------------------------------------+
version = 0x0001 entry = 0x0100 phdr = 0x0010 numphdr = 0x0002
symtab = 0x0058 strtab = 0x0070 magic = "ELF\0"
Interpretation:
This file was created under version 1 of this format. When the program is
loaded into memory, the instruct at address 0x100 (256) will be executed
first. The first program header (which indicates segments in this file)
starts at offset 0x10 (16) into the file, and there are 2 program headers
total. The symbol table starts at offset 0x58 (88) into this file, and the
string table starts at offset 0x70 (112). The magic number is the string
"ELF\0", stored in the elf_hdr_t format as a 4-byte integer 0x00464c45
(4607045) and is used for checking the validity of the header.
*/
typedef struct __attribute__((__packed__)) elf {
uint16_t e_version; /* version should be 1 */
uint16_t e_entry; /* entry point of program */
uint16_t e_phdr_start; /* start of program headers */
uint16_t e_num_phdr; /* number of program headers */
uint16_t e_symtab; /* start of symbol table */
uint16_t e_strtab; /* start of string table */
uint32_t magic; /* ELF */
} elf_hdr_t;
#endif

66
p1-check/main.c Normal file
View File

@@ -0,0 +1,66 @@
/*
* CS 261: Main driver
*
* Name: Nicholas Tamassia
*/
#include "p1-check.h"
/*
* helper function for printing help text
*/
void usage (char **argv)
{
printf("Usage: %s <option(s)> mini-elf-file\n", argv[0]);
printf(" Options are:\n");
printf(" -h Display usage\n");
printf(" -H Show the Mini-ELF header\n");
}
int main (int argc, char **argv)
{
int c;
bool display_header = false;
while ((c = getopt(argc, argv, "hH")) != -1) {
switch (c) {
case 'h':
usage(argv);
return EXIT_SUCCESS;
case 'H':
display_header = true;
break;
default:
usage(argv);
return EXIT_FAILURE;
}
}
/* Check if file path was the last argument */
if (optind != argc - 1) {
usage(argv);
return EXIT_FAILURE;
}
elf_hdr_t header = { 0 };
FILE *header_file = fopen(argv[optind], "r");
/* Invalid file path or failed to read correct data from file */
if (!read_header(header_file, &header)) {
printf("Failed to read file\n");
if (header_file != NULL) {
fclose(header_file);
}
return EXIT_FAILURE;
}
if (display_header) {
dump_header(&header);
}
fclose(header_file);
return EXIT_SUCCESS;
}

BIN
p1-check/main.o Normal file

Binary file not shown.

60
p1-check/p1-check.c Normal file
View File

@@ -0,0 +1,60 @@
/*
* CS 261 PA1: Mini-ELF header verifier
*
* Name: Nicholas Tamassia
*/
#include "p1-check.h"
/**********************************************************************
* REQUIRED FUNCTIONS
*********************************************************************/
bool read_header (FILE *file, elf_hdr_t *hdr)
{
if (!file || !hdr) {
return false;
}
return ((fread(hdr, sizeof(elf_hdr_t), 1, file) == 1) && hdr->magic == 0x00464c45);
}
/**********************************************************************
* OPTIONAL FUNCTIONS
*********************************************************************/
void dump_header (elf_hdr_t *hdr)
{
uint8_t *byte_arr = (uint8_t*)hdr;
size_t size = sizeof(elf_hdr_t) / sizeof(byte_arr[0]);
for (int i = 0; i < size; i++) {
printf("%02x", byte_arr[i]);
if (i != size - 1) {
printf(" ");
}
if (i == size / 2 - 1) {
printf(" ");
}
}
printf("\n");
printf("Mini-ELF version %d\n", hdr->e_version);
printf("Entry point 0x%03x\n", hdr->e_entry);
printf("There are %d program headers, starting at offset %d (0x%02x)\n", hdr->e_num_phdr, hdr->e_phdr_start, hdr->e_phdr_start);
if (hdr->e_symtab != 0) {
printf("There is a symbol table starting at offset %d (0x%02x)\n", hdr->e_symtab, hdr->e_symtab);
} else {
printf("There is no symbol table present\n");
}
if (hdr->e_strtab != 0) {
printf("There is a string table starting at offset %d (0x%02x)\n", hdr->e_strtab, hdr->e_strtab);
} else {
printf("There is no string table present\n");
}
}

29
p1-check/p1-check.h Normal file
View File

@@ -0,0 +1,29 @@
#ifndef __CS261_P1__
#define __CS261_P1__
#include <getopt.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "elf.h"
/**
* @brief Load a Mini-ELF header from an open file stream
*
* @param file File stream to use for input
* @param hdr Pointer to region where the Mini-ELF header should be loaded
* @returns True if the header was successfully loaded and verified, false otherwise
*/
bool read_header (FILE *file, elf_hdr_t *hdr);
/**
* @brief Print Mini-ELF header information to standard out
*
* @param hdr Header with info to print
*/
void dump_header (elf_hdr_t *hdr);
#endif

BIN
p1-check/p1-check.o Normal file

Binary file not shown.

81
p1-check/tests/Makefile Normal file
View File

@@ -0,0 +1,81 @@
#
# Simple Test Makefile
# Mike Lam, James Madison University, August 2016
#
# This version of the Makefile includes support for building a test suite. The
# recommended framework is Check (http://check.sourceforge.net/). To build and
# run the test suite, execute the "test" target. The test suite must be located
# in a module called "testsuite". The MODS, LIBS, and OBJS variables work as
# they do in the main Makefile.
#
# To change the default build target (which executes when you just type
# "make"), change the right-hand side of the definition of the "default"
# target.
#
# By default, this makefile will build the project with debugging symbols and
# without optimization. To change this, edit or remove the "-g" and "-O0"
# options in CFLAGS and LDFLAGS accordingly.
#
# By default, this makefile build the application using the GNU C compiler,
# adhering to the C99 standard with all warnings enabled.
# application-specific settings and run target
EXE=../y86
TEST=testsuite
MODS=public.o
OBJS=../p1-check.o private.o
LIBS=
UTESTOUT=utests.txt
ITESTOUT=itests.txt
default: $(TEST)
$(EXE):
make -C ../
test: utest itest
@echo "========================================"
utest: $(EXE) $(TEST)
@echo "========================================"
@echo " UNIT TESTS"
@./$(TEST) 2>/dev/null >$(UTESTOUT)
@cat $(UTESTOUT) | sed -n -e '/Checks/,$$p' | sed -e 's/^private.*:[EF]://g'
itest: $(EXE)
@echo "========================================"
@echo " INTEGRATION TESTS"
@./integration.sh | tee $(ITESTOUT)
# compiler/linker settings
CC=gcc
CFLAGS=-g -O0 -Wall --std=c99 -pedantic
LDFLAGS=-g -O0
CFLAGS+=-I/opt/homebrew/include -Wno-gnu-zero-variadic-macro-arguments
LDFLAGS+=-L/opt/homebrew/lib
LIBS+=-lcheck -lm -lpthread
ifeq ($(shell uname -s),Linux)
LIBS+=-lrt -lsubunit
endif
# build targets
$(TEST): $(TEST).o $(MODS) $(OBJS)
$(CC) $(LDFLAGS) -o $(TEST) $^ $(LIBS)
%.o: %.c
$(CC) -c $(CFLAGS) $<
clean:
rm -rf $(TEST) $(TEST).o $(MODS) $(UTESTOUT) $(ITESTOUT) outputs valgrind
.PHONY: default clean test unittest inttest

View File

@@ -0,0 +1 @@
Failed to read file

View File

@@ -0,0 +1 @@
Failed to read file

View File

@@ -0,0 +1,4 @@
Usage: ../y86 <option(s)> mini-elf-file
Options are:
-h Display usage
-H Show the Mini-ELF header

View File

@@ -0,0 +1,4 @@
Usage: ../y86 <option(s)> mini-elf-file
Options are:
-h Display usage
-H Show the Mini-ELF header

View File

@@ -0,0 +1,4 @@
Usage: ../y86 <option(s)> mini-elf-file
Options are:
-h Display usage
-H Show the Mini-ELF header

View File

@@ -0,0 +1,4 @@
Usage: ../y86 <option(s)> mini-elf-file
Options are:
-h Display usage
-H Show the Mini-ELF header

View File

@@ -0,0 +1 @@
Failed to read file

View File

@@ -0,0 +1 @@
Failed to read file

View File

@@ -0,0 +1 @@
Failed to read file

View File

@@ -0,0 +1,4 @@
Usage: ../y86 <option(s)> mini-elf-file
Options are:
-h Display usage
-H Show the Mini-ELF header

View File

@@ -0,0 +1,6 @@
01 00 00 01 10 00 04 00 00 00 00 00 45 4c 46 00
Mini-ELF version 1
Entry point 0x100
There are 4 program headers, starting at offset 16 (0x10)
There is no symbol table present
There is no string table present

View File

@@ -0,0 +1,6 @@
01 00 00 01 10 00 02 00 58 00 70 00 45 4c 46 00
Mini-ELF version 1
Entry point 0x100
There are 2 program headers, starting at offset 16 (0x10)
There is a symbol table starting at offset 88 (0x58)
There is a string table starting at offset 112 (0x70)

View File

@@ -0,0 +1,6 @@
01 00 00 01 10 00 05 00 f4 00 16 01 45 4c 46 00
Mini-ELF version 1
Entry point 0x100
There are 5 program headers, starting at offset 16 (0x10)
There is a symbol table starting at offset 244 (0xf4)
There is a string table starting at offset 278 (0x116)

View File

@@ -0,0 +1,6 @@
01 00 00 01 10 00 02 00 00 00 00 00 45 4c 46 00
Mini-ELF version 1
Entry point 0x100
There are 2 program headers, starting at offset 16 (0x10)
There is no symbol table present
There is no string table present

View File

View File

@@ -0,0 +1,6 @@
01 00 00 01 10 00 02 00 58 00 70 00 45 4c 46 00
Mini-ELF version 1
Entry point 0x100
There are 2 program headers, starting at offset 16 (0x10)
There is a symbol table starting at offset 88 (0x58)
There is a string table starting at offset 112 (0x70)

View File

@@ -0,0 +1 @@
01 00 00 01 10 00 02 00 58 00 70 00 45 4c 46 00

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,87 @@
#!/bin/bash
# extract executable name from Makefile
EXE=$(grep "EXE=" Makefile | sed -e "s/EXE=//")
# detect timeout utility (i.e., "timeout" on Linux and "gtimeout" on MacOS)
# and set timeout interval
TIMEOUT="timeout"
TIMEOUT_INTERVAL="3s"
$TIMEOUT --help &>/dev/null
if [[ $? -ne 0 ]]; then
TIMEOUT="gtimeout"
fi
# Valgrind additional output flags
VG_FLAGS="--leak-check=full --track-origins=yes"
function run_test {
# parameters
TAG=$1
ARGS=$2
PTAG=$(printf '%-30s' "$TAG")
# file paths
OUTPUT=outputs/$TAG.txt
DIFF=outputs/$TAG.diff
EXPECT=expected/$TAG.txt
VALGRND=valgrind/$TAG.txt
# run test with timeout
$TIMEOUT $TIMEOUT_INTERVAL $EXE $ARGS 2>/dev/null >"$OUTPUT"
if [ "$?" -lt 124 ]; then
# no timeout; compare output to the expected version
diff -u "$OUTPUT" "$EXPECT" >"$DIFF"
if [ -s "$DIFF" ]; then
# try alternative solution (if it exists)
EXPECT=expected/$TAG-2.txt
if [ -e "$EXPECT" ]; then
diff -u "$OUTPUT" "$EXPECT" >"$DIFF"
if [ -s "$DIFF" ]; then
echo "$PTAG FAIL (see ${TPREFIX}$DIFF for details)"
else
echo "$PTAG pass"
fi
else
echo "$PTAG FAIL (see ${TPREFIX}$DIFF for details)"
fi
else
echo "$PTAG pass"
fi
# run valgrind
$TIMEOUT $TIMEOUT_INTERVAL valgrind $VG_FLAGS $EXE $ARGS &>$VALGRND
else
echo "$PTAG FAIL (crash or timeout)"
fi
}
# initialize output folders
mkdir -p outputs
mkdir -p valgrind
rm -f outputs/* valgrind/*
# run individual tests
source itests.include
# check for memory leaks
LEAK=`cat valgrind/*.txt | grep 'definitely lost' | grep -v ' 0 bytes in 0 blocks'`
if [ -z "$LEAK" ]; then
echo "No memory leak found."
else
echo "Memory leak(s) found. See files listed below for details."
grep 'definitely lost' valgrind/*.txt | sed -e 's/:.*$//g' | awk "{print \" - ${TPREFIX}\" \$0}"
fi
# check for uninitialized values
LEAK=`cat valgrind/*.txt | grep 'uninitialised value'`
if [ -z "$LEAK" ]; then
echo "No uninitialized value found."
else
echo "Uninitialized value(s) found. See files listed below for details."
grep 'uninitialised value' valgrind/*.txt | sed -e 's/:.*$//g' | awk "{print \" - ${TPREFIX}\" \$0}"
fi

View File

@@ -0,0 +1,21 @@
# list of integration tests
# format: run_test <TAG> <ARGS>
# <TAG> used as the root for all filenames (i.e., "expected/$TAG.txt")
# <ARGS> command-line arguments to test
run_test C_simple_hex "-H inputs/simple.o"
run_test C_no_output "inputs/simple.o"
run_test B_help "-h"
run_test B_simple_full "-H inputs/simple.o"
run_test B_multisegment "-H inputs/multiseg.o"
run_test B_stripped "-H inputs/stripped.o"
run_test B_stack "-H inputs/stack.o"
run_test A_invalid_param "-x"
run_test A_invalid_multi_files "-H inputs/simple.o inputs/multiseg.o"
run_test A_invalid_multi_params "-H inputs/simple.o -H inputs/multiseg.o"
run_test A_missing_filename "-H"
run_test A_nonexistent_file "-H nonexist.o"
run_test A_bad_magic "-H inputs/bad-no_elf.o"
run_test A_short_header "-H inputs/bad-short_header.o"
run_test A_bad_magic_no_H "inputs/bad-no_elf.o"
run_test A_short_header_no_H "inputs/bad-short_header.o"

BIN
p1-check/tests/private.o Normal file

Binary file not shown.

26
p1-check/tests/public.c Normal file
View File

@@ -0,0 +1,26 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <check.h>
#include "../p1-check.h"
/* read_header is declared and defined */
START_TEST (C_sanity_read_header_is_declared)
{
elf_hdr_t elf;
FILE *fp = fopen ("inputs/simple.o", "r");
ck_assert (fp != NULL);
bool rc = read_header (fp, &elf);
ck_assert (rc || !rc);
}
END_TEST
void public_tests (Suite *s)
{
TCase *tc_public = tcase_create ("Public");
tcase_add_test (tc_public, C_sanity_read_header_is_declared);
suite_add_tcase (s, tc_public);
}

View File

@@ -0,0 +1,34 @@
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <assert.h>
#include <time.h>
#include <check.h>
extern void public_tests (Suite *s);
extern void private_tests (Suite *s);
Suite * test_suite (void)
{
Suite *s = suite_create ("Default");
public_tests (s);
private_tests (s);
return s;
}
void run_testsuite (void)
{
Suite *s = test_suite ();
SRunner *sr = srunner_create (s);
srunner_run_all (sr, CK_NORMAL);
srunner_free (sr);
}
int main (void)
{
srand((unsigned)time(NULL));
run_testsuite ();
return EXIT_SUCCESS;
}

BIN
p1-check/y86 Normal file

Binary file not shown.

51
p2-load/Makefile Normal file
View File

@@ -0,0 +1,51 @@
#
# Simple Makefile
# Mike Lam, James Madison University, August 2016
#
# This makefile builds a simple application that contains a main module
# (specified by the EXE variable) and a predefined list of additional modules
# (specified by the MODS variable). If there are any external library
# dependencies (e.g., the math library, "-lm"), list them in the LIBS variable.
# If there are any precompiled object files, list them in the OBJS variable.
#
# By default, this makefile will build the project with debugging symbols and
# without optimization. To change this, edit or remove the "-g" and "-O0"
# options in CFLAGS and LDFLAGS accordingly.
#
# By default, this makefile build the application using the GNU C compiler,
# adhering to the C99 standard with all warnings enabled.
# application-specific settings and run target
EXE=y86
MODS=p2-load.o
OBJS=p1-check.o
LIBS=
default: $(EXE)
test: $(EXE)
TPREFIX=tests/ make -C tests test
# compiler/linker settings
CC=gcc
CFLAGS=-g -O0 -Wall --std=c99 -pedantic
LDFLAGS=-g -O0
# build targets
$(EXE): main.o $(MODS) $(OBJS)
$(CC) $(LDFLAGS) -o $(EXE) $^ $(LIBS)
%.o: %.c
$(CC) -c $(CFLAGS) $<
clean:
rm -f $(EXE) main.o $(MODS)
make -C tests clean
.PHONY: default clean

98
p2-load/elf.h Normal file
View File

@@ -0,0 +1,98 @@
#ifndef __CS261_ELF__
#define __CS261_ELF__
#include <stdio.h>
#include <stdint.h>
#include "y86.h"
/*
Mini-ELF file format (byte 0 = first byte of the file)
+----------------------------------------------+
| header (elf_hdr_t) - 16 bytes |
+----------------------------------------------+
| program headers (elf_phdr_t) - 20 bytes each |
+----------------------------------------------+
| program segments - variable length of bytes |
+----------------------------------------------+
| symbol table - each entry is 4 bytes each |
+----------------------------------------------+
| string table - variable length of strings |
+----------------------------------------------+
ELF header structure:
+----------------------------------------------------------------------------+
| 0 1 | 2 3 | 4 5 | 6 7 | 8 9 | 10 11 | 12 13 14 15 |
| version | entry | phdr | numphdr | symtab | strtab | magic number |
+----------------------------------------------------------------------------+
Sample ELF header (all entries in hex, format is little endian):
+----------------------------------------------------------------------------+
| 01 00 | 00 01 | 10 00 | 05 00 | ac 00 | c2 00 | 45 4c 46 00 |
| version | entry | phdr | numphdr | symtab | strtab | magic number |
+----------------------------------------------------------------------------+
version = 0x0001 entry = 0x0100 phdr = 0x0010 numphdr = 0x0005
symtab = 0x00ac strtab = 0x00c2 magic = "ELF\0"
Interpretation:
This file was created under version 1 of this format. When the program is
loaded into memory, the instruct at address 0x100 (256) will be executed
first. The first program header (which indicates segments in this file)
starts at offset 0x10 (16) into the file, and there are 5 program headers
total. The symbol table starts at offset 0xac (172) into this file, and the
string table starts at offset 0xc2 (194). The magic number is the string
"ELF\0" and is for error checking.
*/
typedef struct __attribute__((__packed__)) elf {
uint16_t e_version; /* version should be 1 */
uint16_t e_entry; /* entry point of program */
uint16_t e_phdr_start; /* start of program headers */
uint16_t e_num_phdr; /* number of program headers */
uint16_t e_symtab; /* start of symbol table */
uint16_t e_strtab; /* start of string table */
uint32_t magic; /* ELF */
} elf_hdr_t;
typedef enum {
DATA, CODE, STACK, HEAP, UNKNOWN
} elf_segtype_t;
/*
ELF program header structure (describing segments):
+-----------------------------------------------------------------------+
| 0 1 2 3 | 4 5 6 7 | 8 9 10 11 | 12 13 | 14 15 | 16 17 18 19 |
| offset | size | virt addr | type | flags | magic number|
+-----------------------------------------------------------------------+
Flags store segment permissions as RWX (read/write/execute) in binary.
Examples: 100 (binary) = 4 (decimal/hex) = read-only (R )
101 (binary) = 5 (decimal/hex) = read-execute (R X)
110 (binary) = 6 (decimal/hex) = read-write (RW )
Sample ELF program header (all entries in hex, format is little endian):
+-----------------------------------------------------------------------+
| 74 00 00 00 | 12 00 00 00 | 00 01 00 00 | 01 00 | 05 00 | ef be ad de |
| offset | size | virt addr | type | flags | magic number|
+-----------------------------------------------------------------------+
offset = 0x00000074 size = 0x00000012 virt addr = 0x00000100
type = 0x0001 (CODE) flags = 0x0005 (RX) magic = 0xDEADBEEF
Interpretation:
The segment starts at offset 0x74 (116) in the file, and it is 0x12 (18)
bytes in size. It will be loaded into memory address 0x100 (256). Since it
is a CODE segment, it needs to have read-execute (RX) permissions attached.
The magic number is the value 0xDEADBEEF and is for error checking.
*/
typedef struct __attribute__((__packed__)) elf_phdr {
uint32_t p_offset; /* beginning of the segment in the file (in bytes) */
uint32_t p_size; /* number of bytes in the segment */
uint32_t p_vaddr; /* intended virtual address of the beginning of
the segment in a running program's memory */
uint16_t p_type; /* segment type (e.g., code, data, etc.) */
uint16_t p_flags; /* permissions flags */
uint32_t magic; /* DEADBEEF */
} elf_phdr_t;
#endif

134
p2-load/main.c Normal file
View File

@@ -0,0 +1,134 @@
/*
* CS 261: Main driver
*
* Name: Nicholas Tamassia
* This code was developed in compliance with the JMU Honor Code.
*/
#include "p1-check.h"
#include "p2-load.h"
/* Helper function for printing help text */
void usage (char **argv)
{
printf("Usage: %s <option(s)> mini-elf-file\n", argv[0]);
printf(" Options are:\n");
printf(" -h Display usage\n");
printf(" -H Show the Mini-ELF header\n");
printf(" -a Show all with brief memory\n");
printf(" -f Show all with full memory\n");
printf(" -s Show the program headers\n");
printf(" -m Show the memory contents (brief)\n");
printf(" -M Show the memory contents (full)\n");
}
void exit_file_error(FILE* file) {
if (file) {
fclose(file);
}
printf("Failed to read file\n");
exit(EXIT_FAILURE);
}
int main (int argc, char **argv)
{
int c;
bool show_elf_header = false;
bool show_program_header = false;
bool show_memory_brief = false;
bool show_memory_full = false;
while ((c = getopt(argc, argv, "hHafsmM")) != -1) {
switch (c) {
case 'h':
usage(argv);
return EXIT_SUCCESS;
case 'H':
show_elf_header = true;
break;
case 'a':
show_elf_header = true;
show_program_header = true;
show_memory_brief = true;
break;
case 'f':
show_elf_header = true;
show_program_header = true;
show_memory_full = true;
break;
case 's':
show_program_header = true;
break;
case 'm':
show_memory_brief = true;
break;
case 'M':
show_memory_full = true;
break;
default:
usage(argv);
return EXIT_FAILURE;
}
}
bool invalid_arguments = optind != argc - 1; /* File path was not the last argument */
bool memory_flag_conflict = show_memory_brief && show_memory_full; /* Attempted to ask for brief and full memory at same time */
if (invalid_arguments || memory_flag_conflict) {
usage(argv);
return EXIT_FAILURE;
}
elf_hdr_t header = { 0 };
FILE *header_file = fopen(argv[optind], "r");
/* Read contents of header_file into header */
if (!read_header(header_file, &header)) {
exit_file_error(header_file);
}
if (show_elf_header) {
dump_header(&header);
}
elf_phdr_t phdrs[header.e_num_phdr];
memset(phdrs, 0, sizeof(phdrs));
/* Read program headers into phdrs array */
for (int i = 0; i < header.e_num_phdr; i++) {
if (!read_phdr(header_file, header.e_phdr_start + i * sizeof(elf_phdr_t), &phdrs[i])) {
exit_file_error(header_file);
}
}
if (show_program_header) {
dump_phdrs(header.e_num_phdr, phdrs);
}
byte_t memory[MEMSIZE];
memset(memory, 0, MEMSIZE);
/* Read memory segments into memory array */
for (int i = 0; i < header.e_num_phdr; i++) {
if (!load_segment(header_file, memory, &phdrs[i])) {
exit_file_error(header_file);
}
}
if (show_memory_brief) {
for (int i = 0; i < header.e_num_phdr; i++) {
uint32_t start = phdrs[i].p_vaddr;
uint32_t end = start + phdrs[i].p_size;
dump_memory(memory, start, end);
}
} else if (show_memory_full) {
dump_memory(memory, 0, MEMSIZE);
}
fclose(header_file);
return EXIT_SUCCESS;
}

BIN
p2-load/main.o Normal file

Binary file not shown.

29
p2-load/p1-check.h Normal file
View File

@@ -0,0 +1,29 @@
#ifndef __CS261_P1__
#define __CS261_P1__
#include <getopt.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "elf.h"
/**
* @brief Load a Mini-ELF header from an open file stream
*
* @param file File stream to use for input
* @param hdr Pointer to region where the Mini-ELF header should be loaded
* @returns True if the header was successfully loaded and verified, false otherwise
*/
bool read_header (FILE *file, elf_hdr_t *hdr);
/**
* @brief Print Mini-ELF header information to standard out
*
* @param hdr Header with info to print
*/
void dump_header (elf_hdr_t *hdr);
#endif

BIN
p2-load/p1-check.o Normal file

Binary file not shown.

96
p2-load/p2-load.c Normal file
View File

@@ -0,0 +1,96 @@
/*
* CS 261 PA2: Mini-ELF loader
*
* Name: Nicholas Tamassia
* This code was developed in compliance with the JMU Honor Code.
*/
#include "p2-load.h"
/**********************************************************************
* REQUIRED FUNCTIONS
*********************************************************************/
bool read_phdr (FILE *file, uint16_t offset, elf_phdr_t *phdr)
{
if (!file || !phdr || fseek(file, offset, SEEK_SET) != 0) {
return false;
}
return ((fread(phdr, sizeof(elf_phdr_t), 1, file) == 1) && phdr->magic == 0xDEADBEEF);
}
bool load_segment (FILE *file, byte_t *memory, elf_phdr_t *phdr)
{
if (!file || !memory || !phdr) {
return false;
}
if (phdr->p_vaddr + phdr->p_size > MEMSIZE || fseek(file, phdr->p_offset, SEEK_SET) != 0) {
return false;
}
if ((fread(memory + phdr->p_vaddr, phdr->p_size, 1, file) != 1) && phdr->p_size != 0) {
return false;
}
return true;
}
/**********************************************************************
* OPTIONAL FUNCTIONS
*********************************************************************/
void dump_phdrs (uint16_t numphdrs, elf_phdr_t *phdrs)
{
printf(" Segment Offset Size VirtAddr Type Flags\n");
for (int i = 0; i < numphdrs; i++) {
elf_phdr_t phdr = phdrs[i];
char flags[4] = "RWX";
for (int j = 2; j >= 0; j--) {
if ((phdr.p_flags & (1 << (2 - j))) == 0) {
flags[j] = ' ';
}
}
printf(" %02d 0x%04x 0x%04x 0x%04x %-10s%s\n", i, phdr.p_offset, phdr.p_size, phdr.p_vaddr, p_type_mapper(phdr.p_type), flags);
}
}
char* p_type_mapper(uint16_t type) {
switch (type) {
case 0: return "DATA"; break;
case 1: return "CODE"; break;
case 2: return "STACK"; break;
case 3: return "HEAP"; break;
default: return "UNKNOWN"; break;
}
}
void dump_memory (byte_t *memory, uint16_t start, uint16_t end)
{
printf("Contents of memory from %04x to %04x:\n", start, end);
int aligned_start = start - (start % 16);
for (int i = aligned_start; i < end; i++) {
if (i % 16 == 0) {
printf(" %04x ", i);
}
if (i >= start) {
printf(" %02x", memory[i]);
} else {
printf(" ");
}
if (i % 16 == 15 || i == end - 1) {
printf("\n");
} else if (i % 16 == 7) {
printf(" ");
}
}
}

54
p2-load/p2-load.h Normal file
View File

@@ -0,0 +1,54 @@
#ifndef __CS261_P2__
#define __CS261_P2__
#include <getopt.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "elf.h"
#include "y86.h"
/**
* @brief Load a Mini-ELF program header from an open file stream
*
* @param file File stream to use for input
* @param offset Byte offset in file where the program header is located
* @param phdr Pointer to memory where the Mini-ELF program header should be loaded
* @returns True if the header was successfully loaded and verified, false otherwise
*/
bool read_phdr (FILE *file, uint16_t offset, elf_phdr_t *phdr);
/**
* @brief Load a Mini-ELF program segment from an open file stream
*
* @param file File stream to use for input
* @param memory Pointer to the beginning of the Y86 address space into which
* the segment should be loaded
* @param phdr Pointer to the program header for the segment that should be loaded
* @returns True if the segment was successfully loaded, false otherwise
*/
bool load_segment (FILE *file, byte_t *memory, elf_phdr_t *phdr);
/**
* @brief Print Mini-ELF program header information to standard out
*
* @param numphdrs Number of program headers to print
* @param phdrs Pointer to array of program headers with info to print
*/
void dump_phdrs (uint16_t numphdrs, elf_phdr_t *phdrs);
char* p_type_mapper(uint16_t type);
/**
* @brief Print a portion of a Y86 address space
*
* @param memory Pointer to the beginning of the Y86 address space
* @param start Byte offset where printing should begin
* @param end Byte offset where printing should end
*/
void dump_memory (byte_t *memory, uint16_t start, uint16_t end);
#endif

BIN
p2-load/p2-load.o Normal file

Binary file not shown.

81
p2-load/tests/Makefile Normal file
View File

@@ -0,0 +1,81 @@
#
# Simple Test Makefile
# Mike Lam, James Madison University, August 2016
#
# This version of the Makefile includes support for building a test suite. The
# recommended framework is Check (http://check.sourceforge.net/). To build and
# run the test suite, execute the "test" target. The test suite must be located
# in a module called "testsuite". The MODS, LIBS, and OBJS variables work as
# they do in the main Makefile.
#
# To change the default build target (which executes when you just type
# "make"), change the right-hand side of the definition of the "default"
# target.
#
# By default, this makefile will build the project with debugging symbols and
# without optimization. To change this, edit or remove the "-g" and "-O0"
# options in CFLAGS and LDFLAGS accordingly.
#
# By default, this makefile build the application using the GNU C compiler,
# adhering to the C99 standard with all warnings enabled.
# application-specific settings and run target
EXE=../y86
TEST=testsuite
MODS=public.o
OBJS=../p1-check.o ../p2-load.o private.o
LIBS=
UTESTOUT=utests.txt
ITESTOUT=itests.txt
default: $(TEST)
$(EXE):
make -C ../
test: utest itest
@echo "========================================"
utest: $(EXE) $(TEST)
@echo "========================================"
@echo " UNIT TESTS"
@./$(TEST) 2>/dev/null >$(UTESTOUT)
@cat $(UTESTOUT) | sed -n -e '/Checks/,$$p' | sed -e 's/^private.*:[EF]://g'
itest: $(EXE)
@echo "========================================"
@echo " INTEGRATION TESTS"
@./integration.sh | tee $(ITESTOUT)
# compiler/linker settings
CC=gcc
CFLAGS=-g -O0 -Wall --std=c99 -pedantic
LDFLAGS=-g -O0
CFLAGS+=-I/opt/homebrew/include -Wno-gnu-zero-variadic-macro-arguments
LDFLAGS+=-L/opt/homebrew/lib
LIBS+=-lcheck -lm -lpthread
ifeq ($(shell uname -s),Linux)
LIBS+=-lrt -lsubunit
endif
# build targets
$(TEST): $(TEST).o $(MODS) $(OBJS)
$(CC) $(LDFLAGS) -o $(TEST) $^ $(LIBS)
%.o: %.c
$(CC) -c $(CFLAGS) $<
clean:
rm -rf $(TEST) $(TEST).o $(MODS) $(UTESTOUT) $(ITESTOUT) outputs valgrind
.PHONY: default clean test unittest inttest

View File

@@ -0,0 +1 @@
Failed to read file

View File

@@ -0,0 +1 @@
Failed to read file

View File

@@ -0,0 +1 @@
Failed to read file

View File

@@ -0,0 +1,9 @@
Usage: ../y86 <option(s)> mini-elf-file
Options are:
-h Display usage
-H Show the Mini-ELF header
-a Show all with brief memory
-f Show all with full memory
-s Show the program headers
-m Show the memory contents (brief)
-M Show the memory contents (full)

View File

@@ -0,0 +1,9 @@
Usage: ../y86 <option(s)> mini-elf-file
Options are:
-h Display usage
-H Show the Mini-ELF header
-a Show all with brief memory
-f Show all with full memory
-s Show the program headers
-m Show the memory contents (brief)
-M Show the memory contents (full)

View File

@@ -0,0 +1,9 @@
Usage: ../y86 <option(s)> mini-elf-file
Options are:
-h Display usage
-H Show the Mini-ELF header
-a Show all with brief memory
-f Show all with full memory
-s Show the program headers
-m Show the memory contents (brief)
-M Show the memory contents (full)

View File

@@ -0,0 +1,9 @@
Usage: ../y86 <option(s)> mini-elf-file
Options are:
-h Display usage
-H Show the Mini-ELF header
-a Show all with brief memory
-f Show all with full memory
-s Show the program headers
-m Show the memory contents (brief)
-M Show the memory contents (full)

View File

@@ -0,0 +1,9 @@
Usage: ../y86 <option(s)> mini-elf-file
Options are:
-h Display usage
-H Show the Mini-ELF header
-a Show all with brief memory
-f Show all with full memory
-s Show the program headers
-m Show the memory contents (brief)
-M Show the memory contents (full)

View File

View File

@@ -0,0 +1 @@
Failed to read file

View File

@@ -0,0 +1,17 @@
01 00 18 01 10 00 03 00 00 00 00 00 45 4c 46 00
Mini-ELF version 1
Entry point 0x118
There are 3 program headers, starting at offset 16 (0x10)
There is no symbol table present
There is no string table present
Segment Offset Size VirtAddr Type Flags
00 0x004c 0x0009 0x0000 CODE R X
01 0x0055 0x0002 0x0118 CODE R X
02 0x0057 0x0008 0x013a DATA RW
Contents of memory from 0000 to 0009:
0000 70 18 01 00 00 00 00 00 00
Contents of memory from 0118 to 011a:
0110 10 00
Contents of memory from 013a to 0142:
0130 39 30 00 00 00 00
0140 00 00

View File

@@ -0,0 +1,18 @@
01 00 55 05 10 00 03 00 00 00 00 00 45 4c 46 00
Mini-ELF version 1
Entry point 0x555
There are 3 program headers, starting at offset 16 (0x10)
There is no symbol table present
There is no string table present
Segment Offset Size VirtAddr Type Flags
00 0x004c 0x0009 0x0000 CODE R X
01 0x0055 0x001f 0x0555 CODE R X
02 0x0074 0x0008 0x0987 DATA RW
Contents of memory from 0000 to 0009:
0000 70 55 05 00 00 00 00 00 00
Contents of memory from 0555 to 0574:
0550 30 f0 4d 01 00 00 00 00 00 00 30
0560 f3 de 00 00 00 00 00 00 00 30 f1 6f 00 00 00 00
0570 00 00 00 00
Contents of memory from 0987 to 098f:
0980 dd cc bb aa 00 00 00 00

View File

@@ -0,0 +1,14 @@
01 00 00 01 10 00 02 00 58 00 70 00 45 4c 46 00
Mini-ELF version 1
Entry point 0x100
There are 2 program headers, starting at offset 16 (0x10)
There is a symbol table starting at offset 88 (0x58)
There is a string table starting at offset 112 (0x70)
Segment Offset Size VirtAddr Type Flags
00 0x0038 0x0015 0x0100 CODE R X
01 0x004d 0x000b 0x0200 DATA RW
Contents of memory from 0100 to 0115:
0100 30 f3 0f 00 00 00 20 31 40 13 fd ff ff ff 60 31
0110 70 08 01 00 00
Contents of memory from 0200 to 020b:
0200 aa bb cc dd 00 00 00 dd 00 00 00

View File

@@ -0,0 +1,3 @@
Segment Offset Size VirtAddr Type Flags
00 0x0038 0x0015 0x0100 CODE R X
01 0x004d 0x000b 0x0200 DATA RW

View File

@@ -0,0 +1,27 @@
01 00 00 01 10 00 05 00 f4 00 16 01 45 4c 46 00
Mini-ELF version 1
Entry point 0x100
There are 5 program headers, starting at offset 16 (0x10)
There is a symbol table starting at offset 244 (0xf4)
There is a string table starting at offset 278 (0x116)
Segment Offset Size VirtAddr Type Flags
00 0x0074 0x001e 0x0100 CODE R X
01 0x0092 0x0032 0x0200 CODE R X
02 0x00c4 0x000d 0x0300 DATA RW
03 0x00d1 0x0023 0x0400 DATA R
04 0x00f4 0x0000 0x0f00 STACK RW
Contents of memory from 0100 to 011e:
0100 30 f4 00 0f 00 00 00 00 00 00 30 f5 00 0f 00 00
0110 00 00 00 00 80 00 02 00 00 00 00 00 00 00
Contents of memory from 0200 to 0232:
0200 30 f0 02 03 00 00 00 00 00 00 50 30 00 00 00 00
0210 00 00 00 00 20 31 a0 0f b0 3f c0 c1 c5 40 13 fd
0220 ff ff ff 00 00 00 00 60 31 70 1d 02 00 00 00 00
0230 00 00
Contents of memory from 0300 to 030d:
0300 bb aa 0f 0a 00 00 00 00 00 00 00 dd cc
Contents of memory from 0400 to 0423:
0400 68 65 6c 6c 6f 20 77 6f 72 6c 64 00 67 6f 6f 64
0410 00 79 61 64 64 61 20 79 61 64 64 61 20 79 61 64
0420 64 61 00
Contents of memory from 0f00 to 0f00:

View File

@@ -0,0 +1,5 @@
Contents of memory from 0100 to 0115:
0100 30 f3 0f 00 00 00 20 31 40 13 fd ff ff ff 60 31
0110 70 08 01 00 00
Contents of memory from 0200 to 020b:
0200 aa bb cc dd 00 00 00 dd 00 00 00

View File

@@ -0,0 +1,11 @@
01 00 00 01 10 00 02 00 00 00 00 00 45 4c 46 00
Mini-ELF version 1
Entry point 0x100
There are 2 program headers, starting at offset 16 (0x10)
There is no symbol table present
There is no string table present
Contents of memory from 0100 to 0115:
0100 30 f3 0f 00 00 00 20 31 40 13 fd ff ff ff 60 31
0110 70 08 01 00 00
Contents of memory from 0200 to 020b:
0200 aa bb cc dd 00 00 00 dd 00 00 00

View File

@@ -0,0 +1,9 @@
Usage: ../y86 <option(s)> mini-elf-file
Options are:
-h Display usage
-H Show the Mini-ELF header
-a Show all with brief memory
-f Show all with full memory
-s Show the program headers
-m Show the memory contents (brief)
-M Show the memory contents (full)

View File

@@ -0,0 +1,5 @@
Segment Offset Size VirtAddr Type Flags
00 0x0060 0x0015 0x0100 DATA W
01 0x0075 0x000b 0x0200 DATA X
02 0x0080 0x0015 0x0300 DATA WX
03 0x0090 0x000b 0x0200 DATA RWX

View File

@@ -0,0 +1,268 @@
01 00 00 01 10 00 04 00 00 00 00 00 45 4c 46 00
Mini-ELF version 1
Entry point 0x100
There are 4 program headers, starting at offset 16 (0x10)
There is no symbol table present
There is no string table present
Segment Offset Size VirtAddr Type Flags
00 0x0060 0x0015 0x0100 CODE R X
01 0x0075 0x000b 0x0200 DATA RW
02 0x0080 0x0015 0x0300 CODE R X
03 0x0090 0x000b 0x0200 DATA RW
Contents of memory from 0000 to 1000:
0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0080 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0100 30 f3 0f 00 00 00 20 31 40 13 fd ff ff ff 60 31
0110 70 08 01 00 00 00 00 00 00 00 00 00 00 00 00 00
0120 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0130 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0150 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0170 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0180 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0190 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0200 70 08 01 00 00 aa bb cc dd 00 00 00 00 00 00 00
0210 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0220 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0230 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0240 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0250 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0260 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0270 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0280 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0290 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
02a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
02b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
02c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
02d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
02e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
02f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0300 30 f3 0f 00 00 00 20 31 40 13 fd ff ff ff 60 31
0310 70 08 01 00 00 00 00 00 00 00 00 00 00 00 00 00
0320 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0330 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0340 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0350 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0360 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0370 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0380 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0390 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
03a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
03b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
03c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
03d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
03e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
03f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0400 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0410 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0420 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0430 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0440 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0450 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0460 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0470 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0480 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0490 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
04a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
04b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
04c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
04d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
04e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
04f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0500 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0510 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0520 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0530 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0540 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0550 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0560 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0570 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0580 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0590 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
05a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
05b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
05c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
05d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
05e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
05f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0600 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0610 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0620 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0630 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0640 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0650 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0660 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0670 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0680 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0690 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
06a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
06b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
06c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
06d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
06e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
06f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0700 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0710 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0720 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0730 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0740 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0750 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0760 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0770 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0780 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0790 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
07a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
07b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
07c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
07d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
07e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
07f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0800 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0810 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0820 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0830 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0840 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0850 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0860 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0870 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0880 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0890 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
08a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
08b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
08c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
08d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
08e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
08f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0900 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0910 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0920 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0930 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0940 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0950 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0960 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0970 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0980 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0990 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
09a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
09b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
09c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
09d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
09e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
09f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0aa0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ab0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ac0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ad0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ae0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0af0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ba0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0bb0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0bc0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0bd0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0be0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0bf0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ca0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0cb0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0cc0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0cd0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ce0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0cf0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0da0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0db0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0dc0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0dd0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0de0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0df0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ea0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0eb0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ec0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ed0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ee0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ef0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0fa0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0fb0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0fc0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0fd0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0fe0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ff0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

View File

@@ -0,0 +1,268 @@
01 00 00 01 10 00 04 00 00 00 00 00 45 4c 46 00
Mini-ELF version 1
Entry point 0x100
There are 4 program headers, starting at offset 16 (0x10)
There is no symbol table present
There is no string table present
Segment Offset Size VirtAddr Type Flags
00 0x0060 0x0015 0x0100 CODE R X
01 0x0075 0x000b 0x0200 DATA RW
02 0x0080 0x0015 0x0300 CODE R X
03 0x0090 0x000b 0x0200 DATA RW
Contents of memory from 0000 to 1000:
0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0080 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0100 30 f3 0f 00 00 00 20 31 40 13 fd ff ff ff 60 31
0110 70 08 01 00 00 00 00 00 00 00 00 00 00 00 00 00
0120 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0130 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0150 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0170 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0180 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0190 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0200 70 08 01 00 00 aa bb cc dd 00 00 00 00 00 00 00
0210 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0220 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0230 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0240 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0250 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0260 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0270 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0280 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0290 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
02a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
02b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
02c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
02d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
02e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
02f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0300 30 f3 0f 00 00 00 20 31 40 13 fd ff ff ff 60 31
0310 70 08 01 00 00 00 00 00 00 00 00 00 00 00 00 00
0320 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0330 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0340 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0350 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0360 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0370 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0380 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0390 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
03a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
03b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
03c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
03d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
03e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
03f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0400 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0410 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0420 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0430 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0440 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0450 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0460 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0470 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0480 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0490 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
04a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
04b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
04c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
04d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
04e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
04f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0500 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0510 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0520 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0530 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0540 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0550 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0560 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0570 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0580 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0590 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
05a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
05b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
05c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
05d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
05e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
05f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0600 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0610 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0620 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0630 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0640 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0650 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0660 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0670 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0680 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0690 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
06a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
06b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
06c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
06d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
06e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
06f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0700 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0710 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0720 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0730 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0740 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0750 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0760 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0770 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0780 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0790 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
07a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
07b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
07c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
07d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
07e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
07f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0800 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0810 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0820 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0830 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0840 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0850 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0860 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0870 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0880 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0890 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
08a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
08b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
08c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
08d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
08e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
08f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0900 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0910 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0920 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0930 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0940 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0950 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0960 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0970 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0980 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0990 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
09a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
09b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
09c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
09d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
09e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
09f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0aa0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ab0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ac0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ad0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ae0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0af0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ba0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0bb0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0bc0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0bd0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0be0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0bf0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ca0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0cb0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0cc0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0cd0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ce0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0cf0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0da0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0db0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0dc0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0dd0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0de0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0df0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ea0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0eb0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ec0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ed0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ee0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ef0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0fa0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0fb0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0fc0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0fd0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0fe0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ff0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

View File

@@ -0,0 +1,11 @@
01 00 00 01 10 00 04 00 00 00 00 00 45 4c 46 00
Mini-ELF version 1
Entry point 0x100
There are 4 program headers, starting at offset 16 (0x10)
There is no symbol table present
There is no string table present
Segment Offset Size VirtAddr Type Flags
00 0x0060 0x0015 0x0100 CODE R X
01 0x0075 0x000b 0x0200 DATA RW
02 0x0080 0x0015 0x0300 CODE R X
03 0x0090 0x000b 0x0200 DATA RW

View File

@@ -0,0 +1,6 @@
01 00 00 01 10 00 02 00 58 00 70 00 45 4c 46 00
Mini-ELF version 1
Entry point 0x100
There are 2 program headers, starting at offset 16 (0x10)
There is a symbol table starting at offset 88 (0x58)
There is a string table starting at offset 112 (0x70)

View File

@@ -0,0 +1,3 @@
Segment Offset Size VirtAddr Type Flags
00 0x0038 0x0015 0x0100 CODE R X
01 0x004d 0x000b 0x0200 DATA RW

View File

@@ -0,0 +1,260 @@
Segment Offset Size VirtAddr Type Flags
00 0x0038 0x0015 0x0100 CODE R X
01 0x004d 0x000b 0x0200 DATA RW
Contents of memory from 0000 to 1000:
0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0080 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0100 30 f3 0f 00 00 00 20 31 40 13 fd ff ff ff 60 31
0110 70 08 01 00 00 00 00 00 00 00 00 00 00 00 00 00
0120 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0130 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0150 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0170 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0180 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0190 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0200 aa bb cc dd 00 00 00 dd 00 00 00 00 00 00 00 00
0210 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0220 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0230 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0240 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0250 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0260 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0270 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0280 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0290 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
02a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
02b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
02c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
02d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
02e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
02f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0300 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0310 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0320 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0330 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0340 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0350 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0360 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0370 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0380 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0390 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
03a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
03b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
03c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
03d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
03e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
03f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0400 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0410 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0420 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0430 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0440 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0450 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0460 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0470 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0480 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0490 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
04a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
04b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
04c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
04d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
04e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
04f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0500 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0510 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0520 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0530 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0540 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0550 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0560 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0570 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0580 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0590 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
05a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
05b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
05c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
05d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
05e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
05f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0600 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0610 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0620 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0630 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0640 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0650 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0660 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0670 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0680 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0690 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
06a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
06b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
06c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
06d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
06e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
06f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0700 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0710 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0720 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0730 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0740 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0750 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0760 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0770 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0780 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0790 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
07a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
07b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
07c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
07d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
07e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
07f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0800 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0810 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0820 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0830 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0840 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0850 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0860 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0870 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0880 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0890 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
08a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
08b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
08c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
08d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
08e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
08f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0900 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0910 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0920 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0930 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0940 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0950 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0960 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0970 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0980 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0990 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
09a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
09b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
09c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
09d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
09e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
09f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0a90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0aa0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ab0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ac0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ad0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ae0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0af0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0b90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ba0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0bb0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0bc0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0bd0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0be0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0bf0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0c90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ca0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0cb0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0cc0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0cd0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ce0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0cf0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0d90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0da0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0db0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0dc0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0dd0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0de0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0df0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0e90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ea0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0eb0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ec0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ed0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ee0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ef0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0f90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0fa0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0fb0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0fc0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0fd0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0fe0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0ff0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,87 @@
#!/bin/bash
# extract executable name from Makefile
EXE=$(grep "EXE=" Makefile | sed -e "s/EXE=//")
# detect timeout utility (i.e., "timeout" on Linux and "gtimeout" on MacOS)
# and set timeout interval
TIMEOUT="timeout"
TIMEOUT_INTERVAL="3s"
$TIMEOUT --help &>/dev/null
if [[ $? -ne 0 ]]; then
TIMEOUT="gtimeout"
fi
# Valgrind additional output flags
VG_FLAGS="--leak-check=full --track-origins=yes"
function run_test {
# parameters
TAG=$1
ARGS=$2
PTAG=$(printf '%-30s' "$TAG")
# file paths
OUTPUT=outputs/$TAG.txt
DIFF=outputs/$TAG.diff
EXPECT=expected/$TAG.txt
VALGRND=valgrind/$TAG.txt
# run test with timeout
$TIMEOUT $TIMEOUT_INTERVAL $EXE $ARGS 2>/dev/null >"$OUTPUT"
if [ "$?" -lt 124 ]; then
# no timeout; compare output to the expected version
diff -u "$OUTPUT" "$EXPECT" >"$DIFF"
if [ -s "$DIFF" ]; then
# try alternative solution (if it exists)
EXPECT=expected/$TAG-2.txt
if [ -e "$EXPECT" ]; then
diff -u "$OUTPUT" "$EXPECT" >"$DIFF"
if [ -s "$DIFF" ]; then
echo "$PTAG FAIL (see ${TPREFIX}$DIFF for details)"
else
echo "$PTAG pass"
fi
else
echo "$PTAG FAIL (see ${TPREFIX}$DIFF for details)"
fi
else
echo "$PTAG pass"
fi
# run valgrind
$TIMEOUT $TIMEOUT_INTERVAL valgrind $VG_FLAGS $EXE $ARGS &>$VALGRND
else
echo "$PTAG FAIL (crash or timeout)"
fi
}
# initialize output folders
mkdir -p outputs
mkdir -p valgrind
rm -f outputs/* valgrind/*
# run individual tests
source itests.include
# check for memory leaks
LEAK=`cat valgrind/*.txt | grep 'definitely lost' | grep -v ' 0 bytes in 0 blocks'`
if [ -z "$LEAK" ]; then
echo "No memory leak found."
else
echo "Memory leak(s) found. See files listed below for details."
grep 'definitely lost' valgrind/*.txt | sed -e 's/:.*$//g' | awk "{print \" - ${TPREFIX}\" \$0}"
fi
# check for uninitialized values
LEAK=`cat valgrind/*.txt | grep 'uninitialised value'`
if [ -z "$LEAK" ]; then
echo "No uninitialized value found."
else
echo "Uninitialized value(s) found. See files listed below for details."
grep 'uninitialised value' valgrind/*.txt | sed -e 's/:.*$//g' | awk "{print \" - ${TPREFIX}\" \$0}"
fi

View File

@@ -0,0 +1,30 @@
# list of integration tests
# format: run_test <TAG> <ARGS>
# <TAG> used as the root for all filenames (i.e., "expected/$TAG.txt")
# <ARGS> command-line arguments to test
run_test C_help "-h"
run_test C_simple_H "-H inputs/simple.o"
run_test C_simple_s "-s inputs/simple.o"
run_test C_multiseg_sH "-sH inputs/multiseg.o"
run_test C_multiseg_f "-f inputs/multiseg.o"
run_test C_multiseg_fsHM "-fsHM inputs/multiseg.o"
run_test C_stripped_sM "-sM inputs/stripped.o"
run_test C_more_flags_s "-s inputs/moreflags.o"
run_test B_stripped_m "-m inputs/stripped.o"
run_test B_stripped_mH "-mH inputs/stripped.o"
run_test B_all_flags "-Hsma inputs/simple.o"
run_test B_repeated "-s -s -s inputs/simple.o"
run_test B_stack "-a inputs/stack.o"
run_test A_brief_full "-m -M inputs/simple.o"
run_test A_bad_phdr_vaddr "-m inputs/bad-phdr_vaddr.o"
run_test A_bad_phdr_short "-s inputs/bad-phdr_short.o"
run_test A_bad_phdr_magic "-s inputs/bad-phdr_magic.o"
run_test A_no_flags "inputs/simple.o"
run_test A_no_flags_bad "inputs/bad-phdr_short.o"
run_test A_missing_file "-a"
run_test A_extra_params "-a inputs/simple.o extra params"
run_test A_mem_conflict "-m -M inputs/simple.o"
run_test A_full_conflict "-m -f inputs/simple.o"
run_test A_unaligned1 "-a inputs/unaligned.o"
run_test A_unaligned2 "-a inputs/unaligned2.o"

27
p2-load/tests/itests.txt Normal file
View File

@@ -0,0 +1,27 @@
C_help pass
C_simple_H pass
C_simple_s pass
C_multiseg_sH pass
C_multiseg_f pass
C_multiseg_fsHM pass
C_stripped_sM pass
C_more_flags_s pass
B_stripped_m pass
B_stripped_mH pass
B_all_flags pass
B_repeated pass
B_stack pass
A_brief_full pass
A_bad_phdr_vaddr pass
A_bad_phdr_short pass
A_bad_phdr_magic pass
A_no_flags pass
A_no_flags_bad pass
A_missing_file pass
A_extra_params pass
A_mem_conflict pass
A_full_conflict pass
A_unaligned1 pass
A_unaligned2 pass
No memory leak found.
No uninitialized value found.

View File

@@ -0,0 +1 @@
Failed to read file

View File

@@ -0,0 +1 @@
Failed to read file

View File

@@ -0,0 +1 @@
Failed to read file

View File

View File

@@ -0,0 +1,9 @@
Usage: ../y86 <option(s)> mini-elf-file
Options are:
-h Display usage
-H Show the Mini-ELF header
-a Show all with brief memory
-f Show all with full memory
-s Show the program headers
-m Show the memory contents (brief)
-M Show the memory contents (full)

View File

@@ -0,0 +1,9 @@
Usage: ../y86 <option(s)> mini-elf-file
Options are:
-h Display usage
-H Show the Mini-ELF header
-a Show all with brief memory
-f Show all with full memory
-s Show the program headers
-m Show the memory contents (brief)
-M Show the memory contents (full)

View File

@@ -0,0 +1,9 @@
Usage: ../y86 <option(s)> mini-elf-file
Options are:
-h Display usage
-H Show the Mini-ELF header
-a Show all with brief memory
-f Show all with full memory
-s Show the program headers
-m Show the memory contents (brief)
-M Show the memory contents (full)

View File

@@ -0,0 +1,9 @@
Usage: ../y86 <option(s)> mini-elf-file
Options are:
-h Display usage
-H Show the Mini-ELF header
-a Show all with brief memory
-f Show all with full memory
-s Show the program headers
-m Show the memory contents (brief)
-M Show the memory contents (full)

Some files were not shown because too many files have changed in this diff Show More