boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

user.h (2906B)


      1 /* -*-comment-start: "//";comment-end:""-*-
      2  * GNU Mes --- Maxwell Equations of Software
      3  * Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
      4  *
      5  * This file is part of GNU Mes.
      6  *
      7  * GNU Mes is free software; you can redistribute it and/or modify it
      8  * under the terms of the GNU General Public License as published by
      9  * the Free Software Foundation; either version 3 of the License, or (at
     10  * your option) any later version.
     11  *
     12  * GNU Mes is distributed in the hope that it will be useful, but
     13  * WITHOUT ANY WARRANTY; without even the implied warranty of
     14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15  * GNU General Public License for more details.
     16  *
     17  * You should have received a copy of the GNU General Public License
     18  * along with GNU Mes.  If not, see <http://www.gnu.org/licenses/>.
     19  */
     20 #ifndef __MES_SYS_USER_H
     21 #define __MES_SYS_USER_H 1
     22 
     23 #if SYSTEM_LIBC
     24 #undef __MES_SYS_USER_H
     25 #include_next <sys/user.h>
     26 
     27 #else // ! SYSTEM_LIBC
     28 
     29 /* These are the 32-bit x86 structures.  */
     30 struct user_fpregs_struct
     31 {
     32   long int cwd;
     33   long int swd;
     34   long int twd;
     35   long int fip;
     36   long int fcs;
     37   long int foo;
     38   long int fos;
     39   long int st_space[20];
     40 };
     41 
     42 struct user_fpxregs_struct
     43 {
     44   unsigned short int cwd;
     45   unsigned short int swd;
     46   unsigned short int twd;
     47   unsigned short int fop;
     48   long int fip;
     49   long int fcs;
     50   long int foo;
     51   long int fos;
     52   long int mxcsr;
     53   long int reserved;
     54   long int st_space[32];        /* 8*16 bytes for each FP-reg = 128 bytes */
     55   long int xmm_space[32];       /* 8*16 bytes for each XMM-reg = 128 bytes */
     56   long int padding[56];
     57 };
     58 
     59 struct user_regs_struct
     60 {
     61   long int ebx;
     62   long int ecx;
     63   long int edx;
     64   long int esi;
     65   long int edi;
     66   long int ebp;
     67   long int eax;
     68   long int xds;
     69   long int xes;
     70   long int xfs;
     71   long int xgs;
     72   long int orig_eax;
     73   long int eip;
     74   long int xcs;
     75   long int eflags;
     76   long int esp;
     77   long int xss;
     78 };
     79 
     80 // *INDENT-OFF*
     81 struct user
     82 {
     83   struct user_regs_struct    regs;
     84   int                        u_fpvalid;
     85   struct user_fpregs_struct  i387;
     86   unsigned long int          u_tsize;
     87   unsigned long int          u_dsize;
     88   unsigned long int          u_ssize;
     89   unsigned long int          start_code;
     90   unsigned long int          start_stack;
     91   long int                   signal;
     92   int                        reserved;
     93   struct user_regs_struct   *u_ar0;
     94   struct user_fpregs_struct *u_fpstate;
     95   unsigned long int          magic;
     96   char                       u_comm [32];
     97   int                        u_debugreg [8];
     98 };
     99 
    100 #define PAGE_SHIFT           12
    101 #define PAGE_SIZE            (1UL << PAGE_SHIFT)
    102 #define PAGE_MASK            (~(PAGE_SIZE-1))
    103 #define NBPG                 PAGE_SIZE
    104 #define UPAGES               1
    105 #define HOST_TEXT_START_ADDR (u.start_code)
    106 #define HOST_STACK_END_ADDR  (u.start_stack + u.u_ssize * NBPG)
    107 // *INDENT-ON*
    108 
    109 #endif // ! SYSTEM_LIBC
    110 
    111 #endif // __MES_SYS_USER_H