Subversion Repositories HelenOS-historic

Rev

Rev 1562 | Rev 1565 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1562 Rev 1564
1
/*
1
/*
2
 * Copyright (C) 2006 Ondrej Palkovsky
2
 * Copyright (C) 2006 Ondrej Palkovsky
3
 * All rights reserved.
3
 * All rights reserved.
4
 *
4
 *
5
 * Redistribution and use in source and binary forms, with or without
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
6
 * modification, are permitted provided that the following conditions
7
 * are met:
7
 * are met:
8
 *
8
 *
9
 * - Redistributions of source code must retain the above copyright
9
 * - Redistributions of source code must retain the above copyright
10
 *   notice, this list of conditions and the following disclaimer.
10
 *   notice, this list of conditions and the following disclaimer.
11
 * - Redistributions in binary form must reproduce the above copyright
11
 * - Redistributions in binary form must reproduce the above copyright
12
 *   notice, this list of conditions and the following disclaimer in the
12
 *   notice, this list of conditions and the following disclaimer in the
13
 *   documentation and/or other materials provided with the distribution.
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
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.
15
 *   derived from this software without specific prior written permission.
16
 *
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
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
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
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
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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
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.
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
27
 */
28
#include <stdlib.h>
28
#include <stdlib.h>
29
#include <unistd.h>
29
#include <unistd.h>
30
#include <align.h>
30
#include <align.h>
31
#include <async.h>
31
#include <async.h>
32
#include <ipc/ipc.h>
32
#include <ipc/ipc.h>
33
#include <errno.h>
33
#include <errno.h>
34
#include <stdio.h>
34
#include <stdio.h>
35
#include <ddi.h>
35
#include <ddi.h>
36
#include <sysinfo.h>
36
#include <sysinfo.h>
37
#include <as.h>
37
#include <as.h>
38
#include <ipc/fb.h>
38
#include <ipc/fb.h>
39
#include <ipc/ipc.h>
39
#include <ipc/ipc.h>
40
#include <ipc/ns.h>
40
#include <ipc/ns.h>
41
#include <ipc/services.h>
41
#include <ipc/services.h>
42
 
42
 
43
#include "ega.h"
43
#include "ega.h"
44
#include "../console/screenbuffer.h"
44
#include "../console/screenbuffer.h"
45
#include "main.h"
45
#include "main.h"
46
 
46
 
47
#define MAX_SAVED_SCREENS 256
47
#define MAX_SAVED_SCREENS 256
48
typedef struct saved_screen {
48
typedef struct saved_screen {
49
    short *data;
49
    short *data;
50
} saved_screen;
50
} saved_screen;
51
 
51
 
52
saved_screen saved_screens[MAX_SAVED_SCREENS];
52
saved_screen saved_screens[MAX_SAVED_SCREENS];
53
 
53
 
54
 
54
 
55
#define EGA_IO_ADDRESS 0x3d4
55
#define EGA_IO_ADDRESS 0x3d4
56
#define EGA_IO_SIZE 2
56
#define EGA_IO_SIZE 2
57
 
57
 
58
typedef unsigned char u8;
58
typedef unsigned char u8;
59
typedef unsigned short u16;
59
typedef unsigned short u16;
60
typedef unsigned int u32;
60
typedef unsigned int u32;
61
 
61
 
62
 
62
 
63
/* Allow only 1 connection */
63
/* Allow only 1 connection */
64
static int client_connected = 0;
64
static int client_connected = 0;
65
 
65
 
66
static unsigned int scr_width;
66
static unsigned int scr_width;
67
static unsigned int scr_height;
67
static unsigned int scr_height;
68
static char *scr_addr;
68
static char *scr_addr;
69
 
69
 
70
static unsigned int style = 0x1e;
70
static unsigned int style = 0x1e;
71
 
71
 
72
static inline void outb(u16 port, u8 b)
72
static inline void outb(u16 port, u8 b)
73
{
73
{
74
    asm volatile ("outb %0, %1\n" :: "a" (b), "d" (port));
74
    asm volatile ("outb %0, %1\n" :: "a" (b), "d" (port));
75
}
75
}
76
 
76
 
77
static inline void outw(u16 port, u16 w)
77
static inline void outw(u16 port, u16 w)
78
{
78
{
79
    asm volatile ("outw %0, %1\n" :: "a" (w), "d" (port));
79
    asm volatile ("outw %0, %1\n" :: "a" (w), "d" (port));
80
}
80
}
81
 
81
 
82
static inline void outl(u16 port, u32 l)
82
static inline void outl(u16 port, u32 l)
83
{
83
{
84
    asm volatile ("outl %0, %1\n" :: "a" (l), "d" (port));
84
    asm volatile ("outl %0, %1\n" :: "a" (l), "d" (port));
85
}
85
}
86
 
86
 
87
static inline u8 inb(u16 port)
87
static inline u8 inb(u16 port)
88
{
88
{
89
    u8 val;
89
    u8 val;
90
 
90
 
91
    asm volatile ("inb %1, %0 \n" : "=a" (val) : "d"(port));
91
    asm volatile ("inb %1, %0 \n" : "=a" (val) : "d"(port));
92
    return val;
92
    return val;
93
}
93
}
94
 
94
 
95
static inline u16 inw(u16 port)
95
static inline u16 inw(u16 port)
96
{
96
{
97
    u16 val;
97
    u16 val;
98
 
98
 
99
    asm volatile ("inw %1, %0 \n" : "=a" (val) : "d"(port));
99
    asm volatile ("inw %1, %0 \n" : "=a" (val) : "d"(port));
100
    return val;
100
    return val;
101
}
101
}
102
 
102
 
103
static inline u32 inl(u16 port)
103
static inline u32 inl(u16 port)
104
{
104
{
105
    u32 val;
105
    u32 val;
106
 
106
 
107
    asm volatile ("inl %1, %0 \n" : "=a" (val) : "d"(port));
107
    asm volatile ("inl %1, %0 \n" : "=a" (val) : "d"(port));
108
    return val;
108
    return val;
109
}
109
}
110
 
110
 
111
 
111
 
112
 
112
 
113
 
113
 
114
static void clrscr(void)
114
static void clrscr(void)
115
{
115
{
116
    int i;
116
    int i;
117
   
117
   
118
    for (i=0; i < scr_width*scr_height; i++) {
118
    for (i=0; i < scr_width*scr_height; i++) {
119
        scr_addr[i*2] = ' ';
119
        scr_addr[i*2] = ' ';
120
        scr_addr[i*2+1] = style;
120
        scr_addr[i*2+1] = style;
121
    }
121
    }
122
}
122
}
123
 
123
 
124
static void cursor_goto(unsigned int row, unsigned int col)
124
static void cursor_goto(unsigned int row, unsigned int col)
125
{
125
{
126
    int ega_cursor;
126
    int ega_cursor;
127
 
127
 
128
    ega_cursor=col+scr_width*row;
128
    ega_cursor=col+scr_width*row;
129
   
129
   
130
    outb(EGA_IO_ADDRESS    , 0xe);
130
    outb(EGA_IO_ADDRESS    , 0xe);
131
    outb(EGA_IO_ADDRESS + 1, (ega_cursor >>8) & 0xff);
131
    outb(EGA_IO_ADDRESS + 1, (ega_cursor >>8) & 0xff);
132
    outb(EGA_IO_ADDRESS    , 0xf);
132
    outb(EGA_IO_ADDRESS    , 0xf);
133
    outb(EGA_IO_ADDRESS + 1, ega_cursor & 0xff);
133
    outb(EGA_IO_ADDRESS + 1, ega_cursor & 0xff);
134
}
134
}
135
 
135
 
136
static void cursor_disable(void)
136
static void cursor_disable(void)
137
{
137
{
138
    u8 stat;
138
    u8 stat;
139
    outb(EGA_IO_ADDRESS , 0xa);
139
    outb(EGA_IO_ADDRESS , 0xa);
140
    stat=inb(EGA_IO_ADDRESS + 1);
140
    stat=inb(EGA_IO_ADDRESS + 1);
141
    outb(EGA_IO_ADDRESS , 0xa);
141
    outb(EGA_IO_ADDRESS , 0xa);
142
    outb(EGA_IO_ADDRESS +1 ,stat | (1<<5) );
142
    outb(EGA_IO_ADDRESS +1 ,stat | (1<<5) );
143
}
143
}
144
 
144
 
145
static void cursor_enable(void)
145
static void cursor_enable(void)
146
{
146
{
147
    u8 stat;
147
    u8 stat;
148
    outb(EGA_IO_ADDRESS , 0xa);
148
    outb(EGA_IO_ADDRESS , 0xa);
149
    stat=inb(EGA_IO_ADDRESS + 1);
149
    stat=inb(EGA_IO_ADDRESS + 1);
150
    outb(EGA_IO_ADDRESS , 0xa);
150
    outb(EGA_IO_ADDRESS , 0xa);
151
    outb(EGA_IO_ADDRESS +1 ,stat & (~(1<<5)) );
151
    outb(EGA_IO_ADDRESS +1 ,stat & (~(1<<5)) );
152
}
152
}
153
 
153
 
154
static void scroll(int rows)
154
static void scroll(int rows)
155
{
155
{
156
    int i;
156
    int i;
157
    if (rows > 0) {
157
    if (rows > 0) {
158
        memcpy(scr_addr,((char *)scr_addr)+rows*scr_width*2,scr_width*scr_height*2-rows*scr_width*2);
158
        memcpy(scr_addr,((char *)scr_addr) + rows * scr_width * 2, scr_width * scr_height * 2 - rows * scr_width * 2);
159
        for(i=0;i<rows*scr_width;i++)
159
        for(i = 0; i < rows * scr_width ; i ++)
160
            (((short *)scr_addr)+scr_width*scr_height-rows*scr_width)[i]=((style<<8)+' ');
160
            (((short *)scr_addr) + scr_width * scr_height - rows * scr_width) [i] = ((style << 8) + ' ');
161
    } else if (rows < 0) {
161
    } else if (rows < 0) {
162
 
162
 
163
        memcpy(((char *)scr_addr)-rows*scr_width*2,scr_addr,scr_width*scr_height*2+rows*scr_width*2);
163
        memcpy(((char *)scr_addr) - rows * scr_width * 2 ,scr_addr ,scr_width * scr_height * 2 + rows * scr_width * 2);
164
        for(i=0;i<-rows*scr_width;i++)
164
        for( i = 0; i < - rows * scr_width ; i++)
165
            ((short *)scr_addr)[i]=((style<<8)+' ');
165
            ((short *)scr_addr) [i] = ((style << 8 ) + ' ');
166
    }
166
    }
167
}
167
}
168
 
168
 
169
static void printchar(char c, unsigned int row, unsigned int col)
169
static void printchar(char c, unsigned int row, unsigned int col)
170
{
170
{
171
    scr_addr[(row*scr_width + col)*2] = c;
171
    scr_addr[(row*scr_width + col)*2] = c;
172
    scr_addr[(row*scr_width + col)*2+1] = style;
172
    scr_addr[(row*scr_width + col)*2+1] = style;
173
   
173
   
174
    cursor_goto(row,col+1);
174
    cursor_goto(row,col+1);
175
}
175
}
176
 
176
 
177
static void draw_text_data(keyfield_t *data)
177
static void draw_text_data(keyfield_t *data)
178
{
178
{
179
    int i;
179
    int i;
180
 
180
 
181
    for (i=0; i < scr_width*scr_height; i++) {
181
    for (i=0; i < scr_width*scr_height; i++) {
182
        scr_addr[i*2] = data[i].character;
182
        scr_addr[i*2] = data[i].character;
183
        if (data[i].style.fg_color > data[i].style.bg_color)
183
        if (data[i].style.fg_color > data[i].style.bg_color)
184
            scr_addr[i*2+1] = 0x1e;
184
            scr_addr[i*2+1] = 0x1e;
185
        else
185
        else
186
            scr_addr[i*2+1] = 0xe1;
186
            scr_addr[i*2+1] = 0xe1;
187
    }
187
    }
188
}
188
}
189
 
189
 
190
static int save_screen(void)
190
static int save_screen(void)
191
{
191
{
192
    int i;
192
    int i;
193
    short *mem;
193
    short *mem;
194
    for(i=0;(i<MAX_SAVED_SCREENS)&&(saved_screens[i].data);i++);
194
    for( i=0 ;( i < MAX_SAVED_SCREENS ) && (saved_screens[i].data); i++);
195
    if(i==MAX_SAVED_SCREENS) return EINVAL;
195
    if( i == MAX_SAVED_SCREENS)
-
 
196
        return EINVAL;
196
    if(!(saved_screens[i].data=malloc(2*scr_width*scr_height))) return ENOMEM;
197
    if(!(saved_screens[i].data=malloc( 2 * scr_width*scr_height )))
-
 
198
        return ENOMEM;
197
    memcpy(saved_screens[i].data,scr_addr,2*scr_width*scr_height);
199
    memcpy(saved_screens[i].data,scr_addr, 2 * scr_width * scr_height )
-
 
200
        ;
198
    return i;
201
    return i;
199
}
202
}
200
 
203
 
201
static int print_screen(int i)
204
static int print_screen(int i)
202
{
205
{
203
    if(saved_screens[i].data)
206
    if(saved_screens[i].data)
204
            memcpy(scr_addr,saved_screens[i].data,2*scr_width*scr_height);
207
            memcpy(scr_addr,saved_screens[i].data,2*scr_width*scr_height);
205
    else return EINVAL;
208
    else return EINVAL;
206
    return i;
209
    return i;
207
}
210
}
208
 
211
 
209
 
212
 
210
static void ega_client_connection(ipc_callid_t iid, ipc_call_t *icall)
213
static void ega_client_connection(ipc_callid_t iid, ipc_call_t *icall)
211
{
214
{
212
    int retval;
215
    int retval;
213
    ipc_callid_t callid;
216
    ipc_callid_t callid;
214
    ipc_call_t call;
217
    ipc_call_t call;
215
    char c;
218
    char c;
216
    unsigned int row, col;
219
    unsigned int row, col;
217
    int bgcolor,fgcolor;
220
    int bgcolor,fgcolor;
218
    keyfield_t *interbuf = NULL;
221
    keyfield_t *interbuf = NULL;
219
    size_t intersize = 0;
222
    size_t intersize = 0;
220
    int i;
223
    int i;
221
 
224
 
222
    if (client_connected) {
225
    if (client_connected) {
223
        ipc_answer_fast(iid, ELIMIT, 0,0);
226
        ipc_answer_fast(iid, ELIMIT, 0,0);
224
        return;
227
        return;
225
    }
228
    }
226
    client_connected = 1;
229
    client_connected = 1;
227
    ipc_answer_fast(iid, 0, 0, 0); /* Accept connection */
230
    ipc_answer_fast(iid, 0, 0, 0); /* Accept connection */
228
 
231
 
229
    while (1) {
232
    while (1) {
230
        callid = async_get_call(&call);
233
        callid = async_get_call(&call);
231
        switch (IPC_GET_METHOD(call)) {
234
        switch (IPC_GET_METHOD(call)) {
232
        case IPC_M_PHONE_HUNGUP:
235
        case IPC_M_PHONE_HUNGUP:
233
            client_connected = 0;
236
            client_connected = 0;
234
            ipc_answer_fast(callid,0,0,0);
237
            ipc_answer_fast(callid,0,0,0);
235
            return; /* Exit thread */
238
            return; /* Exit thread */
236
        case IPC_M_AS_AREA_SEND:
239
        case IPC_M_AS_AREA_SEND:
237
            /* We accept one area for data interchange */
240
            /* We accept one area for data interchange */
238
            intersize = IPC_GET_ARG2(call);
241
            intersize = IPC_GET_ARG2(call);
239
            if (intersize >= scr_width*scr_height*sizeof(*interbuf)) {
242
            if (intersize >= scr_width*scr_height*sizeof(*interbuf)) {
240
                receive_comm_area(callid,&call,(void **)&interbuf);
243
                receive_comm_area(callid,&call,(void **)&interbuf);
241
                continue;
244
                continue;
242
            }
245
            }
243
            retval = EINVAL;
246
            retval = EINVAL;
244
            break;
247
            break;
245
        case FB_DRAW_TEXT_DATA:
248
        case FB_DRAW_TEXT_DATA:
246
            if (!interbuf) {
249
            if (!interbuf) {
247
                retval = EINVAL;
250
                retval = EINVAL;
248
                break;
251
                break;
249
            }
252
            }
250
            draw_text_data(interbuf);
253
            draw_text_data(interbuf);
251
            retval = 0;
254
            retval = 0;
252
            break;
255
            break;
253
        case FB_GET_CSIZE:
256
        case FB_GET_CSIZE:
254
            ipc_answer_fast(callid, 0, scr_height, scr_width);
257
            ipc_answer_fast(callid, 0, scr_height, scr_width);
255
            continue;
258
            continue;
256
        case FB_CLEAR:
259
        case FB_CLEAR:
257
            clrscr();
260
            clrscr();
258
            retval = 0;
261
            retval = 0;
259
            break;
262
            break;
260
        case FB_PUTCHAR:
263
        case FB_PUTCHAR:
261
            c = IPC_GET_ARG1(call);
264
            c = IPC_GET_ARG1(call);
262
            row = IPC_GET_ARG2(call);
265
            row = IPC_GET_ARG2(call);
263
            col = IPC_GET_ARG3(call);
266
            col = IPC_GET_ARG3(call);
264
            if (col >= scr_width || row >= scr_height) {
267
            if (col >= scr_width || row >= scr_height) {
265
                retval = EINVAL;
268
                retval = EINVAL;
266
                break;
269
                break;
267
            }
270
            }
268
            printchar(c,row,col);
271
            printchar(c,row,col);
269
            retval = 0;
272
            retval = 0;
270
            break;
273
            break;
271
        case FB_CURSOR_GOTO:
274
        case FB_CURSOR_GOTO:
272
            row = IPC_GET_ARG1(call);
275
            row = IPC_GET_ARG1(call);
273
            col = IPC_GET_ARG2(call);
276
            col = IPC_GET_ARG2(call);
274
            if (row >= scr_height || col >= scr_width) {
277
            if (row >= scr_height || col >= scr_width) {
275
                retval = EINVAL;
278
                retval = EINVAL;
276
                break;
279
                break;
277
            }
280
            }
278
            cursor_goto(row,col);
281
            cursor_goto(row,col);
279
            retval = 0;
282
            retval = 0;
280
            break;
283
            break;
281
        case FB_SCROLL:
284
        case FB_SCROLL:
282
            i = IPC_GET_ARG1(call);
285
            i = IPC_GET_ARG1(call);
283
            if (i > scr_height || i < (- (int)scr_height)) {
286
            if (i > scr_height || i < (- (int)scr_height)) {
284
                retval = EINVAL;
287
                retval = EINVAL;
285
                break;
288
                break;
286
            }
289
            }
287
            scroll(i);
290
            scroll(i);
288
            retval = 0;
291
            retval = 0;
289
            break;
292
            break;
290
        case FB_CURSOR_VISIBILITY:
293
        case FB_CURSOR_VISIBILITY:
291
            if(IPC_GET_ARG1(call))
294
            if(IPC_GET_ARG1(call))
292
                cursor_enable();
295
                cursor_enable();
293
            else
296
            else
294
                cursor_disable();
297
                cursor_disable();
295
            retval = 0;
298
            retval = 0;
296
            break;
299
            break;
297
        case FB_SET_STYLE:
300
        case FB_SET_STYLE:
298
            fgcolor = IPC_GET_ARG1(call);
301
            fgcolor = IPC_GET_ARG1(call);
299
            bgcolor = IPC_GET_ARG2(call);
302
            bgcolor = IPC_GET_ARG2(call);
300
            if (fgcolor > bgcolor)
303
            if (fgcolor > bgcolor)
301
                style = 0x1e;
304
                style = 0x1e;
302
            else
305
            else
303
                style = 0xe1;
306
                style = 0xe1;
304
 
307
 
305
        case FB_VP_DRAW_PIXMAP:
308
        case FB_VP_DRAW_PIXMAP:
306
            i = IPC_GET_ARG2(call);
309
            i = IPC_GET_ARG2(call);
307
            retval = print_screen(i);
310
            retval = print_screen(i);
308
            break;
311
            break;
309
        case FB_VP2PIXMAP:
312
        case FB_VP2PIXMAP:
310
            retval = save_screen();
313
            retval = save_screen();
311
            break;
314
            break;
312
        case FB_DROP_PIXMAP:
315
        case FB_DROP_PIXMAP:
313
            i = IPC_GET_ARG1(call);
316
            i = IPC_GET_ARG1(call);
314
            if (i >= MAX_SAVED_SCREENS) {
317
            if (i >= MAX_SAVED_SCREENS) {
315
                retval = EINVAL;
318
                retval = EINVAL;
316
                break;
319
                break;
317
            }
320
            }
318
            if (saved_screens[i].data) {
321
            if (saved_screens[i].data) {
319
                free(saved_screens[i].data);
322
                free(saved_screens[i].data);
320
                saved_screens[i].data = NULL;
323
                saved_screens[i].data = NULL;
321
            }
324
            }
322
            break;
325
            break;
323
 
326
 
324
        default:
327
        default:
325
            retval = ENOENT;
328
            retval = ENOENT;
326
        }
329
        }
327
        ipc_answer_fast(callid,retval,0,0);
330
        ipc_answer_fast(callid,retval,0,0);
328
    }
331
    }
329
}
332
}
330
 
333
 
331
int ega_init(void)
334
int ega_init(void)
332
{
335
{
333
    void *ega_ph_addr;
336
    void *ega_ph_addr;
334
    size_t sz;
337
    size_t sz;
335
 
338
 
336
 
339
 
337
    ega_ph_addr=(void *)sysinfo_value("fb.address.physical");
340
    ega_ph_addr=(void *)sysinfo_value("fb.address.physical");
338
    scr_width=sysinfo_value("fb.width");
341
    scr_width=sysinfo_value("fb.width");
339
    scr_height=sysinfo_value("fb.height");
342
    scr_height=sysinfo_value("fb.height");
340
    iospace_enable(task_get_id(),(void *)EGA_IO_ADDRESS,2);
343
    iospace_enable(task_get_id(),(void *)EGA_IO_ADDRESS,2);
341
 
344
 
342
    sz = scr_width*scr_height*2;
345
    sz = scr_width*scr_height*2;
343
    scr_addr = as_get_mappable_page(sz);
346
    scr_addr = as_get_mappable_page(sz);
344
 
347
 
345
    map_physmem(ega_ph_addr, scr_addr, ALIGN_UP(sz,PAGE_SIZE)>>PAGE_WIDTH,
348
    map_physmem(ega_ph_addr, scr_addr, ALIGN_UP(sz,PAGE_SIZE)>>PAGE_WIDTH,
346
            AS_AREA_READ | AS_AREA_WRITE);
349
            AS_AREA_READ | AS_AREA_WRITE);
347
 
350
 
348
    async_set_client_connection(ega_client_connection);
351
    async_set_client_connection(ega_client_connection);
349
 
352
 
350
    return 0;
353
    return 0;
351
}
354
}
352
 
355
 
353
 
356