Changeset 8ccec3c1 in mainline


Ignore:
Timestamp:
2006-01-04T22:41:05Z (19 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
45ba9cf
Parents:
a59e81e
Message:

remove deprecated pre-grub stuff on ia32
prepare for the same on amd64

Location:
arch
Files:
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • arch/amd64/src/boot/boot.S

    ra59e81e r8ccec3c1  
    81811:
    8282        jmp 1b
     83       
     84.code32
     85.align 4
     86multiboot_header:
     87        .long MULTIBOOT_HEADER_MAGIC
     88        .long MULTIBOOT_HEADER_FLAGS
     89        .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)        # checksum
     90        .long multiboot_header + BOOT_OFFSET
     91        .long unmapped_ktext_start + BOOT_OFFSET
     92        .long 0
     93        .long 0
     94        .long multiboot_image_start + BOOT_OFFSET
     95
     96multiboot_image_start:
     97        movl $START_STACK, %esp                         # initialize stack pointer
     98        # FIXME TODO
    8399
    84100# Protected 32-bit. We want to reuse the code-seg descriptor,
    85101# the Default operand size must not be 1 when entering long mode
    86 .code32
    87102now_in_prot: 
    88103        # Set up stack & data descriptors
  • arch/amd64/src/boot/memmap.S

    • Property mode changed from 120000 to 100644
    ra59e81e r8ccec3c1  
    1 ../../../ia32/src/boot/memmap.S
     1/*
     2 * Copyright (C) 2005 Josef Cejka
     3 * All rights reserved.
     4 *
     5 * Redistribution and use in source and binary forms, with or without
     6 * modification, are permitted provided that the following conditions
     7 * are met:
     8 *
     9 * - Redistributions of source code must retain the above copyright
     10 *   notice, this list of conditions and the following disclaimer.
     11 * - Redistributions in binary form must reproduce the above copyright
     12 *   notice, this list of conditions and the following disclaimer in the
     13 *   documentation and/or other materials provided with the distribution.
     14 * - The name of the author may not be used to endorse or promote products
     15 *   derived from this software without specific prior written permission.
     16 *
     17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     27 */
     28
     29
     30#include <arch/boot/memmap.h>
     31
     32E820_SMAP = 0x534d4150
     33
     34.global memmap_arch_init
     35.global e801memorysize
     36
     37.code16
     38.section K_TEXT_START_2, "ax"
     39
     40memmap_arch_init:
     41e820begin:
     42        xorl    %ebx,%ebx                       # during first call, ebx must be 0
     43        movw    $e820table_boot,%di
     44        movb    $MEMMAP_E820_MAX_RECORDS,e820counter_boot
     45e820loop:       
     46        movl    $E820_SMAP,%edx                 # control sequence "SMAP"
     47
     48        movl    $0x0000e820,%eax                # service
     49        movl    $MEMMAP_E820_RECORD_SIZE,%ecx
     50        int     $0x15
     51        jc      e820err
     52       
     53        cmpl    $E820_SMAP,%eax                 # verifying BIOS
     54        jne     e820err
     55
     56        cmpl    $MEMMAP_E820_RECORD_SIZE,%ecx
     57        jne     e820err                         # bad record size - bug in bios
     58       
     59        movw    %di,%ax                         # next record
     60        addw    $MEMMAP_E820_RECORD_SIZE,%ax
     61        movw    %ax,%di
     62               
     63        decb    e820counter_boot                # buffer is full
     64        jz      e820end
     65       
     66        testl   %ebx,%ebx       
     67        jnz     e820loop
     68       
     69e820end:
     70        movb    $MEMMAP_E820_MAX_RECORDS,%al
     71        subb    e820counter_boot,%al
     72        movb    %al,e820counter_boot            # store # of valid entries in e820counter
     73
     74        jmp     e801begin
     75
     76e820err:
     77        movb    $0,e820counter_boot
     78
     79# method e801 - get size of memory
     80
     81e801begin:
     82        xorw    %dx,%dx
     83        xorw    %cx,%cx
     84        xorw    %bx,%bx
     85        movw    $0xe801,%ax
     86        stc
     87        int     $0x15
     88       
     89        jc      e801end
     90       
     91        # fix problem with some BIOSes which use ax:bx rather than cx:dx
     92        testw   %cx,%cx
     93        jnz     e801cxdx
     94        testw   %dx,%dx
     95        jnz     e801cxdx
     96
     97        movw    %ax,%cx
     98        movw    %bx,%dx
     99       
     100e801cxdx:
     101        andl    $0xffff,%edx
     102        shll    $6,%edx
     103        andl    $0xffff,%ecx
     104        addl    %ecx,%edx
     105        addl    $0x0400,%edx                    # add lower 1 MB - it's not included by e801 method
     106        movl    %edx,e801memorysize
     107e801end:
     108        ret
     109
     110
     111.section K_DATA_START, "aw", @progbits
     112
     113#memory size in 1 kb chunks
     114e801memorysize:
     115        .long   0
  • arch/amd64/src/mm/memory_init.c

    • Property mode changed from 120000 to 100644
    ra59e81e r8ccec3c1  
    1 ../../../ia32/src/mm/memory_init.c
     1/*
     2 * Copyright (C) 2005 Josef Cejka
     3 * All rights reserved.
     4 *
     5 * Redistribution and use in source and binary forms, with or without
     6 * modification, are permitted provided that the following conditions
     7 * are met:
     8 *
     9 * - Redistributions of source code must retain the above copyright
     10 *   notice, this list of conditions and the following disclaimer.
     11 * - Redistributions in binary form must reproduce the above copyright
     12 *   notice, this list of conditions and the following disclaimer in the
     13 *   documentation and/or other materials provided with the distribution.
     14 * - The name of the author may not be used to endorse or promote products
     15 *   derived from this software without specific prior written permission.
     16 *
     17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     27 */
     28
     29#include <arch/boot/memmap.h>
     30#include <arch/mm/memory_init.h>
     31#include <arch/mm/page.h>
     32#include <print.h>
     33
     34__u8 e820counter __attribute__ ((section ("BOOT_DATA"))) = 0xff;
     35struct e820memmap_ e820table[MEMMAP_E820_MAX_RECORDS] __attribute__ ((section ("BOOT_DATA"))) ;
     36
     37size_t get_memory_size(void)
     38{
     39        return e801memorysize*1024;
     40}
     41
     42void memory_print_map(void)
     43{
     44        __u8 i;
     45       
     46        for (i=0;i<e820counter;i++) {
     47                printf("E820 base: %Q size: %Q type: ", e820table[i].base_address, e820table[i].size);
     48                switch (e820table[i].type) {
     49                        case MEMMAP_MEMORY_AVAILABLE:
     50                                printf("available memory\n");
     51                                break;
     52                        case MEMMAP_MEMORY_RESERVED:
     53                                printf("reserved memory\n");
     54                                break;
     55                        case MEMMAP_MEMORY_ACPI:
     56                                printf("ACPI table\n");
     57                                break;
     58                        case MEMMAP_MEMORY_NVS:
     59                                printf("NVS\n");
     60                                break;
     61                        case MEMMAP_MEMORY_UNUSABLE:
     62                                printf("unusable memory\n");
     63                                break;
     64                        default:
     65                                printf("undefined memory type\n");
     66                }
     67        }
     68
     69}
     70
  • arch/ia32/Makefile.inc

    ra59e81e r8ccec3c1  
    115115        arch/$(ARCH)/src/drivers/ega.c \
    116116        arch/$(ARCH)/src/boot/boot.S \
    117         arch/$(ARCH)/src/boot/memmap.S \
    118117        arch/$(ARCH)/src/fpu_context.c
  • arch/ia32/_link.ld.in

    ra59e81e r8ccec3c1  
    1212#include <arch/boot/boot.h>
    1313#include <arch/mm/page.h>
    14 
    15 ENTRY(kernel_image_start)
    1614
    1715SECTIONS {
     
    2927        .mapped (PA2KA(BOOT_OFFSET+BOOTSTRAP_OFFSET)+SIZEOF(.unmapped)): AT (BOOTSTRAP_OFFSET+SIZEOF(.unmapped)) {
    3028                ktext_start = .;
    31                 *(BOOT_DATA);
    3229                *(.text);
    3330                ktext_end = .;
  • arch/ia32/src/boot/boot.S

    ra59e81e r8ccec3c1  
    3333
    3434.section K_TEXT_START, "ax"
    35 .global kernel_image_start
    3635
    3736KTEXT=8
    3837KDATA=16
    3938
    40 .code16
    41 #
    42 # This is where we require any SPARTAN-kernel-compatible boot loader
    43 # to pass control in real mode.
    44 #
    45 # Protected mode tables are statically initialised during compile
    46 # time. So we can just load the respective table registers and
    47 # switch to protected mode.
    48 #
    49 kernel_image_start:
    50         cli
    51         xorw %ax, %ax
    52         movw %ax, %ds
    53         movw %ax, %es
    54         movw %ax, %ss                                                   # initialize stack segment register
    55         movl $BOOTSTRAP_OFFSET - 0x400, %esp                            # initialize stack pointer
    56        
    57         call memmap_arch_init
    58        
    59         lgdt real_bootstrap_gdtr_boot                                   # initialize Global Descriptor Table register
    60        
    61         movl %cr0, %eax
    62         orl $0x1, %eax
    63         movl %eax, %cr0                                                 # switch to protected mode
    64        
    65         jmpl $KTEXT, $boot_image_start
    66        
    6739.code32
    6840.align 4
     
    7749        .long multiboot_image_start + BOOT_OFFSET
    7850       
    79 boot_image_start:
    80         movw $KDATA, %ax
    81         movw %ax, %es
    82         movw %ax, %gs
    83         movw %ax, %fs
    84         movw %ax, %ds                                                   # kernel data + stack
    85         movw %ax, %ss
    86        
    87         movb $0xd1, %al                                                 # enable A20 using i8042 controller
    88         outb %al, $0x64
    89         movb $0xdf, %al
    90         outb %al, $0x60
    91        
    92         movl $BOOTSTRAP_OFFSET, %esi
    93         movl $BOOTSTRAP_OFFSET + BOOT_OFFSET, %edi
    94         movl $_hardcoded_kernel_size, %ecx
    95         cld
    96         rep movsb
    97        
    98         call map_kernel                                                 # map kernel and turn paging on
    99        
    100         call main_bsp                                                   # never returns
    101 
    102         cli
    103         hlt
    104        
    10551multiboot_image_start:
    10652        movl $BOOTSTRAP_OFFSET - 0x400, %esp                            # initialize stack pointer
Note: See TracChangeset for help on using the changeset viewer.