ceda00de8c4587f39f4f28df697a7f3a33f4d42d
[rrq/maintain_lilo.git] / src / pseudo.S
1 ; pseudo.S -- produce a pseudo kernel header
2 ;
3 ;       This file is useful for booting arbitrary binary images
4 ;       at      0x1000:0000
5 ;
6 ; Copyright 2002-2005 John Coffman.
7 ; All rights reserved.
8
9 ; Licensed under the terms contained in the file 'COPYING' in the 
10 ; source directory.
11 ;
12
13 #define DEBUG 0
14 #define DELL_DIRTY_HACK
15
16
17 SYSSEG  =  0x1000       ; DEF_SYSSEG
18 SETUPSEG = 0x9020       ; DEF_SETUPSEG
19
20 CL_MAGIC_ADDR   = 0x20                  ! command line magic number
21 CL_MAGIC        = 0xa33f                ! very unusual command sequence
22 CL_OFFSET       = 0x22                  ! command line offset
23 CL_LENGTH       = 256                   ! maximum length
24
25                 .text
26 #if 0
27 .globl  _main
28 _main:
29 #endif
30                 .globl  zero
31 zero:
32
33 ; we want this to look like a bootable kernel image
34 ; so we include the following header
35 ;
36                 jmp     begin
37                 .ascii  "HdrS"          ; looks like a real kernel
38                 .word   0x0200          ; header format version number
39                 .word   0,0             ; realmode switch, SETUPSEG
40                 .word   SYSSEG          ; SYSSEG -- load at 1000:0000
41                 .word   id_string
42                 .byte   0               ; type of loader
43                 .byte   0               ; flags 0=load low
44                 .word   2*512           ; move size: 2 sectors
45                 dd      0x10000         ; load us here
46                 dd      0               ; ramdisk image
47                 dd      0               ; ramdisk size
48                 .word   bs_helper,SETUPSEG      ; kludge???
49 ;;              .word   modelist+1024   ; heap end pointer
50 ;----------end of header------------
51                 
52 begin:
53         xor     di,di
54         cmp     word ptr [CL_MAGIC_ADDR],#CL_MAGIC
55         jne     gotoit
56         mov     di,[CL_OFFSET]
57 gotoit:
58         jmpi    0000,SYSSEG                     ; jmp to 0x1000:0000
59
60
61 bs_helper:      int     0x19                    ;label here for kludge
62
63
64 id_string:      .ascii  "pseudo.b"
65                 .byte   0
66
67                 .blkb   zero+512-*
68
69 modelist:
70
71 theend: