summaryrefslogtreecommitdiff
path: root/global.h
AgeCommit message (Collapse)Author
2023-09-24Update code generation to handle the new 64 bit ABIFlavio Cruz
Mostly, we don't set the fields that do not exist and avoid type mismatching (like casting unsigned short to unsigned char for msgt_name). We also revamp type checking to compare mach_msg_type_t to uint64_t instead of just uint32_t as we now use the whole structure. Message-Id: <ZGREMgn19Zptc/Pf@jupiter.tail36e24.ts.net>
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