From d47201cc4f2bc9cbaae0bfab32cf8a1b917f153d Mon Sep 17 00:00:00 2001 From: "kaf24@scramble.cl.cam.ac.uk" Date: Wed, 15 Oct 2003 09:31:04 +0000 Subject: bitkeeper revision 1.520 (3f8d13d8qVVqxcYD--4cXYs5egqNyg) Many files: Fix the minos license so that it is usable for XP and BSD ports. minios.lds: Rename: extras/mini-os/vmlinux.lds -> extras/mini-os/minios.lds .del-list.h~d612a8726e8d42e: Delete: extras/mini-os/h/list.h .del-COPYING~1f9753354580bd13: Delete: extras/mini-os/COPYING --- extras/mini-os/COPYING | 340 ------------------------------------------ extras/mini-os/Makefile | 2 +- extras/mini-os/entry.S | 179 ++++++---------------- extras/mini-os/events.c | 2 +- extras/mini-os/h/hypervisor.h | 10 -- extras/mini-os/h/list.h | 164 -------------------- extras/mini-os/h/mm.h | 74 +++------ extras/mini-os/h/os.h | 17 --- extras/mini-os/h/time.h | 2 - extras/mini-os/hypervisor.c | 39 ++--- extras/mini-os/kernel.c | 20 +++ extras/mini-os/lib/malloc.c | 12 +- extras/mini-os/minios.lds | 54 +++++++ extras/mini-os/mm.c | 111 ++++---------- extras/mini-os/time.c | 17 +++ extras/mini-os/traps.c | 53 +------ extras/mini-os/vmlinux.lds | 82 ---------- 17 files changed, 213 insertions(+), 965 deletions(-) delete mode 100644 extras/mini-os/COPYING delete mode 100644 extras/mini-os/h/list.h create mode 100644 extras/mini-os/minios.lds delete mode 100644 extras/mini-os/vmlinux.lds (limited to 'extras/mini-os') diff --git a/extras/mini-os/COPYING b/extras/mini-os/COPYING deleted file mode 100644 index 5b6e7c66c2..0000000000 --- a/extras/mini-os/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/extras/mini-os/Makefile b/extras/mini-os/Makefile index 18ae585db7..c0b977080b 100644 --- a/extras/mini-os/Makefile +++ b/extras/mini-os/Makefile @@ -21,7 +21,7 @@ hypervisor-ifs: $(TARGET): hypervisor-ifs head.o $(OBJS) # Image will load at 0xC0000000. First bytes from head.o #$(LD) -N -Ttext 0xC0000000 head.o $(OBJS) -o $@.elf - $(LD) -N -T vmlinux.lds head.o $(OBJS) -o $@.elf + $(LD) -N -T minios.lds head.o $(OBJS) -o $@.elf # Guest OS header -- first 8 bytes are identifier 'XenoGues'. echo -e -n 'XenoGues' >$@ # Guest OS header -- next 4 bytes are load address (0xC0000000). diff --git a/extras/mini-os/entry.S b/extras/mini-os/entry.S index a5a86543b0..8565caf745 100644 --- a/extras/mini-os/entry.S +++ b/extras/mini-os/entry.S @@ -1,41 +1,13 @@ -/* - * linux/arch/i386/entry.S - * - * Copyright (C) 1991, 1992 Linus Torvalds - * - * Adjusted for XenoLinux use by K A Frasier - * Adjusted for Xen minimal os by R Neugebauer - */ - #include - -EBX = 0x00 -ECX = 0x04 -EDX = 0x08 -ESI = 0x0C -EDI = 0x10 -EBP = 0x14 -EAX = 0x18 -DS = 0x1C + ES = 0x20 ORIG_EAX = 0x24 EIP = 0x28 CS = 0x2C -EFLAGS = 0x30 -OLDESP = 0x34 -OLDSS = 0x38 -CF_MASK = 0x00000001 -IF_MASK = 0x00000200 -NT_MASK = 0x00004000 - -/* Declare a globally-visible label */ #define ENTRY(X) .globl X ; X : -/* A Linux hangover. Just ignore it. */ -#define SYMBOL_NAME(X) X - #define SAVE_ALL \ cld; \ pushl %es; \ @@ -59,34 +31,15 @@ NT_MASK = 0x00004000 popl %edi; \ popl %ebp; \ popl %eax; \ -1: popl %ds; \ -2: popl %es; \ - addl $4,%esp; \ -3: iret; \ -.section .fixup,"ax"; \ -4: movl $0,(%esp); \ - jmp 1b; \ -5: movl $0,(%esp); \ - jmp 2b; \ -6: pushl %ss; \ popl %ds; \ - pushl %ss; \ popl %es; \ - pushl $11; \ - call do_exit; \ -.previous; \ -.section __ex_table,"a";\ - .align 4; \ - .long 1b,4b; \ - .long 2b,5b; \ - .long 3b,6b; \ -.previous + addl $4,%esp; \ + iret; \ ENTRY(divide_error) pushl $0 # no error code - pushl $ SYMBOL_NAME(do_divide_error) - .align 4 -error_code: + pushl $do_divide_error +do_exception: pushl %ds pushl %eax xorl %eax,%eax @@ -112,20 +65,11 @@ error_code: call *%edi addl $8,%esp -# These are the tests Linux makes before exiting the OS back to userland. -# At these point preeemption may occur, or signals may get delivered. -ret_to_user_tests: -# cmpl $0,need_resched(%ebx) -# jne reschedule -# cmpl $0,sigpending(%ebx) -# je safesti - jmp safesti - ret_from_exception: movb CS(%esp),%cl - test $2,%cl # slow return to ring 2 or 3 - jne ret_to_user_tests + test $2,%cl # slow return to ring 2 or 3 + jne safesti RESTORE_ALL # A note on the "critical region" in our callback handler. @@ -150,11 +94,11 @@ ENTRY(hypervisor_callback) 11: push %esp call do_hypervisor_callback add $4,%esp - movl SYMBOL_NAME(HYPERVISOR_shared_info),%esi + movl HYPERVISOR_shared_info,%esi xorl %eax,%eax movb CS(%esp),%cl test $2,%cl # slow return to ring 2 or 3 - jne ret_to_user_tests + jne safesti safesti:btsl $31,4(%esi) # reenable event callbacks scrit: /**** START OF CRITICAL REGION ****/ cmpl %eax,(%esi) @@ -207,105 +151,78 @@ critical_fixup_table: # Hypervisor uses this for application faults while it executes. ENTRY(failsafe_callback) -1: pop %ds -2: pop %es -3: pop %fs -4: pop %gs -5: iret -.section .fixup,"ax"; \ -6: movl $0,(%esp); \ - jmp 1b; \ -7: movl $0,(%esp); \ - jmp 2b; \ -8: movl $0,(%esp); \ - jmp 3b; \ -9: movl $0,(%esp); \ - jmp 4b; \ -10: pushl %ss; \ - popl %ds; \ - pushl %ss; \ - popl %es; \ - pushl $11; \ - call do_exit; \ -.previous; \ -.section __ex_table,"a";\ - .align 4; \ - .long 1b,6b; \ - .long 2b,7b; \ - .long 3b,8b; \ - .long 4b,9b; \ - .long 5b,10b; \ -.previous + pop %ds + pop %es + pop %fs + pop %gs + iret ENTRY(coprocessor_error) pushl $0 - pushl $ SYMBOL_NAME(do_coprocessor_error) - jmp error_code + pushl $do_coprocessor_error + jmp do_exception ENTRY(simd_coprocessor_error) pushl $0 - pushl $ SYMBOL_NAME(do_simd_coprocessor_error) - jmp error_code + pushl $do_simd_coprocessor_error + jmp do_exception ENTRY(device_not_available) - pushl $-1 # mark this as an int - SAVE_ALL - #call SYMBOL_NAME(math_state_restore) - jmp ret_from_exception + iret ENTRY(debug) pushl $0 - pushl $ SYMBOL_NAME(do_debug) - jmp error_code + pushl $do_debug + jmp do_exception ENTRY(int3) pushl $0 - pushl $ SYMBOL_NAME(do_int3) - jmp error_code + pushl $do_int3 + jmp do_exception ENTRY(overflow) pushl $0 - pushl $ SYMBOL_NAME(do_overflow) - jmp error_code + pushl $do_overflow + jmp do_exception ENTRY(bounds) pushl $0 - pushl $ SYMBOL_NAME(do_bounds) - jmp error_code + pushl $do_bounds + jmp do_exception ENTRY(invalid_op) pushl $0 - pushl $ SYMBOL_NAME(do_invalid_op) - jmp error_code + pushl $do_invalid_op + jmp do_exception ENTRY(coprocessor_segment_overrun) pushl $0 - pushl $ SYMBOL_NAME(do_coprocessor_segment_overrun) - jmp error_code + pushl $do_coprocessor_segment_overrun + jmp do_exception ENTRY(double_fault) - pushl $ SYMBOL_NAME(do_double_fault) - jmp error_code + pushl $do_double_fault + jmp do_exception ENTRY(invalid_TSS) - pushl $ SYMBOL_NAME(do_invalid_TSS) - jmp error_code + pushl $do_invalid_TSS + jmp do_exception ENTRY(segment_not_present) - pushl $ SYMBOL_NAME(do_segment_not_present) - jmp error_code + pushl $do_segment_not_present + jmp do_exception ENTRY(stack_segment) - pushl $ SYMBOL_NAME(do_stack_segment) - jmp error_code + pushl $do_stack_segment + jmp do_exception ENTRY(general_protection) - pushl $ SYMBOL_NAME(do_general_protection) - jmp error_code + pushl $do_general_protection + jmp do_exception ENTRY(alignment_check) - pushl $ SYMBOL_NAME(do_alignment_check) - jmp error_code + pushl $do_alignment_check + jmp do_exception # This handler is special, because it gets an extra value on its stack, # which is the linear faulting address. @@ -333,16 +250,16 @@ ENTRY(page_fault) movl $(__KERNEL_DS),%edx movl %edx,%ds movl %edx,%es - call SYMBOL_NAME(do_page_fault) + call do_page_fault addl $12,%esp jmp ret_from_exception ENTRY(machine_check) pushl $0 - pushl $ SYMBOL_NAME(do_machine_check) - jmp error_code + pushl $do_machine_check + jmp do_exception ENTRY(spurious_interrupt_bug) pushl $0 - pushl $ SYMBOL_NAME(do_spurious_interrupt_bug) - jmp error_code + pushl $do_spurious_interrupt_bug + jmp do_exception diff --git a/extras/mini-os/events.c b/extras/mini-os/events.c index a2083afa37..8603fa4c37 100644 --- a/extras/mini-os/events.c +++ b/extras/mini-os/events.c @@ -29,7 +29,7 @@ void default_handler(int ev, struct pt_regs *regs); /* * demux events to different handlers */ -asmlinkage unsigned int do_event(int ev, struct pt_regs *regs) +unsigned int do_event(int ev, struct pt_regs *regs) { ev_action_t *action; diff --git a/extras/mini-os/h/hypervisor.h b/extras/mini-os/h/hypervisor.h index c0d340f339..a760409c32 100644 --- a/extras/mini-os/h/hypervisor.h +++ b/extras/mini-os/h/hypervisor.h @@ -1,14 +1,4 @@ -/****************************************************************************** - * hypervisor.h - * - * Linux-specific hypervisor handling. - * - * Adjusted by R Neugebauer for Xen minimal OS - * - * Copyright (c) 2002, K A Fraser - */ - #ifndef _HYPERVISOR_H_ #define _HYPERVISOR_H_ diff --git a/extras/mini-os/h/list.h b/extras/mini-os/h/list.h deleted file mode 100644 index eec102405c..0000000000 --- a/extras/mini-os/h/list.h +++ /dev/null @@ -1,164 +0,0 @@ -#ifndef _LINUX_LIST_H -#define _LINUX_LIST_H - -#define ASSERT(x) ((void)0) - -/* - * Simple doubly linked list implementation. - * - * Some of the internal functions ("__xxx") are useful when - * manipulating whole lists rather than single entries, as - * sometimes we already know the next/prev entries and we can - * generate better code by using them directly rather than - * using the generic single-entry routines. - */ - -struct list_head { - struct list_head *next, *prev; -}; - -#define LIST_HEAD_INIT(name) { &(name), &(name) } - -#define LIST_HEAD(name) \ - struct list_head name = LIST_HEAD_INIT(name) - -#define INIT_LIST_HEAD(ptr) do { \ - (ptr)->next = (ptr); (ptr)->prev = (ptr); \ -} while (0) - -/* - * Insert a new entry between two known consecutive entries. - * - * This is only for internal list manipulation where we know - * the prev/next entries already! - */ -static __inline__ void __list_add(struct list_head * new, - struct list_head * prev, - struct list_head * next) -{ - next->prev = new; - new->next = next; - new->prev = prev; - prev->next = new; -} - -/** - * list_add - add a new entry - * @new: new entry to be added - * @head: list head to add it after - * - * Insert a new entry after the specified head. - * This is good for implementing stacks. - */ -static __inline__ void list_add(struct list_head *new, struct list_head *head) -{ - __list_add(new, head, head->next); -} - -/** - * list_add_tail - add a new entry - * @new: new entry to be added - * @head: list head to add it before - * - * Insert a new entry before the specified head. - * This is useful for implementing queues. - */ -static __inline__ void list_add_tail(struct list_head *new, struct list_head *head) -{ - __list_add(new, head->prev, head); -} - -/* - * Delete a list entry by making the prev/next entries - * point to each other. - * - * This is only for internal list manipulation where we know - * the prev/next entries already! - */ -static __inline__ void __list_del(struct list_head * prev, - struct list_head * next) -{ - next->prev = prev; - prev->next = next; -} - -/** - * list_del - deletes entry from list. - * @entry: the element to delete from the list. - * Note: list_empty on entry does not return true after this, the entry is in an undefined state. - */ -static __inline__ void list_del(struct list_head *entry) -{ - ASSERT(entry->next->prev == entry); - ASSERT(entry->prev->next == entry); - __list_del(entry->prev, entry->next); -} - -/** - * list_del_init - deletes entry from list and reinitialize it. - * @entry: the element to delete from the list. - */ -static __inline__ void list_del_init(struct list_head *entry) -{ - __list_del(entry->prev, entry->next); - INIT_LIST_HEAD(entry); -} - -/** - * list_empty - tests whether a list is empty - * @head: the list to test. - */ -static __inline__ int list_empty(struct list_head *head) -{ - return head->next == head; -} - -/** - * list_splice - join two lists - * @list: the new list to add. - * @head: the place to add it in the first list. - */ -static __inline__ void list_splice(struct list_head *list, struct list_head *head) -{ - struct list_head *first = list->next; - - if (first != list) { - struct list_head *last = list->prev; - struct list_head *at = head->next; - - first->prev = head; - head->next = first; - - last->next = at; - at->prev = last; - } -} - -/** - * list_entry - get the struct for this entry - * @ptr: the &struct list_head pointer. - * @type: the type of the struct this is embedded in. - * @member: the name of the list_struct within the struct. - */ -#define list_entry(ptr, type, member) \ - ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) - -/** - * list_for_each - iterate over a list - * @pos: the &struct list_head to use as a loop counter. - * @head: the head for your list. - */ -#define list_for_each(pos, head) \ - for (pos = (head)->next; pos != (head); pos = pos->next) - -/** - * list_for_each_safe - iterate over a list safe against removal of list entry - * @pos: the &struct list_head to use as a loop counter. - * @n: another &struct list_head to use as temporary storage - * @head: the head for your list. - */ -#define list_for_each_safe(pos, n, head) \ - for (pos = (head)->next, n = pos->next; pos != (head); \ - pos = n, n = pos->next) - -#endif diff --git a/extras/mini-os/h/mm.h b/extras/mini-os/h/mm.h index 9cc2271f91..466f0c3137 100644 --- a/extras/mini-os/h/mm.h +++ b/extras/mini-os/h/mm.h @@ -15,26 +15,39 @@ **************************************************************************** * $Id: h-insert.h,v 1.4 2002/11/08 16:03:55 rn Exp $ **************************************************************************** + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. */ #ifndef _MM_H_ #define _MM_H_ -/* PAGE_SHIFT determines the page size */ #define PAGE_SHIFT 12 #define PAGE_SIZE (1UL << PAGE_SHIFT) #define PAGE_MASK (~(PAGE_SIZE-1)) - #define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) #define PFN_DOWN(x) ((x) >> PAGE_SHIFT) #define PFN_PHYS(x) ((x) << PAGE_SHIFT) - /* to align the pointer to the (next) page boundary */ #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) - extern unsigned long *phys_to_machine_mapping; #define pfn_to_mfn(_pfn) (phys_to_machine_mapping[(_pfn)]) #define mfn_to_pfn(_mfn) (machine_to_phys_mapping[(_mfn)]) @@ -51,57 +64,12 @@ static inline unsigned long machine_to_phys(unsigned long machine) return phys; } -/* VIRT <-> MACHINE conversion */ -#define virt_to_machine(_a) (phys_to_machine(__pa(_a))) -#define machine_to_virt(_m) (__va(machine_to_phys(_m))) - -/* - * This handles the memory map.. We could make this a config - * option, but too many people screw it up, and too few need - * it. - * - * A __PAGE_OFFSET of 0xC0000000 means that the kernel has - * a virtual address space of one gigabyte, which limits the - * amount of physical memory you can use to about 950MB. - * - * If you want more physical memory than this then see the CONFIG_HIGHMEM4G - * and CONFIG_HIGHMEM64G options in the kernel configuration. - */ - -#define __PAGE_OFFSET (0xC0000000) - -#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) -#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) -#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) -#define virt_to_page(kaddr) (mem_map + (__pa(kaddr) >> PAGE_SHIFT)) -#define VALID_PAGE(page) ((page - mem_map) < max_mapnr) - -#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) +#define VIRT_START 0xC0000000UL +#define to_phys(x) ((unsigned long)(x)-VIRT_START) +#define to_virt(x) ((void *)((unsigned long)(x)+VIRT_START)) -/* prototypes */ void init_mm(); -void release_bytes_to_allocator(unsigned long min, unsigned long max); -unsigned long __get_free_pages(int order); -void __free_pages(unsigned long p, int order); -#define get_free_pages(_o) (__get_free_pages(_o)) -#define get_free_page() (__get_free_pages(0)) -#define free_pages(_p,_o) (__free_pages(_p,_o)) -#define free_page(_p) (__free_pages(_p,0)) - -static __inline__ int get_order(unsigned long size) -{ - int order; - - size = (size-1) >> (PAGE_SHIFT-1); - order = -1; - do { - size >>= 1; - order++; - } while (size); - return order; -} - +unsigned long alloc_pages(int order); #endif /* _MM_H_ */ diff --git a/extras/mini-os/h/os.h b/extras/mini-os/h/os.h index 9578b8f5b4..c63ae6cdd5 100644 --- a/extras/mini-os/h/os.h +++ b/extras/mini-os/h/os.h @@ -7,7 +7,6 @@ #ifndef _OS_H_ #define _OS_H_ - #define NULL 0 /* @@ -126,9 +125,6 @@ do { \ typedef struct { volatile int counter; } atomic_t; -/* - * This XCHG macro is straight from Linux. It is gross. - */ #define xchg(ptr,v) \ ((__typeof__(*(ptr)))__xchg((unsigned long)(v),(ptr),sizeof(*(ptr)))) struct __xchg_dummy { unsigned long a[100]; }; @@ -252,19 +248,6 @@ static __inline__ void atomic_inc(atomic_t *v) } -/* useful hypervisor macros */ - -struct desc_struct { - unsigned long a,b; -}; -extern struct desc_struct default_ldt[]; - -#define asmlinkage __attribute__((regparm(0))) - -/* - * some random linux macros - */ - #define rdtscll(val) \ __asm__ __volatile__("rdtsc" : "=A" (val)) diff --git a/extras/mini-os/h/time.h b/extras/mini-os/h/time.h index b136f4b0c3..06fa97d68d 100644 --- a/extras/mini-os/h/time.h +++ b/extras/mini-os/h/time.h @@ -20,8 +20,6 @@ #ifndef _TIME_H_ #define _TIME_H_ -#include - /* * System Time * 64 bit value containing the nanoseconds elapsed since boot time. diff --git a/extras/mini-os/hypervisor.c b/extras/mini-os/hypervisor.c index 219c547e3f..ee7d475b1c 100644 --- a/extras/mini-os/hypervisor.c +++ b/extras/mini-os/hypervisor.c @@ -2,24 +2,26 @@ * hypervisor.c * * Communication to/from hypervisor. - * - * Copied from XenoLinux and adjusted by Rolf.Neugebauer@intel.com * - * Copyright (c) 2002, K A Fraser + * Copyright (c) 2002-2003, K A Fraser * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. */ #include @@ -65,12 +67,6 @@ void do_hypervisor_callback(struct pt_regs *regs) while ( shared->events ); } - - -/* - * Define interface to generic handling in irq.c - */ - void enable_hypervisor_event(unsigned int ev) { set_bit(ev, &event_mask); @@ -89,9 +85,6 @@ void disable_hypervisor_event(unsigned int ev) void ack_hypervisor_event(unsigned int ev) { if ( !(event_mask & (1<events_mask); } diff --git a/extras/mini-os/kernel.c b/extras/mini-os/kernel.c index 196d8612c3..12d36f1347 100644 --- a/extras/mini-os/kernel.c +++ b/extras/mini-os/kernel.c @@ -3,6 +3,26 @@ * * Assorted crap goes here, including the initial C entry point, jumped at * from head.S. + * + * Copyright (c) 2002-2003, K A Fraser & R Neugebauer + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. */ #include diff --git a/extras/mini-os/lib/malloc.c b/extras/mini-os/lib/malloc.c index 003c086858..c231eb7e86 100644 --- a/extras/mini-os/lib/malloc.c +++ b/extras/mini-os/lib/malloc.c @@ -51,17 +51,17 @@ static void *more_core(size_t n) if (n == 0) return last; - /* get pages */ - order = get_order(n); - ret = (void *)get_free_pages(order); + n = PFN_UP(n); + for ( order = 0; n > 1; order++ ) + n >>= 1; + ret = (void *)alloc_pages(order); /* work out pointer to end of chunk */ - if (ret) { + if ( ret ) + { num_pages = 1 << order; last = ret + (num_pages * PAGE_SIZE); } - - //printk("malloc(%lu) -> o=%lu r=%p, l=%p", n, order, ret, last); return ret; } diff --git a/extras/mini-os/minios.lds b/extras/mini-os/minios.lds new file mode 100644 index 0000000000..a53504e9a2 --- /dev/null +++ b/extras/mini-os/minios.lds @@ -0,0 +1,54 @@ +OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") +OUTPUT_ARCH(i386) +ENTRY(_start) +SECTIONS +{ + . = 0xC0000000; + _text = .; /* Text and read-only data */ + .text : { + *(.text) + *(.gnu.warning) + } = 0x9090 + + _etext = .; /* End of text section */ + + .rodata : { *(.rodata) *(.rodata.*) } + + .data : { /* Data */ + *(.data) + CONSTRUCTORS + } + + _edata = .; /* End of data section */ + + . = ALIGN(8192); /* init_task */ + .data.init_task : { *(.data.init_task) } + + . = ALIGN(4096); + .data.page_aligned : { *(.data.idt) } + + . = ALIGN(32); + .data.cacheline_aligned : { *(.data.cacheline_aligned) } + + __bss_start = .; /* BSS */ + .bss : { + *(.bss) + } + _end = . ; + + /* Sections to be discarded */ + /DISCARD/ : { + *(.text.exit) + *(.data.exit) + *(.exitcall.exit) + } + + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } +} diff --git a/extras/mini-os/mm.c b/extras/mini-os/mm.c index 834b816511..2bc87a5165 100644 --- a/extras/mini-os/mm.c +++ b/extras/mini-os/mm.c @@ -16,19 +16,23 @@ **************************************************************************** * $Id: c-insert.c,v 1.7 2002/11/08 16:04:34 rn Exp $ **************************************************************************** - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. */ #include @@ -59,7 +63,7 @@ void init_mm(void) printk(" _end: %p\n", &_end); /* set up minimal memory infos */ - start_pfn = PFN_UP(__pa(&_end)); + start_pfn = PFN_UP(to_phys(&_end)); max_pfn = start_info.nr_pages; printk(" start_pfn: %lx\n", start_pfn); @@ -79,19 +83,19 @@ void init_mm(void) * is always true. */ - max_free_pfn = PFN_DOWN(__pa(pgd)); + max_free_pfn = PFN_DOWN(to_phys(pgd)); { unsigned long *pgd = (unsigned long *)start_info.pt_base; unsigned long pte; int i; - printk(" pgd(pa(pgd)): %lx(%lx)", (u_long)pgd, __pa(pgd)); + printk(" pgd(pa(pgd)): %lx(%lx)", (u_long)pgd, to_phys(pgd)); for ( i = 0; i < (HYPERVISOR_VIRT_START>>22); i++ ) { unsigned long pgde = *pgd++; if ( !(pgde & 1) ) continue; pte = machine_to_phys(pgde & PAGE_MASK); - printk(" PT(%x): %lx(%lx)", i, (u_long)__va(pte), pte); + printk(" PT(%x): %lx(%lx)", i, (u_long)to_virt(pte), pte); if (PFN_DOWN(pte) <= max_free_pfn) max_free_pfn = PFN_DOWN(pte); } @@ -103,8 +107,8 @@ void init_mm(void) * now we can initialise the page allocator */ printk("MM: Initialise page allocator for %lx(%lx)-%lx(%lx)\n", - (u_long)__va(PFN_PHYS(start_pfn)), PFN_PHYS(start_pfn), - (u_long)__va(PFN_PHYS(max_free_pfn)), PFN_PHYS(max_free_pfn)); + (u_long)to_virt(PFN_PHYS(start_pfn)), PFN_PHYS(start_pfn), + (u_long)to_virt(PFN_PHYS(max_free_pfn)), PFN_PHYS(max_free_pfn)); init_page_allocator(PFN_PHYS(start_pfn), PFN_PHYS(max_free_pfn)); @@ -233,7 +237,7 @@ static void init_page_allocator(unsigned long min, unsigned long max) /* Allocate space for the allocation bitmap. */ bitmap_size = (max+1) >> (PAGE_SHIFT+3); bitmap_size = round_pgup(bitmap_size); - alloc_bitmap = (unsigned long *)__va(min); + alloc_bitmap = (unsigned long *)to_virt(min); min += bitmap_size; range = max - min; @@ -243,8 +247,8 @@ static void init_page_allocator(unsigned long min, unsigned long max) map_free(min>>PAGE_SHIFT, range>>PAGE_SHIFT); /* The buddy lists are addressed in high memory. */ - min += PAGE_OFFSET; - max += PAGE_OFFSET; + min += VIRT_START; + max += VIRT_START; while ( range != 0 ) { @@ -271,22 +275,8 @@ static void init_page_allocator(unsigned long min, unsigned long max) } -/* Release a PHYSICAL address range to the allocator. */ -void release_bytes_to_allocator(unsigned long min, unsigned long max) -{ - min = round_pgup (min) + PAGE_OFFSET; - max = round_pgdown(max) + PAGE_OFFSET; - - while ( min < max ) - { - __free_pages(min, 0); - min += PAGE_SIZE; - } -} - - /* Allocate 2^@order contiguous pages. Returns a VIRTUAL address. */ -unsigned long __get_free_pages(int order) +unsigned long alloc_pages(int order) { int i; chunk_head_t *alloc_ch, *spare_ch; @@ -325,7 +315,7 @@ unsigned long __get_free_pages(int order) free_head[i] = spare_ch; } - map_alloc(__pa(alloc_ch)>>PAGE_SHIFT, 1<>PAGE_SHIFT, 1<> PAGE_SHIFT; - - map_free(pagenr, 1<level != order ) break; - ch = (chunk_head_t *)(p - size); - p -= size; - } - else - { - /* Merge with successor block? */ - if ( allocated_in_map(pagenr+(1<level != order ) break; - } - - /* Okay, unlink the neighbour. */ - *ch->pprev = ch->next; - ch->next->pprev = ch->pprev; - - order++; - size <<= 1; - } - - /* Okay, add the final chunk to the appropriate free list. */ - ch = (chunk_head_t *)p; - ct = (chunk_tail_t *)(p+size)-1; - ct->level = order; - ch->level = order; - ch->pprev = &free_head[order]; - ch->next = free_head[order]; - ch->next->pprev = &ch->next; - free_head[order] = ch; -} diff --git a/extras/mini-os/time.c b/extras/mini-os/time.c index ff23b2ee63..8e7de4e20d 100644 --- a/extras/mini-os/time.c +++ b/extras/mini-os/time.c @@ -15,6 +15,23 @@ **************************************************************************** * $Id: c-insert.c,v 1.7 2002/11/08 16:04:34 rn Exp $ **************************************************************************** + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. */ diff --git a/extras/mini-os/traps.c b/extras/mini-os/traps.c index 8dec10c581..b97f9e3bc6 100644 --- a/extras/mini-os/traps.c +++ b/extras/mini-os/traps.c @@ -31,52 +31,6 @@ void machine_check(void); extern void do_exit(void); -int kstack_depth_to_print = 24; -#define THREAD_SIZE (2*PAGE_SIZE) - -static inline int kernel_text_address(unsigned long addr) -{ - return ( (addr >> 20) > 0x800 && (addr >> 20) < 0x804 ); -} - -void show_trace(unsigned long * stack) -{ - int i; - unsigned long addr; - - if (!stack) - stack = (unsigned long*)&stack; - - printk("Call Trace: "); - i = 1; - while (((long) stack & (4095)) != 0) { - addr = *stack++; - if (kernel_text_address(addr)) { - printf("0x%lx", addr); - i++; - } - } - printk("\n"); -} - -void show_stack(unsigned long * esp) -{ - unsigned long *stack; - int i; - - if(esp==NULL) - esp=(unsigned long*)&esp; - - stack = esp; - for(i=0; i < kstack_depth_to_print; i++) { - if (((long) stack & (THREAD_SIZE-1)) == 0) - break; - printk("%08lx ", *stack++); - } - printk("\n"); - show_trace(esp); -} - void dump_regs(struct pt_regs *regs) { int in_kernel = 1; @@ -132,7 +86,6 @@ static void inline do_trap(int trapnr, char *str, printk("FATAL: Unhandled Trap (see mini-os:traps.c)"); printf("%d %s", trapnr, str); dump_regs(regs); - show_trace((void *)regs->esp); dump_code(regs->eip); do_exit(); @@ -164,7 +117,7 @@ DO_ERROR(12, "stack segment", stack_segment) DO_ERROR_INFO(17, "alignment check", alignment_check, BUS_ADRALN, 0) DO_ERROR(18, "machine check", machine_check) -void do_page_fault(struct pt_regs * regs, long error_code, +void do_page_fault(struct pt_regs *regs, long error_code, unsigned long address) { printk("Page fault\n"); @@ -211,13 +164,13 @@ void simd_math_error(void *eip) } void do_simd_coprocessor_error(struct pt_regs * regs, - long error_code) + long error_code) { printk("SIMD copro error\n"); } void do_spurious_interrupt_bug(struct pt_regs * regs, - long error_code) + long error_code) { } diff --git a/extras/mini-os/vmlinux.lds b/extras/mini-os/vmlinux.lds deleted file mode 100644 index 7c4c4f8e9c..0000000000 --- a/extras/mini-os/vmlinux.lds +++ /dev/null @@ -1,82 +0,0 @@ -/* ld script to make i386 Linux kernel - * Written by Martin Mares ; - */ -OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") -OUTPUT_ARCH(i386) -ENTRY(_start) -SECTIONS -{ - . = 0xC0000000 + 0x000000; - _text = .; /* Text and read-only data */ - .text : { - *(.text) - *(.fixup) - *(.gnu.warning) - } = 0x9090 - - _etext = .; /* End of text section */ - - .rodata : { *(.rodata) *(.rodata.*) } - .kstrtab : { *(.kstrtab) } - - . = ALIGN(16); /* Exception table */ - __start___ex_table = .; - __ex_table : { *(__ex_table) } - __stop___ex_table = .; - - __start___ksymtab = .; /* Kernel symbol table */ - __ksymtab : { *(__ksymtab) } - __stop___ksymtab = .; - - .data : { /* Data */ - *(.data) - CONSTRUCTORS - } - - _edata = .; /* End of data section */ - - . = ALIGN(8192); /* init_task */ - .data.init_task : { *(.data.init_task) } - - . = ALIGN(4096); /* Init code and data */ - __init_begin = .; - .text.init : { *(.text.init) } - .data.init : { *(.data.init) } - . = ALIGN(16); - __setup_start = .; - .setup.init : { *(.setup.init) } - __setup_end = .; - __initcall_start = .; - .initcall.init : { *(.initcall.init) } - __initcall_end = .; - . = ALIGN(4096); - __init_end = .; - - . = ALIGN(4096); - .data.page_aligned : { *(.data.idt) } - - . = ALIGN(32); - .data.cacheline_aligned : { *(.data.cacheline_aligned) } - - __bss_start = .; /* BSS */ - .bss : { - *(.bss) - } - _end = . ; - - /* Sections to be discarded */ - /DISCARD/ : { - *(.text.exit) - *(.data.exit) - *(.exitcall.exit) - } - - /* Stabs debugging sections. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } -} -- cgit v1.2.3