aboutsummaryrefslogtreecommitdiff
path: root/user.c
Commit message (Collapse)AuthorAgeFilesLines
* Suffix complex_alignof with U to hint the compiler that it is always unsignedFlavio Cruz2024-07-181-2/+2
| | | | | | | | | | | | | | | | | | | | I have noticed a problem when compiling rumpkernel with the new thread_get_name: gnumachUser.c: In function 'thread_get_name': gnumachUser.c:1791:37: error: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Werror=sign-compare] 1791 | if (mig_unlikely (msgh_size != 36 + ((OutP->nameType.msgt_number + 3) & ~3))) | ^~ gnumachUser.c:25:47: note: in definition of macro 'mig_unlikely' 25 | #define mig_unlikely(X) __builtin_expect (!! (X), 0) | ^ cc1: all warnings being treated as errors This ensures that the compiler won't cast ~3 to int since the code will be written as: 1791 | if (mig_unlikely (msgh_size != 36 + ((OutP->nameType.msgt_number + 3) & ~3U))) Message-ID: <hwbytulqiyx3ga3grvgpkgiekriqrogfv4lqasi74hqpeft7im@ipoz6pu44veo>
* x86_64: adapt MiG generated stubs to use mach_port_name_inlined_t for ↵Flavio Cruz2023-12-171-31/+92
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* Revert "x86_64: adapt MiG generated stubs to use mach_port_name_inlined_t ↵Samuel Thibault2023-12-031-92/+31
| | | | | | for inlined port rights." This reverts commit c40604042bd6e9f80e4f5fe6bc9deefb29c4b94a.
* x86_64: adapt MiG generated stubs to use mach_port_name_inlined_t for ↵Flavio Cruz2023-12-031-31/+92
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Fix printing size_tSamuel Thibault2023-05-201-2/+2
|
* Stop including mach/msg_type.h in generated code.Flavio Cruz2023-02-201-1/+0
| | | | | File is not needed. Message-Id: <Y/K1bKVZXhYM7X9W@jupiter.tail36e24.ts.net>
* Introduce complex_alignof to replace word_sizeFlavio Cruz2023-02-131-11/+11
| | | | | | | 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>
* Avoid passing NULL to memcpySamuel Thibault2023-02-021-4/+5
|
* mig: replace boolean.h with stdbool.hFlavio Cruz2022-11-251-2/+2
| | | | Message-Id: <Y3/Z1CGL8D4OwT66@viriathus>
* fill msg size in the header for user stubsLuca Dariz2022-08-271-1/+5
| | | | | | | | | * user.c: - adjust comment in generated file - set msgh_size with the same value passed to mach_msg() Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20220628094927.442907-4-luca@orpolo.org>
* add check for whole message sizeLuca Dariz2022-08-271-1/+6
| | | | | | | | * user.c: ensure fixed-length messages have the correct size. In addition to the single-fields check, this also include padding. Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20220628094927.442907-3-luca@orpolo.org>
* Add _Static_assert when compiling server and user stubs.Flavio Cruz2022-01-211-1/+1
| | | | | | | | | This is only done when data is inlined with a concrete size. It ensures the C and Mig types have the same size in the target arch. Tested by building the hurd package. No assertions were triggered. Message-Id: <YekIQaxvs+4FrHyw@viriathus>
* Include stdint.h in stub code by default.Flavio Cruz2016-04-051-0/+1
| | | | | * server.c: Include stdint.h in the header code. * user.c: Likewise.
* Use word_size instead of 4.Flavio Cruz2016-04-031-11/+11
| | | | | | * server.c: Use word_size and update comments. * type.c: Use word_size to compute padding. * user.c: Use word_size and update comments.
* Remove functions, procedures and simple procedures.Flavio Cruz2016-03-201-24/+8
| | | | | | | | | | | | | 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.
* Do not generate code dereferencing type-punned pointersJustus Winter2015-02-151-4/+5
| | | | | | | | | | | | | | | | | | | | | | 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.
* Add static branch prediction to type checksJustus Winter2014-12-011-12/+15
| | | | | | | | | Annotate generated type checks with static branch prediction optimizing well-formed messages. * utils.c (WriteBogusDefines): Define `mig_unlikely' if not defined. * server.c: Use `mig_unlikely' in generated type checks. * user.c: Likewise.
* Fix variable-sized c stringsJustus Winter2014-02-211-0/+5
| | | | | | | | | | | | Previously, the terminating zero of variable-sized c strings was only included when copying the message if the length of the string was not a multiple of four. mig_strncpy returns the length of the string excluding the terminating zero. Fix this by properly accounting for the byte for the terminating zero in the array length. * server.c (WritePackArgValue): Account for the terminating zero in the array length. * user.c (WritePackArgValue): Likewise.
* Drop the register keywordJustus Winter2013-08-191-52/+52
| | | | | | | | | | | | | | | | | | | 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.
* Fix indentationSamuel Thibault2010-01-041-1/+1
| | | | | * user.c (WriteCheckIdentity): Prepend `\t' before calling WriteMsgError.
* Fix warning during mach compilationSamuel Thibault2009-10-251-0/+2
| | | | | * user.c (WriteIncludes): Include <kern/ipc_mig.h> when building kernel user.
* 2007-06-02 Thomas Schwinge <tschwinge@gnu.org>Thomas Schwinge2007-06-021-1/+0
| | | | | | | | | * 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-03 Leonardo Lopes Pereira <leonardolopespereira@gmail.com>Thomas Schwinge2006-12-031-40/+2
| | | | | | | | | | | | [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.
* 2006-11-29 Thomas Schwinge <tschwinge@gnu.org>Thomas Schwinge2006-11-301-1/+3
| | | | | | | | | | | | | | | | | 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.
* 2006-07-29 Ognyan Kulev <ogi@fmi.uni-sofia.bg>Thomas Schwinge2006-07-281-1/+3
| | | | | | * migcom.c (myfclose): New function. (main): Use myfclose instead of fclose. * user.c (WriteUserIndividual): Check for errors when closing file.
* 2004-02-10 Roland McGrath <roland@frob.com>Roland McGrath2004-02-111-1/+1
| | | | | | | | * user.c (WriteTypeCheck): Use BAD_TYPECHECK macro instead of type-pun. * server.c (WriteTypeCheck): Likewise. * utils.c (WriteBogusDefines): Write a #define for that macro. * utils.c (WriteCheckDecl): Write auto const, not static const. (WriteStaticShortDecl, WriteStaticLongDecl): Likewise.
* 1999-10-11 Roland McGrath <roland@baalperazim.frob.com>Roland McGrath1999-10-111-1/+1
| | | | | * user.c (WriteIncludes): Fix missing newline in last change. * server.c (WriteIncludes): Likewise.
* 1999-10-08 Roland McGrath <roland@baalperazim.frob.com>Roland McGrath1999-10-091-12/+16
| | | | | | | | | | * server.c (WriteIncludes): Write: #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif into the output before all else. This is required for building stubs with GNU libc's built-in Mach/MiG support code. * user.c (WriteIncludes): Likewise.
* Created new module from gnumach/mig at tag before-mig-moveRoland McGrath1998-07-181-0/+1332