Todd,

I think that the object model for the consoles is fine for the consoles
themselves, but as soon as we try to add real shells to them, it won't work. 
There isn't enough flexibility there.  I'll see what I can come up with as I
continue to work with it.

You are right in how you understand the native bug.

I'm also including the diff.  Thanks for getting cvs back up.

- Avery

----------------------------------------------
?JJOS/arch/host/nativecode/messages.txt
? JJOS/arch/host/nativecode/Makefile.mybak
? JJOS/arch/i386/bytecode/jjos-new.zip
? JJOS/arch/i386/bytecode/jos/platform/driver/consoleNative.java
? JJOS/arch/i386/nativecode/jjidt.txt
? JJOS/arch/i386/nativecode/head_ether.txt
? JJOS/arch/i386/nativecode/head_grub.txt
? JJOS/arch/i386/nativecode/jjos-grub-old
? JJOS/arch/i386/nativecode/jjos-grub-new
Index: JJOS/arch/i386/bytecode/jos/platform/driver/console.java
===================================================================
RCS file: 
/sites/jos/cvs/cvsroot/JJOS/arch/i386/bytecode/jos/platform/driver/console.java,v
retrieving revision 1.1
diff -r1.1 console.java
15a16,20
>       public final int id;
>       
>       public console(int id) {
>               this.id = id;
>       }
30c35
<               update();
---
>               update();               
31a37,43
> 
>       private void putString(String s) {
>               for(int i=0; i<s.length(); i++) {
>                       putChar(s.charAt(i));
>               }
>       }
> 
58,59c70,71
< protected void update () {
<       System.arraycopy( buffer, 0, vga, 0, buffer.length );
---
>       protected void update () {
>               System.arraycopy( buffer, 0, vga, 0, buffer.length );
62,63c74,75
< protected void scrollUpOneLine() {
<       System.arraycopy( buffer, JJSCREENWIDTH * 2, buffer, 0, buffer.length - 
JJSCREENWIDTH * 2 );
---
>       protected void scrollUpOneLine() {
>               System.arraycopy( buffer, JJSCREENWIDTH * 2, buffer, 0, buffer.length 
>- JJSCREENWIDTH * 2 );
65,67c77,79
<       /* fill in last row with blanks */
<       for ( int rcol = 0; rcol < JJSCREENWIDTH; rcol++ ) {
<               setChar( JJSCREENHEIGHT - 1, rcol, ' ' );
---
>               /* fill in last row with blanks */
>               for ( int rcol = 0; rcol < JJSCREENWIDTH; rcol++ ) {
>                       setChar( JJSCREENHEIGHT - 1, rcol, ' ' );
69,71c81,83
< 
<       /* if we're 'live', update the display */
<       if ( displayed ) { update(); }
---
>       
>               /* if we're 'live', update the display */
>               if ( displayed ) { update(); }
74,91c86,107
< public void putChar( char c ) {
<       if (c == '\n') {
<               if (row < (JJSCREENHEIGHT-1)) {
<                 column = 0;
<                 row++;
<                         } else {
<                 scrollUpOneLine();
<                 column = 0;
<                 }
<               } else {
<               if (column < (JJSCREENWIDTH-1)) {
<                 setChar(row, column, c );
<                 column++;
<                 } else {
<                 putChar('\n');
<                 putChar(c);
<                 }
<               } /* end else */
---
>       public void putChar( char c ) {
>               // This is debugging output to help track the native bug.
>               // When consoleNative.putChar is native, this function is never called.
>               // System.out.print("PC");
>               // System.out.print(id);
>               if (c == '\n') {
>                       if (row < (JJSCREENHEIGHT-1)) {
>                         column = 0;
>                         row++;
>                       } else {
>                         scrollUpOneLine();
>                         column = 0;
>                       }
>               } else {
>                       if (column < (JJSCREENWIDTH-1)) {
>                         setChar(row, column, c );
>                         column++;
>                       } else {
>                         putChar('\n');
>                         putChar(c);
>                       }
>               } /* end else */
Index: JJOS/arch/i386/nativecode/entry.cc
===================================================================
RCS file: /sites/jos/cvs/cvsroot/JJOS/arch/i386/nativecode/entry.cc,v
retrieving revision 1.20
diff -r1.20 entry.cc
148a149,150
> //  console.clear_screen();
> 
Index: JJOS/arch/i386/nativecode/jjconsol.cc
===================================================================
RCS file: /sites/jos/cvs/cvsroot/JJOS/arch/i386/nativecode/jjconsol.cc,v
retrieving revision 1.6
diff -r1.6 jjconsol.cc
19c19
<  *
---
>  * Avery Regier (ability to view native output with F1 console)
23,37c23
< 
< /*
<  * Programmer's Guide
<  * Table 6.3, pg 178
<  */
< 
< typedef enum 
< {
<   VGA_MODE_7_NORMAL           = 0x07,
<   VGA_MODE_7_INTENSE          = 0x0f,
<   VGA_MODE_7_UNDERLINE                = 0x01,
<   VGA_MODE_7_INTENSE_UNDERLINE        = 0x09,
<   VGA_MODE_7_REVERSED         = 0x70,
<   VGA_MODE_7_BLINKING_REVERSED        = 0xf0
< } VgaMode7CharacterAttributes;
---
> #include "jbmachin.h"
42a29,30
>   buffer = NULL;
> // the destructor for this must still be written!
47a36
>   visible = JJTRUE;
49a39,74
> void jjConsole::setVisible(jjBoolean v)
> {
> // A little old debugging output...
> //  if(v == JJTRUE) printString("v == true\n");
> //  else if(v == JJFALSE) printString("v == false\n");
> //  else printString("v is corrupted!\n");
> 
>    // First, allocate the buffer.  This may be able to be done in the constructor,
>    // but it isn't absolutely necessary until here.
>    if(buffer == NULL) {
>       int allocationSize = sizeof(jju8) * JJSCREENWIDTH * JJSCREENHEIGHT * 2;
> 
>       // Allocates the buffer off of the Java heap.  Is there a better place to 
>       // allocate this from?  Could GC interfere with this?
>       buffer = (jju8 *) jbmp->myHeap->allocate(allocationSize);
>       // buffer = new unsigned char[JJSCREENWIDTH * JJSCREENHEIGHT * 2];
> 
>       for ( int x = 0; x < JJSCREENWIDTH * JJSCREENHEIGHT * 2; x += 2 ) {
>          buffer[x] =  myVGAScreenBufferPointer[x];
>          buffer[x+1] = myVGAScreenBufferPointer[x+1];
>       }
> // } else if((visible == JJTRUE) && (v == JJFALSE)) {
>       // switching from visible to invisible
>       // do nothing!
>    } else if ((visible == JJFALSE) && (v == JJTRUE)) {
>       // switching from invisible to visible
>       // print the buffer to the screen;
>       for ( int x = 0; x < JJSCREENWIDTH * JJSCREENHEIGHT * 2; x += 2 ) {
>          myVGAScreenBufferPointer[x] = buffer[x];
>          myVGAScreenBufferPointer[x+1] = buffer[x+1];
>       }
>    }
>    visible = v;
> }
> 
> 
53c78,80
<   int attribute = myVGAScreenBufferPointer[subscript];
---
>   int attribute;
>   if(buffer != NULL) attribute = buffer[subscript];
>   else attribute = myVGAScreenBufferPointer[subscript];
60c87,89
<   int character = myVGAScreenBufferPointer[subscript];
---
>   int character;
>   if(buffer != NULL) character = buffer[subscript];
>   else  character= myVGAScreenBufferPointer[subscript];
67c96,97
<   myVGAScreenBufferPointer[charsubscript] = c;
---
>   if(visible == JJTRUE) myVGAScreenBufferPointer[charsubscript] = c;
>   if(buffer != NULL) buffer[charsubscript] = c;
69,70c99,102
<   int attribsubscript = (row*JJSCREENWIDTH*2) + (col*2) + 1;
<   myVGAScreenBufferPointer[attribsubscript] = a;
---
>   int attribsubscript = charsubscript + 1;
>       //(row*JJSCREENWIDTH*2) + (col*2) + 1;
>   if(visible == JJTRUE) myVGAScreenBufferPointer[attribsubscript] = a;
>   if(buffer != NULL) buffer[attribsubscript] = a;
132,133c164,166
<               myVGAScreenBufferPointer[x] = ' ';
<               myVGAScreenBufferPointer[x+1] = VGA_MODE_7_NORMAL;
---
>               if(buffer != NULL) {
>                       buffer[x] = ' ';
>                       buffer[x+1] = VGA_MODE_7_NORMAL;
135c168,175
<       } /* end clear_screen() */
---
>               if(visible == JJTRUE) {
>                       myVGAScreenBufferPointer[x] = ' ';
>                       myVGAScreenBufferPointer[x+1] = VGA_MODE_7_NORMAL;
>               }
>       }
>       myRow = 0;
>       myColumn = 0;
> } /* end clear_screen() */
Index: JJOS/arch/i386/nativecode/jjconsole.h
===================================================================
RCS file: /sites/jos/cvs/cvsroot/JJOS/arch/i386/nativecode/jjconsole.h,v
retrieving revision 1.5
diff -r1.5 jjconsole.h
38a39,41
>   void setVisible(jjBoolean v);
>   jju8 getChar(int row, int col);
>   void setChar(int row, int col, jju8 c, jju8 a);
41a45
>   jju8 *buffer;
45,46d48
<   jju8 getChar(int row, int col);
<   void setChar(int row, int col, jju8 c, jju8 a);
49a52,53
> 
>   jjBoolean visible;
51a56,70
> /*
>  * Programmer's Guide
>  * Table 6.3, pg 178
>  */
> 
> typedef enum 
> {
>   VGA_MODE_7_NORMAL           = 0x07,
>   VGA_MODE_7_INTENSE          = 0x0f,
>   VGA_MODE_7_UNDERLINE                = 0x01,
>   VGA_MODE_7_INTENSE_UNDERLINE        = 0x09,
>   VGA_MODE_7_REVERSED         = 0x70,
>   VGA_MODE_7_BLINKING_REVERSED        = 0xf0
> } VgaMode7CharacterAttributes;
> 
Index: JJOS/JJOS/common/bytecode/TestSuite.java
===================================================================
RCS file: /sites/jos/cvs/cvsroot/JJOS/common/bytecode/TestSuite.java,v
retrieving revision 1.1
diff -r1.1 TestSuite.java
25,27c25,27
< import jos.system.keyboard;
< import jos.system.consoled;
< import jos.platform.driver.StandardVga;
---
> //import jos.system.keyboard;
> //import jos.system.consoled;
> import jos.platform.driver.standardVGA;
33c33
<     public static boolean testThreads = true;
---
>     public static boolean testThreads = false;
35c35
<     public static boolean testVGADriver = true;
---
>     public static boolean testVGADriver = false;
37c37
<     public static boolean testConsoleDaemons = true;
---
>     public static boolean testConsoleDaemons = false;
84,85c84,85
<       if (testConsoleDaemons)
<           testConsoleDaemons();
---
>       if (testConsoleDaemons){;}
>       //    testConsoleDaemons();
283,284c283,284
<       System.out.println( "init(): testing threading." );
<       System.out.println( "init() starting counter..." );
---
> //    System.out.println( "init(): testing threading." );
> /*    System.out.println( "init() starting counter..." );
291,309c291,309
< 
<       System.out.println( "init() entering .wait() loop..." );
<       int interrupt_count = 0;
<       while ( interrupt_count < 10 ) {
<                               /* Bad Karma w/o this. */
<           synchronized( jos.system.interrupts.int000 ) {
<               /* because wait() calls release
<                  locks, this doesn't actually
<                  cause any blockage. */
<               try { jos.system.interrupts.int000.wait(); }
<               catch ( InterruptedException ie ) {
<                   System.out.println( "init() interrupted waiting for notify" );
<                   continue;
<               }
<           } /* end synchlock on interrupt. */
<                               // System.out.println( "init() caught interrupt." );
<           interrupt_count++;
<       } /* end .wait() loop */
<       System.out.println( "init() has caught 10 interrupts." );
---
> */
> //    System.out.println( "init() entering .wait() loop..." );
> //    int interrupt_count = 0;
> //    while ( interrupt_count < 10 ) {
> //                            /* Bad Karma w/o this. */
> //        synchronized( jos.system.interrupts.int000 ) {
> //            /* because wait() calls release
> //               locks, this doesn't actually
> //               cause any blockage. */
> //            try { jos.system.interrupts.int000.wait(); }
> //            catch ( InterruptedException ie ) {
> //                System.out.println( "init() interrupted waiting for notify" );
> //                continue;
> //            }
> //        } /* end synchlock on interrupt. */
> //                            // System.out.println( "init() caught interrupt." );
> //        interrupt_count++;
> //    } /* end .wait() loop */
> //    System.out.println( "init() has caught 10 interrupts." );
337,338c337,349
<     public static void testConsoleDaemons() {                 
<       System.out.println( "init() starting console daemons..." );
---
> //    public static void testConsoleDaemons() {                       
> //    System.out.println( "init() starting console daemons..." );/
> //
> //    System.out.println( "init() starting jos.system.keyboard..." );
> //    /* sets up the hardware driver */
> //    keyboard k = new keyboard();
> //    /* starts the KeyEvent dispatch loop */
> //    k.start();
> //
> //    System.out.println( "init() starting jos.system.consoled..." );
> //    /* listens to the dispatching from j.s.k above */
> //    consoled cd = new consoled();
> //    }
340,350d350
<       System.out.println( "init() starting jos.system.keyboard..." );
<       /* sets up the hardware driver */
<       keyboard k = new keyboard();
<       /* starts the KeyEvent dispatch loop */
<       k.start();
< 
<       System.out.println( "init() starting jos.system.consoled..." );
<       /* listens to the dispatching from j.s.k above */
<       consoled cd = new consoled();
<     }
< 
353c353
<       StandardVga v = new StandardVga();
---
>       standardVGA v = new standardVGA();
383a384
>               if(i % 100000 == 0) System.out.print('.');
Index: JJOS/JJOS/common/bytecode/init.java
===================================================================
RCS file: /sites/jos/cvs/cvsroot/JJOS/common/bytecode/init.java,v
retrieving revision 1.38
diff -r1.38 init.java
27,31c27,31
<               standardVGA vga = new standardVGA();
<               vga.startService();
<               vga.bitblt(312, 232, logo, 16 );
<               vga.delay( 0x100000 ); /* give us time to look at it */
<               vga.stopService();
---
>       //      standardVGA vga = new standardVGA();
>       //      vga.startService();
>       //      vga.bitblt(312, 232, logo, 16 );
>       //      vga.delay( 0x100000 ); /* give us time to look at it */
>       //      vga.stopService();
32a33,35
>               TestSuite suite = new TestSuite();
>               suite.runTests();
> 
Index: JJOS/JJOS/common/bytecode/jos/system/console.java
===================================================================
RCS file: /sites/jos/cvs/cvsroot/JJOS/common/bytecode/jos/system/console.java,v
retrieving revision 1.7
diff -r1.7 console.java
14a15
>       private final int id;
16c17
<       public console () {
---
>       public console (int id) {
18c19,21
<               dc = new jos.platform.driver.console();
---
>               //  This is for debugging output to help track the native bug.
>               this.id = id;
>               dc = new jos.platform.driver.console(id);
22a26
>               id = 0;
26a31,33
>       //  This is debugging output to help track the native bug.
>       //      System.out.print("KP");
>       //      System.out.print(id);
30a38,40
>       //  This is debugging output to help track the native bug.
>       //      System.out.print("KR");
>       //      System.out.print(id);
39a50,52
>       //  This is debugging output to help track the native bug.
>       //      System.out.print("KT");
>       //      System.out.print(id);
55c68,73
<       public void putChar(char c) { dc.putChar(c); }
---
>       public void putChar(char c) { 
>       //  This is debugging output to help track the native bug.
>       //      System.out.print("jsc.pc");
>       //      System.out.print(id);
>               dc.putChar(c); 
>       }
Index: JJOS/JJOS/common/bytecode/jos/system/consoled.java
===================================================================
RCS file: /sites/jos/cvs/cvsroot/JJOS/common/bytecode/jos/system/consoled.java,v
retrieving revision 1.7
diff -r1.7 consoled.java
25,26c25,29
<               for (int x = 0; x < 12; x++ ) {
<                       consoles[x] = new console();
---
>               
>               // Use F1 for the native console so as to view debugging output.
>               consoles[0] = new console(new jos.platform.driver.consoleNative());
>               for (int x = 1; x < 12; x++ ) {
>                       consoles[x] = new console(x);
35c38
< //            System.err.println( "consoled.init(): generating event tree..." );
---
>               System.err.println( "consoled.init(): generating event tree..." );
38c41
< //            System.err.println( "consoled.init(): initialization complete..." );
---
>               System.err.println( "consoled.init(): initialization complete..." );
Index: JJOS/JJOS/common/decaf/d_main.cc
===================================================================
RCS file: /sites/jos/cvs/cvsroot/JJOS/common/decaf/d_main.cc,v
retrieving revision 1.34
diff -r1.34 d_main.cc
82a83,85
>   internBuiltInMethod(jos_platform_driver_consoleNative_setVisible, 
>"jos/platform/driver/consoleNative", "setVisible");
>   internBuiltInMethod(jos_platform_driver_consoleNative_putChar, 
>"jos/platform/driver/consoleNative", "putNativeChar");
>   internBuiltInMethod(jos_platform_driver_consoleNative_setChar, 
>"jos/platform/driver/consoleNative", "setNativeChar");
Index: JJOS/JJOS/common/decaf/jvmbuiltins.cc
===================================================================
RCS file: /sites/jos/cvs/cvsroot/JJOS/common/decaf/jvmbuiltins.cc,v
retrieving revision 1.9
diff -r1.9 jvmbuiltins.cc
25a26,27
> #include "jbmachin.h"
> #include "jjconsole.h"
448a451,473
> jjBoolean jos_platform_driver_consoleNative_setVisible(java_word argument[], frame 
>*f, resolved_method *rm, int n_args){
>  // kprintf( "v is %d\n", (jint)(argument[1]) );
>   jjBoolean v = (jjBoolean)(jint)argument[1]; //(((jint)(argument[1])) == 0 ? 
>JJFALSE : JJTRUE);
>   jbmp->myConsole->setVisible(v);
>   return (JJTRUE);
> }
> 
> jjBoolean jos_platform_driver_consoleNative_putChar(java_word argument[], frame *f, 
>resolved_method *rm, int n_args) {
>   jju8 ch = (jju8)(argument[1]);
>   jbmp->myConsole->putChar(ch);
>   return (JJTRUE);    
> }
> 
> jjBoolean jos_platform_driver_consoleNative_setChar(java_word argument[], frame *f, 
>resolved_method *rm, int n_args) {
>   jint row = (jint) argument[1];
>   jint col = (jint) argument[2];
>   jju8 c = (jju8) argument[3];
>   jju8 a = (jju8) VGA_MODE_7_NORMAL;
>   
>   jbmp->myConsole->setChar(row, col, c, a);
>   return (JJTRUE);    
> }
> 
Index: JJOS/JJOS/common/decaf/jvmbuiltins.h
===================================================================
RCS file: /sites/jos/cvs/cvsroot/JJOS/common/decaf/jvmbuiltins.h,v
retrieving revision 1.6
diff -r1.6 jvmbuiltins.h
51a52,54
> jjBoolean jos_platform_driver_consoleNative_setVisible(java_word argument[], frame 
>*f, resolved_method *rm, int n_args);
> jjBoolean jos_platform_driver_consoleNative_putChar(java_word argument[], frame *f, 
>resolved_method *rm, int n_args);
> jjBoolean jos_platform_driver_consoleNative_setChar(java_word argument[], frame *f, 
>resolved_method *rm, int n_args);
Index: JJOS/JJOS/common/nativecode/jbconsol.h
===================================================================
RCS file: /sites/jos/cvs/cvsroot/JJOS/common/nativecode/jbconsol.h,v
retrieving revision 1.2
diff -r1.2 jbconsol.h
32c32
< 
---
>   virtual void setVisible(jjBoolean v) = 0;
34c34
< 
---
>   virtual void setChar(int row, int col, jju8 c, jju8 a) = 0;


_______________________________________________
Kernel maillist  -  [EMAIL PROTECTED]
http://jos.org/mailman/listinfo/kernel

Reply via email to