git.ucc.asn.au
/
tpg
/
acess2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
99aab0b
)
Kernel/VTerm - "Fix" wrapping issue in VTerm (why was old behavior there?)
author
John Hodge (sonata)
<
[email protected]
>
Wed, 5 Nov 2014 09:33:49 +0000
(17:33 +0800)
committer
John Hodge (sonata)
<
[email protected]
>
Wed, 5 Nov 2014 09:33:49 +0000
(17:33 +0800)
KernelLand/Kernel/debug.c
patch
|
blob
|
history
KernelLand/Kernel/drv/pty.c
patch
|
blob
|
history
KernelLand/Kernel/drv/vterm_output.c
patch
|
blob
|
history
KernelLand/Kernel/drv/vterm_termbuf.c
patch
|
blob
|
history
diff --git
a/KernelLand/Kernel/debug.c
b/KernelLand/Kernel/debug.c
index
18c7ebb
..
eed38de
100644
(file)
--- a/
KernelLand/Kernel/debug.c
+++ b/
KernelLand/Kernel/debug.c
@@
-7,7
+7,7
@@
#include <debug_hooks.h>
#define DEBUG_MAX_LINE_LEN 256
#include <debug_hooks.h>
#define DEBUG_MAX_LINE_LEN 256
-#define LOCK_DEBUG_OUTPUT
1
// Avoid interleaving of output lines?
+#define LOCK_DEBUG_OUTPUT
0
// Avoid interleaving of output lines?
#define TRACE_TO_KTERM 0 // Send ENTER/DEBUG/LEAVE to debug?
// === IMPORTS ===
#define TRACE_TO_KTERM 0 // Send ENTER/DEBUG/LEAVE to debug?
// === IMPORTS ===
@@
-77,9
+77,8
@@
static void Debug_Puts(int UseKTerm, const char *Str)
IPStack_SendDebugText(Str);
// Output to the kernel terminal
IPStack_SendDebugText(Str);
// Output to the kernel terminal
- if( UseKTerm && gbDebug_IsKPanic < 2 && giDebug_KTerm != -1)
+ if( UseKTerm && gbDebug_IsKPanic < 2 && giDebug_KTerm != -1
&& gbInPutChar == 0
)
{
{
- if(gbInPutChar) return ;
gbInPutChar = 1;
VFS_Write(giDebug_KTerm, len, Str);
gbInPutChar = 0;
gbInPutChar = 1;
VFS_Write(giDebug_KTerm, len, Str);
gbInPutChar = 0;
@@
-137,7
+136,10
@@
void Debug_KernelPanic(void)
bool LogF(const char *Fmt, ...)
{
#if LOCK_DEBUG_OUTPUT
bool LogF(const char *Fmt, ...)
{
#if LOCK_DEBUG_OUTPUT
- if(CPU_HAS_LOCK(&glDebug_Lock)) return true;
+ if(CPU_HAS_LOCK(&glDebug_Lock)) {
+ Debug_Puts("[#]");
+ return true;
+ }
SHORTLOCK(&glDebug_Lock);
#endif
SHORTLOCK(&glDebug_Lock);
#endif
@@
-265,16
+267,13
@@
void Panic(const char *Fmt, ...)
void Debug_SetKTerminal(const char *File)
{
void Debug_SetKTerminal(const char *File)
{
- int tmp;
if(giDebug_KTerm != -1) {
if(giDebug_KTerm != -1) {
- tmp = giDebug_KTerm;
+ // Clear FD to -1 before closing (prevents writes to closed FD)
+ int oldfd = giDebug_KTerm;
giDebug_KTerm = -1;
giDebug_KTerm = -1;
- VFS_Close(
tmp
);
+ VFS_Close(
oldfd
);
}
}
- tmp = VFS_Open(File, VFS_OPENFLAG_WRITE);
-// Log_Log("Debug", "Opened '%s' as 0x%x", File, tmp);
- giDebug_KTerm = tmp;
-// Log_Log("Debug", "Returning to %p", __builtin_return_address(0));
+ giDebug_KTerm = VFS_Open(File, VFS_OPENFLAG_WRITE);
}
void Debug_Enter(const char *FuncName, const char *ArgTypes, ...)
}
void Debug_Enter(const char *FuncName, const char *ArgTypes, ...)
diff --git
a/KernelLand/Kernel/drv/pty.c
b/KernelLand/Kernel/drv/pty.c
index
2e79323
..
d1f74c5
100644
(file)
--- a/
KernelLand/Kernel/drv/pty.c
+++ b/
KernelLand/Kernel/drv/pty.c
@@
-627,12
+627,14
@@
size_t PTY_WriteClient(tVFS_Node *Node, off_t Offset, size_t Length, const void
// If the server has terminated, send SIGPIPE
if( pty->ServerNode && pty->ServerNode->ReferenceCount == 0 )
{
// If the server has terminated, send SIGPIPE
if( pty->ServerNode && pty->ServerNode->ReferenceCount == 0 )
{
+ LOG("SIGPIPE, server has terminated");
Threads_PostSignal(SIGPIPE);
errno = EIO;
return -1;
}
// Write to either FIFO or directly to output function
Threads_PostSignal(SIGPIPE);
errno = EIO;
return -1;
}
// Write to either FIFO or directly to output function
+ LOG("pty->OutputFcn = %p", pty->OutputFcn);
if( pty->OutputFcn ) {
pty->OutputFcn(pty->OutputHandle, Length, Buffer);
return Length;
if( pty->OutputFcn ) {
pty->OutputFcn(pty->OutputHandle, Length, Buffer);
return Length;
diff --git
a/KernelLand/Kernel/drv/vterm_output.c
b/KernelLand/Kernel/drv/vterm_output.c
index
79afaa7
..
95c552f
100644
(file)
--- a/
KernelLand/Kernel/drv/vterm_output.c
+++ b/
KernelLand/Kernel/drv/vterm_output.c
@@
-5,9
+5,9
@@
* drv/vterm_input.c
* - Virtual Terminal - Input code
*/
* drv/vterm_input.c
* - Virtual Terminal - Input code
*/
+#define DEBUG 0
#include "vterm.h"
#include <api_drv_video.h>
#include "vterm.h"
#include <api_drv_video.h>
-#define DEBUG 0
// === CODE ===
/**
// === CODE ===
/**
@@
-94,7
+94,7
@@
void VT_int_UpdateCursor( tVTerm *Term, int bShow )
if( Term != gpVT_CurTerm ) return ;
if( Term != gpVT_CurTerm ) return ;
- ENTER("pTerm bShow", Term, Show);
+ ENTER("pTerm bShow", Term,
b
Show);
if( !bShow )
{
if( !bShow )
{
@@
-135,10
+135,13
@@
void VT_int_UpdateCursor( tVTerm *Term, int bShow )
*/
void VT_int_UpdateScreen( tVTerm *Term, int UpdateAll )
{
*/
void VT_int_UpdateScreen( tVTerm *Term, int UpdateAll )
{
- // Only update if this is the current terminal
- if( Term != gpVT_CurTerm ) return;
-
ENTER("pTerm iUpdateAll", Term, UpdateAll);
ENTER("pTerm iUpdateAll", Term, UpdateAll);
+ // Only update if this is the current terminal
+ if( Term != gpVT_CurTerm ) {
+ LOG("Term != gpVT_CurTerm (%p)", gpVT_CurTerm);
+ LEAVE('-');
+ return;
+ }
switch( Term->Mode )
{
switch( Term->Mode )
{
@@
-146,7
+149,7
@@
void VT_int_UpdateScreen( tVTerm *Term, int UpdateAll )
size_t view_pos = (Term->Flags & VT_FLAG_ALTBUF) ? 0 : Term->ViewTopRow*Term->TextWidth;
const tVT_Pos *wrpos = VT_int_GetWritePosPtr(Term);
const tVT_Char *buffer = (Term->Flags & VT_FLAG_ALTBUF) ? Term->AltBuf : Term->Text;
size_t view_pos = (Term->Flags & VT_FLAG_ALTBUF) ? 0 : Term->ViewTopRow*Term->TextWidth;
const tVT_Pos *wrpos = VT_int_GetWritePosPtr(Term);
const tVT_Char *buffer = (Term->Flags & VT_FLAG_ALTBUF) ? Term->AltBuf : Term->Text;
- LOG("view_pos = %i, wrpos = %p
, buffer=%p", view_pos, wrpos
, buffer);
+ LOG("view_pos = %i, wrpos = %p
(R%i,C%i), buffer=%p", view_pos, wrpos, wrpos->Row, wrpos->Col
, buffer);
// Re copy the entire screen?
if(UpdateAll) {
VFS_WriteAt(
// Re copy the entire screen?
if(UpdateAll) {
VFS_WriteAt(
@@
-159,6
+162,7
@@
void VT_int_UpdateScreen( tVTerm *Term, int UpdateAll )
// Only copy the current line
else {
size_t ofs = wrpos->Row * Term->TextWidth;
// Only copy the current line
else {
size_t ofs = wrpos->Row * Term->TextWidth;
+ LOG("ofs = %i", ofs);
VFS_WriteAt(
giVT_OutputDevHandle,
(ofs - view_pos)*sizeof(tVT_Char),
VFS_WriteAt(
giVT_OutputDevHandle,
(ofs - view_pos)*sizeof(tVT_Char),
diff --git
a/KernelLand/Kernel/drv/vterm_termbuf.c
b/KernelLand/Kernel/drv/vterm_termbuf.c
index
ed95480
..
1a14f82
100644
(file)
--- a/
KernelLand/Kernel/drv/vterm_termbuf.c
+++ b/
KernelLand/Kernel/drv/vterm_termbuf.c
@@
-79,7
+79,7
@@
void VT_int_PutChar(tVTerm *Term, Uint32 Ch)
{
ASSERTC(wrpos->Col, <=, Term->TextWidth);
VT_int_UpdateScreen( Term, 0 );
{
ASSERTC(wrpos->Col, <=, Term->TextWidth);
VT_int_UpdateScreen( Term, 0 );
-
//
wrpos->Row ++;
+ wrpos->Row ++;
wrpos->Col = 0;
}
wrpos->Col = 0;
}
@@
-124,7
+124,7
@@
void VT_int_PutChar(tVTerm *Term, Uint32 Ch)
case '\0': // Ignore NULL byte
return;
case '\n':
case '\0': // Ignore NULL byte
return;
case '\n':
- LOG("Newline, update
"
);
+ LOG("Newline, update
@ %i", write_pos
);
VT_int_UpdateScreen( Term, 0 ); // Update the line before newlining
wrpos->Row ++;
// TODO: Force scroll?
VT_int_UpdateScreen( Term, 0 ); // Update the line before newlining
wrpos->Row ++;
// TODO: Force scroll?
@@
-170,11
+170,12
@@
void VT_int_PutChar(tVTerm *Term, Uint32 Ch)
buffer[ write_pos ].Colour = Term->CurColour;
// Update the line before wrapping
if( (write_pos + 1) % Term->TextWidth == 0 ) {
buffer[ write_pos ].Colour = Term->CurColour;
// Update the line before wrapping
if( (write_pos + 1) % Term->TextWidth == 0 ) {
- LOG("Line wrap, update
"
);
+ LOG("Line wrap, update
@ %i", write_pos
);
VT_int_UpdateScreen( Term, 0 );
VT_int_UpdateScreen( Term, 0 );
+ // NOTE: Code at the top of PutChar handles the actual wrapping
}
}
- write_pos ++;
wrpos->Col ++;
wrpos->Col ++;
+ write_pos ++;
break;
}
break;
}
UCC
git Repository :: git.ucc.asn.au