halos-cvs Mailing List for HALOS: A Light Operating System
Status: Pre-Alpha
Brought to you by:
blytkerchan
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(11) |
Sep
(155) |
Oct
(3) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
|
Feb
|
Mar
(115) |
Apr
(9) |
May
|
Jun
|
Jul
(9) |
Aug
(17) |
Sep
(3) |
Oct
(1) |
Nov
|
Dec
|
From: Ronald Landheer-C. <bly...@us...> - 2005-10-25 00:30:16
|
Update of /cvsroot/halos/cpu/i386 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26583 Modified Files: ChangeLog lapic.c Log Message: 2005-10-24 blytkerchan * lapic.c (lapic_init): fix a wrong-offset wrong-size write to the local APIC Index: lapic.c =================================================================== RCS file: /cvsroot/halos/cpu/i386/lapic.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- lapic.c 30 Aug 2005 01:49:53 -0000 1.4 +++ lapic.c 25 Oct 2005 00:30:07 -0000 1.5 @@ -140,7 +140,7 @@ /* we enable the local APIC by setting the software-enable flag in * the spurious interrupt vector register. This is bit 8 of field * lapic_siv in the APIC we just memory-mapped. */ - lapic->lapic_siv.bytes[1] |= 1; + lapic->lapic_siv.dwords[0] |= 0x00000100; /* As we haven't set up event handling yet at this time, we'll set * the spurious interrupt vector later and leave it at its default * for the moment. If we'd set it to something now, we wouldn't be Index: ChangeLog =================================================================== RCS file: /cvsroot/halos/cpu/i386/ChangeLog,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- ChangeLog 30 Aug 2005 01:49:53 -0000 1.17 +++ ChangeLog 25 Oct 2005 00:30:07 -0000 1.18 @@ -1,3 +1,7 @@ +2005-10-24 blytkerchan + * lapic.c (lapic_init): fix a wrong-offset wrong-size write to the + local APIC + 2005-08-29 blytkerchan * lapic.c (lapic_init): return -1 iff cpu_have_lapic() returns zero |
From: Ronald Landheer-C. <bly...@us...> - 2005-09-29 23:59:02
|
Update of /cvsroot/halos/klib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23457 Modified Files: ChangeLog macros.h Log Message: 2005-09-29 blytkerchan * macros.h [assert]: repair another silly error Index: macros.h =================================================================== RCS file: /cvsroot/halos/klib/macros.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- macros.h 26 Aug 2005 02:04:11 -0000 1.5 +++ macros.h 29 Sep 2005 23:58:53 -0000 1.6 @@ -38,7 +38,7 @@ #ifndef NDEBUG #define PANIC_ON(x) if (x) panic("fail: %s", #x) -#define assert(x) if (!x) panic("Assertion failed: %s", #x) +#define assert(x) if (!(x)) panic("Assertion failed: %s", #x) #define DEB(x) #x #else #define PANIC_ON(x) (void)(x) Index: ChangeLog =================================================================== RCS file: /cvsroot/halos/klib/ChangeLog,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- ChangeLog 26 Aug 2005 02:04:11 -0000 1.10 +++ ChangeLog 29 Sep 2005 23:58:53 -0000 1.11 @@ -1,3 +1,6 @@ +2005-09-29 blytkerchan + * macros.h [assert]: repair another silly error + 2005-08-25 blytkerchan * macros.h [assert]: repair silly error |
From: Ronald Landheer-C. <bly...@us...> - 2005-09-29 23:58:04
|
Update of /cvsroot/halos/event/i386 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23287 Modified Files: ChangeLog i8259.c Added Files: i8259.h Log Message: 2005-09-29 blytkerchan * i8259.c: include i8259.h (i8259_init): new function * i8259.h: new file Index: ChangeLog =================================================================== RCS file: /cvsroot/halos/event/i386/ChangeLog,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- ChangeLog 30 Aug 2005 01:45:38 -0000 1.20 +++ ChangeLog 29 Sep 2005 23:57:57 -0000 1.21 @@ -1,3 +1,8 @@ +2005-09-29 blytkerchan + * i8259.c: include i8259.h + (i8259_init): new function + * i8259.h: new file + 2005-08-29 blytkerchan * i82489DX.c: new file * i8259.c: ditto --- NEW FILE: i8259.h --- #ifndef event_arch_i8259A_h #define event_arch_i8259A_h int i8259_init(void); #endif Index: i8259.c =================================================================== RCS file: /cvsroot/halos/event/i386/i8259.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- i8259.c 30 Aug 2005 01:45:38 -0000 1.1 +++ i8259.c 29 Sep 2005 23:57:57 -0000 1.2 @@ -0,0 +1,10 @@ +#include "i8259A.h" + +int i8259A_init(void) +{ + /* To initialize the i8259A, we need to send a number of + * Initialization Command Words (ICWs) */ + /* */ + +} + |
From: Ronald Landheer-C. <bly...@us...> - 2005-09-29 23:56:41
|
Update of /cvsroot/halos/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23167 Modified Files: ChangeLog configure.ac.in Log Message: 2004-09-29 blytkerchan * configure.ac.in [CC]: if $CC is not set, assume gcc Index: configure.ac.in =================================================================== RCS file: /cvsroot/halos/config/configure.ac.in,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- configure.ac.in 17 Aug 2005 01:35:22 -0000 1.8 +++ configure.ac.in 29 Sep 2005 23:56:33 -0000 1.9 @@ -11,7 +11,11 @@ AC_SUBST(ARCH, ${host_cpu}) # Checks for programs. -export CC="$CC -g -ffreestanding" +if test "x$CC" = x; then + export CC="gcc -g -ffreestanding" +else + export CC="$CC -g -ffreestanding" +fi AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL Index: ChangeLog =================================================================== RCS file: /cvsroot/halos/config/ChangeLog,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- ChangeLog 17 Aug 2005 01:35:22 -0000 1.20 +++ ChangeLog 29 Sep 2005 23:56:33 -0000 1.21 @@ -1,3 +1,6 @@ +2004-09-29 blytkerchan + * configure.ac.in [CC]: if $CC is not set, assume gcc + 2005-08-16 blytkerchan * Makefile.in.in [real_all]: add install_kernel as prereq * configure.ac.in [CC]: export as $CC -g -ffreestanding to allow |
From: Ronald Landheer-C. <bly...@us...> - 2005-08-30 01:51:32
|
Update of /cvsroot/halos/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5683 Modified Files: 00-index ChangeLog Added Files: 24201606.pdf Log Message: 2005-08-29 blytkerchan * 24201606.pdf: new file * 00-index: reflect above --- NEW FILE: 24201606.pdf --- (This appears to be a binary file; contents omitted.) Index: 00-index =================================================================== RCS file: /cvsroot/halos/doc/00-index,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- 00-index 26 Aug 2005 01:59:10 -0000 1.7 +++ 00-index 30 Aug 2005 01:51:23 -0000 1.8 @@ -1,19 +1,15 @@ * 00-index: this file -* elf11g.zip: documentation of the ELF format -* ELF_Format.pdf: description of the ELF format -* multiboot.txt: multiboot standard as downloaded from - http://www.gnu.org/software/grub/manual/multiboot/multiboot.txt * 24161826.pdf: "Intel(r) Processor Identification and the CPUID Instruction" Application Note 485 June 2004 http://developer.intel.ru/download/design/Xeon/applnots/24161826.pdf +* 24201606.pdf: MultiProcessor Specification + Version 1.4 May 1997 * 24319001.pdf: Intel architecture software developer's manual Volume 1: Basic archtecture -* 25366514.pdf: ditto for the Pentium IV -* links.html: miscelanious interesting links -* magic.txt: magic numbers used in Halos * 24319202.pdf: Intel architecture software developer's manual Volume 3: System Programming (i486) +* 25366514.pdf: ditto for the Pentium IV * 25366816.pdf: Intel architecture software developer's manual Volume 3: System programming guide (IA-32 P4) * 27316601.pdf: 80960RM/RN Processor Initialization: Programming Guide & Initialization Code @@ -21,5 +17,9 @@ Preliminary version * 29071001.pdf: 82093AA I/O Advanced Programmable Interrupt Controller (IOAPIC) Specification update - - +* elf11g.zip: documentation of the ELF format +* ELF_Format.pdf: description of the ELF format +* magic.txt: magic numbers used in Halos +* multiboot.txt: multiboot standard as downloaded from + http://www.gnu.org/software/grub/manual/multiboot/multiboot.txt +* links.html: miscelanious interesting links Index: ChangeLog =================================================================== RCS file: /cvsroot/halos/doc/ChangeLog,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- ChangeLog 26 Aug 2005 01:59:10 -0000 1.10 +++ ChangeLog 30 Aug 2005 01:51:23 -0000 1.11 @@ -1,3 +1,7 @@ +2005-08-29 blytkerchan + * 24201606.pdf: new file + * 00-index: reflect above + 2005-08-25 blytkerchan * 24319202.pdf: new file * 25366816.pdf: ditto |
From: Ronald Landheer-C. <bly...@us...> - 2005-08-30 01:50:01
|
Update of /cvsroot/halos/cpu/i386 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5387 Modified Files: ChangeLog lapic.c Log Message: 2005-08-29 blytkerchan * lapic.c (lapic_init): return -1 iff cpu_have_lapic() returns zero Index: lapic.c =================================================================== RCS file: /cvsroot/halos/cpu/i386/lapic.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- lapic.c 26 Aug 2005 02:01:53 -0000 1.3 +++ lapic.c 30 Aug 2005 01:49:53 -0000 1.4 @@ -146,8 +146,9 @@ * for the moment. If we'd set it to something now, we wouldn't be * able to handle the interrupt anyway.. */ - /* If initializing the local APIC failed, return failure */ - if (cpu_have_lapic() != 0) + /* If initializing the local APIC failed (or if we don't have one), + * return failure */ + if (!cpu_have_lapic()) return -1; return 0; Index: ChangeLog =================================================================== RCS file: /cvsroot/halos/cpu/i386/ChangeLog,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- ChangeLog 26 Aug 2005 02:01:53 -0000 1.16 +++ ChangeLog 30 Aug 2005 01:49:53 -0000 1.17 @@ -1,3 +1,6 @@ +2005-08-29 blytkerchan + * lapic.c (lapic_init): return -1 iff cpu_have_lapic() returns zero + 2005-08-25 blytkerchan * cpu.c: s/cpu_have_apic/cpu_have_lapic/g (cpu_get_cs): move into header |
From: Ronald Landheer-C. <bly...@us...> - 2005-08-30 01:45:49
|
Update of /cvsroot/halos/event/i386 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4690 Modified Files: ChangeLog event.c Added Files: i82489DX.c i8259.c Log Message: 2005-08-29 blytkerchan * i82489DX.c: new file * i8259.c: ditto * event.c (event_arch_init): don't panic of local APIC doesn't initialize Index: ChangeLog =================================================================== RCS file: /cvsroot/halos/event/i386/ChangeLog,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- ChangeLog 26 Aug 2005 01:57:01 -0000 1.19 +++ ChangeLog 30 Aug 2005 01:45:38 -0000 1.20 @@ -1,3 +1,9 @@ +2005-08-29 blytkerchan + * i82489DX.c: new file + * i8259.c: ditto + * event.c (event_arch_init): don't panic of local APIC doesn't + initialize + 2005-08-25 blytkerchan * event.c: include cpu/arch/lapic.h (event_arch_init): call lapic_init and panic on failure --- NEW FILE: i82489DX.c --- Index: event.c =================================================================== RCS file: /cvsroot/halos/event/i386/event.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- event.c 26 Aug 2005 01:57:01 -0000 1.5 +++ event.c 30 Aug 2005 01:45:38 -0000 1.6 @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include <klib/macros.h> +#include <cpu/arch/cpu.h> #include <cpu/arch/lapic.h> #define __event_arch_ #include "wrappers.h" @@ -41,7 +42,21 @@ int event_arch_init(void * arg) { - PANIC_ON(lapic_init()); + /* try to initialize the local APIC. Once this is done, cpu_have_lapic() + * will return nonzero (which is tested at the end of the routine + * we're calling, so we don't test again). If this doesn't succeed, + * we don't have a local APIC or it was shut down in a way we can't + * safely turn it on again (and, in the latter case, we don't try: + * we're not working on Linux here). In such a case, we'll use the + * PIC in stead (but we assert that we can safely do that by asserting + * cpu_have_lapic returns zero) */ + if (lapic_init() != 0) + { + assert(!cpu_have_lapic()); + /* Don't have an APIC - use the 8249A in stead */ + + } + PANIC_ON(event_arch_wrappers_init()); PANIC_ON(interrupt_init()); PANIC_ON(irq_init()); --- NEW FILE: i8259.c --- |
From: Ronald Landheer-C. <bly...@us...> - 2005-08-26 02:04:19
|
Update of /cvsroot/halos/klib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7368 Modified Files: ChangeLog macros.h Log Message: 2005-08-25 blytkerchan * macros.h [assert]: repair silly error Index: macros.h =================================================================== RCS file: /cvsroot/halos/klib/macros.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- macros.h 30 Mar 2005 00:45:51 -0000 1.4 +++ macros.h 26 Aug 2005 02:04:11 -0000 1.5 @@ -38,7 +38,7 @@ #ifndef NDEBUG #define PANIC_ON(x) if (x) panic("fail: %s", #x) -#define assert(x) if (x) panic("Assertion failed: %s", #x) +#define assert(x) if (!x) panic("Assertion failed: %s", #x) #define DEB(x) #x #else #define PANIC_ON(x) (void)(x) Index: ChangeLog =================================================================== RCS file: /cvsroot/halos/klib/ChangeLog,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- ChangeLog 30 Mar 2005 00:45:51 -0000 1.9 +++ ChangeLog 26 Aug 2005 02:04:11 -0000 1.10 @@ -1,3 +1,6 @@ +2005-08-25 blytkerchan + * macros.h [assert]: repair silly error + 2005-03-28 blytkerchan (committed on 2005-03-29) * macros.h [DEB]: new macro |
From: Ronald Landheer-C. <bly...@us...> - 2005-08-26 02:03:43
|
Update of /cvsroot/halos/klib/arch/i386 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7258 Modified Files: ChangeLog types.h Log Message: 2005-08-25 blytkerchan * types.h: add uint64_t and int64_t Index: types.h =================================================================== RCS file: /cvsroot/halos/klib/arch/i386/types.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- types.h 5 Mar 2005 02:17:51 -0000 1.4 +++ types.h 26 Aug 2005 02:03:35 -0000 1.5 @@ -41,6 +41,8 @@ typedef uint32_t size_t; typedef signed short int16_t; typedef unsigned short uint16_t; +typedef unsigned long long int uint64_t; +typedef signed long long int int64_t; #endif Index: ChangeLog =================================================================== RCS file: /cvsroot/halos/klib/arch/i386/ChangeLog,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- ChangeLog 12 Aug 2005 01:05:56 -0000 1.18 +++ ChangeLog 26 Aug 2005 02:03:35 -0000 1.19 @@ -1,3 +1,6 @@ +2005-08-25 blytkerchan + * types.h: add uint64_t and int64_t + 2005-08-11 blytkerchan * compare_and_exchange.c (compare_and_echange_uint): new function * compare_and_exchange.h: ditto |
From: Ronald Landheer-C. <bly...@us...> - 2005-08-26 02:02:53
|
Update of /cvsroot/halos/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7104 Modified Files: ChangeLog main.c Log Message: 2005-08-25 blytkerchan * main.c: s/cpu_have_apic/cpu_have_lapic/g Index: main.c =================================================================== RCS file: /cvsroot/halos/kernel/main.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- main.c 25 Aug 2005 02:12:52 -0000 1.11 +++ main.c 26 Aug 2005 02:02:45 -0000 1.12 @@ -20,7 +20,7 @@ clear_screen(); kprint("Hello from Halos: a light operating system\n"); kprintf("According to the multiboot-loader, we have:\n\tmem_lower: %dK\n\tmem_upper: %dK\n", system_info->mem_lower, system_info->mem_upper); - kprintf("The CPU does %shave a local APIC\n", cpu_have_apic() ? "" : "not "); + kprintf("The CPU does %shave a local APIC\n", cpu_have_lapic() ? "" : "not "); /* we end with an endless loop - the loader doesn't expect us to return * and possibly jumped to us rather than called us */ while (1); Index: ChangeLog =================================================================== RCS file: /cvsroot/halos/kernel/ChangeLog,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- ChangeLog 25 Aug 2005 02:12:52 -0000 1.13 +++ ChangeLog 26 Aug 2005 02:02:45 -0000 1.14 @@ -1,3 +1,6 @@ +2005-08-25 blytkerchan + * main.c: s/cpu_have_apic/cpu_have_lapic/g + 2005-08-24 blytkerchan * main.c (kernel_main): initialize memory management before events: APIC initialization needs to reserve physical memory |
From: Ronald Landheer-C. <bly...@us...> - 2005-08-26 02:02:01
|
Update of /cvsroot/halos/cpu/i386 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6962 Modified Files: ChangeLog cpu.c cpu.h lapic.c lapic.h Log Message: 2005-08-25 blytkerchan * cpu.c: s/cpu_have_apic/cpu_have_lapic/g (cpu_get_cs): move into header * cpu.h: s/cpu_have_apic/cpu_have_lapic/g [CPU_MSR_APICBASE]: new macro (cpu_get_cs): move here (cpu_read_msr): new function (cpu_is_bootstrap): ditto * lapic.c: include cpu.h (lapic_init): see if the APIC can safly be initialized before attempting to do so don't assert the APIC size check for success before returning anything (lapic_id): new function (lapic_version): ditto (lapic_max_lvt): ditto * lapic.h: reflect above Index: cpu.h =================================================================== RCS file: /cvsroot/halos/cpu/i386/cpu.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- cpu.h 26 Mar 2005 20:13:28 -0000 1.9 +++ cpu.h 26 Aug 2005 02:01:53 -0000 1.10 @@ -41,6 +41,8 @@ #include <sys/types.h> #endif +#define CPU_MSR_APICBASE 0x001b + /* the CPU signature type */ typedef struct _cpu_signature_t { @@ -56,7 +58,7 @@ /* nonzero if we have the cpuid instruction */ int cpu_have_cpuid(void); /* nonzero if we have a local APIC */ -int cpu_have_apic(void); +int cpu_have_lapic(void); /* See if we have SSEE support in the CPU */ int cpu_have_sse(void); @@ -66,5 +68,39 @@ /* get the CPU signature - return CPU_SIGNATURE_INVALID if none is available */ cpu_signature_t cpu_get_signature(void); /* get the current code segment descriptor */ -uint16_t cpu_get_cs(void); +static inline uint16_t cpu_get_cs(void) +{ + uint16_t retval; + + asm volatile( + "movw %%cs, %0" + : "=r" (retval) + : /* no inputs */ + ); + + return retval; +} + +/* Read from model-specific register */ +static inline uint64_t cpu_read_msr(uint32_t msr) +{ + uint64_t retval; + + asm volatile( + "rdmsr\n" + : "=A" (retval) + : "c" (msr) + ); + + return retval; +} + +/* Check whether the current CPU is the bootstrap CPU */ +static inline int cpu_is_bootstrap(void) +{ + uint64_t msr = cpu_read_msr(CPU_MSR_APICBASE); + + return msr & 0x0100; +} + #endif Index: cpu.c =================================================================== RCS file: /cvsroot/halos/cpu/i386/cpu.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- cpu.c 26 Mar 2005 20:13:28 -0000 1.12 +++ cpu.c 26 Aug 2005 02:01:53 -0000 1.13 @@ -80,7 +80,7 @@ return retval; } -int cpu_have_apic(void) +int cpu_have_lapic(void) { int retval; @@ -172,15 +172,4 @@ return retval; } -uint16_t cpu_get_cs(void) -{ - uint16_t retval; - - asm( "movw %%cs, %0" - : "=r" (retval) - : /* no inputs */ - ); - - return retval; -} Index: lapic.c =================================================================== RCS file: /cvsroot/halos/cpu/i386/lapic.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- lapic.c 25 Aug 2005 02:19:29 -0000 1.2 +++ lapic.c 26 Aug 2005 02:01:53 -0000 1.3 @@ -14,6 +14,7 @@ #include <mm/arch/mm.h> #include <mm/arch/physmem.h> #include "lapic.h" +#include "cpu.h" /* maximum number of local vector table entries */ #define LVT_ENTRIES_MAX 5 @@ -117,10 +118,23 @@ int lapic_init(void) { assert(lapic == NULL); + + /* First see if we can safely enable the APIC: bit 11 of the APIC + * MSR must be set.. */ + uint64_t msr = cpu_read_msr(CPU_MSR_APICBASE); + if ((msr & 0x00000800) != 0x00000800) + { + /* We can only enable the APIC safely if the CPU has a + * front-side bus which is uses for interrupt handling. + * We don't check that and don't assuime that, so we + * don't re-enable the local APIC */ + return -1; + } + /* Note that all we do here is allocate a page to map on. There's no * virtual memory involved here and there can't be.. */ lapic = LAPIC_ADDR; - assert(sizeof(lapic_t) <= MM_ARCH_PAGE_SIZE); + physmem_arch_reserve((void*)lapic, (void*)lapic + sizeof(lapic_t)); /* we enable the local APIC by setting the software-enable flag in @@ -131,7 +145,32 @@ * the spurious interrupt vector later and leave it at its default * for the moment. If we'd set it to something now, we wouldn't be * able to handle the interrupt anyway.. */ + + /* If initializing the local APIC failed, return failure */ + if (cpu_have_lapic() != 0) + return -1; return 0; } +int lapic_id(void) +{ + assert(lapic != NULL); + + return lapic->lapic_id.bytes[3]; +} + +int lapic_version(void) +{ + assert(lapic != NULL); + + return lapic->lapic_version.bytes[0]; +} + +int lapic_max_lvt(void) +{ + assert(lapic != NULL); + + return lapic->lapic_version.bytes[2]; +} + Index: lapic.h =================================================================== RCS file: /cvsroot/halos/cpu/i386/lapic.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- lapic.h 25 Aug 2005 02:19:29 -0000 1.2 +++ lapic.h 26 Aug 2005 02:01:53 -0000 1.3 @@ -6,5 +6,9 @@ int lapic_init(void); +int lapic_id(void); +int lapic_version(void); +int lapic_max_lvt(void); + #endif Index: ChangeLog =================================================================== RCS file: /cvsroot/halos/cpu/i386/ChangeLog,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- ChangeLog 25 Aug 2005 02:19:29 -0000 1.15 +++ ChangeLog 26 Aug 2005 02:01:53 -0000 1.16 @@ -1,3 +1,21 @@ +2005-08-25 blytkerchan + * cpu.c: s/cpu_have_apic/cpu_have_lapic/g + (cpu_get_cs): move into header + * cpu.h: s/cpu_have_apic/cpu_have_lapic/g + [CPU_MSR_APICBASE]: new macro + (cpu_get_cs): move here + (cpu_read_msr): new function + (cpu_is_bootstrap): ditto + * lapic.c: include cpu.h + (lapic_init): see if the APIC can safly be initialized before + attempting to do so + don't assert the APIC size + check for success before returning anything + (lapic_id): new function + (lapic_version): ditto + (lapic_max_lvt): ditto + * lapic.h: reflect above + 2005-08-24 blytkerchan * lapic.c: include klib/arch/defines.h [lapic_entry_t]: new type |
From: Ronald Landheer-C. <bly...@us...> - 2005-08-26 01:59:17
|
Update of /cvsroot/halos/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5650 Modified Files: 00-index ChangeLog Added Files: 24319202.pdf 25366816.pdf 27316601.pdf 29056601.pdf 29071001.pdf Log Message: 2005-08-25 blytkerchan * 24319202.pdf: new file * 25366816.pdf: ditto * 27316601.pdf: ditto * 29056601.pdf: ditto * 29071001.pdf: ditto * 00-index: reflect above --- NEW FILE: 27316601.pdf --- (This appears to be a binary file; contents omitted.) Index: ChangeLog =================================================================== RCS file: /cvsroot/halos/doc/ChangeLog,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- ChangeLog 24 Mar 2005 01:48:51 -0000 1.9 +++ ChangeLog 26 Aug 2005 01:59:10 -0000 1.10 @@ -1,3 +1,11 @@ +2005-08-25 blytkerchan + * 24319202.pdf: new file + * 25366816.pdf: ditto + * 27316601.pdf: ditto + * 29056601.pdf: ditto + * 29071001.pdf: ditto + * 00-index: reflect above + 2005-03-23 blytkerchan * elf11g.zip: new file * ELF_Format.pdf: ditto --- NEW FILE: 24319202.pdf --- (This appears to be a binary file; contents omitted.) Index: 00-index =================================================================== RCS file: /cvsroot/halos/doc/00-index,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- 00-index 24 Mar 2005 01:48:51 -0000 1.6 +++ 00-index 26 Aug 2005 01:59:10 -0000 1.7 @@ -12,4 +12,14 @@ * 25366514.pdf: ditto for the Pentium IV * links.html: miscelanious interesting links * magic.txt: magic numbers used in Halos - +* 24319202.pdf: Intel architecture software developer's manual + Volume 3: System Programming (i486) +* 25366816.pdf: Intel architecture software developer's manual + Volume 3: System programming guide (IA-32 P4) +* 27316601.pdf: 80960RM/RN Processor Initialization: Programming Guide & Initialization Code +* 29056601.pdf: 82093AA I/O Advanced Programmable Interrupt Controller (IOAPIC) + Preliminary version +* 29071001.pdf: 82093AA I/O Advanced Programmable Interrupt Controller (IOAPIC) + Specification update + + --- NEW FILE: 29056601.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: 29071001.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: 25366816.pdf --- (This appears to be a binary file; contents omitted.) |
From: Ronald Landheer-C. <bly...@us...> - 2005-08-26 01:57:08
|
Update of /cvsroot/halos/event/i386 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6067 Modified Files: ChangeLog event.c irq.c Log Message: 2005-08-25 blytkerchan * event.c: include cpu/arch/lapic.h (event_arch_init): call lapic_init and panic on failure * irq.c: s/cpu_have_apic/cpu_have_lapic/g Index: event.c =================================================================== RCS file: /cvsroot/halos/event/i386/event.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- event.c 5 Mar 2005 02:12:56 -0000 1.4 +++ event.c 26 Aug 2005 01:57:01 -0000 1.5 @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include <klib/macros.h> +#include <cpu/arch/lapic.h> #define __event_arch_ #include "wrappers.h" #include "interrupt.h" @@ -40,6 +41,7 @@ int event_arch_init(void * arg) { + PANIC_ON(lapic_init()); PANIC_ON(event_arch_wrappers_init()); PANIC_ON(interrupt_init()); PANIC_ON(irq_init()); Index: irq.c =================================================================== RCS file: /cvsroot/halos/event/i386/irq.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- irq.c 20 Sep 2004 23:53:27 -0000 1.4 +++ irq.c 26 Aug 2005 01:57:01 -0000 1.5 @@ -43,7 +43,7 @@ * In any case, interrupt 0-32 are considered reserved: interrupts 0-15 * are considered reserved by the APIC, but interrupts 16-32 are also * reserved for other purposes. */ - if (cpu_have_apic()) + if (cpu_have_lapic()) { /* tell the APIC to route IRQs 0-15 to interrupts 32-47 */ } Index: ChangeLog =================================================================== RCS file: /cvsroot/halos/event/i386/ChangeLog,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- ChangeLog 13 Mar 2005 21:48:42 -0000 1.18 +++ ChangeLog 26 Aug 2005 01:57:01 -0000 1.19 @@ -1,3 +1,8 @@ +2005-08-25 blytkerchan + * event.c: include cpu/arch/lapic.h + (event_arch_init): call lapic_init and panic on failure + * irq.c: s/cpu_have_apic/cpu_have_lapic/g + 2005-03-13 blytkerchan * wrappers.S (event_arch_wrappers_init): remove debug symbol (__interrupt_handler_ptrs): allocate space differently |
From: Ronald Landheer-C. <bly...@us...> - 2005-08-25 02:19:39
|
Update of /cvsroot/halos/cpu/i386 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13135 Modified Files: ChangeLog lapic.c lapic.h Log Message: 2005-08-24 blytkerchan * lapic.c: include klib/arch/defines.h [lapic_entry_t]: new type [lapic]: make a lapic_t (lapic_init): minor fixes: s/lapic_addr/lapic/g and return a value * lapic.h: have lapic_init return an int Index: lapic.c =================================================================== RCS file: /cvsroot/halos/cpu/i386/lapic.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- lapic.c 25 Aug 2005 02:11:15 -0000 1.1 +++ lapic.c 25 Aug 2005 02:19:29 -0000 1.2 @@ -10,6 +10,7 @@ * For information on how this works, have a look at 25366816.pdf in the doc/ * module, which is Intel's System Programming Guide for Pentium IV */ #include <klib/macros.h> +#include <klib/arch/defines.h> #include <mm/arch/mm.h> #include <mm/arch/physmem.h> #include "lapic.h" @@ -31,6 +32,14 @@ /* memory-mapped local APIC. Note that the first comment column of the * comments denotes the access: R for read-oly, W for write-only; RW * for read/write */ +union lapic_entry_type +{ + uint32_t dwords[4]; + uint16_t words[8]; + uint8_t bytes[16]; +}; +typedef union lapic_entry_type lapic_entry_t; + struct lapic_type { lapic_entry_t lapic_reserved0; @@ -100,19 +109,19 @@ }; /* This is where the local APIC will be mapped */ -static volatile void * lapic = NULL; +static volatile lapic_t * lapic = NULL; /* Initialize the local APIC. We assume that this is only done once, that the * memory manager is available (i.e. malloc works) and this has not been done * yet. */ int lapic_init(void) { - assert(lapic_addr == NULL); + assert(lapic == NULL); /* Note that all we do here is allocate a page to map on. There's no * virtual memory involved here and there can't be.. */ - lapic_addr = LAPIC_ADDR; + lapic = LAPIC_ADDR; assert(sizeof(lapic_t) <= MM_ARCH_PAGE_SIZE); - physmem_arch_reserve(lapic_addr, lapic_addr + sizeof(lapic_t)); + physmem_arch_reserve((void*)lapic, (void*)lapic + sizeof(lapic_t)); /* we enable the local APIC by setting the software-enable flag in * the spurious interrupt vector register. This is bit 8 of field @@ -122,5 +131,7 @@ * the spurious interrupt vector later and leave it at its default * for the moment. If we'd set it to something now, we wouldn't be * able to handle the interrupt anyway.. */ + + return 0; } Index: lapic.h =================================================================== RCS file: /cvsroot/halos/cpu/i386/lapic.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- lapic.h 25 Aug 2005 02:11:15 -0000 1.1 +++ lapic.h 25 Aug 2005 02:19:29 -0000 1.2 @@ -4,7 +4,7 @@ struct lapic_type; typedef struct lapic_type lapic_t; -void lapic_init(void); +int lapic_init(void); #endif Index: ChangeLog =================================================================== RCS file: /cvsroot/halos/cpu/i386/ChangeLog,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- ChangeLog 25 Aug 2005 02:11:15 -0000 1.14 +++ ChangeLog 25 Aug 2005 02:19:29 -0000 1.15 @@ -1,4 +1,10 @@ 2005-08-24 blytkerchan + * lapic.c: include klib/arch/defines.h + [lapic_entry_t]: new type + [lapic]: make a lapic_t + (lapic_init): minor fixes: s/lapic_addr/lapic/g and return a value + * lapic.h: have lapic_init return an int + * lapic.c: new file * lapic.h: ditto |
From: Ronald Landheer-C. <bly...@us...> - 2005-08-25 02:13:00
|
Update of /cvsroot/halos/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11816 Modified Files: ChangeLog main.c Log Message: 2005-08-24 blytkerchan * main.c (kernel_main): initialize memory management before events: APIC initialization needs to reserve physical memory Index: main.c =================================================================== RCS file: /cvsroot/halos/kernel/main.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- main.c 17 Jul 2005 03:46:53 -0000 1.10 +++ main.c 25 Aug 2005 02:12:52 -0000 1.11 @@ -13,8 +13,8 @@ if (magic != 0x2badb002) bprint("Bad magic number\n"); - PANIC_ON(event_init(system_info)); PANIC_ON(mm_init(system_info)); + PANIC_ON(event_init(system_info)); PANIC_ON(driver_init(system_info, 1)); clear_screen(); Index: ChangeLog =================================================================== RCS file: /cvsroot/halos/kernel/ChangeLog,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- ChangeLog 17 Jul 2005 03:46:53 -0000 1.12 +++ ChangeLog 25 Aug 2005 02:12:52 -0000 1.13 @@ -1,3 +1,7 @@ +2005-08-24 blytkerchan + * main.c (kernel_main): initialize memory management before events: + APIC initialization needs to reserve physical memory + 2005-07-16 blytkerchan * main.c (kernel_main): call driver_init |
From: Ronald Landheer-C. <bly...@us...> - 2005-08-25 02:11:23
|
Update of /cvsroot/halos/cpu/i386 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11367 Modified Files: ChangeLog module.mk Added Files: lapic.c lapic.h Log Message: 2005-08-24 blytkerchan * lapic.c: new file * lapic.h: ditto * module.mk: reflect above Index: ChangeLog =================================================================== RCS file: /cvsroot/halos/cpu/i386/ChangeLog,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- ChangeLog 26 Mar 2005 20:13:28 -0000 1.13 +++ ChangeLog 25 Aug 2005 02:11:15 -0000 1.14 @@ -1,3 +1,7 @@ +2005-08-24 blytkerchan + * lapic.c: new file + * lapic.h: ditto + 2005-03-26 blytkerchan * cpu.c (cpu_have_sse): new function * cpu.h: reflect above --- NEW FILE: lapic.c --- /* This file contains whatever we need to work with the local APICs * This file was created on the 24th of august 2005, after tests with a * Pentium III @ 450 MHz showed that the existing code to detect a local * APIC didn't always work - i.e. the BIOS had de-activated the local APIC. * * A bit like the FreeBSD equivalent, on which I've (slightly) based my * implementation, the local APIC functions have a lapic_ prefix whereas the * I/O APIC functions have an ioapic_ prefix. * * For information on how this works, have a look at 25366816.pdf in the doc/ * module, which is Intel's System Programming Guide for Pentium IV */ #include <klib/macros.h> #include <mm/arch/mm.h> #include <mm/arch/physmem.h> #include "lapic.h" /* maximum number of local vector table entries */ #define LVT_ENTRIES_MAX 5 #define LAPIC_ADDR (void*)0xfee00000 /* local vector table entry type */ struct lvt_entry_type { int edge_trigger : 1; int active_high : 1; int masked : 1; int active : 1; int mode : 16; int vector : 8; }; /* memory-mapped local APIC. Note that the first comment column of the * comments denotes the access: R for read-oly, W for write-only; RW * for read/write */ struct lapic_type { lapic_entry_t lapic_reserved0; lapic_entry_t lapic_reserved1; lapic_entry_t lapic_id; // RW Local APIC ID register lapic_entry_t lapic_version; // R Local APIC version register lapic_entry_t lapic_reserved2; lapic_entry_t lapic_reserved3; lapic_entry_t lapic_reserved4; lapic_entry_t lapic_reserved5; lapic_entry_t lapic_tpr; // RW task priority register (TPR) lapic_entry_t lapic_apr; // R arbitration priority register (APR) lapic_entry_t lapic_ppr; // R processor priority register (PPR) lapic_entry_t lapic_eio; // W EIO register lapic_entry_t lapic_reserved6; lapic_entry_t lapic_ldr; // RW Logical Destination Register (LDR) lapic_entry_t lapic_dfr; // R Destination Format Register (DFR). Note that the upper bits 29 through 31 are RW lapic_entry_t lapic_siv; // R Spurious Interrupt Vector Register. Note that bits 0 through 8 are RW lapic_entry_t lapic_isr0; // R In-service registers (ISRs) lapic_entry_t lapic_isr1; lapic_entry_t lapic_isr2; lapic_entry_t lapic_isr3; lapic_entry_t lapic_isr4; lapic_entry_t lapic_isr5; lapic_entry_t lapic_isr6; lapic_entry_t lapic_isr7; lapic_entry_t lapic_tmr0; // R Trigger-Mode Registers (TMRs) lapic_entry_t lapic_tmr1; lapic_entry_t lapic_tmr2; lapic_entry_t lapic_tmr3; lapic_entry_t lapic_tmr4; lapic_entry_t lapic_tmr5; lapic_entry_t lapic_tmr6; lapic_entry_t lapic_tmr7; lapic_entry_t lapic_irr0; // R Interrupt Request Registers (IRRs) lapic_entry_t lapic_irr1; lapic_entry_t lapic_irr2; lapic_entry_t lapic_irr3; lapic_entry_t lapic_irr4; lapic_entry_t lapic_irr5; lapic_entry_t lapic_irr6; lapic_entry_t lapic_irr7; lapic_entry_t lapic_esr; // R Error status register lapic_entry_t lapic_reserved7; lapic_entry_t lapic_reserved8; lapic_entry_t lapic_reserved9; lapic_entry_t lapic_reservedA; lapic_entry_t lapic_reservedB; lapic_entry_t lapic_reservedC; lapic_entry_t lapic_reservedD; lapic_entry_t lapic_icr_low; // RW Bits 0-31 of the Interrupt Command Register lapic_entry_t lapic_icr_high; // RW Bits 32-63 of the Interrupt Command Register lapic_entry_t lapic_lvt_tr; // RW Local Vector Table (LVT) timer register lapic_entry_t lapic_lvt_tsr; // RW LVT Thermal Sensor Register lapic_entry_t lapic_lvt_pmcr; // RW LVT Performance Monitering Counters register lapic_entry_t lapic_lvt_lint0; // RW LVT LINT0 register lapic_entry_t lapic_lvt_lint1; // RW LVT LINT1 register lapic_entry_t lapic_lvt_error; // RW LVT error register; lapic_entry_t lapic_timer_icr; // RW Timer Initial Count Register lapic_entry_t lapic_timer_ccr; // R Timer Current Count Register lapic_entry_t lapic_reservedE; lapic_entry_t lapic_reservedF; lapic_entry_t lapic_reservedG; lapic_entry_t lapic_reservedH; lapic_entry_t lapic_timer_dcr; // RW Timer Divide Configuration Register lapic_entry_t lapic_reservedI; }; /* This is where the local APIC will be mapped */ static volatile void * lapic = NULL; /* Initialize the local APIC. We assume that this is only done once, that the * memory manager is available (i.e. malloc works) and this has not been done * yet. */ int lapic_init(void) { assert(lapic_addr == NULL); /* Note that all we do here is allocate a page to map on. There's no * virtual memory involved here and there can't be.. */ lapic_addr = LAPIC_ADDR; assert(sizeof(lapic_t) <= MM_ARCH_PAGE_SIZE); physmem_arch_reserve(lapic_addr, lapic_addr + sizeof(lapic_t)); /* we enable the local APIC by setting the software-enable flag in * the spurious interrupt vector register. This is bit 8 of field * lapic_siv in the APIC we just memory-mapped. */ lapic->lapic_siv.bytes[1] |= 1; /* As we haven't set up event handling yet at this time, we'll set * the spurious interrupt vector later and leave it at its default * for the moment. If we'd set it to something now, we wouldn't be * able to handle the interrupt anyway.. */ } --- NEW FILE: lapic.h --- #ifndef _cpu_arch_lapic_h #define _cpu_arch_lapic_h struct lapic_type; typedef struct lapic_type lapic_t; void lapic_init(void); #endif Index: module.mk =================================================================== RCS file: /cvsroot/halos/cpu/i386/module.mk,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- module.mk 17 Sep 2004 16:12:10 -0000 1.1 +++ module.mk 25 Aug 2005 02:11:15 -0000 1.2 @@ -1,2 +1,2 @@ -cpu_SRC += arch/cpu.c +cpu_SRC += arch/cpu.c arch/lapic.c |
From: Ronald Landheer-C. <bly...@us...> - 2005-08-17 01:41:50
|
Update of /cvsroot/halos/elf In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26506 Modified Files: ChangeLog sections.c Log Message: 2005-08-16 blytkerchan * sections.c (elf_section_note_open): allocate retval (elf_section_nobits_open): ditto Index: ChangeLog =================================================================== RCS file: /cvsroot/halos/elf/ChangeLog,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- ChangeLog 4 Apr 2005 00:14:29 -0000 1.9 +++ ChangeLog 17 Aug 2005 01:41:42 -0000 1.10 @@ -1,3 +1,7 @@ +2005-08-16 blytkerchan + * sections.c (elf_section_note_open): allocate retval + (elf_section_nobits_open): ditto + 2005-04-03 blytkerchan * sections.c (elf_sections_read_helper): new function, containing the in-loop part of the function it helps Index: sections.c =================================================================== RCS file: /cvsroot/halos/elf/sections.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- sections.c 4 Apr 2005 00:14:29 -0000 1.7 +++ sections.c 17 Aug 2005 01:41:42 -0000 1.8 @@ -459,7 +459,9 @@ sections->string_table == 0 || (sections->sections[sections->string_table] == NULL && section->sh_name != 0)) return NULL; - elf_section_note_t * retval; + elf_section_note_t * retval = malloc(sizeof(elf_section_note_t)); + if (!retval) + return NULL; retval->magic = ELF_NOTE_SECTION; elf_section_other_open_helper(retval, sections, header, section); @@ -476,7 +478,9 @@ sections->string_table == 0 || (sections->sections[sections->string_table] == NULL && section->sh_name != 0)) return NULL; - elf_section_nobits_t * retval; + elf_section_nobits_t * retval = malloc(sizeof(elf_section_nobits_t)); + if (!retval) + return NULL; retval->magic = ELF_NOBITS_SECTION; elf_section_other_open_helper(retval, sections, header, section); |
From: Ronald Landheer-C. <bly...@us...> - 2005-08-17 01:37:57
|
Update of /cvsroot/halos/mm/i386 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26022 Modified Files: ChangeLog mm.c videomem.c Log Message: 2005-08-16 blytkerchan * mm.c [mm_arch_initialized]: make uint32_t * videomem.c [allocated]: ditto Index: ChangeLog =================================================================== RCS file: /cvsroot/halos/mm/i386/ChangeLog,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- ChangeLog 24 Mar 2005 03:30:19 -0000 1.12 +++ ChangeLog 17 Aug 2005 01:37:47 -0000 1.13 @@ -1,3 +1,7 @@ +2005-08-16 blytkerchan + * mm.c [mm_arch_initialized]: make uint32_t + * videomem.c [allocated]: ditto + 2005-03-23 blytkerchan * physmem.c (physmem_arch_init): check for bit 0 in the system info flags and panic of it's not there Index: videomem.c =================================================================== RCS file: /cvsroot/halos/mm/i386/videomem.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- videomem.c 13 Mar 2005 21:52:38 -0000 1.4 +++ videomem.c 17 Aug 2005 01:37:47 -0000 1.5 @@ -8,7 +8,7 @@ #define VIDEOMEM_OFFS 0x000b8000 static volatile union videomem_type * videomem = (volatile union videomem_type *)VIDEOMEM_OFFS; -static int allocated = 0; +static uint32_t allocated = 0; static struct videomem_handle_type { volatile union videomem_type * videomem; Index: mm.c =================================================================== RCS file: /cvsroot/halos/mm/i386/mm.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- mm.c 16 Mar 2005 01:39:09 -0000 1.4 +++ mm.c 17 Aug 2005 01:37:47 -0000 1.5 @@ -36,7 +36,7 @@ #include <klib/arch/test_and_set.h> #include "physmem.h" -static int mm_arch_initialized = 0; +static uint32_t mm_arch_initialized = 0; int mm_arch_init(void * arg) { |
From: Ronald Landheer-C. <bly...@us...> - 2005-08-17 01:36:32
|
Update of /cvsroot/halos/klib/stdlib/memory In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25867 Modified Files: ChangeLog upool.c Log Message: 2005-08-16 blytkerchan * upool.c [lock]: make uint32_t [initalized]: ditto Index: upool.c =================================================================== RCS file: /cvsroot/halos/klib/stdlib/memory/upool.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- upool.c 23 Mar 2005 02:01:05 -0000 1.3 +++ upool.c 17 Aug 2005 01:36:25 -0000 1.4 @@ -20,8 +20,8 @@ static const size_t header_size = sizeof(void*) + 2 * sizeof(uint32_t); static size_t dir_size = 0; static size_t reserved_size = 0; -static int lock = 0; -static int initialized = 0; +static uint32_t lock = 0; +static uint32_t initialized = 0; typedef struct upool_type { Index: ChangeLog =================================================================== RCS file: /cvsroot/halos/klib/stdlib/memory/ChangeLog,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ChangeLog 23 Mar 2005 02:01:05 -0000 1.3 +++ ChangeLog 17 Aug 2005 01:36:25 -0000 1.4 @@ -1,3 +1,7 @@ +2005-08-16 blytkerchan + * upool.c [lock]: make uint32_t + [initalized]: ditto + 2005-03-22 blytkerchan * upool.c: include klib/arch/memmove.h and mm/arch/mm.h (upool_realloc): rename from realloc |
From: Ronald Landheer-C. <bly...@us...> - 2005-08-17 01:35:31
|
Update of /cvsroot/halos/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25714 Modified Files: ChangeLog Makefile.in.in configure.ac.in Log Message: 2005-08-16 blytkerchan * Makefile.in.in [real_all]: add install_kernel as prereq * configure.ac.in [CC]: export as $CC -g -ffreestanding to allow overriding std CC Index: Makefile.in.in =================================================================== RCS file: /cvsroot/halos/config/Makefile.in.in,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- Makefile.in.in 24 Mar 2005 02:08:37 -0000 1.10 +++ Makefile.in.in 17 Aug 2005 01:35:22 -0000 1.11 @@ -77,7 +77,7 @@ # dependencies for library targets libarch_OBJ:=$(arch_OBJ) -real_all : $(patsubst %,%.a,$(LIBRARIES)) $(patsubst %,%.exe,$(PROGRAMS)) $$__KERNEL__$$ +real_all : $(patsubst %,%.a,$(LIBRARIES)) $(patsubst %,%.exe,$(PROGRAMS)) $$__KERNEL__$$ install_kernel # calculate C include dependencies %.d : %.c $(MAKEFILES) Index: configure.ac.in =================================================================== RCS file: /cvsroot/halos/config/configure.ac.in,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- configure.ac.in 13 Mar 2005 21:46:55 -0000 1.7 +++ configure.ac.in 17 Aug 2005 01:35:22 -0000 1.8 @@ -11,7 +11,7 @@ AC_SUBST(ARCH, ${host_cpu}) # Checks for programs. -export CC="gcc -g -ffreestanding" +export CC="$CC -g -ffreestanding" AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL Index: ChangeLog =================================================================== RCS file: /cvsroot/halos/config/ChangeLog,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- ChangeLog 24 Mar 2005 02:08:37 -0000 1.19 +++ ChangeLog 17 Aug 2005 01:35:22 -0000 1.20 @@ -1,3 +1,8 @@ +2005-08-16 blytkerchan + * Makefile.in.in [real_all]: add install_kernel as prereq + * configure.ac.in [CC]: export as $CC -g -ffreestanding to allow + overriding std CC + 2005-03-23 blytkerchan * Makefile.in.in [Makefile]: add link.mk as a prerequisit [Makefile.in]: run bootstrap.sh, not bootstrap |
From: Ronald Landheer-C. <bly...@us...> - 2005-08-12 01:06:08
|
Update of /cvsroot/halos/klib/arch/i386 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26257 Modified Files: ChangeLog compare_and_exchange.c compare_and_exchange.h decrement.c increment.c Log Message: 2005-08-11 blytkerchan * compare_and_exchange.c (compare_and_echange_uint): new function * compare_and_exchange.h: ditto * decrement.c (atomic_decrement): make target a register * increment.c (atomic_increment): ditto (fetch_and_increment): use compare_and_exchange_uint Index: increment.c =================================================================== RCS file: /cvsroot/halos/klib/arch/i386/increment.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- increment.c 23 Mar 2005 00:26:18 -0000 1.2 +++ increment.c 12 Aug 2005 01:05:56 -0000 1.3 @@ -36,9 +36,9 @@ void atomic_increment(uint32_t * target) { asm("movl %1, %%eax\nlock incl (%%eax)" - : "=m" (target) + : "=r" (target) : "0" (target) - : "eax"); + : "eax", "memory"); } uint32_t fetch_and_increment(uint32_t * target) @@ -48,7 +48,7 @@ do { retval = *target; - } while (compare_and_exchange_int(&retval, target, retval + 1) != 0); + } while (compare_and_exchange_uint(&retval, target, retval + 1) != 0); return retval; } Index: compare_and_exchange.c =================================================================== RCS file: /cvsroot/halos/klib/arch/i386/compare_and_exchange.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- compare_and_exchange.c 24 Sep 2004 00:31:12 -0000 1.2 +++ compare_and_exchange.c 12 Aug 2005 01:05:56 -0000 1.3 @@ -61,3 +61,8 @@ { return compare_and_exchange_ptr(exp_ptr, tar_ptr, (void*)src); } + +int compare_and_exchange_uint(uint32_t * exp_ptr, uint32_t * tar_ptr, uint32_t src) +{ + return compare_and_exchange_ptr(exp_ptr, tar_ptr, (void*)src); +} Index: ChangeLog =================================================================== RCS file: /cvsroot/halos/klib/arch/i386/ChangeLog,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- ChangeLog 23 Mar 2005 01:56:32 -0000 1.17 +++ ChangeLog 12 Aug 2005 01:05:56 -0000 1.18 @@ -1,3 +1,10 @@ +2005-08-11 blytkerchan + * compare_and_exchange.c (compare_and_echange_uint): new function + * compare_and_exchange.h: ditto + * decrement.c (atomic_decrement): make target a register + * increment.c (atomic_increment): ditto + (fetch_and_increment): use compare_and_exchange_uint + 2005-03-22 blytkerchan * memmove.S: new file, imported (and slightly modified) from Newlib * memmove.h: new file Index: decrement.c =================================================================== RCS file: /cvsroot/halos/klib/arch/i386/decrement.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- decrement.c 21 Sep 2004 00:48:23 -0000 1.1 +++ decrement.c 12 Aug 2005 01:05:56 -0000 1.2 @@ -36,8 +36,8 @@ void atomic_decrement(uint32_t * target) { asm("movl %1, %%eax\nlock decl (%%eax)" - : "=m" (target) + : "=r" (target) : "0" (target) - : "eax"); + : "eax", "memory"); } Index: compare_and_exchange.h =================================================================== RCS file: /cvsroot/halos/klib/arch/i386/compare_and_exchange.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- compare_and_exchange.h 24 Sep 2004 00:31:12 -0000 1.2 +++ compare_and_exchange.h 12 Aug 2005 01:05:56 -0000 1.3 @@ -52,6 +52,7 @@ * otherwise. */ int compare_and_exchange_int(int32_t * exp_ptr, volatile int32_t * tar_ptr, int32_t src_ptr); +int compare_and_exchange_uint(uint32_t * exp_ptr, volatile uint32_t * tar_ptr, uint32_t src_ptr); int compare_and_exchange_ptr(void * exp_ptr, volatile void * tar_ptr, const void * src_ptr); #ifdef __cplusplus } |
From: Ronald Landheer-C. <bly...@us...> - 2005-07-19 11:28:26
|
Update of /cvsroot/halos/pilots In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12263 Modified Files: ChangeLog header.S Added Files: pilot.lds Log Message: 2005-07-18 blytkerchan * header.S: finish * pilot.lds: new file --- NEW FILE: pilot.lds --- /* Halos: a light operating system * Copyright (c) 2004, Ronald Landheer-Cieslak * All rights reserved * * This is free software. You may distribute it and/or modify it and * distribute modified forms provided that the following terms are met: * * * Redistributions of the source code must retain the above copyright * notice, this list of conditions and the following disclaimer; * * 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; * * None of the names of the authors of this software may be used to endorse * or promote this software, derived software or any distribution of this * software or any distribution of which this software is part, without * prior written permission from the authors involved; * * Unless you have received a written statement from Ronald Landheer-Cieslak * that says otherwise, the terms of the GNU General Public License, as * published by the Free Software Foundation, version 2 or (at your option) * any later version, also apply. * * 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 OWNER 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. */ OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") ENTRY(pilot_init) OUTPUT_ARCH("i386") SECTIONS { . = 0x00000000; __b_load = .; .pilotheader : { *(.pilotheader); LONG(0); /* force allocation of the section */ } . = ALIGN(4096); __b_pilot = .; .text ALIGN(4096) : { *(.text) PROVIDE(__etext = .); } .rodata : { *(.rodata) PROVIDE(__erodata = .); } .data : { *(.data) PROVIDE(__edata = .); PROVIDE(__end_data = .); } __e_load = .; .bss ALIGN(4096): { *(.bss) *(COMMON) . = ALIGN(4096); *(.initial_stack) PROVIDE(__e_bss = .); } __pilot_end = .; /* /DISCARD/ : { *(.node*) *(.indent) *(.comment) *(.stab) *(.stabstr) } */ } Index: header.S =================================================================== RCS file: /cvsroot/halos/pilots/header.S,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- header.S 18 Jul 2005 01:01:04 -0000 1.1 +++ header.S 19 Jul 2005 11:28:17 -0000 1.2 @@ -39,3 +39,18 @@ /* magic */ .long PILOT_MAGIC1 .long PILOT_MAGIC2 + .long __end - _pilot_start + .long pilot_init - _pilot_start + .long pilot_fini - _pilot_start + .long PILOT_NAMED | PILOT_NEED_CONSOLE + .long pilt_name - _pilot_start + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0xfaab0010 - (PILOT_MAGIC1 + PILOT_MAGIC2 + (__end - _pilot_start) + (pilot_init - _pilot_start) + (pilot_fini - _pilot_start) + (PILOT_NAMED | PILOT_NEED_CONSOLE) + (pilt_name - _pilot_start)) + Index: ChangeLog =================================================================== RCS file: /cvsroot/halos/pilots/ChangeLog,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ChangeLog 18 Jul 2005 01:01:03 -0000 1.2 +++ ChangeLog 19 Jul 2005 11:28:17 -0000 1.3 @@ -1,3 +1,7 @@ +2005-07-18 blytkerchan + * header.S: finish + * pilot.lds: new file + 2005-07-17 blytkerchan * hello.c: new file * header.S: ditto |
From: Ronald Landheer-C. <bly...@us...> - 2005-07-18 01:02:12
|
Update of /cvsroot/halos/drivers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1104 Modified Files: ChangeLog drivers.h Log Message: 2005-07-17 blytkerchan * drivers.h: add macros for magic numbers Index: drivers.h =================================================================== RCS file: /cvsroot/halos/drivers/drivers.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- drivers.h 17 Jul 2005 03:45:10 -0000 1.4 +++ drivers.h 18 Jul 2005 01:02:03 -0000 1.5 @@ -10,6 +10,8 @@ #define DRIVERS_ABI_AGE 0 /* maximal number of pilots that can be loaded at any time */ #define PILOTS_MAXNUM 1024 +#define PILOT_MAGIC1 0x48414c4f +#define PILOT_MAGIC2 0X53000000 /* flags */ #define PILOT_LAST 0x00000001 /* pilot should be the last Index: ChangeLog =================================================================== RCS file: /cvsroot/halos/drivers/ChangeLog,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ChangeLog 17 Jul 2005 03:45:10 -0000 1.7 +++ ChangeLog 18 Jul 2005 01:02:03 -0000 1.8 @@ -1,3 +1,6 @@ +2005-07-17 blytkerchan + * drivers.h: add macros for magic numbers + 2005-07-16 blytkerchan follow up on decision to name drivers pilots * drivers.h: remove errant #define |
From: Ronald Landheer-C. <bly...@us...> - 2005-07-18 01:01:49
|
Update of /cvsroot/halos/pilots In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv840 Modified Files: ChangeLog Added Files: header.S hello.c Log Message: 2005-07-17 blytkerchan * hello.c: new file * header.S: ditto --- NEW FILE: header.S --- /* Halos: a light operating system * Copyright (c) 2004, Ronald Landheer-Cieslak * All rights reserved * * This is free software. You may distribute it and/or modify it and * distribute modified forms provided that the following terms are met: * * * Redistributions of the source code must retain the above copyright * notice, this list of conditions and the following disclaimer; * * 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; * * None of the names of the authors of this software may be used to endorse * or promote this software, derived software or any distribution of this * software or any distribution of which this software is part, without * prior written permission from the authors involved; * * Unless you have received a written statement from Ronald Landheer-Cieslak * that says otherwise, the terms of the GNU General Public License, as * published by the Free Software Foundation, version 2 or (at your option) * any later version, also apply. * * 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 OWNER 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 <drivers/drivers.h> .section .pilotheader .align 4 /* 32-bit alignment */ _pilot_start: /* magic */ .long PILOT_MAGIC1 .long PILOT_MAGIC2 --- NEW FILE: hello.c --- /* Halos: a light operating system * Copyright (c) 2004, Ronald Landheer-Cieslak * All rights reserved * * This is free software. You may distribute it and/or modify it and * distribute modified forms provided that the following terms are met: * * * Redistributions of the source code must retain the above copyright * notice, this list of conditions and the following disclaimer; * * 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; * * None of the names of the authors of this software may be used to endorse * or promote this software, derived software or any distribution of this * software or any distribution of which this software is part, without * prior written permission from the authors involved; * * Unless you have received a written statement from Ronald Landheer-Cieslak * that says otherwise, the terms of the GNU General Public License, as * published by the Free Software Foundation, version 2 or (at your option) * any later version, also apply. * * 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 OWNER 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. */ /* Example pilot that uses klib's kprint() function to say "Hello, world!" */ #include <drivers/drivers.h> Index: ChangeLog =================================================================== RCS file: /cvsroot/halos/pilots/ChangeLog,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ChangeLog 17 Jul 2005 03:47:14 -0000 1.1 +++ ChangeLog 18 Jul 2005 01:01:03 -0000 1.2 @@ -1,3 +1,7 @@ +2005-07-17 blytkerchan + * hello.c: new file + * header.S: ditto + 2005-05-16 blytkerchan * README: new file |
From: Ronald Landheer-C. <bly...@us...> - 2005-07-17 03:47:22
|
Update of /cvsroot/halos/pilots In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5702 Added Files: ChangeLog README Log Message: 2005-05-16 blytkerchan * README: new file --- NEW FILE: README --- A word on Pilots The word "Pilots" is used where in Linux you'd use "module", Windows you'd use "Driver" etc. The word "Drivers" is used for the parts of the kernel that drive the pilots - i.e. load them, track their dependencies, and otherwise pamper them to make their job possible. Pilots stands for "Pilots Indicating Less Obstruction To Solutions" and is YA recursive acronym. Pilots should always be compiled into ELF32 files - the pilot-loader doesn't recognize anything else. The structure found in the file <drivers/drivers.h> called ``drivers_header_type'' should be found in the first 4K bytes of the pilot's file and should be aligned on a 32-bit boundary. The checksum of the fields in the header (i.e. sum of all fields) should be 0xfaab0010. Dependencies are tracked by name and by type of pilot. I.e.: there are two "special" types of pilots: a virtual memory manager and a scheduler. Pilots than launch their own threads will need the scheduler to be loaded before them, so they depend on a scheduler. Similarly, pilots that allocate virtual memory need a virtual memory manager. There are a few other special types of pilots that you can depend on, which are listed below and (the canonical location) in <drivers/drivers.h> --- NEW FILE: ChangeLog --- 2005-05-16 blytkerchan * README: new file |