From 52a9bf348782b041daa6b783356fe05833582379 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Wed, 30 Dec 2009 21:51:58 +0800 Subject: [PATCH] Added debug code to vterm, fixed userland _errno support --- Kernel/Makefile.BuildNum | 2 +- Kernel/drv/vterm.c | 61 +++++++++++++-------- Usermode/Libraries/libacess.so_src/core.asm | 2 +- Usermode/include/acess/sys.h | 3 + 4 files changed, 42 insertions(+), 26 deletions(-) diff --git a/Kernel/Makefile.BuildNum b/Kernel/Makefile.BuildNum index 73c7d6dc..e6ab2162 100644 --- a/Kernel/Makefile.BuildNum +++ b/Kernel/Makefile.BuildNum @@ -1 +1 @@ -BUILD_NUM = 8 +BUILD_NUM = 11 diff --git a/Kernel/drv/vterm.c b/Kernel/drv/vterm.c index 50392144..8496b9e0 100644 --- a/Kernel/drv/vterm.c +++ b/Kernel/drv/vterm.c @@ -1,6 +1,7 @@ /* * Acess2 Virtual Terminal Driver */ +#define DEBUG 1 #include #include #include @@ -12,7 +13,7 @@ // === CONSTANTS === #define VERSION ((0<<8)|(50)) -#define NUM_VTS 7 +#define NUM_VTS 8 #define MAX_INPUT_CHARS32 64 #define MAX_INPUT_CHARS8 (MAX_INPUT_CHARS32*4) #define VT_SCROLLBACK 1 // 2 Screens of text @@ -359,42 +360,54 @@ int VT_Terminal_IOCtl(tVFS_Node *Node, int Id, void *Data) { int *iData = Data; tVTerm *term = Node->ImplPtr; + ENTER("pNode iId pData", Node, Id, Data); + switch(Id) { - case DRV_IOCTL_TYPE: return DRV_TYPE_TERMINAL; - case DRV_IOCTL_IDENT: memcpy(Data, "VT\0\0", 4); return 0; - case DRV_IOCTL_VERSION: return VERSION; - case DRV_IOCTL_LOOKUP: return 0; + case DRV_IOCTL_TYPE: + LEAVE('i', DRV_TYPE_TERMINAL); + return DRV_TYPE_TERMINAL; + case DRV_IOCTL_IDENT: + memcpy(Data, "VT\0\0", 4); + LEAVE('i', 0); + return 0; + case DRV_IOCTL_VERSION: + LEAVE('x', VERSION); + return VERSION; + case DRV_IOCTL_LOOKUP: + LEAVE('i', 0); + return 0; // Get/Set the mode (and apply any changes) case TERM_IOCTL_MODETYPE: - if(Data == NULL) return term->Mode; - - if(term->Mode != *iData) { - VT_int_ChangeMode(term, *iData); + if(Data != NULL) + { + if(term->Mode != *iData) + VT_int_ChangeMode(term, *iData); + + // Update the screen dimensions + if(giVT_CurrentTerminal == Node->Inode) + VT_SetTerminal( giVT_CurrentTerminal ); } - - // Update the screen dimensions - if(giVT_CurrentTerminal == Node->Inode) - VT_SetTerminal( giVT_CurrentTerminal ); - break; + LEAVE('i', term->Mode); + return term->Mode; // Get/set the terminal width case TERM_IOCTL_WIDTH: - if(Data == NULL) return term->Width; - term->Width = *iData; - break; + if(Data != NULL) term->Width = *iData; + Log("VT_Terminal_IOCtl - RETURN term->Width = %i", term->Width); + LEAVE('i', term->Width); + return term->Width; // Get/set the terminal height case TERM_IOCTL_HEIGHT: - if(Data == NULL) return term->Height; - term->Height = *iData; - break; - - default: - return -1; + if(Data != NULL) term->Height = *iData; + Log("VT_Terminal_IOCtl - RETURN term->Height = %i", term->Height); + LEAVE('i', term->Height); + return term->Height; } - return 0; + LEAVE('i', -1); + return -1; } /** diff --git a/Usermode/Libraries/libacess.so_src/core.asm b/Usermode/Libraries/libacess.so_src/core.asm index 8cb53b77..ef5b1233 100644 --- a/Usermode/Libraries/libacess.so_src/core.asm +++ b/Usermode/Libraries/libacess.so_src/core.asm @@ -5,7 +5,7 @@ [BITS 32] [section .data] -[global _errno] +[global _errno:data (4)] _errno: dd 0 diff --git a/Usermode/include/acess/sys.h b/Usermode/include/acess/sys.h index c9a57619..7f4d7dbf 100644 --- a/Usermode/include/acess/sys.h +++ b/Usermode/include/acess/sys.h @@ -52,6 +52,9 @@ struct s_sysFInfo { typedef struct s_sysFInfo t_sysFInfo; typedef struct s_sysACL t_sysACL; +// === VARIABLES === +extern int _errno; + // === FUNCTIONS === extern void _SysDebug(char *str, ...); // --- Proc --- -- 2.20.1