Subversion Repositories shark

Rev

Rev 3 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 pj 1
/* Project:     OSLib
2
 * Description: The OS Construction Kit
3
 * Date:                1.6.2000
4
 * Idea by:             Luca Abeni & Gerardo Lamastra
5
 *
6
 * OSLib is an SO project aimed at developing a common, easy-to-use
7
 * low-level infrastructure for developing OS kernels and Embedded
8
 * Applications; it partially derives from the HARTIK project but it
9
 * currently is independently developed.
10
 *
11
 * OSLib is distributed under GPL License, and some of its code has
12
 * been derived from the Linux kernel source; also some important
13
 * ideas come from studying the DJGPP go32 extender.
14
 *
15
 * We acknowledge the Linux Community, Free Software Foundation,
16
 * D.J. Delorie and all the other developers who believe in the
17
 * freedom of software and ideas.
18
 *
19
 * For legalese, check out the included GPL license.
20
 */
21
 
22
/*      Multiboot Info test file                */
23
 
24
#include <ll/i386/stdlib.h>
25
#include <ll/i386/cons.h>
26
#include <ll/i386/error.h>
27
#include <ll/i386/mem.h>
28
#include <ll/i386/mb-info.h>
29
#include <ll/sys/ll/ll-func.h>
30
#include <ll/sys/ll/event.h>
31
 
32
int main (int argc, char *argv[])
33
{
34
    DWORD sp1, sp2;
35
    struct ll_initparms parms;
36
    struct multiboot_info *mbi;
37
    DWORD lbase, hbase;
38
    DWORD lsize, hsize;
40 pj 39
    int eXtender = 0;
2 pj 40
 
41
    sp1 = get_SP();
42
    cli();
43
    parms.mode = LL_PERIODIC;
44
    parms.tick = 1000;
45
    mbi = ll_init();
46
    event_init(&parms);
47
 
48
    if (mbi == NULL) {
49
            message("Error in LowLevel initialization code...\n");
50
            sti();
51
            l1_exit(-1);
52
    }
53
    sti();
54
 
55
        message("LowLevel started...\n");
56
        message("MultiBoot informations:\n");
57
 
40 pj 58
        if (mbi->flags & MB_INFO_BOOT_LOADER_NAME) {
59
            message("Loader Name provided: %s\n", (char *)mbi->boot_loader_name);
60
            if (*((char *)(mbi->boot_loader_name)) == 'X') {
61
                eXtender = 1;
62
            }
63
        }
2 pj 64
        if (mbi->flags & MB_INFO_MEMORY) {
65
                message("\tMemory informations OK\n");
66
                lsize = mbi->mem_lower * 1024;
67
                hsize = mbi->mem_upper * 1024;
68
                message("Mem Lower: %lx %lu\n", lsize, lsize);
69
                message("Mem Upper: %lx %lu\n", hsize, hsize);
40 pj 70
                if (eXtender) {
2 pj 71
                        lbase = mbi->mem_lowbase;
72
                        hbase = mbi->mem_upbase;
73
                } else {
74
                        lbase = 0x0;
75
                        hbase = 0x100000;
76
                }
77
                message("\t\tLow Memory: %ld - %ld (%lx - %lx) \n",
78
                                lbase, lbase + lsize,
79
                                lbase, lbase + lsize);
80
                message("\t\tLow Memory: %ld - %ld (%lx - %lx)\n",
81
                                hbase, hbase + hsize,
82
                                hbase, hbase + hsize);
83
        }
84
        if (mbi->flags & MB_INFO_BOOTDEV) {
85
                message("\tBoot device set\n");
86
        }
87
        if (mbi->flags & MB_INFO_CMDLINE) {
88
                message("\tCommand line provided\n");
89
        }
90
        if (mbi->flags & MB_INFO_MODS) {
91
                message("\tSome modules was loaded\n");
92
        }
93
        if (mbi->flags & MB_INFO_AOUT_SYMS) {
94
                message("\tA.OUT Simbol table\n");
95
        }
96
        if (mbi->flags & MB_INFO_ELF_SHDR) {
97
                message("\tELF Section header\n");
98
        }
99
        if (mbi->flags & MB_INFO_MEM_MAP) {
100
                message("\tMemory map provided\n");
101
        }
40 pj 102
        if (eXtender) {
2 pj 103
                message("\tLoaded through X\n");
104
        }
105
    cli();
106
    ll_end();
107
    sp2 = get_SP();
108
    message("End reached!\n");
109
    message("Actual stack : %lx - ", sp2);
110
    message("Begin stack : %lx\n", sp1);
111
    message("Check if same : %s\n",sp1 == sp2 ? "Ok :-)" : "No :-(");
112
 
113
    return 1;
114
}