|
@@ -232,6 +232,42 @@ static PXENV_EXIT_t pxenv_file_exec ( struct s_PXENV_FILE_EXEC *file_exec ) {
|
232
|
232
|
return PXENV_EXIT_SUCCESS;
|
233
|
233
|
}
|
234
|
234
|
|
|
235
|
+/**
|
|
236
|
+ * FILE CMDLINE
|
|
237
|
+ *
|
|
238
|
+ * @v file_cmdline Pointer to a struct s_PXENV_FILE_CMDLINE
|
|
239
|
+ * @v s_PXENV_FILE_CMDLINE::Buffer Buffer to contain command line
|
|
240
|
+ * @v s_PXENV_FILE_CMDLINE::BufferSize Size of buffer
|
|
241
|
+ * @ret #PXENV_EXIT_SUCCESS Command was executed successfully
|
|
242
|
+ * @ret #PXENV_EXIT_FAILURE Command was not executed successfully
|
|
243
|
+ * @ret s_PXENV_FILE_EXEC::Status PXE status code
|
|
244
|
+ * @ret s_PXENV_FILE_EXEC::BufferSize Length of command line (including NUL)
|
|
245
|
+ *
|
|
246
|
+ */
|
|
247
|
+static PXENV_EXIT_t
|
|
248
|
+pxenv_file_cmdline ( struct s_PXENV_FILE_CMDLINE *file_cmdline ) {
|
|
249
|
+ userptr_t buffer;
|
|
250
|
+ size_t max_len;
|
|
251
|
+ size_t len;
|
|
252
|
+
|
|
253
|
+ DBG ( "PXENV_FILE_CMDLINE to %04x:%04x+%04x \"%s\"\n",
|
|
254
|
+ file_cmdline->Buffer.segment, file_cmdline->Buffer.offset,
|
|
255
|
+ file_cmdline->BufferSize, pxe_cmdline );
|
|
256
|
+
|
|
257
|
+ buffer = real_to_user ( file_cmdline->Buffer.segment,
|
|
258
|
+ file_cmdline->Buffer.offset );
|
|
259
|
+ len = file_cmdline->BufferSize;
|
|
260
|
+ max_len = ( pxe_cmdline ?
|
|
261
|
+ ( strlen ( pxe_cmdline ) + 1 /* NUL */ ) : 0 );
|
|
262
|
+ if ( len > max_len )
|
|
263
|
+ len = max_len;
|
|
264
|
+ copy_to_user ( buffer, 0, pxe_cmdline, len );
|
|
265
|
+ file_cmdline->BufferSize = max_len;
|
|
266
|
+
|
|
267
|
+ file_cmdline->Status = PXENV_STATUS_SUCCESS;
|
|
268
|
+ return PXENV_EXIT_SUCCESS;
|
|
269
|
+}
|
|
270
|
+
|
235
|
271
|
/**
|
236
|
272
|
* FILE API CHECK
|
237
|
273
|
*
|
|
@@ -298,6 +334,8 @@ struct pxe_api_call pxe_file_api[] __pxe_api_call = {
|
298
|
334
|
struct s_PXENV_GET_FILE_SIZE ),
|
299
|
335
|
PXE_API_CALL ( PXENV_FILE_EXEC, pxenv_file_exec,
|
300
|
336
|
struct s_PXENV_FILE_EXEC ),
|
|
337
|
+ PXE_API_CALL ( PXENV_FILE_CMDLINE, pxenv_file_cmdline,
|
|
338
|
+ struct s_PXENV_FILE_CMDLINE ),
|
301
|
339
|
PXE_API_CALL ( PXENV_FILE_API_CHECK, pxenv_file_api_check,
|
302
|
340
|
struct s_PXENV_FILE_API_CHECK ),
|
303
|
341
|
};
|