Нужен автокод - иностранцам вежливо настраивать язык кириллический

Информация о пользователе

Привет, Гость! Войдите или зарегистрируйтесь.


Вы здесь » Нужен автокод - иностранцам вежливо настраивать язык кириллический » UEFI » CALL(32|64)[EX][a] - мнемоники и инструкции


CALL(32|64)[EX][a] - мнемоники и инструкции

Сообщений 1 страница 8 из 8

1

https://uefi.org/specs/UEFI/2.11/Apx_J_ … _List.html

0x03 - код у этой инструкции.

Описание

CALL32{EX}{a} {@}R1 {Immed32|Index32}
CALL64{EX}{a} Immed64

Но само описание сделано непонятно:
1) нет отсылки к месту, в котором описан синтаксис фигурных скобок;
2) не описано, как понимать опциональную букву 'a';
3) не ясно, когда выбирать CALL32EX, а когда CALL64EX (и почему не видно CALLn-варианта).
4) псевдокод ссылается на бит по имени, но само имя не встречается далее в описании формата инструкции:
if (Opcode.ImmedData64Bit) { ...

Отредактировано Лис (Сегодня 03:02:13)

0

2

22.6 EBC Instruction Syntax
Most EBC instructions have one or more variations that modify the size of the instruction and/or the behavior of the
instruction itself. These variations will typically modify an instruction in one or more of the following ways:
• The size of the data being operated upon
• The addressing mode for the operands
• The size of index or immediate data
• To represent these variations syntactically in this specification the following conventions are used:
• Natural indexes are indicated with the “Index” keyword, and may take the form of “Index16,” “Index32,” or “In-
dex64” to indicate the size of the index value supported. Sometimes the form Index16|32|64 is used here, which
is simply a shorthand notation for Index16|Index32|Index64. A natural index is encoded per Index Encoding is
resolved at runtime.
• Immediate values are indicated with the “Immed” keyword, and may take the form of “Immed16,” “Immed32,”
or “Immed64” to indicate the size of the immediate value supported. The shorthand notation Immed16|32|64 is
sometimes used when different size immediate values are supported.
• Terms in brackets [ ] are required.
• Terms in braces { } are optional.
• Alternate terms are separated by a vertical bar |.
• The form R1 and R2 represent Operand 1 register and Operand 2 register respectfully, and can typically be any
VM general-purpose register R0-R7.
• Within descriptions of the instructions, brackets [ ] enclosing a register and/or index indicate that the contents of
the memory pointed to by the enclosed contents are used.

При написании своей спецификации имело бы смысл все эти соглашения пронумеровать каждое,
чтобы иметь возможность на них ссылаться (§ 2.6.1). И сослаться в каждом описании каждой инструкции,
для того, чтобы описании инструкции стало более понятным.

Обычно, кстати, наоборот - опциональное в квадратных скобках, а не обязательное.
RFC 4234 / Augmented BNF for Syntax Specifications
POSIX shell / man-страницы и IEEE Std 1003.1 (POSIX)
BNF/EBNF в реализации ISO/IEC 14977 (Extended Backus–Naur Form — EBNF)
синтаксис ABNF из RFC 5234 и демонстрируют опцию в [ ] при описании команд/параметров
Microsoft MSDN / Windows API документация: в описаниях сигнатур API и команд опциональные параметры часто показывают в квадратных скобках.
SQL стандарты и документация (напр., спецификации диалектов и руководства): опциональные части синтаксиса в BNF/EBNF примечаниях обычно показаны в [ ]
GNU autotools/autoconf manual и многие Unix‑руководства: использование [ ] для опциональных аргументов команд/флагов.
ANSI‑C yacc / Berkeley yacc использует синтаксис, основанный на BNF

Отредактировано Лис (Сегодня 04:09:47)

0

3

1.9.4 Instruction Descriptions
An instruction description for EBC instructions generally has the following format:
InstructionName: The formal name of the instruction.
Syntax: A brief description of the instruction.
Description: A description of the functionality provided by the instruction accompanied by a table that details the
instruction encoding
.
Operation: Details the operations performed on operands.
Behaviors and Restrictions: An item-by-item description of the behavior of each operand involved in the instruction
and any restrictions that apply to the operands or the instruction.

«accompanied by a table that details the instruction encoding»
а почему было не выделить это в отдельный явный раздел? Это бы повысило формализованность описания набора инструкций.

1.9.1 Data Structure Descriptions
Supported processors are “little endian” machines. This distinction means that the low-order byte of a multibyte data
item in memory is at the lowest address, while the high-order byte is at the highest address.
Some supported 64-bit
processors may be configured for both “little endian” and “big endian” operation. All implementations designed to
conform to this specification use “little endian” operation.
In some memory layout descriptions, certain fields are marked reserved . Software must initialize such fields to zero
and ignore them when read. On an update operation, software must preserve any reserved field.

Могли вообще синтаксис из Kaitai Struct использовать? Или не могли?

Отредактировано Лис (Сегодня 04:13:04)

0

4

Ничего не написано про "собаку" {@}, точнее нет ссылки на описание.

22.5 EBC Instruction Operands
...
INSTRUCTION Operand1, Operand2
...
Typically, instruction operands will be one of the following:
• Direct
• Indirect
• Indirect with index
• Immediate

Там выше пример инструкции, и у неё обязательно два операнда в примере, и они разделены запятой. А в этой инструкции CALL похоже что операнд один. И запятой нет. Это (как и любая другая несостыковка) затрудняет понимание.

22.5.2 Indirect Operands
When an indirect operand is specified, a VM register contains the address of the operand data. This is sometimes
referred to as register indirect, and is indicated by prefixing the register operand with “@.”

Отредактировано Лис (Сегодня 04:24:12)

0

5

A natural index is encoded per Index Encoding is resolved at runtime.

Это странно построенное английское предложение, в нем is два раза, а так обычно не бывает (я о таком не.знаю)

Пока в точности алгоритм распаковки я не понял, но для этого был отдельный топик:
natural indexing

For the CALL32 forms, if Operand 1 is indirect, then the immediate data is interpreted as an index, and the Operand 1 value is fetched from memory address [R1 + Index32].

Ещё немного, ещё чуть-чуть, чтобы понять, как вызывать функции UEFI через таблицы, указатель на которые передаётся в главную функцию при старте.

Отредактировано Лис (Сегодня 04:56:54)

0

6

1.9.5 Pseudo-Code Conventions
Pseudo code is presented to describe algorithms in a more concise form. None of the algorithms in this document are
intended to be compiled directly. The code is presented at a level corresponding to the surrounding text.
In describing variables, a list is an unordered collection of homogeneous objects. A queue is an ordered list of homo-
geneous objects. Unless otherwise noted, the ordering is assumed to be FIFO.
Pseudo code is presented in a C-like format, using C conventions where appropriate. The coding style, particularly
the indentation style, is used for readability and does not necessarily comply with an implementation of the UEFI
Specification.

Я думаю, что надо придумать синтаксис для того, чтобы описывать расположение битовых полей.
Чтобы байтовые позиции отдельно, битовые позиции отдельно (как целая и дробная части в двоичной, восьмеричной или шестнадцатеричной системе счисления?).
Или не позициями описывать, а началом и длиной?
Или сделать и то и другое на выбор и/или вместе?

Главное не забыть добавить в описание поля имя. Авторы описания EFI EBC не добавили имена, и это проблема.

Отредактировано Лис (Сегодня 04:12:00)

0

7

Внимательно рассмотрев все биты в таблице описания кодирования инструкции, я не увидел куда там впихивают букву "а"

Однако меня смущает бит 4 байта 1:
0 = Absolute address
1 = Relative address

Можно ли предположить, что по-умолчанию CALL - это relative-вызов, а если буква `a` указана - то absolute?

Чтобы окончательно подтвердить — нужно увидеть прямо в реализации/парсере сопоставление текстовой формы с битом Absolute/Relative

Отредактировано Лис (Сегодня 05:15:38)

0

8

Упражнение для читателя:
- изучите, как описана инструкция CALL для платформ intel, arm, loongson, КуМир, MIX/MMIX, CLR, java bytecode, WASM.
- найдите отличия с описанием виртуальной машины EBC.
- напишите ваши идеи о том, как лучше описывать виртуальную машину.
- что там в llvm напридумывали?

Тема для идей (чтобы тут не офтопить):
Как описывают платформы?

Отредактировано Лис (Сегодня 05:52:39)

0


Вы здесь » Нужен автокод - иностранцам вежливо настраивать язык кириллический » UEFI » CALL(32|64)[EX][a] - мнемоники и инструкции