mirror of
https://github.com/ipxe/ipxe
synced 2025-12-15 00:12:19 +03:00
[pxe] Remove userptr_t from PXE API call dispatcher
Simplify the PXE API call dispatcher code by assuming that the PXE parameter block is accessible via a direct pointer dereference. This avoids the need for the API call dispatcher to know the size of the parameter block. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -85,8 +85,6 @@ struct pxe_api_call {
|
|||||||
* @ret exit PXE API call exit code
|
* @ret exit PXE API call exit code
|
||||||
*/
|
*/
|
||||||
PXENV_EXIT_t ( * entry ) ( union u_PXENV_ANY *params );
|
PXENV_EXIT_t ( * entry ) ( union u_PXENV_ANY *params );
|
||||||
/** Length of parameters */
|
|
||||||
uint16_t params_len;
|
|
||||||
/** Opcode */
|
/** Opcode */
|
||||||
uint16_t opcode;
|
uint16_t opcode;
|
||||||
};
|
};
|
||||||
@@ -112,7 +110,6 @@ struct pxe_api_call {
|
|||||||
( union u_PXENV_ANY *params ) ) _entry ) \
|
( union u_PXENV_ANY *params ) ) _entry ) \
|
||||||
: ( ( PXENV_EXIT_t ( * ) \
|
: ( ( PXENV_EXIT_t ( * ) \
|
||||||
( union u_PXENV_ANY *params ) ) _entry ) ), \
|
( union u_PXENV_ANY *params ) ) _entry ) ), \
|
||||||
.params_len = sizeof ( _params_type ), \
|
|
||||||
.opcode = _opcode, \
|
.opcode = _opcode, \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -144,10 +144,10 @@ static struct profiler * pxe_api_profiler ( unsigned int opcode ) {
|
|||||||
*/
|
*/
|
||||||
__asmcall void pxe_api_call ( struct i386_all_regs *ix86 ) {
|
__asmcall void pxe_api_call ( struct i386_all_regs *ix86 ) {
|
||||||
uint16_t opcode = ix86->regs.bx;
|
uint16_t opcode = ix86->regs.bx;
|
||||||
userptr_t uparams = real_to_virt ( ix86->segs.es, ix86->regs.di );
|
|
||||||
struct profiler *profiler = pxe_api_profiler ( opcode );
|
struct profiler *profiler = pxe_api_profiler ( opcode );
|
||||||
|
union u_PXENV_ANY *params =
|
||||||
|
real_to_virt ( ix86->segs.es, ix86->regs.di );
|
||||||
struct pxe_api_call *call;
|
struct pxe_api_call *call;
|
||||||
union u_PXENV_ANY params;
|
|
||||||
PXENV_EXIT_t ret;
|
PXENV_EXIT_t ret;
|
||||||
|
|
||||||
/* Start profiling */
|
/* Start profiling */
|
||||||
@@ -160,17 +160,13 @@ __asmcall void pxe_api_call ( struct i386_all_regs *ix86 ) {
|
|||||||
call = &pxenv_unknown_api;
|
call = &pxenv_unknown_api;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy parameter block from caller */
|
|
||||||
copy_from_user ( ¶ms, uparams, 0, call->params_len );
|
|
||||||
|
|
||||||
/* Set default status in case child routine fails to do so */
|
/* Set default status in case child routine fails to do so */
|
||||||
params.Status = PXENV_STATUS_FAILURE;
|
params->Status = PXENV_STATUS_FAILURE;
|
||||||
|
|
||||||
/* Hand off to relevant API routine */
|
/* Hand off to relevant API routine */
|
||||||
ret = call->entry ( ¶ms );
|
ret = call->entry ( params );
|
||||||
|
|
||||||
/* Copy modified parameter block back to caller and return */
|
/* Return exit code in %ax */
|
||||||
copy_to_user ( uparams, 0, ¶ms, call->params_len );
|
|
||||||
ix86->regs.ax = ret;
|
ix86->regs.ax = ret;
|
||||||
|
|
||||||
/* Stop profiling, if applicable */
|
/* Stop profiling, if applicable */
|
||||||
@@ -195,24 +191,20 @@ int pxe_api_call_weak ( struct i386_all_regs *ix86 ) {
|
|||||||
* @ret ax PXE exit code
|
* @ret ax PXE exit code
|
||||||
*/
|
*/
|
||||||
__asmcall void pxe_loader_call ( struct i386_all_regs *ix86 ) {
|
__asmcall void pxe_loader_call ( struct i386_all_regs *ix86 ) {
|
||||||
userptr_t uparams = real_to_virt ( ix86->segs.es, ix86->regs.di );
|
struct s_UNDI_LOADER *params =
|
||||||
struct s_UNDI_LOADER params;
|
real_to_virt ( ix86->segs.es, ix86->regs.di );
|
||||||
PXENV_EXIT_t ret;
|
PXENV_EXIT_t ret;
|
||||||
|
|
||||||
/* Copy parameter block from caller */
|
|
||||||
copy_from_user ( ¶ms, uparams, 0, sizeof ( params ) );
|
|
||||||
|
|
||||||
/* Fill in ROM segment address */
|
/* Fill in ROM segment address */
|
||||||
ppxe.UNDIROMID.segment = ix86->segs.ds;
|
ppxe.UNDIROMID.segment = ix86->segs.ds;
|
||||||
|
|
||||||
/* Set default status in case child routine fails to do so */
|
/* Set default status in case child routine fails to do so */
|
||||||
params.Status = PXENV_STATUS_FAILURE;
|
params->Status = PXENV_STATUS_FAILURE;
|
||||||
|
|
||||||
/* Call UNDI loader */
|
/* Call UNDI loader */
|
||||||
ret = undi_loader ( ¶ms );
|
ret = undi_loader ( params );
|
||||||
|
|
||||||
/* Copy modified parameter block back to caller and return */
|
/* Return exit code in %ax */
|
||||||
copy_to_user ( uparams, 0, ¶ms, sizeof ( params ) );
|
|
||||||
ix86->regs.ax = ret;
|
ix86->regs.ax = ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user