Ver código fonte

[segment] Add "Requested memory not available" error message

prep_segment() can sometimes fail because an image requests memory
that is already in use by gPXE.  This will happen if
e.g. undionly.kpxe is used to boot memtest86; the memtest86 image is
an old-format kernel that needs to be loaded at 9000:0000, but this
area of memory may well already be in use by the underlying PXE stack.

Add a human-friendly error message, so that the cause is more
immediately visible.
tags/v0.9.8
Michael Brown 15 anos atrás
pai
commit
f7d2168c8e
2 arquivos alterados com 12 adições e 0 exclusões
  1. 1
    0
      src/hci/strerror.c
  2. 11
    0
      src/image/segment.c

+ 1
- 0
src/hci/strerror.c Ver arquivo

@@ -115,5 +115,6 @@ struct errortab common_errors[] __errortab = {
115 115
 	{ ENOSPC, "No space left on device" },
116 116
 	{ ENOTSUP, "Not supported" },
117 117
 	{ EPERM, "Operation not permitted" },
118
+	{ ERANGE, "Out of range" },
118 119
 	{ ETIMEDOUT, "Connection timed out" },
119 120
 };

+ 11
- 0
src/image/segment.c Ver arquivo

@@ -26,6 +26,7 @@
26 26
 #include <errno.h>
27 27
 #include <gpxe/uaccess.h>
28 28
 #include <gpxe/memmap.h>
29
+#include <gpxe/errortab.h>
29 30
 #include <gpxe/segment.h>
30 31
 
31 32
 /**
@@ -72,3 +73,13 @@ int prep_segment ( userptr_t segment, size_t filesz, size_t memsz ) {
72 73
 	      start, mid, end );
73 74
 	return -ERANGE;
74 75
 }
76
+
77
+/**
78
+ * Segment-specific error messages
79
+ *
80
+ * This error happens sufficiently often to merit a user-friendly
81
+ * description.
82
+ */
83
+struct errortab segment_errors[] __errortab = {
84
+	{ ERANGE, "Requested memory not available" },
85
+};

Carregando…
Cancelar
Salvar