From toni at famkaufmann.info Fri Aug 1 19:47:58 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Fri, 1 Aug 2008 19:47:58 +0200 Subject: [Lost] [Patch] kbc - Rewrite Message-ID: <200808011947.58216.toni@famkaufmann.info> - kbc: Bisheriges LostIO-Interface entfernt, kbc liefert jetzt keine ASCII-Codes mehr * kbc: Callback-Funktion die Keycodes verschickt * vterm: Die Tastendruecke werden jetzt von kbc per Callback-Funktion geliefert, dadurch muss nicht mehr gepollt werden Bei diesem Patch handelt es sich um einen Rewrite von kbc. Dabei wurde ein Teil der Funktionalität (das uebersetzen in Zeichen) nach vterm verschoben, da es sonst schwierig wird, eine vernuenftige Terminalemulation zu bauen (unterschiedliche Zeichen von Tasten je nach Modus, Tasten-remapping und sowas). -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : kbc-rewrite.patch Dateityp : text/x-diff Dateigröße : 47881 bytes Beschreibung: nicht verfügbar URL : From mail at kevin-wolf.de Fri Aug 1 23:15:52 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Fri, 1 Aug 2008 23:15:52 +0200 Subject: [Lost] [Patch] kbc - Rewrite In-Reply-To: <200808011947.58216.toni@famkaufmann.info> References: <200808011947.58216.toni@famkaufmann.info> Message-ID: <200808012315.53043@kevin-wolf.de> Am Freitag, 1. August 2008 19:47:58 schrieb Antoine Kaufmann: > - kbc: Bisheriges LostIO-Interface entfernt, kbc liefert jetzt keine > ASCII-Codes mehr > * kbc: Callback-Funktion die Keycodes verschickt > * vterm: Die Tastendruecke werden jetzt von kbc per Callback-Funktion > geliefert, dadurch muss nicht mehr gepollt werden Ich nehme an, über das grundlegende Konzept brauche ich nicht viele Worte verlieren. Der Ansatz ist natürlich genau das, was man nicht haben möchte. Alles strebt darauf hin, Dateien für alles zu benutzen, und kbc bewegt sich zurück auf eigene RPCs. Die richtige Lösung wäre blockierendes LostIO, und ich erwarte, daß du diesen Code dann zu gegebener Zeit entsprechend umschreibst. Okay, auf zu den Details... > Index: trunk/src/modules/include/keycodes.h > =================================================================== > --- /dev/null > +++ trunk/src/modules/include/keycodes.h > @@ -0,0 +1,79 @@ > +/* > + * Copyright (c) 2008 The LOST Project. All rights reserved. > + * > + * This code is derived from software contributed to the LOST Project > + * by Antoine Kaufmann. > + * > + * 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 LOST Project > + * and its contributors. > + * 4. Neither the name of the LOST 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. > + */ > + > +#ifndef _KEYCODES_H_ > +#define _KEYCODES_H_ > + > +/** > + * Das sind einige der Keycodes die KBC ueber die Callback-Funktion > verschickt. + * Es handelt sich dabei aber nur um diese Keycodes, die auf > allen Layouts am + * selben Ort sind. > + */ > + > +#define KEYCODE_SHIFT_LEFT 42 > +#define KEYCODE_SHIFT_RIGHT 54 > +#define KEYCODE_CONTROL_LEFT 29 > +#define KEYCODE_CONTROL_RIGHT 97 > +#define KEYCODE_ALT 56 > +#define KEYCODE_ALTGR 100 > + > +#define KEYCODE_INSERT 110 > +#define KEYCODE_DELETE 111 > +#define KEYCODE_PAGE_UP 104 > +#define KEYCODE_PAGE_DOWN 109 > +#define KEYCODE_HOME 102 > +#define KEYCODE_END 107 > + > +#define KEYCODE_F1 59 > +#define KEYCODE_F2 60 > +#define KEYCODE_F3 61 > +#define KEYCODE_F4 62 > +#define KEYCODE_F5 63 > +#define KEYCODE_F6 64 > +#define KEYCODE_F7 64 > +#define KEYCODE_F8 66 > +#define KEYCODE_F9 67 > +#define KEYCODE_F10 68 > +#define KEYCODE_F11 87 > +#define KEYCODE_F12 88 Werden die Codes für die F-Tasten irgendwo verwendet? Um noch weiter zu gehen: Da bei der Benutzung der Pfeiltasten usw. ein Fixme steht, daß das nur temporär ist, sollten hier letztendlich nicht nur die Modifiertasten stehenbleiben? (Zu denen gehört dann aber zweifellos auch die Tux-Taste ;-)) > + > +#define KEYCODE_ARROW_UP 103 > +#define KEYCODE_ARROW_DOWN 108 > +#define KEYCODE_ARROW_LEFT 105 > +#define KEYCODE_ARROW_RIGHT 106 > + > + > +#endif // ifndef _KEYCODES_H_ > + > Index: trunk/src/modules/kbc/keyboard.c > =================================================================== > --- trunk.orig/src/modules/kbc/keyboard.c > +++ trunk/src/modules/kbc/keyboard.c > @@ -1,334 +1,214 @@ > - > -#include "types.h" > -#include "syscall.h" > -#include "rpc.h" > -#include "stdlib.h" > -#include "stdio.h" > -#include "lostio.h" > -#include "ports.h" > +/* > + * Copyright (c) 2008 The LOST Project. All rights reserved. > + * > + * This code is derived from software contributed to the LOST Project > + * by Antoine Kaufmann. > + * > + * 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 LOST Project > + * and its contributors. > + * 4. Neither the name of the LOST 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 > +#include > +#include > +#include > +#include > +#include > +#include > > #include "keyboard.h" > #include "mouse.h" > > -#define BUFFER_SIZE 1024 > -#define BUFFER_TYPE_RAW 1 > -#define BUFFER_TYPE_ASCII 2 > - > - > -void kbd_irq_handler(); > - > -dword kbd_scancode[256][2] = > -{ > - {0, 0}, // 0x00 > - {27, 27}, // 0x01 > - {'1', '|'}, // 0x02 > - {'2', '"'}, // 0x03 F5 > - {'3', 0}, // 0x04 F3 > - {'4', '$'}, // 0x05 F1 > - {'5', '%'}, // 0x06 F2 > - {'6', '&'}, // 0x07 F12 > - {'7', '/'}, // 0x08 F10 > - {'8', '('}, // 0x09 > - {'9', ')'}, // 0x0A F8 > - {'0', '='}, // 0x0B F6 > - {39, '?'}, // 0x0C' > - {'^', '`'}, // 0x0D > - {'\b', '\b'}, // 0x0E > - {'\t', '\t'}, // 0x0F F4 > - {'q', 'Q'}, // 0x10 > - {'w', 'W'}, // 0x11 > - {'e', 'E'}, // 0x12 > - {'r', 'R'}, // 0x13 > - {'t', 'T'}, // 0x14 > - {'z', 'Z'}, // 0x15 q > - {'u', 'U'}, // 0x16 1 > - {'i', 'I'}, // 0x17 > - {'o', 'O'}, // 0x18 > - {'p', 'P'}, // 0x19 > - {'u', 'e'}, // 0x1A y > - {'+', '*'}, // 0x1B s > - {'\n', '\n'}, // 0x1C a > - {0, 0}, // 0x1D w > - {'a', 'A'}, // 0x1E 2 > - {'s', 'S'}, // 0x1F > - {'d', 'D'}, // 0x20 > - {'f', 'F'}, // 0x21 c > - {'g', 'G'}, // 0x22 x > - {'h', 'H'}, // 0x23 d > - {'j', 'J'}, // 0x24 e > - {'k', 'K'}, // 0x25 4 > - {'l', 'L'}, // 0x26 3 > - {'o', 'e'}, // 0x27 > - {'a', 'a'}, // 0x28 > - {0, 0}, // 0x29 space > - {0, 0}, // 0x2A v > - {'#', '\''}, // 0x2B f > - {'y', 'Y'}, // 0x2C t > - {'x', 'X'}, // 0x2D r > - {'c', 'C'}, // 0x2E 5 > - {'v', 'V'}, // 0x2F > - {'b', 'B'}, // 0x30 > - {'n', 'N'}, // 0x31 n > - {'m', 'M'}, // 0x32 b > - {',', ';'}, // 0x33 h > - {'.', ':'}, // 0x34 g > - {'-', '_'}, // 0x35 z > - {0, 0}, // 0x36 6 > - {0, 0}, // 0x37 > - {0, 0}, // 0x38 > - {' ', ' '}, // 0x39 > - {0, 0}, // 0x3A m > - {256+59, 0}, // 0x3B j [F1] > - {256+60, 0}, // 0x3C u > - {256+61, 0}, // 0x3D 7 > - {256+62, 0}, // 0x3E 8 > - {256+63, 0}, // 0x3F > - {256+64, 0}, // 0x40 > - {256+65, 0}, // 0x41 , > - {256+66, 0}, // 0x42 k > - {256+67, 0}, // 0x43 i > - {256+68, 0}, // 0x44 o [F10] > - {0, 0}, // 0x45 0 > - {0, 0}, // 0x46 9 > - {0, 0}, // 0x47 > - {0, 0}, // 0x48 > - {0, 0}, // 0x49 . > - {0, 0}, // 0x4A - > - {0, 0}, // 0x4B l > - {0, 0}, // 0x4C TODO > - {0, 0}, // 0x4D p > - {0, 0}, // 0x4E Ã? > - {0, 0}, // 0x4F > - {0, 0}, // 0x50 > - {0, 0}, // 0x51 > - {0, 0}, // 0x52 TODO > - {0, 0}, // 0x53 > - {0, 0}, // 0x54 TODO > - {0, 0}, // 0x55 > - {0, 0}, // 0x56 > - {256+133, 0}, // 0x57 [F11] > - {256+134, 0}, // 0x58 capslock [F12] > - {0, 0}, // 0x59 > - {0, 0}, // 0x5A enter > - {0, 0}, // 0x5B + > - {0, 0}, // 0x5C > - {0, 0}, // 0x5D # > - {0, 0}, // 0x5E > - {0, 0}, // 0x5F > - {0, 0}, // 0x60 > - {0, 0}, // 0x61 > - {0, 0}, // 0x62 > - {0, 0}, // 0x63 > - {0, 0}, // 0x64 > - {0, 0}, // 0x65 > - {0, 0}, // 0x66 backspace > - {0, 0}, // 0x67 > - {0, 0}, // 0x68 > - {0, 0}, // 0x69 numblock 1 //TODO > - {0, 0}, // 0x6A > - {0, 0}, // 0x6B numblock 6 //TODO > - {0, 0}, // 0x6C numblock 7 //TODO > - {0, 0}, // 0x6D > - {0, 0}, // 0x6E > - {0, 0}, // 0x6F > - {0, 0}, // 0x70 numblock 0 //TODO > - {0, 0}, // 0x71 numblock , //TODO > - {0, 0}, // 0x72 numblock 2 //TODO > - {0, 0}, // 0x73 numblock 5 //TODO > - {0, 0}, // 0x74 numblock 6 //TODO > - {0, 0}, // 0x75 numblock 8 //TODO > - {0, 0}, // 0x76 ESC > - {0, 0}, // 0x77 NUM > - {0, 0}, // 0x78 F11 > - {0, 0}, // 0x79 numblock + //TODO > - {0, 0}, // 0x7A numblock 3 //TODO > - {0, 0}, // 0x7B numblock - //TODO > - {0, 0}, // 0x7C numblock * //TODO > - {0, 0}, // 0x7D numblock 9 //TODO > - {0, 0}, // 0x7E scroll lock > - {0, 0}, // 0x7F > - {0, 0}, // 0x80 > - {0, 0}, // 0x81 > - {0, 0}, // 0x82 > - {0, 0}, // 0x83 F7 > - {0, 0}, // 0x84 > - {0, 0}, // 0x85 > - {0, 0}, // 0x86 > - {0, 0}, // 0x87 > - {0, 0}, // 0x88 > - {0, 0}, // 0x89 > - {0, 0}, // 0x8A > - {0, 0}, // 0x8B > - {0, 0}, // 0x8C > - {0, 0}, // 0x8D > - {0, 0}, // 0x8E > - {0, 0}, // 0x8F > -}; > - > - > -size_t kbd_buffer_pos; > -byte* kbd_ascii_buffer; > -byte* kbd_work_buffer; > +/** > + * Liste mit den PIDs die benachrichtitg werden wollen, bei Tastendruecken > + */ > +static list_t* callback_list; > + > +/** > + * RPC-Handler zum registrieren eines Callbacks fuer Tastendruecke > + */ > +static void rpc_register_callback(pid_t pid, dword cid, size_t data_size, > + void* data); > + > + > +/** > + * IRQ-Hander > + */ > +static void kbd_irq_handler(void); > + > +/** > + * Befehl an den Tastaturkontroller senden > + */ > +void kbd_send_cmd(uint8_t cmd); static? > + > + > +/** > + * Tastendruck an wartende Prozesse senden > + * > + * @param keycode Der zu sendende Keycode > + * @param release TRUE wenn die Taste losgelassen wurde > + */ > +static void send_key_event(uint8_t keycode, bool release); > > -size_t kbd_read_handler(lostio_filehandle_t* filehandle, void* buf, > - size_t blocksize, size_t blockcount); > > -void kbd_send_cmd(byte cmd); > > -// Keyboard wird initialisiert > +/** > + * Tastaturtreiber initialisieren > + */ > void keyboard_init(void) > { > - kbd_ascii_buffer = malloc(BUFFER_SIZE); > - kbd_work_buffer = malloc(BUFFER_SIZE); > - kbd_buffer_pos = 0; > - > - //Speicher fuer ein neues typehandle allokieren > - typehandle_t* typehandle = malloc(sizeof(typehandle_t)); > - typehandle->id = 255; > - typehandle->not_found = NULL; > - typehandle->pre_open = NULL; > - typehandle->post_open = NULL; > - typehandle->read = &kbd_read_handler; > - typehandle->write = NULL; > - typehandle->seek = NULL; > - typehandle->close = NULL; > - typehandle->link = NULL; > - typehandle->unlink = NULL; > - lostio_register_typehandle(typehandle); > - > - vfstree_create_node("/keyboard", LOSTIO_TYPES_DIRECTORY, 0, 0, 0); > - //vfstree_create_node("/raw", 255, 0, (void*)BUFFER_TYPE_RAW); > - vfstree_create_node("/keyboard/ascii", 255, 0, > (void*)BUFFER_TYPE_ASCII, 0); + // Liste mit Prozessen, die > benachrichtigt werden wollen ueber Tastendruecke + callback_list = > list_create(); > + register_message_handler("KBDREGIS", rpc_register_callback); "KBDREGIS" wäre eine Konstante in einer öffentlichen Headerdatei wert, die dann auch von vterm benutzt werden kann. > > + // Interrupt-Handler fuer die Tastatur registrieren > register_intr_handler(0x21, &kbd_irq_handler); > - > + > + // Tastatur-Reset > long long timeout = get_tick_count() + 500000; > outb(0x60, 0xff); > - while ((inb(0x60) != 0xaa) && (get_tick_count() < timeout)) yield(); > + while ((inb(0x60) != 0xaa) && (get_tick_count() < timeout)) yield(); > } > > - > -void kbd_send_cmd(byte cmd) > +/** > + * Befehl an den Tastaturkontroller senden > + */ > +void kbd_send_cmd(uint8_t cmd) > { > - while ((inb(0x64) & 0x02) != 0) yield(); > + while ((inb(0x64) & 0x02) != 0) { > + yield(); > + } > + > outb(0x60, cmd); > - while (inb(0x60) != 0xfa) yield(); > + > + while (inb(0x60) != 0xFA) { > + yield(); > + } > } > > > +/** > + * IRQ-Hander > + */ > void kbd_irq_handler() { > + uint8_t scancode; > + uint8_t keycode = 0; > + bool break_code = FALSE; > + > + // Status-Variablen fuer das Behandeln von e0- und e1-Scancodes > + static bool e0_code = FALSE; > + // Wird auf 1 gesetzt, sobald e1 gelesen wurde, und auf 2, sobald das > erste + // Datenbyte gelesen wurde > + static int e1_code = 0; > + static uint16_t e1_prev = 0; > + > p(); Wieso p/v an dieser Stelle? > > - byte scancode = inb(0x60); > - byte ascii; > - bool breakcode; > - bool preceding_zero; > - > - static bool state_caps = FALSE; > - static bool state_extended = FALSE; > - > - if (scancode == 0xE0) { > - state_extended = TRUE; > - v(); > - return; > - } > + scancode = inb(0x60); > > - if (state_extended) > - { > - state_extended = FALSE; > - > - preceding_zero = TRUE; > - switch (scancode) > - { > - case 0x4B: ascii = 75; break; // Links > - case 0x4D: ascii = 77; break; // Rechts > - case 0x48: ascii = 72; break; // Hoch > - case 0x50: ascii = 80; break; // Runter > - > - case 0x49: ascii = 73; break; // Bild Auf > - case 0x51: ascii = 81; break; // Bild Ab > - > - case 0x52: ascii = 82; break; // Einfg > - case 0x53: ascii = 83; break; // Entf > - case 0x47: ascii = 71; break; // Pos1 > - case 0x4F: ascii = 79; break; // Ende > - > - default: > - if ((scancode & 0x80) == 0) { > - printf("<0E %02x>", scancode); > - } > - ascii = 0; > - break; > - } > - } > - else > - { > - //Ascii-Zeichen fuer diese Taste holen > - if(state_caps == TRUE) > - { > - ascii = kbd_scancode[scancode][1] & 0xff; > - preceding_zero = kbd_scancode[scancode][1] & 0x100; > - } > - else > - { > - ascii = kbd_scancode[scancode][0] & 0xff; > - preceding_zero = kbd_scancode[scancode][0] & 0x100; > - } > - } > > - // > - if(scancode > 0x80) > - { > - breakcode = TRUE; > - } > - else > - { > - breakcode = FALSE; > + // Um einen Breakcode handelt es sich, wenn das oberste Bit gesetzt > ist und + // es kein e0 oder e1 fuer einen Extended-scancode ist > + if ((scancode & 0x80) && > + (e1_code || (scancode != 0xE1)) && > + (e0_code || (scancode != 0xE0))) > + { > + break_code = TRUE; > + scancode &= ~0x80; > + } > + > + if (e0_code) { > + // Fertiger e0-Scancode > + keycode = translate_scancode(1, scancode); > + e0_code = FALSE; > + } else if (e1_code == 2) { > + // Fertiger e1-Scancode > + // Zweiten Scancode in hoeherwertiges Byte packen > + e1_prev |= ((uint16_t) scancode << 8); > + keycode = translate_scancode(2, e1_prev); > + e1_code = 0; > + } else if (e1_code == 1) { > + // Erstes Byte fuer e1-Scancode > + e1_prev = scancode; > + e1_code++; > + } else if (scancode == 0xE0) { > + // Anfang eines e0-Codes > + e0_code = TRUE; > + } else if (scancode == 0xE1) { > + // Anfang eines e1-Codes > + e1_code = 1; > + } else { > + // Normaler Scancode > + keycode = translate_scancode(0, scancode); > } > > - //Eine shift taste > - if(((scancode & (~0x80)) == 0x2a) || ((scancode & (~0x80)) == 0x36)) > - { > - state_caps = !breakcode; > - } > - else if(ascii != 0) > - { > - if(kbd_buffer_pos < BUFFER_SIZE - (preceding_zero ? 1 : 0)) > - { > - if (preceding_zero) { > - kbd_ascii_buffer[kbd_buffer_pos++] = 0; > - } > - kbd_ascii_buffer[kbd_buffer_pos++] = ascii; > - } > - else > - { > - printf("\n[KBC] Tastaturpuffer voll\n"); > - } > + if (keycode != 0) { > + send_key_event(keycode, break_code); > } > > v(); > } > > > -size_t kbd_read_handler(lostio_filehandle_t* filehandle, void* buf, > - size_t blocksize, size_t blockcount) > +/** > + * RPC-Handler zum registrieren eines Callbacks fuer Tastendruecke > + */ > +static void rpc_register_callback(pid_t pid, dword cid, size_t data_size, > + void* data) > { > - size_t size = blocksize * blockcount; > + pid_t* ppid = malloc(sizeof(*ppid)); > + *ppid = pid; Ganz ehrlich, man muß nicht immer überkorrekt sein. Eine PID läßt sich wunderbar in einen void* casten. Keine Notwendigkeit für malloc. > - p(); > - if(size > kbd_buffer_pos) > - { > - size = kbd_buffer_pos; > - } > - > - memcpy(kbd_work_buffer, kbd_ascii_buffer, size); > - memmove(kbd_ascii_buffer, (void*) ((dword)kbd_ascii_buffer + size), > kbd_buffer_pos - size); - > - memcpy(buf, kbd_work_buffer, size); > + list_push(callback_list, ppid); > + rpc_send_dword_response(pid, cid, 1); > +} > > - kbd_buffer_pos -= size; > - v(); > +/** > + * Tastendruck an wartende Prozesse senden > + * > + * Der RPC verschickt dabei 2 Bytes, das erste mit dem keycode, das zweite > ist + * entweder 0 oder != 0 je nachdem, ob die Taste gedrueckt oder > losgelassen + * wurde. > + * > + * @param keycode Der zu sendende Keycode > + * @param release TRUE wenn die Taste losgelassen wurde > + */ > +static void send_key_event(uint8_t keycode, bool release) > +{ > + pid_t* pid; > + int i; > + char data[8 + 2]; > + > + strcpy(data, "KBDEVENT"); > + data[8] = keycode; > + data[9] = release; > > - return size; > + for (i = 0; (pid = list_get_element_at(callback_list, i)); i++) { > + send_message(*pid, 512, 0, 8 + 2, data); > + } > } > > Index: trunk/src/modules/kbc/keyboard.h > =================================================================== > --- trunk.orig/src/modules/kbc/keyboard.h > +++ trunk/src/modules/kbc/keyboard.h > @@ -4,4 +4,20 @@ > > void keyboard_init(void); > > + > +/** > + * Scancode in einen Keycode uebersetzen > + * > + * @param set Zu Benutztende Tabelle: > + * 0: Normale Scancodes > + * 1: Extended0 Scancodes > + * 2: Extended1 Scancodes > + * > + * @param code Scancode; keine Breakcodes nur normale Scancodes > + * Fuer e1 den zweiten Scancode im hoeherwertigen Byte > uebergeben + * > + * @return Keycode oder 0 falls der Scancode nicht bekannt ist > + */ > +uint8_t translate_scancode(int set, uint16_t scancode); > + > #endif > Index: trunk/src/modules/kbc/main.c > =================================================================== > --- trunk.orig/src/modules/kbc/main.c > +++ trunk/src/modules/kbc/main.c > @@ -10,8 +10,6 @@ > #include "keyboard.h" > #include "mouse.h" > > -extern size_t kbd_buffer_pos; > - > int main(int argc, char* argv[]) > { > request_ports(0x60, 1); > @@ -26,8 +24,6 @@ int main(int argc, char* argv[]) > > init_service_register("kbc"); > > - kbd_buffer_pos = 0; > - > while(1) { > wait_for_rpc(); > } > Index: trunk/src/modules/kbc/sc2kc.c > =================================================================== > --- /dev/null > +++ trunk/src/modules/kbc/sc2kc.c > @@ -0,0 +1,127 @@ > +/* > + * Copyright (c) 2008 The LOST Project. All rights reserved. > + * > + * This code is derived from software contributed to the LOST Project > + * by Antoine Kaufmann. > + * > + * 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 LOST Project > + * and its contributors. > + * 4. Neither the name of the LOST 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 > +#include "keyboard.h" > + > + > +/** > + * Scancode => Keycode Uebersetzungstabelle fuer Scancode Set 1 > + */ > +static uint8_t sc_to_kc[][128] = { > + // Normale Scancodes > + { > + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, > + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, > + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, > + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, > + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, > + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, > + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, > + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, > + 80, 81, 82, 84, 00, 00, 86, 87, 88, 00, > + 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, > + 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, > + 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, > + 00, 00, 00, 00, 00, 00, 00, 00 > + }, > + > + // Extended0-Scancodes (werden mit e0 eingeleitet) > + { > + 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, > + 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, > + 00, 00, 00, 00, 00, 00, 00, 00, 00, 97, > + 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, > + 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, > + 00, 00, 00, 00, 00, 00, 100, 00, 00, 00, > + 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, > + 00, 102, 103, 104, 00, 105, 00, 106, 00, 107, > + 108, 109, 110, 111, 00, 00, 00, 00, 00, 00, > + 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, > + 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, > + 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, > + 00, 00, 00, 00, 00, 00, 00, 00 > + }, > +}; Ich gehe einfach mal davon aus, daß du deinen Code mal laufen lassen hast und akzeptiere das dann als Beweis durch Ausprobieren. ;-) > + > +/** > + * Scancode in einen Keycode uebersetzen > + * > + * @param set Zu Benutztende Tabelle: > + * 0: Normale Scancodes > + * 1: Extended0 Scancodes > + * 2: Extended1 Scancodes > + * > + * @param code Scancode; keine Breakcodes nur normale Scancodes > + * Fuer e1 den zweiten Scancode im hoeherwertigen Byte > uebergeben + * > + * @return Keycode oder 0 falls der Scancode nicht bekannt ist > + */ > +uint8_t translate_scancode(int set, uint16_t scancode) > +{ > + uint8_t keycode = 0; > + > + switch (set) { > + // Normale scancodes > + case 0: > + keycode = sc_to_kc[0][scancode]; > + break; > + > + // e0-Scancodes > + case 1: > + keycode = sc_to_kc[1][scancode]; > + break; > + > + // e1-Scancodes > + case 2: > + // TODO: Hier waere eigentlich eine Tabelle auch schoen > + switch (scancode) { > + // Pause > + case 0x451D: > + keycode = 119; > + break; > + > + default: > + keycode = 0x0; > + }; > + break; > + } > + > + if (keycode == 0) { > + printf("kbc: Unbekannter Scancode: 0x%x (%d)\n", scancode, set); > + } > + > + return keycode; > +} > Index: trunk/src/modules/vterm/input.c > =================================================================== > --- /dev/null > +++ trunk/src/modules/vterm/input.c > @@ -0,0 +1,219 @@ > +/* > + * Copyright (c) 2008 The LOST Project. All rights reserved. > + * > + * This code is derived from software contributed to the LOST Project > + * by Antoine Kaufmann. > + * > + * 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 LOST Project > + * and its contributors. > + * 4. Neither the name of the LOST 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 > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "vterm.h" > +#include "keymap.h" > + > +extern vterminal_t* current_vterm; > + > +/// Pid von kbc > +static pid_t kbc_pid = 0; > + > +/** > + * Callback bei KBC registieren; Danach kommt bei jedem Tastatur-Ereignis > ein + * RPC mit Namen KBDEVENT > + * > + * @return TRUE bei Erfolg, FALSE sonst > + */ > +static bool kbd_register_callback(); > + > +/** > + * Calback handler > + */ > +static void rpc_kbd_callback(pid_t pid, dword cid, size_t data_size, > + void* data); > + > +/** > + * Tastendruecke an ein virtuelles Terminal senden > + * > + * @param vterm Terminal-Handle > + * @param keycode Der Keycode > + * @param release TRUE wenn die Taste losgelassen wurde, FALSE sonst > + */ > +static void send_key_to_vterm(vterminal_t* vterm, uint8_t keycode, > + bool release); > + > + > + > +/** > + * Eingabe initialisieren > + * > + * @return TRUE bei Erfolg, FALSE sonst > + */ > +bool init_input() > +{ > + // RPC-Handler fuer die Callbacks von KBD einrichten > + register_message_handler("KBDEVENT", rpc_kbd_callback); > + > + return kbd_register_callback(); > +} > + > +/** > + * Callback bei KBD registieren; Danach kommt bei jedem Tastatur-Ereignis > ein + * RPC mit Namen KBDEVENT > + * > + * @return TRUE bei Erfolg, FALSE sonst > + */ > +static bool kbd_register_callback() > +{ > + kbc_pid = init_service_get("kbc"); > + if (!kbc_pid) { > + return FALSE; > + } > + > + return rpc_get_dword(kbc_pid, "KBDREGIS", 0, NULL); > +} Kapselung in Funktionen schön und gut, aber manchmal ist es zu viel des Guten. Pack das doch direkt in init_input rein, das ist sonst so leer. > + > +/** > + * Calback handler > + */ > +static void rpc_kbd_callback(pid_t pid, dword cid, size_t data_size, > + void* data) > +{ > + uint8_t* kbd_data = data; > + vterminal_t* vterm = current_vterm; > + > + if ((pid != kbc_pid) || (data_size != 2)) { > + return; > + } > + > + send_key_to_vterm(vterm, kbd_data[0], !kbd_data[1]); > +} > + > +/** > + * Eingabe fuer ein virtuelles Terminal initialisieren > + * > + * @param vterm Pointer auf die Verwaltungsstruktur fuers vterm > + */ > +bool vterm_input_init(vterminal_t* vterm) > +{ > + //vterm_input_t* in = &(vterm->input); > + > + return TRUE; > +} Ich bin gänzlich überwältigt von der Nützlichkeit dieser Funktion. > + > +/** > + * Tastendruecke an ein virtuelles Terminal senden > + * > + * @param vterm Terminal-Handle > + * @param keycode Der Keycode > + * @param down TRUE wenn die Taste gedrueckt wurde, FALSE sonst > + */ > +static void send_key_to_vterm(vterminal_t* vterm, uint8_t keycode, > + bool down) > +{ > + static bool st_shift = FALSE; > + static bool st_control = FALSE; > + static bool st_alt = FALSE; > + static bool st_altgr = FALSE; > + > + keymap_entry_t* e; > + //char buf[16]; Rein oder raus. Aber nicht auskommentiert rein. > + wchar_t c = 0; > + > + // Modifier-Tasten Verarbeiten > + switch (keycode) { > + case KEYCODE_SHIFT_LEFT: > + case KEYCODE_SHIFT_RIGHT: > + st_shift = down; > + return; > + > + case KEYCODE_CONTROL_LEFT: > + case KEYCODE_CONTROL_RIGHT: > + st_control = down; > + return; > + > + case KEYCODE_ALT: > + st_alt = down; > + return; > + > + case KEYCODE_ALTGR: > + st_altgr = down; > + return; > + } > + > + /*printf("Keycode %d %d%d%d%d %s\n", keycode, st_shift, st_control, > st_alt, + st_altgr, (!down ? " up\n" : " down\n"));*/ Debugcode sollte raus. > + > + // Von hier an brauchen wir die losgelassenen Tasten nicht mehr > + if (!down) { > + return; > + } > + > + // FIXME: Ist nur temporaer da, damit Pfeiltasten und andere > Spezialtasten + // funktionieren wie bisher. > + switch (keycode) { > + case KEYCODE_ARROW_UP: vterm_process_input("\0H", 2); return; > + case KEYCODE_ARROW_DOWN: vterm_process_input("\0P", 2); return; > + case KEYCODE_ARROW_LEFT: vterm_process_input("\0K", 2); return; > + case KEYCODE_ARROW_RIGHT: vterm_process_input("\0M", 2); return; > + case KEYCODE_PAGE_UP: vterm_process_input("\0I", 2); return; > + case KEYCODE_PAGE_DOWN: vterm_process_input("\0Q", 2); return; > + case KEYCODE_INSERT: vterm_process_input("\0R", 2); return; > + case KEYCODE_HOME: vterm_process_input("\0G", 2); return; > + case KEYCODE_END: vterm_process_input("\0O", 2); return; > + case KEYCODE_DELETE: vterm_process_input("\0S", 2); return; > + } > + > + // Zeichen auswaehlen > + e = keymap_get(keycode); > + // TODO: AltGr+Shift > + if (st_shift) { > + c = e->shift; > + } else if (st_altgr) { > + c = e->altgr; > + } else if (st_control) { > + c = e->ctrl; > + } else { > + c = e->normal; > + } > + // TODO: Alt > + > + > + // FIXME: Mit einem richtigen wc tut das nicht, aber dafuer brauche > ich erst + // ein wctomb. > + if (c != 0) { > + vterm_process_input((char*) &c, 1); > + } > +} > + > Index: trunk/src/modules/vterm/keymap.c > =================================================================== > --- /dev/null > +++ trunk/src/modules/vterm/keymap.c > @@ -0,0 +1,178 @@ > +/* > + * Copyright (c) 2008 The LOST Project. All rights reserved. > + * > + * This code is derived from software contributed to the LOST Project > + * by Antoine Kaufmann. > + * > + * 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 LOST Project > + * and its contributors. > + * 4. Neither the name of the LOST 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" > + > +keymap_entry_t keymap[] = { > + { 0, 0, 0, 0 }, // 0 > + { '\033', '\033', '\033', '\033' }, > + { '1', '!', '|', 0 }, > + { '2', '"', 0, 0 }, > + { '3', '#', 0, 0 }, > + { '4', '$', 0, 0 }, > + { '5', '%', 0, 0 }, > + { '6', '&', 0, 0 }, > + { '7', '/', 0, 0 }, > + { '8', '(', 0, 0 }, > + { '9', ')', 0, 0 }, // 10 > + { '0', '=', 0, 0 }, > + { '\'', 0, 0, 0 }, > + { '^', 0, 0, 0 }, > + { '\b', 0, 0, 0 }, > + { '\t', 0, 0, 0 }, > + { 'q', 'Q', 0, 0 }, > + { 'w', 'W', 0, 0 }, > + { 'e', 'E', 0, 0 }, > + { 'r', 'R', 0, 0 }, > + { 't', 'T', 0, 0 }, // 20 > + { 'z', 'Z', 0, 0 }, > + { 'u', 'U', 0, 0 }, > + { 'i', 'I', 0, 0 }, > + { 'o', 'O', 0, 0 }, > + { 'p', 'P', 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { '\n', 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 'a', 'A', 0, 0 }, // 30 > + { 's', 'S', 0, 0 }, > + { 'd', 'D', 0, 0 }, > + { 'f', 'F', 0, 0 }, > + { 'g', 'G', 0, 0 }, > + { 'h', 'H', 0, 0 }, > + { 'j', 'J', 0, 0 }, > + { 'k', 'K', 0, 0 }, > + { 'l', 'L', 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, // 40 > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 'y', 'Y', 0, 0 }, > + { 'x', 'X', 0, 0 }, > + { 'c', 'C', 0, 0 }, > + { 'v', 'V', 0, 0 }, > + { 'b', 'B', 0, 0 }, > + { 'n', 'N', 0, 0 }, > + { 'm', 'M', 0, 0 }, // 50 > + { ',', ';', 0, 0 }, > + { '.', ':', 0, 0 }, > + { '-', '_', 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { ' ', ' ', ' ', 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, // 60 > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, // 70 > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, // 80 > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { '<', '>', '|', 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, // 90 > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, // 100 > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, // 110 > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, // 120 > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > + { 0, 0, 0, 0 }, > +}; Ich will Umlaute, wenn es schon einen neuen Tastaturtreiber gibt! ;-) > + > +/** > + * Eintrag aus der Keymap auslesen > + * > + * @return Pointer auf den Eintrag oder NULL wenn keiner existiert > + */ > +keymap_entry_t* keymap_get(uint8_t keycode) > +{ > + return &keymap[keycode]; > +} > + > Index: trunk/src/modules/vterm/keymap.h > =================================================================== > --- /dev/null > +++ trunk/src/modules/vterm/keymap.h > @@ -0,0 +1,59 @@ > +/* > + * Copyright (c) 2008 The LOST Project. All rights reserved. > + * > + * This code is derived from software contributed to the LOST Project > + * by Antoine Kaufmann. > + * > + * 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 LOST Project > + * and its contributors. > + * 4. Neither the name of the LOST 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. > + */ > + > +#ifndef _KEYMAP_H_ > +#define _KEYMAP_H_ > +#include > +#include > + > +/** > + * Eintrag in der Keymap > + */ > +typedef struct keymap_entry { > + wchar_t normal; > + wchar_t shift; > + wchar_t altgr; > + wchar_t ctrl; > +} keymap_entry_t; > + > +/** > + * Eintrag aus der Keymap auslesen > + * > + * @return Pointer auf den Eintrag oder NULL wenn keiner existiert > + */ > +keymap_entry_t* keymap_get(uint8_t keycode); > + > +#endif // ifndef _KEYMAP_H_ > + > Index: trunk/src/modules/vterm/term.c > =================================================================== > --- trunk.orig/src/modules/vterm/term.c > +++ trunk/src/modules/vterm/term.c > @@ -124,6 +124,7 @@ vterminal_t* vterm_create(char shortcut) > if (vterm_output_init(vterm, 100) == FALSE) { > // TODO > } > + vterm_input_init(vterm); > return vterm; > } > > Index: trunk/src/modules/vterm/vterm.c > =================================================================== > --- trunk.orig/src/modules/vterm/vterm.c > +++ trunk/src/modules/vterm/vterm.c > @@ -43,84 +43,29 @@ > #include "init.h" > > > -/// Oeffnet Eingabdatei > -static bool init_io_files(); > /// Hier kommen die Eingaben fuer all die virtuellen Terminals her > FILE* input = NULL; > > -/// Eingaben einlesen > -static void get_input(); > - > int main(int argc, char* argv[]) > { > - // Eingabedatei oeffnen > - if (init_io_files() == FALSE) { > + // Eingabe initialisieren > + if (init_input() == FALSE) { > // Falls das nicht klappt, ist alles sinnlos. ;-) > return -1; > } > > // Schnittstelle fuer die anderen Prozesse einrichten > init_lostio_interface(); > - > - init_output(); > > + init_output(); > init_vterminals(10); > - > + > init_service_register("vterm"); > - > + > // Auf Anfragen warten > - timer_register(&get_input, 200000); > while(TRUE) { > wait_for_rpc(); > lostio_dispatch(); > } > } > > -/** > - * File-Handle fuer die Eingaben aller Terminals oeffnen > - * > - * @return TRUE bei Erfolg, FALSE im Fehlerfall > - */ > -bool init_io_files() > -{ > - int i; > - > - // Falls das öffnen nicht beim ersten Anlauf klappt, wird weiter > Probiert - // 5 Mal im Abstand von einer Sekunde > - for (i = 0; (i < 10) && (input == NULL); i++) { > - if (input == NULL) { > - input = fopen("kbc:/keyboard/ascii", "r"); > - } > - > - // Pruefen ob schon beide erfolgreich geoeffnet wurden > - if ((input == NULL)) { > - msleep(500); > - } > - } > - > - // Wenn input nicht geoeffnet werden konnten, muss abgebrochen werden > - if (input == NULL) { > - puts("Input konnte nicht geoeffnet werden!"); > - return FALSE; > - } > - > - return TRUE; > -} > - > -/** > - * Eingaben holen... wird vom Timer aufgerufen > - */ > -static void get_input() > -{ > - char buffer[32]; > - size_t buffer_pos; > - > - buffer_pos = fread(buffer, 1, sizeof(buffer), input); > - if (buffer_pos != 0) { > - p(); > - vterm_process_input(buffer, buffer_pos); > - v(); > - } > - timer_register(&get_input, 50000); > -} > - > Index: trunk/src/modules/vterm/vterm.h > =================================================================== > --- trunk.orig/src/modules/vterm/vterm.h > +++ trunk/src/modules/vterm/vterm.h > @@ -51,9 +51,12 @@ void init_lostio_interface(); > /// Output-Treiber vorbereiten > void init_output(); > > +/// Eingabe initialisieren > +bool init_input(); > + > // Farbe im Videospeicher > typedef union { > - byte raw; > + uint8_t raw; > struct { > unsigned char foreground : 3; > unsigned char bold : 1; > @@ -122,6 +125,9 @@ typedef struct vterm_output { > bool vt100_color_reversed; > } vterm_output_t; > > +typedef struct vterm_input { > +} vterm_input_t; > + Wofür genau ist dieser Typ gut? > > /// Typ fuer ein Terminal > typedef struct { > @@ -133,7 +139,10 @@ typedef struct { > > /// Struktur fuer den ganzen Ausgabekram > vterm_output_t output; > - > + > + /// Struktur fuer den ganzen Eingabekram > + vterm_input_t input; > + > /// LostIO-Node fuer out-Datei > vfstree_node_t* out_node; > > @@ -216,3 +225,6 @@ void vt100_process_output(vterminal_t* v > /// UTF8-String in Codepage437-String verwandeln > int utf8_to_cp437(vterminal_t* vterm, const char* str, size_t len, char* > buf); > > + > +/// Eingabe fuer ein virtuelles Terminal initialisieren > +bool vterm_input_init(vterminal_t* vterm); From toni at famkaufmann.info Sat Aug 2 01:37:18 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 2 Aug 2008 01:37:18 +0200 Subject: [Lost] [Patch] kbc - Rewrite In-Reply-To: <200808012315.53043@kevin-wolf.de> References: <200808011947.58216.toni@famkaufmann.info> <200808012315.53043@kevin-wolf.de> Message-ID: <200808020137.19315.toni@famkaufmann.info> Am Freitag, 1. August 2008 23.15:52 schrieb Kevin Wolf: > Am Freitag, 1. August 2008 19:47:58 schrieb Antoine Kaufmann: > > - kbc: Bisheriges LostIO-Interface entfernt, kbc liefert jetzt keine > > ASCII-Codes mehr > > * kbc: Callback-Funktion die Keycodes verschickt > > * vterm: Die Tastendruecke werden jetzt von kbc per Callback-Funktion > > geliefert, dadurch muss nicht mehr gepollt werden > > Ich nehme an, über das grundlegende Konzept brauche ich nicht viele Worte > verlieren. Der Ansatz ist natürlich genau das, was man nicht haben möchte. > Alles strebt darauf hin, Dateien für alles zu benutzen, und kbc bewegt sich > zurück auf eigene RPCs. Die richtige Lösung wäre blockierendes LostIO, und > ich erwarte, daß du diesen Code dann zu gegebener Zeit entsprechend > umschreibst. Jo klar, das ist dann aber auch kein Problem dieses Stück dann anzupassen. Ich wollte aber nicht noch grosse LostIO-Änderungen in der 0.2 machen und dort auch noch Bugs einbauen, und noch die halben Module wieder abändern, damit das passt. > > Okay, auf zu den Details... > > > Index: trunk/src/modules/include/keycodes.h > > =================================================================== > > --- /dev/null > > +++ trunk/src/modules/include/keycodes.h > > @@ -0,0 +1,79 @@ > > +/* > > + * Copyright (c) 2008 The LOST Project. All rights reserved. > > + * > > + * This code is derived from software contributed to the LOST Project > > + * by Antoine Kaufmann. > > + * > > + * 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 LOST Project > > + * and its contributors. > > + * 4. Neither the name of the LOST 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. + */ > > + > > +#ifndef _KEYCODES_H_ > > +#define _KEYCODES_H_ > > + > > +/** > > + * Das sind einige der Keycodes die KBC ueber die Callback-Funktion > > verschickt. + * Es handelt sich dabei aber nur um diese Keycodes, die auf > > allen Layouts am + * selben Ort sind. > > + */ > > + > > +#define KEYCODE_SHIFT_LEFT 42 > > +#define KEYCODE_SHIFT_RIGHT 54 > > +#define KEYCODE_CONTROL_LEFT 29 > > +#define KEYCODE_CONTROL_RIGHT 97 > > +#define KEYCODE_ALT 56 > > +#define KEYCODE_ALTGR 100 > > + > > +#define KEYCODE_INSERT 110 > > +#define KEYCODE_DELETE 111 > > +#define KEYCODE_PAGE_UP 104 > > +#define KEYCODE_PAGE_DOWN 109 > > +#define KEYCODE_HOME 102 > > +#define KEYCODE_END 107 > > + > > +#define KEYCODE_F1 59 > > +#define KEYCODE_F2 60 > > +#define KEYCODE_F3 61 > > +#define KEYCODE_F4 62 > > +#define KEYCODE_F5 63 > > +#define KEYCODE_F6 64 > > +#define KEYCODE_F7 64 > > +#define KEYCODE_F8 66 > > +#define KEYCODE_F9 67 > > +#define KEYCODE_F10 68 > > +#define KEYCODE_F11 87 > > +#define KEYCODE_F12 88 > > Werden die Codes für die F-Tasten irgendwo verwendet? Noch nicht, aber mit einem der naechsten Patches werden sie dann fürs Umschalten der virtuellen Terminals benutzt, und nicht mehr escape. ;-) > Um noch weiter zu gehen: Da bei der Benutzung der Pfeiltasten usw. ein > Fixme steht, daß das nur temporär ist, sollten hier letztendlich nicht nur > die Modifiertasten stehenbleiben? (Zu denen gehört dann aber zweifellos > auch die Tux-Taste ;-)) Die werden dann halt einfach im vt100-Teil verarbeitet, von daher duerfen die schon hier bleiben. > > + > > +#define KEYCODE_ARROW_UP 103 > > +#define KEYCODE_ARROW_DOWN 108 > > +#define KEYCODE_ARROW_LEFT 105 > > +#define KEYCODE_ARROW_RIGHT 106 > > + > > + > > +#endif // ifndef _KEYCODES_H_ > > + > > Index: trunk/src/modules/kbc/keyboard.c > > =================================================================== > > --- trunk.orig/src/modules/kbc/keyboard.c > > +++ trunk/src/modules/kbc/keyboard.c .... .... > > +/** > > + * RPC-Handler zum registrieren eines Callbacks fuer Tastendruecke > > + */ > > +static void rpc_register_callback(pid_t pid, dword cid, size_t > > data_size, + void* data) > > { > > - size_t size = blocksize * blockcount; > > + pid_t* ppid = malloc(sizeof(*ppid)); > > + *ppid = pid; > > Ganz ehrlich, man muß nicht immer überkorrekt sein. Eine PID läßt sich > wunderbar in einen void* casten. Keine Notwendigkeit für malloc. Hm stimmt, wenn da einer auf die Idee kommt 64-Bit PIDs zu benutzen muesste das wohl eine Warnung geben... > > - p(); > > - if(size > kbd_buffer_pos) > > - { > > - size = kbd_buffer_pos; > > - } > > - > > - memcpy(kbd_work_buffer, kbd_ascii_buffer, size); > > - memmove(kbd_ascii_buffer, (void*) ((dword)kbd_ascii_buffer + size), > > kbd_buffer_pos - size); - > > - memcpy(buf, kbd_work_buffer, size); > > + list_push(callback_list, ppid); > > + rpc_send_dword_response(pid, cid, 1); > > +} > > > > - kbd_buffer_pos -= size; > > - v(); > > +/** > > + * Tastendruck an wartende Prozesse senden > > + * > > + * Der RPC verschickt dabei 2 Bytes, das erste mit dem keycode, das > > zweite ist + * entweder 0 oder != 0 je nachdem, ob die Taste gedrueckt > > oder losgelassen + * wurde. > > + * > > + * @param keycode Der zu sendende Keycode > > + * @param release TRUE wenn die Taste losgelassen wurde > > + */ > > +static void send_key_event(uint8_t keycode, bool release) > > +{ > > + pid_t* pid; > > + int i; > > + char data[8 + 2]; > > + > > + strcpy(data, "KBDEVENT"); > > + data[8] = keycode; > > + data[9] = release; > > > > - return size; > > + for (i = 0; (pid = list_get_element_at(callback_list, i)); i++) { > > + send_message(*pid, 512, 0, 8 + 2, data); > > + } > > } > > > > Index: trunk/src/modules/vterm/input.c > > =================================================================== > > --- /dev/null > > +++ trunk/src/modules/vterm/input.c > > +/** > > + * Eingabe fuer ein virtuelles Terminal initialisieren > > + * > > + * @param vterm Pointer auf die Verwaltungsstruktur fuers vterm > > + */ > > +bool vterm_input_init(vterminal_t* vterm) > > +{ > > + //vterm_input_t* in = &(vterm->input); > > + > > + return TRUE; > > +} > > Ich bin gänzlich überwältigt von der Nützlichkeit dieser Funktion. Hm stimmt das mit eigener Keymap fuer ein vterm habe ich mir ja anders überlegt. ;-) > > Index: trunk/src/modules/vterm/keymap.c > > =================================================================== > > --- /dev/null > > +++ trunk/src/modules/vterm/keymap.c > Ich will Umlaute, wenn es schon einen neuen Tastaturtreiber gibt! ;-) Ich wollte doch nur nicht noch ein wc_to_mb mit in den Patch packen. ;-) -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : kbc-rewrite-2.patch Dateityp : text/x-diff Dateigröße : 46179 bytes Beschreibung: nicht verfügbar URL : From mail at kevin-wolf.de Sat Aug 2 14:17:29 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 2 Aug 2008 14:17:29 +0200 Subject: [Lost] [Patch] kbc - Rewrite In-Reply-To: <200808020137.19315.toni@famkaufmann.info> References: <200808011947.58216.toni@famkaufmann.info> <200808012315.53043@kevin-wolf.de> <200808020137.19315.toni@famkaufmann.info> Message-ID: <200808021417.29395@kevin-wolf.de> Ok, schieb rein. From toni at famkaufmann.info Sat Aug 2 14:43:27 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 2 Aug 2008 14:43:27 +0200 Subject: [Lost] [Patch 1/3] kernel2: RPC In-Reply-To: <200807311824.09985@kevin-wolf.de> References: <200807311824.09985@kevin-wolf.de> Message-ID: <200808021443.27525.toni@famkaufmann.info> Am Donnerstag, 31. Juli 2008 18.24:09 schrieb Kevin Wolf: > + kernel2: mmc_automap_user() mappt virtuell zusammenhängenden Speicher aus > einem anderen Kontext (z.B. den Stack eines Tasks, der per RPC aufgerufen > werden soll) > + kernel2: syscall_fastrpc > + kernel2: syscall_fastrpc_ret > > Dieser Patch ist irgendwas zwischen ziemlich und extrem kaputt. Ich würde > es trotzdem vorziehen, ihn erstmal so einzuchecken und die Details später > zu fixen. > Index: trunk/src/kernel2/src/syscalls/rpc.c > =================================================================== > --- trunk.orig/src/kernel2/src/syscalls/rpc.c > +++ trunk/src/kernel2/src/syscalls/rpc.c > .... > + // Der aufgerufene Task darf wieder laufen > + if (callee->status == PM_STATUS_WAIT_FOR_RPC) { > + callee->status = PM_STATUS_READY; > + } > + Muss da das if wirklich hin? Wenn ja, deckt es auch alle Fälle? Irgendwie bin ich da grad etwas unsicher. > +/** > + * Wird nach der Ausführung eines RPC-Handlers aufgerufen. > + * > + * Nach der Rückkehr vom RPC-Handler wird der neueste Zustand vom > RPC-Stack + * gepopt und zur Wiederherstellung des ursprünglichen > Prozessorzustands + * benutzt. > + * > + * Dies betrifft eip, esp, eax und eflags. Die übrigen Register sind vom > + * RPC-Handler zu sicher und vor dem Aufruf von SYSCALL_FASTRPC_RET s/sicher/sichern/ ;-) > + * wiederherzustellen. eax ist davon ausgenommen, da es die > Funktionsnummer + * des Syscalls enthalten muß. > + * > + * @param esp Interrupt-Stackframe des vom RPC-Handler zurückkehrenden > Tasks + */ > +void syscall_fastrpc_ret(void) > +{ > + rpc_t* rpc = list_pop(cpu_get_current()->thread->process->rpcs); > + interrupt_stack_frame_t* callee_isf = > + cpu_get_current()->thread->kernel_stack; > + > + // Wenn der Task vom RPC-Handler zurückkehrt, obwohl der Handler > + // gar nicht aufgerufen wurde, läuft was schief > + if (rpc == NULL) { > +#if 0 > + if(debug_test_flag(DEBUG_FLAG_STACK_BACKTRACE)) { > + stack_backtrace_ebp(callee_isf->ebp, callee_isf->eip); > + } > +#endif > + kprintf("Unerwartete Rueckkehr vom RPC-Handler\n"); Und dann kommt absichtlich ein PF? ;-) > Index: trunk/src/kernel2/src/arch/i386/mm/virt.c > =================================================================== > --- trunk.orig/src/kernel2/src/arch/i386/mm/virt.c > +++ trunk/src/kernel2/src/arch/i386/mm/virt.c > @@ -147,32 +147,35 @@ void vmm_kernel_unmap(vaddr_t start, siz > } > } > > -#if 0 > /** > * Vergr?ssert den Userspace-Stack eines Tasks um pages Seiten s/Tasks/Threads/ oder? ;-) > * > * @param task_ptr Pointer zur Task-Struktur > * @param pages Anzahl der zu mappenden Seiten > */ > -void increase_user_stack_size(struct task * task_ptr, int pages) > +void increase_user_stack_size(pm_thread_t* task_ptr, int pages) Wäre es soviel arbeit task_ptr anders zu benennen? ;-) ... > - map_page((mmc_context_t) task_ptr->cr3, > task_ptr->user_stack_bottom, phys_alloc_page(), PTE_P | PTE_W | PTE_U); + > mmc_map(&task_ptr->process->context, > + task_ptr->kernel_stack_bottom, > + pmm_alloc(1), PTE_P | PTE_W | PTE_U, 1); > } > } > -#endif Gibts hier nicht ein Makro USERSPACE_DATA oder so? > Index: trunk/src/kernel2/src/arch/i386/mm/mm_context.c > =================================================================== > --- trunk.orig/src/kernel2/src/arch/i386/mm/mm_context.c > +++ trunk/src/kernel2/src/arch/i386/mm/mm_context.c > @@ -509,7 +509,7 @@ static vaddr_t find_contiguous_pages > * Mappt einen Speicherbereich in einen MM-Kontext an eine freie Adresse > in * einem vorgegebenen Adressberech. > * > - * @param page_directory Kontext, in den gemappt werden soll > + * @param context Kontext, in den gemappt werden soll > * @param start Physische Startadresse des zu mappenden Speicherbereichs > * @param count Anzahl der zu mappenden Seiten > * @param lower_limit Niedrigste zul?ssige virtuelle Adresse > @@ -532,3 +532,44 @@ vaddr_t mmc_automap(mmc_context_t* conte > return NULL; > } > } > + > +/** > + * Mappt einen Speicherbereich eines anderen Tasks in einen MM-Kontext an > eine + * freie Adresse in einem vorgegebenen Adressberech. > + * > + * @param target_ctx Kontext, in den gemappt werden soll > + * @param source_ctx Kontext, aus dem Speicher gemappt werden soll > + * @param start Virtuelle Startadresse des zu mappenden Speicherbereichs > + * bezueglich source_ctx > + * @param count Anzahl der zu mappenden Seiten > + * @param lower_limit Niedrigste zulaessige virtuelle Adresse > + * @param upper_limit Hoechste zulaessige virtuelle Adresse > + * @param flags Flags fuer die Pagetable > + */ > +vaddr_t mmc_automap_user(mmc_context_t* target_ctx, mmc_context_t* > source_ctx, + vaddr_t start, size_t count, uintptr_t lower_limit, > uintptr_t upper_limit, + int flags) > +{ > + size_t i; > + paddr_t paddr; > + vaddr_t vaddr; > + vaddr_t free_page = > + find_contiguous_pages(target_ctx, count, lower_limit, > upper_limit); + > + if (free_page == NULL) { > + return NULL; > + } > + > + // FIXME Hier wird unter Umstaenden ziemlich oft dieselbe Pagetable > gemappt + // und wieder ungemappt (in mmc_resolve) > + for (i = 0; i < count; i++) { > + paddr = mmc_resolve(source_ctx, start + (i * PAGE_SIZE)); > + vaddr = free_page + (i * PAGE_SIZE); > + if (!mmc_map(target_ctx, vaddr, paddr, flags, count)) { > + mmc_unmap(target_ctx, free_page, i); Und phyisch freigeben? > + return NULL; > + } > + } > + > + return free_page; > +} Wenn du das angepasst hast, kannst du direkt einchecken. From toni at famkaufmann.info Sat Aug 2 14:48:53 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 2 Aug 2008 14:48:53 +0200 Subject: [Lost] [Patch 2/3] kernel2: wait_for_rpc In-Reply-To: <200807311826.50215@kevin-wolf.de> References: <200807311824.09985@kevin-wolf.de> <200807311826.50215@kevin-wolf.de> Message-ID: <200808021448.53715.toni@famkaufmann.info> Am Donnerstag, 31. Juli 2008 18.26:50 schrieb Kevin Wolf: > + kernel2: syscall_wait_for_rpc Abgsesehen vom aufruf eines Syscallhandlers sieht das gut aus. ;-) Aber check das halt so ein, solange da keine Kernel-Funktion existiert. From toni at famkaufmann.info Sat Aug 2 14:50:43 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 2 Aug 2008 14:50:43 +0200 Subject: [Lost] [Patch 3/3] kernel2: v_and_wait_for_rpc In-Reply-To: <200807311827.27929@kevin-wolf.de> References: <200807311824.09985@kevin-wolf.de> <200807311827.27929@kevin-wolf.de> Message-ID: <200808021450.43882.toni@famkaufmann.info> Am Donnerstag, 31. Juli 2008 18.27:27 schrieb Kevin Wolf: > + kernel2: v_and_wait_for_rpc Ack. From mail at kevin-wolf.de Sat Aug 2 15:28:14 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 2 Aug 2008 15:28:14 +0200 Subject: [Lost] [Patch 1/3] kernel2: RPC In-Reply-To: <200808021443.27525.toni@famkaufmann.info> References: <200807311824.09985@kevin-wolf.de> <200808021443.27525.toni@famkaufmann.info> Message-ID: <200808021528.15079@kevin-wolf.de> > > Index: trunk/src/kernel2/src/syscalls/rpc.c > > =================================================================== > > --- trunk.orig/src/kernel2/src/syscalls/rpc.c > > +++ trunk/src/kernel2/src/syscalls/rpc.c > > .... > > + // Der aufgerufene Task darf wieder laufen > > + if (callee->status == PM_STATUS_WAIT_FOR_RPC) { > > + callee->status = PM_STATUS_READY; > > + } > > + > > Muss da das if wirklich hin? Wenn ja, deckt es auch alle Fälle? Irgendwie > bin ich da grad etwas unsicher. Hm, keine Ahnung. Aber von BLOCKED auf READY setzen, nur weil ein RPC kommt? Halte ich mal grundsätzlich für mutig. > > +void syscall_fastrpc_ret(void) > > +{ > > + rpc_t* rpc = list_pop(cpu_get_current()->thread->process->rpcs); > > + interrupt_stack_frame_t* callee_isf = > > + cpu_get_current()->thread->kernel_stack; > > + > > + // Wenn der Task vom RPC-Handler zurückkehrt, obwohl der Handler > > + // gar nicht aufgerufen wurde, läuft was schief > > + if (rpc == NULL) { > > +#if 0 > > + if(debug_test_flag(DEBUG_FLAG_STACK_BACKTRACE)) { > > + stack_backtrace_ebp(callee_isf->ebp, callee_isf->eip); > > + } > > +#endif > > + kprintf("Unerwartete Rueckkehr vom RPC-Handler\n"); > > Und dann kommt absichtlich ein PF? ;-) Na gut, ich laß mal ein return springen... Oder lieber panic, solange es kein abort_task gibt? > > +/** > > + * Mappt einen Speicherbereich eines anderen Tasks in einen MM-Kontext > > an eine + * freie Adresse in einem vorgegebenen Adressberech. > > + * > > + * @param target_ctx Kontext, in den gemappt werden soll > > + * @param source_ctx Kontext, aus dem Speicher gemappt werden soll > > + * @param start Virtuelle Startadresse des zu mappenden Speicherbereichs > > + * bezueglich source_ctx > > + * @param count Anzahl der zu mappenden Seiten > > + * @param lower_limit Niedrigste zulaessige virtuelle Adresse > > + * @param upper_limit Hoechste zulaessige virtuelle Adresse > > + * @param flags Flags fuer die Pagetable > > + */ > > +vaddr_t mmc_automap_user(mmc_context_t* target_ctx, mmc_context_t* > > source_ctx, + vaddr_t start, size_t count, uintptr_t lower_limit, > > uintptr_t upper_limit, + int flags) > > +{ > > + size_t i; > > + paddr_t paddr; > > + vaddr_t vaddr; > > + vaddr_t free_page = > > + find_contiguous_pages(target_ctx, count, lower_limit, > > upper_limit); + > > + if (free_page == NULL) { > > + return NULL; > > + } > > + > > + // FIXME Hier wird unter Umstaenden ziemlich oft dieselbe Pagetable > > gemappt + // und wieder ungemappt (in mmc_resolve) > > + for (i = 0; i < count; i++) { > > + paddr = mmc_resolve(source_ctx, start + (i * PAGE_SIZE)); > > + vaddr = free_page + (i * PAGE_SIZE); > > + if (!mmc_map(target_ctx, vaddr, paddr, flags, count)) { > > + mmc_unmap(target_ctx, free_page, i); > > Und phyisch freigeben? Da würde sich der Prozeß, dem der source_ctx gehört, aber freuen, wenn mit seinen Pages plötzlich SMU gemacht wird. ;-) From toni at famkaufmann.info Sat Aug 2 21:29:16 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 2 Aug 2008 21:29:16 +0200 Subject: [Lost] [Patch] vterm: vt100-Emulation Message-ID: <200808022129.16414.toni@famkaufmann.info> + vterm: In vt100-Emulation verhindern, dass der Cursor ueber den Bildschirmrand hinausgesetzt wird + vterm: reversed video mode aktivieren mit [7; + vterm: Tabulatoren richtig anzeigen -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : vterm-vt100.patch Dateityp : text/x-diff Dateigröße : 9178 bytes Beschreibung: nicht verfügbar URL : From mail at kevin-wolf.de Sat Aug 2 21:47:57 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 2 Aug 2008 21:47:57 +0200 Subject: [Lost] [Patch] vterm: vt100-Emulation In-Reply-To: <200808022129.16414.toni@famkaufmann.info> References: <200808022129.16414.toni@famkaufmann.info> Message-ID: <200808022147.57534@kevin-wolf.de> Am Samstag, 2. August 2008 21:29:16 schrieb Antoine Kaufmann: > + vterm: In vt100-Emulation verhindern, dass der Cursor ueber den > Bildschirmrand hinausgesetzt wird > + vterm: reversed video mode aktivieren mit [7; > + vterm: Tabulatoren richtig anzeigen > +static void vt100_safe_curpos(vterminal_t* vterm, int x, int y) > +{ > + vterm_output_t* out = &(vterm->output); > + int x_max = out->screen_width - 1; > + int y_max = out->screen_height - 1; > + position_t screen_pos; > + position_t buffer_pos; > + > + // Raender Oben und Links pruefen > + if (x < 0) { > + x = 0; > + } > + if (y < 0) { > + y = 0; > + } > + > + // Unten und Rechts > + if (x > x_max) { > + x = x_max; > + } > + if (y > y_max) { > + y = y_max; > + } > + > + buffer_position(out, screen_pos, &buffer_pos); > + > + // In positionstruktur einfuellen > + screen_pos.line = y; > + screen_pos.column = x; > + > + buffer_position(out, screen_pos, &buffer_pos); > + output_set_position(out, buffer_pos.line, buffer_pos.column); > +} Das erste buffer_position erscheint mir überflüssig > @@ -552,10 +589,17 @@ static void vt100_clear_screen(vterminal > int n1, int n2) > { > vterm_output_t* out = &(vterm->output); > + position_t screen_pos; > + > + screen_position(out, out->buffer_pos, &screen_pos); > > // Anzahl der uebrigen Zeichen > - size_t count = (out->screen_height - out->buffer_pos.line) * out-> > - screen_width - out->buffer_pos.column; > + size_t count = (out->screen_height - screen_pos.line) * out-> > + screen_width - screen_pos.column; > + > + FILE* oldsin = stdout; stdout = NULL; > + printf("\nClear count: %d\n", count); > + stdout = oldsin; Debugcode? Ansonsten rein damit. Ich habe zwar keine Ahnung von vterm, aber du wirst es ja schon ausprobiert haben... From toni at famkaufmann.info Sun Aug 3 01:09:11 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sun, 3 Aug 2008 01:09:11 +0200 Subject: [Lost] [Patch] vterm Kontrolltasten angepasst Message-ID: <200808030109.12150.toni@famkaufmann.info> * vterm: Tastenkombinationen zum wechseln der Terminals auf Alt + Fn, scrollen mit Shift + "Pfeil hoch" und "Pfeil runter" respektiv shift + "Page up" und "Page Down" -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : vterm-keymap.patch Dateityp : text/x-diff Dateigröße : 12101 bytes Beschreibung: nicht verfügbar URL : From toni at famkaufmann.info Sun Aug 3 09:05:15 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sun, 3 Aug 2008 09:05:15 +0200 Subject: [Lost] [Patch] init_signals static Message-ID: <200808030905.15288.toni@famkaufmann.info> * libc: Die interne Funktion init_signals in src/modules/lib/posix/signal.c wird als static deklariert Ist bei mir nötig damit sich less linken lässt. Der hat selbst auch eine init_signals. -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : init_signals.patch Dateityp : text/x-diff Dateigröße : 384 bytes Beschreibung: nicht verfügbar URL : From toni at famkaufmann.info Sun Aug 3 10:46:36 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sun, 3 Aug 2008 10:46:36 +0200 Subject: [Lost] [Patch] stat-Makros korrigiert Message-ID: <200808031046.36597.toni@famkaufmann.info> ! libc: stat-Makros zum feststellen des Types waren totaler Unsinn. Das sorgte dafuer, dass nano keine Dateien öffnen wollte, weil er sie als Spezialdateteien erkannte. -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : stat-macros.patch Dateityp : text/x-diff Dateigröße : 1234 bytes Beschreibung: nicht verfügbar URL : From mail at kevin-wolf.de Sun Aug 3 13:50:07 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sun, 3 Aug 2008 13:50:07 +0200 Subject: [Lost] [Patch] vterm Kontrolltasten angepasst In-Reply-To: <200808030109.12150.toni@famkaufmann.info> References: <200808030109.12150.toni@famkaufmann.info> Message-ID: <200808031350.08183@kevin-wolf.de> Am Sonntag, 3. August 2008 01:09:11 schrieb Antoine Kaufmann: > * vterm: Tastenkombinationen zum wechseln der Terminals auf Alt + Fn, > scrollen mit Shift + "Pfeil hoch" und "Pfeil runter" respektiv shift + > "Page up" und "Page Down" Nimm die input_process_char() noch komplett raus anstatt nur ihren Inhalt zu löschen. Ansonsten ack. From mail at kevin-wolf.de Sun Aug 3 13:57:24 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sun, 3 Aug 2008 13:57:24 +0200 Subject: [Lost] [Patch] init_signals static In-Reply-To: <200808030905.15288.toni@famkaufmann.info> References: <200808030905.15288.toni@famkaufmann.info> Message-ID: <200808031357.25072@kevin-wolf.de> Am Sonntag, 3. August 2008 09:05:15 schrieb Antoine Kaufmann: > * libc: Die interne Funktion init_signals in src/modules/lib/posix/signal.c > wird als static deklariert > > Ist bei mir nötig damit sich less linken lässt. Der hat selbst auch eine > init_signals. Keine halben Sachen bitte. ;-) initialized und _signal_default_handler dürften ruhig auch static sein. Ansonsten ok. From mail at kevin-wolf.de Sun Aug 3 14:01:03 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sun, 3 Aug 2008 14:01:03 +0200 Subject: [Lost] [Patch] stat-Makros korrigiert In-Reply-To: <200808031046.36597.toni@famkaufmann.info> References: <200808031046.36597.toni@famkaufmann.info> Message-ID: <200808031401.03715@kevin-wolf.de> Am Sonntag, 3. August 2008 10:46:36 schrieb Antoine Kaufmann: > ! libc: stat-Makros zum feststellen des Types waren totaler Unsinn. > > Das sorgte dafuer, dass nano keine Dateien öffnen wollte, weil er sie als > Spezialdateteien erkannte. Ack. From toni at famkaufmann.info Sun Aug 10 10:49:01 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sun, 10 Aug 2008 10:49:01 +0200 Subject: [Lost] [Patch] config.h nach lost/config.h umbenennen Message-ID: <200808101049.05082.toni@famkaufmann.info> * libc: config.h in lost/config.h verschoben um Probleme beim cross compilieren zu vermeiden -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : rename-config-h.patch Dateityp : text/x-diff Dateigröße : 29504 bytes Beschreibung: nicht verfügbar URL : -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: This is a digitally signed message part. URL : From toni at famkaufmann.info Sun Aug 10 11:07:10 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sun, 10 Aug 2008 11:07:10 +0200 Subject: [Lost] [Patch] vterm - EOF Message-ID: <200808101107.13602.toni@famkaufmann.info> ! vterm: EOF wird jetzt nicht mehr gesetzt + libc: LostIO-Flag LOSTIO_FLAG_NOAUTOEOF Dieser Patch verhindert, dass LostIO in vterm beim öffnen EOF setzt, wenn der node eine Grösse von 0 hat. -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : vterm-eof.patch Dateityp : text/x-diff Dateigröße : 1580 bytes Beschreibung: nicht verfügbar URL : -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: This is a digitally signed message part. URL : From toni at famkaufmann.info Sun Aug 10 10:51:49 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sun, 10 Aug 2008 10:51:49 +0200 Subject: [Lost] [Patch] getopt() Message-ID: <200808101051.52692.toni@famkaufmann.info> + libc: getopt() aus NetBSD übernommen -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : getopt.patch Dateityp : text/x-diff Dateigröße : 27408 bytes Beschreibung: nicht verfügbar URL : -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: This is a digitally signed message part. URL : From toni at famkaufmann.info Mon Aug 11 21:54:38 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Mon, 11 Aug 2008 21:54:38 +0200 Subject: [Lost] Test der Liste Message-ID: <200808112154.41132.toni@famkaufmann.info> Hallo, da wir im Moment einige Probleme mit der Mailingliste haben, ist das hier ein Test um herauszufinden, ob das wieder funktioniert. -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: This is a digitally signed message part. URL : From toni at famkaufmann.info Mon Aug 11 21:50:11 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Mon, 11 Aug 2008 21:50:11 +0200 Subject: [Lost] Test der Liste Message-ID: <200808112150.15588.toni@famkaufmann.info> Hallo, da wir im Moment einige Probleme mit der Mailingliste haben, ist das hier ein Test um herauszufinden, ob das wieder funktioniert. -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: This is a digitally signed message part. URL : From mail at kevin-wolf.de Mon Aug 11 22:06:11 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Mon, 11 Aug 2008 22:06:11 +0200 Subject: [Lost] Test der Liste In-Reply-To: <200808112154.41132.toni@famkaufmann.info> References: <200808112154.41132.toni@famkaufmann.info> Message-ID: <200808112206.11939@kevin-wolf.de> Am Montag, 11. August 2008 21:54:38 schrieb Antoine Kaufmann: > Hallo, da wir im Moment einige Probleme mit der Mailingliste haben, ist das > hier ein Test um herauszufinden, ob das wieder funktioniert. Eine Testantwort auf eine Testnachricht. From mail at kevin-wolf.de Mon Aug 11 22:13:34 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Mon, 11 Aug 2008 22:13:34 +0200 Subject: [Lost] [Patch] vterm - EOF Message-ID: <200808112213.35022@kevin-wolf.de> Am Sonntag, 10. August 2008 11:07:10 schrieb Antoine Kaufmann: > ! vterm: EOF wird jetzt nicht mehr gesetzt > + libc: LostIO-Flag LOSTIO_FLAG_NOAUTOEOF > > Dieser Patch verhindert, dass LostIO in vterm beim öffnen EOF setzt, wenn > der node eine Grösse von 0 hat. Ack From mail at kevin-wolf.de Mon Aug 11 22:19:42 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Mon, 11 Aug 2008 22:19:42 +0200 Subject: [Lost] [Patch] getopt() Message-ID: <200808112219.42943@kevin-wolf.de> Am Sonntag, 10. August 2008 10:51:49 schrieb Antoine Kaufmann: > + libc: getopt() aus NetBSD übernommen > Index: trunk/src/include/cdefs.h > =================================================================== > --- trunk.orig/src/include/cdefs.h > +++ trunk/src/include/cdefs.h > @@ -38,6 +38,8 @@ > #define _SYS_CDEFS_H_ > #define _CDEFS_H_ /* bird: compatability */ > > +#define lint > + > #if defined(__cplusplus) > #define __BEGIN_DECLS extern "C" { > #define __END_DECLS } Wofür ist das gut? > Index: trunk/src/modules/include/getopt.h > =================================================================== > --- /dev/null > +++ trunk/src/modules/include/getopt.h > @@ -0,0 +1,94 @@ > +/* > + * Copyright (c) 2008 The LOST Project. All rights reserved. > + * > + * This code is derived from software contributed to the LOST Project > + * by Antoine Kaufmann. > + * > + * 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 LOST Project > + * and its contributors. > + * 4. Neither the name of the LOST 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. > + */ > + > +#ifndef _GETOPT_H_ > +#define _GETOPT_H_ > + > +// Fuer den has_arg-Member in der option-struct > +#define no_argument 0 > +#define required_argument 1 > +#define optional_argument 2 > + > +struct option { > + const char* name; > + int has_arg; > + int* flag; > + int val; > +}; > + > +extern char* optarg; > +extern int optind; > +extern int opterr; > +extern int optopt; > +extern int optreset; > + > + > +/** > + * > + * @param argc > + * @param argv > + * @param optstring > + * > + * @return > + */ > +int getopt(int argc, char* const argv[], const char* optstring); > + > +/** > + * > + * @param argc > + * @param argv > + * @param optstring > + * @param longopts > + * @param longindex > + * > + * @return > + */ > +int getopt_long(int argc, char* const argv[], const char* optstring, > + const struct option* longopts, int* longindex); > + > +/** > + * > + * @param argc > + * @param argv > + * @param optstring > + * @param longopts > + * @param longindex > + * > + * @return > + */ > +int getopt_long_only(int argc, char* const argv[], const char* optstring, > + const struct option* longopts, int* longindex); > + > +#endif Die Kommentare sehen etwas leer aus... From mail at kevin-wolf.de Mon Aug 11 22:19:50 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Mon, 11 Aug 2008 22:19:50 +0200 Subject: [Lost] [Patch] config.h nach lost/config.h umbenennen Message-ID: <200808112219.50291@kevin-wolf.de> Am Sonntag, 10. August 2008 10:49:01 schrieb Antoine Kaufmann: > * libc: config.h in lost/config.h verschoben um Probleme beim cross > compilieren zu vermeiden Wenn du alle includes erwischt hast: Ack. From toni at famkaufmann.info Sat Aug 16 00:04:43 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 16 Aug 2008 00:04:43 +0200 Subject: [Lost] [Patch] getopt() In-Reply-To: <200808112219.42943@kevin-wolf.de> References: <200808112219.42943@kevin-wolf.de> Message-ID: <200808160004.49367.toni@famkaufmann.info> Hier ein Patch mit Kommentaren und ohne #define lint -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : getopt.patch Dateityp : text/x-diff Dateigröße : 30803 bytes Beschreibung: nicht verfügbar URL : -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: This is a digitally signed message part. URL : From mail at kevin-wolf.de Sat Aug 16 00:51:24 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 16 Aug 2008 00:51:24 +0200 Subject: [Lost] [Patch] getopt() In-Reply-To: <200808160004.49367.toni@famkaufmann.info> References: <200808112219.42943@kevin-wolf.de> <200808160004.49367.toni@famkaufmann.info> Message-ID: <200808160051.24736@kevin-wolf.de> Am Samstag, 16. August 2008 00:04:43 schrieb Antoine Kaufmann: > Hier ein Patch mit Kommentaren und ohne #define lint Rein damit. From toni at famkaufmann.info Sat Aug 16 01:51:59 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 16 Aug 2008 01:51:59 +0200 Subject: [Lost] [Patch] system()-Implementierung Message-ID: <200808160152.04147.toni@famkaufmann.info> + libc: Implementierung von system() -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : system.patch Dateityp : text/x-diff Dateigröße : 2612 bytes Beschreibung: nicht verfügbar URL : -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: This is a digitally signed message part. URL : From mail at kevin-wolf.de Sat Aug 16 02:00:51 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 16 Aug 2008 02:00:51 +0200 Subject: [Lost] [Patch] system()-Implementierung In-Reply-To: <200808160152.04147.toni@famkaufmann.info> References: <200808160152.04147.toni@famkaufmann.info> Message-ID: <200808160200.51567@kevin-wolf.de> Am Samstag, 16. August 2008 01:51:59 schrieb Antoine Kaufmann: > + libc: Implementierung von system() #ifndef CONFIG_LIBC_NO_STUBS außenrum? Ansonsten vorerst in Ordnung. From toni at famkaufmann.info Sat Aug 16 11:01:29 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 16 Aug 2008 11:01:29 +0200 Subject: [Lost] [Patch] kernel - Ausgaben auf Bildschirm bei Bedarf deaktivieren Message-ID: <200808161101.33354.toni@famkaufmann.info> + kernel: Debugswitch n, der die Ausgabe von Text auf den Bildschirm unterbindet. Sowas braucht man, wenn man nano oder ncurses allgemein debuggen will. ;-) Die Ausgaben landen damit nur noch auf der seriellen Schnittstelle. -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : noconsole.patch Dateityp : text/x-diff Dateigröße : 1505 bytes Beschreibung: nicht verfügbar URL : -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: This is a digitally signed message part. URL : From toni at famkaufmann.info Sat Aug 16 12:09:21 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 16 Aug 2008 12:09:21 +0200 Subject: [Lost] =?utf-8?q?=5BPatch=5D_libc_-_Kleinere_Fixes_f=C3=BCrs_Komp?= =?utf-8?q?ilieren_von_gcc?= Message-ID: <200808161209.27329.toni@famkaufmann.info> + libc: stdint-Typen ergaenzt + libc: strncat-Deklaration ergaenzt ! libc: Diverse Prototypen korrigiert -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : gcc-fixes.patch Dateityp : text/x-diff Dateigröße : 4614 bytes Beschreibung: nicht verfügbar URL : -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: This is a digitally signed message part. URL : From toni at famkaufmann.info Sat Aug 16 13:00:23 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 16 Aug 2008 13:00:23 +0200 Subject: [Lost] [Patch] libc - mkstemp Message-ID: <200808161300.27736.toni@famkaufmann.info> ! libc: Fehlende deklaration fuer mktemp + libc: mkstemp() -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : mkstemp.patch Dateityp : text/x-diff Dateigröße : 1537 bytes Beschreibung: nicht verfügbar URL : -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: This is a digitally signed message part. URL : From toni at famkaufmann.info Sat Aug 16 13:03:25 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 16 Aug 2008 13:03:25 +0200 Subject: [Lost] [Patch] libc - strcoll() Message-ID: <200808161303.28318.toni@famkaufmann.info> + libc: strcoll() -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : strcoll.patch Dateityp : text/x-diff Dateigröße : 946 bytes Beschreibung: nicht verfügbar URL : -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: This is a digitally signed message part. URL : From toni at famkaufmann.info Sat Aug 16 13:06:07 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 16 Aug 2008 13:06:07 +0200 Subject: [Lost] =?utf-8?q?=5BPatch=5D_libc_-_Fix_f=C3=BCr_setjmp=2Eh?= Message-ID: <200808161306.10961.toni@famkaufmann.info> ! libc: In setjmp.h dword durch uintptr_t ersetzen, damit die types.h nicht reinkommt (Probleme beim cross compilieren) -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : setjmp-header-fix.patch Dateityp : text/x-diff Dateigröße : 393 bytes Beschreibung: nicht verfügbar URL : -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: This is a digitally signed message part. URL : From toni at famkaufmann.info Sat Aug 16 14:06:39 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 16 Aug 2008 14:06:39 +0200 Subject: [Lost] [Patch] [1/2] vterm - Eingaben mit vt100-Emulation verarbeiten Message-ID: <200808161406.42921.toni@famkaufmann.info> + vterm: Eingaben durch die vt100-Emulation verarbeiten lassen und vt100-Konforme Sequenzen zurückgeben. -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : vterm-vt100-input.patch Dateityp : text/x-diff Dateigröße : 6935 bytes Beschreibung: nicht verfügbar URL : -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: This is a digitally signed message part. URL : From toni at famkaufmann.info Sat Aug 16 14:07:55 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 16 Aug 2008 14:07:55 +0200 Subject: [Lost] [Patch] [2/2] readline an neue Eingabesequenzen anpassen Message-ID: <200808161408.00213.toni@famkaufmann.info> * libc: readline() an die neuen vt100-Eingabesequenzen anpassen -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : readline-keys.patch Dateityp : text/x-diff Dateigröße : 5563 bytes Beschreibung: nicht verfügbar URL : -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: This is a digitally signed message part. URL : From toni at famkaufmann.info Sat Aug 16 14:58:45 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 16 Aug 2008 14:58:45 +0200 Subject: [Lost] =?utf-8?q?=5BPatch=5D_shell_-_Fix_f=C3=BCrs_Ersetzen_der_U?= =?utf-8?q?mgebungsvariablen?= Message-ID: <200808161458.48897.toni@famkaufmann.info> ! shell: Beim Ersetzen der Ubgebungsvariablen wurde das 0-Byte nicht mitverschoben -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : shell-envvars.patch Dateityp : text/x-diff Dateigröße : 552 bytes Beschreibung: nicht verfügbar URL : -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: This is a digitally signed message part. URL : From mail at kevin-wolf.de Sat Aug 16 17:05:58 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 16 Aug 2008 17:05:58 +0200 Subject: [Lost] =?utf-8?q?=5BPatch=5D_shell_-_Fix_f=C3=BCrs_Ersetzen_der_U?= =?utf-8?q?mgebungsvariablen?= In-Reply-To: <200808161458.48897.toni@famkaufmann.info> References: <200808161458.48897.toni@famkaufmann.info> Message-ID: <200808161705.58643@kevin-wolf.de> Am Samstag, 16. August 2008 14:58:45 schrieb Antoine Kaufmann: > ! shell: Beim Ersetzen der Ubgebungsvariablen wurde das 0-Byte nicht > mitverschoben Ack. Und im nächsten Patch könnte man dann den potentiellen Buffer Overflow auch noch rausnehmen. ;-) From mail at kevin-wolf.de Sat Aug 16 17:07:40 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 16 Aug 2008 17:07:40 +0200 Subject: [Lost] [Patch] kernel - Ausgaben auf Bildschirm bei Bedarf deaktivieren In-Reply-To: <200808161101.33354.toni@famkaufmann.info> References: <200808161101.33354.toni@famkaufmann.info> Message-ID: <200808161707.41128@kevin-wolf.de> Am Samstag, 16. August 2008 11:01:29 schrieb Antoine Kaufmann: > + kernel: Debugswitch n, der die Ausgabe von Text auf den Bildschirm > unterbindet. > > Sowas braucht man, wenn man nano oder ncurses allgemein debuggen will. ;-) > Die Ausgaben landen damit nur noch auf der seriellen Schnittstelle. Ich bin nicht von der Nützlichkeit überzeugt, aber kaputtmachen sollte es nichts. From mail at kevin-wolf.de Sat Aug 16 17:09:50 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 16 Aug 2008 17:09:50 +0200 Subject: [Lost] =?utf-8?q?=5BPatch=5D_libc_-_Kleinere_Fixes_f=C3=BCrs_Komp?= =?utf-8?q?ilieren_von_gcc?= In-Reply-To: <200808161209.27329.toni@famkaufmann.info> References: <200808161209.27329.toni@famkaufmann.info> Message-ID: <200808161709.50704@kevin-wolf.de> Am Samstag, 16. August 2008 12:09:21 schrieb Antoine Kaufmann: > + libc: stdint-Typen ergaenzt > + libc: strncat-Deklaration ergaenzt > ! libc: Diverse Prototypen korrigiert Rein damit From mail at kevin-wolf.de Sat Aug 16 17:24:42 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 16 Aug 2008 17:24:42 +0200 Subject: [Lost] [Patch] libc - mkstemp In-Reply-To: <200808161300.27736.toni@famkaufmann.info> References: <200808161300.27736.toni@famkaufmann.info> Message-ID: <200808161724.43230@kevin-wolf.de> Am Samstag, 16. August 2008 13:00:23 schrieb Antoine Kaufmann: > ! libc: Fehlende deklaration fuer mktemp > + libc: mkstemp() > Index: trunk/src/modules/lib/posix/mktemp.c > =================================================================== > --- trunk.orig/src/modules/lib/posix/mktemp.c > +++ trunk/src/modules/lib/posix/mktemp.c > @@ -86,3 +87,31 @@ char* mktemp(char* template) > > return template; > } > + > +/** > + * Temporaere Datei erstellen. Dabei wird so lange gesucht, bis eine > gefunden + * wird, die noch nicht existiert. > + * > + * @param template Vorlage fuer den Dateinamen. Sie wird von der Funktion > + * abgeandert. Am schluss muessen mindestens 6 X stehen. > + * > + * @return Dateideskriptor > + */ > +int mkstemp(char* template) > +{ > + int fd = -1; > + size_t len = strlen(template); > + char buf[len + 1]; > + > + while (fd == -1) { > + strcpy(buf, template); > + if (!mktemp(buf)) { Du solltest template benutzen, nicht buf. Laut Kopfkommentar und Manpage wird template entsprechend verändert. > + return fd; > + } > + > + fd = open(buf, O_EXCL | O_CREAT); > + } > + > + return fd; > +} > + From mail at kevin-wolf.de Sat Aug 16 17:50:51 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 16 Aug 2008 17:50:51 +0200 Subject: [Lost] [Patch] libc - strcoll() In-Reply-To: <200808161303.28318.toni@famkaufmann.info> References: <200808161303.28318.toni@famkaufmann.info> Message-ID: <200808161750.52577@kevin-wolf.de> Am Samstag, 16. August 2008 13:03:25 schrieb Antoine Kaufmann: > + libc: strcoll() Ack From mail at kevin-wolf.de Sat Aug 16 17:53:16 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 16 Aug 2008 17:53:16 +0200 Subject: [Lost] =?utf-8?q?=5BPatch=5D_libc_-_Fix_f=C3=BCr_setjmp=2Eh?= In-Reply-To: <200808161306.10961.toni@famkaufmann.info> References: <200808161306.10961.toni@famkaufmann.info> Message-ID: <200808161753.16323@kevin-wolf.de> Am Samstag, 16. August 2008 13:06:07 schrieb Antoine Kaufmann: > ! libc: In setjmp.h dword durch uintptr_t ersetzen, damit die types.h nicht > reinkommt (Probleme beim cross compilieren) Ack. From mail at kevin-wolf.de Sat Aug 16 18:00:29 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 16 Aug 2008 18:00:29 +0200 Subject: [Lost] [Patch] [1/2] vterm - Eingaben mit vt100-Emulation verarbeiten In-Reply-To: <200808161406.42921.toni@famkaufmann.info> References: <200808161406.42921.toni@famkaufmann.info> Message-ID: <200808161800.29219@kevin-wolf.de> Am Samstag, 16. August 2008 14:06:39 schrieb Antoine Kaufmann: > + vterm: Eingaben durch die vt100-Emulation verarbeiten lassen und > vt100-Konforme Sequenzen zurückgeben. > Index: trunk/src/modules/vterm/input.c > =================================================================== > --- trunk.orig/src/modules/vterm/input.c > +++ trunk/src/modules/vterm/input.c > @@ -98,8 +98,9 @@ static void rpc_kbd_callback(pid_t pid, > if ((pid != kbc_pid) || (data_size != 2)) { > return; > } > - > + p(); > send_key_to_vterm(vterm, kbd_data[0], !kbd_data[1]); > + v(); Hier wäre ein Kommentar nett, was damit geschützt wird. Sieht ansonsten gut aus From mail at kevin-wolf.de Sat Aug 16 18:09:26 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 16 Aug 2008 18:09:26 +0200 Subject: [Lost] [Patch] [2/2] readline an neue Eingabesequenzen anpassen In-Reply-To: <200808161408.00213.toni@famkaufmann.info> References: <200808161408.00213.toni@famkaufmann.info> Message-ID: <200808161809.26166@kevin-wolf.de> Am Samstag, 16. August 2008 14:07:55 schrieb Antoine Kaufmann: > * libc: readline() an die neuen vt100-Eingabesequenzen anpassen > Index: trunk/src/modules/lib/readline.c > =================================================================== > --- trunk.orig/src/modules/lib/readline.c > +++ trunk/src/modules/lib/readline.c > @@ -43,17 +43,6 @@ > > #define BUFFER_SIZE 255 > > - > -#define KEY_LEFT 75 > -#define KEY_RIGHT 77 > -#define KEY_UP 72 > -#define KEY_DOWN 80 > - > -#define KEY_HOME 71 > -#define KEY_END 79 > -#define KEY_INS 82 > -#define KEY_DEL 83 > - > static list_t* history = NULL; > > /** > @@ -280,21 +269,29 @@ char* readline(const char* prompt) > while (!enter) > { > char c = keyboard_read_char(); > - > + > switch (c) { > + > case '\0': > c = keyboard_read_char(); > - switch (c) { > - // Ende der Eingabedatei > - case '\0': > - enter = TRUE; > - > - printf("\r\n"); > - fflush(stdout); > - break; > + enter = TRUE; > + break; Ist das printf und fflush jetzt nicht mehr nötig? > > + // Escapesequenzen fuer Kontrolltasten verarbeiten > + case '\033': > + { > + char buf[4]; > + int i; > + memset(buf, 0, sizeof(buf)); > + > + if ((buf [0] = keyboard_read_char())!= '[') { > + goto seq_nomatch; > + } > + > + buf[1] = keyboard_read_char(); > + switch (buf[1]) { > // Links > - case KEY_LEFT: > + case 'D': > if (pos > 0) { > printf("\033[1D"); > fflush(stdout); > @@ -303,7 +300,7 @@ char* readline(const char* prompt) > break; > > // Rechts > - case KEY_RIGHT: > + case 'C': > if (pos < size) { > printf("\033[1C"); > fflush(stdout); > @@ -312,9 +309,9 @@ char* readline(const char* prompt) > break; > > // Hoch/Runter > - case KEY_UP: > - case KEY_DOWN: > - if (c == KEY_UP) { > + case 'A': > + case 'B': > + if (buf[1] == 'A') { > if (history_pos < (int) list_size(history) - > 1) { history_pos++; > } else { > @@ -330,11 +327,11 @@ char* readline(const char* prompt) > > memset(buffer, 0, BUFFER_SIZE); > if (history_pos > -1) { > - strncpy(buffer, > - list_get_element_at(history, history_pos), > + strncpy(buffer, > + list_get_element_at(history, history_pos), > BUFFER_SIZE - 1); Ich schätze, das ist irgendeine Whitespaceänderung, die mit dem Patch nichts zu tun hat? Macht nur das svn blame kaputt, rauslassen. > } > - > + > char* format; > asprintf(&format, "\033[%dD", pos); > printf("%s\033[K%s", format, buffer); > @@ -344,9 +341,14 @@ char* readline(const char* prompt) > pos = size = strlen(buffer); > > break; > - > - // Entfernen > - case KEY_DEL: > + > + // Delete Gibt es einen Grund, warum du die deutschen Tastenbezeichnungen rauslöschst und durch englische ersetzt? > + case '3': > + // Der Delete-Taste muss noch eine Tilde folgen > + if ((buf[2] = keyboard_read_char()) != '~') { > + goto seq_nomatch; > + } > + > if (pos < size) { > delchar(buffer, pos); > size--; > @@ -354,37 +356,36 @@ char* readline(const char* prompt) > fflush(stdout); > } > break; > - > - // Pos1 > - case KEY_HOME: > - { > - char* format; > - asprintf(&format, "\033[%dD", pos); > - printf("%s", format); > - free(format); > > > + > + // Home > + case 'H': > + printf("\033[%dD", pos); > pos = 0; > fflush(stdout); > break; > - } > - > - // Ende > - case KEY_END: > - { > - char* format; > - asprintf(&format, "\033[%dC", strlen(buffer) - > pos); - printf("%s", format); > - free(format); > > + // End > + case 'F': > + printf("\033[%dC", strlen(buffer) - pos); > pos = strlen(buffer); > delchar(buffer, pos); > printf("\033[K\033[s%s\033[u", &buffer[pos]); > fflush(stdout); > break; > - } > + > + default: > + goto seq_nomatch; > } > + > break; > +seq_nomatch: > + for (i = 0; (c = buf[i]); i++) { > + ungetc(buf[i], stdin); > + } > + break; > + } > > case '\b': > if (pos > 0) { From toni at famkaufmann.info Sat Aug 16 22:18:04 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 16 Aug 2008 22:18:04 +0200 Subject: [Lost] [Patch] [2/2] readline an neue Eingabesequenzen anpassen In-Reply-To: <200808161809.26166@kevin-wolf.de> References: <200808161408.00213.toni@famkaufmann.info> <200808161809.26166@kevin-wolf.de> Message-ID: <200808162218.07988.toni@famkaufmann.info> Hier der korrigierte Patch. -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : readline-keys.patch Dateityp : text/x-diff Dateigröße : 5327 bytes Beschreibung: nicht verfügbar URL : -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: This is a digitally signed message part. URL : From toni at famkaufmann.info Sat Aug 16 23:09:26 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 16 Aug 2008 23:09:26 +0200 Subject: [Lost] =?utf-8?q?=5BPatch=5D_libc_-_Fix_f=C3=BCr_mktemp?= Message-ID: <200808162309.30211.toni@famkaufmann.info> ! libc: Jetzt kann man mit mktemp auch ohne PFs Pfade generieren -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : mktemp-fix.patch Dateityp : text/x-diff Dateigröße : 750 bytes Beschreibung: nicht verfügbar URL : -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: This is a digitally signed message part. URL : From mail at kevin-wolf.de Sat Aug 16 23:24:35 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 16 Aug 2008 23:24:35 +0200 Subject: [Lost] [Patch] [2/2] readline an neue Eingabesequenzen anpassen In-Reply-To: <200808162218.07988.toni@famkaufmann.info> References: <200808161408.00213.toni@famkaufmann.info> <200808161809.26166@kevin-wolf.de> <200808162218.07988.toni@famkaufmann.info> Message-ID: <200808162324.35463@kevin-wolf.de> Am Samstag, 16. August 2008 22:18:04 schrieb Antoine Kaufmann: > Hier der korrigierte Patch. Ack. From toni at famkaufmann.info Sun Aug 17 01:10:52 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sun, 17 Aug 2008 01:10:52 +0200 Subject: [Lost] =?utf-8?q?=5BPatch=5D_libc_-_POSIX-Regexfunktionen_aus_Fre?= =?utf-8?q?eBSD_=C3=BCbernehmen?= Message-ID: <200808170111.29754.toni@famkaufmann.info> + libc: regex-Funktionen aus FreeBSD übernommen -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : regex.patch Dateityp : text/x-diff Dateigröße : 122645 bytes Beschreibung: nicht verfügbar URL : -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: This is a digitally signed message part. URL : From mail at kevin-wolf.de Sun Aug 17 01:42:03 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sun, 17 Aug 2008 01:42:03 +0200 Subject: [Lost] =?utf-8?q?=5BPatch=5D_libc_-_POSIX-Regexfunktionen_aus_Fre?= =?utf-8?q?eBSD_=C3=BCbernehmen?= In-Reply-To: <200808170111.29754.toni@famkaufmann.info> References: <200808170111.29754.toni@famkaufmann.info> Message-ID: <200808170142.03184@kevin-wolf.de> Am Sonntag, 17. August 2008 01:10:52 schrieb Antoine Kaufmann: > + libc: regex-Funktionen aus FreeBSD übernommen Jo. Keine Ahnung. Wird schon passen. ;-) From mail at kevin-wolf.de Sun Aug 24 13:06:17 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sun, 24 Aug 2008 13:06:17 +0200 Subject: [Lost] [Patch] kernel: Kaputten Stackpointer erkennen Message-ID: <200808241306.18442@kevin-wolf.de> ! kernel: Bei einem Page Fault wurde davon ausgegangen, dass der Stack vergroessert werden muss, wenn cr2 in der Naehe von esp liegt. Das beruecksichtigt nicht den Fall, dass esp durch den Userspace kaputtgemacht werden kann. Ein Vergleich mit dem kernelinternen user_stack_bottom kann diesen Fall erkennen. -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : kernel-userstack-increase.patch Dateityp : text/x-diff Dateigröße : 869 bytes Beschreibung: nicht verfügbar URL : From toni at famkaufmann.info Sun Aug 24 13:04:13 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sun, 24 Aug 2008 13:04:13 +0200 Subject: [Lost] [Patch] kernel: Kaputten Stackpointer erkennen In-Reply-To: <200808241306.18442@kevin-wolf.de> References: <200808241306.18442@kevin-wolf.de> Message-ID: <200808241304.16654.toni@famkaufmann.info> Am Sonntag, 24. August 2008 13.06:17 schrieb Kevin Wolf: > ! kernel: Bei einem Page Fault wurde davon ausgegangen, dass der Stack > vergroessert werden muss, wenn cr2 in der Naehe von esp liegt. Das > beruecksichtigt nicht den Fall, dass esp durch den Userspace kaputtgemacht > werden kann. Ein Vergleich mit dem kernelinternen user_stack_bottom kann > diesen Fall erkennen. > > Index: trunk/src/kernel/src/intr.c > =================================================================== > --- trunk.orig/src/kernel/src/intr.c > +++ trunk/src/kernel/src/intr.c > @@ -431,8 +431,11 @@ void handle_exception(dword* esp) > > case 14: > cr2 = read_cr2(); > - // Ueberprüfen ob der Pagefault durch einen Stackoverflow > hervorgerufen wurde - if((cr2 <= isf->esp + 0x800) && (cr2 >= > isf->esp - 0x20) && (current_task != NULL)) + // Ueberprüfen ob > der Pagefault durch einen Stackoverflow + // hervorgerufen wurde > + if ((cr2 <= isf->esp + 0x800) && (cr2 >= isf->esp - 0x20) > + && (cr2 >= (uintptr_t)current_task->user_stack_bottom - > 0x1000) + && (current_task != NULL)) Kommt dieser vergliech hier nicht etwas zu spät? > { > increase_user_stack_size(current_task, 1); > return; Sonst siehts gut aus. -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: This is a digitally signed message part. URL : From dunklermeuchler at gmail.com Sun Aug 24 13:19:27 2008 From: dunklermeuchler at gmail.com (stultus / dunklermeuchler) Date: Sun, 24 Aug 2008 13:19:27 +0200 Subject: [Lost] [Patch] ramdisk Message-ID: <23571930808240419g27cf23d8r4cc1e2849b0a51ae@mail.gmail.com> So, hier dann mal der Patch für die ramdisk. Das Teil kann Verzeichnisse anlegen, Dateien anlegen, Schreiben, Lesen, und truncate sollte für verkleinern und vergrößern funktionieren. -------------- nächster Teil -------------- Ein Dateianhang mit HTML-Daten wurde abgetrennt... URL: -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : ramdisk.patch Dateityp : text/x-patch Dateigröße : 26391 bytes Beschreibung: nicht verfügbar URL : From toni at famkaufmann.info Sun Aug 24 19:25:13 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sun, 24 Aug 2008 19:25:13 +0200 Subject: [Lost] [Patch] ramdisk In-Reply-To: <23571930808240419g27cf23d8r4cc1e2849b0a51ae@mail.gmail.com> References: <23571930808240419g27cf23d8r4cc1e2849b0a51ae@mail.gmail.com> Message-ID: <200808241925.17263.toni@famkaufmann.info> Am Sonntag, 24. August 2008 13.19:27 schrieb stultus / dunklermeuchler: > So, hier dann mal der Patch für die ramdisk. Das Teil kann Verzeichnisse > anlegen, Dateien anlegen, Schreiben, Lesen, und truncate sollte für > verkleinern und vergrößern funktionieren. > Index: src/modules/cdi/ramdisk/dir.c > =================================================================== > --- src/modules/cdi/ramdisk/dir.c (revision 0) > +++ src/modules/cdi/ramdisk/dir.c (revision 0) > @@ -0,0 +1,65 @@ > .... > +int ramdisk_fs_dir_create_child(struct cdi_fs_stream* stream, const char* > name, + struct cdi_fs_res* parent) > +{ > + struct ramdisk_fs_res* res = malloc(sizeof(*res)); > + struct ramdisk_fs_res* parent_res = (struct ramdisk_fs_res*) parent; > + > + memset(res, 0, sizeof(*res)); > + > + res->res.loaded = 1; > + > + res->res.name = strdup(name); > + res->res.res = &ramdisk_fs_res; > + res->buffer = 0; NULL, wenns dir nichts ausmacht. ;-) > + res->size = 0; > + > + cdi_list_push(parent_res->res.children, res); > + res->res.parent = parent; > + > + stream->res = (struct cdi_fs_res*) res; > + return 1; > +} > Index: src/modules/cdi/ramdisk/ramdisk_cdi.h > =================================================================== > --- src/modules/cdi/ramdisk/ramdisk_cdi.h (revision 0) > +++ src/modules/cdi/ramdisk/ramdisk_cdi.h (revision 0) > @@ -0,0 +1,99 @@ > ... > +/** > + * Dateisystemressource fuer ramdisk > + */ > +struct ramdisk_fs_res { > + struct cdi_fs_res res; > + void* buffer; > + size_t size; > + int64_t access_time; > + int64_t modification_time; > +}; Hier hätte ich gegen Dokumentation der Member nichts einzuwenden. ;-) > .... > + > +// Pointer auf die ramdisk-Ressourcen Solche Kommentare darfst du gerne auch korrigieren beim Übernehmen. Das sind ja keine Pointer. > +extern struct cdi_fs_res_res ramdisk_fs_res; > +extern struct cdi_fs_res_file ramdisk_fs_file; > +extern struct cdi_fs_res_dir ramdisk_fs_dir; > +extern struct cdi_fs_res_link ramdisk_fs_link; > + > +#endif > + > Index: src/modules/cdi/ramdisk/file.c > =================================================================== > --- src/modules/cdi/ramdisk/file.c (revision 0) > +++ src/modules/cdi/ramdisk/file.c (revision 0) > @@ -0,0 +1,103 @@ > ... > +size_t ramdisk_fs_file_write(struct cdi_fs_stream* stream, uint64_t start, > + size_t size, const void* data) > +{ > + struct ramdisk_fs_res* res = (struct ramdisk_fs_res*) stream->res; > + > + // Es soll mehr geschrieben werden als Platz ist. Buffer vergr??ern!. oe statt ö > + if ((res->size - start) < size) { > + size_t new_size; > + new_size = start + size; > + void* new_buffer = malloc(new_size); > + if (new_size == 0) { Hier willst du vermutlich nicht new_size prüfen, aber siehe unten.... > + stream->error = CDI_FS_ERROR_INTERNAL; > + return 0; > + } > + memcpy(new_buffer,res->buffer,res->size); > + free(res->buffer); > + res->buffer = new_buffer; > + res->size = new_size; > + } > + > + memcpy(res->buffer + start, data, size); if (!(new_buffer = realloc(res->buffer, new_size))) { ... memset(res->buffer + res->size, 0, new_size - res->size); Dürfte effizienter als malloc memcpy und free sein. ;-) > + return size; > +} > + > +int ramdisk_fs_file_truncate(struct cdi_fs_stream* stream, uint64_t size) > +{ > + struct ramdisk_fs_res* res = (struct ramdisk_fs_res*) stream->res; > + > + // Nichts zu tun > + if (size == res->size) { > + return 1; > + } > + > + void* new_buffer; > + new_buffer = malloc(size); > + if (new_buffer == 0) { > + stream->error = CDI_FS_ERROR_INTERNAL; > + return 0; > + } > + > + if (res->size < size) { > + memcpy(new_buffer,res->buffer,res->size); > + memset(new_buffer + res->size,0,size - res->size); > + } > + else { > + memcpy(new_buffer,res->buffer,size); > + } > + free(res->buffer); Auch hier realloc() bitte > + res->buffer = new_buffer; > + res->size = size; > + return 1; > +} > Index: src/modules/cdi/ramdisk/init.c > =================================================================== > --- src/modules/cdi/ramdisk/init.c (revision 0) > +++ src/modules/cdi/ramdisk/init.c (revision 0) > @@ -0,0 +1,67 @@ > +#include "ramdisk_cdi.h" > +#include > + > +int ramdisk_fs_init(struct cdi_fs_filesystem* cdi_fs) > +{ > + struct ramdisk_fs_res* root_res; > + //ramdisk_fs_t* fs = malloc(sizeof(*fs)) Das kannst du ja getrost rauswerfen. > + > + cdi_fs->opaque = NULL; Benutzt du das irgendwo? > + > + //fs->dev_read = null; > + //fs->dev_write = null; > + //fs->dev_private = cdi_fs; Raus damit > + > + root_res = malloc(sizeof(*root_res)); > + memset(root_res, 0, sizeof(*root_res)); > + root_res->res.name = strdup("/"); > + root_res->res.res = &ramdisk_fs_res; > + root_res->res.dir = &ramdisk_fs_dir; > + root_res->res.loaded = 1; > + root_res->buffer = 0; > + root_res->size = 0; > + > + cdi_fs->root_res = (struct cdi_fs_res*) root_res; > + puts("mounted"); Diese Debugausgabe aus ext2 darfst du auch gerne löschen. ;-) > + return 1; > +} > + > +int ramdisk_fs_destroy(struct cdi_fs_filesystem* fs) > +{ > + return 0; > +} > Index: src/modules/cdi/ramdisk/res.c > =================================================================== > --- src/modules/cdi/ramdisk/res.c (revision 0) > +++ src/modules/cdi/ramdisk/res.c (revision 0) > @@ -0,0 +1,160 @@ > ... > +int ramdisk_fs_res_unload(struct cdi_fs_stream* stream) > +{ > + struct ramdisk_fs_res* res = (struct ramdisk_fs_res*) stream->res; > + > + if (!res->res.loaded) { > + return 0; > + } > + > + if (res->res.dir) { > + // dir_clear(stream); > + } Raus damit. > + > + res->res.loaded = 0; > + return 1; > +} > + > ,,. -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: This is a digitally signed message part. URL : From dunklermeuchler at gmail.com Sun Aug 24 20:03:56 2008 From: dunklermeuchler at gmail.com (stultus / dunklermeuchler) Date: Sun, 24 Aug 2008 20:03:56 +0200 Subject: [Lost] [Patch] ramdisk In-Reply-To: <200808241925.17263.toni@famkaufmann.info> References: <23571930808240419g27cf23d8r4cc1e2849b0a51ae@mail.gmail.com> <200808241925.17263.toni@famkaufmann.info> Message-ID: <23571930808241103j92fe4e6nea8012c62c431f99@mail.gmail.com> So, ich denk ich hab alles angemerkte erwischt. Neuer Patch im Anhang -------------- nächster Teil -------------- Ein Dateianhang mit HTML-Daten wurde abgetrennt... URL: -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : ramdisk.patch Dateityp : text/x-patch Dateigröße : 26067 bytes Beschreibung: nicht verfügbar URL : From toni at famkaufmann.info Sun Aug 24 20:40:39 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sun, 24 Aug 2008 20:40:39 +0200 Subject: [Lost] [Patch] ramdisk In-Reply-To: <23571930808241103j92fe4e6nea8012c62c431f99@mail.gmail.com> References: <23571930808240419g27cf23d8r4cc1e2849b0a51ae@mail.gmail.com> <200808241925.17263.toni@famkaufmann.info> <23571930808241103j92fe4e6nea8012c62c431f99@mail.gmail.com> Message-ID: <200808242040.42109.toni@famkaufmann.info> Am Sonntag, 24. August 2008 20.03:56 schrieb stultus / dunklermeuchler: > Index: src/modules/cdi/ramdisk/dir.c > =================================================================== >... > +int ramdisk_fs_dir_create_child(struct cdi_fs_stream* stream, const char* > name, + struct cdi_fs_res* parent) > +{ > + struct ramdisk_fs_res* res = malloc(sizeof(*res)); > + struct ramdisk_fs_res* parent_res = (struct ramdisk_fs_res*) parent; > + > + memset(res, 0, sizeof(*res)); > + > + res->res.loaded = 1; > + > + res->res.name = strdup(name); > + res->res.res = &ramdisk_fs_res; > + res->buffer = NULL; > + res->size = 0; Hm ist ja eigentlich garnicht nötig wenn du oben eh res auf 0 setzt... > + > + cdi_list_push(parent_res->res.children, res); > + res->res.parent = parent; > + > + stream->res = (struct cdi_fs_res*) res; > + return 1; > +} > Index: src/modules/cdi/ramdisk/file.c > =================================================================== > +#include "ramdisk_cdi.h" > + > +size_t ramdisk_fs_file_read(struct cdi_fs_stream* stream, uint64_t start, > + size_t size, void* data) > +{ > + struct ramdisk_fs_res* res = (struct ramdisk_fs_res*) stream->res; > + > + // maximal bis Ende lesen. > + if ((res->size - start) < size) { > + size = res->size - start; > + } > + > + memcpy(data, res->buffer + start, size); > + return size; > +} > + > +size_t ramdisk_fs_file_write(struct cdi_fs_stream* stream, uint64_t start, > + size_t size, const void* data) > +{ > + struct ramdisk_fs_res* res = (struct ramdisk_fs_res*) stream->res; > + > + // Es soll mehr geschrieben werden als Platz ist. Buffer > vergroessern!. + if ((res->size - start) < size) { > + void* new_buffer; > + size_t new_size; > + new_size = start + size; > + if (!(new_buffer = realloc(res->buffer,new_size))) { > + stream->error = CDI_FS_ERROR_INTERNAL; > + return 0; > + } res->buffer = new_buffer; > + memset(res->buffer + res->size, 0, new_size - res->size); > + res->buffer = new_buffer; Dafür hier nicht. > + res->size = new_size; > + } > + > + memcpy(res->buffer + start, data, size); > + return size; > +} > + > +int ramdisk_fs_file_truncate(struct cdi_fs_stream* stream, uint64_t size) > +{ > + struct ramdisk_fs_res* res = (struct ramdisk_fs_res*) stream->res; > + > + // Nichts zu tun > + if (size == res->size) { > + return 1; > + } > + > + void* new_buffer; > + if (!(new_buffer = realloc(res->buffer,size))) { > + stream->error = CDI_FS_ERROR_INTERNAL; > + } > + if (res->size < size) { > + memset(new_buffer + res->size,0,size - res->size); > + } Oder auch so, von mir aus... ;-) > + > + res->buffer = new_buffer; > + res->size = size; > + return 1; > +} > Index: src/modules/cdi/ramdisk/init.c > =================================================================== > .... > +int ramdisk_fs_init(struct cdi_fs_filesystem* cdi_fs) > +{ > + struct ramdisk_fs_res* root_res; > + > + root_res = malloc(sizeof(*root_res)); > + memset(root_res, 0, sizeof(*root_res)); > + root_res->res.name = strdup("/"); > + root_res->res.res = &ramdisk_fs_res; > + root_res->res.dir = &ramdisk_fs_dir; > + root_res->res.loaded = 1; > + root_res->buffer = 0; > + root_res->size = 0; Eigentlich auch unnötig. > + > + cdi_fs->root_res = (struct cdi_fs_res*) root_res; > + return 1; > +} > + > +int ramdisk_fs_destroy(struct cdi_fs_filesystem* fs) > +{ > + return 0; > +} -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: This is a digitally signed message part. URL : From dunklermeuchler at gmail.com Sun Aug 24 20:55:05 2008 From: dunklermeuchler at gmail.com (stultus / dunklermeuchler) Date: Sun, 24 Aug 2008 20:55:05 +0200 Subject: [Lost] [Patch] ramdisk In-Reply-To: <200808242040.42109.toni@famkaufmann.info> References: <23571930808240419g27cf23d8r4cc1e2849b0a51ae@mail.gmail.com> <200808241925.17263.toni@famkaufmann.info> <23571930808241103j92fe4e6nea8012c62c431f99@mail.gmail.com> <200808242040.42109.toni@famkaufmann.info> Message-ID: <23571930808241155h6c454a5as40d6c83d083ad7ac@mail.gmail.com> Und hier kommt Nr. 3 -------------- nächster Teil -------------- Ein Dateianhang mit HTML-Daten wurde abgetrennt... URL: -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : ramdisk.patch Dateityp : text/x-patch Dateigröße : 25970 bytes Beschreibung: nicht verfügbar URL : From toni at famkaufmann.info Tue Aug 26 13:45:30 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Tue, 26 Aug 2008 13:45:30 +0200 Subject: [Lost] =?utf-8?q?=5BPatch=5D_tcpip_-_Broadcasts__und_Pakete_besti?= =?utf-8?q?mmtes_Ger=C3=A4t_senden?= Message-ID: <200808261345.35335.toni@famkaufmann.info> + tcpip: Limited Broadcasts im ARP-Code korrekt auflösen + tcpip: Pakete über ein bestimmtes Gerät versenden, ohne Routing -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : tcpip-ip-broadcasts.patch Dateityp : text/x-diff Dateigröße : 6576 bytes Beschreibung: nicht verfügbar URL : -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: This is a digitally signed message part. URL : From toni at famkaufmann.info Tue Aug 26 13:47:15 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Tue, 26 Aug 2008 13:47:15 +0200 Subject: [Lost] [Patch] tcpip - udp Message-ID: <200808261347.24093.toni@famkaufmann.info> + tcpip: udp-Unterstützung -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : tcpip-udp.patch Dateityp : text/x-diff Dateigröße : 15978 bytes Beschreibung: nicht verfügbar URL : -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: This is a digitally signed message part. URL : From toni at famkaufmann.info Tue Aug 26 20:51:52 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Tue, 26 Aug 2008 20:51:52 +0200 Subject: [Lost] [Patch] tcpip - udp In-Reply-To: <200808261347.24093.toni@famkaufmann.info> References: <200808261347.24093.toni@famkaufmann.info> Message-ID: <200808262051.55730.toni@famkaufmann.info> Am Dienstag, 26. August 2008 13.47:15 schrieb Antoine Kaufmann: > + tcpip: udp-Unterstützung In dieser Version habe ich noch den source_ip-Parameter für udp_send rausgeworfen. Die Quell-IP kann udp_send über die Routingtabelle ausfindig machen. -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : tcpip-udp.patch Dateityp : text/x-diff Dateigröße : 16002 bytes Beschreibung: nicht verfügbar URL : -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: This is a digitally signed message part. URL : From dunklermeuchler at gmail.com Thu Aug 28 23:25:22 2008 From: dunklermeuchler at gmail.com (stultus / dunklermeuchler) Date: Thu, 28 Aug 2008 23:25:22 +0200 Subject: [Lost] [Patch] ramdisk In-Reply-To: <23571930808241155h6c454a5as40d6c83d083ad7ac@mail.gmail.com> References: <23571930808240419g27cf23d8r4cc1e2849b0a51ae@mail.gmail.com> <200808241925.17263.toni@famkaufmann.info> <23571930808241103j92fe4e6nea8012c62c431f99@mail.gmail.com> <200808242040.42109.toni@famkaufmann.info> <23571930808241155h6c454a5as40d6c83d083ad7ac@mail.gmail.com> Message-ID: <23571930808281425y2d6f8975xebdc6761551455e0@mail.gmail.com> + ramdisk_fs_destroy. Das Dateisystem kann jetzt auch restlos abgebaut werden, bzw sollte es zumindenst. -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : ramdisk.patch Dateityp : text/x-patch Dateigröße : 26496 bytes Beschreibung: nicht verfügbar URL : From mail at kevin-wolf.de Sat Aug 30 14:08:01 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 30 Aug 2008 14:08:01 +0200 Subject: [Lost] [Patch] ramdisk In-Reply-To: <23571930808281425y2d6f8975xebdc6761551455e0@mail.gmail.com> References: <23571930808240419g27cf23d8r4cc1e2849b0a51ae@mail.gmail.com> <23571930808241155h6c454a5as40d6c83d083ad7ac@mail.gmail.com> <23571930808281425y2d6f8975xebdc6761551455e0@mail.gmail.com> Message-ID: <200808301408.01858@kevin-wolf.de> Am Donnerstag, 28. August 2008 23:25:22 schrieb stultus / dunklermeuchler: > + ramdisk_fs_destroy. Das Dateisystem kann jetzt auch restlos abgebaut > werden, bzw sollte es zumindenst. > Index: src/modules/cdi/ramdisk/dir.c > =================================================================== > --- src/modules/cdi/ramdisk/dir.c       (revision 0) > +++ src/modules/cdi/ramdisk/dir.c       (revision 0) > @@ -0,0 +1,63 @@ > +/* > + * Copyright (c) 2008 The LOST Project. All rights reserved. > + * > + * This code is derived from software contributed to the LOST Project > + * by Alexander Siol. > + * > + * 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 LOST Project > + *     and its contributors. > + * 4. Neither the name of the LOST 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 > + > +#include "ramdisk_cdi.h" > + > + > +cdi_list_t ramdisk_fs_dir_list(struct cdi_fs_stream* stream) > +{ > +    return stream->res->children; > +} > + > +int ramdisk_fs_dir_create_child(struct cdi_fs_stream* stream, const char* > name, +                             struct cdi_fs_res* parent) > +{ > +    struct ramdisk_fs_res* res = malloc(sizeof(*res)); > +    struct ramdisk_fs_res* parent_res = (struct ramdisk_fs_res*) parent; > + > +    memset(res, 0, sizeof(*res)); > + > +    res->res.loaded = 1; > + > +    res->res.name = strdup(name); > +    res->res.res = &ramdisk_fs_res; > + > +    cdi_list_push(parent_res->res.children, res); > +    res->res.parent = parent; > + > +    stream->res = (struct cdi_fs_res*) res; > +    return 1; > +} > Index: src/modules/cdi/ramdisk/ramdisk_cdi.h > =================================================================== > --- src/modules/cdi/ramdisk/ramdisk_cdi.h       (revision 0) > +++ src/modules/cdi/ramdisk/ramdisk_cdi.h       (revision 0) > @@ -0,0 +1,103 @@ > +/* > + * Copyright (c) 2008 The LOST Project. All rights reserved. > + * > + * This code is derived from software contributed to the LOST Project > + * by Alexander Siol. > + * > + * 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 LOST Project > + *     and its contributors. > + * 4. Neither the name of the LOST 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. > + */ > + > +#ifndef _RAMDISK_CDI_H_ > +#define _RAMDISK_CDI_H_ > + > +#include > +#include > + > +#include "cdi/fs.h" > + > + > +/** > + * Dateisystemressource fuer ramdisk > + */ > +struct ramdisk_fs_res { > +    struct cdi_fs_res res; Nenn das besser cdi. Zeilen wie res->res.res sind nicht gerade intuitiv verständlich. > + > +    // Buffer fuer die Daten, und dessen Groesse > +    void* buffer; > +    size_t size; > + > +    // Zugriffszeiten (Meta-Informationen) > +    int64_t access_time; > +    int64_t modification_time; > +}; > + > + > +// CDI-IF > +int ramdisk_fs_init(struct cdi_fs_filesystem* fs); > +int ramdisk_fs_destroy(struct cdi_fs_filesystem* fs); > + > +// CDI Res > +int     ramdisk_fs_res_load(struct cdi_fs_stream* stream); > +int     ramdisk_fs_res_unload(struct cdi_fs_stream* stream); > +//int     ramdisk_fs_res_remove(struct cdi_fs_stream* stream); > +//int     ramdisk_fs_res_rename(struct cdi_fs_stream* stream, const char* > name); +//int     ramdisk_fs_res_move(struct cdi_fs_stream* stream, struct > cdi_fs_res* dest); +int     ramdisk_fs_res_assign_class(struct > cdi_fs_stream* stream, +            cdi_fs_res_class_t class); > +//int     ramdisk_fs_res_remove_class(struct cdi_fs_stream* stream, > +//            cdi_fs_res_class_t class); Entweder rein oder raus. Auskommentierter Code ist lokal zwar toll, aber nichts für das SVN. > +int64_t ramdisk_fs_res_meta_read(struct cdi_fs_stream* stream, > cdi_fs_meta_t meta); +int     ramdisk_fs_res_meta_write(struct > cdi_fs_stream* stream, cdi_fs_meta_t meta, +    int64_t value); > + > +// CDI File > +size_t  ramdisk_fs_file_read(struct cdi_fs_stream* stream, uint64_t start, > +            size_t size, void* data); > +size_t  ramdisk_fs_file_write(struct cdi_fs_stream* stream, uint64_t > start, +            size_t size, const void* data); > +int     ramdisk_fs_file_truncate(struct cdi_fs_stream* stream, uint64_t > size); + > +// CDI Dir > +cdi_list_t  ramdisk_fs_dir_list(struct cdi_fs_stream* stream); > +int         ramdisk_fs_dir_create_child(struct cdi_fs_stream* stream, > +                const char* name, struct cdi_fs_res* parent); > + > +// CDI Link > +//const char* ramdisk_fs_link_read(struct cdi_fs_stream* stream); > +//int         ramdisk_fs_link_write(struct cdi_fs_stream* stream, const > char* path); + > + > +// ramdisk-Ressourcen(-Typen) > +extern struct cdi_fs_res_res    ramdisk_fs_res; > +extern struct cdi_fs_res_file   ramdisk_fs_file; > +extern struct cdi_fs_res_dir    ramdisk_fs_dir; > +extern struct cdi_fs_res_link   ramdisk_fs_link; > + > +#endif > + > Index: src/modules/cdi/ramdisk/file.c > =================================================================== > --- src/modules/cdi/ramdisk/file.c      (revision 0) > +++ src/modules/cdi/ramdisk/file.c      (revision 0) > @@ -0,0 +1,95 @@ > +/* > + * Copyright (c) 2008 The LOST Project. All rights reserved. > + * > + * This code is derived from software contributed to the LOST Project > + * by Alexander Siol. > + * > + * 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 LOST Project > + *     and its contributors. > + * 4. Neither the name of the LOST 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 "ramdisk_cdi.h" > + > +size_t ramdisk_fs_file_read(struct cdi_fs_stream* stream, uint64_t start, > +    size_t size, void* data) > +{ > +    struct ramdisk_fs_res* res = (struct ramdisk_fs_res*) stream->res; > + > +    // maximal bis Ende lesen. > +    if ((res->size - start) < size) { > +        size = res->size - start; > +    } > + > +    memcpy(data, res->buffer + start, size); > +    return size; > +} > + > +size_t ramdisk_fs_file_write(struct cdi_fs_stream* stream, uint64_t start, > +    size_t size, const void* data) > +{ > +    struct ramdisk_fs_res* res = (struct ramdisk_fs_res*) stream->res; > + > +    // Es soll mehr geschrieben werden als Platz ist. Buffer > vergroessern!. +    if ((res->size - start) < size) { > +        void* new_buffer; > +        size_t new_size; > +        new_size = start + size; > +        if (!(new_buffer = realloc(res->buffer,new_size))) { > +            stream->error = CDI_FS_ERROR_INTERNAL; > +            return 0; > +        } > +        memset(res->buffer + res->size, 0, new_size - res->size); Das ist unnötig, wird ja vom memcpy gleich wieder überschrieben. > +        res->buffer = new_buffer; > +        res->size = new_size; > +    } > + > +    memcpy(res->buffer + start, data, size); > +    return size; > +} > + > +int ramdisk_fs_file_truncate(struct cdi_fs_stream* stream, uint64_t size) > +{ > +    struct ramdisk_fs_res* res = (struct ramdisk_fs_res*) stream->res; > + > +    // Nichts zu tun > +    if (size == res->size) { > +        return 1; > +    } > + > +    void* new_buffer; > +    if (!(new_buffer = realloc(res->buffer,size))) { > +        stream->error = CDI_FS_ERROR_INTERNAL; > +    } return 0? > +    if (res->size < size) { > +        memset(new_buffer + res->size,0,size - res->size); > +    } > + > +    res->buffer = new_buffer; > +    res->size = size; > +    return 1; > +} > Index: src/modules/cdi/ramdisk/init.c > =================================================================== > --- src/modules/cdi/ramdisk/init.c      (revision 0) > +++ src/modules/cdi/ramdisk/init.c      (revision 0) > @@ -0,0 +1,77 @@ > +/* > + * Copyright (c) 2008 The LOST Project. All rights reserved. > + * > + * This code is derived from software contributed to the LOST Project > + * by Alexander Siol. > + * > + * 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 LOST Project > + *     and its contributors. > + * 4. Neither the name of the LOST 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 "ramdisk_cdi.h" > +#include > + > +static int dir_clear(struct cdi_fs_res* real_res) > +{ > +    struct ramdisk_fs_res* res = (struct ramdisk_fs_res*) real_res; > +    struct ramdisk_fs_res* child; > + > +    while ((child = cdi_list_pop(res->res.children))) { > +        if (child->res.dir) { > +            dir_clear((struct cdi_fs_res*)child); > +        } > +        free(child->res.name); > +        free(child->buffer); > +        free(child); > +    } > + > +    cdi_list_destroy(res->res.children); > +    res->res.children = NULL; > +    return 1; > +} > + > +int ramdisk_fs_init(struct cdi_fs_filesystem* cdi_fs) > +{ > +    struct ramdisk_fs_res* root_res; > + > +    root_res = malloc(sizeof(*root_res)); > +    memset(root_res, 0, sizeof(*root_res)); > +    root_res->res.name = strdup("/"); Warum kann man nicht einfach "/" ohne strdup nehmen? Wird der String später verändert? > +    root_res->res.res = &ramdisk_fs_res; > +    root_res->res.dir = &ramdisk_fs_dir; > +    root_res->res.loaded = 1; > + > +    cdi_fs->root_res = (struct cdi_fs_res*) root_res; > +    return 1; > +} > + > +int ramdisk_fs_destroy(struct cdi_fs_filesystem* fs) > +{ > +    dir_clear(fs->root_res); free? > +    return 0; > +} > Index: src/modules/cdi/ramdisk/Makefile.all > =================================================================== > --- src/modules/cdi/ramdisk/Makefile.all        (revision 0) > +++ src/modules/cdi/ramdisk/Makefile.all        (revision 0) > @@ -0,0 +1,6 @@ > +shopt -s extglob > +source $LOST_BUILDMK_ROOT/config.sh > + > +echo "LD   $1/modules/ramdisk" > +$LOST_TOOLS_LD -oramdisk.mod -Ttext=0x40000000 *.o --start-group $2 > --end-group +$LOST_TOOLS_STRIP -s ramdisk.mod -o $1/modules/ramdisk > Index: src/modules/cdi/ramdisk/main.c > =================================================================== > --- src/modules/cdi/ramdisk/main.c      (revision 0) > +++ src/modules/cdi/ramdisk/main.c      (revision 0) > @@ -0,0 +1,98 @@ > +/* > + * Copyright (c) 2008 The LOST Project. All rights reserved. > + * > + * This code is derived from software contributed to the LOST Project > + * by Alexander Siol. > + * > + * 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 LOST Project > + *     and its contributors. > + * 4. Neither the name of the LOST 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 > +#include > +#include > + > +#include "cdi/fs.h" > +#include "cdi/misc.h" > + > +#include "ramdisk_cdi.h" > + > +struct ramdisk_driver { > +    struct cdi_fs_driver fs; > +}; > + > +static struct ramdisk_driver ramdisk_driver; > +static const char* driver_name = "ramdisk"; > + > +static int ramdisk_driver_init(struct ramdisk_driver* driver); > +static void ramdisk_driver_destroy(struct cdi_driver* driver); > + > +#ifdef CDI_STANDALONE > +int main() > +#else > +int init_ramdisk > +#endif > +{ > +    cdi_init(); > + > +    if (ramdisk_driver_init(&ramdisk_driver) != 0) { > +        return -1; > +    } > +    cdi_fs_driver_register((struct cdi_fs_driver*) &ramdisk_driver); > + > +#ifdef CDI_STANDALONE > +    cdi_run_drivers(); > +#endif > + > +    return 0; > +} > + > +/** > + * Initialisiert die Datenstrukturen fuer den ramdisk-Treiber > + */ > +static int ramdisk_driver_init(struct ramdisk_driver* driver) > +{ > +    // Konstruktor der Vaterklasse > +    cdi_fs_driver_init((struct cdi_fs_driver*) driver); > + > +    // Namen setzen > +    driver->fs.drv.name = driver_name; > +    driver->fs.fs_init = ramdisk_fs_init; > +    driver->fs.fs_destroy = ramdisk_fs_destroy; > + > +    driver->fs.drv.destroy = ramdisk_driver_destroy; > +    return 0; > +} > + > +/** > + * Deinitialisiert die Datenstrukturen fuer den ramdisk-Treiber > + */ > +static void ramdisk_driver_destroy(struct cdi_driver* driver) > +{ > +    cdi_fs_driver_destroy((struct cdi_fs_driver*) driver); > +} > Index: src/modules/cdi/ramdisk/res.c > =================================================================== > --- src/modules/cdi/ramdisk/res.c       (revision 0) > +++ src/modules/cdi/ramdisk/res.c       (revision 0) > @@ -0,0 +1,156 @@ > +/* > + * Copyright (c) 2008 The LOST Project. All rights reserved. > + * > + * This code is derived from software contributed to the LOST Project > + * by Alexander Siol. > + * > + * 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 LOST Project > + *     and its contributors. > + * 4. Neither the name of the LOST 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 "ramdisk_cdi.h" > + > +int ramdisk_fs_res_load(struct cdi_fs_stream* stream) > +{ > +    struct ramdisk_fs_res* res = (struct ramdisk_fs_res*) stream->res; > + > +    if (res->res.loaded) { > +        return 0; > +    } > + > +    res->res.loaded = 1; > +    return 1; > +} > + > +int ramdisk_fs_res_unload(struct cdi_fs_stream* stream) > +{ > +    struct ramdisk_fs_res* res = (struct ramdisk_fs_res*) stream->res; > + > +    if (!res->res.loaded) { > +        return 0; > +    } > + > +    res->res.loaded = 0; > +    return 1; > +} > + > +int64_t ramdisk_fs_res_meta_read(struct cdi_fs_stream* stream, > cdi_fs_meta_t meta) +{ > +    struct ramdisk_fs_res* res = (struct ramdisk_fs_res*) stream->res; > + > +    switch (meta) { > +        case CDI_FS_META_SIZE: > +            return res->size; > + > +        case CDI_FS_META_USEDBLOCKS: > +            return 1; > + > +        case CDI_FS_META_BLOCKSZ: > +            return res->size; > + > +        case CDI_FS_META_BESTBLOCKSZ: > +            return res->size; > + > +        case CDI_FS_META_CREATETIME: > +            return res->modification_time; > + > +        case CDI_FS_META_ACCESSTIME: > +            return res->access_time; > + > +        case CDI_FS_META_CHANGETIME: > +            return res->modification_time; > +    } > + > +    return 0; > +} Vielleicht vor dem return 0; noch einen Fehler setzen? > + > +int ramdisk_fs_res_meta_write(struct cdi_fs_stream* stream, cdi_fs_meta_t > meta, +                           int64_t value) > +{ > +    struct ramdisk_fs_res* res = (struct ramdisk_fs_res*) stream->res; > + > +    switch (meta) { > +        case CDI_FS_META_ACCESSTIME: > +            res->access_time = value; > +            return 1; > + > +        case CDI_FS_META_CHANGETIME: > +            res->modification_time = value; > +            return 1; > + > +        // RO: > +        case CDI_FS_META_SIZE: > +        case CDI_FS_META_USEDBLOCKS: > +        case CDI_FS_META_BESTBLOCKSZ: > +        case CDI_FS_META_BLOCKSZ: > +        case CDI_FS_META_CREATETIME: > +            return 0; > +    } > + > +    return 0; > +} Hier jeweils auch. > + > +int ramdisk_fs_res_assign_class(struct cdi_fs_stream* stream, > +                             cdi_fs_res_class_t class) > +{ > +    struct ramdisk_fs_res* res = (struct ramdisk_fs_res*) stream->res; > + > +    // In ramdisk koennen die Ressource nur zu maximal einer Klasse > gleichzeitig +    // gehoeren > +    if (res->res.file || res->res.dir || res->res.link || > res->res.special) +    { > +        stream->error = CDI_FS_ERROR_ONS; > +        return 0; > +    } > + > +    switch (class) { > +        case CDI_FS_CLASS_FILE: > +            res->res.file = &ramdisk_fs_file; > +            break; > + > +        case CDI_FS_CLASS_DIR: > +            res->res.dir = &ramdisk_fs_dir; > +            break; > + > +        case CDI_FS_CLASS_LINK: > +            stream->error = CDI_FS_ERROR_NOT_IMPLEMENTED; > +            goto error_out; > +            break; > + > +        case CDI_FS_CLASS_SPECIAL: > +            stream->error = CDI_FS_ERROR_NOT_IMPLEMENTED; > +            goto error_out; > +            break; > + > +    }; > + > +    return 1; > + > +error_out: > +    return 0; > +} Ja, goto ist schon toll, um im Fehlerfall wieder Sachen freizugeben. Aber direkt ein return 0; tut es hier eigentlich auch... > Index: src/modules/cdi/ramdisk/resources.c > =================================================================== > --- src/modules/cdi/ramdisk/resources.c (revision 0) > +++ src/modules/cdi/ramdisk/resources.c (revision 0) > @@ -0,0 +1,67 @@ > +/* > + * Copyright (c) 2008 The LOST Project. All rights reserved. > + * > + * This code is derived from software contributed to the LOST Project > + * by Alexander Siol. > + * > + * 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 LOST Project > + *     and its contributors. > + * 4. Neither the name of the LOST 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 "ramdisk_cdi.h" > + > +struct cdi_fs_res_res   ramdisk_fs_res = { > +    .load = ramdisk_fs_res_load, > +    .unload = ramdisk_fs_res_unload, > + > +    .meta_read = ramdisk_fs_res_meta_read, > +    .meta_write = ramdisk_fs_res_meta_write, > + > +    .assign_class = ramdisk_fs_res_assign_class > +}; > + > +struct cdi_fs_res_file  ramdisk_fs_file = { > +    // Prinzipiell haben wir nur ausfuehrbare Dateien, der Rest wird mit > den +    // Berechtigungen geregelt > +    .executable = 1, > + > +    .read = ramdisk_fs_file_read, > +    .write = ramdisk_fs_file_write, > +    .truncate = ramdisk_fs_file_truncate > +}; > + > +struct cdi_fs_res_dir   ramdisk_fs_dir = { > +    .list = ramdisk_fs_dir_list, > +    .create_child = ramdisk_fs_dir_create_child > +}; > + > +struct cdi_fs_res_link  ramdisk_fs_link = { > +    .read_link = NULL,//ramdisk_fs_link_read, > +    .write_link = NULL,//ramdisk_fs_link_write Auskommentierter Code > +}; > + Wenn man die structs in die passenden Dateien verschiebt, hätte man eine Datei weniger, könnte im Editor direkt vom struct aus die Funktionen suchen und nebenbei noch einen Haufen Funktionen static machen, oder? From mail at kevin-wolf.de Sat Aug 30 14:13:22 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 30 Aug 2008 14:13:22 +0200 Subject: [Lost] =?utf-8?q?=5BPatch=5D_tcpip_-_Broadcasts__und_Pakete_besti?= =?utf-8?q?mmtes_Ger=C3=A4t_senden?= In-Reply-To: <200808261345.35335.toni@famkaufmann.info> References: <200808261345.35335.toni@famkaufmann.info> Message-ID: <200808301413.22523@kevin-wolf.de> Am Dienstag, 26. August 2008 13:45:30 schrieb Antoine Kaufmann: > + tcpip: Limited Broadcasts im ARP-Code korrekt auflösen > + tcpip: Pakete über ein bestimmtes Gerät versenden, ohne Routing Ack From mail at kevin-wolf.de Sat Aug 30 18:20:46 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 30 Aug 2008 18:20:46 +0200 Subject: [Lost] kernel: invlpg braucht eine physische Adresse Message-ID: <200808301820.46841@kevin-wolf.de> ! kernel: In alloc_kernel_pages wurde invlpg mit einer physischen Adresse aufgerufen. Mit einer virtuellen Adresse bringt das mehr. -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : kernel-fix-invlpg.patch Dateityp : text/x-diff Dateigröße : 664 bytes Beschreibung: nicht verfügbar URL : From toni at famkaufmann.info Sat Aug 30 18:18:48 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 30 Aug 2008 18:18:48 +0200 Subject: [Lost] kernel: invlpg braucht eine physische Adresse In-Reply-To: <200808301820.46841@kevin-wolf.de> References: <200808301820.46841@kevin-wolf.de> Message-ID: <200808301818.57857.toni@famkaufmann.info> Am Samstag, 30. August 2008 18.20:46 schrieb Kevin Wolf: > ! kernel: In alloc_kernel_pages wurde invlpg mit einer physischen Adresse > aufgerufen. Mit einer virtuellen Adresse bringt das mehr. Ack. -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: This is a digitally signed message part. URL : From mail at kevin-wolf.de Sat Aug 30 20:44:04 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 30 Aug 2008 20:44:04 +0200 Subject: [Lost] =?iso-8859-1?q?=5BPatch=5D_Pascal-RTL=3A_tar_schreibt_gr?= =?iso-8859-1?q?=F6=DFere_zusammenh=E4ngende_Bl=F6cke?= Message-ID: <200808302044.04715@kevin-wolf.de> * Pascal-RTL: tar schreibt jetzt in 64K-Blöcken (statt 512 Bytes) From mail at kevin-wolf.de Sat Aug 30 20:46:16 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 30 Aug 2008 20:46:16 +0200 Subject: [Lost] =?iso-8859-1?q?=5BPatch=5D_Pascal-RTL=3A_tar_schreibt_gr?= =?iso-8859-1?q?=F6=DFere_zusammenh=E4ngende_Bl=F6cke?= In-Reply-To: <200808302044.04715@kevin-wolf.de> References: <200808302044.04715@kevin-wolf.de> Message-ID: <200808302046.16969@kevin-wolf.de> Am Samstag, 30. August 2008 20:44:04 schrieb Kevin Wolf: > * Pascal-RTL: tar schreibt jetzt in 64K-Blöcken (statt 512 Bytes) Und für die ihre Kristallkugel verlegt habenden hier auch noch der Patch. -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : tar.patch Dateityp : text/x-diff Dateigröße : 3411 bytes Beschreibung: nicht verfügbar URL : From toni at famkaufmann.info Sat Aug 30 20:51:21 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 30 Aug 2008 20:51:21 +0200 Subject: [Lost] [Patch] init - Memleak beim Laden von Programmen Message-ID: <200808302051.53618.toni@famkaufmann.info> ! init: Memleak beim Laden von Programmen gefixt -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : init-fix-memleak.patch Dateityp : text/x-diff Dateigröße : 1105 bytes Beschreibung: nicht verfügbar URL : -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: This is a digitally signed message part. URL : From toni at famkaufmann.info Sat Aug 30 20:53:45 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 30 Aug 2008 20:53:45 +0200 Subject: [Lost] [Patch] kernel - Speicherveranzeige der Prozesse bei SYSCALL_PM_INIT_PAGE aktualisieren Message-ID: <200808302053.47835.toni@famkaufmann.info> ! kernel: Bei einem SYSCALL_PM_INIT_PAGE wurde memory_used des Prozesses nicht aktualisiert. Das fuehrt zu einer fehlerhaften Anzeige in ps. -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : kernel-fix-init-memusage.patch Dateityp : text/x-diff Dateigröße : 618 bytes Beschreibung: nicht verfügbar URL : -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: This is a digitally signed message part. URL : From mail at kevin-wolf.de Sat Aug 30 22:54:59 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 30 Aug 2008 22:54:59 +0200 Subject: [Lost] [Patch] init - Memleak beim Laden von Programmen In-Reply-To: <200808302051.53618.toni@famkaufmann.info> References: <200808302051.53618.toni@famkaufmann.info> Message-ID: <200808302254.59639@kevin-wolf.de> Am Samstag, 30. August 2008 20:51:21 schrieb Antoine Kaufmann: > Index: trunk/src/modules/init/init.c > =================================================================== > --- trunk.orig/src/modules/init/init.c > +++ trunk/src/modules/init/init.c > @@ -522,7 +522,7 @@ size_t ainflate(void* src, size_t len, v > stream.avail_in = len - i - 8; > > stream.avail_out = *((dword*) (src_buf + len - 4)); > - stream.next_out = mem_allocate(stream.avail_out, 0); > + stream.next_out = malloc(stream.avail_out); > *dest_ptr = stream.next_out; > > > @@ -556,6 +556,7 @@ size_t ainflate(void* src, size_t len, v > > pid_t start_program(char* path, char* args, pid_t parent_pid) > { > + pid_t pid; > FILE* f = fopen(path, "r"); > > if(f == NULL) > @@ -620,12 +621,14 @@ pid_t start_program(char* path, char* ar > } > else > { > - buffer = mem_allocate(pages * 4096, 0); > + buffer = malloc(pages * 4096); An der Stelle hätte ich aber wirklich mem_allocate benutzt, wenn du eh ganze Pages brauchst. > fread(buffer, 1, size, f); > } > fclose(f); > > - return load_single_module((Elf32_Ehdr*) buffer, args, parent_pid); > + pid = load_single_module((Elf32_Ehdr*) buffer, args, parent_pid); Kann load_single_module denn überhaupt mit nicht page-aligntem Buffer umgehen? malloc dürfte sowas theoretisch machen. > + free(buffer); > + return pid; > } From mail at kevin-wolf.de Sat Aug 30 22:57:48 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 30 Aug 2008 22:57:48 +0200 Subject: [Lost] [Patch] kernel - Speicherveranzeige der Prozesse bei SYSCALL_PM_INIT_PAGE aktualisieren In-Reply-To: <200808302053.47835.toni@famkaufmann.info> References: <200808302053.47835.toni@famkaufmann.info> Message-ID: <200808302257.48447@kevin-wolf.de> Am Samstag, 30. August 2008 20:53:45 schrieb Antoine Kaufmann: > ! kernel: Bei einem SYSCALL_PM_INIT_PAGE wurde memory_used des Prozesses > nicht aktualisiert. Das fuehrt zu einer fehlerhaften Anzeige in ps. PAGE_SIZE statt 12, ansonsten sieht es gut aus. From toni at famkaufmann.info Sun Aug 31 10:43:34 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sun, 31 Aug 2008 10:43:34 +0200 Subject: [Lost] [Patch] init - Memleak beim Laden von Programmen In-Reply-To: <200808302254.59639@kevin-wolf.de> References: <200808302051.53618.toni@famkaufmann.info> <200808302254.59639@kevin-wolf.de> Message-ID: <200808311043.37980.toni@famkaufmann.info> Am Samstag, 30. August 2008 22.54:59 schrieb Kevin Wolf: > Am Samstag, 30. August 2008 20:51:21 schrieb Antoine Kaufmann: > > Index: trunk/src/modules/init/init.c > > =================================================================== > > --- trunk.orig/src/modules/init/init.c > > +++ trunk/src/modules/init/init.c > > @@ -522,7 +522,7 @@ size_t ainflate(void* src, size_t len, v > >      stream.avail_in = len - i - 8; > > > >      stream.avail_out = *((dword*) (src_buf + len - 4)); > > -    stream.next_out = mem_allocate(stream.avail_out, 0); > > +    stream.next_out = malloc(stream.avail_out); > >      *dest_ptr = stream.next_out; > > > > > > @@ -556,6 +556,7 @@ size_t ainflate(void* src, size_t len, v > > > >  pid_t start_program(char* path, char* args, pid_t parent_pid) > >  { > > +    pid_t pid; > >      FILE* f = fopen(path, "r"); > > > >      if(f == NULL) > > @@ -620,12 +621,14 @@ pid_t start_program(char* path, char* ar > >      } > >      else > >      { > > -        buffer = mem_allocate(pages * 4096, 0); > > +        buffer = malloc(pages * 4096); > > An der Stelle hätte ich aber wirklich mem_allocate benutzt, wenn du eh > ganze Pages brauchst. Dann braucht mem_free aber auch eine Grösse und ich muss ainflate auch noch anpasen. ;-) > >          fread(buffer, 1, size, f); > >      } > >      fclose(f); > > > > -    return load_single_module((Elf32_Ehdr*) buffer, args, parent_pid); > > +    pid = load_single_module((Elf32_Ehdr*) buffer, args, parent_pid); > > Kann load_single_module denn überhaupt mit nicht page-aligntem Buffer > umgehen? malloc dürfte sowas theoretisch machen. Jo das alloziert neue Pages um sie an die neuen Prozesse zu verschenken. ;-) > > +    free(buffer); > > +    return pid; > >  } -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: This is a digitally signed message part. URL : From toni at famkaufmann.info Sun Aug 31 10:46:15 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sun, 31 Aug 2008 10:46:15 +0200 Subject: [Lost] =?utf-8?q?=5BPatch=5D_Pascal-RTL=3A_tar_schreibt_gr=C3=B6?= =?utf-8?q?=C3=9Fere_zusammenh=C3=A4ngende_Bl=C3=B6cke?= In-Reply-To: <200808302046.16969@kevin-wolf.de> References: <200808302044.04715@kevin-wolf.de> <200808302046.16969@kevin-wolf.de> Message-ID: <200808311046.18587.toni@famkaufmann.info> Am Samstag, 30. August 2008 20.46:16 schrieb Kevin Wolf: > Am Samstag, 30. August 2008 20:44:04 schrieb Kevin Wolf: > > * Pascal-RTL: tar schreibt jetzt in 64K-Blöcken (statt 512 Bytes) > > Und für die ihre Kristallkugel verlegt habenden hier auch noch der Patch. Wie gütig von dir. ;-) Mir fällt nichts auf und du wirst es ja schon ausprobiert haben... ;-) Also ack. -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: This is a digitally signed message part. URL : From mail at kevin-wolf.de Sun Aug 31 11:09:53 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sun, 31 Aug 2008 11:09:53 +0200 Subject: [Lost] [Patch] init - Memleak beim Laden von Programmen In-Reply-To: <200808311043.37980.toni@famkaufmann.info> References: <200808302051.53618.toni@famkaufmann.info> <200808302254.59639@kevin-wolf.de> <200808311043.37980.toni@famkaufmann.info> Message-ID: <200808311109.53824@kevin-wolf.de> Am Sonntag, 31. August 2008 10:43:34 schrieb Antoine Kaufmann: > Am Samstag, 30. August 2008 22.54:59 schrieb Kevin Wolf: > > An der Stelle hätte ich aber wirklich mem_allocate benutzt, wenn du eh > > ganze Pages brauchst. > > Dann braucht mem_free aber auch eine Grösse und ich muss ainflate auch noch > anpasen. ;-) Na gut, dann mach es eben so rein. ;-) From mail at kevin-wolf.de Sun Aug 31 11:35:13 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sun, 31 Aug 2008 11:35:13 +0200 Subject: [Lost] [Patch] tcpip - udp In-Reply-To: <200808262051.55730.toni@famkaufmann.info> References: <200808261347.24093.toni@famkaufmann.info> <200808262051.55730.toni@famkaufmann.info> Message-ID: <200808311135.13596@kevin-wolf.de> Am Dienstag, 26. August 2008 20:51:52 schrieb Antoine Kaufmann: > Re: [Lost] [Patch] tcpip - udp > Von: > Antoine Kaufmann > An: > "Lost-Patches" > Datum: > Dienstag 20:51:52 > Anhänge:  >  tcpip-udp.patch >   > Es sind nicht genügend Informationen zur Überprüfung der Gültigkeit der > Signatur vorhanden. Details anzeigen > > Am Dienstag, 26. August 2008 13.47:15 schrieb Antoine Kaufmann: > > + tcpip: udp-Unterstützung > > In dieser Version habe ich noch den source_ip-Parameter für udp_send > rausgeworfen. Die Quell-IP kann udp_send über die Routingtabelle ausfindig > machen. > > Index: trunk/src/modules/tcpip/include/udp.h > =================================================================== > --- /dev/null > +++ trunk/src/modules/tcpip/include/udp.h > @@ -0,0 +1,191 @@ > +/* > + * Copyright (c) 2008 The LOST Project. All rights reserved. > + * > + * This code is derived from software contributed to the LOST Project > + * by Antoine Kaufmann > + * > + * 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 LOST Project > + * and its contributors. > + * 4. Neither the name of the LOST 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. > + */ > + > +#ifndef _UDP_H_ > +#define _UDP_H_ > + > +#include > + > +#include "collections.h" > + > +/** Header eines UDP-Pakets */ > +struct udp_header { > + /** Quellport des Pakets. Wird nur benoetigt, wenn der Versender > dieses + * Pakets eine Antwort erwartet. */ > + uint16_t source_port; > + > + /** Ziel-Port */ > + uint16_t dest_port; > + > + /** Laenge des Pakets (mit Header, min 8) */ > + uint16_t length; > + > + /** Pruefsumme oder 0 wenn diese nicht gepfrueft werden soll. */ > + uint16_t checksum; > +} __attribute__ ((packed)); > + > + > +/* TODO: Gehoert nach ip.h */ > +/** IP-Pseudoheader (wird zur Berechnung der TCP- und UDP-Pruefsummen > benutzt.*/ +struct udp_pseudo_header { > + /** Quell-IP des Pakets */ > + uint32_t source_ip; > + > + /** Ziel-IP des Pakets */ > + uint32_t dest_ip; > + > + /** Protokoll (TCP: 6, UDP: 17) */ > + uint16_t proto; > + > + /** Laenge des TCP-/UDP-Pakets */ > + uint16_t length; > +} __attribute__ ((packed)); > + > + > +/** Geoeffneter UDP-Port (listening) */ > +struct udp_port { > + /** Adresse auf der gelauscht wird. Oder 0 fuer alle */ > + uint32_t ip; > + > + /** Portnummer */ > + uint16_t port; > + > + /** Puffer mit den Paketen die eingegangen sind. */ > + list_t* in_buffer; > +}; > + > + > +/** UDP-Paket, wie es im In-Buffer liegt */ > +struct udp_packet { > + /** Quell-IP */ > + uint32_t source_ip; > + > + /** Quell-Port */ > + uint16_t source_port; > + > + /** Ziel-IP notwendig wenn auf 0.0.0.0 gelauscht wird. */ > + uint32_t dest_ip; > + > + /** Laenge der Daten */ > + size_t data_len; > + > + /** Pointer auf die Daten */ > + uint8_t data[]; Wenn mich meine C-Kenntnisse nicht täuschen, kommen da nicht vier Byte Pointer, sondern direkt die Daten. Der Kommentar führt dann in die Irre. > +}; > + > + > +/** > + * UDP-Code initialisieren > + */ > +void init_udp(); > + > +/** > + * Auf UDP-Port lauschen. > + * > + * @param ip IP auf der gelauscht werden soll, oder 0 fuer alle > + * @param port Port > + * > + * @return Pointer auf ein Port-Handle > + */ > +struct udp_port* udp_listen(uint32_t ip, uint16_t port); > + > +/** > + * Port wieder freigeben > + * > + * @param port Pointer auf ein Port-Handle > + */ > +void udp_port_release(struct udp_port* port); > + > +/** > + * Warten bis ein Paket eintrifft, oder die Zeit abgelaufen ist. > + * > + * @param port Port auf dem gewartet werden soll > + * @param timeout Zeit in Millisekunden nach der aufgegeben werden soll > oder 0 + * falls garnicht gewartet werden soll. > + * > + * @return Pointer auf einên udp_in_buffer oder NULL wenn kein Paket > + * eingetroffen ist. > + */ > +struct udp_packet* udp_port_wait(struct udp_port* port, uint64_t timeout); > + > +/** > + * UDP-Paket senden > + * > + * @param dest_ip IP an die das Paket gesendet werden soll. > + * @param dest_port Zielport > + * @param src_port Quellport > + * @param data Paket-Daten > + * @param length Laenge der Daten > + */ > +void udp_send(uint32_t dest_ip, uint16_t dest_port, uint16_t src_port, > + void* data, size_t length); > + > +/** > + * UDP-Paket direkt senden ohne Routing > + * > + * @param device Karte ueber die das Paket gesendet wird > + * @param dest_ip IP an die das Paket gesendet werden soll. > + * @param dest_port Zielport > + * @param src_ip IP von der aus das Paket gesendet werden soll > + * @param src_port Quellport > + * @param data Paket-Daten > + * @param len Laenge der Daten > + */ > +void udp_send_direct(struct device* device, uint32_t dest_ip, > + uint16_t dest_port, uint32_t src_ip, uint16_t src_port, void* data, > + size_t len); > + > + > +/** > + * UDP-Paket empfangen. Wird vom IP-Empfangscode aufgerufen. > + * > + * @param source_ip Quell-IP > + * @param dest_ip Ziel-IP > + * @param data Empfangenes UDP-Paket > + * @param len Laenge des Pakets > + */ > +void udp_receive(uint32_t src_ip, uint32_t dest_ip, void* data, size_t > len); + > +/*word tcp_checksum > + (struct tcp_header* header, struct tcp_pseudo_header* pseudo_header, > + void* data, dword data_size); > +void tcp_update_checksum > + (struct tcp_header* header, struct tcp_pseudo_header* pseudo_header, > + void* data, dword data_size); > + > +void tcp_receive(dword source_ip, void* data, dword data_size); > +void tcp_send_ack(struct tcp_connection* conn); // TODO Ersetzen*/ Auskommentierter Code. > + > +#endif > Index: trunk/src/modules/tcpip/ip.c > =================================================================== > --- trunk.orig/src/modules/tcpip/ip.c > +++ trunk/src/modules/tcpip/ip.c > @@ -45,6 +45,7 @@ > #include "arp.h" > #include "ethernet.h" > #include "tcp.h" > +#include "udp.h" > > //Hier koennen die Debug-Nachrichten aktiviert werden > #define DEBUG 0 > @@ -276,6 +277,8 @@ void ip_receive(struct device *device, v > > case IP_PROTO_UDP: > DEBUG_MSG("UDP-Paket eingegangen"); > + udp_receive(header->source_ip, header->dest_ip, packet, > + packet_size); > break; > > default: > Index: trunk/src/modules/tcpip/udp.c > =================================================================== > --- /dev/null > +++ trunk/src/modules/tcpip/udp.c > @@ -0,0 +1,284 @@ > +/* > + * Copyright (c) 2008 The LOST Project. All rights reserved. > + * > + * This code is derived from software contributed to the LOST Project > + * by Antoine Kaufmann > + * > + * 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 LOST Project > + * and its contributors. > + * 4. Neither the name of the LOST 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 > +#include > +#include > +#include > +#include > +#include > + > +#include "ip.h" > +#include "udp.h" > + > +/** Liste mit den UPD-Ports auf denen gelauscht wird. */ UDP, nicht UPD. > +list_t* udp_ports; > + > +/** > + * UDP-Code initialisieren > + */ > +void init_udp() > +{ > + udp_ports = list_create(); > +} > + > +/** > + * Auf UDP-Port lauschen. > + * > + * @param ip IP auf der gelauscht werden soll, oder 0 fuer alle > + * @param port Port > + * > + * @return Pointer auf ein Port-Handle > + */ > +struct udp_port* udp_listen(uint32_t ip, uint16_t port) > +{ > + struct udp_port* p = malloc(sizeof(*p)); > + > + p->ip = ip; > + p->port = port; > + p->in_buffer = list_create(); > + > + list_push(udp_ports, p); > + return p; > +} Ich finde, hier wäre eine Prüfung schick, ob nicht schon jemand anderes auf diesem Port lauscht. > + > +/** > + * Port wieder freigeben > + * > + * @param port Pointer auf ein Port-Handle > + */ > +void udp_port_release(struct udp_port* port) > +{ > + int i; > + struct udp_port* list_p; > + struct udp_packet* ib; > + > + // Wenn sich der Index zwischen list_get_element_at und list_remove > + // verschiebt haben wir ein Problem > + p(); > + for (i = 0; (list_p = list_get_element_at(udp_ports, i)); i++) { > + if (list_p == port) { > + list_remove(udp_ports, i); > + > + for (i = 0; (ib = list_get_element_at(port->in_buffer, i)); > i++) { + free(ib); > + } > + > + list_destroy(port->in_buffer); > + free(port); > + break; > + } > + } > + v(); > +} > + > +/** > + * Timer Stub fuer udp_port_wait > + */ > +static void udp_timer_stub() {} > + > +/** > + * Warten bis ein Paket eintrifft, oder die Zeit abgelaufen ist. > + * > + * @param port Port auf dem gewartet werden soll > + * @param timeout Zeit in Mikrosekunden nach der aufgegeben werden soll > oder 0 + * falls garnicht gewartet werden soll. > + * > + * @return Pointer auf einên udp_in_buffer oder NULL wenn kein Paket Sondêrzeichen im Kommentar. > + * eingetroffen ist. > + */ > +struct udp_packet* udp_port_wait(struct udp_port* port, uint64_t timeout) > +{ > + struct udp_packet* ib; > + > + if (timeout == 0) { > + return list_pop(port->in_buffer); > + } else { > + // Timer einrichten, damit spaetestens beim Timeout ein RPC kommt > + timer_register(udp_timer_stub, timeout); > + > + // Warten bis ein Paket in der Liste ist > + while (!(ib = list_pop(port->in_buffer)) && > + (timeout > get_tick_count())) timeout ist kein Timestamp, sondern die Zeit, die gewartet werden soll. Das ist meistens deutlich kleiner als get_tick_count(). > + { > + wait_for_rpc(); > + } > + > + return ib; > + } > +} > + > +/** > + * Port suchen, der auf dieser IP und diesem Port lauscht. > + * > + * @param source_ip IP > + * @paran port Port > + * > + * @return Pointer auf den Port oder NULL wenn keine gefunden wurde > + */ > +static struct udp_port* get_port(uint32_t ip, uint16_t port) > +{ > + struct udp_port* p; > + int i; > + > + for (i = 0; (p = list_get_element_at(udp_ports, i)); i++) { > + if ((p->port == port) && ((p->ip == ip) || !p->ip)) { > + return p; > + } > + } > + > + return NULL; > +} > + > +/** > + * UDP-Paket zusammenbauen > + * > + * @param buffer Puffer > + * @param dest_port Zielport > + * @param src_port Quellport > + * @param data Paket-Daten > + * @param len Laenge der Daten > + */ > +static void udp_fill_packet(void* buffer, uint16_t dest_port, uint16_t > src_port, + void* data, size_t len) > +{ > + struct udp_header* header = buffer; > + void* packet_data = buffer + sizeof(struct udp_header); > + > + // Header des Pakets befuellen > + header->dest_port = big_endian_word(dest_port); > + header->source_port = big_endian_word(src_port); > + header->length = big_endian_word(len + sizeof(struct > udp_header)); + header->checksum = 0; // TODO ;-) > + > + // Daten ins Paket kopieren > + memcpy(packet_data, data, len); > +} > + > +/** > + * UDP-Paket senden > + * > + * @param dest_ip IP an die das Paket gesendet werden soll. > + * @param dest_port Zielport > + * @param src_port Quellport > + * @param data Paket-Daten > + * @param length Laenge der Daten > + */ > +void udp_send(uint32_t dest_ip, uint16_t dest_port, uint16_t src_port, > + void* data, size_t length) > +{ > + size_t packet_len = length + sizeof(struct udp_header); > + uint8_t packet[packet_len]; > + struct routing_entry* route; > + > + // Quell-IP finden wir in der Route > + if (!(route = get_routing_entry(dest_ip))) { > + return; > + } > + > + udp_fill_packet(packet, dest_port, route->device->dev.ip, data, > length); + > + // Raus damit > + ip_send(dest_ip, IP_PROTO_UDP, packet, packet_len); > +} > + > +/** > + * UDP-Paket direkt senden ohne Routing > + * > + * @param device Karte ueber die das Paket gesendet wird > + * @param dest_ip IP an die das Paket gesendet werden soll. > + * @param dest_port Zielport > + * @param src_ip IP von der aus das Paket gesendet werden soll > + * @param src_port Quellport > + * @param data Paket-Daten > + * @param len Laenge der Daten > + */ > +void udp_send_direct(struct device* device, uint32_t dest_ip, > + uint16_t dest_port, uint32_t src_ip, uint16_t src_port, void* data, > + size_t len) > +{ > + size_t packet_len = len + sizeof(struct udp_header); > + uint8_t packet[packet_len]; > + > + udp_fill_packet(packet, dest_port, src_ip, data, len); > + > + // Raus damit > + ip_send_direct(device, dest_ip, IP_PROTO_UDP, packet, packet_len); > + > +} > + > +/** > + * UDP-Paket empfangen. Wird vom IP-Empfangscode aufgerufen. > + * > + * @param source_ip Quell-IP > + * @param dest_ip Ziel-IP > + * @param data Empfangenes UDP-Paket > + * @param len Laenge des Pakets > + */ > +void udp_receive(uint32_t src_ip, uint32_t dest_ip, void* data, size_t > len) +{ > + struct udp_header* header = data; > + struct udp_port* port; > + struct udp_packet* ib; > + size_t data_len; > + > + puts("udp_receive"); Öhm, nein. Nicht im SVN. > + // Ein Kaputtes Paket Sehr kaputt? *g* > + if (len < sizeof(struct udp_header)) { > + return; > + } > + > + // Pfruefen ob auf diesem Port gelauscht wird > + if (!(port = get_port(dest_ip, big_endian_word(header->dest_port)))) { > + return; > + } > + > + // TODO: Pruefen der Pruefsumme falls gesetzt > + > + > + // in_buffer vorbereiten um in die Liste zu haengen > + data_len = big_endian_word(header->length) - sizeof(struct > udp_header); + ib = malloc(sizeof(*ib) + data_len); > + > + ib->source_ip = big_endian_dword(src_ip); > + ib->dest_ip = big_endian_dword(dest_ip); > + ib->source_port = big_endian_word(header->source_port); > + > + ib->data_len = data_len; > + memcpy(ib->data, data + sizeof(struct udp_header), data_len); > + > + list_push(port->in_buffer, ib); > +} > + > Index: trunk/src/modules/tcpip/main.c > =================================================================== > --- trunk.orig/src/modules/tcpip/main.c > +++ trunk/src/modules/tcpip/main.c > @@ -45,6 +45,7 @@ > #include "arp.h" > #include "ip.h" > #include "tcp.h" > +#include "udp.h" > #include "lostio_if.h" > #include "dns.h" > #include "lostio.h" > @@ -77,6 +78,7 @@ int main(int argc, char* argv[]) > init_arp(); > init_ip(); > init_tcp(); > + init_udp(); > init_lostio_interface(); > > register_message_handler(RPC_IP_REGISTER_DRIVER, rpc_register_driver); Kann man irgendwie noch nicht benutzen in dieser Form, oder? Ein LostIO-Interface wäre noch ganz nett. From toni at famkaufmann.info Sun Aug 31 17:45:04 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sun, 31 Aug 2008 17:45:04 +0200 Subject: [Lost] [Patch] Kompilieren mit -Wstrict-prototypes und ensprechende Korrekturen Message-ID: <20080831154504.GA3491@thales.produktiv.lan> * Kompilieren mit -Wstrict-prototypes und ensprechende Korrekturen -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : fix-prototypes.patch Dateityp : text/x-diff Dateigröße : 67230 bytes Beschreibung: nicht verfügbar URL : -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: nicht verfügbar URL : From mail at kevin-wolf.de Sun Aug 31 18:10:03 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sun, 31 Aug 2008 18:10:03 +0200 Subject: [Lost] =?utf-8?q?=5BPatch=5D_Kompilieren_mit_-Wstrict-prototypes_?= =?utf-8?q?und_ensprechende=09Korrekturen?= In-Reply-To: <20080831154504.GA3491@thales.produktiv.lan> References: <20080831154504.GA3491@thales.produktiv.lan> Message-ID: <200808311810.03664@kevin-wolf.de> Am Sonntag, 31. August 2008 17:45:04 schrieb Antoine Kaufmann: > Index: trunk/src/modules/lib/servmgr.c > =================================================================== > --- trunk.orig/src/modules/lib/servmgr.c > +++ trunk/src/modules/lib/servmgr.c > @@ -38,8 +38,9 @@ > #include > #include > #include > +#include Reicht das einmal nicht? > > -static pid_t servmgr_pid(); > +static pid_t servmgr_pid(void); > > bool servmgr_need(const char* service_name) > { > Index: trunk/src/kernel/src/console.c > =================================================================== > --- trunk.orig/src/kernel/src/console.c > +++ trunk/src/kernel/src/console.c > @@ -87,7 +87,7 @@ > #define SCREEN_WIDTH 80 > #define SCREEN_HEIGHT 25 > > -void con_set_hw_cursor(); > +static void con_set_hw_cursor(void); > > static unsigned short * vidmem = (unsigned short*)0xb8000; > > @@ -148,7 +148,7 @@ static void con_set_cursor_pos(unsigned > /** > * Leert den Bildschirm > */ > -static void con_clear_screen() > +static void con_clear_screen(void) > { > int i; > > @@ -163,7 +163,7 @@ static void con_clear_screen() > /** > * Scrollt eine Zeile nach unten > */ > -static void scroll_down() > +static void scroll_down(void) > { > int i; > > @@ -598,7 +598,7 @@ void init_console(void) > /** > * Aktualisiert die Postition des Hardware Cursors > */ > -void con_set_hw_cursor() > +static void con_set_hw_cursor() Hier kein void in den Klammern? Der Rest stimmt vermutlich so halbwegs. ;-) From toni at famkaufmann.info Sun Aug 31 18:22:29 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sun, 31 Aug 2008 18:22:29 +0200 Subject: [Lost] [Patch] Kompilieren mit -Wstrict-prototypes und ensprechende?Korrekturen In-Reply-To: <200808311810.03664@kevin-wolf.de> References: <20080831154504.GA3491@thales.produktiv.lan> <200808311810.03664@kevin-wolf.de> Message-ID: <20080831162229.GA4092@thales.produktiv.lan> On Sun, Aug 31 18:10, Kevin Wolf wrote: > Am Sonntag, 31. August 2008 17:45:04 schrieb Antoine Kaufmann: > > Index: trunk/src/modules/lib/servmgr.c > > =================================================================== > > --- trunk.orig/src/modules/lib/servmgr.c > > +++ trunk/src/modules/lib/servmgr.c > > @@ -38,8 +38,9 @@ > > #include > > #include > > #include > > +#include > > Reicht das einmal nicht? Doppelt genäht hält besser. ;-) > > > > > -static pid_t servmgr_pid(); > > +static pid_t servmgr_pid(void); > > > > bool servmgr_need(const char* service_name) > > { > > Index: trunk/src/kernel/src/console.c > > =================================================================== > > --- trunk.orig/src/kernel/src/console.c > > +++ trunk/src/kernel/src/console.c > > @@ -87,7 +87,7 @@ > > #define SCREEN_WIDTH 80 > > #define SCREEN_HEIGHT 25 > > > > -void con_set_hw_cursor(); > > +static void con_set_hw_cursor(void); > > > > static unsigned short * vidmem = (unsigned short*)0xb8000; > > > > @@ -148,7 +148,7 @@ static void con_set_cursor_pos(unsigned > > /** > > * Leert den Bildschirm > > */ > > -static void con_clear_screen() > > +static void con_clear_screen(void) > > { > > int i; > > > > @@ -163,7 +163,7 @@ static void con_clear_screen() > > /** > > * Scrollt eine Zeile nach unten > > */ > > -static void scroll_down() > > +static void scroll_down(void) > > { > > int i; > > > > @@ -598,7 +598,7 @@ void init_console(void) > > /** > > * Aktualisiert die Postition des Hardware Cursors > > */ > > -void con_set_hw_cursor() > > +static void con_set_hw_cursor() > > Hier kein void in den Klammern? Ist nicht unbedingt nötig weil der Prototyp oben schon gekommen ist, aber eigentlich gehört es rein. Noch ein Anlauf. -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : fix-prototypes.patch Dateityp : text/x-diff Dateigröße : 67193 bytes Beschreibung: nicht verfügbar URL : -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: nicht verfügbar URL : From mail at kevin-wolf.de Sun Aug 31 20:43:14 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sun, 31 Aug 2008 20:43:14 +0200 Subject: [Lost] =?utf-8?q?=5BPatch=5D_Kompilieren_mit_-Wstrict-prototypes_?= =?utf-8?q?und=09ensprechende=3FKorrekturen?= In-Reply-To: <20080831162229.GA4092@thales.produktiv.lan> References: <20080831154504.GA3491@thales.produktiv.lan> <200808311810.03664@kevin-wolf.de> <20080831162229.GA4092@thales.produktiv.lan> Message-ID: <200808312043.14333@kevin-wolf.de> Am Sonntag, 31. August 2008 18:22:29 schrieb Antoine Kaufmann: > Noch ein Anlauf. Ich weigere mich, das nochmal durchzusehen. ;-) Sofern du nichts anderes mehr geändert hast als die beiden von mir genannten Stellen, kann das rein. From toni at famkaufmann.info Sun Aug 31 21:41:28 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sun, 31 Aug 2008 21:41:28 +0200 Subject: [Lost] [Patch] FPC - fpc.cfg und ld finden Message-ID: <20080831194128.GC18454@thales.produktiv.lan> Dieser Patch für FPC sorgt dafür, dass er seine fpc.cfg im Verzeichnis file:/packages/fpc/2.0.4/ sucht. Dort ist noch ein kleiner Hack im Code. Aber sonst erkennt er das Verzeichnis nicht wirklich, müsste man mal Debuggen. Liegt vermutlich an einem Stub. ;-) Den LD sucht er fix in file:/system/lpt-bin/ld. Vielleicht könnte man da noch etwas reinmachen um in $PATH zu suchen, aber ansich unnötig. -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : fpc_config_ld.patch Dateityp : text/x-diff Dateigröße : 6572 bytes Beschreibung: nicht verfügbar URL : -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: nicht verfügbar URL : From janosch.graef at gmx.net Sun Aug 31 22:02:50 2008 From: janosch.graef at gmx.net (=?ISO-8859-15?Q?Janosch_Gr=E4f?=) Date: Sun, 31 Aug 2008 22:02:50 +0200 Subject: [Lost] =?iso-8859-15?q?Ramdisk_-_Children-Liste_f=FCr_das_Rootobj?= =?iso-8859-15?q?ekt_anlegen?= Message-ID: <48BAF8EA.7080803@gmx.net> Ich hoffe ich habe den Patch mit der aktuellen Version von ramdisk/init.c erstellt ;) -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : ramdisk.patch Dateityp : text/x-patch Dateigröße : 558 bytes Beschreibung: nicht verfügbar URL : From toni at famkaufmann.info Sun Aug 31 23:14:58 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sun, 31 Aug 2008 23:14:58 +0200 Subject: [Lost] [Patch] tcpip - udp In-Reply-To: <200808311135.13596@kevin-wolf.de> References: <200808261347.24093.toni@famkaufmann.info> <200808262051.55730.toni@famkaufmann.info> <200808311135.13596@kevin-wolf.de> Message-ID: <20080831211458.GA13964@thales.produktiv.lan> On Sun, Aug 31 11:35, Kevin Wolf wrote: > Kann man irgendwie noch nicht benutzen in dieser Form, oder? Ein > LostIO-Interface wäre noch ganz nett. Dem ist so, aber der dhcp-Patch, der irgendwann folgt, baut darauf auf, und ein halbes LostIO-Interface habe ich auch schon. Aber das kann ich mit einem späteren Patch einbauen, oder? Im Anhang die korrigierte Version. -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : tcpip-udp.patch Dateityp : text/x-diff Dateigröße : 15977 bytes Beschreibung: nicht verfügbar URL : -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: nicht verfügbar URL :