| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
inlined port rights.
For i686, we just change the code to use mach_port_name_inlined_t when
defining the types. This is a no-op.
For x86_64, there's a few things that are different:
- In the server code, the server handler can get inlined ports and the
array will be resized and cast as an array of mach_port_name_t. Output
parameters have a similar treatment where the inlined array in the
output is used as an array of mach_port_name_t but resized to look like
a mach_port_name_inlined_t.
- In the user side, we follow the same approach. Input ports as arrays
of mach_port_name_t are expanded into an array of mach_port_name_inlined_t.
Output ports are then converted back into an array of
mach_port_name_inlined_t so that they fit into the expected message
format.
Essentially, regardless of whether port rights are inline or out of
line, user interfaces and server stubs always receive an array of port
rights, not mach_port_name_inlined_t. However, inlined port rights will
be exchanged using mach_port_name_inlined_t.
|
|
|
|
|
|
| |
for inlined port rights."
This reverts commit c40604042bd6e9f80e4f5fe6bc9deefb29c4b94a.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
inlined port rights.
For i686, we just change the code to use mach_port_name_inlined_t when
defining the types. This is a no-op.
For x86_64, there's a few things that are different:
- In the server code, the server handler can get inlined ports and the
array will be resized and cast as an array of mach_port_name_t. Output
parameters have a similar treatment where the inlined array in the
output is used as an array of mach_port_name_t but resized to look like
a mach_port_name_inlined_t.
- In the user side, we follow the same approach. Input ports as arrays
of mach_port_name_t are expanded into an array of mach_port_name_inlined_t.
Output ports are then converted back into an array of
mach_port_name_inlined_t so that they fit into the expected message
format.
Essentially, regardless of whether port rights are inline or out of
line, user interfaces and server stubs always receive an array of port
rights, not mach_port_name_inlined_t. However, inlined port rights will
be exchanged using mach_port_name_inlined_t.
Message-ID: <20231124213041.952886-4-flaviocruz@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Back in the wonderful old days of Mach 2, when there were no send-once
rights, dead names, or port reference counts, MIG used to have more
kinds of operations: there were functions, procedures, simpleprocedures,
routines, and simpleroutines. Routines returned an error code as their C
function return value, functions had real return values, procedures and
simpleprocedures returned void.
Functions, procedures, and simpleprocedures signalled errors by invoking
a global function. By default, a function named MsgError was invoked,
but a subsystem could specify a different function using the 'error'
directive:
error CustomErrorHandler;
In Mach 3, functions, procedures, and simpleprocedures are gone.
Routines and simpleroutines are the only remaining kinds of operations.
Some 26 years later, most of the code for generating functions,
procedures, and simpleprocedures was removed from GNU MIG in commit
7f10b4ed6a557b7a1fd1083939156a3dcf8b377e. Error directives remained,
seemingly due to an oversight. So remove them too.
Found while trying to use the word 'error' as an identifier and
receiving a cryptic syntax error from MIG.
Message-Id: <20230617203953.622120-1-bugaevc@gmail.com>
|
|
|
|
|
|
|
| |
Remove the concept of word_size since it is meaningless in some
architectures. This is also done in preparation to possibly introduce
8-byte aligned messages.
Message-Id: <Y+lkv0uMo/3+hbCb@jupiter.tail36e24.ts.net>
|
|
|
|
| |
Message-Id: <Y3/Z1CGL8D4OwT66@viriathus>
|
|
|
|
|
|
|
|
| |
For kernel server or user subsystems we would initialize basic types
twice, once in main() and again for the subsystem declaration. Instead,
initialize basic types when the subsystem is declared and then throw
errors when types are defined multiple times.
Message-Id: <Y3HUt/YAKaqMMTi3@viriathus>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Basic syntax is presented below and allows users to define
nested structured types by using simpler or structure types as
members. Mig will use the C padding and alignment rules to produce
the same size as the corresponding C structures.
type timespec_t = struct {
uint32_t tv_sec;
uint32_t tv_nsec;
};
This allows us to build stubs that are more easily adaptable to other
architectures.
Message-Id: <Y2SjQSMOINY8I5Dy@viriathus>
|
|
|
|
|
|
|
| |
* parser.y: add information about type names
Signed-off-by: Luca Dariz <luca@orpolo.org>
Message-Id: <20220403150020.120799-3-luca@orpolo.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* cpu.sym: retrieve size of vm_offset_t and mach_port_name_t from
gnumach headers at compile type.
* global.{c,h}: add port size as a variable and initialize it to the
port name size.
* lexxer.l: apply port or port name size to the corresponding types,
instead of using the word size.
* parser.y: update port size if we're generating for kernel-space
(server or client). Also re-initialize default port types to account
for this change.
* type.c: use port size instead of word size in default port types and
runtime checks.
There are many assumptions about mach_port_t:
- on kernel side, its size is the same as a pointer. This allows to
replace the port name with the address of the corresponding data
structure during copyin in mach_msg()
- in mig, this is also the "word size", which is derived from gnumach
headers as the size of integer_t
- its size is also the same as natural_t, so it's possible to model
structures like mach_port_status_t as an array of integer_t in
mig. This is convenient since arrays and structures can't have
mixed types.
- its size is always the same as the port name size
This patch does not change the current behaviour on 32-bit kernels,
but allows for some of these assumptions to be broken on 64-bit
kernels. This is needed to have 32-bit port names on 64-bit kernels
and be able to support a 32-bit userspace. It still leaves the choice
for a 64-bit userspace, if all integer_t and natural_t are to be
extended to 64 bit.
However keeping 32-bit port names seems to be the right thing, based on
previous discussions [1], even for a 64-bit kernel.
The only assumption kept is that in kernel-space ports are always the
size of a pointer, as they refer to a data structure and not to a
specific port name. To ensure this is true for various user/kernel
combinations, we dynamically change the port size if we're generating
code for kernel-space server or clients, and keep the size of a port the
same of a port name for user-space servers and clients.
[1] https://lists.gnu.org/archive/html/bug-hurd/2012-04/msg00000.html
Signed-off-by: Luca Dariz <luca@orpolo.org>
Message-Id: <20220403150020.120799-2-luca@orpolo.org>
|
|
|
|
| |
* parser.y: Move syColon from ArgumentType into Argument.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This has been tested by cross-compiling a base Hurd system to make sure
these kinds of routines are no longer used.
* lexxer.l: Remove tokens.
* parser.y: Remove token types and production rules.
* routine.c: Remove rtMakeProcedure, rtMakeSimpleProcedure,
rtMakeFunction.
* routine.h: Remove enum values rkSimpleProcedure, rkProcedure,
rkFunction. Remove dead fields from struct routine.
* user.c: Simplify and remove dead code.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add support for protected payloads. The new `intranpayload' option can
be used to specify a translation function translating payloads to
values of the translated type. This function will be used instead of
the `intran' function to to look up the receiving object of a message
in a server.
This makes it easy to use the protected payloads introduced in GNU
Mach 1.5.
An inTransPayload function translates payloads to objects, like an
inTrans function translates from port names to objects. Generate code
in the server routine to optimize lookups to the receiver of the
message.
Additionally, if no intran function is provided, but an intranpayload
function is, it is expected to translate from payloads to port names.
This is used to preserve the semantics in case the server routine
expects a port name.
* NEWS: Add item.
* lexxer.l: Emit syInTranPayload.
* parser.h: Define syInTranPayload.
* parser.y (TransTypeSpec): Handle syInTranPayload.
* type.h (struct ipc_type): Add itInTransPayload.
* server.c (WriteExtractArgValue): If a payload-aware intrans function
has been specified, use it to get a reference to the receiving object.
* routine.c (rtAugmentArgKind): Force the use of a local variable if a
payload-aware translate-in function is defined.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Drop the register keyword both from MIGs code and from the generated
code. The register keyword is only a hint and it is ignored by modern
compilers.
* alloca.c: Drop the register keyword.
* header.c: Likewise.
* lexxer.l: Likewise.
* parser.y: Likewise.
* routine.c: Likewise.
* server.c: Likewise.
* statement.c: Likewise.
* string.c: Likewise.
* type.c: Likewise.
* user.c: Likewise.
* utils.c: Likewise.
* vprint.c: Likewise.
|
|
|
|
|
| |
* parser.y (yyerror): Use a format string instead of directly passing
the argument to error.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix compiler, flex and bison warnings.
* error.c: Include <stdlib.h>.
* lexxer.h (yylex): Add declaration.
* migcom.c: Include <stdlib.h>.
(main): Set USER, SHEADER and IHEADER to `NULL' by default.
(myfclose): Add lost conversion specifications.
* parser.h (yyerror): Add declaration.
* routine.c (rtPrintArg, rtCheckRoutine): Add braces to avoid
ambiguousness.
* server.c (WriteSymTabEntries): Make NUM an `u_int'.
* user.c (WriteUserIndividual): Add a `default' case in a switch
statement and add lost conversion specifications.
* lexxer.l: Set option `nounput'.
* parser.y (%left): Change commas to spaces.
|
|
|