home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.os.development      Operating system development chatter      4,255 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 3,441 of 4,255   
   mutazilah@gmail.com to Joe Monk   
   Re: segmentation (1/2)   
   15 Nov 22 17:44:32   
   
   From: muta...@gmail.com   
      
   On Sunday, November 13, 2022 at 12:09:20 AM UTC+8, Joe Monk wrote:   
   > > And they don't care if there are more than 32 address bits   
   > > being operated on, so long as someone has gone to the effort of   
   > > carefully initializing them, typically to 0, but under 64-bit   
   > > pdos-generic, other numbers will be carefully put into the high   
   > > 32 bits of each register, before calling   
   > > THE 32-BIT APPLICATION.   
   > >   
   > Show me the generated z/Arch assembler for one of your "applications".   
      
   I just wrote this for Windows:   
      
   C:\devel\pdos\pdpclib>pdptest   
   usage: pdptest    
   fills up memory as a speed test   
      
   C:\devel\pdos\pdpclib>pdptest 55   
   finished   
      
      
   Here is the C code:   
      
   #include    
   #include    
   #include    
      
   int main(int argc, char **argv)   
   {   
       char *buf;   
       size_t len;   
       size_t x;   
      
       if (argc <= 1)   
       {   
           printf("usage: pdptest \n");   
           printf("fills up memory as a speed test\n");   
           return (EXIT_FAILURE);   
       }   
      
       len = (size_t)strtoul(*(argv + 1), NULL, 10);   
       buf = malloc(len);   
       if (buf == NULL)   
       {   
           printf("failed to allocate %lu bytes\n", (unsigned long)len);   
           return (EXIT_FAILURE);   
       }   
      
       for (x = 0; x < len; x++)   
       {   
           buf[x] = (char)(5 * x);   
       }   
      
       printf("finished\n");   
       return (EXIT_SUCCESS);   
   }   
      
      
   And here is the output of gccmvs:   
      
   C:\devel\pdos\pdpclib>gccmvs -S -I . -Os pdptest.c   
      
   C:\devel\pdos\pdpclib>   
      
      
            COPY  PDPTOP   
            CSECT   
   * Program text area   
   @@LC3    EQU   *   
            DC    C'finished'   
            DC    X'15'   
            DC    X'0'   
   @@LC2    EQU   *   
            DC    C'failed to allocate %lu bytes'   
            DC    X'15'   
            DC    X'0'   
   @@LC0    EQU   *   
            DC    C'usage: pdptest '   
            DC    X'15'   
            DC    X'0'   
   @@LC1    EQU   *   
            DC    C'fills up memory as a speed test'   
            DC    X'15'   
            DC    X'0'   
            DS    0F   
            COPY  PDPMAIN   
   * X-func main prologue   
   MAIN     PDPPRLG CINDEX=0,FRAME=104,BASER=12,ENTRY=YES   
            B     @@FEN0   
            LTORG   
   @@FEN0   EQU   *   
            DROP  12   
            BALR  12,0   
            USING *,12   
   @@PG0    EQU   *   
            LR    11,1   
            L     10,=A(@@PGT0)   
   * Function main code   
            L     2,0(11)   
            LA    3,1(0,0)   
            CR    2,3   
            BNH   @@L12   
            L     2,4(11)   
            MVC   88(4,13),4(2)   
            MVC   92(4,13),=F'0'   
            MVC   96(4,13),=F'10'   
            LA    1,88(,13)   
            L     15,=V(STRTOUL)   
            BALR  14,15   
            LR    3,15   
            ST    15,88(13)   
            LA    1,88(,13)   
            L     15,=V(MALLOC)   
            BALR  14,15   
            LTR   15,15   
            BE    @@L13   
            SLR   2,2   
            CLR   2,3   
            BNL   @@L10   
            LR    4,2   
   @@L8     EQU   *   
            STC   4,0(2,15)   
            A     4,=F'5'   
            A     2,=F'1'   
            CLR   2,3   
            BL    @@L8   
   @@L10    EQU   *   
            MVC   88(4,13),=A(@@LC3)   
            LA    1,88(,13)   
            L     15,=V(PRINTF)   
            BALR  14,15   
            SLR   15,15   
            B     @@L1   
   @@L13    EQU   *   
            MVC   88(4,13),=A(@@LC2)   
            ST    3,92(13)   
   @@L11    EQU   *   
            LA    1,88(,13)   
            L     15,=V(PRINTF)   
            BALR  14,15   
            LA    15,12(0,0)   
            B     @@L1   
   @@L12    EQU   *   
            MVC   88(4,13),=A(@@LC0)   
            LA    1,88(,13)   
            L     15,=V(PRINTF)   
            BALR  14,15   
            MVC   88(4,13),=A(@@LC1)   
            B     @@L11   
   @@L1     EQU   *   
   * Function main epilogue   
            PDPEPIL   
   * Function main literal pool   
            DS    0F   
            LTORG   
   * Function main page table   
            DS    0F   
   @@PGT0   EQU   *   
            DC    A(@@PG0)   
            END   @@MAIN   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca