瀏覽代碼

Code used for load buffer and multiboot image testing

tags/v0.9.3
Michael Brown 19 年之前
父節點
當前提交
112d7f9d79
共有 1 個檔案被更改,包括 10 行新增2 行删除
  1. 10
    2
      src/tests/tftptest.c

+ 10
- 2
src/tests/tftptest.c 查看文件

19
 	uint16_t fbms;
19
 	uint16_t fbms;
20
 	int rc;
20
 	int rc;
21
 
21
 
22
+
23
+	ebuffer_alloc ( &buffer, 0 );
24
+#if 0
22
 	memset ( &buffer, 0, sizeof ( buffer ) );
25
 	memset ( &buffer, 0, sizeof ( buffer ) );
23
 	buffer.addr = real_to_user ( 0, 0x7c00 );
26
 	buffer.addr = real_to_user ( 0, 0x7c00 );
24
 	get_real ( fbms, BDA_SEG, BDA_FBMS );
27
 	get_real ( fbms, BDA_SEG, BDA_FBMS );
25
 	buffer.len = ( fbms * 1024 - 0x7c00 );
28
 	buffer.len = ( fbms * 1024 - 0x7c00 );
29
+#endif
26
 
30
 
27
 	memset ( &tftp, 0, sizeof ( tftp ) );
31
 	memset ( &tftp, 0, sizeof ( tftp ) );
28
 	udp_connect ( &tftp.udp, target );
32
 	udp_connect ( &tftp.udp, target );
33
 	if ( ( rc = async_wait ( tftp_get ( &tftp ) ) ) != 0 )
37
 	if ( ( rc = async_wait ( tftp_get ( &tftp ) ) ) != 0 )
34
 		return rc;
38
 		return rc;
35
 
39
 
40
+	memset ( &image, 0, sizeof ( image ) );
36
 	image.data = buffer.addr;
41
 	image.data = buffer.addr;
37
 	image.len = buffer.len;
42
 	image.len = buffer.len;
38
-	if ( ( rc = elf_load ( &image ) ) == 0 ) {
39
-		printf ( "Got valid ELF image: execaddr at %lx\n",
43
+	if ( ( rc = multiboot_load ( &image ) ) == 0 ) {
44
+		printf ( "Got valid multiboot image: execaddr at %lx\n",
40
 			 image.entry );
45
 			 image.entry );
46
+
47
+		image_exec ( &image );
48
+
41
 		return 0;
49
 		return 0;
42
 	}
50
 	}
43
 
51
 

Loading…
取消
儲存