wok view linld/stuff/src/HIMEM.CPP @ rev 19538

linld: add 'linld <kernel> <cmdline>' syntax
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Dec 02 12:37:59 2016 +0100 (2016-12-02)
parents bb42796dcd3b
children 31c5cbbd9380
line source
1 // This file is distributed under GPL
2 //
3 // High mem handling routines
4 // C++ part of VCPI madness is here
6 #include "crtl.h"
7 #include "common.h"
9 int skip_xmmalloc;
10 void load_image(struct image_himem *m) {
11 no_exit++; // die() won't return to DOS
12 m->remaining = m->size;
13 u32 buf= m->buf = m->fallback;
14 u32* bufv= &buf;
15 if(m->fallback >= _1m) {
16 if(vcpi) {
17 bufv = malloc_bufv_or_die(m);
18 }
19 else if (!skip_xmmalloc) {
20 xmm_alloc(m);
21 }
22 }
23 do {
24 u8 xfer_buf[PAGE_SIZE];
25 u16 size = read_image(m, xfer_buf, PAGE_SIZE);
26 if(s16(size) <= 0) break;
27 memcpy32(*bufv, seg(xfer_buf), ofs(xfer_buf), size);
28 if (bufv != &buf) bufv++;
29 buf += size;
30 } while (*bufv);
31 if(m->remaining) die("Read error");
32 close(m->fd2close);
33 }