100% found this document useful (1 vote)
11 views

Foundations of Linux Debugging, Disassembling, and Reversing: Analyze Binary Code, Understand Stack Memory Usage, and Reconstruct C/C++ Code with Intel x64 1st Edition Dmitry Vostokov pdf download

The document provides links to download various ebooks authored by Dmitry Vostokov, focusing on topics such as Linux debugging, ARM64 debugging, trace and log analysis, and Python debugging. It includes detailed information about the books, including their titles, editions, and links for access. Additionally, it contains copyright information and a table of contents for the book 'Foundations of Linux Debugging, Disassembling, and Reversing'.

Uploaded by

shirezahrau
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
11 views

Foundations of Linux Debugging, Disassembling, and Reversing: Analyze Binary Code, Understand Stack Memory Usage, and Reconstruct C/C++ Code with Intel x64 1st Edition Dmitry Vostokov pdf download

The document provides links to download various ebooks authored by Dmitry Vostokov, focusing on topics such as Linux debugging, ARM64 debugging, trace and log analysis, and Python debugging. It includes detailed information about the books, including their titles, editions, and links for access. Additionally, it contains copyright information and a table of contents for the book 'Foundations of Linux Debugging, Disassembling, and Reversing'.

Uploaded by

shirezahrau
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 80

Visit https://ebookmass.

com to download the full version and


browse more ebooks or textbooks

Foundations of Linux Debugging, Disassembling, and


Reversing: Analyze Binary Code, Understand Stack
Memory Usage, and Reconstruct C/C++ Code with
Intel x64 1st Edition Dmitry Vostokov

_____ Press the link below to begin your download _____

https://ebookmass.com/product/foundations-of-linux-
debugging-disassembling-and-reversing-analyze-binary-code-
understand-stack-memory-usage-and-reconstruct-c-c-code-with-
intel-x64-1st-edition-dmitry-vostokov/

Access ebookmass.com now to download high-quality


ebooks or textbooks
We believe these products will be a great fit for you. Click
the link to download now, or visit ebookmass.com
to discover even more!

Foundations of ARM64 Linux Debugging, Disassembling, and


Reversing: Analyze Code, Understand Stack Memory Usage,
and Reconstruct Original C/C++ Code with ARM64 1st Edition
Dmitry Vostokov
https://ebookmass.com/product/foundations-of-arm64-linux-debugging-
disassembling-and-reversing-analyze-code-understand-stack-memory-
usage-and-reconstruct-original-c-c-code-with-arm64-1st-edition-dmitry-
vostokov/

Foundations of ARM64 Linux Debugging, Disassembling, and


Reversing Dmitry Vostokov

https://ebookmass.com/product/foundations-of-arm64-linux-debugging-
disassembling-and-reversing-dmitry-vostokov/

Fundamentals of Trace and Log Analysis: A Pattern-Oriented


Approach to Monitoring, Diagnostics, and Debugging 1st
Edition Dmitry Vostokov
https://ebookmass.com/product/fundamentals-of-trace-and-log-analysis-
a-pattern-oriented-approach-to-monitoring-diagnostics-and-
debugging-1st-edition-dmitry-vostokov-2/

Fundamentals of Trace and Log Analysis A Pattern-Oriented


Approach to Monitoring, Diagnostics, and Debugging 1st
Edition Dmitry Vostokov
https://ebookmass.com/product/fundamentals-of-trace-and-log-analysis-
a-pattern-oriented-approach-to-monitoring-diagnostics-and-
debugging-1st-edition-dmitry-vostokov/
Python Debugging for AI, Machine Learning, and Cloud
Computing: A Pattern-Oriented Approach 1st Edition Dmitry
Vostokov
https://ebookmass.com/product/python-debugging-for-ai-machine-
learning-and-cloud-computing-a-pattern-oriented-approach-1st-edition-
dmitry-vostokov/

Visual Studio Code Distilled: Evolved Code Editing for


Windows, macOS, and Linux - Third Edition Alessandro Del
Sole
https://ebookmass.com/product/visual-studio-code-distilled-evolved-
code-editing-for-windows-macos-and-linux-third-edition-alessandro-del-
sole/

Visual Studio Code Distilled: Evolved Code Editing for


Windows, macOS, and Linux 3 / converted Edition Alessandro
Del Sole
https://ebookmass.com/product/visual-studio-code-distilled-evolved-
code-editing-for-windows-macos-and-linux-3-converted-edition-
alessandro-del-sole/

International Swimming Pool and Spa Code 2021 1st Edition


International Code Council

https://ebookmass.com/product/international-swimming-pool-and-spa-
code-2021-1st-edition-international-code-council/

International Fire Code (International Code Council


Series) 2021 1st Edition International Code Council

https://ebookmass.com/product/international-fire-code-international-
code-council-series-2021-1st-edition-international-code-council/
Foundations of Linux
Debugging, Disassembling,
and Reversing
Analyze Binary Code, Understand
Stack Memory Usage, and Reconstruct
C/C++ Code with Intel x64

Dmitry Vostokov
Foundations of Linux
Debugging,
Disassembling, and
Reversing
Analyze Binary Code,
Understand Stack Memory
Usage, and Reconstruct C/C++
Code with Intel x64

Dmitry Vostokov
Foundations of Linux Debugging, Disassembling, and Reversing: Analyze
Binary Code, Understand Stack Memory Usage, and Reconstruct C/C++
Code with Intel x64
Dmitry Vostokov
Dublin, Ireland

ISBN-13 (pbk): 978-1-4842-9152-8 ISBN-13 (electronic): 978-1-4842-9153-5


https://doi.org/10.1007/978-1-4842-9153-5

Copyright © 2023 by Dmitry Vostokov


This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or
part of the material is concerned, specifically the rights of translation, reprinting, reuse of
illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way,
and transmission or information storage and retrieval, electronic adaptation, computer software,
or by similar or dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark
symbol with every occurrence of a trademarked name, logo, or image we use the names, logos,
and images only in an editorial fashion and to the benefit of the trademark owner, with no
intention of infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if
they are not identified as such, is not to be taken as an expression of opinion as to whether or not
they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of
publication, neither the authors nor the editors nor the publisher can accept any legal
responsibility for any errors or omissions that may be made. The publisher makes no warranty,
express or implied, with respect to the material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Celestin Suresh John
Development Editor: James Markham
Coordinating Editor: Mark Powers
Cover designed by eStudioCalamar
Cover image by Eugene Golovesov on Unsplash (www.unsplash.com)
Distributed to the book trade worldwide by Apress Media, LLC, 1 New York Plaza, New York, NY
10004, U.S.A. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail [email protected],
or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member
(owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance
Inc is a Delaware corporation.
For information on translations, please e-mail [email protected]; for
reprint, paperback, or audio rights, please e-mail [email protected].
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook
versions and licenses are also available for most titles. For more information, reference our Print
and eBook Bulk Sales web page at http://www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is
available to readers on GitHub (https://github.com/Apress). For more detailed information,
please visit http://www.apress.com/source-code.
Printed on acid-free paper
Table of Contents
About the Author���������������������������������������������������������������������������������ix

About the Technical Reviewer�������������������������������������������������������������xi

Preface����������������������������������������������������������������������������������������������xiii

Chapter 1: Memory, Registers, and Simple Arithmetic�������������������������1


Memory and Registers Inside an Idealized Computer������������������������������������������1
Memory and Registers Inside Intel 64-Bit PC�������������������������������������������������������2
“Arithmetic” Project: Memory Layout and Registers��������������������������������������������3
“Arithmetic” Project: A Computer Program�����������������������������������������������������������5
“Arithmetic” Project: Assigning Numbers to Memory Locations���������������������������5
Assigning Numbers to Registers���������������������������������������������������������������������������8
“Arithmetic” Project: Adding Numbers to Memory Cells���������������������������������������8
Incrementing/Decrementing Numbers in Memory and Registers�����������������������11
Multiplying Numbers�������������������������������������������������������������������������������������������14
Summary������������������������������������������������������������������������������������������������������������17

Chapter 2: Code Optimization�������������������������������������������������������������19


“Arithmetic” Project: C/C++ Program�����������������������������������������������������������������19
Downloading GDB�����������������������������������������������������������������������������������������������20
GDB Disassembly Output – No Optimization�������������������������������������������������������20
GDB Disassembly Output – Optimization������������������������������������������������������������25
Summary������������������������������������������������������������������������������������������������������������26

iii
Table of Contents

Chapter 3: Number Representations��������������������������������������������������27


Numbers and Their Representations�������������������������������������������������������������������27
Decimal Representation (Base Ten)��������������������������������������������������������������������28
Ternary Representation (Base Three)������������������������������������������������������������������29
Binary Representation (Base Two)����������������������������������������������������������������������29
Hexadecimal Representation (Base Sixteen)������������������������������������������������������30
Why Are Hexadecimals Used?�����������������������������������������������������������������������������30
Summary������������������������������������������������������������������������������������������������������������32

Chapter 4: Pointers�����������������������������������������������������������������������������33
A Definition���������������������������������������������������������������������������������������������������������33
“Pointers” Project: Memory Layout and Registers����������������������������������������������34
“Pointers” Project: Calculations��������������������������������������������������������������������������36
Using Pointers to Assign Numbers to Memory Cells�������������������������������������������36
Adding Numbers Using Pointers�������������������������������������������������������������������������42
Incrementing Numbers Using Pointers���������������������������������������������������������������45
Multiplying Numbers Using Pointers�������������������������������������������������������������������48
Summary������������������������������������������������������������������������������������������������������������51

Chapter 5: Bytes, Words, Double, and Quad Words�����������������������������53


Using Hexadecimal Numbers������������������������������������������������������������������������������53
Byte Granularity��������������������������������������������������������������������������������������������������53
Bit Granularity�����������������������������������������������������������������������������������������������������54
Memory Layout���������������������������������������������������������������������������������������������������55
Summary������������������������������������������������������������������������������������������������������������58

Chapter 6: Pointers to Memory�����������������������������������������������������������59


Pointers Revisited�����������������������������������������������������������������������������������������������59
Addressing Types������������������������������������������������������������������������������������������������59

iv
Table of Contents

Registers Revisited���������������������������������������������������������������������������������������������65
NULL Pointers�����������������������������������������������������������������������������������������������������65
Invalid Pointers���������������������������������������������������������������������������������������������������65
Variables As Pointers������������������������������������������������������������������������������������������66
Pointer Initialization��������������������������������������������������������������������������������������������67
Initialized and Uninitialized Data�������������������������������������������������������������������������67
More Pseudo Notation�����������������������������������������������������������������������������������������68
“MemoryPointers” Project: Memory Layout�������������������������������������������������������68
Summary������������������������������������������������������������������������������������������������������������79

Chapter 7: Logical Instructions and RIP���������������������������������������������81


Instruction Format����������������������������������������������������������������������������������������������81
Logical Shift Instructions������������������������������������������������������������������������������������82
Logical Operations����������������������������������������������������������������������������������������������82
Zeroing Memory or Registers�����������������������������������������������������������������������������83
Instruction Pointer�����������������������������������������������������������������������������������������������84
Code Section�������������������������������������������������������������������������������������������������������85
Summary������������������������������������������������������������������������������������������������������������86

Chapter 8: Reconstructing a Program with Pointers��������������������������87


Example of Disassembly Output: No Optimization����������������������������������������������87
Reconstructing C/C++ Code: Part 1��������������������������������������������������������������������90
Reconstructing C/C++ Code: Part 2��������������������������������������������������������������������92
Reconstructing C/C++ Code: Part 3��������������������������������������������������������������������93
Reconstructing C/C++ Code: C/C++ Program����������������������������������������������������94
Example of Disassembly Output: Optimized Program�����������������������������������������95
Summary������������������������������������������������������������������������������������������������������������96

v
Table of Contents

Chapter 9: Memory and Stacks����������������������������������������������������������97


Stack: A Definition�����������������������������������������������������������������������������������������������97
Stack Implementation in Memory�����������������������������������������������������������������������98
Things to Remember�����������������������������������������������������������������������������������������100
PUSH Instruction�����������������������������������������������������������������������������������������������101
POP Instruction�������������������������������������������������������������������������������������������������101
Register Review������������������������������������������������������������������������������������������������102
Application Memory Simplified�������������������������������������������������������������������������105
Stack Overflow��������������������������������������������������������������������������������������������������105
Jumps���������������������������������������������������������������������������������������������������������������106
Calls������������������������������������������������������������������������������������������������������������������108
Call Stack����������������������������������������������������������������������������������������������������������110
Exploring Stack in GDB�������������������������������������������������������������������������������������112
Summary����������������������������������������������������������������������������������������������������������115

Chapter 10: Frame Pointer and Local Variables�������������������������������117


Stack Usage������������������������������������������������������������������������������������������������������117
Register Review������������������������������������������������������������������������������������������������118
Addressing Array Elements�������������������������������������������������������������������������������118
Stack Structure (No Function Parameters)�������������������������������������������������������119
Function Prolog�������������������������������������������������������������������������������������������������121
Raw Stack (No Local Variables and Function Parameters)�������������������������������121
Function Epilog�������������������������������������������������������������������������������������������������123
“Local Variables” Project����������������������������������������������������������������������������������124
Disassembly of Optimized Executable��������������������������������������������������������������127
Summary����������������������������������������������������������������������������������������������������������128

vi
Table of Contents

Chapter 11: Function Parameters�����������������������������������������������������129


“FunctionParameters” Project��������������������������������������������������������������������������129
Stack Structure�������������������������������������������������������������������������������������������������130
Function Prolog and Epilog�������������������������������������������������������������������������������132
Project Disassembled Code with Comments����������������������������������������������������133
Parameter Mismatch Problem��������������������������������������������������������������������������137
Summary����������������������������������������������������������������������������������������������������������138

Chapter 12: More Instructions����������������������������������������������������������139


CPU Flags Register��������������������������������������������������������������������������������������������139
The Fast Way to Fill Memory�����������������������������������������������������������������������������140
Testing for 0������������������������������������������������������������������������������������������������������141
TEST – Logical Compare�����������������������������������������������������������������������������������142
CMP – Compare Two Operands�������������������������������������������������������������������������143
TEST or CMP?���������������������������������������������������������������������������������������������������144
Conditional Jumps��������������������������������������������������������������������������������������������144
The Structure of Registers��������������������������������������������������������������������������������145
Function Return Value���������������������������������������������������������������������������������������146
Using Byte Registers�����������������������������������������������������������������������������������������146
Summary����������������������������������������������������������������������������������������������������������147

Chapter 13: Function Pointer Parameters����������������������������������������149


“FunctionPointerParameters” Project���������������������������������������������������������������149
Commented Disassembly���������������������������������������������������������������������������������150
Summary����������������������������������������������������������������������������������������������������������159

vii
Table of Contents

Chapter 14: Summary of Code Disassembly Patterns����������������������161


Function Prolog/Epilog��������������������������������������������������������������������������������������161
LEA (Load Effective Address)����������������������������������������������������������������������������164
Passing Parameters������������������������������������������������������������������������������������������164
Accessing Parameters and Local Variables������������������������������������������������������165
Summary����������������������������������������������������������������������������������������������������������166

Index�������������������������������������������������������������������������������������������������167

viii
About the Author
Dmitry Vostokov is an internationally
recognized expert, speaker, educator, scientist,
and author. He is the founder of the pattern-
oriented software diagnostics, forensics,
and prognostics discipline and Software
Diagnostics Institute (DA+TA: DumpAnalysis.
org + TraceAnalysis.org). Vostokov has also
authored more than 50 books on software
diagnostics, anomaly detection and analysis,
software and memory forensics, root cause analysis and problem solving,
memory dump analysis, debugging, software trace and log analysis,
reverse engineering, and malware analysis. He has more than 25 years
of experience in software architecture, design, development, and
maintenance in various industries, including leadership, technical, and
people management roles. Dmitry also founded Syndromatix, Anolog.
io, BriteTrace, DiaThings, Logtellect, OpenTask Iterative and Incremental
Publishing (OpenTask.com), Software Diagnostics Technology and
Services (former Memory Dump Analysis Services; PatternDiagnostics.
com), and Software Prognostics. In his spare time, he presents various
topics on Debugging TV and explores Software Narratology, its further
development as Narratology of Things and Diagnostics of Things (DoT),
and Software Pathology. His current areas of interest are theoretical
software diagnostics and its mathematical and computer science
foundations, application of artificial intelligence, machine learning and

ix
About the Author

data mining to diagnostics and anomaly detection, software diagnostics


engineering and diagnostics-driven development, and diagnostics
workflow and interaction. Recent areas of interest also include cloud
native computing, security, automation, functional programming, and
applications of category theory to software development and big data.

x
About the Technical Reviewer
Vikas Talan is a senior engineer at Qualcomm
(an American multinational corporation). He is
the founder of S.M.A.R.T Solutions, a technical
company. He also worked at MediaTek and
Cadence in core technical domains. He has
in-depth experience in Linux kernel
programming, Linux device drivers, ARM 64,
ARM, and porting of Android OS and Linux
drivers on chipsets. He hails from Delhi
NCR, India.

xi
Preface
The book covers topics ranging from Intel x64 assembly language
instructions and writing programs in assembly language to pointers, live
debugging, and static binary analysis of compiled C and C++ code.
Diagnostics of core memory dumps, live and postmortem debugging
of Linux applications, services, and systems, memory forensics, malware,
and vulnerability analysis require an understanding of x64 Intel assembly
language and how C and C++ compilers generate code, including
memory layout and pointers. This book is about background knowledge
and practical foundations that are needed to understand internal Linux
program structure and behavior, start working with the GDB debugger, and
use it for disassembly and reversing. It consists of practical step-by-step
exercises of increasing complexity with explanations and many diagrams,
including some necessary background topics.
By the end of the book, you will have a solid understanding of how
Linux C and C++ compilers generate binary code. In addition, you will be
able to analyze such code confidently, understand stack memory usage,
and reconstruct original C/C++ code.
The book will be useful for

• Software technical support and escalation engineers

• Software engineers coming from JVM background

• Software testers

• Engineers coming from non-Linux environments, for


example, Windows or Mac OS X

xiii
Preface

• Linux C/C++ software engineers without assembly


language background

• Security researchers without assembly language


background

• Beginners learning Linux software reverse engineering


techniques

This book can also be used as an x64 assembly language and Linux
debugging supplement for relevant undergraduate-level courses.

Source Code
All source code used in this book can be downloaded from github.com/
apress/linux-debugging-disassembling-reversing.

xiv
CHAPTER 1

Memory, Registers,
and Simple Arithmetic
 emory and Registers Inside
M
an Idealized Computer
Computer memory consists of a sequence of memory cells, and each cell
has a unique address (location). Every cell contains a “number.” We refer
to these “numbers” as contents at addresses (locations). Because memory
access is slower than arithmetic instructions, there are so-called registers
to speed up complex operations that require memory to store temporary
results. We can also think about them as stand-alone memory cells. The
name of a register is its address. Figure 1-1 illustrates this concept.

© Dmitry Vostokov 2023 1


D. Vostokov, Foundations of Linux Debugging, Disassembling, and Reversing,
https://doi.org/10.1007/978-1-4842-9153-5_1
Chapter 1 Memory, Registers, and Simple Arithmetic

Figure 1-1. Computer memory represented as a sequence of memory


cells and locations

 emory and Registers Inside Intel


M
64-Bit PC
Figure 1-2 shows addresses for memory locations containing integer
values usually differ by four or eight, and we also show two registers called
%RAX and %RDX. The first halves of them are called %EAX and %EDX.

2
Chapter 1 Memory, Registers, and Simple Arithmetic

Figure 1-2. Typical Intel x64 memory and register layout

Because memory cells contain “numbers,” we start with simple


arithmetic and ask a PC to compute the sum of two numbers to see how
memory and registers change their values.

“ Arithmetic” Project: Memory Layout


and Registers
For our project, we have two memory addresses (locations) that we call
“a” and “b.” We can think about “a” and “b” as names of their respective
addresses (locations). Now we introduce a special notation where (a) means

3
Chapter 1 Memory, Registers, and Simple Arithmetic

contents at the memory address (location) “a.” If we use the C or C++


language to write our project, we declare and define memory locations “a”
and “b” as

static int a, b;

By default, when we load a program, static memory locations are filled


with zeroes, and we can depict our initial memory layout after loading the
program, as shown in Figure 1-3.

Figure 1-3. Initial memory layout after loading the program

4
Chapter 1 Memory, Registers, and Simple Arithmetic

“Arithmetic” Project: A Computer Program


We can think of a computer program as a sequence of instructions for
the manipulation of contents of memory cells and registers. For example,
addition operation: add the contents of memory cell №12 to the contents
of memory cell №14. In our pseudo-code, we can write

(14) + (12) -> (14)

Our first program in pseudo-code is shown on the left of the table:

1 -> (a) Here, we put assembly instructions corresponding


1 -> (b) to pseudo-code.
(b) + (a) -> (b)
(a) + 1 -> (a)
(b) * (a) -> (b)

“->” means moving (assigning) the new value to the contents of a


memory location (address). “;” is a comment sign, and the rest of the line is
a comment. “=” shows the current value at a memory location (address).
To remind, a code written in a high-level programming language is
translated to a machine language by a compiler. However, the machine
language can be readable if its digital codes are represented in some
mnemonic system called assembly language. For example, INC a is
increment by one of what is stored at a memory location “a.”

“ Arithmetic” Project: Assigning Numbers


to Memory Locations
We remind that “a” means location (address) of the memory cell, and it is
also the name of the location (address) 000055555555802c (see Figure 1-3).
(a) means the contents (number) stored at the address “a.”

5
Chapter 1 Memory, Registers, and Simple Arithmetic

If we use the C or C++ language, “a” is called “the variable a,” and we
write the assignment as

a = 1;

In the Intel assembly language, we write

mov $1, a

In the GDB disassembly output, we see the following code where the
variable “a” and address are shown in comments:

movl   $0x1,0x2ef2(%rip)        # 0x55555555802c <a>

We show the translation of our pseudo-code into assembly language in


the right column:

1 -> (a)          ; (a) = 1 movl $1, a


1 -> (b)          ; (b) = 1 movl $1, b
(b) + (a) -> (b)
(a) + 1 -> (a)
(b) * (a) -> (b)

Notice movl instructions instead of mov. This is because “a” and “b”
can point to both 32-bit (like %EAX or %EDX registers) and 64-bit memory
cells (like %RAX and %RDX registers). In the registers’ case, it is clear from
their names whether we use 64-bit %RAX or 32-bit %EAX. But in the case
of memory addresses “a” and “b,” it is not clear whether they refer to 64-bit
or 32-bit cells. We use movl to disambiguate and show that we use 32-bit
memory cells that are enough to hold integers from 0 to 4294967295.
0x2ef2(%rip) is how the compiler generates code to calculate the
address “a” instead of specifying it directly. Such code requires less
memory space. We explain this in later chapters.

6
Chapter 1 Memory, Registers, and Simple Arithmetic

Literal constants have the $ prefix, for example, $0x1. The 0x prefix
means the following number is hexadecimal. The leading four zeroes of
the address are also omitted in the comment. We explain such numbers in
Chapter 3. Please also notice that the movement direction is the same in
both the disassembly output and the pseudo-code: from left to right.
After executing the first two assembly language instructions, we have
the memory layout shown in Figure 1-4.

Figure 1-4. Memory layout after executing the first two assembly
language instructions

7
Chapter 1 Memory, Registers, and Simple Arithmetic

Assigning Numbers to Registers


This is similar to memory assignments. We can write in pseudo-code:

1 -> register
(a) -> register

Note that we do not use brackets when we refer to register contents.


The latter instruction means assigning (copying) the number at the
location (address) “a” to a register.
In assembly language, we write

mov  $1, %eax   # 1 is copied to the first half of %RAX


register
mov  $1, %rax   # full contents of %RAX register are
replaced with 1
mov  a, %eax
mov  a, %rax

In the GDB disassembly output, we may see the following code:

mov    $0x0,%eax

“ Arithmetic” Project: Adding Numbers


to Memory Cells
Now let’s look at the following pseudo-code statement in more detail:

(b) + (a) -> (b)

To recall, “a” and “b” mean the names of locations (addresses)


000055555555802c and 0000555555558030, respectively (see Figure 1-4).
(a) and (b) mean contents at addresses “a” and “b,” respectively, simply
some numbers stored there.

8
Chapter 1 Memory, Registers, and Simple Arithmetic

In the C or C++ language, we write the following statement:

b = b + a;
b += a;

In assembly language, we use the instruction ADD. Because of AMD64


and Intel EM64T architecture’s limitations, we cannot use both memory
addresses in one step (instruction), for example, add a, b. We can only use
the add register, b instruction to add the value stored in the register to
the contents of the memory cell b. Recall that a register is like a temporary
memory cell itself here:

(a) -> register


(b) + register -> (b)

Alternatively, we can use two registers:

(a) -> register1


(b) -> register2
register2 + register1 -> register2
register2 -> (b)

In assembly language, we write

mov a, %eax
add %eax, b

or we can add two registers and move the result to the memory cell b:

mov b, %edx
mov a, %eax
add %edx, %eax
mov %eax, b

9
Chapter 1 Memory, Registers, and Simple Arithmetic

In the GDB disassembly output, we may see the following code:

mov    0x2ee6(%rip),%edx        # 0x555555558030 <b>


mov    0x2edc(%rip),%eax        # 0x55555555802c <a>
add    %edx,%eax
mov    %eax,0x2ed8(%rip)        # 0x555555558030 <b>

Now we can translate our pseudo-code into assembly language:

1 -> (a)          ; (a) = 1 movl $1, a


1 -> (b)          ; (b) = 1 movl $1, b
(b) + (a) -> (b)  ; %eax = 1 mov a, %eax
; %edx = 1     mov  b, %edx
; %eax = 2
   add  %edx, %eax
; (b) = 2
   mov %eax, b
(a) + 1 -> (a)
(b) * (a) -> (b)

After the execution of ADD and MOV instructions, we have the


memory layout illustrated in Figure 1-5.

10
Chapter 1 Memory, Registers, and Simple Arithmetic

Figure 1-5. Memory layout after executing ADD and MOV


instructions

Incrementing/Decrementing Numbers
in Memory and Registers
In pseudo-code, it looks simple and means increment (decrement) a
number stored at the location (address) “a”:

(a) + 1 -> (a)


(a) – 1 -> (a)

11
Chapter 1 Memory, Registers, and Simple Arithmetic

In the C or C++ language, we can write this using three possible ways:

a = a + 1;
++a;
a++;
b = b – 1;
--b;
b--;

In assembly language, we use instructions INC and DEC and write

incl    a
inc     %eax
decl    a
dec     %eax

We use incl when we need to specify the 32-bit memory cell. It is


ambiguous when we use “a.” However, using %eax implies using 32-bit
values, so inc is unambiguous.
In the GDB disassembly output, we may see the same instruction:

inc    %eax

or

add    $0x1,%eax   # a compiler may decide to use ADD


instead of INC

12
Chapter 1 Memory, Registers, and Simple Arithmetic

Now we add the assembly language translation of increment:

1 -> (a)          ; (a) = 1 movl $1, a


1 -> (b)          ; (b) = 1 movl $1, b
(b) + (a) -> (b)  ; %eax = 1 mov a, %eax
; %edx = 1 mov  b, %edx
; %eax = 2 add  %edx, %eax
; (b) = 2 mov %eax, b
(a) + 1 -> (a)    ; %eax = 1 mov  a, %eax
; %eax = 2 add  $1, %eax
; (a) = 2 mov  %eax, a
(b) * (a) -> (b)

After the execution of INC or ADD instruction, we have the memory


layout illustrated in Figure 1-6.

13
Chapter 1 Memory, Registers, and Simple Arithmetic

Figure 1-6. Memory layout after the execution of INC or ADD


instruction

Multiplying Numbers
In pseudo-code, we write

(b) * (a) -> (b)

It means that we multiply the number at the location (address) “b” by


the number at the location (address) “a.”
In the C or C++ language, we can write that using two ways:

b =  b * a;
b *= a;

14
Chapter 1 Memory, Registers, and Simple Arithmetic

In assembly language, we use instruction IMUL (Integer MULtiply)


and write

mov  a, %eax
imul b, %eax
mov  %eax, b

The multiplication instruction means (b) * %eax -> %eax, and we


must put the contents of “a” into %EAX. The multiplication result is put
into the register %EAX, and its contents are saved at the location (address)
“b.” Alternatively, we may put all multiplication operands into registers:

mov  a, %eax
mov  b, %edx
imul %edx, %eax
mov  %eax, b

In the GDB disassembly output, we may see the following code:

mov    0x2ec3(%rip),%edx        # 0x555555558030 <b>


mov    0x2eb9(%rip),%eax        # 0x55555555802c <a>
imul   %edx,%eax
mov    %eax,0x2eb4(%rip)        # 0x555555558030 <b>

15
Chapter 1 Memory, Registers, and Simple Arithmetic

Now we add two additional assembly instructions to our pseudo-code


assembly language translation:

1 -> (a)          ; (a) = 1 movl $1, a


1 -> (b)          ; (b) = 1 movl $1, b
(b) + (a) -> (b)  ; %eax = 1 mov a, %eax
; %edx = 1 mov  b, %edx
; %eax = 2 add  %edx, %eax
; (b) = 2 mov %eax, b
(a) + 1 -> (a)    ; %eax = 1 mov  a, %eax
; %eax = 2 add  $1, %eax
; (a) = 2 mov  %eax, a
(b) * (a) -> (b)  ; %edx = 2 mov  b, %edx
; %eax = 2 mov  a, %eax
; %eax = 4 imul %edx, %eax
; (b) = 4 mov  %eax, b

After the execution of IMUL and MOV instructions, we have the


memory layout illustrated in Figure 1-7.

16
Chapter 1 Memory, Registers, and Simple Arithmetic

Figure 1-7. Memory layout after the execution of IMUL and MOV
instructions

Summary
This chapter introduced CPU registers and explained the memory layout
of a simple arithmetic program. We learned basic x64 instructions and
manually translated simple C and C++ code to assembly language.
The next chapter looks at assembly language code produced by a
debugger via disassembling binary code. Then, we reverse it to C and C++
code. We also compare the disassembly output of nonoptimized code to
optimized code.

17
CHAPTER 2

Code Optimization
“Arithmetic” Project: C/C++ Program
Let’s rewrite our “Arithmetic” program in C/C++. Corresponding assembly
language instructions are put in comments:

int a, b;

int main(int argc, char* argv[])


{
      a = 1;               // movl $1, a

      b = 1;               // movl $1, b

      b = b + a;           // mov  a, %eax


                           // mov  b, %edx
                           // add  %edx, %eax
                           // mov  %eax, b

      ++a;                 // mov  a, %eax


                           // add  $1, %eax
                           // mov  %eax, a

© Dmitry Vostokov 2023 19


D. Vostokov, Foundations of Linux Debugging, Disassembling, and Reversing,
https://doi.org/10.1007/978-1-4842-9153-5_2
Chapter 2 Code Optimization

      b = b * a;           // mov  b, %edx


                           // mov  a, %eax
                           // imul %edx, %eax
                           // mov  %eax, b

                           // results: (a) = 2 and (b) = 4


      return 0;
}

Downloading GDB
We used WSL2 and "Debian GNU/Linux 10 (buster)" as a working
environment. We chose Debian because we used it for the “Accelerated
Linux Core Dump Analysis” training course.1 After installing Debian, we
need to install essential build tools and GDB:

sudo apt install build-essential


sudo apt install gdb

You may also need to download git to clone source code:

sudo apt install git


cd ~
git clone github.com/apress/linux-debugging-disassembling-­
reversing .

GDB Disassembly Output – No Optimization


The source code can be downloaded from the following location:
github.com/apress/linux-debugging-disassembling-reversing/
Chapter2/

1
www.dumpanalysis.org/accelerated-linux-core-dump-analysis-book

20
Chapter 2 Code Optimization

If we compile and link the program in no optimization mode (default):

coredump@DESKTOP-IS6V2L0:~/pflddr/x64/Chapter2$ gcc
ArithmeticProjectC.cpp -o ArithmeticProjectC

we get the binary executable module we can load in GDB and inspect
assembly code.
First, we run GDB with the program as a parameter:

coredump@DESKTOP-IS6V2L0:~/pflddr/x64/Chapter2$ gdb ./
ArithmeticProjectC
GNU gdb (Debian 8.2.1-2+b3) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/
licenses/gpl.html>
This is free software: you are free to change and
redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources
online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".


Type "apropos word" to search for commands related to "word"...
Reading symbols from ./ArithmeticProjectC...(no debugging
symbols found)...done.
(gdb)

21
Chapter 2 Code Optimization

Next, we put a breakpoint at our main C/C++ function to allow the


program execution to stop at that point and give us a chance to inspect
memory and registers. Symbolic names/function names like "main" can be
used instead of code memory locations:

(gdb) break main


Breakpoint 1 at 0x1129

Then we start execution of the program (let it run). The program then
stops at the previously set breakpoint:

(gdb) run
Starting program: /home/coredump/pflddr/x64/Chapter2/
ArithmeticProjectC

Breakpoint 1, 0x0000555555555129 in main ()

Now we disassemble the main function:

(gdb) disass main


Dump of assembler code for function main:
   0x0000555555555125 <+0>:     push   %rbp
   0x0000555555555126 <+1>:     mov    %rsp,%rbp
=> 0x0000555555555129 <+4>:     mov    %edi,-0x4(%rbp)
   0x000055555555512c <+7>:     mov    %rsi,-0x10(%rbp)
   0x0000555555555130 <+11>:    movl   $0x1,0x2ef2(%rip)        
# 0x55555555802c <a>
   0x000055555555513a <+21>:    movl   $0x1,0x2eec(%rip)        
# 0x555555558030 <b>
   0x0000555555555144 <+31>:    mov    0x2ee6(%rip),%edx        
# 0x555555558030 <b>
   0x000055555555514a <+37>:    mov    0x2edc(%rip),%eax        
# 0x55555555802c <a>
   0x0000555555555150 <+43>:    add    %edx,%eax

22
Chapter 2 Code Optimization

   0x0000555555555152 <+45>:    mov    %eax,0x2ed8(%rip)        
# 0x555555558030 <b>
   0x0000555555555158 <+51>:    mov    0x2ece(%rip),%eax        
# 0x55555555802c <a>
   0x000055555555515e <+57>:    add    $0x1,%eax
   0x0000555555555161 <+60>:    mov    %eax,0x2ec5(%rip)        
# 0x55555555802c <a>
   0x0000555555555167 <+66>:    mov    0x2ec3(%rip),%edx        
# 0x555555558030 <b>
   0x000055555555516d <+72>:    mov    0x2eb9(%rip),%eax        
# 0x55555555802c <a>
   0x0000555555555173 <+78>:    imul   %edx,%eax
   0x0000555555555176 <+81>:    mov    %eax,0x2eb4(%rip)        
# 0x555555558030 <b>
   0x000055555555517c <+87>:    mov    $0x0,%eax
   0x0000555555555181 <+92>:    pop    %rbp
   0x0000555555555182 <+93>:    retq
End of assembler dump.

We repeat the part of the formatted disassembly output here that


corresponds to our C/C++ code:

   0x0000555555555130 <+11>:    movl   $0x1,0x2ef2(%rip)        
# 0x55555555802c <a>
   0x000055555555513a <+21>:    movl   $0x1,0x2eec(%rip)        
# 0x555555558030 <b>
   0x0000555555555144 <+31>:    mov    0x2ee6(%rip),%edx        
# 0x555555558030 <b>
   0x000055555555514a <+37>:    mov    0x2edc(%rip),%eax        
# 0x55555555802c <a>
   0x0000555555555150 <+43>:    add    %edx,%eax

23
Chapter 2 Code Optimization

   0x0000555555555152 <+45>:    mov    %eax,0x2ed8(%rip)        
# 0x555555558030 <b>
   0x0000555555555158 <+51>:    mov    0x2ece(%rip),%eax        
# 0x55555555802c <a>
   0x000055555555515e <+57>:    add    $0x1,%eax
   0x0000555555555161 <+60>:    mov    %eax,0x2ec5(%rip)        
# 0x55555555802c <a>
   0x0000555555555167 <+66>:    mov    0x2ec3(%rip),%edx        
# 0x555555558030 <b>
   0x000055555555516d <+72>:    mov    0x2eb9(%rip),%eax        
# 0x55555555802c <a>
   0x0000555555555173 <+78>:    imul   %edx,%eax
   0x0000555555555176 <+81>:    mov    %eax,0x2eb4(%rip)        
# 0x555555558030 <b>

We can directly translate it to bare assembly code we used in the


previous chapter and put corresponding pseudo-code in comments:

movl   $1, a              # 1 -> (a)


movl   $1, b              # 1 -> (b)
mov    b, %edx            # (b) + (a) -> (b)
mov    a, %eax
add    %edx, %eax
mov    %eax, b
mov    a, %eax            # (a) + 1 -> (a)
add    $1, %eax
mov    %eax, a
mov    b, %edx            # (b) * (a) -> (b)
mov    a, %eax
imul   %edx, %eax
mov    %eax, b

24
Chapter 2 Code Optimization

Now we can exit GDB:

(gdb) q
A debugging session is active.

        Inferior 1 [process 2249] will be killed.

Quit anyway? (y or n) y
coredump@DESKTOP-IS6V2L0:~/pflddr/x64/Chapter2$

GDB Disassembly Output – Optimization


If we compile and link the program in optimization mode:

coredump@DESKTOP-IS6V2L0:~/pflddr/x64/Chapter2$ gcc
ArithmeticProjectC.cpp -O1 -o ArithmeticProjectC

and after repeating the same steps in GDB, we get the following output:

(gdb) disass main


Dump of assembler code for function main:
=> 0x0000555555555125 <+0>:     movl   $0x2,0x2f01(%rip)        
# 0x555555558030 <a>
   0x000055555555512f <+10>:    movl   $0x4,0x2ef3(%rip)        
# 0x55555555802c <b>
   0x0000555555555139 <+20>:    mov    $0x0,%eax
   0x000055555555513e <+25>:    retq
End of assembler dump.

This corresponds to the following pseudo-code:

mov $2, a   # 2 -> (a)


mov $4, b   # 4 -> (b)

Please note that the compiler also chose to put memory cell “b” first
(000055555555802c) and then memory cell “a” (0000555555558030).

25
Chapter 2 Code Optimization

What happened to all our assembly code in this executable? This code
seems to be directly placing the end result into the “b” memory cell if we
observe. Why is this happening? The answer lies in compiler optimization.
When the code is compiled in optimization mode, the compiler can
calculate the final result from the simple C/C++ source code itself and
generate only the necessary code to update corresponding memory
locations.

Summary
In this chapter, we looked at assembly language code produced by a
debugger via disassembling binary code. Then, we reversed it to C and C++
code. We also compared the disassembly output of nonoptimized code to
optimized code and understood why.
The next chapter refreshes number representations, especially the
hexadecimal one.

26
CHAPTER 3

Number
Representations
Numbers and Their Representations
Imagine a herder in ancient times trying to count his sheep. He has a
certain number of stones (twelve):

However, he can only count up to three and arranges the total into
groups of three:

© Dmitry Vostokov 2023 27


D. Vostokov, Foundations of Linux Debugging, Disassembling, and Reversing,
https://doi.org/10.1007/978-1-4842-9153-5_3
Chapter 3 Number Representations

The last picture is a representation (a kind of notation) of the number


of stones. We have one group of three groups of three stones plus a
separate group of three stones. If he could count up to ten, we would see a
different representation of the same number of stones. We would have one
group of ten stones and another group of two stones.

Decimal Representation (Base Ten)


Let’s now see how twelve stones are represented in arithmetic notation if
we can count up to ten. We have one group of ten numbers plus two:

12dec = 1 * 10 + 2 or 1 * 101 + 2 * 100

Here is another exercise with 123 stones. We have 1 group of ten by


ten stones, another group of 2 groups of ten stones, and the last group
of 3 stones:

123dec = 1 * 10*10 + 2 * 10 + 3 or 1 * 102 + 2 * 101 + 3 * 100

We can formalize it in the following summation notation:

Ndec = an*10n + an-1*10n-1 + … + a2*102 + a1*101 + a0*100


0 <= ai <= 9
Using the summation symbol, we have this formula:

n
Ndec = ∑ ai*10i
i=0

28
Chapter 3 Number Representations

Ternary Representation (Base Three)


Now we come back to our herder’s example of twelve stones. We have 1
group of three by three stones, 1 group of three stones, and an empty (0)
group (which is not empty if we have one stone only or have thirteen
stones instead of twelve). We can write down the number of groups
sequentially: 110. Therefore, 110 is a ternary representation (notation) of
twelve stones, and it is equivalent to 12 written in decimal notation:

12dec = 1*32 + 1*31 + 0*30

Ndec = an*3n + an-1*3n-1 + … + a2*32 + a1*31 + a0*30


ai = 0 or 1 or 2

n
Ndec = ∑ ai*3i
i=0

Binary Representation (Base Two)


In the case of counting up to two, we have more groups for twelve stones:
1100. Therefore, 1100 is a binary representation (notation) for 12 in
decimal notation:

12dec = 1*23 + 1*22 + 0*21 + 0*20

123dec = 1*26 + 1*25 + 1*24 + 1*23 + 0*22 + 1*21 + 1*20 or


11110112

Ndec = an*2n + an-1*2n-1 + … + a2*22 + a1*21 + a0*20


ai = 0 or 1

n
Ndec = ∑ ai*2i
i=0

29
Chapter 3 Number Representations

Hexadecimal Representation (Base Sixteen)


If we can count up to sixteen, twelve stones fit in one group, but we
need more symbols: A, B, C, D, E, and F for ten, eleven, twelve, thirteen,
fourteen, and fifteen, respectively:
12dec = C in hexadecimal representation (notation)

123dec = 7Bhex

123dec = 7*161 + 11*160

n
Ndec = ∑ ai*16i
i=0

Why Are Hexadecimals Used?


Consider this number written in binary notation: 1100010100112. Its
equivalent in decimal notation is 3155:

3155dec = 1*211 + 1*210 + 0*29 + 0*28 + 0*27 + 1*26 + 0*25


+ 1*24 + 0*23 + 0*22 + 1*21 + 1*20

Now we divide the binary number digits into groups of four and write
them down in decimal and hexadecimal notation:

110001010011

12dec 5dec 3dec

Chex 5hex 3hex

We see that hexadecimal notation is more compact because every


four binary digit group number corresponds to one hexadecimal number.
Table 3-1 lists hexadecimal equivalents for every four binary digit
combination.

30
Chapter 3 Number Representations

Table 3-1. Hexadecimal Equivalents for Every Four


Binary Digit Combination
Binary Decimal Hexadecimal

0000 0 0
0001 1 1
0010 2 2
0011 3 3
0100 4 4
0101 5 5
0110 6 6
0111 7 7
1000 8 8
1001 9 9
1010 10 A
1011 11 B
1100 12 C
1101 13 D
1110 14 E
1111 15 F

In GDB and other debuggers, memory addresses are displayed in


hexadecimal notation.

31
Chapter 3 Number Representations

Summary
This chapter refreshed different representations of a number, including
hexadecimal notation.
The next chapter introduces pointers. We rewrite our arithmetic
program from Chapter 1 using pointers to memory and use the GDB
debugger to execute instructions one by one and watch changes
to memory.

32
Other documents randomly have
different content
ORNITHOLOGY.

PLATE XXXIII.

PSITTACUS MACULATUS
SPOTTED BREASTED PARRAKEET.

Picæ.

GENERIC CHARACTER.
Bill falcated; upper mandible moveable and in general covered
with a cere: nostrils rounded, placed in the base of the bill: tongue
fleshy, obtuse, entire: feet formed for climbing.

SPECIFIC CHARACTER.
Green: crown, hind, head and nape black: temples cinereous:
throat, neck, and breast fuscous with the margins of the feather
sulphureous: shoulder scarlet: rump and middle of the abdomen
sanguineous.
Psittacus Maculatus: viridis: vertice, occipite, nuchaque nigris:
temporibus cinereis: gula, collo, pectoreque fuscis
marginibus pennarum sulphureis: humeris coccineis:
uropygio abdomineque medio sanguineis.
A very rare species of the Parrakeet tribe, and which is presumed
to be a native of South America.
The length of this bird is nine inches and a half; the bill and legs
blackish. The prevailing colour of the plumage green, front and
crown of the head blueish green, the rest of the head and neck
black: the feathers upon the face glossed with blue: a large ovate
cinereous spot on the cheeks: throat and breast black varied with
pale yellowish scollops, the margin of the feathers being a pale
sulphureous yellow, the disk black: the black disk usually forming a
kind of triangular spot with the point tending downwards. The wings
are green, except the quill feathers, which are blue, and the butt of
the wing or shoulder the colour of which is scarlet. The body
beneath green with a large spot of sanguineous-purple on the
abdomen. The lower part of the back and rump the same
sanguineous purple colour as the abdominal spot: tail above green,
the feathers purplish towards the end; beneath rufous brown.
This curious bird is nearly allied to Psittacus Squammosus, the
Scaly Breasted Parrakeet, and in no very remote degree with
another kind of Parrakeet, the Wavy Breasted Parrot, Psittacus
Lineatus. The first of these our bird exceeds by at least an inch in
length, the other by an inch and a quarter. Instead of the dark
colours of the head, as in our bird, the head and neck of P.
Squammosus are dull orange. The darker colouring of our bird
assimilates more nearly with Psittacus Lineatus, but in other respects
is entirely different. We have considered it as a new species, at the
same time that it must be observed from the very close analogy that
prevails between this bird and the Scaly Breasted Parrakeet, it may
possibly prove hereafter to be the adult bird of that kind rather than
a distinct species.
34

London. Published by E. Donovan & Mess.rs Simpkin & Marshall, March 1, 1823.
CONCHOLOGY.

PLATE XXXIV.

TEREBRATULA SANGUINEA
SANGUINEOUS LAMP-ANOMIA,
TEREBRATULA,
OR,
LAMP COCKLE.

Bivalve.

GENERIC CHARACTER.
Shell inequivalve regular, somewhat triagonal: upper valve
imperforate, lower valve beaked above the hinge, the beak usually
incurvate, perforated at the tip, or grooved, for the passage of a
short tendinous pedicle, by means of which it adheres to other
bodies: Hinge with two teeth, and furnished with two osseous
elevated and furcated processes arising from the disk of the upper or
smaller valve, destined to support the animal.

SPECIFIC CHARACTER
AND
SYNONYMS.
Shell red, ventricose, suborbicular, longitudinally ribbed: upper
valve depressed in the middle; the lower with the back elevated.
Terebratula Sanguinea: testa rubrâ ventricosa, suborbiculata,
longitudinaliter costata: valva superiore in medio excavato:
inferiore dorso elevato, apice incurvato perforato.
Anomia Sanguinea. Obovata longitudinaliter sulcata, triloba; sinu
profundo, nate producta latere angulata foramen ambiente.
Solanders MSS.—Hab. in O. Pacifico. G. R. Forster.
Anomia Sanguinea. Portland Catalogue.
Anomia Sanguinea. Leverian Cat. sec. part. p. 15.
Anomia Sanguinea. Dillwyn’s Conch. 1. 293. 21.
Terebratula Sanguinea. Leach. Zool. Misc. t. 76.
Terebratula Sanguinea. Lamarck Anim. sans. Vert. T. 6. p. 1. p. 243.
Lampas Sanguineus, La Sanguinolente (Anomia Sanguinea S.)
Calonne Cat. Humph. MS.

This is one among the number of those very choice accessions to


the Conchological knowledge of the last century, that was derived
from the scientific labours of our first circumnavigators in the
Southern Ocean: it occurred to them upon the coast of New
Zealand, not in any abundance, but so far plentifully that after the
Banksian Cabinet was supplied there were several specimens to
spare for distribution among the friends of Sir Joseph Banks, Dr.
Solander, and Captain Cook. From this little store the species passed
in the first instance into several collections, and among others into
that of the late Duchess of Portland, Dr. Chauncey, Mr. Cracherode,
Mr. G. Humphrey, and some others. It has since occurred, but not in
any abundance to later voyagers in those seas. And it is reputed also
to have been met with in the Straits of Magellan.
The specimen of this rare shell which we have delineated, and
which always was considered as one of the largest of its species
known, once constituted part of the Testaceological collection of Sir
Ashton Lever, having been presented to that eminent collector by
Captain Cook, at the time of his return to England after his first
voyage. There is a small hole pierced through the upper valve of this
shell, and which, in the absence of all other information, induces the
persuasion of its having been originally suspended like several other
shells we have already mentioned, as an ornament or appendage to
the dress of some New Zealander; the aperture being so designed
that the two valves could easily have been kept together by means
of a string passing through this hole of the upper valve, and the
opening in the beak of the lower one. The animal inhabitant is
probably eaten by the New Zealanders, who besides being cannibals,
subsist chiefly upon the marine productions of their shores, which
their wives and female children obtain daily for them by swimming
and diving into the sea. There is a rare species found in the
Mediterranean Sea, Anomia Vitrea of Gmelin, which nearly
approaches this species in point of size, and is eagerly sought after,
we are told, by the people of those parts as a delicious food. We
should, however, imagine from its scarcity, that it is only at the
tables of the rich that this luxurious repast appears.
In adopting the genus Terebratula for the shell before us, some
explanation may be expected for our departure from the Linnæan
classification, for in the system of that author it is one of the Anomia
Tribe, the term and character of Terebratula not being recognised by
that author as generically distinct from the Anomia. Our reasons for
this deviation shall be explained as briefly as it is possible: from the
nature of those remarks, and the extent of enquiry with which it is
connected, this cannot however be comprised within very slender
limits.
In the Linnæan arrangement, the Anomia form a very
comprehensive genus, and since in particular the fossil species are
included it should certainly have been divided into several distinct
sections or families in order to embrace the different tribes of those
shells, which according to the character Linnæus has given of the
genus must necessarily be referred to it. It is impossible without
some modification of this kind to reconcile Anomia Ephippium and
Cepa, with Anomia Caput Serpentinus or Terebratula, or either of
them with A. Placenta; and there are besides these some other
families which do not well accord, and which might perhaps be
separated into distinct genera with great advantage, the fossil kinds
especially, which are very numerous and much diversified in
structure. It cannot be very material whether they be so divided into
genera or be placed in different families under the general
appellation of Anomiæ: they are obviously very dissimilar and should
be kept apart, and we have examples of both these modes of
classing the Anomiæ among the early Naturalists.
A late french writer, M. Bosc, speaking of this tribe of shells,
observes, that Linnæus having confounded the Terebratules with the
Anomies, Bruguière first established their differences, and Lamarck
had fixed their characters. This observation is not sufficiently explicit,
and may possibly imply more than the author of it has intended. It
assumes as a conclusion that Linnæus committed an error in
confounding these two genera, without informing us in what state of
arrangement Linnæus found them. It may be inferred from this that
they had been more accurately discriminated before his time, or on
the contrary, that they never had been classed in any form, and that
it was the want of knowledge in Linnæus which led him to confound
shells together that were generically distinct. But whichever we are
to understand, the conclusion is, that Linnæus had confounded
them, and that it remained for Bruguière and Lamarck to reform
those errors of Linnæus, which all later Naturalists had left
uncorrected, if not unobserved. Now really this view of the subject is
not fairly taken if such an inference be intended. The result of a very
little enquiry among the authors who preceded Linnæus, or were
immediately subsequent to him, will assure us of the truth of this;
and will convince us beyond a doubt, that the discrimination of
neither of those authors was necessary either to furnish the
Naturalists of the present day with the term Terebratula; to
determine the differences that exist between them and the Anomiæ,
or to fix the characters by which the Terebratulæ are distinguished.
The Anomia genus, instead of being devised by Linnæus, or
Terebratula in particular, owing its invention to any modern writer,
have been both so long established that the greatest difficulty is to
determine where in the retrospect of authors our enquiries are to
cease. Without proceeding further back than the last two centuries,
it may be observed that Fabius Columna in his work “De Purpura,”
published at Rome in the year 1616, speaks of the Anomiæ; he calls
them Conchæ rariores Anomiæ, and from that period at least the
term Anomia has been received among Naturalists. Nor is the term
Terebratula of much later origin. Da Costa in his Elements of
Conchology informs us that from the time of Fabius Columna the
word Anomia had become universal, that is as a general
denomination for all the shells which Linnæus subsequently placed
together under that name. The term Terebratula was given, says this
writer, by Gualtieri; in plate 96 of his work, Gualtieri figures three
recent kinds, and has made a particular genus for them, which he
calls Terebratula. And it is further added in another place “the
Anomiæ are bivalves with unequal valves, and never eared, the beak
of the largest or under valve is greatly produced, and rises or curves
over the beak of the smaller or upper valve, and is perforated or
pierced through like a tube, from which particular they have also
obtained the name of Terebratulæ.”
These remarks sufficiently establish the circumstance of the term
Anomia, being a comprehensive title for all the shells which Linnæus
subsequently placed together under that name, and also shews that
we are not indebted to either Bruguière or Lamarck for
discriminating the Terebratulæ. We can ever go further back in this
particular than Da Costa has done, for that able author is mistaken
in supposing Gualtieri to be the first writer who had proposed the
genus Terebratula. Gualtieri published his work in the year 1724, and
we happen to possess among other valuable MSS. of the celebrated
Antiquarian, Hearne, the original copy of Lluid’s Lithophylacia
Britannica, as corrected for the press, dated Montgomery, 1698, in
which the genus Terebratula is distinctly named: and this, as it
appears from the date, was more than fifty years before the time of
Gualtieri; and we have also the authority of our english Lister in
1694 for the like distinction. All these writers, it will be observed,
preceded Klein, who has in a particular manner described the genus
Terebratula in his Methodus Ostraceologia, published in 1753, but in
which he does not speak of himself as having invented that term.
“Terebratulas, Luidiano titulo, vocamus Diaconchas anomalas, rostro
parterebrato, vid. Nomencl. Litholog. Promotum hoc titulo.” His
genus Concha ΤΡΊΛΟΒΟΣ, genus Concha Adunca, genus Bursula, and
genus Globus, are all sub-divisions of the Anomiæ Conchæ of other
writers, divided according to their forms and other peculiarities, and
in which particular attention is paid to the perforation or non-
perforation of the beak; Trilobos being distinguished as “vertice
integro,” Bursula as Terebratulæformes rostro non perforato, &c. And
we may lastly mention that from some original MSS. of Da Costa, in
our possession, it appears that Anomia was a general term for the
whole family, and Terebratula Anomiæ lævis was the term by which
the English and other Naturalists, long prior to the middle of last
century, were accustomed to distinguish the same kind of shells
which in the modern nomenclature of Conchology is also named
generically Terebratula. Da Costa, as Librarian of the Royal Society,
was in the habit of correspondence with the learned men of his time
throughout Europe, and his local knowledge from this circumstance,
though never committed to the press, is not likely to be disputed.
We could proceed yet further, but enough has surely been
advanced to shew that so far from Linnæus having confounded the
Terebratula with the Anomia, he left them precisely as he found
them, placing them after the example of his predecessors, under the
comprehensive term of Anomia, which they had assigned to them.
And we have also said enough to prove that to ascribe the Genus
Terebratula to either Bruguière or Lamarck can result only from our
ignorance of that information which in former days was regarded as
the best criterion of an able Naturalist, a correct knowledge of the
labours of his predecessors.
Under all its circumstances it may be a matter of some
indifference to the scientific Naturalist whether in the arrangement
of the Anomiæ we follow the concise method of the old writers and
Linnæus among the number, or the diffuse distribution of later
writers. If we place them in different families according to their
characters, whether regarded as sectional distinctions of Anomia, or
as distinct genera, we shall at least produce some consistency in the
arrangement. But there is yet another mode of arrangement which
appears to be the favourite theme with some Conchologists of the
present day, and which it may be proper in this place to mention,
namely, the classification of shells according to their animals. This
has been attempted in the work of Cuvier, his “Règne Animal,” and
the result of this endeavour, so far as it relates to the Anomia in
particular, may in this place deserve our explicit observation. In this
work (Règne Animal) Cuvier endeavouring to class the Anomiæ
according to the animals known to inhabit them, as well as those
which he imagines for the fossil tribes, so disperses them, that the
Trochi, Turbines, Nautili, Volutæ, and indeed nearly the whole of the
Univalves intervene between his two first genera of these bivalves,
Hyalæa and Anomia; and the Anomia tridentata of Forskahl, which is
the Hyalæa of this author, is placed with Clio (the shell of which is
our Bulla Aperta[26]) among the Ptéropodes. After the long interval
occasioned by this introduction of the Univalves we find Anomia,[26]
and Placuna, two of his genera together, but with another tribe of
beings, the animal inhabitants being of his class Acéphales; and
after another wide interval in which the bivalve Mya,[26] the
multivalve Pholas,[26] the univalve Teredo,[26] and the naked or shell-
less Ascidia, occur we find in a distant class among another tribe of
animals, Mollusques Brachopodes, the genus Terebratula. It is here
ascribed to Bruguière, as in other works it is assigned to Lamarck.
Such is the arrangement of this family in the Règne Animal of Cuvier,
a form in which no cabinet, it must be acknowledged, could be
arranged without embracing the most unprecedented anomalies; nor
can we doubt that if the animals of the fossil Terebratulæ and
Anomiæ were known, for in this arrangement they rest on
presumption only, they must be further separated in such a system
than they are at present, some being perforated at the beaks, others
imperforate, and some having the aperture under the beaks, all
which demonstrates a difference in the structure of the animal, to
whose use they were adapted.
From this analysis of the generical distinctions of the different
families of the Anomiæ we may now be permitted to return to the
shell before us, the object of our more immediate consideration, and
respecting which there appears to be no less misconception among
late later writers than we have found already respecting the genera.
It appears that Dr. Leach had some short time since published a
figure of this shell: his definition is altogether brief, and the
information he affords less explanatory than might be desired: he
quotes no authority or synonyms, and in his general description
merely observes that “It seems to be a very rare species, a few
specimens only having been received from New Zealand.” Vide. Zool.
Misc. p. 76. Lamarck assuming from these observations, as it may be
presumed, that the shell had not been previously noticed, unless it
were an Anomia Capensis of Gmelin, proposes it as a new species
under the name of Terebratula Sanguinea of Leach, at the same
time that he rejects his specific character, and assigns another to the
species; the character given to it as a new species by Dr. Leach is
“Testa sanguinea, subtillissime et creberrime impresso-punctata,
longitudinaliter costata, costis simplicibus; antica uniundulata;” that
of Lamarck, “Testâ oblongâ, irregulari, rubrá, creberrimé impresso
punctata; striis transversis undulatîs; margine denticulato,” to which
is added, “Habite—les mers de la Nouvelle Zélande d’après M.
Leach.” This seems to shew that the shell was only known to
Lamarck, through the communication of the last-mentioned writer;
and the suggestion is the more probable since the specimen in the
British Museum has the same interrogation as to being the Anomia
Capensis of Chemnitz, that is annexed by Lamarck to his description
of the species. “Je crois qu’on doit donner comme synonyme
l’Anomia capensis Gmel., d’après la citation de Chemniz; mais
l’individu que j’avais sous les yeux, n’est pas assez entier pour
affirmer ce rapprochement.”
There is obviously some want of farther explanation in these
details, the omission of which may possibly be supplied by tracing
the history of this interesting shell from the time in which it first
appeared in this country; for there are local circumstances
connected with it which having escaped the mention of Dr. Leach,
and consequently of Lamarck, have led to the erroneous conclusion
that it had remained till very lately undescribed. Dr. Leach was
probably not aware, or through some oversight omits to notice that
the specific name which he has given to this shell was that assigned
to it many years ago by Dr. Solander, and that it has uniformly borne
the name of Anomia sanguinea, or (Terebratula sanguinea) among
all the English Naturalists in consequence from the time of that
learned friend and companion of Sir Joseph Banks down to the
present period: It is the Anomia sanguinea of Dr. Solanders MSS.
and was designated under that name in the Museum of the Dutchess
of Portland: it appeared under the same appellation in the catalogue
of that museum, published in 1786: in the Calonnian Museum and
Catalogue, printed in the year 1795; it stood under that name also in
the Museum of Sir Ashton Lever, and it appeared under the same
denomination in the sale catalogue of that museum, published in the
year 1806. Under all these circumstances it may be presumed the
name must have obtained no small publicity, and we need scarcely
add that the example of these authorities were followed in the
Cabinets of english collectors generally, that happened to be in
possession of the shell, among which was that of Mr. Cracherode,
which was subsequently deposited in the British Museum. And lastly,
it should be mentioned that it occurs under the same name in the
Testaceological Manual of Mr. Dillwyn. Nothing therefore can be
more certain than that the french writers are not correct in their
opinion when they imagine that the shell had been so named in the
first instance by Dr. Leach; and it is no less certain that the credit of
having first noticed the species is due to Dr. Solander, he described it
more than forty years ago: his words as they stand in his
manuscripts are, “Anomia sanguinea obovato, longitudinaliter sulcata,
triloba; sinu profundo nate producta latere angulata foramen
ambiente.” Mr. Dillwyn has well expressed the character of this shell
in his description of Anomia Sanguinea, but has by some oversight
misquoted this passage of Dr. Solander’s manuscripts; and by that
means has confounded the Anomia Sanguinea of Dr. Solander, with
his Anomia Cruenta; this will be more fully shewn hereafter.
Upon this subject we have only lastly to observe that although
Lamarck has deemed it requisite to give a specific character of this
shell dissimilar from that of Dr. Leach, he omits to mention, as well
as the former, that very conspicuous character of the species, the
deep longitudinal hollow down the middle of the upper valve, and
the dorsal elevation of the lower one. Lamarck, indeed, confesses
that the individual which he had under his eyes, and consequently
that which he describes, is not sufficiently perfect to authorize him in
determining the analogy between that shell and the Anomia
Capensis of Gmelin, which Chemnitz has figured; a circumstance
that may explain the cause of this omission in the specific character
of Terebratula sanguinea. Yet we should have thought a shell
sufficiently entire to have enabled this ingenious Naturalist to have
composed his character of the species, would have been so far
perfect as to have justified some conclusion upon its analogy with
the Gmelinian Anomia Capensis. We may confidently add that these
two shells are totally distinct species, and are even generically
different if we enter very scrupulously upon their distinctive
characters. Dr. Solander had described this latter shell before the
time of Gmelin under the name of Anomia Cruenta.
The representations of this choice testaceous production, which
accompanies our present description, will, it is presumed, convey a
more correct idea of the shell than can be expressed by words. The
Leverian specimen from which, as before observed, these figures are
taken, realized at the public hammer at the Leverian sale the sum of
five guineas,[27] and it still remains so rare that there would probably
be little, if any, dimunition in the price were it again to be disposed
of in the same manner at the present period. The shells of this kind
vary in some small degree in the intensity of colour from a very deep
sanguineous red to a paler hue.
35

London. Published by E. Donovan & Mess.rs Simpkin & Marshall, March


1, 1823.
ENTOMOLOGY.

PLATE XXXV.

PAPILIO BELLADONNA
BELLADONNA’S BUTTERFLY.

Lepidoptera.

GENERIC CHARACTER.
Antennæ thicker towards the tip, and generally terminating in a
knob: wings erect when at rest. Fly by day.
**** Heliconii.

SPECIFIC CHARACTER
AND
SYNONYMS.
Wings oblong entire, black with somewhat hyaline spots: posterior
pair with a yellow spot at the base, and two at the anal angle.
Papilio Belladonna: alis oblongis integerrimis atris sub-hyalino
maculatis: posticis macula baseos anguloque ani maculis
duobus flavis.
Papilio Belladonna: alis oblongis integerrimis atris: anticis hyalino
punctatis, posticis flavo maculatis. Fabr. Ent. Syst. T. 3. p. 1.
p. 180.
Papilio Belladonna. Jon. fig. pict. 3. tab. 37. fig. 2.
Statura P. Pasithoe at major. Corpus nigrum abdominis marginibus
cinereis. Alæ atræ, cinereo punctatæ. Subtus concolores at lineola
maculaque baseos albis. Posticæ atræ, flavo maculatæ macula
baseos angulique ani majoribus. Subtus fere concolores.

A figure of this very rare and probably unique insect cannot fail, it
is presumed, of proving an acceptable addition to the collectanea of
the Entomologist: it is the only representation of the species now
extant, and has been ascertained upon the authority of the only
document we now possess of the insect intended in the Fabrician
writings under the appellation of Papilio Hel. Belladonna.
Fabricius, as it appears from his references in his Entomologia
Systematica, met with the drawings of this species in the collection
of Mr. Jones, whose cabinet also possessed the original specimen
from which the drawing was taken. It is from this individual example
in the cabinet of Mr. Jones that the delineation in the annexed plate
is copied.
This curious Papilio is one of the larger species of the Heliconi
tribe to which it appertains. The wings are a blueish black, and
rather closely studded with sub-hyaline or transparent spots, which
are minutely speckled with black: those on the anterior wings are
somewhat sagittate and disposed into two irregular bands towards
the exterior half of the wings: those on the posterior wings are
rather larger and more inclining to an ovate form; and three of the
largest, namely, one at the base, and two at the anal angle, are of a
bright yellow colour. The inner limb of the wing is grey inclining to
yellowish. The head and thorax are black; the abdomen black with
the sides pale yellow. The spots being semitransparent the
appearance on the underside in a great degree corresponds with
that above: there is a small difference, because instead of one
yellowish spot at the base of the posterior wing, there are two,
another smaller than that which appears at the base of that wing on
the upper surface being situated below it. We have been more
minute in the description of these spots, because upon an attentive
comparison of the insect in Mr. Jones’s Cabinet, with the Fabrician
description, we perceive some small deficiency in the latter, a
circumstance, it must be confessed, of rare occurrence in this author,
but unquestionably worthy of our notice and correction, as it is the
only authority upon which the species must in future rest.
The country of this interesting insect is unknown; it is remotely
conjectured only that it may be Africa. The insect is represented with
its wings expanded upon a sprig of
ERICA PARMENTARIA,
an elegant vegetable production of the Cape of Good Hope.
36

London. Published by E. Donovan & Mess.rs Simpkin & Marshall,


April 1, 1823.
CONCHOLOGY.

PLATE XXXVI.

NERITA POLITA. Var.


PINK-BANDED VARIETY
OF THE
THICK POLISHED NERIT.

Univalve.

GENERIC CHARACTER.
Animal a Limax. Linn.[28] Shell univalve, spiral, gibbous, flattish at
the bottom: aperture semi-orbicular and semi-lunar, pillar lip
transversely truncated.
*** Perforated with the lips denticulated.

SPECIFIC CHARACTER
AND
SYNONYMS.
Shell thick, glabrous, variously coloured, crown obliterated: lip
toothed each side.
* Var. Variegated with white, red, and black.
Nerita Polita: testa crossâ, glabrâ, colore variâ vertice obliterato,
labio utroque dentato.
* Ex albo rubro nigroque variegata.
Nerita Polita: testa lævi: vertice obliterato, labio utroque dentato.
Linn. Mus. Lud. Ulr. 678. n. 392.
Linn. Syst. Nat. edit. 12. 2. 1254. 731.
Gmel. Linn. Syst. 6. 3680. 43.
Nerita Polita. Chemn. 5. t. 193. f. 200. 2014.
Rumpf. Mus. t. 22. fig. 1. k.
Argenv. Conch. t. 7. f. k.
Seba Mus. 3. t. 38. f. 56.
Lamarck T. 6. p. 2. 192. 7.

In the arrangement of Cuvier, entitled “Règne Animal,” the


Mollusca or animal of the Nerita constitutes one of his “Gasteropodes
pectinibranches,” the character of which as defined by that author is
quite as comprehensive and rather less explicit than the Linnæan
limaces: he divides them into several families according to the
peculiar form of their shells, for collectively almost every genera of
the spiral univalves fall under this very general denomination, as well
as many of those shells which are simply conic, as in the Linnæan
classification they do under that of Limax. Cuvier mentions as a
character of this tribe that their breathing apertures, with the
exception of a family he calls Cyclostomes, are composed of a
number of foliations ranged parallel to each other like the teeth of a
comb. They have two feelers, and two eyes usually situated on a
pedicle. The greatest difference between these animals consist in
the presence or absence of the canal formed by a prolongation of
the edge of the pulmonary cavity of the left side, a respiratory organ
communicating with others by means of which the animal breathes
without quitting its retreat in the water.
According to Lamarck the animal of Nerita has the foot large and
short, with two pointed feelers, and the eyes raised upon a papilla at
the exterior base of each.
Bosc is less diffuse than either. The animal of the Nerites, he
observes, have the head flat and lunate, a little sloping to the two
extremities: from the base of the head on each side issues two conic
slender horns, one of which is twice the length of the other. The
eyes are two little black points placed upon a trihedral tubercule at
the exterior base of the horns, the mouth placed underneath the
head and formed with a lip, thick and wrinkled. The foot almost
round, flat beneath, convex above, and rather shorter than the shell.
The mantle or fleshy prolongation entirely covers the interior of the
shell and is slightly crenulated at the margin.
Denys de Montfort speaking of the species Nerita Peloronata, a
shell abounding on the shores of the Antilles, observes that there
are male and female animals of this kind, the two sexes being
isolated or distinct individuals; they are of an amphibious nature,
living in the sea, from whence they ascend occasionally and crawl
about the rocks.
Linnæus under the Nerita genus comprehends as well the
imperforated or non-umbilicated kinds as those which have that
perforation. The later continental writers divide these again,
retaining the name Nerita to those which have no perforation; those
with a perforation are called Natica, by the french authors Natice,
after Adanson, Gualtieri, and Favanne. Lamarck has also a genus
Neritina, and another Navicella, all which in the Linnæan system are
of the Nerita tribe.
Nerita Polita is by no means an uncommon shell upon the coasts
of the Indian Ocean, being found throughout their whole extent
from Japan to the Cape of Good of Hope, and as it appears also
upon the shores of many islands in the Indian and the Great
Southern Ocean.
Besides being so very abundant in those parts, it may also be
observed that no species of the testaceous tribe is more remarkable
for the almost endless variety of colours, or the form and disposition
of the spots, dots, and lineations, than the individuals of this kind of
Nerit. There are, however, some few of its varieties which from being
local are far less abundant than the rest, and the shell in particular
which we have selected for the most conspicuous object in the
annexed plate is one the most important of the number. The
prevailing colour of the ordinary varieties is olivaceous, in some
paler, in others more inclining to blackish; the charactered marks in
general yellowish, triangular or sagittate, and varied with short
blackish lines. This is the usual appearance of the back or upper part
of the shell, the region surrounding the mouth is white, including the
lip, the inside of the mouth yellow, and this latter character appears
constant throughout all the varieties of the species. The particular
variety which constitutes the chief object in our plate, is of the red
banded kind, the bands being diversified with red and white,
disposed in spots, and lineations, with peculiar elegance. The
varieties of this banded kind are scarce in general, but the particular
kind which we have represented is unique, whether regarded for its
magnitude, its exquisite perfection, or brilliancy of colouring. We
have represented the upper and under surface of this shell, together
with the upper and under surface of a shell of the common kind, in
order that by the contrast, the beauty of the former might be
exemplified with greater perspicuity.
The history of this matchless variety of Nerita Polita is distinctly
known: it is one of those shells which were brought from the
Sandwich Islands by Captain Cook, when he returned from his first
voyage of discovery in the South Seas. It was observed appended to
an ornament worn at the breast of one of the natives, and was
obtained in exchange, it is believed, for an iron hatchet; the Islander
to whom it belonged esteeming it very much, and the English Officer
being anxious to possess it. This circumstance of its having been
affixed to an ornament worn by one of the savages, explains the
reason of the shell being perforated, the hole having been made in
order to pass a string through the shell to fasten it on the ornament
securely. The shell was presented by Captain Cook to Sir Ashton
Lever, in whose Museum it was subsequently deposited; and
notwithstanding the defect above-mentioned, this little shell
produced at the dissolution of the Leverian Museum, in the year
1806, the sum of nine pounds sterling, at the public hammer.[29] A
celebrated collector, the late Mr. Noel Jennings, was the purchaser;
and it is understood that on the subsequent dispersion of the
collection of Mr. Jennings, which took place a few years ago, that it
became, with some other very rare shells of that collection, the
property of Lord Mount Morris.

END OF VOL. I.

Plummer and Brewis, Printers,


Love Lane, Eastcheap.

1. (Adamas.) “Proximum apud nos Indicis Arabicisque margaritis


pretium est, de quibus in nono diximus volumine inter res marinas.”
Plin. Hist. Nat. lib 37. cap. 4.

2. Vide Annales du Museum National. An. xi. (1802) Premier


Cahier.

3. Le Cedo Nulli à bandes, ou dont la robe jaunâtre se partage en


quatre bandes, l’inférieure et celle du milieu sont comparties de
marbrures blanches, les deux autres sont remplies, l’une de quatre
cordelettes à point blancs, la seconde de trois seulement. Tom. 1, p.
442.

4. This shell, though sufficiently intelligible among the figures of


Kircher’s shells, engraved and published by Bonanni, and also in the
works of Lister and some others, escaped the notice of Linnæus. So
late as the tenth edition of Systema Natura it does not appear.
Gmelin describes this shell with much accuracy in his edition of the
last mentioned work, under the specific name of Scapha.

5. “Testa varicibus æqualibus longitudinalibus, &c.” is an incorrect


reading of Professor Gmelin. If we examine the Linnæan description
of the Museum of the Queen of Sweden, Mus. Lud. Ulr. to which
Gmelin refers, we shall find it to be as might be naturally expected,
“testa costis æqualibus;” for it is the ribs, and not for veins that
Linnæus intended. Linnæus refers to the 10th edition of his Systema
Naturæ, which is not mentioned by Gmelin, and here we again meet
with the same reading “testa costis æqualibus, &c.” We have been
the more explicit in pointing out this error, because we observe that
one Conchologist, not long since, in the absence, doubtlessly, of the
moment, has translated literally the Gmelinian text in describing
Buccinum Harpa.

6. Lot 75 of the 60th day. July 2nd, 1806.

7. This article is thus described in the last day’s sale, lot 81, “An
elegant and unique pink variety of the imperial sun, drawn up with
the anchor of a ship, from the depth of sixty fathoms, in Cook’s
Straits, New Zealand.” Sold for £24 3s.

8. In Orchard-street, Portman-square, Thursday, April 13th, 1815.


Vide lot 84.

9. Système des animaux sans vertèbres, p. 86.

10. We have lately understood that the editors of Encyclopædie


Methodique, now publishing in Paris, intend giving figures of the
Papiliones of the Equites family, which Fabricius has described. This
endeavour to illustrate Fabricius is under the direction of Mons.
Latreille, a Member of the National Institute, an Entomologist
himself, of acknowledged talent, and one to whose great ability, as
well as personal urbanity, we are happy to bear our testimony of
praise. In the absence of more conclusive authority, the conjectures
of Mons. Latreille would be, unquestionably, useful; but we shall,
ourselves, tread the same path, and as we trust, may assist also, in
no small degree to dispel the darkness which at present
overshadows this fair portion of the science. As we are, ourselves,
possessed of the authentic evidences, by means of which, the
species of Fabricius can be immediately identified, we have no
occasion to wander into the labyrinths of conjecture: we at once
arrive at the certainty of truth. The annunciation of this design, on
the part of the French editors, leads to a conclusion of the
importance attached to this endeavour: it need be only stated on our
part, that the illustrations we shall subjoin to such of the Fabrician
species as may pass under our own observations, will be precisely
taken from the individual objects which Fabricius has described.

11. “Cornua cervina—bois de cerf.”—Seba.

12. “Horum processus admodum producti sunt; ut ideo Cornua


cervina appellentur ob qualemcunque similitudinem. Corpus tamen
Cochleæ semper pro ratione ramorum minus est, quam in Muricibus
superioribus.”[12a]—Seba T. 3. tab. 77. p. 172.

12a. As Murex ramosus, of which several varieties are given in the


plates Seba, Murex Saxatilis, &c.

13. Lot 305, third day, Saturday, May 25th, 1805.

14. The Hindoos entertain the belief of a general deluge, not very
dissimilar to that of the Mosaic records. They admit, however, many
such catastrophes of the earth, and subsequent renovations through
the creative power of this attribute of Brahma, which they
denominate Vishnu. The Chank Shell refers to a deluge of the earth,
anterior to that which seems to accord with the sacred writ. The
deliverance of the earth from the Mosaic deluge they term the lotos
creation, the type of which is the expanded flower of the lotos, the
indian pedma emerging above the surface of the waters with Vishnu
seated in its centre.
15. Were it requisite to treat more amply upon this subject, it
would be in our power to produce abundant evidence of the
prevalence of this symbol of the sacred Volute, wherever Vishnu or
his delegated power appears. The rich repository of the India House,
the British Museum, and many private collections afford us some
examples of the most interesting kind. Some few of these are so
immediately connected with the object of our enquiry, that we feel
persuaded no apology will be necessary for their introduction.
In the collection of Lord Valentia is a four-sided cast in brass,
resembling a kind of pyramid, consisting of three low platforms,
each bearing idols, and surmounted at the summit by a tortoise. In
several Indian paintings mythologically adverting to the subject of
the creation, the tortoise is represented raising the new-born earth
upon its back above the waters, and it is usually seen in other
mythological paintings of the same subject bearing the throne upon
which Vishnu is seated, while the attendants, personified by various
beings, are lifting the earth from the deep. Such a painting was once
in the celebrated collection of Colonel Stuart: and we need no other
evidence to shew that the bronze of Lord Valentia’s collection is of
the same mythological nature, and referable to the deluge, than to
observe the Chank Shell placed at each of the four corners of the
ornament. We may comprehend the allusion of the tortoise raising
the earth from the waters of the deluge, from a trait of the ancient
Chinese astronomy; by the tortoise bearing the earth, they intended
the north pole of the ecliptic, which, at the time of the deluge, they
maintained had not materially changed its position, and that by this
means the world was sustained and saved from utter annihilation.
An Indian painting, mentioned by Mr. Edward Moor, the author of
the Hindoo Pantheon, presents us with another deity, Sivi, who holds
the Chank Shell in one of his four hands, and the antelope (moon) in
another.
There is also an Indian painting of Devi, who appears holding a
Chank Shell, furnished on each side with a lateral lappit or wing: this
symbol he holds in one hand, and the wheel, the emblem of the
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.

More than just a book-buying platform, we strive to be a bridge


connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.

Join us on a journey of knowledge exploration, passion nurturing, and


personal growth every day!

ebookmasss.com

You might also like