Browse Source

Added .nbi as a format.

tags/v0.9.3
Michael Brown 17 years ago
parent
commit
37127ea90c
2 changed files with 69 additions and 0 deletions
  1. 4
    0
      src/arch/i386/Makefile
  2. 65
    0
      src/arch/i386/prefix/nbiprefix.S

+ 4
- 0
src/arch/i386/Makefile View File

80
 OBJS_dskprefix		= dskprefix zdskprefix
80
 OBJS_dskprefix		= dskprefix zdskprefix
81
 CFLAGS_zdskprefix	= $(CFLAGS_ZPREFIX)
81
 CFLAGS_zdskprefix	= $(CFLAGS_ZPREFIX)
82
 
82
 
83
+MEDIA			+= nbi
84
+OBJS_nbiprefix		= nbiprefix znbiprefix
85
+CFLAGS_znbiprefix	= $(CFLAGS_ZPREFIX)
86
+
83
 MEDIA			+= hd
87
 MEDIA			+= hd
84
 OBJS_hdprefix		= hdprefix zhdprefix
88
 OBJS_hdprefix		= hdprefix zhdprefix
85
 CFLAGS_zhdprefix	= $(CFLAGS_ZPREFIX)
89
 CFLAGS_zhdprefix	= $(CFLAGS_ZPREFIX)

+ 65
- 0
src/arch/i386/prefix/nbiprefix.S View File

1
+	.text
2
+	.arch i386
3
+	.section ".prefix", "ax", @progbits
4
+	.section ".prefix.data", "aw", @progbits
5
+	.code16
6
+	.section ".prefix"
7
+	.org 0
8
+
9
+nbi_header:
10
+	
11
+/*****************************************************************************
12
+ * NBI file header
13
+ *****************************************************************************
14
+ */
15
+file_header:
16
+	.long	0x1b031336	/* Signature */
17
+	.byte	0x04		/* 16 bytes header, no vendor info */
18
+	.byte	0
19
+	.byte	0
20
+	.byte	0		/* No flags */
21
+	.word	0x0000, 0x07c0	/* Load header to 0x07c0:0x0000 */
22
+	.word	entry, 0x07c0	/* Start execution at 0x07c0:entry */
23
+	.size	file_header, . - file_header
24
+
25
+/*****************************************************************************
26
+ * NBI segment header
27
+ *****************************************************************************
28
+ */
29
+segment_header:
30
+	.byte	0x04		/* 16 bytes header, no vendor info */
31
+	.byte	0
32
+	.byte	0
33
+	.byte	0x04		/* Last segment */
34
+	.long	0x00007e00
35
+	.long	_load_size - 512
36
+	.long	_load_size - 512
37
+	.size	segment_header, . - segment_header
38
+
39
+/*****************************************************************************
40
+ * NBI entry point
41
+ *****************************************************************************
42
+ */
43
+entry:
44
+	/* Install low and high memory regions */
45
+	call	install
46
+
47
+	/* Jump to .text16 segment */
48
+	pushw	%ax
49
+	pushw	$1f
50
+	lret
51
+	.section ".text16", "awx", @progbits
52
+1:
53
+	pushl	$main
54
+	pushw	%cs
55
+	call	prot_call
56
+	popl	%eax /* discard */
57
+
58
+	/* Reboot system */
59
+	int $0x19
60
+
61
+	.previous
62
+	.size	entry, . - entry
63
+
64
+nbi_header_end:
65
+	.org 512

Loading…
Cancel
Save