Project

General

Profile

Revision 126

controller in half

View differences:

graphics.c
49 49
    return SUCCESS;
50 50
}
51 51

  
52
int (vbe_get_controller_information)(vg_vbe_contr_info_t *info_p) {
53
    memset(info_p, 0, sizeof(vg_vbe_contr_info_t)); // reset values
54

  
55
    mmap_t controller_map;
56

  
57
    struct reg86 reg_86;
58
    memset(&reg_86, 0, sizeof(struct reg86)); // reset struct
59

  
60
    VbeInfoBlock *virtual_addr = lm_alloc(sizeof(VbeInfoBlock), &controller_map);
61

  
62
    virtual_addr->VbeSignature[0] = 'V';
63
    virtual_addr->VbeSignature[1] = 'B';
64
    virtual_addr->VbeSignature[2] = 'E';
65
    virtual_addr->VbeSignature[3] = '2';
66

  
67

  
68
    reg_86.intno = VC_BIOS_SERV;
69
    reg_86.ah = VBE_CALL;
70
    reg_86.al = VBE_CTRL_INFO;
71
    reg_86.es = PB2BASE(controller_map.phys);
72
    reg_86.di = PB2OFF(controller_map.phys);
73
    // BIOS CALL
74
    if (sys_int86(&reg_86)) {
75
        printf("%s: sys_int86 failed\n", __func__);
76
        if (free_memory()) {
77
            printf("%s: lm_free failed\n", __func__);
78
            return LCF_ERROR;
79
        }
80
        return BIOS_CALL_ERROR;
81
    }
82

  
83
    info_p->VBESignature[0] = virtual_addr->VbeSignature[0];
84
    info_p->VBESignature[1] = virtual_addr->VbeSignature[1];
85
    info_p->VBESignature[2] = virtual_addr->VbeSignature[2];
86
    info_p->VBESignature[3] = virtual_addr->VbeSignature[3];
87

  
88
    uint8_t lsb, msb;
89
    util_get_LSB(virtual_addr->VbeVersion, &lsb);
90
    util_get_MSB(virtual_addr->VbeVersion, &msb);
91
    info_p->VBEVersion[0] = lsb;
92
    info_p->VBEVersion[1] = msb;
93

  
94
    info_p->TotalMemory = (virtual_addr->TotalMemory << 6);
95

  
96
    // Convert Far Far Pointer to Virtual Address
97

  
98
    //uint32_t phys_ptr = FAR2PHYS(virtual_addr->OemStringPtr);
99

  
100

  
101

  
102

  
103

  
104

  
105

  
106
    return SUCCESS;
107
}
108

  
52 109
phys_bytes get_phys_addr(void) {
53 110
    return vbe_mem_info.PhysBasePtr;
54 111
}

Also available in: Unified diff