From particleflux at googlemail.com Sun Jul 1 18:58:32 2012 From: particleflux at googlemail.com (Stefan Linke) Date: Sun, 1 Jul 2012 18:58:32 +0200 Subject: [tyndur-devel] =?utf-8?q?=5BPATCH=5D_kernel2=3A_auf_Vorhandensein?= =?utf-8?q?_von_SSE_pr=C3=BCfen_vor_dem_versuch_es_zu_aktivieren_?= =?utf-8?b?Oyk=?= Message-ID: <1341161912-22383-1-git-send-email-particleflux@googlemail.com> ! auf älteren CPUs ohne sse hatte der init code einen GP gebaut wegen nicht vorhandenen Bits in cr4. Check für Vorhandensein davor eingebaut Signed-off-by: Stefan Linke --- src/kernel2/src/init.c | 48 ++++++++++++++++++++++++++---------------------- 1 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/kernel2/src/init.c b/src/kernel2/src/init.c index 08c0a71..37bc60e 100644 --- a/src/kernel2/src/init.c +++ b/src/kernel2/src/init.c @@ -219,28 +219,32 @@ void init(int multiboot_magic, struct multiboot_info *boot_info, bool bsp) // SSE aktivieren // TODO: Buildscripts fixen? - #if CONFIG_ARCH == ARCH_AMD64 - asm volatile( - "movq %cr0, %rax;" - "andq $0xfffffffffffffffb, %rax;" - "orq $2, %rax;" - "movq %rax, %cr0;" - "movq %cr4, %rax;" - "orq $0x600, %rax;" - "movq %rax, %cr4;" - ); - #else - asm volatile( - "movl %cr0, %eax;" - "andl $0xfffffffb, %eax;" - "orl $2, %eax;" - "movl %eax, %cr0;" - "movl %cr4, %eax;" - "orl $0x600, %eax;" - "movl %eax, %cr4;" - ); - #endif - + uint32_t edx=0; + asm volatile("cpuid": "=d" (edx) : "a" (1) : "ebx", "ecx"); + if ((edx & (1 << 24)) && (edx & (1 << 25))) { // check if FXSR and SSE bits are set + #if CONFIG_ARCH == ARCH_AMD64 + asm volatile( + "movq %cr0, %rax;" + "andq $0xfffffffffffffffb, %rax;" + "orq $2, %rax;" + "movq %rax, %cr0;" + "movq %cr4, %rax;" + "orq $0x600, %rax;" + "movq %rax, %cr4;" + ); + #else + asm volatile( + "movl %cr0, %eax;" + "andl $0xfffffffb, %eax;" + "orl $2, %eax;" + "movl %eax, %cr0;" + "movl %cr4, %eax;" + "orl $0x600, %eax;" + "movl %eax, %cr4;" + ); + #endif + } + static volatile lock_t vmm_lock = LOCK_LOCKED; // ACHTUNG: Hier besteht ein kleines Problem: Da in vmm_init der APIC // gemappt wird, kann nicht mehr darauf zugegriffen werden, bis Paging -- 1.7.8.6 From arne.hasselbring at googlemail.com Mon Jul 2 18:08:51 2012 From: arne.hasselbring at googlemail.com (Arne Hasselbring) Date: Mon, 2 Jul 2012 18:08:51 +0200 Subject: [tyndur-devel] =?utf-8?q?=5BPATCH=5D_Deadkeys?= Message-ID: <1341245331-5827-1-git-send-email-arne.hasselbring@googlemail.com> + vterm kann jetzt Deadkeys Signed-off-by: Arne Hasselbring --- src/modules/vterm/include/keymap.h | 2 + src/modules/vterm/input.c | 104 ++++++++++++++++++++++++++++++ src/modules/vterm/keymaps/Makefile.all | 2 +- src/modules/vterm/keymaps/de.c | 6 +- src/modules/vterm/keymaps/de_nodeadkeys.c | 41 ++++++++++++ 5 Dateien geändert, 151 Zeilen hinzugefügt(+), 4 Zeilen entfernt(-) create mode 100644 src/modules/vterm/keymaps/de_nodeadkeys.c diff --git a/src/modules/vterm/include/keymap.h b/src/modules/vterm/include/keymap.h index 4a8a733..604080d 100644 --- a/src/modules/vterm/include/keymap.h +++ b/src/modules/vterm/include/keymap.h @@ -39,6 +39,8 @@ #include #include +#define KEYMAP_DEADKEY 0x80000000 + /** * Eintrag in der Keymap */ diff --git a/src/modules/vterm/input.c b/src/modules/vterm/input.c index 95cf991..5d1ce57 100644 --- a/src/modules/vterm/input.c +++ b/src/modules/vterm/input.c @@ -51,6 +51,64 @@ extern vterminal_t* current_vterm; /// Pid von kbc static pid_t kbc_pid = 0; +static wchar_t deadkey = 0; + +static wchar_t deadkey_chars[53][4] = { + { L'Ã', L'Á', L'À', L'Â' }, //A + { 0, 0, 0, 0 }, + { 0, L'?', 0, L'?' }, + { 0, 0, 0, 0 }, + { L'?', L'É', L'È', L'Ê' }, + { 0, 0, 0, 0 }, + { 0, L'?', 0, L'?' }, + { 0, 0, 0, L'?' }, + { L'?', L'Í', L'Ì', L'Î' }, + { 0, 0, 0, L'?' }, + { 0, L'?', 0, 0 }, + { 0, L'?', 0, 0 }, + { 0, L'?', 0, 0 }, + { L'Ñ', L'?', L'?', 0 }, + { L'Õ', L'Ó', L'Ò', L'Ô' }, + { 0, L'?', 0, 0 }, + { 0, 0, 0, 0 }, + { 0, L'?', 0, 0 }, + { 0, L'?', 0, L'?' }, + { 0, 0, 0, 0 }, + { L'?', L'Ú', L'Ù', L'Û' }, + { L'?', L'?', L'?', 0 }, + { 0, L'?', L'?', L'?' }, + { 0, 0, 0, 0 }, + { L'?', L'Ý', L'?', L'?' }, + { 0, L'?', 0, L'?' }, + { L'ã', L'á', L'à', L'â' }, //a + { 0, 0, 0, 0 }, + { 0, L'?', 0, L'?' }, + { 0, 0, 0, 0 }, + { L'?', L'é', L'è', L'ê' }, + { 0, 0, 0, 0 }, + { 0, L'?', 0, L'?' }, + { 0, 0, 0, L'?' }, + { L'?', L'í', L'ì', L'î' }, + { 0, 0, 0, L'?' }, + { 0, L'?', 0, 0 }, + { 0, L'?', 0, 0 }, + { 0, L'?', 0, 0 }, + { L'ñ', L'?', L'?', 0 }, + { L'õ', L'ó', L'ò', L'ô' }, + { 0, L'?', 0, 0 }, + { 0, 0, 0, 0 }, + { 0, L'?', 0, 0 }, + { 0, L'?', 0, L'?' }, + { 0, 0, 0, 0 }, + { L'?', L'ú', L'ù', L'û' }, + { L'?', L'?', L'?', 0 }, + { 0, L'?', L'?', L'?' }, + { 0, 0, 0, 0 }, + { L'?', L'ý', L'?', L'?' }, + { 0, L'?', 0, L'?' }, + { '~', L'´', '`', '^' }, //space +}; + /** * Calback handler */ @@ -110,6 +168,45 @@ static void rpc_kbd_callback(pid_t pid, uint32_t cid, size_t data_size, } /** + * Aus Deadkey und Zeichen das passende Zeichen bestimmen + * + * @param c Zeichen + */ +static wchar_t get_real_key(wchar_t c) +{ + c &= ~KEYMAP_DEADKEY; + if (c >= 'A' && c <= 'Z') { + c -= 'A'; + } else if (c >= 'a' && c <= 'z') { + c -= 'a' - 26; + } else if (c == ' ' || c == deadkey) { + c = 52; + } else { + deadkey = 0; + return 0; + } + switch (deadkey) { + case '~': + c = deadkey_chars[c][0]; + break; + case L'´': + c = deadkey_chars[c][1]; + break; + case '`': + c = deadkey_chars[c][2]; + break; + case '^': + c = deadkey_chars[c][3]; + break; + default: + c = 0; + break; + } + deadkey = 0; + return c; +} + +/** * Tastendruecke an ein virtuelles Terminal senden * * @param vterm Terminal-Handle @@ -187,6 +284,13 @@ static void send_key_to_vterm(vterminal_t* vterm, uint8_t keycode, c = e->normal; } + if ((c & KEYMAP_DEADKEY) && !deadkey) { + deadkey = (c & ~KEYMAP_DEADKEY); + return; + } else if (deadkey) { + c = get_real_key(c); + } + if ((c != 0) && ((len = wctomb(buf, c)) != -1)) { vterm_process_input(buf, len); } diff --git a/src/modules/vterm/keymaps/Makefile.all b/src/modules/vterm/keymaps/Makefile.all index 7e47059..ba7fa5c 100644 --- a/src/modules/vterm/keymaps/Makefile.all +++ b/src/modules/vterm/keymaps/Makefile.all @@ -3,7 +3,7 @@ source $LOST_BUILDMK_ROOT/config.sh mkdir -p $1/system/keymaps -for lang in de us de_ch; do +for lang in de de_nodeadkeys us de_ch; do echo "KMAP $lang" $LOST_TOOLS_LD --oformat binary $lang.o -e 0 -o $1/system/keymaps/$lang.kbd chmod a-x $1/system/keymaps/$lang.kbd diff --git a/src/modules/vterm/keymaps/de.c b/src/modules/vterm/keymaps/de.c index df400bd..4e0eb71 100644 --- a/src/modules/vterm/keymaps/de.c +++ b/src/modules/vterm/keymaps/de.c @@ -49,7 +49,7 @@ keymap_entry_t keymap[128] = { { '9', ')', ']', 0 }, // 10 { '0', '=', '}', 0 }, {L'ß', '?', '\\', 0 }, - { 0, '`', 0, 0 }, + {L'´' | KEYMAP_DEADKEY, '`' | KEYMAP_DEADKEY, 0, 0 }, { '\b', 0, 0, 0 }, { '\t', 0, 0, 0 }, { 'q', 'Q', '@', 17 }, @@ -63,7 +63,7 @@ keymap_entry_t keymap[128] = { { 'o', 'O', 0, 15 }, { 'p', 'P', 0, 16 }, {L'ü', L'Ü', 0, 0 }, - { '+', '*', '~', 0 }, + { '+', '*', '~' | KEYMAP_DEADKEY, 0 }, { '\n', 0, 0, 0 }, { 0, 0, 0, 0 }, { 'a', 'A', 0, 1 }, // 30 @@ -77,7 +77,7 @@ keymap_entry_t keymap[128] = { { 'l', 'L', 0, 12 }, {L'ö', L'Ö', 0, 0 }, {L'ä', L'Ä', 0, 0 }, // 40 - { 0, 0, 0, 0 }, + { '^' | KEYMAP_DEADKEY, L'°', 0, 0 }, { 0, 0, 0, 0 }, { '#', '\'', 0, 0 }, { 'y', 'Y', 0, 25 }, diff --git a/src/modules/vterm/keymaps/de_nodeadkeys.c b/src/modules/vterm/keymaps/de_nodeadkeys.c new file mode 100644 index 0000000..c856f28 --- /dev/null +++ b/src/modules/vterm/keymaps/de_nodeadkeys.c @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2012 The tyndur Project. All rights reserved. + * + * This code is derived from software contributed to the tyndur Project + * by Arne Hasselbring. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the tyndur Project + * and its contributors. + * 4. Neither the name of the tyndur Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "keymap.h" + +#undef KEYMAP_DEADKEY +#define KEYMAP_DEADKEY 0 + +#include "de.c" -- 1.7.11.1 From arne.hasselbring at googlemail.com Wed Jul 4 20:07:28 2012 From: arne.hasselbring at googlemail.com (Arne Hasselbring) Date: Wed, 4 Jul 2012 20:07:28 +0200 Subject: [tyndur-devel] =?utf-8?q?=5BPATCH=5D_kbc=3A_m=C3=B6gliche_Endloss?= =?utf-8?q?chleife_gefixt?= Message-ID: <1341425248-25844-1-git-send-email-arne.hasselbring@googlemail.com> ! Wenn in send_kbc_command kein 0xfa (ACK), sondern 0xfe (Resend) zurück- kommt, hätte es eine Endlosschleife gegeben. Signed-off-by: Arne Hasselbring --- src/modules/kbc/keyboard.c | 11 ++++++----- 1 Datei geändert, 6 Zeilen hinzugefügt(+), 5 Zeilen entfernt(-) diff --git a/src/modules/kbc/keyboard.c b/src/modules/kbc/keyboard.c index bfacf01..4fdaadc 100644 --- a/src/modules/kbc/keyboard.c +++ b/src/modules/kbc/keyboard.c @@ -85,11 +85,12 @@ static void send_key_event(uint8_t keycode, bool release); */ static void send_kbd_command(uint8_t command) { - while (inb(0x64) & 0x2) { - yield(); - } - outb(0x60, command); - while (inb(0x60) != 0xfa); + do { + while (inb(0x64) & 0x2) { + yield(); + } + outb(0x60, command); + } while (inb(0x60) == 0xfe); } -- 1.7.11.1