diff options
author | Michael Brown <mcb30@etherboot.org> | 2006-05-19 15:06:51 +0000 |
---|---|---|
committer | Michael Brown <mcb30@etherboot.org> | 2006-05-19 15:06:51 +0000 |
commit | d48d0fb1bb53262bf44a03dbe8388529f1566a1c (patch) | |
tree | 31081f33dbeb48c42d2e4cf806570853162781d9 /src/net/tcp/iscsi.c | |
parent | 0ab92faedbe423fa9b93f01b6d1971f28b0b3139 (diff) | |
download | ipxe-d48d0fb1bb53262bf44a03dbe8388529f1566a1c.tar.gz |
Add the concept of a "user pointer" (similar to the void __user * in
the kernel), which encapsulates the information needed to refer to an
external buffer. Under normal operation, this can just be a void *
equivalent, but under -DKEEP_IT_REAL it would be a segoff_t equivalent.
Use this concept to avoid the need for bounce buffers in int13.c,
which reduces memory usage and opens up the possibility of using
multi-sector reads.
Extend the block-device API and the SCSI block device implementation
to support multi-sector reads.
Update iscsi.c to use user buffers.
Move the obsolete portions of realmode.h to old_realmode.h.
MS-DOS now boots an order of magnitude faster over iSCSI (~10 seconds
from power-up to C:> prompt in bochs).
Diffstat (limited to 'src/net/tcp/iscsi.c')
-rw-r--r-- | src/net/tcp/iscsi.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/net/tcp/iscsi.c b/src/net/tcp/iscsi.c index 633c895c..d7c4b120 100644 --- a/src/net/tcp/iscsi.c +++ b/src/net/tcp/iscsi.c @@ -24,6 +24,7 @@ #include <byteswap.h> #include <gpxe/scsi.h> #include <gpxe/process.h> +#include <gpxe/uaccess.h> #include <gpxe/iscsi.h> /** @file @@ -130,7 +131,7 @@ static void iscsi_rx_data_in ( struct iscsi_session *iscsi, void *data, assert ( iscsi->command != NULL ); assert ( iscsi->command->data_in != NULL ); assert ( ( offset + len ) <= iscsi->command->data_in_len ); - memcpy ( ( iscsi->command->data_in + offset ), data, len ); + copy_to_user ( iscsi->command->data_in, offset, data, len ); /* Record SCSI status, if present */ if ( data_in->flags & ISCSI_DATA_FLAG_STATUS ) @@ -234,7 +235,11 @@ static void iscsi_tx_data_out ( struct iscsi_session *iscsi ) { assert ( iscsi->command->data_out != NULL ); assert ( ( offset + len ) <= iscsi->command->data_out_len ); - tcp_send ( &iscsi->tcp, iscsi->command->data_out + offset, len ); + if ( len > tcp_buflen ) + len = tcp_buflen; + copy_from_user ( tcp_buffer, iscsi->command->data_out, offset, len ); + + tcp_send ( &iscsi->tcp, tcp_buffer, len ); } /**************************************************************************** |