Subversion Repositories tendra.SVN

Rev

Rev 6 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6 7u83 1
<?xml version="1.0" standalone="no"?>
2
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
3
  "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
4
 
5
<!--
6
  $Id$
7
-->
8
 
9
<book>
10
  <bookinfo>
11
    <title>Validation of TenDRA Capability to Implement a UNIX-like Operating
12
      System</title>
13
 
14
    <corpauthor>The TenDRA Project</corpauthor>
15
 
16
    <authorgroup>
17
      <author>
18
        <firstname>Fran&ccedil;ois</firstname>
19
        <surname>de Ferri&egrave;re</surname>
20
        <affiliation>
21
          <orgname>Open Software Foundation Research Institute</orgname>
22
        </affiliation>
23
      </author>
24
 
25
      <author>
26
        <firstname>Fred</firstname>
27
        <surname>Roy</surname>
28
        <affiliation>
29
          <orgname>Open Software Foundation Research Institute</orgname>
30
        </affiliation>
31
      </author>
32
 
33
      <editor>
34
        <firstname>Jeroen</firstname>
35
        <surname>Ruigrok van der Werven</surname>
36
      </editor>
37
    </authorgroup>
38
 
39
    <abstract>
40
      <para>This is the final report on work undertaken in relation to the
41
        UnixWare(R) operating system on the Intel platform, carried out under
42
        contract for the UK Defence Research Agency.</para>
43
    </abstract>
44
  </bookinfo>
45
 
46
  <chapter>
47
    <title>Objectives and Description</title>
48
 
49
    <sect1>
50
      <title>Objectives</title>
51
 
52
      <para>A first objective of this project was to perform validation,
53
        performance and robustness testing of the TenDRA technology to ensure
54
        its capability to implement and fully bootstrap a UNIX-like operating
55
        system on a variety of target processor architectures.</para>
56
 
57
      <para>Another objective was to provide an assessment of TenDRA
58
        technology to express a fully portable operating system
59
        implementation.</para>
60
 
61
      <para>This report summarizes the work done with respect to these two
62
        objectives.</para>
63
    </sect1>
64
 
65
    <sect1>
66
      <title>General description</title>
67
 
68
      <para>A Unix system can be divided into three parts, which characterize
69
        the portability level of the code:</para>
70
 
71
      <itemizedlist>
72
        <listitem>
73
          <para>The Kernel, which has some parts in assembler, e.g.  for
74
            context switching, interruptions, locks, or parts of device
75
            drivers.  Assembly code is used either in separate files or is
76
            embedded in C programs or header files.</para>
77
        </listitem>
78
 
79
        <listitem>
80
          <para>The Libraries, some of which may contain assembly code.  The
81
            crt0 library and code for system calls are examples.</para>
82
        </listitem>
83
 
84
        <listitem>
85
          <para>The Commands, in which use of assembly code is very unusual.
86
            They share a non-explicit API with the libraries against which
87
            they are built.</para>
88
        </listitem>
89
      </itemizedlist>
90
 
91
      <para>As for other software OSF already ported to ANDF, the port of the
92
        Unix system has been done in three successive steps:</para>
93
 
94
      <itemizedlist>
95
        <listitem>
96
          <para>The NAT-NAT step, which consists in rebuilding the system with
97
            the native compilation chain, to ensure that the system can be
98
            regenerated from the set of sources.</para>
99
        </listitem>
100
 
101
        <listitem>
102
          <para>The DRA-NAT step, for which the TenDRA technology is employed
103
            as a replacement of the native compilation chain to build the
104
            system, using the native system header files, as for a classical
105
            compilation chain. This part involves dealing with assembler
106
            issues as well as discrepancies between the native and the TenDRA
107
            code generators. Note that Unix systems are known to be compiler
108
            dependent.</para>
109
        </listitem>
110
 
111
        <listitem>
112
          <para>The DRA-DRA step, which consists in using the TenDRA
113
            technology as a portability tool. The API shared by the commands
114
            and libraries has to be defined, and used to produce architecture
115
            independent ANDF code for these parts. This code is then installed
116
            and validated on the selected machines. Note that the kernel part
117
            of the Unix system has not been included in this task since it is
118
            essentially not portable.</para>
119
        </listitem>
120
      </itemizedlist>
121
    </sect1>
122
 
123
    <sect1>
124
      <title>Choice of a UNIX system and update of the objectives</title>
125
 
126
      <para>We have used the source for the UnixWare system as the base for
127
        performing the port of a Unix source code. We originally planned to
128
        conduct the experiment on two different platforms: an Intel/386
129
        platform and a Sun/Sparc one. The NAT-NAT, DRA-NAT and part of the
130
        DRA-DRA steps have been achieved on the Intel/386 platform. Then, in
131
        the light of the experience we gained from this work, we decided to
132
        re-focus the project on a more complete DRA-DRA experiment, with a
133
        different Unix system.  This report only covers that part of the work
134
        done up to this change.</para>
135
    </sect1>
136
 
137
    <sect1>
138
      <title>Choice of the validation tools</title>
139
 
140
      <para>Throughout this experiment we had to validate the various parts of
141
        the system we built.</para>
142
 
143
      <para>A first level of validation was achieved by using the kernel and
144
        commands built in the DRA-NAT step for our daily work. In addition, we
145
        used the VSX4 and AIMIII validation suites to test more thoroughly the
146
        robustness and performance of the system built in DRA-NAT mode.</para>
147
    </sect1>
148
  </chapter>
149
 
150
  <chapter>
151
    <title>Software Information</title>
152
 
153
    <para><emphasis>Software Category</emphasis></para>
154
 
155
    <para>UnixWare is a desktop Operating System derived from System V release
156
      4.2.</para>
157
 
158
    <para>It includes support for TCP/IP and Netware networking, X/Window,
159
      Motif and a Desktop Manager.</para>
160
 
161
    <para><emphasis>UnixWare Version and Release Level</emphasis></para>
162
 
163
    <para>A beta release of UnixWare version 2.0 for the Intel386 family
164
      (Load q7.1) source code was used.</para>
165
 
166
    <para><emphasis>Authors</emphasis></para>
167
 
168
    <para>The authors of the UnixWare system are the Novell, Inc., with
169
      portions of code developed by other contributors such as the University
170
      of Berkeley and MIT.</para>
171
 
172
    <para><emphasis>Source code</emphasis></para>
173
 
174
    <para>The source code delivery for UnixWare 2.0 beta release represents
175
      approximately 240 Mbytes of code. Most of the system has been recompiled
176
      during the NAT-NAT phase of this project.</para>
177
 
178
    <para>Included in this code is a graphical interface, based on X11 and
179
      Motif. However, since this interface contains some code delivered in
180
      binary format and since this interface is an optional part of a Unix
181
      system, we did not use this code.</para>
182
 
183
    <table>
184
      <title>Rough source code distribution</title>
185
 
186
      <tgroup align="center" cols="6" colsep="1" rowsep="1">
187
        <thead>
188
          <row>
189
            <entry>Libraries</entry>
190
            <entry>Kernel</entry>
191
            <entry>Commands &amp; tools</entry>
192
            <entry>Graphics</entry>
193
            <entry>Misc.</entry>
194
            <entry>Total</entry>
195
          </row>
196
        </thead>
197
 
198
        <tbody>
199
          <row>
200
            <entry>15MB</entry>
201
            <entry>30MB</entry>
202
            <entry>101MB</entry>
203
            <entry>85MB</entry>
204
            <entry>11MB</entry>
205
            <entry>242MB</entry>
206
          </row>
207
        </tbody>
208
      </tgroup>
209
    </table>
210
 
211
    <para>In addition, various data files are delivered, for configuration and
212
      messaging, especially under Command &amp; tools directories. In
213
      addition, some parts of the system, for example the kernel code for the
214
      vxfs file system and some device drivers, appear to be delivered in
215
      binary format only. So, a more accurate view of the volume of source
216
      code submitted to the TenDRA technology is provided by sizing the C
217
      language source files only:</para>
218
 
219
    <table>
220
      <title>C language files</title>
221
      <tgroup align="center" cols="5" colsep="1" rowsep="1">
222
        <thead>
223
          <row>
224
            <entry>Headers</entry>
225
            <entry>Libraries</entry>
226
            <entry>Kernel</entry>
227
            <entry>Commands &amp; tools</entry>
228
            <entry>Total</entry>
229
          </row>
230
        </thead>
231
        <tbody>
232
          <row>
233
            <entry>19.7MB</entry>
234
            <entry>11.2MB</entry>
235
            <entry>19.8MB</entry>
236
            <entry>39.6MB</entry>
237
            <entry>90.3MB</entry>
238
          </row>
239
        </tbody>
240
      </tgroup>
241
    </table>
242
 
243
    <para><emphasis>TenDRA (ANDF) Technology Version Release</emphasis></para>
244
 
245
    <para>The TDF snapshot dated December 94 (svr4_i386 target) has been used;
246
      it is based on the TDF Specification Issue 3.0.</para>
247
 
248
    <para><emphasis>Validation tools</emphasis></para>
249
 
250
    <itemizedlist>
251
      <listitem>
252
        <para>X/OPEN Verification Suite release 4.2.4</para>
253
      </listitem>
254
 
255
      <listitem>
256
        <para>AIM Suite III v3.1 (AIM Technology Inc.)</para>
257
      </listitem>
258
    </itemizedlist>
259
 
260
    <para><emphasis>OS Platform Environment</emphasis></para>
261
 
262
    <para>Two identical Intel486 PCs running UnixWare 2.0 and more than 1 GB
263
      of disk space, mostly through NFS servers.</para>
264
  </chapter>
265
 
266
  <chapter id="project-phase">
267
    <title>Description of Project phases</title>
268
 
269
    <para>In this section we describe the tasks which have been performed
270
      under this project on the Intel/386 platform. As already mentioned in
271
      this report, the work has been split into three main stages, named the
272
      NAT-NAT, DRA-NAT and DRA-DRA steps. Preliminary to these steps, an
273
      installation phase was needed to set up the environment and tools for
274
      this project.</para>
275
 
276
    <para><emphasis>Installation phase:</emphasis></para>
277
 
278
    <para><emphasis>T1.</emphasis> UnixWare installation.</para>
279
 
280
    <itemizedlist>
281
      <listitem>
282
        <para>Install the complete binary code of UnixWare.</para>
283
 
284
        <para>This task consisted in running the UnixWare installation
285
          procedure, from the tape we received, on an Intel/386 machine. When
286
          this was completed, we installed a second identical machine with the
287
          same configuration. Because we used a beta version of the system, we
288
          found a few problems, which were solved with assistance from Novell,
289
          Inc.</para>
290
      </listitem>
291
 
292
      <listitem>
293
        <para>Perform some checks to verify that the installation is
294
          correct.</para>
295
 
296
        <para>We used these two machines as our normal development
297
          machines.</para>
298
      </listitem>
299
 
300
      <listitem>
301
        <para>Install UnixWare source code and setup various build
302
          environments.</para>
303
 
304
        <para>A build environment was provided with the source code delivery
305
          of the system. We made a few modifications to it in order to create
306
          one build environment for each of the NAT-NAT, DRA-NAT and DRA-DRA
307
          phases.</para>
308
      </listitem>
309
    </itemizedlist>
310
 
311
    <para><emphasis>Delivery</emphasis>: System running.</para>
312
 
313
    <para><emphasis>T2. </emphasis>TenDRA installation.</para>
314
 
315
    <itemizedlist>
316
      <listitem>
317
        <para>Install the TenDRA technology for UnixWare.</para>
318
 
319
        <para>We obtained from DRA a complete TenDRA technology delivery for
320
          the UnixWare system. We just needed to recompile some executables
321
          since we were not running the same version of the system as
322
          them.</para>
323
      </listitem>
324
    </itemizedlist>
325
 
326
    <para><emphasis>Delivery</emphasis>: TenDRA installed.</para>
327
 
328
    <para><emphasis>T3.</emphasis>Validation suites installation.</para>
329
 
330
    <itemizedlist>
331
      <listitem>
332
        <para>Install the VSX4 suite which is used to check the kernel,
333
        the main libraries and some commands of the system built in DRA-NAT
334
        phase.</para>
335
 
336
        <para>The VSX4 suite was installed for the NAT-NAT version of the
337
          system. Next, a new image of the suite for the validation of the
338
          DRA-NAT system was created.</para>
339
      </listitem>
340
 
341
      <listitem>
342
        <para>Install the AIMIII suite which is used to check the robustness
343
          and performance of the system.</para>
344
 
345
        <para>The AIMIII suite was installed to check the native system and
346
        then the DRA-NAT one.</para>
347
      </listitem>
348
    </itemizedlist>
349
 
350
    <para><emphasis>Delivery</emphasis>: Validation suites installed.</para>
351
 
352
    <para><emphasis>NAT-NAT phase:</emphasis></para>
353
 
354
    <para><emphasis>T4.</emphasis> NAT-NAT build.</para>
355
 
356
    <itemizedlist>
357
      <listitem>
358
        <para>Compile the UnixWare build tools and libraries.</para>
359
 
360
        <para>Tools such as make, cc, ld, ..., were built during this step and
361
          then used to proceed with the compilation of the libraries.</para>
362
      </listitem>
363
 
364
      <listitem>
365
        <para>Compile the UnixWare kernel.</para>
366
 
367
        <para>A kernel, along with dynamically loadable modules, has been
368
          produced.</para>
369
      </listitem>
370
 
371
      <listitem>
372
        <para>Compile the UnixWare commands.</para>
373
 
374
        <para>All the UnixWare commands have been built in this step.</para>
375
      </listitem>
376
    </itemizedlist>
377
 
378
    <para><emphasis>Delivery</emphasis>: Reference system to which the DRA-NAT
379
      built system will be compared.</para>
380
 
381
    <para><emphasis>DRA-NAT phase:</emphasis></para>
382
 
383
    <para><emphasis>T5. </emphasis>DRA-NAT build.</para>
384
 
385
    <itemizedlist>
386
      <listitem>
387
        <para>Compile the UnixWare build tools &amp; libraries, kernel and
388
          commands using the TenDRA technology. This may show up some bugs in
389
          the TenDRA technology, as well as assembly language issues in the
390
          UnixWare source code.</para>
391
 
392
        <para>The native cc compiler was replaced by a shell script which
393
          modified some options and called the tcc TenDRA compiler in DRA-NAT
394
          mode.</para>
395
      </listitem>
396
 
397
      <listitem>
398
        <para>Report the build problems to DRA.</para>
399
 
400
        <para>When we found problems with the tcc compiler, we isolated the
401
          problem in a few lines of C code which were provided to DRA.</para>
402
      </listitem>
403
 
404
      <listitem>
405
        <para>Use temporary workarounds to complete the task as much as
406
          possible.</para>
407
 
408
        <para>When it was possible, we made temporary modifications to the
409
          source code in order to bypass the problem.</para>
410
      </listitem>
411
 
412
      <listitem>
413
        <para>Update the TenDRA technology with the fixes for the build
414
          problems.</para>
415
 
416
        <para>When fixes were received from DRA, the tenDRA technology was
417
          updated. Then, the sources where the problem showed up were
418
          recompiled.</para>
419
      </listitem>
420
    </itemizedlist>
421
 
422
    <para><emphasis>Delivery</emphasis>: Details of build problems</para>
423
 
424
    <para>System to be validated.</para>
425
 
426
    <para><emphasis>T6. </emphasis>DRA-NAT validation.</para>
427
 
428
    <itemizedlist>
429
      <listitem>
430
        <para>Replace native commands and libraries by those built in DRA-NAT
431
          mode, and boot the system with a DRA-NAT kernel.</para>
432
 
433
        <para>We progressively replaced native commands and libraries by the
434
          ones produced with the TenDRA technology in DRA-NAT mode. Similarly,
435
          we booted the system with a kernel in which we gradually added more
436
          and more components built in DRA-NAT mode.</para>
437
      </listitem>
438
 
439
      <listitem>
440
        <para>Validate the system against the VSX4 validation suite. This will
441
          exercise some commands, usual libraries and related system calls
442
          implementation inside the kernel.</para>
443
 
444
        <para>First, we ran the VSX4 validation suite on the native system.
445
          Then, we ran it on a system built in DRA-NAT mode and compared the
446
          results against those obtained with the native system.</para>
447
      </listitem>
448
 
449
      <listitem>
450
        <para>Validate the system against the AIMIII validation suite.  This
451
          will check the performances and robustness of the system with
452
          respect to time-sharing.</para>
453
 
454
        <para>We compared the results obtained when running the suite on a
455
          native system and a DRA-NAT one.</para>
456
      </listitem>
457
    </itemizedlist>
458
 
459
    <para><emphasis>Delivery</emphasis>: Validation report.</para>
460
 
461
    <para><emphasis>DRA-DRA phase:</emphasis></para>
462
 
463
    <para><emphasis>T7. </emphasis>API definition.</para>
464
 
465
    <itemizedlist>
466
      <listitem>
467
        <para>Define the non-explicit API used by the commands. Machine
468
          dependent code issues will be addressed
469
          specifically.</para>
470
 
471
        <para>We determined the basic standard interfaces upon which the
472
          interface was built. Then we extended it in order to cover a minimum
473
          set of commands.</para>
474
      </listitem>
475
 
476
      <listitem>
477
        <para>Build the token libraries for the API used by the commands and
478
          libraries.</para>
479
 
480
        <para>We used the TenDRA technology tools to describe and build the
481
          interface.</para>
482
      </listitem>
483
    </itemizedlist>
484
 
485
    <para><emphasis>T8. </emphasis>DRA-DRA assessment.</para>
486
 
487
    <itemizedlist>
488
      <listitem>
489
        <para>Build a selected set of commands.</para>
490
 
491
        <para>We built the commands which were covered by the extended
492
          interface we implemented.</para>
493
      </listitem>
494
 
495
      <listitem>
496
        <para>Report problems to DRA.</para>
497
      </listitem>
498
 
499
      <listitem>
500
        <para>Update the TenDRA technology with the fixes.</para>
501
      </listitem>
502
 
503
      <listitem>
504
        <para>Complete the compilation of the selected set of
505
          commands.</para>
506
      </listitem>
507
 
508
      <listitem>
509
        <para>Delivery: Assessment report.</para>
510
      </listitem>
511
    </itemizedlist>
512
  </chapter>
513
 
514
  <chapter id="project-environment">
515
    <title>Project environment</title>
516
 
517
    <sect1>
518
      <title>Hardware environment</title>
519
 
520
      <para>Two identical Intel/486 PCs running UnixWare 2.0 beta release have
521
        been used as the development platforms for the various build phases.
522
        Each of them was equipped with 16MB of RAM, a local 300 MB disk and an
523
        Ethernet controller.  Another 300MB disk was added to one of the
524
        machine dedicated to validation.  We also used additional disk space
525
        through NFS servers to store the UnixWare source delivery, the TenDRA
526
        compilation system as well as the object files created during the
527
        three builds. This layout permitted us to run concurrently two
528
        different builds from any of the two platforms while keeping the
529
        consistency of project files.</para>
530
 
531
      <para>During the validation process of the DRA-NAT build, one machine
532
        was dedicated to the validation tests while the other one was
533
        preserved for development purposes. This was necessary for three
534
        reasons:</para>
535
 
536
      <itemizedlist>
537
        <listitem>
538
          <para>The test machine was more likely to crash or have files
539
            corrupted.</para>
540
        </listitem>
541
 
542
        <listitem>
543
          <para>Some tests from the VSX4 test suite require execution from a
544
            local disk.</para>
545
        </listitem>
546
 
547
        <listitem>
548
          <para>The environment for running the AIMIII benchmark has to be
549
            kept stable.</para>
550
        </listitem>
551
      </itemizedlist>
552
    </sect1>
553
 
554
    <sect1>
555
      <title>UnixWare source delivery</title>
556
 
557
      <para>The source code delivery for UnixWare on Intel/386 is organized in
558
        several subdirectories which reflect the dependency of sources upon
559
        CPU and hardware architectures.</para>
560
 
561
      <para>When building a new system, one of the first steps is to construct
562
        a WORK tree. This tree is created from a merge between different parts
563
        of the original source tree, with symbolic links to the source files,
564
        depending on CPU/architecture configuration. Along with this WORK
565
        tree, a TOOLS and a MACH trees are also created, which together
566
        constitute the private environment for a build. The TOOLS tree is used
567
        for the tools and libraries used for internal build purpose. The MACH
568
        tree will contain at the end of a build all the components which
569
        constitute the actual system we built.</para>
570
 
571
      <para>A set of environment variables defines the current paths for the
572
        WORK, TOOLS and MACH trees. This has been used to create different
573
        build environments for each of the NAT-NAT, DRA-NAT and DRA-DRA
574
        phases.</para>
575
 
576
      <para>The disk space required for building a system is as
577
        follows:</para>
578
 
579
      <para>Original source tree: 240 MB</para>
580
 
581
      <para>For each of the NAT-NAT, DRA-NAT and DRA-DRA phases:</para>
582
      <para>WORK tree: 350 MB</para>
583
      <para>TOOLS tree:	35 MB</para>
584
      <para>MACH tree: 220 MB</para>
585
 
586
      <para>In order to keep on-line the NAT-NAT and DRA-NAT builds,
587
        approximately 1.5 GB of disk space has been taken on NFS servers. We
588
        did not need to perform the last steps at the end of a build, which
589
        consist in making packages and images of binary deliveries, because we
590
        were not producing a system for distribution. This would have required
591
        an additional disk space of about 800 MB per build.</para>
592
 
593
      <para> For the VSX4 validation suite, we needed more than 300 MB of disk
594
        space to keep two environments for the validation of the native and
595
        DRA-NAT systems.</para>
596
    </sect1>
597
 
598
    <sect1>
599
      <title>TenDRA technology</title>
600
 
601
      <para>Replacement of one compiler by another, and moreover,
602
        compatibility between object files produced by two different
603
        compilers, are often difficult issues. But in the case of the TenDRA
604
        compiler this has been straightforward.</para>
605
 
606
      <para>TenDRA compilers are designed to be compatible with the native
607
        compiler of the platform they are targeted to, generating the same
608
        internal format for data, using the same calling conventions, ....
609
        This allowed us to link together binary files from one or the other
610
        compiler, without any problems.</para>
611
 
612
      <para>Also, the command line options for the TenDRA compilers reflect as
613
        much as possible the options for the corresponding native compiler.
614
        So, we had very few modifications to make to the option line in order
615
        to replace the native cc compiler by the TenDRA tcc one. These changes
616
        have been implemented by a front-end shell script which emulates a
617
        call to the native compiler by a call to tcc. </para>
618
 
619
      <para>It appeared early on that some source files from the UnixWare
620
        distribution were not strictly ANSI compliant. For example, a function
621
        declared in a header file using ANSI syntax was actually defined using
622
        K&amp;R syntax.  Therefore we had to use the relaxing options:</para>
623
 
624
      <para>-not_ansi -nepc</para>
625
 
626
      <para>Using the TenDRA compiler with the native system header files, the
627
        DRA-NAT mode, required the additional option:</para>
628
 
629
      <para>-Ysystem</para>
630
 
631
      <para>Adaptation to special compilation options local to some makefiles
632
        are discussed in section 7.</para>
633
    </sect1>
634
  </chapter>
635
 
636
  <chapter>
637
    <title>Results of Project phases</title>
638
 
639
    <para>The NAT-NAT and DRA-NAT project phases, described in
640
      <link linkend="project-phase">Description of Project phases</link>,
641
      have been completed with a good level of success. The DRA-DRA phase has
642
      been limited to cover a hundred or so commands. In the next paragraphs
643
      we detail the results of each of the phases of the project.</para>
644
 
645
    <sect1>
646
      <title>Installation phase</title>
647
 
648
      <para>This phase was not concerned with the TenDRA technology, so it did
649
        not produce any noteworthy results.</para>
650
    </sect1>
651
 
652
    <sect1>
653
      <title>NAT-NAT phase</title>
654
 
655
      <para>The objective of this phase was to check that the system can be
656
        completely built with the native system compiler from the source
657
        delivery.  Indeed, this phase was very helpful to set-up the build
658
        environment, and to evaluate the resources we would need for the next
659
        phases.</para>
660
    </sect1>
661
 
662
    <sect1>
663
      <title>DRA-NAT phase</title>
664
 
665
      <para><emphasis>DRA-NAT build</emphasis></para>
666
 
667
      <para>During this phase we compiled the whole system, as for the NAT-NAT
668
        build, using the TenDRA technology as a standard compiler. Therefore,
669
        we used the system header files instead of the architecture neutral
670
        headers.  At completion of this task, we obtained the following
671
        results:</para>
672
 
673
      <itemizedlist>
674
        <listitem>
675
          <para>65% of the library source files could be successfully compiled
676
            with the TenDRA technology.</para>
677
        </listitem>
678
 
679
        <listitem>
680
          <para>About 65% of the kernel C code could be successfully compiled
681
            with the TenDRA technology.</para>
682
        </listitem>
683
 
684
        <listitem>
685
          <para>Nearly all the commands and tools could be compiled with the
686
            TenDRA technology.</para>
687
        </listitem>
688
      </itemizedlist>
689
 
690
      <para>These figures need some explanation to see why the TenDRA
691
        technology failed to compile some of the files. There were essentially
692
        three cases where the technology could not compile the files:</para>
693
 
694
      <itemizedlist>
695
        <listitem>
696
          <para>support of assembly language instructions inlined in C
697
            programs.</para>
698
 
699
          <para>Such code is not per-se architecture neutral and it is
700
            therefore clearly beyond the TenDRA technology goals.</para>
701
 
702
          <para>Assembly code was present in only 2% of the library source
703
            files, but was used in 22% of the files for the kernel
704
            components.</para>
705
        </listitem>
706
 
707
        <listitem>
708
          <para>support of special alignments for fields in structures
709
            (#pragma pack(n) directive)</para>
710
 
711
          <para>This feature was only relevant for Intel386 architecture. It
712
            was present in about 33% of the library C source files (Mostly for
713
            the Netware related libraries) and in 12% of the kernel C source
714
            files.</para>
715
        </listitem>
716
 
717
        <listitem>
718
          <para>Code written in C++ language.</para>
719
 
720
          <para>There were also some parts of the system which used the C++
721
            language. Since a C++ producer is not yet available for the TenDRA
722
            technology, we could not compile these files.</para>
723
 
724
          <para>Files with C++ code represented about 9% of the source code
725
            for the libraries and about 5% of the source code for the
726
            commands.</para>
727
        </listitem>
728
      </itemizedlist>
729
 
730
      <para>In summary, excluding the C++ files, about 85% of the C source
731
        files could be successfully compiled with the TenDRA technology.</para>
732
 
733
      <para>Apart from these issues, we found very few problems in the TenDRA
734
        compiler, 8 problems in fact, which were usually fixed or bypassed
735
        very quickly. These are included in the Appendix.</para>
736
 
737
      <para><emphasis>DRA-NAT validation</emphasis></para>
738
 
739
      <para>The DRA-NAT built kernel was customized for actual hardware and
740
        successfully booted.</para>
741
 
742
      <para>The VSX4 tests have been built and exercised first on the native
743
        UNIX version. On this beta release, approximately 6,000 tests are
744
        successful while a hundred of them are not. Three libraries are
745
        involved (libc being the most important one), and best results are got
746
        using the shared version of them.</para>
747
 
748
      <para>The following system software configuration was then used for
749
        recompiling and rerunning the VSX4 tests:</para>
750
 
751
      <itemizedlist>
752
        <listitem>
753
          <para>TenDRA compiler in DRA-NAT mode</para>
754
        </listitem>
755
 
756
        <listitem>
757
          <para>DRA-NAT commands</para>
758
        </listitem>
759
 
760
        <listitem>
761
          <para>DRA-NAT libraries for compile-time link-edits</para>
762
        </listitem>
763
 
764
        <listitem>
765
          <para>DRA-NAT version of dynamically-linked libc at
766
            runtime.</para>
767
        </listitem>
768
 
769
        <listitem>
770
          <para>DRA-NAT kernel</para>
771
        </listitem>
772
      </itemizedlist>
773
 
774
      <para>With this configuration, the VSX4 tests level of success is the
775
        same as for the native system. Two modules of the dynamically linked
776
        libc library were temporarily replaced by their native version in
777
        order to cure problems with the sed command.</para>
778
 
779
      <para>The AIMIII benchmark was used to exercise the native and DRA-NAT
780
        systems. At a medium user load level (simulated by the benchmark),
781
        i.e. 30-60 users, the performance of the two systems is similar:
782
        variations are below 3%.</para>
783
 
784
      <para>During the DRA-NAT validation phase, only 7 problems in TenDRA
785
        technology were encountered. These are included in the
786
        Appendix.</para>
787
    </sect1>
788
 
789
    <sect1>
790
      <title>DRA-DRA phase</title>
791
 
792
      <para>A base API has been created from a merge between the svid3 and
793
        xpg4 APIs, which are included in the TenDRA technology delivery. This
794
        allowed us to compile 57 commands (out of approximately 600). This
795
        demonstrated the need for a custom extension API for compiling most
796
        UnixWare commands. With the present extension API, 46 additional
797
        commands have been compiled.</para>
798
 
799
      <para>During this phase, two minor problems in the TenDRA technology
800
        were identified (these are included in the Appendix).</para>
801
    </sect1>
802
  </chapter>
803
 
804
  <chapter>
805
    <title>Methods applied</title>
806
 
807
    <sect1>
808
      <title>Correction of compilation problems</title>
809
 
810
      <para><emphasis>Native C compiler</emphasis></para>
811
 
812
      <para>As stated in <link linkend="project-environment">\xa4  4., page
813
        8</link>, binaries made by native and TenDRA compilers are
814
        interoperable. So a straightforward method to bypass a problem with
815
        TenDRA in DRA-NAT mode is to compile the ``guilty'' source file with
816
        the native compiler.  This method has been used in cases where tcc
817
        lacked a feature, e.g.  assembly language inlining, or when a bug in
818
        the code generated by tcc was identified but not yet fixed.</para>
819
 
820
      <para><emphasis>Source code modifications</emphasis></para>
821
 
822
      <para> In some cases, minor changes were applied to a source file (under
823
        #ifdef __ANDF__ conditions) when code rewriting was necessary to avoid
824
        a problem.  Example: function f() is defined with no argument but is
825
        called sometimes with one argument in original source; the revised
826
        source will be:</para>
827
 
828
      <programlisting>
829
      int f() { }
830
      /* .... */
831
      #ifndef __ANDF__
832
      	f(1);
833
      #else
834
      	f();
835
      #endif
836
      </programlisting>
837
 
838
      <para>In other cases, we had to modify some Makefiles. In the DRA-NAT
839
        build, this was necessary for sources which contained assembly
840
        instructions for example (or included a header file which used the
841
        same feature). When building the libraries and commands, the relevant
842
        Makefiles were modified. When building the kernel, a more elegant
843
        method has been used: a ''rulefile'', included by all the Makefiles,
844
        has been modified to check, prior to compiling a .c file, if a file
845
        with the same name plus a specific suffix .NATIVE existed. If so, the
846
        native compiler was called. In addition, shell scripts were written to
847
        create lists of source files, which were dependent on header files
848
        known to contain assembly code (or #pragma pack), and to create the
849
        .NATIVE files according to these lists.</para>
850
 
851
      <para>All these modifications on source files and Makefiles were done
852
        through a patch procedure:</para>
853
 
854
      <itemizedlist>
855
        <listitem>
856
          <para>In order to patch a file, from the WORK tree, two copies of
857
            the file are made in a patch tree, one for modifications and the
858
            other for keeping the reference version.</para>
859
        </listitem>
860
 
861
        <listitem>
862
          <para>Then the initial file, usually a link into the source tree, is
863
            replaced by a link to the copy for modifications.</para>
864
        </listitem>
865
 
866
        <listitem>
867
          <para>Once this has been done, the initial file can be modified,
868
            while the initial version of the file is saved.</para>
869
        </listitem>
870
      </itemizedlist>
871
    </sect1>
872
 
873
    <sect1>
874
      <title>Identification of TenDRA built object files</title>
875
 
876
      <para>In order to control the elements of the systems which were built
877
        in DRA-NAT mode, it was helpful to insert a special signature in
878
        object files created by the TenDRA compiler. An ident directive has
879
        been added to the assembly files generated by the TenDRA compiler,
880
        with the following pattern:</para>
881
 
882
      <para>/andf/bin/trans386:   (ANDF) 3.0 03/22/95</para>
883
 
884
      <para>Such a pattern can be extracted by mcs or strings commands from
885
        binary files (executables and libraries) in order to control a
886
        posteriori the number of modules actually compiled by the TenDRA
887
        technology.</para>
888
 
889
      <para>The file we modified in the TenDRA source delivery is the
890
        <filename>src/installer/trans386/trans.c</filename> file, and the
891
        change we made is located in the main() function:</para>
892
 
893
      <programlisting>
894
          init_all();
895
 
896
          if (diagnose)
897
             out_diagnose_prelude();
898
          TRASH d_capsule();
899
 
900
          /* change start */
901
          outs(``.ident \''@(#)/andf/bin/trans386:   (ANDF) 3.0 03/22/95\'''');
902
          outnl();
903
          /* change end */
904
 
905
          while (weak_list)
906
              /* ... */
907
      </programlisting>
908
    </sect1>
909
 
910
    <sect1>
911
      <title>Kernel and shared libraries</title>
912
 
913
      <para><emphasis>Configuring the DRA-NAT kernel for actual
914
        hardware</emphasis></para>
915
 
916
      <para>The normal way to build a kernel is to create, from the set of
917
        object files built for the kernel part of the system, a kernel which
918
        is not targeted to any particular hardware. Then, the system must be
919
        packaged on a tape and floppies, in order to be installed. An
920
        installation procedure would then be used to load the system and
921
        interactively configure the generic kernel to the actual hardware.
922
        However, going all the way through this procedure would have required
923
        a lot of time and disk space.</para>
924
 
925
      <para>We preferred to use a more simple and incremental way of building
926
        and configuring a new kernel:</para>
927
 
928
      <itemizedlist>
929
        <listitem>
930
          <para>We dedicated a development machine for the kernel
931
            testing.</para>
932
        </listitem>
933
 
934
        <listitem>
935
          <para>We copied the /etc/conf tree into the ``MACH'' tree of DRA-NAT
936
            build. This tree holds the kernel binary components and the kernel
937
            configuration files.</para>
938
        </listitem>
939
 
940
        <listitem>
941
          <para>We replaced (partially or totally) the original binaries by
942
            their DRA-NAT version.</para>
943
        </listitem>
944
 
945
        <listitem>
946
          <para>We then rebuilt a kernel, with the idbuild command.</para>
947
 
948
          <para>Note that the idbuild command is sensitive to the environment
949
            variables defining the current build ``MACH'' tree (ROOT and MACH
950
            variables).</para>
951
        </listitem>
952
      </itemizedlist>
953
 
954
      <para><emphasis>Progressive switching from native to DRA-NAT
955
        kernel</emphasis></para>
956
 
957
      <para>The method described above has proven very useful for easy fault
958
        isolation in case of a system crash.</para>
959
 
960
      <para>Kernel components are divided into two parts: those parts of the
961
        base kernel (<filename>/stand/unix</filename>) and those
962
        dynamically-loaded (from <filename>/etc/conf/mod.d</filename>). We
963
        started by replacing only one, non-critical, component of the kernel.
964
        Then, we replaced some dynamically-loaded modules by their DRA-NAT
965
        version. We continued by replacing other base kernel modules and
966
        concluded with the remaining dynamically-loaded modules. More than ten
967
        intermediate kernels were built and exercised during this
968
        process.</para>
969
 
970
      <para>Prior to exercising these kernels, emergency recovery floppies
971
        were made.  They could be (and have been) used to repair manually the
972
        hard disk stand or root file systems when the normal boot process from
973
        the hard disk failed.</para>
974
 
975
      <para>In order to switch to a new kernel, built in
976
        <filename>$ROOT/$MACH/etc/conf/cf.d/unix</filename>, it has to be
977
        copied into <filename>/stand</filename> (for example under the name
978
        <filename>unix.dranat</filename>).  The new dynamically-loaded kernel
979
        modules, built in the
980
        <filename>$ROOT/$MACH/etc/conf/modnew.d</filename> directory, have
981
        also to be moved to the <filename>/etc/conf.d/mod.d</filename>
982
        directory in order to be loaded at the next system reboot.  This
983
        latter operation should be done while the system is quiescent, i.e.
984
        after bringing it in single user mode and just before rebooting. To
985
        boot the alternative base kernel, the boot sequence is interrupted and
986
        an alternate kernel name is supplied by means of the KERNEL=name
987
        command.</para>
988
 
989
      <para><emphasis>Switching from native to DRA-NAT shared
990
        libraries</emphasis> </para>
991
 
992
      <para>For exercising a shared library made during the DRA-NAT build,
993
        e.g. the dynamically loaded libc, relevant files in
994
        <filename>/usr/lib</filename> and <filename>/usr/ccs/lib</filename>
995
        were replaced by links to either the reference or the DRA-NAT versions
996
        of them.  Care must be taken with these links, as shown by an example
997
        in <link linkend="dra-nat-validation">\xa4  7.4, page 19</link>.</para>
998
    </sect1>
999
 
1000
    <sect1>
1001
      <title>VSX4 validation</title>
1002
 
1003
      <para><emphasis>Installing VSX4 and building tests for NAT-NAT &amp;
1004
        DRA-NAT systems validation</emphasis></para>
1005
 
1006
      <para>The VSX4 test suite is a rather large and complex application.
1007
        Before actually running the tests, a number of steps have to be
1008
        performed:</para>
1009
 
1010
      <itemizedlist>
1011
        <listitem><para>We loaded the VSX4 test suite on a local disk which we
1012
            added on one of the machines. Some hardware and system configurations
1013
            were also needed in order to satisfy the VSX4
1014
            requirements.</para></listitem>
1015
 
1016
        <listitem><para>We configured the VSX4 test suite in order to provide it
1017
            with the actual description of the system. This configuration had to
1018
            be tuned while executing VSX4 on the native system, since for some
1019
            parameters we did not have enough information on the system to make
1020
            the right choice.</para></listitem>
1021
 
1022
        <listitem><para>We installed the VSX4 test suite, which consisted of the
1023
            compilation of the tools VSX4 needed for executing the tests and for
1024
            reporting on them.</para></listitem>
1025
 
1026
        <listitem><para>We built the VSX4 test suite, which consisted in
1027
            producing the actual executable code for each test to be
1028
            executed.</para></listitem>
1029
 
1030
      </itemizedlist>
1031
 
1032
      <para>At this point, we were able to execute the tests on the native
1033
        system to obtain reference results against which the DRA-NAT system
1034
        would be compared.</para>
1035
 
1036
      <para>For exercising the DRA-NAT build, we duplicated the tree which
1037
        contained the executable tests (TESTROOT) and created a new directory
1038
        to contain the results of build and execution steps. We customized the
1039
        VSX4 build configuration file to use the TenDRA compiler in DRA-NAT
1040
        mode and the commands/libraries built in the DRA-NAT phase, and we
1041
        rebuilt the tests.  Prior to reruning them, the configuration file for
1042
        VSX4 execution was changed in a way similar to the build configuration
1043
        file; note that the execution of some tests consists in performing a
1044
        compilation.</para>
1045
    </sect1>
1046
  </chapter>
1047
 
1048
  <chapter>
1049
    <title>Review of problems and other interesting points</title>
1050
 
1051
    <sect1>
1052
      <title>Installation of the UnixWare binary delivery</title>
1053
 
1054
      <para>When installing the UnixWare system from the binary delivery, we
1055
        faced one problem when installing optional packages such as nfs. This
1056
        was due to corrupted entries in a file containing information about
1057
        every file which is installed on the system through the packaging
1058
        system, /var/sadm/intall/contents. Deleting the corrupted entries,
1059
        removing the badly installed package and reinstalling it cured the
1060
        problem.</para>
1061
    </sect1>
1062
 
1063
    <sect1>
1064
      <title>NAT-NAT build phase</title>
1065
 
1066
      <para> Very few problems were encountered during this phase. We had some
1067
        troubles when building X11 &amp; Motif, first because we had forgotten
1068
        to customize a definition in a Makefile stating that we were using
1069
        binaries for Motif and not building it from sources; secondly because
1070
        two Makefiles were buggy.  This had no impact on other project phases
1071
        since the graphic system was not covered by DRA-NAT and DRA-DRA
1072
        experiments.</para>
1073
    </sect1>
1074
 
1075
    <sect1>
1076
      <title>DRA-NAT build phase</title>
1077
 
1078
      <para>This phase was the longest and richest. We describe below the
1079
        problems we had successively.</para>
1080
 
1081
      <para><emphasis>Use of the TenDRA compiler throughout the build
1082
        process</emphasis></para>
1083
 
1084
      <para>In the first steps of the build procedure, just modifying the PATH
1085
        environment variable was enough to use the TenDRA compiler as a pseudo
1086
        cc compiler. These steps include the building of libraries and
1087
        cross-environment tools, among which a new C compiler which was used
1088
        as soon as it was built. From this stage, we had to modify the build
1089
        procedure in order to substitute the freshly built compiler by a shell
1090
        script which emulates a call to the new compiler by a call to the
1091
        TenDRA tcc compiler.</para>
1092
 
1093
      <para>In order to mimic the behavior of the compiler we want to replace,
1094
        we had to pass an option to tcc to modify the search path for the
1095
        system libraries.  With this option tcc calls the UnixWare linker with
1096
        information on the location of the libraries. Assuming that the
1097
        TOOLS_REF variable contains the correct path for the current build
1098
        tools, the option line we used was:</para>
1099
 
1100
      <para>-Wl:-YP,$TOOLS_REF/usr/ccs/lib:$TOOLS_REF/usr/lib</para>
1101
 
1102
      <para><emphasis>C-programming issues</emphasis></para>
1103
 
1104
      <para>Most issues related to poor ANSI conformance have been by-passed
1105
        by using the tcc options -Xa -not_ansi -nepc.</para>
1106
 
1107
      <para>However, in a few cases, we had to make minor changes in source
1108
        files:</para>
1109
 
1110
      <itemizedlist>
1111
        <listitem>
1112
          <para>to avoid type promotion conflicts when a function was declared
1113
            with the prototype notation, and defined using the K&amp;R syntax.
1114
            We changed the definition to use the prototype notation
1115
            also.</para>
1116
        </listitem>
1117
 
1118
        <listitem>
1119
          <para>to fix a mismatch in the number of arguments of a function,
1120
            e.g. when such function was declared without argument and defined
1121
            empty, but called with one argument.</para>
1122
        </listitem>
1123
 
1124
        <listitem>
1125
          <para>to force the setting of __USLC__ preprocessor variable, which
1126
            is set by default by UnixWare C compilers. We discovered this
1127
            during the link-edit of a library, as some symbols were referenced
1128
            but undefined.</para>
1129
        </listitem>
1130
      </itemizedlist>
1131
 
1132
      <para><emphasis>Mapping special features of UnixWare compiler to
1133
        TenDRA</emphasis></para>
1134
 
1135
      <para>Such features appeared through command line options which were
1136
        local to some Makefiles, or through #pragma directives in
1137
        sources.</para>
1138
 
1139
      <para>Consider first a simple example: the normal option for producing
1140
        position-independent code is -KPIC, for both UnixWare cc and TenDRA.
1141
        However, a Makefile, responsible for building a shared library, was
1142
        using -Kpic instead. This option was supported by UnixWare but ignored
1143
        by TenDRA.  This resulted in a fatal error at library link-edit time.
1144
        A quick way to make TenDRA understand the -Kpic option is to create
1145
        inside the TenDRA svr4_i386/env directory a file named K-pic by
1146
        linking it to the existing file K-PIC.</para>
1147
 
1148
      <para>The following two options of the UnixWare compiler can be ignored
1149
        (e.g.  filtered out): -Kno_host and -W0,-1c. The first one disables
1150
        the inlining of some C standard functions, and the second tells the
1151
        compiler to treat literal strings as constants. These two options
1152
        correspond to the default behavior for TenDRA.</para>
1153
 
1154
      <para>The UnixWare compiler supports a pragma directive, to disable some
1155
        floating point optimization, termed fenv_access on. This directive was
1156
        used in a module to raise a floating point exception at run-time
1157
        rather than at compilation time. There is no equivalent option for
1158
        TenDRA, and furthermore tcc would abort when such a source file was
1159
        compiled. A fix was later supplied by DRA.</para>
1160
 
1161
      <para>The #pragma weak directive of the native compiler supports nested
1162
        references to symbols such as:</para>
1163
 
1164
      <para>#pragma weak sym1 = sym2</para>
1165
 
1166
      <para>#pragma weak sym2 = sym3</para>
1167
 
1168
      <para>This rarely used feature was not correctly supported by TenDRA.
1169
        This has been easily changed in the source code, and DRA will fix the
1170
        problem.</para>
1171
 
1172
      <para>UnixWare provides developers with a utility termed fur to reorder
1173
        the functions in a relocatable object. This utility was used in
1174
        Makefiles when building the shared version of libraries, and used to
1175
        fail, complaining of missing function names. These functions appeared
1176
        to be declared as static in sources, and in such case the TenDRA
1177
        default behavior is to discard the related symbols. TenDRA supports a
1178
        pragma directive to change this default behavior. For example #pragma
1179
        preserve * will keep all symbols. As all library modules compiled with
1180
        -KPIC option were concerned, we have modified the svr4_i386/K-PIC file
1181
        already mentioned in this document, adding the line:</para>
1182
 
1183
      <para>&gt;STARTUP -f/andf/svr4_i386/env/static_pic</para>
1184
 
1185
      <para>This static_pic file was then created, containing:</para>
1186
 
1187
      <para>#pragma preserve *</para>
1188
 
1189
      <para>Finally, we mention a difference between the native compiler and
1190
        the TenDRA one which had no incidence but a warning message at
1191
        link-edit time. tcc generates an alignment of 8 for global structures
1192
        whose size is greater than 63, while the native compiler always use an
1193
        alignment of 4; when linking an object file compiled by the native
1194
        compiler and an object file compiled by TenDRA which both declare the
1195
        same structure, the linker issued a warning.</para>
1196
    </sect1>
1197
 
1198
    <sect1 id="dra-nat-validation">
1199
      <title>DRA-NAT validation, manually exercising commands and
1200
        libraries</title>
1201
 
1202
      <para> The first level of validation we performed on the commands built
1203
        in DRA-NAT mode was to use these commands to replace the native ones.
1204
        We simply did this by modifying the PATH environment variable. Two
1205
        errors, inside the vi command, were detected, and then fixed, during
1206
        these tests.</para>
1207
 
1208
      <para> We exercised in the same way the DRA-NAT version of the shared
1209
        libc library.  This validation revealed problems with grep, sed, and
1210
        the search subcommand of vi, cpio and find. When investigating the
1211
        grep command, it appeared that using the DRA-NAT static version of the
1212
        libc library solved the problem.  Thus we focused on the generation of
1213
        position-independent code (-KPIC option) by the TenDRA compiler. We
1214
        reported a bug to DRA, which was fixed in the subsequent release of
1215
        the TenDRA software. Rebuilding the shared libc library with the new
1216
        version of the TenDRA compiler fixed the problems for the grep, vi and
1217
        find commands. The sed command still did not behave correctly and
1218
        needs further investigation. The problem with cpio was due to a
1219
        mistake in our procedure for switching from the native version of the
1220
        shared libc library to the DRA-NAT version: we forgot to take into
1221
        account the file /usr/lib/libdl.so.1 together with the file
1222
        /usr/lib/libc.so.1, while these two files are linked. This point was
1223
        discovered after looking at the Makefile of the cpio command (local
1224
        libraries used here include libld).</para>
1225
    </sect1>
1226
 
1227
    <sect1>
1228
      <title>DRA-NAT validation phase, booting the kernel</title>
1229
 
1230
      <para>Despite the fact that the kernel is a complex and sensitive part
1231
        of the system, we found only two problems while exercising kernels
1232
        with more and more DRA-NAT built components.</para>
1233
 
1234
      <para>The first problem we had was a PANIC message when running a kernel
1235
        with some DRA-NAT code. Using the crash command on the dumpfile file
1236
        created at system crash time, we located the problem in a call to a
1237
        function coded in assembly language. The comments embedded in the
1238
        source file told us that the code was making special assumptions on
1239
        the arguments and return value, which appeared to be
1240
        compiler-dependant. Instead of rewriting the code, we recompiled with
1241
        the native compiler the few C modules which were calling this
1242
        function.</para>
1243
 
1244
      <para>The second problem we had did more damage to the system disk (some
1245
        configuration files became corrupted). We managed to repair these
1246
        files using the Emergency Recovery floppies and making comparisons
1247
        with our second platform (which had been carefully kept away from
1248
        risky experiments). The problem was due to a small difference between
1249
        code generated by the native compiler and the TenDRA compiler, which
1250
        would have usually no incidence.  When a global variable is defined
1251
        and initialized to zero, the native compiler puts it in a DATA section
1252
        while the TenDRA compiler puts it (by default) in a COMMON section.
1253
        During the build of the kernel, a utility was used to patch the value
1254
        of such a variable inside an object file, and this operation failed
1255
        (silently) when the object file had been created by TenDRA.  The
1256
        TenDRA installer comes with an install-time option -h which makes it
1257
        behave like the native compiler in respect to this point.</para>
1258
    </sect1>
1259
 
1260
    <sect1>
1261
      <title>DRA-NAT validation phase, VSX4</title>
1262
 
1263
      <para>We used the VSX4 test suite to exercise the TenDRA technology in
1264
        three successive steps.</para>
1265
 
1266
      <para>Firstly, we built the VSX4 tests with the TenDRA compiler and the
1267
        static DRA-NAT system libraries. Then we ran the tests on a system
1268
        with a native kernel.</para>
1269
 
1270
      <para>Secondly, we ran the tests built in the previous step on a system
1271
        with a DRA-NAT kernel.</para>
1272
 
1273
      <para>Finally, we rebuilt the VSX4 tests, with the TenDRA compiler, on
1274
        a system with shared DRA-NAT system libraries (when available) and a
1275
        DRA-NAT kernel, and ran the suite on the same system.</para>
1276
 
1277
      <para>During these three steps, the PATH environment variable was
1278
        giving access exclusively to DRA-NAT built commands. Only a few
1279
        commands are actually exercised by the VSX4 test suite: ar, awk, grep,
1280
        ld, lorder, make, sed, sh, tsort (...) at build time, cpio, gencat and
1281
        tar at execution time.</para>
1282
 
1283
      <para>Five libraries are required, thus exercised, to build the VSX4
1284
        tests for UnixWare: libc, libm, libmalloc, libgen and libcrypt. A
1285
        dynamically-linked variant exists for libc and libcrypt only.</para>
1286
 
1287
      <para>Surprisingly enough, none of the problems we had were located in
1288
        the DRA-NAT build being validated. All the VSX4 tests (approximately
1289
        6,000) successful when using native system were also successful on the
1290
        DRA-NAT system.  However, we faced three other types of
1291
        problems:</para>
1292
 
1293
      <itemizedlist>
1294
        <listitem>
1295
          <para>Tests failing because of wrong permission on a work directory;
1296
            this simply came from the way we created a new target tree for
1297
            VSX4 test binaries.</para>
1298
        </listitem>
1299
 
1300
        <listitem>
1301
          <para>Unclean code in test source. For example, the volatile
1302
            qualifier of a variable was missing, though the varaible was
1303
            modified by a signal handler and tested inside a while loop. Since
1304
            optimizations are enabled by default in TenDRA, this test failed
1305
            when compiled by tcc. There were two other tests which failed
1306
            because of undesirable optimizations made by the TenDRA
1307
            optimizer.</para>
1308
        </listitem>
1309
 
1310
        <listitem>
1311
          <para>The static and shared variant of the libc library does not
1312
            behave the same in some cases. 14 tests failed when using the
1313
            static version of the libc library (native or DRA-NAT), which
1314
            passed when using the shared libc library.</para>
1315
        </listitem>
1316
      </itemizedlist>
1317
    </sect1>
1318
 
1319
    <sect1>
1320
      <title>DRA-NAT validation phase, AIMIII</title>
1321
 
1322
      <para>Due to a yet unexplained problem occurring when exercising either
1323
        native or DRA-NAT systems, AIMIII benchmark results have only been
1324
        obtained up to a load of 63 users.</para>
1325
 
1326
      <para>When running the benchmark, we tried to use an environment as
1327
        stable as possible. We installed the benchmark on a local file system,
1328
        used only for this purpose, and disabled the cron daemon. However, we
1329
        had noticeable differences (peak difference up to 15%) between the
1330
        results of two equivalent runs at a small user load (1-10 users),
1331
        while such differences drop to 1% at a load of 60 users.</para>
1332
 
1333
      <para>To avoid side effects when measuring performance, we have always
1334
        used the native compiler to compile the benchmark. The latter has to
1335
        be linked only with the libc library, and we have used the shared
1336
        variant.  Exercising the DRA-NAT build requires booting the DRA-NAT
1337
        kernel and setting up the DRA-NAT version of the dynamically-loaded
1338
        libc.</para>
1339
 
1340
      <para>Given these assumptions, native and DRA-NAT systems have similar
1341
        performance: within a load range of 20-60 users, differences are below
1342
        3%.</para>
1343
    </sect1>
1344
 
1345
    <sect1>
1346
      <title>DRA-DRA phase</title>
1347
 
1348
      <para>A first experiment on very simple commands (echo, touch), showed
1349
        that the base API on which the commands were built was a mix of the
1350
        svid3 and xpg4 APIs. In fact, 57 commands, out of more than 600, were
1351
        based on this base API. When we tried to extend this API to cover more
1352
        commands, it quickly became apparent that most of the commands need
1353
        their own extension to the base API. Thus, each additional command
1354
        requires a lot of work in order to compile in DRA-DRA mode. During the
1355
        time of the experiment, we could only extend the API to cover about
1356
        100 commands.</para>
1357
 
1358
      <para>We list below miscellaneous problems we encountered, which
1359
        required some modification in source files:</para>
1360
 
1361
      <itemizedlist>
1362
        <listitem>
1363
          <para>Implicit function declarations</para>
1364
 
1365
          <para>We wanted to suppress all the warnings due to missing function
1366
            prototypes for the commands we worked on. This was important in
1367
            order to make sure that every function used by a command was in
1368
            the interface we defined. However, in most of the commands we
1369
            worked on, internal functions returning an int were not declared.
1370
            So, we had to add their declaration in the source files in order
1371
            to suppress warnings on these functions. When this was done,
1372
            remaining warnings were due to use of functions without inclusion
1373
            of the include files where they were defined, or to incomplete
1374
            include files, in which case we added the prototype to the
1375
            interface.</para>
1376
        </listitem>
1377
 
1378
        <listitem>
1379
          <para>Redeclaration of errno</para>
1380
 
1381
          <para>In a few source files, errno was defined as a token by the
1382
            inclusion of the &lt;errno.h&gt; include file, but was also
1383
            defined in the file with the instruction:</para>
1384
 
1385
          <programlisting>
1386
  extern int errno;
1387
          </programlisting>
1388
 
1389
          <para>Since errno can be implemented in different ways on different
1390
            architectures, it must not be declared as an int variable. This
1391
            problem has been corrected by removing this declaration from the
1392
            source file.</para>
1393
        </listitem>
1394
 
1395
        <listitem>
1396
          <para>Redefinition of API functions</para>
1397
 
1398
          <para>In a few cases, a function was declared in an include file as
1399
            being part of the API, e.g rewind, but was later defined in the
1400
            file. We corrected the problem by renaming the internal function
1401
            so that the conflict does not exist any longer.</para>
1402
        </listitem>
1403
      </itemizedlist>
1404
    </sect1>
1405
  </chapter>
1406
 
1407
  <chapter>
1408
    <title>Summary of numerical characteristics</title>
1409
 
1410
    <para>The table below gives the number of files in the UnixWare source
1411
      delivery in respect to the programming language being used. Header files
1412
      are not counted.</para>
1413
 
1414
    <table>
1415
      <title>Source files / language</title>
1416
 
1417
      <tgroup align="center" cols="4" colsep="1" rowsep="1">
1418
        <thead>
1419
          <row>
1420
            <entry/>
1421
            <entry>C</entry>
1422
            <entry>Kernel</entry>
1423
            <entry>asm</entry>
1424
          </row>
1425
        </thead>
1426
 
1427
        <tbody>
1428
          <row>
1429
            <entry>libraries</entry>
1430
            <entry>2555 (83%)</entry>
1431
            <entry>278 (9%)</entry>
1432
            <entry>254 (8%)</entry>
1433
          </row>
1434
 
1435
          <row>
1436
            <entry>Kernel</entry>
1437
            <entry>997 (94%)</entry>
1438
            <entry>/</entry>
1439
            <entry>67 (6%)</entry>
1440
          </row>
1441
 
1442
          <row>
1443
            <entry>Commands</entry>
1444
            <entry>4464 (94%)</entry>
1445
            <entry>216 (5%)</entry>
1446
            <entry>38 (1%)</entry>
1447
          </row>
1448
 
1449
          <row>
1450
            <entry>Total</entry>
1451
            <entry>8016 (90%)</entry>
1452
            <entry>494 (6%)</entry>
1453
            <entry>359 (4%)</entry>
1454
          </row>
1455
        </tbody>
1456
      </tgroup>
1457
    </table>
1458
 
1459
    <para>The following table applies to the DRA-NAT build; it gives the
1460
      number of C source files and ratios of code compiled by TenDRA versus
1461
      code compiled by the native compiler. We distinguish the two reasons for
1462
      using the native C compiler: because of assembly language inclusions, or
1463
      because of use of pragma pack directive.</para>
1464
 
1465
    <table>
1466
      <title>DRA-NAT build: C source files / compiler</title>
1467
 
1468
      <tgroup align="center" cols="4" colsep="1" rowsep="1">
1469
        <thead>
1470
          <row>
1471
            <entry/>
1472
            <entry>TenDRA</entry>
1473
            <entry>cc (asm)</entry>
1474
            <entry>cc (pack)</entry>
1475
          </row>
1476
        </thead>
1477
 
1478
        <tbody>
1479
          <row>
1480
            <entry>libraries</entry>
1481
            <entry>1678 (65%)</entry>
1482
            <entry>62 (2%)</entry>
1483
            <entry>851 (33%)</entry>
1484
          </row>
1485
 
1486
          <row>
1487
            <entry>Kernel</entry>
1488
            <entry>664 (66%)</entry>
1489
            <entry>216 (22%)</entry>
1490
            <entry>117 (12%)</entry>
1491
          </row>
1492
 
1493
          <row>
1494
            <entry>Commands</entry>
1495
            <entry>4439 (99%)</entry>
1496
            <entry>16</entry>
1497
            <entry>9</entry>
1498
          </row>
1499
 
1500
          <row>
1501
            <entry>Total</entry>
1502
            <entry>6781 (84%)</entry>
1503
            <entry>294 (4%)</entry>
1504
            <entry>977 (12%)</entry>
1505
          </row>
1506
        </tbody>
1507
      </tgroup>
1508
    </table>
1509
 
1510
    <para>Note that for libraries, the Netware protocols are responsible for
1511
      the high number of C sources dependent on the pragma pack
1512
      feature.</para>
1513
 
1514
    <para>The following numbers characterize the maturity of the TenDRA C
1515
      compilation chain and the level of UnixWare source code portability, as
1516
      shown by the DRA-NAT phases of our project:</para>
1517
 
1518
    <table>
1519
      <title>Maturity of TenDRA &amp; UnixWare sources portability</title>
1520
 
1521
      <tgroup align="center" cols="4" colsep="1" rowsep="1">
1522
        <thead>
1523
          <row>
1524
            <entry>KB of C source code</entry>
1525
            <entry># of changes in sources</entry>
1526
            <entry># of problems, build</entry>
1527
            <entry># of problems, validation</entry>
1528
          </row>
1529
        </thead>
1530
 
1531
        <tbody>
1532
          <row>
1533
            <entry>59,000</entry>
1534
            <entry>69</entry>
1535
            <entry>8</entry>
1536
            <entry>7</entry>
1537
          </row>
1538
        </tbody>
1539
      </tgroup>
1540
    </table>
1541
 
1542
    <para>The table below shows the performance of the native system versus
1543
      that of DRA-NAT kernel and libc library as measured by the AIMIII
1544
      benchmark; the shared variant of libc is used.</para>
1545
 
1546
    <table>
1547
      <title>Native vs. DRA-NAT performance, AIMIII</title>
1548
 
1549
      <tgroup align="center" cols="4" colsep="1" rowsep="1">
1550
        <thead>
1551
          <row>
1552
            <entry># of users</entry>
1553
            <entry>jobs/min, native</entry>
1554
            <entry>jobs/min, DRA-NAT</entry>
1555
            <entry>delta</entry>
1556
          </row>
1557
        </thead>
1558
 
1559
        <tbody>
1560
          <row>
1561
            <entry>33</entry>
1562
            <entry>109.6</entry>
1563
            <entry>108.2</entry>
1564
            <entry>- 0.7%</entry>
1565
          </row>
1566
 
1567
          <row>
1568
            <entry>43</entry>
1569
            <entry>106.7</entry>
1570
            <entry>105.1</entry>
1571
            <entry>- 1.5%</entry>
1572
          </row>
1573
 
1574
          <row>
1575
            <entry>53</entry>
1576
            <entry>102.6</entry>
1577
            <entry>101.3</entry>
1578
            <entry>- 1.3%</entry>
1579
          </row>
1580
 
1581
          <row>
1582
            <entry>63</entry>
1583
            <entry>100.6</entry>
1584
            <entry>100.2</entry>
1585
            <entry>- 0.4%</entry>
1586
          </row>
1587
        </tbody>
1588
      </tgroup>
1589
    </table>
1590
 
1591
    <para>While the DRA-DRA phase was only partially realized, it is
1592
      interesting to note that 62 additional source files were so far modified
1593
      to enforce the portability of code, e.g.to avoid implicit function
1594
      declarations. The following tables give an idea of the volume of items
1595
      which must be added to the base API to compile a limited set of commands
1596
      in DRA-DRA mode.</para>
1597
 
1598
    <table>
1599
      <title>DRA-DRA: commands built with base API</title>
1600
 
1601
      <tgroup align="center" cols="3" colsep="1" rowsep="1">
1602
        <thead>
1603
          <row>
1604
            <entry>API</entry>
1605
            <entry># of commands to build</entry>
1606
            <entry># of commands built</entry>
1607
          </row>
1608
        </thead>
1609
 
1610
        <tbody>
1611
          <row>
1612
            <entry>svid3 + xpg4</entry>
1613
            <entry>600</entry>
1614
            <entry>57 (9.5%)</entry>
1615
          </row>
1616
        </tbody>
1617
      </tgroup>
1618
    </table>
1619
 
1620
    <table>
1621
      <title>DRA-DRA: extending the base API</title>
1622
 
1623
      <tgroup align="center" cols="3" colsep="1" rowsep="1">
1624
        <thead>
1625
          <row>
1626
            <entry># of extensions</entry>
1627
            <entry># of commands to build</entry>
1628
            <entry># of commands built</entry>
1629
          </row>
1630
        </thead>
1631
 
1632
        <tbody>
1633
          <row>
1634
            <entry>177</entry>
1635
            <entry>543</entry>
1636
            <entry>46 (10%)</entry>
1637
          </row>
1638
        </tbody>
1639
      </tgroup>
1640
    </table>
1641
 
1642
    <para>By extension we mean the adding of a specification such as defining
1643
      a function, a constant, a field inside a structure, etc.</para>
1644
  </chapter>
1645
 
1646
  <chapter>
1647
    <title>Conclusion</title>
1648
 
1649
    <para>The experiment to compile a whole Unix system with the TenDRA
1650
      compiler used as a replacement of the native compiler was very
1651
      successful.  Although Unix sources are known to be compiler dependent,
1652
      most of the code could be compiled with no, or minor, modifications.
1653
      Also, we found very few bugs in the technology, and the performance of
1654
      the system did not change noticeably.</para>
1655
 
1656
    <para>The DRA-DRA part of the experiment showed that defining an API for
1657
      the commands was not as simple as one might think. A more complete
1658
      experiment is required to complement this task.</para>
1659
  </chapter>
1660
 
1661
  <appendix>
1662
    <title>List of problems submitted to DRA</title>
1663
 
1664
    <para>The problems are classified according to their status at the end of
1665
      June 95.  They were encountered while using the December 94 release of
1666
      TenDRA. Most of the bugs were fixed in the following version of TenDRA
1667
      technology, which is the April 95 release.</para>
1668
 
1669
    <para><emphasis>Possible functional enhancements</emphasis></para>
1670
 
1671
    <itemizedlist>
1672
      <listitem>
1673
        <para>Support of assembly code.</para>
1674
 
1675
        <para>CR95_037.FB:assembly-code</para>
1676
      </listitem>
1677
 
1678
      <listitem>
1679
        <para>Support of the #pragma pack directive.</para>
1680
 
1681
        <para>CR95_050.FB:pragma_pack</para>
1682
      </listitem>
1683
    </itemizedlist>
1684
 
1685
    <para><emphasis>Issues closed without changes</emphasis></para>
1686
 
1687
    <itemizedlist>
1688
      <listitem>
1689
        <para>tcc option -Wa,-o,objectfile conflicts with option
1690
          -c.</para>
1691
 
1692
        <para>CR94_xxx.FB094.</para>
1693
 
1694
        <para>Status: closed (option -o must be used instead of
1695
          -Wa,-o).</para>
1696
      </listitem>
1697
 
1698
      <listitem>
1699
        <para>Structure alignment dependent on size.</para>
1700
 
1701
        <para>CR94_149:comm_align_8</para>
1702
 
1703
        <para>Status: closed (any multiple of 4 is correct).</para>
1704
      </listitem>
1705
 
1706
      <listitem>
1707
        <para>Optimization on non volatile variable</para>
1708
 
1709
        <para>CR95_185.FB::-optim-in-while2</para>
1710
 
1711
        <para>Status: closed (the volatile qualifier must be used).</para>
1712
      </listitem>
1713
 
1714
      <listitem>
1715
        <para>questionable optimization on the result of a function returning
1716
          a float value.</para>
1717
 
1718
        <para>CR95_186.FB::_optim_fp_call</para>
1719
 
1720
        <para>CR95_211.mantissa_size</para>
1721
 
1722
        <para>Status: in the process of being resolved (the DRA 80x86
1723
          installer supports an option, -R1, which forces the desired
1724
          rounding).</para>
1725
      </listitem>
1726
    </itemizedlist>
1727
 
1728
    <para>Bugs which have been fixed</para>
1729
 
1730
    <itemizedlist>
1731
      <listitem>
1732
        <para>Error on initialization of an array of computed size.</para>
1733
 
1734
        <para>CR94_166.FB091.sizeof-array-size.</para>
1735
 
1736
        <para>Status: fixed by April 95 release</para>
1737
      </listitem>
1738
 
1739
      <listitem>
1740
        <para>Installer aborts with signal 9.</para>
1741
 
1742
        <para>CR94_166.FB092.</para>
1743
 
1744
        <para>Status: solved by FIX 118, prior to April 95 release.</para>
1745
      </listitem>
1746
 
1747
      <listitem>
1748
        <para>Floating divide by zero causes the compiler to abort.</para>
1749
 
1750
        <para>CR94_212.FB093.float-div-0</para>
1751
 
1752
        <para>Status: solved by FIX 119, prior to April 95 release.</para>
1753
      </listitem>
1754
 
1755
      <listitem>
1756
        <para>Illegal assembly instruction generated by tcc.</para>
1757
 
1758
        <para>CR95_028.FB095-as-testb</para>
1759
 
1760
        <para>Status: fixed by April 95 release.</para>
1761
      </listitem>
1762
 
1763
      <listitem>
1764
        <para>errors using fur command on objects compiled with -KPIC.</para>
1765
 
1766
        <para>CR95_043.FB:Function_realocator</para>
1767
 
1768
        <para>Status: solved by using TenDRA #pragma preserve *
1769
          directive.</para>
1770
      </listitem>
1771
 
1772
      <listitem>
1773
        <para>Error in comparison of the address of an array.</para>
1774
 
1775
        <para>CR95_131.FB:lower_than_address</para>
1776
 
1777
        <para>Status: solved by FIX 127, prior to April 95 release.</para>
1778
      </listitem>
1779
 
1780
      <listitem>
1781
        <para>wrong optimization makes i386optim abort.</para>
1782
 
1783
        <para>CR95_147:bitwise_AND_bitfield</para>
1784
 
1785
        <para>Status: solved by FIX 128, prior to April 95 release.</para>
1786
      </listitem>
1787
 
1788
      <listitem>
1789
        <para>wrong optimization makes vi work incorrectly.</para>
1790
 
1791
        <para>CR95_163:optim_in_while</para>
1792
 
1793
        <para>Status: solved by FIX 129, prior to April 95 release.</para>
1794
      </listitem>
1795
 
1796
      <listitem>
1797
        <para>Error in stack management with combination of `for' and `switch'
1798
          C instructions.</para>
1799
 
1800
        <para>CR95_198.FB::_stack_mngt_error</para>
1801
 
1802
        <para>Status: fixed by April 95 release.</para>
1803
      </listitem>
1804
 
1805
      <listitem>
1806
        <para>reference to an undefined structure does not cause an
1807
          error.</para>
1808
 
1809
        <para>CR95_209.FB::no_err_undef_struct</para>
1810
 
1811
        <para>Status: fixed by April 95 release.</para>
1812
      </listitem>
1813
 
1814
      <listitem>
1815
        <para>Error on a switch statement when compiling with option
1816
          -KPIC</para>
1817
 
1818
        <para>CR95_216.FB::pic_switch</para>
1819
 
1820
        <para>Status: fixed by April 95 release.</para>
1821
      </listitem>
1822
    </itemizedlist>
1823
 
1824
    <para><emphasis>Pending issues</emphasis></para>
1825
 
1826
    <para>The issues listed below are either bugs which have been corrected
1827
      since the April 95 release and are awaiting the next release, or
1828
      problems which are still being investigated by DRA at the time of
1829
      writing.</para>
1830
 
1831
    <itemizedlist>
1832
      <listitem>
1833
        <para>Error on the signed literal value 2^32-1.</para>
1834
 
1835
        <para>CR95_029.FB096-literal-more-than-32-bits</para>
1836
 
1837
        <para>Status: under investigation.</para>
1838
      </listitem>
1839
 
1840
      <listitem>
1841
        <para>Error on dependencies between #pragma weak instructions.</para>
1842
 
1843
        <para>CR95_041.FB:twice_weak</para>
1844
 
1845
        <para>Status: under investigation.</para>
1846
      </listitem>
1847
 
1848
      <listitem>
1849
        <para>Infinite loop in tdfc after an unclosed #if instruction.</para>
1850
 
1851
        <para>CR95_119.FB:endif_loop</para>
1852
 
1853
        <para>Status: corrected since the April 95 release.</para>
1854
      </listitem>
1855
 
1856
      <listitem>
1857
        <para>Error on re-declaration of a tokenized object.</para>
1858
 
1859
        <para>CR95_196.FB::_token_double_dec</para>
1860
 
1861
        <para>Status: corrected since the April 95 release.</para>
1862
      </listitem>
1863
 
1864
      <listitem>
1865
        <para>Error on the definition of an array with a tokenize</para>
1866
      </listitem>
1867
    </itemizedlist>
1868
 
1869
    <para>This document was generated on
1870
      <?dbtimestamp format="Y-m-d H:M"?>.</para>
1871
  </appendix>
1872
</book>