summaryrefslogtreecommitdiff
path: root/global.c
AgeCommit message (Collapse)Author
2023-12-17x86_64: adapt MiG generated stubs to use mach_port_name_inlined_t for ↵Flavio Cruz
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.
2023-12-03Revert "x86_64: adapt MiG generated stubs to use mach_port_name_inlined_t ↵Samuel Thibault
for inlined port rights." This reverts commit c40604042bd6e9f80e4f5fe6bc9deefb29c4b94a.
2023-12-03x86_64: adapt MiG generated stubs to use mach_port_name_inlined_t for ↵Flavio Cruz
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>
2023-06-17Remove error procedure directivesSergey Bugaev
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>
2023-02-13Introduce complex_alignof to replace word_sizeFlavio Cruz
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>
2022-11-25mig: replace boolean.h with stdbool.hFlavio Cruz
Message-Id: <Y3/Z1CGL8D4OwT66@viriathus>
2022-08-27add separate port_size and mach_port_name_size definitionsLuca Dariz
* 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>
2015-02-15Do not generate code dereferencing type-punned pointersJustus Winter
For variable-length arrays, up to 2048 bytes are transmitted inline. If the array is larger, the data is transmitted out-of-line, and a pointer to a vm_allocated region is stored at the beginning of the array. Previously, the generated code casted the field. Use a union instead. This fixes the gcc warning `dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]'. * global.c (OOLPostfix): New variable. * global.h (OOLPostfix): New declaration. * server.c (WriteServerCallArg): Avoid cast. (WriteDestroyArg): Likewise. (WritePackArgValue): Likewise. (WritePackArg): Likewise. * user.c (WriteExtractArgValue): Likewise. * utils.c (WriteFieldDeclPrim): Generate a union with an additional pointer field for variable-length arrays.
2007-06-022007-06-02 Thomas Schwinge <tschwinge@gnu.org>Thomas Schwinge
* global.c (LintLib): Remove definition. * global.h (LintLib): Remove declaration. * header.c (WriteUserRoutine, WriteServerRoutine): Don't emit `Lint' code. * user.c (WriteIncludes): Likewise. * utils.c (WriteRCSDecl): Likewise.
2006-12-032006-12-03 Leonardo Lopes Pereira <leonardolopespereira@gmail.com>Thomas Schwinge
[patch #5018 --- ``Remove support to msg_send interface.''] * global.c (UseMsgRPC): Removed definition. * global.h (UseMsgRPC): Removed declaration. * mig.in (--help): Removed information about `-r' and `-R' options. * migcom.c (parseArgs): Changed the switches `-r' and `-R' to deal with the absence of obsolete the send/receive pairs. * user.c (WriteRoutine): Adapted the use of `UseMsgRPC' as if it was defined to `TRUE'. (WriteMsgSendReceive): Removed, since it is not used anymore.
2001-06-082001-06-07 Roland McGrath <roland@frob.com>Roland McGrath
* global.c (DefaultFiles): New variable, boolean initialized to true. (more_global): Leave null file name variables alone if it's false. * global.h (DefaultFiles): Declare it. * migcom.c (parseArgs): New option -n clears it. * mig.in: Grok -n (pass it through) and put it in the usage message.
1998-07-18Created new module from gnumach/mig at tag before-mig-moveRoland McGrath