From: John Hodge Date: Tue, 5 Jul 2011 06:29:21 +0000 (+0800) Subject: Misc changes X-Git-Tag: rel0.10~47 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=16786b0b2d78359e052bd088f86aee90e1140737;p=tpg%2Facess2.git Misc changes - Code cleanup - Preparing for ^C/etc in VTerm - Better commenting --- diff --git a/Kernel/arch/arm7/include/proc.h b/Kernel/arch/arm7/include/proc.h index 62d23980..507b8791 100644 --- a/Kernel/arch/arm7/include/proc.h +++ b/Kernel/arch/arm7/include/proc.h @@ -43,7 +43,7 @@ typedef struct { } tSyscallRegs; // === MACROS === -#define HALT() __asm__ __volatile__ ("nop") +#define HALT() do{}while(0) // === PROTOTYPES === extern void Proc_Start(void); diff --git a/Kernel/arch/x86_64/desctab.asm b/Kernel/arch/x86_64/desctab.asm index aa3e1adc..c575dd61 100644 --- a/Kernel/arch/x86_64/desctab.asm +++ b/Kernel/arch/x86_64/desctab.asm @@ -59,15 +59,15 @@ Desctab_Init: ; Set an IDT entry to a callback %macro SETIDT 2 mov rax, %2 - mov WORD [rdi + %1*16], ax + mov WORD [rdi + %1*16], ax shr rax, 16 - mov WORD [rdi + %1*16 + 6], ax + mov WORD [rdi + %1*16 + 6], ax shr rax, 16 mov DWORD [rdi + %1*16 + 8], eax ; Enable - mov ax, WORD [rdi + %1*16 + 4] - or ax, 0x8000 - mov WORD [rdi + %1*16 + 4], ax + mov ax, WORD [rdi + %1*16 + 4] + or ax, 0x8000 + mov WORD [rdi + %1*16 + 4], ax %endmacro ; Install error handlers @@ -104,27 +104,27 @@ Desctab_Init: mov dx, 0x20 mov al, 0x11 out dx, al ; Init Command - mov dx, 0x21 + mov dx, 0x21 mov al, 0xF0 out dx, al ; Offset (Start of IDT Range) - mov al, 0x04 + mov al, 0x04 out dx, al ; IRQ connected to Slave (00000100b) = IRQ2 - mov al, 0x01 + mov al, 0x01 out dx, al ; Set Mode - mov al, 0x00 + mov al, 0x00 out dx, al ; Set Mode mov dx, 0xA0 mov al, 0x11 out dx, al ; Init Command - mov dx, 0xA1 + mov dx, 0xA1 mov al, 0xF8 out dx, al ; Offset (Start of IDT Range) - mov al, 0x02 + mov al, 0x02 out dx, al ; IRQ Line connected to master - mov al, 0x01 + mov al, 0x01 out dx, al ; Set Mode - mov dl, 0x00 + mov dl, 0x00 out dx, al ; Set Mode pop rdx @@ -137,7 +137,7 @@ Desctab_Init: mov rax, gGDTPtr mov rcx, gGDT mov QWORD [rax+2], rcx - lidt [rax] + lgdt [rax] ; Start interrupts sti diff --git a/Kernel/arch/x86_64/mm_virt.c b/Kernel/arch/x86_64/mm_virt.c index d86ca1a9..ae8784b1 100644 --- a/Kernel/arch/x86_64/mm_virt.c +++ b/Kernel/arch/x86_64/mm_virt.c @@ -3,7 +3,7 @@ * * Virtual Memory Manager */ -#define DEBUG 1 +#define DEBUG 0 #include #include #include diff --git a/Kernel/bin/elf.c b/Kernel/bin/elf.c index 2f43eee8..b55011bb 100644 --- a/Kernel/bin/elf.c +++ b/Kernel/bin/elf.c @@ -41,7 +41,7 @@ tBinary *Elf_Load(int fp) // Check the file type if(hdr.ident[0] != 0x7F || hdr.ident[1] != 'E' || hdr.ident[2] != 'L' || hdr.ident[3] != 'F') { - Warning("Non-ELF File was passed to the ELF loader\n"); + Log_Warning("ELF", "Non-ELF File was passed to the ELF loader"); LEAVE('n'); return NULL; } @@ -49,7 +49,7 @@ tBinary *Elf_Load(int fp) // Check for a program header if(hdr.phoff == 0) { #if DEBUG_WARN - Warning("ELF File does not contain a program header\n"); + Log_Warning("ELF", "File does not contain a program header (phoff == 0)"); #endif LEAVE('n'); return NULL; @@ -222,7 +222,7 @@ tBinary *Elf_Load(int fp) // Reallocate ret = realloc( ret, sizeof(tBinary) + 3*sizeof(Uint)*j ); if(!ret) { - Warning("BIN", "ElfLoad: Unable to reallocate return structure"); + Log_Warning("BIN", "ElfLoad: Unable to reallocate return structure"); return NULL; } ret->NumPages = j; diff --git a/Kernel/drv/vterm.c b/Kernel/drv/vterm.c index de920d8d..d2bdd81d 100644 --- a/Kernel/drv/vterm.c +++ b/Kernel/drv/vterm.c @@ -11,8 +11,6 @@ #include #include -#define USE_CTRL_ALT 1 - // === CONSTANTS === #define VERSION ((0<<8)|(50)) @@ -29,6 +27,7 @@ #define VT_FLAG_HIDECSR 0x01 #define VT_FLAG_ALTBUF 0x02 //!< Alternate screen buffer +#define VT_FLAG_RAWIN 0x04 //!< Don't handle ^Z/^C/^V #define VT_FLAG_HASFB 0x10 //!< Set if the VTerm has requested the Framebuffer enum eVT_InModes { @@ -426,7 +425,6 @@ int VT_Root_IOCtl(tVFS_Node *Node, int Id, void *Data) } /** - * \fn Uint64 VT_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) * \brief Read from a virtual terminal */ Uint64 VT_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) @@ -465,7 +463,7 @@ Uint64 VT_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) // Other - UCS-4 default: VFS_SelectNode(Node, VFS_SELECT_READ, NULL, "VT_Read (UCS-4)"); - + avail = term->InputWrite - term->InputRead; if(avail < 0) avail += MAX_INPUT_CHARS32; @@ -752,30 +750,20 @@ void VT_KBCallBack(Uint32 Codepoint) Codepoint &= 0x7FFFFFFF; switch(Codepoint) { - #if !USE_CTRL_ALT - case KEY_RSHIFT: gbVT_CtrlDown = 0; break; - case KEY_LSHIFT: gbVT_AltDown = 0; break; - #else case KEY_LALT: gbVT_AltDown &= ~1; break; case KEY_RALT: gbVT_AltDown &= ~2; break; case KEY_LCTRL: gbVT_CtrlDown &= ~1; break; case KEY_RCTRL: gbVT_CtrlDown &= ~2; break; - #endif } return; } switch(Codepoint) { - #if !USE_CTRL_ALT // HACK: Use both shifts instead of Ctrl-Alt - case KEY_RSHIFT: gbVT_CtrlDown = 1; break; - case KEY_LSHIFT: gbVT_AltDown = 1; break; - #else case KEY_LALT: gbVT_AltDown |= 1; break; case KEY_RALT: gbVT_AltDown |= 2; break; case KEY_LCTRL: gbVT_CtrlDown |= 1; break; case KEY_RCTRL: gbVT_CtrlDown |= 2; break; - #endif default: if(!gbVT_AltDown || !gbVT_CtrlDown) @@ -865,6 +853,19 @@ void VT_KBCallBack(Uint32 Codepoint) // Unprintable / Don't Pass return; } + +#if 0 + // Handle meta characters + if( !(term->Flags & VT_FLAG_RAWIN) ) + { + switch(buf[0]) + { + case '\3': // ^C + + break; + } + } +#endif // Write if( MAX_INPUT_CHARS8 - term->InputWrite >= len )