Despite my best efforts the Linux way of doing this is the only

way that works correctly.

- Remove unused function.
- Move declaration of variables to .S file.
This commit is contained in:
Matthew N. Dodd 2003-06-13 00:36:03 +00:00
parent 3dfdc427f1
commit cba6ce369d
2 changed files with 20 additions and 38 deletions

View File

@ -67,9 +67,8 @@ struct smapi_softc {
struct smapi_bios_header *header;
};
u_long smapi32_offset;
u_short smapi32_segment;
#define SMAPI32_SEGMENT 0x18
extern u_long smapi32_offset;
extern u_short smapi32_segment;
devclass_t smapi_devclass;
@ -123,14 +122,8 @@ smapi_ioctl (dev, cmd, data, fflag, td)
error = 0;
break;
case SMAPIOCGFUNCTION:
#if 1
smapi32_segment = SMAPI32_SEGMENT;
smapi32_offset = sc->smapi32_entry;
error = smapi32(
#else
error = smapi32_new(sc->smapi32_entry, SMAPI32_SEGMENT,
#endif
(struct smapi_bios_parameter *)data,
error = smapi32((struct smapi_bios_parameter *)data,
(struct smapi_bios_parameter *)data);
break;
default:

View File

@ -3,11 +3,28 @@ __FBSDID("$FreeBSD$");
#include <machine/asmacros.h>
/*
* This is cribbed from the Linux thinkpad-4.1 driver by
* Thomas Hood.
*/
.align
smapi32_entry: /* far pointer to SMAPI entry */
.globl smapi32_offset
smapi32_offset: .long 0x00000000 /* set by caller */
smapi32_segment: .word 0x0000 /* %cs stored here */
.text
/*
* smapi32(input_param, output_param)
* struct smapi_bios_parameter *input_parm;
* struct smapi_bios_parameter *output_parm;
*
* stack frame:
* 0x00 : saved ebp
* 0x04 : return EIP
* 0x08 : input_parm
* 0x0c : output_parm
*/
ENTRY(smapi32)
pushl %ebp /* Save frame */
@ -24,31 +41,3 @@ ENTRY(smapi32)
leave
ret
/*
* smapi32(offset, segment, input_param, output_param)
* u_int offset;
* u_short segment;
* struct smapi_bios_parameter *input_parm;
* struct smapi_bios_parameter *output_parm;
*/
ENTRY(smapi32_new)
pushl %ebp /* Save frame */
movl %esp,%ebp
movl 0x08(%ebp),%eax
movl %eax,smapi32_offset
movw 0x0c(%ebp),%ax
movw %ax,smapi32_segment
pushl %ds
pushl 0x20(%ebp) /* Output Param */
pushl %ds
pushl 0x10(%ebp) /* Input Param */
movl $0,%eax
movw %cs,smapi32_segment
lcall *(smapi32_offset)
leave
ret