[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tyndur-devel] [PATCH 2/2] kernel2: vm86: in/out-Instruktionen mit Immediate-Port



On Wed, Dec 23, 2015 at 08:23:28PM +0100, Kevin Wolf wrote:
> + kernel2: Der Instruktionsemulator unterstützt jetzt auch die
>   in/out-Varianten, die die Portnummer als Immediatewert statt in dx
>   bekommen.
> 
> Signed-off-by: Kevin Wolf <kevin@xxxxxxxxxx>
> ---
>  src/kernel2/src/arch/i386/vm86.c | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
> 
> diff --git a/src/kernel2/src/arch/i386/vm86.c b/src/kernel2/src/arch/i386/vm86.c
> index 566f2af..eb81476 100644
> --- a/src/kernel2/src/arch/i386/vm86.c
> +++ b/src/kernel2/src/arch/i386/vm86.c
> @@ -375,6 +375,38 @@ int vm86_exception(interrupt_stack_frame_t* isf)
>              isf->eip = emulator_pop(isf);
>              break;
>  
> +        case 0xe4: /* in al, imm8 */
> +            isf->eax &= ~0xFF;
> +            isf->eax |= inb(ops[1]);
> +            isf->eip += 2;
> +            break;
> +
> +        case 0xe5: /* in ax, imm8 */
> +            isf->eax &= ~0xFFFF;
> +            isf->eax |= inw(ops[1]);
> +            isf->eip += 2;
> +            break;
> +
> +        case 0x66e5: /* in eax, imm8 */
> +            isf->eax = inl(ops[1]);

Das muss selbstverständlich ops[2] sein, den Präfix muss man ja
mitrechnen.

> +            isf->eip += 3;
> +            break;
> +
> +        case 0xe6: /* out imm8, al */
> +            outb(ops[1], isf->eax);
> +            isf->eip += 2;
> +            break;
> +
> +        case 0xe7: /* out imm8, ax */
> +            outw(ops[1], isf->eax);
> +            isf->eip += 2;
> +            break;
> +
> +        case 0x66e7: /* outl imm8, eax */
> +            outl(ops[1], isf->eax);

Und hier auch.

> +            isf->eip += 3;
> +            break;
> +
>          case 0xec: /* inb al, dx */
>              isf->eax &= ~0xFF;
>              isf->eax |= inb(isf->edx);

Kevin