From fmnssun at gmail.com Wed May 12 21:12:10 2010 From: fmnssun at gmail.com (Roman Muentener) Date: Wed, 12 May 2010 21:12:10 +0200 Subject: [tyndur-devel] [PATCH] Tool zum Speichern und Wiederherstellen von Partitionstabellen Message-ID: <1273691530-17947-1-git-send-email-fmnssun@gmail.com> Kleines Tool, aus Langeweile entstanden und zum fseek mit Devices zu testen. Signed-off-by: Roman Muentener --- src/modules/c/partt/Makefile.all | 7 ++ src/modules/c/partt/main.c | 125 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 132 insertions(+), 0 deletions(-) create mode 100644 src/modules/c/partt/Makefile.all create mode 100644 src/modules/c/partt/main.c diff --git a/src/modules/c/partt/Makefile.all b/src/modules/c/partt/Makefile.all new file mode 100644 index 0000000..0549688 --- /dev/null +++ b/src/modules/c/partt/Makefile.all @@ -0,0 +1,7 @@ +shopt -s extglob +source $LOST_BUILDMK_ROOT/config.sh + +echo "LD $1/apps/partt" +$LOST_TOOLS_LD -opartt -Ttext=0x40000000 *.o --start-group $2 --end-group + +mv partt $1/apps/ diff --git a/src/modules/c/partt/main.c b/src/modules/c/partt/main.c new file mode 100644 index 0000000..e2d6ecc --- /dev/null +++ b/src/modules/c/partt/main.c @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2010 The tyndur Project. All rights reserved. + * + * This code is derived from software contributed to the tyndur Project + * by Roman Muentener. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the tyndur Project + * and its contributors. + * 4. Neither the name of the tyndur Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include + +unsigned char partition_table[64]; + +int go_part(char* source, char* destination,char* action); + +int main(int argc, char* argv[]) +{ + if(argc < 4) + { + printf("partt source destination action\n"); + printf(" source -- Quelle (Device oder Datei)\n"); + printf(" destination -- Zielort (Device oder Datei)\n"); + printf(" action -- Aktion: load oder save\n"); + printf(" load: Liest Partitionstabelle von Datei [source] und schreibt nach Device [destination]\n"); + printf(" save: Liest Partitionstabelle von Device [source] und schreibt nach Datei [destination]\n"); + printf("\n\n"); + printf("Beispiel: Speichern: partt ata:/ata00 save.pt save\n"); + printf(" Laden: partt save.pt ata:/ata00 load\n"); + return 1; + } + return go_part(argv[1],argv[2],argv[3]); +} + +int go_part(char* source, char* destination,char* action) +{ + FILE* fsrc = fopen(source,"r"); + if(!fsrc) + { + printf("partt: Konnte Device/Datei nicht lesen! [source]\n"); + return 3; + } + + int read_offset = 0x0; + int write_offset = 0x0; + + if(strcmp(action,"save") == 0) + { + read_offset = 0x01BE; + write_offset = 0x0; + } + else if(strcmp(action,"load") == 0) + { + read_offset = 0x0; + write_offset = 0x01BE; + } + else + { + printf("partt: Unbekannte Aktion!\n"); + return 2; + } + + if(fseek(fsrc,read_offset,SEEK_SET) != 0) + { + printf("partt: Sprung an Position schlug fehl! [source]\n"); + return 4; + } + + if(fread(partition_table,1,64,fsrc) != 64) + { + printf("partt: Konnte Partitionstabelle nicht lesen! [source]\n"); + return 5; + } + + FILE* fdst = fopen(destination,"w"); + if(!fdst) + { + printf("partt: Konnte Device/Datei nicht lesen! [destination]\n"); + return 3; + } + + if(fseek(fdst,write_offset,SEEK_SET) != 0) + { + printf("partt: Sprung an Position schlug fehl! [destination]\n"); + return 6; + } + + if(fwrite(partition_table,1,64,fdst) != 64) + { + printf("partt: Konnte Partitionstabelle nicht speichern! [destination]\n"); + return 7; + } + + fclose(fdst); + fclose(fsrc); + + return 0; +} -- 1.6.0.4 From kevin at tyndur.org Thu May 13 17:50:30 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Thu, 13 May 2010 17:50:30 +0200 Subject: [PATCH 0/4] init: Geräteverwaltung Message-ID: <1273765834-15957-1-git-send-email-kevin@tyndur.org> Wir brauchen spätestens mit cdi_provide_device irgendeine zentrale Stelle, die alle Geräte im System kennt. Also darf mal wieder init ran. Das ist natürlich noch stark ausbaubar, init weiß nicht besonders viel über diese Geräte. Aber der Rest sollten vom Mechanismus her Kleinigkeiten sein, die man auch später noch leicht einfügen kann. Die einzige Ausnahme ist vielleicht der noch fehlende Callback-Mechanismus für Hotplugging. Kevin Wolf (4): init: devmgr pci: Geraete bei init registrieren cdi: PCI-Geraete von init holen statt ueber LIO lsdev src/modules/cdi/lib/pci.c | 132 +++++++++++++++++------------------- src/modules/cdi/lsdev/Makefile.all | 6 ++ src/modules/cdi/lsdev/main.c | 82 ++++++++++++++++++++++ src/modules/include/init.h | 10 +++ src/modules/init/devmgr.c | 98 ++++++++++++++++++++++++++ src/modules/init/init.c | 6 ++ src/modules/lib/init.c | 20 ++++++ src/modules/pci/pci.c | 59 ++++++++++++++++ 8 files changed, 342 insertions(+), 71 deletions(-) create mode 100644 src/modules/cdi/lsdev/Makefile.all create mode 100644 src/modules/cdi/lsdev/main.c create mode 100644 src/modules/init/devmgr.c From kevin at tyndur.org Thu May 13 17:50:31 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Thu, 13 May 2010 17:50:31 +0200 Subject: [tyndur-devel] [PATCH 1/4] init: devmgr In-Reply-To: <1273765834-15957-1-git-send-email-kevin@tyndur.org> References: <1273765834-15957-1-git-send-email-kevin@tyndur.org> Message-ID: <1273765834-15957-2-git-send-email-kevin@tyndur.org> + init: Systemweit zentrale Verwaltung von Geraeten, damit sich unterschiedliche Treiber koordinieren koennen Signed-off-by: Kevin Wolf --- src/modules/include/init.h | 10 ++++ src/modules/init/devmgr.c | 98 ++++++++++++++++++++++++++++++++++++++++++++ src/modules/init/init.c | 6 +++ src/modules/lib/init.c | 20 +++++++++ 4 files changed, 134 insertions(+), 0 deletions(-) create mode 100644 src/modules/init/devmgr.c diff --git a/src/modules/include/init.h b/src/modules/include/init.h index 325a7b4..aa18fd5 100644 --- a/src/modules/include/init.h +++ b/src/modules/include/init.h @@ -63,5 +63,15 @@ pid_t init_execute(const char* cmd); #endif +struct init_dev_desc { + char name[64]; + int type; + size_t bus_data_size; + uint8_t bus_data[]; +}; + +int init_dev_register(struct init_dev_desc* dev, size_t size); +int init_dev_list(struct init_dev_desc** devs); + #endif diff --git a/src/modules/init/devmgr.c b/src/modules/init/devmgr.c new file mode 100644 index 0000000..42adc92 --- /dev/null +++ b/src/modules/init/devmgr.c @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2010 The tyndur Project. All rights reserved. + * + * This code is derived from software contributed to the tyndur Project + * by Kevin Wolf. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the tyndur Project + * and its contributors. + * 4. Neither the name of the tyndur Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include +#include +#include +#include +#include + +struct device { + struct init_dev_desc* public; +}; + +list_t* devices = NULL; + +void rpc_dev_register(pid_t pid, dword cid, size_t size, void* data) +{ + struct init_dev_desc* desc; + struct device* dev; + + if (size < sizeof(struct init_dev_desc)) { + rpc_send_int_response(pid, cid, -1); + return; + } + + desc = data; + if (size != desc->bus_data_size + sizeof(struct init_dev_desc)) { + rpc_send_int_response(pid, cid, -1); + return; + } + + desc = malloc(size); + memcpy(desc, data, size); + desc->name[sizeof(desc->name) - 1] = '\0'; + + dev = malloc(sizeof(*dev)); + dev->public = desc; + + if (devices == NULL) { + devices = list_create(); + } + + list_push(devices, dev); + rpc_send_int_response(pid, cid, 0); +} + +void rpc_dev_list(pid_t pid, dword cid, size_t size, void* data) +{ + size_t bytes = 0; + int i; + struct device* dev; + + for (i = 0; (dev = list_get_element_at(devices, i)); i++) { + bytes += dev->public->bus_data_size + sizeof(struct init_dev_desc); + } + + uint8_t buf[bytes]; + size_t pos = 0; + + for (i = 0; (dev = list_get_element_at(devices, i)); i++) { + size_t s = dev->public->bus_data_size + sizeof(struct init_dev_desc); + memcpy(&buf[pos], dev->public, s); + pos += s; + } + + rpc_send_response(pid, cid, bytes, (char*) buf); +} diff --git a/src/modules/init/init.c b/src/modules/init/init.c index 475d602..e5fbbdb 100644 --- a/src/modules/init/init.c +++ b/src/modules/init/init.c @@ -75,6 +75,9 @@ void rpc_loadelf(pid_t pid, dword correlation_id, size_t data_size, void* data); void rpc_reopen_stdio(pid_t pid, dword cid, size_t size, void* data); +void rpc_dev_register(pid_t pid, dword cid, size_t size, void* data); +void rpc_dev_list(pid_t pid, dword cid, size_t size, void* data); + void load_modules(init_module_list_t* modules); bool load_single_module(Elf32_Ehdr* elf_header, char* args, pid_t parent_pid); bool start_program(char* path, char* args, pid_t parent_pid); @@ -168,6 +171,9 @@ void _start(dword modules) register_message_handler("UP_STDIO", &rpc_reopen_stdio); + register_message_handler("DEV_REG ", &rpc_dev_register); + register_message_handler("DEV_LIST", &rpc_dev_list); + io_init(); diff --git a/src/modules/lib/init.c b/src/modules/lib/init.c index 3759114..1451e80 100644 --- a/src/modules/lib/init.c +++ b/src/modules/lib/init.c @@ -175,3 +175,23 @@ pid_t init_execute(const char* cmd) return pid; } +int init_dev_register(struct init_dev_desc* dev, size_t size) +{ + return rpc_get_int(1, "DEV_REG ", size, (char*) dev); +} + +int init_dev_list(struct init_dev_desc** devs) +{ + int res; + response_t* response = rpc_get_response(1, "DEV_LIST", 0, NULL); + + if (response == 0) { + return -1; + } + + *devs = response->data; + res = response->data_length; + free(response); + + return res; +} -- 1.6.0.2 From kevin at tyndur.org Thu May 13 17:50:32 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Thu, 13 May 2010 17:50:32 +0200 Subject: [tyndur-devel] [PATCH 2/4] pci: Geraete bei init registrieren In-Reply-To: <1273765834-15957-1-git-send-email-kevin@tyndur.org> References: <1273765834-15957-1-git-send-email-kevin@tyndur.org> Message-ID: <1273765834-15957-3-git-send-email-kevin@tyndur.org> + pci: Alle PCI-Geraete werden bei init registriert Signed-off-by: Kevin Wolf --- src/modules/pci/pci.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 59 insertions(+), 0 deletions(-) diff --git a/src/modules/pci/pci.c b/src/modules/pci/pci.c index 75227fe..a1e2b66 100644 --- a/src/modules/pci/pci.c +++ b/src/modules/pci/pci.c @@ -99,6 +99,64 @@ int main(int argc, char* argv[]) return 0; } +void register_pci_device(void* data, size_t size) +{ + struct pci_device* device = data; + const char* class; + + struct { + struct init_dev_desc desc; + uint8_t bus_data[size]; + } info; + + switch (device->class_id) { + case 0x00: + if (device->subclass_id == 0x1) { + class = "vga"; + } else { + class = "legacy"; + } + break; + + case 0x01: + class = "storage"; + break; + + case 0x02: + class = "net"; + break; + + case 0x03: + class = "display"; + break; + + case 0x04: + switch (device->subclass_id) { + case 0x0: class = "video"; break; + case 0x1: class = "audio"; break; + default: class = "multimedia"; break; + } + break; + + case 0x06: + class = "bridge"; + break; + + default: + class = "device"; + break; + } + + snprintf(info.desc.name, sizeof(info.desc.name), "pci_%s_%d.%d.%d", + class, device->bus, device->device, device->function); + + info.desc.type = 10; /* CDI_PCI */ + info.desc.bus_data_size = size; + + memcpy(info.bus_data, data, size); + init_dev_register(&info.desc, sizeof(info.desc) + size); +} + void create_device_files(void) { int i, j; @@ -129,6 +187,7 @@ void create_device_files(void) pos += sizeof(struct pci_resource); } + register_pci_device(content, size); vfstree_create_node(filename, LOSTIO_TYPES_PCI_DEVICE, size, content, 0); -- 1.6.0.2 From kevin at tyndur.org Thu May 13 17:50:33 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Thu, 13 May 2010 17:50:33 +0200 Subject: [tyndur-devel] [PATCH 3/4] cdi: PCI-Geraete von init holen statt ueber LIO In-Reply-To: <1273765834-15957-1-git-send-email-kevin@tyndur.org> References: <1273765834-15957-1-git-send-email-kevin@tyndur.org> Message-ID: <1273765834-15957-4-git-send-email-kevin@tyndur.org> * cdi: Nachdem init jetzt alle Geraete kennt, koennen wir sie auch genauso gut von dort holen. Signed-off-by: Kevin Wolf --- src/modules/cdi/lib/pci.c | 132 +++++++++++++++++++++------------------------ 1 files changed, 61 insertions(+), 71 deletions(-) diff --git a/src/modules/cdi/lib/pci.c b/src/modules/cdi/lib/pci.c index e14f48a..145942c 100644 --- a/src/modules/cdi/lib/pci.c +++ b/src/modules/cdi/lib/pci.c @@ -12,8 +12,10 @@ #include #include #include +#include #include +#include #include #include @@ -22,71 +24,57 @@ #include "cdi/pci.h" /** - * Liest aus einer LOST-pci:/devices-Datei die Daten eines PCI-Geraets ein + * Liest die Daten eines PCI-Geraets ein */ -static struct cdi_pci_device* read_pci_device(char* filename) +static struct cdi_pci_device* read_pci_device(uint8_t* data, size_t size) { - FILE* f = fopen(filename, "r"); - if (f == NULL) { - fprintf(stderr, "PCI-Geraet %s nicht gefunden.\n", filename); - return NULL; - } - - struct pci_device device; - if (!fread(&device, sizeof(device), 1, f)) { - fprintf(stderr, "Konnte nicht von %s lesen.\n", filename); - fclose(f); - return NULL; - } + struct pci_device* device = (struct pci_device*) data; // CDI-Struktur initialisieren struct cdi_pci_device* cdi_device = malloc(sizeof(*cdi_device)); - cdi_device->bus = device.bus; - cdi_device->dev = device.device; - cdi_device->function = device.function; - cdi_device->vendor_id = device.vendor_id; - cdi_device->device_id = device.device_id; - cdi_device->class_id = device.class_id; - cdi_device->subclass_id = device.subclass_id; - cdi_device->interface_id = device.interface_id; - cdi_device->rev_id = device.rev_id; - cdi_device->irq = device.irq; + cdi_device->bus = device->bus; + cdi_device->dev = device->device; + cdi_device->function = device->function; + cdi_device->vendor_id = device->vendor_id; + cdi_device->device_id = device->device_id; + cdi_device->class_id = device->class_id; + cdi_device->subclass_id = device->subclass_id; + cdi_device->interface_id = device->interface_id; + cdi_device->rev_id = device->rev_id; + cdi_device->irq = device->irq; cdi_device->resources = cdi_list_create(); // Ressourcen hinzufuegen struct pci_resource res; struct cdi_pci_resource* cdi_res; int index = 0; - while (!feof(f)) { - if (fread(&res, sizeof(res), 1, f)) { - - cdi_res = malloc(sizeof(*cdi_res)); - cdi_res->start = res.start; - cdi_res->length = res.length; - cdi_res->index = index++; - cdi_res->address = 0; - - switch (res.type) { - case PCI_RESOURCE_MEM: - cdi_res->type = CDI_PCI_MEMORY; - break; - - case PCI_RESOURCE_PORT: - cdi_res->type = CDI_PCI_IOPORTS; - break; - } - - cdi_list_push(cdi_device->resources, cdi_res); - - } else { - fprintf(stderr, "Konnte nicht von %s lesen.\n", filename); - fclose(f); - cdi_pci_device_destroy(cdi_device); - return NULL; + + size -= sizeof(*device); + data += sizeof(*device); + + while (size >= sizeof(res)) { + memcpy(&res, data, sizeof(res)); + size -= sizeof(res); + data += sizeof(res); + + cdi_res = malloc(sizeof(*cdi_res)); + cdi_res->start = res.start; + cdi_res->length = res.length; + cdi_res->index = index++; + cdi_res->address = 0; + + switch (res.type) { + case PCI_RESOURCE_MEM: + cdi_res->type = CDI_PCI_MEMORY; + break; + + case PCI_RESOURCE_PORT: + cdi_res->type = CDI_PCI_IOPORTS; + break; } - } - fclose(f); + cdi_list_push(cdi_device->resources, cdi_res); + } return cdi_device; } @@ -97,33 +85,35 @@ static struct cdi_pci_device* read_pci_device(char* filename) */ void cdi_pci_get_all_devices(cdi_list_t list) { - servmgr_need("pci"); + struct init_dev_desc* devs; + uint8_t* data; + int ret; - io_resource_t* dir_res = directory_open("pci:/devices/"); - - if (dir_res == NULL) { - fprintf(stderr, "Konnte pci:/devices/ nicht oeffnen\n"); + ret = init_dev_list(&devs); + if (ret < 0) { return; } - io_direntry_t* direntry; - while ((direntry = directory_read(dir_res))) { - if (direntry->type == IO_DIRENTRY_FILE) { - struct cdi_pci_device* device; - char* buffer = NULL; - asprintf(&buffer, "pci:/devices/%s", direntry->name); + data = (uint8_t*) devs; + while (1) { + size_t size; - device = read_pci_device(buffer); - if (device != NULL) { - cdi_list_push(list, device); - } + if (ret < sizeof(struct init_dev_desc)) { + break; + } - free(buffer); + devs = (struct init_dev_desc*) data; + size = sizeof(struct init_dev_desc) + devs->bus_data_size; + if (ret < size) { + break; } - free(direntry); - } - directory_close(dir_res); + if (devs->type == CDI_PCI) { + cdi_list_push(list, read_pci_device(devs->bus_data, size)); + } + ret -= size; + data += size; + }; } /** -- 1.6.0.2 From kevin at tyndur.org Thu May 13 17:50:34 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Thu, 13 May 2010 17:50:34 +0200 Subject: [tyndur-devel] [PATCH 4/4] lsdev In-Reply-To: <1273765834-15957-1-git-send-email-kevin@tyndur.org> References: <1273765834-15957-1-git-send-email-kevin@tyndur.org> Message-ID: <1273765834-15957-5-git-send-email-kevin@tyndur.org> + lsdev: Anzeigen aller bei init registrierter Geraete Signed-off-by: Kevin Wolf --- src/modules/cdi/lsdev/Makefile.all | 6 +++ src/modules/cdi/lsdev/main.c | 82 ++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+), 0 deletions(-) create mode 100644 src/modules/cdi/lsdev/Makefile.all create mode 100644 src/modules/cdi/lsdev/main.c diff --git a/src/modules/cdi/lsdev/Makefile.all b/src/modules/cdi/lsdev/Makefile.all new file mode 100644 index 0000000..5f906a9 --- /dev/null +++ b/src/modules/cdi/lsdev/Makefile.all @@ -0,0 +1,6 @@ +shopt -s extglob +source $LOST_BUILDMK_ROOT/config.sh + +echo "LD $1/apps/lsdev" +$LOST_TOOLS_LD -olsdev.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_STRIP -s lsdev.mod -o $1/apps/lsdev diff --git a/src/modules/cdi/lsdev/main.c b/src/modules/cdi/lsdev/main.c new file mode 100644 index 0000000..18e7f57 --- /dev/null +++ b/src/modules/cdi/lsdev/main.c @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2007 The tyndur Project. All rights reserved. + * + * This code is derived from software contributed to the tyndur Project + * by Kevin Wolf. + * + * 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. + * + * 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 + +int main(void) +{ + struct init_dev_desc* devs; + uint8_t* data; + int ret; + + ret = init_dev_list(&devs); + if (ret < 0) { + fprintf(stderr, "Konnte Geraete nicht abfragen\n"); + return 1; + } + + data = (uint8_t*) devs; + while (1) { + size_t size; + + if (ret < sizeof(struct init_dev_desc)) { + break; + } + + devs = (struct init_dev_desc*) data; + size = sizeof(struct init_dev_desc) + devs->bus_data_size; + if (ret < size) { + break; + } + + switch (devs->type) { + case CDI_PCI: + { + struct pci_device* device = + (struct pci_device*) devs->bus_data; + + printf("PCI %04x:%04x %s\n", + device->vendor_id, device->device_id, + devs->name); + break; + } + + default: + printf("??? %s\n", + devs->name); + break; + } + ret -= size; + data += size; + }; + + return 0; +} -- 1.6.0.2 From fmnssun at gmail.com Thu May 13 20:27:26 2010 From: fmnssun at gmail.com (Roman Muentener) Date: Thu, 13 May 2010 20:27:26 +0200 Subject: [tyndur-devel] [PATCH] Abfrage des DNS-Caches via lostio erlauben Message-ID: <1273775246-17690-1-git-send-email-fmnssun@gmail.com> DNS-Requests verschoben von tcpip:/dns/%s nach tcpip:/dns/request/%s Abfrage des Caches via tcpip:/dns/cache Signed-off-by: Roman Muentener --- src/modules/lib/posix/net.c | 2 +- src/modules/tcpip/dns.c | 15 ++++++++++----- src/modules/tcpip/include/dns.h | 10 ++++++++++ src/modules/tcpip/lostio_if.c | 33 +++++++++++++++++++++++++++++++-- 4 files changed, 52 insertions(+), 8 deletions(-) diff --git a/src/modules/lib/posix/net.c b/src/modules/lib/posix/net.c index d1c4c6b..78b9d7a 100644 --- a/src/modules/lib/posix/net.c +++ b/src/modules/lib/posix/net.c @@ -203,7 +203,7 @@ struct hostent* gethostbyname(const char* name) unsigned long count = 0; // Datei oeffnen - asprintf(&path, "tcpip:/dns/%s", name); + asprintf(&path, "tcpip:/dns/request/%s", name); f = fopen(path, "r"); free(path); diff --git a/src/modules/tcpip/dns.c b/src/modules/tcpip/dns.c index 2cc4a36..b0e741c 100644 --- a/src/modules/tcpip/dns.c +++ b/src/modules/tcpip/dns.c @@ -64,14 +64,19 @@ #define DNS_CACHE_SIZE 64 -struct dns_cache_entry { - char* name; - struct dns_request_result* result; -}; - static list_t* dns_cache = NULL; /** + * Gibt einen Pointer auf den DNS-Cache + * + * @return Pointer zum DNS-Cache + */ +list_t* get_dns_cache(void) +{ + return dns_cache; +} + +/** * Holt eine IP-Adresse aus dem DNS-Cache * * @return Zum gegebenen Domainnamen passende IP-Adresse oder 0, wenn die diff --git a/src/modules/tcpip/include/dns.h b/src/modules/tcpip/include/dns.h index 9682514..e7f360c 100644 --- a/src/modules/tcpip/include/dns.h +++ b/src/modules/tcpip/include/dns.h @@ -37,6 +37,9 @@ #define _DNS_H_ #include +#include +#include +#include "collections.h" #define DNS_PORT 53 @@ -96,11 +99,18 @@ static inline void dns_set_opcode(struct dns_header* header, uint8_t opcode) #define QTYPE_A big_endian_word(1) #define QCLASS_IN big_endian_word(1) +list_t* get_dns_cache(void); + struct dns_request_result { uint32_t* ip_address; uint32_t ip_count; }; +struct dns_cache_entry { + char* name; + struct dns_request_result* result; +}; + struct dns_request_result* dns_request(char* domain); #endif diff --git a/src/modules/tcpip/lostio_if.c b/src/modules/tcpip/lostio_if.c index 32fdf44..d93c23b 100644 --- a/src/modules/tcpip/lostio_if.c +++ b/src/modules/tcpip/lostio_if.c @@ -49,7 +49,7 @@ #include "dns.h" //Hier koennen die Debug-Nachrichten aktiviert werden -#define DEBUG 0 +#define DEBUG 1 #if DEBUG == 1 #define DEBUG_MSG(s) printf("[ TCPIP ] debug: %s() '%s'\n",__FUNCTION__,s) @@ -131,6 +131,8 @@ void init_lostio_interface(void) // Dateien/Verzeichnisse anlegen vfstree_create_node("/dns", LOSTIO_TYPES_DNS, 0, NULL, LOSTIO_FLAG_BROWSABLE); + vfstree_create_node("/dns/request", LOSTIO_TYPES_DNS, 0, NULL, + LOSTIO_FLAG_BROWSABLE); vfstree_create_node("/route", LOSTIO_TYPES_ROUTE, 1, NULL, 0); } @@ -165,7 +167,34 @@ bool lostio_tcp_not_found(char** path, byte flags, pid_t pid, io_resource_t* ps) { DEBUG_MSG("Knoten anlegen"); - if (strncmp(*path, "/dns/", 5) == 0) { + if(strncmp(*path,"/dns/cache",10) == 0) { + struct dns_cache_entry* entry; + int i, size = 0, offset = 0; + char* data = NULL; + for (i = 0; (entry = list_get_element_at(get_dns_cache(), i)); i++) { + int j; + for(j = 0; j < entry->result->ip_count; j++) { + char* line; + asprintf(&line,"%s :: %s\n",entry->name,ip_to_string(entry->result->ip_address[j])); + int len = strlen(line); + size += len; + data = realloc(data,size); + strncpy(data+offset,line,len); + free(line); + offset += len; + } + } + + data = realloc(data,size+1); + data[size] = '\0'; + + + return vfstree_create_node(*path, LOSTIO_TYPES_RAMFILE, + size+1, data, 0); + } + + + if (strncmp(*path, "/dns/request/", 13) == 0) { // DNS Request absetzen struct dns_request_result* result = dns_request(strrchr(*path, '/') + 1); -- 1.6.0.4 From kevin at tyndur.org Sun May 16 22:54:33 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Sun, 16 May 2010 22:54:33 +0200 Subject: [PATCH 0/6] libc: Fixes und Vorbereitung für C++ Message-ID: <1274043279-16362-1-git-send-email-kevin@tyndur.org> Der Versuch, libstd++ ans Laufen zu bringen, hat in der libc ein paar Fehler und Inkompatibilitäten mit C++ ans Licht gebracht, die diese Serie behebt. Für ein lauffähiges C++-Hello-World fehlen anschließend zumindest noch ein paar extern "C" sowieso Unterstützung für Konstruktoren. Kevin Wolf (6): libc: iscntrl und isprint als Funktionen libc: atoi-Deklaration gefixt libc: C++-kompatibles NULL libc: localeconv nicht static inline machen libc: Deklaration von mktemp/mkstemp gefixt libc: Typisierungsfix fuer assert src/include/arch/i386/stddef.h | 4 +++ src/include/ctype.h | 11 +++++++- src/include/stdlib.h | 10 ++++++++ src/include/string.h | 2 - src/lib/string.c | 5 +-- src/modules/include/assert.h | 2 +- src/modules/include/locale.h | 18 +-------------- src/modules/include/unistd.h | 6 ----- src/modules/lib/posix/locale.c | 47 ++++++++++++++++++++++++++++++++++++++++ 9 files changed, 74 insertions(+), 31 deletions(-) create mode 100644 src/modules/lib/posix/locale.c From kevin at tyndur.org Sun May 16 22:54:34 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Sun, 16 May 2010 22:54:34 +0200 Subject: [tyndur-devel] [PATCH 1/6] libc: iscntrl und isprint als Funktionen In-Reply-To: <1274043279-16362-1-git-send-email-kevin@tyndur.org> References: <1274043279-16362-1-git-send-email-kevin@tyndur.org> Message-ID: <1274043279-16362-2-git-send-email-kevin@tyndur.org> ! libc: iscntrl und isprint muessen als Funktionen vorhanden sein Signed-off-by: Kevin Wolf --- src/include/ctype.h | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/include/ctype.h b/src/include/ctype.h index 51cb2f4..817bedb 100644 --- a/src/include/ctype.h +++ b/src/include/ctype.h @@ -29,8 +29,15 @@ #ifndef _CTYPE_H_ #define _CTYPE_H_ -#define isprint(c) ((c) >= (char) 0x20) -#define iscntrl(c) ((c) < (char) 0x20) +static inline int isprint(int c) +{ + return (c >= 0x20); +} + +static inline int iscntrl(int c) +{ + return (c < 0x20); +} static inline int isspace(int c) { -- 1.6.0.2 From kevin at tyndur.org Sun May 16 22:54:35 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Sun, 16 May 2010 22:54:35 +0200 Subject: [tyndur-devel] [PATCH 2/6] libc: atoi-Deklaration gefixt In-Reply-To: <1274043279-16362-1-git-send-email-kevin@tyndur.org> References: <1274043279-16362-1-git-send-email-kevin@tyndur.org> Message-ID: <1274043279-16362-3-git-send-email-kevin@tyndur.org> ! libc: atoi gehoert nach stdlib.h ! libc: atoi gibt einen signed-Wert zurueck Signed-off-by: Kevin Wolf --- src/include/stdlib.h | 3 +++ src/include/string.h | 2 -- src/lib/string.c | 5 ++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/include/stdlib.h b/src/include/stdlib.h index 745d32d..62cd49b 100644 --- a/src/include/stdlib.h +++ b/src/include/stdlib.h @@ -54,6 +54,9 @@ long strtol(const char* str, char** endptr, int base); unsigned long strtoul(const char *nptr, char **endptr, int base); unsigned long long strtoull(const char *nptr, char **endptr, int base); +int atoi(const char* s); +long atol(const char* str); + char* getenv(const char* name); int setenv(const char* name, const char* value, int overwrite); diff --git a/src/include/string.h b/src/include/string.h index 0e082fe..e530689 100644 --- a/src/include/string.h +++ b/src/include/string.h @@ -68,8 +68,6 @@ size_t strspn(const char* s, const char* charset); size_t strcspn(const char* s, const char* charset); void itoa(unsigned int n, char* s, unsigned int base); -unsigned int atoi(const char* s); -long atol(const char* str); char* index(const char* p, int ch); diff --git a/src/lib/string.c b/src/lib/string.c index 2cb1e80..f6f4132 100644 --- a/src/lib/string.c +++ b/src/lib/string.c @@ -154,10 +154,9 @@ unsigned long int strtoul(const char *nptr, char **endptr, int base) } -unsigned int atoi(const char *s) +int atoi(const char *s) { - // FIXME Eigentlich ist atoi ja signed... - return (unsigned int) strtoull(s, NULL, 10); + return (int) strtoull(s, NULL, 10); } // -- 1.6.0.2 From kevin at tyndur.org Sun May 16 22:54:36 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Sun, 16 May 2010 22:54:36 +0200 Subject: [tyndur-devel] [PATCH 3/6] libc: C++-kompatibles NULL In-Reply-To: <1274043279-16362-1-git-send-email-kevin@tyndur.org> References: <1274043279-16362-1-git-send-email-kevin@tyndur.org> Message-ID: <1274043279-16362-4-git-send-email-kevin@tyndur.org> + libc: Fuer C++ muss NULL anders definiert werden Signed-off-by: Kevin Wolf --- src/include/arch/i386/stddef.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/src/include/arch/i386/stddef.h b/src/include/arch/i386/stddef.h index 0594c48..13c907d 100644 --- a/src/include/arch/i386/stddef.h +++ b/src/include/arch/i386/stddef.h @@ -31,7 +31,11 @@ #include #include +#ifndef __cplusplus #define NULL (void*) 0 +#else +#define NULL 0 +#endif typedef __SIZE_TYPE__ size_t; typedef int ptrdiff_t; -- 1.6.0.2 From kevin at tyndur.org Sun May 16 22:54:37 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Sun, 16 May 2010 22:54:37 +0200 Subject: [tyndur-devel] [PATCH 4/6] libc: localeconv nicht static inline machen In-Reply-To: <1274043279-16362-1-git-send-email-kevin@tyndur.org> References: <1274043279-16362-1-git-send-email-kevin@tyndur.org> Message-ID: <1274043279-16362-5-git-send-email-kevin@tyndur.org> * libc: C++ stoert sich am C99-Initializer, also woanders hin damit... Signed-off-by: Kevin Wolf --- src/modules/include/locale.h | 18 +-------------- src/modules/lib/posix/locale.c | 47 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 17 deletions(-) create mode 100644 src/modules/lib/posix/locale.c diff --git a/src/modules/include/locale.h b/src/modules/include/locale.h index 13af482..5a1c4c2 100644 --- a/src/modules/include/locale.h +++ b/src/modules/include/locale.h @@ -81,23 +81,7 @@ enum { /** * Gibt Informationen zur aktiven Locale zurueck */ -static inline struct lconv* localeconv(void) -{ - static struct lconv lconv = { - .decimal_point = ",", - .thousands_sep = " ", - .mon_decimal_point = ",", - .mon_thousands_sep = " ", - .int_curr_symbol = "EUR", - .currency_symbol = "EUR", - .positive_sign = "+", - .negative_sign = "-", - .p_sign_posn = 1, - .n_sign_posn = 1, - }; - - return &lconv; -}; +struct lconv* localeconv(void); /** * Aktuelles Locale anpassen. Ist locale == NULL wird nichts gemacht. diff --git a/src/modules/lib/posix/locale.c b/src/modules/lib/posix/locale.c new file mode 100644 index 0000000..96614b9 --- /dev/null +++ b/src/modules/lib/posix/locale.c @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2010 The tyndur Project. All rights reserved. + * + * This code is derived from software contributed to the tyndur Project + * by Kevin Wolf. + * + * 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. + * + * 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 + +struct lconv* localeconv(void) +{ + static struct lconv lconv = { + .decimal_point = ",", + .thousands_sep = " ", + .mon_decimal_point = ",", + .mon_thousands_sep = " ", + .int_curr_symbol = "EUR", + .currency_symbol = "EUR", + .positive_sign = "+", + .negative_sign = "-", + .p_sign_posn = 1, + .n_sign_posn = 1, + }; + + return &lconv; +} -- 1.6.0.2 From kevin at tyndur.org Sun May 16 22:54:38 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Sun, 16 May 2010 22:54:38 +0200 Subject: [tyndur-devel] [PATCH 5/6] libc: Deklaration von mktemp/mkstemp gefixt In-Reply-To: <1274043279-16362-1-git-send-email-kevin@tyndur.org> References: <1274043279-16362-1-git-send-email-kevin@tyndur.org> Message-ID: <1274043279-16362-6-git-send-email-kevin@tyndur.org> ! libc: mktemp/mkstemp gehoeren nach stdlib.h * libc: template als Parameternamen ist mit C++ ungeschickt Signed-off-by: Kevin Wolf --- src/include/stdlib.h | 7 +++++++ src/modules/include/unistd.h | 6 ------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/include/stdlib.h b/src/include/stdlib.h index 62cd49b..8475e46 100644 --- a/src/include/stdlib.h +++ b/src/include/stdlib.h @@ -247,4 +247,11 @@ long int random(void); */ void srandom(unsigned int seed); + +/// Dateinamen fuer temporaere Datei erstellen +char* mktemp(char* _template); + +/// Temporaere Datei anlegen +int mkstemp(char* _template); + #endif diff --git a/src/modules/include/unistd.h b/src/modules/include/unistd.h index 97999ac..2e2e3b5 100644 --- a/src/modules/include/unistd.h +++ b/src/modules/include/unistd.h @@ -104,12 +104,6 @@ off_t lseek(int fd, off_t offset, int whence); /// Unix-Datei schliessen int close(int fd); -/// Dateinamen fuer temporaere Datei erstellen -char* mktemp(char* template); - -/// Temporaere Datei anlegen -int mkstemp(char* template); - /// In eine Datei mit gegebenem Offset lesen ssize_t pread(int fd, void *buf, size_t count, off_t offset); -- 1.6.0.2 From kevin at tyndur.org Sun May 16 22:54:39 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Sun, 16 May 2010 22:54:39 +0200 Subject: [tyndur-devel] [PATCH 6/6] libc: Typisierungsfix fuer assert In-Reply-To: <1274043279-16362-1-git-send-email-kevin@tyndur.org> References: <1274043279-16362-1-git-send-email-kevin@tyndur.org> Message-ID: <1274043279-16362-7-git-send-email-kevin@tyndur.org> ! libc: Der Parameter fuer assert muss in C99 und C++ kein int sein Signed-off-by: Kevin Wolf --- src/modules/include/assert.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/modules/include/assert.h b/src/modules/include/assert.h index cc9a4cd..3ed64f6 100644 --- a/src/modules/include/assert.h +++ b/src/modules/include/assert.h @@ -38,6 +38,6 @@ void _assert(const char* assertion, const char* file, int line, int expression); // Das #x verwandelt x in einen String -#define assert(x) _assert(#x, __FILE__, __LINE__, x) +#define assert(x) _assert(#x, __FILE__, __LINE__, !!(x)) #endif -- 1.6.0.2 From kevin at tyndur.org Sat May 22 01:03:20 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Sat, 22 May 2010 01:03:20 +0200 Subject: [PATCH 0/2] Mehr C++-Kompatibilität Message-ID: <1274483002-28871-1-git-send-email-kevin@tyndur.org> Nochmal zwei Patches, die benötigt werden, damit libstd++ gebaut werden kann und ein funktionierndes Hello World oder bochs zustandebringt. Kevin Wolf (2): libc: extern "C" in Headerdateien libc: Konstruktoren buildmk.sh | 6 +++++- src/include/setjmp.h | 9 +++++++++ src/include/stdlib.h | 8 ++++++++ src/include/string.h | 9 +++++++++ src/modules/c/build/Makefile.all | 2 +- src/modules/c/calc/Makefile.all | 2 +- src/modules/c/desktop/Makefile.all | 2 +- src/modules/c/fdisk/Makefile.all | 2 +- src/modules/c/ftp/Makefile.all | 2 +- src/modules/c/getterm/Makefile.all | 2 +- src/modules/c/mousetest/Makefile.all | 2 +- src/modules/c/shell/Makefile.all | 4 ++-- src/modules/c/vm86test/Makefile.all | 2 +- src/modules/cdi/ata/Makefile.all | 2 +- src/modules/cdi/e1000/Makefile.all | 2 +- src/modules/cdi/ext2/Makefile.all | 2 +- src/modules/cdi/floppy/Makefile.all | 2 +- src/modules/cdi/iso9660/Makefile.all | 2 +- src/modules/cdi/ne2k/Makefile.all | 2 +- src/modules/cdi/pcnet/Makefile.all | 2 +- src/modules/cdi/ramdisk/Makefile.all | 2 +- src/modules/cdi/rtl8139/Makefile.all | 2 +- src/modules/cdi/serial/Makefile.all | 2 +- src/modules/cdi/sis900/Makefile.all | 2 +- src/modules/cmos/Makefile.all | 2 +- src/modules/console/Makefile.all | 2 +- src/modules/dma/Makefile.all | 2 +- src/modules/fat/Makefile.all | 2 +- src/modules/file/Makefile.all | 2 +- src/modules/floppy/Makefile.all | 2 +- src/modules/gui/Makefile.all | 2 +- src/modules/include/arpa/inet.h | 9 +++++++++ src/modules/include/assert.h | 9 +++++++++ src/modules/include/math.h | 8 ++++++++ src/modules/include/netdb.h | 8 ++++++++ src/modules/include/signal.h | 9 +++++++-- src/modules/include/stdio.h | 7 +++++++ src/modules/include/sys/socket.h | 9 +++++++++ src/modules/include/time.h | 8 ++++++++ src/modules/include/unistd.h | 9 +++++++++ src/modules/init/Makefile.all | 2 +- src/modules/kbc/Makefile.all | 2 +- src/modules/lib/crt0.c | 16 ++++++++++++++++ src/modules/pas/kedit/Makefile.all | 2 +- src/modules/pas/kirc/Makefile.all | 2 +- src/modules/pas/lpt/Makefile.all | 2 +- src/modules/pas/pashello/Makefile.all | 2 +- src/modules/pas/setup/Makefile.all | 2 +- src/modules/pas/tdx/Makefile.all | 2 +- src/modules/pci/Makefile.all | 2 +- src/modules/ramoverlay/Makefile.all | 2 +- src/modules/rpcbench/Makefile.all | 2 +- src/modules/servmgr/Makefile.all | 2 +- src/modules/skeleton/Makefile.all | 2 +- src/modules/speaker/Makefile.all | 2 +- src/modules/sysinfo/Makefile.all | 2 +- src/modules/tcpip/Makefile.all | 2 +- src/modules/testlib/Makefile.all | 2 +- src/modules/tmp/Makefile.all | 2 +- src/modules/vesa/Makefile.all | 2 +- src/modules/vga/Makefile.all | 2 +- src/modules/vterm/Makefile.all | 2 +- 62 files changed, 170 insertions(+), 52 deletions(-) From kevin at tyndur.org Sat May 22 01:03:21 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Sat, 22 May 2010 01:03:21 +0200 Subject: [tyndur-devel] [PATCH 1/2] libc: extern "C" in Headerdateien In-Reply-To: <1274483002-28871-1-git-send-email-kevin@tyndur.org> References: <1274483002-28871-1-git-send-email-kevin@tyndur.org> Message-ID: <1274483002-28871-2-git-send-email-kevin@tyndur.org> * libc: Headerdateien fuer C++ brauchbar machen Signed-off-by: Kevin Wolf --- src/include/setjmp.h | 9 +++++++++ src/include/stdlib.h | 8 ++++++++ src/include/string.h | 9 +++++++++ src/modules/include/arpa/inet.h | 9 +++++++++ src/modules/include/assert.h | 9 +++++++++ src/modules/include/math.h | 8 ++++++++ src/modules/include/netdb.h | 8 ++++++++ src/modules/include/signal.h | 9 +++++++-- src/modules/include/stdio.h | 7 +++++++ src/modules/include/sys/socket.h | 9 +++++++++ src/modules/include/time.h | 8 ++++++++ src/modules/include/unistd.h | 9 +++++++++ 12 files changed, 100 insertions(+), 2 deletions(-) diff --git a/src/include/setjmp.h b/src/include/setjmp.h index 18f91e5..bc47809 100644 --- a/src/include/setjmp.h +++ b/src/include/setjmp.h @@ -32,7 +32,16 @@ typedef uintptr_t jmp_buf[9]; + +#ifdef __cplusplus +extern "C" { +#endif + int setjmp(jmp_buf env); void longjmp(jmp_buf env, int value); +#ifdef __cplusplus +}; // extern "C" +#endif + #endif diff --git a/src/include/stdlib.h b/src/include/stdlib.h index 8475e46..d56d879 100644 --- a/src/include/stdlib.h +++ b/src/include/stdlib.h @@ -40,6 +40,10 @@ /** Maximale laenge eines Multibyte-Zeichens in Bytes */ #define MB_CUR_MAX 4 +#ifdef __cplusplus +extern "C" { +#endif + void exit(int result); void abort(void); int atexit(void (*function)(void)); @@ -254,4 +258,8 @@ char* mktemp(char* _template); /// Temporaere Datei anlegen int mkstemp(char* _template); +#ifdef __cplusplus +}; // extern "C" +#endif + #endif diff --git a/src/include/string.h b/src/include/string.h index e530689..5f71088 100644 --- a/src/include/string.h +++ b/src/include/string.h @@ -28,8 +28,13 @@ #ifndef _STRING_H_ #define _STRING_H_ + #include +#ifdef __cplusplus +extern "C" { +#endif + void* memcpy(void* dest, const void* src, size_t num); void* memccpy(void* dest, const void* src, int c, size_t num); void* memmove(void* dest, const void* src, size_t num); @@ -82,5 +87,9 @@ int strncasecmp(const char* s1, const char* s2, size_t n); int strcoll(const char* s1, const char* s2); +#ifdef __cplusplus +}; // extern "C" +#endif + #endif /* ndef _STRING_H */ diff --git a/src/modules/include/arpa/inet.h b/src/modules/include/arpa/inet.h index 8224bf0..4689df6 100644 --- a/src/modules/include/arpa/inet.h +++ b/src/modules/include/arpa/inet.h @@ -31,6 +31,11 @@ #include + +#ifdef __cplusplus +extern "C" { +#endif + unsigned long int htonl(unsigned long int hostlong); unsigned short int htons(unsigned short int hostshort); unsigned long int ntohl(unsigned long int netlong); @@ -78,5 +83,9 @@ int inet_pton(int family, const char* src, void* dst); */ const char *inet_ntop(int family, const void* src, char* dst, socklen_t size); +#ifdef __cplusplus +}; // extern "C" +#endif + #endif diff --git a/src/modules/include/assert.h b/src/modules/include/assert.h index 3ed64f6..87acd4e 100644 --- a/src/modules/include/assert.h +++ b/src/modules/include/assert.h @@ -31,6 +31,10 @@ #undef assert #endif +#ifdef __cplusplus +extern "C" { +#endif + #ifdef NDEBUG #define assert(x) ((void) 0) #else @@ -39,5 +43,10 @@ void _assert(const char* assertion, const char* file, int line, // Das #x verwandelt x in einen String #define assert(x) _assert(#x, __FILE__, __LINE__, !!(x)) + +#ifdef __cplusplus +}; // extern "C" +#endif + #endif diff --git a/src/modules/include/math.h b/src/modules/include/math.h index 486e21e..207fd3d 100644 --- a/src/modules/include/math.h +++ b/src/modules/include/math.h @@ -50,6 +50,10 @@ #define M_SQRT1_2 0.70710678118654752440 +#ifdef __cplusplus +extern "C" { +#endif + double tan(double); float tanf(float); long double tanl(long double); @@ -113,5 +117,9 @@ long double nearbyintl(long double x); double rint(double x); double pow(double x, double y); +#ifdef __cplusplus +}; // extern "C" +#endif + #endif diff --git a/src/modules/include/netdb.h b/src/modules/include/netdb.h index feb0ba2..f65c5f0 100644 --- a/src/modules/include/netdb.h +++ b/src/modules/include/netdb.h @@ -55,6 +55,11 @@ struct protoent { int p_proto; }; + +#ifdef __cplusplus +extern "C" { +#endif + struct hostent* gethostbyname(const char* name); /** @@ -97,6 +102,9 @@ const char* hstrerror(int error); */ void herror(const char* str); +#ifdef __cplusplus +}; // extern "C" +#endif #endif diff --git a/src/modules/include/signal.h b/src/modules/include/signal.h index 4c6f9de..4f5ebd7 100644 --- a/src/modules/include/signal.h +++ b/src/modules/include/signal.h @@ -109,6 +109,10 @@ typedef uint32_t sig_atomic_t; +#ifdef __cplusplus +extern "C" { +#endif + // Gehoert nach Spezifikation da nicht rein. void _signal_default_handler(int signal); @@ -209,8 +213,9 @@ int raise(int signal); int kill(pid_t pid, int signal); - - +#ifdef __cplusplus +}; // extern "C" +#endif #endif // ifndef _SIGNAL_H_ diff --git a/src/modules/include/stdio.h b/src/modules/include/stdio.h index a4d3bb3..b5f34f4 100644 --- a/src/modules/include/stdio.h +++ b/src/modules/include/stdio.h @@ -54,6 +54,9 @@ extern FILE* stdin; extern FILE* stdout; extern FILE* stderr; +#ifdef __cplusplus +extern "C" { +#endif int putc(int c, FILE *stream); int putchar(int c); @@ -129,4 +132,8 @@ int rename(const char *oldpath, const char *newpath); /// benutzen zu koennen int fileno(FILE* io_res); +#ifdef __cplusplus +}; // extern "C" +#endif + #endif diff --git a/src/modules/include/sys/socket.h b/src/modules/include/sys/socket.h index 90c7e15..e768524 100644 --- a/src/modules/include/sys/socket.h +++ b/src/modules/include/sys/socket.h @@ -82,6 +82,11 @@ enum { IPPROTO_RAW, }; + +#ifdef __cplusplus +extern "C" { +#endif + /** * Erstellt einen Socket * @@ -173,4 +178,8 @@ int listen(int sock, int backlog); */ int accept(int sock, struct sockaddr* address, socklen_t* address_len); +#ifdef __cplusplus +}; // extern "C" +#endif + #endif diff --git a/src/modules/include/time.h b/src/modules/include/time.h index 3fcf5d0..9ba6cdb 100644 --- a/src/modules/include/time.h +++ b/src/modules/include/time.h @@ -44,6 +44,10 @@ struct tm { }; +#ifdef __cplusplus +extern "C" { +#endif + time_t time(time_t* t); /// Timestamp in tm-Struct einfuellen @@ -65,5 +69,9 @@ char* asctime(const struct tm* time_ptr); time_t mktime(struct tm* time_ptr); #endif +#ifdef __cplusplus +}; // extern "C" +#endif + #endif diff --git a/src/modules/include/unistd.h b/src/modules/include/unistd.h index 2e2e3b5..8c5e3ed 100644 --- a/src/modules/include/unistd.h +++ b/src/modules/include/unistd.h @@ -47,6 +47,11 @@ int isatty(int desc); #endif + +#ifdef __cplusplus +extern "C" { +#endif + /// PID des aktuellen Prozesses auslesen pid_t getpid(void); @@ -165,5 +170,9 @@ int gethostname(char* buf, size_t len); #endif +#ifdef __cplusplus +}; // extern "C" +#endif + #endif -- 1.6.0.2 From kevin at tyndur.org Sat May 22 01:03:22 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Sat, 22 May 2010 01:03:22 +0200 Subject: [tyndur-devel] [PATCH 2/2] libc: Konstruktoren In-Reply-To: <1274483002-28871-1-git-send-email-kevin@tyndur.org> References: <1274483002-28871-1-git-send-email-kevin@tyndur.org> Message-ID: <1274483002-28871-3-git-send-email-kevin@tyndur.org> + libc: Beim Start werden Konstruktoren aufgerufen + Linkerskript fuer Userspace-Programme * Alle Programme auf das neue Linkerskript umgestellt Signed-off-by: Kevin Wolf --- buildmk.sh | 6 +++++- src/modules/c/build/Makefile.all | 2 +- src/modules/c/calc/Makefile.all | 2 +- src/modules/c/desktop/Makefile.all | 2 +- src/modules/c/fdisk/Makefile.all | 2 +- src/modules/c/ftp/Makefile.all | 2 +- src/modules/c/getterm/Makefile.all | 2 +- src/modules/c/mousetest/Makefile.all | 2 +- src/modules/c/shell/Makefile.all | 4 ++-- src/modules/c/vm86test/Makefile.all | 2 +- src/modules/cdi/ata/Makefile.all | 2 +- src/modules/cdi/e1000/Makefile.all | 2 +- src/modules/cdi/ext2/Makefile.all | 2 +- src/modules/cdi/floppy/Makefile.all | 2 +- src/modules/cdi/iso9660/Makefile.all | 2 +- src/modules/cdi/ne2k/Makefile.all | 2 +- src/modules/cdi/pcnet/Makefile.all | 2 +- src/modules/cdi/ramdisk/Makefile.all | 2 +- src/modules/cdi/rtl8139/Makefile.all | 2 +- src/modules/cdi/serial/Makefile.all | 2 +- src/modules/cdi/sis900/Makefile.all | 2 +- src/modules/cmos/Makefile.all | 2 +- src/modules/console/Makefile.all | 2 +- src/modules/dma/Makefile.all | 2 +- src/modules/fat/Makefile.all | 2 +- src/modules/file/Makefile.all | 2 +- src/modules/floppy/Makefile.all | 2 +- src/modules/gui/Makefile.all | 2 +- src/modules/init/Makefile.all | 2 +- src/modules/kbc/Makefile.all | 2 +- src/modules/lib/crt0.c | 16 ++++++++++++++++ src/modules/pas/kedit/Makefile.all | 2 +- src/modules/pas/kirc/Makefile.all | 2 +- src/modules/pas/lpt/Makefile.all | 2 +- src/modules/pas/pashello/Makefile.all | 2 +- src/modules/pas/setup/Makefile.all | 2 +- src/modules/pas/tdx/Makefile.all | 2 +- src/modules/pci/Makefile.all | 2 +- src/modules/ramoverlay/Makefile.all | 2 +- src/modules/rpcbench/Makefile.all | 2 +- src/modules/servmgr/Makefile.all | 2 +- src/modules/skeleton/Makefile.all | 2 +- src/modules/speaker/Makefile.all | 2 +- src/modules/sysinfo/Makefile.all | 2 +- src/modules/tcpip/Makefile.all | 2 +- src/modules/testlib/Makefile.all | 2 +- src/modules/tmp/Makefile.all | 2 +- src/modules/vesa/Makefile.all | 2 +- src/modules/vga/Makefile.all | 2 +- src/modules/vterm/Makefile.all | 2 +- 50 files changed, 70 insertions(+), 50 deletions(-) diff --git a/buildmk.sh b/buildmk.sh index 4e3cd85..8665913 100644 --- a/buildmk.sh +++ b/buildmk.sh @@ -72,6 +72,10 @@ if [ -d lib ]; then LIBDIRS="`pwd`/lib/library.a $LIBDIRS" fi +if [ -f "user-$LOST_ARCH.ld" ]; then + export LDSCRIPT="-T `pwd`/user-$LOST_ARCH.ld" +fi + CC_FLAGS= CC_FLAGS_APPEND= if [ -f Makefile.conf ]; then @@ -109,7 +113,7 @@ EOF fi if [ -f Makefile.all ]; then - echo -e \\tLOST_BUILDMK_ROOT="$LOST_BUILDMK_ROOT" bash Makefile.all '$(BUILD_ROOT)' \'$LIBDIRS $LIB_GCC\' \'$LOST_BUILDMK_ROOT\' >> Makefile + echo -e \\tLOST_BUILDMK_ROOT="$LOST_BUILDMK_ROOT" LDSCRIPT="'$LDSCRIPT'" bash Makefile.all '$(BUILD_ROOT)' \'$LIBDIRS $LIB_GCC\' \'$LOST_BUILDMK_ROOT\' >> Makefile fi cat <> Makefile diff --git a/src/modules/c/build/Makefile.all b/src/modules/c/build/Makefile.all index 8c9b17a..9c2a821 100644 --- a/src/modules/c/build/Makefile.all +++ b/src/modules/c/build/Makefile.all @@ -3,5 +3,5 @@ source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/apps/build" -$LOST_TOOLS_LD -obuild -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -obuild $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s build -o $1/apps/build diff --git a/src/modules/c/calc/Makefile.all b/src/modules/c/calc/Makefile.all index 84347dd..5c8b02b 100644 --- a/src/modules/c/calc/Makefile.all +++ b/src/modules/c/calc/Makefile.all @@ -2,6 +2,6 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/apps/calc" -$LOST_TOOLS_LD -ocalc -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -ocalc $LDSCRIPT *.o --start-group $2 --end-group mv calc $1/apps/ diff --git a/src/modules/c/desktop/Makefile.all b/src/modules/c/desktop/Makefile.all index 510cb6e..1d4986c 100644 --- a/src/modules/c/desktop/Makefile.all +++ b/src/modules/c/desktop/Makefile.all @@ -3,7 +3,7 @@ source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/apps/desktop" -$LOST_TOOLS_LD -odesktop -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -odesktop $LDSCRIPT *.o --start-group $2 --end-group mv desktop $1/apps/ diff --git a/src/modules/c/fdisk/Makefile.all b/src/modules/c/fdisk/Makefile.all index 8c7cbb5..652266f 100644 --- a/src/modules/c/fdisk/Makefile.all +++ b/src/modules/c/fdisk/Makefile.all @@ -3,6 +3,6 @@ source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/apps/fdisk" -$LOST_TOOLS_LD -ofdisk -Ttext=0x40000000 --start-group *.o $2 --end-group +$LOST_TOOLS_LD -ofdisk $LDSCRIPT --start-group *.o $2 --end-group $LOST_TOOLS_STRIP -s fdisk -o $1/apps/fdisk diff --git a/src/modules/c/ftp/Makefile.all b/src/modules/c/ftp/Makefile.all index fb31509..54bf0d0 100644 --- a/src/modules/c/ftp/Makefile.all +++ b/src/modules/c/ftp/Makefile.all @@ -2,6 +2,6 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/apps/ftp" -$LOST_TOOLS_LD -oftp -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -oftp $LDSCRIPT *.o --start-group $2 --end-group mv ftp $1/apps/ diff --git a/src/modules/c/getterm/Makefile.all b/src/modules/c/getterm/Makefile.all index 244dc29..7375874 100644 --- a/src/modules/c/getterm/Makefile.all +++ b/src/modules/c/getterm/Makefile.all @@ -3,6 +3,6 @@ source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/apps/getterm" -$LOST_TOOLS_LD -ogetterm -Ttext=0x40000000 --start-group *.o $2 --end-group +$LOST_TOOLS_LD -ogetterm $LDSCRIPT --start-group *.o $2 --end-group $LOST_TOOLS_STRIP -s getterm -o $1/apps/getterm diff --git a/src/modules/c/mousetest/Makefile.all b/src/modules/c/mousetest/Makefile.all index 450bed8..29efae3 100644 --- a/src/modules/c/mousetest/Makefile.all +++ b/src/modules/c/mousetest/Makefile.all @@ -2,7 +2,7 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/apps/mtest" -$LOST_TOOLS_LD -omtest -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -omtest $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s mtest -o $1/apps/mtest diff --git a/src/modules/c/shell/Makefile.all b/src/modules/c/shell/Makefile.all index 2dbbc14..dcf40c0 100644 --- a/src/modules/c/shell/Makefile.all +++ b/src/modules/c/shell/Makefile.all @@ -5,9 +5,9 @@ echo "LD $1/apps/sh" if [ -z "`grep '#define CONFIG_SHELL_BUILTIN_ONLY' ../../../include/lost/config.h`" ]; then - $LOST_TOOLS_LD -osh -Ttext=0x40000000 *.o --start-group $2 --end-group + $LOST_TOOLS_LD -osh $LDSCRIPT *.o --start-group $2 --end-group else - $LOST_TOOLS_LD -osh -Ttext=0x40000000 *.o cmds/*.o --start-group $2 --end-group + $LOST_TOOLS_LD -osh $LDSCRIPT *.o cmds/*.o --start-group $2 --end-group fi $LOST_TOOLS_STRIP -s sh -o $1/apps/sh diff --git a/src/modules/c/vm86test/Makefile.all b/src/modules/c/vm86test/Makefile.all index c128e45..c6a5c36 100644 --- a/src/modules/c/vm86test/Makefile.all +++ b/src/modules/c/vm86test/Makefile.all @@ -3,6 +3,6 @@ source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/apps/vm86test" -$LOST_TOOLS_LD -ovm86test -Ttext=0x40000000 --start-group *.o $2 --end-group +$LOST_TOOLS_LD -ovm86test $LDSCRIPT --start-group *.o $2 --end-group $LOST_TOOLS_STRIP -s vm86test -o $1/apps/vm86test diff --git a/src/modules/cdi/ata/Makefile.all b/src/modules/cdi/ata/Makefile.all index 432c20c..a058b41 100644 --- a/src/modules/cdi/ata/Makefile.all +++ b/src/modules/cdi/ata/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/ata" -$LOST_TOOLS_LD -oata.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -oata.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s ata.mod -o $1/modules/ata diff --git a/src/modules/cdi/e1000/Makefile.all b/src/modules/cdi/e1000/Makefile.all index f0e1fc6..277e087 100644 --- a/src/modules/cdi/e1000/Makefile.all +++ b/src/modules/cdi/e1000/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/e1000" -$LOST_TOOLS_LD -oe1000.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -oe1000.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s e1000.mod -o $1/modules/e1000 diff --git a/src/modules/cdi/ext2/Makefile.all b/src/modules/cdi/ext2/Makefile.all index 3495a88..c08026b 100644 --- a/src/modules/cdi/ext2/Makefile.all +++ b/src/modules/cdi/ext2/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/ext2" -$LOST_TOOLS_LD -oext2.mod -Ttext=0x40000000 *.o */*.o --start-group $2 --end-group +$LOST_TOOLS_LD -oext2.mod $LDSCRIPT *.o */*.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s ext2.mod -o $1/modules/ext2 diff --git a/src/modules/cdi/floppy/Makefile.all b/src/modules/cdi/floppy/Makefile.all index 501db2b..487d74d 100644 --- a/src/modules/cdi/floppy/Makefile.all +++ b/src/modules/cdi/floppy/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/cdi_floppy" -$LOST_TOOLS_LD -ocdi_floppy.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -ocdi_floppy.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s cdi_floppy.mod -o $1/modules/cdi_floppy diff --git a/src/modules/cdi/iso9660/Makefile.all b/src/modules/cdi/iso9660/Makefile.all index fb14f69..7f747a1 100644 --- a/src/modules/cdi/iso9660/Makefile.all +++ b/src/modules/cdi/iso9660/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/iso9660" -$LOST_TOOLS_LD -oiso9660.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -oiso9660.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s iso9660.mod -o $1/modules/iso9660 diff --git a/src/modules/cdi/ne2k/Makefile.all b/src/modules/cdi/ne2k/Makefile.all index 250d3c3..1d51c21 100644 --- a/src/modules/cdi/ne2k/Makefile.all +++ b/src/modules/cdi/ne2k/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/ne2k" -$LOST_TOOLS_LD -Ttext=0x40000000 -one2k.mod *.o --start-group $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -one2k.mod *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s ne2k.mod -o $1/modules/ne2k diff --git a/src/modules/cdi/pcnet/Makefile.all b/src/modules/cdi/pcnet/Makefile.all index 4ad6890..b8937a1 100644 --- a/src/modules/cdi/pcnet/Makefile.all +++ b/src/modules/cdi/pcnet/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/pcnet" -$LOST_TOOLS_LD -Ttext=0x40000000 -opcnet.mod *.o --start-group $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -opcnet.mod *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s pcnet.mod -o $1/modules/pcnet diff --git a/src/modules/cdi/ramdisk/Makefile.all b/src/modules/cdi/ramdisk/Makefile.all index 3e03444..9c724e7 100644 --- a/src/modules/cdi/ramdisk/Makefile.all +++ b/src/modules/cdi/ramdisk/Makefile.all @@ -2,5 +2,5 @@ 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_LD -oramdisk.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s ramdisk.mod -o $1/modules/ramdisk diff --git a/src/modules/cdi/rtl8139/Makefile.all b/src/modules/cdi/rtl8139/Makefile.all index c7bfe1d..d5f64ab 100644 --- a/src/modules/cdi/rtl8139/Makefile.all +++ b/src/modules/cdi/rtl8139/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/rtl8139" -$LOST_TOOLS_LD -Ttext=0x40000000 -ortl8139.mod *.o --start-group $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -ortl8139.mod *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s rtl8139.mod -o $1/modules/rtl8139 diff --git a/src/modules/cdi/serial/Makefile.all b/src/modules/cdi/serial/Makefile.all index 2f03a04..7118ff0 100644 --- a/src/modules/cdi/serial/Makefile.all +++ b/src/modules/cdi/serial/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/serial" -$LOST_TOOLS_LD -oserial.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -oserial.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s serial.mod -o $1/modules/serial diff --git a/src/modules/cdi/sis900/Makefile.all b/src/modules/cdi/sis900/Makefile.all index 697149c..a76350e 100644 --- a/src/modules/cdi/sis900/Makefile.all +++ b/src/modules/cdi/sis900/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/sis900" -$LOST_TOOLS_LD -osis900.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -osis900.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s sis900.mod -o $1/modules/sis900 diff --git a/src/modules/cmos/Makefile.all b/src/modules/cmos/Makefile.all index 4678dfc..0c40b28 100755 --- a/src/modules/cmos/Makefile.all +++ b/src/modules/cmos/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/cmos" -$LOST_TOOLS_LD -ocmos.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -ocmos.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s cmos.mod -o $1/modules/cmos diff --git a/src/modules/console/Makefile.all b/src/modules/console/Makefile.all index 6d537f9..5fa0a43 100644 --- a/src/modules/console/Makefile.all +++ b/src/modules/console/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/console" -$LOST_TOOLS_LD -Ttext=0x40000000 -oconsole.mod *.o --start-group $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -oconsole.mod *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s console.mod -o $1/modules/console diff --git a/src/modules/dma/Makefile.all b/src/modules/dma/Makefile.all index 2c43d17..cdf2120 100644 --- a/src/modules/dma/Makefile.all +++ b/src/modules/dma/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/dma" -$LOST_TOOLS_LD -odma.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -odma.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s dma.mod -o $1/modules/dma diff --git a/src/modules/fat/Makefile.all b/src/modules/fat/Makefile.all index 850b36d..7ceec1a 100644 --- a/src/modules/fat/Makefile.all +++ b/src/modules/fat/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/fat" -$LOST_TOOLS_LD -ofat.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -ofat.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s fat.mod -o $1/modules/fat diff --git a/src/modules/file/Makefile.all b/src/modules/file/Makefile.all index d1343c6..2e344f2 100644 --- a/src/modules/file/Makefile.all +++ b/src/modules/file/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/file" -$LOST_TOOLS_LD -ofile.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -ofile.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s file.mod -o $1/modules/file diff --git a/src/modules/floppy/Makefile.all b/src/modules/floppy/Makefile.all index 79b7e71..1c14c78 100755 --- a/src/modules/floppy/Makefile.all +++ b/src/modules/floppy/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/floppy" -$LOST_TOOLS_LD -ofloppy.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -ofloppy.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s floppy.mod -o $1/modules/floppy diff --git a/src/modules/gui/Makefile.all b/src/modules/gui/Makefile.all index 59df853..6791a3d 100644 --- a/src/modules/gui/Makefile.all +++ b/src/modules/gui/Makefile.all @@ -2,7 +2,7 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/gui" -$LOST_TOOLS_LD -Ttext=0x40000000 -ogui.mod src/*.o src/freetype/base/ftbase.o src/freetype/base/ftsystem.o src/freetype/base/ftglyph.o src/freetype/base/ftbitmap.o src/freetype/base/ftinit.o src/freetype/autofit/autofit.o src/freetype/smooth/smooth.o src/freetype/psaux/psaux.o src/freetype/psnames/psnames.o src/freetype/pshinter/pshinter.o src/freetype/truetype/truetype.o src/freetype/raster/raster.o src/freetype/gzip/ftgzip.o src/freetype/lzw/ftlzw.o src/freetype/sfnt/sfnt.o --start-group $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -ogui.mod src/*.o src/freetype/base/ftbase.o src/freetype/base/ftsystem.o src/freetype/base/ftglyph.o src/freetype/base/ftbitmap.o src/freetype/base/ftinit.o src/freetype/autofit/autofit.o src/freetype/smooth/smooth.o src/freetype/psaux/psaux.o src/freetype/psnames/psnames.o src/freetype/pshinter/pshinter.o src/freetype/truetype/truetype.o src/freetype/raster/raster.o src/freetype/gzip/ftgzip.o src/freetype/lzw/ftlzw.o src/freetype/sfnt/sfnt.o --start-group $2 --end-group mv gui.mod $1/modules/gui #Andere Formate (in def ftmodule.h aktivieren): #src/freetype/type42/type42.o diff --git a/src/modules/init/Makefile.all b/src/modules/init/Makefile.all index 13c03f2..3d50e8f 100644 --- a/src/modules/init/Makefile.all +++ b/src/modules/init/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/init" -$LOST_TOOLS_LD -Ttext=0x40000000 -oinit.mod *.o */*.o --start-group $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -oinit.mod *.o */*.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s init.mod -o $1/modules/init diff --git a/src/modules/kbc/Makefile.all b/src/modules/kbc/Makefile.all index 98dedb9..92bb1a1 100644 --- a/src/modules/kbc/Makefile.all +++ b/src/modules/kbc/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/kbc" -$LOST_TOOLS_LD -m elf_i386 -okbc.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -m elf_i386 -okbc.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s kbc.mod -o $1/modules/kbc diff --git a/src/modules/lib/crt0.c b/src/modules/lib/crt0.c index 615baf9..4c3192d 100644 --- a/src/modules/lib/crt0.c +++ b/src/modules/lib/crt0.c @@ -39,6 +39,21 @@ extern void init_envvars(void); extern void init_waitpid(void); extern void stdio_init(void); +extern void (*__ctor_start__)(void); +extern void (*__ctor_end__)(void); + +static void call_constructors(void) +{ + void (**f)(void); + + for (f = &__ctor_start__; f < &__ctor_end__; f++) { + /* Dummy-Eintrag aus crtbegin.o ueberspringen */ + if (*f && ((uintptr_t) *f != 0xffffffff)) { + (*f)(); + } + } +} + void __attribute__((weak)) _start(void) { //v(); @@ -87,6 +102,7 @@ void __attribute__((weak)) _start(void) } argv[argc] = NULL; + call_constructors(); int result = main(argc, argv); // Falls ein Buffer auf stdout eingerichtet wurde, wird der geflusht und diff --git a/src/modules/pas/kedit/Makefile.all b/src/modules/pas/kedit/Makefile.all index 7f4d2d0..03cb164 100644 --- a/src/modules/pas/kedit/Makefile.all +++ b/src/modules/pas/kedit/Makefile.all @@ -1,4 +1,4 @@ shopt -s extglob echo "LD $1/kedit" -"$COMPILER_PREFIX"ld -m elf_i386 -okedit -Ttext=0x40000000 *.o lang/*.o --start-group ../lib/units/*.a $2 --end-group `gcc -print-libgcc-file-name` +"$COMPILER_PREFIX"ld -m elf_i386 -okedit $LDSCRIPT *.o lang/*.o --start-group ../lib/units/*.a $2 --end-group `gcc -print-libgcc-file-name` strip -s kedit -o $1/apps/kedit diff --git a/src/modules/pas/kirc/Makefile.all b/src/modules/pas/kirc/Makefile.all index 2c84acc..b934084 100644 --- a/src/modules/pas/kirc/Makefile.all +++ b/src/modules/pas/kirc/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/apps/kirc" -$LOST_TOOLS_LD -okirc -Ttext=0x40000000 *.o --start-group ../lib/units/*.a $2 --end-group +$LOST_TOOLS_LD -okirc $LDSCRIPT *.o --start-group ../lib/units/*.a $2 --end-group $LOST_TOOLS_STRIP -s kirc -o $1/apps/kirc diff --git a/src/modules/pas/lpt/Makefile.all b/src/modules/pas/lpt/Makefile.all index c4078d2..22840bc 100644 --- a/src/modules/pas/lpt/Makefile.all +++ b/src/modules/pas/lpt/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/apps/lpt" -$LOST_TOOLS_LD -olpt.mod -Ttext=0x40000000 *.o lang/*.o --start-group ../lib/units/*.a $2 --end-group +$LOST_TOOLS_LD -olpt.mod $LDSCRIPT *.o lang/*.o --start-group ../lib/units/*.a $2 --end-group $LOST_TOOLS_STRIP -s lpt.mod -o $1/apps/lpt diff --git a/src/modules/pas/pashello/Makefile.all b/src/modules/pas/pashello/Makefile.all index 6fece97..27a3a02 100644 --- a/src/modules/pas/pashello/Makefile.all +++ b/src/modules/pas/pashello/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/apps/pashello" -$LOST_TOOLS_LD -opashello -Ttext=0x40000000 *.o --start-group ../lib/units/*.a $2 --end-group +$LOST_TOOLS_LD -opashello $LDSCRIPT *.o --start-group ../lib/units/*.a $2 --end-group $LOST_TOOLS_STRIP -s pashello -o $1/apps/pashello diff --git a/src/modules/pas/setup/Makefile.all b/src/modules/pas/setup/Makefile.all index 29fea51..1b1b1be 100644 --- a/src/modules/pas/setup/Makefile.all +++ b/src/modules/pas/setup/Makefile.all @@ -1,4 +1,4 @@ shopt -s extglob echo "LD $1/setup" -"$COMPILER_PREFIX"ld -m elf_i386 -osetup -Ttext=0x40000000 *.o lang/*.o --start-group ../lib/units/*.a $2 --end-group `gcc -print-libgcc-file-name` +"$COMPILER_PREFIX"ld -m elf_i386 -osetup $LDSCRIPT *.o lang/*.o --start-group ../lib/units/*.a $2 --end-group `gcc -print-libgcc-file-name` strip -s setup -o $1/apps/setup diff --git a/src/modules/pas/tdx/Makefile.all b/src/modules/pas/tdx/Makefile.all index 5b05399..11da9eb 100644 --- a/src/modules/pas/tdx/Makefile.all +++ b/src/modules/pas/tdx/Makefile.all @@ -1,4 +1,4 @@ shopt -s extglob echo "LD $1/tdx" -"$COMPILER_PREFIX"ld -m elf_i386 -otdx -Ttext=0x40000000 *.o --start-group ../lib/units/*.a $2 --end-group `gcc -print-libgcc-file-name` +"$COMPILER_PREFIX"ld -m elf_i386 -otdx $LDSCRIPT *.o --start-group ../lib/units/*.a $2 --end-group `gcc -print-libgcc-file-name` strip -s tdx -o $1/apps/tdx diff --git a/src/modules/pci/Makefile.all b/src/modules/pci/Makefile.all index a216d0c..a2fb264 100644 --- a/src/modules/pci/Makefile.all +++ b/src/modules/pci/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/pci" -$LOST_TOOLS_LD -opci.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -opci.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s pci.mod -o $1/modules/pci diff --git a/src/modules/ramoverlay/Makefile.all b/src/modules/ramoverlay/Makefile.all index 8eacb97..d93ef54 100644 --- a/src/modules/ramoverlay/Makefile.all +++ b/src/modules/ramoverlay/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/ramoverlay" -$LOST_TOOLS_LD -Ttext=0x40000000 -oramoverlay.mod *.o --start-group $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -oramoverlay.mod *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s ramoverlay.mod -o $1/modules/ramoverlay diff --git a/src/modules/rpcbench/Makefile.all b/src/modules/rpcbench/Makefile.all index 1c47c42..6a4a465 100644 --- a/src/modules/rpcbench/Makefile.all +++ b/src/modules/rpcbench/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/rpcbench" -$LOST_TOOLS_LD -Ttext=0x40000000 -orpcbench.mod --start-group *.o $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -orpcbench.mod --start-group *.o $2 --end-group $LOST_TOOLS_STRIP -s rpcbench.mod -o $1/modules/rpcbench diff --git a/src/modules/servmgr/Makefile.all b/src/modules/servmgr/Makefile.all index 4a276b2..59b7be6 100644 --- a/src/modules/servmgr/Makefile.all +++ b/src/modules/servmgr/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/servmgr" -$LOST_TOOLS_LD -Ttext=0x40000000 -oservmgr.mod *.o --start-group $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -oservmgr.mod *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s servmgr.mod -o $1/modules/servmgr diff --git a/src/modules/skeleton/Makefile.all b/src/modules/skeleton/Makefile.all index ebf4abc..ef77ae3 100644 --- a/src/modules/skeleton/Makefile.all +++ b/src/modules/skeleton/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/skeleton" -$LOST_TOOLS_LD -Ttext=0x40000000 -oskeleton.mod *.o --start-group $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -oskeleton.mod *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s skeleton.mod -o $1/modules/skeleton diff --git a/src/modules/speaker/Makefile.all b/src/modules/speaker/Makefile.all index 4f8ce8e..186dcbf 100644 --- a/src/modules/speaker/Makefile.all +++ b/src/modules/speaker/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/speaker" -$LOST_TOOLS_LD -Ttext=0x40000000 -ospeaker.mod *.o --start-group $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -ospeaker.mod *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s speaker.mod -o $1/modules/speaker diff --git a/src/modules/sysinfo/Makefile.all b/src/modules/sysinfo/Makefile.all index 8eda0b4..0a4aa9d 100644 --- a/src/modules/sysinfo/Makefile.all +++ b/src/modules/sysinfo/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/sysinfo" -$LOST_TOOLS_LD -Ttext=0x40000000 -osysinfo.mod *.o --start-group $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -osysinfo.mod *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s sysinfo.mod -o $1/modules/sysinfo diff --git a/src/modules/tcpip/Makefile.all b/src/modules/tcpip/Makefile.all index d1e355f..ea8e4e4 100644 --- a/src/modules/tcpip/Makefile.all +++ b/src/modules/tcpip/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/tcpip" -$LOST_TOOLS_LD -Ttext=0x40000000 -otcpip.mod *.o --start-group $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -otcpip.mod *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s tcpip.mod -o $1/modules/tcpip diff --git a/src/modules/testlib/Makefile.all b/src/modules/testlib/Makefile.all index 89e888d..4500c64 100644 --- a/src/modules/testlib/Makefile.all +++ b/src/modules/testlib/Makefile.all @@ -2,6 +2,6 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/tests" -$LOST_TOOLS_LD -otests.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -otests.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s tests.mod -o $1/modules/tests diff --git a/src/modules/tmp/Makefile.all b/src/modules/tmp/Makefile.all index d3aa060..81fe3eb 100755 --- a/src/modules/tmp/Makefile.all +++ b/src/modules/tmp/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/tmp" -$LOST_TOOLS_LD -otmp.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -otmp.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s tmp.mod -o $1/modules/tmp diff --git a/src/modules/vesa/Makefile.all b/src/modules/vesa/Makefile.all index ec59a0e..2d4ace1 100644 --- a/src/modules/vesa/Makefile.all +++ b/src/modules/vesa/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/vesa" -$LOST_TOOLS_LD -Ttext=0x40000000 -ovesa.mod *.o --start-group $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -ovesa.mod *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s vesa.mod -o $1/modules/vesa diff --git a/src/modules/vga/Makefile.all b/src/modules/vga/Makefile.all index 767707f..599af71 100644 --- a/src/modules/vga/Makefile.all +++ b/src/modules/vga/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/vga" -$LOST_TOOLS_LD -Ttext=0x40000000 -ovga.mod *.o --start-group $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -ovga.mod *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s vga.mod -o $1/modules/vga diff --git a/src/modules/vterm/Makefile.all b/src/modules/vterm/Makefile.all index a987d5c..9bafcce 100644 --- a/src/modules/vterm/Makefile.all +++ b/src/modules/vterm/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/vterm" -$LOST_TOOLS_LD -Ttext=0x40000000 -ovterm.mod *.o keymaps/de.o --start-group $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -ovterm.mod *.o keymaps/de.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s vterm.mod -o $1/modules/vterm -- 1.6.0.2 From toni at tyndur.org Sat May 22 11:17:10 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sat, 22 May 2010 11:17:10 +0200 Subject: [tyndur-devel] [PATCH 1/4] init: devmgr In-Reply-To: <1273765834-15957-2-git-send-email-kevin@tyndur.org> References: <1273765834-15957-1-git-send-email-kevin@tyndur.org> <1273765834-15957-2-git-send-email-kevin@tyndur.org> Message-ID: <20100522091709.GA27329@neo.geekcave.lan> On Thu, May 13 17:50, Kevin Wolf wrote: > + init: Systemweit zentrale Verwaltung von Geraeten, damit sich > unterschiedliche Treiber koordinieren koennen > > Signed-off-by: Kevin Wolf > --- > src/modules/include/init.h | 10 ++++ > src/modules/init/devmgr.c | 98 ++++++++++++++++++++++++++++++++++++++++++++ > src/modules/init/init.c | 6 +++ > src/modules/lib/init.c | 20 +++++++++ > 4 files changed, 134 insertions(+), 0 deletions(-) > create mode 100644 src/modules/init/devmgr.c > > diff --git a/src/modules/include/init.h b/src/modules/include/init.h > index 325a7b4..aa18fd5 100644 > --- a/src/modules/include/init.h > +++ b/src/modules/include/init.h > @@ -63,5 +63,15 @@ pid_t init_execute(const char* cmd); > > #endif > > +struct init_dev_desc { > + char name[64]; > + int type; > + size_t bus_data_size; > + uint8_t bus_data[]; > +}; > + > +int init_dev_register(struct init_dev_desc* dev, size_t size); > +int init_dev_list(struct init_dev_desc** devs); > + > #endif > > diff --git a/src/modules/init/devmgr.c b/src/modules/init/devmgr.c > new file mode 100644 > index 0000000..42adc92 > --- /dev/null > +++ b/src/modules/init/devmgr.c > @@ -0,0 +1,98 @@ > +/* > + * Copyright (c) 2010 The tyndur Project. All rights reserved. > + * > + * This code is derived from software contributed to the tyndur Project > + * by Kevin Wolf. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * 3. All advertising materials mentioning features or use of this software > + * must display the following acknowledgement: > + * This product includes software developed by the tyndur Project > + * and its contributors. > + * 4. Neither the name of the tyndur Project nor the names of its > + * contributors may be used to endorse or promote products derived > + * from this software without specific prior written permission. > + * > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS > + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED > + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR > + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR > + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, > + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, > + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; > + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, > + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR > + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF > + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > + */ > +#include > +#include > +#include > +#include > +#include > + > +struct device { > + struct init_dev_desc* public; > +}; > + > +list_t* devices = NULL; > + > +void rpc_dev_register(pid_t pid, dword cid, size_t size, void* data) > +{ > + struct init_dev_desc* desc; > + struct device* dev; > + > + if (size < sizeof(struct init_dev_desc)) { > + rpc_send_int_response(pid, cid, -1); > + return; > + } > + > + desc = data; > + if (size != desc->bus_data_size + sizeof(struct init_dev_desc)) { > + rpc_send_int_response(pid, cid, -1); > + return; > + } > + > + desc = malloc(size); > + memcpy(desc, data, size); > + desc->name[sizeof(desc->name) - 1] = '\0'; > + > + dev = malloc(sizeof(*dev)); > + dev->public = desc; > + > + if (devices == NULL) { > + devices = list_create(); > + } > + > + list_push(devices, dev); > + rpc_send_int_response(pid, cid, 0); > +} > + > +void rpc_dev_list(pid_t pid, dword cid, size_t size, void* data) > +{ > + size_t bytes = 0; > + int i; > + struct device* dev; > + Müsstest du hier nicht noch mindestens ein p/v-Paar einbauen? > + for (i = 0; (dev = list_get_element_at(devices, i)); i++) { > + bytes += dev->public->bus_data_size + sizeof(struct init_dev_desc); > + } > + > + uint8_t buf[bytes]; > + size_t pos = 0; > + > + for (i = 0; (dev = list_get_element_at(devices, i)); i++) { > + size_t s = dev->public->bus_data_size + sizeof(struct init_dev_desc); > + memcpy(&buf[pos], dev->public, s); > + pos += s; > + } > + > + rpc_send_response(pid, cid, bytes, (char*) buf); > +} > diff --git a/src/modules/init/init.c b/src/modules/init/init.c > index 475d602..e5fbbdb 100644 > --- a/src/modules/init/init.c > +++ b/src/modules/init/init.c > @@ -75,6 +75,9 @@ void rpc_loadelf(pid_t pid, dword correlation_id, size_t data_size, void* data); > > void rpc_reopen_stdio(pid_t pid, dword cid, size_t size, void* data); > > +void rpc_dev_register(pid_t pid, dword cid, size_t size, void* data); > +void rpc_dev_list(pid_t pid, dword cid, size_t size, void* data); > + > void load_modules(init_module_list_t* modules); > bool load_single_module(Elf32_Ehdr* elf_header, char* args, pid_t parent_pid); > bool start_program(char* path, char* args, pid_t parent_pid); > @@ -168,6 +171,9 @@ void _start(dword modules) > > register_message_handler("UP_STDIO", &rpc_reopen_stdio); > > + register_message_handler("DEV_REG ", &rpc_dev_register); > + register_message_handler("DEV_LIST", &rpc_dev_list); > + > io_init(); > > > diff --git a/src/modules/lib/init.c b/src/modules/lib/init.c > index 3759114..1451e80 100644 > --- a/src/modules/lib/init.c > +++ b/src/modules/lib/init.c > @@ -175,3 +175,23 @@ pid_t init_execute(const char* cmd) > return pid; > } > > +int init_dev_register(struct init_dev_desc* dev, size_t size) > +{ > + return rpc_get_int(1, "DEV_REG ", size, (char*) dev); > +} > + > +int init_dev_list(struct init_dev_desc** devs) > +{ > + int res; > + response_t* response = rpc_get_response(1, "DEV_LIST", 0, NULL); > + > + if (response == 0) { > + return -1; > + } > + > + *devs = response->data; > + res = response->data_length; > + free(response); > + > + return res; > +} > -- > 1.6.0.2 Sonst sieht das gut aus. Acked-by: Antoine Kaufmann -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 198 bytes Beschreibung: nicht verfügbar URL : From toni at tyndur.org Sat May 22 14:20:54 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sat, 22 May 2010 14:20:54 +0200 Subject: [tyndur-devel] [PATCH 2/4] pci: Geraete bei init registrieren In-Reply-To: <1273765834-15957-3-git-send-email-kevin@tyndur.org> References: <1273765834-15957-1-git-send-email-kevin@tyndur.org> <1273765834-15957-3-git-send-email-kevin@tyndur.org> Message-ID: <20100522122054.GB27329@neo.geekcave.lan> On Thu, May 13 17:50, Kevin Wolf wrote: > + pci: Alle PCI-Geraete werden bei init registriert > > Signed-off-by: Kevin Wolf Bei den Klassennummern vertraue ich mal darauf, dass du die richtig abgetippt hast, und sonst sieht das gut aus. ;-) Acked-by: Antoine Kaufmann -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 198 bytes Beschreibung: nicht verfügbar URL : From kevin at tyndur.org Wed May 26 22:34:04 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Wed, 26 May 2010 22:34:04 +0200 Subject: [tyndur-devel] [PATCH 0/4] Und nochmal libc Message-ID: <1274906048-26023-1-git-send-email-kevin@tyndur.org> Aller guten Dinge sind drei... Kevin Wolf (4): libc: strtod libc: Konstanten libc: Mehr extern "C" libc: Fix fuer Whitespace in scanf src/include/limits.h | 1 + src/include/stdlib.h | 4 ++ src/lib/string.c | 70 +++++++++++++++++++++++++++++++++++++++ src/modules/include/dirent.h | 9 +++++ src/modules/include/libgen.h | 8 ++++ src/modules/include/stdio.h | 1 + src/modules/include/sys/stat.h | 9 +++++ src/modules/lib/stdlibc/scanf.c | 1 + 8 files changed, 103 insertions(+), 0 deletions(-) From kevin at tyndur.org Wed May 26 22:34:05 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Wed, 26 May 2010 22:34:05 +0200 Subject: [tyndur-devel] [PATCH 1/4] libc: strtod In-Reply-To: <1274906048-26023-1-git-send-email-kevin@tyndur.org> References: <1274906048-26023-1-git-send-email-kevin@tyndur.org> Message-ID: <1274906048-26023-2-git-send-email-kevin@tyndur.org> + libc: Eine halbe Implementierung von strtod Signed-off-by: Kevin Wolf --- src/include/stdlib.h | 4 +++ src/lib/string.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 0 deletions(-) diff --git a/src/include/stdlib.h b/src/include/stdlib.h index d56d879..873dda8 100644 --- a/src/include/stdlib.h +++ b/src/include/stdlib.h @@ -58,6 +58,10 @@ long strtol(const char* str, char** endptr, int base); unsigned long strtoul(const char *nptr, char **endptr, int base); unsigned long long strtoull(const char *nptr, char **endptr, int base); +long double strtold(const char* nptr, char** end); +double strtod(const char* nptr, char** end); +float strtof(const char* nptr, char** end); + int atoi(const char* s); long atol(const char* str); diff --git a/src/lib/string.c b/src/lib/string.c index f6f4132..d6d662f 100644 --- a/src/lib/string.c +++ b/src/lib/string.c @@ -198,6 +198,76 @@ long atol(const char *str) return result; } +long double strtold(const char* nptr, char** end) +{ + long double result = 0; + long double frac = 0; + long double base = 10.0; + int neg = 0; + int decimal = 0; + + // Leerzeichen am Anfang muessen ignoriert werden + while (isspace(*nptr)) { + nptr++; + } + + // Vorzeichen + if (*nptr == '+') { + nptr++; + } else if (*nptr == '-') { + neg = 1; + nptr++; + } + + // Ergebnis berechnen + result = 0; + while (*nptr) { + switch (*nptr) { + case '0' ... '9': + if (*nptr - '0' > base - 1) { + goto out; + } + if (!decimal) { + result = result * base + (*nptr - '0'); + } else { + frac = frac + ((*nptr - '0') / base); + base *= 10.0; + } + break; + + case '.': + decimal = 1; + break; + + case 'E': + case 'e': + // TODO + + default: + goto out; + } + nptr++; + } +out: + result += frac; + + if (end != NULL) { + *end = (char*) nptr; + } + + return neg ? - result : result; +} + +double strtod(const char* nptr, char** end) +{ + return strtold(nptr, end); +} + +float strtof(const char* nptr, char** end) +{ + return strtold(nptr, end); +} + /** * Zwei Strings unter Beruecksichtigung des aktuellen locales vergleichen */ -- 1.6.0.2 From kevin at tyndur.org Wed May 26 22:34:06 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Wed, 26 May 2010 22:34:06 +0200 Subject: [tyndur-devel] [PATCH 2/4] libc: Konstanten In-Reply-To: <1274906048-26023-1-git-send-email-kevin@tyndur.org> References: <1274906048-26023-1-git-send-email-kevin@tyndur.org> Message-ID: <1274906048-26023-3-git-send-email-kevin@tyndur.org> + libc: PATH_MAX und FILENAME_MAX Signed-off-by: Kevin Wolf --- src/include/limits.h | 1 + src/modules/include/stdio.h | 1 + 2 files changed, 2 insertions(+), 0 deletions(-) diff --git a/src/include/limits.h b/src/include/limits.h index 62f8399..d305fd0 100644 --- a/src/include/limits.h +++ b/src/include/limits.h @@ -56,6 +56,7 @@ #define UINT_MAX 0xFFFFFFFF #define _POSIX_PATH_MAX 4096 +#define PATH_MAX _POSIX_PATH_MAX /** Maximale laenge eines Multibyte-Zeichens in Bytes */ #define MB_LEN_MAX 4 diff --git a/src/modules/include/stdio.h b/src/modules/include/stdio.h index b5f34f4..a3be896 100644 --- a/src/modules/include/stdio.h +++ b/src/modules/include/stdio.h @@ -44,6 +44,7 @@ #define _IOFBF 2 #define _IOLBF 3 +#define FILENAME_MAX 4096 #define BUFSIZ 512 #define P_tmpdir "file:/tmp" -- 1.6.0.2 From kevin at tyndur.org Wed May 26 22:34:07 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Wed, 26 May 2010 22:34:07 +0200 Subject: [tyndur-devel] [PATCH 3/4] libc: Mehr extern "C" In-Reply-To: <1274906048-26023-1-git-send-email-kevin@tyndur.org> References: <1274906048-26023-1-git-send-email-kevin@tyndur.org> Message-ID: <1274906048-26023-4-git-send-email-kevin@tyndur.org> * libc: extern "C" fuer noch ein paar Headerdateien mehr Signed-off-by: Kevin Wolf --- src/modules/include/dirent.h | 9 +++++++++ src/modules/include/libgen.h | 8 ++++++++ src/modules/include/sys/stat.h | 9 +++++++++ 3 files changed, 26 insertions(+), 0 deletions(-) diff --git a/src/modules/include/dirent.h b/src/modules/include/dirent.h index e84c15a..2cdf69a 100644 --- a/src/modules/include/dirent.h +++ b/src/modules/include/dirent.h @@ -37,6 +37,11 @@ struct dirent { typedef io_resource_t DIR; + +#ifdef __cplusplus +extern "C" { +#endif + DIR* opendir(const char * name); int closedir(DIR * dir); @@ -45,5 +50,9 @@ long telldir(DIR * dir); void rewinddir(DIR * dir); void seekdir(DIR * dir, long offset); +#ifdef __cplusplus +}; // extern "C" +#endif + #endif diff --git a/src/modules/include/libgen.h b/src/modules/include/libgen.h index 5b5f58c..31ce967 100644 --- a/src/modules/include/libgen.h +++ b/src/modules/include/libgen.h @@ -29,6 +29,10 @@ #ifndef _LIBGEN_H_ #define _LIBGEN_H_ +#ifdef __cplusplus +extern "C" { +#endif + /** * Trennt den Dateinamen aus einem Pfad heraus. Wenn path ein Nullpointer ist, * wird "." zurueckgegeben. Der Rueckgabestring befindet sich in einem @@ -43,4 +47,8 @@ char* basename(char* path); */ char* dirname(char* path); +#ifdef __cplusplus +}; // extern "C" +#endif + #endif diff --git a/src/modules/include/sys/stat.h b/src/modules/include/sys/stat.h index 5e7cfcb..62fee46 100644 --- a/src/modules/include/sys/stat.h +++ b/src/modules/include/sys/stat.h @@ -111,6 +111,11 @@ struct stat { blkcnt_t st_blocks; /// Anzahl der Blocks }; + +#ifdef __cplusplus +extern "C" { +#endif + /// Modus einer Datei aendern int chmod(const char* filename, mode_t mode); @@ -138,4 +143,8 @@ int mknod(const char* filename, mode_t mode, dev_t device); /// Modus fuer neue Dateien festlegen mode_t umask(mode_t mode); +#ifdef __cplusplus +}; // extern "C" +#endif + #endif //ifndef _SYS_STAT_H_ -- 1.6.0.2 From kevin at tyndur.org Wed May 26 22:34:08 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Wed, 26 May 2010 22:34:08 +0200 Subject: [tyndur-devel] [PATCH 4/4] libc: Fix fuer Whitespace in scanf In-Reply-To: <1274906048-26023-1-git-send-email-kevin@tyndur.org> References: <1274906048-26023-1-git-send-email-kevin@tyndur.org> Message-ID: <1274906048-26023-5-git-send-email-kevin@tyndur.org> ! libc: Nach dem Lesen von Whitespace muss das erste Nicht-Whitespace-Zeichen in den Eingabepuffer zurueck Signed-off-by: Kevin Wolf --- src/modules/lib/stdlibc/scanf.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/modules/lib/stdlibc/scanf.c b/src/modules/lib/stdlibc/scanf.c index db665c5..6c19df7 100644 --- a/src/modules/lib/stdlibc/scanf.c +++ b/src/modules/lib/stdlibc/scanf.c @@ -199,6 +199,7 @@ static int jscanf(const char* fmt, va_list ap, do { c = jgetc(state); } while (isspace(c)); + jungetc(state, c); break; case '%': -- 1.6.0.2 From kevin at tyndur.org Wed May 26 23:04:50 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Wed, 26 May 2010 23:04:50 +0200 Subject: [tyndur-devel] [PATCH] kernel2: pm_create_process: PPID 0 ist aktueller Prozess Message-ID: <1274907890-18634-1-git-send-email-kevin@tyndur.org> ! kernel2: Wenn beim Erstellen eines Prozesses 0 als PID des Elternprozesses angegeben wird, ist der aufrufende Prozess selbst gemeint. Signed-off-by: Kevin Wolf --- src/kernel2/src/syscalls/pm.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/kernel2/src/syscalls/pm.c b/src/kernel2/src/syscalls/pm.c index 71358f4..f65018f 100644 --- a/src/kernel2/src/syscalls/pm.c +++ b/src/kernel2/src/syscalls/pm.c @@ -50,7 +50,8 @@ * @param start Start-Adresse * @param uid User-Id * @param cmdline Kommandozeile mit der der Prozess gestartet wurde - * @param parent_pid PID des Elternprozesses + * @param parent_pid PID des Elternprozesses; bei 0 wird die PID des + * aufrufenden Prozesses selbst benutzt * * @return PID des neuen Tasks */ @@ -58,7 +59,14 @@ pid_t syscall_pm_create_process(vaddr_t start, uid_t uid, const char* cmdline, pid_t parent_pid) { // Eltern-Prozess holen - pm_process_t* parent = pm_get(parent_pid); + pm_process_t* parent; + + if (parent_pid == 0) { + parent = current_process; + } else { + parent = pm_get(parent_pid); + } + // TODO: UID? pm_process_t* process = pm_create(parent, cmdline); pm_thread_create(process, start); -- 1.6.0.2 From toni at tyndur.org Sat May 29 15:54:31 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sat, 29 May 2010 15:54:31 +0200 Subject: [tyndur-devel] [PATCH 3/4] cdi: PCI-Geraete von init holen statt ueber LIO In-Reply-To: <1273765834-15957-4-git-send-email-kevin@tyndur.org> References: <1273765834-15957-1-git-send-email-kevin@tyndur.org> <1273765834-15957-4-git-send-email-kevin@tyndur.org> Message-ID: <20100529135430.GB5412@neo.geekcave.lan> On Thu, May 13 17:50, Kevin Wolf wrote: > * cdi: Nachdem init jetzt alle Geraete kennt, koennen wir sie auch > genauso gut von dort holen. > > Signed-off-by: Kevin Wolf Sieht vernünftig aus. Acked-by: Antoine Kaufmann -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 198 bytes Beschreibung: nicht verfügbar URL : From toni at tyndur.org Sat May 29 15:58:58 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sat, 29 May 2010 15:58:58 +0200 Subject: [tyndur-devel] [PATCH 4/4] lsdev In-Reply-To: <1273765834-15957-5-git-send-email-kevin@tyndur.org> References: <1273765834-15957-1-git-send-email-kevin@tyndur.org> <1273765834-15957-5-git-send-email-kevin@tyndur.org> Message-ID: <20100529135858.GC5412@neo.geekcave.lan> On Thu, May 13 17:50, Kevin Wolf wrote: > + lsdev: Anzeigen aller bei init registrierter Geraete > > Signed-off-by: Kevin Wolf Gibts einen Grund warum du das als eigenständiges Programm reinpackst, und nicht in die shell? Aber von mir aus kann das so rein. Acked-by: Antoine Kaufmann -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 198 bytes Beschreibung: nicht verfügbar URL : From toni at tyndur.org Sat May 29 15:59:42 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sat, 29 May 2010 15:59:42 +0200 Subject: [tyndur-devel] [PATCH 1/6] libc: iscntrl und isprint als Funktionen In-Reply-To: <1274043279-16362-2-git-send-email-kevin@tyndur.org> References: <1274043279-16362-1-git-send-email-kevin@tyndur.org> <1274043279-16362-2-git-send-email-kevin@tyndur.org> Message-ID: <20100529135942.GD5412@neo.geekcave.lan> On Sun, May 16 22:54, Kevin Wolf wrote: > ! libc: iscntrl und isprint muessen als Funktionen vorhanden sein > > Signed-off-by: Kevin Wolf Acked-by: Antoine Kaufmann -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 198 bytes Beschreibung: nicht verfügbar URL : From toni at tyndur.org Sat May 29 16:02:03 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sat, 29 May 2010 16:02:03 +0200 Subject: [tyndur-devel] [PATCH 2/6] libc: atoi-Deklaration gefixt In-Reply-To: <1274043279-16362-3-git-send-email-kevin@tyndur.org> References: <1274043279-16362-1-git-send-email-kevin@tyndur.org> <1274043279-16362-3-git-send-email-kevin@tyndur.org> Message-ID: <20100529140203.GE5412@neo.geekcave.lan> On Sun, May 16 22:54, Kevin Wolf wrote: > ! libc: atoi gehoert nach stdlib.h > ! libc: atoi gibt einen signed-Wert zurueck > > Signed-off-by: Kevin Wolf Acked-by: Antoine Kaufmann -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 198 bytes Beschreibung: nicht verfügbar URL : From toni at tyndur.org Sat May 29 16:03:00 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sat, 29 May 2010 16:03:00 +0200 Subject: [tyndur-devel] [PATCH 3/6] libc: C++-kompatibles NULL In-Reply-To: <1274043279-16362-4-git-send-email-kevin@tyndur.org> References: <1274043279-16362-1-git-send-email-kevin@tyndur.org> <1274043279-16362-4-git-send-email-kevin@tyndur.org> Message-ID: <20100529140300.GF5412@neo.geekcave.lan> On Sun, May 16 22:54, Kevin Wolf wrote: > + libc: Fuer C++ muss NULL anders definiert werden > > Signed-off-by: Kevin Wolf Hm ich dachte das wäre schon lange drin, aber dann war das wohl nur in irgend einem Branch von mir... Acked-by: Antoine Kaufmann -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 198 bytes Beschreibung: nicht verfügbar URL : From toni at tyndur.org Sat May 29 16:03:56 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sat, 29 May 2010 16:03:56 +0200 Subject: [tyndur-devel] [PATCH 4/6] libc: localeconv nicht static inline machen In-Reply-To: <1274043279-16362-5-git-send-email-kevin@tyndur.org> References: <1274043279-16362-1-git-send-email-kevin@tyndur.org> <1274043279-16362-5-git-send-email-kevin@tyndur.org> Message-ID: <20100529140356.GG5412@neo.geekcave.lan> On Sun, May 16 22:54, Kevin Wolf wrote: > * libc: C++ stoert sich am C99-Initializer, also woanders hin damit... > > Signed-off-by: Kevin Wolf Acked-by: Antoine Kaufmann -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 198 bytes Beschreibung: nicht verfügbar URL : From toni at tyndur.org Sat May 29 16:05:33 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sat, 29 May 2010 16:05:33 +0200 Subject: [tyndur-devel] [PATCH 5/6] libc: Deklaration von mktemp/mkstemp gefixt In-Reply-To: <1274043279-16362-6-git-send-email-kevin@tyndur.org> References: <1274043279-16362-1-git-send-email-kevin@tyndur.org> <1274043279-16362-6-git-send-email-kevin@tyndur.org> Message-ID: <20100529140533.GH5412@neo.geekcave.lan> On Sun, May 16 22:54, Kevin Wolf wrote: > ! libc: mktemp/mkstemp gehoeren nach stdlib.h > * libc: template als Parameternamen ist mit C++ ungeschickt > > Signed-off-by: Kevin Wolf Acked-by: Antoine Kaufmann -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 198 bytes Beschreibung: nicht verfügbar URL : From toni at tyndur.org Sat May 29 16:06:26 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sat, 29 May 2010 16:06:26 +0200 Subject: [tyndur-devel] [PATCH 6/6] libc: Typisierungsfix fuer assert In-Reply-To: <1274043279-16362-7-git-send-email-kevin@tyndur.org> References: <1274043279-16362-1-git-send-email-kevin@tyndur.org> <1274043279-16362-7-git-send-email-kevin@tyndur.org> Message-ID: <20100529140625.GI5412@neo.geekcave.lan> On Sun, May 16 22:54, Kevin Wolf wrote: > ! libc: Der Parameter fuer assert muss in C99 und C++ kein int sein > > Signed-off-by: Kevin Wolf Acked-by: Antoine Kaufmann -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 198 bytes Beschreibung: nicht verfügbar URL : From kevin at tyndur.org Sat May 29 16:31:14 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Sat, 29 May 2010 16:31:14 +0200 Subject: [tyndur-devel] [PATCH v2 2/2] libc: Konstruktoren In-Reply-To: <1274483002-28871-3-git-send-email-kevin@tyndur.org> References: <1274483002-28871-3-git-send-email-kevin@tyndur.org> Message-ID: <1275143474-29577-1-git-send-email-kevin@tyndur.org> + libc: Beim Start werden Konstruktoren aufgerufen + Linkerskript fuer Userspace-Programme * Alle Programme auf das neue Linkerskript umgestellt Signed-off-by: Kevin Wolf --- v2: * Jetzt sogar mit Linkerskript buildmk.sh | 6 ++++- src/modules/c/build/Makefile.all | 2 +- src/modules/c/calc/Makefile.all | 2 +- src/modules/c/desktop/Makefile.all | 2 +- src/modules/c/fdisk/Makefile.all | 2 +- src/modules/c/ftp/Makefile.all | 2 +- src/modules/c/getterm/Makefile.all | 2 +- src/modules/c/mousetest/Makefile.all | 2 +- src/modules/c/shell/Makefile.all | 4 +- src/modules/c/vm86test/Makefile.all | 2 +- src/modules/cdi/ata/Makefile.all | 2 +- src/modules/cdi/e1000/Makefile.all | 2 +- src/modules/cdi/ext2/Makefile.all | 2 +- src/modules/cdi/floppy/Makefile.all | 2 +- src/modules/cdi/iso9660/Makefile.all | 2 +- src/modules/cdi/ne2k/Makefile.all | 2 +- src/modules/cdi/pcnet/Makefile.all | 2 +- src/modules/cdi/ramdisk/Makefile.all | 2 +- src/modules/cdi/rtl8139/Makefile.all | 2 +- src/modules/cdi/serial/Makefile.all | 2 +- src/modules/cdi/sis900/Makefile.all | 2 +- src/modules/cdi/vesa/Makefile.all | 2 +- src/modules/cmos/Makefile.all | 2 +- src/modules/console/Makefile.all | 2 +- src/modules/dma/Makefile.all | 2 +- src/modules/fat/Makefile.all | 2 +- src/modules/file/Makefile.all | 2 +- src/modules/floppy/Makefile.all | 2 +- src/modules/init/Makefile.all | 2 +- src/modules/kbc/Makefile.all | 2 +- src/modules/lib/crt0.c | 16 ++++++++++++ src/modules/pas/kedit/Makefile.all | 2 +- src/modules/pas/kirc/Makefile.all | 2 +- src/modules/pas/lpt/Makefile.all | 2 +- src/modules/pas/pashello/Makefile.all | 2 +- src/modules/pas/setup/Makefile.all | 2 +- src/modules/pas/tdx/Makefile.all | 2 +- src/modules/pci/Makefile.all | 2 +- src/modules/ramoverlay/Makefile.all | 2 +- src/modules/rpcbench/Makefile.all | 2 +- src/modules/servmgr/Makefile.all | 2 +- src/modules/skeleton/Makefile.all | 2 +- src/modules/speaker/Makefile.all | 2 +- src/modules/sysinfo/Makefile.all | 2 +- src/modules/tcpip/Makefile.all | 2 +- src/modules/testlib/Makefile.all | 2 +- src/modules/tmp/Makefile.all | 2 +- src/modules/user-i386.ld | 42 +++++++++++++++++++++++++++++++++ src/modules/vterm/Makefile.all | 2 +- 49 files changed, 110 insertions(+), 48 deletions(-) create mode 100644 src/modules/user-i386.ld diff --git a/buildmk.sh b/buildmk.sh index 4e3cd85..8665913 100644 --- a/buildmk.sh +++ b/buildmk.sh @@ -72,6 +72,10 @@ if [ -d lib ]; then LIBDIRS="`pwd`/lib/library.a $LIBDIRS" fi +if [ -f "user-$LOST_ARCH.ld" ]; then + export LDSCRIPT="-T `pwd`/user-$LOST_ARCH.ld" +fi + CC_FLAGS= CC_FLAGS_APPEND= if [ -f Makefile.conf ]; then @@ -109,7 +113,7 @@ EOF fi if [ -f Makefile.all ]; then - echo -e \\tLOST_BUILDMK_ROOT="$LOST_BUILDMK_ROOT" bash Makefile.all '$(BUILD_ROOT)' \'$LIBDIRS $LIB_GCC\' \'$LOST_BUILDMK_ROOT\' >> Makefile + echo -e \\tLOST_BUILDMK_ROOT="$LOST_BUILDMK_ROOT" LDSCRIPT="'$LDSCRIPT'" bash Makefile.all '$(BUILD_ROOT)' \'$LIBDIRS $LIB_GCC\' \'$LOST_BUILDMK_ROOT\' >> Makefile fi cat <> Makefile diff --git a/src/modules/c/build/Makefile.all b/src/modules/c/build/Makefile.all index 8c9b17a..9c2a821 100644 --- a/src/modules/c/build/Makefile.all +++ b/src/modules/c/build/Makefile.all @@ -3,5 +3,5 @@ source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/apps/build" -$LOST_TOOLS_LD -obuild -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -obuild $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s build -o $1/apps/build diff --git a/src/modules/c/calc/Makefile.all b/src/modules/c/calc/Makefile.all index 84347dd..5c8b02b 100644 --- a/src/modules/c/calc/Makefile.all +++ b/src/modules/c/calc/Makefile.all @@ -2,6 +2,6 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/apps/calc" -$LOST_TOOLS_LD -ocalc -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -ocalc $LDSCRIPT *.o --start-group $2 --end-group mv calc $1/apps/ diff --git a/src/modules/c/desktop/Makefile.all b/src/modules/c/desktop/Makefile.all index 510cb6e..1d4986c 100644 --- a/src/modules/c/desktop/Makefile.all +++ b/src/modules/c/desktop/Makefile.all @@ -3,7 +3,7 @@ source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/apps/desktop" -$LOST_TOOLS_LD -odesktop -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -odesktop $LDSCRIPT *.o --start-group $2 --end-group mv desktop $1/apps/ diff --git a/src/modules/c/fdisk/Makefile.all b/src/modules/c/fdisk/Makefile.all index 8c7cbb5..652266f 100644 --- a/src/modules/c/fdisk/Makefile.all +++ b/src/modules/c/fdisk/Makefile.all @@ -3,6 +3,6 @@ source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/apps/fdisk" -$LOST_TOOLS_LD -ofdisk -Ttext=0x40000000 --start-group *.o $2 --end-group +$LOST_TOOLS_LD -ofdisk $LDSCRIPT --start-group *.o $2 --end-group $LOST_TOOLS_STRIP -s fdisk -o $1/apps/fdisk diff --git a/src/modules/c/ftp/Makefile.all b/src/modules/c/ftp/Makefile.all index fb31509..54bf0d0 100644 --- a/src/modules/c/ftp/Makefile.all +++ b/src/modules/c/ftp/Makefile.all @@ -2,6 +2,6 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/apps/ftp" -$LOST_TOOLS_LD -oftp -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -oftp $LDSCRIPT *.o --start-group $2 --end-group mv ftp $1/apps/ diff --git a/src/modules/c/getterm/Makefile.all b/src/modules/c/getterm/Makefile.all index 244dc29..7375874 100644 --- a/src/modules/c/getterm/Makefile.all +++ b/src/modules/c/getterm/Makefile.all @@ -3,6 +3,6 @@ source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/apps/getterm" -$LOST_TOOLS_LD -ogetterm -Ttext=0x40000000 --start-group *.o $2 --end-group +$LOST_TOOLS_LD -ogetterm $LDSCRIPT --start-group *.o $2 --end-group $LOST_TOOLS_STRIP -s getterm -o $1/apps/getterm diff --git a/src/modules/c/mousetest/Makefile.all b/src/modules/c/mousetest/Makefile.all index 450bed8..29efae3 100644 --- a/src/modules/c/mousetest/Makefile.all +++ b/src/modules/c/mousetest/Makefile.all @@ -2,7 +2,7 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/apps/mtest" -$LOST_TOOLS_LD -omtest -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -omtest $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s mtest -o $1/apps/mtest diff --git a/src/modules/c/shell/Makefile.all b/src/modules/c/shell/Makefile.all index 2dbbc14..dcf40c0 100644 --- a/src/modules/c/shell/Makefile.all +++ b/src/modules/c/shell/Makefile.all @@ -5,9 +5,9 @@ echo "LD $1/apps/sh" if [ -z "`grep '#define CONFIG_SHELL_BUILTIN_ONLY' ../../../include/lost/config.h`" ]; then - $LOST_TOOLS_LD -osh -Ttext=0x40000000 *.o --start-group $2 --end-group + $LOST_TOOLS_LD -osh $LDSCRIPT *.o --start-group $2 --end-group else - $LOST_TOOLS_LD -osh -Ttext=0x40000000 *.o cmds/*.o --start-group $2 --end-group + $LOST_TOOLS_LD -osh $LDSCRIPT *.o cmds/*.o --start-group $2 --end-group fi $LOST_TOOLS_STRIP -s sh -o $1/apps/sh diff --git a/src/modules/c/vm86test/Makefile.all b/src/modules/c/vm86test/Makefile.all index c128e45..c6a5c36 100644 --- a/src/modules/c/vm86test/Makefile.all +++ b/src/modules/c/vm86test/Makefile.all @@ -3,6 +3,6 @@ source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/apps/vm86test" -$LOST_TOOLS_LD -ovm86test -Ttext=0x40000000 --start-group *.o $2 --end-group +$LOST_TOOLS_LD -ovm86test $LDSCRIPT --start-group *.o $2 --end-group $LOST_TOOLS_STRIP -s vm86test -o $1/apps/vm86test diff --git a/src/modules/cdi/ata/Makefile.all b/src/modules/cdi/ata/Makefile.all index 432c20c..a058b41 100644 --- a/src/modules/cdi/ata/Makefile.all +++ b/src/modules/cdi/ata/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/ata" -$LOST_TOOLS_LD -oata.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -oata.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s ata.mod -o $1/modules/ata diff --git a/src/modules/cdi/e1000/Makefile.all b/src/modules/cdi/e1000/Makefile.all index f0e1fc6..277e087 100644 --- a/src/modules/cdi/e1000/Makefile.all +++ b/src/modules/cdi/e1000/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/e1000" -$LOST_TOOLS_LD -oe1000.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -oe1000.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s e1000.mod -o $1/modules/e1000 diff --git a/src/modules/cdi/ext2/Makefile.all b/src/modules/cdi/ext2/Makefile.all index 3495a88..c08026b 100644 --- a/src/modules/cdi/ext2/Makefile.all +++ b/src/modules/cdi/ext2/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/ext2" -$LOST_TOOLS_LD -oext2.mod -Ttext=0x40000000 *.o */*.o --start-group $2 --end-group +$LOST_TOOLS_LD -oext2.mod $LDSCRIPT *.o */*.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s ext2.mod -o $1/modules/ext2 diff --git a/src/modules/cdi/floppy/Makefile.all b/src/modules/cdi/floppy/Makefile.all index 501db2b..487d74d 100644 --- a/src/modules/cdi/floppy/Makefile.all +++ b/src/modules/cdi/floppy/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/cdi_floppy" -$LOST_TOOLS_LD -ocdi_floppy.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -ocdi_floppy.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s cdi_floppy.mod -o $1/modules/cdi_floppy diff --git a/src/modules/cdi/iso9660/Makefile.all b/src/modules/cdi/iso9660/Makefile.all index fb14f69..7f747a1 100644 --- a/src/modules/cdi/iso9660/Makefile.all +++ b/src/modules/cdi/iso9660/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/iso9660" -$LOST_TOOLS_LD -oiso9660.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -oiso9660.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s iso9660.mod -o $1/modules/iso9660 diff --git a/src/modules/cdi/ne2k/Makefile.all b/src/modules/cdi/ne2k/Makefile.all index 250d3c3..1d51c21 100644 --- a/src/modules/cdi/ne2k/Makefile.all +++ b/src/modules/cdi/ne2k/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/ne2k" -$LOST_TOOLS_LD -Ttext=0x40000000 -one2k.mod *.o --start-group $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -one2k.mod *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s ne2k.mod -o $1/modules/ne2k diff --git a/src/modules/cdi/pcnet/Makefile.all b/src/modules/cdi/pcnet/Makefile.all index 4ad6890..b8937a1 100644 --- a/src/modules/cdi/pcnet/Makefile.all +++ b/src/modules/cdi/pcnet/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/pcnet" -$LOST_TOOLS_LD -Ttext=0x40000000 -opcnet.mod *.o --start-group $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -opcnet.mod *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s pcnet.mod -o $1/modules/pcnet diff --git a/src/modules/cdi/ramdisk/Makefile.all b/src/modules/cdi/ramdisk/Makefile.all index 3e03444..9c724e7 100644 --- a/src/modules/cdi/ramdisk/Makefile.all +++ b/src/modules/cdi/ramdisk/Makefile.all @@ -2,5 +2,5 @@ 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_LD -oramdisk.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s ramdisk.mod -o $1/modules/ramdisk diff --git a/src/modules/cdi/rtl8139/Makefile.all b/src/modules/cdi/rtl8139/Makefile.all index c7bfe1d..d5f64ab 100644 --- a/src/modules/cdi/rtl8139/Makefile.all +++ b/src/modules/cdi/rtl8139/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/rtl8139" -$LOST_TOOLS_LD -Ttext=0x40000000 -ortl8139.mod *.o --start-group $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -ortl8139.mod *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s rtl8139.mod -o $1/modules/rtl8139 diff --git a/src/modules/cdi/serial/Makefile.all b/src/modules/cdi/serial/Makefile.all index 2f03a04..7118ff0 100644 --- a/src/modules/cdi/serial/Makefile.all +++ b/src/modules/cdi/serial/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/serial" -$LOST_TOOLS_LD -oserial.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -oserial.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s serial.mod -o $1/modules/serial diff --git a/src/modules/cdi/sis900/Makefile.all b/src/modules/cdi/sis900/Makefile.all index 697149c..a76350e 100644 --- a/src/modules/cdi/sis900/Makefile.all +++ b/src/modules/cdi/sis900/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/sis900" -$LOST_TOOLS_LD -osis900.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -osis900.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s sis900.mod -o $1/modules/sis900 diff --git a/src/modules/cdi/vesa/Makefile.all b/src/modules/cdi/vesa/Makefile.all index ec6f85a..2d4ace1 100644 --- a/src/modules/cdi/vesa/Makefile.all +++ b/src/modules/cdi/vesa/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/vesa" -$LOST_TOOLS_LD -ovesa.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -ovesa.mod *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s vesa.mod -o $1/modules/vesa diff --git a/src/modules/cmos/Makefile.all b/src/modules/cmos/Makefile.all index 4678dfc..0c40b28 100755 --- a/src/modules/cmos/Makefile.all +++ b/src/modules/cmos/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/cmos" -$LOST_TOOLS_LD -ocmos.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -ocmos.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s cmos.mod -o $1/modules/cmos diff --git a/src/modules/console/Makefile.all b/src/modules/console/Makefile.all index 6d537f9..5fa0a43 100644 --- a/src/modules/console/Makefile.all +++ b/src/modules/console/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/console" -$LOST_TOOLS_LD -Ttext=0x40000000 -oconsole.mod *.o --start-group $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -oconsole.mod *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s console.mod -o $1/modules/console diff --git a/src/modules/dma/Makefile.all b/src/modules/dma/Makefile.all index 2c43d17..cdf2120 100644 --- a/src/modules/dma/Makefile.all +++ b/src/modules/dma/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/dma" -$LOST_TOOLS_LD -odma.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -odma.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s dma.mod -o $1/modules/dma diff --git a/src/modules/fat/Makefile.all b/src/modules/fat/Makefile.all index 850b36d..7ceec1a 100644 --- a/src/modules/fat/Makefile.all +++ b/src/modules/fat/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/fat" -$LOST_TOOLS_LD -ofat.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -ofat.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s fat.mod -o $1/modules/fat diff --git a/src/modules/file/Makefile.all b/src/modules/file/Makefile.all index d1343c6..2e344f2 100644 --- a/src/modules/file/Makefile.all +++ b/src/modules/file/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/file" -$LOST_TOOLS_LD -ofile.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -ofile.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s file.mod -o $1/modules/file diff --git a/src/modules/floppy/Makefile.all b/src/modules/floppy/Makefile.all index 79b7e71..1c14c78 100755 --- a/src/modules/floppy/Makefile.all +++ b/src/modules/floppy/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/floppy" -$LOST_TOOLS_LD -ofloppy.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -ofloppy.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s floppy.mod -o $1/modules/floppy diff --git a/src/modules/init/Makefile.all b/src/modules/init/Makefile.all index 13c03f2..3d50e8f 100644 --- a/src/modules/init/Makefile.all +++ b/src/modules/init/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/init" -$LOST_TOOLS_LD -Ttext=0x40000000 -oinit.mod *.o */*.o --start-group $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -oinit.mod *.o */*.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s init.mod -o $1/modules/init diff --git a/src/modules/kbc/Makefile.all b/src/modules/kbc/Makefile.all index 98dedb9..92bb1a1 100644 --- a/src/modules/kbc/Makefile.all +++ b/src/modules/kbc/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/kbc" -$LOST_TOOLS_LD -m elf_i386 -okbc.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -m elf_i386 -okbc.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s kbc.mod -o $1/modules/kbc diff --git a/src/modules/lib/crt0.c b/src/modules/lib/crt0.c index 615baf9..4c3192d 100644 --- a/src/modules/lib/crt0.c +++ b/src/modules/lib/crt0.c @@ -39,6 +39,21 @@ extern void init_envvars(void); extern void init_waitpid(void); extern void stdio_init(void); +extern void (*__ctor_start__)(void); +extern void (*__ctor_end__)(void); + +static void call_constructors(void) +{ + void (**f)(void); + + for (f = &__ctor_start__; f < &__ctor_end__; f++) { + /* Dummy-Eintrag aus crtbegin.o ueberspringen */ + if (*f && ((uintptr_t) *f != 0xffffffff)) { + (*f)(); + } + } +} + void __attribute__((weak)) _start(void) { //v(); @@ -87,6 +102,7 @@ void __attribute__((weak)) _start(void) } argv[argc] = NULL; + call_constructors(); int result = main(argc, argv); // Falls ein Buffer auf stdout eingerichtet wurde, wird der geflusht und diff --git a/src/modules/pas/kedit/Makefile.all b/src/modules/pas/kedit/Makefile.all index 7f4d2d0..03cb164 100644 --- a/src/modules/pas/kedit/Makefile.all +++ b/src/modules/pas/kedit/Makefile.all @@ -1,4 +1,4 @@ shopt -s extglob echo "LD $1/kedit" -"$COMPILER_PREFIX"ld -m elf_i386 -okedit -Ttext=0x40000000 *.o lang/*.o --start-group ../lib/units/*.a $2 --end-group `gcc -print-libgcc-file-name` +"$COMPILER_PREFIX"ld -m elf_i386 -okedit $LDSCRIPT *.o lang/*.o --start-group ../lib/units/*.a $2 --end-group `gcc -print-libgcc-file-name` strip -s kedit -o $1/apps/kedit diff --git a/src/modules/pas/kirc/Makefile.all b/src/modules/pas/kirc/Makefile.all index 2c84acc..b934084 100644 --- a/src/modules/pas/kirc/Makefile.all +++ b/src/modules/pas/kirc/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/apps/kirc" -$LOST_TOOLS_LD -okirc -Ttext=0x40000000 *.o --start-group ../lib/units/*.a $2 --end-group +$LOST_TOOLS_LD -okirc $LDSCRIPT *.o --start-group ../lib/units/*.a $2 --end-group $LOST_TOOLS_STRIP -s kirc -o $1/apps/kirc diff --git a/src/modules/pas/lpt/Makefile.all b/src/modules/pas/lpt/Makefile.all index c4078d2..22840bc 100644 --- a/src/modules/pas/lpt/Makefile.all +++ b/src/modules/pas/lpt/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/apps/lpt" -$LOST_TOOLS_LD -olpt.mod -Ttext=0x40000000 *.o lang/*.o --start-group ../lib/units/*.a $2 --end-group +$LOST_TOOLS_LD -olpt.mod $LDSCRIPT *.o lang/*.o --start-group ../lib/units/*.a $2 --end-group $LOST_TOOLS_STRIP -s lpt.mod -o $1/apps/lpt diff --git a/src/modules/pas/pashello/Makefile.all b/src/modules/pas/pashello/Makefile.all index 6fece97..27a3a02 100644 --- a/src/modules/pas/pashello/Makefile.all +++ b/src/modules/pas/pashello/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/apps/pashello" -$LOST_TOOLS_LD -opashello -Ttext=0x40000000 *.o --start-group ../lib/units/*.a $2 --end-group +$LOST_TOOLS_LD -opashello $LDSCRIPT *.o --start-group ../lib/units/*.a $2 --end-group $LOST_TOOLS_STRIP -s pashello -o $1/apps/pashello diff --git a/src/modules/pas/setup/Makefile.all b/src/modules/pas/setup/Makefile.all index 29fea51..1b1b1be 100644 --- a/src/modules/pas/setup/Makefile.all +++ b/src/modules/pas/setup/Makefile.all @@ -1,4 +1,4 @@ shopt -s extglob echo "LD $1/setup" -"$COMPILER_PREFIX"ld -m elf_i386 -osetup -Ttext=0x40000000 *.o lang/*.o --start-group ../lib/units/*.a $2 --end-group `gcc -print-libgcc-file-name` +"$COMPILER_PREFIX"ld -m elf_i386 -osetup $LDSCRIPT *.o lang/*.o --start-group ../lib/units/*.a $2 --end-group `gcc -print-libgcc-file-name` strip -s setup -o $1/apps/setup diff --git a/src/modules/pas/tdx/Makefile.all b/src/modules/pas/tdx/Makefile.all index 5b05399..11da9eb 100644 --- a/src/modules/pas/tdx/Makefile.all +++ b/src/modules/pas/tdx/Makefile.all @@ -1,4 +1,4 @@ shopt -s extglob echo "LD $1/tdx" -"$COMPILER_PREFIX"ld -m elf_i386 -otdx -Ttext=0x40000000 *.o --start-group ../lib/units/*.a $2 --end-group `gcc -print-libgcc-file-name` +"$COMPILER_PREFIX"ld -m elf_i386 -otdx $LDSCRIPT *.o --start-group ../lib/units/*.a $2 --end-group `gcc -print-libgcc-file-name` strip -s tdx -o $1/apps/tdx diff --git a/src/modules/pci/Makefile.all b/src/modules/pci/Makefile.all index a216d0c..a2fb264 100644 --- a/src/modules/pci/Makefile.all +++ b/src/modules/pci/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/pci" -$LOST_TOOLS_LD -opci.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -opci.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s pci.mod -o $1/modules/pci diff --git a/src/modules/ramoverlay/Makefile.all b/src/modules/ramoverlay/Makefile.all index 8eacb97..d93ef54 100644 --- a/src/modules/ramoverlay/Makefile.all +++ b/src/modules/ramoverlay/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/ramoverlay" -$LOST_TOOLS_LD -Ttext=0x40000000 -oramoverlay.mod *.o --start-group $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -oramoverlay.mod *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s ramoverlay.mod -o $1/modules/ramoverlay diff --git a/src/modules/rpcbench/Makefile.all b/src/modules/rpcbench/Makefile.all index 1c47c42..6a4a465 100644 --- a/src/modules/rpcbench/Makefile.all +++ b/src/modules/rpcbench/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/rpcbench" -$LOST_TOOLS_LD -Ttext=0x40000000 -orpcbench.mod --start-group *.o $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -orpcbench.mod --start-group *.o $2 --end-group $LOST_TOOLS_STRIP -s rpcbench.mod -o $1/modules/rpcbench diff --git a/src/modules/servmgr/Makefile.all b/src/modules/servmgr/Makefile.all index 4a276b2..59b7be6 100644 --- a/src/modules/servmgr/Makefile.all +++ b/src/modules/servmgr/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/servmgr" -$LOST_TOOLS_LD -Ttext=0x40000000 -oservmgr.mod *.o --start-group $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -oservmgr.mod *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s servmgr.mod -o $1/modules/servmgr diff --git a/src/modules/skeleton/Makefile.all b/src/modules/skeleton/Makefile.all index ebf4abc..ef77ae3 100644 --- a/src/modules/skeleton/Makefile.all +++ b/src/modules/skeleton/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/skeleton" -$LOST_TOOLS_LD -Ttext=0x40000000 -oskeleton.mod *.o --start-group $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -oskeleton.mod *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s skeleton.mod -o $1/modules/skeleton diff --git a/src/modules/speaker/Makefile.all b/src/modules/speaker/Makefile.all index 4f8ce8e..186dcbf 100644 --- a/src/modules/speaker/Makefile.all +++ b/src/modules/speaker/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/speaker" -$LOST_TOOLS_LD -Ttext=0x40000000 -ospeaker.mod *.o --start-group $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -ospeaker.mod *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s speaker.mod -o $1/modules/speaker diff --git a/src/modules/sysinfo/Makefile.all b/src/modules/sysinfo/Makefile.all index 8eda0b4..0a4aa9d 100644 --- a/src/modules/sysinfo/Makefile.all +++ b/src/modules/sysinfo/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/sysinfo" -$LOST_TOOLS_LD -Ttext=0x40000000 -osysinfo.mod *.o --start-group $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -osysinfo.mod *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s sysinfo.mod -o $1/modules/sysinfo diff --git a/src/modules/tcpip/Makefile.all b/src/modules/tcpip/Makefile.all index d1e355f..ea8e4e4 100644 --- a/src/modules/tcpip/Makefile.all +++ b/src/modules/tcpip/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/tcpip" -$LOST_TOOLS_LD -Ttext=0x40000000 -otcpip.mod *.o --start-group $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -otcpip.mod *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s tcpip.mod -o $1/modules/tcpip diff --git a/src/modules/testlib/Makefile.all b/src/modules/testlib/Makefile.all index 89e888d..4500c64 100644 --- a/src/modules/testlib/Makefile.all +++ b/src/modules/testlib/Makefile.all @@ -2,6 +2,6 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/tests" -$LOST_TOOLS_LD -otests.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -otests.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s tests.mod -o $1/modules/tests diff --git a/src/modules/tmp/Makefile.all b/src/modules/tmp/Makefile.all index d3aa060..81fe3eb 100755 --- a/src/modules/tmp/Makefile.all +++ b/src/modules/tmp/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/tmp" -$LOST_TOOLS_LD -otmp.mod -Ttext=0x40000000 *.o --start-group $2 --end-group +$LOST_TOOLS_LD -otmp.mod $LDSCRIPT *.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s tmp.mod -o $1/modules/tmp diff --git a/src/modules/user-i386.ld b/src/modules/user-i386.ld new file mode 100644 index 0000000..14e21b0 --- /dev/null +++ b/src/modules/user-i386.ld @@ -0,0 +1,42 @@ +LOAD_ADDR = 0x40000000; +LINK_ADDR = 0x40000000; + +ENTRY(_start) +SECTIONS +{ + . = LINK_ADDR; + + .text : AT(ADDR(.text)) + { + *(.text) + } + .rodata ALIGN(4096) : AT(ADDR(.rodata)) + { + *(.rodata) + } + .data ALIGN(4096) : AT(ADDR(.data)) + { + *(.data) + } + .bss ALIGN(4096) : AT(ADDR(.bss)) + { + *(.bss) + } + + /* FIXME Alignment ist Workaround fuer kaputten ELF-Loader in init */ + . = ALIGN(4096); + __ctor_start__ = .; + .ctors : AT(ADDR(.ctors)) { + *(.ctors) + } + __ctor_end__ = .; + + /* FIXME Alignment ist Workaround fuer kaputten ELF-Loader in init */ + . = ALIGN(4096); + __dtor_start__ = .; + .dtors : { + *(.dtors) + } + __dtor_end__ = .; +} + diff --git a/src/modules/vterm/Makefile.all b/src/modules/vterm/Makefile.all index a987d5c..9bafcce 100644 --- a/src/modules/vterm/Makefile.all +++ b/src/modules/vterm/Makefile.all @@ -2,5 +2,5 @@ shopt -s extglob source $LOST_BUILDMK_ROOT/config.sh echo "LD $1/modules/vterm" -$LOST_TOOLS_LD -Ttext=0x40000000 -ovterm.mod *.o keymaps/de.o --start-group $2 --end-group +$LOST_TOOLS_LD $LDSCRIPT -ovterm.mod *.o keymaps/de.o --start-group $2 --end-group $LOST_TOOLS_STRIP -s vterm.mod -o $1/modules/vterm -- 1.6.0.2 From kevin at tyndur.org Sat May 29 16:35:18 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Sat, 29 May 2010 16:35:18 +0200 Subject: [tyndur-devel] [PATCH 4/4] lsdev In-Reply-To: <20100529135858.GC5412@neo.geekcave.lan> References: <1273765834-15957-1-git-send-email-kevin@tyndur.org> <1273765834-15957-5-git-send-email-kevin@tyndur.org> <20100529135858.GC5412@neo.geekcave.lan> Message-ID: <20100529143517.GA15363@silvanus> On Sat, May 29, 2010 at 03:58:58PM +0200, Antoine Kaufmann wrote: > On Thu, May 13 17:50, Kevin Wolf wrote: > > + lsdev: Anzeigen aller bei init registrierter Geraete > > > > Signed-off-by: Kevin Wolf > > Gibts einen Grund warum du das als eigenständiges Programm reinpackst, > und nicht in die shell? > Aber von mir aus kann das so rein. Weil ich CDI-Funktionen benutzen wollte. Am Ende ist aber wohl nicht viel mehr davon übriggeblieben als CDI_PCI... Was sich aber hoffentlich noch irgendwann ändern wird, wenn CDI die Geräte ordentlich verwaltet. From toni at tyndur.org Sat May 29 16:35:51 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sat, 29 May 2010 16:35:51 +0200 Subject: [tyndur-devel] [PATCH 1/2] libc: extern "C" in Headerdateien In-Reply-To: <1274483002-28871-2-git-send-email-kevin@tyndur.org> References: <1274483002-28871-1-git-send-email-kevin@tyndur.org> <1274483002-28871-2-git-send-email-kevin@tyndur.org> Message-ID: <20100529143550.GJ5412@neo.geekcave.lan> On Sat, May 22 01:03, Kevin Wolf wrote: > * libc: Headerdateien fuer C++ brauchbar machen > > Signed-off-by: Kevin Wolf > --- > diff --git a/src/modules/include/unistd.h b/src/modules/include/unistd.h > index 2e2e3b5..8c5e3ed 100644 > --- a/src/modules/include/unistd.h > +++ b/src/modules/include/unistd.h > @@ -47,6 +47,11 @@ Ich glaube das müsste eher vor diese Zeile hier. > int isatty(int desc); > #endif > > + > +#ifdef __cplusplus > +extern "C" { > +#endif > + > /// PID des aktuellen Prozesses auslesen > pid_t getpid(void); > > @@ -165,5 +170,9 @@ int gethostname(char* buf, size_t len); > > #endif > > +#ifdef __cplusplus > +}; // extern "C" > +#endif > + > #endif > Wenn du das noch korrigierst kann das rein. Acked-by: Antoine Kaufmann -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 198 bytes Beschreibung: nicht verfügbar URL : From toni at tyndur.org Sat May 29 16:48:10 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sat, 29 May 2010 16:48:10 +0200 Subject: [tyndur-devel] [PATCH v2 2/2] libc: Konstruktoren In-Reply-To: <1275143474-29577-1-git-send-email-kevin@tyndur.org> References: <1274483002-28871-3-git-send-email-kevin@tyndur.org> <1275143474-29577-1-git-send-email-kevin@tyndur.org> Message-ID: <20100529144810.GK5412@neo.geekcave.lan> On Sat, May 29 16:31, Kevin Wolf wrote: > + libc: Beim Start werden Konstruktoren aufgerufen > + Linkerskript fuer Userspace-Programme > * Alle Programme auf das neue Linkerskript umgestellt > > Signed-off-by: Kevin Wolf Ich habe jetzt nicht kontrolliert ob du alle Makefile.alls erwischt hast, aber ich nehme mal an du hast das so getestet. ;-) Acked-by: Antoine Kaufmann -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 198 bytes Beschreibung: nicht verfügbar URL : From toni at tyndur.org Sat May 29 16:58:02 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sat, 29 May 2010 16:58:02 +0200 Subject: [tyndur-devel] [PATCH 1/4] libc: strtod In-Reply-To: <1274906048-26023-2-git-send-email-kevin@tyndur.org> References: <1274906048-26023-1-git-send-email-kevin@tyndur.org> <1274906048-26023-2-git-send-email-kevin@tyndur.org> Message-ID: <20100529145802.GL5412@neo.geekcave.lan> On Wed, May 26 22:34, Kevin Wolf wrote: > + libc: Eine halbe Implementierung von strtod > > Signed-off-by: Kevin Wolf > --- > src/include/stdlib.h | 4 +++ > src/lib/string.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 74 insertions(+), 0 deletions(-) > > diff --git a/src/include/stdlib.h b/src/include/stdlib.h > index d56d879..873dda8 100644 > --- a/src/include/stdlib.h > +++ b/src/include/stdlib.h > @@ -58,6 +58,10 @@ long strtol(const char* str, char** endptr, int base); > unsigned long strtoul(const char *nptr, char **endptr, int base); > unsigned long long strtoull(const char *nptr, char **endptr, int base); > > +long double strtold(const char* nptr, char** end); > +double strtod(const char* nptr, char** end); > +float strtof(const char* nptr, char** end); > + > int atoi(const char* s); > long atol(const char* str); > > diff --git a/src/lib/string.c b/src/lib/string.c > index f6f4132..d6d662f 100644 > --- a/src/lib/string.c > +++ b/src/lib/string.c > @@ -198,6 +198,76 @@ long atol(const char *str) > return result; > } > > +long double strtold(const char* nptr, char** end) > +{ > + long double result = 0; > + long double frac = 0; > + long double base = 10.0; > + int neg = 0; > + int decimal = 0; > + > + // Leerzeichen am Anfang muessen ignoriert werden > + while (isspace(*nptr)) { > + nptr++; > + } > + > + // Vorzeichen > + if (*nptr == '+') { > + nptr++; > + } else if (*nptr == '-') { > + neg = 1; > + nptr++; > + } > + > + // Ergebnis berechnen > + result = 0; > + while (*nptr) { > + switch (*nptr) { > + case '0' ... '9': > + if (*nptr - '0' > base - 1) { > + goto out; > + } > + if (!decimal) { > + result = result * base + (*nptr - '0'); > + } else { > + frac = frac + ((*nptr - '0') / base); > + base *= 10.0; > + } > + break; > + > + case '.': > + decimal = 1; > + break; > + > + case 'E': > + case 'e': > + // TODO > + > + default: > + goto out; > + } > + nptr++; > + } > +out: > + result += frac; > + > + if (end != NULL) { > + *end = (char*) nptr; Hm bist du da nicht off by one mit end? Laut manpage soll das auf das letzte konvertierte Zeichen zeigen. > + } > + > + return neg ? - result : result; > +} > + > +double strtod(const char* nptr, char** end) > +{ > + return strtold(nptr, end); > +} > + > +float strtof(const char* nptr, char** end) > +{ > + return strtold(nptr, end); > +} > + > /** > * Zwei Strings unter Beruecksichtigung des aktuellen locales vergleichen > */ Abgesehen davon sieht das gut aus, glaube ich. Wenn du das also korrigierst, oder ich das falsch verstehe, kann das rein. ;-) Acked-by: Antoine Kaufmann -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 198 bytes Beschreibung: nicht verfügbar URL : From toni at tyndur.org Sat May 29 16:59:25 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sat, 29 May 2010 16:59:25 +0200 Subject: [tyndur-devel] [PATCH 2/4] libc: Konstanten In-Reply-To: <1274906048-26023-3-git-send-email-kevin@tyndur.org> References: <1274906048-26023-1-git-send-email-kevin@tyndur.org> <1274906048-26023-3-git-send-email-kevin@tyndur.org> Message-ID: <20100529145925.GM5412@neo.geekcave.lan> On Wed, May 26 22:34, Kevin Wolf wrote: > + libc: PATH_MAX und FILENAME_MAX > > Signed-off-by: Kevin Wolf Acked-by: Antoine Kaufmann -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 198 bytes Beschreibung: nicht verfügbar URL : From toni at tyndur.org Sat May 29 17:11:47 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sat, 29 May 2010 17:11:47 +0200 Subject: [tyndur-devel] [PATCH 3/4] libc: Mehr extern "C" In-Reply-To: <1274906048-26023-4-git-send-email-kevin@tyndur.org> References: <1274906048-26023-1-git-send-email-kevin@tyndur.org> <1274906048-26023-4-git-send-email-kevin@tyndur.org> Message-ID: <20100529151146.GN5412@neo.geekcave.lan> On Wed, May 26 22:34, Kevin Wolf wrote: > * libc: extern "C" fuer noch ein paar Headerdateien mehr > > Signed-off-by: Kevin Wolf Acked-by: Antoine Kaufmann -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 198 bytes Beschreibung: nicht verfügbar URL : From toni at tyndur.org Sat May 29 17:13:31 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sat, 29 May 2010 17:13:31 +0200 Subject: [tyndur-devel] [PATCH 4/4] libc: Fix fuer Whitespace in scanf In-Reply-To: <1274906048-26023-5-git-send-email-kevin@tyndur.org> References: <1274906048-26023-1-git-send-email-kevin@tyndur.org> <1274906048-26023-5-git-send-email-kevin@tyndur.org> Message-ID: <20100529151331.GO5412@neo.geekcave.lan> On Wed, May 26 22:34, Kevin Wolf wrote: > ! libc: Nach dem Lesen von Whitespace muss das erste > Nicht-Whitespace-Zeichen in den Eingabepuffer zurueck > > Signed-off-by: Kevin Wolf Sieht vernünftig aus. Acked-by: Antoine Kaufmann -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 198 bytes Beschreibung: nicht verfügbar URL : From toni at tyndur.org Sat May 29 17:14:06 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sat, 29 May 2010 17:14:06 +0200 Subject: [tyndur-devel] [PATCH] kernel2: pm_create_process: PPID 0 ist aktueller Prozess In-Reply-To: <1274907890-18634-1-git-send-email-kevin@tyndur.org> References: <1274907890-18634-1-git-send-email-kevin@tyndur.org> Message-ID: <20100529151406.GP5412@neo.geekcave.lan> On Wed, May 26 23:04, Kevin Wolf wrote: > ! kernel2: Wenn beim Erstellen eines Prozesses 0 als PID des > Elternprozesses angegeben wird, ist der aufrufende Prozess selbst > gemeint. > > Signed-off-by: Kevin Wolf Acked-by: Antoine Kaufmann -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 198 bytes Beschreibung: nicht verfügbar URL : From kevin at tyndur.org Sat May 29 17:16:55 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Sat, 29 May 2010 17:16:55 +0200 Subject: [tyndur-devel] [PATCH 0/2] ELF-Loader-Umbauarbeiten Message-ID: <1275146217-13020-1-git-send-email-kevin@tyndur.org> Am Ende dieser Serie ist hoffentlich einer von unseren ELF-Loadern weg und ein anderer nicht mehr kaputt. ;-) Kevin Wolf (2): init: ELF-Loader aus der libc benutzen libc: ELF-Loader fuer geteilte Pages gefixt src/lib/bin_loader/elf32.c | 66 +++++++++++++++--------- src/modules/init/init.c | 114 ++++-------------------------------------- src/modules/init/loader.c | 118 ++++++++++++++++++++++++++++++++++++++++++++ src/modules/user-i386.ld | 4 -- 4 files changed, 169 insertions(+), 133 deletions(-) create mode 100644 src/modules/init/loader.c From kevin at tyndur.org Sat May 29 17:16:56 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Sat, 29 May 2010 17:16:56 +0200 Subject: [tyndur-devel] [PATCH 1/2] init: ELF-Loader aus der libc benutzen In-Reply-To: <1275146217-13020-1-git-send-email-kevin@tyndur.org> References: <1275146217-13020-1-git-send-email-kevin@tyndur.org> Message-ID: <1275146217-13020-2-git-send-email-kevin@tyndur.org> * init: ELF-Loader aus der libc benutzen statt eigener Implementierung. Die Loader duerften momentan in etwa gleich kaputt sein. Signed-off-by: Kevin Wolf --- src/modules/init/init.c | 114 ++++--------------------------------------- src/modules/init/loader.c | 118 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 128 insertions(+), 104 deletions(-) create mode 100644 src/modules/init/loader.c diff --git a/src/modules/init/init.c b/src/modules/init/init.c index 475d602..dace629 100644 --- a/src/modules/init/init.c +++ b/src/modules/init/init.c @@ -76,7 +76,8 @@ void rpc_loadelf(pid_t pid, dword correlation_id, size_t data_size, void* data); void rpc_reopen_stdio(pid_t pid, dword cid, size_t size, void* data); void load_modules(init_module_list_t* modules); -bool load_single_module(Elf32_Ehdr* elf_header, char* args, pid_t parent_pid); +pid_t load_single_module(void* image, size_t image_size, char* args, + pid_t parent_pid) ; bool start_program(char* path, char* args, pid_t parent_pid); extern void init_sync_messages(void); @@ -351,109 +352,13 @@ void load_modules(init_module_list_t* modules) for(i = 0; i < modules->count; i++) { //printf("Modul %d: %s\n", i, modules->modules[i].cmdline); - load_single_module((Elf32_Ehdr*) modules->modules[i].start, modules->modules[i].cmdline, 0); + load_single_module((Elf32_Ehdr*) modules->modules[i].start, + modules->modules[i].size, modules->modules[i].cmdline, 0); mem_free(modules->modules[i].start, modules->modules[i].size); //msleep(50); // Damit die Meldungen nicht durcheinandergeraten } } -/** - * Der ELF-Loader (noch Total Kaputt) - */ -pid_t load_single_module(Elf32_Ehdr* elf_header, char* args, pid_t parent_pid) -{ - Elf32_Phdr* program_header; - dword i, j; - pid_t pid; - - //Liste mit den Programm-Headern. Wird benutzt um auch programme laden zu koennen, die nicht - list_t* pheader_list = list_create(); - - pid = 0; - if (elf_header->e_magic == ELF_MAGIC) - { - program_header = (Elf32_Phdr *) ((dword) elf_header + elf_header->e_phoff); - //Zuerst den Bereich mit dem entry-point suchen - for (j = 0; j < 2; j++) - { - for (i = 0; i < elf_header->e_phnum; i++) - { - // Im ersten durchgang alles ausser dem Bereich mit dem entry-Point pushe, damit er zu oberst ist - if((j == 1) && ((elf_header->e_entry >= program_header[i].p_vaddr) && (elf_header->e_entry <= program_header[i].p_vaddr + program_header[i].p_memsz))) - { - pheader_list = list_push(pheader_list, (void*)&(program_header[i])); - } - else if((j == 0) && !((elf_header->e_entry >= program_header[i].p_vaddr) && (elf_header->e_entry <= program_header[i].p_vaddr + program_header[i].p_memsz))) - { - pheader_list = list_push(pheader_list, (void*)&(program_header[i])); - } - } - } - - while(list_is_empty(pheader_list) == FALSE) - { - //Den naechsten Bereich aus der Liste holen - program_header = (Elf32_Phdr*) list_pop(pheader_list); - - if (program_header->p_type == 1) - { - if ((elf_header->e_entry >= program_header->p_vaddr) && (elf_header->e_entry <= program_header->p_vaddr + program_header->p_memsz)) - { - if(pid != 0) - { - unblock_process(pid); - pid = 0; - } - pid = create_process(elf_header->e_entry, 0, args, parent_pid); - //printf("[ INIT ] Erstelle Prozess PID=%d entry=0x%08x\n", pid, elf_header->e_entry); - } - else if (pid == 0) - { - // FIXME - printf("Kein Task: phdr->vaddr = %x, ehdr->entry = %x\nDas Modul ist entweder beschaedigt oder wird von diesem Loader nicht unterstuetzt (Kein Entry Point wurde gefunden :-S)\n", program_header->p_vaddr, elf_header->e_entry); - continue; - } - - dword page_offset = program_header->p_vaddr % 0x1000; - - // Groesse des benoetigten Speicherblocks berechnen - size_t mem_size = program_header->p_memsz; - mem_size = PAGE_ALIGN_ROUND_UP(mem_size + page_offset); - - - void* mem_image = mem_allocate(mem_size, 0); - - // FIXME: Hier koennte man noch ein Bisschen Zeit sparen indem - // nur die letzten paar Bytes auf 0 gesetzt werden. Aber dann - // kriege ich es garantiert hin, entweder zuwenig oder zuviel - // zu nullen. ;-) - memset(mem_image, 0, mem_size); - - // printf(" Kopiere 0x%08x Bytes nach 0x%08x\n", program_header->p_filesz, program_header->p_vaddr + page_offset); - // Daten kopieren - memcpy((void*) ((dword) mem_image + page_offset), (void*) ((dword) elf_header + program_header->p_offset), program_header->p_filesz); - - // Pages in den Prozess mappen - init_child_page (pid, (void*) (program_header->p_vaddr), mem_image, mem_size); - } - } - - } - else - { - printf("ELF-Magic ungueltig (0x%x)\n",elf_header->e_magic); - return 0; - } - - - if(pid != 0) - { - unblock_process(pid); - } - - return pid; -} - size_t ainflate(void* src, size_t len, void** dest_ptr) { int ret = 0; @@ -537,6 +442,7 @@ pid_t start_program(char* path, char* args, pid_t parent_pid) } void* buffer = NULL; + size_t buffer_size = 0; long size = 0; fseek(f, 0, SEEK_END); @@ -558,10 +464,9 @@ pid_t start_program(char* path, char* args, pid_t parent_pid) byte* in_buffer = malloc(pages * 4096); fread(in_buffer, 1, size, f); - size_t length = ainflate(in_buffer, size, &buffer); + buffer_size = ainflate(in_buffer, size, &buffer); free(in_buffer); - if(length == 0) - { + if (buffer_size == 0) { return FALSE; } } @@ -599,12 +504,13 @@ pid_t start_program(char* path, char* args, pid_t parent_pid) } else { - buffer = malloc(pages * 4096); + buffer_size = pages * 4096; + buffer = malloc(buffer_size); fread(buffer, 1, size, f); } fclose(f); - pid = load_single_module((Elf32_Ehdr*) buffer, args, parent_pid); + pid = load_single_module(buffer, buffer_size, args, parent_pid); free(buffer); return pid; } diff --git a/src/modules/init/loader.c b/src/modules/init/loader.c new file mode 100644 index 0000000..9e7d06a --- /dev/null +++ b/src/modules/init/loader.c @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2010 The tyndur Project. All rights reserved. + * + * This code is derived from software contributed to the tyndur Project + * by Kevin Wolf. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the tyndur Project + * and its contributors. + * 4. Neither the name of the tyndur Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include + +static struct { + pid_t pid; + char* args; + pid_t parent_pid; + lock_t lock; +} loader_state; + +/** + * Speicher allozieren um ihn spaeter in einen neuen Prozess zu mappen. Diese + * Funktion sollte nicht fuer "normale" Allokationen benutzt werden, da immer + * ganze Pages alloziert werden. + * + * @param size minimale Groesse des Bereichs + * + * @return Adresse, oder NULL falls ein Fehler aufgetreten ist + */ +vaddr_t loader_allocate_mem(size_t size) +{ + return mem_allocate(size, 0); +} + +/** + * Ein Stueck Speicher in den Prozess mappen. Dieser darf dazu noch nicht + * gestartet sein. Der Speicher muss zuerst mit loader_allocate_mem alloziert + * worden sein, denn sonst kann nicht garantiert werden, dass der Speicher + * uebertragen werden kann. + * + * @param process PID des Prozesses + * @param dest_address Adresse an die der Speicher im Zielprozess soll + * @param src_address Adresse im aktuellen Kontext die uebetragen werden soll + * @param size Groesse des Speicherbereichs in Bytes + * + * @return TRUE, wenn der bereich gemappt wurde, FALSE sonst + */ +bool loader_assign_mem(pid_t process, vaddr_t dest_address, + vaddr_t src_address, size_t size) +{ + init_child_page(loader_state.pid, dest_address, src_address, size); + return TRUE; +} + + +/** + * Erstellt einen neuen Thread. + * + * @param process PID + * @param address Einsprungsadresse des Threads + * + * @return bool TRUE, wenn der Thread erstellt wurde, FALSE sonst + */ +bool loader_create_thread(pid_t process, vaddr_t address) +{ + loader_state.pid = create_process((uintptr_t) address, 0, + loader_state.args, loader_state.parent_pid); + return loader_state.pid != 0; +} + +/** + * Erstellt einen neuen Prozess aus einer ELF-Datei + */ +pid_t load_single_module(void* image, size_t image_size, char* args, + pid_t parent_pid) +{ + p(); + lock(&loader_state.lock); + + loader_state.args = args; + loader_state.parent_pid = parent_pid; + if (!loader_elf32_load_image(0, image, image_size)) { + loader_state.pid = 0; + goto fail; + } + unblock_process(loader_state.pid); + +fail: + unlock(&loader_state.lock); + v(); + return loader_state.pid; +} -- 1.6.0.2 From kevin at tyndur.org Sat May 29 17:16:57 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Sat, 29 May 2010 17:16:57 +0200 Subject: [tyndur-devel] [PATCH 2/2] libc: ELF-Loader fuer geteilte Pages gefixt In-Reply-To: <1275146217-13020-1-git-send-email-kevin@tyndur.org> References: <1275146217-13020-1-git-send-email-kevin@tyndur.org> Message-ID: <1275146217-13020-3-git-send-email-kevin@tyndur.org> ! libc: Der ELF-Loader hatte bisher Probleme, wenn sich zwei Program Header eine Page teilen, so dass einer von beiden gewinnt und der andere genullten Speicher bekommt. Stattdessen den gesamten Speicher auf einmal allozieren und nach getaner Arbeit alles auf einmal dem Kindprozess uebertragen * user-i386.ld: Workaround aus dem Linkerskript entfernt Signed-off-by: Kevin Wolf --- src/lib/bin_loader/elf32.c | 66 +++++++++++++++++++++++++++---------------- src/modules/user-i386.ld | 4 -- 2 files changed, 41 insertions(+), 29 deletions(-) diff --git a/src/lib/bin_loader/elf32.c b/src/lib/bin_loader/elf32.c index 22b9487..cc9513d 100644 --- a/src/lib/bin_loader/elf32.c +++ b/src/lib/bin_loader/elf32.c @@ -63,53 +63,69 @@ bool loader_is_elf32(vaddr_t image_start, size_t image_size) /** - * Laed ein ELF-32-Image + * Laedt ein ELF-32-Image */ -bool loader_elf32_load_image(pid_t process, vaddr_t image_start, size_t image_size) +bool loader_elf32_load_image(pid_t process, vaddr_t image_start, + size_t image_size) { Elf32_Ehdr* elf_header = (Elf32_Ehdr*) image_start; - + // Nur gueltige ELF-Images laden if (elf_header->e_magic != ELF_MAGIC) { return FALSE; } + // Hauptthread erstellen loader_create_thread(process, (vaddr_t) elf_header->e_entry); - + // Pointer auf den ersten Program-Header, dieser wird von e_phnum weiteren // PHs gefolgt Elf32_Phdr* program_header = (Elf32_Phdr*) (((uintptr_t) elf_header) + elf_header->e_phoff); - - // Jetzt werden die einzelnen Program-Header geladen + + // Groesse des gesamten Zielspeichers bestimmen + uintptr_t min_addr = -1; + uintptr_t max_addr = 0; + size_t num_pages; int i; + + for (i = 0; i < elf_header->e_phnum; i++) { + if (program_header[i].p_type != PT_LOAD) { + continue; + } + if (program_header[i].p_vaddr < min_addr) { + min_addr = program_header[i].p_vaddr; + } + if (program_header[i].p_vaddr + program_header[i].p_memsz > max_addr) { + max_addr = program_header[i].p_vaddr + program_header[i].p_memsz; + } + } + + num_pages = (max_addr >> PAGE_SHIFT) - (min_addr >> PAGE_SHIFT) + 1; + min_addr &= PAGE_MASK; + + // Jetzt werden die einzelnen Program-Header geladen + uint8_t* src_mem = image_start; + uint8_t* child_mem = loader_allocate_mem(num_pages * PAGE_SIZE); + memset(child_mem, 0, num_pages * PAGE_SIZE); + for (i = 0; i < elf_header->e_phnum; i++) { // Nur ladbare PHs laden ;-) if (program_header->p_type == PT_LOAD) { - // Speicher allokieren, daten kopieren und anschliessend den - // Beriech zwischen filesz und memsz mit Nullen auffuellen - // - // FIXME Das +1 koennte unter Umstaenden zu viel Speicher - // reservieren und den naechsten Header schiefgehen lassen - size_t page_count = NUM_PAGES(PAGE_ALIGN_ROUND_UP( - program_header->p_memsz) + 1); - vaddr_t mem_image = loader_allocate_mem(page_count * PAGE_SIZE); - memcpy((vaddr_t) ((uintptr_t) mem_image + program_header->p_offset - % PAGE_SIZE), (vaddr_t) ((uintptr_t) elf_header + - program_header->p_offset), program_header->p_filesz); - memset((vaddr_t) ((uintptr_t) mem_image + program_header->p_offset - % PAGE_SIZE + program_header->p_filesz), 0, program_header-> - p_memsz - program_header->p_filesz); - // Den geladenen Speicher in den Adressraum des Prozesses - // verschieben - loader_assign_mem(process, (vaddr_t) PAGE_ALIGN_ROUND_DOWN( - program_header->p_vaddr), - mem_image, page_count * PAGE_SIZE); + memcpy( + &child_mem[program_header->p_vaddr - min_addr], + &src_mem[program_header->p_offset], + program_header->p_filesz); } program_header++; } + // Den geladenen Speicher in den Adressraum des Prozesses + // verschieben + loader_assign_mem(process, (void*) min_addr, child_mem, + num_pages * PAGE_SIZE); + return TRUE; } diff --git a/src/modules/user-i386.ld b/src/modules/user-i386.ld index 14e21b0..4709d66 100644 --- a/src/modules/user-i386.ld +++ b/src/modules/user-i386.ld @@ -23,16 +23,12 @@ SECTIONS *(.bss) } - /* FIXME Alignment ist Workaround fuer kaputten ELF-Loader in init */ - . = ALIGN(4096); __ctor_start__ = .; .ctors : AT(ADDR(.ctors)) { *(.ctors) } __ctor_end__ = .; - /* FIXME Alignment ist Workaround fuer kaputten ELF-Loader in init */ - . = ALIGN(4096); __dtor_start__ = .; .dtors : { *(.dtors) -- 1.6.0.2 From toni at tyndur.org Sat May 29 20:21:31 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sat, 29 May 2010 20:21:31 +0200 Subject: [tyndur-devel] [PATCH 2/2] libc: ELF-Loader fuer geteilte Pages gefixt In-Reply-To: <1275146217-13020-3-git-send-email-kevin@tyndur.org> References: <1275146217-13020-1-git-send-email-kevin@tyndur.org> <1275146217-13020-3-git-send-email-kevin@tyndur.org> Message-ID: <20100529182131.GQ5412@neo.geekcave.lan> On Sat, May 29 17:16, Kevin Wolf wrote: > ! libc: Der ELF-Loader hatte bisher Probleme, wenn sich zwei Program > Header eine Page teilen, so dass einer von beiden gewinnt und der > andere genullten Speicher bekommt. Stattdessen den gesamten Speicher > auf einmal allozieren und nach getaner Arbeit alles auf einmal dem > Kindprozess uebertragen > * user-i386.ld: Workaround aus dem Linkerskript entfernt > > Signed-off-by: Kevin Wolf Könnte so funktionieren. ;-) Acked-by: Antoine Kaufmann -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 198 bytes Beschreibung: nicht verfügbar URL : From toni at tyndur.org Sat May 29 20:31:53 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sat, 29 May 2010 20:31:53 +0200 Subject: [tyndur-devel] [PATCH 1/2] init: ELF-Loader aus der libc benutzen In-Reply-To: <1275146217-13020-2-git-send-email-kevin@tyndur.org> References: <1275146217-13020-1-git-send-email-kevin@tyndur.org> <1275146217-13020-2-git-send-email-kevin@tyndur.org> Message-ID: <20100529183153.GR5412@neo.geekcave.lan> On Sat, May 29 17:16, Kevin Wolf wrote: > * init: ELF-Loader aus der libc benutzen statt eigener Implementierung. > Die Loader duerften momentan in etwa gleich kaputt sein. > > Signed-off-by: Kevin Wolf Acked-by: Antoine Kaufmann -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 198 bytes Beschreibung: nicht verfügbar URL : From toni at tyndur.org Sat May 29 21:14:12 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sat, 29 May 2010 21:14:12 +0200 Subject: [tyndur-devel] [PATCH 1/2] Libc: stdbool.h eingefuehrt Message-ID: <1275160453-14490-1-git-send-email-toni@tyndur.org> + Libc: Wir haben jetzt auch eine stdbool.h und koennen somit jetzt auch ein einigermassen standardkonformes bool benutzen. Signed-off-by: Antoine Kaufmann --- src/include/stdbool.h | 41 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 41 insertions(+), 0 deletions(-) create mode 100644 src/include/stdbool.h diff --git a/src/include/stdbool.h b/src/include/stdbool.h new file mode 100644 index 0000000..876e0ed --- /dev/null +++ b/src/include/stdbool.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2010 The tyndur Project. All rights reserved. + * + * This code is derived from software contributed to the tyndur 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. + * + * 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 _STDBOOL_H_ +#define _STDBOOL_H_ + +#define __bool_true_false_are_defined 1 + +#ifndef __cplusplus +#define bool _Bool +#define true 1 +#define false 0 +#endif + +#endif /* ndef STDBOOL_H */ + -- 1.6.4.4 From toni at tyndur.org Sat May 29 21:14:13 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sat, 29 May 2010 21:14:13 +0200 Subject: [tyndur-devel] [PATCH 2/2] Buildsystem: make softclean In-Reply-To: <1275160453-14490-1-git-send-email-toni@tyndur.org> References: <1275160453-14490-1-git-send-email-toni@tyndur.org> Message-ID: <1275160453-14490-2-git-send-email-toni@tyndur.org> Buildsystem: make softclean, Objektdateien usw. loeschen, makefiles aber beibehalten. Signed-off-by: Antoine Kaufmann --- buildmk.sh | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/buildmk.sh b/buildmk.sh index 8665913..b9d4194 100644 --- a/buildmk.sh +++ b/buildmk.sh @@ -225,11 +225,16 @@ done # Code für make clean cat <> Makefile -clean: +clean_objs: rm -f *.o *.a *.mod *.ppu link.res ppas.sh `basename \`pwd\`` + +softclean: clean_objs + for file in *; do if [ -f "\$\$file/Makefile" -a \( ! -f "\$\$file/.nobuild" -o -f "\$\$file/.ignorenobuild" \) ]; then \$(MAKE) -sC "\$\$file" softclean; fi done + +clean: clean_objs for file in *; do if [ -f "\$\$file/Makefile" -a \( ! -f "\$\$file/.nobuild" -o -f "\$\$file/.ignorenobuild" \) ]; then \$(MAKE) -sC "\$\$file" clean; rm "\$\$file/Makefile"; fi done -.SILENT: all makefiles subdirs obj clean clean_root updateroot image-floppy image-hd test-qemu test-qemu-hd +.SILENT: all makefiles subdirs obj clean softclean clean_objs clean_root updateroot image-floppy image-hd test-qemu test-qemu-hd EOF if [ "$LOST_BUILDMK_ROOT" == "`pwd`" ]; then -- 1.6.4.4 From kevin at tyndur.org Sat May 29 21:35:35 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Sat, 29 May 2010 21:35:35 +0200 Subject: [tyndur-devel] [PATCH 2/2] Buildsystem: make softclean In-Reply-To: <1275160453-14490-2-git-send-email-toni@tyndur.org> References: <1275160453-14490-1-git-send-email-toni@tyndur.org> <1275160453-14490-2-git-send-email-toni@tyndur.org> Message-ID: <20100529193535.GB15363@silvanus> On Sat, May 29, 2010 at 09:14:13PM +0200, Antoine Kaufmann wrote: > Buildsystem: make softclean, Objektdateien usw. loeschen, makefiles aber > beibehalten. > > Signed-off-by: Antoine Kaufmann Acked-by: Kevin Wolf From kevin at tyndur.org Sat May 29 22:06:03 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Sat, 29 May 2010 22:06:03 +0200 Subject: [tyndur-devel] [PATCH 1/2] Libc: stdbool.h eingefuehrt In-Reply-To: <1275160453-14490-1-git-send-email-toni@tyndur.org> References: <1275160453-14490-1-git-send-email-toni@tyndur.org> Message-ID: <20100529200603.GC15363@silvanus> On Sat, May 29, 2010 at 09:14:12PM +0200, Antoine Kaufmann wrote: > + Libc: Wir haben jetzt auch eine stdbool.h und koennen somit jetzt auch > ein einigermassen standardkonformes bool benutzen. > > Signed-off-by: Antoine Kaufmann Acked-by: Kevin Wolf From toni at tyndur.org Sun May 30 14:02:31 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sun, 30 May 2010 14:02:31 +0200 Subject: [tyndur-devel] [PATCH] kernel2: Kernel-Interrupts moeglich machen Message-ID: <1275220951-8468-1-git-send-email-toni@tyndur.org> * kernel2: Anpassungen damit kernel-Interrupts nicht mehr den Stack durcheinander bringen. * kernel2: Neues Feld user_isf eingefuehrt, damit im Kernel jederzeit auf den ISF des Userspace-Interrupts zugegriffen werden kann, auch nach einem Kernel-Interrupt. ! kernel2: Keine RPCs zu Tasks die in Kernel-Interrupts sind Signed-off-by: Antoine Kaufmann --- src/kernel2/include/tasks.h | 3 +++ src/kernel2/src/interrupts/im.c | 19 ++++++++++++------- src/kernel2/src/syscalls/rpc.c | 12 ++++++++++-- src/kernel2/src/tasks/thread.c | 1 + 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/kernel2/include/tasks.h b/src/kernel2/include/tasks.h index dfd0ea5..d1b031c 100644 --- a/src/kernel2/include/tasks.h +++ b/src/kernel2/include/tasks.h @@ -106,6 +106,9 @@ typedef struct { /// Groesse des Kernelstacks size_t kernel_stack_size; + /// Aktueller Stackframe des Userspace-Interrupts + vaddr_t user_isf; + /// Anfang des Usermode-Stacks vaddr_t user_stack_bottom; diff --git a/src/kernel2/src/interrupts/im.c b/src/kernel2/src/interrupts/im.c index 1930c0d..072e662 100644 --- a/src/kernel2/src/interrupts/im.c +++ b/src/kernel2/src/interrupts/im.c @@ -133,9 +133,14 @@ interrupt_stack_frame_t* im_handler(interrupt_stack_frame_t* isf) // Pointer auf den aktuellen Thread holen pm_thread_t* thread = current_thread; pm_thread_t* old_thread = thread; - thread->kernel_stack = (vaddr_t) isf; uint8_t int_num = isf->interrupt_number; - + interrupt_stack_frame_t* new_isf = isf; + + // Wenn der Int aus dem Userspace kommt, legen wir den zugehoerigen ISF ab + if (isf->cs != 0x8) { + thread->user_isf = isf; + } + if (int_num < 20) { handle_exception(isf, int_num); } else if ((int_num >= 20) && (int_num < 32)){ @@ -179,17 +184,17 @@ interrupt_stack_frame_t* im_handler(interrupt_stack_frame_t* isf) thread = current_thread; if (thread != old_thread) { - interrupt_stack_frame_t* new_isf = - (interrupt_stack_frame_t*) thread->kernel_stack; + old_thread->kernel_stack = isf; + new_isf = thread->kernel_stack; cpu_get_current()->tss.ss0 = 2 << 3; if (new_isf->eflags & 0x20000) { cpu_get_current()->tss.esp0 = - (uintptr_t) thread->kernel_stack + (uintptr_t) thread->user_isf + sizeof(struct vm86_isf); } else { cpu_get_current()->tss.esp0 = - (uintptr_t) thread->kernel_stack + (uintptr_t) thread->user_isf + sizeof(interrupt_stack_frame_t); } @@ -197,7 +202,7 @@ interrupt_stack_frame_t* im_handler(interrupt_stack_frame_t* isf) } im_end_of_interrupt(int_num); - return (interrupt_stack_frame_t*) thread->kernel_stack; + return new_isf; } /** diff --git a/src/kernel2/src/syscalls/rpc.c b/src/kernel2/src/syscalls/rpc.c index 6bc7340..533b412 100644 --- a/src/kernel2/src/syscalls/rpc.c +++ b/src/kernel2/src/syscalls/rpc.c @@ -206,11 +206,19 @@ int do_fastrpc(pid_t callee_pid, size_t metadata_size, void* metadata, // Interrupt Stack Frame des aufgerufenen Tasks mappen paddr_t callee_isf_phys = - mmc_resolve(&callee->process->context, callee->kernel_stack); + mmc_resolve(&callee->process->context, callee->user_isf); interrupt_stack_frame_t* callee_isf = (interrupt_stack_frame_t*) vmm_kernel_automap(callee_isf_phys, sizeof(*callee_isf)); + // Wenn sich der Task gerade in einem Kernel-Int befindet, lassen wir ihn + // besser in Ruhe und probieren spaeter nochmal. + if ((current_thread != callee) && + (callee->kernel_stack != callee->user_isf)) + { + vmm_kernel_unmap(callee_isf, sizeof(*callee_isf)); + return -EAGAIN; + } // RPC-Backlinkinformation anlegen rpc_t* rpc = malloc(sizeof(rpc_t)); @@ -363,7 +371,7 @@ bool fastrpc_irq(pm_process_t* callee, size_t metadata_size, void* metadata, void syscall_fastrpc_ret(void) { rpc_t* rpc = list_pop(current_process->rpcs); - interrupt_stack_frame_t* callee_isf = current_thread->kernel_stack; + interrupt_stack_frame_t* callee_isf = current_thread->user_isf; // Wenn der Task vom RPC-Handler zurückkehrt, obwohl der Handler // gar nicht aufgerufen wurde, läuft was schief diff --git a/src/kernel2/src/tasks/thread.c b/src/kernel2/src/tasks/thread.c index b94cc3b..ba6e569 100644 --- a/src/kernel2/src/tasks/thread.c +++ b/src/kernel2/src/tasks/thread.c @@ -79,6 +79,7 @@ pm_thread_t* pm_thread_create(pm_process_t* process, vaddr_t entry) thread->kernel_stack_size - sizeof(interrupt_stack_frame_t)); interrupt_stack_frame_t* isf = (interrupt_stack_frame_t*) thread-> kernel_stack; + thread->user_isf = thread->kernel_stack; // Wir wollen alle Register schoen mit 0 initialisiert haben memset(isf, 0, sizeof(interrupt_stack_frame_t)); -- 1.6.4.4 From toni at tyndur.org Sun May 30 14:02:49 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sun, 30 May 2010 14:02:49 +0200 Subject: [tyndur-devel] [PATCH] servmgr: Etwas grosszuegiger Dateien schliessen Message-ID: <1275220969-8810-1-git-send-email-toni@tyndur.org> ! servmgr: Wenn man in servmgr die Konfigurationsdateien nach dem Einlesen auch wieder schliesst, lassen sich diese danach sogar loeschen. Signed-off-by: Antoine Kaufmann --- src/modules/servmgr/config.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/src/modules/servmgr/config.c b/src/modules/servmgr/config.c index dfa3fe1..2280e00 100644 --- a/src/modules/servmgr/config.c +++ b/src/modules/servmgr/config.c @@ -167,6 +167,7 @@ static void config_parse_deps(const char* path, list_push(conf_serv->deps, dep); } + fclose(f); } /** @@ -201,6 +202,7 @@ static void config_parse_conf(const char* path, conf_serv->conf.wait = TERMINATE; } } + fclose(f); } -- 1.6.4.4 From toni at tyndur.org Sun May 30 14:03:05 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sun, 30 May 2010 14:03:05 +0200 Subject: [tyndur-devel] [PATCH] Libc: symlink ist kein Stub mehr Message-ID: <1275220985-9078-1-git-send-email-toni@tyndur.org> ! Libc: symlink ist kein Stub mehr Signed-off-by: Antoine Kaufmann --- src/modules/include/unistd.h | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/modules/include/unistd.h b/src/modules/include/unistd.h index a55afd8..2949dfb 100644 --- a/src/modules/include/unistd.h +++ b/src/modules/include/unistd.h @@ -121,6 +121,16 @@ long alarm(long seconds); /// Gibt die Groesse einer Page zurueck int getpagesize(void); +/** + * Einen symbolischen Link anlegen + * + * @param oldpath Ziel des Links + * @param newpath Hier wird der Link erstellt + * + * @return 0 bei Erfolg; im Fehlerfall -1 und errno wird gesetzt + */ +int symlink(const char* oldpath, const char* newpath); + #ifndef CONFIG_LIBC_NO_STUBS /// Prozess klonen pid_t fork(void); @@ -143,16 +153,6 @@ unsigned int sleep(unsigned int seconds); /// Datei umbenennen oder verschieben int rename(const char* path_old, const char* path_new); -/** - * Einen symbolischen Link anlegen - * - * @param oldpath Ziel des Links - * @param newpath Hier wird der Link erstellt - * - * @return 0 bei Erfolg; im Fehlerfall -1 und errno wird gesetzt - */ -int symlink(const char* oldpath, const char* newpath); - /// Gibt die aktuelle Benutzer-ID zurueck uid_t getuid(void); -- 1.6.4.4 From toni at tyndur.org Sun May 30 14:03:20 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sun, 30 May 2010 14:03:20 +0200 Subject: [tyndur-devel] [PATCH] Shell: readlink() und symlink() benutzen Message-ID: <1275221000-9314-1-git-send-email-toni@tyndur.org> * Shell: readlink() und symlink() benutzen, statt selbst mit fopen() rumzufrickeln. Signed-off-by: Antoine Kaufmann --- src/modules/c/shell/cmds/readlink.c | 8 ++------ src/modules/c/shell/cmds/symlink.c | 8 +------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/modules/c/shell/cmds/readlink.c b/src/modules/c/shell/cmds/readlink.c index 2c31bd3..e0015ab 100644 --- a/src/modules/c/shell/cmds/readlink.c +++ b/src/modules/c/shell/cmds/readlink.c @@ -49,22 +49,18 @@ void readlink_display_usage(void); #endif { char buffer[4096]; - size_t len; + ssize_t len; if (argc != 2) { readlink_display_usage(); return -1; } - FILE* file = fopen(argv[1], "lr"); - if (file == NULL) { + if ((len = readlink(argv[1], buffer, sizeof(buffer) - 1)) < 0) { puts("Fehler: Symlink konnte nicht gelesen werden."); return -1; } - - len = fread(buffer, 1, 4095, file); buffer[len] = 0; - fclose(file); puts(buffer); diff --git a/src/modules/c/shell/cmds/symlink.c b/src/modules/c/shell/cmds/symlink.c index c1dcc43..1379f2b 100644 --- a/src/modules/c/shell/cmds/symlink.c +++ b/src/modules/c/shell/cmds/symlink.c @@ -54,16 +54,10 @@ void symlink_display_usage(void); return -1; } - FILE* file = fopen(argv[1], "lw"); - - if (file == NULL) { + if (symlink(argv[2], argv[1])) { puts("Fehler: Symlink konnte nicht erstellt werden."); return -1; } - - char* dest = io_get_absolute_path(argv[2]); - fwrite(dest, 1, strlen(dest) + 1, file); - fclose(file); return EXIT_SUCCESS; } -- 1.6.4.4 From toni at tyndur.org Sun May 30 14:03:35 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sun, 30 May 2010 14:03:35 +0200 Subject: [tyndur-devel] [PATCH] Shell: Beim cat nicht nur auf EOF sonder auch Fehler pruefen Message-ID: <1275221015-9558-1-git-send-email-toni@tyndur.org> ! Shell: Beim cat nicht nur auf EOF sonder auch Fehler pruefen Signed-off-by: Antoine Kaufmann --- src/modules/c/shell/cmds/cat.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/modules/c/shell/cmds/cat.c b/src/modules/c/shell/cmds/cat.c index ffa70ce..a8320b4 100644 --- a/src/modules/c/shell/cmds/cat.c +++ b/src/modules/c/shell/cmds/cat.c @@ -49,6 +49,8 @@ void cat_display_usage(void); int main(int argc, char* argv[]) #endif { + int result = EXIT_SUCCESS; + if (argc != 2) { cat_display_usage(); return -1; @@ -59,22 +61,28 @@ void cat_display_usage(void); if (file == NULL) { printf("Konnte '%s' nicht zum lesen oeffnen!\n", path); + result = EXIT_FAILURE; } else { char buffer[BLOCK_SIZE + 1]; size_t size; - while (feof(file) != EOF) { + while (!feof(file) && !ferror(file)) { size = fread(buffer, 1, BLOCK_SIZE, file); buffer[size] = 0; printf("%s", buffer); } + + if (ferror(file)) { + puts("Beim Lesen ist ein Fehler aufgetreten!\n"); + result = EXIT_FAILURE; + } fclose(file); printf("\n"); } - return EXIT_SUCCESS; + return result; } void cat_display_usage() -- 1.6.4.4 From toni at tyndur.org Sun May 30 14:03:57 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sun, 30 May 2010 14:03:57 +0200 Subject: [tyndur-devel] [PATCH] Libc: Fix fuer EOF-Erkennung in fgets() Message-ID: <1275221037-9950-1-git-send-email-toni@tyndur.org> Libc: Wenn fgets() das Ende der Eingabe vor einem Zeilenumbruch erreichte, fuehrte das bis jetzt zu einer Endlosschleife. Signed-off-by: Antoine Kaufmann --- src/modules/lib/stdlibc/file.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/src/modules/lib/stdlibc/file.c b/src/modules/lib/stdlibc/file.c index c40abcb..45e24f2 100644 --- a/src/modules/lib/stdlibc/file.c +++ b/src/modules/lib/stdlibc/file.c @@ -361,6 +361,8 @@ char* fgets(char* dest, int length, FILE *io_res) if ((c == EOF) && (ferror(io_res) != 0)) { i = 0; break; + } else if (feof(io_res)) { + break; } else if (c == EOF) { i--; continue; -- 1.6.4.4 From toni at tyndur.org Sun May 30 14:04:12 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sun, 30 May 2010 14:04:12 +0200 Subject: [tyndur-devel] [PATCH] kernel2: Code readonly mappen Message-ID: <1275221052-10187-1-git-send-email-toni@tyndur.org> * kernel2: Code readonly mappen Signed-off-by: Antoine Kaufmann --- src/kernel2/include/mm.h | 3 +++ src/kernel2/src/arch/i386/kernel.ld | 4 ++++ src/kernel2/src/arch/i386/mm/virt.c | 15 ++++++++++----- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/kernel2/include/mm.h b/src/kernel2/include/mm.h index 9ab51f0..ffb68b1 100644 --- a/src/kernel2/include/mm.h +++ b/src/kernel2/include/mm.h @@ -51,6 +51,9 @@ extern void kernel_phys_end(void); extern void kernel_start(void); extern void kernel_end(void); +/* Start des bereichs des Kernels der beschreibbar sein muss */ +extern void kernel_rw_start(void); + void pmm_init(struct multiboot_info* multiboot_info); diff --git a/src/kernel2/src/arch/i386/kernel.ld b/src/kernel2/src/arch/i386/kernel.ld index 0cb7936..6921bcf 100644 --- a/src/kernel2/src/arch/i386/kernel.ld +++ b/src/kernel2/src/arch/i386/kernel.ld @@ -20,6 +20,10 @@ SECTIONS } .data ALIGN(4096) : AT(ADDR(.data) - VIRT_TO_PHYS) { + /* Um klar zwischen Bereichen unterscheiden zu koennen, die + schreibbar sein muessen, und nur lesbaren, wird davon + ausgegangen, dass alle vor diesem Label nur lesbar sind. */ + kernel_rw_start = .; *(.data) } .bss ALIGN(4096) : AT(ADDR(.bss) - VIRT_TO_PHYS) diff --git a/src/kernel2/src/arch/i386/mm/virt.c b/src/kernel2/src/arch/i386/mm/virt.c index d057523..9b0b4ea 100644 --- a/src/kernel2/src/arch/i386/mm/virt.c +++ b/src/kernel2/src/arch/i386/mm/virt.c @@ -51,12 +51,17 @@ extern page_directory_t page_directory_current; * Die physische Speicherverwaltung muss dazu bereits initialisiert sein. */ void vmm_init(mmc_context_t* kernel_context) -{ +{ + size_t rosize = kernel_rw_start - kernel_start; + size_t rwsize = kernel_end - kernel_rw_start; + // TODO: 4M-Pages benutzen, wenn in config.h aktiviert // Den Kernel mappen - mmc_map(kernel_context, kernel_start, kernel_phys_start, PTE_W | PTE_P, - NUM_PAGES((uintptr_t) kernel_end - (uintptr_t) kernel_start)); - + mmc_map(kernel_context, kernel_start, kernel_phys_start, PTE_P, + NUM_PAGES(rosize)); + mmc_map(kernel_context, kernel_start + rosize, + kernel_phys_start + rosize, PTE_P | PTE_W, NUM_PAGES(rwsize)); + // Videospeicher mappen // TODO Usermodus muss die momentan wegen VM86 sehen. Waere wohl besser, // wenn VM86 einen eigenen Adressraum haette. @@ -110,7 +115,7 @@ void vmm_init_local(mmc_context_t* kernel_context) "mov %0, %%cr3\n\t" // Paging aktivieren "mov %%cr0, %%eax\n\t" - "or $0x80000000, %%eax\n\t" + "or $0x80010000, %%eax\n\t" "mov %%eax, %%cr0\n\t" : : "r" (kernel_context->page_directory) : "eax"); } -- 1.6.4.4 From toni at tyndur.org Sun May 30 14:04:32 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sun, 30 May 2010 14:04:32 +0200 Subject: [tyndur-devel] [PATCH 1/2] Libc: Alte Lostio-Debugmeldung entfernt Message-ID: <1275221073-10487-1-git-send-email-toni@tyndur.org> * Libc: Alte Lostio-Debugmeldung entfernen beim oeffnen von inexistenten Dateien. Signed-off-by: Antoine Kaufmann --- src/modules/lib/lostio/handler.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/src/modules/lib/lostio/handler.c b/src/modules/lib/lostio/handler.c index aeb3f4d..1c23d3d 100644 --- a/src/modules/lib/lostio/handler.c +++ b/src/modules/lib/lostio/handler.c @@ -526,7 +526,6 @@ static lostio_filehandle_t* lostio_open(char* path, uint8_t attr, pid_t pid, io_ //dann wird das oeffnen abgebrochen. if((typehandle == NULL) || (typehandle->not_found == NULL)) { - printf("Datei nicht vorhanden: '%s'\n", path); return 0; } else -- 1.6.4.4 From toni at tyndur.org Sun May 30 14:04:33 2010 From: toni at tyndur.org (Antoine Kaufmann) Date: Sun, 30 May 2010 14:04:33 +0200 Subject: [tyndur-devel] [PATCH 2/2] init: Interpreter-Debugausgabe entfernt In-Reply-To: <1275221073-10487-1-git-send-email-toni@tyndur.org> References: <1275221073-10487-1-git-send-email-toni@tyndur.org> Message-ID: <1275221073-10487-2-git-send-email-toni@tyndur.org> - init: Interpreter-Debugausgabe Signed-off-by: Antoine Kaufmann --- src/modules/init/init.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/src/modules/init/init.c b/src/modules/init/init.c index aadd56e..9368908 100644 --- a/src/modules/init/init.c +++ b/src/modules/init/init.c @@ -505,7 +505,6 @@ pid_t start_program(char* path, char* args, pid_t parent_pid) args ? args : ""); new_path = strtok(interpreter + 2, " "); - printf("Interpreter: %s %s\n", new_path, new_args); ret = start_program(new_path, new_args, parent_pid); free(new_args); return ret; -- 1.6.4.4 From kevin at tyndur.org Sun May 30 16:50:13 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Sun, 30 May 2010 16:50:13 +0200 Subject: [tyndur-devel] [PATCH] kernel2: Kernel-Interrupts moeglich machen In-Reply-To: <1275220951-8468-1-git-send-email-toni@tyndur.org> References: <1275220951-8468-1-git-send-email-toni@tyndur.org> Message-ID: <20100530145011.GA13995@silvanus> On Sun, May 30, 2010 at 02:02:31PM +0200, Antoine Kaufmann wrote: > * kernel2: Anpassungen damit kernel-Interrupts nicht mehr den Stack > durcheinander bringen. > * kernel2: Neues Feld user_isf eingefuehrt, damit im Kernel jederzeit > auf den ISF des Userspace-Interrupts zugegriffen werden > kann, auch nach einem Kernel-Interrupt. > ! kernel2: Keine RPCs zu Tasks die in Kernel-Interrupts sind > > Signed-off-by: Antoine Kaufmann Ich glaube, das könnte so funktionieren. Aber die kernel_stack-Vorkommen im VM86-Code willst du vermutlich auch noch austauschen. Wenn du das gefixt hast, kann es rein. From kevin at tyndur.org Sun May 30 17:32:58 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Sun, 30 May 2010 17:32:58 +0200 Subject: [tyndur-devel] [PATCH] servmgr: Etwas grosszuegiger Dateien schliessen In-Reply-To: <1275220969-8810-1-git-send-email-toni@tyndur.org> References: <1275220969-8810-1-git-send-email-toni@tyndur.org> Message-ID: <20100530153257.GB13995@silvanus> On Sun, May 30, 2010 at 02:02:49PM +0200, Antoine Kaufmann wrote: > ! servmgr: Wenn man in servmgr die Konfigurationsdateien nach dem > Einlesen auch wieder schliesst, lassen sich diese danach > sogar loeschen. > > Signed-off-by: Antoine Kaufmann Acked-by: Kevin Wolf From kevin at tyndur.org Sun May 30 17:34:02 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Sun, 30 May 2010 17:34:02 +0200 Subject: [tyndur-devel] [PATCH] Libc: symlink ist kein Stub mehr In-Reply-To: <1275220985-9078-1-git-send-email-toni@tyndur.org> References: <1275220985-9078-1-git-send-email-toni@tyndur.org> Message-ID: <20100530153402.GC13995@silvanus> On Sun, May 30, 2010 at 02:03:05PM +0200, Antoine Kaufmann wrote: > ! Libc: symlink ist kein Stub mehr > > Signed-off-by: Antoine Kaufmann Acked-by: Kevin Wolf From max at tyndur.org Sun May 30 18:15:39 2010 From: max at tyndur.org (max at tyndur.org) Date: Sun, 30 May 2010 18:15:39 +0200 Subject: [tyndur-devel] [PATCH] Warnungen sind mit -Werror schlecht Message-ID: <1275236139-13769-1-git-send-email-max@tyndur.org> From: Max Reitz * wchar_t sollte als __WCHAR_TYPE__ definiert werden, damit es hier keine inkompatiblen Zeigerzuweisungen (in readline.c) gibt. * Neuer Wert im jprintf-positional_parameters-Struktur-enum, damit dieser auch verwendet werden kann Signed-off-by: Max Reitz --- src/include/arch/i386/stddef.h | 2 +- src/modules/lib/stdlibc/jprintf.c | 1 + 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/include/arch/i386/stddef.h b/src/include/arch/i386/stddef.h index 13c907d..8c0720d 100644 --- a/src/include/arch/i386/stddef.h +++ b/src/include/arch/i386/stddef.h @@ -40,7 +40,7 @@ typedef __SIZE_TYPE__ size_t; typedef int ptrdiff_t; #ifndef __cplusplus -typedef int32_t wchar_t; +typedef __WCHAR_TYPE__ wchar_t; #endif #endif diff --git a/src/modules/lib/stdlibc/jprintf.c b/src/modules/lib/stdlibc/jprintf.c index c7fbbce..cefba06 100644 --- a/src/modules/lib/stdlibc/jprintf.c +++ b/src/modules/lib/stdlibc/jprintf.c @@ -246,6 +246,7 @@ struct positional_parameter unsigned_type_flag = 0x100, uint_type = unsigned_type_flag | int_type, //ulong_type = unsigned_type_flag | long_type, + ulong_long_type = unsigned_type_flag | long_long_type, ptr_type = 0x10, double_type = 0x20, long_double_type = 0x30, -- 1.7.1 From kevin at tyndur.org Sun May 30 18:49:29 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Sun, 30 May 2010 18:49:29 +0200 Subject: [tyndur-devel] [PATCH] Shell: readlink() und symlink() benutzen In-Reply-To: <1275221000-9314-1-git-send-email-toni@tyndur.org> References: <1275221000-9314-1-git-send-email-toni@tyndur.org> Message-ID: <20100530164929.GD13995@silvanus> On Sun, May 30, 2010 at 02:03:20PM +0200, Antoine Kaufmann wrote: > * Shell: readlink() und symlink() benutzen, statt selbst mit fopen() > rumzufrickeln. > > Signed-off-by: Antoine Kaufmann > --- > src/modules/c/shell/cmds/readlink.c | 8 ++------ > src/modules/c/shell/cmds/symlink.c | 8 +------- > 2 files changed, 3 insertions(+), 13 deletions(-) > > diff --git a/src/modules/c/shell/cmds/readlink.c b/src/modules/c/shell/cmds/readlink.c > index 2c31bd3..e0015ab 100644 > --- a/src/modules/c/shell/cmds/readlink.c > +++ b/src/modules/c/shell/cmds/readlink.c > @@ -49,22 +49,18 @@ void readlink_display_usage(void); > #endif > { > char buffer[4096]; > - size_t len; > + ssize_t len; > > if (argc != 2) { > readlink_display_usage(); > return -1; > } > > - FILE* file = fopen(argv[1], "lr"); > - if (file == NULL) { > + if ((len = readlink(argv[1], buffer, sizeof(buffer) - 1)) < 0) { > puts("Fehler: Symlink konnte nicht gelesen werden."); > return -1; > } > - > - len = fread(buffer, 1, 4095, file); > buffer[len] = 0; > - fclose(file); > > puts(buffer); > > diff --git a/src/modules/c/shell/cmds/symlink.c b/src/modules/c/shell/cmds/symlink.c > index c1dcc43..1379f2b 100644 > --- a/src/modules/c/shell/cmds/symlink.c > +++ b/src/modules/c/shell/cmds/symlink.c > @@ -54,16 +54,10 @@ void symlink_display_usage(void); > return -1; > } > > - FILE* file = fopen(argv[1], "lw"); > - > - if (file == NULL) { > + if (symlink(argv[2], argv[1])) { Ist das wirklich gleichbedeutend? Bei einem schon existierenden Symlink würde ich von der fopen-Variante erwarten, dass sie das Ziel ändert, während symlink mit EEXIST scheitern muss. From shyxormz at asxsoft.de Sun May 30 19:10:45 2010 From: shyxormz at asxsoft.de (Patrick Pokatilo) Date: Sun, 30 May 2010 19:10:45 +0200 Subject: [tyndur-devel] [PATCH] Translated some build scripts Message-ID: <1275239445-13314-1-git-send-email-shyxormz@asxsoft.de> Signed-off-by: Patrick Pokatilo --- build/scripts/create_partition | 4 +- build/scripts/get_partition | 4 +- build/scripts/image_cdrom | 10 ++++---- buildmk.sh | 40 +++++++++++++++++++------------------- config.py | 42 ++++++++++++++++++++-------------------- config.sh | 4 +- 6 files changed, 52 insertions(+), 52 deletions(-) diff --git a/build/scripts/create_partition b/build/scripts/create_partition index feb5574..78510b0 100755 --- a/build/scripts/create_partition +++ b/build/scripts/create_partition @@ -65,7 +65,7 @@ def le_dword(dword): # Abrrechen wenn kein Argument mit dem Pfad gefunden werden konnte if len(sys.argv) <= 1: - print 'Bitte Imagepfad angeben' + print 'Please specify an image path' sys.exit(-1) # Ansonsten wird der Pfad gespeichert @@ -74,7 +74,7 @@ image_path = sys.argv[1] # Image oeffnen image_file = open(image_path, mode='r+b') if image_file == 0: - print 'Image konnte nicht geoeffnet werden.' + print 'Image could not be opened.' sys.exit(-1) stat_info = os.lstat(image_path) image_size = stat_info[stat.ST_SIZE] diff --git a/build/scripts/get_partition b/build/scripts/get_partition index 0f89086..40e2d54 100755 --- a/build/scripts/get_partition +++ b/build/scripts/get_partition @@ -44,7 +44,7 @@ def le_dword(a, b, c, d): # Abrrechen wenn kein Argument mit dem Pfad gefunden werden konnte if len(sys.argv) <= 1: - print 'Bitte Imagepfad angeben' + print 'Please specify an image path' sys.exit(-1) # Ansonsten wird der Pfad gespeichert @@ -53,7 +53,7 @@ image_path = sys.argv[1] # Image oeffnen image_file = open(image_path, mode='rb') if image_file == 0: - print 'Image konnte nicht geoeffnet werden.' + print 'Image could not be opened.' sys.exit(-1) # Partitionstabelle vorbereiten und einlesen diff --git a/build/scripts/image_cdrom b/build/scripts/image_cdrom index 7f91a77..5c3d170 100755 --- a/build/scripts/image_cdrom +++ b/build/scripts/image_cdrom @@ -51,7 +51,7 @@ export MTOOLSRC=lostmtools.conf # Festplattenpartition kopieren if [ ! -f $HD_IMAGE_PATH ]; then - echo "Benoetige ein Festplattenimage" + echo "Require a hard disk image" exit 1 fi @@ -78,8 +78,8 @@ if [ -f $STAGE2_ELTORITO ]; then # Eltorito -boot-load-size 4 -boot-info-table -m .svn -o $IMAGE_PATH \ $ROOT $ROOT_COMMON $ROOT_CDROM - echo "CD-Image erfolgreich erstellt!" - echo "Verwendete Methode: Eltorito" + echo "CD image created successfully!" + echo "Used method: Eltorito" exit fi @@ -131,5 +131,5 @@ cp $FLOPPY_IMAGE_PATH $ROOT_CDROM mkisofs -b $(basename $FLOPPY_IMAGE_PATH) -m .svn -o $IMAGE_PATH $ROOT $ROOT_COMMON $ROOT_CDROM $ROOT_LOCAL rm $ROOT_CDROM/$(basename $FLOPPY_IMAGE_PATH) -echo "CD-Image erfolgreich erstellt!" -echo "Verwendete Methode: Floppy-Emulation" +echo "CD image created successfully!" +echo "Used method: Floppy emulation" diff --git a/buildmk.sh b/buildmk.sh index b9d4194..11c98e0 100644 --- a/buildmk.sh +++ b/buildmk.sh @@ -1,7 +1,7 @@ #!/bin/bash # Copyright (c) 2006 The tyndur Project. All rights reserved. -# +# # This code is derived from software contributed to the tyndur Project # by Kevin Wolf. # @@ -21,16 +21,16 @@ # 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 +# 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 +# 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. shopt -s extglob @@ -102,7 +102,7 @@ if [ "`pwd | grep '/src/kernel2'`" == "" ]; then cat <> Makefile \$(MAKE) --no-print-directory -s makefiles \$(MAKE) --no-print-directory -s subdirs - \$(MAKE) --no-print-directory -s obj + \$(MAKE) --no-print-directory -s obj EOF else cat <> Makefile @@ -154,14 +154,14 @@ echo subdirs: >> Makefile for file in lib rtl !(lib|rtl|arch) arch; do if [ -d "$file" ]; then if [ "$file" == "include" -o \( -f "$file/.nobuild" -a ! -f "$file/.ignorenobuild" \) ]; then - echo Ueberspringe `pwd`/$file/Makefile + echo Skip `pwd`/$file/Makefile continue fi if [ "`basename \`pwd\``" == "arch" ] && [ "$file" != "$LOST_ARCH" ]; then - echo Ueberspringe `pwd`/$file/Makefile + echo Skip `pwd`/$file/Makefile continue fi - echo Erzeuge `pwd`/$file/Makefile + echo Create `pwd`/$file/Makefile echo -e "\\t\$(MAKE)" --no-print-directory -sC "$file" >> Makefile # echo -e \\tmake -C "$file" '| (grep -vE "^(make|if)" || true)' >> Makefile @@ -179,13 +179,13 @@ for file in *.c *.cpp *.asm *.pas *.S; do *.c) echo ${file%.c}.o: $file >> Makefile echo -e \\techo "'CC $file: $CC'" >> Makefile - + echo -e \\t\$\(CC\) $file >> Makefile ;; *.cpp) echo ${file%.cpp}.o: $file >> Makefile echo -e \\techo "'CPP $file: $CPP'" >> Makefile - + echo -e \\t\$\(CPP\) $file >> Makefile ;; @@ -203,7 +203,7 @@ for file in *.c *.cpp *.asm *.pas *.S; do ;; *.pas) echo ${file%.pas}.o: $file >> Makefile - + echo -e \\techo "'PPC $file'" >> Makefile if [ "$file" == "system.pas" ]; then echo -e \\t\$\(PPC\) -Us -Fiinclude/inc/ -Fiinclude/i386/ -Fiinclude/common/ $file >> Makefile @@ -214,7 +214,7 @@ for file in *.c *.cpp *.asm *.pas *.S; do *.S) echo ${file%.S}.o: $file >> Makefile echo -e \\techo "'AS $file: $CPP'" >> Makefile - + echo -e \\t\$\(AS\) -o ${file%.S}.o $file >> Makefile ;; esac @@ -232,7 +232,7 @@ softclean: clean_objs for file in *; do if [ -f "\$\$file/Makefile" -a \( ! -f "\$\$file/.nobuild" -o -f "\$\$file/.ignorenobuild" \) ]; then \$(MAKE) -sC "\$\$file" softclean; fi done clean: clean_objs - for file in *; do if [ -f "\$\$file/Makefile" -a \( ! -f "\$\$file/.nobuild" -o -f "\$\$file/.ignorenobuild" \) ]; then \$(MAKE) -sC "\$\$file" clean; rm "\$\$file/Makefile"; fi done + for file in *; do if [ -f "\$\$file/Makefile" -a \( ! -f "\$\$file/.nobuild" -o -f "\$\$file/.ignorenobuild" \) ]; then \$(MAKE) -sC "\$\$file" clean; rm "\$\$file/Makefile"; fi done .SILENT: all makefiles subdirs obj clean softclean clean_objs clean_root updateroot image-floppy image-hd test-qemu test-qemu-hd EOF @@ -284,10 +284,10 @@ bugreport: gcc -v 2> bugreport/gcc.version nasm -v > bugreport/nasm.version ld -v > bugreport/ld.version - + cp build/*.mod bugreport/ cp build/*.krn bugreport/ - + tar cjf bugreport.tar.bz2 bugreport rm -rf bugreport EOF diff --git a/config.py b/config.py index f3748d6..1fd34e8 100755 --- a/config.py +++ b/config.py @@ -7,8 +7,8 @@ frontend = "dialog" result = os.popen('which ' + frontend) if result.read() == '': - print "\nDas gewuenschte Frontend (" + frontend + ") steht nicht zur Verfuegung." - print "Sie muessen ein anderes waehlen (editieren sie config.py), oder das gewaehlte installieren.\n" + print "\nThe selected frontend (" + frontend + ") is not available." + print "You have to select a different one (edit config.py) or install the selected.\n" sys.exit(1) @@ -16,16 +16,16 @@ class shift_register: def __init__(self, size): self.size = size self.data = {} - + for index in range(1, size): self.data[index] = "" - + def shift(self, value): for index in range(0, self.size - 1): self.data[self.size - index] = self.data[self.size - index - 1] - + self.data[1] = value - + def at(self, index): if index in range(1, self.size): return self.data[index] @@ -49,12 +49,12 @@ def show_dialog(options, define_name, define_value): return "#undef " + define_name elif options['type'] == 'text': result = os.popen(frontend + ' --stdout --title "' + title + '" --inputbox "' + options['desc'] + '" 0 0 "' + define_value + '"').readline() - + return '#define ' + define_name + ' ' + result - + elif options['type'] == 'radio': opts = options['values'].split(',') - + opts_list = '' for opt in opts: opts_list = opts_list + ' "' + opt + '" "" ' @@ -62,7 +62,7 @@ def show_dialog(options, define_name, define_value): opts_list += 'on' else: opts_list += 'off' - + result = os.popen(frontend + ' --stdout --title "' + title + '" --radiolist "' + options['desc'] + '" 0 0 ' + str(len(opts)) + ' ' + opts_list ).readline() return '#define ' + define_name + ' ' + result @@ -83,36 +83,36 @@ regex_option = re.compile('^\//%(.*?) ["\'`](.*?)["\'`]') for _line in lines: line = _line.strip() line_buffer.shift(line) - - + + if(regex_define.match(line)): options = {} for index in range(2, line_buffer.size): if regex_define.match(line_buffer.at(index)): break - + option_match = regex_option.match(line_buffer.at(index)) if option_match: options[option_match.group(1)] = option_match.group(2) - - + + match_define_complex = regex_define_complex.match(line) if(match_define_complex): define_name = match_define_complex.group(1) define_value = match_define_complex.group(2) print 'define name:`' + define_name + '` value:`' + match_define_complex.group(2) + '`' _line = _line.replace(line, show_dialog(options, define_name, define_value)) - + else: match_define_simple = regex_define_simple.match(line) is_defined = match_define_simple.group(1) define_name = match_define_simple.group(2) - + print 'define name:`' + define_name + '` value:`' + is_defined + '`' - + _line = _line.replace(line, show_dialog(options, define_name, is_defined)) - + config_file_dest.write(_line) @@ -120,5 +120,5 @@ for _line in lines: config_file_dest.close() config_file_source.close() -print "\n\nAls naechster Schritt ist in den meisten Faellen ein 'make clean' notwendig." -print "Anschliessend koennen mit 'make' der tyndur-Kernel und die Module erstellt werden.\n\n" +print "\n\nIn most cases the next step has to be 'make clean'." +print "Afterwards the tyndur-kernel and the modules can be created via 'make'.\n\n" diff --git a/config.sh b/config.sh index 0ae1246..676288a 100644 --- a/config.sh +++ b/config.sh @@ -19,7 +19,7 @@ fi if [ "$LOST_ARCH" == "amd64" ]; then COMPILER_PREFIX=$COMPILER_PREFIX_AMD64 - + LOST_TOOLS_AR=$COMPILER_PREFIX"ar" LOST_TOOLS_AS=$COMPILER_PREFIX"as -64" LOST_TOOLS_LD=$COMPILER_PREFIX"ld -m elf_x86_64" @@ -29,7 +29,7 @@ if [ "$LOST_ARCH" == "amd64" ]; then LOST_TOOLS_STRIP=$COMPILER_PREFIX"strip -F elf64-x86-64" else COMPILER_PREFIX=$COMPILER_PREFIX_I386 - + LOST_TOOLS_AR=$COMPILER_PREFIX"ar" LOST_TOOLS_AS=$COMPILER_PREFIX"as -32" LOST_TOOLS_LD=$COMPILER_PREFIX"ld -m elf_i386" -- 1.6.3.3 From kevin at tyndur.org Sun May 30 19:36:02 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Sun, 30 May 2010 19:36:02 +0200 Subject: [tyndur-devel] [PATCH] Shell: Beim cat nicht nur auf EOF sonder auch Fehler pruefen In-Reply-To: <1275221015-9558-1-git-send-email-toni@tyndur.org> References: <1275221015-9558-1-git-send-email-toni@tyndur.org> Message-ID: <20100530173602.GE13995@silvanus> On Sun, May 30, 2010 at 02:03:35PM +0200, Antoine Kaufmann wrote: > ! Shell: Beim cat nicht nur auf EOF sonder auch Fehler pruefen > > Signed-off-by: Antoine Kaufmann Acked-by: Kevin Wolf From kevin at tyndur.org Sun May 30 19:37:35 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Sun, 30 May 2010 19:37:35 +0200 Subject: [tyndur-devel] [PATCH] Libc: Fix fuer EOF-Erkennung in fgets() In-Reply-To: <1275221037-9950-1-git-send-email-toni@tyndur.org> References: <1275221037-9950-1-git-send-email-toni@tyndur.org> Message-ID: <20100530173734.GF13995@silvanus> On Sun, May 30, 2010 at 02:03:57PM +0200, Antoine Kaufmann wrote: > Libc: Wenn fgets() das Ende der Eingabe vor einem Zeilenumbruch erreichte, > fuehrte das bis jetzt zu einer Endlosschleife. > > Signed-off-by: Antoine Kaufmann Acked-by: Kevin Wolf From kevin at tyndur.org Sun May 30 19:44:57 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Sun, 30 May 2010 19:44:57 +0200 Subject: [tyndur-devel] [PATCH] kernel2: Code readonly mappen In-Reply-To: <1275221052-10187-1-git-send-email-toni@tyndur.org> References: <1275221052-10187-1-git-send-email-toni@tyndur.org> Message-ID: <20100530174457.GG13995@silvanus> On Sun, May 30, 2010 at 02:04:12PM +0200, Antoine Kaufmann wrote: > * kernel2: Code readonly mappen > > Signed-off-by: Antoine Kaufmann Acked-by: Kevin Wolf From kevin at tyndur.org Sun May 30 19:47:52 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Sun, 30 May 2010 19:47:52 +0200 Subject: [tyndur-devel] [PATCH 1/2] Libc: Alte Lostio-Debugmeldung entfernt In-Reply-To: <1275221073-10487-1-git-send-email-toni@tyndur.org> References: <1275221073-10487-1-git-send-email-toni@tyndur.org> Message-ID: <20100530174752.GH13995@silvanus> On Sun, May 30, 2010 at 02:04:32PM +0200, Antoine Kaufmann wrote: > * Libc: Alte Lostio-Debugmeldung entfernen beim oeffnen von inexistenten > Dateien. > > Signed-off-by: Antoine Kaufmann Acked-by: Kevin Wolf From kevin at tyndur.org Sun May 30 19:48:16 2010 From: kevin at tyndur.org (Kevin Wolf) Date: Sun, 30 May 2010 19:48:16 +0200 Subject: [tyndur-devel] [PATCH 2/2] init: Interpreter-Debugausgabe entfernt In-Reply-To: <1275221073-10487-2-git-send-email-toni@tyndur.org> References: <1275221073-10487-1-git-send-email-toni@tyndur.org> <1275221073-10487-2-git-send-email-toni@tyndur.org> Message-ID: <20100530174815.GI13995@silvanus> On Sun, May 30, 2010 at 02:04:33PM +0200, Antoine Kaufmann wrote: > - init: Interpreter-Debugausgabe > > Signed-off-by: Antoine Kaufmann Acked-by: Kevin Wolf