bug-mes
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] include: Add ucontext_t for all architectures


From: Janneke Nieuwenhuizen
Subject: Re: [PATCH v2] include: Add ucontext_t for all architectures
Date: Wed, 28 Feb 2024 10:27:21 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Ekaitz Zarraga writes:

Thanks!  Looks pretty good, again, I only changed some nitpicks, mostly
whitespace, copyright, alphabetical ordering, etc.  As you're looking to
be a guix commiter, find the range-diff below.:)

(I kind of like your "include: " prefix, but we went from "Mes C Lib: ",
to "lib: ", so while this only touches include/, let's keep the "lib: "
prefix.  Possibly include/ should have been moved into lib/, but let's
not go there now).

Greetings,
Janneke

1:  df6ddd379 ! 1:  f677ede39 include: Add ucontext_t for all architectures
    @@ Metadata
     Author: Ekaitz Zarraga <ekaitz@elenq.tech>
     
      ## Commit message ##
    -    include: Add ucontext_t for all architectures
    +    lib: Add ucontext_t for all architectures.
     
         ucontext_t is used by `tcc -run` and it affects the compilation process
    -    of that. If we don't have the data structures defined the build process
    -    of tcc-mob later in the chain fails. We don't use the `-run` option for
    +    of that.  If we don't have the data structures defined the build 
process
    +    of tcc-mob later in the chain fails.  We don't use the `-run` option 
for
         anything in the bootstrapping process, but as we do `ONE_SOURCE` that
    -    affect our building process. The cleanest solution is to add the proper
    +    affect our building process.  The cleanest solution is to add the 
proper
         support here and forget about it.
     
         This commit copies the code from musl libc, using the GNU_SOURCE part 
of
    -    the `#ifdef`s in there as that's what tcc expects. We can do better but
    +    the `#ifdef`s in there as that's what tcc expects.  We can do better 
but
         the goal of the commit is to make the bare minimum.
     
    -    * include/signal.h (ucontext_t): Move current i386 support to separate
    -      file.
    -    * include/gnu/x86/signal.h: Add it.
    -    * include/linux/x86/signal.h: Add it.
    -    * include/linux/x86_64/signal.h: Add it.
    -    * include/linux/arm/signal.h: Add it.
    -    * include/linux/riscv64/signal.h: Add it.
    +    * include/signal.h (ucontext_t): Move current i386 support to...
    +    * include/gnu/x86/signal.h: ...this new file.
    +    * include/linux/x86/signal.h,
    +    include/linux/x86_64/signal.h,
    +    include/linux/arm/signal.h,
    +    include/linux/riscv64/signal.h: New files.
         * simple.sh: Add support for multiple signal.h files.
    -    * configure.sh: Add support for multiple signal.h files.
    -    * configure: Add support for multiple signal.h files.
    +    * configure.sh: Likewise.
    +    * configure: Likewise.
     
      ## configure ##
     @@ configure: See \"Porting GNU Mes\" in the manual, or try 
--with-courage\n" mes-system)
    @@ configure: See \"Porting GNU Mes\" in the manual, or try 
--with-courage\n" mes-s
                         (string-append "include/arch/" file-name)))
              (system* "mkdir" "-p" "include/arch")
     -        (for-each copy-header '("kernel-stat.h" "syscall.h")))
    -+        (for-each copy-header '("kernel-stat.h" "syscall.h" "signal.h")))
    ++        (for-each copy-header '("kernel-stat.h" "signal.h" "syscall.h")))
      
            (let ((make (and=> (file-name "make" deps) basename)))
              (display (string-append "
     
      ## configure.sh ##
    +@@
    + 
    + # GNU Mes --- Maxwell Equations of Software
    + # Copyright © 2018,2019,2021,2022,2023,2024 Janneke Nieuwenhuizen 
<janneke@gnu.org>
    +-# Copyright © 2023 Ekaitz Zarraga <ekaitz@elenq.tech>
    ++# Copyright © 2023, 2024 Ekaitz Zarraga <ekaitz@elenq.tech>
    + #
    + # This file is part of GNU Mes.
    + #
     @@ configure.sh: EOF
    + 
      mkdir -p include/arch
      cp -f -v ${srcdest}include/${mes_kernel}/${mes_cpu}/kernel-stat.h 
include/arch
    - cp -f -v ${srcdest}include/${mes_kernel}/${mes_cpu}/syscall.h include/arch
     +cp -f -v ${srcdest}include/${mes_kernel}/${mes_cpu}/signal.h include/arch
    + cp -f -v ${srcdest}include/${mes_kernel}/${mes_cpu}/syscall.h include/arch
      
      cat <<EOF
    - GNU Mes is configured for
     
      ## include/gnu/x86/signal.h (new) ##
     @@
    @@ include/linux/arm/signal.h (new)
     +
     +typedef int greg_t
     +typedef int gregset_t[18];
    -+typedef struct sigcontext {
    -+  unsigned long trap_no, error_code, oldmask;
    -+  unsigned long arm_r0, arm_r1, arm_r2, arm_r3;
    -+  unsigned long arm_r4, arm_r5, arm_r6, arm_r7;
    -+  unsigned long arm_r8, arm_r9, arm_r10, arm_fp;
    -+  unsigned long arm_ip, arm_sp, arm_lr, arm_pc;
    -+  unsigned long arm_cpsr, fault_address;
    ++typedef struct sigcontext
    ++{
    ++  unsigned long trap_no, error_code, oldmask;
    ++  unsigned long arm_r0, arm_r1, arm_r2, arm_r3;
    ++  unsigned long arm_r4, arm_r5, arm_r6, arm_r7;
    ++  unsigned long arm_r8, arm_r9, arm_r10, arm_fp;
    ++  unsigned long arm_ip, arm_sp, arm_lr, arm_pc;
    ++  unsigned long arm_cpsr, fault_address;
     +} mcontext_t;
     +
    -+struct sigaltstack {
    -+  void *ss_sp;
    -+  int ss_flags;
    -+  size_t ss_size;
    ++struct sigaltstack
    ++{
    ++  void *ss_sp;
    ++  int ss_flags;
    ++  size_t ss_size;
     +};
     +
    -+typedef struct __ucontext {
    -+  unsigned long uc_flags;
    -+  struct __ucontext *uc_link;
    -+  stack_t uc_stack;
    -+  mcontext_t uc_mcontext;
    -+  sigset_t uc_sigmask;
    -+  unsigned long long uc_regspace[64];
    ++typedef struct __ucontext
    ++{
    ++  unsigned long uc_flags;
    ++  struct __ucontext *uc_link;
    ++  stack_t uc_stack;
    ++  mcontext_t uc_mcontext;
    ++  sigset_t uc_sigmask;
    ++  unsigned long long uc_regspace[64];
     +} ucontext_t;
     
      ## include/linux/riscv64/signal.h (new) ##
    @@ include/linux/x86_64/signal.h (new)
     +
     +struct __st
     +{
    -+    unsigned short significand[4], exponent, padding[3];
    ++  unsigned short significand[4], exponent, padding[3];
     +};
     +
     +struct _xmm
     +{
    -+    unsigned element[4];
    ++  unsigned element[4];
     +};
     +
     +typedef struct _fpstate
    @@ include/signal.h: struct sigaction
     
      ## simple.sh ##
     @@ simple.sh: EOF
    + 
      mkdir -p include/arch
      cp -f include/$mes_kernel/$mes_cpu/kernel-stat.h include/arch
    - cp -f include/$mes_kernel/$mes_cpu/syscall.h include/arch
     +cp -f include/$mes_kernel/$mes_cpu/signal.h include/arch
    + cp -f include/$mes_kernel/$mes_cpu/syscall.h include/arch
      
      ## Build ##
    - compiler=gcc     # not configurable


-- 
Janneke Nieuwenhuizen <janneke@gnu.org>  | GNU LilyPond https://LilyPond.org
Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com



reply via email to

[Prev in Thread] Current Thread [Next in Thread]