|
@@ -95,7 +95,7 @@ static struct ebinfo loaderinfo = {
|
95
|
95
|
* @v context NBI image context
|
96
|
96
|
* @ret True Image is a valid NBI image
|
97
|
97
|
* @ret False Image is not a valid NBI image
|
98
|
|
- * @err EBADIMG Image is not a valid NBI image
|
|
98
|
+ * @err ENOEXEC Image is not a valid NBI image
|
99
|
99
|
*
|
100
|
100
|
* "context" is filled in with a context pointer suitable for passing to
|
101
|
101
|
* nbi_load() and nbi_boot().
|
|
@@ -106,14 +106,14 @@ static int nbi_probe ( physaddr_t start, off_t len, void **context ) {
|
106
|
106
|
|
107
|
107
|
if ( (unsigned)len < sizeof ( imgheader ) ) {
|
108
|
108
|
DBG ( "NBI image too small\n" );
|
109
|
|
- errno = EBADIMG;
|
|
109
|
+ errno = ENOEXEC;
|
110
|
110
|
return 0;
|
111
|
111
|
}
|
112
|
112
|
|
113
|
113
|
copy_from_phys ( &imgheader, start, sizeof ( imgheader ) );
|
114
|
114
|
|
115
|
115
|
if ( imgheader.magic != NBI_MAGIC ) {
|
116
|
|
- errno = EBADIMG;
|
|
116
|
+ errno = ENOEXEC;
|
117
|
117
|
return 0;
|
118
|
118
|
}
|
119
|
119
|
|
|
@@ -168,7 +168,7 @@ static int nbi_load_segment ( physaddr_t dest, off_t imglen,
|
168
|
168
|
* @v process Function to call for each segment
|
169
|
169
|
* @ret True All segments were processed successfully
|
170
|
170
|
* @ret False An error occurred processing a segment
|
171
|
|
- * @err EBADIMG Image is not a valid NBI image
|
|
171
|
+ * @err ENOEXEC Image is not a valid NBI image
|
172
|
172
|
* @err other As returned by the "process" function
|
173
|
173
|
*
|
174
|
174
|
*/
|
|
@@ -200,7 +200,7 @@ static int nbi_process_segments ( physaddr_t start, off_t len,
|
200
|
200
|
if ( sh.length == 0 ) {
|
201
|
201
|
/* Avoid infinite loop? */
|
202
|
202
|
DBG ( "NBI invalid segheader length 0\n" );
|
203
|
|
- errno = EBADIMG;
|
|
203
|
+ errno = ENOEXEC;
|
204
|
204
|
return 0;
|
205
|
205
|
}
|
206
|
206
|
|
|
@@ -240,7 +240,7 @@ static int nbi_process_segments ( physaddr_t start, off_t len,
|
240
|
240
|
sh_off += NBI_LENGTH ( sh.length );
|
241
|
241
|
if ( sh_off >= NBI_HEADER_LENGTH ) {
|
242
|
242
|
DBG ( "NBI header overflow\n" );
|
243
|
|
- errno = EBADIMG;
|
|
243
|
+ errno = ENOEXEC;
|
244
|
244
|
return 0;
|
245
|
245
|
}
|
246
|
246
|
|
|
@@ -249,7 +249,7 @@ static int nbi_process_segments ( physaddr_t start, off_t len,
|
249
|
249
|
if ( offset != len ) {
|
250
|
250
|
DBG ( "NBI length mismatch (file %d, metadata %d)\n",
|
251
|
251
|
len, offset );
|
252
|
|
- errno = EBADIMG;
|
|
252
|
+ errno = ENOEXEC;
|
253
|
253
|
return 0;
|
254
|
254
|
}
|
255
|
255
|
|
|
@@ -264,7 +264,7 @@ static int nbi_process_segments ( physaddr_t start, off_t len,
|
264
|
264
|
* @v context NBI context (as returned by nbi_probe())
|
265
|
265
|
* @ret True Image loaded into memory
|
266
|
266
|
* @ret False Image not loaded into memory
|
267
|
|
- * @err EBADIMG Image is not a valid NBI image
|
|
267
|
+ * @err ENOEXEC Image is not a valid NBI image
|
268
|
268
|
* @err other As returned by nbi_process_segments()
|
269
|
269
|
* @err other As returned by nbi_prepare_segment()
|
270
|
270
|
* @err other As returned by nbi_load_segment()
|
|
@@ -275,7 +275,7 @@ static int nbi_load ( physaddr_t start, off_t len, void *context ) {
|
275
|
275
|
|
276
|
276
|
/* If we don't have enough data give up */
|
277
|
277
|
if ( len < NBI_HEADER_LENGTH ) {
|
278
|
|
- errno = EBADIMG;
|
|
278
|
+ errno = ENOEXEC;
|
279
|
279
|
return 0;
|
280
|
280
|
}
|
281
|
281
|
|
|
@@ -305,7 +305,7 @@ static int nbi_load ( physaddr_t start, off_t len, void *context ) {
|
305
|
305
|
* @v imgheader Image header information
|
306
|
306
|
* @ret Never NBI program booted successfully
|
307
|
307
|
* @ret False NBI program returned
|
308
|
|
- * @err EIMGRET NBI program returned
|
|
308
|
+ * @err ECANCELED NBI program returned
|
309
|
309
|
*
|
310
|
310
|
*/
|
311
|
311
|
static int nbi_boot16 ( struct imgheader *imgheader ) {
|
|
@@ -340,7 +340,7 @@ static int nbi_boot16 ( struct imgheader *imgheader ) {
|
340
|
340
|
CLOBBER ( "eax", "ecx", "edx", "ebp" ) );
|
341
|
341
|
BASEMEM_PARAMETER_DONE ( bootp_data );
|
342
|
342
|
|
343
|
|
- errno = EIMGRET;
|
|
343
|
+ errno = ECANCELED;
|
344
|
344
|
return 0;
|
345
|
345
|
}
|
346
|
346
|
|
|
@@ -350,11 +350,11 @@ static int nbi_boot16 ( struct imgheader *imgheader ) {
|
350
|
350
|
* @v imgheader Image header information
|
351
|
351
|
* @ret False NBI program should not have returned
|
352
|
352
|
* @ret other As returned by NBI program
|
353
|
|
- * @err EIMGRET NBI program should not have returned
|
|
353
|
+ * @err ECANCELED NBI program should not have returned
|
354
|
354
|
*
|
355
|
355
|
* To distinguish between the case of an NBI program returning false,
|
356
|
356
|
* and an NBI program that should not have returned, check errno.
|
357
|
|
- * errno will be set to EIMGRET only if the NBI program should not
|
|
357
|
+ * errno will be set to ECANCELED only if the NBI program should not
|
358
|
358
|
* have returned.
|
359
|
359
|
*
|
360
|
360
|
*/
|
|
@@ -374,7 +374,7 @@ static int nbi_boot32 ( struct imgheader *imgheader ) {
|
374
|
374
|
printf ( "Secondary program returned %d\n", rc );
|
375
|
375
|
if ( ! NBI_PROGRAM_RETURNS ( imgheader->flags ) ) {
|
376
|
376
|
/* We shouldn't have returned */
|
377
|
|
- errno = EIMGRET;
|
|
377
|
+ errno = ECANCELED;
|
378
|
378
|
rc = 0;
|
379
|
379
|
}
|
380
|
380
|
|
|
@@ -388,7 +388,7 @@ static int nbi_boot32 ( struct imgheader *imgheader ) {
|
388
|
388
|
* @ret Never NBI program booted successfully
|
389
|
389
|
* @ret False NBI program should not have returned
|
390
|
390
|
* @ret other As returned by NBI program
|
391
|
|
- * @err EIMGRET NBI program should not have returned
|
|
391
|
+ * @err ECANCELED NBI program should not have returned
|
392
|
392
|
*
|
393
|
393
|
* See also nbi_boot16() and nbi_boot32().
|
394
|
394
|
*
|