| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
Message-Id: <ZAbgdBuKlIIiF6zA@jupiter.tail36e24.ts.net>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
By using uintptr_t, we ensure that all 64 bit stubs are free of
undefined behavior since we support up to 8-byte alignment. This works
fine given that Mig will type check types that have higher alignment
requirements through the use of _Static_assert.
This even works for a 64 bit kernel / 32 bit user land since we can use
mig64 to build stubs for the 8-byte aligned kernel stubs and existing 32
bit mig to build the old user side stubs. Pragma is no longer required as we take
advantage of the compiler to drive the alignment and avoid undefined
behavior.
Message-Id: <Y/KsiXZKkq1q/D+3@jupiter.tail36e24.ts.net>
|
|
|
|
|
|
| |
This was a miss in the previous patch given that mach_msg_type_long_t is
12 bytes long so won't neatly align to 8 bytes.
Message-Id: <Y+8VyADQ8+bRRUcp@jupiter.tail36e24.ts.net>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On x86_64 alignment of structures is different, as the pointer size is different.
For simplicity we keep the same 4-byte alignment as used on
32-bit. This simplifies the support for 32-bit rpc on 64-bit kernels,
and also it seems not worth as an optimization, as we would need to
add more code in the ipc_kmsg* routines.
* routine.c: align both short and long descriptors
* utils.c: use a fixed alignment for data fields in structures
representing messages.
Signed-off-by: Luca Dariz <luca@orpolo.org>
Message-Id: <20220628094927.442907-2-luca@orpolo.org>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
Although in practice the buffers can be modified since they are from the
message, it leads to missing const where it would otherwise make sense.
|
|
|
|
| |
to avoid forcing the caller to respect the definite string size.
|
|
|
|
|
|
|
|
|
|
| |
This will allow to relieve constraints in callers, e.g. dir_lookup("") would
otherwise produce a warning with gcc-11 since char[1024] would mean that
dir_lookup would read all 1024 characters while it is not.
* utils.c (UserVarQualifier): Also use const_ qualifier when type is
string_t.
* tests/includes/types.h (const_string_t): New type.
|
|
|
|
|
|
|
|
|
|
| |
Users of RPCs want to be able to pass pointers to const data, so add
const qualifiers to RPCs as appropriate.
* utils.c (UserVarConst, UserVarQualifier): New functions.
(WriteUserVarDecl): Use UserVarQualifier to qualify function parameter.
(WriteFieldDeclPrim): Use UserVarConst to qualify pointer to user
variable.
|
|
|
|
|
|
|
|
|
| |
Nowadays' compilers are able to recognize memcpy and replace it
appropriately without having to tell them so through a structure
assignment. That also avoids warnings about type puning.
* utils.c (WriteCopyType): Emit memcpy call instead of type-puned
assignement.
|
|
|
|
|
| |
* utils.c (WriteStaticLongDecl): Explicitly cast name to unsigned short to
ignore truncation of MACH_MSG_TYPE_POLYMORPHIC i.e. -1.
|
|
|
|
|
| |
* utils.c (WriteCheckDecl, WriteStaticShortDecl): Explicitly cast name to
unsigned char to ignore truncation of MACH_MSG_TYPE_POLYMORPHIC i.e. -1.
|
|
|
|
| |
* utils.c: Generate code using uint32_t.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
Drop the auto keyword from the generated source code. auto is the
default storage type for variables anyway and it is customary to omit
it.
* utils.c (WriteCheckDecl): Drop auto from generated source.
(WriteStaticLongDecl): Likewise.
(WriteStaticShortDecl): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
| |
* utils.c (do_skip_vfprintf): New macro.
(WriteCopyType, WritePackMsgType): Use that, so we do va_start and
va_end independently around each SkipVFPrintf call.
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|