wok diff syslinux/stuff/iso2exe/bootlinux.c @ rev 13733
Add xdigger
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Dec 25 16:40:45 2012 +0100 (2012-12-25) |
parents | 58b695f73790 |
children | 65b3fd0022ed |
line diff
1.1 --- a/syslinux/stuff/iso2exe/bootlinux.c Sat Dec 15 13:43:51 2012 +0100 1.2 +++ b/syslinux/stuff/iso2exe/bootlinux.c Tue Dec 25 16:40:45 2012 +0100 1.3 @@ -22,7 +22,9 @@ 1.4 #define SETUP_SEGMENT 0x9000 1.5 #define CMDLINE_OFFSET 0x9E00 1.6 1.7 -#define BUFFERSZ 2*1024 1.8 +#define PAGE_BITS 12 1.9 +#define PAGE_SIZE 4096 1.10 +#define BUFFERSZ PAGE_SIZE 1.11 static char buffer[BUFFERSZ]; 1.12 static unsigned long initrd_addr, initrd_size; 1.13 1.14 @@ -88,6 +90,8 @@ 1.15 #endasm 1.16 } 1.17 1.18 +#undef ZIMAGE_SUPPORT /* Does not work... */ 1.19 + 1.20 static int versiondos; 1.21 static int dosversion(void) 1.22 { 1.23 @@ -111,7 +115,7 @@ 1.24 printf("DOS %d not supported.\nTrying anyway...\n", 1.25 versiondos); 1.26 } 1.27 - p->align = 4096; 1.28 + p->align = PAGE_SIZE; 1.29 break; 1.30 case 4096: // first initrd 1.31 initrd_addr = p->base; 1.32 @@ -169,8 +173,35 @@ 1.33 #define HDRS 0x53726448 1.34 if (* (unsigned long *) (buffer + HEADER) != HDRS) 1.35 version = 0; 1.36 + if (version < 0x204) 1.37 + syssize &= 0x000FFFFFUL; 1.38 + if (version) { 1.39 +#ifdef REALMODE_SWITCH 1.40 + extern int far_realmode_switch(); 1.41 +#asm 1.42 + jmp end_realmode_switch 1.43 +_far_realmode_switch: 1.44 + call _realmode_switch 1.45 + cli 1.46 + mov al, #0x80 // Disable NMI 1.47 + out 0x70, al 1.48 + retf 1.49 +end_realmode_switch: 1.50 +#endasm 1.51 + * (unsigned short *) (buffer + RMSWOFS) = 1.52 + far_realmode_switch; 1.53 + * (unsigned short *) (buffer + RMSWSEG) = 1.54 + getcs(); 1.55 +#endif 1.56 + kernelmem.base = 1.57 + * (unsigned long *) (buffer + SYSTEMCODE); 1.58 + * (unsigned short *) (buffer + HEAPPTR) = 1.59 + 0x9B00; 1.60 + // buffer[LOADFLAGS] |= 0x80; 1.61 + * (unsigned short *) (buffer + LOADERTYPE) |= 1.62 + 0x80FF; 1.63 + } 1.64 if (!version || !(buffer[LOADFLAGS] & 1)) { 1.65 -#undef ZIMAGE_SUPPORT /* Does not work... */ 1.66 #ifdef ZIMAGE_SUPPORT 1.67 #asm 1.68 pusha 1.69 @@ -199,21 +230,6 @@ 1.70 #endif 1.71 die("Not a bzImage format"); 1.72 } 1.73 - if (version < 0x204) 1.74 - syssize &= 0x000FFFFFUL; 1.75 - if (version) { 1.76 -#ifdef REALMODE_SWITCH 1.77 - * (unsigned short *) (buffer + RMSWOFS) = 1.78 - realmode_switch; 1.79 - * (unsigned short *) (buffer + RMSWSEG) = 1.80 - getcs(); 1.81 -#endif 1.82 - * (unsigned short *) (buffer + HEAPPTR) = 1.83 - 0x9B00; 1.84 - // buffer[LOADFLAGS] |= 0x80; 1.85 - * (unsigned short *) (buffer + LOADERTYPE) |= 1.86 - 0x80FF; 1.87 - } 1.88 } 1.89 movesetup(); 1.90 setup -= n;