Subversion Repositories shark

Rev

Details | 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;
39
 
40
    sp1 = get_SP();
41
    cli();
42
    parms.mode = LL_PERIODIC;
43
    parms.tick = 1000;
44
    mbi = ll_init();
45
    event_init(&parms);
46
 
47
    if (mbi == NULL) {
48
            message("Error in LowLevel initialization code...\n");
49
            sti();
50
            l1_exit(-1);
51
    }
52
    sti();
53
 
54
        message("LowLevel started...\n");
55
        message("MultiBoot informations:\n");
56
 
57
        if (mbi->flags & MB_INFO_MEMORY) {
58
                message("\tMemory informations OK\n");
59
                lsize = mbi->mem_lower * 1024;
60
                hsize = mbi->mem_upper * 1024;
61
                message("Mem Lower: %lx %lu\n", lsize, lsize);
62
                message("Mem Upper: %lx %lu\n", hsize, hsize);
63
                if (mbi->flags & MB_INFO_USEGDT) {
64
                        lbase = mbi->mem_lowbase;
65
                        hbase = mbi->mem_upbase;
66
                } else {
67
                        lbase = 0x0;
68
                        hbase = 0x100000;
69
                }
70
                message("\t\tLow Memory: %ld - %ld (%lx - %lx) \n",
71
                                lbase, lbase + lsize,
72
                                lbase, lbase + lsize);
73
                message("\t\tLow Memory: %ld - %ld (%lx - %lx)\n",
74
                                hbase, hbase + hsize,
75
                                hbase, hbase + hsize);
76
        }
77
        if (mbi->flags & MB_INFO_BOOTDEV) {
78
                message("\tBoot device set\n");
79
        }
80
        if (mbi->flags & MB_INFO_CMDLINE) {
81
                message("\tCommand line provided\n");
82
        }
83
        if (mbi->flags & MB_INFO_MODS) {
84
                message("\tSome modules was loaded\n");
85
        }
86
        if (mbi->flags & MB_INFO_AOUT_SYMS) {
87
                message("\tA.OUT Simbol table\n");
88
        }
89
        if (mbi->flags & MB_INFO_ELF_SHDR) {
90
                message("\tELF Section header\n");
91
        }
92
        if (mbi->flags & MB_INFO_MEM_MAP) {
93
                message("\tMemory map provided\n");
94
        }
95
        if (mbi->flags & MB_INFO_USEGDT) {
96
                message("\tLoaded through X\n");
97
        }
98
    cli();
99
    ll_end();
100
    sp2 = get_SP();
101
    message("End reached!\n");
102
    message("Actual stack : %lx - ", sp2);
103
    message("Begin stack : %lx\n", sp1);
104
    message("Check if same : %s\n",sp1 == sp2 ? "Ok :-)" : "No :-(");
105
 
106
    return 1;
107
}