text stringlengths 1 1.05M |
|---|
_read_clock:
;RTC.c,9 :: struct real_time_clock read_clock (){
MOVF R0, 0
MOVWF _read_clock_su_addr+0
MOVF R1, 0
MOVWF _read_clock_su_addr+1
;RTC.c,13 :: I2C1_Start();
CALL _I2C1_Start+0, 0
;RTC.c,14 :: I2C1_Wr(0xD0);
MOVLW 208
MOVWF FARG_I2C1_Wr_data_+0
CALL _I2C1_Wr+0, 0
;RTC.c,15 :: I2C1_Wr(0);
CLRF FARG_I2C1_Wr_data_+0
CALL _I2C1_Wr+0, 0
;RTC.c,16 :: I2C1_Repeated_Start();
CALL _I2C1_Repeated_Start+0, 0
;RTC.c,17 :: I2C1_Wr(0xD1);
MOVLW 209
MOVWF FARG_I2C1_Wr_data_+0
CALL _I2C1_Wr+0, 0
;RTC.c,18 :: read_date.seconds = I2C1_Rd(1);
MOVLW 1
MOVWF FARG_I2C1_Rd_ack+0
CALL _I2C1_Rd+0, 0
MOVF R0, 0
MOVWF read_clock_read_date_L0+0
;RTC.c,19 :: read_date.minutes = I2C1_Rd(1);
MOVLW 1
MOVWF FARG_I2C1_Rd_ack+0
CALL _I2C1_Rd+0, 0
MOVF R0, 0
MOVWF read_clock_read_date_L0+2
;RTC.c,20 :: read_date.hours = I2C1_Rd(1);
MOVLW 1
MOVWF FARG_I2C1_Rd_ack+0
CALL _I2C1_Rd+0, 0
MOVF R0, 0
MOVWF read_clock_read_date_L0+4
;RTC.c,21 :: read_date.weekday = I2C1_Rd(1);
MOVLW 1
MOVWF FARG_I2C1_Rd_ack+0
CALL _I2C1_Rd+0, 0
MOVF R0, 0
MOVWF read_clock_read_date_L0+6
;RTC.c,22 :: read_date.days = I2C1_Rd(1);
MOVLW 1
MOVWF FARG_I2C1_Rd_ack+0
CALL _I2C1_Rd+0, 0
MOVF R0, 0
MOVWF read_clock_read_date_L0+8
;RTC.c,23 :: read_date.month = I2C1_Rd(1);
MOVLW 1
MOVWF FARG_I2C1_Rd_ack+0
CALL _I2C1_Rd+0, 0
MOVF R0, 0
MOVWF read_clock_read_date_L0+10
;RTC.c,24 :: read_date.years = I2C1_Rd(0);
CLRF FARG_I2C1_Rd_ack+0
CALL _I2C1_Rd+0, 0
MOVF R0, 0
MOVWF read_clock_read_date_L0+12
;RTC.c,25 :: I2C1_Stop();
CALL _I2C1_Stop+0, 0
;RTC.c,27 :: return read_date;
MOVLW 14
MOVWF R0
MOVF _read_clock_su_addr+0, 0
MOVWF FSR1
MOVF _read_clock_su_addr+1, 0
MOVWF FSR1H
MOVLW read_clock_read_date_L0+0
MOVWF FSR0
MOVLW hi_addr(read_clock_read_date_L0+0)
MOVWF FSR0H
L_read_clock0:
MOVF POSTINC0+0, 0
MOVWF POSTINC1+0
DECF R0, 1
BTFSS STATUS+0, 2
GOTO L_read_clock0
;RTC.c,28 :: }
L_end_read_clock:
RETURN 0
; end of _read_clock
_write_date_lcd:
;RTC.c,30 :: void write_date_lcd(struct real_time_clock read_date){
;RTC.c,33 :: LCD_I2C_Chr(1,6,((read_date.hours & 0xf0) >> 4) + 0x30);
MOVLW 1
MOVWF FARG_Lcd_I2C_Chr_row+0
MOVLW 6
MOVWF FARG_Lcd_I2C_Chr_column+0
MOVLW 240
ANDWF FARG_write_date_lcd_read_date+4, 0
MOVWF FARG_Lcd_I2C_Chr_out_char+0
RRCF FARG_Lcd_I2C_Chr_out_char+0, 1
BCF FARG_Lcd_I2C_Chr_out_char+0, 7
RRCF FARG_Lcd_I2C_Chr_out_char+0, 1
BCF FARG_Lcd_I2C_Chr_out_char+0, 7
RRCF FARG_Lcd_I2C_Chr_out_char+0, 1
BCF FARG_Lcd_I2C_Chr_out_char+0, 7
RRCF FARG_Lcd_I2C_Chr_out_char+0, 1
BCF FARG_Lcd_I2C_Chr_out_char+0, 7
MOVLW 48
ADDWF FARG_Lcd_I2C_Chr_out_char+0, 1
CALL _Lcd_I2C_Chr+0, 0
;RTC.c,34 :: LCD_I2C_Chr_cp ((read_date.hours & 0x0f) + 0x30);
MOVLW 15
ANDWF FARG_write_date_lcd_read_date+4, 0
MOVWF FARG_Lcd_I2C_Chr_CP_out_char+0
MOVLW 48
ADDWF FARG_Lcd_I2C_Chr_CP_out_char+0, 1
CALL _Lcd_I2C_Chr_CP+0, 0
;RTC.c,35 :: LCD_I2C_Chr_cp (':');
MOVLW 58
MOVWF FARG_Lcd_I2C_Chr_CP_out_char+0
CALL _Lcd_I2C_Chr_CP+0, 0
;RTC.c,36 :: LCD_I2C_Chr_cp (((read_date.minutes & 0xf0) >> 4) + 0x30);
MOVLW 240
ANDWF FARG_write_date_lcd_read_date+2, 0
MOVWF FARG_Lcd_I2C_Chr_CP_out_char+0
RRCF FARG_Lcd_I2C_Chr_CP_out_char+0, 1
BCF FARG_Lcd_I2C_Chr_CP_out_char+0, 7
RRCF FARG_Lcd_I2C_Chr_CP_out_char+0, 1
BCF FARG_Lcd_I2C_Chr_CP_out_char+0, 7
RRCF FARG_Lcd_I2C_Chr_CP_out_char+0, 1
BCF FARG_Lcd_I2C_Chr_CP_out_char+0, 7
RRCF FARG_Lcd_I2C_Chr_CP_out_char+0, 1
BCF FARG_Lcd_I2C_Chr_CP_out_char+0, 7
MOVLW 48
ADDWF FARG_Lcd_I2C_Chr_CP_out_char+0, 1
CALL _Lcd_I2C_Chr_CP+0, 0
;RTC.c,37 :: LCD_I2C_Chr_cp ((read_date.minutes & 0x0f) + 0x30);
MOVLW 15
ANDWF FARG_write_date_lcd_read_date+2, 0
MOVWF FARG_Lcd_I2C_Chr_CP_out_char+0
MOVLW 48
ADDWF FARG_Lcd_I2C_Chr_CP_out_char+0, 1
CALL _Lcd_I2C_Chr_CP+0, 0
;RTC.c,38 :: LCD_I2C_Chr(2,5,((read_date.days & 0xf0) >> 4) + 0x30);
MOVLW 2
MOVWF FARG_Lcd_I2C_Chr_row+0
MOVLW 5
MOVWF FARG_Lcd_I2C_Chr_column+0
MOVLW 240
ANDWF FARG_write_date_lcd_read_date+8, 0
MOVWF FARG_Lcd_I2C_Chr_out_char+0
RRCF FARG_Lcd_I2C_Chr_out_char+0, 1
BCF FARG_Lcd_I2C_Chr_out_char+0, 7
RRCF FARG_Lcd_I2C_Chr_out_char+0, 1
BCF FARG_Lcd_I2C_Chr_out_char+0, 7
RRCF FARG_Lcd_I2C_Chr_out_char+0, 1
BCF FARG_Lcd_I2C_Chr_out_char+0, 7
RRCF FARG_Lcd_I2C_Chr_out_char+0, 1
BCF FARG_Lcd_I2C_Chr_out_char+0, 7
MOVLW 48
ADDWF FARG_Lcd_I2C_Chr_out_char+0, 1
CALL _Lcd_I2C_Chr+0, 0
;RTC.c,39 :: LCD_I2C_Chr_cp ((read_date.days & 0x0f) + 0x30);
MOVLW 15
ANDWF FARG_write_date_lcd_read_date+8, 0
MOVWF FARG_Lcd_I2C_Chr_CP_out_char+0
MOVLW 48
ADDWF FARG_Lcd_I2C_Chr_CP_out_char+0, 1
CALL _Lcd_I2C_Chr_CP+0, 0
;RTC.c,40 :: LCD_I2C_Chr_cp ('/');
MOVLW 47
MOVWF FARG_Lcd_I2C_Chr_CP_out_char+0
CALL _Lcd_I2C_Chr_CP+0, 0
;RTC.c,41 :: LCD_I2C_Chr_cp (((read_date.month & 0xf0) >> 4) + 0x30);
MOVLW 240
ANDWF FARG_write_date_lcd_read_date+10, 0
MOVWF FARG_Lcd_I2C_Chr_CP_out_char+0
RRCF FARG_Lcd_I2C_Chr_CP_out_char+0, 1
BCF FARG_Lcd_I2C_Chr_CP_out_char+0, 7
RRCF FARG_Lcd_I2C_Chr_CP_out_char+0, 1
BCF FARG_Lcd_I2C_Chr_CP_out_char+0, 7
RRCF FARG_Lcd_I2C_Chr_CP_out_char+0, 1
BCF FARG_Lcd_I2C_Chr_CP_out_char+0, 7
RRCF FARG_Lcd_I2C_Chr_CP_out_char+0, 1
BCF FARG_Lcd_I2C_Chr_CP_out_char+0, 7
MOVLW 48
ADDWF FARG_Lcd_I2C_Chr_CP_out_char+0, 1
CALL _Lcd_I2C_Chr_CP+0, 0
;RTC.c,42 :: LCD_I2C_Chr_cp ((read_date.month & 0x0f) + 0x30);
MOVLW 15
ANDWF FARG_write_date_lcd_read_date+10, 0
MOVWF FARG_Lcd_I2C_Chr_CP_out_char+0
MOVLW 48
ADDWF FARG_Lcd_I2C_Chr_CP_out_char+0, 1
CALL _Lcd_I2C_Chr_CP+0, 0
;RTC.c,43 :: LCD_I2C_Chr_cp ('/');
MOVLW 47
MOVWF FARG_Lcd_I2C_Chr_CP_out_char+0
CALL _Lcd_I2C_Chr_CP+0, 0
;RTC.c,44 :: LCD_I2C_Chr_cp (((read_date. years & 0xf0) >> 4) + 0x30);
MOVLW 240
ANDWF FARG_write_date_lcd_read_date+12, 0
MOVWF FARG_Lcd_I2C_Chr_CP_out_char+0
RRCF FARG_Lcd_I2C_Chr_CP_out_char+0, 1
BCF FARG_Lcd_I2C_Chr_CP_out_char+0, 7
RRCF FARG_Lcd_I2C_Chr_CP_out_char+0, 1
BCF FARG_Lcd_I2C_Chr_CP_out_char+0, 7
RRCF FARG_Lcd_I2C_Chr_CP_out_char+0, 1
BCF FARG_Lcd_I2C_Chr_CP_out_char+0, 7
RRCF FARG_Lcd_I2C_Chr_CP_out_char+0, 1
BCF FARG_Lcd_I2C_Chr_CP_out_char+0, 7
MOVLW 48
ADDWF FARG_Lcd_I2C_Chr_CP_out_char+0, 1
CALL _Lcd_I2C_Chr_CP+0, 0
;RTC.c,45 :: LCD_I2C_Chr_cp ((read_date. years & 0x0f) + 0x30);
MOVLW 15
ANDWF FARG_write_date_lcd_read_date+12, 0
MOVWF FARG_Lcd_I2C_Chr_CP_out_char+0
MOVLW 48
ADDWF FARG_Lcd_I2C_Chr_CP_out_char+0, 1
CALL _Lcd_I2C_Chr_CP+0, 0
;RTC.c,47 :: }
L_end_write_date_lcd:
RETURN 0
; end of _write_date_lcd
_converte_timer:
;RTC.c,49 :: struct real_time_clock converte_timer (struct real_time_clock dados_convert){
MOVF R0, 0
MOVWF R3
MOVF R1, 0
MOVWF R4
;RTC.c,53 :: dados_convertidos.hours = ((dados_convert.hours & 0xf0) >> 4) + 0x30;
MOVLW 240
ANDWF FARG_converte_timer_dados_convert+4, 0
MOVWF R2
MOVF R2, 0
MOVWF R0
RRCF R0, 1
BCF R0, 7
RRCF R0, 1
BCF R0, 7
RRCF R0, 1
BCF R0, 7
RRCF R0, 1
BCF R0, 7
MOVLW 48
ADDWF R0, 1
MOVF R0, 0
MOVWF R9
;RTC.c,54 :: dados_convertidos.hours1 = ((dados_convert.hours & 0x0f) + 0x30);
MOVLW 15
ANDWF FARG_converte_timer_dados_convert+4, 0
MOVWF R0
MOVLW 48
ADDWF R0, 1
MOVF R0, 0
MOVWF R10
;RTC.c,55 :: dados_convertidos.minutes = (((dados_convert.minutes & 0xf0) >> 4) + 0x30);
MOVLW 240
ANDWF FARG_converte_timer_dados_convert+2, 0
MOVWF R2
MOVF R2, 0
MOVWF R0
RRCF R0, 1
BCF R0, 7
RRCF R0, 1
BCF R0, 7
RRCF R0, 1
BCF R0, 7
RRCF R0, 1
BCF R0, 7
MOVLW 48
ADDWF R0, 1
MOVF R0, 0
MOVWF R7
;RTC.c,56 :: dados_convertidos.minutes1 = ((dados_convert.minutes & 0x0f) + 0x30);
MOVLW 15
ANDWF FARG_converte_timer_dados_convert+2, 0
MOVWF R0
MOVLW 48
ADDWF R0, 1
MOVF R0, 0
MOVWF R8
;RTC.c,57 :: dados_convertidos.days = ((dados_convert.days & 0xf0) >> 4) + 0x30;
MOVLW 240
ANDWF FARG_converte_timer_dados_convert+8, 0
MOVWF R2
MOVF R2, 0
MOVWF R0
RRCF R0, 1
BCF R0, 7
RRCF R0, 1
BCF R0, 7
RRCF R0, 1
BCF R0, 7
RRCF R0, 1
BCF R0, 7
MOVLW 48
ADDWF R0, 1
MOVF R0, 0
MOVWF R13
;RTC.c,58 :: dados_convertidos.days1 = ((dados_convert.days & 0x0f) + 0x30);
MOVLW 15
ANDWF FARG_converte_timer_dados_convert+8, 0
MOVWF R0
MOVLW 48
ADDWF R0, 1
MOVF R0, 0
MOVWF R14
;RTC.c,59 :: dados_convertidos.month = (((dados_convert.month & 0xf0) >> 4) + 0x30);
MOVLW 240
ANDWF FARG_converte_timer_dados_convert+10, 0
MOVWF R2
MOVF R2, 0
MOVWF R0
RRCF R0, 1
BCF R0, 7
RRCF R0, 1
BCF R0, 7
RRCF R0, 1
BCF R0, 7
RRCF R0, 1
BCF R0, 7
MOVLW 48
ADDWF R0, 1
MOVF R0, 0
MOVWF R15
;RTC.c,60 :: dados_convertidos.month1 = ((dados_convert.month & 0x0f) + 0x30);
MOVLW 15
ANDWF FARG_converte_timer_dados_convert+10, 0
MOVWF R0
MOVLW 48
ADDWF R0, 1
MOVF R0, 0
MOVWF R16
;RTC.c,61 :: dados_convertidos.years = (((dados_convert.years & 0xf0) >> 4) + 0x30);
MOVLW 240
ANDWF FARG_converte_timer_dados_convert+12, 0
MOVWF R2
MOVF R2, 0
MOVWF R0
RRCF R0, 1
BCF R0, 7
RRCF R0, 1
BCF R0, 7
RRCF R0, 1
BCF R0, 7
RRCF R0, 1
BCF R0, 7
MOVLW 48
ADDWF R0, 1
MOVF R0, 0
MOVWF R17
;RTC.c,62 :: dados_convertidos.years1 = ((dados_convert.years & 0x0f) + 0x30);
MOVLW 15
ANDWF FARG_converte_timer_dados_convert+12, 0
MOVWF R0
MOVLW 48
ADDWF R0, 1
MOVF R0, 0
MOVWF R18
;RTC.c,65 :: return dados_convertidos;
MOVLW 14
MOVWF R0
MOVF R3, 0
MOVWF FSR1
MOVF R4, 0
MOVWF FSR1H
MOVLW 5
MOVWF FSR0
MOVLW 0
MOVWF FSR0H
L_converte_timer1:
MOVF POSTINC0+0, 0
MOVWF POSTINC1+0
DECF R0, 1
BTFSS STATUS+0, 2
GOTO L_converte_timer1
;RTC.c,66 :: }
L_end_converte_timer:
RETURN 0
; end of _converte_timer
_write_lcd:
;RTC.c,69 :: void write_lcd (struct real_time_clock read_dates){
;RTC.c,71 :: LCD_I2C_Chr(1,6, read_dates.hours);
MOVLW 1
MOVWF FARG_Lcd_I2C_Chr_row+0
MOVLW 6
MOVWF FARG_Lcd_I2C_Chr_column+0
MOVF FARG_write_lcd_read_dates+4, 0
MOVWF FARG_Lcd_I2C_Chr_out_char+0
CALL _Lcd_I2C_Chr+0, 0
;RTC.c,72 :: LCD_I2C_Chr_cp (read_dates.hours1);
MOVF FARG_write_lcd_read_dates+5, 0
MOVWF FARG_Lcd_I2C_Chr_CP_out_char+0
CALL _Lcd_I2C_Chr_CP+0, 0
;RTC.c,73 :: LCD_I2C_Chr_cp (':');
MOVLW 58
MOVWF FARG_Lcd_I2C_Chr_CP_out_char+0
CALL _Lcd_I2C_Chr_CP+0, 0
;RTC.c,74 :: LCD_I2C_Chr_cp (read_dates.minutes);
MOVF FARG_write_lcd_read_dates+2, 0
MOVWF FARG_Lcd_I2C_Chr_CP_out_char+0
CALL _Lcd_I2C_Chr_CP+0, 0
;RTC.c,75 :: LCD_I2C_Chr_cp (read_dates.minutes1);
MOVF FARG_write_lcd_read_dates+3, 0
MOVWF FARG_Lcd_I2C_Chr_CP_out_char+0
CALL _Lcd_I2C_Chr_CP+0, 0
;RTC.c,76 :: LCD_I2C_Chr(2,5, read_dates.days);
MOVLW 2
MOVWF FARG_Lcd_I2C_Chr_row+0
MOVLW 5
MOVWF FARG_Lcd_I2C_Chr_column+0
MOVF FARG_write_lcd_read_dates+8, 0
MOVWF FARG_Lcd_I2C_Chr_out_char+0
CALL _Lcd_I2C_Chr+0, 0
;RTC.c,77 :: LCD_I2C_Chr_cp (read_dates.days1);
MOVF FARG_write_lcd_read_dates+9, 0
MOVWF FARG_Lcd_I2C_Chr_CP_out_char+0
CALL _Lcd_I2C_Chr_CP+0, 0
;RTC.c,78 :: LCD_I2C_Chr_cp ('/');
MOVLW 47
MOVWF FARG_Lcd_I2C_Chr_CP_out_char+0
CALL _Lcd_I2C_Chr_CP+0, 0
;RTC.c,79 :: LCD_I2C_Chr_cp (read_dates.month);
MOVF FARG_write_lcd_read_dates+10, 0
MOVWF FARG_Lcd_I2C_Chr_CP_out_char+0
CALL _Lcd_I2C_Chr_CP+0, 0
;RTC.c,80 :: LCD_I2C_Chr_cp (read_dates.month1);
MOVF FARG_write_lcd_read_dates+11, 0
MOVWF FARG_Lcd_I2C_Chr_CP_out_char+0
CALL _Lcd_I2C_Chr_CP+0, 0
;RTC.c,81 :: LCD_I2C_Chr_cp ('/');
MOVLW 47
MOVWF FARG_Lcd_I2C_Chr_CP_out_char+0
CALL _Lcd_I2C_Chr_CP+0, 0
;RTC.c,82 :: LCD_I2C_Chr_cp (read_dates. years);
MOVF FARG_write_lcd_read_dates+12, 0
MOVWF FARG_Lcd_I2C_Chr_CP_out_char+0
CALL _Lcd_I2C_Chr_CP+0, 0
;RTC.c,83 :: LCD_I2C_Chr_cp (read_dates. years1);
MOVF FARG_write_lcd_read_dates+13, 0
MOVWF FARG_Lcd_I2C_Chr_CP_out_char+0
CALL _Lcd_I2C_Chr_CP+0, 0
;RTC.c,86 :: }
L_end_write_lcd:
RETURN 0
; end of _write_lcd
|
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// <chrono>
// class month;
// month() = default;
// explicit constexpr month(int m) noexcept;
// explicit constexpr operator int() const noexcept;
// Effects: Constructs an object of type month by initializing m_ with m.
// The value held is unspecified if d is not in the range [0, 255].
#include <chrono>
#include <type_traits>
#include <cassert>
#include "test_macros.h"
int main(int, char**)
{
using month = std::chrono::month;
ASSERT_NOEXCEPT(month{});
ASSERT_NOEXCEPT(month(1));
ASSERT_NOEXCEPT(static_cast<unsigned>(month(1)));
constexpr month m0{};
static_assert(static_cast<unsigned>(m0) == 0, "");
constexpr month m1{1};
static_assert(static_cast<unsigned>(m1) == 1, "");
for (unsigned i = 0; i <= 255; ++i)
{
month m(i);
assert(static_cast<unsigned>(m) == i);
}
return 0;
}
|
; A116156: a(n) = 5^n * n*(n + 1).
; 0,10,150,1500,12500,93750,656250,4375000,28125000,175781250,1074218750,6445312500,38085937500,222167968750,1281738281250,7324218750000,41503906250000,233459472656250,1304626464843750,7247924804687500
mov $2,5
pow $2,$0
mul $2,$0
add $0,2
mul $0,$2
sub $0,$2
mov $1,$0
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r14
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0x1db7a, %rsi
lea addresses_UC_ht+0x393a, %rdi
nop
nop
nop
nop
nop
dec %r12
mov $33, %rcx
rep movsl
nop
nop
sub $644, %rdi
lea addresses_D_ht+0x2b3a, %rbp
nop
inc %r14
mov (%rbp), %dx
nop
nop
nop
nop
nop
inc %rbp
lea addresses_UC_ht+0x1e73a, %rdx
nop
nop
nop
add $54783, %r12
mov $0x6162636465666768, %rcx
movq %rcx, %xmm0
movups %xmm0, (%rdx)
cmp $18159, %rcx
lea addresses_WT_ht+0x433a, %rcx
nop
nop
nop
add $28686, %rsi
mov $0x6162636465666768, %rbp
movq %rbp, %xmm2
and $0xffffffffffffffc0, %rcx
vmovaps %ymm2, (%rcx)
nop
and $4667, %r14
lea addresses_normal_ht+0x4e3a, %rdi
nop
cmp %rsi, %rsi
mov (%rdi), %r14
nop
nop
nop
nop
nop
and $52870, %r12
lea addresses_A_ht+0x1033d, %rsi
lea addresses_D_ht+0x15b3a, %rdi
nop
xor %r11, %r11
mov $13, %rcx
rep movsb
nop
dec %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r14
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r14
push %r15
push %r9
push %rbp
push %rcx
push %rsi
// Store
lea addresses_US+0xa33a, %r14
nop
nop
nop
sub %rbp, %rbp
movb $0x51, (%r14)
nop
nop
nop
nop
nop
xor %r14, %r14
// Store
lea addresses_US+0x1a0ba, %rcx
nop
inc %r13
mov $0x5152535455565758, %rsi
movq %rsi, %xmm6
vmovups %ymm6, (%rcx)
nop
nop
nop
nop
nop
inc %rbp
// Load
lea addresses_A+0x133a, %r13
clflush (%r13)
nop
and $16070, %r14
mov (%r13), %r15
// Exception!!!
mov (0), %r14
nop
nop
nop
inc %r13
// Store
lea addresses_WC+0x753a, %rcx
nop
nop
cmp $45494, %r14
mov $0x5152535455565758, %r9
movq %r9, (%rcx)
nop
nop
and %r9, %r9
// Store
lea addresses_normal+0x46e6, %r15
clflush (%r15)
nop
nop
nop
and %r9, %r9
movb $0x51, (%r15)
and %r14, %r14
// Load
lea addresses_normal+0x144ba, %rbp
nop
nop
cmp %rcx, %rcx
movb (%rbp), %r14b
dec %r9
// Store
lea addresses_WT+0xc03a, %r15
nop
nop
nop
nop
and $14543, %r9
movb $0x51, (%r15)
nop
nop
nop
nop
nop
xor $35778, %r14
// Faulty Load
lea addresses_US+0xa33a, %rbp
nop
nop
xor %r14, %r14
mov (%rbp), %esi
lea oracles, %rbp
and $0xff, %rsi
shlq $12, %rsi
mov (%rbp,%rsi,1), %rsi
pop %rsi
pop %rcx
pop %rbp
pop %r9
pop %r15
pop %r14
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 8, 'AVXalign': False, 'NT': True, 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': True, 'NT': False, 'congruent': 11, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}}
{'51': 4}
51 51 51 51
*/
|
; int w_vector_shrink_to_fit(w_vector_t *v)
SECTION code_clib
SECTION code_adt_w_vector
PUBLIC _w_vector_shrink_to_fit
EXTERN _b_vector_shrink_to_fit
defc _w_vector_shrink_to_fit = _b_vector_shrink_to_fit
|
; Copyright (c) 2005-2020 Intel Corporation
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
.code
ALIGN 8
PUBLIC __TBB_get_cpu_ctl_env
__TBB_get_cpu_ctl_env:
stmxcsr [rcx]
fstcw [rcx+4]
ret
.code
ALIGN 8
PUBLIC __TBB_set_cpu_ctl_env
__TBB_set_cpu_ctl_env:
ldmxcsr [rcx]
fldcw [rcx+4]
ret
end
|
; A146076: Sum of even divisors of n.
; 0,2,0,6,0,8,0,14,0,12,0,24,0,16,0,30,0,26,0,36,0,24,0,56,0,28,0,48,0,48,0,62,0,36,0,78,0,40,0,84,0,64,0,72,0,48,0,120,0,62,0,84,0,80,0,112,0,60,0,144,0,64,0,126,0,96,0,108,0,96,0,182,0,76,0,120,0,112,0,180,0,84,0,192,0,88,0,168,0,156,0,144,0,96,0,248,0,114,0,186,0,144,0,196,0,108,0,240,0,144,0,240,0,160,0,180,0,120,0,336,0,124,0,192,0,208,0,254,0,168,0,288,0,136,0,252,0,192,0,288,0,144,0,390,0,148,0,228,0,248,0,280,0,192,0,336,0,160,0,372,0,242,0,252,0,168,0,448,0,216,0,264,0,240,0,360,0,180,0,468,0,224,0,336,0,256,0,288,0,240,0,504,0,196,0,342,0,312,0,434,0,204,0,432,0,208,0,420,0,384,0,324,0,216,0,560,0,220,0,432,0,304,0,496,0,228,0,480,0,288,0,420,0,364,0,360,0,288,0,720,0,266,0,372,0,336,0,448,0,312
mov $27,$0
mov $29,2
lpb $29,1
clr $0,27
mov $0,$27
sub $29,1
add $0,$29
sub $0,1
cal $0,271342 ; Sum of all even divisors of all positive integers <= n.
add $5,$0
add $0,$5
mov $1,$0
mov $30,$29
lpb $30,1
mov $28,$1
sub $30,1
lpe
lpe
lpb $27,1
mov $27,0
sub $28,$1
lpe
mov $1,$28
div $1,4
mul $1,2
|
;Testname=unoptimized; Arguments=-O0 -fbin -o br2496848.bin; Files=stdout stderr br2496848.bin
;Testname=optimized; Arguments=-Ox -fbin -o br2496848.bin; Files=stdout stderr br2496848.bin
bits 64
foo:
default abs
mov al, [qword 0xffffffffffffffff]
mov al, [qword 0x1ffffffffffffffff]
mov cl, [byte 0x12345678]
default rel
mov cl, [foo]
mov cl, [foo + 0x10000000]
mov cl, [foo + 0x100000000]
mov cl, [0x100]
mov cl, [$$ + 0x100]
mov cl, [rax - 1]
mov cl, [rax + 0xffffffff]
mov cl, [rax + 0x1ffffffff]
bits 32
mov cl, [eax - 1]
mov cl, [eax + 0xffffffff]
mov cl, [eax + 0x1ffffffff]
mov cl, [byte eax + 0xffffffff]
mov cl, [byte eax + 0x1ffffffff]
mov cl, [byte eax + 0x1000ffff]
bits 16
mov cl, [di - 1]
mov cl, [di + 0xffff]
mov cl, [di + 0x1ffff]
mov cl, [byte di + 0xffff]
mov cl, [byte di + 0x1ffff]
mov cl, [byte di + 0x10ff]
|
/*
* Copyright (c) 2017, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
L0:
(W&~f0.1)jmpi L448
L16:
add (1|M0) a0.0<1>:ud r23.5<0;1,0>:ud 0x48EC100:ud
mov (1|M0) r16.2<1>:ud 0x0:ud
and (1|M0) r16.3<1>:ud r0.3<0;1,0>:ud 0xFFFFFFFE:ud
mov (8|M0) r17.0<1>:ud r25.0<8;8,1>:ud
mov (1|M0) r17.2<1>:f r10.1<0;1,0>:f
mov (1|M0) r17.3<1>:f r10.3<0;1,0>:f
send (1|M0) r96:uw r16:ub 0x2 a0.0
mov (1|M0) r17.2<1>:f r10.6<0;1,0>:f
mov (1|M0) r17.3<1>:f r10.3<0;1,0>:f
send (1|M0) r104:uw r16:ub 0x2 a0.0
mov (16|M0) r13.0<1>:uw r96.0<16;16,1>:uw
mov (16|M0) r12.0<1>:uw r97.0<16;16,1>:uw
mov (16|M0) r96.0<1>:uw r100.0<16;16,1>:uw
mov (16|M0) r97.0<1>:uw r101.0<16;16,1>:uw
mov (16|M0) r100.0<1>:uw r13.0<16;16,1>:uw
mov (16|M0) r101.0<1>:uw r12.0<16;16,1>:uw
mov (16|M0) r13.0<1>:uw r104.0<16;16,1>:uw
mov (16|M0) r12.0<1>:uw r105.0<16;16,1>:uw
mov (16|M0) r104.0<1>:uw r108.0<16;16,1>:uw
mov (16|M0) r105.0<1>:uw r109.0<16;16,1>:uw
mov (16|M0) r108.0<1>:uw r13.0<16;16,1>:uw
mov (16|M0) r109.0<1>:uw r12.0<16;16,1>:uw
mov (1|M0) a0.8<1>:uw 0xC00:uw
mov (1|M0) a0.9<1>:uw 0xC40:uw
mov (1|M0) a0.10<1>:uw 0xC80:uw
mov (1|M0) a0.11<1>:uw 0xCC0:uw
add (4|M0) a0.12<1>:uw a0.8<4;4,1>:uw 0x100:uw
L448:
nop
|
kernel: file format elf32-i386
Disassembly of section .text:
80100000 <multiboot_header>:
80100000: 02 b0 ad 1b 00 00 add 0x1bad(%eax),%dh
80100006: 00 00 add %al,(%eax)
80100008: fe 4f 52 decb 0x52(%edi)
8010000b: e4 0f in $0xf,%al
8010000c <entry>:
8010000c: 0f 20 e0 mov %cr4,%eax
8010000f: 83 c8 10 or $0x10,%eax
80100012: 0f 22 e0 mov %eax,%cr4
80100015: b8 00 90 10 00 mov $0x109000,%eax
8010001a: 0f 22 d8 mov %eax,%cr3
8010001d: 0f 20 c0 mov %cr0,%eax
80100020: 0d 00 00 01 80 or $0x80010000,%eax
80100025: 0f 22 c0 mov %eax,%cr0
80100028: bc d0 b5 10 80 mov $0x8010b5d0,%esp
8010002d: b8 60 2e 10 80 mov $0x80102e60,%eax
80100032: ff e0 jmp *%eax
80100034: 66 90 xchg %ax,%ax
80100036: 66 90 xchg %ax,%ax
80100038: 66 90 xchg %ax,%ax
8010003a: 66 90 xchg %ax,%ax
8010003c: 66 90 xchg %ax,%ax
8010003e: 66 90 xchg %ax,%ax
80100040 <binit>:
struct buf head;
} bcache;
void
binit(void)
{
80100040: 55 push %ebp
80100041: 89 e5 mov %esp,%ebp
80100043: 53 push %ebx
//PAGEBREAK!
// Create linked list of buffers
bcache.head.prev = &bcache.head;
bcache.head.next = &bcache.head;
for(b = bcache.buf; b < bcache.buf+NBUF; b++){
80100044: bb 14 b6 10 80 mov $0x8010b614,%ebx
struct buf head;
} bcache;
void
binit(void)
{
80100049: 83 ec 14 sub $0x14,%esp
struct buf *b;
initlock(&bcache.lock, "bcache");
8010004c: c7 44 24 04 a0 6f 10 movl $0x80106fa0,0x4(%esp)
80100053: 80
80100054: c7 04 24 e0 b5 10 80 movl $0x8010b5e0,(%esp)
8010005b: e8 c0 42 00 00 call 80104320 <initlock>
//PAGEBREAK!
// Create linked list of buffers
bcache.head.prev = &bcache.head;
bcache.head.next = &bcache.head;
80100060: ba dc fc 10 80 mov $0x8010fcdc,%edx
initlock(&bcache.lock, "bcache");
//PAGEBREAK!
// Create linked list of buffers
bcache.head.prev = &bcache.head;
80100065: c7 05 2c fd 10 80 dc movl $0x8010fcdc,0x8010fd2c
8010006c: fc 10 80
bcache.head.next = &bcache.head;
8010006f: c7 05 30 fd 10 80 dc movl $0x8010fcdc,0x8010fd30
80100076: fc 10 80
80100079: eb 09 jmp 80100084 <binit+0x44>
8010007b: 90 nop
8010007c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80100080: 89 da mov %ebx,%edx
for(b = bcache.buf; b < bcache.buf+NBUF; b++){
80100082: 89 c3 mov %eax,%ebx
80100084: 8d 43 0c lea 0xc(%ebx),%eax
b->next = bcache.head.next;
80100087: 89 53 54 mov %edx,0x54(%ebx)
b->prev = &bcache.head;
8010008a: c7 43 50 dc fc 10 80 movl $0x8010fcdc,0x50(%ebx)
initsleeplock(&b->lock, "buffer");
80100091: 89 04 24 mov %eax,(%esp)
80100094: c7 44 24 04 a7 6f 10 movl $0x80106fa7,0x4(%esp)
8010009b: 80
8010009c: e8 6f 41 00 00 call 80104210 <initsleeplock>
bcache.head.next->prev = b;
801000a1: a1 30 fd 10 80 mov 0x8010fd30,%eax
801000a6: 89 58 50 mov %ebx,0x50(%eax)
//PAGEBREAK!
// Create linked list of buffers
bcache.head.prev = &bcache.head;
bcache.head.next = &bcache.head;
for(b = bcache.buf; b < bcache.buf+NBUF; b++){
801000a9: 8d 83 5c 02 00 00 lea 0x25c(%ebx),%eax
801000af: 3d dc fc 10 80 cmp $0x8010fcdc,%eax
b->next = bcache.head.next;
b->prev = &bcache.head;
initsleeplock(&b->lock, "buffer");
bcache.head.next->prev = b;
bcache.head.next = b;
801000b4: 89 1d 30 fd 10 80 mov %ebx,0x8010fd30
//PAGEBREAK!
// Create linked list of buffers
bcache.head.prev = &bcache.head;
bcache.head.next = &bcache.head;
for(b = bcache.buf; b < bcache.buf+NBUF; b++){
801000ba: 75 c4 jne 80100080 <binit+0x40>
b->prev = &bcache.head;
initsleeplock(&b->lock, "buffer");
bcache.head.next->prev = b;
bcache.head.next = b;
}
}
801000bc: 83 c4 14 add $0x14,%esp
801000bf: 5b pop %ebx
801000c0: 5d pop %ebp
801000c1: c3 ret
801000c2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801000c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801000d0 <bread>:
}
// Return a locked buf with the contents of the indicated block.
struct buf*
bread(uint dev, uint blockno)
{
801000d0: 55 push %ebp
801000d1: 89 e5 mov %esp,%ebp
801000d3: 57 push %edi
801000d4: 56 push %esi
801000d5: 53 push %ebx
801000d6: 83 ec 1c sub $0x1c,%esp
801000d9: 8b 75 08 mov 0x8(%ebp),%esi
static struct buf*
bget(uint dev, uint blockno)
{
struct buf *b;
acquire(&bcache.lock);
801000dc: c7 04 24 e0 b5 10 80 movl $0x8010b5e0,(%esp)
}
// Return a locked buf with the contents of the indicated block.
struct buf*
bread(uint dev, uint blockno)
{
801000e3: 8b 7d 0c mov 0xc(%ebp),%edi
static struct buf*
bget(uint dev, uint blockno)
{
struct buf *b;
acquire(&bcache.lock);
801000e6: e8 b5 42 00 00 call 801043a0 <acquire>
// Is the block already cached?
for(b = bcache.head.next; b != &bcache.head; b = b->next){
801000eb: 8b 1d 30 fd 10 80 mov 0x8010fd30,%ebx
801000f1: 81 fb dc fc 10 80 cmp $0x8010fcdc,%ebx
801000f7: 75 12 jne 8010010b <bread+0x3b>
801000f9: eb 25 jmp 80100120 <bread+0x50>
801000fb: 90 nop
801000fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80100100: 8b 5b 54 mov 0x54(%ebx),%ebx
80100103: 81 fb dc fc 10 80 cmp $0x8010fcdc,%ebx
80100109: 74 15 je 80100120 <bread+0x50>
if(b->dev == dev && b->blockno == blockno){
8010010b: 3b 73 04 cmp 0x4(%ebx),%esi
8010010e: 75 f0 jne 80100100 <bread+0x30>
80100110: 3b 7b 08 cmp 0x8(%ebx),%edi
80100113: 75 eb jne 80100100 <bread+0x30>
b->refcnt++;
80100115: 83 43 4c 01 addl $0x1,0x4c(%ebx)
80100119: eb 3f jmp 8010015a <bread+0x8a>
8010011b: 90 nop
8010011c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
}
// Not cached; recycle some unused buffer and clean buffer
// "clean" because B_DIRTY and not locked means log.c
// hasn't yet committed the changes to the buffer.
for(b = bcache.head.prev; b != &bcache.head; b = b->prev){
80100120: 8b 1d 2c fd 10 80 mov 0x8010fd2c,%ebx
80100126: 81 fb dc fc 10 80 cmp $0x8010fcdc,%ebx
8010012c: 75 0d jne 8010013b <bread+0x6b>
8010012e: eb 58 jmp 80100188 <bread+0xb8>
80100130: 8b 5b 50 mov 0x50(%ebx),%ebx
80100133: 81 fb dc fc 10 80 cmp $0x8010fcdc,%ebx
80100139: 74 4d je 80100188 <bread+0xb8>
if(b->refcnt == 0 && (b->flags & B_DIRTY) == 0) {
8010013b: 8b 43 4c mov 0x4c(%ebx),%eax
8010013e: 85 c0 test %eax,%eax
80100140: 75 ee jne 80100130 <bread+0x60>
80100142: f6 03 04 testb $0x4,(%ebx)
80100145: 75 e9 jne 80100130 <bread+0x60>
b->dev = dev;
80100147: 89 73 04 mov %esi,0x4(%ebx)
b->blockno = blockno;
8010014a: 89 7b 08 mov %edi,0x8(%ebx)
b->flags = 0;
8010014d: c7 03 00 00 00 00 movl $0x0,(%ebx)
b->refcnt = 1;
80100153: c7 43 4c 01 00 00 00 movl $0x1,0x4c(%ebx)
release(&bcache.lock);
8010015a: c7 04 24 e0 b5 10 80 movl $0x8010b5e0,(%esp)
80100161: e8 6a 43 00 00 call 801044d0 <release>
acquiresleep(&b->lock);
80100166: 8d 43 0c lea 0xc(%ebx),%eax
80100169: 89 04 24 mov %eax,(%esp)
8010016c: e8 df 40 00 00 call 80104250 <acquiresleep>
bread(uint dev, uint blockno)
{
struct buf *b;
b = bget(dev, blockno);
if(!(b->flags & B_VALID)) {
80100171: f6 03 02 testb $0x2,(%ebx)
80100174: 75 08 jne 8010017e <bread+0xae>
iderw(b);
80100176: 89 1c 24 mov %ebx,(%esp)
80100179: e8 a2 1f 00 00 call 80102120 <iderw>
}
return b;
}
8010017e: 83 c4 1c add $0x1c,%esp
80100181: 89 d8 mov %ebx,%eax
80100183: 5b pop %ebx
80100184: 5e pop %esi
80100185: 5f pop %edi
80100186: 5d pop %ebp
80100187: c3 ret
release(&bcache.lock);
acquiresleep(&b->lock);
return b;
}
}
panic("bget: no buffers");
80100188: c7 04 24 ae 6f 10 80 movl $0x80106fae,(%esp)
8010018f: e8 cc 01 00 00 call 80100360 <panic>
80100194: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
8010019a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
801001a0 <bwrite>:
}
// Write b's contents to disk. Must be locked.
void
bwrite(struct buf *b)
{
801001a0: 55 push %ebp
801001a1: 89 e5 mov %esp,%ebp
801001a3: 53 push %ebx
801001a4: 83 ec 14 sub $0x14,%esp
801001a7: 8b 5d 08 mov 0x8(%ebp),%ebx
if(!holdingsleep(&b->lock))
801001aa: 8d 43 0c lea 0xc(%ebx),%eax
801001ad: 89 04 24 mov %eax,(%esp)
801001b0: e8 3b 41 00 00 call 801042f0 <holdingsleep>
801001b5: 85 c0 test %eax,%eax
801001b7: 74 10 je 801001c9 <bwrite+0x29>
panic("bwrite");
b->flags |= B_DIRTY;
801001b9: 83 0b 04 orl $0x4,(%ebx)
iderw(b);
801001bc: 89 5d 08 mov %ebx,0x8(%ebp)
}
801001bf: 83 c4 14 add $0x14,%esp
801001c2: 5b pop %ebx
801001c3: 5d pop %ebp
bwrite(struct buf *b)
{
if(!holdingsleep(&b->lock))
panic("bwrite");
b->flags |= B_DIRTY;
iderw(b);
801001c4: e9 57 1f 00 00 jmp 80102120 <iderw>
// Write b's contents to disk. Must be locked.
void
bwrite(struct buf *b)
{
if(!holdingsleep(&b->lock))
panic("bwrite");
801001c9: c7 04 24 bf 6f 10 80 movl $0x80106fbf,(%esp)
801001d0: e8 8b 01 00 00 call 80100360 <panic>
801001d5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801001d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801001e0 <brelse>:
// Release a locked buffer.
// Move to the head of the MRU list.
void
brelse(struct buf *b)
{
801001e0: 55 push %ebp
801001e1: 89 e5 mov %esp,%ebp
801001e3: 56 push %esi
801001e4: 53 push %ebx
801001e5: 83 ec 10 sub $0x10,%esp
801001e8: 8b 5d 08 mov 0x8(%ebp),%ebx
if(!holdingsleep(&b->lock))
801001eb: 8d 73 0c lea 0xc(%ebx),%esi
801001ee: 89 34 24 mov %esi,(%esp)
801001f1: e8 fa 40 00 00 call 801042f0 <holdingsleep>
801001f6: 85 c0 test %eax,%eax
801001f8: 74 5b je 80100255 <brelse+0x75>
panic("brelse");
releasesleep(&b->lock);
801001fa: 89 34 24 mov %esi,(%esp)
801001fd: e8 ae 40 00 00 call 801042b0 <releasesleep>
acquire(&bcache.lock);
80100202: c7 04 24 e0 b5 10 80 movl $0x8010b5e0,(%esp)
80100209: e8 92 41 00 00 call 801043a0 <acquire>
b->refcnt--;
if (b->refcnt == 0) {
8010020e: 83 6b 4c 01 subl $0x1,0x4c(%ebx)
80100212: 75 2f jne 80100243 <brelse+0x63>
// no one is waiting for it.
b->next->prev = b->prev;
80100214: 8b 43 54 mov 0x54(%ebx),%eax
80100217: 8b 53 50 mov 0x50(%ebx),%edx
8010021a: 89 50 50 mov %edx,0x50(%eax)
b->prev->next = b->next;
8010021d: 8b 43 50 mov 0x50(%ebx),%eax
80100220: 8b 53 54 mov 0x54(%ebx),%edx
80100223: 89 50 54 mov %edx,0x54(%eax)
b->next = bcache.head.next;
80100226: a1 30 fd 10 80 mov 0x8010fd30,%eax
b->prev = &bcache.head;
8010022b: c7 43 50 dc fc 10 80 movl $0x8010fcdc,0x50(%ebx)
b->refcnt--;
if (b->refcnt == 0) {
// no one is waiting for it.
b->next->prev = b->prev;
b->prev->next = b->next;
b->next = bcache.head.next;
80100232: 89 43 54 mov %eax,0x54(%ebx)
b->prev = &bcache.head;
bcache.head.next->prev = b;
80100235: a1 30 fd 10 80 mov 0x8010fd30,%eax
8010023a: 89 58 50 mov %ebx,0x50(%eax)
bcache.head.next = b;
8010023d: 89 1d 30 fd 10 80 mov %ebx,0x8010fd30
}
release(&bcache.lock);
80100243: c7 45 08 e0 b5 10 80 movl $0x8010b5e0,0x8(%ebp)
}
8010024a: 83 c4 10 add $0x10,%esp
8010024d: 5b pop %ebx
8010024e: 5e pop %esi
8010024f: 5d pop %ebp
b->prev = &bcache.head;
bcache.head.next->prev = b;
bcache.head.next = b;
}
release(&bcache.lock);
80100250: e9 7b 42 00 00 jmp 801044d0 <release>
// Move to the head of the MRU list.
void
brelse(struct buf *b)
{
if(!holdingsleep(&b->lock))
panic("brelse");
80100255: c7 04 24 c6 6f 10 80 movl $0x80106fc6,(%esp)
8010025c: e8 ff 00 00 00 call 80100360 <panic>
80100261: 66 90 xchg %ax,%ax
80100263: 66 90 xchg %ax,%ax
80100265: 66 90 xchg %ax,%ax
80100267: 66 90 xchg %ax,%ax
80100269: 66 90 xchg %ax,%ax
8010026b: 66 90 xchg %ax,%ax
8010026d: 66 90 xchg %ax,%ax
8010026f: 90 nop
80100270 <consoleread>:
}
}
int
consoleread(struct inode *ip, char *dst, int n)
{
80100270: 55 push %ebp
80100271: 89 e5 mov %esp,%ebp
80100273: 57 push %edi
80100274: 56 push %esi
80100275: 53 push %ebx
80100276: 83 ec 1c sub $0x1c,%esp
80100279: 8b 7d 08 mov 0x8(%ebp),%edi
8010027c: 8b 75 0c mov 0xc(%ebp),%esi
uint target;
int c;
iunlock(ip);
8010027f: 89 3c 24 mov %edi,(%esp)
80100282: e8 09 15 00 00 call 80101790 <iunlock>
target = n;
acquire(&cons.lock);
80100287: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp)
8010028e: e8 0d 41 00 00 call 801043a0 <acquire>
while(n > 0){
80100293: 8b 55 10 mov 0x10(%ebp),%edx
80100296: 85 d2 test %edx,%edx
80100298: 0f 8e bc 00 00 00 jle 8010035a <consoleread+0xea>
8010029e: 8b 5d 10 mov 0x10(%ebp),%ebx
801002a1: eb 26 jmp 801002c9 <consoleread+0x59>
801002a3: 90 nop
801002a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
while(input.r == input.w){
if(proc->killed){
801002a8: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801002ae: 8b 40 24 mov 0x24(%eax),%eax
801002b1: 85 c0 test %eax,%eax
801002b3: 75 73 jne 80100328 <consoleread+0xb8>
release(&cons.lock);
ilock(ip);
return -1;
}
sleep(&input.r, &cons.lock);
801002b5: c7 44 24 04 20 a5 10 movl $0x8010a520,0x4(%esp)
801002bc: 80
801002bd: c7 04 24 c0 ff 10 80 movl $0x8010ffc0,(%esp)
801002c4: e8 d7 3b 00 00 call 80103ea0 <sleep>
iunlock(ip);
target = n;
acquire(&cons.lock);
while(n > 0){
while(input.r == input.w){
801002c9: a1 c0 ff 10 80 mov 0x8010ffc0,%eax
801002ce: 3b 05 c4 ff 10 80 cmp 0x8010ffc4,%eax
801002d4: 74 d2 je 801002a8 <consoleread+0x38>
ilock(ip);
return -1;
}
sleep(&input.r, &cons.lock);
}
c = input.buf[input.r++ % INPUT_BUF];
801002d6: 8d 50 01 lea 0x1(%eax),%edx
801002d9: 89 15 c0 ff 10 80 mov %edx,0x8010ffc0
801002df: 89 c2 mov %eax,%edx
801002e1: 83 e2 7f and $0x7f,%edx
801002e4: 0f b6 8a 40 ff 10 80 movzbl -0x7fef00c0(%edx),%ecx
801002eb: 0f be d1 movsbl %cl,%edx
if(c == C('D')){ // EOF
801002ee: 83 fa 04 cmp $0x4,%edx
801002f1: 74 56 je 80100349 <consoleread+0xd9>
// caller gets a 0-byte result.
input.r--;
}
break;
}
*dst++ = c;
801002f3: 83 c6 01 add $0x1,%esi
--n;
801002f6: 83 eb 01 sub $0x1,%ebx
if(c == '\n')
801002f9: 83 fa 0a cmp $0xa,%edx
// caller gets a 0-byte result.
input.r--;
}
break;
}
*dst++ = c;
801002fc: 88 4e ff mov %cl,-0x1(%esi)
--n;
if(c == '\n')
801002ff: 74 52 je 80100353 <consoleread+0xe3>
int c;
iunlock(ip);
target = n;
acquire(&cons.lock);
while(n > 0){
80100301: 85 db test %ebx,%ebx
80100303: 75 c4 jne 801002c9 <consoleread+0x59>
80100305: 8b 45 10 mov 0x10(%ebp),%eax
*dst++ = c;
--n;
if(c == '\n')
break;
}
release(&cons.lock);
80100308: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp)
8010030f: 89 45 e4 mov %eax,-0x1c(%ebp)
80100312: e8 b9 41 00 00 call 801044d0 <release>
ilock(ip);
80100317: 89 3c 24 mov %edi,(%esp)
8010031a: e8 a1 13 00 00 call 801016c0 <ilock>
8010031f: 8b 45 e4 mov -0x1c(%ebp),%eax
return target - n;
80100322: eb 1d jmp 80100341 <consoleread+0xd1>
80100324: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
target = n;
acquire(&cons.lock);
while(n > 0){
while(input.r == input.w){
if(proc->killed){
release(&cons.lock);
80100328: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp)
8010032f: e8 9c 41 00 00 call 801044d0 <release>
ilock(ip);
80100334: 89 3c 24 mov %edi,(%esp)
80100337: e8 84 13 00 00 call 801016c0 <ilock>
return -1;
8010033c: b8 ff ff ff ff mov $0xffffffff,%eax
}
release(&cons.lock);
ilock(ip);
return target - n;
}
80100341: 83 c4 1c add $0x1c,%esp
80100344: 5b pop %ebx
80100345: 5e pop %esi
80100346: 5f pop %edi
80100347: 5d pop %ebp
80100348: c3 ret
}
sleep(&input.r, &cons.lock);
}
c = input.buf[input.r++ % INPUT_BUF];
if(c == C('D')){ // EOF
if(n < target){
80100349: 39 5d 10 cmp %ebx,0x10(%ebp)
8010034c: 76 05 jbe 80100353 <consoleread+0xe3>
// Save ^D for next time, to make sure
// caller gets a 0-byte result.
input.r--;
8010034e: a3 c0 ff 10 80 mov %eax,0x8010ffc0
80100353: 8b 45 10 mov 0x10(%ebp),%eax
80100356: 29 d8 sub %ebx,%eax
80100358: eb ae jmp 80100308 <consoleread+0x98>
int c;
iunlock(ip);
target = n;
acquire(&cons.lock);
while(n > 0){
8010035a: 31 c0 xor %eax,%eax
8010035c: eb aa jmp 80100308 <consoleread+0x98>
8010035e: 66 90 xchg %ax,%ax
80100360 <panic>:
release(&cons.lock);
}
void
panic(char *s)
{
80100360: 55 push %ebp
80100361: 89 e5 mov %esp,%ebp
80100363: 56 push %esi
80100364: 53 push %ebx
80100365: 83 ec 40 sub $0x40,%esp
}
static inline void
cli(void)
{
asm volatile("cli");
80100368: fa cli
int i;
uint pcs[10];
cli();
cons.locking = 0;
cprintf("cpu with apicid %d: panic: ", cpu->apicid);
80100369: 65 a1 00 00 00 00 mov %gs:0x0,%eax
cprintf(s);
cprintf("\n");
getcallerpcs(&s, pcs);
8010036f: 8d 5d d0 lea -0x30(%ebp),%ebx
{
int i;
uint pcs[10];
cli();
cons.locking = 0;
80100372: c7 05 54 a5 10 80 00 movl $0x0,0x8010a554
80100379: 00 00 00
8010037c: 8d 75 f8 lea -0x8(%ebp),%esi
cprintf("cpu with apicid %d: panic: ", cpu->apicid);
8010037f: 0f b6 00 movzbl (%eax),%eax
80100382: c7 04 24 cd 6f 10 80 movl $0x80106fcd,(%esp)
80100389: 89 44 24 04 mov %eax,0x4(%esp)
8010038d: e8 be 02 00 00 call 80100650 <cprintf>
cprintf(s);
80100392: 8b 45 08 mov 0x8(%ebp),%eax
80100395: 89 04 24 mov %eax,(%esp)
80100398: e8 b3 02 00 00 call 80100650 <cprintf>
cprintf("\n");
8010039d: c7 04 24 c6 74 10 80 movl $0x801074c6,(%esp)
801003a4: e8 a7 02 00 00 call 80100650 <cprintf>
getcallerpcs(&s, pcs);
801003a9: 8d 45 08 lea 0x8(%ebp),%eax
801003ac: 89 5c 24 04 mov %ebx,0x4(%esp)
801003b0: 89 04 24 mov %eax,(%esp)
801003b3: e8 88 3f 00 00 call 80104340 <getcallerpcs>
for(i=0; i<10; i++)
cprintf(" %p", pcs[i]);
801003b8: 8b 03 mov (%ebx),%eax
801003ba: 83 c3 04 add $0x4,%ebx
801003bd: c7 04 24 e9 6f 10 80 movl $0x80106fe9,(%esp)
801003c4: 89 44 24 04 mov %eax,0x4(%esp)
801003c8: e8 83 02 00 00 call 80100650 <cprintf>
cons.locking = 0;
cprintf("cpu with apicid %d: panic: ", cpu->apicid);
cprintf(s);
cprintf("\n");
getcallerpcs(&s, pcs);
for(i=0; i<10; i++)
801003cd: 39 f3 cmp %esi,%ebx
801003cf: 75 e7 jne 801003b8 <panic+0x58>
cprintf(" %p", pcs[i]);
panicked = 1; // freeze other CPU
801003d1: c7 05 58 a5 10 80 01 movl $0x1,0x8010a558
801003d8: 00 00 00
801003db: eb fe jmp 801003db <panic+0x7b>
801003dd: 8d 76 00 lea 0x0(%esi),%esi
801003e0 <consputc>:
}
void
consputc(int c)
{
if(panicked){
801003e0: 8b 15 58 a5 10 80 mov 0x8010a558,%edx
801003e6: 85 d2 test %edx,%edx
801003e8: 74 06 je 801003f0 <consputc+0x10>
801003ea: fa cli
801003eb: eb fe jmp 801003eb <consputc+0xb>
801003ed: 8d 76 00 lea 0x0(%esi),%esi
crt[pos] = ' ' | 0x0700;
}
void
consputc(int c)
{
801003f0: 55 push %ebp
801003f1: 89 e5 mov %esp,%ebp
801003f3: 57 push %edi
801003f4: 56 push %esi
801003f5: 53 push %ebx
801003f6: 89 c3 mov %eax,%ebx
801003f8: 83 ec 1c sub $0x1c,%esp
cli();
for(;;)
;
}
if(c == BACKSPACE){
801003fb: 3d 00 01 00 00 cmp $0x100,%eax
80100400: 0f 84 ac 00 00 00 je 801004b2 <consputc+0xd2>
uartputc('\b'); uartputc(' '); uartputc('\b');
} else
uartputc(c);
80100406: 89 04 24 mov %eax,(%esp)
80100409: e8 c2 56 00 00 call 80105ad0 <uartputc>
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
8010040e: bf d4 03 00 00 mov $0x3d4,%edi
80100413: b8 0e 00 00 00 mov $0xe,%eax
80100418: 89 fa mov %edi,%edx
8010041a: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
8010041b: be d5 03 00 00 mov $0x3d5,%esi
80100420: 89 f2 mov %esi,%edx
80100422: ec in (%dx),%al
{
int pos;
// Cursor position: col + 80*row.
outb(CRTPORT, 14);
pos = inb(CRTPORT+1) << 8;
80100423: 0f b6 c8 movzbl %al,%ecx
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80100426: 89 fa mov %edi,%edx
80100428: c1 e1 08 shl $0x8,%ecx
8010042b: b8 0f 00 00 00 mov $0xf,%eax
80100430: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80100431: 89 f2 mov %esi,%edx
80100433: ec in (%dx),%al
outb(CRTPORT, 15);
pos |= inb(CRTPORT+1);
80100434: 0f b6 c0 movzbl %al,%eax
80100437: 09 c1 or %eax,%ecx
if(c == '\n')
80100439: 83 fb 0a cmp $0xa,%ebx
8010043c: 0f 84 0d 01 00 00 je 8010054f <consputc+0x16f>
pos += 80 - pos%80;
else if(c == BACKSPACE){
80100442: 81 fb 00 01 00 00 cmp $0x100,%ebx
80100448: 0f 84 e8 00 00 00 je 80100536 <consputc+0x156>
if(pos > 0) --pos;
} else
crt[pos++] = (c&0xff) | 0x0700; // black on white
8010044e: 0f b6 db movzbl %bl,%ebx
80100451: 80 cf 07 or $0x7,%bh
80100454: 8d 79 01 lea 0x1(%ecx),%edi
80100457: 66 89 9c 09 00 80 0b mov %bx,-0x7ff48000(%ecx,%ecx,1)
8010045e: 80
if(pos < 0 || pos > 25*80)
8010045f: 81 ff d0 07 00 00 cmp $0x7d0,%edi
80100465: 0f 87 bf 00 00 00 ja 8010052a <consputc+0x14a>
panic("pos under/overflow");
if((pos/80) >= 24){ // Scroll up.
8010046b: 81 ff 7f 07 00 00 cmp $0x77f,%edi
80100471: 7f 68 jg 801004db <consputc+0xfb>
80100473: 89 f8 mov %edi,%eax
80100475: 89 fb mov %edi,%ebx
80100477: c1 e8 08 shr $0x8,%eax
8010047a: 89 c6 mov %eax,%esi
8010047c: 8d 8c 3f 00 80 0b 80 lea -0x7ff48000(%edi,%edi,1),%ecx
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80100483: bf d4 03 00 00 mov $0x3d4,%edi
80100488: b8 0e 00 00 00 mov $0xe,%eax
8010048d: 89 fa mov %edi,%edx
8010048f: ee out %al,(%dx)
80100490: 89 f0 mov %esi,%eax
80100492: b2 d5 mov $0xd5,%dl
80100494: ee out %al,(%dx)
80100495: b8 0f 00 00 00 mov $0xf,%eax
8010049a: 89 fa mov %edi,%edx
8010049c: ee out %al,(%dx)
8010049d: 89 d8 mov %ebx,%eax
8010049f: b2 d5 mov $0xd5,%dl
801004a1: ee out %al,(%dx)
outb(CRTPORT, 14);
outb(CRTPORT+1, pos>>8);
outb(CRTPORT, 15);
outb(CRTPORT+1, pos);
crt[pos] = ' ' | 0x0700;
801004a2: b8 20 07 00 00 mov $0x720,%eax
801004a7: 66 89 01 mov %ax,(%ecx)
if(c == BACKSPACE){
uartputc('\b'); uartputc(' '); uartputc('\b');
} else
uartputc(c);
cgaputc(c);
}
801004aa: 83 c4 1c add $0x1c,%esp
801004ad: 5b pop %ebx
801004ae: 5e pop %esi
801004af: 5f pop %edi
801004b0: 5d pop %ebp
801004b1: c3 ret
for(;;)
;
}
if(c == BACKSPACE){
uartputc('\b'); uartputc(' '); uartputc('\b');
801004b2: c7 04 24 08 00 00 00 movl $0x8,(%esp)
801004b9: e8 12 56 00 00 call 80105ad0 <uartputc>
801004be: c7 04 24 20 00 00 00 movl $0x20,(%esp)
801004c5: e8 06 56 00 00 call 80105ad0 <uartputc>
801004ca: c7 04 24 08 00 00 00 movl $0x8,(%esp)
801004d1: e8 fa 55 00 00 call 80105ad0 <uartputc>
801004d6: e9 33 ff ff ff jmp 8010040e <consputc+0x2e>
if(pos < 0 || pos > 25*80)
panic("pos under/overflow");
if((pos/80) >= 24){ // Scroll up.
memmove(crt, crt+80, sizeof(crt[0])*23*80);
801004db: c7 44 24 08 60 0e 00 movl $0xe60,0x8(%esp)
801004e2: 00
pos -= 80;
801004e3: 8d 5f b0 lea -0x50(%edi),%ebx
if(pos < 0 || pos > 25*80)
panic("pos under/overflow");
if((pos/80) >= 24){ // Scroll up.
memmove(crt, crt+80, sizeof(crt[0])*23*80);
801004e6: c7 44 24 04 a0 80 0b movl $0x800b80a0,0x4(%esp)
801004ed: 80
pos -= 80;
memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos));
801004ee: 8d b4 1b 00 80 0b 80 lea -0x7ff48000(%ebx,%ebx,1),%esi
if(pos < 0 || pos > 25*80)
panic("pos under/overflow");
if((pos/80) >= 24){ // Scroll up.
memmove(crt, crt+80, sizeof(crt[0])*23*80);
801004f5: c7 04 24 00 80 0b 80 movl $0x800b8000,(%esp)
801004fc: e8 cf 40 00 00 call 801045d0 <memmove>
pos -= 80;
memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos));
80100501: b8 d0 07 00 00 mov $0x7d0,%eax
80100506: 29 f8 sub %edi,%eax
80100508: 01 c0 add %eax,%eax
8010050a: 89 34 24 mov %esi,(%esp)
8010050d: 89 44 24 08 mov %eax,0x8(%esp)
80100511: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80100518: 00
80100519: e8 02 40 00 00 call 80104520 <memset>
8010051e: 89 f1 mov %esi,%ecx
80100520: be 07 00 00 00 mov $0x7,%esi
80100525: e9 59 ff ff ff jmp 80100483 <consputc+0xa3>
if(pos > 0) --pos;
} else
crt[pos++] = (c&0xff) | 0x0700; // black on white
if(pos < 0 || pos > 25*80)
panic("pos under/overflow");
8010052a: c7 04 24 ed 6f 10 80 movl $0x80106fed,(%esp)
80100531: e8 2a fe ff ff call 80100360 <panic>
pos |= inb(CRTPORT+1);
if(c == '\n')
pos += 80 - pos%80;
else if(c == BACKSPACE){
if(pos > 0) --pos;
80100536: 85 c9 test %ecx,%ecx
80100538: 8d 79 ff lea -0x1(%ecx),%edi
8010053b: 0f 85 1e ff ff ff jne 8010045f <consputc+0x7f>
80100541: b9 00 80 0b 80 mov $0x800b8000,%ecx
80100546: 31 db xor %ebx,%ebx
80100548: 31 f6 xor %esi,%esi
8010054a: e9 34 ff ff ff jmp 80100483 <consputc+0xa3>
pos = inb(CRTPORT+1) << 8;
outb(CRTPORT, 15);
pos |= inb(CRTPORT+1);
if(c == '\n')
pos += 80 - pos%80;
8010054f: 89 c8 mov %ecx,%eax
80100551: ba 67 66 66 66 mov $0x66666667,%edx
80100556: f7 ea imul %edx
80100558: c1 ea 05 shr $0x5,%edx
8010055b: 8d 04 92 lea (%edx,%edx,4),%eax
8010055e: c1 e0 04 shl $0x4,%eax
80100561: 8d 78 50 lea 0x50(%eax),%edi
80100564: e9 f6 fe ff ff jmp 8010045f <consputc+0x7f>
80100569: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80100570 <printint>:
int locking;
} cons;
static void
printint(int xx, int base, int sign)
{
80100570: 55 push %ebp
80100571: 89 e5 mov %esp,%ebp
80100573: 57 push %edi
80100574: 56 push %esi
80100575: 89 d6 mov %edx,%esi
80100577: 53 push %ebx
80100578: 83 ec 1c sub $0x1c,%esp
static char digits[] = "0123456789abcdef";
char buf[16];
int i;
uint x;
if(sign && (sign = xx < 0))
8010057b: 85 c9 test %ecx,%ecx
8010057d: 74 61 je 801005e0 <printint+0x70>
8010057f: 85 c0 test %eax,%eax
80100581: 79 5d jns 801005e0 <printint+0x70>
x = -xx;
80100583: f7 d8 neg %eax
80100585: bf 01 00 00 00 mov $0x1,%edi
else
x = xx;
i = 0;
8010058a: 31 c9 xor %ecx,%ecx
8010058c: eb 04 jmp 80100592 <printint+0x22>
8010058e: 66 90 xchg %ax,%ax
do{
buf[i++] = digits[x % base];
80100590: 89 d9 mov %ebx,%ecx
80100592: 31 d2 xor %edx,%edx
80100594: f7 f6 div %esi
80100596: 8d 59 01 lea 0x1(%ecx),%ebx
80100599: 0f b6 92 18 70 10 80 movzbl -0x7fef8fe8(%edx),%edx
}while((x /= base) != 0);
801005a0: 85 c0 test %eax,%eax
else
x = xx;
i = 0;
do{
buf[i++] = digits[x % base];
801005a2: 88 54 1d d7 mov %dl,-0x29(%ebp,%ebx,1)
}while((x /= base) != 0);
801005a6: 75 e8 jne 80100590 <printint+0x20>
if(sign)
801005a8: 85 ff test %edi,%edi
else
x = xx;
i = 0;
do{
buf[i++] = digits[x % base];
801005aa: 89 d8 mov %ebx,%eax
}while((x /= base) != 0);
if(sign)
801005ac: 74 08 je 801005b6 <printint+0x46>
buf[i++] = '-';
801005ae: 8d 59 02 lea 0x2(%ecx),%ebx
801005b1: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1)
while(--i >= 0)
801005b6: 83 eb 01 sub $0x1,%ebx
801005b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
consputc(buf[i]);
801005c0: 0f be 44 1d d8 movsbl -0x28(%ebp,%ebx,1),%eax
}while((x /= base) != 0);
if(sign)
buf[i++] = '-';
while(--i >= 0)
801005c5: 83 eb 01 sub $0x1,%ebx
consputc(buf[i]);
801005c8: e8 13 fe ff ff call 801003e0 <consputc>
}while((x /= base) != 0);
if(sign)
buf[i++] = '-';
while(--i >= 0)
801005cd: 83 fb ff cmp $0xffffffff,%ebx
801005d0: 75 ee jne 801005c0 <printint+0x50>
consputc(buf[i]);
}
801005d2: 83 c4 1c add $0x1c,%esp
801005d5: 5b pop %ebx
801005d6: 5e pop %esi
801005d7: 5f pop %edi
801005d8: 5d pop %ebp
801005d9: c3 ret
801005da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
uint x;
if(sign && (sign = xx < 0))
x = -xx;
else
x = xx;
801005e0: 31 ff xor %edi,%edi
801005e2: eb a6 jmp 8010058a <printint+0x1a>
801005e4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801005ea: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
801005f0 <consolewrite>:
return target - n;
}
int
consolewrite(struct inode *ip, char *buf, int n)
{
801005f0: 55 push %ebp
801005f1: 89 e5 mov %esp,%ebp
801005f3: 57 push %edi
801005f4: 56 push %esi
801005f5: 53 push %ebx
801005f6: 83 ec 1c sub $0x1c,%esp
int i;
iunlock(ip);
801005f9: 8b 45 08 mov 0x8(%ebp),%eax
return target - n;
}
int
consolewrite(struct inode *ip, char *buf, int n)
{
801005fc: 8b 75 10 mov 0x10(%ebp),%esi
int i;
iunlock(ip);
801005ff: 89 04 24 mov %eax,(%esp)
80100602: e8 89 11 00 00 call 80101790 <iunlock>
acquire(&cons.lock);
80100607: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp)
8010060e: e8 8d 3d 00 00 call 801043a0 <acquire>
80100613: 8b 7d 0c mov 0xc(%ebp),%edi
for(i = 0; i < n; i++)
80100616: 85 f6 test %esi,%esi
80100618: 8d 1c 37 lea (%edi,%esi,1),%ebx
8010061b: 7e 12 jle 8010062f <consolewrite+0x3f>
8010061d: 8d 76 00 lea 0x0(%esi),%esi
consputc(buf[i] & 0xff);
80100620: 0f b6 07 movzbl (%edi),%eax
80100623: 83 c7 01 add $0x1,%edi
80100626: e8 b5 fd ff ff call 801003e0 <consputc>
{
int i;
iunlock(ip);
acquire(&cons.lock);
for(i = 0; i < n; i++)
8010062b: 39 df cmp %ebx,%edi
8010062d: 75 f1 jne 80100620 <consolewrite+0x30>
consputc(buf[i] & 0xff);
release(&cons.lock);
8010062f: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp)
80100636: e8 95 3e 00 00 call 801044d0 <release>
ilock(ip);
8010063b: 8b 45 08 mov 0x8(%ebp),%eax
8010063e: 89 04 24 mov %eax,(%esp)
80100641: e8 7a 10 00 00 call 801016c0 <ilock>
return n;
}
80100646: 83 c4 1c add $0x1c,%esp
80100649: 89 f0 mov %esi,%eax
8010064b: 5b pop %ebx
8010064c: 5e pop %esi
8010064d: 5f pop %edi
8010064e: 5d pop %ebp
8010064f: c3 ret
80100650 <cprintf>:
//PAGEBREAK: 50
// Print to the console. only understands %d, %x, %p, %s.
void
cprintf(char *fmt, ...)
{
80100650: 55 push %ebp
80100651: 89 e5 mov %esp,%ebp
80100653: 57 push %edi
80100654: 56 push %esi
80100655: 53 push %ebx
80100656: 83 ec 1c sub $0x1c,%esp
int i, c, locking;
uint *argp;
char *s;
locking = cons.locking;
80100659: a1 54 a5 10 80 mov 0x8010a554,%eax
if(locking)
8010065e: 85 c0 test %eax,%eax
{
int i, c, locking;
uint *argp;
char *s;
locking = cons.locking;
80100660: 89 45 e0 mov %eax,-0x20(%ebp)
if(locking)
80100663: 0f 85 27 01 00 00 jne 80100790 <cprintf+0x140>
acquire(&cons.lock);
if (fmt == 0)
80100669: 8b 45 08 mov 0x8(%ebp),%eax
8010066c: 85 c0 test %eax,%eax
8010066e: 89 c1 mov %eax,%ecx
80100670: 0f 84 2b 01 00 00 je 801007a1 <cprintf+0x151>
panic("null fmt");
argp = (uint*)(void*)(&fmt + 1);
for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
80100676: 0f b6 00 movzbl (%eax),%eax
80100679: 31 db xor %ebx,%ebx
8010067b: 89 cf mov %ecx,%edi
8010067d: 8d 75 0c lea 0xc(%ebp),%esi
80100680: 85 c0 test %eax,%eax
80100682: 75 4c jne 801006d0 <cprintf+0x80>
80100684: eb 5f jmp 801006e5 <cprintf+0x95>
80100686: 66 90 xchg %ax,%ax
if(c != '%'){
consputc(c);
continue;
}
c = fmt[++i] & 0xff;
80100688: 83 c3 01 add $0x1,%ebx
8010068b: 0f b6 14 1f movzbl (%edi,%ebx,1),%edx
if(c == 0)
8010068f: 85 d2 test %edx,%edx
80100691: 74 52 je 801006e5 <cprintf+0x95>
break;
switch(c){
80100693: 83 fa 70 cmp $0x70,%edx
80100696: 74 72 je 8010070a <cprintf+0xba>
80100698: 7f 66 jg 80100700 <cprintf+0xb0>
8010069a: 83 fa 25 cmp $0x25,%edx
8010069d: 8d 76 00 lea 0x0(%esi),%esi
801006a0: 0f 84 a2 00 00 00 je 80100748 <cprintf+0xf8>
801006a6: 83 fa 64 cmp $0x64,%edx
801006a9: 75 7d jne 80100728 <cprintf+0xd8>
case 'd':
printint(*argp++, 10, 1);
801006ab: 8d 46 04 lea 0x4(%esi),%eax
801006ae: b9 01 00 00 00 mov $0x1,%ecx
801006b3: 89 45 e4 mov %eax,-0x1c(%ebp)
801006b6: 8b 06 mov (%esi),%eax
801006b8: ba 0a 00 00 00 mov $0xa,%edx
801006bd: e8 ae fe ff ff call 80100570 <printint>
801006c2: 8b 75 e4 mov -0x1c(%ebp),%esi
if (fmt == 0)
panic("null fmt");
argp = (uint*)(void*)(&fmt + 1);
for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
801006c5: 83 c3 01 add $0x1,%ebx
801006c8: 0f b6 04 1f movzbl (%edi,%ebx,1),%eax
801006cc: 85 c0 test %eax,%eax
801006ce: 74 15 je 801006e5 <cprintf+0x95>
if(c != '%'){
801006d0: 83 f8 25 cmp $0x25,%eax
801006d3: 74 b3 je 80100688 <cprintf+0x38>
consputc('%');
break;
default:
// Print unknown % sequence to draw attention.
consputc('%');
consputc(c);
801006d5: e8 06 fd ff ff call 801003e0 <consputc>
if (fmt == 0)
panic("null fmt");
argp = (uint*)(void*)(&fmt + 1);
for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
801006da: 83 c3 01 add $0x1,%ebx
801006dd: 0f b6 04 1f movzbl (%edi,%ebx,1),%eax
801006e1: 85 c0 test %eax,%eax
801006e3: 75 eb jne 801006d0 <cprintf+0x80>
consputc(c);
break;
}
}
if(locking)
801006e5: 8b 45 e0 mov -0x20(%ebp),%eax
801006e8: 85 c0 test %eax,%eax
801006ea: 74 0c je 801006f8 <cprintf+0xa8>
release(&cons.lock);
801006ec: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp)
801006f3: e8 d8 3d 00 00 call 801044d0 <release>
}
801006f8: 83 c4 1c add $0x1c,%esp
801006fb: 5b pop %ebx
801006fc: 5e pop %esi
801006fd: 5f pop %edi
801006fe: 5d pop %ebp
801006ff: c3 ret
continue;
}
c = fmt[++i] & 0xff;
if(c == 0)
break;
switch(c){
80100700: 83 fa 73 cmp $0x73,%edx
80100703: 74 53 je 80100758 <cprintf+0x108>
80100705: 83 fa 78 cmp $0x78,%edx
80100708: 75 1e jne 80100728 <cprintf+0xd8>
case 'd':
printint(*argp++, 10, 1);
break;
case 'x':
case 'p':
printint(*argp++, 16, 0);
8010070a: 8d 46 04 lea 0x4(%esi),%eax
8010070d: 31 c9 xor %ecx,%ecx
8010070f: 89 45 e4 mov %eax,-0x1c(%ebp)
80100712: 8b 06 mov (%esi),%eax
80100714: ba 10 00 00 00 mov $0x10,%edx
80100719: e8 52 fe ff ff call 80100570 <printint>
8010071e: 8b 75 e4 mov -0x1c(%ebp),%esi
break;
80100721: eb a2 jmp 801006c5 <cprintf+0x75>
80100723: 90 nop
80100724: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
case '%':
consputc('%');
break;
default:
// Print unknown % sequence to draw attention.
consputc('%');
80100728: b8 25 00 00 00 mov $0x25,%eax
8010072d: 89 55 e4 mov %edx,-0x1c(%ebp)
80100730: e8 ab fc ff ff call 801003e0 <consputc>
consputc(c);
80100735: 8b 55 e4 mov -0x1c(%ebp),%edx
80100738: 89 d0 mov %edx,%eax
8010073a: e8 a1 fc ff ff call 801003e0 <consputc>
8010073f: eb 99 jmp 801006da <cprintf+0x8a>
80100741: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
s = "(null)";
for(; *s; s++)
consputc(*s);
break;
case '%':
consputc('%');
80100748: b8 25 00 00 00 mov $0x25,%eax
8010074d: e8 8e fc ff ff call 801003e0 <consputc>
break;
80100752: e9 6e ff ff ff jmp 801006c5 <cprintf+0x75>
80100757: 90 nop
case 'x':
case 'p':
printint(*argp++, 16, 0);
break;
case 's':
if((s = (char*)*argp++) == 0)
80100758: 8d 46 04 lea 0x4(%esi),%eax
8010075b: 8b 36 mov (%esi),%esi
8010075d: 89 45 e4 mov %eax,-0x1c(%ebp)
s = "(null)";
80100760: b8 00 70 10 80 mov $0x80107000,%eax
80100765: 85 f6 test %esi,%esi
80100767: 0f 44 f0 cmove %eax,%esi
for(; *s; s++)
8010076a: 0f be 06 movsbl (%esi),%eax
8010076d: 84 c0 test %al,%al
8010076f: 74 16 je 80100787 <cprintf+0x137>
80100771: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80100778: 83 c6 01 add $0x1,%esi
consputc(*s);
8010077b: e8 60 fc ff ff call 801003e0 <consputc>
printint(*argp++, 16, 0);
break;
case 's':
if((s = (char*)*argp++) == 0)
s = "(null)";
for(; *s; s++)
80100780: 0f be 06 movsbl (%esi),%eax
80100783: 84 c0 test %al,%al
80100785: 75 f1 jne 80100778 <cprintf+0x128>
case 'x':
case 'p':
printint(*argp++, 16, 0);
break;
case 's':
if((s = (char*)*argp++) == 0)
80100787: 8b 75 e4 mov -0x1c(%ebp),%esi
8010078a: e9 36 ff ff ff jmp 801006c5 <cprintf+0x75>
8010078f: 90 nop
uint *argp;
char *s;
locking = cons.locking;
if(locking)
acquire(&cons.lock);
80100790: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp)
80100797: e8 04 3c 00 00 call 801043a0 <acquire>
8010079c: e9 c8 fe ff ff jmp 80100669 <cprintf+0x19>
if (fmt == 0)
panic("null fmt");
801007a1: c7 04 24 07 70 10 80 movl $0x80107007,(%esp)
801007a8: e8 b3 fb ff ff call 80100360 <panic>
801007ad: 8d 76 00 lea 0x0(%esi),%esi
801007b0 <consoleintr>:
#define C(x) ((x)-'@') // Control-x
void
consoleintr(int (*getc)(void))
{
801007b0: 55 push %ebp
801007b1: 89 e5 mov %esp,%ebp
801007b3: 57 push %edi
801007b4: 56 push %esi
int c, doprocdump = 0;
801007b5: 31 f6 xor %esi,%esi
#define C(x) ((x)-'@') // Control-x
void
consoleintr(int (*getc)(void))
{
801007b7: 53 push %ebx
801007b8: 83 ec 1c sub $0x1c,%esp
801007bb: 8b 5d 08 mov 0x8(%ebp),%ebx
int c, doprocdump = 0;
acquire(&cons.lock);
801007be: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp)
801007c5: e8 d6 3b 00 00 call 801043a0 <acquire>
801007ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
while((c = getc()) >= 0){
801007d0: ff d3 call *%ebx
801007d2: 85 c0 test %eax,%eax
801007d4: 89 c7 mov %eax,%edi
801007d6: 78 48 js 80100820 <consoleintr+0x70>
switch(c){
801007d8: 83 ff 10 cmp $0x10,%edi
801007db: 0f 84 2f 01 00 00 je 80100910 <consoleintr+0x160>
801007e1: 7e 5d jle 80100840 <consoleintr+0x90>
801007e3: 83 ff 15 cmp $0x15,%edi
801007e6: 0f 84 d4 00 00 00 je 801008c0 <consoleintr+0x110>
801007ec: 83 ff 7f cmp $0x7f,%edi
801007ef: 90 nop
801007f0: 75 53 jne 80100845 <consoleintr+0x95>
input.e--;
consputc(BACKSPACE);
}
break;
case C('H'): case '\x7f': // Backspace
if(input.e != input.w){
801007f2: a1 c8 ff 10 80 mov 0x8010ffc8,%eax
801007f7: 3b 05 c4 ff 10 80 cmp 0x8010ffc4,%eax
801007fd: 74 d1 je 801007d0 <consoleintr+0x20>
input.e--;
801007ff: 83 e8 01 sub $0x1,%eax
80100802: a3 c8 ff 10 80 mov %eax,0x8010ffc8
consputc(BACKSPACE);
80100807: b8 00 01 00 00 mov $0x100,%eax
8010080c: e8 cf fb ff ff call 801003e0 <consputc>
consoleintr(int (*getc)(void))
{
int c, doprocdump = 0;
acquire(&cons.lock);
while((c = getc()) >= 0){
80100811: ff d3 call *%ebx
80100813: 85 c0 test %eax,%eax
80100815: 89 c7 mov %eax,%edi
80100817: 79 bf jns 801007d8 <consoleintr+0x28>
80100819: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
}
}
break;
}
}
release(&cons.lock);
80100820: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp)
80100827: e8 a4 3c 00 00 call 801044d0 <release>
if(doprocdump) {
8010082c: 85 f6 test %esi,%esi
8010082e: 0f 85 ec 00 00 00 jne 80100920 <consoleintr+0x170>
procdump(); // now call procdump() wo. cons.lock held
}
}
80100834: 83 c4 1c add $0x1c,%esp
80100837: 5b pop %ebx
80100838: 5e pop %esi
80100839: 5f pop %edi
8010083a: 5d pop %ebp
8010083b: c3 ret
8010083c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
{
int c, doprocdump = 0;
acquire(&cons.lock);
while((c = getc()) >= 0){
switch(c){
80100840: 83 ff 08 cmp $0x8,%edi
80100843: 74 ad je 801007f2 <consoleintr+0x42>
input.e--;
consputc(BACKSPACE);
}
break;
default:
if(c != 0 && input.e-input.r < INPUT_BUF){
80100845: 85 ff test %edi,%edi
80100847: 74 87 je 801007d0 <consoleintr+0x20>
80100849: a1 c8 ff 10 80 mov 0x8010ffc8,%eax
8010084e: 89 c2 mov %eax,%edx
80100850: 2b 15 c0 ff 10 80 sub 0x8010ffc0,%edx
80100856: 83 fa 7f cmp $0x7f,%edx
80100859: 0f 87 71 ff ff ff ja 801007d0 <consoleintr+0x20>
c = (c == '\r') ? '\n' : c;
input.buf[input.e++ % INPUT_BUF] = c;
8010085f: 8d 50 01 lea 0x1(%eax),%edx
80100862: 83 e0 7f and $0x7f,%eax
consputc(BACKSPACE);
}
break;
default:
if(c != 0 && input.e-input.r < INPUT_BUF){
c = (c == '\r') ? '\n' : c;
80100865: 83 ff 0d cmp $0xd,%edi
input.buf[input.e++ % INPUT_BUF] = c;
80100868: 89 15 c8 ff 10 80 mov %edx,0x8010ffc8
consputc(BACKSPACE);
}
break;
default:
if(c != 0 && input.e-input.r < INPUT_BUF){
c = (c == '\r') ? '\n' : c;
8010086e: 0f 84 b8 00 00 00 je 8010092c <consoleintr+0x17c>
input.buf[input.e++ % INPUT_BUF] = c;
80100874: 89 f9 mov %edi,%ecx
80100876: 88 88 40 ff 10 80 mov %cl,-0x7fef00c0(%eax)
consputc(c);
8010087c: 89 f8 mov %edi,%eax
8010087e: e8 5d fb ff ff call 801003e0 <consputc>
if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){
80100883: 83 ff 04 cmp $0x4,%edi
80100886: a1 c8 ff 10 80 mov 0x8010ffc8,%eax
8010088b: 74 19 je 801008a6 <consoleintr+0xf6>
8010088d: 83 ff 0a cmp $0xa,%edi
80100890: 74 14 je 801008a6 <consoleintr+0xf6>
80100892: 8b 0d c0 ff 10 80 mov 0x8010ffc0,%ecx
80100898: 8d 91 80 00 00 00 lea 0x80(%ecx),%edx
8010089e: 39 d0 cmp %edx,%eax
801008a0: 0f 85 2a ff ff ff jne 801007d0 <consoleintr+0x20>
input.w = input.e;
wakeup(&input.r);
801008a6: c7 04 24 c0 ff 10 80 movl $0x8010ffc0,(%esp)
if(c != 0 && input.e-input.r < INPUT_BUF){
c = (c == '\r') ? '\n' : c;
input.buf[input.e++ % INPUT_BUF] = c;
consputc(c);
if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){
input.w = input.e;
801008ad: a3 c4 ff 10 80 mov %eax,0x8010ffc4
wakeup(&input.r);
801008b2: e8 99 37 00 00 call 80104050 <wakeup>
801008b7: e9 14 ff ff ff jmp 801007d0 <consoleintr+0x20>
801008bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
case C('P'): // Process listing.
// procdump() locks cons.lock indirectly; invoke later
doprocdump = 1;
break;
case C('U'): // Kill line.
while(input.e != input.w &&
801008c0: a1 c8 ff 10 80 mov 0x8010ffc8,%eax
801008c5: 3b 05 c4 ff 10 80 cmp 0x8010ffc4,%eax
801008cb: 75 2b jne 801008f8 <consoleintr+0x148>
801008cd: e9 fe fe ff ff jmp 801007d0 <consoleintr+0x20>
801008d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
input.buf[(input.e-1) % INPUT_BUF] != '\n'){
input.e--;
801008d8: a3 c8 ff 10 80 mov %eax,0x8010ffc8
consputc(BACKSPACE);
801008dd: b8 00 01 00 00 mov $0x100,%eax
801008e2: e8 f9 fa ff ff call 801003e0 <consputc>
case C('P'): // Process listing.
// procdump() locks cons.lock indirectly; invoke later
doprocdump = 1;
break;
case C('U'): // Kill line.
while(input.e != input.w &&
801008e7: a1 c8 ff 10 80 mov 0x8010ffc8,%eax
801008ec: 3b 05 c4 ff 10 80 cmp 0x8010ffc4,%eax
801008f2: 0f 84 d8 fe ff ff je 801007d0 <consoleintr+0x20>
input.buf[(input.e-1) % INPUT_BUF] != '\n'){
801008f8: 83 e8 01 sub $0x1,%eax
801008fb: 89 c2 mov %eax,%edx
801008fd: 83 e2 7f and $0x7f,%edx
case C('P'): // Process listing.
// procdump() locks cons.lock indirectly; invoke later
doprocdump = 1;
break;
case C('U'): // Kill line.
while(input.e != input.w &&
80100900: 80 ba 40 ff 10 80 0a cmpb $0xa,-0x7fef00c0(%edx)
80100907: 75 cf jne 801008d8 <consoleintr+0x128>
80100909: e9 c2 fe ff ff jmp 801007d0 <consoleintr+0x20>
8010090e: 66 90 xchg %ax,%ax
acquire(&cons.lock);
while((c = getc()) >= 0){
switch(c){
case C('P'): // Process listing.
// procdump() locks cons.lock indirectly; invoke later
doprocdump = 1;
80100910: be 01 00 00 00 mov $0x1,%esi
80100915: e9 b6 fe ff ff jmp 801007d0 <consoleintr+0x20>
8010091a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
}
release(&cons.lock);
if(doprocdump) {
procdump(); // now call procdump() wo. cons.lock held
}
}
80100920: 83 c4 1c add $0x1c,%esp
80100923: 5b pop %ebx
80100924: 5e pop %esi
80100925: 5f pop %edi
80100926: 5d pop %ebp
break;
}
}
release(&cons.lock);
if(doprocdump) {
procdump(); // now call procdump() wo. cons.lock held
80100927: e9 14 38 00 00 jmp 80104140 <procdump>
}
break;
default:
if(c != 0 && input.e-input.r < INPUT_BUF){
c = (c == '\r') ? '\n' : c;
input.buf[input.e++ % INPUT_BUF] = c;
8010092c: c6 80 40 ff 10 80 0a movb $0xa,-0x7fef00c0(%eax)
consputc(c);
80100933: b8 0a 00 00 00 mov $0xa,%eax
80100938: e8 a3 fa ff ff call 801003e0 <consputc>
8010093d: a1 c8 ff 10 80 mov 0x8010ffc8,%eax
80100942: e9 5f ff ff ff jmp 801008a6 <consoleintr+0xf6>
80100947: 89 f6 mov %esi,%esi
80100949: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80100950 <consoleinit>:
return n;
}
void
consoleinit(void)
{
80100950: 55 push %ebp
80100951: 89 e5 mov %esp,%ebp
80100953: 83 ec 18 sub $0x18,%esp
initlock(&cons.lock, "console");
80100956: c7 44 24 04 10 70 10 movl $0x80107010,0x4(%esp)
8010095d: 80
8010095e: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp)
80100965: e8 b6 39 00 00 call 80104320 <initlock>
devsw[CONSOLE].write = consolewrite;
devsw[CONSOLE].read = consoleread;
cons.locking = 1;
picenable(IRQ_KBD);
8010096a: c7 04 24 01 00 00 00 movl $0x1,(%esp)
void
consoleinit(void)
{
initlock(&cons.lock, "console");
devsw[CONSOLE].write = consolewrite;
80100971: c7 05 8c 09 11 80 f0 movl $0x801005f0,0x8011098c
80100978: 05 10 80
devsw[CONSOLE].read = consoleread;
8010097b: c7 05 88 09 11 80 70 movl $0x80100270,0x80110988
80100982: 02 10 80
cons.locking = 1;
80100985: c7 05 54 a5 10 80 01 movl $0x1,0x8010a554
8010098c: 00 00 00
picenable(IRQ_KBD);
8010098f: e8 6c 28 00 00 call 80103200 <picenable>
ioapicenable(IRQ_KBD, 0);
80100994: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
8010099b: 00
8010099c: c7 04 24 01 00 00 00 movl $0x1,(%esp)
801009a3: e8 08 19 00 00 call 801022b0 <ioapicenable>
}
801009a8: c9 leave
801009a9: c3 ret
801009aa: 66 90 xchg %ax,%ax
801009ac: 66 90 xchg %ax,%ax
801009ae: 66 90 xchg %ax,%ax
801009b0 <exec>:
#include "x86.h"
#include "elf.h"
int
exec(char *path, char **argv)
{
801009b0: 55 push %ebp
801009b1: 89 e5 mov %esp,%ebp
801009b3: 57 push %edi
801009b4: 56 push %esi
801009b5: 53 push %ebx
801009b6: 81 ec 1c 01 00 00 sub $0x11c,%esp
struct elfhdr elf;
struct inode *ip;
struct proghdr ph;
pde_t *pgdir, *oldpgdir;
begin_op();
801009bc: e8 cf 21 00 00 call 80102b90 <begin_op>
if((ip = namei(path)) == 0){
801009c1: 8b 45 08 mov 0x8(%ebp),%eax
801009c4: 89 04 24 mov %eax,(%esp)
801009c7: e8 24 15 00 00 call 80101ef0 <namei>
801009cc: 85 c0 test %eax,%eax
801009ce: 89 c3 mov %eax,%ebx
801009d0: 74 37 je 80100a09 <exec+0x59>
end_op();
return -1;
}
ilock(ip);
801009d2: 89 04 24 mov %eax,(%esp)
801009d5: e8 e6 0c 00 00 call 801016c0 <ilock>
pgdir = 0;
// Check ELF header
if(readi(ip, (char*)&elf, 0, sizeof(elf)) != sizeof(elf))
801009da: 8d 85 24 ff ff ff lea -0xdc(%ebp),%eax
801009e0: c7 44 24 0c 34 00 00 movl $0x34,0xc(%esp)
801009e7: 00
801009e8: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
801009ef: 00
801009f0: 89 44 24 04 mov %eax,0x4(%esp)
801009f4: 89 1c 24 mov %ebx,(%esp)
801009f7: e8 54 0f 00 00 call 80101950 <readi>
801009fc: 83 f8 34 cmp $0x34,%eax
801009ff: 74 1f je 80100a20 <exec+0x70>
bad:
if(pgdir)
freevm(pgdir);
if(ip){
iunlockput(ip);
80100a01: 89 1c 24 mov %ebx,(%esp)
80100a04: e8 f7 0e 00 00 call 80101900 <iunlockput>
end_op();
80100a09: e8 f2 21 00 00 call 80102c00 <end_op>
}
return -1;
80100a0e: b8 ff ff ff ff mov $0xffffffff,%eax
}
80100a13: 81 c4 1c 01 00 00 add $0x11c,%esp
80100a19: 5b pop %ebx
80100a1a: 5e pop %esi
80100a1b: 5f pop %edi
80100a1c: 5d pop %ebp
80100a1d: c3 ret
80100a1e: 66 90 xchg %ax,%ax
pgdir = 0;
// Check ELF header
if(readi(ip, (char*)&elf, 0, sizeof(elf)) != sizeof(elf))
goto bad;
if(elf.magic != ELF_MAGIC)
80100a20: 81 bd 24 ff ff ff 7f cmpl $0x464c457f,-0xdc(%ebp)
80100a27: 45 4c 46
80100a2a: 75 d5 jne 80100a01 <exec+0x51>
goto bad;
if((pgdir = setupkvm()) == 0)
80100a2c: e8 1f 5f 00 00 call 80106950 <setupkvm>
80100a31: 85 c0 test %eax,%eax
80100a33: 89 85 f4 fe ff ff mov %eax,-0x10c(%ebp)
80100a39: 74 c6 je 80100a01 <exec+0x51>
goto bad;
// Load program into memory.
sz = 0;
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
80100a3b: 66 83 bd 50 ff ff ff cmpw $0x0,-0xb0(%ebp)
80100a42: 00
80100a43: 8b b5 40 ff ff ff mov -0xc0(%ebp),%esi
if((pgdir = setupkvm()) == 0)
goto bad;
// Load program into memory.
sz = 0;
80100a49: c7 85 f0 fe ff ff 00 movl $0x0,-0x110(%ebp)
80100a50: 00 00 00
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
80100a53: 0f 84 da 00 00 00 je 80100b33 <exec+0x183>
80100a59: 31 ff xor %edi,%edi
80100a5b: eb 18 jmp 80100a75 <exec+0xc5>
80100a5d: 8d 76 00 lea 0x0(%esi),%esi
80100a60: 0f b7 85 50 ff ff ff movzwl -0xb0(%ebp),%eax
80100a67: 83 c7 01 add $0x1,%edi
80100a6a: 83 c6 20 add $0x20,%esi
80100a6d: 39 f8 cmp %edi,%eax
80100a6f: 0f 8e be 00 00 00 jle 80100b33 <exec+0x183>
if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph))
80100a75: 8d 85 04 ff ff ff lea -0xfc(%ebp),%eax
80100a7b: c7 44 24 0c 20 00 00 movl $0x20,0xc(%esp)
80100a82: 00
80100a83: 89 74 24 08 mov %esi,0x8(%esp)
80100a87: 89 44 24 04 mov %eax,0x4(%esp)
80100a8b: 89 1c 24 mov %ebx,(%esp)
80100a8e: e8 bd 0e 00 00 call 80101950 <readi>
80100a93: 83 f8 20 cmp $0x20,%eax
80100a96: 0f 85 84 00 00 00 jne 80100b20 <exec+0x170>
goto bad;
if(ph.type != ELF_PROG_LOAD)
80100a9c: 83 bd 04 ff ff ff 01 cmpl $0x1,-0xfc(%ebp)
80100aa3: 75 bb jne 80100a60 <exec+0xb0>
continue;
if(ph.memsz < ph.filesz)
80100aa5: 8b 85 18 ff ff ff mov -0xe8(%ebp),%eax
80100aab: 3b 85 14 ff ff ff cmp -0xec(%ebp),%eax
80100ab1: 72 6d jb 80100b20 <exec+0x170>
goto bad;
if(ph.vaddr + ph.memsz < ph.vaddr)
80100ab3: 03 85 0c ff ff ff add -0xf4(%ebp),%eax
80100ab9: 72 65 jb 80100b20 <exec+0x170>
goto bad;
if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0)
80100abb: 89 44 24 08 mov %eax,0x8(%esp)
80100abf: 8b 85 f0 fe ff ff mov -0x110(%ebp),%eax
80100ac5: 89 44 24 04 mov %eax,0x4(%esp)
80100ac9: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax
80100acf: 89 04 24 mov %eax,(%esp)
80100ad2: e8 49 61 00 00 call 80106c20 <allocuvm>
80100ad7: 85 c0 test %eax,%eax
80100ad9: 89 85 f0 fe ff ff mov %eax,-0x110(%ebp)
80100adf: 74 3f je 80100b20 <exec+0x170>
goto bad;
if(ph.vaddr % PGSIZE != 0)
80100ae1: 8b 85 0c ff ff ff mov -0xf4(%ebp),%eax
80100ae7: a9 ff 0f 00 00 test $0xfff,%eax
80100aec: 75 32 jne 80100b20 <exec+0x170>
goto bad;
if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
80100aee: 8b 95 14 ff ff ff mov -0xec(%ebp),%edx
80100af4: 89 44 24 04 mov %eax,0x4(%esp)
80100af8: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax
80100afe: 89 5c 24 08 mov %ebx,0x8(%esp)
80100b02: 89 54 24 10 mov %edx,0x10(%esp)
80100b06: 8b 95 08 ff ff ff mov -0xf8(%ebp),%edx
80100b0c: 89 04 24 mov %eax,(%esp)
80100b0f: 89 54 24 0c mov %edx,0xc(%esp)
80100b13: e8 48 60 00 00 call 80106b60 <loaduvm>
80100b18: 85 c0 test %eax,%eax
80100b1a: 0f 89 40 ff ff ff jns 80100a60 <exec+0xb0>
freevm(oldpgdir);
return 0;
bad:
if(pgdir)
freevm(pgdir);
80100b20: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax
80100b26: 89 04 24 mov %eax,(%esp)
80100b29: e8 02 62 00 00 call 80106d30 <freevm>
80100b2e: e9 ce fe ff ff jmp 80100a01 <exec+0x51>
if(ph.vaddr % PGSIZE != 0)
goto bad;
if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
goto bad;
}
iunlockput(ip);
80100b33: 89 1c 24 mov %ebx,(%esp)
80100b36: e8 c5 0d 00 00 call 80101900 <iunlockput>
80100b3b: 90 nop
80100b3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
end_op();
80100b40: e8 bb 20 00 00 call 80102c00 <end_op>
ip = 0;
// Allocate two pages at the next page boundary.
// Make the first inaccessible. Use the second as the user stack.
sz = PGROUNDUP(sz);
80100b45: 8b 85 f0 fe ff ff mov -0x110(%ebp),%eax
80100b4b: 05 ff 0f 00 00 add $0xfff,%eax
80100b50: 25 00 f0 ff ff and $0xfffff000,%eax
if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0)
80100b55: 8d 90 00 20 00 00 lea 0x2000(%eax),%edx
80100b5b: 89 44 24 04 mov %eax,0x4(%esp)
80100b5f: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax
80100b65: 89 54 24 08 mov %edx,0x8(%esp)
80100b69: 89 04 24 mov %eax,(%esp)
80100b6c: e8 af 60 00 00 call 80106c20 <allocuvm>
80100b71: 85 c0 test %eax,%eax
80100b73: 89 85 ec fe ff ff mov %eax,-0x114(%ebp)
80100b79: 75 18 jne 80100b93 <exec+0x1e3>
freevm(oldpgdir);
return 0;
bad:
if(pgdir)
freevm(pgdir);
80100b7b: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax
80100b81: 89 04 24 mov %eax,(%esp)
80100b84: e8 a7 61 00 00 call 80106d30 <freevm>
if(ip){
iunlockput(ip);
end_op();
}
return -1;
80100b89: b8 ff ff ff ff mov $0xffffffff,%eax
80100b8e: e9 80 fe ff ff jmp 80100a13 <exec+0x63>
// Allocate two pages at the next page boundary.
// Make the first inaccessible. Use the second as the user stack.
sz = PGROUNDUP(sz);
if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0)
goto bad;
clearpteu(pgdir, (char*)(sz - 2*PGSIZE));
80100b93: 8b 9d ec fe ff ff mov -0x114(%ebp),%ebx
80100b99: 89 d8 mov %ebx,%eax
80100b9b: 2d 00 20 00 00 sub $0x2000,%eax
80100ba0: 89 44 24 04 mov %eax,0x4(%esp)
80100ba4: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax
80100baa: 89 04 24 mov %eax,(%esp)
80100bad: e8 fe 61 00 00 call 80106db0 <clearpteu>
sp = sz;
// Push argument strings, prepare rest of stack in ustack.
for(argc = 0; argv[argc]; argc++) {
80100bb2: 8b 45 0c mov 0xc(%ebp),%eax
80100bb5: 8b 00 mov (%eax),%eax
80100bb7: 85 c0 test %eax,%eax
80100bb9: 0f 84 70 01 00 00 je 80100d2f <exec+0x37f>
80100bbf: 8b 7d 0c mov 0xc(%ebp),%edi
80100bc2: 31 f6 xor %esi,%esi
80100bc4: 8b 4d 0c mov 0xc(%ebp),%ecx
80100bc7: 89 f2 mov %esi,%edx
80100bc9: 89 fe mov %edi,%esi
80100bcb: 89 d7 mov %edx,%edi
80100bcd: 83 c1 04 add $0x4,%ecx
80100bd0: eb 0e jmp 80100be0 <exec+0x230>
80100bd2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80100bd8: 83 c1 04 add $0x4,%ecx
if(argc >= MAXARG)
80100bdb: 83 ff 20 cmp $0x20,%edi
80100bde: 74 9b je 80100b7b <exec+0x1cb>
goto bad;
sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
80100be0: 89 04 24 mov %eax,(%esp)
80100be3: 89 8d f0 fe ff ff mov %ecx,-0x110(%ebp)
80100be9: e8 72 3b 00 00 call 80104760 <strlen>
80100bee: f7 d0 not %eax
80100bf0: 01 c3 add %eax,%ebx
if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
80100bf2: 8b 06 mov (%esi),%eax
// Push argument strings, prepare rest of stack in ustack.
for(argc = 0; argv[argc]; argc++) {
if(argc >= MAXARG)
goto bad;
sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
80100bf4: 83 e3 fc and $0xfffffffc,%ebx
if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
80100bf7: 89 04 24 mov %eax,(%esp)
80100bfa: e8 61 3b 00 00 call 80104760 <strlen>
80100bff: 83 c0 01 add $0x1,%eax
80100c02: 89 44 24 0c mov %eax,0xc(%esp)
80100c06: 8b 06 mov (%esi),%eax
80100c08: 89 5c 24 04 mov %ebx,0x4(%esp)
80100c0c: 89 44 24 08 mov %eax,0x8(%esp)
80100c10: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax
80100c16: 89 04 24 mov %eax,(%esp)
80100c19: e8 f2 62 00 00 call 80106f10 <copyout>
80100c1e: 85 c0 test %eax,%eax
80100c20: 0f 88 55 ff ff ff js 80100b7b <exec+0x1cb>
goto bad;
clearpteu(pgdir, (char*)(sz - 2*PGSIZE));
sp = sz;
// Push argument strings, prepare rest of stack in ustack.
for(argc = 0; argv[argc]; argc++) {
80100c26: 8b 8d f0 fe ff ff mov -0x110(%ebp),%ecx
if(argc >= MAXARG)
goto bad;
sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
goto bad;
ustack[3+argc] = sp;
80100c2c: 8d 95 58 ff ff ff lea -0xa8(%ebp),%edx
80100c32: 89 9c bd 64 ff ff ff mov %ebx,-0x9c(%ebp,%edi,4)
goto bad;
clearpteu(pgdir, (char*)(sz - 2*PGSIZE));
sp = sz;
// Push argument strings, prepare rest of stack in ustack.
for(argc = 0; argv[argc]; argc++) {
80100c39: 83 c7 01 add $0x1,%edi
80100c3c: 8b 01 mov (%ecx),%eax
80100c3e: 89 ce mov %ecx,%esi
80100c40: 85 c0 test %eax,%eax
80100c42: 75 94 jne 80100bd8 <exec+0x228>
80100c44: 89 fe mov %edi,%esi
}
ustack[3+argc] = 0;
ustack[0] = 0xffffffff; // fake return PC
ustack[1] = argc;
ustack[2] = sp - (argc+1)*4; // argv pointer
80100c46: 8d 04 b5 04 00 00 00 lea 0x4(,%esi,4),%eax
80100c4d: 89 d9 mov %ebx,%ecx
80100c4f: 29 c1 sub %eax,%ecx
sp -= (3+argc+1) * 4;
80100c51: 83 c0 0c add $0xc,%eax
80100c54: 29 c3 sub %eax,%ebx
if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
80100c56: 89 44 24 0c mov %eax,0xc(%esp)
80100c5a: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax
80100c60: 89 54 24 08 mov %edx,0x8(%esp)
80100c64: 89 5c 24 04 mov %ebx,0x4(%esp)
sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
goto bad;
ustack[3+argc] = sp;
}
ustack[3+argc] = 0;
80100c68: c7 84 b5 64 ff ff ff movl $0x0,-0x9c(%ebp,%esi,4)
80100c6f: 00 00 00 00
ustack[0] = 0xffffffff; // fake return PC
ustack[1] = argc;
ustack[2] = sp - (argc+1)*4; // argv pointer
sp -= (3+argc+1) * 4;
if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
80100c73: 89 04 24 mov %eax,(%esp)
goto bad;
ustack[3+argc] = sp;
}
ustack[3+argc] = 0;
ustack[0] = 0xffffffff; // fake return PC
80100c76: c7 85 58 ff ff ff ff movl $0xffffffff,-0xa8(%ebp)
80100c7d: ff ff ff
ustack[1] = argc;
80100c80: 89 b5 5c ff ff ff mov %esi,-0xa4(%ebp)
ustack[2] = sp - (argc+1)*4; // argv pointer
80100c86: 89 8d 60 ff ff ff mov %ecx,-0xa0(%ebp)
sp -= (3+argc+1) * 4;
if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
80100c8c: e8 7f 62 00 00 call 80106f10 <copyout>
80100c91: 85 c0 test %eax,%eax
80100c93: 0f 88 e2 fe ff ff js 80100b7b <exec+0x1cb>
goto bad;
// Save program name for debugging.
for(last=s=path; *s; s++)
80100c99: 8b 45 08 mov 0x8(%ebp),%eax
80100c9c: 0f b6 10 movzbl (%eax),%edx
80100c9f: 84 d2 test %dl,%dl
80100ca1: 74 19 je 80100cbc <exec+0x30c>
80100ca3: 8b 4d 08 mov 0x8(%ebp),%ecx
80100ca6: 83 c0 01 add $0x1,%eax
if(*s == '/')
last = s+1;
80100ca9: 80 fa 2f cmp $0x2f,%dl
sp -= (3+argc+1) * 4;
if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
goto bad;
// Save program name for debugging.
for(last=s=path; *s; s++)
80100cac: 0f b6 10 movzbl (%eax),%edx
if(*s == '/')
last = s+1;
80100caf: 0f 44 c8 cmove %eax,%ecx
80100cb2: 83 c0 01 add $0x1,%eax
sp -= (3+argc+1) * 4;
if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
goto bad;
// Save program name for debugging.
for(last=s=path; *s; s++)
80100cb5: 84 d2 test %dl,%dl
80100cb7: 75 f0 jne 80100ca9 <exec+0x2f9>
80100cb9: 89 4d 08 mov %ecx,0x8(%ebp)
if(*s == '/')
last = s+1;
safestrcpy(proc->name, last, sizeof(proc->name));
80100cbc: 8b 45 08 mov 0x8(%ebp),%eax
80100cbf: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
80100cc6: 00
80100cc7: 89 44 24 04 mov %eax,0x4(%esp)
80100ccb: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100cd1: 83 c0 6c add $0x6c,%eax
80100cd4: 89 04 24 mov %eax,(%esp)
80100cd7: e8 44 3a 00 00 call 80104720 <safestrcpy>
// Commit to the user image.
oldpgdir = proc->pgdir;
80100cdc: 65 a1 04 00 00 00 mov %gs:0x4,%eax
proc->pgdir = pgdir;
80100ce2: 8b 8d f4 fe ff ff mov -0x10c(%ebp),%ecx
if(*s == '/')
last = s+1;
safestrcpy(proc->name, last, sizeof(proc->name));
// Commit to the user image.
oldpgdir = proc->pgdir;
80100ce8: 8b 70 04 mov 0x4(%eax),%esi
proc->pgdir = pgdir;
80100ceb: 89 48 04 mov %ecx,0x4(%eax)
proc->sz = sz;
80100cee: 8b 8d ec fe ff ff mov -0x114(%ebp),%ecx
80100cf4: 89 08 mov %ecx,(%eax)
proc->tf->eip = elf.entry; // main
80100cf6: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100cfc: 8b 8d 3c ff ff ff mov -0xc4(%ebp),%ecx
80100d02: 8b 50 18 mov 0x18(%eax),%edx
80100d05: 89 4a 38 mov %ecx,0x38(%edx)
proc->tf->esp = sp;
80100d08: 8b 50 18 mov 0x18(%eax),%edx
80100d0b: 89 5a 44 mov %ebx,0x44(%edx)
proc -> length_of_job =2 ; ///sanidhya has added it
80100d0e: c7 80 8c 00 00 00 02 movl $0x2,0x8c(%eax)
80100d15: 00 00 00
switchuvm(proc);
80100d18: 89 04 24 mov %eax,(%esp)
80100d1b: e8 f0 5c 00 00 call 80106a10 <switchuvm>
freevm(oldpgdir);
80100d20: 89 34 24 mov %esi,(%esp)
80100d23: e8 08 60 00 00 call 80106d30 <freevm>
return 0;
80100d28: 31 c0 xor %eax,%eax
80100d2a: e9 e4 fc ff ff jmp 80100a13 <exec+0x63>
goto bad;
clearpteu(pgdir, (char*)(sz - 2*PGSIZE));
sp = sz;
// Push argument strings, prepare rest of stack in ustack.
for(argc = 0; argv[argc]; argc++) {
80100d2f: 8b 9d ec fe ff ff mov -0x114(%ebp),%ebx
80100d35: 31 f6 xor %esi,%esi
80100d37: 8d 95 58 ff ff ff lea -0xa8(%ebp),%edx
80100d3d: e9 04 ff ff ff jmp 80100c46 <exec+0x296>
80100d42: 66 90 xchg %ax,%ax
80100d44: 66 90 xchg %ax,%ax
80100d46: 66 90 xchg %ax,%ax
80100d48: 66 90 xchg %ax,%ax
80100d4a: 66 90 xchg %ax,%ax
80100d4c: 66 90 xchg %ax,%ax
80100d4e: 66 90 xchg %ax,%ax
80100d50 <fileinit>:
struct file file[NFILE];
} ftable;
void
fileinit(void)
{
80100d50: 55 push %ebp
80100d51: 89 e5 mov %esp,%ebp
80100d53: 83 ec 18 sub $0x18,%esp
initlock(&ftable.lock, "ftable");
80100d56: c7 44 24 04 29 70 10 movl $0x80107029,0x4(%esp)
80100d5d: 80
80100d5e: c7 04 24 e0 ff 10 80 movl $0x8010ffe0,(%esp)
80100d65: e8 b6 35 00 00 call 80104320 <initlock>
}
80100d6a: c9 leave
80100d6b: c3 ret
80100d6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80100d70 <filealloc>:
// Allocate a file structure.
struct file*
filealloc(void)
{
80100d70: 55 push %ebp
80100d71: 89 e5 mov %esp,%ebp
80100d73: 53 push %ebx
struct file *f;
acquire(&ftable.lock);
for(f = ftable.file; f < ftable.file + NFILE; f++){
80100d74: bb 14 00 11 80 mov $0x80110014,%ebx
}
// Allocate a file structure.
struct file*
filealloc(void)
{
80100d79: 83 ec 14 sub $0x14,%esp
struct file *f;
acquire(&ftable.lock);
80100d7c: c7 04 24 e0 ff 10 80 movl $0x8010ffe0,(%esp)
80100d83: e8 18 36 00 00 call 801043a0 <acquire>
80100d88: eb 11 jmp 80100d9b <filealloc+0x2b>
80100d8a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
for(f = ftable.file; f < ftable.file + NFILE; f++){
80100d90: 83 c3 18 add $0x18,%ebx
80100d93: 81 fb 74 09 11 80 cmp $0x80110974,%ebx
80100d99: 74 25 je 80100dc0 <filealloc+0x50>
if(f->ref == 0){
80100d9b: 8b 43 04 mov 0x4(%ebx),%eax
80100d9e: 85 c0 test %eax,%eax
80100da0: 75 ee jne 80100d90 <filealloc+0x20>
f->ref = 1;
release(&ftable.lock);
80100da2: c7 04 24 e0 ff 10 80 movl $0x8010ffe0,(%esp)
struct file *f;
acquire(&ftable.lock);
for(f = ftable.file; f < ftable.file + NFILE; f++){
if(f->ref == 0){
f->ref = 1;
80100da9: c7 43 04 01 00 00 00 movl $0x1,0x4(%ebx)
release(&ftable.lock);
80100db0: e8 1b 37 00 00 call 801044d0 <release>
return f;
}
}
release(&ftable.lock);
return 0;
}
80100db5: 83 c4 14 add $0x14,%esp
acquire(&ftable.lock);
for(f = ftable.file; f < ftable.file + NFILE; f++){
if(f->ref == 0){
f->ref = 1;
release(&ftable.lock);
return f;
80100db8: 89 d8 mov %ebx,%eax
}
}
release(&ftable.lock);
return 0;
}
80100dba: 5b pop %ebx
80100dbb: 5d pop %ebp
80100dbc: c3 ret
80100dbd: 8d 76 00 lea 0x0(%esi),%esi
f->ref = 1;
release(&ftable.lock);
return f;
}
}
release(&ftable.lock);
80100dc0: c7 04 24 e0 ff 10 80 movl $0x8010ffe0,(%esp)
80100dc7: e8 04 37 00 00 call 801044d0 <release>
return 0;
}
80100dcc: 83 c4 14 add $0x14,%esp
release(&ftable.lock);
return f;
}
}
release(&ftable.lock);
return 0;
80100dcf: 31 c0 xor %eax,%eax
}
80100dd1: 5b pop %ebx
80100dd2: 5d pop %ebp
80100dd3: c3 ret
80100dd4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80100dda: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80100de0 <filedup>:
// Increment ref count for file f.
struct file*
filedup(struct file *f)
{
80100de0: 55 push %ebp
80100de1: 89 e5 mov %esp,%ebp
80100de3: 53 push %ebx
80100de4: 83 ec 14 sub $0x14,%esp
80100de7: 8b 5d 08 mov 0x8(%ebp),%ebx
acquire(&ftable.lock);
80100dea: c7 04 24 e0 ff 10 80 movl $0x8010ffe0,(%esp)
80100df1: e8 aa 35 00 00 call 801043a0 <acquire>
if(f->ref < 1)
80100df6: 8b 43 04 mov 0x4(%ebx),%eax
80100df9: 85 c0 test %eax,%eax
80100dfb: 7e 1a jle 80100e17 <filedup+0x37>
panic("filedup");
f->ref++;
80100dfd: 83 c0 01 add $0x1,%eax
80100e00: 89 43 04 mov %eax,0x4(%ebx)
release(&ftable.lock);
80100e03: c7 04 24 e0 ff 10 80 movl $0x8010ffe0,(%esp)
80100e0a: e8 c1 36 00 00 call 801044d0 <release>
return f;
}
80100e0f: 83 c4 14 add $0x14,%esp
80100e12: 89 d8 mov %ebx,%eax
80100e14: 5b pop %ebx
80100e15: 5d pop %ebp
80100e16: c3 ret
struct file*
filedup(struct file *f)
{
acquire(&ftable.lock);
if(f->ref < 1)
panic("filedup");
80100e17: c7 04 24 30 70 10 80 movl $0x80107030,(%esp)
80100e1e: e8 3d f5 ff ff call 80100360 <panic>
80100e23: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80100e29: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80100e30 <fileclose>:
}
// Close file f. (Decrement ref count, close when reaches 0.)
void
fileclose(struct file *f)
{
80100e30: 55 push %ebp
80100e31: 89 e5 mov %esp,%ebp
80100e33: 57 push %edi
80100e34: 56 push %esi
80100e35: 53 push %ebx
80100e36: 83 ec 1c sub $0x1c,%esp
80100e39: 8b 7d 08 mov 0x8(%ebp),%edi
struct file ff;
acquire(&ftable.lock);
80100e3c: c7 04 24 e0 ff 10 80 movl $0x8010ffe0,(%esp)
80100e43: e8 58 35 00 00 call 801043a0 <acquire>
if(f->ref < 1)
80100e48: 8b 57 04 mov 0x4(%edi),%edx
80100e4b: 85 d2 test %edx,%edx
80100e4d: 0f 8e 89 00 00 00 jle 80100edc <fileclose+0xac>
panic("fileclose");
if(--f->ref > 0){
80100e53: 83 ea 01 sub $0x1,%edx
80100e56: 85 d2 test %edx,%edx
80100e58: 89 57 04 mov %edx,0x4(%edi)
80100e5b: 74 13 je 80100e70 <fileclose+0x40>
release(&ftable.lock);
80100e5d: c7 45 08 e0 ff 10 80 movl $0x8010ffe0,0x8(%ebp)
else if(ff.type == FD_INODE){
begin_op();
iput(ff.ip);
end_op();
}
}
80100e64: 83 c4 1c add $0x1c,%esp
80100e67: 5b pop %ebx
80100e68: 5e pop %esi
80100e69: 5f pop %edi
80100e6a: 5d pop %ebp
acquire(&ftable.lock);
if(f->ref < 1)
panic("fileclose");
if(--f->ref > 0){
release(&ftable.lock);
80100e6b: e9 60 36 00 00 jmp 801044d0 <release>
return;
}
ff = *f;
80100e70: 0f b6 47 09 movzbl 0x9(%edi),%eax
80100e74: 8b 37 mov (%edi),%esi
80100e76: 8b 5f 0c mov 0xc(%edi),%ebx
f->ref = 0;
f->type = FD_NONE;
80100e79: c7 07 00 00 00 00 movl $0x0,(%edi)
panic("fileclose");
if(--f->ref > 0){
release(&ftable.lock);
return;
}
ff = *f;
80100e7f: 88 45 e7 mov %al,-0x19(%ebp)
80100e82: 8b 47 10 mov 0x10(%edi),%eax
f->ref = 0;
f->type = FD_NONE;
release(&ftable.lock);
80100e85: c7 04 24 e0 ff 10 80 movl $0x8010ffe0,(%esp)
panic("fileclose");
if(--f->ref > 0){
release(&ftable.lock);
return;
}
ff = *f;
80100e8c: 89 45 e0 mov %eax,-0x20(%ebp)
f->ref = 0;
f->type = FD_NONE;
release(&ftable.lock);
80100e8f: e8 3c 36 00 00 call 801044d0 <release>
if(ff.type == FD_PIPE)
80100e94: 83 fe 01 cmp $0x1,%esi
80100e97: 74 0f je 80100ea8 <fileclose+0x78>
pipeclose(ff.pipe, ff.writable);
else if(ff.type == FD_INODE){
80100e99: 83 fe 02 cmp $0x2,%esi
80100e9c: 74 22 je 80100ec0 <fileclose+0x90>
begin_op();
iput(ff.ip);
end_op();
}
}
80100e9e: 83 c4 1c add $0x1c,%esp
80100ea1: 5b pop %ebx
80100ea2: 5e pop %esi
80100ea3: 5f pop %edi
80100ea4: 5d pop %ebp
80100ea5: c3 ret
80100ea6: 66 90 xchg %ax,%ax
f->ref = 0;
f->type = FD_NONE;
release(&ftable.lock);
if(ff.type == FD_PIPE)
pipeclose(ff.pipe, ff.writable);
80100ea8: 0f be 75 e7 movsbl -0x19(%ebp),%esi
80100eac: 89 1c 24 mov %ebx,(%esp)
80100eaf: 89 74 24 04 mov %esi,0x4(%esp)
80100eb3: e8 08 25 00 00 call 801033c0 <pipeclose>
80100eb8: eb e4 jmp 80100e9e <fileclose+0x6e>
80100eba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
else if(ff.type == FD_INODE){
begin_op();
80100ec0: e8 cb 1c 00 00 call 80102b90 <begin_op>
iput(ff.ip);
80100ec5: 8b 45 e0 mov -0x20(%ebp),%eax
80100ec8: 89 04 24 mov %eax,(%esp)
80100ecb: e8 00 09 00 00 call 801017d0 <iput>
end_op();
}
}
80100ed0: 83 c4 1c add $0x1c,%esp
80100ed3: 5b pop %ebx
80100ed4: 5e pop %esi
80100ed5: 5f pop %edi
80100ed6: 5d pop %ebp
if(ff.type == FD_PIPE)
pipeclose(ff.pipe, ff.writable);
else if(ff.type == FD_INODE){
begin_op();
iput(ff.ip);
end_op();
80100ed7: e9 24 1d 00 00 jmp 80102c00 <end_op>
{
struct file ff;
acquire(&ftable.lock);
if(f->ref < 1)
panic("fileclose");
80100edc: c7 04 24 38 70 10 80 movl $0x80107038,(%esp)
80100ee3: e8 78 f4 ff ff call 80100360 <panic>
80100ee8: 90 nop
80100ee9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80100ef0 <filestat>:
}
// Get metadata about file f.
int
filestat(struct file *f, struct stat *st)
{
80100ef0: 55 push %ebp
80100ef1: 89 e5 mov %esp,%ebp
80100ef3: 53 push %ebx
80100ef4: 83 ec 14 sub $0x14,%esp
80100ef7: 8b 5d 08 mov 0x8(%ebp),%ebx
if(f->type == FD_INODE){
80100efa: 83 3b 02 cmpl $0x2,(%ebx)
80100efd: 75 31 jne 80100f30 <filestat+0x40>
ilock(f->ip);
80100eff: 8b 43 10 mov 0x10(%ebx),%eax
80100f02: 89 04 24 mov %eax,(%esp)
80100f05: e8 b6 07 00 00 call 801016c0 <ilock>
stati(f->ip, st);
80100f0a: 8b 45 0c mov 0xc(%ebp),%eax
80100f0d: 89 44 24 04 mov %eax,0x4(%esp)
80100f11: 8b 43 10 mov 0x10(%ebx),%eax
80100f14: 89 04 24 mov %eax,(%esp)
80100f17: e8 04 0a 00 00 call 80101920 <stati>
iunlock(f->ip);
80100f1c: 8b 43 10 mov 0x10(%ebx),%eax
80100f1f: 89 04 24 mov %eax,(%esp)
80100f22: e8 69 08 00 00 call 80101790 <iunlock>
return 0;
}
return -1;
}
80100f27: 83 c4 14 add $0x14,%esp
{
if(f->type == FD_INODE){
ilock(f->ip);
stati(f->ip, st);
iunlock(f->ip);
return 0;
80100f2a: 31 c0 xor %eax,%eax
}
return -1;
}
80100f2c: 5b pop %ebx
80100f2d: 5d pop %ebp
80100f2e: c3 ret
80100f2f: 90 nop
80100f30: 83 c4 14 add $0x14,%esp
ilock(f->ip);
stati(f->ip, st);
iunlock(f->ip);
return 0;
}
return -1;
80100f33: b8 ff ff ff ff mov $0xffffffff,%eax
}
80100f38: 5b pop %ebx
80100f39: 5d pop %ebp
80100f3a: c3 ret
80100f3b: 90 nop
80100f3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80100f40 <fileread>:
// Read from file f.
int
fileread(struct file *f, char *addr, int n)
{
80100f40: 55 push %ebp
80100f41: 89 e5 mov %esp,%ebp
80100f43: 57 push %edi
80100f44: 56 push %esi
80100f45: 53 push %ebx
80100f46: 83 ec 1c sub $0x1c,%esp
80100f49: 8b 5d 08 mov 0x8(%ebp),%ebx
80100f4c: 8b 75 0c mov 0xc(%ebp),%esi
80100f4f: 8b 7d 10 mov 0x10(%ebp),%edi
int r;
if(f->readable == 0)
80100f52: 80 7b 08 00 cmpb $0x0,0x8(%ebx)
80100f56: 74 68 je 80100fc0 <fileread+0x80>
return -1;
if(f->type == FD_PIPE)
80100f58: 8b 03 mov (%ebx),%eax
80100f5a: 83 f8 01 cmp $0x1,%eax
80100f5d: 74 49 je 80100fa8 <fileread+0x68>
return piperead(f->pipe, addr, n);
if(f->type == FD_INODE){
80100f5f: 83 f8 02 cmp $0x2,%eax
80100f62: 75 63 jne 80100fc7 <fileread+0x87>
ilock(f->ip);
80100f64: 8b 43 10 mov 0x10(%ebx),%eax
80100f67: 89 04 24 mov %eax,(%esp)
80100f6a: e8 51 07 00 00 call 801016c0 <ilock>
if((r = readi(f->ip, addr, f->off, n)) > 0)
80100f6f: 89 7c 24 0c mov %edi,0xc(%esp)
80100f73: 8b 43 14 mov 0x14(%ebx),%eax
80100f76: 89 74 24 04 mov %esi,0x4(%esp)
80100f7a: 89 44 24 08 mov %eax,0x8(%esp)
80100f7e: 8b 43 10 mov 0x10(%ebx),%eax
80100f81: 89 04 24 mov %eax,(%esp)
80100f84: e8 c7 09 00 00 call 80101950 <readi>
80100f89: 85 c0 test %eax,%eax
80100f8b: 89 c6 mov %eax,%esi
80100f8d: 7e 03 jle 80100f92 <fileread+0x52>
f->off += r;
80100f8f: 01 43 14 add %eax,0x14(%ebx)
iunlock(f->ip);
80100f92: 8b 43 10 mov 0x10(%ebx),%eax
80100f95: 89 04 24 mov %eax,(%esp)
80100f98: e8 f3 07 00 00 call 80101790 <iunlock>
return -1;
if(f->type == FD_PIPE)
return piperead(f->pipe, addr, n);
if(f->type == FD_INODE){
ilock(f->ip);
if((r = readi(f->ip, addr, f->off, n)) > 0)
80100f9d: 89 f0 mov %esi,%eax
f->off += r;
iunlock(f->ip);
return r;
}
panic("fileread");
}
80100f9f: 83 c4 1c add $0x1c,%esp
80100fa2: 5b pop %ebx
80100fa3: 5e pop %esi
80100fa4: 5f pop %edi
80100fa5: 5d pop %ebp
80100fa6: c3 ret
80100fa7: 90 nop
int r;
if(f->readable == 0)
return -1;
if(f->type == FD_PIPE)
return piperead(f->pipe, addr, n);
80100fa8: 8b 43 0c mov 0xc(%ebx),%eax
80100fab: 89 45 08 mov %eax,0x8(%ebp)
f->off += r;
iunlock(f->ip);
return r;
}
panic("fileread");
}
80100fae: 83 c4 1c add $0x1c,%esp
80100fb1: 5b pop %ebx
80100fb2: 5e pop %esi
80100fb3: 5f pop %edi
80100fb4: 5d pop %ebp
int r;
if(f->readable == 0)
return -1;
if(f->type == FD_PIPE)
return piperead(f->pipe, addr, n);
80100fb5: e9 b6 25 00 00 jmp 80103570 <piperead>
80100fba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
fileread(struct file *f, char *addr, int n)
{
int r;
if(f->readable == 0)
return -1;
80100fc0: b8 ff ff ff ff mov $0xffffffff,%eax
80100fc5: eb d8 jmp 80100f9f <fileread+0x5f>
if((r = readi(f->ip, addr, f->off, n)) > 0)
f->off += r;
iunlock(f->ip);
return r;
}
panic("fileread");
80100fc7: c7 04 24 42 70 10 80 movl $0x80107042,(%esp)
80100fce: e8 8d f3 ff ff call 80100360 <panic>
80100fd3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80100fd9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80100fe0 <filewrite>:
//PAGEBREAK!
// Write to file f.
int
filewrite(struct file *f, char *addr, int n)
{
80100fe0: 55 push %ebp
80100fe1: 89 e5 mov %esp,%ebp
80100fe3: 57 push %edi
80100fe4: 56 push %esi
80100fe5: 53 push %ebx
80100fe6: 83 ec 2c sub $0x2c,%esp
80100fe9: 8b 45 0c mov 0xc(%ebp),%eax
80100fec: 8b 7d 08 mov 0x8(%ebp),%edi
80100fef: 89 45 dc mov %eax,-0x24(%ebp)
80100ff2: 8b 45 10 mov 0x10(%ebp),%eax
int r;
if(f->writable == 0)
80100ff5: 80 7f 09 00 cmpb $0x0,0x9(%edi)
//PAGEBREAK!
// Write to file f.
int
filewrite(struct file *f, char *addr, int n)
{
80100ff9: 89 45 e4 mov %eax,-0x1c(%ebp)
int r;
if(f->writable == 0)
80100ffc: 0f 84 ae 00 00 00 je 801010b0 <filewrite+0xd0>
return -1;
if(f->type == FD_PIPE)
80101002: 8b 07 mov (%edi),%eax
80101004: 83 f8 01 cmp $0x1,%eax
80101007: 0f 84 c2 00 00 00 je 801010cf <filewrite+0xef>
return pipewrite(f->pipe, addr, n);
if(f->type == FD_INODE){
8010100d: 83 f8 02 cmp $0x2,%eax
80101010: 0f 85 d7 00 00 00 jne 801010ed <filewrite+0x10d>
// and 2 blocks of slop for non-aligned writes.
// this really belongs lower down, since writei()
// might be writing a device like the console.
int max = ((LOGSIZE-1-1-2) / 2) * 512;
int i = 0;
while(i < n){
80101016: 8b 45 e4 mov -0x1c(%ebp),%eax
80101019: 31 db xor %ebx,%ebx
8010101b: 85 c0 test %eax,%eax
8010101d: 7f 31 jg 80101050 <filewrite+0x70>
8010101f: e9 9c 00 00 00 jmp 801010c0 <filewrite+0xe0>
80101024: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
begin_op();
ilock(f->ip);
if ((r = writei(f->ip, addr + i, f->off, n1)) > 0)
f->off += r;
iunlock(f->ip);
80101028: 8b 4f 10 mov 0x10(%edi),%ecx
n1 = max;
begin_op();
ilock(f->ip);
if ((r = writei(f->ip, addr + i, f->off, n1)) > 0)
f->off += r;
8010102b: 01 47 14 add %eax,0x14(%edi)
8010102e: 89 45 e0 mov %eax,-0x20(%ebp)
iunlock(f->ip);
80101031: 89 0c 24 mov %ecx,(%esp)
80101034: e8 57 07 00 00 call 80101790 <iunlock>
end_op();
80101039: e8 c2 1b 00 00 call 80102c00 <end_op>
8010103e: 8b 45 e0 mov -0x20(%ebp),%eax
if(r < 0)
break;
if(r != n1)
80101041: 39 f0 cmp %esi,%eax
80101043: 0f 85 98 00 00 00 jne 801010e1 <filewrite+0x101>
panic("short filewrite");
i += r;
80101049: 01 c3 add %eax,%ebx
// and 2 blocks of slop for non-aligned writes.
// this really belongs lower down, since writei()
// might be writing a device like the console.
int max = ((LOGSIZE-1-1-2) / 2) * 512;
int i = 0;
while(i < n){
8010104b: 39 5d e4 cmp %ebx,-0x1c(%ebp)
8010104e: 7e 70 jle 801010c0 <filewrite+0xe0>
int n1 = n - i;
80101050: 8b 75 e4 mov -0x1c(%ebp),%esi
80101053: b8 00 1a 00 00 mov $0x1a00,%eax
80101058: 29 de sub %ebx,%esi
8010105a: 81 fe 00 1a 00 00 cmp $0x1a00,%esi
80101060: 0f 4f f0 cmovg %eax,%esi
if(n1 > max)
n1 = max;
begin_op();
80101063: e8 28 1b 00 00 call 80102b90 <begin_op>
ilock(f->ip);
80101068: 8b 47 10 mov 0x10(%edi),%eax
8010106b: 89 04 24 mov %eax,(%esp)
8010106e: e8 4d 06 00 00 call 801016c0 <ilock>
if ((r = writei(f->ip, addr + i, f->off, n1)) > 0)
80101073: 89 74 24 0c mov %esi,0xc(%esp)
80101077: 8b 47 14 mov 0x14(%edi),%eax
8010107a: 89 44 24 08 mov %eax,0x8(%esp)
8010107e: 8b 45 dc mov -0x24(%ebp),%eax
80101081: 01 d8 add %ebx,%eax
80101083: 89 44 24 04 mov %eax,0x4(%esp)
80101087: 8b 47 10 mov 0x10(%edi),%eax
8010108a: 89 04 24 mov %eax,(%esp)
8010108d: e8 be 09 00 00 call 80101a50 <writei>
80101092: 85 c0 test %eax,%eax
80101094: 7f 92 jg 80101028 <filewrite+0x48>
f->off += r;
iunlock(f->ip);
80101096: 8b 4f 10 mov 0x10(%edi),%ecx
80101099: 89 45 e0 mov %eax,-0x20(%ebp)
8010109c: 89 0c 24 mov %ecx,(%esp)
8010109f: e8 ec 06 00 00 call 80101790 <iunlock>
end_op();
801010a4: e8 57 1b 00 00 call 80102c00 <end_op>
if(r < 0)
801010a9: 8b 45 e0 mov -0x20(%ebp),%eax
801010ac: 85 c0 test %eax,%eax
801010ae: 74 91 je 80101041 <filewrite+0x61>
i += r;
}
return i == n ? n : -1;
}
panic("filewrite");
}
801010b0: 83 c4 2c add $0x2c,%esp
filewrite(struct file *f, char *addr, int n)
{
int r;
if(f->writable == 0)
return -1;
801010b3: b8 ff ff ff ff mov $0xffffffff,%eax
i += r;
}
return i == n ? n : -1;
}
panic("filewrite");
}
801010b8: 5b pop %ebx
801010b9: 5e pop %esi
801010ba: 5f pop %edi
801010bb: 5d pop %ebp
801010bc: c3 ret
801010bd: 8d 76 00 lea 0x0(%esi),%esi
break;
if(r != n1)
panic("short filewrite");
i += r;
}
return i == n ? n : -1;
801010c0: 3b 5d e4 cmp -0x1c(%ebp),%ebx
801010c3: 89 d8 mov %ebx,%eax
801010c5: 75 e9 jne 801010b0 <filewrite+0xd0>
}
panic("filewrite");
}
801010c7: 83 c4 2c add $0x2c,%esp
801010ca: 5b pop %ebx
801010cb: 5e pop %esi
801010cc: 5f pop %edi
801010cd: 5d pop %ebp
801010ce: c3 ret
int r;
if(f->writable == 0)
return -1;
if(f->type == FD_PIPE)
return pipewrite(f->pipe, addr, n);
801010cf: 8b 47 0c mov 0xc(%edi),%eax
801010d2: 89 45 08 mov %eax,0x8(%ebp)
i += r;
}
return i == n ? n : -1;
}
panic("filewrite");
}
801010d5: 83 c4 2c add $0x2c,%esp
801010d8: 5b pop %ebx
801010d9: 5e pop %esi
801010da: 5f pop %edi
801010db: 5d pop %ebp
int r;
if(f->writable == 0)
return -1;
if(f->type == FD_PIPE)
return pipewrite(f->pipe, addr, n);
801010dc: e9 6f 23 00 00 jmp 80103450 <pipewrite>
end_op();
if(r < 0)
break;
if(r != n1)
panic("short filewrite");
801010e1: c7 04 24 4b 70 10 80 movl $0x8010704b,(%esp)
801010e8: e8 73 f2 ff ff call 80100360 <panic>
i += r;
}
return i == n ? n : -1;
}
panic("filewrite");
801010ed: c7 04 24 51 70 10 80 movl $0x80107051,(%esp)
801010f4: e8 67 f2 ff ff call 80100360 <panic>
801010f9: 66 90 xchg %ax,%ax
801010fb: 66 90 xchg %ax,%ax
801010fd: 66 90 xchg %ax,%ax
801010ff: 90 nop
80101100 <balloc>:
// Blocks.
// Allocate a zeroed disk block.
static uint
balloc(uint dev)
{
80101100: 55 push %ebp
80101101: 89 e5 mov %esp,%ebp
80101103: 57 push %edi
80101104: 56 push %esi
80101105: 53 push %ebx
80101106: 83 ec 2c sub $0x2c,%esp
80101109: 89 45 d8 mov %eax,-0x28(%ebp)
int b, bi, m;
struct buf *bp;
bp = 0;
for(b = 0; b < sb.size; b += BPB){
8010110c: a1 e0 09 11 80 mov 0x801109e0,%eax
80101111: 85 c0 test %eax,%eax
80101113: 0f 84 8c 00 00 00 je 801011a5 <balloc+0xa5>
80101119: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%ebp)
bp = bread(dev, BBLOCK(b, sb));
80101120: 8b 75 dc mov -0x24(%ebp),%esi
80101123: 89 f0 mov %esi,%eax
80101125: c1 f8 0c sar $0xc,%eax
80101128: 03 05 f8 09 11 80 add 0x801109f8,%eax
8010112e: 89 44 24 04 mov %eax,0x4(%esp)
80101132: 8b 45 d8 mov -0x28(%ebp),%eax
80101135: 89 04 24 mov %eax,(%esp)
80101138: e8 93 ef ff ff call 801000d0 <bread>
8010113d: 89 45 e4 mov %eax,-0x1c(%ebp)
80101140: a1 e0 09 11 80 mov 0x801109e0,%eax
80101145: 89 45 e0 mov %eax,-0x20(%ebp)
for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
80101148: 31 c0 xor %eax,%eax
8010114a: eb 33 jmp 8010117f <balloc+0x7f>
8010114c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
m = 1 << (bi % 8);
if((bp->data[bi/8] & m) == 0){ // Is block free?
80101150: 8b 5d e4 mov -0x1c(%ebp),%ebx
80101153: 89 c2 mov %eax,%edx
bp = 0;
for(b = 0; b < sb.size; b += BPB){
bp = bread(dev, BBLOCK(b, sb));
for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
m = 1 << (bi % 8);
80101155: 89 c1 mov %eax,%ecx
if((bp->data[bi/8] & m) == 0){ // Is block free?
80101157: c1 fa 03 sar $0x3,%edx
bp = 0;
for(b = 0; b < sb.size; b += BPB){
bp = bread(dev, BBLOCK(b, sb));
for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
m = 1 << (bi % 8);
8010115a: 83 e1 07 and $0x7,%ecx
8010115d: bf 01 00 00 00 mov $0x1,%edi
80101162: d3 e7 shl %cl,%edi
if((bp->data[bi/8] & m) == 0){ // Is block free?
80101164: 0f b6 5c 13 5c movzbl 0x5c(%ebx,%edx,1),%ebx
bp = 0;
for(b = 0; b < sb.size; b += BPB){
bp = bread(dev, BBLOCK(b, sb));
for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
m = 1 << (bi % 8);
80101169: 89 f9 mov %edi,%ecx
if((bp->data[bi/8] & m) == 0){ // Is block free?
8010116b: 0f b6 fb movzbl %bl,%edi
8010116e: 85 cf test %ecx,%edi
80101170: 74 46 je 801011b8 <balloc+0xb8>
struct buf *bp;
bp = 0;
for(b = 0; b < sb.size; b += BPB){
bp = bread(dev, BBLOCK(b, sb));
for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
80101172: 83 c0 01 add $0x1,%eax
80101175: 83 c6 01 add $0x1,%esi
80101178: 3d 00 10 00 00 cmp $0x1000,%eax
8010117d: 74 05 je 80101184 <balloc+0x84>
8010117f: 3b 75 e0 cmp -0x20(%ebp),%esi
80101182: 72 cc jb 80101150 <balloc+0x50>
brelse(bp);
bzero(dev, b + bi);
return b + bi;
}
}
brelse(bp);
80101184: 8b 45 e4 mov -0x1c(%ebp),%eax
80101187: 89 04 24 mov %eax,(%esp)
8010118a: e8 51 f0 ff ff call 801001e0 <brelse>
{
int b, bi, m;
struct buf *bp;
bp = 0;
for(b = 0; b < sb.size; b += BPB){
8010118f: 81 45 dc 00 10 00 00 addl $0x1000,-0x24(%ebp)
80101196: 8b 45 dc mov -0x24(%ebp),%eax
80101199: 3b 05 e0 09 11 80 cmp 0x801109e0,%eax
8010119f: 0f 82 7b ff ff ff jb 80101120 <balloc+0x20>
return b + bi;
}
}
brelse(bp);
}
panic("balloc: out of blocks");
801011a5: c7 04 24 5b 70 10 80 movl $0x8010705b,(%esp)
801011ac: e8 af f1 ff ff call 80100360 <panic>
801011b1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
for(b = 0; b < sb.size; b += BPB){
bp = bread(dev, BBLOCK(b, sb));
for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
m = 1 << (bi % 8);
if((bp->data[bi/8] & m) == 0){ // Is block free?
bp->data[bi/8] |= m; // Mark block in use.
801011b8: 09 d9 or %ebx,%ecx
801011ba: 8b 5d e4 mov -0x1c(%ebp),%ebx
801011bd: 88 4c 13 5c mov %cl,0x5c(%ebx,%edx,1)
log_write(bp);
801011c1: 89 1c 24 mov %ebx,(%esp)
801011c4: e8 67 1b 00 00 call 80102d30 <log_write>
brelse(bp);
801011c9: 89 1c 24 mov %ebx,(%esp)
801011cc: e8 0f f0 ff ff call 801001e0 <brelse>
static void
bzero(int dev, int bno)
{
struct buf *bp;
bp = bread(dev, bno);
801011d1: 8b 45 d8 mov -0x28(%ebp),%eax
801011d4: 89 74 24 04 mov %esi,0x4(%esp)
801011d8: 89 04 24 mov %eax,(%esp)
801011db: e8 f0 ee ff ff call 801000d0 <bread>
memset(bp->data, 0, BSIZE);
801011e0: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
801011e7: 00
801011e8: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
801011ef: 00
static void
bzero(int dev, int bno)
{
struct buf *bp;
bp = bread(dev, bno);
801011f0: 89 c3 mov %eax,%ebx
memset(bp->data, 0, BSIZE);
801011f2: 8d 40 5c lea 0x5c(%eax),%eax
801011f5: 89 04 24 mov %eax,(%esp)
801011f8: e8 23 33 00 00 call 80104520 <memset>
log_write(bp);
801011fd: 89 1c 24 mov %ebx,(%esp)
80101200: e8 2b 1b 00 00 call 80102d30 <log_write>
brelse(bp);
80101205: 89 1c 24 mov %ebx,(%esp)
80101208: e8 d3 ef ff ff call 801001e0 <brelse>
}
}
brelse(bp);
}
panic("balloc: out of blocks");
}
8010120d: 83 c4 2c add $0x2c,%esp
80101210: 89 f0 mov %esi,%eax
80101212: 5b pop %ebx
80101213: 5e pop %esi
80101214: 5f pop %edi
80101215: 5d pop %ebp
80101216: c3 ret
80101217: 89 f6 mov %esi,%esi
80101219: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80101220 <iget>:
// Find the inode with number inum on device dev
// and return the in-memory copy. Does not lock
// the inode and does not read it from disk.
static struct inode*
iget(uint dev, uint inum)
{
80101220: 55 push %ebp
80101221: 89 e5 mov %esp,%ebp
80101223: 57 push %edi
80101224: 89 c7 mov %eax,%edi
80101226: 56 push %esi
struct inode *ip, *empty;
acquire(&icache.lock);
// Is the inode already cached?
empty = 0;
80101227: 31 f6 xor %esi,%esi
// Find the inode with number inum on device dev
// and return the in-memory copy. Does not lock
// the inode and does not read it from disk.
static struct inode*
iget(uint dev, uint inum)
{
80101229: 53 push %ebx
acquire(&icache.lock);
// Is the inode already cached?
empty = 0;
for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
8010122a: bb 34 0a 11 80 mov $0x80110a34,%ebx
// Find the inode with number inum on device dev
// and return the in-memory copy. Does not lock
// the inode and does not read it from disk.
static struct inode*
iget(uint dev, uint inum)
{
8010122f: 83 ec 1c sub $0x1c,%esp
struct inode *ip, *empty;
acquire(&icache.lock);
80101232: c7 04 24 00 0a 11 80 movl $0x80110a00,(%esp)
// Find the inode with number inum on device dev
// and return the in-memory copy. Does not lock
// the inode and does not read it from disk.
static struct inode*
iget(uint dev, uint inum)
{
80101239: 89 55 e4 mov %edx,-0x1c(%ebp)
struct inode *ip, *empty;
acquire(&icache.lock);
8010123c: e8 5f 31 00 00 call 801043a0 <acquire>
// Is the inode already cached?
empty = 0;
for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
80101241: 8b 55 e4 mov -0x1c(%ebp),%edx
80101244: eb 14 jmp 8010125a <iget+0x3a>
80101246: 66 90 xchg %ax,%ax
if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){
ip->ref++;
release(&icache.lock);
return ip;
}
if(empty == 0 && ip->ref == 0) // Remember empty slot.
80101248: 85 f6 test %esi,%esi
8010124a: 74 3c je 80101288 <iget+0x68>
acquire(&icache.lock);
// Is the inode already cached?
empty = 0;
for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
8010124c: 81 c3 90 00 00 00 add $0x90,%ebx
80101252: 81 fb 54 26 11 80 cmp $0x80112654,%ebx
80101258: 74 46 je 801012a0 <iget+0x80>
if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){
8010125a: 8b 4b 08 mov 0x8(%ebx),%ecx
8010125d: 85 c9 test %ecx,%ecx
8010125f: 7e e7 jle 80101248 <iget+0x28>
80101261: 39 3b cmp %edi,(%ebx)
80101263: 75 e3 jne 80101248 <iget+0x28>
80101265: 39 53 04 cmp %edx,0x4(%ebx)
80101268: 75 de jne 80101248 <iget+0x28>
ip->ref++;
8010126a: 83 c1 01 add $0x1,%ecx
release(&icache.lock);
return ip;
8010126d: 89 de mov %ebx,%esi
// Is the inode already cached?
empty = 0;
for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){
ip->ref++;
release(&icache.lock);
8010126f: c7 04 24 00 0a 11 80 movl $0x80110a00,(%esp)
// Is the inode already cached?
empty = 0;
for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){
ip->ref++;
80101276: 89 4b 08 mov %ecx,0x8(%ebx)
release(&icache.lock);
80101279: e8 52 32 00 00 call 801044d0 <release>
ip->ref = 1;
ip->flags = 0;
release(&icache.lock);
return ip;
}
8010127e: 83 c4 1c add $0x1c,%esp
80101281: 89 f0 mov %esi,%eax
80101283: 5b pop %ebx
80101284: 5e pop %esi
80101285: 5f pop %edi
80101286: 5d pop %ebp
80101287: c3 ret
80101288: 85 c9 test %ecx,%ecx
8010128a: 0f 44 f3 cmove %ebx,%esi
acquire(&icache.lock);
// Is the inode already cached?
empty = 0;
for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
8010128d: 81 c3 90 00 00 00 add $0x90,%ebx
80101293: 81 fb 54 26 11 80 cmp $0x80112654,%ebx
80101299: 75 bf jne 8010125a <iget+0x3a>
8010129b: 90 nop
8010129c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(empty == 0 && ip->ref == 0) // Remember empty slot.
empty = ip;
}
// Recycle an inode cache entry.
if(empty == 0)
801012a0: 85 f6 test %esi,%esi
801012a2: 74 29 je 801012cd <iget+0xad>
panic("iget: no inodes");
ip = empty;
ip->dev = dev;
801012a4: 89 3e mov %edi,(%esi)
ip->inum = inum;
801012a6: 89 56 04 mov %edx,0x4(%esi)
ip->ref = 1;
801012a9: c7 46 08 01 00 00 00 movl $0x1,0x8(%esi)
ip->flags = 0;
801012b0: c7 46 4c 00 00 00 00 movl $0x0,0x4c(%esi)
release(&icache.lock);
801012b7: c7 04 24 00 0a 11 80 movl $0x80110a00,(%esp)
801012be: e8 0d 32 00 00 call 801044d0 <release>
return ip;
}
801012c3: 83 c4 1c add $0x1c,%esp
801012c6: 89 f0 mov %esi,%eax
801012c8: 5b pop %ebx
801012c9: 5e pop %esi
801012ca: 5f pop %edi
801012cb: 5d pop %ebp
801012cc: c3 ret
empty = ip;
}
// Recycle an inode cache entry.
if(empty == 0)
panic("iget: no inodes");
801012cd: c7 04 24 71 70 10 80 movl $0x80107071,(%esp)
801012d4: e8 87 f0 ff ff call 80100360 <panic>
801012d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801012e0 <bmap>:
// Return the disk block address of the nth block in inode ip.
// If there is no such block, bmap allocates one.
static uint
bmap(struct inode *ip, uint bn)
{
801012e0: 55 push %ebp
801012e1: 89 e5 mov %esp,%ebp
801012e3: 57 push %edi
801012e4: 56 push %esi
801012e5: 53 push %ebx
801012e6: 89 c3 mov %eax,%ebx
801012e8: 83 ec 1c sub $0x1c,%esp
uint addr, *a;
struct buf *bp;
if(bn < NDIRECT){
801012eb: 83 fa 0b cmp $0xb,%edx
801012ee: 77 18 ja 80101308 <bmap+0x28>
801012f0: 8d 34 90 lea (%eax,%edx,4),%esi
if((addr = ip->addrs[bn]) == 0)
801012f3: 8b 46 5c mov 0x5c(%esi),%eax
801012f6: 85 c0 test %eax,%eax
801012f8: 74 66 je 80101360 <bmap+0x80>
brelse(bp);
return addr;
}
panic("bmap: out of range");
}
801012fa: 83 c4 1c add $0x1c,%esp
801012fd: 5b pop %ebx
801012fe: 5e pop %esi
801012ff: 5f pop %edi
80101300: 5d pop %ebp
80101301: c3 ret
80101302: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if(bn < NDIRECT){
if((addr = ip->addrs[bn]) == 0)
ip->addrs[bn] = addr = balloc(ip->dev);
return addr;
}
bn -= NDIRECT;
80101308: 8d 72 f4 lea -0xc(%edx),%esi
if(bn < NINDIRECT){
8010130b: 83 fe 7f cmp $0x7f,%esi
8010130e: 77 77 ja 80101387 <bmap+0xa7>
// Load indirect block, allocating if necessary.
if((addr = ip->addrs[NDIRECT]) == 0)
80101310: 8b 80 8c 00 00 00 mov 0x8c(%eax),%eax
80101316: 85 c0 test %eax,%eax
80101318: 74 5e je 80101378 <bmap+0x98>
ip->addrs[NDIRECT] = addr = balloc(ip->dev);
bp = bread(ip->dev, addr);
8010131a: 89 44 24 04 mov %eax,0x4(%esp)
8010131e: 8b 03 mov (%ebx),%eax
80101320: 89 04 24 mov %eax,(%esp)
80101323: e8 a8 ed ff ff call 801000d0 <bread>
a = (uint*)bp->data;
if((addr = a[bn]) == 0){
80101328: 8d 54 b0 5c lea 0x5c(%eax,%esi,4),%edx
if(bn < NINDIRECT){
// Load indirect block, allocating if necessary.
if((addr = ip->addrs[NDIRECT]) == 0)
ip->addrs[NDIRECT] = addr = balloc(ip->dev);
bp = bread(ip->dev, addr);
8010132c: 89 c7 mov %eax,%edi
a = (uint*)bp->data;
if((addr = a[bn]) == 0){
8010132e: 8b 32 mov (%edx),%esi
80101330: 85 f6 test %esi,%esi
80101332: 75 19 jne 8010134d <bmap+0x6d>
a[bn] = addr = balloc(ip->dev);
80101334: 8b 03 mov (%ebx),%eax
80101336: 89 55 e4 mov %edx,-0x1c(%ebp)
80101339: e8 c2 fd ff ff call 80101100 <balloc>
8010133e: 8b 55 e4 mov -0x1c(%ebp),%edx
80101341: 89 02 mov %eax,(%edx)
80101343: 89 c6 mov %eax,%esi
log_write(bp);
80101345: 89 3c 24 mov %edi,(%esp)
80101348: e8 e3 19 00 00 call 80102d30 <log_write>
}
brelse(bp);
8010134d: 89 3c 24 mov %edi,(%esp)
80101350: e8 8b ee ff ff call 801001e0 <brelse>
return addr;
}
panic("bmap: out of range");
}
80101355: 83 c4 1c add $0x1c,%esp
a = (uint*)bp->data;
if((addr = a[bn]) == 0){
a[bn] = addr = balloc(ip->dev);
log_write(bp);
}
brelse(bp);
80101358: 89 f0 mov %esi,%eax
return addr;
}
panic("bmap: out of range");
}
8010135a: 5b pop %ebx
8010135b: 5e pop %esi
8010135c: 5f pop %edi
8010135d: 5d pop %ebp
8010135e: c3 ret
8010135f: 90 nop
uint addr, *a;
struct buf *bp;
if(bn < NDIRECT){
if((addr = ip->addrs[bn]) == 0)
ip->addrs[bn] = addr = balloc(ip->dev);
80101360: 8b 03 mov (%ebx),%eax
80101362: e8 99 fd ff ff call 80101100 <balloc>
80101367: 89 46 5c mov %eax,0x5c(%esi)
brelse(bp);
return addr;
}
panic("bmap: out of range");
}
8010136a: 83 c4 1c add $0x1c,%esp
8010136d: 5b pop %ebx
8010136e: 5e pop %esi
8010136f: 5f pop %edi
80101370: 5d pop %ebp
80101371: c3 ret
80101372: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
bn -= NDIRECT;
if(bn < NINDIRECT){
// Load indirect block, allocating if necessary.
if((addr = ip->addrs[NDIRECT]) == 0)
ip->addrs[NDIRECT] = addr = balloc(ip->dev);
80101378: 8b 03 mov (%ebx),%eax
8010137a: e8 81 fd ff ff call 80101100 <balloc>
8010137f: 89 83 8c 00 00 00 mov %eax,0x8c(%ebx)
80101385: eb 93 jmp 8010131a <bmap+0x3a>
}
brelse(bp);
return addr;
}
panic("bmap: out of range");
80101387: c7 04 24 81 70 10 80 movl $0x80107081,(%esp)
8010138e: e8 cd ef ff ff call 80100360 <panic>
80101393: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80101399: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801013a0 <readsb>:
struct superblock sb;
// Read the super block.
void
readsb(int dev, struct superblock *sb)
{
801013a0: 55 push %ebp
801013a1: 89 e5 mov %esp,%ebp
801013a3: 56 push %esi
801013a4: 53 push %ebx
801013a5: 83 ec 10 sub $0x10,%esp
struct buf *bp;
bp = bread(dev, 1);
801013a8: 8b 45 08 mov 0x8(%ebp),%eax
801013ab: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
801013b2: 00
struct superblock sb;
// Read the super block.
void
readsb(int dev, struct superblock *sb)
{
801013b3: 8b 75 0c mov 0xc(%ebp),%esi
struct buf *bp;
bp = bread(dev, 1);
801013b6: 89 04 24 mov %eax,(%esp)
801013b9: e8 12 ed ff ff call 801000d0 <bread>
memmove(sb, bp->data, sizeof(*sb));
801013be: 89 34 24 mov %esi,(%esp)
801013c1: c7 44 24 08 1c 00 00 movl $0x1c,0x8(%esp)
801013c8: 00
void
readsb(int dev, struct superblock *sb)
{
struct buf *bp;
bp = bread(dev, 1);
801013c9: 89 c3 mov %eax,%ebx
memmove(sb, bp->data, sizeof(*sb));
801013cb: 8d 40 5c lea 0x5c(%eax),%eax
801013ce: 89 44 24 04 mov %eax,0x4(%esp)
801013d2: e8 f9 31 00 00 call 801045d0 <memmove>
brelse(bp);
801013d7: 89 5d 08 mov %ebx,0x8(%ebp)
}
801013da: 83 c4 10 add $0x10,%esp
801013dd: 5b pop %ebx
801013de: 5e pop %esi
801013df: 5d pop %ebp
{
struct buf *bp;
bp = bread(dev, 1);
memmove(sb, bp->data, sizeof(*sb));
brelse(bp);
801013e0: e9 fb ed ff ff jmp 801001e0 <brelse>
801013e5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801013e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801013f0 <bfree>:
}
// Free a disk block.
static void
bfree(int dev, uint b)
{
801013f0: 55 push %ebp
801013f1: 89 e5 mov %esp,%ebp
801013f3: 57 push %edi
801013f4: 89 d7 mov %edx,%edi
801013f6: 56 push %esi
801013f7: 53 push %ebx
801013f8: 89 c3 mov %eax,%ebx
801013fa: 83 ec 1c sub $0x1c,%esp
struct buf *bp;
int bi, m;
readsb(dev, &sb);
801013fd: 89 04 24 mov %eax,(%esp)
80101400: c7 44 24 04 e0 09 11 movl $0x801109e0,0x4(%esp)
80101407: 80
80101408: e8 93 ff ff ff call 801013a0 <readsb>
bp = bread(dev, BBLOCK(b, sb));
8010140d: 89 fa mov %edi,%edx
8010140f: c1 ea 0c shr $0xc,%edx
80101412: 03 15 f8 09 11 80 add 0x801109f8,%edx
80101418: 89 1c 24 mov %ebx,(%esp)
bi = b % BPB;
m = 1 << (bi % 8);
8010141b: bb 01 00 00 00 mov $0x1,%ebx
{
struct buf *bp;
int bi, m;
readsb(dev, &sb);
bp = bread(dev, BBLOCK(b, sb));
80101420: 89 54 24 04 mov %edx,0x4(%esp)
80101424: e8 a7 ec ff ff call 801000d0 <bread>
bi = b % BPB;
m = 1 << (bi % 8);
80101429: 89 f9 mov %edi,%ecx
struct buf *bp;
int bi, m;
readsb(dev, &sb);
bp = bread(dev, BBLOCK(b, sb));
bi = b % BPB;
8010142b: 81 e7 ff 0f 00 00 and $0xfff,%edi
80101431: 89 fa mov %edi,%edx
m = 1 << (bi % 8);
80101433: 83 e1 07 and $0x7,%ecx
if((bp->data[bi/8] & m) == 0)
80101436: c1 fa 03 sar $0x3,%edx
int bi, m;
readsb(dev, &sb);
bp = bread(dev, BBLOCK(b, sb));
bi = b % BPB;
m = 1 << (bi % 8);
80101439: d3 e3 shl %cl,%ebx
{
struct buf *bp;
int bi, m;
readsb(dev, &sb);
bp = bread(dev, BBLOCK(b, sb));
8010143b: 89 c6 mov %eax,%esi
bi = b % BPB;
m = 1 << (bi % 8);
if((bp->data[bi/8] & m) == 0)
8010143d: 0f b6 44 10 5c movzbl 0x5c(%eax,%edx,1),%eax
80101442: 0f b6 c8 movzbl %al,%ecx
80101445: 85 d9 test %ebx,%ecx
80101447: 74 20 je 80101469 <bfree+0x79>
panic("freeing free block");
bp->data[bi/8] &= ~m;
80101449: f7 d3 not %ebx
8010144b: 21 c3 and %eax,%ebx
8010144d: 88 5c 16 5c mov %bl,0x5c(%esi,%edx,1)
log_write(bp);
80101451: 89 34 24 mov %esi,(%esp)
80101454: e8 d7 18 00 00 call 80102d30 <log_write>
brelse(bp);
80101459: 89 34 24 mov %esi,(%esp)
8010145c: e8 7f ed ff ff call 801001e0 <brelse>
}
80101461: 83 c4 1c add $0x1c,%esp
80101464: 5b pop %ebx
80101465: 5e pop %esi
80101466: 5f pop %edi
80101467: 5d pop %ebp
80101468: c3 ret
readsb(dev, &sb);
bp = bread(dev, BBLOCK(b, sb));
bi = b % BPB;
m = 1 << (bi % 8);
if((bp->data[bi/8] & m) == 0)
panic("freeing free block");
80101469: c7 04 24 94 70 10 80 movl $0x80107094,(%esp)
80101470: e8 eb ee ff ff call 80100360 <panic>
80101475: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80101479: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80101480 <iinit>:
struct inode inode[NINODE];
} icache;
void
iinit(int dev)
{
80101480: 55 push %ebp
80101481: 89 e5 mov %esp,%ebp
80101483: 53 push %ebx
80101484: bb 40 0a 11 80 mov $0x80110a40,%ebx
80101489: 83 ec 24 sub $0x24,%esp
int i = 0;
initlock(&icache.lock, "icache");
8010148c: c7 44 24 04 a7 70 10 movl $0x801070a7,0x4(%esp)
80101493: 80
80101494: c7 04 24 00 0a 11 80 movl $0x80110a00,(%esp)
8010149b: e8 80 2e 00 00 call 80104320 <initlock>
for(i = 0; i < NINODE; i++) {
initsleeplock(&icache.inode[i].lock, "inode");
801014a0: 89 1c 24 mov %ebx,(%esp)
801014a3: 81 c3 90 00 00 00 add $0x90,%ebx
801014a9: c7 44 24 04 ae 70 10 movl $0x801070ae,0x4(%esp)
801014b0: 80
801014b1: e8 5a 2d 00 00 call 80104210 <initsleeplock>
iinit(int dev)
{
int i = 0;
initlock(&icache.lock, "icache");
for(i = 0; i < NINODE; i++) {
801014b6: 81 fb 60 26 11 80 cmp $0x80112660,%ebx
801014bc: 75 e2 jne 801014a0 <iinit+0x20>
initsleeplock(&icache.inode[i].lock, "inode");
}
readsb(dev, &sb);
801014be: 8b 45 08 mov 0x8(%ebp),%eax
801014c1: c7 44 24 04 e0 09 11 movl $0x801109e0,0x4(%esp)
801014c8: 80
801014c9: 89 04 24 mov %eax,(%esp)
801014cc: e8 cf fe ff ff call 801013a0 <readsb>
cprintf("sb: size %d nblocks %d ninodes %d nlog %d logstart %d\
801014d1: a1 f8 09 11 80 mov 0x801109f8,%eax
801014d6: c7 04 24 04 71 10 80 movl $0x80107104,(%esp)
801014dd: 89 44 24 1c mov %eax,0x1c(%esp)
801014e1: a1 f4 09 11 80 mov 0x801109f4,%eax
801014e6: 89 44 24 18 mov %eax,0x18(%esp)
801014ea: a1 f0 09 11 80 mov 0x801109f0,%eax
801014ef: 89 44 24 14 mov %eax,0x14(%esp)
801014f3: a1 ec 09 11 80 mov 0x801109ec,%eax
801014f8: 89 44 24 10 mov %eax,0x10(%esp)
801014fc: a1 e8 09 11 80 mov 0x801109e8,%eax
80101501: 89 44 24 0c mov %eax,0xc(%esp)
80101505: a1 e4 09 11 80 mov 0x801109e4,%eax
8010150a: 89 44 24 08 mov %eax,0x8(%esp)
8010150e: a1 e0 09 11 80 mov 0x801109e0,%eax
80101513: 89 44 24 04 mov %eax,0x4(%esp)
80101517: e8 34 f1 ff ff call 80100650 <cprintf>
inodestart %d bmap start %d\n", sb.size, sb.nblocks,
sb.ninodes, sb.nlog, sb.logstart, sb.inodestart,
sb.bmapstart);
}
8010151c: 83 c4 24 add $0x24,%esp
8010151f: 5b pop %ebx
80101520: 5d pop %ebp
80101521: c3 ret
80101522: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80101529: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80101530 <ialloc>:
//PAGEBREAK!
// Allocate a new inode with the given type on device dev.
// A free inode has a type of zero.
struct inode*
ialloc(uint dev, short type)
{
80101530: 55 push %ebp
80101531: 89 e5 mov %esp,%ebp
80101533: 57 push %edi
80101534: 56 push %esi
80101535: 53 push %ebx
80101536: 83 ec 2c sub $0x2c,%esp
80101539: 8b 45 0c mov 0xc(%ebp),%eax
int inum;
struct buf *bp;
struct dinode *dip;
for(inum = 1; inum < sb.ninodes; inum++){
8010153c: 83 3d e8 09 11 80 01 cmpl $0x1,0x801109e8
//PAGEBREAK!
// Allocate a new inode with the given type on device dev.
// A free inode has a type of zero.
struct inode*
ialloc(uint dev, short type)
{
80101543: 8b 7d 08 mov 0x8(%ebp),%edi
80101546: 89 45 e4 mov %eax,-0x1c(%ebp)
int inum;
struct buf *bp;
struct dinode *dip;
for(inum = 1; inum < sb.ninodes; inum++){
80101549: 0f 86 a2 00 00 00 jbe 801015f1 <ialloc+0xc1>
8010154f: be 01 00 00 00 mov $0x1,%esi
80101554: bb 01 00 00 00 mov $0x1,%ebx
80101559: eb 1a jmp 80101575 <ialloc+0x45>
8010155b: 90 nop
8010155c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
dip->type = type;
log_write(bp); // mark it allocated on the disk
brelse(bp);
return iget(dev, inum);
}
brelse(bp);
80101560: 89 14 24 mov %edx,(%esp)
{
int inum;
struct buf *bp;
struct dinode *dip;
for(inum = 1; inum < sb.ninodes; inum++){
80101563: 83 c3 01 add $0x1,%ebx
dip->type = type;
log_write(bp); // mark it allocated on the disk
brelse(bp);
return iget(dev, inum);
}
brelse(bp);
80101566: e8 75 ec ff ff call 801001e0 <brelse>
{
int inum;
struct buf *bp;
struct dinode *dip;
for(inum = 1; inum < sb.ninodes; inum++){
8010156b: 89 de mov %ebx,%esi
8010156d: 3b 1d e8 09 11 80 cmp 0x801109e8,%ebx
80101573: 73 7c jae 801015f1 <ialloc+0xc1>
bp = bread(dev, IBLOCK(inum, sb));
80101575: 89 f0 mov %esi,%eax
80101577: c1 e8 03 shr $0x3,%eax
8010157a: 03 05 f4 09 11 80 add 0x801109f4,%eax
80101580: 89 3c 24 mov %edi,(%esp)
80101583: 89 44 24 04 mov %eax,0x4(%esp)
80101587: e8 44 eb ff ff call 801000d0 <bread>
8010158c: 89 c2 mov %eax,%edx
dip = (struct dinode*)bp->data + inum%IPB;
8010158e: 89 f0 mov %esi,%eax
80101590: 83 e0 07 and $0x7,%eax
80101593: c1 e0 06 shl $0x6,%eax
80101596: 8d 4c 02 5c lea 0x5c(%edx,%eax,1),%ecx
if(dip->type == 0){ // a free inode
8010159a: 66 83 39 00 cmpw $0x0,(%ecx)
8010159e: 75 c0 jne 80101560 <ialloc+0x30>
memset(dip, 0, sizeof(*dip));
801015a0: 89 0c 24 mov %ecx,(%esp)
801015a3: c7 44 24 08 40 00 00 movl $0x40,0x8(%esp)
801015aa: 00
801015ab: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
801015b2: 00
801015b3: 89 55 dc mov %edx,-0x24(%ebp)
801015b6: 89 4d e0 mov %ecx,-0x20(%ebp)
801015b9: e8 62 2f 00 00 call 80104520 <memset>
dip->type = type;
801015be: 0f b7 45 e4 movzwl -0x1c(%ebp),%eax
log_write(bp); // mark it allocated on the disk
801015c2: 8b 55 dc mov -0x24(%ebp),%edx
for(inum = 1; inum < sb.ninodes; inum++){
bp = bread(dev, IBLOCK(inum, sb));
dip = (struct dinode*)bp->data + inum%IPB;
if(dip->type == 0){ // a free inode
memset(dip, 0, sizeof(*dip));
dip->type = type;
801015c5: 8b 4d e0 mov -0x20(%ebp),%ecx
log_write(bp); // mark it allocated on the disk
801015c8: 89 55 e4 mov %edx,-0x1c(%ebp)
for(inum = 1; inum < sb.ninodes; inum++){
bp = bread(dev, IBLOCK(inum, sb));
dip = (struct dinode*)bp->data + inum%IPB;
if(dip->type == 0){ // a free inode
memset(dip, 0, sizeof(*dip));
dip->type = type;
801015cb: 66 89 01 mov %ax,(%ecx)
log_write(bp); // mark it allocated on the disk
801015ce: 89 14 24 mov %edx,(%esp)
801015d1: e8 5a 17 00 00 call 80102d30 <log_write>
brelse(bp);
801015d6: 8b 55 e4 mov -0x1c(%ebp),%edx
801015d9: 89 14 24 mov %edx,(%esp)
801015dc: e8 ff eb ff ff call 801001e0 <brelse>
return iget(dev, inum);
}
brelse(bp);
}
panic("ialloc: no inodes");
}
801015e1: 83 c4 2c add $0x2c,%esp
if(dip->type == 0){ // a free inode
memset(dip, 0, sizeof(*dip));
dip->type = type;
log_write(bp); // mark it allocated on the disk
brelse(bp);
return iget(dev, inum);
801015e4: 89 f2 mov %esi,%edx
}
brelse(bp);
}
panic("ialloc: no inodes");
}
801015e6: 5b pop %ebx
if(dip->type == 0){ // a free inode
memset(dip, 0, sizeof(*dip));
dip->type = type;
log_write(bp); // mark it allocated on the disk
brelse(bp);
return iget(dev, inum);
801015e7: 89 f8 mov %edi,%eax
}
brelse(bp);
}
panic("ialloc: no inodes");
}
801015e9: 5e pop %esi
801015ea: 5f pop %edi
801015eb: 5d pop %ebp
if(dip->type == 0){ // a free inode
memset(dip, 0, sizeof(*dip));
dip->type = type;
log_write(bp); // mark it allocated on the disk
brelse(bp);
return iget(dev, inum);
801015ec: e9 2f fc ff ff jmp 80101220 <iget>
}
brelse(bp);
}
panic("ialloc: no inodes");
801015f1: c7 04 24 b4 70 10 80 movl $0x801070b4,(%esp)
801015f8: e8 63 ed ff ff call 80100360 <panic>
801015fd: 8d 76 00 lea 0x0(%esi),%esi
80101600 <iupdate>:
}
// Copy a modified in-memory inode to disk.
void
iupdate(struct inode *ip)
{
80101600: 55 push %ebp
80101601: 89 e5 mov %esp,%ebp
80101603: 56 push %esi
80101604: 53 push %ebx
80101605: 83 ec 10 sub $0x10,%esp
80101608: 8b 5d 08 mov 0x8(%ebp),%ebx
struct buf *bp;
struct dinode *dip;
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
8010160b: 8b 43 04 mov 0x4(%ebx),%eax
dip->type = ip->type;
dip->major = ip->major;
dip->minor = ip->minor;
dip->nlink = ip->nlink;
dip->size = ip->size;
memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
8010160e: 83 c3 5c add $0x5c,%ebx
iupdate(struct inode *ip)
{
struct buf *bp;
struct dinode *dip;
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
80101611: c1 e8 03 shr $0x3,%eax
80101614: 03 05 f4 09 11 80 add 0x801109f4,%eax
8010161a: 89 44 24 04 mov %eax,0x4(%esp)
8010161e: 8b 43 a4 mov -0x5c(%ebx),%eax
80101621: 89 04 24 mov %eax,(%esp)
80101624: e8 a7 ea ff ff call 801000d0 <bread>
dip = (struct dinode*)bp->data + ip->inum%IPB;
80101629: 8b 53 a8 mov -0x58(%ebx),%edx
8010162c: 83 e2 07 and $0x7,%edx
8010162f: c1 e2 06 shl $0x6,%edx
80101632: 8d 54 10 5c lea 0x5c(%eax,%edx,1),%edx
iupdate(struct inode *ip)
{
struct buf *bp;
struct dinode *dip;
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
80101636: 89 c6 mov %eax,%esi
dip = (struct dinode*)bp->data + ip->inum%IPB;
dip->type = ip->type;
80101638: 0f b7 43 f4 movzwl -0xc(%ebx),%eax
dip->major = ip->major;
dip->minor = ip->minor;
dip->nlink = ip->nlink;
dip->size = ip->size;
memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
8010163c: 83 c2 0c add $0xc,%edx
struct buf *bp;
struct dinode *dip;
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
dip = (struct dinode*)bp->data + ip->inum%IPB;
dip->type = ip->type;
8010163f: 66 89 42 f4 mov %ax,-0xc(%edx)
dip->major = ip->major;
80101643: 0f b7 43 f6 movzwl -0xa(%ebx),%eax
80101647: 66 89 42 f6 mov %ax,-0xa(%edx)
dip->minor = ip->minor;
8010164b: 0f b7 43 f8 movzwl -0x8(%ebx),%eax
8010164f: 66 89 42 f8 mov %ax,-0x8(%edx)
dip->nlink = ip->nlink;
80101653: 0f b7 43 fa movzwl -0x6(%ebx),%eax
80101657: 66 89 42 fa mov %ax,-0x6(%edx)
dip->size = ip->size;
8010165b: 8b 43 fc mov -0x4(%ebx),%eax
8010165e: 89 42 fc mov %eax,-0x4(%edx)
memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
80101661: 89 5c 24 04 mov %ebx,0x4(%esp)
80101665: 89 14 24 mov %edx,(%esp)
80101668: c7 44 24 08 34 00 00 movl $0x34,0x8(%esp)
8010166f: 00
80101670: e8 5b 2f 00 00 call 801045d0 <memmove>
log_write(bp);
80101675: 89 34 24 mov %esi,(%esp)
80101678: e8 b3 16 00 00 call 80102d30 <log_write>
brelse(bp);
8010167d: 89 75 08 mov %esi,0x8(%ebp)
}
80101680: 83 c4 10 add $0x10,%esp
80101683: 5b pop %ebx
80101684: 5e pop %esi
80101685: 5d pop %ebp
dip->minor = ip->minor;
dip->nlink = ip->nlink;
dip->size = ip->size;
memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
log_write(bp);
brelse(bp);
80101686: e9 55 eb ff ff jmp 801001e0 <brelse>
8010168b: 90 nop
8010168c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80101690 <idup>:
// Increment reference count for ip.
// Returns ip to enable ip = idup(ip1) idiom.
struct inode*
idup(struct inode *ip)
{
80101690: 55 push %ebp
80101691: 89 e5 mov %esp,%ebp
80101693: 53 push %ebx
80101694: 83 ec 14 sub $0x14,%esp
80101697: 8b 5d 08 mov 0x8(%ebp),%ebx
acquire(&icache.lock);
8010169a: c7 04 24 00 0a 11 80 movl $0x80110a00,(%esp)
801016a1: e8 fa 2c 00 00 call 801043a0 <acquire>
ip->ref++;
801016a6: 83 43 08 01 addl $0x1,0x8(%ebx)
release(&icache.lock);
801016aa: c7 04 24 00 0a 11 80 movl $0x80110a00,(%esp)
801016b1: e8 1a 2e 00 00 call 801044d0 <release>
return ip;
}
801016b6: 83 c4 14 add $0x14,%esp
801016b9: 89 d8 mov %ebx,%eax
801016bb: 5b pop %ebx
801016bc: 5d pop %ebp
801016bd: c3 ret
801016be: 66 90 xchg %ax,%ax
801016c0 <ilock>:
// Lock the given inode.
// Reads the inode from disk if necessary.
void
ilock(struct inode *ip)
{
801016c0: 55 push %ebp
801016c1: 89 e5 mov %esp,%ebp
801016c3: 56 push %esi
801016c4: 53 push %ebx
801016c5: 83 ec 10 sub $0x10,%esp
801016c8: 8b 5d 08 mov 0x8(%ebp),%ebx
struct buf *bp;
struct dinode *dip;
if(ip == 0 || ip->ref < 1)
801016cb: 85 db test %ebx,%ebx
801016cd: 0f 84 b0 00 00 00 je 80101783 <ilock+0xc3>
801016d3: 8b 43 08 mov 0x8(%ebx),%eax
801016d6: 85 c0 test %eax,%eax
801016d8: 0f 8e a5 00 00 00 jle 80101783 <ilock+0xc3>
panic("ilock");
acquiresleep(&ip->lock);
801016de: 8d 43 0c lea 0xc(%ebx),%eax
801016e1: 89 04 24 mov %eax,(%esp)
801016e4: e8 67 2b 00 00 call 80104250 <acquiresleep>
if(!(ip->flags & I_VALID)){
801016e9: f6 43 4c 02 testb $0x2,0x4c(%ebx)
801016ed: 74 09 je 801016f8 <ilock+0x38>
brelse(bp);
ip->flags |= I_VALID;
if(ip->type == 0)
panic("ilock: no type");
}
}
801016ef: 83 c4 10 add $0x10,%esp
801016f2: 5b pop %ebx
801016f3: 5e pop %esi
801016f4: 5d pop %ebp
801016f5: c3 ret
801016f6: 66 90 xchg %ax,%ax
panic("ilock");
acquiresleep(&ip->lock);
if(!(ip->flags & I_VALID)){
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
801016f8: 8b 43 04 mov 0x4(%ebx),%eax
801016fb: c1 e8 03 shr $0x3,%eax
801016fe: 03 05 f4 09 11 80 add 0x801109f4,%eax
80101704: 89 44 24 04 mov %eax,0x4(%esp)
80101708: 8b 03 mov (%ebx),%eax
8010170a: 89 04 24 mov %eax,(%esp)
8010170d: e8 be e9 ff ff call 801000d0 <bread>
dip = (struct dinode*)bp->data + ip->inum%IPB;
80101712: 8b 53 04 mov 0x4(%ebx),%edx
80101715: 83 e2 07 and $0x7,%edx
80101718: c1 e2 06 shl $0x6,%edx
8010171b: 8d 54 10 5c lea 0x5c(%eax,%edx,1),%edx
panic("ilock");
acquiresleep(&ip->lock);
if(!(ip->flags & I_VALID)){
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
8010171f: 89 c6 mov %eax,%esi
dip = (struct dinode*)bp->data + ip->inum%IPB;
ip->type = dip->type;
80101721: 0f b7 02 movzwl (%edx),%eax
ip->major = dip->major;
ip->minor = dip->minor;
ip->nlink = dip->nlink;
ip->size = dip->size;
memmove(ip->addrs, dip->addrs, sizeof(ip->addrs));
80101724: 83 c2 0c add $0xc,%edx
acquiresleep(&ip->lock);
if(!(ip->flags & I_VALID)){
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
dip = (struct dinode*)bp->data + ip->inum%IPB;
ip->type = dip->type;
80101727: 66 89 43 50 mov %ax,0x50(%ebx)
ip->major = dip->major;
8010172b: 0f b7 42 f6 movzwl -0xa(%edx),%eax
8010172f: 66 89 43 52 mov %ax,0x52(%ebx)
ip->minor = dip->minor;
80101733: 0f b7 42 f8 movzwl -0x8(%edx),%eax
80101737: 66 89 43 54 mov %ax,0x54(%ebx)
ip->nlink = dip->nlink;
8010173b: 0f b7 42 fa movzwl -0x6(%edx),%eax
8010173f: 66 89 43 56 mov %ax,0x56(%ebx)
ip->size = dip->size;
80101743: 8b 42 fc mov -0x4(%edx),%eax
80101746: 89 43 58 mov %eax,0x58(%ebx)
memmove(ip->addrs, dip->addrs, sizeof(ip->addrs));
80101749: 8d 43 5c lea 0x5c(%ebx),%eax
8010174c: 89 54 24 04 mov %edx,0x4(%esp)
80101750: c7 44 24 08 34 00 00 movl $0x34,0x8(%esp)
80101757: 00
80101758: 89 04 24 mov %eax,(%esp)
8010175b: e8 70 2e 00 00 call 801045d0 <memmove>
brelse(bp);
80101760: 89 34 24 mov %esi,(%esp)
80101763: e8 78 ea ff ff call 801001e0 <brelse>
ip->flags |= I_VALID;
80101768: 83 4b 4c 02 orl $0x2,0x4c(%ebx)
if(ip->type == 0)
8010176c: 66 83 7b 50 00 cmpw $0x0,0x50(%ebx)
80101771: 0f 85 78 ff ff ff jne 801016ef <ilock+0x2f>
panic("ilock: no type");
80101777: c7 04 24 cc 70 10 80 movl $0x801070cc,(%esp)
8010177e: e8 dd eb ff ff call 80100360 <panic>
{
struct buf *bp;
struct dinode *dip;
if(ip == 0 || ip->ref < 1)
panic("ilock");
80101783: c7 04 24 c6 70 10 80 movl $0x801070c6,(%esp)
8010178a: e8 d1 eb ff ff call 80100360 <panic>
8010178f: 90 nop
80101790 <iunlock>:
}
// Unlock the given inode.
void
iunlock(struct inode *ip)
{
80101790: 55 push %ebp
80101791: 89 e5 mov %esp,%ebp
80101793: 56 push %esi
80101794: 53 push %ebx
80101795: 83 ec 10 sub $0x10,%esp
80101798: 8b 5d 08 mov 0x8(%ebp),%ebx
if(ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1)
8010179b: 85 db test %ebx,%ebx
8010179d: 74 24 je 801017c3 <iunlock+0x33>
8010179f: 8d 73 0c lea 0xc(%ebx),%esi
801017a2: 89 34 24 mov %esi,(%esp)
801017a5: e8 46 2b 00 00 call 801042f0 <holdingsleep>
801017aa: 85 c0 test %eax,%eax
801017ac: 74 15 je 801017c3 <iunlock+0x33>
801017ae: 8b 43 08 mov 0x8(%ebx),%eax
801017b1: 85 c0 test %eax,%eax
801017b3: 7e 0e jle 801017c3 <iunlock+0x33>
panic("iunlock");
releasesleep(&ip->lock);
801017b5: 89 75 08 mov %esi,0x8(%ebp)
}
801017b8: 83 c4 10 add $0x10,%esp
801017bb: 5b pop %ebx
801017bc: 5e pop %esi
801017bd: 5d pop %ebp
iunlock(struct inode *ip)
{
if(ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1)
panic("iunlock");
releasesleep(&ip->lock);
801017be: e9 ed 2a 00 00 jmp 801042b0 <releasesleep>
// Unlock the given inode.
void
iunlock(struct inode *ip)
{
if(ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1)
panic("iunlock");
801017c3: c7 04 24 db 70 10 80 movl $0x801070db,(%esp)
801017ca: e8 91 eb ff ff call 80100360 <panic>
801017cf: 90 nop
801017d0 <iput>:
// to it, free the inode (and its content) on disk.
// All calls to iput() must be inside a transaction in
// case it has to free the inode.
void
iput(struct inode *ip)
{
801017d0: 55 push %ebp
801017d1: 89 e5 mov %esp,%ebp
801017d3: 57 push %edi
801017d4: 56 push %esi
801017d5: 53 push %ebx
801017d6: 83 ec 1c sub $0x1c,%esp
801017d9: 8b 75 08 mov 0x8(%ebp),%esi
acquire(&icache.lock);
801017dc: c7 04 24 00 0a 11 80 movl $0x80110a00,(%esp)
801017e3: e8 b8 2b 00 00 call 801043a0 <acquire>
if(ip->ref == 1 && (ip->flags & I_VALID) && ip->nlink == 0){
801017e8: 8b 46 08 mov 0x8(%esi),%eax
801017eb: 83 f8 01 cmp $0x1,%eax
801017ee: 74 20 je 80101810 <iput+0x40>
ip->type = 0;
iupdate(ip);
acquire(&icache.lock);
ip->flags = 0;
}
ip->ref--;
801017f0: 83 e8 01 sub $0x1,%eax
801017f3: 89 46 08 mov %eax,0x8(%esi)
release(&icache.lock);
801017f6: c7 45 08 00 0a 11 80 movl $0x80110a00,0x8(%ebp)
}
801017fd: 83 c4 1c add $0x1c,%esp
80101800: 5b pop %ebx
80101801: 5e pop %esi
80101802: 5f pop %edi
80101803: 5d pop %ebp
iupdate(ip);
acquire(&icache.lock);
ip->flags = 0;
}
ip->ref--;
release(&icache.lock);
80101804: e9 c7 2c 00 00 jmp 801044d0 <release>
80101809: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
// case it has to free the inode.
void
iput(struct inode *ip)
{
acquire(&icache.lock);
if(ip->ref == 1 && (ip->flags & I_VALID) && ip->nlink == 0){
80101810: f6 46 4c 02 testb $0x2,0x4c(%esi)
80101814: 74 da je 801017f0 <iput+0x20>
80101816: 66 83 7e 56 00 cmpw $0x0,0x56(%esi)
8010181b: 75 d3 jne 801017f0 <iput+0x20>
// inode has no links and no other references: truncate and free.
release(&icache.lock);
8010181d: c7 04 24 00 0a 11 80 movl $0x80110a00,(%esp)
80101824: 89 f3 mov %esi,%ebx
80101826: e8 a5 2c 00 00 call 801044d0 <release>
8010182b: 8d 7e 30 lea 0x30(%esi),%edi
8010182e: eb 07 jmp 80101837 <iput+0x67>
80101830: 83 c3 04 add $0x4,%ebx
{
int i, j;
struct buf *bp;
uint *a;
for(i = 0; i < NDIRECT; i++){
80101833: 39 fb cmp %edi,%ebx
80101835: 74 19 je 80101850 <iput+0x80>
if(ip->addrs[i]){
80101837: 8b 53 5c mov 0x5c(%ebx),%edx
8010183a: 85 d2 test %edx,%edx
8010183c: 74 f2 je 80101830 <iput+0x60>
bfree(ip->dev, ip->addrs[i]);
8010183e: 8b 06 mov (%esi),%eax
80101840: e8 ab fb ff ff call 801013f0 <bfree>
ip->addrs[i] = 0;
80101845: c7 43 5c 00 00 00 00 movl $0x0,0x5c(%ebx)
8010184c: eb e2 jmp 80101830 <iput+0x60>
8010184e: 66 90 xchg %ax,%ax
}
}
if(ip->addrs[NDIRECT]){
80101850: 8b 86 8c 00 00 00 mov 0x8c(%esi),%eax
80101856: 85 c0 test %eax,%eax
80101858: 75 3e jne 80101898 <iput+0xc8>
brelse(bp);
bfree(ip->dev, ip->addrs[NDIRECT]);
ip->addrs[NDIRECT] = 0;
}
ip->size = 0;
8010185a: c7 46 58 00 00 00 00 movl $0x0,0x58(%esi)
iupdate(ip);
80101861: 89 34 24 mov %esi,(%esp)
80101864: e8 97 fd ff ff call 80101600 <iupdate>
acquire(&icache.lock);
if(ip->ref == 1 && (ip->flags & I_VALID) && ip->nlink == 0){
// inode has no links and no other references: truncate and free.
release(&icache.lock);
itrunc(ip);
ip->type = 0;
80101869: 31 c0 xor %eax,%eax
8010186b: 66 89 46 50 mov %ax,0x50(%esi)
iupdate(ip);
8010186f: 89 34 24 mov %esi,(%esp)
80101872: e8 89 fd ff ff call 80101600 <iupdate>
acquire(&icache.lock);
80101877: c7 04 24 00 0a 11 80 movl $0x80110a00,(%esp)
8010187e: e8 1d 2b 00 00 call 801043a0 <acquire>
80101883: 8b 46 08 mov 0x8(%esi),%eax
ip->flags = 0;
80101886: c7 46 4c 00 00 00 00 movl $0x0,0x4c(%esi)
8010188d: e9 5e ff ff ff jmp 801017f0 <iput+0x20>
80101892: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
ip->addrs[i] = 0;
}
}
if(ip->addrs[NDIRECT]){
bp = bread(ip->dev, ip->addrs[NDIRECT]);
80101898: 89 44 24 04 mov %eax,0x4(%esp)
8010189c: 8b 06 mov (%esi),%eax
a = (uint*)bp->data;
for(j = 0; j < NINDIRECT; j++){
8010189e: 31 db xor %ebx,%ebx
ip->addrs[i] = 0;
}
}
if(ip->addrs[NDIRECT]){
bp = bread(ip->dev, ip->addrs[NDIRECT]);
801018a0: 89 04 24 mov %eax,(%esp)
801018a3: e8 28 e8 ff ff call 801000d0 <bread>
801018a8: 89 45 e4 mov %eax,-0x1c(%ebp)
a = (uint*)bp->data;
801018ab: 8d 78 5c lea 0x5c(%eax),%edi
for(j = 0; j < NINDIRECT; j++){
801018ae: 31 c0 xor %eax,%eax
801018b0: eb 13 jmp 801018c5 <iput+0xf5>
801018b2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801018b8: 83 c3 01 add $0x1,%ebx
801018bb: 81 fb 80 00 00 00 cmp $0x80,%ebx
801018c1: 89 d8 mov %ebx,%eax
801018c3: 74 10 je 801018d5 <iput+0x105>
if(a[j])
801018c5: 8b 14 87 mov (%edi,%eax,4),%edx
801018c8: 85 d2 test %edx,%edx
801018ca: 74 ec je 801018b8 <iput+0xe8>
bfree(ip->dev, a[j]);
801018cc: 8b 06 mov (%esi),%eax
801018ce: e8 1d fb ff ff call 801013f0 <bfree>
801018d3: eb e3 jmp 801018b8 <iput+0xe8>
}
brelse(bp);
801018d5: 8b 45 e4 mov -0x1c(%ebp),%eax
801018d8: 89 04 24 mov %eax,(%esp)
801018db: e8 00 e9 ff ff call 801001e0 <brelse>
bfree(ip->dev, ip->addrs[NDIRECT]);
801018e0: 8b 96 8c 00 00 00 mov 0x8c(%esi),%edx
801018e6: 8b 06 mov (%esi),%eax
801018e8: e8 03 fb ff ff call 801013f0 <bfree>
ip->addrs[NDIRECT] = 0;
801018ed: c7 86 8c 00 00 00 00 movl $0x0,0x8c(%esi)
801018f4: 00 00 00
801018f7: e9 5e ff ff ff jmp 8010185a <iput+0x8a>
801018fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80101900 <iunlockput>:
}
// Common idiom: unlock, then put.
void
iunlockput(struct inode *ip)
{
80101900: 55 push %ebp
80101901: 89 e5 mov %esp,%ebp
80101903: 53 push %ebx
80101904: 83 ec 14 sub $0x14,%esp
80101907: 8b 5d 08 mov 0x8(%ebp),%ebx
iunlock(ip);
8010190a: 89 1c 24 mov %ebx,(%esp)
8010190d: e8 7e fe ff ff call 80101790 <iunlock>
iput(ip);
80101912: 89 5d 08 mov %ebx,0x8(%ebp)
}
80101915: 83 c4 14 add $0x14,%esp
80101918: 5b pop %ebx
80101919: 5d pop %ebp
// Common idiom: unlock, then put.
void
iunlockput(struct inode *ip)
{
iunlock(ip);
iput(ip);
8010191a: e9 b1 fe ff ff jmp 801017d0 <iput>
8010191f: 90 nop
80101920 <stati>:
}
// Copy stat information from inode.
void
stati(struct inode *ip, struct stat *st)
{
80101920: 55 push %ebp
80101921: 89 e5 mov %esp,%ebp
80101923: 8b 55 08 mov 0x8(%ebp),%edx
80101926: 8b 45 0c mov 0xc(%ebp),%eax
st->dev = ip->dev;
80101929: 8b 0a mov (%edx),%ecx
8010192b: 89 48 04 mov %ecx,0x4(%eax)
st->ino = ip->inum;
8010192e: 8b 4a 04 mov 0x4(%edx),%ecx
80101931: 89 48 08 mov %ecx,0x8(%eax)
st->type = ip->type;
80101934: 0f b7 4a 50 movzwl 0x50(%edx),%ecx
80101938: 66 89 08 mov %cx,(%eax)
st->nlink = ip->nlink;
8010193b: 0f b7 4a 56 movzwl 0x56(%edx),%ecx
8010193f: 66 89 48 0c mov %cx,0xc(%eax)
st->size = ip->size;
80101943: 8b 52 58 mov 0x58(%edx),%edx
80101946: 89 50 10 mov %edx,0x10(%eax)
}
80101949: 5d pop %ebp
8010194a: c3 ret
8010194b: 90 nop
8010194c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80101950 <readi>:
//PAGEBREAK!
// Read data from inode.
int
readi(struct inode *ip, char *dst, uint off, uint n)
{
80101950: 55 push %ebp
80101951: 89 e5 mov %esp,%ebp
80101953: 57 push %edi
80101954: 56 push %esi
80101955: 53 push %ebx
80101956: 83 ec 2c sub $0x2c,%esp
80101959: 8b 45 0c mov 0xc(%ebp),%eax
8010195c: 8b 7d 08 mov 0x8(%ebp),%edi
8010195f: 8b 75 10 mov 0x10(%ebp),%esi
80101962: 89 45 e0 mov %eax,-0x20(%ebp)
80101965: 8b 45 14 mov 0x14(%ebp),%eax
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
80101968: 66 83 7f 50 03 cmpw $0x3,0x50(%edi)
//PAGEBREAK!
// Read data from inode.
int
readi(struct inode *ip, char *dst, uint off, uint n)
{
8010196d: 89 45 e4 mov %eax,-0x1c(%ebp)
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
80101970: 0f 84 aa 00 00 00 je 80101a20 <readi+0xd0>
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read)
return -1;
return devsw[ip->major].read(ip, dst, n);
}
if(off > ip->size || off + n < off)
80101976: 8b 47 58 mov 0x58(%edi),%eax
80101979: 39 f0 cmp %esi,%eax
8010197b: 0f 82 c7 00 00 00 jb 80101a48 <readi+0xf8>
80101981: 8b 5d e4 mov -0x1c(%ebp),%ebx
80101984: 89 da mov %ebx,%edx
80101986: 01 f2 add %esi,%edx
80101988: 0f 82 ba 00 00 00 jb 80101a48 <readi+0xf8>
return -1;
if(off + n > ip->size)
n = ip->size - off;
8010198e: 89 c1 mov %eax,%ecx
80101990: 29 f1 sub %esi,%ecx
80101992: 39 d0 cmp %edx,%eax
80101994: 0f 43 cb cmovae %ebx,%ecx
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
80101997: 31 c0 xor %eax,%eax
80101999: 85 c9 test %ecx,%ecx
}
if(off > ip->size || off + n < off)
return -1;
if(off + n > ip->size)
n = ip->size - off;
8010199b: 89 4d e4 mov %ecx,-0x1c(%ebp)
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
8010199e: 74 70 je 80101a10 <readi+0xc0>
801019a0: 89 7d d8 mov %edi,-0x28(%ebp)
801019a3: 89 c7 mov %eax,%edi
801019a5: 8d 76 00 lea 0x0(%esi),%esi
bp = bread(ip->dev, bmap(ip, off/BSIZE));
801019a8: 8b 5d d8 mov -0x28(%ebp),%ebx
801019ab: 89 f2 mov %esi,%edx
801019ad: c1 ea 09 shr $0x9,%edx
801019b0: 89 d8 mov %ebx,%eax
801019b2: e8 29 f9 ff ff call 801012e0 <bmap>
801019b7: 89 44 24 04 mov %eax,0x4(%esp)
801019bb: 8b 03 mov (%ebx),%eax
m = min(n - tot, BSIZE - off%BSIZE);
801019bd: bb 00 02 00 00 mov $0x200,%ebx
return -1;
if(off + n > ip->size)
n = ip->size - off;
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
bp = bread(ip->dev, bmap(ip, off/BSIZE));
801019c2: 89 04 24 mov %eax,(%esp)
801019c5: e8 06 e7 ff ff call 801000d0 <bread>
m = min(n - tot, BSIZE - off%BSIZE);
801019ca: 8b 4d e4 mov -0x1c(%ebp),%ecx
801019cd: 29 f9 sub %edi,%ecx
return -1;
if(off + n > ip->size)
n = ip->size - off;
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
bp = bread(ip->dev, bmap(ip, off/BSIZE));
801019cf: 89 c2 mov %eax,%edx
m = min(n - tot, BSIZE - off%BSIZE);
801019d1: 89 f0 mov %esi,%eax
801019d3: 25 ff 01 00 00 and $0x1ff,%eax
801019d8: 29 c3 sub %eax,%ebx
for (int j = 0; j < min(m, 10); j++) {
cprintf("%x ", bp->data[off%BSIZE+j]);
}
cprintf("\n");
*/
memmove(dst, bp->data + off%BSIZE, m);
801019da: 8d 44 02 5c lea 0x5c(%edx,%eax,1),%eax
if(off + n > ip->size)
n = ip->size - off;
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
bp = bread(ip->dev, bmap(ip, off/BSIZE));
m = min(n - tot, BSIZE - off%BSIZE);
801019de: 39 cb cmp %ecx,%ebx
for (int j = 0; j < min(m, 10); j++) {
cprintf("%x ", bp->data[off%BSIZE+j]);
}
cprintf("\n");
*/
memmove(dst, bp->data + off%BSIZE, m);
801019e0: 89 44 24 04 mov %eax,0x4(%esp)
801019e4: 8b 45 e0 mov -0x20(%ebp),%eax
if(off + n > ip->size)
n = ip->size - off;
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
bp = bread(ip->dev, bmap(ip, off/BSIZE));
m = min(n - tot, BSIZE - off%BSIZE);
801019e7: 0f 47 d9 cmova %ecx,%ebx
for (int j = 0; j < min(m, 10); j++) {
cprintf("%x ", bp->data[off%BSIZE+j]);
}
cprintf("\n");
*/
memmove(dst, bp->data + off%BSIZE, m);
801019ea: 89 5c 24 08 mov %ebx,0x8(%esp)
if(off > ip->size || off + n < off)
return -1;
if(off + n > ip->size)
n = ip->size - off;
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
801019ee: 01 df add %ebx,%edi
801019f0: 01 de add %ebx,%esi
for (int j = 0; j < min(m, 10); j++) {
cprintf("%x ", bp->data[off%BSIZE+j]);
}
cprintf("\n");
*/
memmove(dst, bp->data + off%BSIZE, m);
801019f2: 89 55 dc mov %edx,-0x24(%ebp)
801019f5: 89 04 24 mov %eax,(%esp)
801019f8: e8 d3 2b 00 00 call 801045d0 <memmove>
brelse(bp);
801019fd: 8b 55 dc mov -0x24(%ebp),%edx
80101a00: 89 14 24 mov %edx,(%esp)
80101a03: e8 d8 e7 ff ff call 801001e0 <brelse>
if(off > ip->size || off + n < off)
return -1;
if(off + n > ip->size)
n = ip->size - off;
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
80101a08: 01 5d e0 add %ebx,-0x20(%ebp)
80101a0b: 39 7d e4 cmp %edi,-0x1c(%ebp)
80101a0e: 77 98 ja 801019a8 <readi+0x58>
cprintf("\n");
*/
memmove(dst, bp->data + off%BSIZE, m);
brelse(bp);
}
return n;
80101a10: 8b 45 e4 mov -0x1c(%ebp),%eax
}
80101a13: 83 c4 2c add $0x2c,%esp
80101a16: 5b pop %ebx
80101a17: 5e pop %esi
80101a18: 5f pop %edi
80101a19: 5d pop %ebp
80101a1a: c3 ret
80101a1b: 90 nop
80101a1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
{
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read)
80101a20: 0f bf 47 52 movswl 0x52(%edi),%eax
80101a24: 66 83 f8 09 cmp $0x9,%ax
80101a28: 77 1e ja 80101a48 <readi+0xf8>
80101a2a: 8b 04 c5 80 09 11 80 mov -0x7feef680(,%eax,8),%eax
80101a31: 85 c0 test %eax,%eax
80101a33: 74 13 je 80101a48 <readi+0xf8>
return -1;
return devsw[ip->major].read(ip, dst, n);
80101a35: 8b 75 e4 mov -0x1c(%ebp),%esi
80101a38: 89 75 10 mov %esi,0x10(%ebp)
*/
memmove(dst, bp->data + off%BSIZE, m);
brelse(bp);
}
return n;
}
80101a3b: 83 c4 2c add $0x2c,%esp
80101a3e: 5b pop %ebx
80101a3f: 5e pop %esi
80101a40: 5f pop %edi
80101a41: 5d pop %ebp
struct buf *bp;
if(ip->type == T_DEV){
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read)
return -1;
return devsw[ip->major].read(ip, dst, n);
80101a42: ff e0 jmp *%eax
80101a44: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read)
return -1;
80101a48: b8 ff ff ff ff mov $0xffffffff,%eax
80101a4d: eb c4 jmp 80101a13 <readi+0xc3>
80101a4f: 90 nop
80101a50 <writei>:
// PAGEBREAK!
// Write data to inode.
int
writei(struct inode *ip, char *src, uint off, uint n)
{
80101a50: 55 push %ebp
80101a51: 89 e5 mov %esp,%ebp
80101a53: 57 push %edi
80101a54: 56 push %esi
80101a55: 53 push %ebx
80101a56: 83 ec 2c sub $0x2c,%esp
80101a59: 8b 45 08 mov 0x8(%ebp),%eax
80101a5c: 8b 75 0c mov 0xc(%ebp),%esi
80101a5f: 8b 4d 14 mov 0x14(%ebp),%ecx
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
80101a62: 66 83 78 50 03 cmpw $0x3,0x50(%eax)
// PAGEBREAK!
// Write data to inode.
int
writei(struct inode *ip, char *src, uint off, uint n)
{
80101a67: 89 75 dc mov %esi,-0x24(%ebp)
80101a6a: 8b 75 10 mov 0x10(%ebp),%esi
80101a6d: 89 45 d8 mov %eax,-0x28(%ebp)
80101a70: 89 4d e0 mov %ecx,-0x20(%ebp)
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
80101a73: 0f 84 b7 00 00 00 je 80101b30 <writei+0xe0>
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write)
return -1;
return devsw[ip->major].write(ip, src, n);
}
if(off > ip->size || off + n < off)
80101a79: 8b 45 d8 mov -0x28(%ebp),%eax
80101a7c: 39 70 58 cmp %esi,0x58(%eax)
80101a7f: 0f 82 e3 00 00 00 jb 80101b68 <writei+0x118>
80101a85: 8b 4d e0 mov -0x20(%ebp),%ecx
80101a88: 89 c8 mov %ecx,%eax
80101a8a: 01 f0 add %esi,%eax
80101a8c: 0f 82 d6 00 00 00 jb 80101b68 <writei+0x118>
return -1;
if(off + n > MAXFILE*BSIZE)
80101a92: 3d 00 18 01 00 cmp $0x11800,%eax
80101a97: 0f 87 cb 00 00 00 ja 80101b68 <writei+0x118>
return -1;
for(tot=0; tot<n; tot+=m, off+=m, src+=m){
80101a9d: 85 c9 test %ecx,%ecx
80101a9f: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
80101aa6: 74 77 je 80101b1f <writei+0xcf>
bp = bread(ip->dev, bmap(ip, off/BSIZE));
80101aa8: 8b 7d d8 mov -0x28(%ebp),%edi
80101aab: 89 f2 mov %esi,%edx
m = min(n - tot, BSIZE - off%BSIZE);
80101aad: bb 00 02 00 00 mov $0x200,%ebx
return -1;
if(off + n > MAXFILE*BSIZE)
return -1;
for(tot=0; tot<n; tot+=m, off+=m, src+=m){
bp = bread(ip->dev, bmap(ip, off/BSIZE));
80101ab2: c1 ea 09 shr $0x9,%edx
80101ab5: 89 f8 mov %edi,%eax
80101ab7: e8 24 f8 ff ff call 801012e0 <bmap>
80101abc: 89 44 24 04 mov %eax,0x4(%esp)
80101ac0: 8b 07 mov (%edi),%eax
80101ac2: 89 04 24 mov %eax,(%esp)
80101ac5: e8 06 e6 ff ff call 801000d0 <bread>
m = min(n - tot, BSIZE - off%BSIZE);
80101aca: 8b 4d e0 mov -0x20(%ebp),%ecx
80101acd: 2b 4d e4 sub -0x1c(%ebp),%ecx
memmove(bp->data + off%BSIZE, src, m);
80101ad0: 8b 55 dc mov -0x24(%ebp),%edx
return -1;
if(off + n > MAXFILE*BSIZE)
return -1;
for(tot=0; tot<n; tot+=m, off+=m, src+=m){
bp = bread(ip->dev, bmap(ip, off/BSIZE));
80101ad3: 89 c7 mov %eax,%edi
m = min(n - tot, BSIZE - off%BSIZE);
80101ad5: 89 f0 mov %esi,%eax
80101ad7: 25 ff 01 00 00 and $0x1ff,%eax
80101adc: 29 c3 sub %eax,%ebx
80101ade: 39 cb cmp %ecx,%ebx
80101ae0: 0f 47 d9 cmova %ecx,%ebx
memmove(bp->data + off%BSIZE, src, m);
80101ae3: 8d 44 07 5c lea 0x5c(%edi,%eax,1),%eax
if(off > ip->size || off + n < off)
return -1;
if(off + n > MAXFILE*BSIZE)
return -1;
for(tot=0; tot<n; tot+=m, off+=m, src+=m){
80101ae7: 01 de add %ebx,%esi
bp = bread(ip->dev, bmap(ip, off/BSIZE));
m = min(n - tot, BSIZE - off%BSIZE);
memmove(bp->data + off%BSIZE, src, m);
80101ae9: 89 54 24 04 mov %edx,0x4(%esp)
80101aed: 89 5c 24 08 mov %ebx,0x8(%esp)
80101af1: 89 04 24 mov %eax,(%esp)
80101af4: e8 d7 2a 00 00 call 801045d0 <memmove>
log_write(bp);
80101af9: 89 3c 24 mov %edi,(%esp)
80101afc: e8 2f 12 00 00 call 80102d30 <log_write>
brelse(bp);
80101b01: 89 3c 24 mov %edi,(%esp)
80101b04: e8 d7 e6 ff ff call 801001e0 <brelse>
if(off > ip->size || off + n < off)
return -1;
if(off + n > MAXFILE*BSIZE)
return -1;
for(tot=0; tot<n; tot+=m, off+=m, src+=m){
80101b09: 01 5d e4 add %ebx,-0x1c(%ebp)
80101b0c: 8b 45 e4 mov -0x1c(%ebp),%eax
80101b0f: 01 5d dc add %ebx,-0x24(%ebp)
80101b12: 39 45 e0 cmp %eax,-0x20(%ebp)
80101b15: 77 91 ja 80101aa8 <writei+0x58>
memmove(bp->data + off%BSIZE, src, m);
log_write(bp);
brelse(bp);
}
if(n > 0 && off > ip->size){
80101b17: 8b 45 d8 mov -0x28(%ebp),%eax
80101b1a: 39 70 58 cmp %esi,0x58(%eax)
80101b1d: 72 39 jb 80101b58 <writei+0x108>
ip->size = off;
iupdate(ip);
}
return n;
80101b1f: 8b 45 e0 mov -0x20(%ebp),%eax
}
80101b22: 83 c4 2c add $0x2c,%esp
80101b25: 5b pop %ebx
80101b26: 5e pop %esi
80101b27: 5f pop %edi
80101b28: 5d pop %ebp
80101b29: c3 ret
80101b2a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
{
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write)
80101b30: 0f bf 40 52 movswl 0x52(%eax),%eax
80101b34: 66 83 f8 09 cmp $0x9,%ax
80101b38: 77 2e ja 80101b68 <writei+0x118>
80101b3a: 8b 04 c5 84 09 11 80 mov -0x7feef67c(,%eax,8),%eax
80101b41: 85 c0 test %eax,%eax
80101b43: 74 23 je 80101b68 <writei+0x118>
return -1;
return devsw[ip->major].write(ip, src, n);
80101b45: 89 4d 10 mov %ecx,0x10(%ebp)
if(n > 0 && off > ip->size){
ip->size = off;
iupdate(ip);
}
return n;
}
80101b48: 83 c4 2c add $0x2c,%esp
80101b4b: 5b pop %ebx
80101b4c: 5e pop %esi
80101b4d: 5f pop %edi
80101b4e: 5d pop %ebp
struct buf *bp;
if(ip->type == T_DEV){
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write)
return -1;
return devsw[ip->major].write(ip, src, n);
80101b4f: ff e0 jmp *%eax
80101b51: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
log_write(bp);
brelse(bp);
}
if(n > 0 && off > ip->size){
ip->size = off;
80101b58: 8b 45 d8 mov -0x28(%ebp),%eax
80101b5b: 89 70 58 mov %esi,0x58(%eax)
iupdate(ip);
80101b5e: 89 04 24 mov %eax,(%esp)
80101b61: e8 9a fa ff ff call 80101600 <iupdate>
80101b66: eb b7 jmp 80101b1f <writei+0xcf>
}
return n;
}
80101b68: 83 c4 2c add $0x2c,%esp
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write)
return -1;
80101b6b: b8 ff ff ff ff mov $0xffffffff,%eax
if(n > 0 && off > ip->size){
ip->size = off;
iupdate(ip);
}
return n;
}
80101b70: 5b pop %ebx
80101b71: 5e pop %esi
80101b72: 5f pop %edi
80101b73: 5d pop %ebp
80101b74: c3 ret
80101b75: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80101b79: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80101b80 <namecmp>:
//PAGEBREAK!
// Directories
int
namecmp(const char *s, const char *t)
{
80101b80: 55 push %ebp
80101b81: 89 e5 mov %esp,%ebp
80101b83: 83 ec 18 sub $0x18,%esp
return strncmp(s, t, DIRSIZ);
80101b86: 8b 45 0c mov 0xc(%ebp),%eax
80101b89: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp)
80101b90: 00
80101b91: 89 44 24 04 mov %eax,0x4(%esp)
80101b95: 8b 45 08 mov 0x8(%ebp),%eax
80101b98: 89 04 24 mov %eax,(%esp)
80101b9b: e8 b0 2a 00 00 call 80104650 <strncmp>
}
80101ba0: c9 leave
80101ba1: c3 ret
80101ba2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80101ba9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80101bb0 <dirlookup>:
// Look for a directory entry in a directory.
// If found, set *poff to byte offset of entry.
struct inode*
dirlookup(struct inode *dp, char *name, uint *poff)
{
80101bb0: 55 push %ebp
80101bb1: 89 e5 mov %esp,%ebp
80101bb3: 57 push %edi
80101bb4: 56 push %esi
80101bb5: 53 push %ebx
80101bb6: 83 ec 2c sub $0x2c,%esp
80101bb9: 8b 5d 08 mov 0x8(%ebp),%ebx
uint off, inum;
struct dirent de;
if(dp->type != T_DIR)
80101bbc: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx)
80101bc1: 0f 85 97 00 00 00 jne 80101c5e <dirlookup+0xae>
panic("dirlookup not DIR");
for(off = 0; off < dp->size; off += sizeof(de)){
80101bc7: 8b 53 58 mov 0x58(%ebx),%edx
80101bca: 31 ff xor %edi,%edi
80101bcc: 8d 75 d8 lea -0x28(%ebp),%esi
80101bcf: 85 d2 test %edx,%edx
80101bd1: 75 0d jne 80101be0 <dirlookup+0x30>
80101bd3: eb 73 jmp 80101c48 <dirlookup+0x98>
80101bd5: 8d 76 00 lea 0x0(%esi),%esi
80101bd8: 83 c7 10 add $0x10,%edi
80101bdb: 39 7b 58 cmp %edi,0x58(%ebx)
80101bde: 76 68 jbe 80101c48 <dirlookup+0x98>
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80101be0: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp)
80101be7: 00
80101be8: 89 7c 24 08 mov %edi,0x8(%esp)
80101bec: 89 74 24 04 mov %esi,0x4(%esp)
80101bf0: 89 1c 24 mov %ebx,(%esp)
80101bf3: e8 58 fd ff ff call 80101950 <readi>
80101bf8: 83 f8 10 cmp $0x10,%eax
80101bfb: 75 55 jne 80101c52 <dirlookup+0xa2>
panic("dirlink read");
if(de.inum == 0)
80101bfd: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp)
80101c02: 74 d4 je 80101bd8 <dirlookup+0x28>
// Directories
int
namecmp(const char *s, const char *t)
{
return strncmp(s, t, DIRSIZ);
80101c04: 8d 45 da lea -0x26(%ebp),%eax
80101c07: 89 44 24 04 mov %eax,0x4(%esp)
80101c0b: 8b 45 0c mov 0xc(%ebp),%eax
80101c0e: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp)
80101c15: 00
80101c16: 89 04 24 mov %eax,(%esp)
80101c19: e8 32 2a 00 00 call 80104650 <strncmp>
for(off = 0; off < dp->size; off += sizeof(de)){
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("dirlink read");
if(de.inum == 0)
continue;
if(namecmp(name, de.name) == 0){
80101c1e: 85 c0 test %eax,%eax
80101c20: 75 b6 jne 80101bd8 <dirlookup+0x28>
// entry matches path element
if(poff)
80101c22: 8b 45 10 mov 0x10(%ebp),%eax
80101c25: 85 c0 test %eax,%eax
80101c27: 74 05 je 80101c2e <dirlookup+0x7e>
*poff = off;
80101c29: 8b 45 10 mov 0x10(%ebp),%eax
80101c2c: 89 38 mov %edi,(%eax)
inum = de.inum;
80101c2e: 0f b7 55 d8 movzwl -0x28(%ebp),%edx
return iget(dp->dev, inum);
80101c32: 8b 03 mov (%ebx),%eax
80101c34: e8 e7 f5 ff ff call 80101220 <iget>
}
}
return 0;
}
80101c39: 83 c4 2c add $0x2c,%esp
80101c3c: 5b pop %ebx
80101c3d: 5e pop %esi
80101c3e: 5f pop %edi
80101c3f: 5d pop %ebp
80101c40: c3 ret
80101c41: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80101c48: 83 c4 2c add $0x2c,%esp
inum = de.inum;
return iget(dp->dev, inum);
}
}
return 0;
80101c4b: 31 c0 xor %eax,%eax
}
80101c4d: 5b pop %ebx
80101c4e: 5e pop %esi
80101c4f: 5f pop %edi
80101c50: 5d pop %ebp
80101c51: c3 ret
if(dp->type != T_DIR)
panic("dirlookup not DIR");
for(off = 0; off < dp->size; off += sizeof(de)){
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("dirlink read");
80101c52: c7 04 24 f5 70 10 80 movl $0x801070f5,(%esp)
80101c59: e8 02 e7 ff ff call 80100360 <panic>
{
uint off, inum;
struct dirent de;
if(dp->type != T_DIR)
panic("dirlookup not DIR");
80101c5e: c7 04 24 e3 70 10 80 movl $0x801070e3,(%esp)
80101c65: e8 f6 e6 ff ff call 80100360 <panic>
80101c6a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80101c70 <namex>:
// If parent != 0, return the inode for the parent and copy the final
// path element into name, which must have room for DIRSIZ bytes.
// Must be called inside a transaction since it calls iput().
static struct inode*
namex(char *path, int nameiparent, char *name)
{
80101c70: 55 push %ebp
80101c71: 89 e5 mov %esp,%ebp
80101c73: 57 push %edi
80101c74: 89 cf mov %ecx,%edi
80101c76: 56 push %esi
80101c77: 53 push %ebx
80101c78: 89 c3 mov %eax,%ebx
80101c7a: 83 ec 2c sub $0x2c,%esp
struct inode *ip, *next;
if(*path == '/')
80101c7d: 80 38 2f cmpb $0x2f,(%eax)
// If parent != 0, return the inode for the parent and copy the final
// path element into name, which must have room for DIRSIZ bytes.
// Must be called inside a transaction since it calls iput().
static struct inode*
namex(char *path, int nameiparent, char *name)
{
80101c80: 89 55 e0 mov %edx,-0x20(%ebp)
struct inode *ip, *next;
if(*path == '/')
80101c83: 0f 84 51 01 00 00 je 80101dda <namex+0x16a>
ip = iget(ROOTDEV, ROOTINO);
else
ip = idup(proc->cwd);
80101c89: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80101c8f: 8b 70 68 mov 0x68(%eax),%esi
// Increment reference count for ip.
// Returns ip to enable ip = idup(ip1) idiom.
struct inode*
idup(struct inode *ip)
{
acquire(&icache.lock);
80101c92: c7 04 24 00 0a 11 80 movl $0x80110a00,(%esp)
80101c99: e8 02 27 00 00 call 801043a0 <acquire>
ip->ref++;
80101c9e: 83 46 08 01 addl $0x1,0x8(%esi)
release(&icache.lock);
80101ca2: c7 04 24 00 0a 11 80 movl $0x80110a00,(%esp)
80101ca9: e8 22 28 00 00 call 801044d0 <release>
80101cae: eb 03 jmp 80101cb3 <namex+0x43>
{
char *s;
int len;
while(*path == '/')
path++;
80101cb0: 83 c3 01 add $0x1,%ebx
skipelem(char *path, char *name)
{
char *s;
int len;
while(*path == '/')
80101cb3: 0f b6 03 movzbl (%ebx),%eax
80101cb6: 3c 2f cmp $0x2f,%al
80101cb8: 74 f6 je 80101cb0 <namex+0x40>
path++;
if(*path == 0)
80101cba: 84 c0 test %al,%al
80101cbc: 0f 84 ed 00 00 00 je 80101daf <namex+0x13f>
return 0;
s = path;
while(*path != '/' && *path != 0)
80101cc2: 0f b6 03 movzbl (%ebx),%eax
80101cc5: 89 da mov %ebx,%edx
80101cc7: 84 c0 test %al,%al
80101cc9: 0f 84 b1 00 00 00 je 80101d80 <namex+0x110>
80101ccf: 3c 2f cmp $0x2f,%al
80101cd1: 75 0f jne 80101ce2 <namex+0x72>
80101cd3: e9 a8 00 00 00 jmp 80101d80 <namex+0x110>
80101cd8: 3c 2f cmp $0x2f,%al
80101cda: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80101ce0: 74 0a je 80101cec <namex+0x7c>
path++;
80101ce2: 83 c2 01 add $0x1,%edx
while(*path == '/')
path++;
if(*path == 0)
return 0;
s = path;
while(*path != '/' && *path != 0)
80101ce5: 0f b6 02 movzbl (%edx),%eax
80101ce8: 84 c0 test %al,%al
80101cea: 75 ec jne 80101cd8 <namex+0x68>
80101cec: 89 d1 mov %edx,%ecx
80101cee: 29 d9 sub %ebx,%ecx
path++;
len = path - s;
if(len >= DIRSIZ)
80101cf0: 83 f9 0d cmp $0xd,%ecx
80101cf3: 0f 8e 8f 00 00 00 jle 80101d88 <namex+0x118>
memmove(name, s, DIRSIZ);
80101cf9: 89 5c 24 04 mov %ebx,0x4(%esp)
80101cfd: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp)
80101d04: 00
80101d05: 89 3c 24 mov %edi,(%esp)
80101d08: 89 55 e4 mov %edx,-0x1c(%ebp)
80101d0b: e8 c0 28 00 00 call 801045d0 <memmove>
path++;
if(*path == 0)
return 0;
s = path;
while(*path != '/' && *path != 0)
path++;
80101d10: 8b 55 e4 mov -0x1c(%ebp),%edx
80101d13: 89 d3 mov %edx,%ebx
memmove(name, s, DIRSIZ);
else {
memmove(name, s, len);
name[len] = 0;
}
while(*path == '/')
80101d15: 80 3a 2f cmpb $0x2f,(%edx)
80101d18: 75 0e jne 80101d28 <namex+0xb8>
80101d1a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
path++;
80101d20: 83 c3 01 add $0x1,%ebx
memmove(name, s, DIRSIZ);
else {
memmove(name, s, len);
name[len] = 0;
}
while(*path == '/')
80101d23: 80 3b 2f cmpb $0x2f,(%ebx)
80101d26: 74 f8 je 80101d20 <namex+0xb0>
ip = iget(ROOTDEV, ROOTINO);
else
ip = idup(proc->cwd);
while((path = skipelem(path, name)) != 0){
ilock(ip);
80101d28: 89 34 24 mov %esi,(%esp)
80101d2b: e8 90 f9 ff ff call 801016c0 <ilock>
if(ip->type != T_DIR){
80101d30: 66 83 7e 50 01 cmpw $0x1,0x50(%esi)
80101d35: 0f 85 85 00 00 00 jne 80101dc0 <namex+0x150>
iunlockput(ip);
return 0;
}
if(nameiparent && *path == '\0'){
80101d3b: 8b 55 e0 mov -0x20(%ebp),%edx
80101d3e: 85 d2 test %edx,%edx
80101d40: 74 09 je 80101d4b <namex+0xdb>
80101d42: 80 3b 00 cmpb $0x0,(%ebx)
80101d45: 0f 84 a5 00 00 00 je 80101df0 <namex+0x180>
// Stop one level early.
iunlock(ip);
return ip;
}
if((next = dirlookup(ip, name, 0)) == 0){
80101d4b: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
80101d52: 00
80101d53: 89 7c 24 04 mov %edi,0x4(%esp)
80101d57: 89 34 24 mov %esi,(%esp)
80101d5a: e8 51 fe ff ff call 80101bb0 <dirlookup>
80101d5f: 85 c0 test %eax,%eax
80101d61: 74 5d je 80101dc0 <namex+0x150>
// Common idiom: unlock, then put.
void
iunlockput(struct inode *ip)
{
iunlock(ip);
80101d63: 89 34 24 mov %esi,(%esp)
80101d66: 89 45 e4 mov %eax,-0x1c(%ebp)
80101d69: e8 22 fa ff ff call 80101790 <iunlock>
iput(ip);
80101d6e: 89 34 24 mov %esi,(%esp)
80101d71: e8 5a fa ff ff call 801017d0 <iput>
if((next = dirlookup(ip, name, 0)) == 0){
iunlockput(ip);
return 0;
}
iunlockput(ip);
ip = next;
80101d76: 8b 45 e4 mov -0x1c(%ebp),%eax
80101d79: 89 c6 mov %eax,%esi
80101d7b: e9 33 ff ff ff jmp 80101cb3 <namex+0x43>
while(*path == '/')
path++;
if(*path == 0)
return 0;
s = path;
while(*path != '/' && *path != 0)
80101d80: 31 c9 xor %ecx,%ecx
80101d82: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
path++;
len = path - s;
if(len >= DIRSIZ)
memmove(name, s, DIRSIZ);
else {
memmove(name, s, len);
80101d88: 89 4c 24 08 mov %ecx,0x8(%esp)
80101d8c: 89 5c 24 04 mov %ebx,0x4(%esp)
80101d90: 89 3c 24 mov %edi,(%esp)
80101d93: 89 55 dc mov %edx,-0x24(%ebp)
80101d96: 89 4d e4 mov %ecx,-0x1c(%ebp)
80101d99: e8 32 28 00 00 call 801045d0 <memmove>
name[len] = 0;
80101d9e: 8b 4d e4 mov -0x1c(%ebp),%ecx
80101da1: 8b 55 dc mov -0x24(%ebp),%edx
80101da4: c6 04 0f 00 movb $0x0,(%edi,%ecx,1)
80101da8: 89 d3 mov %edx,%ebx
80101daa: e9 66 ff ff ff jmp 80101d15 <namex+0xa5>
return 0;
}
iunlockput(ip);
ip = next;
}
if(nameiparent){
80101daf: 8b 45 e0 mov -0x20(%ebp),%eax
80101db2: 85 c0 test %eax,%eax
80101db4: 75 4c jne 80101e02 <namex+0x192>
80101db6: 89 f0 mov %esi,%eax
iput(ip);
return 0;
}
return ip;
}
80101db8: 83 c4 2c add $0x2c,%esp
80101dbb: 5b pop %ebx
80101dbc: 5e pop %esi
80101dbd: 5f pop %edi
80101dbe: 5d pop %ebp
80101dbf: c3 ret
// Common idiom: unlock, then put.
void
iunlockput(struct inode *ip)
{
iunlock(ip);
80101dc0: 89 34 24 mov %esi,(%esp)
80101dc3: e8 c8 f9 ff ff call 80101790 <iunlock>
iput(ip);
80101dc8: 89 34 24 mov %esi,(%esp)
80101dcb: e8 00 fa ff ff call 801017d0 <iput>
if(nameiparent){
iput(ip);
return 0;
}
return ip;
}
80101dd0: 83 c4 2c add $0x2c,%esp
iunlock(ip);
return ip;
}
if((next = dirlookup(ip, name, 0)) == 0){
iunlockput(ip);
return 0;
80101dd3: 31 c0 xor %eax,%eax
if(nameiparent){
iput(ip);
return 0;
}
return ip;
}
80101dd5: 5b pop %ebx
80101dd6: 5e pop %esi
80101dd7: 5f pop %edi
80101dd8: 5d pop %ebp
80101dd9: c3 ret
namex(char *path, int nameiparent, char *name)
{
struct inode *ip, *next;
if(*path == '/')
ip = iget(ROOTDEV, ROOTINO);
80101dda: ba 01 00 00 00 mov $0x1,%edx
80101ddf: b8 01 00 00 00 mov $0x1,%eax
80101de4: e8 37 f4 ff ff call 80101220 <iget>
80101de9: 89 c6 mov %eax,%esi
80101deb: e9 c3 fe ff ff jmp 80101cb3 <namex+0x43>
iunlockput(ip);
return 0;
}
if(nameiparent && *path == '\0'){
// Stop one level early.
iunlock(ip);
80101df0: 89 34 24 mov %esi,(%esp)
80101df3: e8 98 f9 ff ff call 80101790 <iunlock>
if(nameiparent){
iput(ip);
return 0;
}
return ip;
}
80101df8: 83 c4 2c add $0x2c,%esp
return 0;
}
if(nameiparent && *path == '\0'){
// Stop one level early.
iunlock(ip);
return ip;
80101dfb: 89 f0 mov %esi,%eax
if(nameiparent){
iput(ip);
return 0;
}
return ip;
}
80101dfd: 5b pop %ebx
80101dfe: 5e pop %esi
80101dff: 5f pop %edi
80101e00: 5d pop %ebp
80101e01: c3 ret
}
iunlockput(ip);
ip = next;
}
if(nameiparent){
iput(ip);
80101e02: 89 34 24 mov %esi,(%esp)
80101e05: e8 c6 f9 ff ff call 801017d0 <iput>
return 0;
80101e0a: 31 c0 xor %eax,%eax
80101e0c: eb aa jmp 80101db8 <namex+0x148>
80101e0e: 66 90 xchg %ax,%ax
80101e10 <dirlink>:
}
// Write a new directory entry (name, inum) into the directory dp.
int
dirlink(struct inode *dp, char *name, uint inum)
{
80101e10: 55 push %ebp
80101e11: 89 e5 mov %esp,%ebp
80101e13: 57 push %edi
80101e14: 56 push %esi
80101e15: 53 push %ebx
80101e16: 83 ec 2c sub $0x2c,%esp
80101e19: 8b 5d 08 mov 0x8(%ebp),%ebx
int off;
struct dirent de;
struct inode *ip;
// Check that name is not present.
if((ip = dirlookup(dp, name, 0)) != 0){
80101e1c: 8b 45 0c mov 0xc(%ebp),%eax
80101e1f: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
80101e26: 00
80101e27: 89 1c 24 mov %ebx,(%esp)
80101e2a: 89 44 24 04 mov %eax,0x4(%esp)
80101e2e: e8 7d fd ff ff call 80101bb0 <dirlookup>
80101e33: 85 c0 test %eax,%eax
80101e35: 0f 85 8b 00 00 00 jne 80101ec6 <dirlink+0xb6>
iput(ip);
return -1;
}
// Look for an empty dirent.
for(off = 0; off < dp->size; off += sizeof(de)){
80101e3b: 8b 43 58 mov 0x58(%ebx),%eax
80101e3e: 31 ff xor %edi,%edi
80101e40: 8d 75 d8 lea -0x28(%ebp),%esi
80101e43: 85 c0 test %eax,%eax
80101e45: 75 13 jne 80101e5a <dirlink+0x4a>
80101e47: eb 35 jmp 80101e7e <dirlink+0x6e>
80101e49: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80101e50: 8d 57 10 lea 0x10(%edi),%edx
80101e53: 39 53 58 cmp %edx,0x58(%ebx)
80101e56: 89 d7 mov %edx,%edi
80101e58: 76 24 jbe 80101e7e <dirlink+0x6e>
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80101e5a: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp)
80101e61: 00
80101e62: 89 7c 24 08 mov %edi,0x8(%esp)
80101e66: 89 74 24 04 mov %esi,0x4(%esp)
80101e6a: 89 1c 24 mov %ebx,(%esp)
80101e6d: e8 de fa ff ff call 80101950 <readi>
80101e72: 83 f8 10 cmp $0x10,%eax
80101e75: 75 5e jne 80101ed5 <dirlink+0xc5>
panic("dirlink read");
if(de.inum == 0)
80101e77: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp)
80101e7c: 75 d2 jne 80101e50 <dirlink+0x40>
break;
}
strncpy(de.name, name, DIRSIZ);
80101e7e: 8b 45 0c mov 0xc(%ebp),%eax
80101e81: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp)
80101e88: 00
80101e89: 89 44 24 04 mov %eax,0x4(%esp)
80101e8d: 8d 45 da lea -0x26(%ebp),%eax
80101e90: 89 04 24 mov %eax,(%esp)
80101e93: e8 28 28 00 00 call 801046c0 <strncpy>
de.inum = inum;
80101e98: 8b 45 10 mov 0x10(%ebp),%eax
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80101e9b: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp)
80101ea2: 00
80101ea3: 89 7c 24 08 mov %edi,0x8(%esp)
80101ea7: 89 74 24 04 mov %esi,0x4(%esp)
80101eab: 89 1c 24 mov %ebx,(%esp)
if(de.inum == 0)
break;
}
strncpy(de.name, name, DIRSIZ);
de.inum = inum;
80101eae: 66 89 45 d8 mov %ax,-0x28(%ebp)
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80101eb2: e8 99 fb ff ff call 80101a50 <writei>
80101eb7: 83 f8 10 cmp $0x10,%eax
80101eba: 75 25 jne 80101ee1 <dirlink+0xd1>
panic("dirlink");
return 0;
80101ebc: 31 c0 xor %eax,%eax
}
80101ebe: 83 c4 2c add $0x2c,%esp
80101ec1: 5b pop %ebx
80101ec2: 5e pop %esi
80101ec3: 5f pop %edi
80101ec4: 5d pop %ebp
80101ec5: c3 ret
struct dirent de;
struct inode *ip;
// Check that name is not present.
if((ip = dirlookup(dp, name, 0)) != 0){
iput(ip);
80101ec6: 89 04 24 mov %eax,(%esp)
80101ec9: e8 02 f9 ff ff call 801017d0 <iput>
return -1;
80101ece: b8 ff ff ff ff mov $0xffffffff,%eax
80101ed3: eb e9 jmp 80101ebe <dirlink+0xae>
}
// Look for an empty dirent.
for(off = 0; off < dp->size; off += sizeof(de)){
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("dirlink read");
80101ed5: c7 04 24 f5 70 10 80 movl $0x801070f5,(%esp)
80101edc: e8 7f e4 ff ff call 80100360 <panic>
}
strncpy(de.name, name, DIRSIZ);
de.inum = inum;
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("dirlink");
80101ee1: c7 04 24 6a 77 10 80 movl $0x8010776a,(%esp)
80101ee8: e8 73 e4 ff ff call 80100360 <panic>
80101eed: 8d 76 00 lea 0x0(%esi),%esi
80101ef0 <namei>:
return ip;
}
struct inode*
namei(char *path)
{
80101ef0: 55 push %ebp
char name[DIRSIZ];
return namex(path, 0, name);
80101ef1: 31 d2 xor %edx,%edx
return ip;
}
struct inode*
namei(char *path)
{
80101ef3: 89 e5 mov %esp,%ebp
80101ef5: 83 ec 18 sub $0x18,%esp
char name[DIRSIZ];
return namex(path, 0, name);
80101ef8: 8b 45 08 mov 0x8(%ebp),%eax
80101efb: 8d 4d ea lea -0x16(%ebp),%ecx
80101efe: e8 6d fd ff ff call 80101c70 <namex>
}
80101f03: c9 leave
80101f04: c3 ret
80101f05: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80101f09: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80101f10 <nameiparent>:
struct inode*
nameiparent(char *path, char *name)
{
80101f10: 55 push %ebp
return namex(path, 1, name);
80101f11: ba 01 00 00 00 mov $0x1,%edx
return namex(path, 0, name);
}
struct inode*
nameiparent(char *path, char *name)
{
80101f16: 89 e5 mov %esp,%ebp
return namex(path, 1, name);
80101f18: 8b 4d 0c mov 0xc(%ebp),%ecx
80101f1b: 8b 45 08 mov 0x8(%ebp),%eax
}
80101f1e: 5d pop %ebp
}
struct inode*
nameiparent(char *path, char *name)
{
return namex(path, 1, name);
80101f1f: e9 4c fd ff ff jmp 80101c70 <namex>
80101f24: 66 90 xchg %ax,%ax
80101f26: 66 90 xchg %ax,%ax
80101f28: 66 90 xchg %ax,%ax
80101f2a: 66 90 xchg %ax,%ax
80101f2c: 66 90 xchg %ax,%ax
80101f2e: 66 90 xchg %ax,%ax
80101f30 <idestart>:
}
// Start the request for b. Caller must hold idelock.
static void
idestart(struct buf *b)
{
80101f30: 55 push %ebp
80101f31: 89 e5 mov %esp,%ebp
80101f33: 56 push %esi
80101f34: 89 c6 mov %eax,%esi
80101f36: 53 push %ebx
80101f37: 83 ec 10 sub $0x10,%esp
if(b == 0)
80101f3a: 85 c0 test %eax,%eax
80101f3c: 0f 84 99 00 00 00 je 80101fdb <idestart+0xab>
panic("idestart");
if(b->blockno >= FSSIZE)
80101f42: 8b 48 08 mov 0x8(%eax),%ecx
80101f45: 81 f9 e7 03 00 00 cmp $0x3e7,%ecx
80101f4b: 0f 87 7e 00 00 00 ja 80101fcf <idestart+0x9f>
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80101f51: ba f7 01 00 00 mov $0x1f7,%edx
80101f56: 66 90 xchg %ax,%ax
80101f58: ec in (%dx),%al
static int
idewait(int checkerr)
{
int r;
while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY)
80101f59: 83 e0 c0 and $0xffffffc0,%eax
80101f5c: 3c 40 cmp $0x40,%al
80101f5e: 75 f8 jne 80101f58 <idestart+0x28>
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80101f60: 31 db xor %ebx,%ebx
80101f62: ba f6 03 00 00 mov $0x3f6,%edx
80101f67: 89 d8 mov %ebx,%eax
80101f69: ee out %al,(%dx)
80101f6a: ba f2 01 00 00 mov $0x1f2,%edx
80101f6f: b8 01 00 00 00 mov $0x1,%eax
80101f74: ee out %al,(%dx)
80101f75: 0f b6 c1 movzbl %cl,%eax
80101f78: b2 f3 mov $0xf3,%dl
80101f7a: ee out %al,(%dx)
idewait(0);
outb(0x3f6, 0); // generate interrupt
outb(0x1f2, sector_per_block); // number of sectors
outb(0x1f3, sector & 0xff);
outb(0x1f4, (sector >> 8) & 0xff);
80101f7b: 89 c8 mov %ecx,%eax
80101f7d: b2 f4 mov $0xf4,%dl
80101f7f: c1 f8 08 sar $0x8,%eax
80101f82: ee out %al,(%dx)
80101f83: b2 f5 mov $0xf5,%dl
80101f85: 89 d8 mov %ebx,%eax
80101f87: ee out %al,(%dx)
outb(0x1f5, (sector >> 16) & 0xff);
outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((sector>>24)&0x0f));
80101f88: 0f b6 46 04 movzbl 0x4(%esi),%eax
80101f8c: b2 f6 mov $0xf6,%dl
80101f8e: 83 e0 01 and $0x1,%eax
80101f91: c1 e0 04 shl $0x4,%eax
80101f94: 83 c8 e0 or $0xffffffe0,%eax
80101f97: ee out %al,(%dx)
if(b->flags & B_DIRTY){
80101f98: f6 06 04 testb $0x4,(%esi)
80101f9b: 75 13 jne 80101fb0 <idestart+0x80>
80101f9d: ba f7 01 00 00 mov $0x1f7,%edx
80101fa2: b8 20 00 00 00 mov $0x20,%eax
80101fa7: ee out %al,(%dx)
outb(0x1f7, write_cmd);
outsl(0x1f0, b->data, BSIZE/4);
} else {
outb(0x1f7, read_cmd);
}
}
80101fa8: 83 c4 10 add $0x10,%esp
80101fab: 5b pop %ebx
80101fac: 5e pop %esi
80101fad: 5d pop %ebp
80101fae: c3 ret
80101faf: 90 nop
80101fb0: b2 f7 mov $0xf7,%dl
80101fb2: b8 30 00 00 00 mov $0x30,%eax
80101fb7: ee out %al,(%dx)
}
static inline void
outsl(int port, const void *addr, int cnt)
{
asm volatile("cld; rep outsl" :
80101fb8: b9 80 00 00 00 mov $0x80,%ecx
outb(0x1f4, (sector >> 8) & 0xff);
outb(0x1f5, (sector >> 16) & 0xff);
outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((sector>>24)&0x0f));
if(b->flags & B_DIRTY){
outb(0x1f7, write_cmd);
outsl(0x1f0, b->data, BSIZE/4);
80101fbd: 83 c6 5c add $0x5c,%esi
80101fc0: ba f0 01 00 00 mov $0x1f0,%edx
80101fc5: fc cld
80101fc6: f3 6f rep outsl %ds:(%esi),(%dx)
} else {
outb(0x1f7, read_cmd);
}
}
80101fc8: 83 c4 10 add $0x10,%esp
80101fcb: 5b pop %ebx
80101fcc: 5e pop %esi
80101fcd: 5d pop %ebp
80101fce: c3 ret
idestart(struct buf *b)
{
if(b == 0)
panic("idestart");
if(b->blockno >= FSSIZE)
panic("incorrect blockno");
80101fcf: c7 04 24 60 71 10 80 movl $0x80107160,(%esp)
80101fd6: e8 85 e3 ff ff call 80100360 <panic>
// Start the request for b. Caller must hold idelock.
static void
idestart(struct buf *b)
{
if(b == 0)
panic("idestart");
80101fdb: c7 04 24 57 71 10 80 movl $0x80107157,(%esp)
80101fe2: e8 79 e3 ff ff call 80100360 <panic>
80101fe7: 89 f6 mov %esi,%esi
80101fe9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80101ff0 <ideinit>:
return 0;
}
void
ideinit(void)
{
80101ff0: 55 push %ebp
80101ff1: 89 e5 mov %esp,%ebp
80101ff3: 83 ec 18 sub $0x18,%esp
int i;
initlock(&idelock, "ide");
80101ff6: c7 44 24 04 72 71 10 movl $0x80107172,0x4(%esp)
80101ffd: 80
80101ffe: c7 04 24 80 a5 10 80 movl $0x8010a580,(%esp)
80102005: e8 16 23 00 00 call 80104320 <initlock>
picenable(IRQ_IDE);
8010200a: c7 04 24 0e 00 00 00 movl $0xe,(%esp)
80102011: e8 ea 11 00 00 call 80103200 <picenable>
ioapicenable(IRQ_IDE, ncpu - 1);
80102016: a1 80 2d 11 80 mov 0x80112d80,%eax
8010201b: c7 04 24 0e 00 00 00 movl $0xe,(%esp)
80102022: 83 e8 01 sub $0x1,%eax
80102025: 89 44 24 04 mov %eax,0x4(%esp)
80102029: e8 82 02 00 00 call 801022b0 <ioapicenable>
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
8010202e: ba f7 01 00 00 mov $0x1f7,%edx
80102033: 90 nop
80102034: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80102038: ec in (%dx),%al
static int
idewait(int checkerr)
{
int r;
while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY)
80102039: 83 e0 c0 and $0xffffffc0,%eax
8010203c: 3c 40 cmp $0x40,%al
8010203e: 75 f8 jne 80102038 <ideinit+0x48>
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102040: ba f6 01 00 00 mov $0x1f6,%edx
80102045: b8 f0 ff ff ff mov $0xfffffff0,%eax
8010204a: ee out %al,(%dx)
8010204b: b9 e8 03 00 00 mov $0x3e8,%ecx
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102050: b2 f7 mov $0xf7,%dl
80102052: eb 09 jmp 8010205d <ideinit+0x6d>
80102054: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
ioapicenable(IRQ_IDE, ncpu - 1);
idewait(0);
// Check if disk 1 is present
outb(0x1f6, 0xe0 | (1<<4));
for(i=0; i<1000; i++){
80102058: 83 e9 01 sub $0x1,%ecx
8010205b: 74 0f je 8010206c <ideinit+0x7c>
8010205d: ec in (%dx),%al
if(inb(0x1f7) != 0){
8010205e: 84 c0 test %al,%al
80102060: 74 f6 je 80102058 <ideinit+0x68>
havedisk1 = 1;
80102062: c7 05 60 a5 10 80 01 movl $0x1,0x8010a560
80102069: 00 00 00
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
8010206c: ba f6 01 00 00 mov $0x1f6,%edx
80102071: b8 e0 ff ff ff mov $0xffffffe0,%eax
80102076: ee out %al,(%dx)
}
}
// Switch back to disk 0.
outb(0x1f6, 0xe0 | (0<<4));
}
80102077: c9 leave
80102078: c3 ret
80102079: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80102080 <ideintr>:
}
// Interrupt handler.
void
ideintr(void)
{
80102080: 55 push %ebp
80102081: 89 e5 mov %esp,%ebp
80102083: 57 push %edi
80102084: 56 push %esi
80102085: 53 push %ebx
80102086: 83 ec 1c sub $0x1c,%esp
struct buf *b;
// First queued buffer is the active request.
acquire(&idelock);
80102089: c7 04 24 80 a5 10 80 movl $0x8010a580,(%esp)
80102090: e8 0b 23 00 00 call 801043a0 <acquire>
if((b = idequeue) == 0){
80102095: 8b 1d 64 a5 10 80 mov 0x8010a564,%ebx
8010209b: 85 db test %ebx,%ebx
8010209d: 74 30 je 801020cf <ideintr+0x4f>
release(&idelock);
// cprintf("spurious IDE interrupt\n");
return;
}
idequeue = b->qnext;
8010209f: 8b 43 58 mov 0x58(%ebx),%eax
801020a2: a3 64 a5 10 80 mov %eax,0x8010a564
// Read data if needed.
if(!(b->flags & B_DIRTY) && idewait(1) >= 0)
801020a7: 8b 33 mov (%ebx),%esi
801020a9: f7 c6 04 00 00 00 test $0x4,%esi
801020af: 74 37 je 801020e8 <ideintr+0x68>
insl(0x1f0, b->data, BSIZE/4);
// Wake process waiting for this buf.
b->flags |= B_VALID;
b->flags &= ~B_DIRTY;
801020b1: 83 e6 fb and $0xfffffffb,%esi
801020b4: 83 ce 02 or $0x2,%esi
801020b7: 89 33 mov %esi,(%ebx)
wakeup(b);
801020b9: 89 1c 24 mov %ebx,(%esp)
801020bc: e8 8f 1f 00 00 call 80104050 <wakeup>
// Start disk on next buf in queue.
if(idequeue != 0)
801020c1: a1 64 a5 10 80 mov 0x8010a564,%eax
801020c6: 85 c0 test %eax,%eax
801020c8: 74 05 je 801020cf <ideintr+0x4f>
idestart(idequeue);
801020ca: e8 61 fe ff ff call 80101f30 <idestart>
struct buf *b;
// First queued buffer is the active request.
acquire(&idelock);
if((b = idequeue) == 0){
release(&idelock);
801020cf: c7 04 24 80 a5 10 80 movl $0x8010a580,(%esp)
801020d6: e8 f5 23 00 00 call 801044d0 <release>
// Start disk on next buf in queue.
if(idequeue != 0)
idestart(idequeue);
release(&idelock);
}
801020db: 83 c4 1c add $0x1c,%esp
801020de: 5b pop %ebx
801020df: 5e pop %esi
801020e0: 5f pop %edi
801020e1: 5d pop %ebp
801020e2: c3 ret
801020e3: 90 nop
801020e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801020e8: ba f7 01 00 00 mov $0x1f7,%edx
801020ed: 8d 76 00 lea 0x0(%esi),%esi
801020f0: ec in (%dx),%al
static int
idewait(int checkerr)
{
int r;
while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY)
801020f1: 89 c1 mov %eax,%ecx
801020f3: 83 e1 c0 and $0xffffffc0,%ecx
801020f6: 80 f9 40 cmp $0x40,%cl
801020f9: 75 f5 jne 801020f0 <ideintr+0x70>
;
if(checkerr && (r & (IDE_DF|IDE_ERR)) != 0)
801020fb: a8 21 test $0x21,%al
801020fd: 75 b2 jne 801020b1 <ideintr+0x31>
}
idequeue = b->qnext;
// Read data if needed.
if(!(b->flags & B_DIRTY) && idewait(1) >= 0)
insl(0x1f0, b->data, BSIZE/4);
801020ff: 8d 7b 5c lea 0x5c(%ebx),%edi
}
static inline void
insl(int port, void *addr, int cnt)
{
asm volatile("cld; rep insl" :
80102102: b9 80 00 00 00 mov $0x80,%ecx
80102107: ba f0 01 00 00 mov $0x1f0,%edx
8010210c: fc cld
8010210d: f3 6d rep insl (%dx),%es:(%edi)
8010210f: 8b 33 mov (%ebx),%esi
80102111: eb 9e jmp 801020b1 <ideintr+0x31>
80102113: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80102119: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80102120 <iderw>:
// Sync buf with disk.
// If B_DIRTY is set, write buf to disk, clear B_DIRTY, set B_VALID.
// Else if B_VALID is not set, read buf from disk, set B_VALID.
void
iderw(struct buf *b)
{
80102120: 55 push %ebp
80102121: 89 e5 mov %esp,%ebp
80102123: 53 push %ebx
80102124: 83 ec 14 sub $0x14,%esp
80102127: 8b 5d 08 mov 0x8(%ebp),%ebx
struct buf **pp;
if(!holdingsleep(&b->lock))
8010212a: 8d 43 0c lea 0xc(%ebx),%eax
8010212d: 89 04 24 mov %eax,(%esp)
80102130: e8 bb 21 00 00 call 801042f0 <holdingsleep>
80102135: 85 c0 test %eax,%eax
80102137: 0f 84 9e 00 00 00 je 801021db <iderw+0xbb>
panic("iderw: buf not locked");
if((b->flags & (B_VALID|B_DIRTY)) == B_VALID)
8010213d: 8b 03 mov (%ebx),%eax
8010213f: 83 e0 06 and $0x6,%eax
80102142: 83 f8 02 cmp $0x2,%eax
80102145: 0f 84 a8 00 00 00 je 801021f3 <iderw+0xd3>
panic("iderw: nothing to do");
if(b->dev != 0 && !havedisk1)
8010214b: 8b 53 04 mov 0x4(%ebx),%edx
8010214e: 85 d2 test %edx,%edx
80102150: 74 0d je 8010215f <iderw+0x3f>
80102152: a1 60 a5 10 80 mov 0x8010a560,%eax
80102157: 85 c0 test %eax,%eax
80102159: 0f 84 88 00 00 00 je 801021e7 <iderw+0xc7>
panic("iderw: ide disk 1 not present");
acquire(&idelock); //DOC:acquire-lock
8010215f: c7 04 24 80 a5 10 80 movl $0x8010a580,(%esp)
80102166: e8 35 22 00 00 call 801043a0 <acquire>
// Append b to idequeue.
b->qnext = 0;
for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue
8010216b: a1 64 a5 10 80 mov 0x8010a564,%eax
panic("iderw: ide disk 1 not present");
acquire(&idelock); //DOC:acquire-lock
// Append b to idequeue.
b->qnext = 0;
80102170: c7 43 58 00 00 00 00 movl $0x0,0x58(%ebx)
for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue
80102177: 85 c0 test %eax,%eax
80102179: 75 07 jne 80102182 <iderw+0x62>
8010217b: eb 4e jmp 801021cb <iderw+0xab>
8010217d: 8d 76 00 lea 0x0(%esi),%esi
80102180: 89 d0 mov %edx,%eax
80102182: 8b 50 58 mov 0x58(%eax),%edx
80102185: 85 d2 test %edx,%edx
80102187: 75 f7 jne 80102180 <iderw+0x60>
80102189: 83 c0 58 add $0x58,%eax
;
*pp = b;
8010218c: 89 18 mov %ebx,(%eax)
// Start disk if necessary.
if(idequeue == b)
8010218e: 39 1d 64 a5 10 80 cmp %ebx,0x8010a564
80102194: 74 3c je 801021d2 <iderw+0xb2>
idestart(b);
// Wait for request to finish.
while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){
80102196: 8b 03 mov (%ebx),%eax
80102198: 83 e0 06 and $0x6,%eax
8010219b: 83 f8 02 cmp $0x2,%eax
8010219e: 74 1a je 801021ba <iderw+0x9a>
sleep(b, &idelock);
801021a0: c7 44 24 04 80 a5 10 movl $0x8010a580,0x4(%esp)
801021a7: 80
801021a8: 89 1c 24 mov %ebx,(%esp)
801021ab: e8 f0 1c 00 00 call 80103ea0 <sleep>
// Start disk if necessary.
if(idequeue == b)
idestart(b);
// Wait for request to finish.
while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){
801021b0: 8b 13 mov (%ebx),%edx
801021b2: 83 e2 06 and $0x6,%edx
801021b5: 83 fa 02 cmp $0x2,%edx
801021b8: 75 e6 jne 801021a0 <iderw+0x80>
sleep(b, &idelock);
}
release(&idelock);
801021ba: c7 45 08 80 a5 10 80 movl $0x8010a580,0x8(%ebp)
}
801021c1: 83 c4 14 add $0x14,%esp
801021c4: 5b pop %ebx
801021c5: 5d pop %ebp
// Wait for request to finish.
while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){
sleep(b, &idelock);
}
release(&idelock);
801021c6: e9 05 23 00 00 jmp 801044d0 <release>
acquire(&idelock); //DOC:acquire-lock
// Append b to idequeue.
b->qnext = 0;
for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue
801021cb: b8 64 a5 10 80 mov $0x8010a564,%eax
801021d0: eb ba jmp 8010218c <iderw+0x6c>
;
*pp = b;
// Start disk if necessary.
if(idequeue == b)
idestart(b);
801021d2: 89 d8 mov %ebx,%eax
801021d4: e8 57 fd ff ff call 80101f30 <idestart>
801021d9: eb bb jmp 80102196 <iderw+0x76>
iderw(struct buf *b)
{
struct buf **pp;
if(!holdingsleep(&b->lock))
panic("iderw: buf not locked");
801021db: c7 04 24 76 71 10 80 movl $0x80107176,(%esp)
801021e2: e8 79 e1 ff ff call 80100360 <panic>
if((b->flags & (B_VALID|B_DIRTY)) == B_VALID)
panic("iderw: nothing to do");
if(b->dev != 0 && !havedisk1)
panic("iderw: ide disk 1 not present");
801021e7: c7 04 24 a1 71 10 80 movl $0x801071a1,(%esp)
801021ee: e8 6d e1 ff ff call 80100360 <panic>
struct buf **pp;
if(!holdingsleep(&b->lock))
panic("iderw: buf not locked");
if((b->flags & (B_VALID|B_DIRTY)) == B_VALID)
panic("iderw: nothing to do");
801021f3: c7 04 24 8c 71 10 80 movl $0x8010718c,(%esp)
801021fa: e8 61 e1 ff ff call 80100360 <panic>
801021ff: 90 nop
80102200 <ioapicinit>:
void
ioapicinit(void)
{
int i, id, maxintr;
if(!ismp)
80102200: a1 84 27 11 80 mov 0x80112784,%eax
80102205: 85 c0 test %eax,%eax
80102207: 0f 84 9b 00 00 00 je 801022a8 <ioapicinit+0xa8>
ioapic->data = data;
}
void
ioapicinit(void)
{
8010220d: 55 push %ebp
8010220e: 89 e5 mov %esp,%ebp
80102210: 56 push %esi
80102211: 53 push %ebx
80102212: 83 ec 10 sub $0x10,%esp
int i, id, maxintr;
if(!ismp)
return;
ioapic = (volatile struct ioapic*)IOAPIC;
80102215: c7 05 54 26 11 80 00 movl $0xfec00000,0x80112654
8010221c: 00 c0 fe
};
static uint
ioapicread(int reg)
{
ioapic->reg = reg;
8010221f: c7 05 00 00 c0 fe 01 movl $0x1,0xfec00000
80102226: 00 00 00
return ioapic->data;
80102229: 8b 15 54 26 11 80 mov 0x80112654,%edx
8010222f: 8b 42 10 mov 0x10(%edx),%eax
};
static uint
ioapicread(int reg)
{
ioapic->reg = reg;
80102232: c7 02 00 00 00 00 movl $0x0,(%edx)
return ioapic->data;
80102238: 8b 1d 54 26 11 80 mov 0x80112654,%ebx
return;
ioapic = (volatile struct ioapic*)IOAPIC;
maxintr = (ioapicread(REG_VER) >> 16) & 0xFF;
id = ioapicread(REG_ID) >> 24;
if(id != ioapicid)
8010223e: 0f b6 15 80 27 11 80 movzbl 0x80112780,%edx
if(!ismp)
return;
ioapic = (volatile struct ioapic*)IOAPIC;
maxintr = (ioapicread(REG_VER) >> 16) & 0xFF;
80102245: c1 e8 10 shr $0x10,%eax
80102248: 0f b6 f0 movzbl %al,%esi
static uint
ioapicread(int reg)
{
ioapic->reg = reg;
return ioapic->data;
8010224b: 8b 43 10 mov 0x10(%ebx),%eax
if(!ismp)
return;
ioapic = (volatile struct ioapic*)IOAPIC;
maxintr = (ioapicread(REG_VER) >> 16) & 0xFF;
id = ioapicread(REG_ID) >> 24;
8010224e: c1 e8 18 shr $0x18,%eax
if(id != ioapicid)
80102251: 39 c2 cmp %eax,%edx
80102253: 74 12 je 80102267 <ioapicinit+0x67>
cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");
80102255: c7 04 24 c0 71 10 80 movl $0x801071c0,(%esp)
8010225c: e8 ef e3 ff ff call 80100650 <cprintf>
80102261: 8b 1d 54 26 11 80 mov 0x80112654,%ebx
80102267: ba 10 00 00 00 mov $0x10,%edx
8010226c: 31 c0 xor %eax,%eax
8010226e: eb 02 jmp 80102272 <ioapicinit+0x72>
80102270: 89 cb mov %ecx,%ebx
}
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
80102272: 89 13 mov %edx,(%ebx)
ioapic->data = data;
80102274: 8b 1d 54 26 11 80 mov 0x80112654,%ebx
8010227a: 8d 48 20 lea 0x20(%eax),%ecx
cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");
// Mark all interrupts edge-triggered, active high, disabled,
// and not routed to any CPUs.
for(i = 0; i <= maxintr; i++){
ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i));
8010227d: 81 c9 00 00 01 00 or $0x10000,%ecx
if(id != ioapicid)
cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");
// Mark all interrupts edge-triggered, active high, disabled,
// and not routed to any CPUs.
for(i = 0; i <= maxintr; i++){
80102283: 83 c0 01 add $0x1,%eax
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
ioapic->data = data;
80102286: 89 4b 10 mov %ecx,0x10(%ebx)
80102289: 8d 4a 01 lea 0x1(%edx),%ecx
8010228c: 83 c2 02 add $0x2,%edx
}
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
8010228f: 89 0b mov %ecx,(%ebx)
ioapic->data = data;
80102291: 8b 0d 54 26 11 80 mov 0x80112654,%ecx
if(id != ioapicid)
cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");
// Mark all interrupts edge-triggered, active high, disabled,
// and not routed to any CPUs.
for(i = 0; i <= maxintr; i++){
80102297: 39 c6 cmp %eax,%esi
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
ioapic->data = data;
80102299: c7 41 10 00 00 00 00 movl $0x0,0x10(%ecx)
if(id != ioapicid)
cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");
// Mark all interrupts edge-triggered, active high, disabled,
// and not routed to any CPUs.
for(i = 0; i <= maxintr; i++){
801022a0: 7d ce jge 80102270 <ioapicinit+0x70>
ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i));
ioapicwrite(REG_TABLE+2*i+1, 0);
}
}
801022a2: 83 c4 10 add $0x10,%esp
801022a5: 5b pop %ebx
801022a6: 5e pop %esi
801022a7: 5d pop %ebp
801022a8: f3 c3 repz ret
801022aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801022b0 <ioapicenable>:
void
ioapicenable(int irq, int cpunum)
{
if(!ismp)
801022b0: 8b 15 84 27 11 80 mov 0x80112784,%edx
}
}
void
ioapicenable(int irq, int cpunum)
{
801022b6: 55 push %ebp
801022b7: 89 e5 mov %esp,%ebp
801022b9: 8b 45 08 mov 0x8(%ebp),%eax
if(!ismp)
801022bc: 85 d2 test %edx,%edx
801022be: 74 29 je 801022e9 <ioapicenable+0x39>
return;
// Mark interrupt edge-triggered, active high,
// enabled, and routed to the given cpunum,
// which happens to be that cpu's APIC ID.
ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq);
801022c0: 8d 48 20 lea 0x20(%eax),%ecx
801022c3: 8d 54 00 10 lea 0x10(%eax,%eax,1),%edx
}
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
801022c7: a1 54 26 11 80 mov 0x80112654,%eax
801022cc: 89 10 mov %edx,(%eax)
ioapic->data = data;
801022ce: a1 54 26 11 80 mov 0x80112654,%eax
// Mark interrupt edge-triggered, active high,
// enabled, and routed to the given cpunum,
// which happens to be that cpu's APIC ID.
ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq);
ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24);
801022d3: 83 c2 01 add $0x1,%edx
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
ioapic->data = data;
801022d6: 89 48 10 mov %ecx,0x10(%eax)
// Mark interrupt edge-triggered, active high,
// enabled, and routed to the given cpunum,
// which happens to be that cpu's APIC ID.
ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq);
ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24);
801022d9: 8b 4d 0c mov 0xc(%ebp),%ecx
}
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
801022dc: 89 10 mov %edx,(%eax)
ioapic->data = data;
801022de: a1 54 26 11 80 mov 0x80112654,%eax
// Mark interrupt edge-triggered, active high,
// enabled, and routed to the given cpunum,
// which happens to be that cpu's APIC ID.
ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq);
ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24);
801022e3: c1 e1 18 shl $0x18,%ecx
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
ioapic->data = data;
801022e6: 89 48 10 mov %ecx,0x10(%eax)
// Mark interrupt edge-triggered, active high,
// enabled, and routed to the given cpunum,
// which happens to be that cpu's APIC ID.
ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq);
ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24);
}
801022e9: 5d pop %ebp
801022ea: c3 ret
801022eb: 66 90 xchg %ax,%ax
801022ed: 66 90 xchg %ax,%ax
801022ef: 90 nop
801022f0 <kfree>:
// which normally should have been returned by a
// call to kalloc(). (The exception is when
// initializing the allocator; see kinit above.)
void
kfree(char *v)
{
801022f0: 55 push %ebp
801022f1: 89 e5 mov %esp,%ebp
801022f3: 53 push %ebx
801022f4: 83 ec 14 sub $0x14,%esp
801022f7: 8b 5d 08 mov 0x8(%ebp),%ebx
struct run *r;
if((uint)v % PGSIZE || v < end || V2P(v) >= PHYSTOP)
801022fa: f7 c3 ff 0f 00 00 test $0xfff,%ebx
80102300: 75 7c jne 8010237e <kfree+0x8e>
80102302: 81 fb 28 5d 11 80 cmp $0x80115d28,%ebx
80102308: 72 74 jb 8010237e <kfree+0x8e>
8010230a: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax
80102310: 3d ff ff ff 0d cmp $0xdffffff,%eax
80102315: 77 67 ja 8010237e <kfree+0x8e>
panic("kfree");
// Fill with junk to catch dangling refs.
memset(v, 1, PGSIZE);
80102317: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
8010231e: 00
8010231f: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
80102326: 00
80102327: 89 1c 24 mov %ebx,(%esp)
8010232a: e8 f1 21 00 00 call 80104520 <memset>
if(kmem.use_lock)
8010232f: 8b 15 94 26 11 80 mov 0x80112694,%edx
80102335: 85 d2 test %edx,%edx
80102337: 75 37 jne 80102370 <kfree+0x80>
acquire(&kmem.lock);
r = (struct run*)v;
r->next = kmem.freelist;
80102339: a1 98 26 11 80 mov 0x80112698,%eax
8010233e: 89 03 mov %eax,(%ebx)
kmem.freelist = r;
if(kmem.use_lock)
80102340: a1 94 26 11 80 mov 0x80112694,%eax
if(kmem.use_lock)
acquire(&kmem.lock);
r = (struct run*)v;
r->next = kmem.freelist;
kmem.freelist = r;
80102345: 89 1d 98 26 11 80 mov %ebx,0x80112698
if(kmem.use_lock)
8010234b: 85 c0 test %eax,%eax
8010234d: 75 09 jne 80102358 <kfree+0x68>
release(&kmem.lock);
}
8010234f: 83 c4 14 add $0x14,%esp
80102352: 5b pop %ebx
80102353: 5d pop %ebp
80102354: c3 ret
80102355: 8d 76 00 lea 0x0(%esi),%esi
acquire(&kmem.lock);
r = (struct run*)v;
r->next = kmem.freelist;
kmem.freelist = r;
if(kmem.use_lock)
release(&kmem.lock);
80102358: c7 45 08 60 26 11 80 movl $0x80112660,0x8(%ebp)
}
8010235f: 83 c4 14 add $0x14,%esp
80102362: 5b pop %ebx
80102363: 5d pop %ebp
acquire(&kmem.lock);
r = (struct run*)v;
r->next = kmem.freelist;
kmem.freelist = r;
if(kmem.use_lock)
release(&kmem.lock);
80102364: e9 67 21 00 00 jmp 801044d0 <release>
80102369: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
// Fill with junk to catch dangling refs.
memset(v, 1, PGSIZE);
if(kmem.use_lock)
acquire(&kmem.lock);
80102370: c7 04 24 60 26 11 80 movl $0x80112660,(%esp)
80102377: e8 24 20 00 00 call 801043a0 <acquire>
8010237c: eb bb jmp 80102339 <kfree+0x49>
kfree(char *v)
{
struct run *r;
if((uint)v % PGSIZE || v < end || V2P(v) >= PHYSTOP)
panic("kfree");
8010237e: c7 04 24 f2 71 10 80 movl $0x801071f2,(%esp)
80102385: e8 d6 df ff ff call 80100360 <panic>
8010238a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80102390 <freerange>:
kmem.use_lock = 1;
}
void
freerange(void *vstart, void *vend)
{
80102390: 55 push %ebp
80102391: 89 e5 mov %esp,%ebp
80102393: 56 push %esi
80102394: 53 push %ebx
80102395: 83 ec 10 sub $0x10,%esp
char *p;
p = (char*)PGROUNDUP((uint)vstart);
80102398: 8b 45 08 mov 0x8(%ebp),%eax
kmem.use_lock = 1;
}
void
freerange(void *vstart, void *vend)
{
8010239b: 8b 75 0c mov 0xc(%ebp),%esi
char *p;
p = (char*)PGROUNDUP((uint)vstart);
8010239e: 8d 90 ff 0f 00 00 lea 0xfff(%eax),%edx
801023a4: 81 e2 00 f0 ff ff and $0xfffff000,%edx
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
801023aa: 8d 9a 00 10 00 00 lea 0x1000(%edx),%ebx
801023b0: 39 de cmp %ebx,%esi
801023b2: 73 08 jae 801023bc <freerange+0x2c>
801023b4: eb 18 jmp 801023ce <freerange+0x3e>
801023b6: 66 90 xchg %ax,%ax
801023b8: 89 da mov %ebx,%edx
801023ba: 89 c3 mov %eax,%ebx
kfree(p);
801023bc: 89 14 24 mov %edx,(%esp)
801023bf: e8 2c ff ff ff call 801022f0 <kfree>
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
801023c4: 8d 83 00 10 00 00 lea 0x1000(%ebx),%eax
801023ca: 39 f0 cmp %esi,%eax
801023cc: 76 ea jbe 801023b8 <freerange+0x28>
kfree(p);
}
801023ce: 83 c4 10 add $0x10,%esp
801023d1: 5b pop %ebx
801023d2: 5e pop %esi
801023d3: 5d pop %ebp
801023d4: c3 ret
801023d5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801023d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801023e0 <kinit1>:
// the pages mapped by entrypgdir on free list.
// 2. main() calls kinit2() with the rest of the physical pages
// after installing a full page table that maps them on all cores.
void
kinit1(void *vstart, void *vend)
{
801023e0: 55 push %ebp
801023e1: 89 e5 mov %esp,%ebp
801023e3: 56 push %esi
801023e4: 53 push %ebx
801023e5: 83 ec 10 sub $0x10,%esp
801023e8: 8b 75 0c mov 0xc(%ebp),%esi
initlock(&kmem.lock, "kmem");
801023eb: c7 44 24 04 f8 71 10 movl $0x801071f8,0x4(%esp)
801023f2: 80
801023f3: c7 04 24 60 26 11 80 movl $0x80112660,(%esp)
801023fa: e8 21 1f 00 00 call 80104320 <initlock>
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
801023ff: 8b 45 08 mov 0x8(%ebp),%eax
// after installing a full page table that maps them on all cores.
void
kinit1(void *vstart, void *vend)
{
initlock(&kmem.lock, "kmem");
kmem.use_lock = 0;
80102402: c7 05 94 26 11 80 00 movl $0x0,0x80112694
80102409: 00 00 00
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
8010240c: 8d 90 ff 0f 00 00 lea 0xfff(%eax),%edx
80102412: 81 e2 00 f0 ff ff and $0xfffff000,%edx
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102418: 8d 9a 00 10 00 00 lea 0x1000(%edx),%ebx
8010241e: 39 de cmp %ebx,%esi
80102420: 73 0a jae 8010242c <kinit1+0x4c>
80102422: eb 1a jmp 8010243e <kinit1+0x5e>
80102424: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80102428: 89 da mov %ebx,%edx
8010242a: 89 c3 mov %eax,%ebx
kfree(p);
8010242c: 89 14 24 mov %edx,(%esp)
8010242f: e8 bc fe ff ff call 801022f0 <kfree>
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102434: 8d 83 00 10 00 00 lea 0x1000(%ebx),%eax
8010243a: 39 c6 cmp %eax,%esi
8010243c: 73 ea jae 80102428 <kinit1+0x48>
kinit1(void *vstart, void *vend)
{
initlock(&kmem.lock, "kmem");
kmem.use_lock = 0;
freerange(vstart, vend);
}
8010243e: 83 c4 10 add $0x10,%esp
80102441: 5b pop %ebx
80102442: 5e pop %esi
80102443: 5d pop %ebp
80102444: c3 ret
80102445: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80102449: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80102450 <kinit2>:
void
kinit2(void *vstart, void *vend)
{
80102450: 55 push %ebp
80102451: 89 e5 mov %esp,%ebp
80102453: 56 push %esi
80102454: 53 push %ebx
80102455: 83 ec 10 sub $0x10,%esp
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
80102458: 8b 45 08 mov 0x8(%ebp),%eax
freerange(vstart, vend);
}
void
kinit2(void *vstart, void *vend)
{
8010245b: 8b 75 0c mov 0xc(%ebp),%esi
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
8010245e: 8d 90 ff 0f 00 00 lea 0xfff(%eax),%edx
80102464: 81 e2 00 f0 ff ff and $0xfffff000,%edx
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
8010246a: 8d 9a 00 10 00 00 lea 0x1000(%edx),%ebx
80102470: 39 de cmp %ebx,%esi
80102472: 73 08 jae 8010247c <kinit2+0x2c>
80102474: eb 18 jmp 8010248e <kinit2+0x3e>
80102476: 66 90 xchg %ax,%ax
80102478: 89 da mov %ebx,%edx
8010247a: 89 c3 mov %eax,%ebx
kfree(p);
8010247c: 89 14 24 mov %edx,(%esp)
8010247f: e8 6c fe ff ff call 801022f0 <kfree>
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102484: 8d 83 00 10 00 00 lea 0x1000(%ebx),%eax
8010248a: 39 c6 cmp %eax,%esi
8010248c: 73 ea jae 80102478 <kinit2+0x28>
void
kinit2(void *vstart, void *vend)
{
freerange(vstart, vend);
kmem.use_lock = 1;
8010248e: c7 05 94 26 11 80 01 movl $0x1,0x80112694
80102495: 00 00 00
}
80102498: 83 c4 10 add $0x10,%esp
8010249b: 5b pop %ebx
8010249c: 5e pop %esi
8010249d: 5d pop %ebp
8010249e: c3 ret
8010249f: 90 nop
801024a0 <kalloc>:
// Allocate one 4096-byte page of physical memory.
// Returns a pointer that the kernel can use.
// Returns 0 if the memory cannot be allocated.
char*
kalloc(void)
{
801024a0: 55 push %ebp
801024a1: 89 e5 mov %esp,%ebp
801024a3: 53 push %ebx
801024a4: 83 ec 14 sub $0x14,%esp
struct run *r;
if(kmem.use_lock)
801024a7: a1 94 26 11 80 mov 0x80112694,%eax
801024ac: 85 c0 test %eax,%eax
801024ae: 75 30 jne 801024e0 <kalloc+0x40>
acquire(&kmem.lock);
r = kmem.freelist;
801024b0: 8b 1d 98 26 11 80 mov 0x80112698,%ebx
if(r)
801024b6: 85 db test %ebx,%ebx
801024b8: 74 08 je 801024c2 <kalloc+0x22>
kmem.freelist = r->next;
801024ba: 8b 13 mov (%ebx),%edx
801024bc: 89 15 98 26 11 80 mov %edx,0x80112698
if(kmem.use_lock)
801024c2: 85 c0 test %eax,%eax
801024c4: 74 0c je 801024d2 <kalloc+0x32>
release(&kmem.lock);
801024c6: c7 04 24 60 26 11 80 movl $0x80112660,(%esp)
801024cd: e8 fe 1f 00 00 call 801044d0 <release>
return (char*)r;
}
801024d2: 83 c4 14 add $0x14,%esp
801024d5: 89 d8 mov %ebx,%eax
801024d7: 5b pop %ebx
801024d8: 5d pop %ebp
801024d9: c3 ret
801024da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
kalloc(void)
{
struct run *r;
if(kmem.use_lock)
acquire(&kmem.lock);
801024e0: c7 04 24 60 26 11 80 movl $0x80112660,(%esp)
801024e7: e8 b4 1e 00 00 call 801043a0 <acquire>
801024ec: a1 94 26 11 80 mov 0x80112694,%eax
801024f1: eb bd jmp 801024b0 <kalloc+0x10>
801024f3: 66 90 xchg %ax,%ax
801024f5: 66 90 xchg %ax,%ax
801024f7: 66 90 xchg %ax,%ax
801024f9: 66 90 xchg %ax,%ax
801024fb: 66 90 xchg %ax,%ax
801024fd: 66 90 xchg %ax,%ax
801024ff: 90 nop
80102500 <kbdgetc>:
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102500: ba 64 00 00 00 mov $0x64,%edx
80102505: ec in (%dx),%al
normalmap, shiftmap, ctlmap, ctlmap
};
uint st, data, c;
st = inb(KBSTATP);
if((st & KBS_DIB) == 0)
80102506: a8 01 test $0x1,%al
80102508: 0f 84 ba 00 00 00 je 801025c8 <kbdgetc+0xc8>
8010250e: b2 60 mov $0x60,%dl
80102510: ec in (%dx),%al
return -1;
data = inb(KBDATAP);
80102511: 0f b6 c8 movzbl %al,%ecx
if(data == 0xE0){
80102514: 81 f9 e0 00 00 00 cmp $0xe0,%ecx
8010251a: 0f 84 88 00 00 00 je 801025a8 <kbdgetc+0xa8>
shift |= E0ESC;
return 0;
} else if(data & 0x80){
80102520: 84 c0 test %al,%al
80102522: 79 2c jns 80102550 <kbdgetc+0x50>
// Key released
data = (shift & E0ESC ? data : data & 0x7F);
80102524: 8b 15 b4 a5 10 80 mov 0x8010a5b4,%edx
8010252a: f6 c2 40 test $0x40,%dl
8010252d: 75 05 jne 80102534 <kbdgetc+0x34>
8010252f: 89 c1 mov %eax,%ecx
80102531: 83 e1 7f and $0x7f,%ecx
shift &= ~(shiftcode[data] | E0ESC);
80102534: 0f b6 81 20 73 10 80 movzbl -0x7fef8ce0(%ecx),%eax
8010253b: 83 c8 40 or $0x40,%eax
8010253e: 0f b6 c0 movzbl %al,%eax
80102541: f7 d0 not %eax
80102543: 21 d0 and %edx,%eax
80102545: a3 b4 a5 10 80 mov %eax,0x8010a5b4
return 0;
8010254a: 31 c0 xor %eax,%eax
8010254c: c3 ret
8010254d: 8d 76 00 lea 0x0(%esi),%esi
#include "defs.h"
#include "kbd.h"
int
kbdgetc(void)
{
80102550: 55 push %ebp
80102551: 89 e5 mov %esp,%ebp
80102553: 53 push %ebx
80102554: 8b 1d b4 a5 10 80 mov 0x8010a5b4,%ebx
} else if(data & 0x80){
// Key released
data = (shift & E0ESC ? data : data & 0x7F);
shift &= ~(shiftcode[data] | E0ESC);
return 0;
} else if(shift & E0ESC){
8010255a: f6 c3 40 test $0x40,%bl
8010255d: 74 09 je 80102568 <kbdgetc+0x68>
// Last character was an E0 escape; or with 0x80
data |= 0x80;
8010255f: 83 c8 80 or $0xffffff80,%eax
shift &= ~E0ESC;
80102562: 83 e3 bf and $0xffffffbf,%ebx
data = (shift & E0ESC ? data : data & 0x7F);
shift &= ~(shiftcode[data] | E0ESC);
return 0;
} else if(shift & E0ESC){
// Last character was an E0 escape; or with 0x80
data |= 0x80;
80102565: 0f b6 c8 movzbl %al,%ecx
shift &= ~E0ESC;
}
shift |= shiftcode[data];
80102568: 0f b6 91 20 73 10 80 movzbl -0x7fef8ce0(%ecx),%edx
shift ^= togglecode[data];
8010256f: 0f b6 81 20 72 10 80 movzbl -0x7fef8de0(%ecx),%eax
// Last character was an E0 escape; or with 0x80
data |= 0x80;
shift &= ~E0ESC;
}
shift |= shiftcode[data];
80102576: 09 da or %ebx,%edx
shift ^= togglecode[data];
80102578: 31 c2 xor %eax,%edx
c = charcode[shift & (CTL | SHIFT)][data];
8010257a: 89 d0 mov %edx,%eax
8010257c: 83 e0 03 and $0x3,%eax
8010257f: 8b 04 85 00 72 10 80 mov -0x7fef8e00(,%eax,4),%eax
data |= 0x80;
shift &= ~E0ESC;
}
shift |= shiftcode[data];
shift ^= togglecode[data];
80102586: 89 15 b4 a5 10 80 mov %edx,0x8010a5b4
c = charcode[shift & (CTL | SHIFT)][data];
if(shift & CAPSLOCK){
8010258c: 83 e2 08 and $0x8,%edx
shift &= ~E0ESC;
}
shift |= shiftcode[data];
shift ^= togglecode[data];
c = charcode[shift & (CTL | SHIFT)][data];
8010258f: 0f b6 04 08 movzbl (%eax,%ecx,1),%eax
if(shift & CAPSLOCK){
80102593: 74 0b je 801025a0 <kbdgetc+0xa0>
if('a' <= c && c <= 'z')
80102595: 8d 50 9f lea -0x61(%eax),%edx
80102598: 83 fa 19 cmp $0x19,%edx
8010259b: 77 1b ja 801025b8 <kbdgetc+0xb8>
c += 'A' - 'a';
8010259d: 83 e8 20 sub $0x20,%eax
else if('A' <= c && c <= 'Z')
c += 'a' - 'A';
}
return c;
}
801025a0: 5b pop %ebx
801025a1: 5d pop %ebp
801025a2: c3 ret
801025a3: 90 nop
801025a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if((st & KBS_DIB) == 0)
return -1;
data = inb(KBDATAP);
if(data == 0xE0){
shift |= E0ESC;
801025a8: 83 0d b4 a5 10 80 40 orl $0x40,0x8010a5b4
return 0;
801025af: 31 c0 xor %eax,%eax
801025b1: c3 ret
801025b2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
shift ^= togglecode[data];
c = charcode[shift & (CTL | SHIFT)][data];
if(shift & CAPSLOCK){
if('a' <= c && c <= 'z')
c += 'A' - 'a';
else if('A' <= c && c <= 'Z')
801025b8: 8d 48 bf lea -0x41(%eax),%ecx
c += 'a' - 'A';
801025bb: 8d 50 20 lea 0x20(%eax),%edx
801025be: 83 f9 19 cmp $0x19,%ecx
801025c1: 0f 46 c2 cmovbe %edx,%eax
}
return c;
801025c4: eb da jmp 801025a0 <kbdgetc+0xa0>
801025c6: 66 90 xchg %ax,%ax
};
uint st, data, c;
st = inb(KBSTATP);
if((st & KBS_DIB) == 0)
return -1;
801025c8: b8 ff ff ff ff mov $0xffffffff,%eax
801025cd: c3 ret
801025ce: 66 90 xchg %ax,%ax
801025d0 <kbdintr>:
return c;
}
void
kbdintr(void)
{
801025d0: 55 push %ebp
801025d1: 89 e5 mov %esp,%ebp
801025d3: 83 ec 18 sub $0x18,%esp
consoleintr(kbdgetc);
801025d6: c7 04 24 00 25 10 80 movl $0x80102500,(%esp)
801025dd: e8 ce e1 ff ff call 801007b0 <consoleintr>
}
801025e2: c9 leave
801025e3: c3 ret
801025e4: 66 90 xchg %ax,%ax
801025e6: 66 90 xchg %ax,%ax
801025e8: 66 90 xchg %ax,%ax
801025ea: 66 90 xchg %ax,%ax
801025ec: 66 90 xchg %ax,%ax
801025ee: 66 90 xchg %ax,%ax
801025f0 <fill_rtcdate>:
return inb(CMOS_RETURN);
}
static void fill_rtcdate(struct rtcdate *r)
{
801025f0: 55 push %ebp
801025f1: 89 c1 mov %eax,%ecx
801025f3: 89 e5 mov %esp,%ebp
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801025f5: ba 70 00 00 00 mov $0x70,%edx
801025fa: 53 push %ebx
801025fb: 31 c0 xor %eax,%eax
801025fd: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801025fe: bb 71 00 00 00 mov $0x71,%ebx
80102603: 89 da mov %ebx,%edx
80102605: ec in (%dx),%al
static uint cmos_read(uint reg)
{
outb(CMOS_PORT, reg);
microdelay(200);
return inb(CMOS_RETURN);
80102606: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102609: b2 70 mov $0x70,%dl
8010260b: 89 01 mov %eax,(%ecx)
8010260d: b8 02 00 00 00 mov $0x2,%eax
80102612: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102613: 89 da mov %ebx,%edx
80102615: ec in (%dx),%al
80102616: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102619: b2 70 mov $0x70,%dl
8010261b: 89 41 04 mov %eax,0x4(%ecx)
8010261e: b8 04 00 00 00 mov $0x4,%eax
80102623: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102624: 89 da mov %ebx,%edx
80102626: ec in (%dx),%al
80102627: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
8010262a: b2 70 mov $0x70,%dl
8010262c: 89 41 08 mov %eax,0x8(%ecx)
8010262f: b8 07 00 00 00 mov $0x7,%eax
80102634: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102635: 89 da mov %ebx,%edx
80102637: ec in (%dx),%al
80102638: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
8010263b: b2 70 mov $0x70,%dl
8010263d: 89 41 0c mov %eax,0xc(%ecx)
80102640: b8 08 00 00 00 mov $0x8,%eax
80102645: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102646: 89 da mov %ebx,%edx
80102648: ec in (%dx),%al
80102649: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
8010264c: b2 70 mov $0x70,%dl
8010264e: 89 41 10 mov %eax,0x10(%ecx)
80102651: b8 09 00 00 00 mov $0x9,%eax
80102656: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102657: 89 da mov %ebx,%edx
80102659: ec in (%dx),%al
8010265a: 0f b6 d8 movzbl %al,%ebx
8010265d: 89 59 14 mov %ebx,0x14(%ecx)
r->minute = cmos_read(MINS);
r->hour = cmos_read(HOURS);
r->day = cmos_read(DAY);
r->month = cmos_read(MONTH);
r->year = cmos_read(YEAR);
}
80102660: 5b pop %ebx
80102661: 5d pop %ebp
80102662: c3 ret
80102663: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80102669: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80102670 <lapicinit>:
//PAGEBREAK!
void
lapicinit(void)
{
if(!lapic)
80102670: a1 9c 26 11 80 mov 0x8011269c,%eax
}
//PAGEBREAK!
void
lapicinit(void)
{
80102675: 55 push %ebp
80102676: 89 e5 mov %esp,%ebp
if(!lapic)
80102678: 85 c0 test %eax,%eax
8010267a: 0f 84 c0 00 00 00 je 80102740 <lapicinit+0xd0>
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102680: c7 80 f0 00 00 00 3f movl $0x13f,0xf0(%eax)
80102687: 01 00 00
lapic[ID]; // wait for write to finish, by reading
8010268a: 8b 50 20 mov 0x20(%eax),%edx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010268d: c7 80 e0 03 00 00 0b movl $0xb,0x3e0(%eax)
80102694: 00 00 00
lapic[ID]; // wait for write to finish, by reading
80102697: 8b 50 20 mov 0x20(%eax),%edx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010269a: c7 80 20 03 00 00 20 movl $0x20020,0x320(%eax)
801026a1: 00 02 00
lapic[ID]; // wait for write to finish, by reading
801026a4: 8b 50 20 mov 0x20(%eax),%edx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
801026a7: c7 80 80 03 00 00 80 movl $0x989680,0x380(%eax)
801026ae: 96 98 00
lapic[ID]; // wait for write to finish, by reading
801026b1: 8b 50 20 mov 0x20(%eax),%edx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
801026b4: c7 80 50 03 00 00 00 movl $0x10000,0x350(%eax)
801026bb: 00 01 00
lapic[ID]; // wait for write to finish, by reading
801026be: 8b 50 20 mov 0x20(%eax),%edx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
801026c1: c7 80 60 03 00 00 00 movl $0x10000,0x360(%eax)
801026c8: 00 01 00
lapic[ID]; // wait for write to finish, by reading
801026cb: 8b 50 20 mov 0x20(%eax),%edx
lapicw(LINT0, MASKED);
lapicw(LINT1, MASKED);
// Disable performance counter overflow interrupts
// on machines that provide that interrupt entry.
if(((lapic[VER]>>16) & 0xFF) >= 4)
801026ce: 8b 50 30 mov 0x30(%eax),%edx
801026d1: c1 ea 10 shr $0x10,%edx
801026d4: 80 fa 03 cmp $0x3,%dl
801026d7: 77 6f ja 80102748 <lapicinit+0xd8>
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
801026d9: c7 80 70 03 00 00 33 movl $0x33,0x370(%eax)
801026e0: 00 00 00
lapic[ID]; // wait for write to finish, by reading
801026e3: 8b 50 20 mov 0x20(%eax),%edx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
801026e6: c7 80 80 02 00 00 00 movl $0x0,0x280(%eax)
801026ed: 00 00 00
lapic[ID]; // wait for write to finish, by reading
801026f0: 8b 50 20 mov 0x20(%eax),%edx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
801026f3: c7 80 80 02 00 00 00 movl $0x0,0x280(%eax)
801026fa: 00 00 00
lapic[ID]; // wait for write to finish, by reading
801026fd: 8b 50 20 mov 0x20(%eax),%edx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102700: c7 80 b0 00 00 00 00 movl $0x0,0xb0(%eax)
80102707: 00 00 00
lapic[ID]; // wait for write to finish, by reading
8010270a: 8b 50 20 mov 0x20(%eax),%edx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010270d: c7 80 10 03 00 00 00 movl $0x0,0x310(%eax)
80102714: 00 00 00
lapic[ID]; // wait for write to finish, by reading
80102717: 8b 50 20 mov 0x20(%eax),%edx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010271a: c7 80 00 03 00 00 00 movl $0x88500,0x300(%eax)
80102721: 85 08 00
lapic[ID]; // wait for write to finish, by reading
80102724: 8b 50 20 mov 0x20(%eax),%edx
80102727: 90 nop
lapicw(EOI, 0);
// Send an Init Level De-Assert to synchronise arbitration ID's.
lapicw(ICRHI, 0);
lapicw(ICRLO, BCAST | INIT | LEVEL);
while(lapic[ICRLO] & DELIVS)
80102728: 8b 90 00 03 00 00 mov 0x300(%eax),%edx
8010272e: 80 e6 10 and $0x10,%dh
80102731: 75 f5 jne 80102728 <lapicinit+0xb8>
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102733: c7 80 80 00 00 00 00 movl $0x0,0x80(%eax)
8010273a: 00 00 00
lapic[ID]; // wait for write to finish, by reading
8010273d: 8b 40 20 mov 0x20(%eax),%eax
while(lapic[ICRLO] & DELIVS)
;
// Enable interrupts on the APIC (but not on the processor).
lapicw(TPR, 0);
}
80102740: 5d pop %ebp
80102741: c3 ret
80102742: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102748: c7 80 40 03 00 00 00 movl $0x10000,0x340(%eax)
8010274f: 00 01 00
lapic[ID]; // wait for write to finish, by reading
80102752: 8b 50 20 mov 0x20(%eax),%edx
80102755: eb 82 jmp 801026d9 <lapicinit+0x69>
80102757: 89 f6 mov %esi,%esi
80102759: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80102760 <cpunum>:
lapicw(TPR, 0);
}
int
cpunum(void)
{
80102760: 55 push %ebp
80102761: 89 e5 mov %esp,%ebp
80102763: 56 push %esi
80102764: 53 push %ebx
80102765: 83 ec 10 sub $0x10,%esp
static inline uint
readeflags(void)
{
uint eflags;
asm volatile("pushfl; popl %0" : "=r" (eflags));
80102768: 9c pushf
80102769: 58 pop %eax
// Cannot call cpu when interrupts are enabled:
// result not guaranteed to last long enough to be used!
// Would prefer to panic but even printing is chancy here:
// almost everything, including cprintf and panic, calls cpu,
// often indirectly through acquire and release.
if(readeflags()&FL_IF){
8010276a: f6 c4 02 test $0x2,%ah
8010276d: 74 12 je 80102781 <cpunum+0x21>
static int n;
if(n++ == 0)
8010276f: a1 b8 a5 10 80 mov 0x8010a5b8,%eax
80102774: 8d 50 01 lea 0x1(%eax),%edx
80102777: 85 c0 test %eax,%eax
80102779: 89 15 b8 a5 10 80 mov %edx,0x8010a5b8
8010277f: 74 4a je 801027cb <cpunum+0x6b>
cprintf("cpu called from %x with interrupts enabled\n",
__builtin_return_address(0));
}
if (!lapic)
80102781: a1 9c 26 11 80 mov 0x8011269c,%eax
80102786: 85 c0 test %eax,%eax
80102788: 74 5d je 801027e7 <cpunum+0x87>
return 0;
apicid = lapic[ID] >> 24;
8010278a: 8b 58 20 mov 0x20(%eax),%ebx
for (i = 0; i < ncpu; ++i) {
8010278d: 8b 35 80 2d 11 80 mov 0x80112d80,%esi
}
if (!lapic)
return 0;
apicid = lapic[ID] >> 24;
80102793: c1 eb 18 shr $0x18,%ebx
for (i = 0; i < ncpu; ++i) {
80102796: 85 f6 test %esi,%esi
80102798: 7e 56 jle 801027f0 <cpunum+0x90>
if (cpus[i].apicid == apicid)
8010279a: 0f b6 05 a0 27 11 80 movzbl 0x801127a0,%eax
801027a1: 39 d8 cmp %ebx,%eax
801027a3: 74 42 je 801027e7 <cpunum+0x87>
801027a5: ba 5c 28 11 80 mov $0x8011285c,%edx
if (!lapic)
return 0;
apicid = lapic[ID] >> 24;
for (i = 0; i < ncpu; ++i) {
801027aa: 31 c0 xor %eax,%eax
801027ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801027b0: 83 c0 01 add $0x1,%eax
801027b3: 39 f0 cmp %esi,%eax
801027b5: 74 39 je 801027f0 <cpunum+0x90>
if (cpus[i].apicid == apicid)
801027b7: 0f b6 0a movzbl (%edx),%ecx
801027ba: 81 c2 bc 00 00 00 add $0xbc,%edx
801027c0: 39 d9 cmp %ebx,%ecx
801027c2: 75 ec jne 801027b0 <cpunum+0x50>
return i;
}
panic("unknown apicid\n");
}
801027c4: 83 c4 10 add $0x10,%esp
801027c7: 5b pop %ebx
801027c8: 5e pop %esi
801027c9: 5d pop %ebp
801027ca: c3 ret
// almost everything, including cprintf and panic, calls cpu,
// often indirectly through acquire and release.
if(readeflags()&FL_IF){
static int n;
if(n++ == 0)
cprintf("cpu called from %x with interrupts enabled\n",
801027cb: 8b 45 04 mov 0x4(%ebp),%eax
801027ce: c7 04 24 20 74 10 80 movl $0x80107420,(%esp)
801027d5: 89 44 24 04 mov %eax,0x4(%esp)
801027d9: e8 72 de ff ff call 80100650 <cprintf>
__builtin_return_address(0));
}
if (!lapic)
801027de: a1 9c 26 11 80 mov 0x8011269c,%eax
801027e3: 85 c0 test %eax,%eax
801027e5: 75 a3 jne 8010278a <cpunum+0x2a>
for (i = 0; i < ncpu; ++i) {
if (cpus[i].apicid == apicid)
return i;
}
panic("unknown apicid\n");
}
801027e7: 83 c4 10 add $0x10,%esp
cprintf("cpu called from %x with interrupts enabled\n",
__builtin_return_address(0));
}
if (!lapic)
return 0;
801027ea: 31 c0 xor %eax,%eax
for (i = 0; i < ncpu; ++i) {
if (cpus[i].apicid == apicid)
return i;
}
panic("unknown apicid\n");
}
801027ec: 5b pop %ebx
801027ed: 5e pop %esi
801027ee: 5d pop %ebp
801027ef: c3 ret
apicid = lapic[ID] >> 24;
for (i = 0; i < ncpu; ++i) {
if (cpus[i].apicid == apicid)
return i;
}
panic("unknown apicid\n");
801027f0: c7 04 24 4c 74 10 80 movl $0x8010744c,(%esp)
801027f7: e8 64 db ff ff call 80100360 <panic>
801027fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80102800 <lapiceoi>:
// Acknowledge interrupt.
void
lapiceoi(void)
{
if(lapic)
80102800: a1 9c 26 11 80 mov 0x8011269c,%eax
}
// Acknowledge interrupt.
void
lapiceoi(void)
{
80102805: 55 push %ebp
80102806: 89 e5 mov %esp,%ebp
if(lapic)
80102808: 85 c0 test %eax,%eax
8010280a: 74 0d je 80102819 <lapiceoi+0x19>
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010280c: c7 80 b0 00 00 00 00 movl $0x0,0xb0(%eax)
80102813: 00 00 00
lapic[ID]; // wait for write to finish, by reading
80102816: 8b 40 20 mov 0x20(%eax),%eax
void
lapiceoi(void)
{
if(lapic)
lapicw(EOI, 0);
}
80102819: 5d pop %ebp
8010281a: c3 ret
8010281b: 90 nop
8010281c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80102820 <microdelay>:
// Spin for a given number of microseconds.
// On real hardware would want to tune this dynamically.
void
microdelay(int us)
{
80102820: 55 push %ebp
80102821: 89 e5 mov %esp,%ebp
}
80102823: 5d pop %ebp
80102824: c3 ret
80102825: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80102829: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80102830 <lapicstartap>:
// Start additional processor running entry code at addr.
// See Appendix B of MultiProcessor Specification.
void
lapicstartap(uchar apicid, uint addr)
{
80102830: 55 push %ebp
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102831: ba 70 00 00 00 mov $0x70,%edx
80102836: 89 e5 mov %esp,%ebp
80102838: b8 0f 00 00 00 mov $0xf,%eax
8010283d: 53 push %ebx
8010283e: 8b 4d 08 mov 0x8(%ebp),%ecx
80102841: 8b 5d 0c mov 0xc(%ebp),%ebx
80102844: ee out %al,(%dx)
80102845: b8 0a 00 00 00 mov $0xa,%eax
8010284a: b2 71 mov $0x71,%dl
8010284c: ee out %al,(%dx)
// and the warm reset vector (DWORD based at 40:67) to point at
// the AP startup code prior to the [universal startup algorithm]."
outb(CMOS_PORT, 0xF); // offset 0xF is shutdown code
outb(CMOS_PORT+1, 0x0A);
wrv = (ushort*)P2V((0x40<<4 | 0x67)); // Warm reset vector
wrv[0] = 0;
8010284d: 31 c0 xor %eax,%eax
8010284f: 66 a3 67 04 00 80 mov %ax,0x80000467
wrv[1] = addr >> 4;
80102855: 89 d8 mov %ebx,%eax
80102857: c1 e8 04 shr $0x4,%eax
8010285a: 66 a3 69 04 00 80 mov %ax,0x80000469
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102860: a1 9c 26 11 80 mov 0x8011269c,%eax
wrv[0] = 0;
wrv[1] = addr >> 4;
// "Universal startup algorithm."
// Send INIT (level-triggered) interrupt to reset other CPU.
lapicw(ICRHI, apicid<<24);
80102865: c1 e1 18 shl $0x18,%ecx
// when it is in the halted state due to an INIT. So the second
// should be ignored, but it is part of the official Intel algorithm.
// Bochs complains about the second one. Too bad for Bochs.
for(i = 0; i < 2; i++){
lapicw(ICRHI, apicid<<24);
lapicw(ICRLO, STARTUP | (addr>>12));
80102868: c1 eb 0c shr $0xc,%ebx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010286b: 89 88 10 03 00 00 mov %ecx,0x310(%eax)
lapic[ID]; // wait for write to finish, by reading
80102871: 8b 50 20 mov 0x20(%eax),%edx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102874: c7 80 00 03 00 00 00 movl $0xc500,0x300(%eax)
8010287b: c5 00 00
lapic[ID]; // wait for write to finish, by reading
8010287e: 8b 50 20 mov 0x20(%eax),%edx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102881: c7 80 00 03 00 00 00 movl $0x8500,0x300(%eax)
80102888: 85 00 00
lapic[ID]; // wait for write to finish, by reading
8010288b: 8b 50 20 mov 0x20(%eax),%edx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010288e: 89 88 10 03 00 00 mov %ecx,0x310(%eax)
lapic[ID]; // wait for write to finish, by reading
80102894: 8b 50 20 mov 0x20(%eax),%edx
// when it is in the halted state due to an INIT. So the second
// should be ignored, but it is part of the official Intel algorithm.
// Bochs complains about the second one. Too bad for Bochs.
for(i = 0; i < 2; i++){
lapicw(ICRHI, apicid<<24);
lapicw(ICRLO, STARTUP | (addr>>12));
80102897: 89 da mov %ebx,%edx
80102899: 80 ce 06 or $0x6,%dh
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010289c: 89 90 00 03 00 00 mov %edx,0x300(%eax)
lapic[ID]; // wait for write to finish, by reading
801028a2: 8b 58 20 mov 0x20(%eax),%ebx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
801028a5: 89 88 10 03 00 00 mov %ecx,0x310(%eax)
lapic[ID]; // wait for write to finish, by reading
801028ab: 8b 48 20 mov 0x20(%eax),%ecx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
801028ae: 89 90 00 03 00 00 mov %edx,0x300(%eax)
lapic[ID]; // wait for write to finish, by reading
801028b4: 8b 40 20 mov 0x20(%eax),%eax
for(i = 0; i < 2; i++){
lapicw(ICRHI, apicid<<24);
lapicw(ICRLO, STARTUP | (addr>>12));
microdelay(200);
}
}
801028b7: 5b pop %ebx
801028b8: 5d pop %ebp
801028b9: c3 ret
801028ba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801028c0 <cmostime>:
r->year = cmos_read(YEAR);
}
// qemu seems to use 24-hour GWT and the values are BCD encoded
void cmostime(struct rtcdate *r)
{
801028c0: 55 push %ebp
801028c1: ba 70 00 00 00 mov $0x70,%edx
801028c6: 89 e5 mov %esp,%ebp
801028c8: b8 0b 00 00 00 mov $0xb,%eax
801028cd: 57 push %edi
801028ce: 56 push %esi
801028cf: 53 push %ebx
801028d0: 83 ec 4c sub $0x4c,%esp
801028d3: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801028d4: b2 71 mov $0x71,%dl
801028d6: ec in (%dx),%al
801028d7: 88 45 b7 mov %al,-0x49(%ebp)
801028da: 8d 5d b8 lea -0x48(%ebp),%ebx
struct rtcdate t1, t2;
int sb, bcd;
sb = cmos_read(CMOS_STATB);
bcd = (sb & (1 << 2)) == 0;
801028dd: 80 65 b7 04 andb $0x4,-0x49(%ebp)
801028e1: 8d 7d d0 lea -0x30(%ebp),%edi
801028e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801028e8: be 70 00 00 00 mov $0x70,%esi
// make sure CMOS doesn't modify time while we read it
for(;;) {
fill_rtcdate(&t1);
801028ed: 89 d8 mov %ebx,%eax
801028ef: e8 fc fc ff ff call 801025f0 <fill_rtcdate>
801028f4: b8 0a 00 00 00 mov $0xa,%eax
801028f9: 89 f2 mov %esi,%edx
801028fb: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801028fc: ba 71 00 00 00 mov $0x71,%edx
80102901: ec in (%dx),%al
if(cmos_read(CMOS_STATA) & CMOS_UIP)
80102902: 84 c0 test %al,%al
80102904: 78 e7 js 801028ed <cmostime+0x2d>
continue;
fill_rtcdate(&t2);
80102906: 89 f8 mov %edi,%eax
80102908: e8 e3 fc ff ff call 801025f0 <fill_rtcdate>
if(memcmp(&t1, &t2, sizeof(t1)) == 0)
8010290d: c7 44 24 08 18 00 00 movl $0x18,0x8(%esp)
80102914: 00
80102915: 89 7c 24 04 mov %edi,0x4(%esp)
80102919: 89 1c 24 mov %ebx,(%esp)
8010291c: e8 4f 1c 00 00 call 80104570 <memcmp>
80102921: 85 c0 test %eax,%eax
80102923: 75 c3 jne 801028e8 <cmostime+0x28>
break;
}
// convert
if(bcd) {
80102925: 80 7d b7 00 cmpb $0x0,-0x49(%ebp)
80102929: 75 78 jne 801029a3 <cmostime+0xe3>
#define CONV(x) (t1.x = ((t1.x >> 4) * 10) + (t1.x & 0xf))
CONV(second);
8010292b: 8b 45 b8 mov -0x48(%ebp),%eax
8010292e: 89 c2 mov %eax,%edx
80102930: 83 e0 0f and $0xf,%eax
80102933: c1 ea 04 shr $0x4,%edx
80102936: 8d 14 92 lea (%edx,%edx,4),%edx
80102939: 8d 04 50 lea (%eax,%edx,2),%eax
8010293c: 89 45 b8 mov %eax,-0x48(%ebp)
CONV(minute);
8010293f: 8b 45 bc mov -0x44(%ebp),%eax
80102942: 89 c2 mov %eax,%edx
80102944: 83 e0 0f and $0xf,%eax
80102947: c1 ea 04 shr $0x4,%edx
8010294a: 8d 14 92 lea (%edx,%edx,4),%edx
8010294d: 8d 04 50 lea (%eax,%edx,2),%eax
80102950: 89 45 bc mov %eax,-0x44(%ebp)
CONV(hour );
80102953: 8b 45 c0 mov -0x40(%ebp),%eax
80102956: 89 c2 mov %eax,%edx
80102958: 83 e0 0f and $0xf,%eax
8010295b: c1 ea 04 shr $0x4,%edx
8010295e: 8d 14 92 lea (%edx,%edx,4),%edx
80102961: 8d 04 50 lea (%eax,%edx,2),%eax
80102964: 89 45 c0 mov %eax,-0x40(%ebp)
CONV(day );
80102967: 8b 45 c4 mov -0x3c(%ebp),%eax
8010296a: 89 c2 mov %eax,%edx
8010296c: 83 e0 0f and $0xf,%eax
8010296f: c1 ea 04 shr $0x4,%edx
80102972: 8d 14 92 lea (%edx,%edx,4),%edx
80102975: 8d 04 50 lea (%eax,%edx,2),%eax
80102978: 89 45 c4 mov %eax,-0x3c(%ebp)
CONV(month );
8010297b: 8b 45 c8 mov -0x38(%ebp),%eax
8010297e: 89 c2 mov %eax,%edx
80102980: 83 e0 0f and $0xf,%eax
80102983: c1 ea 04 shr $0x4,%edx
80102986: 8d 14 92 lea (%edx,%edx,4),%edx
80102989: 8d 04 50 lea (%eax,%edx,2),%eax
8010298c: 89 45 c8 mov %eax,-0x38(%ebp)
CONV(year );
8010298f: 8b 45 cc mov -0x34(%ebp),%eax
80102992: 89 c2 mov %eax,%edx
80102994: 83 e0 0f and $0xf,%eax
80102997: c1 ea 04 shr $0x4,%edx
8010299a: 8d 14 92 lea (%edx,%edx,4),%edx
8010299d: 8d 04 50 lea (%eax,%edx,2),%eax
801029a0: 89 45 cc mov %eax,-0x34(%ebp)
#undef CONV
}
*r = t1;
801029a3: 8b 4d 08 mov 0x8(%ebp),%ecx
801029a6: 8b 45 b8 mov -0x48(%ebp),%eax
801029a9: 89 01 mov %eax,(%ecx)
801029ab: 8b 45 bc mov -0x44(%ebp),%eax
801029ae: 89 41 04 mov %eax,0x4(%ecx)
801029b1: 8b 45 c0 mov -0x40(%ebp),%eax
801029b4: 89 41 08 mov %eax,0x8(%ecx)
801029b7: 8b 45 c4 mov -0x3c(%ebp),%eax
801029ba: 89 41 0c mov %eax,0xc(%ecx)
801029bd: 8b 45 c8 mov -0x38(%ebp),%eax
801029c0: 89 41 10 mov %eax,0x10(%ecx)
801029c3: 8b 45 cc mov -0x34(%ebp),%eax
801029c6: 89 41 14 mov %eax,0x14(%ecx)
r->year += 2000;
801029c9: 81 41 14 d0 07 00 00 addl $0x7d0,0x14(%ecx)
}
801029d0: 83 c4 4c add $0x4c,%esp
801029d3: 5b pop %ebx
801029d4: 5e pop %esi
801029d5: 5f pop %edi
801029d6: 5d pop %ebp
801029d7: c3 ret
801029d8: 66 90 xchg %ax,%ax
801029da: 66 90 xchg %ax,%ax
801029dc: 66 90 xchg %ax,%ax
801029de: 66 90 xchg %ax,%ax
801029e0 <install_trans>:
}
// Copy committed blocks from log to their home location
static void
install_trans(void)
{
801029e0: 55 push %ebp
801029e1: 89 e5 mov %esp,%ebp
801029e3: 57 push %edi
801029e4: 56 push %esi
801029e5: 53 push %ebx
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
801029e6: 31 db xor %ebx,%ebx
}
// Copy committed blocks from log to their home location
static void
install_trans(void)
{
801029e8: 83 ec 1c sub $0x1c,%esp
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
801029eb: a1 e8 26 11 80 mov 0x801126e8,%eax
801029f0: 85 c0 test %eax,%eax
801029f2: 7e 78 jle 80102a6c <install_trans+0x8c>
801029f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block
801029f8: a1 d4 26 11 80 mov 0x801126d4,%eax
801029fd: 01 d8 add %ebx,%eax
801029ff: 83 c0 01 add $0x1,%eax
80102a02: 89 44 24 04 mov %eax,0x4(%esp)
80102a06: a1 e4 26 11 80 mov 0x801126e4,%eax
80102a0b: 89 04 24 mov %eax,(%esp)
80102a0e: e8 bd d6 ff ff call 801000d0 <bread>
80102a13: 89 c7 mov %eax,%edi
struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst
80102a15: 8b 04 9d ec 26 11 80 mov -0x7feed914(,%ebx,4),%eax
static void
install_trans(void)
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
80102a1c: 83 c3 01 add $0x1,%ebx
struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block
struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst
80102a1f: 89 44 24 04 mov %eax,0x4(%esp)
80102a23: a1 e4 26 11 80 mov 0x801126e4,%eax
80102a28: 89 04 24 mov %eax,(%esp)
80102a2b: e8 a0 d6 ff ff call 801000d0 <bread>
memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst
80102a30: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
80102a37: 00
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block
struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst
80102a38: 89 c6 mov %eax,%esi
memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst
80102a3a: 8d 47 5c lea 0x5c(%edi),%eax
80102a3d: 89 44 24 04 mov %eax,0x4(%esp)
80102a41: 8d 46 5c lea 0x5c(%esi),%eax
80102a44: 89 04 24 mov %eax,(%esp)
80102a47: e8 84 1b 00 00 call 801045d0 <memmove>
bwrite(dbuf); // write dst to disk
80102a4c: 89 34 24 mov %esi,(%esp)
80102a4f: e8 4c d7 ff ff call 801001a0 <bwrite>
brelse(lbuf);
80102a54: 89 3c 24 mov %edi,(%esp)
80102a57: e8 84 d7 ff ff call 801001e0 <brelse>
brelse(dbuf);
80102a5c: 89 34 24 mov %esi,(%esp)
80102a5f: e8 7c d7 ff ff call 801001e0 <brelse>
static void
install_trans(void)
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
80102a64: 39 1d e8 26 11 80 cmp %ebx,0x801126e8
80102a6a: 7f 8c jg 801029f8 <install_trans+0x18>
memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst
bwrite(dbuf); // write dst to disk
brelse(lbuf);
brelse(dbuf);
}
}
80102a6c: 83 c4 1c add $0x1c,%esp
80102a6f: 5b pop %ebx
80102a70: 5e pop %esi
80102a71: 5f pop %edi
80102a72: 5d pop %ebp
80102a73: c3 ret
80102a74: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80102a7a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80102a80 <write_head>:
// Write in-memory log header to disk.
// This is the true point at which the
// current transaction commits.
static void
write_head(void)
{
80102a80: 55 push %ebp
80102a81: 89 e5 mov %esp,%ebp
80102a83: 57 push %edi
80102a84: 56 push %esi
80102a85: 53 push %ebx
80102a86: 83 ec 1c sub $0x1c,%esp
struct buf *buf = bread(log.dev, log.start);
80102a89: a1 d4 26 11 80 mov 0x801126d4,%eax
80102a8e: 89 44 24 04 mov %eax,0x4(%esp)
80102a92: a1 e4 26 11 80 mov 0x801126e4,%eax
80102a97: 89 04 24 mov %eax,(%esp)
80102a9a: e8 31 d6 ff ff call 801000d0 <bread>
struct logheader *hb = (struct logheader *) (buf->data);
int i;
hb->n = log.lh.n;
80102a9f: 8b 1d e8 26 11 80 mov 0x801126e8,%ebx
for (i = 0; i < log.lh.n; i++) {
80102aa5: 31 d2 xor %edx,%edx
80102aa7: 85 db test %ebx,%ebx
// This is the true point at which the
// current transaction commits.
static void
write_head(void)
{
struct buf *buf = bread(log.dev, log.start);
80102aa9: 89 c7 mov %eax,%edi
struct logheader *hb = (struct logheader *) (buf->data);
int i;
hb->n = log.lh.n;
80102aab: 89 58 5c mov %ebx,0x5c(%eax)
80102aae: 8d 70 5c lea 0x5c(%eax),%esi
for (i = 0; i < log.lh.n; i++) {
80102ab1: 7e 17 jle 80102aca <write_head+0x4a>
80102ab3: 90 nop
80102ab4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
hb->block[i] = log.lh.block[i];
80102ab8: 8b 0c 95 ec 26 11 80 mov -0x7feed914(,%edx,4),%ecx
80102abf: 89 4c 96 04 mov %ecx,0x4(%esi,%edx,4)
{
struct buf *buf = bread(log.dev, log.start);
struct logheader *hb = (struct logheader *) (buf->data);
int i;
hb->n = log.lh.n;
for (i = 0; i < log.lh.n; i++) {
80102ac3: 83 c2 01 add $0x1,%edx
80102ac6: 39 da cmp %ebx,%edx
80102ac8: 75 ee jne 80102ab8 <write_head+0x38>
hb->block[i] = log.lh.block[i];
}
bwrite(buf);
80102aca: 89 3c 24 mov %edi,(%esp)
80102acd: e8 ce d6 ff ff call 801001a0 <bwrite>
brelse(buf);
80102ad2: 89 3c 24 mov %edi,(%esp)
80102ad5: e8 06 d7 ff ff call 801001e0 <brelse>
}
80102ada: 83 c4 1c add $0x1c,%esp
80102add: 5b pop %ebx
80102ade: 5e pop %esi
80102adf: 5f pop %edi
80102ae0: 5d pop %ebp
80102ae1: c3 ret
80102ae2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80102ae9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80102af0 <initlog>:
static void recover_from_log(void);
static void commit();
void
initlog(int dev)
{
80102af0: 55 push %ebp
80102af1: 89 e5 mov %esp,%ebp
80102af3: 56 push %esi
80102af4: 53 push %ebx
80102af5: 83 ec 30 sub $0x30,%esp
80102af8: 8b 5d 08 mov 0x8(%ebp),%ebx
if (sizeof(struct logheader) >= BSIZE)
panic("initlog: too big logheader");
struct superblock sb;
initlock(&log.lock, "log");
80102afb: c7 44 24 04 5c 74 10 movl $0x8010745c,0x4(%esp)
80102b02: 80
80102b03: c7 04 24 a0 26 11 80 movl $0x801126a0,(%esp)
80102b0a: e8 11 18 00 00 call 80104320 <initlock>
readsb(dev, &sb);
80102b0f: 8d 45 dc lea -0x24(%ebp),%eax
80102b12: 89 44 24 04 mov %eax,0x4(%esp)
80102b16: 89 1c 24 mov %ebx,(%esp)
80102b19: e8 82 e8 ff ff call 801013a0 <readsb>
log.start = sb.logstart;
80102b1e: 8b 45 ec mov -0x14(%ebp),%eax
log.size = sb.nlog;
80102b21: 8b 55 e8 mov -0x18(%ebp),%edx
// Read the log header from disk into the in-memory log header
static void
read_head(void)
{
struct buf *buf = bread(log.dev, log.start);
80102b24: 89 1c 24 mov %ebx,(%esp)
struct superblock sb;
initlock(&log.lock, "log");
readsb(dev, &sb);
log.start = sb.logstart;
log.size = sb.nlog;
log.dev = dev;
80102b27: 89 1d e4 26 11 80 mov %ebx,0x801126e4
// Read the log header from disk into the in-memory log header
static void
read_head(void)
{
struct buf *buf = bread(log.dev, log.start);
80102b2d: 89 44 24 04 mov %eax,0x4(%esp)
struct superblock sb;
initlock(&log.lock, "log");
readsb(dev, &sb);
log.start = sb.logstart;
log.size = sb.nlog;
80102b31: 89 15 d8 26 11 80 mov %edx,0x801126d8
panic("initlog: too big logheader");
struct superblock sb;
initlock(&log.lock, "log");
readsb(dev, &sb);
log.start = sb.logstart;
80102b37: a3 d4 26 11 80 mov %eax,0x801126d4
// Read the log header from disk into the in-memory log header
static void
read_head(void)
{
struct buf *buf = bread(log.dev, log.start);
80102b3c: e8 8f d5 ff ff call 801000d0 <bread>
struct logheader *lh = (struct logheader *) (buf->data);
int i;
log.lh.n = lh->n;
for (i = 0; i < log.lh.n; i++) {
80102b41: 31 d2 xor %edx,%edx
read_head(void)
{
struct buf *buf = bread(log.dev, log.start);
struct logheader *lh = (struct logheader *) (buf->data);
int i;
log.lh.n = lh->n;
80102b43: 8b 58 5c mov 0x5c(%eax),%ebx
80102b46: 8d 70 5c lea 0x5c(%eax),%esi
for (i = 0; i < log.lh.n; i++) {
80102b49: 85 db test %ebx,%ebx
read_head(void)
{
struct buf *buf = bread(log.dev, log.start);
struct logheader *lh = (struct logheader *) (buf->data);
int i;
log.lh.n = lh->n;
80102b4b: 89 1d e8 26 11 80 mov %ebx,0x801126e8
for (i = 0; i < log.lh.n; i++) {
80102b51: 7e 17 jle 80102b6a <initlog+0x7a>
80102b53: 90 nop
80102b54: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
log.lh.block[i] = lh->block[i];
80102b58: 8b 4c 96 04 mov 0x4(%esi,%edx,4),%ecx
80102b5c: 89 0c 95 ec 26 11 80 mov %ecx,-0x7feed914(,%edx,4)
{
struct buf *buf = bread(log.dev, log.start);
struct logheader *lh = (struct logheader *) (buf->data);
int i;
log.lh.n = lh->n;
for (i = 0; i < log.lh.n; i++) {
80102b63: 83 c2 01 add $0x1,%edx
80102b66: 39 da cmp %ebx,%edx
80102b68: 75 ee jne 80102b58 <initlog+0x68>
log.lh.block[i] = lh->block[i];
}
brelse(buf);
80102b6a: 89 04 24 mov %eax,(%esp)
80102b6d: e8 6e d6 ff ff call 801001e0 <brelse>
static void
recover_from_log(void)
{
read_head();
install_trans(); // if committed, copy from log to disk
80102b72: e8 69 fe ff ff call 801029e0 <install_trans>
log.lh.n = 0;
80102b77: c7 05 e8 26 11 80 00 movl $0x0,0x801126e8
80102b7e: 00 00 00
write_head(); // clear the log
80102b81: e8 fa fe ff ff call 80102a80 <write_head>
readsb(dev, &sb);
log.start = sb.logstart;
log.size = sb.nlog;
log.dev = dev;
recover_from_log();
}
80102b86: 83 c4 30 add $0x30,%esp
80102b89: 5b pop %ebx
80102b8a: 5e pop %esi
80102b8b: 5d pop %ebp
80102b8c: c3 ret
80102b8d: 8d 76 00 lea 0x0(%esi),%esi
80102b90 <begin_op>:
}
// called at the start of each FS system call.
void
begin_op(void)
{
80102b90: 55 push %ebp
80102b91: 89 e5 mov %esp,%ebp
80102b93: 83 ec 18 sub $0x18,%esp
acquire(&log.lock);
80102b96: c7 04 24 a0 26 11 80 movl $0x801126a0,(%esp)
80102b9d: e8 fe 17 00 00 call 801043a0 <acquire>
80102ba2: eb 18 jmp 80102bbc <begin_op+0x2c>
80102ba4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
while(1){
if(log.committing){
sleep(&log, &log.lock);
80102ba8: c7 44 24 04 a0 26 11 movl $0x801126a0,0x4(%esp)
80102baf: 80
80102bb0: c7 04 24 a0 26 11 80 movl $0x801126a0,(%esp)
80102bb7: e8 e4 12 00 00 call 80103ea0 <sleep>
void
begin_op(void)
{
acquire(&log.lock);
while(1){
if(log.committing){
80102bbc: a1 e0 26 11 80 mov 0x801126e0,%eax
80102bc1: 85 c0 test %eax,%eax
80102bc3: 75 e3 jne 80102ba8 <begin_op+0x18>
sleep(&log, &log.lock);
} else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){
80102bc5: a1 dc 26 11 80 mov 0x801126dc,%eax
80102bca: 8b 15 e8 26 11 80 mov 0x801126e8,%edx
80102bd0: 83 c0 01 add $0x1,%eax
80102bd3: 8d 0c 80 lea (%eax,%eax,4),%ecx
80102bd6: 8d 14 4a lea (%edx,%ecx,2),%edx
80102bd9: 83 fa 1e cmp $0x1e,%edx
80102bdc: 7f ca jg 80102ba8 <begin_op+0x18>
// this op might exhaust log space; wait for commit.
sleep(&log, &log.lock);
} else {
log.outstanding += 1;
release(&log.lock);
80102bde: c7 04 24 a0 26 11 80 movl $0x801126a0,(%esp)
sleep(&log, &log.lock);
} else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){
// this op might exhaust log space; wait for commit.
sleep(&log, &log.lock);
} else {
log.outstanding += 1;
80102be5: a3 dc 26 11 80 mov %eax,0x801126dc
release(&log.lock);
80102bea: e8 e1 18 00 00 call 801044d0 <release>
break;
}
}
}
80102bef: c9 leave
80102bf0: c3 ret
80102bf1: eb 0d jmp 80102c00 <end_op>
80102bf3: 90 nop
80102bf4: 90 nop
80102bf5: 90 nop
80102bf6: 90 nop
80102bf7: 90 nop
80102bf8: 90 nop
80102bf9: 90 nop
80102bfa: 90 nop
80102bfb: 90 nop
80102bfc: 90 nop
80102bfd: 90 nop
80102bfe: 90 nop
80102bff: 90 nop
80102c00 <end_op>:
// called at the end of each FS system call.
// commits if this was the last outstanding operation.
void
end_op(void)
{
80102c00: 55 push %ebp
80102c01: 89 e5 mov %esp,%ebp
80102c03: 57 push %edi
80102c04: 56 push %esi
80102c05: 53 push %ebx
80102c06: 83 ec 1c sub $0x1c,%esp
int do_commit = 0;
acquire(&log.lock);
80102c09: c7 04 24 a0 26 11 80 movl $0x801126a0,(%esp)
80102c10: e8 8b 17 00 00 call 801043a0 <acquire>
log.outstanding -= 1;
80102c15: a1 dc 26 11 80 mov 0x801126dc,%eax
if(log.committing)
80102c1a: 8b 15 e0 26 11 80 mov 0x801126e0,%edx
end_op(void)
{
int do_commit = 0;
acquire(&log.lock);
log.outstanding -= 1;
80102c20: 83 e8 01 sub $0x1,%eax
if(log.committing)
80102c23: 85 d2 test %edx,%edx
end_op(void)
{
int do_commit = 0;
acquire(&log.lock);
log.outstanding -= 1;
80102c25: a3 dc 26 11 80 mov %eax,0x801126dc
if(log.committing)
80102c2a: 0f 85 f3 00 00 00 jne 80102d23 <end_op+0x123>
panic("log.committing");
if(log.outstanding == 0){
80102c30: 85 c0 test %eax,%eax
80102c32: 0f 85 cb 00 00 00 jne 80102d03 <end_op+0x103>
log.committing = 1;
} else {
// begin_op() may be waiting for log space.
wakeup(&log);
}
release(&log.lock);
80102c38: c7 04 24 a0 26 11 80 movl $0x801126a0,(%esp)
}
static void
commit()
{
if (log.lh.n > 0) {
80102c3f: 31 db xor %ebx,%ebx
log.outstanding -= 1;
if(log.committing)
panic("log.committing");
if(log.outstanding == 0){
do_commit = 1;
log.committing = 1;
80102c41: c7 05 e0 26 11 80 01 movl $0x1,0x801126e0
80102c48: 00 00 00
} else {
// begin_op() may be waiting for log space.
wakeup(&log);
}
release(&log.lock);
80102c4b: e8 80 18 00 00 call 801044d0 <release>
}
static void
commit()
{
if (log.lh.n > 0) {
80102c50: a1 e8 26 11 80 mov 0x801126e8,%eax
80102c55: 85 c0 test %eax,%eax
80102c57: 0f 8e 90 00 00 00 jle 80102ced <end_op+0xed>
80102c5d: 8d 76 00 lea 0x0(%esi),%esi
write_log(void)
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
struct buf *to = bread(log.dev, log.start+tail+1); // log block
80102c60: a1 d4 26 11 80 mov 0x801126d4,%eax
80102c65: 01 d8 add %ebx,%eax
80102c67: 83 c0 01 add $0x1,%eax
80102c6a: 89 44 24 04 mov %eax,0x4(%esp)
80102c6e: a1 e4 26 11 80 mov 0x801126e4,%eax
80102c73: 89 04 24 mov %eax,(%esp)
80102c76: e8 55 d4 ff ff call 801000d0 <bread>
80102c7b: 89 c6 mov %eax,%esi
struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block
80102c7d: 8b 04 9d ec 26 11 80 mov -0x7feed914(,%ebx,4),%eax
static void
write_log(void)
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
80102c84: 83 c3 01 add $0x1,%ebx
struct buf *to = bread(log.dev, log.start+tail+1); // log block
struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block
80102c87: 89 44 24 04 mov %eax,0x4(%esp)
80102c8b: a1 e4 26 11 80 mov 0x801126e4,%eax
80102c90: 89 04 24 mov %eax,(%esp)
80102c93: e8 38 d4 ff ff call 801000d0 <bread>
memmove(to->data, from->data, BSIZE);
80102c98: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
80102c9f: 00
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
struct buf *to = bread(log.dev, log.start+tail+1); // log block
struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block
80102ca0: 89 c7 mov %eax,%edi
memmove(to->data, from->data, BSIZE);
80102ca2: 8d 40 5c lea 0x5c(%eax),%eax
80102ca5: 89 44 24 04 mov %eax,0x4(%esp)
80102ca9: 8d 46 5c lea 0x5c(%esi),%eax
80102cac: 89 04 24 mov %eax,(%esp)
80102caf: e8 1c 19 00 00 call 801045d0 <memmove>
bwrite(to); // write the log
80102cb4: 89 34 24 mov %esi,(%esp)
80102cb7: e8 e4 d4 ff ff call 801001a0 <bwrite>
brelse(from);
80102cbc: 89 3c 24 mov %edi,(%esp)
80102cbf: e8 1c d5 ff ff call 801001e0 <brelse>
brelse(to);
80102cc4: 89 34 24 mov %esi,(%esp)
80102cc7: e8 14 d5 ff ff call 801001e0 <brelse>
static void
write_log(void)
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
80102ccc: 3b 1d e8 26 11 80 cmp 0x801126e8,%ebx
80102cd2: 7c 8c jl 80102c60 <end_op+0x60>
static void
commit()
{
if (log.lh.n > 0) {
write_log(); // Write modified blocks from cache to log
write_head(); // Write header to disk -- the real commit
80102cd4: e8 a7 fd ff ff call 80102a80 <write_head>
install_trans(); // Now install writes to home locations
80102cd9: e8 02 fd ff ff call 801029e0 <install_trans>
log.lh.n = 0;
80102cde: c7 05 e8 26 11 80 00 movl $0x0,0x801126e8
80102ce5: 00 00 00
write_head(); // Erase the transaction from the log
80102ce8: e8 93 fd ff ff call 80102a80 <write_head>
if(do_commit){
// call commit w/o holding locks, since not allowed
// to sleep with locks.
commit();
acquire(&log.lock);
80102ced: c7 04 24 a0 26 11 80 movl $0x801126a0,(%esp)
80102cf4: e8 a7 16 00 00 call 801043a0 <acquire>
log.committing = 0;
80102cf9: c7 05 e0 26 11 80 00 movl $0x0,0x801126e0
80102d00: 00 00 00
wakeup(&log);
80102d03: c7 04 24 a0 26 11 80 movl $0x801126a0,(%esp)
80102d0a: e8 41 13 00 00 call 80104050 <wakeup>
release(&log.lock);
80102d0f: c7 04 24 a0 26 11 80 movl $0x801126a0,(%esp)
80102d16: e8 b5 17 00 00 call 801044d0 <release>
}
}
80102d1b: 83 c4 1c add $0x1c,%esp
80102d1e: 5b pop %ebx
80102d1f: 5e pop %esi
80102d20: 5f pop %edi
80102d21: 5d pop %ebp
80102d22: c3 ret
int do_commit = 0;
acquire(&log.lock);
log.outstanding -= 1;
if(log.committing)
panic("log.committing");
80102d23: c7 04 24 60 74 10 80 movl $0x80107460,(%esp)
80102d2a: e8 31 d6 ff ff call 80100360 <panic>
80102d2f: 90 nop
80102d30 <log_write>:
// modify bp->data[]
// log_write(bp)
// brelse(bp)
void
log_write(struct buf *b)
{
80102d30: 55 push %ebp
80102d31: 89 e5 mov %esp,%ebp
80102d33: 53 push %ebx
80102d34: 83 ec 14 sub $0x14,%esp
int i;
if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1)
80102d37: a1 e8 26 11 80 mov 0x801126e8,%eax
// modify bp->data[]
// log_write(bp)
// brelse(bp)
void
log_write(struct buf *b)
{
80102d3c: 8b 5d 08 mov 0x8(%ebp),%ebx
int i;
if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1)
80102d3f: 83 f8 1d cmp $0x1d,%eax
80102d42: 0f 8f 98 00 00 00 jg 80102de0 <log_write+0xb0>
80102d48: 8b 0d d8 26 11 80 mov 0x801126d8,%ecx
80102d4e: 8d 51 ff lea -0x1(%ecx),%edx
80102d51: 39 d0 cmp %edx,%eax
80102d53: 0f 8d 87 00 00 00 jge 80102de0 <log_write+0xb0>
panic("too big a transaction");
if (log.outstanding < 1)
80102d59: a1 dc 26 11 80 mov 0x801126dc,%eax
80102d5e: 85 c0 test %eax,%eax
80102d60: 0f 8e 86 00 00 00 jle 80102dec <log_write+0xbc>
panic("log_write outside of trans");
acquire(&log.lock);
80102d66: c7 04 24 a0 26 11 80 movl $0x801126a0,(%esp)
80102d6d: e8 2e 16 00 00 call 801043a0 <acquire>
for (i = 0; i < log.lh.n; i++) {
80102d72: 8b 15 e8 26 11 80 mov 0x801126e8,%edx
80102d78: 83 fa 00 cmp $0x0,%edx
80102d7b: 7e 54 jle 80102dd1 <log_write+0xa1>
if (log.lh.block[i] == b->blockno) // log absorbtion
80102d7d: 8b 4b 08 mov 0x8(%ebx),%ecx
panic("too big a transaction");
if (log.outstanding < 1)
panic("log_write outside of trans");
acquire(&log.lock);
for (i = 0; i < log.lh.n; i++) {
80102d80: 31 c0 xor %eax,%eax
if (log.lh.block[i] == b->blockno) // log absorbtion
80102d82: 39 0d ec 26 11 80 cmp %ecx,0x801126ec
80102d88: 75 0f jne 80102d99 <log_write+0x69>
80102d8a: eb 3c jmp 80102dc8 <log_write+0x98>
80102d8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80102d90: 39 0c 85 ec 26 11 80 cmp %ecx,-0x7feed914(,%eax,4)
80102d97: 74 2f je 80102dc8 <log_write+0x98>
panic("too big a transaction");
if (log.outstanding < 1)
panic("log_write outside of trans");
acquire(&log.lock);
for (i = 0; i < log.lh.n; i++) {
80102d99: 83 c0 01 add $0x1,%eax
80102d9c: 39 d0 cmp %edx,%eax
80102d9e: 75 f0 jne 80102d90 <log_write+0x60>
if (log.lh.block[i] == b->blockno) // log absorbtion
break;
}
log.lh.block[i] = b->blockno;
80102da0: 89 0c 95 ec 26 11 80 mov %ecx,-0x7feed914(,%edx,4)
if (i == log.lh.n)
log.lh.n++;
80102da7: 83 c2 01 add $0x1,%edx
80102daa: 89 15 e8 26 11 80 mov %edx,0x801126e8
b->flags |= B_DIRTY; // prevent eviction
80102db0: 83 0b 04 orl $0x4,(%ebx)
release(&log.lock);
80102db3: c7 45 08 a0 26 11 80 movl $0x801126a0,0x8(%ebp)
}
80102dba: 83 c4 14 add $0x14,%esp
80102dbd: 5b pop %ebx
80102dbe: 5d pop %ebp
}
log.lh.block[i] = b->blockno;
if (i == log.lh.n)
log.lh.n++;
b->flags |= B_DIRTY; // prevent eviction
release(&log.lock);
80102dbf: e9 0c 17 00 00 jmp 801044d0 <release>
80102dc4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
acquire(&log.lock);
for (i = 0; i < log.lh.n; i++) {
if (log.lh.block[i] == b->blockno) // log absorbtion
break;
}
log.lh.block[i] = b->blockno;
80102dc8: 89 0c 85 ec 26 11 80 mov %ecx,-0x7feed914(,%eax,4)
80102dcf: eb df jmp 80102db0 <log_write+0x80>
80102dd1: 8b 43 08 mov 0x8(%ebx),%eax
80102dd4: a3 ec 26 11 80 mov %eax,0x801126ec
if (i == log.lh.n)
80102dd9: 75 d5 jne 80102db0 <log_write+0x80>
80102ddb: eb ca jmp 80102da7 <log_write+0x77>
80102ddd: 8d 76 00 lea 0x0(%esi),%esi
log_write(struct buf *b)
{
int i;
if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1)
panic("too big a transaction");
80102de0: c7 04 24 6f 74 10 80 movl $0x8010746f,(%esp)
80102de7: e8 74 d5 ff ff call 80100360 <panic>
if (log.outstanding < 1)
panic("log_write outside of trans");
80102dec: c7 04 24 85 74 10 80 movl $0x80107485,(%esp)
80102df3: e8 68 d5 ff ff call 80100360 <panic>
80102df8: 66 90 xchg %ax,%ax
80102dfa: 66 90 xchg %ax,%ax
80102dfc: 66 90 xchg %ax,%ax
80102dfe: 66 90 xchg %ax,%ax
80102e00 <mpmain>:
}
// Common CPU setup code.
static void
mpmain(void)
{
80102e00: 55 push %ebp
80102e01: 89 e5 mov %esp,%ebp
80102e03: 83 ec 18 sub $0x18,%esp
cprintf("cpu%d: starting\n", cpunum());
80102e06: e8 55 f9 ff ff call 80102760 <cpunum>
80102e0b: c7 04 24 a0 74 10 80 movl $0x801074a0,(%esp)
80102e12: 89 44 24 04 mov %eax,0x4(%esp)
80102e16: e8 35 d8 ff ff call 80100650 <cprintf>
idtinit(); // load idt register
80102e1b: e8 e0 29 00 00 call 80105800 <idtinit>
xchg(&cpu->started, 1); // tell startothers() we're up
80102e20: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
xchg(volatile uint *addr, uint newval)
{
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
80102e27: b8 01 00 00 00 mov $0x1,%eax
80102e2c: f0 87 82 a8 00 00 00 lock xchg %eax,0xa8(%edx)
scheduler(); // start running processes
80102e33: e8 48 0d 00 00 call 80103b80 <scheduler>
80102e38: 90 nop
80102e39: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80102e40 <mpenter>:
}
// Other CPUs jump here from entryother.S.
static void
mpenter(void)
{
80102e40: 55 push %ebp
80102e41: 89 e5 mov %esp,%ebp
80102e43: 83 ec 08 sub $0x8,%esp
switchkvm();
80102e46: e8 a5 3b 00 00 call 801069f0 <switchkvm>
seginit();
80102e4b: e8 c0 39 00 00 call 80106810 <seginit>
lapicinit();
80102e50: e8 1b f8 ff ff call 80102670 <lapicinit>
mpmain();
80102e55: e8 a6 ff ff ff call 80102e00 <mpmain>
80102e5a: 66 90 xchg %ax,%ax
80102e5c: 66 90 xchg %ax,%ax
80102e5e: 66 90 xchg %ax,%ax
80102e60 <main>:
// Bootstrap processor starts running C code here.
// Allocate a real stack and switch to it, first
// doing some setup required for memory allocator to work.
int
main(void)
{
80102e60: 55 push %ebp
80102e61: 89 e5 mov %esp,%ebp
80102e63: 53 push %ebx
80102e64: 83 e4 f0 and $0xfffffff0,%esp
80102e67: 83 ec 10 sub $0x10,%esp
kinit1(end, P2V(4*1024*1024)); // phys page allocator
80102e6a: c7 44 24 04 00 00 40 movl $0x80400000,0x4(%esp)
80102e71: 80
80102e72: c7 04 24 28 5d 11 80 movl $0x80115d28,(%esp)
80102e79: e8 62 f5 ff ff call 801023e0 <kinit1>
kvmalloc(); // kernel page table
80102e7e: e8 4d 3b 00 00 call 801069d0 <kvmalloc>
mpinit(); // detect other processors
80102e83: e8 a8 01 00 00 call 80103030 <mpinit>
lapicinit(); // interrupt controller
80102e88: e8 e3 f7 ff ff call 80102670 <lapicinit>
80102e8d: 8d 76 00 lea 0x0(%esi),%esi
seginit(); // segment descriptors
80102e90: e8 7b 39 00 00 call 80106810 <seginit>
cprintf("\ncpu%d: starting xv6\n\n", cpunum());
80102e95: e8 c6 f8 ff ff call 80102760 <cpunum>
80102e9a: c7 04 24 b1 74 10 80 movl $0x801074b1,(%esp)
80102ea1: 89 44 24 04 mov %eax,0x4(%esp)
80102ea5: e8 a6 d7 ff ff call 80100650 <cprintf>
picinit(); // another interrupt controller
80102eaa: e8 81 03 00 00 call 80103230 <picinit>
ioapicinit(); // another interrupt controller
80102eaf: e8 4c f3 ff ff call 80102200 <ioapicinit>
consoleinit(); // console hardware
80102eb4: e8 97 da ff ff call 80100950 <consoleinit>
uartinit(); // serial port
80102eb9: e8 62 2c 00 00 call 80105b20 <uartinit>
80102ebe: 66 90 xchg %ax,%ax
pinit(); // process table
80102ec0: e8 db 08 00 00 call 801037a0 <pinit>
tvinit(); // trap vectors
80102ec5: e8 96 28 00 00 call 80105760 <tvinit>
binit(); // buffer cache
80102eca: e8 71 d1 ff ff call 80100040 <binit>
80102ecf: 90 nop
fileinit(); // file table
80102ed0: e8 7b de ff ff call 80100d50 <fileinit>
ideinit(); // disk
80102ed5: e8 16 f1 ff ff call 80101ff0 <ideinit>
if(!ismp)
80102eda: a1 84 27 11 80 mov 0x80112784,%eax
80102edf: 85 c0 test %eax,%eax
80102ee1: 0f 84 ca 00 00 00 je 80102fb1 <main+0x151>
// Write entry code to unused memory at 0x7000.
// The linker has placed the image of entryother.S in
// _binary_entryother_start.
code = P2V(0x7000);
memmove(code, _binary_entryother_start, (uint)_binary_entryother_size);
80102ee7: c7 44 24 08 8a 00 00 movl $0x8a,0x8(%esp)
80102eee: 00
for(c = cpus; c < cpus+ncpu; c++){
80102eef: bb a0 27 11 80 mov $0x801127a0,%ebx
// Write entry code to unused memory at 0x7000.
// The linker has placed the image of entryother.S in
// _binary_entryother_start.
code = P2V(0x7000);
memmove(code, _binary_entryother_start, (uint)_binary_entryother_size);
80102ef4: c7 44 24 04 8c a4 10 movl $0x8010a48c,0x4(%esp)
80102efb: 80
80102efc: c7 04 24 00 70 00 80 movl $0x80007000,(%esp)
80102f03: e8 c8 16 00 00 call 801045d0 <memmove>
for(c = cpus; c < cpus+ncpu; c++){
80102f08: 69 05 80 2d 11 80 bc imul $0xbc,0x80112d80,%eax
80102f0f: 00 00 00
80102f12: 05 a0 27 11 80 add $0x801127a0,%eax
80102f17: 39 d8 cmp %ebx,%eax
80102f19: 76 78 jbe 80102f93 <main+0x133>
80102f1b: 90 nop
80102f1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(c == cpus+cpunum()) // We've started already.
80102f20: e8 3b f8 ff ff call 80102760 <cpunum>
80102f25: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax
80102f2b: 05 a0 27 11 80 add $0x801127a0,%eax
80102f30: 39 c3 cmp %eax,%ebx
80102f32: 74 46 je 80102f7a <main+0x11a>
continue;
// Tell entryother.S what stack to use, where to enter, and what
// pgdir to use. We cannot use kpgdir yet, because the AP processor
// is running in low memory, so we use entrypgdir for the APs too.
stack = kalloc();
80102f34: e8 67 f5 ff ff call 801024a0 <kalloc>
*(void**)(code-4) = stack + KSTACKSIZE;
*(void**)(code-8) = mpenter;
80102f39: c7 05 f8 6f 00 80 40 movl $0x80102e40,0x80006ff8
80102f40: 2e 10 80
*(int**)(code-12) = (void *) V2P(entrypgdir);
80102f43: c7 05 f4 6f 00 80 00 movl $0x109000,0x80006ff4
80102f4a: 90 10 00
// Tell entryother.S what stack to use, where to enter, and what
// pgdir to use. We cannot use kpgdir yet, because the AP processor
// is running in low memory, so we use entrypgdir for the APs too.
stack = kalloc();
*(void**)(code-4) = stack + KSTACKSIZE;
80102f4d: 05 00 10 00 00 add $0x1000,%eax
80102f52: a3 fc 6f 00 80 mov %eax,0x80006ffc
*(void**)(code-8) = mpenter;
*(int**)(code-12) = (void *) V2P(entrypgdir);
lapicstartap(c->apicid, V2P(code));
80102f57: 0f b6 03 movzbl (%ebx),%eax
80102f5a: c7 44 24 04 00 70 00 movl $0x7000,0x4(%esp)
80102f61: 00
80102f62: 89 04 24 mov %eax,(%esp)
80102f65: e8 c6 f8 ff ff call 80102830 <lapicstartap>
80102f6a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
// wait for cpu to finish mpmain()
while(c->started == 0)
80102f70: 8b 83 a8 00 00 00 mov 0xa8(%ebx),%eax
80102f76: 85 c0 test %eax,%eax
80102f78: 74 f6 je 80102f70 <main+0x110>
// The linker has placed the image of entryother.S in
// _binary_entryother_start.
code = P2V(0x7000);
memmove(code, _binary_entryother_start, (uint)_binary_entryother_size);
for(c = cpus; c < cpus+ncpu; c++){
80102f7a: 69 05 80 2d 11 80 bc imul $0xbc,0x80112d80,%eax
80102f81: 00 00 00
80102f84: 81 c3 bc 00 00 00 add $0xbc,%ebx
80102f8a: 05 a0 27 11 80 add $0x801127a0,%eax
80102f8f: 39 c3 cmp %eax,%ebx
80102f91: 72 8d jb 80102f20 <main+0xc0>
fileinit(); // file table
ideinit(); // disk
if(!ismp)
timerinit(); // uniprocessor timer
startothers(); // start other processors
kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers()
80102f93: c7 44 24 04 00 00 00 movl $0x8e000000,0x4(%esp)
80102f9a: 8e
80102f9b: c7 04 24 00 00 40 80 movl $0x80400000,(%esp)
80102fa2: e8 a9 f4 ff ff call 80102450 <kinit2>
userinit(); // first user process
80102fa7: e8 14 08 00 00 call 801037c0 <userinit>
mpmain(); // finish this processor's setup
80102fac: e8 4f fe ff ff call 80102e00 <mpmain>
tvinit(); // trap vectors
binit(); // buffer cache
fileinit(); // file table
ideinit(); // disk
if(!ismp)
timerinit(); // uniprocessor timer
80102fb1: e8 4a 27 00 00 call 80105700 <timerinit>
80102fb6: e9 2c ff ff ff jmp 80102ee7 <main+0x87>
80102fbb: 66 90 xchg %ax,%ax
80102fbd: 66 90 xchg %ax,%ax
80102fbf: 90 nop
80102fc0 <mpsearch1>:
}
// Look for an MP structure in the len bytes at addr.
static struct mp*
mpsearch1(uint a, int len)
{
80102fc0: 55 push %ebp
80102fc1: 89 e5 mov %esp,%ebp
80102fc3: 56 push %esi
uchar *e, *p, *addr;
addr = P2V(a);
80102fc4: 8d b0 00 00 00 80 lea -0x80000000(%eax),%esi
}
// Look for an MP structure in the len bytes at addr.
static struct mp*
mpsearch1(uint a, int len)
{
80102fca: 53 push %ebx
uchar *e, *p, *addr;
addr = P2V(a);
e = addr+len;
80102fcb: 8d 1c 16 lea (%esi,%edx,1),%ebx
}
// Look for an MP structure in the len bytes at addr.
static struct mp*
mpsearch1(uint a, int len)
{
80102fce: 83 ec 10 sub $0x10,%esp
uchar *e, *p, *addr;
addr = P2V(a);
e = addr+len;
for(p = addr; p < e; p += sizeof(struct mp))
80102fd1: 39 de cmp %ebx,%esi
80102fd3: 73 3c jae 80103011 <mpsearch1+0x51>
80102fd5: 8d 76 00 lea 0x0(%esi),%esi
if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
80102fd8: c7 44 24 08 04 00 00 movl $0x4,0x8(%esp)
80102fdf: 00
80102fe0: c7 44 24 04 c8 74 10 movl $0x801074c8,0x4(%esp)
80102fe7: 80
80102fe8: 89 34 24 mov %esi,(%esp)
80102feb: e8 80 15 00 00 call 80104570 <memcmp>
80102ff0: 85 c0 test %eax,%eax
80102ff2: 75 16 jne 8010300a <mpsearch1+0x4a>
80102ff4: 31 c9 xor %ecx,%ecx
80102ff6: 31 d2 xor %edx,%edx
{
int i, sum;
sum = 0;
for(i=0; i<len; i++)
sum += addr[i];
80102ff8: 0f b6 04 16 movzbl (%esi,%edx,1),%eax
sum(uchar *addr, int len)
{
int i, sum;
sum = 0;
for(i=0; i<len; i++)
80102ffc: 83 c2 01 add $0x1,%edx
sum += addr[i];
80102fff: 01 c1 add %eax,%ecx
sum(uchar *addr, int len)
{
int i, sum;
sum = 0;
for(i=0; i<len; i++)
80103001: 83 fa 10 cmp $0x10,%edx
80103004: 75 f2 jne 80102ff8 <mpsearch1+0x38>
uchar *e, *p, *addr;
addr = P2V(a);
e = addr+len;
for(p = addr; p < e; p += sizeof(struct mp))
if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
80103006: 84 c9 test %cl,%cl
80103008: 74 10 je 8010301a <mpsearch1+0x5a>
{
uchar *e, *p, *addr;
addr = P2V(a);
e = addr+len;
for(p = addr; p < e; p += sizeof(struct mp))
8010300a: 83 c6 10 add $0x10,%esi
8010300d: 39 f3 cmp %esi,%ebx
8010300f: 77 c7 ja 80102fd8 <mpsearch1+0x18>
if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
return (struct mp*)p;
return 0;
}
80103011: 83 c4 10 add $0x10,%esp
addr = P2V(a);
e = addr+len;
for(p = addr; p < e; p += sizeof(struct mp))
if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
return (struct mp*)p;
return 0;
80103014: 31 c0 xor %eax,%eax
}
80103016: 5b pop %ebx
80103017: 5e pop %esi
80103018: 5d pop %ebp
80103019: c3 ret
8010301a: 83 c4 10 add $0x10,%esp
8010301d: 89 f0 mov %esi,%eax
8010301f: 5b pop %ebx
80103020: 5e pop %esi
80103021: 5d pop %ebp
80103022: c3 ret
80103023: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80103029: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80103030 <mpinit>:
return conf;
}
void
mpinit(void)
{
80103030: 55 push %ebp
80103031: 89 e5 mov %esp,%ebp
80103033: 57 push %edi
80103034: 56 push %esi
80103035: 53 push %ebx
80103036: 83 ec 1c sub $0x1c,%esp
uchar *bda;
uint p;
struct mp *mp;
bda = (uchar *) P2V(0x400);
if((p = ((bda[0x0F]<<8)| bda[0x0E]) << 4)){
80103039: 0f b6 05 0f 04 00 80 movzbl 0x8000040f,%eax
80103040: 0f b6 15 0e 04 00 80 movzbl 0x8000040e,%edx
80103047: c1 e0 08 shl $0x8,%eax
8010304a: 09 d0 or %edx,%eax
8010304c: c1 e0 04 shl $0x4,%eax
8010304f: 85 c0 test %eax,%eax
80103051: 75 1b jne 8010306e <mpinit+0x3e>
if((mp = mpsearch1(p, 1024)))
return mp;
} else {
p = ((bda[0x14]<<8)|bda[0x13])*1024;
80103053: 0f b6 05 14 04 00 80 movzbl 0x80000414,%eax
8010305a: 0f b6 15 13 04 00 80 movzbl 0x80000413,%edx
80103061: c1 e0 08 shl $0x8,%eax
80103064: 09 d0 or %edx,%eax
80103066: c1 e0 0a shl $0xa,%eax
if((mp = mpsearch1(p-1024, 1024)))
80103069: 2d 00 04 00 00 sub $0x400,%eax
uint p;
struct mp *mp;
bda = (uchar *) P2V(0x400);
if((p = ((bda[0x0F]<<8)| bda[0x0E]) << 4)){
if((mp = mpsearch1(p, 1024)))
8010306e: ba 00 04 00 00 mov $0x400,%edx
80103073: e8 48 ff ff ff call 80102fc0 <mpsearch1>
80103078: 85 c0 test %eax,%eax
8010307a: 89 c7 mov %eax,%edi
8010307c: 0f 84 4e 01 00 00 je 801031d0 <mpinit+0x1a0>
mpconfig(struct mp **pmp)
{
struct mpconf *conf;
struct mp *mp;
if((mp = mpsearch()) == 0 || mp->physaddr == 0)
80103082: 8b 77 04 mov 0x4(%edi),%esi
80103085: 85 f6 test %esi,%esi
80103087: 0f 84 ce 00 00 00 je 8010315b <mpinit+0x12b>
return 0;
conf = (struct mpconf*) P2V((uint) mp->physaddr);
8010308d: 8d 86 00 00 00 80 lea -0x80000000(%esi),%eax
if(memcmp(conf, "PCMP", 4) != 0)
80103093: c7 44 24 08 04 00 00 movl $0x4,0x8(%esp)
8010309a: 00
8010309b: c7 44 24 04 cd 74 10 movl $0x801074cd,0x4(%esp)
801030a2: 80
801030a3: 89 04 24 mov %eax,(%esp)
struct mpconf *conf;
struct mp *mp;
if((mp = mpsearch()) == 0 || mp->physaddr == 0)
return 0;
conf = (struct mpconf*) P2V((uint) mp->physaddr);
801030a6: 89 45 e4 mov %eax,-0x1c(%ebp)
if(memcmp(conf, "PCMP", 4) != 0)
801030a9: e8 c2 14 00 00 call 80104570 <memcmp>
801030ae: 85 c0 test %eax,%eax
801030b0: 0f 85 a5 00 00 00 jne 8010315b <mpinit+0x12b>
return 0;
if(conf->version != 1 && conf->version != 4)
801030b6: 0f b6 86 06 00 00 80 movzbl -0x7ffffffa(%esi),%eax
801030bd: 3c 04 cmp $0x4,%al
801030bf: 0f 85 29 01 00 00 jne 801031ee <mpinit+0x1be>
return 0;
if(sum((uchar*)conf, conf->length) != 0)
801030c5: 0f b7 86 04 00 00 80 movzwl -0x7ffffffc(%esi),%eax
sum(uchar *addr, int len)
{
int i, sum;
sum = 0;
for(i=0; i<len; i++)
801030cc: 85 c0 test %eax,%eax
801030ce: 74 1d je 801030ed <mpinit+0xbd>
static uchar
sum(uchar *addr, int len)
{
int i, sum;
sum = 0;
801030d0: 31 c9 xor %ecx,%ecx
for(i=0; i<len; i++)
801030d2: 31 d2 xor %edx,%edx
801030d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
sum += addr[i];
801030d8: 0f b6 9c 16 00 00 00 movzbl -0x80000000(%esi,%edx,1),%ebx
801030df: 80
sum(uchar *addr, int len)
{
int i, sum;
sum = 0;
for(i=0; i<len; i++)
801030e0: 83 c2 01 add $0x1,%edx
sum += addr[i];
801030e3: 01 d9 add %ebx,%ecx
sum(uchar *addr, int len)
{
int i, sum;
sum = 0;
for(i=0; i<len; i++)
801030e5: 39 d0 cmp %edx,%eax
801030e7: 7f ef jg 801030d8 <mpinit+0xa8>
conf = (struct mpconf*) P2V((uint) mp->physaddr);
if(memcmp(conf, "PCMP", 4) != 0)
return 0;
if(conf->version != 1 && conf->version != 4)
return 0;
if(sum((uchar*)conf, conf->length) != 0)
801030e9: 84 c9 test %cl,%cl
801030eb: 75 6e jne 8010315b <mpinit+0x12b>
struct mp *mp;
struct mpconf *conf;
struct mpproc *proc;
struct mpioapic *ioapic;
if((conf = mpconfig(&mp)) == 0)
801030ed: 8b 5d e4 mov -0x1c(%ebp),%ebx
801030f0: 85 db test %ebx,%ebx
801030f2: 74 67 je 8010315b <mpinit+0x12b>
return;
ismp = 1;
801030f4: c7 05 84 27 11 80 01 movl $0x1,0x80112784
801030fb: 00 00 00
lapic = (uint*)conf->lapicaddr;
801030fe: 8b 86 24 00 00 80 mov -0x7fffffdc(%esi),%eax
80103104: a3 9c 26 11 80 mov %eax,0x8011269c
for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
80103109: 0f b7 8e 04 00 00 80 movzwl -0x7ffffffc(%esi),%ecx
80103110: 8d 86 2c 00 00 80 lea -0x7fffffd4(%esi),%eax
80103116: 01 d9 add %ebx,%ecx
80103118: 39 c8 cmp %ecx,%eax
8010311a: 0f 83 90 00 00 00 jae 801031b0 <mpinit+0x180>
switch(*p){
80103120: 80 38 04 cmpb $0x4,(%eax)
80103123: 77 7b ja 801031a0 <mpinit+0x170>
80103125: 0f b6 10 movzbl (%eax),%edx
80103128: ff 24 95 d4 74 10 80 jmp *-0x7fef8b2c(,%edx,4)
8010312f: 90 nop
p += sizeof(struct mpioapic);
continue;
case MPBUS:
case MPIOINTR:
case MPLINTR:
p += 8;
80103130: 83 c0 08 add $0x8,%eax
if((conf = mpconfig(&mp)) == 0)
return;
ismp = 1;
lapic = (uint*)conf->lapicaddr;
for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
80103133: 39 c1 cmp %eax,%ecx
80103135: 77 e9 ja 80103120 <mpinit+0xf0>
default:
ismp = 0;
break;
}
}
if(!ismp){
80103137: a1 84 27 11 80 mov 0x80112784,%eax
8010313c: 85 c0 test %eax,%eax
8010313e: 75 70 jne 801031b0 <mpinit+0x180>
// Didn't like what we found; fall back to no MP.
ncpu = 1;
80103140: c7 05 80 2d 11 80 01 movl $0x1,0x80112d80
80103147: 00 00 00
lapic = 0;
8010314a: c7 05 9c 26 11 80 00 movl $0x0,0x8011269c
80103151: 00 00 00
ioapicid = 0;
80103154: c6 05 80 27 11 80 00 movb $0x0,0x80112780
// Bochs doesn't support IMCR, so this doesn't run on Bochs.
// But it would on real hardware.
outb(0x22, 0x70); // Select IMCR
outb(0x23, inb(0x23) | 1); // Mask external interrupts.
}
}
8010315b: 83 c4 1c add $0x1c,%esp
8010315e: 5b pop %ebx
8010315f: 5e pop %esi
80103160: 5f pop %edi
80103161: 5d pop %ebp
80103162: c3 ret
80103163: 90 nop
80103164: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
lapic = (uint*)conf->lapicaddr;
for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
switch(*p){
case MPPROC:
proc = (struct mpproc*)p;
if(ncpu < NCPU) {
80103168: 8b 15 80 2d 11 80 mov 0x80112d80,%edx
8010316e: 83 fa 07 cmp $0x7,%edx
80103171: 7f 17 jg 8010318a <mpinit+0x15a>
cpus[ncpu].apicid = proc->apicid; // apicid may differ from ncpu
80103173: 0f b6 58 01 movzbl 0x1(%eax),%ebx
80103177: 69 d2 bc 00 00 00 imul $0xbc,%edx,%edx
ncpu++;
8010317d: 83 05 80 2d 11 80 01 addl $0x1,0x80112d80
for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
switch(*p){
case MPPROC:
proc = (struct mpproc*)p;
if(ncpu < NCPU) {
cpus[ncpu].apicid = proc->apicid; // apicid may differ from ncpu
80103184: 88 9a a0 27 11 80 mov %bl,-0x7feed860(%edx)
ncpu++;
}
p += sizeof(struct mpproc);
8010318a: 83 c0 14 add $0x14,%eax
continue;
8010318d: eb a4 jmp 80103133 <mpinit+0x103>
8010318f: 90 nop
case MPIOAPIC:
ioapic = (struct mpioapic*)p;
ioapicid = ioapic->apicno;
80103190: 0f b6 50 01 movzbl 0x1(%eax),%edx
p += sizeof(struct mpioapic);
80103194: 83 c0 08 add $0x8,%eax
}
p += sizeof(struct mpproc);
continue;
case MPIOAPIC:
ioapic = (struct mpioapic*)p;
ioapicid = ioapic->apicno;
80103197: 88 15 80 27 11 80 mov %dl,0x80112780
p += sizeof(struct mpioapic);
continue;
8010319d: eb 94 jmp 80103133 <mpinit+0x103>
8010319f: 90 nop
case MPIOINTR:
case MPLINTR:
p += 8;
continue;
default:
ismp = 0;
801031a0: c7 05 84 27 11 80 00 movl $0x0,0x80112784
801031a7: 00 00 00
break;
801031aa: eb 87 jmp 80103133 <mpinit+0x103>
801031ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
lapic = 0;
ioapicid = 0;
return;
}
if(mp->imcrp){
801031b0: 80 7f 0c 00 cmpb $0x0,0xc(%edi)
801031b4: 74 a5 je 8010315b <mpinit+0x12b>
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801031b6: ba 22 00 00 00 mov $0x22,%edx
801031bb: b8 70 00 00 00 mov $0x70,%eax
801031c0: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801031c1: b2 23 mov $0x23,%dl
801031c3: ec in (%dx),%al
// Bochs doesn't support IMCR, so this doesn't run on Bochs.
// But it would on real hardware.
outb(0x22, 0x70); // Select IMCR
outb(0x23, inb(0x23) | 1); // Mask external interrupts.
801031c4: 83 c8 01 or $0x1,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801031c7: ee out %al,(%dx)
}
}
801031c8: 83 c4 1c add $0x1c,%esp
801031cb: 5b pop %ebx
801031cc: 5e pop %esi
801031cd: 5f pop %edi
801031ce: 5d pop %ebp
801031cf: c3 ret
} else {
p = ((bda[0x14]<<8)|bda[0x13])*1024;
if((mp = mpsearch1(p-1024, 1024)))
return mp;
}
return mpsearch1(0xF0000, 0x10000);
801031d0: ba 00 00 01 00 mov $0x10000,%edx
801031d5: b8 00 00 0f 00 mov $0xf0000,%eax
801031da: e8 e1 fd ff ff call 80102fc0 <mpsearch1>
mpconfig(struct mp **pmp)
{
struct mpconf *conf;
struct mp *mp;
if((mp = mpsearch()) == 0 || mp->physaddr == 0)
801031df: 85 c0 test %eax,%eax
} else {
p = ((bda[0x14]<<8)|bda[0x13])*1024;
if((mp = mpsearch1(p-1024, 1024)))
return mp;
}
return mpsearch1(0xF0000, 0x10000);
801031e1: 89 c7 mov %eax,%edi
mpconfig(struct mp **pmp)
{
struct mpconf *conf;
struct mp *mp;
if((mp = mpsearch()) == 0 || mp->physaddr == 0)
801031e3: 0f 85 99 fe ff ff jne 80103082 <mpinit+0x52>
801031e9: e9 6d ff ff ff jmp 8010315b <mpinit+0x12b>
return 0;
conf = (struct mpconf*) P2V((uint) mp->physaddr);
if(memcmp(conf, "PCMP", 4) != 0)
return 0;
if(conf->version != 1 && conf->version != 4)
801031ee: 3c 01 cmp $0x1,%al
801031f0: 0f 84 cf fe ff ff je 801030c5 <mpinit+0x95>
801031f6: e9 60 ff ff ff jmp 8010315b <mpinit+0x12b>
801031fb: 66 90 xchg %ax,%ax
801031fd: 66 90 xchg %ax,%ax
801031ff: 90 nop
80103200 <picenable>:
80103200: 55 push %ebp
80103201: b8 fe ff ff ff mov $0xfffffffe,%eax
80103206: ba 21 00 00 00 mov $0x21,%edx
8010320b: 89 e5 mov %esp,%ebp
8010320d: 8b 4d 08 mov 0x8(%ebp),%ecx
80103210: d3 c0 rol %cl,%eax
80103212: 66 23 05 00 a0 10 80 and 0x8010a000,%ax
80103219: 66 a3 00 a0 10 80 mov %ax,0x8010a000
8010321f: ee out %al,(%dx)
80103220: ba a1 00 00 00 mov $0xa1,%edx
80103225: 66 c1 e8 08 shr $0x8,%ax
80103229: ee out %al,(%dx)
8010322a: 5d pop %ebp
8010322b: c3 ret
8010322c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80103230 <picinit>:
80103230: 55 push %ebp
80103231: b8 ff ff ff ff mov $0xffffffff,%eax
80103236: 89 e5 mov %esp,%ebp
80103238: 57 push %edi
80103239: 56 push %esi
8010323a: 53 push %ebx
8010323b: bb 21 00 00 00 mov $0x21,%ebx
80103240: 89 da mov %ebx,%edx
80103242: ee out %al,(%dx)
80103243: b9 a1 00 00 00 mov $0xa1,%ecx
80103248: 89 ca mov %ecx,%edx
8010324a: ee out %al,(%dx)
8010324b: bf 11 00 00 00 mov $0x11,%edi
80103250: be 20 00 00 00 mov $0x20,%esi
80103255: 89 f8 mov %edi,%eax
80103257: 89 f2 mov %esi,%edx
80103259: ee out %al,(%dx)
8010325a: b8 20 00 00 00 mov $0x20,%eax
8010325f: 89 da mov %ebx,%edx
80103261: ee out %al,(%dx)
80103262: b8 04 00 00 00 mov $0x4,%eax
80103267: ee out %al,(%dx)
80103268: b8 03 00 00 00 mov $0x3,%eax
8010326d: ee out %al,(%dx)
8010326e: bb a0 00 00 00 mov $0xa0,%ebx
80103273: 89 f8 mov %edi,%eax
80103275: 89 da mov %ebx,%edx
80103277: ee out %al,(%dx)
80103278: b8 28 00 00 00 mov $0x28,%eax
8010327d: 89 ca mov %ecx,%edx
8010327f: ee out %al,(%dx)
80103280: b8 02 00 00 00 mov $0x2,%eax
80103285: ee out %al,(%dx)
80103286: b8 03 00 00 00 mov $0x3,%eax
8010328b: ee out %al,(%dx)
8010328c: bf 68 00 00 00 mov $0x68,%edi
80103291: 89 f2 mov %esi,%edx
80103293: 89 f8 mov %edi,%eax
80103295: ee out %al,(%dx)
80103296: b9 0a 00 00 00 mov $0xa,%ecx
8010329b: 89 c8 mov %ecx,%eax
8010329d: ee out %al,(%dx)
8010329e: 89 f8 mov %edi,%eax
801032a0: 89 da mov %ebx,%edx
801032a2: ee out %al,(%dx)
801032a3: 89 c8 mov %ecx,%eax
801032a5: ee out %al,(%dx)
801032a6: 0f b7 05 00 a0 10 80 movzwl 0x8010a000,%eax
801032ad: 66 83 f8 ff cmp $0xffff,%ax
801032b1: 74 10 je 801032c3 <picinit+0x93>
801032b3: ba 21 00 00 00 mov $0x21,%edx
801032b8: ee out %al,(%dx)
801032b9: ba a1 00 00 00 mov $0xa1,%edx
801032be: 66 c1 e8 08 shr $0x8,%ax
801032c2: ee out %al,(%dx)
801032c3: 5b pop %ebx
801032c4: 5e pop %esi
801032c5: 5f pop %edi
801032c6: 5d pop %ebp
801032c7: c3 ret
801032c8: 66 90 xchg %ax,%ax
801032ca: 66 90 xchg %ax,%ax
801032cc: 66 90 xchg %ax,%ax
801032ce: 66 90 xchg %ax,%ax
801032d0 <pipealloc>:
int writeopen; // write fd is still open
};
int
pipealloc(struct file **f0, struct file **f1)
{
801032d0: 55 push %ebp
801032d1: 89 e5 mov %esp,%ebp
801032d3: 57 push %edi
801032d4: 56 push %esi
801032d5: 53 push %ebx
801032d6: 83 ec 1c sub $0x1c,%esp
801032d9: 8b 75 08 mov 0x8(%ebp),%esi
801032dc: 8b 5d 0c mov 0xc(%ebp),%ebx
struct pipe *p;
p = 0;
*f0 = *f1 = 0;
801032df: c7 03 00 00 00 00 movl $0x0,(%ebx)
801032e5: c7 06 00 00 00 00 movl $0x0,(%esi)
if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0)
801032eb: e8 80 da ff ff call 80100d70 <filealloc>
801032f0: 85 c0 test %eax,%eax
801032f2: 89 06 mov %eax,(%esi)
801032f4: 0f 84 a4 00 00 00 je 8010339e <pipealloc+0xce>
801032fa: e8 71 da ff ff call 80100d70 <filealloc>
801032ff: 85 c0 test %eax,%eax
80103301: 89 03 mov %eax,(%ebx)
80103303: 0f 84 87 00 00 00 je 80103390 <pipealloc+0xc0>
goto bad;
if((p = (struct pipe*)kalloc()) == 0)
80103309: e8 92 f1 ff ff call 801024a0 <kalloc>
8010330e: 85 c0 test %eax,%eax
80103310: 89 c7 mov %eax,%edi
80103312: 74 7c je 80103390 <pipealloc+0xc0>
goto bad;
p->readopen = 1;
80103314: c7 80 3c 02 00 00 01 movl $0x1,0x23c(%eax)
8010331b: 00 00 00
p->writeopen = 1;
8010331e: c7 80 40 02 00 00 01 movl $0x1,0x240(%eax)
80103325: 00 00 00
p->nwrite = 0;
80103328: c7 80 38 02 00 00 00 movl $0x0,0x238(%eax)
8010332f: 00 00 00
p->nread = 0;
80103332: c7 80 34 02 00 00 00 movl $0x0,0x234(%eax)
80103339: 00 00 00
initlock(&p->lock, "pipe");
8010333c: 89 04 24 mov %eax,(%esp)
8010333f: c7 44 24 04 e8 74 10 movl $0x801074e8,0x4(%esp)
80103346: 80
80103347: e8 d4 0f 00 00 call 80104320 <initlock>
(*f0)->type = FD_PIPE;
8010334c: 8b 06 mov (%esi),%eax
8010334e: c7 00 01 00 00 00 movl $0x1,(%eax)
(*f0)->readable = 1;
80103354: 8b 06 mov (%esi),%eax
80103356: c6 40 08 01 movb $0x1,0x8(%eax)
(*f0)->writable = 0;
8010335a: 8b 06 mov (%esi),%eax
8010335c: c6 40 09 00 movb $0x0,0x9(%eax)
(*f0)->pipe = p;
80103360: 8b 06 mov (%esi),%eax
80103362: 89 78 0c mov %edi,0xc(%eax)
(*f1)->type = FD_PIPE;
80103365: 8b 03 mov (%ebx),%eax
80103367: c7 00 01 00 00 00 movl $0x1,(%eax)
(*f1)->readable = 0;
8010336d: 8b 03 mov (%ebx),%eax
8010336f: c6 40 08 00 movb $0x0,0x8(%eax)
(*f1)->writable = 1;
80103373: 8b 03 mov (%ebx),%eax
80103375: c6 40 09 01 movb $0x1,0x9(%eax)
(*f1)->pipe = p;
80103379: 8b 03 mov (%ebx),%eax
return 0;
8010337b: 31 db xor %ebx,%ebx
(*f0)->writable = 0;
(*f0)->pipe = p;
(*f1)->type = FD_PIPE;
(*f1)->readable = 0;
(*f1)->writable = 1;
(*f1)->pipe = p;
8010337d: 89 78 0c mov %edi,0xc(%eax)
if(*f0)
fileclose(*f0);
if(*f1)
fileclose(*f1);
return -1;
}
80103380: 83 c4 1c add $0x1c,%esp
80103383: 89 d8 mov %ebx,%eax
80103385: 5b pop %ebx
80103386: 5e pop %esi
80103387: 5f pop %edi
80103388: 5d pop %ebp
80103389: c3 ret
8010338a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
//PAGEBREAK: 20
bad:
if(p)
kfree((char*)p);
if(*f0)
80103390: 8b 06 mov (%esi),%eax
80103392: 85 c0 test %eax,%eax
80103394: 74 08 je 8010339e <pipealloc+0xce>
fileclose(*f0);
80103396: 89 04 24 mov %eax,(%esp)
80103399: e8 92 da ff ff call 80100e30 <fileclose>
if(*f1)
8010339e: 8b 03 mov (%ebx),%eax
fileclose(*f1);
return -1;
801033a0: bb ff ff ff ff mov $0xffffffff,%ebx
bad:
if(p)
kfree((char*)p);
if(*f0)
fileclose(*f0);
if(*f1)
801033a5: 85 c0 test %eax,%eax
801033a7: 74 d7 je 80103380 <pipealloc+0xb0>
fileclose(*f1);
801033a9: 89 04 24 mov %eax,(%esp)
801033ac: e8 7f da ff ff call 80100e30 <fileclose>
return -1;
}
801033b1: 83 c4 1c add $0x1c,%esp
801033b4: 89 d8 mov %ebx,%eax
801033b6: 5b pop %ebx
801033b7: 5e pop %esi
801033b8: 5f pop %edi
801033b9: 5d pop %ebp
801033ba: c3 ret
801033bb: 90 nop
801033bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801033c0 <pipeclose>:
void
pipeclose(struct pipe *p, int writable)
{
801033c0: 55 push %ebp
801033c1: 89 e5 mov %esp,%ebp
801033c3: 56 push %esi
801033c4: 53 push %ebx
801033c5: 83 ec 10 sub $0x10,%esp
801033c8: 8b 5d 08 mov 0x8(%ebp),%ebx
801033cb: 8b 75 0c mov 0xc(%ebp),%esi
acquire(&p->lock);
801033ce: 89 1c 24 mov %ebx,(%esp)
801033d1: e8 ca 0f 00 00 call 801043a0 <acquire>
if(writable){
801033d6: 85 f6 test %esi,%esi
801033d8: 74 3e je 80103418 <pipeclose+0x58>
p->writeopen = 0;
wakeup(&p->nread);
801033da: 8d 83 34 02 00 00 lea 0x234(%ebx),%eax
void
pipeclose(struct pipe *p, int writable)
{
acquire(&p->lock);
if(writable){
p->writeopen = 0;
801033e0: c7 83 40 02 00 00 00 movl $0x0,0x240(%ebx)
801033e7: 00 00 00
wakeup(&p->nread);
801033ea: 89 04 24 mov %eax,(%esp)
801033ed: e8 5e 0c 00 00 call 80104050 <wakeup>
} else {
p->readopen = 0;
wakeup(&p->nwrite);
}
if(p->readopen == 0 && p->writeopen == 0){
801033f2: 8b 93 3c 02 00 00 mov 0x23c(%ebx),%edx
801033f8: 85 d2 test %edx,%edx
801033fa: 75 0a jne 80103406 <pipeclose+0x46>
801033fc: 8b 83 40 02 00 00 mov 0x240(%ebx),%eax
80103402: 85 c0 test %eax,%eax
80103404: 74 32 je 80103438 <pipeclose+0x78>
release(&p->lock);
kfree((char*)p);
} else
release(&p->lock);
80103406: 89 5d 08 mov %ebx,0x8(%ebp)
}
80103409: 83 c4 10 add $0x10,%esp
8010340c: 5b pop %ebx
8010340d: 5e pop %esi
8010340e: 5d pop %ebp
}
if(p->readopen == 0 && p->writeopen == 0){
release(&p->lock);
kfree((char*)p);
} else
release(&p->lock);
8010340f: e9 bc 10 00 00 jmp 801044d0 <release>
80103414: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(writable){
p->writeopen = 0;
wakeup(&p->nread);
} else {
p->readopen = 0;
wakeup(&p->nwrite);
80103418: 8d 83 38 02 00 00 lea 0x238(%ebx),%eax
acquire(&p->lock);
if(writable){
p->writeopen = 0;
wakeup(&p->nread);
} else {
p->readopen = 0;
8010341e: c7 83 3c 02 00 00 00 movl $0x0,0x23c(%ebx)
80103425: 00 00 00
wakeup(&p->nwrite);
80103428: 89 04 24 mov %eax,(%esp)
8010342b: e8 20 0c 00 00 call 80104050 <wakeup>
80103430: eb c0 jmp 801033f2 <pipeclose+0x32>
80103432: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
}
if(p->readopen == 0 && p->writeopen == 0){
release(&p->lock);
80103438: 89 1c 24 mov %ebx,(%esp)
8010343b: e8 90 10 00 00 call 801044d0 <release>
kfree((char*)p);
80103440: 89 5d 08 mov %ebx,0x8(%ebp)
} else
release(&p->lock);
}
80103443: 83 c4 10 add $0x10,%esp
80103446: 5b pop %ebx
80103447: 5e pop %esi
80103448: 5d pop %ebp
p->readopen = 0;
wakeup(&p->nwrite);
}
if(p->readopen == 0 && p->writeopen == 0){
release(&p->lock);
kfree((char*)p);
80103449: e9 a2 ee ff ff jmp 801022f0 <kfree>
8010344e: 66 90 xchg %ax,%ax
80103450 <pipewrite>:
}
//PAGEBREAK: 40
int
pipewrite(struct pipe *p, char *addr, int n)
{
80103450: 55 push %ebp
80103451: 89 e5 mov %esp,%ebp
80103453: 57 push %edi
80103454: 56 push %esi
80103455: 53 push %ebx
80103456: 83 ec 1c sub $0x1c,%esp
80103459: 8b 7d 08 mov 0x8(%ebp),%edi
int i;
acquire(&p->lock);
8010345c: 89 3c 24 mov %edi,(%esp)
8010345f: e8 3c 0f 00 00 call 801043a0 <acquire>
for(i = 0; i < n; i++){
80103464: 8b 45 10 mov 0x10(%ebp),%eax
80103467: 85 c0 test %eax,%eax
80103469: 0f 8e c2 00 00 00 jle 80103531 <pipewrite+0xe1>
8010346f: 8b 45 0c mov 0xc(%ebp),%eax
80103472: 8d b7 34 02 00 00 lea 0x234(%edi),%esi
80103478: 8b 8f 38 02 00 00 mov 0x238(%edi),%ecx
8010347e: 8d 9f 38 02 00 00 lea 0x238(%edi),%ebx
80103484: 89 45 e4 mov %eax,-0x1c(%ebp)
80103487: 03 45 10 add 0x10(%ebp),%eax
8010348a: 89 45 e0 mov %eax,-0x20(%ebp)
while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full
8010348d: 8b 87 34 02 00 00 mov 0x234(%edi),%eax
80103493: 8d 90 00 02 00 00 lea 0x200(%eax),%edx
80103499: 39 d1 cmp %edx,%ecx
8010349b: 0f 85 c4 00 00 00 jne 80103565 <pipewrite+0x115>
if(p->readopen == 0 || proc->killed){
801034a1: 8b 97 3c 02 00 00 mov 0x23c(%edi),%edx
801034a7: 85 d2 test %edx,%edx
801034a9: 0f 84 a1 00 00 00 je 80103550 <pipewrite+0x100>
801034af: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
801034b6: 8b 42 24 mov 0x24(%edx),%eax
801034b9: 85 c0 test %eax,%eax
801034bb: 74 22 je 801034df <pipewrite+0x8f>
801034bd: e9 8e 00 00 00 jmp 80103550 <pipewrite+0x100>
801034c2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801034c8: 8b 87 3c 02 00 00 mov 0x23c(%edi),%eax
801034ce: 85 c0 test %eax,%eax
801034d0: 74 7e je 80103550 <pipewrite+0x100>
801034d2: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801034d8: 8b 48 24 mov 0x24(%eax),%ecx
801034db: 85 c9 test %ecx,%ecx
801034dd: 75 71 jne 80103550 <pipewrite+0x100>
release(&p->lock);
return -1;
}
wakeup(&p->nread);
801034df: 89 34 24 mov %esi,(%esp)
801034e2: e8 69 0b 00 00 call 80104050 <wakeup>
sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep
801034e7: 89 7c 24 04 mov %edi,0x4(%esp)
801034eb: 89 1c 24 mov %ebx,(%esp)
801034ee: e8 ad 09 00 00 call 80103ea0 <sleep>
{
int i;
acquire(&p->lock);
for(i = 0; i < n; i++){
while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full
801034f3: 8b 87 34 02 00 00 mov 0x234(%edi),%eax
801034f9: 8b 97 38 02 00 00 mov 0x238(%edi),%edx
801034ff: 05 00 02 00 00 add $0x200,%eax
80103504: 39 c2 cmp %eax,%edx
80103506: 74 c0 je 801034c8 <pipewrite+0x78>
return -1;
}
wakeup(&p->nread);
sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep
}
p->data[p->nwrite++ % PIPESIZE] = addr[i];
80103508: 8b 45 e4 mov -0x1c(%ebp),%eax
8010350b: 8d 4a 01 lea 0x1(%edx),%ecx
8010350e: 81 e2 ff 01 00 00 and $0x1ff,%edx
80103514: 89 8f 38 02 00 00 mov %ecx,0x238(%edi)
8010351a: 83 45 e4 01 addl $0x1,-0x1c(%ebp)
8010351e: 0f b6 00 movzbl (%eax),%eax
80103521: 88 44 17 34 mov %al,0x34(%edi,%edx,1)
pipewrite(struct pipe *p, char *addr, int n)
{
int i;
acquire(&p->lock);
for(i = 0; i < n; i++){
80103525: 8b 45 e4 mov -0x1c(%ebp),%eax
80103528: 3b 45 e0 cmp -0x20(%ebp),%eax
8010352b: 0f 85 5c ff ff ff jne 8010348d <pipewrite+0x3d>
wakeup(&p->nread);
sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep
}
p->data[p->nwrite++ % PIPESIZE] = addr[i];
}
wakeup(&p->nread); //DOC: pipewrite-wakeup1
80103531: 8d 97 34 02 00 00 lea 0x234(%edi),%edx
80103537: 89 14 24 mov %edx,(%esp)
8010353a: e8 11 0b 00 00 call 80104050 <wakeup>
release(&p->lock);
8010353f: 89 3c 24 mov %edi,(%esp)
80103542: e8 89 0f 00 00 call 801044d0 <release>
return n;
80103547: 8b 45 10 mov 0x10(%ebp),%eax
8010354a: eb 11 jmp 8010355d <pipewrite+0x10d>
8010354c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
acquire(&p->lock);
for(i = 0; i < n; i++){
while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full
if(p->readopen == 0 || proc->killed){
release(&p->lock);
80103550: 89 3c 24 mov %edi,(%esp)
80103553: e8 78 0f 00 00 call 801044d0 <release>
return -1;
80103558: b8 ff ff ff ff mov $0xffffffff,%eax
p->data[p->nwrite++ % PIPESIZE] = addr[i];
}
wakeup(&p->nread); //DOC: pipewrite-wakeup1
release(&p->lock);
return n;
}
8010355d: 83 c4 1c add $0x1c,%esp
80103560: 5b pop %ebx
80103561: 5e pop %esi
80103562: 5f pop %edi
80103563: 5d pop %ebp
80103564: c3 ret
{
int i;
acquire(&p->lock);
for(i = 0; i < n; i++){
while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full
80103565: 89 ca mov %ecx,%edx
80103567: eb 9f jmp 80103508 <pipewrite+0xb8>
80103569: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80103570 <piperead>:
return n;
}
int
piperead(struct pipe *p, char *addr, int n)
{
80103570: 55 push %ebp
80103571: 89 e5 mov %esp,%ebp
80103573: 57 push %edi
80103574: 56 push %esi
80103575: 53 push %ebx
80103576: 83 ec 1c sub $0x1c,%esp
80103579: 8b 75 08 mov 0x8(%ebp),%esi
8010357c: 8b 7d 0c mov 0xc(%ebp),%edi
int i;
acquire(&p->lock);
8010357f: 89 34 24 mov %esi,(%esp)
80103582: e8 19 0e 00 00 call 801043a0 <acquire>
while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty
80103587: 8b 86 34 02 00 00 mov 0x234(%esi),%eax
8010358d: 3b 86 38 02 00 00 cmp 0x238(%esi),%eax
80103593: 75 5b jne 801035f0 <piperead+0x80>
80103595: 8b 9e 40 02 00 00 mov 0x240(%esi),%ebx
8010359b: 85 db test %ebx,%ebx
8010359d: 74 51 je 801035f0 <piperead+0x80>
8010359f: 8d 9e 34 02 00 00 lea 0x234(%esi),%ebx
801035a5: eb 25 jmp 801035cc <piperead+0x5c>
801035a7: 90 nop
if(proc->killed){
release(&p->lock);
return -1;
}
sleep(&p->nread, &p->lock); //DOC: piperead-sleep
801035a8: 89 74 24 04 mov %esi,0x4(%esp)
801035ac: 89 1c 24 mov %ebx,(%esp)
801035af: e8 ec 08 00 00 call 80103ea0 <sleep>
piperead(struct pipe *p, char *addr, int n)
{
int i;
acquire(&p->lock);
while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty
801035b4: 8b 86 34 02 00 00 mov 0x234(%esi),%eax
801035ba: 3b 86 38 02 00 00 cmp 0x238(%esi),%eax
801035c0: 75 2e jne 801035f0 <piperead+0x80>
801035c2: 8b 96 40 02 00 00 mov 0x240(%esi),%edx
801035c8: 85 d2 test %edx,%edx
801035ca: 74 24 je 801035f0 <piperead+0x80>
if(proc->killed){
801035cc: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801035d2: 8b 48 24 mov 0x24(%eax),%ecx
801035d5: 85 c9 test %ecx,%ecx
801035d7: 74 cf je 801035a8 <piperead+0x38>
release(&p->lock);
801035d9: 89 34 24 mov %esi,(%esp)
801035dc: e8 ef 0e 00 00 call 801044d0 <release>
addr[i] = p->data[p->nread++ % PIPESIZE];
}
wakeup(&p->nwrite); //DOC: piperead-wakeup
release(&p->lock);
return i;
}
801035e1: 83 c4 1c add $0x1c,%esp
acquire(&p->lock);
while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty
if(proc->killed){
release(&p->lock);
return -1;
801035e4: b8 ff ff ff ff mov $0xffffffff,%eax
addr[i] = p->data[p->nread++ % PIPESIZE];
}
wakeup(&p->nwrite); //DOC: piperead-wakeup
release(&p->lock);
return i;
}
801035e9: 5b pop %ebx
801035ea: 5e pop %esi
801035eb: 5f pop %edi
801035ec: 5d pop %ebp
801035ed: c3 ret
801035ee: 66 90 xchg %ax,%ax
release(&p->lock);
return -1;
}
sleep(&p->nread, &p->lock); //DOC: piperead-sleep
}
for(i = 0; i < n; i++){ //DOC: piperead-copy
801035f0: 8b 55 10 mov 0x10(%ebp),%edx
if(p->nread == p->nwrite)
801035f3: 31 db xor %ebx,%ebx
release(&p->lock);
return -1;
}
sleep(&p->nread, &p->lock); //DOC: piperead-sleep
}
for(i = 0; i < n; i++){ //DOC: piperead-copy
801035f5: 85 d2 test %edx,%edx
801035f7: 7f 2b jg 80103624 <piperead+0xb4>
801035f9: eb 31 jmp 8010362c <piperead+0xbc>
801035fb: 90 nop
801035fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(p->nread == p->nwrite)
break;
addr[i] = p->data[p->nread++ % PIPESIZE];
80103600: 8d 48 01 lea 0x1(%eax),%ecx
80103603: 25 ff 01 00 00 and $0x1ff,%eax
80103608: 89 8e 34 02 00 00 mov %ecx,0x234(%esi)
8010360e: 0f b6 44 06 34 movzbl 0x34(%esi,%eax,1),%eax
80103613: 88 04 1f mov %al,(%edi,%ebx,1)
release(&p->lock);
return -1;
}
sleep(&p->nread, &p->lock); //DOC: piperead-sleep
}
for(i = 0; i < n; i++){ //DOC: piperead-copy
80103616: 83 c3 01 add $0x1,%ebx
80103619: 3b 5d 10 cmp 0x10(%ebp),%ebx
8010361c: 74 0e je 8010362c <piperead+0xbc>
if(p->nread == p->nwrite)
8010361e: 8b 86 34 02 00 00 mov 0x234(%esi),%eax
80103624: 3b 86 38 02 00 00 cmp 0x238(%esi),%eax
8010362a: 75 d4 jne 80103600 <piperead+0x90>
break;
addr[i] = p->data[p->nread++ % PIPESIZE];
}
wakeup(&p->nwrite); //DOC: piperead-wakeup
8010362c: 8d 86 38 02 00 00 lea 0x238(%esi),%eax
80103632: 89 04 24 mov %eax,(%esp)
80103635: e8 16 0a 00 00 call 80104050 <wakeup>
release(&p->lock);
8010363a: 89 34 24 mov %esi,(%esp)
8010363d: e8 8e 0e 00 00 call 801044d0 <release>
return i;
}
80103642: 83 c4 1c add $0x1c,%esp
break;
addr[i] = p->data[p->nread++ % PIPESIZE];
}
wakeup(&p->nwrite); //DOC: piperead-wakeup
release(&p->lock);
return i;
80103645: 89 d8 mov %ebx,%eax
}
80103647: 5b pop %ebx
80103648: 5e pop %esi
80103649: 5f pop %edi
8010364a: 5d pop %ebp
8010364b: c3 ret
8010364c: 66 90 xchg %ax,%ax
8010364e: 66 90 xchg %ax,%ax
80103650 <allocproc>:
// If found, change state to EMBRYO and initialize
// state required to run in the kernel.
// Otherwise return 0.
static struct proc*
allocproc(void)
{
80103650: 55 push %ebp
80103651: 89 e5 mov %esp,%ebp
80103653: 53 push %ebx
struct proc *p;
char *sp;
acquire(&ptable.lock);
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80103654: bb d4 2d 11 80 mov $0x80112dd4,%ebx
// If found, change state to EMBRYO and initialize
// state required to run in the kernel.
// Otherwise return 0.
static struct proc*
allocproc(void)
{
80103659: 83 ec 14 sub $0x14,%esp
struct proc *p;
char *sp;
acquire(&ptable.lock);
8010365c: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103663: e8 38 0d 00 00 call 801043a0 <acquire>
80103668: eb 18 jmp 80103682 <allocproc+0x32>
8010366a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80103670: 81 c3 9c 00 00 00 add $0x9c,%ebx
80103676: 81 fb d4 54 11 80 cmp $0x801154d4,%ebx
8010367c: 0f 84 a6 00 00 00 je 80103728 <allocproc+0xd8>
if(p->state == UNUSED)
80103682: 8b 43 0c mov 0xc(%ebx),%eax
80103685: 85 c0 test %eax,%eax
80103687: 75 e7 jne 80103670 <allocproc+0x20>
release(&ptable.lock);
return 0;
found:
p->state = EMBRYO;
p->pid = nextpid++;
80103689: a1 08 a0 10 80 mov 0x8010a008,%eax
p->createTime = ticks;
p->length_of_job =10 ;
p->runTime = 0;
p->sleepTime =0;
release(&ptable.lock);
8010368e: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
release(&ptable.lock);
return 0;
found:
p->state = EMBRYO;
80103695: c7 43 0c 01 00 00 00 movl $0x1,0xc(%ebx)
p->pid = nextpid++;
p->createTime = ticks;
p->length_of_job =10 ;
8010369c: c7 83 8c 00 00 00 0a movl $0xa,0x8c(%ebx)
801036a3: 00 00 00
release(&ptable.lock);
return 0;
found:
p->state = EMBRYO;
p->pid = nextpid++;
801036a6: 8d 50 01 lea 0x1(%eax),%edx
801036a9: 89 43 10 mov %eax,0x10(%ebx)
p->createTime = ticks;
801036ac: a1 20 5d 11 80 mov 0x80115d20,%eax
release(&ptable.lock);
return 0;
found:
p->state = EMBRYO;
p->pid = nextpid++;
801036b1: 89 15 08 a0 10 80 mov %edx,0x8010a008
p->createTime = ticks;
p->length_of_job =10 ;
p->runTime = 0;
801036b7: c7 83 88 00 00 00 00 movl $0x0,0x88(%ebx)
801036be: 00 00 00
p->sleepTime =0;
801036c1: c7 83 80 00 00 00 00 movl $0x0,0x80(%ebx)
801036c8: 00 00 00
return 0;
found:
p->state = EMBRYO;
p->pid = nextpid++;
p->createTime = ticks;
801036cb: 89 43 7c mov %eax,0x7c(%ebx)
p->length_of_job =10 ;
p->runTime = 0;
p->sleepTime =0;
release(&ptable.lock);
801036ce: e8 fd 0d 00 00 call 801044d0 <release>
// Allocate kernel stack.
if((p->kstack = kalloc()) == 0){
801036d3: e8 c8 ed ff ff call 801024a0 <kalloc>
801036d8: 85 c0 test %eax,%eax
801036da: 89 43 08 mov %eax,0x8(%ebx)
801036dd: 74 5d je 8010373c <allocproc+0xec>
return 0;
}
sp = p->kstack + KSTACKSIZE;
// Leave room for trap frame.
sp -= sizeof *p->tf;
801036df: 8d 90 b4 0f 00 00 lea 0xfb4(%eax),%edx
// Set up new context to start executing at forkret,
// which returns to trapret.
sp -= 4;
*(uint*)sp = (uint)trapret;
sp -= sizeof *p->context;
801036e5: 05 9c 0f 00 00 add $0xf9c,%eax
return 0;
}
sp = p->kstack + KSTACKSIZE;
// Leave room for trap frame.
sp -= sizeof *p->tf;
801036ea: 89 53 18 mov %edx,0x18(%ebx)
p->tf = (struct trapframe*)sp;
// Set up new context to start executing at forkret,
// which returns to trapret.
sp -= 4;
*(uint*)sp = (uint)trapret;
801036ed: c7 40 14 4d 57 10 80 movl $0x8010574d,0x14(%eax)
sp -= sizeof *p->context;
p->context = (struct context*)sp;
memset(p->context, 0, sizeof *p->context);
801036f4: c7 44 24 08 14 00 00 movl $0x14,0x8(%esp)
801036fb: 00
801036fc: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80103703: 00
80103704: 89 04 24 mov %eax,(%esp)
// which returns to trapret.
sp -= 4;
*(uint*)sp = (uint)trapret;
sp -= sizeof *p->context;
p->context = (struct context*)sp;
80103707: 89 43 1c mov %eax,0x1c(%ebx)
memset(p->context, 0, sizeof *p->context);
8010370a: e8 11 0e 00 00 call 80104520 <memset>
p->context->eip = (uint)forkret;
8010370f: 8b 43 1c mov 0x1c(%ebx),%eax
80103712: c7 40 10 50 37 10 80 movl $0x80103750,0x10(%eax)
return p;
80103719: 89 d8 mov %ebx,%eax
}
8010371b: 83 c4 14 add $0x14,%esp
8010371e: 5b pop %ebx
8010371f: 5d pop %ebp
80103720: c3 ret
80103721: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
if(p->state == UNUSED)
goto found;
release(&ptable.lock);
80103728: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
8010372f: e8 9c 0d 00 00 call 801044d0 <release>
p->context = (struct context*)sp;
memset(p->context, 0, sizeof *p->context);
p->context->eip = (uint)forkret;
return p;
}
80103734: 83 c4 14 add $0x14,%esp
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
if(p->state == UNUSED)
goto found;
release(&ptable.lock);
return 0;
80103737: 31 c0 xor %eax,%eax
p->context = (struct context*)sp;
memset(p->context, 0, sizeof *p->context);
p->context->eip = (uint)forkret;
return p;
}
80103739: 5b pop %ebx
8010373a: 5d pop %ebp
8010373b: c3 ret
p->sleepTime =0;
release(&ptable.lock);
// Allocate kernel stack.
if((p->kstack = kalloc()) == 0){
p->state = UNUSED;
8010373c: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx)
return 0;
80103743: eb d6 jmp 8010371b <allocproc+0xcb>
80103745: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80103749: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80103750 <forkret>:
// A fork child's very first scheduling by scheduler()
// will swtch here. "Return" to user space.
void
forkret(void)
{
80103750: 55 push %ebp
80103751: 89 e5 mov %esp,%ebp
80103753: 83 ec 18 sub $0x18,%esp
static int first = 1;
// Still holding ptable.lock from scheduler.
release(&ptable.lock);
80103756: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
8010375d: e8 6e 0d 00 00 call 801044d0 <release>
if (first) {
80103762: a1 04 a0 10 80 mov 0x8010a004,%eax
80103767: 85 c0 test %eax,%eax
80103769: 75 05 jne 80103770 <forkret+0x20>
iinit(ROOTDEV);
initlog(ROOTDEV);
}
// Return to "caller", actually trapret (see allocproc).
}
8010376b: c9 leave
8010376c: c3 ret
8010376d: 8d 76 00 lea 0x0(%esi),%esi
if (first) {
// Some initialization functions must be run in the context
// of a regular process (e.g., they call sleep), and thus cannot
// be run from main().
first = 0;
iinit(ROOTDEV);
80103770: c7 04 24 01 00 00 00 movl $0x1,(%esp)
if (first) {
// Some initialization functions must be run in the context
// of a regular process (e.g., they call sleep), and thus cannot
// be run from main().
first = 0;
80103777: c7 05 04 a0 10 80 00 movl $0x0,0x8010a004
8010377e: 00 00 00
iinit(ROOTDEV);
80103781: e8 fa dc ff ff call 80101480 <iinit>
initlog(ROOTDEV);
80103786: c7 04 24 01 00 00 00 movl $0x1,(%esp)
8010378d: e8 5e f3 ff ff call 80102af0 <initlog>
}
// Return to "caller", actually trapret (see allocproc).
}
80103792: c9 leave
80103793: c3 ret
80103794: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
8010379a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
801037a0 <pinit>:
static void wakeup1(void *chan);
void
pinit(void)
{
801037a0: 55 push %ebp
801037a1: 89 e5 mov %esp,%ebp
801037a3: 83 ec 18 sub $0x18,%esp
initlock(&ptable.lock, "ptable");
801037a6: c7 44 24 04 ed 74 10 movl $0x801074ed,0x4(%esp)
801037ad: 80
801037ae: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
801037b5: e8 66 0b 00 00 call 80104320 <initlock>
}
801037ba: c9 leave
801037bb: c3 ret
801037bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801037c0 <userinit>:
//PAGEBREAK: 32
// Set up first user process.
void
userinit(void)
{
801037c0: 55 push %ebp
801037c1: 89 e5 mov %esp,%ebp
801037c3: 53 push %ebx
801037c4: 83 ec 14 sub $0x14,%esp
struct proc *p;
extern char _binary_initcode_start[], _binary_initcode_size[];
p = allocproc();
801037c7: e8 84 fe ff ff call 80103650 <allocproc>
801037cc: 89 c3 mov %eax,%ebx
initproc = p;
801037ce: a3 bc a5 10 80 mov %eax,0x8010a5bc
if((p->pgdir = setupkvm()) == 0)
801037d3: e8 78 31 00 00 call 80106950 <setupkvm>
801037d8: 85 c0 test %eax,%eax
801037da: 89 43 04 mov %eax,0x4(%ebx)
801037dd: 0f 84 d4 00 00 00 je 801038b7 <userinit+0xf7>
panic("userinit: out of memory?");
inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size);
801037e3: 89 04 24 mov %eax,(%esp)
801037e6: c7 44 24 08 2c 00 00 movl $0x2c,0x8(%esp)
801037ed: 00
801037ee: c7 44 24 04 60 a4 10 movl $0x8010a460,0x4(%esp)
801037f5: 80
801037f6: e8 e5 32 00 00 call 80106ae0 <inituvm>
p->sz = PGSIZE;
801037fb: c7 03 00 10 00 00 movl $0x1000,(%ebx)
memset(p->tf, 0, sizeof(*p->tf));
80103801: c7 44 24 08 4c 00 00 movl $0x4c,0x8(%esp)
80103808: 00
80103809: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80103810: 00
80103811: 8b 43 18 mov 0x18(%ebx),%eax
80103814: 89 04 24 mov %eax,(%esp)
80103817: e8 04 0d 00 00 call 80104520 <memset>
p->tf->cs = (SEG_UCODE << 3) | DPL_USER;
8010381c: 8b 43 18 mov 0x18(%ebx),%eax
8010381f: ba 23 00 00 00 mov $0x23,%edx
p->tf->ds = (SEG_UDATA << 3) | DPL_USER;
80103824: b9 2b 00 00 00 mov $0x2b,%ecx
if((p->pgdir = setupkvm()) == 0)
panic("userinit: out of memory?");
inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size);
p->sz = PGSIZE;
memset(p->tf, 0, sizeof(*p->tf));
p->tf->cs = (SEG_UCODE << 3) | DPL_USER;
80103829: 66 89 50 3c mov %dx,0x3c(%eax)
p->tf->ds = (SEG_UDATA << 3) | DPL_USER;
8010382d: 8b 43 18 mov 0x18(%ebx),%eax
80103830: 66 89 48 2c mov %cx,0x2c(%eax)
p->tf->es = p->tf->ds;
80103834: 8b 43 18 mov 0x18(%ebx),%eax
80103837: 0f b7 50 2c movzwl 0x2c(%eax),%edx
8010383b: 66 89 50 28 mov %dx,0x28(%eax)
p->tf->ss = p->tf->ds;
8010383f: 8b 43 18 mov 0x18(%ebx),%eax
80103842: 0f b7 50 2c movzwl 0x2c(%eax),%edx
80103846: 66 89 50 48 mov %dx,0x48(%eax)
p->tf->eflags = FL_IF;
8010384a: 8b 43 18 mov 0x18(%ebx),%eax
8010384d: c7 40 40 00 02 00 00 movl $0x200,0x40(%eax)
p->tf->esp = PGSIZE;
80103854: 8b 43 18 mov 0x18(%ebx),%eax
80103857: c7 40 44 00 10 00 00 movl $0x1000,0x44(%eax)
p->tf->eip = 0; // beginning of initcode.S
8010385e: 8b 43 18 mov 0x18(%ebx),%eax
80103861: c7 40 38 00 00 00 00 movl $0x0,0x38(%eax)
safestrcpy(p->name, "initcode", sizeof(p->name));
80103868: 8d 43 6c lea 0x6c(%ebx),%eax
8010386b: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
80103872: 00
80103873: c7 44 24 04 0d 75 10 movl $0x8010750d,0x4(%esp)
8010387a: 80
8010387b: 89 04 24 mov %eax,(%esp)
8010387e: e8 9d 0e 00 00 call 80104720 <safestrcpy>
p->cwd = namei("/");
80103883: c7 04 24 16 75 10 80 movl $0x80107516,(%esp)
8010388a: e8 61 e6 ff ff call 80101ef0 <namei>
8010388f: 89 43 68 mov %eax,0x68(%ebx)
// this assignment to p->state lets other cores
// run this process. the acquire forces the above
// writes to be visible, and the lock is also needed
// because the assignment might not be atomic.
acquire(&ptable.lock);
80103892: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103899: e8 02 0b 00 00 call 801043a0 <acquire>
p->state = RUNNABLE;
8010389e: c7 43 0c 03 00 00 00 movl $0x3,0xc(%ebx)
release(&ptable.lock);
801038a5: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
801038ac: e8 1f 0c 00 00 call 801044d0 <release>
}
801038b1: 83 c4 14 add $0x14,%esp
801038b4: 5b pop %ebx
801038b5: 5d pop %ebp
801038b6: c3 ret
p = allocproc();
initproc = p;
if((p->pgdir = setupkvm()) == 0)
panic("userinit: out of memory?");
801038b7: c7 04 24 f4 74 10 80 movl $0x801074f4,(%esp)
801038be: e8 9d ca ff ff call 80100360 <panic>
801038c3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801038c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801038d0 <growproc>:
// Grow current process's memory by n bytes.
// Return 0 on success, -1 on failure.
int
growproc(int n)
{
801038d0: 55 push %ebp
801038d1: 89 e5 mov %esp,%ebp
801038d3: 83 ec 18 sub $0x18,%esp
uint sz;
sz = proc->sz;
801038d6: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
// Grow current process's memory by n bytes.
// Return 0 on success, -1 on failure.
int
growproc(int n)
{
801038dd: 8b 4d 08 mov 0x8(%ebp),%ecx
uint sz;
sz = proc->sz;
801038e0: 8b 02 mov (%edx),%eax
if(n > 0){
801038e2: 83 f9 00 cmp $0x0,%ecx
801038e5: 7e 39 jle 80103920 <growproc+0x50>
if((sz = allocuvm(proc->pgdir, sz, sz + n)) == 0)
801038e7: 01 c1 add %eax,%ecx
801038e9: 89 4c 24 08 mov %ecx,0x8(%esp)
801038ed: 89 44 24 04 mov %eax,0x4(%esp)
801038f1: 8b 42 04 mov 0x4(%edx),%eax
801038f4: 89 04 24 mov %eax,(%esp)
801038f7: e8 24 33 00 00 call 80106c20 <allocuvm>
801038fc: 85 c0 test %eax,%eax
801038fe: 74 40 je 80103940 <growproc+0x70>
80103900: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
return -1;
} else if(n < 0){
if((sz = deallocuvm(proc->pgdir, sz, sz + n)) == 0)
return -1;
}
proc->sz = sz;
80103907: 89 02 mov %eax,(%edx)
switchuvm(proc);
80103909: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010390f: 89 04 24 mov %eax,(%esp)
80103912: e8 f9 30 00 00 call 80106a10 <switchuvm>
return 0;
80103917: 31 c0 xor %eax,%eax
}
80103919: c9 leave
8010391a: c3 ret
8010391b: 90 nop
8010391c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
sz = proc->sz;
if(n > 0){
if((sz = allocuvm(proc->pgdir, sz, sz + n)) == 0)
return -1;
} else if(n < 0){
80103920: 74 e5 je 80103907 <growproc+0x37>
if((sz = deallocuvm(proc->pgdir, sz, sz + n)) == 0)
80103922: 01 c1 add %eax,%ecx
80103924: 89 4c 24 08 mov %ecx,0x8(%esp)
80103928: 89 44 24 04 mov %eax,0x4(%esp)
8010392c: 8b 42 04 mov 0x4(%edx),%eax
8010392f: 89 04 24 mov %eax,(%esp)
80103932: e8 d9 33 00 00 call 80106d10 <deallocuvm>
80103937: 85 c0 test %eax,%eax
80103939: 75 c5 jne 80103900 <growproc+0x30>
8010393b: 90 nop
8010393c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
uint sz;
sz = proc->sz;
if(n > 0){
if((sz = allocuvm(proc->pgdir, sz, sz + n)) == 0)
return -1;
80103940: b8 ff ff ff ff mov $0xffffffff,%eax
return -1;
}
proc->sz = sz;
switchuvm(proc);
return 0;
}
80103945: c9 leave
80103946: c3 ret
80103947: 89 f6 mov %esi,%esi
80103949: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80103950 <chpr>:
//change length_of_job
int
chpr( int pid, int length_of_job )
{
80103950: 55 push %ebp
80103951: 89 e5 mov %esp,%ebp
80103953: 53 push %ebx
80103954: 83 ec 14 sub $0x14,%esp
80103957: 8b 5d 08 mov 0x8(%ebp),%ebx
struct proc *p;
acquire(&ptable.lock);
8010395a: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103961: e8 3a 0a 00 00 call 801043a0 <acquire>
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103966: ba d4 2d 11 80 mov $0x80112dd4,%edx
8010396b: eb 11 jmp 8010397e <chpr+0x2e>
8010396d: 8d 76 00 lea 0x0(%esi),%esi
80103970: 81 c2 9c 00 00 00 add $0x9c,%edx
80103976: 81 fa d4 54 11 80 cmp $0x801154d4,%edx
8010397c: 74 0e je 8010398c <chpr+0x3c>
if(p->pid == pid ) {
8010397e: 39 5a 10 cmp %ebx,0x10(%edx)
80103981: 75 ed jne 80103970 <chpr+0x20>
p->length_of_job = length_of_job;
80103983: 8b 45 0c mov 0xc(%ebp),%eax
80103986: 89 82 8c 00 00 00 mov %eax,0x8c(%edx)
break;
}
}
release(&ptable.lock);
8010398c: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103993: e8 38 0b 00 00 call 801044d0 <release>
return pid;
}
80103998: 83 c4 14 add $0x14,%esp
8010399b: 89 d8 mov %ebx,%eax
8010399d: 5b pop %ebx
8010399e: 5d pop %ebp
8010399f: c3 ret
801039a0 <fork>:
// Create a new process copying p as the parent.
// Sets up stack to return as if from system call.
// Caller must set state of returned proc to RUNNABLE.
int
fork(void)
{
801039a0: 55 push %ebp
801039a1: 89 e5 mov %esp,%ebp
801039a3: 57 push %edi
801039a4: 56 push %esi
801039a5: 53 push %ebx
801039a6: 83 ec 1c sub $0x1c,%esp
int i, pid;
struct proc *np;
// Allocate process.
if((np = allocproc()) == 0){
801039a9: e8 a2 fc ff ff call 80103650 <allocproc>
801039ae: 85 c0 test %eax,%eax
801039b0: 89 c3 mov %eax,%ebx
801039b2: 0f 84 d5 00 00 00 je 80103a8d <fork+0xed>
return -1;
}
// Copy process state from p.
if((np->pgdir = copyuvm(proc->pgdir, proc->sz)) == 0){
801039b8: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801039be: 8b 10 mov (%eax),%edx
801039c0: 89 54 24 04 mov %edx,0x4(%esp)
801039c4: 8b 40 04 mov 0x4(%eax),%eax
801039c7: 89 04 24 mov %eax,(%esp)
801039ca: e8 11 34 00 00 call 80106de0 <copyuvm>
801039cf: 85 c0 test %eax,%eax
801039d1: 89 43 04 mov %eax,0x4(%ebx)
801039d4: 0f 84 ba 00 00 00 je 80103a94 <fork+0xf4>
kfree(np->kstack);
np->kstack = 0;
np->state = UNUSED;
return -1;
}
np->sz = proc->sz;
801039da: 65 a1 04 00 00 00 mov %gs:0x4,%eax
np->parent = proc;
*np->tf = *proc->tf;
801039e0: b9 13 00 00 00 mov $0x13,%ecx
801039e5: 8b 7b 18 mov 0x18(%ebx),%edi
kfree(np->kstack);
np->kstack = 0;
np->state = UNUSED;
return -1;
}
np->sz = proc->sz;
801039e8: 8b 00 mov (%eax),%eax
801039ea: 89 03 mov %eax,(%ebx)
np->parent = proc;
801039ec: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801039f2: 89 43 14 mov %eax,0x14(%ebx)
*np->tf = *proc->tf;
801039f5: 8b 70 18 mov 0x18(%eax),%esi
801039f8: f3 a5 rep movsl %ds:(%esi),%es:(%edi)
// Clear %eax so that fork returns 0 in the child.
np->tf->eax = 0;
for(i = 0; i < NOFILE; i++)
801039fa: 31 f6 xor %esi,%esi
np->sz = proc->sz;
np->parent = proc;
*np->tf = *proc->tf;
// Clear %eax so that fork returns 0 in the child.
np->tf->eax = 0;
801039fc: 8b 43 18 mov 0x18(%ebx),%eax
801039ff: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
80103a06: c7 40 1c 00 00 00 00 movl $0x0,0x1c(%eax)
80103a0d: 8d 76 00 lea 0x0(%esi),%esi
for(i = 0; i < NOFILE; i++)
if(proc->ofile[i])
80103a10: 8b 44 b2 28 mov 0x28(%edx,%esi,4),%eax
80103a14: 85 c0 test %eax,%eax
80103a16: 74 13 je 80103a2b <fork+0x8b>
np->ofile[i] = filedup(proc->ofile[i]);
80103a18: 89 04 24 mov %eax,(%esp)
80103a1b: e8 c0 d3 ff ff call 80100de0 <filedup>
80103a20: 89 44 b3 28 mov %eax,0x28(%ebx,%esi,4)
80103a24: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
*np->tf = *proc->tf;
// Clear %eax so that fork returns 0 in the child.
np->tf->eax = 0;
for(i = 0; i < NOFILE; i++)
80103a2b: 83 c6 01 add $0x1,%esi
80103a2e: 83 fe 10 cmp $0x10,%esi
80103a31: 75 dd jne 80103a10 <fork+0x70>
if(proc->ofile[i])
np->ofile[i] = filedup(proc->ofile[i]);
np->cwd = idup(proc->cwd);
80103a33: 8b 42 68 mov 0x68(%edx),%eax
80103a36: 89 04 24 mov %eax,(%esp)
80103a39: e8 52 dc ff ff call 80101690 <idup>
80103a3e: 89 43 68 mov %eax,0x68(%ebx)
safestrcpy(np->name, proc->name, sizeof(proc->name));
80103a41: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80103a47: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
80103a4e: 00
80103a4f: 83 c0 6c add $0x6c,%eax
80103a52: 89 44 24 04 mov %eax,0x4(%esp)
80103a56: 8d 43 6c lea 0x6c(%ebx),%eax
80103a59: 89 04 24 mov %eax,(%esp)
80103a5c: e8 bf 0c 00 00 call 80104720 <safestrcpy>
pid = np->pid;
80103a61: 8b 73 10 mov 0x10(%ebx),%esi
acquire(&ptable.lock);
80103a64: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103a6b: e8 30 09 00 00 call 801043a0 <acquire>
np->state = RUNNABLE;
80103a70: c7 43 0c 03 00 00 00 movl $0x3,0xc(%ebx)
release(&ptable.lock);
80103a77: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103a7e: e8 4d 0a 00 00 call 801044d0 <release>
return pid;
80103a83: 89 f0 mov %esi,%eax
}
80103a85: 83 c4 1c add $0x1c,%esp
80103a88: 5b pop %ebx
80103a89: 5e pop %esi
80103a8a: 5f pop %edi
80103a8b: 5d pop %ebp
80103a8c: c3 ret
int i, pid;
struct proc *np;
// Allocate process.
if((np = allocproc()) == 0){
return -1;
80103a8d: b8 ff ff ff ff mov $0xffffffff,%eax
80103a92: eb f1 jmp 80103a85 <fork+0xe5>
}
// Copy process state from p.
if((np->pgdir = copyuvm(proc->pgdir, proc->sz)) == 0){
kfree(np->kstack);
80103a94: 8b 43 08 mov 0x8(%ebx),%eax
80103a97: 89 04 24 mov %eax,(%esp)
80103a9a: e8 51 e8 ff ff call 801022f0 <kfree>
np->kstack = 0;
np->state = UNUSED;
return -1;
80103a9f: b8 ff ff ff ff mov $0xffffffff,%eax
}
// Copy process state from p.
if((np->pgdir = copyuvm(proc->pgdir, proc->sz)) == 0){
kfree(np->kstack);
np->kstack = 0;
80103aa4: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx)
np->state = UNUSED;
80103aab: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx)
return -1;
80103ab2: eb d1 jmp 80103a85 <fork+0xe5>
80103ab4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80103aba: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80103ac0 <cps>:
panic("zombie exit");
}
int cps()
{
80103ac0: 55 push %ebp
80103ac1: 89 e5 mov %esp,%ebp
80103ac3: 57 push %edi
80103ac4: 56 push %esi
80103ac5: 53 push %ebx
80103ac6: 83 ec 1c sub $0x1c,%esp
}
static inline void
sti(void)
{
asm volatile("sti");
80103ac9: fb sti
sti();
int i,j;
i = 0;
j = 0;
// Loop over process table looking for process with pid.
acquire(&ptable.lock);
80103aca: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103ad1: bb 40 2e 11 80 mov $0x80112e40,%ebx
// Enable interrupts on this processor.
sti();
int i,j;
i = 0;
j = 0;
80103ad6: 31 ff xor %edi,%edi
// Loop over process table looking for process with pid.
acquire(&ptable.lock);
80103ad8: e8 c3 08 00 00 call 801043a0 <acquire>
struct proc *p;
// Enable interrupts on this processor.
sti();
int i,j;
i = 0;
80103add: 31 f6 xor %esi,%esi
j = 0;
// Loop over process table looking for process with pid.
acquire(&ptable.lock);
cprintf("name \t pid \t state \t length of job\n");
80103adf: c7 04 24 f8 75 10 80 movl $0x801075f8,(%esp)
80103ae6: e8 65 cb ff ff call 80100650 <cprintf>
80103aeb: eb 16 jmp 80103b03 <cps+0x43>
80103aed: 8d 76 00 lea 0x0(%esi),%esi
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if ( p->state == SLEEPING ){
cprintf("%s \t %d \t SLEEPING \t %d \n ", p->name, p->pid ,p->length_of_job);
i = i +1;}
else if ( p->state == RUNNING ){
80103af0: 83 f8 04 cmp $0x4,%eax
80103af3: 74 63 je 80103b58 <cps+0x98>
80103af5: 81 c3 9c 00 00 00 add $0x9c,%ebx
i = 0;
j = 0;
// Loop over process table looking for process with pid.
acquire(&ptable.lock);
cprintf("name \t pid \t state \t length of job\n");
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103afb: 81 fb 40 55 11 80 cmp $0x80115540,%ebx
80103b01: 74 3d je 80103b40 <cps+0x80>
if ( p->state == SLEEPING ){
80103b03: 8b 43 a0 mov -0x60(%ebx),%eax
80103b06: 83 f8 02 cmp $0x2,%eax
80103b09: 75 e5 jne 80103af0 <cps+0x30>
cprintf("%s \t %d \t SLEEPING \t %d \n ", p->name, p->pid ,p->length_of_job);
80103b0b: 8b 43 20 mov 0x20(%ebx),%eax
i = i +1;}
80103b0e: 83 c6 01 add $0x1,%esi
// Loop over process table looking for process with pid.
acquire(&ptable.lock);
cprintf("name \t pid \t state \t length of job\n");
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if ( p->state == SLEEPING ){
cprintf("%s \t %d \t SLEEPING \t %d \n ", p->name, p->pid ,p->length_of_job);
80103b11: 89 5c 24 04 mov %ebx,0x4(%esp)
80103b15: 81 c3 9c 00 00 00 add $0x9c,%ebx
80103b1b: c7 04 24 18 75 10 80 movl $0x80107518,(%esp)
80103b22: 89 44 24 0c mov %eax,0xc(%esp)
80103b26: 8b 83 08 ff ff ff mov -0xf8(%ebx),%eax
80103b2c: 89 44 24 08 mov %eax,0x8(%esp)
80103b30: e8 1b cb ff ff call 80100650 <cprintf>
i = 0;
j = 0;
// Loop over process table looking for process with pid.
acquire(&ptable.lock);
cprintf("name \t pid \t state \t length of job\n");
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103b35: 81 fb 40 55 11 80 cmp $0x80115540,%ebx
80103b3b: 75 c6 jne 80103b03 <cps+0x43>
80103b3d: 8d 76 00 lea 0x0(%esi),%esi
else if ( p->state == RUNNING ){
cprintf("%s \t %d \t RUNNING \t %d \n ", p->name, p->pid,p->length_of_job );
j = j+1;}
}
release(&ptable.lock);
80103b40: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103b47: e8 84 09 00 00 call 801044d0 <release>
return i+j;
}
80103b4c: 83 c4 1c add $0x1c,%esp
cprintf("%s \t %d \t RUNNING \t %d \n ", p->name, p->pid,p->length_of_job );
j = j+1;}
}
release(&ptable.lock);
return i+j;
80103b4f: 8d 04 3e lea (%esi,%edi,1),%eax
}
80103b52: 5b pop %ebx
80103b53: 5e pop %esi
80103b54: 5f pop %edi
80103b55: 5d pop %ebp
80103b56: c3 ret
80103b57: 90 nop
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if ( p->state == SLEEPING ){
cprintf("%s \t %d \t SLEEPING \t %d \n ", p->name, p->pid ,p->length_of_job);
i = i +1;}
else if ( p->state == RUNNING ){
cprintf("%s \t %d \t RUNNING \t %d \n ", p->name, p->pid,p->length_of_job );
80103b58: 8b 43 20 mov 0x20(%ebx),%eax
j = j+1;}
80103b5b: 83 c7 01 add $0x1,%edi
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if ( p->state == SLEEPING ){
cprintf("%s \t %d \t SLEEPING \t %d \n ", p->name, p->pid ,p->length_of_job);
i = i +1;}
else if ( p->state == RUNNING ){
cprintf("%s \t %d \t RUNNING \t %d \n ", p->name, p->pid,p->length_of_job );
80103b5e: 89 5c 24 04 mov %ebx,0x4(%esp)
80103b62: c7 04 24 34 75 10 80 movl $0x80107534,(%esp)
80103b69: 89 44 24 0c mov %eax,0xc(%esp)
80103b6d: 8b 43 a4 mov -0x5c(%ebx),%eax
80103b70: 89 44 24 08 mov %eax,0x8(%esp)
80103b74: e8 d7 ca ff ff call 80100650 <cprintf>
80103b79: e9 77 ff ff ff jmp 80103af5 <cps+0x35>
80103b7e: 66 90 xchg %ax,%ax
80103b80 <scheduler>:
// via swtch back to the scheduler.
//This is the scheduler with shortest job first scheduling mechanism. We give low priority with process with larger length of job
void
scheduler(void)
{
80103b80: 55 push %ebp
80103b81: 89 e5 mov %esp,%ebp
80103b83: 53 push %ebx
80103b84: 83 ec 14 sub $0x14,%esp
80103b87: fb sti
for(;;){
// Enable interrupts on this processor.
sti();
struct proc *highP = 0;
// Looking for runnable process
acquire(&ptable.lock);
80103b88: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
for(p = ptable.proc ; p < &ptable.proc[NPROC]; p++){
80103b8f: bb d4 2d 11 80 mov $0x80112dd4,%ebx
for(;;){
// Enable interrupts on this processor.
sti();
struct proc *highP = 0;
// Looking for runnable process
acquire(&ptable.lock);
80103b94: e8 07 08 00 00 call 801043a0 <acquire>
80103b99: eb 17 jmp 80103bb2 <scheduler+0x32>
80103b9b: 90 nop
80103b9c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(p = ptable.proc ; p < &ptable.proc[NPROC]; p++){
80103ba0: 81 c3 9c 00 00 00 add $0x9c,%ebx
80103ba6: 81 fb d4 54 11 80 cmp $0x801154d4,%ebx
80103bac: 0f 83 af 00 00 00 jae 80103c61 <scheduler+0xe1>
if(p->state != RUNNABLE)
80103bb2: 83 7b 0c 03 cmpl $0x3,0xc(%ebx)
80103bb6: 75 e8 jne 80103ba0 <scheduler+0x20>
80103bb8: b8 d4 2d 11 80 mov $0x80112dd4,%eax
80103bbd: eb 0d jmp 80103bcc <scheduler+0x4c>
80103bbf: 90 nop
continue;
highP = p;
// choose one with lowest length_of_job
for(p1 = ptable.proc; p1 < &ptable.proc[NPROC]; p1++){
80103bc0: 05 9c 00 00 00 add $0x9c,%eax
80103bc5: 3d d4 54 11 80 cmp $0x801154d4,%eax
80103bca: 74 21 je 80103bed <scheduler+0x6d>
if(p1->state != RUNNABLE)
80103bcc: 83 78 0c 03 cmpl $0x3,0xc(%eax)
80103bd0: 75 ee jne 80103bc0 <scheduler+0x40>
80103bd2: 8b 90 8c 00 00 00 mov 0x8c(%eax),%edx
80103bd8: 39 93 8c 00 00 00 cmp %edx,0x8c(%ebx)
80103bde: 0f 4f d8 cmovg %eax,%ebx
for(p = ptable.proc ; p < &ptable.proc[NPROC]; p++){
if(p->state != RUNNABLE)
continue;
highP = p;
// choose one with lowest length_of_job
for(p1 = ptable.proc; p1 < &ptable.proc[NPROC]; p1++){
80103be1: 05 9c 00 00 00 add $0x9c,%eax
80103be6: 3d d4 54 11 80 cmp $0x801154d4,%eax
80103beb: 75 df jne 80103bcc <scheduler+0x4c>
if ( highP->length_of_job > p1->length_of_job ) // larger length_of_job, lower priorty
highP = p1;
}
p = highP;
proc = p;
switchuvm(p);
80103bed: 89 1c 24 mov %ebx,(%esp)
continue;
if ( highP->length_of_job > p1->length_of_job ) // larger length_of_job, lower priorty
highP = p1;
}
p = highP;
proc = p;
80103bf0: 65 89 1d 04 00 00 00 mov %ebx,%gs:0x4
switchuvm(p);
80103bf7: e8 14 2e 00 00 call 80106a10 <switchuvm>
p->state = RUNNING;
cprintf("\n Scheduler :: Process %s with pid %d running with length as %d \n", p->name, p->pid, p->length_of_job);
80103bfc: 8b 83 8c 00 00 00 mov 0x8c(%ebx),%eax
highP = p1;
}
p = highP;
proc = p;
switchuvm(p);
p->state = RUNNING;
80103c02: c7 43 0c 04 00 00 00 movl $0x4,0xc(%ebx)
cprintf("\n Scheduler :: Process %s with pid %d running with length as %d \n", p->name, p->pid, p->length_of_job);
80103c09: 89 44 24 0c mov %eax,0xc(%esp)
80103c0d: 8b 43 10 mov 0x10(%ebx),%eax
80103c10: c7 04 24 1c 76 10 80 movl $0x8010761c,(%esp)
80103c17: 89 44 24 08 mov %eax,0x8(%esp)
80103c1b: 8d 43 6c lea 0x6c(%ebx),%eax
// Enable interrupts on this processor.
sti();
struct proc *highP = 0;
// Looking for runnable process
acquire(&ptable.lock);
for(p = ptable.proc ; p < &ptable.proc[NPROC]; p++){
80103c1e: 81 c3 9c 00 00 00 add $0x9c,%ebx
}
p = highP;
proc = p;
switchuvm(p);
p->state = RUNNING;
cprintf("\n Scheduler :: Process %s with pid %d running with length as %d \n", p->name, p->pid, p->length_of_job);
80103c24: 89 44 24 04 mov %eax,0x4(%esp)
80103c28: e8 23 ca ff ff call 80100650 <cprintf>
swtch(&cpu->scheduler, p->context);
80103c2d: 8b 43 80 mov -0x80(%ebx),%eax
80103c30: 89 44 24 04 mov %eax,0x4(%esp)
80103c34: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80103c3a: 83 c0 04 add $0x4,%eax
80103c3d: 89 04 24 mov %eax,(%esp)
80103c40: e8 36 0b 00 00 call 8010477b <swtch>
switchkvm();
80103c45: e8 a6 2d 00 00 call 801069f0 <switchkvm>
// Enable interrupts on this processor.
sti();
struct proc *highP = 0;
// Looking for runnable process
acquire(&ptable.lock);
for(p = ptable.proc ; p < &ptable.proc[NPROC]; p++){
80103c4a: 81 fb d4 54 11 80 cmp $0x801154d4,%ebx
swtch(&cpu->scheduler, p->context);
switchkvm();
// Process is done running for now.
// It should have changed its p->state before coming back.
proc = 0;
80103c50: 65 c7 05 04 00 00 00 movl $0x0,%gs:0x4
80103c57: 00 00 00 00
// Enable interrupts on this processor.
sti();
struct proc *highP = 0;
// Looking for runnable process
acquire(&ptable.lock);
for(p = ptable.proc ; p < &ptable.proc[NPROC]; p++){
80103c5b: 0f 82 51 ff ff ff jb 80103bb2 <scheduler+0x32>
// Process is done running for now.
// It should have changed its p->state before coming back.
proc = 0;
}
release(&ptable.lock);
80103c61: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103c68: e8 63 08 00 00 call 801044d0 <release>
}
80103c6d: e9 15 ff ff ff jmp 80103b87 <scheduler+0x7>
80103c72: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80103c79: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80103c80 <sched>:
// be proc->intena and proc->ncli, but that would
// break in the few places where a lock is held but
// there's no process.
void
sched(void)
{
80103c80: 55 push %ebp
80103c81: 89 e5 mov %esp,%ebp
80103c83: 53 push %ebx
80103c84: 83 ec 14 sub $0x14,%esp
int intena;
if(!holding(&ptable.lock))
80103c87: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103c8e: e8 9d 07 00 00 call 80104430 <holding>
80103c93: 85 c0 test %eax,%eax
80103c95: 74 4d je 80103ce4 <sched+0x64>
panic("sched ptable.lock");
if(cpu->ncli != 1)
80103c97: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80103c9d: 83 b8 ac 00 00 00 01 cmpl $0x1,0xac(%eax)
80103ca4: 75 62 jne 80103d08 <sched+0x88>
panic("sched locks");
if(proc->state == RUNNING)
80103ca6: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
80103cad: 83 7a 0c 04 cmpl $0x4,0xc(%edx)
80103cb1: 74 49 je 80103cfc <sched+0x7c>
static inline uint
readeflags(void)
{
uint eflags;
asm volatile("pushfl; popl %0" : "=r" (eflags));
80103cb3: 9c pushf
80103cb4: 59 pop %ecx
panic("sched running");
if(readeflags()&FL_IF)
80103cb5: 80 e5 02 and $0x2,%ch
80103cb8: 75 36 jne 80103cf0 <sched+0x70>
panic("sched interruptible");
intena = cpu->intena;
80103cba: 8b 98 b0 00 00 00 mov 0xb0(%eax),%ebx
swtch(&proc->context, cpu->scheduler);
80103cc0: 83 c2 1c add $0x1c,%edx
80103cc3: 8b 40 04 mov 0x4(%eax),%eax
80103cc6: 89 14 24 mov %edx,(%esp)
80103cc9: 89 44 24 04 mov %eax,0x4(%esp)
80103ccd: e8 a9 0a 00 00 call 8010477b <swtch>
cpu->intena = intena;
80103cd2: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80103cd8: 89 98 b0 00 00 00 mov %ebx,0xb0(%eax)
}
80103cde: 83 c4 14 add $0x14,%esp
80103ce1: 5b pop %ebx
80103ce2: 5d pop %ebp
80103ce3: c3 ret
sched(void)
{
int intena;
if(!holding(&ptable.lock))
panic("sched ptable.lock");
80103ce4: c7 04 24 4f 75 10 80 movl $0x8010754f,(%esp)
80103ceb: e8 70 c6 ff ff call 80100360 <panic>
if(cpu->ncli != 1)
panic("sched locks");
if(proc->state == RUNNING)
panic("sched running");
if(readeflags()&FL_IF)
panic("sched interruptible");
80103cf0: c7 04 24 7b 75 10 80 movl $0x8010757b,(%esp)
80103cf7: e8 64 c6 ff ff call 80100360 <panic>
if(!holding(&ptable.lock))
panic("sched ptable.lock");
if(cpu->ncli != 1)
panic("sched locks");
if(proc->state == RUNNING)
panic("sched running");
80103cfc: c7 04 24 6d 75 10 80 movl $0x8010756d,(%esp)
80103d03: e8 58 c6 ff ff call 80100360 <panic>
int intena;
if(!holding(&ptable.lock))
panic("sched ptable.lock");
if(cpu->ncli != 1)
panic("sched locks");
80103d08: c7 04 24 61 75 10 80 movl $0x80107561,(%esp)
80103d0f: e8 4c c6 ff ff call 80100360 <panic>
80103d14: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80103d1a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80103d20 <exit>:
// Exit the current process. Does not return.
// An exited process remains in the zombie state
// until its parent calls wait() to find out it exited.
void
exit(void)
{
80103d20: 55 push %ebp
80103d21: 89 e5 mov %esp,%ebp
80103d23: 56 push %esi
80103d24: 53 push %ebx
struct proc *p;
int fd;
if(proc == initproc)
80103d25: 31 db xor %ebx,%ebx
// Exit the current process. Does not return.
// An exited process remains in the zombie state
// until its parent calls wait() to find out it exited.
void
exit(void)
{
80103d27: 83 ec 10 sub $0x10,%esp
struct proc *p;
int fd;
if(proc == initproc)
80103d2a: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
80103d31: 3b 15 bc a5 10 80 cmp 0x8010a5bc,%edx
80103d37: 0f 84 0b 01 00 00 je 80103e48 <exit+0x128>
80103d3d: 8d 76 00 lea 0x0(%esi),%esi
panic("init exiting");
// Close all open files.
for(fd = 0; fd < NOFILE; fd++){
if(proc->ofile[fd]){
80103d40: 8d 73 08 lea 0x8(%ebx),%esi
80103d43: 8b 44 b2 08 mov 0x8(%edx,%esi,4),%eax
80103d47: 85 c0 test %eax,%eax
80103d49: 74 17 je 80103d62 <exit+0x42>
fileclose(proc->ofile[fd]);
80103d4b: 89 04 24 mov %eax,(%esp)
80103d4e: e8 dd d0 ff ff call 80100e30 <fileclose>
proc->ofile[fd] = 0;
80103d53: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
80103d5a: c7 44 b2 08 00 00 00 movl $0x0,0x8(%edx,%esi,4)
80103d61: 00
if(proc == initproc)
panic("init exiting");
// Close all open files.
for(fd = 0; fd < NOFILE; fd++){
80103d62: 83 c3 01 add $0x1,%ebx
80103d65: 83 fb 10 cmp $0x10,%ebx
80103d68: 75 d6 jne 80103d40 <exit+0x20>
fileclose(proc->ofile[fd]);
proc->ofile[fd] = 0;
}
}
begin_op();
80103d6a: e8 21 ee ff ff call 80102b90 <begin_op>
iput(proc->cwd);
80103d6f: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80103d75: 8b 40 68 mov 0x68(%eax),%eax
80103d78: 89 04 24 mov %eax,(%esp)
80103d7b: e8 50 da ff ff call 801017d0 <iput>
end_op();
80103d80: e8 7b ee ff ff call 80102c00 <end_op>
proc->cwd = 0;
80103d85: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80103d8b: c7 40 68 00 00 00 00 movl $0x0,0x68(%eax)
acquire(&ptable.lock);
80103d92: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103d99: e8 02 06 00 00 call 801043a0 <acquire>
// Parent might be sleeping in wait().
wakeup1(proc->parent);
80103d9e: 65 8b 0d 04 00 00 00 mov %gs:0x4,%ecx
static void
wakeup1(void *chan)
{
struct proc *p;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80103da5: b8 d4 2d 11 80 mov $0x80112dd4,%eax
proc->cwd = 0;
acquire(&ptable.lock);
// Parent might be sleeping in wait().
wakeup1(proc->parent);
80103daa: 8b 51 14 mov 0x14(%ecx),%edx
80103dad: eb 0d jmp 80103dbc <exit+0x9c>
80103daf: 90 nop
static void
wakeup1(void *chan)
{
struct proc *p;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80103db0: 05 9c 00 00 00 add $0x9c,%eax
80103db5: 3d d4 54 11 80 cmp $0x801154d4,%eax
80103dba: 74 1e je 80103dda <exit+0xba>
if(p->state == SLEEPING && p->chan == chan)
80103dbc: 83 78 0c 02 cmpl $0x2,0xc(%eax)
80103dc0: 75 ee jne 80103db0 <exit+0x90>
80103dc2: 3b 50 20 cmp 0x20(%eax),%edx
80103dc5: 75 e9 jne 80103db0 <exit+0x90>
p->state = RUNNABLE;
80103dc7: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
static void
wakeup1(void *chan)
{
struct proc *p;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80103dce: 05 9c 00 00 00 add $0x9c,%eax
80103dd3: 3d d4 54 11 80 cmp $0x801154d4,%eax
80103dd8: 75 e2 jne 80103dbc <exit+0x9c>
wakeup1(proc->parent);
// Pass abandoned children to init.
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if(p->parent == proc){
p->parent = initproc;
80103dda: 8b 1d bc a5 10 80 mov 0x8010a5bc,%ebx
80103de0: ba d4 2d 11 80 mov $0x80112dd4,%edx
80103de5: eb 0f jmp 80103df6 <exit+0xd6>
80103de7: 90 nop
// Parent might be sleeping in wait().
wakeup1(proc->parent);
// Pass abandoned children to init.
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103de8: 81 c2 9c 00 00 00 add $0x9c,%edx
80103dee: 81 fa d4 54 11 80 cmp $0x801154d4,%edx
80103df4: 74 3a je 80103e30 <exit+0x110>
if(p->parent == proc){
80103df6: 3b 4a 14 cmp 0x14(%edx),%ecx
80103df9: 75 ed jne 80103de8 <exit+0xc8>
p->parent = initproc;
if(p->state == ZOMBIE)
80103dfb: 83 7a 0c 05 cmpl $0x5,0xc(%edx)
wakeup1(proc->parent);
// Pass abandoned children to init.
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if(p->parent == proc){
p->parent = initproc;
80103dff: 89 5a 14 mov %ebx,0x14(%edx)
if(p->state == ZOMBIE)
80103e02: 75 e4 jne 80103de8 <exit+0xc8>
80103e04: b8 d4 2d 11 80 mov $0x80112dd4,%eax
80103e09: eb 11 jmp 80103e1c <exit+0xfc>
80103e0b: 90 nop
80103e0c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
static void
wakeup1(void *chan)
{
struct proc *p;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80103e10: 05 9c 00 00 00 add $0x9c,%eax
80103e15: 3d d4 54 11 80 cmp $0x801154d4,%eax
80103e1a: 74 cc je 80103de8 <exit+0xc8>
if(p->state == SLEEPING && p->chan == chan)
80103e1c: 83 78 0c 02 cmpl $0x2,0xc(%eax)
80103e20: 75 ee jne 80103e10 <exit+0xf0>
80103e22: 3b 58 20 cmp 0x20(%eax),%ebx
80103e25: 75 e9 jne 80103e10 <exit+0xf0>
p->state = RUNNABLE;
80103e27: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
80103e2e: eb e0 jmp 80103e10 <exit+0xf0>
wakeup1(initproc);
}
}
// Jump into the scheduler, never to return.
proc->state = ZOMBIE;
80103e30: c7 41 0c 05 00 00 00 movl $0x5,0xc(%ecx)
sched();
80103e37: e8 44 fe ff ff call 80103c80 <sched>
panic("zombie exit");
80103e3c: c7 04 24 9c 75 10 80 movl $0x8010759c,(%esp)
80103e43: e8 18 c5 ff ff call 80100360 <panic>
{
struct proc *p;
int fd;
if(proc == initproc)
panic("init exiting");
80103e48: c7 04 24 8f 75 10 80 movl $0x8010758f,(%esp)
80103e4f: e8 0c c5 ff ff call 80100360 <panic>
80103e54: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80103e5a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80103e60 <yield>:
}
// Give up the CPU for one scheduling round.
void
yield(void)
{
80103e60: 55 push %ebp
80103e61: 89 e5 mov %esp,%ebp
80103e63: 83 ec 18 sub $0x18,%esp
acquire(&ptable.lock); //DOC: yieldlock
80103e66: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103e6d: e8 2e 05 00 00 call 801043a0 <acquire>
proc->state = RUNNABLE;
80103e72: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80103e78: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
sched();
80103e7f: e8 fc fd ff ff call 80103c80 <sched>
release(&ptable.lock);
80103e84: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103e8b: e8 40 06 00 00 call 801044d0 <release>
}
80103e90: c9 leave
80103e91: c3 ret
80103e92: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80103e99: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80103ea0 <sleep>:
// Atomically release lock and sleep on chan.
// Reacquires lock when awakened.
void
sleep(void *chan, struct spinlock *lk)
{
80103ea0: 55 push %ebp
80103ea1: 89 e5 mov %esp,%ebp
80103ea3: 56 push %esi
80103ea4: 53 push %ebx
80103ea5: 83 ec 10 sub $0x10,%esp
if(proc == 0)
80103ea8: 65 a1 04 00 00 00 mov %gs:0x4,%eax
// Atomically release lock and sleep on chan.
// Reacquires lock when awakened.
void
sleep(void *chan, struct spinlock *lk)
{
80103eae: 8b 75 08 mov 0x8(%ebp),%esi
80103eb1: 8b 5d 0c mov 0xc(%ebp),%ebx
if(proc == 0)
80103eb4: 85 c0 test %eax,%eax
80103eb6: 0f 84 8b 00 00 00 je 80103f47 <sleep+0xa7>
panic("sleep");
if(lk == 0)
80103ebc: 85 db test %ebx,%ebx
80103ebe: 74 7b je 80103f3b <sleep+0x9b>
// change p->state and then call sched.
// Once we hold ptable.lock, we can be
// guaranteed that we won't miss any wakeup
// (wakeup runs with ptable.lock locked),
// so it's okay to release lk.
if(lk != &ptable.lock){ //DOC: sleeplock0
80103ec0: 81 fb a0 2d 11 80 cmp $0x80112da0,%ebx
80103ec6: 74 50 je 80103f18 <sleep+0x78>
acquire(&ptable.lock); //DOC: sleeplock1
80103ec8: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103ecf: e8 cc 04 00 00 call 801043a0 <acquire>
release(lk);
80103ed4: 89 1c 24 mov %ebx,(%esp)
80103ed7: e8 f4 05 00 00 call 801044d0 <release>
}
// Go to sleep.
proc->chan = chan;
80103edc: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80103ee2: 89 70 20 mov %esi,0x20(%eax)
proc->state = SLEEPING;
80103ee5: c7 40 0c 02 00 00 00 movl $0x2,0xc(%eax)
sched();
80103eec: e8 8f fd ff ff call 80103c80 <sched>
// Tidy up.
proc->chan = 0;
80103ef1: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80103ef7: c7 40 20 00 00 00 00 movl $0x0,0x20(%eax)
// Reacquire original lock.
if(lk != &ptable.lock){ //DOC: sleeplock2
release(&ptable.lock);
80103efe: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103f05: e8 c6 05 00 00 call 801044d0 <release>
acquire(lk);
80103f0a: 89 5d 08 mov %ebx,0x8(%ebp)
}
}
80103f0d: 83 c4 10 add $0x10,%esp
80103f10: 5b pop %ebx
80103f11: 5e pop %esi
80103f12: 5d pop %ebp
proc->chan = 0;
// Reacquire original lock.
if(lk != &ptable.lock){ //DOC: sleeplock2
release(&ptable.lock);
acquire(lk);
80103f13: e9 88 04 00 00 jmp 801043a0 <acquire>
acquire(&ptable.lock); //DOC: sleeplock1
release(lk);
}
// Go to sleep.
proc->chan = chan;
80103f18: 89 70 20 mov %esi,0x20(%eax)
proc->state = SLEEPING;
80103f1b: c7 40 0c 02 00 00 00 movl $0x2,0xc(%eax)
sched();
80103f22: e8 59 fd ff ff call 80103c80 <sched>
// Tidy up.
proc->chan = 0;
80103f27: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80103f2d: c7 40 20 00 00 00 00 movl $0x0,0x20(%eax)
// Reacquire original lock.
if(lk != &ptable.lock){ //DOC: sleeplock2
release(&ptable.lock);
acquire(lk);
}
}
80103f34: 83 c4 10 add $0x10,%esp
80103f37: 5b pop %ebx
80103f38: 5e pop %esi
80103f39: 5d pop %ebp
80103f3a: c3 ret
{
if(proc == 0)
panic("sleep");
if(lk == 0)
panic("sleep without lk");
80103f3b: c7 04 24 ae 75 10 80 movl $0x801075ae,(%esp)
80103f42: e8 19 c4 ff ff call 80100360 <panic>
// Reacquires lock when awakened.
void
sleep(void *chan, struct spinlock *lk)
{
if(proc == 0)
panic("sleep");
80103f47: c7 04 24 a8 75 10 80 movl $0x801075a8,(%esp)
80103f4e: e8 0d c4 ff ff call 80100360 <panic>
80103f53: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80103f59: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80103f60 <wait>:
// Wait for a child process to exit and return its pid.
// Return -1 if this process has no children.
int
wait(void)
{
80103f60: 55 push %ebp
80103f61: 89 e5 mov %esp,%ebp
80103f63: 56 push %esi
80103f64: 53 push %ebx
80103f65: 83 ec 10 sub $0x10,%esp
struct proc *p;
int havekids, pid;
acquire(&ptable.lock);
80103f68: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103f6f: e8 2c 04 00 00 call 801043a0 <acquire>
80103f74: 65 a1 04 00 00 00 mov %gs:0x4,%eax
for(;;){
// Scan through table looking for exited children.
havekids = 0;
80103f7a: 31 d2 xor %edx,%edx
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103f7c: bb d4 2d 11 80 mov $0x80112dd4,%ebx
80103f81: eb 13 jmp 80103f96 <wait+0x36>
80103f83: 90 nop
80103f84: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80103f88: 81 c3 9c 00 00 00 add $0x9c,%ebx
80103f8e: 81 fb d4 54 11 80 cmp $0x801154d4,%ebx
80103f94: 74 22 je 80103fb8 <wait+0x58>
if(p->parent != proc)
80103f96: 39 43 14 cmp %eax,0x14(%ebx)
80103f99: 75 ed jne 80103f88 <wait+0x28>
continue;
havekids = 1;
if(p->state == ZOMBIE){
80103f9b: 83 7b 0c 05 cmpl $0x5,0xc(%ebx)
80103f9f: 74 34 je 80103fd5 <wait+0x75>
acquire(&ptable.lock);
for(;;){
// Scan through table looking for exited children.
havekids = 0;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103fa1: 81 c3 9c 00 00 00 add $0x9c,%ebx
if(p->parent != proc)
continue;
havekids = 1;
80103fa7: ba 01 00 00 00 mov $0x1,%edx
acquire(&ptable.lock);
for(;;){
// Scan through table looking for exited children.
havekids = 0;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103fac: 81 fb d4 54 11 80 cmp $0x801154d4,%ebx
80103fb2: 75 e2 jne 80103f96 <wait+0x36>
80103fb4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
return pid;
}
}
// No point waiting if we don't have any children.
if(!havekids || proc->killed){
80103fb8: 85 d2 test %edx,%edx
80103fba: 74 6e je 8010402a <wait+0xca>
80103fbc: 8b 50 24 mov 0x24(%eax),%edx
80103fbf: 85 d2 test %edx,%edx
80103fc1: 75 67 jne 8010402a <wait+0xca>
release(&ptable.lock);
return -1;
}
// Wait for children to exit. (See wakeup1 call in proc_exit.)
sleep(proc, &ptable.lock); //DOC: wait-sleep
80103fc3: c7 44 24 04 a0 2d 11 movl $0x80112da0,0x4(%esp)
80103fca: 80
80103fcb: 89 04 24 mov %eax,(%esp)
80103fce: e8 cd fe ff ff call 80103ea0 <sleep>
}
80103fd3: eb 9f jmp 80103f74 <wait+0x14>
continue;
havekids = 1;
if(p->state == ZOMBIE){
// Found one.
pid = p->pid;
kfree(p->kstack);
80103fd5: 8b 43 08 mov 0x8(%ebx),%eax
if(p->parent != proc)
continue;
havekids = 1;
if(p->state == ZOMBIE){
// Found one.
pid = p->pid;
80103fd8: 8b 73 10 mov 0x10(%ebx),%esi
kfree(p->kstack);
80103fdb: 89 04 24 mov %eax,(%esp)
80103fde: e8 0d e3 ff ff call 801022f0 <kfree>
p->kstack = 0;
freevm(p->pgdir);
80103fe3: 8b 43 04 mov 0x4(%ebx),%eax
havekids = 1;
if(p->state == ZOMBIE){
// Found one.
pid = p->pid;
kfree(p->kstack);
p->kstack = 0;
80103fe6: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx)
freevm(p->pgdir);
80103fed: 89 04 24 mov %eax,(%esp)
80103ff0: e8 3b 2d 00 00 call 80106d30 <freevm>
p->pid = 0;
p->parent = 0;
p->name[0] = 0;
p->killed = 0;
p->state = UNUSED;
release(&ptable.lock);
80103ff5: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
// Found one.
pid = p->pid;
kfree(p->kstack);
p->kstack = 0;
freevm(p->pgdir);
p->pid = 0;
80103ffc: c7 43 10 00 00 00 00 movl $0x0,0x10(%ebx)
p->parent = 0;
80104003: c7 43 14 00 00 00 00 movl $0x0,0x14(%ebx)
p->name[0] = 0;
8010400a: c6 43 6c 00 movb $0x0,0x6c(%ebx)
p->killed = 0;
8010400e: c7 43 24 00 00 00 00 movl $0x0,0x24(%ebx)
p->state = UNUSED;
80104015: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx)
release(&ptable.lock);
8010401c: e8 af 04 00 00 call 801044d0 <release>
}
// Wait for children to exit. (See wakeup1 call in proc_exit.)
sleep(proc, &ptable.lock); //DOC: wait-sleep
}
}
80104021: 83 c4 10 add $0x10,%esp
p->parent = 0;
p->name[0] = 0;
p->killed = 0;
p->state = UNUSED;
release(&ptable.lock);
return pid;
80104024: 89 f0 mov %esi,%eax
}
// Wait for children to exit. (See wakeup1 call in proc_exit.)
sleep(proc, &ptable.lock); //DOC: wait-sleep
}
}
80104026: 5b pop %ebx
80104027: 5e pop %esi
80104028: 5d pop %ebp
80104029: c3 ret
}
}
// No point waiting if we don't have any children.
if(!havekids || proc->killed){
release(&ptable.lock);
8010402a: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80104031: e8 9a 04 00 00 call 801044d0 <release>
}
// Wait for children to exit. (See wakeup1 call in proc_exit.)
sleep(proc, &ptable.lock); //DOC: wait-sleep
}
}
80104036: 83 c4 10 add $0x10,%esp
}
// No point waiting if we don't have any children.
if(!havekids || proc->killed){
release(&ptable.lock);
return -1;
80104039: b8 ff ff ff ff mov $0xffffffff,%eax
}
// Wait for children to exit. (See wakeup1 call in proc_exit.)
sleep(proc, &ptable.lock); //DOC: wait-sleep
}
}
8010403e: 5b pop %ebx
8010403f: 5e pop %esi
80104040: 5d pop %ebp
80104041: c3 ret
80104042: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80104049: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104050 <wakeup>:
}
// Wake up all processes sleeping on chan.
void
wakeup(void *chan)
{
80104050: 55 push %ebp
80104051: 89 e5 mov %esp,%ebp
80104053: 53 push %ebx
80104054: 83 ec 14 sub $0x14,%esp
80104057: 8b 5d 08 mov 0x8(%ebp),%ebx
acquire(&ptable.lock);
8010405a: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80104061: e8 3a 03 00 00 call 801043a0 <acquire>
static void
wakeup1(void *chan)
{
struct proc *p;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80104066: b8 d4 2d 11 80 mov $0x80112dd4,%eax
8010406b: eb 0f jmp 8010407c <wakeup+0x2c>
8010406d: 8d 76 00 lea 0x0(%esi),%esi
80104070: 05 9c 00 00 00 add $0x9c,%eax
80104075: 3d d4 54 11 80 cmp $0x801154d4,%eax
8010407a: 74 24 je 801040a0 <wakeup+0x50>
if(p->state == SLEEPING && p->chan == chan)
8010407c: 83 78 0c 02 cmpl $0x2,0xc(%eax)
80104080: 75 ee jne 80104070 <wakeup+0x20>
80104082: 3b 58 20 cmp 0x20(%eax),%ebx
80104085: 75 e9 jne 80104070 <wakeup+0x20>
p->state = RUNNABLE;
80104087: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
static void
wakeup1(void *chan)
{
struct proc *p;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
8010408e: 05 9c 00 00 00 add $0x9c,%eax
80104093: 3d d4 54 11 80 cmp $0x801154d4,%eax
80104098: 75 e2 jne 8010407c <wakeup+0x2c>
8010409a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
void
wakeup(void *chan)
{
acquire(&ptable.lock);
wakeup1(chan);
release(&ptable.lock);
801040a0: c7 45 08 a0 2d 11 80 movl $0x80112da0,0x8(%ebp)
}
801040a7: 83 c4 14 add $0x14,%esp
801040aa: 5b pop %ebx
801040ab: 5d pop %ebp
void
wakeup(void *chan)
{
acquire(&ptable.lock);
wakeup1(chan);
release(&ptable.lock);
801040ac: e9 1f 04 00 00 jmp 801044d0 <release>
801040b1: eb 0d jmp 801040c0 <kill>
801040b3: 90 nop
801040b4: 90 nop
801040b5: 90 nop
801040b6: 90 nop
801040b7: 90 nop
801040b8: 90 nop
801040b9: 90 nop
801040ba: 90 nop
801040bb: 90 nop
801040bc: 90 nop
801040bd: 90 nop
801040be: 90 nop
801040bf: 90 nop
801040c0 <kill>:
// Kill the process with the given pid.
// Process won't exit until it returns
// to user space (see trap in trap.c).
int
kill(int pid)
{
801040c0: 55 push %ebp
801040c1: 89 e5 mov %esp,%ebp
801040c3: 53 push %ebx
801040c4: 83 ec 14 sub $0x14,%esp
801040c7: 8b 5d 08 mov 0x8(%ebp),%ebx
struct proc *p;
acquire(&ptable.lock);
801040ca: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
801040d1: e8 ca 02 00 00 call 801043a0 <acquire>
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
801040d6: b8 d4 2d 11 80 mov $0x80112dd4,%eax
801040db: eb 0f jmp 801040ec <kill+0x2c>
801040dd: 8d 76 00 lea 0x0(%esi),%esi
801040e0: 05 9c 00 00 00 add $0x9c,%eax
801040e5: 3d d4 54 11 80 cmp $0x801154d4,%eax
801040ea: 74 3c je 80104128 <kill+0x68>
if(p->pid == pid){
801040ec: 39 58 10 cmp %ebx,0x10(%eax)
801040ef: 75 ef jne 801040e0 <kill+0x20>
p->killed = 1;
// Wake process from sleep if necessary.
if(p->state == SLEEPING)
801040f1: 83 78 0c 02 cmpl $0x2,0xc(%eax)
struct proc *p;
acquire(&ptable.lock);
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if(p->pid == pid){
p->killed = 1;
801040f5: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax)
// Wake process from sleep if necessary.
if(p->state == SLEEPING)
801040fc: 74 1a je 80104118 <kill+0x58>
p->state = RUNNABLE;
release(&ptable.lock);
801040fe: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80104105: e8 c6 03 00 00 call 801044d0 <release>
return 0;
}
}
release(&ptable.lock);
return -1;
}
8010410a: 83 c4 14 add $0x14,%esp
p->killed = 1;
// Wake process from sleep if necessary.
if(p->state == SLEEPING)
p->state = RUNNABLE;
release(&ptable.lock);
return 0;
8010410d: 31 c0 xor %eax,%eax
}
}
release(&ptable.lock);
return -1;
}
8010410f: 5b pop %ebx
80104110: 5d pop %ebp
80104111: c3 ret
80104112: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if(p->pid == pid){
p->killed = 1;
// Wake process from sleep if necessary.
if(p->state == SLEEPING)
p->state = RUNNABLE;
80104118: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
8010411f: eb dd jmp 801040fe <kill+0x3e>
80104121: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
release(&ptable.lock);
return 0;
}
}
release(&ptable.lock);
80104128: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
8010412f: e8 9c 03 00 00 call 801044d0 <release>
return -1;
}
80104134: 83 c4 14 add $0x14,%esp
release(&ptable.lock);
return 0;
}
}
release(&ptable.lock);
return -1;
80104137: b8 ff ff ff ff mov $0xffffffff,%eax
}
8010413c: 5b pop %ebx
8010413d: 5d pop %ebp
8010413e: c3 ret
8010413f: 90 nop
80104140 <procdump>:
// Print a process listing to console. For debugging.
// Runs when user types ^P on console.
// No lock to avoid wedging a stuck machine further.
void
procdump(void)
{
80104140: 55 push %ebp
80104141: 89 e5 mov %esp,%ebp
80104143: 57 push %edi
80104144: 56 push %esi
80104145: 53 push %ebx
80104146: bb 40 2e 11 80 mov $0x80112e40,%ebx
8010414b: 83 ec 4c sub $0x4c,%esp
8010414e: 8d 75 e8 lea -0x18(%ebp),%esi
80104151: eb 23 jmp 80104176 <procdump+0x36>
80104153: 90 nop
80104154: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(p->state == SLEEPING){
getcallerpcs((uint*)p->context->ebp+2, pc);
for(i=0; i<10 && pc[i] != 0; i++)
cprintf(" %p", pc[i]);
}
cprintf("\n");
80104158: c7 04 24 c6 74 10 80 movl $0x801074c6,(%esp)
8010415f: e8 ec c4 ff ff call 80100650 <cprintf>
80104164: 81 c3 9c 00 00 00 add $0x9c,%ebx
int i;
struct proc *p;
char *state;
uint pc[10];
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
8010416a: 81 fb 40 55 11 80 cmp $0x80115540,%ebx
80104170: 0f 84 8a 00 00 00 je 80104200 <procdump+0xc0>
if(p->state == UNUSED)
80104176: 8b 43 a0 mov -0x60(%ebx),%eax
80104179: 85 c0 test %eax,%eax
8010417b: 74 e7 je 80104164 <procdump+0x24>
continue;
if(p->state >= 0 && p->state < NELEM(states) && states[p->state])
8010417d: 83 f8 05 cmp $0x5,%eax
state = states[p->state];
else
state = "???";
80104180: ba bf 75 10 80 mov $0x801075bf,%edx
uint pc[10];
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if(p->state == UNUSED)
continue;
if(p->state >= 0 && p->state < NELEM(states) && states[p->state])
80104185: 77 11 ja 80104198 <procdump+0x58>
80104187: 8b 14 85 60 76 10 80 mov -0x7fef89a0(,%eax,4),%edx
state = states[p->state];
else
state = "???";
8010418e: b8 bf 75 10 80 mov $0x801075bf,%eax
80104193: 85 d2 test %edx,%edx
80104195: 0f 44 d0 cmove %eax,%edx
cprintf("%d %s %s", p->pid, state, p->name);
80104198: 8b 43 a4 mov -0x5c(%ebx),%eax
8010419b: 89 5c 24 0c mov %ebx,0xc(%esp)
8010419f: 89 54 24 08 mov %edx,0x8(%esp)
801041a3: c7 04 24 c3 75 10 80 movl $0x801075c3,(%esp)
801041aa: 89 44 24 04 mov %eax,0x4(%esp)
801041ae: e8 9d c4 ff ff call 80100650 <cprintf>
if(p->state == SLEEPING){
801041b3: 83 7b a0 02 cmpl $0x2,-0x60(%ebx)
801041b7: 75 9f jne 80104158 <procdump+0x18>
getcallerpcs((uint*)p->context->ebp+2, pc);
801041b9: 8d 45 c0 lea -0x40(%ebp),%eax
801041bc: 89 44 24 04 mov %eax,0x4(%esp)
801041c0: 8b 43 b0 mov -0x50(%ebx),%eax
801041c3: 8d 7d c0 lea -0x40(%ebp),%edi
801041c6: 8b 40 0c mov 0xc(%eax),%eax
801041c9: 83 c0 08 add $0x8,%eax
801041cc: 89 04 24 mov %eax,(%esp)
801041cf: e8 6c 01 00 00 call 80104340 <getcallerpcs>
801041d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(i=0; i<10 && pc[i] != 0; i++)
801041d8: 8b 17 mov (%edi),%edx
801041da: 85 d2 test %edx,%edx
801041dc: 0f 84 76 ff ff ff je 80104158 <procdump+0x18>
cprintf(" %p", pc[i]);
801041e2: 89 54 24 04 mov %edx,0x4(%esp)
801041e6: 83 c7 04 add $0x4,%edi
801041e9: c7 04 24 e9 6f 10 80 movl $0x80106fe9,(%esp)
801041f0: e8 5b c4 ff ff call 80100650 <cprintf>
else
state = "???";
cprintf("%d %s %s", p->pid, state, p->name);
if(p->state == SLEEPING){
getcallerpcs((uint*)p->context->ebp+2, pc);
for(i=0; i<10 && pc[i] != 0; i++)
801041f5: 39 f7 cmp %esi,%edi
801041f7: 75 df jne 801041d8 <procdump+0x98>
801041f9: e9 5a ff ff ff jmp 80104158 <procdump+0x18>
801041fe: 66 90 xchg %ax,%ax
cprintf(" %p", pc[i]);
}
cprintf("\n");
}
}
80104200: 83 c4 4c add $0x4c,%esp
80104203: 5b pop %ebx
80104204: 5e pop %esi
80104205: 5f pop %edi
80104206: 5d pop %ebp
80104207: c3 ret
80104208: 66 90 xchg %ax,%ax
8010420a: 66 90 xchg %ax,%ax
8010420c: 66 90 xchg %ax,%ax
8010420e: 66 90 xchg %ax,%ax
80104210 <initsleeplock>:
#include "spinlock.h"
#include "sleeplock.h"
void
initsleeplock(struct sleeplock *lk, char *name)
{
80104210: 55 push %ebp
80104211: 89 e5 mov %esp,%ebp
80104213: 53 push %ebx
80104214: 83 ec 14 sub $0x14,%esp
80104217: 8b 5d 08 mov 0x8(%ebp),%ebx
initlock(&lk->lk, "sleep lock");
8010421a: c7 44 24 04 78 76 10 movl $0x80107678,0x4(%esp)
80104221: 80
80104222: 8d 43 04 lea 0x4(%ebx),%eax
80104225: 89 04 24 mov %eax,(%esp)
80104228: e8 f3 00 00 00 call 80104320 <initlock>
lk->name = name;
8010422d: 8b 45 0c mov 0xc(%ebp),%eax
lk->locked = 0;
80104230: c7 03 00 00 00 00 movl $0x0,(%ebx)
lk->pid = 0;
80104236: c7 43 3c 00 00 00 00 movl $0x0,0x3c(%ebx)
void
initsleeplock(struct sleeplock *lk, char *name)
{
initlock(&lk->lk, "sleep lock");
lk->name = name;
8010423d: 89 43 38 mov %eax,0x38(%ebx)
lk->locked = 0;
lk->pid = 0;
}
80104240: 83 c4 14 add $0x14,%esp
80104243: 5b pop %ebx
80104244: 5d pop %ebp
80104245: c3 ret
80104246: 8d 76 00 lea 0x0(%esi),%esi
80104249: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104250 <acquiresleep>:
void
acquiresleep(struct sleeplock *lk)
{
80104250: 55 push %ebp
80104251: 89 e5 mov %esp,%ebp
80104253: 56 push %esi
80104254: 53 push %ebx
80104255: 83 ec 10 sub $0x10,%esp
80104258: 8b 5d 08 mov 0x8(%ebp),%ebx
acquire(&lk->lk);
8010425b: 8d 73 04 lea 0x4(%ebx),%esi
8010425e: 89 34 24 mov %esi,(%esp)
80104261: e8 3a 01 00 00 call 801043a0 <acquire>
while (lk->locked) {
80104266: 8b 13 mov (%ebx),%edx
80104268: 85 d2 test %edx,%edx
8010426a: 74 16 je 80104282 <acquiresleep+0x32>
8010426c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
sleep(lk, &lk->lk);
80104270: 89 74 24 04 mov %esi,0x4(%esp)
80104274: 89 1c 24 mov %ebx,(%esp)
80104277: e8 24 fc ff ff call 80103ea0 <sleep>
void
acquiresleep(struct sleeplock *lk)
{
acquire(&lk->lk);
while (lk->locked) {
8010427c: 8b 03 mov (%ebx),%eax
8010427e: 85 c0 test %eax,%eax
80104280: 75 ee jne 80104270 <acquiresleep+0x20>
sleep(lk, &lk->lk);
}
lk->locked = 1;
80104282: c7 03 01 00 00 00 movl $0x1,(%ebx)
lk->pid = proc->pid;
80104288: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010428e: 8b 40 10 mov 0x10(%eax),%eax
80104291: 89 43 3c mov %eax,0x3c(%ebx)
release(&lk->lk);
80104294: 89 75 08 mov %esi,0x8(%ebp)
}
80104297: 83 c4 10 add $0x10,%esp
8010429a: 5b pop %ebx
8010429b: 5e pop %esi
8010429c: 5d pop %ebp
while (lk->locked) {
sleep(lk, &lk->lk);
}
lk->locked = 1;
lk->pid = proc->pid;
release(&lk->lk);
8010429d: e9 2e 02 00 00 jmp 801044d0 <release>
801042a2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801042a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801042b0 <releasesleep>:
}
void
releasesleep(struct sleeplock *lk)
{
801042b0: 55 push %ebp
801042b1: 89 e5 mov %esp,%ebp
801042b3: 56 push %esi
801042b4: 53 push %ebx
801042b5: 83 ec 10 sub $0x10,%esp
801042b8: 8b 5d 08 mov 0x8(%ebp),%ebx
acquire(&lk->lk);
801042bb: 8d 73 04 lea 0x4(%ebx),%esi
801042be: 89 34 24 mov %esi,(%esp)
801042c1: e8 da 00 00 00 call 801043a0 <acquire>
lk->locked = 0;
801042c6: c7 03 00 00 00 00 movl $0x0,(%ebx)
lk->pid = 0;
801042cc: c7 43 3c 00 00 00 00 movl $0x0,0x3c(%ebx)
wakeup(lk);
801042d3: 89 1c 24 mov %ebx,(%esp)
801042d6: e8 75 fd ff ff call 80104050 <wakeup>
release(&lk->lk);
801042db: 89 75 08 mov %esi,0x8(%ebp)
}
801042de: 83 c4 10 add $0x10,%esp
801042e1: 5b pop %ebx
801042e2: 5e pop %esi
801042e3: 5d pop %ebp
{
acquire(&lk->lk);
lk->locked = 0;
lk->pid = 0;
wakeup(lk);
release(&lk->lk);
801042e4: e9 e7 01 00 00 jmp 801044d0 <release>
801042e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801042f0 <holdingsleep>:
}
int
holdingsleep(struct sleeplock *lk)
{
801042f0: 55 push %ebp
801042f1: 89 e5 mov %esp,%ebp
801042f3: 56 push %esi
801042f4: 53 push %ebx
801042f5: 83 ec 10 sub $0x10,%esp
801042f8: 8b 5d 08 mov 0x8(%ebp),%ebx
int r;
acquire(&lk->lk);
801042fb: 8d 73 04 lea 0x4(%ebx),%esi
801042fe: 89 34 24 mov %esi,(%esp)
80104301: e8 9a 00 00 00 call 801043a0 <acquire>
r = lk->locked;
80104306: 8b 1b mov (%ebx),%ebx
release(&lk->lk);
80104308: 89 34 24 mov %esi,(%esp)
8010430b: e8 c0 01 00 00 call 801044d0 <release>
return r;
}
80104310: 83 c4 10 add $0x10,%esp
80104313: 89 d8 mov %ebx,%eax
80104315: 5b pop %ebx
80104316: 5e pop %esi
80104317: 5d pop %ebp
80104318: c3 ret
80104319: 66 90 xchg %ax,%ax
8010431b: 66 90 xchg %ax,%ax
8010431d: 66 90 xchg %ax,%ax
8010431f: 90 nop
80104320 <initlock>:
#include "proc.h"
#include "spinlock.h"
void
initlock(struct spinlock *lk, char *name)
{
80104320: 55 push %ebp
80104321: 89 e5 mov %esp,%ebp
80104323: 8b 45 08 mov 0x8(%ebp),%eax
lk->name = name;
80104326: 8b 55 0c mov 0xc(%ebp),%edx
lk->locked = 0;
80104329: c7 00 00 00 00 00 movl $0x0,(%eax)
#include "spinlock.h"
void
initlock(struct spinlock *lk, char *name)
{
lk->name = name;
8010432f: 89 50 04 mov %edx,0x4(%eax)
lk->locked = 0;
lk->cpu = 0;
80104332: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
}
80104339: 5d pop %ebp
8010433a: c3 ret
8010433b: 90 nop
8010433c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80104340 <getcallerpcs>:
}
// Record the current call stack in pcs[] by following the %ebp chain.
void
getcallerpcs(void *v, uint pcs[])
{
80104340: 55 push %ebp
80104341: 89 e5 mov %esp,%ebp
uint *ebp;
int i;
ebp = (uint*)v - 2;
80104343: 8b 45 08 mov 0x8(%ebp),%eax
}
// Record the current call stack in pcs[] by following the %ebp chain.
void
getcallerpcs(void *v, uint pcs[])
{
80104346: 8b 4d 0c mov 0xc(%ebp),%ecx
80104349: 53 push %ebx
uint *ebp;
int i;
ebp = (uint*)v - 2;
8010434a: 8d 50 f8 lea -0x8(%eax),%edx
for(i = 0; i < 10; i++){
8010434d: 31 c0 xor %eax,%eax
8010434f: 90 nop
if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
80104350: 8d 9a 00 00 00 80 lea -0x80000000(%edx),%ebx
80104356: 81 fb fe ff ff 7f cmp $0x7ffffffe,%ebx
8010435c: 77 1a ja 80104378 <getcallerpcs+0x38>
break;
pcs[i] = ebp[1]; // saved %eip
8010435e: 8b 5a 04 mov 0x4(%edx),%ebx
80104361: 89 1c 81 mov %ebx,(%ecx,%eax,4)
{
uint *ebp;
int i;
ebp = (uint*)v - 2;
for(i = 0; i < 10; i++){
80104364: 83 c0 01 add $0x1,%eax
if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
break;
pcs[i] = ebp[1]; // saved %eip
ebp = (uint*)ebp[0]; // saved %ebp
80104367: 8b 12 mov (%edx),%edx
{
uint *ebp;
int i;
ebp = (uint*)v - 2;
for(i = 0; i < 10; i++){
80104369: 83 f8 0a cmp $0xa,%eax
8010436c: 75 e2 jne 80104350 <getcallerpcs+0x10>
pcs[i] = ebp[1]; // saved %eip
ebp = (uint*)ebp[0]; // saved %ebp
}
for(; i < 10; i++)
pcs[i] = 0;
}
8010436e: 5b pop %ebx
8010436f: 5d pop %ebp
80104370: c3 ret
80104371: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
break;
pcs[i] = ebp[1]; // saved %eip
ebp = (uint*)ebp[0]; // saved %ebp
}
for(; i < 10; i++)
pcs[i] = 0;
80104378: c7 04 81 00 00 00 00 movl $0x0,(%ecx,%eax,4)
if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
break;
pcs[i] = ebp[1]; // saved %eip
ebp = (uint*)ebp[0]; // saved %ebp
}
for(; i < 10; i++)
8010437f: 83 c0 01 add $0x1,%eax
80104382: 83 f8 0a cmp $0xa,%eax
80104385: 74 e7 je 8010436e <getcallerpcs+0x2e>
pcs[i] = 0;
80104387: c7 04 81 00 00 00 00 movl $0x0,(%ecx,%eax,4)
if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
break;
pcs[i] = ebp[1]; // saved %eip
ebp = (uint*)ebp[0]; // saved %ebp
}
for(; i < 10; i++)
8010438e: 83 c0 01 add $0x1,%eax
80104391: 83 f8 0a cmp $0xa,%eax
80104394: 75 e2 jne 80104378 <getcallerpcs+0x38>
80104396: eb d6 jmp 8010436e <getcallerpcs+0x2e>
80104398: 90 nop
80104399: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801043a0 <acquire>:
// Loops (spins) until the lock is acquired.
// Holding a lock for a long time may cause
// other CPUs to waste time spinning to acquire it.
void
acquire(struct spinlock *lk)
{
801043a0: 55 push %ebp
801043a1: 89 e5 mov %esp,%ebp
801043a3: 83 ec 18 sub $0x18,%esp
801043a6: 9c pushf
801043a7: 59 pop %ecx
}
static inline void
cli(void)
{
asm volatile("cli");
801043a8: fa cli
{
int eflags;
eflags = readeflags();
cli();
if(cpu->ncli == 0)
801043a9: 65 a1 00 00 00 00 mov %gs:0x0,%eax
801043af: 8b 90 ac 00 00 00 mov 0xac(%eax),%edx
801043b5: 85 d2 test %edx,%edx
801043b7: 75 0c jne 801043c5 <acquire+0x25>
cpu->intena = eflags & FL_IF;
801043b9: 81 e1 00 02 00 00 and $0x200,%ecx
801043bf: 89 88 b0 00 00 00 mov %ecx,0xb0(%eax)
cpu->ncli += 1;
801043c5: 83 c2 01 add $0x1,%edx
801043c8: 89 90 ac 00 00 00 mov %edx,0xac(%eax)
// other CPUs to waste time spinning to acquire it.
void
acquire(struct spinlock *lk)
{
pushcli(); // disable interrupts to avoid deadlock.
if(holding(lk))
801043ce: 8b 55 08 mov 0x8(%ebp),%edx
// Check whether this cpu is holding the lock.
int
holding(struct spinlock *lock)
{
return lock->locked && lock->cpu == cpu;
801043d1: 8b 0a mov (%edx),%ecx
801043d3: 85 c9 test %ecx,%ecx
801043d5: 74 05 je 801043dc <acquire+0x3c>
801043d7: 3b 42 08 cmp 0x8(%edx),%eax
801043da: 74 3e je 8010441a <acquire+0x7a>
xchg(volatile uint *addr, uint newval)
{
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
801043dc: b9 01 00 00 00 mov $0x1,%ecx
801043e1: eb 08 jmp 801043eb <acquire+0x4b>
801043e3: 90 nop
801043e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801043e8: 8b 55 08 mov 0x8(%ebp),%edx
801043eb: 89 c8 mov %ecx,%eax
801043ed: f0 87 02 lock xchg %eax,(%edx)
pushcli(); // disable interrupts to avoid deadlock.
if(holding(lk))
panic("acquire");
// The xchg is atomic.
while(xchg(&lk->locked, 1) != 0)
801043f0: 85 c0 test %eax,%eax
801043f2: 75 f4 jne 801043e8 <acquire+0x48>
;
// Tell the C compiler and the processor to not move loads or stores
// past this point, to ensure that the critical section's memory
// references happen after the lock is acquired.
__sync_synchronize();
801043f4: f0 83 0c 24 00 lock orl $0x0,(%esp)
// Record info about lock acquisition for debugging.
lk->cpu = cpu;
801043f9: 8b 45 08 mov 0x8(%ebp),%eax
801043fc: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
getcallerpcs(&lk, lk->pcs);
80104403: 83 c0 0c add $0xc,%eax
// past this point, to ensure that the critical section's memory
// references happen after the lock is acquired.
__sync_synchronize();
// Record info about lock acquisition for debugging.
lk->cpu = cpu;
80104406: 89 50 fc mov %edx,-0x4(%eax)
getcallerpcs(&lk, lk->pcs);
80104409: 89 44 24 04 mov %eax,0x4(%esp)
8010440d: 8d 45 08 lea 0x8(%ebp),%eax
80104410: 89 04 24 mov %eax,(%esp)
80104413: e8 28 ff ff ff call 80104340 <getcallerpcs>
}
80104418: c9 leave
80104419: c3 ret
void
acquire(struct spinlock *lk)
{
pushcli(); // disable interrupts to avoid deadlock.
if(holding(lk))
panic("acquire");
8010441a: c7 04 24 83 76 10 80 movl $0x80107683,(%esp)
80104421: e8 3a bf ff ff call 80100360 <panic>
80104426: 8d 76 00 lea 0x0(%esi),%esi
80104429: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104430 <holding>:
}
// Check whether this cpu is holding the lock.
int
holding(struct spinlock *lock)
{
80104430: 55 push %ebp
return lock->locked && lock->cpu == cpu;
80104431: 31 c0 xor %eax,%eax
}
// Check whether this cpu is holding the lock.
int
holding(struct spinlock *lock)
{
80104433: 89 e5 mov %esp,%ebp
80104435: 8b 55 08 mov 0x8(%ebp),%edx
return lock->locked && lock->cpu == cpu;
80104438: 8b 0a mov (%edx),%ecx
8010443a: 85 c9 test %ecx,%ecx
8010443c: 74 0f je 8010444d <holding+0x1d>
8010443e: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80104444: 39 42 08 cmp %eax,0x8(%edx)
80104447: 0f 94 c0 sete %al
8010444a: 0f b6 c0 movzbl %al,%eax
}
8010444d: 5d pop %ebp
8010444e: c3 ret
8010444f: 90 nop
80104450 <pushcli>:
// it takes two popcli to undo two pushcli. Also, if interrupts
// are off, then pushcli, popcli leaves them off.
void
pushcli(void)
{
80104450: 55 push %ebp
80104451: 89 e5 mov %esp,%ebp
static inline uint
readeflags(void)
{
uint eflags;
asm volatile("pushfl; popl %0" : "=r" (eflags));
80104453: 9c pushf
80104454: 59 pop %ecx
}
static inline void
cli(void)
{
asm volatile("cli");
80104455: fa cli
int eflags;
eflags = readeflags();
cli();
if(cpu->ncli == 0)
80104456: 65 a1 00 00 00 00 mov %gs:0x0,%eax
8010445c: 8b 90 ac 00 00 00 mov 0xac(%eax),%edx
80104462: 85 d2 test %edx,%edx
80104464: 75 0c jne 80104472 <pushcli+0x22>
cpu->intena = eflags & FL_IF;
80104466: 81 e1 00 02 00 00 and $0x200,%ecx
8010446c: 89 88 b0 00 00 00 mov %ecx,0xb0(%eax)
cpu->ncli += 1;
80104472: 83 c2 01 add $0x1,%edx
80104475: 89 90 ac 00 00 00 mov %edx,0xac(%eax)
}
8010447b: 5d pop %ebp
8010447c: c3 ret
8010447d: 8d 76 00 lea 0x0(%esi),%esi
80104480 <popcli>:
void
popcli(void)
{
80104480: 55 push %ebp
80104481: 89 e5 mov %esp,%ebp
80104483: 83 ec 18 sub $0x18,%esp
static inline uint
readeflags(void)
{
uint eflags;
asm volatile("pushfl; popl %0" : "=r" (eflags));
80104486: 9c pushf
80104487: 58 pop %eax
if(readeflags()&FL_IF)
80104488: f6 c4 02 test $0x2,%ah
8010448b: 75 34 jne 801044c1 <popcli+0x41>
panic("popcli - interruptible");
if(--cpu->ncli < 0)
8010448d: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80104493: 8b 88 ac 00 00 00 mov 0xac(%eax),%ecx
80104499: 8d 51 ff lea -0x1(%ecx),%edx
8010449c: 85 d2 test %edx,%edx
8010449e: 89 90 ac 00 00 00 mov %edx,0xac(%eax)
801044a4: 78 0f js 801044b5 <popcli+0x35>
panic("popcli");
if(cpu->ncli == 0 && cpu->intena)
801044a6: 75 0b jne 801044b3 <popcli+0x33>
801044a8: 8b 80 b0 00 00 00 mov 0xb0(%eax),%eax
801044ae: 85 c0 test %eax,%eax
801044b0: 74 01 je 801044b3 <popcli+0x33>
}
static inline void
sti(void)
{
asm volatile("sti");
801044b2: fb sti
sti();
}
801044b3: c9 leave
801044b4: c3 ret
popcli(void)
{
if(readeflags()&FL_IF)
panic("popcli - interruptible");
if(--cpu->ncli < 0)
panic("popcli");
801044b5: c7 04 24 a2 76 10 80 movl $0x801076a2,(%esp)
801044bc: e8 9f be ff ff call 80100360 <panic>
void
popcli(void)
{
if(readeflags()&FL_IF)
panic("popcli - interruptible");
801044c1: c7 04 24 8b 76 10 80 movl $0x8010768b,(%esp)
801044c8: e8 93 be ff ff call 80100360 <panic>
801044cd: 8d 76 00 lea 0x0(%esi),%esi
801044d0 <release>:
}
// Release the lock.
void
release(struct spinlock *lk)
{
801044d0: 55 push %ebp
801044d1: 89 e5 mov %esp,%ebp
801044d3: 83 ec 18 sub $0x18,%esp
801044d6: 8b 45 08 mov 0x8(%ebp),%eax
// Check whether this cpu is holding the lock.
int
holding(struct spinlock *lock)
{
return lock->locked && lock->cpu == cpu;
801044d9: 8b 10 mov (%eax),%edx
801044db: 85 d2 test %edx,%edx
801044dd: 74 0c je 801044eb <release+0x1b>
801044df: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
801044e6: 39 50 08 cmp %edx,0x8(%eax)
801044e9: 74 0d je 801044f8 <release+0x28>
// Release the lock.
void
release(struct spinlock *lk)
{
if(!holding(lk))
panic("release");
801044eb: c7 04 24 a9 76 10 80 movl $0x801076a9,(%esp)
801044f2: e8 69 be ff ff call 80100360 <panic>
801044f7: 90 nop
lk->pcs[0] = 0;
801044f8: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
lk->cpu = 0;
801044ff: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
// Tell the C compiler and the processor to not move loads or stores
// past this point, to ensure that all the stores in the critical
// section are visible to other cores before the lock is released.
// Both the C compiler and the hardware may re-order loads and
// stores; __sync_synchronize() tells them both not to.
__sync_synchronize();
80104506: f0 83 0c 24 00 lock orl $0x0,(%esp)
// Release the lock, equivalent to lk->locked = 0.
// This code can't use a C assignment, since it might
// not be atomic. A real OS would use C atomics here.
asm volatile("movl $0, %0" : "+m" (lk->locked) : );
8010450b: c7 00 00 00 00 00 movl $0x0,(%eax)
popcli();
}
80104511: c9 leave
// Release the lock, equivalent to lk->locked = 0.
// This code can't use a C assignment, since it might
// not be atomic. A real OS would use C atomics here.
asm volatile("movl $0, %0" : "+m" (lk->locked) : );
popcli();
80104512: e9 69 ff ff ff jmp 80104480 <popcli>
80104517: 66 90 xchg %ax,%ax
80104519: 66 90 xchg %ax,%ax
8010451b: 66 90 xchg %ax,%ax
8010451d: 66 90 xchg %ax,%ax
8010451f: 90 nop
80104520 <memset>:
80104520: 55 push %ebp
80104521: 89 e5 mov %esp,%ebp
80104523: 57 push %edi
80104524: 53 push %ebx
80104525: 8b 55 08 mov 0x8(%ebp),%edx
80104528: 8b 4d 10 mov 0x10(%ebp),%ecx
8010452b: f6 c2 03 test $0x3,%dl
8010452e: 75 05 jne 80104535 <memset+0x15>
80104530: f6 c1 03 test $0x3,%cl
80104533: 74 13 je 80104548 <memset+0x28>
80104535: 89 d7 mov %edx,%edi
80104537: 8b 45 0c mov 0xc(%ebp),%eax
8010453a: fc cld
8010453b: f3 aa rep stos %al,%es:(%edi)
8010453d: 5b pop %ebx
8010453e: 89 d0 mov %edx,%eax
80104540: 5f pop %edi
80104541: 5d pop %ebp
80104542: c3 ret
80104543: 90 nop
80104544: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80104548: 0f b6 7d 0c movzbl 0xc(%ebp),%edi
8010454c: c1 e9 02 shr $0x2,%ecx
8010454f: 89 fb mov %edi,%ebx
80104551: 89 f8 mov %edi,%eax
80104553: c1 e3 18 shl $0x18,%ebx
80104556: c1 e0 10 shl $0x10,%eax
80104559: 09 d8 or %ebx,%eax
8010455b: 09 f8 or %edi,%eax
8010455d: c1 e7 08 shl $0x8,%edi
80104560: 09 f8 or %edi,%eax
80104562: 89 d7 mov %edx,%edi
80104564: fc cld
80104565: f3 ab rep stos %eax,%es:(%edi)
80104567: 5b pop %ebx
80104568: 89 d0 mov %edx,%eax
8010456a: 5f pop %edi
8010456b: 5d pop %ebp
8010456c: c3 ret
8010456d: 8d 76 00 lea 0x0(%esi),%esi
80104570 <memcmp>:
80104570: 55 push %ebp
80104571: 89 e5 mov %esp,%ebp
80104573: 57 push %edi
80104574: 56 push %esi
80104575: 8b 45 10 mov 0x10(%ebp),%eax
80104578: 53 push %ebx
80104579: 8b 75 0c mov 0xc(%ebp),%esi
8010457c: 8b 5d 08 mov 0x8(%ebp),%ebx
8010457f: 85 c0 test %eax,%eax
80104581: 74 29 je 801045ac <memcmp+0x3c>
80104583: 0f b6 13 movzbl (%ebx),%edx
80104586: 0f b6 0e movzbl (%esi),%ecx
80104589: 38 d1 cmp %dl,%cl
8010458b: 75 2b jne 801045b8 <memcmp+0x48>
8010458d: 8d 78 ff lea -0x1(%eax),%edi
80104590: 31 c0 xor %eax,%eax
80104592: eb 14 jmp 801045a8 <memcmp+0x38>
80104594: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80104598: 0f b6 54 03 01 movzbl 0x1(%ebx,%eax,1),%edx
8010459d: 83 c0 01 add $0x1,%eax
801045a0: 0f b6 0c 06 movzbl (%esi,%eax,1),%ecx
801045a4: 38 ca cmp %cl,%dl
801045a6: 75 10 jne 801045b8 <memcmp+0x48>
801045a8: 39 f8 cmp %edi,%eax
801045aa: 75 ec jne 80104598 <memcmp+0x28>
801045ac: 5b pop %ebx
801045ad: 31 c0 xor %eax,%eax
801045af: 5e pop %esi
801045b0: 5f pop %edi
801045b1: 5d pop %ebp
801045b2: c3 ret
801045b3: 90 nop
801045b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801045b8: 0f b6 c2 movzbl %dl,%eax
801045bb: 5b pop %ebx
801045bc: 29 c8 sub %ecx,%eax
801045be: 5e pop %esi
801045bf: 5f pop %edi
801045c0: 5d pop %ebp
801045c1: c3 ret
801045c2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801045c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801045d0 <memmove>:
801045d0: 55 push %ebp
801045d1: 89 e5 mov %esp,%ebp
801045d3: 56 push %esi
801045d4: 53 push %ebx
801045d5: 8b 45 08 mov 0x8(%ebp),%eax
801045d8: 8b 75 0c mov 0xc(%ebp),%esi
801045db: 8b 5d 10 mov 0x10(%ebp),%ebx
801045de: 39 c6 cmp %eax,%esi
801045e0: 73 2e jae 80104610 <memmove+0x40>
801045e2: 8d 0c 1e lea (%esi,%ebx,1),%ecx
801045e5: 39 c8 cmp %ecx,%eax
801045e7: 73 27 jae 80104610 <memmove+0x40>
801045e9: 85 db test %ebx,%ebx
801045eb: 8d 53 ff lea -0x1(%ebx),%edx
801045ee: 74 17 je 80104607 <memmove+0x37>
801045f0: 29 d9 sub %ebx,%ecx
801045f2: 89 cb mov %ecx,%ebx
801045f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801045f8: 0f b6 0c 13 movzbl (%ebx,%edx,1),%ecx
801045fc: 88 0c 10 mov %cl,(%eax,%edx,1)
801045ff: 83 ea 01 sub $0x1,%edx
80104602: 83 fa ff cmp $0xffffffff,%edx
80104605: 75 f1 jne 801045f8 <memmove+0x28>
80104607: 5b pop %ebx
80104608: 5e pop %esi
80104609: 5d pop %ebp
8010460a: c3 ret
8010460b: 90 nop
8010460c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80104610: 31 d2 xor %edx,%edx
80104612: 85 db test %ebx,%ebx
80104614: 74 f1 je 80104607 <memmove+0x37>
80104616: 8d 76 00 lea 0x0(%esi),%esi
80104619: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104620: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
80104624: 88 0c 10 mov %cl,(%eax,%edx,1)
80104627: 83 c2 01 add $0x1,%edx
8010462a: 39 d3 cmp %edx,%ebx
8010462c: 75 f2 jne 80104620 <memmove+0x50>
8010462e: 5b pop %ebx
8010462f: 5e pop %esi
80104630: 5d pop %ebp
80104631: c3 ret
80104632: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80104639: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104640 <memcpy>:
80104640: 55 push %ebp
80104641: 89 e5 mov %esp,%ebp
80104643: 5d pop %ebp
80104644: eb 8a jmp 801045d0 <memmove>
80104646: 8d 76 00 lea 0x0(%esi),%esi
80104649: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104650 <strncmp>:
80104650: 55 push %ebp
80104651: 89 e5 mov %esp,%ebp
80104653: 57 push %edi
80104654: 56 push %esi
80104655: 8b 4d 10 mov 0x10(%ebp),%ecx
80104658: 53 push %ebx
80104659: 8b 7d 08 mov 0x8(%ebp),%edi
8010465c: 8b 75 0c mov 0xc(%ebp),%esi
8010465f: 85 c9 test %ecx,%ecx
80104661: 74 37 je 8010469a <strncmp+0x4a>
80104663: 0f b6 17 movzbl (%edi),%edx
80104666: 0f b6 1e movzbl (%esi),%ebx
80104669: 84 d2 test %dl,%dl
8010466b: 74 3f je 801046ac <strncmp+0x5c>
8010466d: 38 d3 cmp %dl,%bl
8010466f: 75 3b jne 801046ac <strncmp+0x5c>
80104671: 8d 47 01 lea 0x1(%edi),%eax
80104674: 01 cf add %ecx,%edi
80104676: eb 1b jmp 80104693 <strncmp+0x43>
80104678: 90 nop
80104679: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80104680: 0f b6 10 movzbl (%eax),%edx
80104683: 84 d2 test %dl,%dl
80104685: 74 21 je 801046a8 <strncmp+0x58>
80104687: 0f b6 19 movzbl (%ecx),%ebx
8010468a: 83 c0 01 add $0x1,%eax
8010468d: 89 ce mov %ecx,%esi
8010468f: 38 da cmp %bl,%dl
80104691: 75 19 jne 801046ac <strncmp+0x5c>
80104693: 39 c7 cmp %eax,%edi
80104695: 8d 4e 01 lea 0x1(%esi),%ecx
80104698: 75 e6 jne 80104680 <strncmp+0x30>
8010469a: 5b pop %ebx
8010469b: 31 c0 xor %eax,%eax
8010469d: 5e pop %esi
8010469e: 5f pop %edi
8010469f: 5d pop %ebp
801046a0: c3 ret
801046a1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801046a8: 0f b6 5e 01 movzbl 0x1(%esi),%ebx
801046ac: 0f b6 c2 movzbl %dl,%eax
801046af: 29 d8 sub %ebx,%eax
801046b1: 5b pop %ebx
801046b2: 5e pop %esi
801046b3: 5f pop %edi
801046b4: 5d pop %ebp
801046b5: c3 ret
801046b6: 8d 76 00 lea 0x0(%esi),%esi
801046b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801046c0 <strncpy>:
801046c0: 55 push %ebp
801046c1: 89 e5 mov %esp,%ebp
801046c3: 56 push %esi
801046c4: 53 push %ebx
801046c5: 8b 45 08 mov 0x8(%ebp),%eax
801046c8: 8b 5d 0c mov 0xc(%ebp),%ebx
801046cb: 8b 4d 10 mov 0x10(%ebp),%ecx
801046ce: 89 c2 mov %eax,%edx
801046d0: eb 19 jmp 801046eb <strncpy+0x2b>
801046d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801046d8: 83 c3 01 add $0x1,%ebx
801046db: 0f b6 4b ff movzbl -0x1(%ebx),%ecx
801046df: 83 c2 01 add $0x1,%edx
801046e2: 84 c9 test %cl,%cl
801046e4: 88 4a ff mov %cl,-0x1(%edx)
801046e7: 74 09 je 801046f2 <strncpy+0x32>
801046e9: 89 f1 mov %esi,%ecx
801046eb: 85 c9 test %ecx,%ecx
801046ed: 8d 71 ff lea -0x1(%ecx),%esi
801046f0: 7f e6 jg 801046d8 <strncpy+0x18>
801046f2: 31 c9 xor %ecx,%ecx
801046f4: 85 f6 test %esi,%esi
801046f6: 7e 17 jle 8010470f <strncpy+0x4f>
801046f8: 90 nop
801046f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80104700: c6 04 0a 00 movb $0x0,(%edx,%ecx,1)
80104704: 89 f3 mov %esi,%ebx
80104706: 83 c1 01 add $0x1,%ecx
80104709: 29 cb sub %ecx,%ebx
8010470b: 85 db test %ebx,%ebx
8010470d: 7f f1 jg 80104700 <strncpy+0x40>
8010470f: 5b pop %ebx
80104710: 5e pop %esi
80104711: 5d pop %ebp
80104712: c3 ret
80104713: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80104719: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104720 <safestrcpy>:
80104720: 55 push %ebp
80104721: 89 e5 mov %esp,%ebp
80104723: 56 push %esi
80104724: 53 push %ebx
80104725: 8b 4d 10 mov 0x10(%ebp),%ecx
80104728: 8b 45 08 mov 0x8(%ebp),%eax
8010472b: 8b 55 0c mov 0xc(%ebp),%edx
8010472e: 85 c9 test %ecx,%ecx
80104730: 7e 26 jle 80104758 <safestrcpy+0x38>
80104732: 8d 74 0a ff lea -0x1(%edx,%ecx,1),%esi
80104736: 89 c1 mov %eax,%ecx
80104738: eb 17 jmp 80104751 <safestrcpy+0x31>
8010473a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80104740: 83 c2 01 add $0x1,%edx
80104743: 0f b6 5a ff movzbl -0x1(%edx),%ebx
80104747: 83 c1 01 add $0x1,%ecx
8010474a: 84 db test %bl,%bl
8010474c: 88 59 ff mov %bl,-0x1(%ecx)
8010474f: 74 04 je 80104755 <safestrcpy+0x35>
80104751: 39 f2 cmp %esi,%edx
80104753: 75 eb jne 80104740 <safestrcpy+0x20>
80104755: c6 01 00 movb $0x0,(%ecx)
80104758: 5b pop %ebx
80104759: 5e pop %esi
8010475a: 5d pop %ebp
8010475b: c3 ret
8010475c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80104760 <strlen>:
80104760: 55 push %ebp
80104761: 31 c0 xor %eax,%eax
80104763: 89 e5 mov %esp,%ebp
80104765: 8b 55 08 mov 0x8(%ebp),%edx
80104768: 80 3a 00 cmpb $0x0,(%edx)
8010476b: 74 0c je 80104779 <strlen+0x19>
8010476d: 8d 76 00 lea 0x0(%esi),%esi
80104770: 83 c0 01 add $0x1,%eax
80104773: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1)
80104777: 75 f7 jne 80104770 <strlen+0x10>
80104779: 5d pop %ebp
8010477a: c3 ret
8010477b <swtch>:
8010477b: 8b 44 24 04 mov 0x4(%esp),%eax
8010477f: 8b 54 24 08 mov 0x8(%esp),%edx
80104783: 55 push %ebp
80104784: 53 push %ebx
80104785: 56 push %esi
80104786: 57 push %edi
80104787: 89 20 mov %esp,(%eax)
80104789: 89 d4 mov %edx,%esp
8010478b: 5f pop %edi
8010478c: 5e pop %esi
8010478d: 5b pop %ebx
8010478e: 5d pop %ebp
8010478f: c3 ret
80104790 <fetchint>:
// Fetch the int at addr from the current process.
int
fetchint(uint addr, int *ip)
{
if(addr >= proc->sz || addr+4 > proc->sz)
80104790: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
// to a saved program counter, and then the first argument.
// Fetch the int at addr from the current process.
int
fetchint(uint addr, int *ip)
{
80104797: 55 push %ebp
80104798: 89 e5 mov %esp,%ebp
8010479a: 8b 45 08 mov 0x8(%ebp),%eax
if(addr >= proc->sz || addr+4 > proc->sz)
8010479d: 8b 12 mov (%edx),%edx
8010479f: 39 c2 cmp %eax,%edx
801047a1: 76 15 jbe 801047b8 <fetchint+0x28>
801047a3: 8d 48 04 lea 0x4(%eax),%ecx
801047a6: 39 ca cmp %ecx,%edx
801047a8: 72 0e jb 801047b8 <fetchint+0x28>
return -1;
*ip = *(int*)(addr);
801047aa: 8b 10 mov (%eax),%edx
801047ac: 8b 45 0c mov 0xc(%ebp),%eax
801047af: 89 10 mov %edx,(%eax)
return 0;
801047b1: 31 c0 xor %eax,%eax
}
801047b3: 5d pop %ebp
801047b4: c3 ret
801047b5: 8d 76 00 lea 0x0(%esi),%esi
// Fetch the int at addr from the current process.
int
fetchint(uint addr, int *ip)
{
if(addr >= proc->sz || addr+4 > proc->sz)
return -1;
801047b8: b8 ff ff ff ff mov $0xffffffff,%eax
*ip = *(int*)(addr);
return 0;
}
801047bd: 5d pop %ebp
801047be: c3 ret
801047bf: 90 nop
801047c0 <fetchstr>:
int
fetchstr(uint addr, char **pp)
{
char *s, *ep;
if(addr >= proc->sz)
801047c0: 65 a1 04 00 00 00 mov %gs:0x4,%eax
// Fetch the nul-terminated string at addr from the current process.
// Doesn't actually copy the string - just sets *pp to point at it.
// Returns length of string, not including nul.
int
fetchstr(uint addr, char **pp)
{
801047c6: 55 push %ebp
801047c7: 89 e5 mov %esp,%ebp
801047c9: 8b 4d 08 mov 0x8(%ebp),%ecx
char *s, *ep;
if(addr >= proc->sz)
801047cc: 39 08 cmp %ecx,(%eax)
801047ce: 76 2c jbe 801047fc <fetchstr+0x3c>
return -1;
*pp = (char*)addr;
801047d0: 8b 55 0c mov 0xc(%ebp),%edx
801047d3: 89 c8 mov %ecx,%eax
801047d5: 89 0a mov %ecx,(%edx)
ep = (char*)proc->sz;
801047d7: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
801047de: 8b 12 mov (%edx),%edx
for(s = *pp; s < ep; s++)
801047e0: 39 d1 cmp %edx,%ecx
801047e2: 73 18 jae 801047fc <fetchstr+0x3c>
if(*s == 0)
801047e4: 80 39 00 cmpb $0x0,(%ecx)
801047e7: 75 0c jne 801047f5 <fetchstr+0x35>
801047e9: eb 1d jmp 80104808 <fetchstr+0x48>
801047eb: 90 nop
801047ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801047f0: 80 38 00 cmpb $0x0,(%eax)
801047f3: 74 13 je 80104808 <fetchstr+0x48>
if(addr >= proc->sz)
return -1;
*pp = (char*)addr;
ep = (char*)proc->sz;
for(s = *pp; s < ep; s++)
801047f5: 83 c0 01 add $0x1,%eax
801047f8: 39 c2 cmp %eax,%edx
801047fa: 77 f4 ja 801047f0 <fetchstr+0x30>
fetchstr(uint addr, char **pp)
{
char *s, *ep;
if(addr >= proc->sz)
return -1;
801047fc: b8 ff ff ff ff mov $0xffffffff,%eax
ep = (char*)proc->sz;
for(s = *pp; s < ep; s++)
if(*s == 0)
return s - *pp;
return -1;
}
80104801: 5d pop %ebp
80104802: c3 ret
80104803: 90 nop
80104804: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
return -1;
*pp = (char*)addr;
ep = (char*)proc->sz;
for(s = *pp; s < ep; s++)
if(*s == 0)
return s - *pp;
80104808: 29 c8 sub %ecx,%eax
return -1;
}
8010480a: 5d pop %ebp
8010480b: c3 ret
8010480c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80104810 <argint>:
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
return fetchint(proc->tf->esp + 4 + 4*n, ip);
80104810: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
}
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
80104817: 55 push %ebp
80104818: 89 e5 mov %esp,%ebp
return fetchint(proc->tf->esp + 4 + 4*n, ip);
8010481a: 8b 4d 08 mov 0x8(%ebp),%ecx
8010481d: 8b 42 18 mov 0x18(%edx),%eax
// Fetch the int at addr from the current process.
int
fetchint(uint addr, int *ip)
{
if(addr >= proc->sz || addr+4 > proc->sz)
80104820: 8b 12 mov (%edx),%edx
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
return fetchint(proc->tf->esp + 4 + 4*n, ip);
80104822: 8b 40 44 mov 0x44(%eax),%eax
80104825: 8d 04 88 lea (%eax,%ecx,4),%eax
80104828: 8d 48 04 lea 0x4(%eax),%ecx
// Fetch the int at addr from the current process.
int
fetchint(uint addr, int *ip)
{
if(addr >= proc->sz || addr+4 > proc->sz)
8010482b: 39 d1 cmp %edx,%ecx
8010482d: 73 19 jae 80104848 <argint+0x38>
8010482f: 8d 48 08 lea 0x8(%eax),%ecx
80104832: 39 ca cmp %ecx,%edx
80104834: 72 12 jb 80104848 <argint+0x38>
return -1;
*ip = *(int*)(addr);
80104836: 8b 50 04 mov 0x4(%eax),%edx
80104839: 8b 45 0c mov 0xc(%ebp),%eax
8010483c: 89 10 mov %edx,(%eax)
return 0;
8010483e: 31 c0 xor %eax,%eax
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
return fetchint(proc->tf->esp + 4 + 4*n, ip);
}
80104840: 5d pop %ebp
80104841: c3 ret
80104842: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
// Fetch the int at addr from the current process.
int
fetchint(uint addr, int *ip)
{
if(addr >= proc->sz || addr+4 > proc->sz)
return -1;
80104848: b8 ff ff ff ff mov $0xffffffff,%eax
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
return fetchint(proc->tf->esp + 4 + 4*n, ip);
}
8010484d: 5d pop %ebp
8010484e: c3 ret
8010484f: 90 nop
80104850 <argptr>:
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
return fetchint(proc->tf->esp + 4 + 4*n, ip);
80104850: 65 a1 04 00 00 00 mov %gs:0x4,%eax
// Fetch the nth word-sized system call argument as a pointer
// to a block of memory of size bytes. Check that the pointer
// lies within the process address space.
int
argptr(int n, char **pp, int size)
{
80104856: 55 push %ebp
80104857: 89 e5 mov %esp,%ebp
80104859: 53 push %ebx
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
return fetchint(proc->tf->esp + 4 + 4*n, ip);
8010485a: 8b 4d 08 mov 0x8(%ebp),%ecx
8010485d: 8b 50 18 mov 0x18(%eax),%edx
80104860: 8b 52 44 mov 0x44(%edx),%edx
80104863: 8d 0c 8a lea (%edx,%ecx,4),%ecx
// Fetch the int at addr from the current process.
int
fetchint(uint addr, int *ip)
{
if(addr >= proc->sz || addr+4 > proc->sz)
80104866: 8b 10 mov (%eax),%edx
argptr(int n, char **pp, int size)
{
int i;
if(argint(n, &i) < 0)
return -1;
80104868: b8 ff ff ff ff mov $0xffffffff,%eax
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
return fetchint(proc->tf->esp + 4 + 4*n, ip);
8010486d: 8d 59 04 lea 0x4(%ecx),%ebx
// Fetch the int at addr from the current process.
int
fetchint(uint addr, int *ip)
{
if(addr >= proc->sz || addr+4 > proc->sz)
80104870: 39 d3 cmp %edx,%ebx
80104872: 73 25 jae 80104899 <argptr+0x49>
80104874: 8d 59 08 lea 0x8(%ecx),%ebx
80104877: 39 da cmp %ebx,%edx
80104879: 72 1e jb 80104899 <argptr+0x49>
{
int i;
if(argint(n, &i) < 0)
return -1;
if(size < 0 || (uint)i >= proc->sz || (uint)i+size > proc->sz)
8010487b: 8b 5d 10 mov 0x10(%ebp),%ebx
int
fetchint(uint addr, int *ip)
{
if(addr >= proc->sz || addr+4 > proc->sz)
return -1;
*ip = *(int*)(addr);
8010487e: 8b 49 04 mov 0x4(%ecx),%ecx
{
int i;
if(argint(n, &i) < 0)
return -1;
if(size < 0 || (uint)i >= proc->sz || (uint)i+size > proc->sz)
80104881: 85 db test %ebx,%ebx
80104883: 78 14 js 80104899 <argptr+0x49>
80104885: 39 d1 cmp %edx,%ecx
80104887: 73 10 jae 80104899 <argptr+0x49>
80104889: 8b 5d 10 mov 0x10(%ebp),%ebx
8010488c: 01 cb add %ecx,%ebx
8010488e: 39 d3 cmp %edx,%ebx
80104890: 77 07 ja 80104899 <argptr+0x49>
return -1;
*pp = (char*)i;
80104892: 8b 45 0c mov 0xc(%ebp),%eax
80104895: 89 08 mov %ecx,(%eax)
return 0;
80104897: 31 c0 xor %eax,%eax
}
80104899: 5b pop %ebx
8010489a: 5d pop %ebp
8010489b: c3 ret
8010489c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801048a0 <argstr>:
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
return fetchint(proc->tf->esp + 4 + 4*n, ip);
801048a0: 65 a1 04 00 00 00 mov %gs:0x4,%eax
// Check that the pointer is valid and the string is nul-terminated.
// (There is no shared writable memory, so the string can't change
// between this check and being used by the kernel.)
int
argstr(int n, char **pp)
{
801048a6: 55 push %ebp
801048a7: 89 e5 mov %esp,%ebp
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
return fetchint(proc->tf->esp + 4 + 4*n, ip);
801048a9: 8b 4d 08 mov 0x8(%ebp),%ecx
801048ac: 8b 50 18 mov 0x18(%eax),%edx
// Fetch the int at addr from the current process.
int
fetchint(uint addr, int *ip)
{
if(addr >= proc->sz || addr+4 > proc->sz)
801048af: 8b 00 mov (%eax),%eax
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
return fetchint(proc->tf->esp + 4 + 4*n, ip);
801048b1: 8b 52 44 mov 0x44(%edx),%edx
801048b4: 8d 14 8a lea (%edx,%ecx,4),%edx
801048b7: 8d 4a 04 lea 0x4(%edx),%ecx
// Fetch the int at addr from the current process.
int
fetchint(uint addr, int *ip)
{
if(addr >= proc->sz || addr+4 > proc->sz)
801048ba: 39 c1 cmp %eax,%ecx
801048bc: 73 07 jae 801048c5 <argstr+0x25>
801048be: 8d 4a 08 lea 0x8(%edx),%ecx
801048c1: 39 c8 cmp %ecx,%eax
801048c3: 73 0b jae 801048d0 <argstr+0x30>
int
argstr(int n, char **pp)
{
int addr;
if(argint(n, &addr) < 0)
return -1;
801048c5: b8 ff ff ff ff mov $0xffffffff,%eax
return fetchstr(addr, pp);
}
801048ca: 5d pop %ebp
801048cb: c3 ret
801048cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
int
fetchint(uint addr, int *ip)
{
if(addr >= proc->sz || addr+4 > proc->sz)
return -1;
*ip = *(int*)(addr);
801048d0: 8b 4a 04 mov 0x4(%edx),%ecx
int
fetchstr(uint addr, char **pp)
{
char *s, *ep;
if(addr >= proc->sz)
801048d3: 39 c1 cmp %eax,%ecx
801048d5: 73 ee jae 801048c5 <argstr+0x25>
return -1;
*pp = (char*)addr;
801048d7: 8b 55 0c mov 0xc(%ebp),%edx
801048da: 89 c8 mov %ecx,%eax
801048dc: 89 0a mov %ecx,(%edx)
ep = (char*)proc->sz;
801048de: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
801048e5: 8b 12 mov (%edx),%edx
for(s = *pp; s < ep; s++)
801048e7: 39 d1 cmp %edx,%ecx
801048e9: 73 da jae 801048c5 <argstr+0x25>
if(*s == 0)
801048eb: 80 39 00 cmpb $0x0,(%ecx)
801048ee: 75 12 jne 80104902 <argstr+0x62>
801048f0: eb 1e jmp 80104910 <argstr+0x70>
801048f2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801048f8: 80 38 00 cmpb $0x0,(%eax)
801048fb: 90 nop
801048fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80104900: 74 0e je 80104910 <argstr+0x70>
if(addr >= proc->sz)
return -1;
*pp = (char*)addr;
ep = (char*)proc->sz;
for(s = *pp; s < ep; s++)
80104902: 83 c0 01 add $0x1,%eax
80104905: 39 c2 cmp %eax,%edx
80104907: 77 ef ja 801048f8 <argstr+0x58>
80104909: eb ba jmp 801048c5 <argstr+0x25>
8010490b: 90 nop
8010490c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(*s == 0)
return s - *pp;
80104910: 29 c8 sub %ecx,%eax
{
int addr;
if(argint(n, &addr) < 0)
return -1;
return fetchstr(addr, pp);
}
80104912: 5d pop %ebp
80104913: c3 ret
80104914: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
8010491a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80104920 <syscall>:
[SYS_chpr] sys_chpr,
};
void
syscall(void)
{
80104920: 55 push %ebp
80104921: 89 e5 mov %esp,%ebp
80104923: 53 push %ebx
80104924: 83 ec 14 sub $0x14,%esp
int num;
num = proc->tf->eax;
80104927: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
8010492e: 8b 5a 18 mov 0x18(%edx),%ebx
80104931: 8b 43 1c mov 0x1c(%ebx),%eax
if(num > 0 && num < NELEM(syscalls) && syscalls[num]) {
80104934: 8d 48 ff lea -0x1(%eax),%ecx
80104937: 83 f9 17 cmp $0x17,%ecx
8010493a: 77 1c ja 80104958 <syscall+0x38>
8010493c: 8b 0c 85 e0 76 10 80 mov -0x7fef8920(,%eax,4),%ecx
80104943: 85 c9 test %ecx,%ecx
80104945: 74 11 je 80104958 <syscall+0x38>
proc->tf->eax = syscalls[num]();
80104947: ff d1 call *%ecx
80104949: 89 43 1c mov %eax,0x1c(%ebx)
} else {
cprintf("%d %s: unknown sys call %d\n",
proc->pid, proc->name, num);
proc->tf->eax = -1;
}
}
8010494c: 83 c4 14 add $0x14,%esp
8010494f: 5b pop %ebx
80104950: 5d pop %ebp
80104951: c3 ret
80104952: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
num = proc->tf->eax;
if(num > 0 && num < NELEM(syscalls) && syscalls[num]) {
proc->tf->eax = syscalls[num]();
} else {
cprintf("%d %s: unknown sys call %d\n",
80104958: 89 44 24 0c mov %eax,0xc(%esp)
proc->pid, proc->name, num);
8010495c: 8d 42 6c lea 0x6c(%edx),%eax
8010495f: 89 44 24 08 mov %eax,0x8(%esp)
num = proc->tf->eax;
if(num > 0 && num < NELEM(syscalls) && syscalls[num]) {
proc->tf->eax = syscalls[num]();
} else {
cprintf("%d %s: unknown sys call %d\n",
80104963: 8b 42 10 mov 0x10(%edx),%eax
80104966: c7 04 24 b1 76 10 80 movl $0x801076b1,(%esp)
8010496d: 89 44 24 04 mov %eax,0x4(%esp)
80104971: e8 da bc ff ff call 80100650 <cprintf>
proc->pid, proc->name, num);
proc->tf->eax = -1;
80104976: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010497c: 8b 40 18 mov 0x18(%eax),%eax
8010497f: c7 40 1c ff ff ff ff movl $0xffffffff,0x1c(%eax)
}
}
80104986: 83 c4 14 add $0x14,%esp
80104989: 5b pop %ebx
8010498a: 5d pop %ebp
8010498b: c3 ret
8010498c: 66 90 xchg %ax,%ax
8010498e: 66 90 xchg %ax,%ax
80104990 <create>:
return -1;
}
static struct inode*
create(char *path, short type, short major, short minor)
{
80104990: 55 push %ebp
80104991: 89 e5 mov %esp,%ebp
80104993: 57 push %edi
80104994: 56 push %esi
80104995: 53 push %ebx
80104996: 83 ec 4c sub $0x4c,%esp
80104999: 89 4d c0 mov %ecx,-0x40(%ebp)
8010499c: 8b 4d 08 mov 0x8(%ebp),%ecx
uint off;
struct inode *ip, *dp;
char name[DIRSIZ];
if((dp = nameiparent(path, name)) == 0)
8010499f: 8d 5d da lea -0x26(%ebp),%ebx
801049a2: 89 5c 24 04 mov %ebx,0x4(%esp)
801049a6: 89 04 24 mov %eax,(%esp)
return -1;
}
static struct inode*
create(char *path, short type, short major, short minor)
{
801049a9: 89 55 c4 mov %edx,-0x3c(%ebp)
801049ac: 89 4d bc mov %ecx,-0x44(%ebp)
uint off;
struct inode *ip, *dp;
char name[DIRSIZ];
if((dp = nameiparent(path, name)) == 0)
801049af: e8 5c d5 ff ff call 80101f10 <nameiparent>
801049b4: 85 c0 test %eax,%eax
801049b6: 89 c7 mov %eax,%edi
801049b8: 0f 84 da 00 00 00 je 80104a98 <create+0x108>
return 0;
ilock(dp);
801049be: 89 04 24 mov %eax,(%esp)
801049c1: e8 fa cc ff ff call 801016c0 <ilock>
if((ip = dirlookup(dp, name, &off)) != 0){
801049c6: 8d 45 d4 lea -0x2c(%ebp),%eax
801049c9: 89 44 24 08 mov %eax,0x8(%esp)
801049cd: 89 5c 24 04 mov %ebx,0x4(%esp)
801049d1: 89 3c 24 mov %edi,(%esp)
801049d4: e8 d7 d1 ff ff call 80101bb0 <dirlookup>
801049d9: 85 c0 test %eax,%eax
801049db: 89 c6 mov %eax,%esi
801049dd: 74 41 je 80104a20 <create+0x90>
iunlockput(dp);
801049df: 89 3c 24 mov %edi,(%esp)
801049e2: e8 19 cf ff ff call 80101900 <iunlockput>
ilock(ip);
801049e7: 89 34 24 mov %esi,(%esp)
801049ea: e8 d1 cc ff ff call 801016c0 <ilock>
if(type == T_FILE && ip->type == T_FILE)
801049ef: 66 83 7d c4 02 cmpw $0x2,-0x3c(%ebp)
801049f4: 75 12 jne 80104a08 <create+0x78>
801049f6: 66 83 7e 50 02 cmpw $0x2,0x50(%esi)
801049fb: 89 f0 mov %esi,%eax
801049fd: 75 09 jne 80104a08 <create+0x78>
panic("create: dirlink");
iunlockput(dp);
return ip;
}
801049ff: 83 c4 4c add $0x4c,%esp
80104a02: 5b pop %ebx
80104a03: 5e pop %esi
80104a04: 5f pop %edi
80104a05: 5d pop %ebp
80104a06: c3 ret
80104a07: 90 nop
if((ip = dirlookup(dp, name, &off)) != 0){
iunlockput(dp);
ilock(ip);
if(type == T_FILE && ip->type == T_FILE)
return ip;
iunlockput(ip);
80104a08: 89 34 24 mov %esi,(%esp)
80104a0b: e8 f0 ce ff ff call 80101900 <iunlockput>
panic("create: dirlink");
iunlockput(dp);
return ip;
}
80104a10: 83 c4 4c add $0x4c,%esp
iunlockput(dp);
ilock(ip);
if(type == T_FILE && ip->type == T_FILE)
return ip;
iunlockput(ip);
return 0;
80104a13: 31 c0 xor %eax,%eax
panic("create: dirlink");
iunlockput(dp);
return ip;
}
80104a15: 5b pop %ebx
80104a16: 5e pop %esi
80104a17: 5f pop %edi
80104a18: 5d pop %ebp
80104a19: c3 ret
80104a1a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
return ip;
iunlockput(ip);
return 0;
}
if((ip = ialloc(dp->dev, type)) == 0)
80104a20: 0f bf 45 c4 movswl -0x3c(%ebp),%eax
80104a24: 89 44 24 04 mov %eax,0x4(%esp)
80104a28: 8b 07 mov (%edi),%eax
80104a2a: 89 04 24 mov %eax,(%esp)
80104a2d: e8 fe ca ff ff call 80101530 <ialloc>
80104a32: 85 c0 test %eax,%eax
80104a34: 89 c6 mov %eax,%esi
80104a36: 0f 84 bf 00 00 00 je 80104afb <create+0x16b>
panic("create: ialloc");
ilock(ip);
80104a3c: 89 04 24 mov %eax,(%esp)
80104a3f: e8 7c cc ff ff call 801016c0 <ilock>
ip->major = major;
80104a44: 0f b7 45 c0 movzwl -0x40(%ebp),%eax
80104a48: 66 89 46 52 mov %ax,0x52(%esi)
ip->minor = minor;
80104a4c: 0f b7 45 bc movzwl -0x44(%ebp),%eax
80104a50: 66 89 46 54 mov %ax,0x54(%esi)
ip->nlink = 1;
80104a54: b8 01 00 00 00 mov $0x1,%eax
80104a59: 66 89 46 56 mov %ax,0x56(%esi)
iupdate(ip);
80104a5d: 89 34 24 mov %esi,(%esp)
80104a60: e8 9b cb ff ff call 80101600 <iupdate>
if(type == T_DIR){ // Create . and .. entries.
80104a65: 66 83 7d c4 01 cmpw $0x1,-0x3c(%ebp)
80104a6a: 74 34 je 80104aa0 <create+0x110>
// No ip->nlink++ for ".": avoid cyclic ref count.
if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0)
panic("create dots");
}
if(dirlink(dp, name, ip->inum) < 0)
80104a6c: 8b 46 04 mov 0x4(%esi),%eax
80104a6f: 89 5c 24 04 mov %ebx,0x4(%esp)
80104a73: 89 3c 24 mov %edi,(%esp)
80104a76: 89 44 24 08 mov %eax,0x8(%esp)
80104a7a: e8 91 d3 ff ff call 80101e10 <dirlink>
80104a7f: 85 c0 test %eax,%eax
80104a81: 78 6c js 80104aef <create+0x15f>
panic("create: dirlink");
iunlockput(dp);
80104a83: 89 3c 24 mov %edi,(%esp)
80104a86: e8 75 ce ff ff call 80101900 <iunlockput>
return ip;
}
80104a8b: 83 c4 4c add $0x4c,%esp
if(dirlink(dp, name, ip->inum) < 0)
panic("create: dirlink");
iunlockput(dp);
return ip;
80104a8e: 89 f0 mov %esi,%eax
}
80104a90: 5b pop %ebx
80104a91: 5e pop %esi
80104a92: 5f pop %edi
80104a93: 5d pop %ebp
80104a94: c3 ret
80104a95: 8d 76 00 lea 0x0(%esi),%esi
uint off;
struct inode *ip, *dp;
char name[DIRSIZ];
if((dp = nameiparent(path, name)) == 0)
return 0;
80104a98: 31 c0 xor %eax,%eax
80104a9a: e9 60 ff ff ff jmp 801049ff <create+0x6f>
80104a9f: 90 nop
ip->minor = minor;
ip->nlink = 1;
iupdate(ip);
if(type == T_DIR){ // Create . and .. entries.
dp->nlink++; // for ".."
80104aa0: 66 83 47 56 01 addw $0x1,0x56(%edi)
iupdate(dp);
80104aa5: 89 3c 24 mov %edi,(%esp)
80104aa8: e8 53 cb ff ff call 80101600 <iupdate>
// No ip->nlink++ for ".": avoid cyclic ref count.
if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0)
80104aad: 8b 46 04 mov 0x4(%esi),%eax
80104ab0: c7 44 24 04 60 77 10 movl $0x80107760,0x4(%esp)
80104ab7: 80
80104ab8: 89 34 24 mov %esi,(%esp)
80104abb: 89 44 24 08 mov %eax,0x8(%esp)
80104abf: e8 4c d3 ff ff call 80101e10 <dirlink>
80104ac4: 85 c0 test %eax,%eax
80104ac6: 78 1b js 80104ae3 <create+0x153>
80104ac8: 8b 47 04 mov 0x4(%edi),%eax
80104acb: c7 44 24 04 5f 77 10 movl $0x8010775f,0x4(%esp)
80104ad2: 80
80104ad3: 89 34 24 mov %esi,(%esp)
80104ad6: 89 44 24 08 mov %eax,0x8(%esp)
80104ada: e8 31 d3 ff ff call 80101e10 <dirlink>
80104adf: 85 c0 test %eax,%eax
80104ae1: 79 89 jns 80104a6c <create+0xdc>
panic("create dots");
80104ae3: c7 04 24 53 77 10 80 movl $0x80107753,(%esp)
80104aea: e8 71 b8 ff ff call 80100360 <panic>
}
if(dirlink(dp, name, ip->inum) < 0)
panic("create: dirlink");
80104aef: c7 04 24 62 77 10 80 movl $0x80107762,(%esp)
80104af6: e8 65 b8 ff ff call 80100360 <panic>
iunlockput(ip);
return 0;
}
if((ip = ialloc(dp->dev, type)) == 0)
panic("create: ialloc");
80104afb: c7 04 24 44 77 10 80 movl $0x80107744,(%esp)
80104b02: e8 59 b8 ff ff call 80100360 <panic>
80104b07: 89 f6 mov %esi,%esi
80104b09: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104b10 <argfd.constprop.0>:
#include "fcntl.h"
// Fetch the nth word-sized system call argument as a file descriptor
// and return both the descriptor and the corresponding struct file.
static int
argfd(int n, int *pfd, struct file **pf)
80104b10: 55 push %ebp
80104b11: 89 e5 mov %esp,%ebp
80104b13: 56 push %esi
80104b14: 89 c6 mov %eax,%esi
80104b16: 53 push %ebx
80104b17: 89 d3 mov %edx,%ebx
80104b19: 83 ec 20 sub $0x20,%esp
{
int fd;
struct file *f;
if(argint(n, &fd) < 0)
80104b1c: 8d 45 f4 lea -0xc(%ebp),%eax
80104b1f: 89 44 24 04 mov %eax,0x4(%esp)
80104b23: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80104b2a: e8 e1 fc ff ff call 80104810 <argint>
80104b2f: 85 c0 test %eax,%eax
80104b31: 78 35 js 80104b68 <argfd.constprop.0+0x58>
return -1;
if(fd < 0 || fd >= NOFILE || (f=proc->ofile[fd]) == 0)
80104b33: 8b 4d f4 mov -0xc(%ebp),%ecx
80104b36: 83 f9 0f cmp $0xf,%ecx
80104b39: 77 2d ja 80104b68 <argfd.constprop.0+0x58>
80104b3b: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104b41: 8b 44 88 28 mov 0x28(%eax,%ecx,4),%eax
80104b45: 85 c0 test %eax,%eax
80104b47: 74 1f je 80104b68 <argfd.constprop.0+0x58>
return -1;
if(pfd)
80104b49: 85 f6 test %esi,%esi
80104b4b: 74 02 je 80104b4f <argfd.constprop.0+0x3f>
*pfd = fd;
80104b4d: 89 0e mov %ecx,(%esi)
if(pf)
80104b4f: 85 db test %ebx,%ebx
80104b51: 74 0d je 80104b60 <argfd.constprop.0+0x50>
*pf = f;
80104b53: 89 03 mov %eax,(%ebx)
return 0;
80104b55: 31 c0 xor %eax,%eax
}
80104b57: 83 c4 20 add $0x20,%esp
80104b5a: 5b pop %ebx
80104b5b: 5e pop %esi
80104b5c: 5d pop %ebp
80104b5d: c3 ret
80104b5e: 66 90 xchg %ax,%ax
return -1;
if(pfd)
*pfd = fd;
if(pf)
*pf = f;
return 0;
80104b60: 31 c0 xor %eax,%eax
80104b62: eb f3 jmp 80104b57 <argfd.constprop.0+0x47>
80104b64: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
{
int fd;
struct file *f;
if(argint(n, &fd) < 0)
return -1;
80104b68: b8 ff ff ff ff mov $0xffffffff,%eax
80104b6d: eb e8 jmp 80104b57 <argfd.constprop.0+0x47>
80104b6f: 90 nop
80104b70 <sys_dup>:
return -1;
}
int
sys_dup(void)
{
80104b70: 55 push %ebp
struct file *f;
int fd;
if(argfd(0, 0, &f) < 0)
80104b71: 31 c0 xor %eax,%eax
return -1;
}
int
sys_dup(void)
{
80104b73: 89 e5 mov %esp,%ebp
80104b75: 53 push %ebx
80104b76: 83 ec 24 sub $0x24,%esp
struct file *f;
int fd;
if(argfd(0, 0, &f) < 0)
80104b79: 8d 55 f4 lea -0xc(%ebp),%edx
80104b7c: e8 8f ff ff ff call 80104b10 <argfd.constprop.0>
80104b81: 85 c0 test %eax,%eax
80104b83: 78 1b js 80104ba0 <sys_dup+0x30>
return -1;
if((fd=fdalloc(f)) < 0)
80104b85: 8b 55 f4 mov -0xc(%ebp),%edx
static int
fdalloc(struct file *f)
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
80104b88: 31 db xor %ebx,%ebx
80104b8a: 65 a1 04 00 00 00 mov %gs:0x4,%eax
if(proc->ofile[fd] == 0){
80104b90: 8b 4c 98 28 mov 0x28(%eax,%ebx,4),%ecx
80104b94: 85 c9 test %ecx,%ecx
80104b96: 74 18 je 80104bb0 <sys_dup+0x40>
static int
fdalloc(struct file *f)
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
80104b98: 83 c3 01 add $0x1,%ebx
80104b9b: 83 fb 10 cmp $0x10,%ebx
80104b9e: 75 f0 jne 80104b90 <sys_dup+0x20>
return -1;
if((fd=fdalloc(f)) < 0)
return -1;
filedup(f);
return fd;
}
80104ba0: 83 c4 24 add $0x24,%esp
{
struct file *f;
int fd;
if(argfd(0, 0, &f) < 0)
return -1;
80104ba3: b8 ff ff ff ff mov $0xffffffff,%eax
if((fd=fdalloc(f)) < 0)
return -1;
filedup(f);
return fd;
}
80104ba8: 5b pop %ebx
80104ba9: 5d pop %ebp
80104baa: c3 ret
80104bab: 90 nop
80104bac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
if(proc->ofile[fd] == 0){
proc->ofile[fd] = f;
80104bb0: 89 54 98 28 mov %edx,0x28(%eax,%ebx,4)
if(argfd(0, 0, &f) < 0)
return -1;
if((fd=fdalloc(f)) < 0)
return -1;
filedup(f);
80104bb4: 89 14 24 mov %edx,(%esp)
80104bb7: e8 24 c2 ff ff call 80100de0 <filedup>
return fd;
}
80104bbc: 83 c4 24 add $0x24,%esp
if(argfd(0, 0, &f) < 0)
return -1;
if((fd=fdalloc(f)) < 0)
return -1;
filedup(f);
return fd;
80104bbf: 89 d8 mov %ebx,%eax
}
80104bc1: 5b pop %ebx
80104bc2: 5d pop %ebp
80104bc3: c3 ret
80104bc4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80104bca: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80104bd0 <sys_read>:
int
sys_read(void)
{
80104bd0: 55 push %ebp
struct file *f;
int n;
char *p;
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
80104bd1: 31 c0 xor %eax,%eax
return fd;
}
int
sys_read(void)
{
80104bd3: 89 e5 mov %esp,%ebp
80104bd5: 83 ec 28 sub $0x28,%esp
struct file *f;
int n;
char *p;
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
80104bd8: 8d 55 ec lea -0x14(%ebp),%edx
80104bdb: e8 30 ff ff ff call 80104b10 <argfd.constprop.0>
80104be0: 85 c0 test %eax,%eax
80104be2: 78 54 js 80104c38 <sys_read+0x68>
80104be4: 8d 45 f0 lea -0x10(%ebp),%eax
80104be7: 89 44 24 04 mov %eax,0x4(%esp)
80104beb: c7 04 24 02 00 00 00 movl $0x2,(%esp)
80104bf2: e8 19 fc ff ff call 80104810 <argint>
80104bf7: 85 c0 test %eax,%eax
80104bf9: 78 3d js 80104c38 <sys_read+0x68>
80104bfb: 8b 45 f0 mov -0x10(%ebp),%eax
80104bfe: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80104c05: 89 44 24 08 mov %eax,0x8(%esp)
80104c09: 8d 45 f4 lea -0xc(%ebp),%eax
80104c0c: 89 44 24 04 mov %eax,0x4(%esp)
80104c10: e8 3b fc ff ff call 80104850 <argptr>
80104c15: 85 c0 test %eax,%eax
80104c17: 78 1f js 80104c38 <sys_read+0x68>
return -1;
return fileread(f, p, n);
80104c19: 8b 45 f0 mov -0x10(%ebp),%eax
80104c1c: 89 44 24 08 mov %eax,0x8(%esp)
80104c20: 8b 45 f4 mov -0xc(%ebp),%eax
80104c23: 89 44 24 04 mov %eax,0x4(%esp)
80104c27: 8b 45 ec mov -0x14(%ebp),%eax
80104c2a: 89 04 24 mov %eax,(%esp)
80104c2d: e8 0e c3 ff ff call 80100f40 <fileread>
}
80104c32: c9 leave
80104c33: c3 ret
80104c34: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
struct file *f;
int n;
char *p;
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
return -1;
80104c38: b8 ff ff ff ff mov $0xffffffff,%eax
return fileread(f, p, n);
}
80104c3d: c9 leave
80104c3e: c3 ret
80104c3f: 90 nop
80104c40 <sys_write>:
int
sys_write(void)
{
80104c40: 55 push %ebp
struct file *f;
int n;
char *p;
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
80104c41: 31 c0 xor %eax,%eax
return fileread(f, p, n);
}
int
sys_write(void)
{
80104c43: 89 e5 mov %esp,%ebp
80104c45: 83 ec 28 sub $0x28,%esp
struct file *f;
int n;
char *p;
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
80104c48: 8d 55 ec lea -0x14(%ebp),%edx
80104c4b: e8 c0 fe ff ff call 80104b10 <argfd.constprop.0>
80104c50: 85 c0 test %eax,%eax
80104c52: 78 54 js 80104ca8 <sys_write+0x68>
80104c54: 8d 45 f0 lea -0x10(%ebp),%eax
80104c57: 89 44 24 04 mov %eax,0x4(%esp)
80104c5b: c7 04 24 02 00 00 00 movl $0x2,(%esp)
80104c62: e8 a9 fb ff ff call 80104810 <argint>
80104c67: 85 c0 test %eax,%eax
80104c69: 78 3d js 80104ca8 <sys_write+0x68>
80104c6b: 8b 45 f0 mov -0x10(%ebp),%eax
80104c6e: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80104c75: 89 44 24 08 mov %eax,0x8(%esp)
80104c79: 8d 45 f4 lea -0xc(%ebp),%eax
80104c7c: 89 44 24 04 mov %eax,0x4(%esp)
80104c80: e8 cb fb ff ff call 80104850 <argptr>
80104c85: 85 c0 test %eax,%eax
80104c87: 78 1f js 80104ca8 <sys_write+0x68>
return -1;
return filewrite(f, p, n);
80104c89: 8b 45 f0 mov -0x10(%ebp),%eax
80104c8c: 89 44 24 08 mov %eax,0x8(%esp)
80104c90: 8b 45 f4 mov -0xc(%ebp),%eax
80104c93: 89 44 24 04 mov %eax,0x4(%esp)
80104c97: 8b 45 ec mov -0x14(%ebp),%eax
80104c9a: 89 04 24 mov %eax,(%esp)
80104c9d: e8 3e c3 ff ff call 80100fe0 <filewrite>
}
80104ca2: c9 leave
80104ca3: c3 ret
80104ca4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
struct file *f;
int n;
char *p;
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
return -1;
80104ca8: b8 ff ff ff ff mov $0xffffffff,%eax
return filewrite(f, p, n);
}
80104cad: c9 leave
80104cae: c3 ret
80104caf: 90 nop
80104cb0 <sys_close>:
int
sys_close(void)
{
80104cb0: 55 push %ebp
80104cb1: 89 e5 mov %esp,%ebp
80104cb3: 83 ec 28 sub $0x28,%esp
int fd;
struct file *f;
if(argfd(0, &fd, &f) < 0)
80104cb6: 8d 55 f4 lea -0xc(%ebp),%edx
80104cb9: 8d 45 f0 lea -0x10(%ebp),%eax
80104cbc: e8 4f fe ff ff call 80104b10 <argfd.constprop.0>
80104cc1: 85 c0 test %eax,%eax
80104cc3: 78 23 js 80104ce8 <sys_close+0x38>
return -1;
proc->ofile[fd] = 0;
80104cc5: 8b 55 f0 mov -0x10(%ebp),%edx
80104cc8: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104cce: c7 44 90 28 00 00 00 movl $0x0,0x28(%eax,%edx,4)
80104cd5: 00
fileclose(f);
80104cd6: 8b 45 f4 mov -0xc(%ebp),%eax
80104cd9: 89 04 24 mov %eax,(%esp)
80104cdc: e8 4f c1 ff ff call 80100e30 <fileclose>
return 0;
80104ce1: 31 c0 xor %eax,%eax
}
80104ce3: c9 leave
80104ce4: c3 ret
80104ce5: 8d 76 00 lea 0x0(%esi),%esi
{
int fd;
struct file *f;
if(argfd(0, &fd, &f) < 0)
return -1;
80104ce8: b8 ff ff ff ff mov $0xffffffff,%eax
proc->ofile[fd] = 0;
fileclose(f);
return 0;
}
80104ced: c9 leave
80104cee: c3 ret
80104cef: 90 nop
80104cf0 <sys_fstat>:
int
sys_fstat(void)
{
80104cf0: 55 push %ebp
struct file *f;
struct stat *st;
if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0)
80104cf1: 31 c0 xor %eax,%eax
return 0;
}
int
sys_fstat(void)
{
80104cf3: 89 e5 mov %esp,%ebp
80104cf5: 83 ec 28 sub $0x28,%esp
struct file *f;
struct stat *st;
if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0)
80104cf8: 8d 55 f0 lea -0x10(%ebp),%edx
80104cfb: e8 10 fe ff ff call 80104b10 <argfd.constprop.0>
80104d00: 85 c0 test %eax,%eax
80104d02: 78 34 js 80104d38 <sys_fstat+0x48>
80104d04: 8d 45 f4 lea -0xc(%ebp),%eax
80104d07: c7 44 24 08 14 00 00 movl $0x14,0x8(%esp)
80104d0e: 00
80104d0f: 89 44 24 04 mov %eax,0x4(%esp)
80104d13: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80104d1a: e8 31 fb ff ff call 80104850 <argptr>
80104d1f: 85 c0 test %eax,%eax
80104d21: 78 15 js 80104d38 <sys_fstat+0x48>
return -1;
return filestat(f, st);
80104d23: 8b 45 f4 mov -0xc(%ebp),%eax
80104d26: 89 44 24 04 mov %eax,0x4(%esp)
80104d2a: 8b 45 f0 mov -0x10(%ebp),%eax
80104d2d: 89 04 24 mov %eax,(%esp)
80104d30: e8 bb c1 ff ff call 80100ef0 <filestat>
}
80104d35: c9 leave
80104d36: c3 ret
80104d37: 90 nop
{
struct file *f;
struct stat *st;
if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0)
return -1;
80104d38: b8 ff ff ff ff mov $0xffffffff,%eax
return filestat(f, st);
}
80104d3d: c9 leave
80104d3e: c3 ret
80104d3f: 90 nop
80104d40 <sys_link>:
// Create the path new as a link to the same inode as old.
int
sys_link(void)
{
80104d40: 55 push %ebp
80104d41: 89 e5 mov %esp,%ebp
80104d43: 57 push %edi
80104d44: 56 push %esi
80104d45: 53 push %ebx
80104d46: 83 ec 3c sub $0x3c,%esp
char name[DIRSIZ], *new, *old;
struct inode *dp, *ip;
if(argstr(0, &old) < 0 || argstr(1, &new) < 0)
80104d49: 8d 45 d4 lea -0x2c(%ebp),%eax
80104d4c: 89 44 24 04 mov %eax,0x4(%esp)
80104d50: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80104d57: e8 44 fb ff ff call 801048a0 <argstr>
80104d5c: 85 c0 test %eax,%eax
80104d5e: 0f 88 e6 00 00 00 js 80104e4a <sys_link+0x10a>
80104d64: 8d 45 d0 lea -0x30(%ebp),%eax
80104d67: 89 44 24 04 mov %eax,0x4(%esp)
80104d6b: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80104d72: e8 29 fb ff ff call 801048a0 <argstr>
80104d77: 85 c0 test %eax,%eax
80104d79: 0f 88 cb 00 00 00 js 80104e4a <sys_link+0x10a>
return -1;
begin_op();
80104d7f: e8 0c de ff ff call 80102b90 <begin_op>
if((ip = namei(old)) == 0){
80104d84: 8b 45 d4 mov -0x2c(%ebp),%eax
80104d87: 89 04 24 mov %eax,(%esp)
80104d8a: e8 61 d1 ff ff call 80101ef0 <namei>
80104d8f: 85 c0 test %eax,%eax
80104d91: 89 c3 mov %eax,%ebx
80104d93: 0f 84 ac 00 00 00 je 80104e45 <sys_link+0x105>
end_op();
return -1;
}
ilock(ip);
80104d99: 89 04 24 mov %eax,(%esp)
80104d9c: e8 1f c9 ff ff call 801016c0 <ilock>
if(ip->type == T_DIR){
80104da1: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx)
80104da6: 0f 84 91 00 00 00 je 80104e3d <sys_link+0xfd>
iunlockput(ip);
end_op();
return -1;
}
ip->nlink++;
80104dac: 66 83 43 56 01 addw $0x1,0x56(%ebx)
iupdate(ip);
iunlock(ip);
if((dp = nameiparent(new, name)) == 0)
80104db1: 8d 7d da lea -0x26(%ebp),%edi
end_op();
return -1;
}
ip->nlink++;
iupdate(ip);
80104db4: 89 1c 24 mov %ebx,(%esp)
80104db7: e8 44 c8 ff ff call 80101600 <iupdate>
iunlock(ip);
80104dbc: 89 1c 24 mov %ebx,(%esp)
80104dbf: e8 cc c9 ff ff call 80101790 <iunlock>
if((dp = nameiparent(new, name)) == 0)
80104dc4: 8b 45 d0 mov -0x30(%ebp),%eax
80104dc7: 89 7c 24 04 mov %edi,0x4(%esp)
80104dcb: 89 04 24 mov %eax,(%esp)
80104dce: e8 3d d1 ff ff call 80101f10 <nameiparent>
80104dd3: 85 c0 test %eax,%eax
80104dd5: 89 c6 mov %eax,%esi
80104dd7: 74 4f je 80104e28 <sys_link+0xe8>
goto bad;
ilock(dp);
80104dd9: 89 04 24 mov %eax,(%esp)
80104ddc: e8 df c8 ff ff call 801016c0 <ilock>
if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){
80104de1: 8b 03 mov (%ebx),%eax
80104de3: 39 06 cmp %eax,(%esi)
80104de5: 75 39 jne 80104e20 <sys_link+0xe0>
80104de7: 8b 43 04 mov 0x4(%ebx),%eax
80104dea: 89 7c 24 04 mov %edi,0x4(%esp)
80104dee: 89 34 24 mov %esi,(%esp)
80104df1: 89 44 24 08 mov %eax,0x8(%esp)
80104df5: e8 16 d0 ff ff call 80101e10 <dirlink>
80104dfa: 85 c0 test %eax,%eax
80104dfc: 78 22 js 80104e20 <sys_link+0xe0>
iunlockput(dp);
goto bad;
}
iunlockput(dp);
80104dfe: 89 34 24 mov %esi,(%esp)
80104e01: e8 fa ca ff ff call 80101900 <iunlockput>
iput(ip);
80104e06: 89 1c 24 mov %ebx,(%esp)
80104e09: e8 c2 c9 ff ff call 801017d0 <iput>
end_op();
80104e0e: e8 ed dd ff ff call 80102c00 <end_op>
ip->nlink--;
iupdate(ip);
iunlockput(ip);
end_op();
return -1;
}
80104e13: 83 c4 3c add $0x3c,%esp
iunlockput(dp);
iput(ip);
end_op();
return 0;
80104e16: 31 c0 xor %eax,%eax
ip->nlink--;
iupdate(ip);
iunlockput(ip);
end_op();
return -1;
}
80104e18: 5b pop %ebx
80104e19: 5e pop %esi
80104e1a: 5f pop %edi
80104e1b: 5d pop %ebp
80104e1c: c3 ret
80104e1d: 8d 76 00 lea 0x0(%esi),%esi
if((dp = nameiparent(new, name)) == 0)
goto bad;
ilock(dp);
if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){
iunlockput(dp);
80104e20: 89 34 24 mov %esi,(%esp)
80104e23: e8 d8 ca ff ff call 80101900 <iunlockput>
end_op();
return 0;
bad:
ilock(ip);
80104e28: 89 1c 24 mov %ebx,(%esp)
80104e2b: e8 90 c8 ff ff call 801016c0 <ilock>
ip->nlink--;
80104e30: 66 83 6b 56 01 subw $0x1,0x56(%ebx)
iupdate(ip);
80104e35: 89 1c 24 mov %ebx,(%esp)
80104e38: e8 c3 c7 ff ff call 80101600 <iupdate>
iunlockput(ip);
80104e3d: 89 1c 24 mov %ebx,(%esp)
80104e40: e8 bb ca ff ff call 80101900 <iunlockput>
end_op();
80104e45: e8 b6 dd ff ff call 80102c00 <end_op>
return -1;
}
80104e4a: 83 c4 3c add $0x3c,%esp
ilock(ip);
ip->nlink--;
iupdate(ip);
iunlockput(ip);
end_op();
return -1;
80104e4d: b8 ff ff ff ff mov $0xffffffff,%eax
}
80104e52: 5b pop %ebx
80104e53: 5e pop %esi
80104e54: 5f pop %edi
80104e55: 5d pop %ebp
80104e56: c3 ret
80104e57: 89 f6 mov %esi,%esi
80104e59: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104e60 <sys_unlink>:
}
//PAGEBREAK!
int
sys_unlink(void)
{
80104e60: 55 push %ebp
80104e61: 89 e5 mov %esp,%ebp
80104e63: 57 push %edi
80104e64: 56 push %esi
80104e65: 53 push %ebx
80104e66: 83 ec 5c sub $0x5c,%esp
struct inode *ip, *dp;
struct dirent de;
char name[DIRSIZ], *path;
uint off;
if(argstr(0, &path) < 0)
80104e69: 8d 45 c0 lea -0x40(%ebp),%eax
80104e6c: 89 44 24 04 mov %eax,0x4(%esp)
80104e70: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80104e77: e8 24 fa ff ff call 801048a0 <argstr>
80104e7c: 85 c0 test %eax,%eax
80104e7e: 0f 88 76 01 00 00 js 80104ffa <sys_unlink+0x19a>
return -1;
begin_op();
80104e84: e8 07 dd ff ff call 80102b90 <begin_op>
if((dp = nameiparent(path, name)) == 0){
80104e89: 8b 45 c0 mov -0x40(%ebp),%eax
80104e8c: 8d 5d ca lea -0x36(%ebp),%ebx
80104e8f: 89 5c 24 04 mov %ebx,0x4(%esp)
80104e93: 89 04 24 mov %eax,(%esp)
80104e96: e8 75 d0 ff ff call 80101f10 <nameiparent>
80104e9b: 85 c0 test %eax,%eax
80104e9d: 89 45 b4 mov %eax,-0x4c(%ebp)
80104ea0: 0f 84 4f 01 00 00 je 80104ff5 <sys_unlink+0x195>
end_op();
return -1;
}
ilock(dp);
80104ea6: 8b 75 b4 mov -0x4c(%ebp),%esi
80104ea9: 89 34 24 mov %esi,(%esp)
80104eac: e8 0f c8 ff ff call 801016c0 <ilock>
// Cannot unlink "." or "..".
if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0)
80104eb1: c7 44 24 04 60 77 10 movl $0x80107760,0x4(%esp)
80104eb8: 80
80104eb9: 89 1c 24 mov %ebx,(%esp)
80104ebc: e8 bf cc ff ff call 80101b80 <namecmp>
80104ec1: 85 c0 test %eax,%eax
80104ec3: 0f 84 21 01 00 00 je 80104fea <sys_unlink+0x18a>
80104ec9: c7 44 24 04 5f 77 10 movl $0x8010775f,0x4(%esp)
80104ed0: 80
80104ed1: 89 1c 24 mov %ebx,(%esp)
80104ed4: e8 a7 cc ff ff call 80101b80 <namecmp>
80104ed9: 85 c0 test %eax,%eax
80104edb: 0f 84 09 01 00 00 je 80104fea <sys_unlink+0x18a>
goto bad;
if((ip = dirlookup(dp, name, &off)) == 0)
80104ee1: 8d 45 c4 lea -0x3c(%ebp),%eax
80104ee4: 89 5c 24 04 mov %ebx,0x4(%esp)
80104ee8: 89 44 24 08 mov %eax,0x8(%esp)
80104eec: 89 34 24 mov %esi,(%esp)
80104eef: e8 bc cc ff ff call 80101bb0 <dirlookup>
80104ef4: 85 c0 test %eax,%eax
80104ef6: 89 c3 mov %eax,%ebx
80104ef8: 0f 84 ec 00 00 00 je 80104fea <sys_unlink+0x18a>
goto bad;
ilock(ip);
80104efe: 89 04 24 mov %eax,(%esp)
80104f01: e8 ba c7 ff ff call 801016c0 <ilock>
if(ip->nlink < 1)
80104f06: 66 83 7b 56 00 cmpw $0x0,0x56(%ebx)
80104f0b: 0f 8e 24 01 00 00 jle 80105035 <sys_unlink+0x1d5>
panic("unlink: nlink < 1");
if(ip->type == T_DIR && !isdirempty(ip)){
80104f11: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx)
80104f16: 8d 75 d8 lea -0x28(%ebp),%esi
80104f19: 74 7d je 80104f98 <sys_unlink+0x138>
iunlockput(ip);
goto bad;
}
memset(&de, 0, sizeof(de));
80104f1b: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
80104f22: 00
80104f23: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80104f2a: 00
80104f2b: 89 34 24 mov %esi,(%esp)
80104f2e: e8 ed f5 ff ff call 80104520 <memset>
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80104f33: 8b 45 c4 mov -0x3c(%ebp),%eax
80104f36: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp)
80104f3d: 00
80104f3e: 89 74 24 04 mov %esi,0x4(%esp)
80104f42: 89 44 24 08 mov %eax,0x8(%esp)
80104f46: 8b 45 b4 mov -0x4c(%ebp),%eax
80104f49: 89 04 24 mov %eax,(%esp)
80104f4c: e8 ff ca ff ff call 80101a50 <writei>
80104f51: 83 f8 10 cmp $0x10,%eax
80104f54: 0f 85 cf 00 00 00 jne 80105029 <sys_unlink+0x1c9>
panic("unlink: writei");
if(ip->type == T_DIR){
80104f5a: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx)
80104f5f: 0f 84 a3 00 00 00 je 80105008 <sys_unlink+0x1a8>
dp->nlink--;
iupdate(dp);
}
iunlockput(dp);
80104f65: 8b 45 b4 mov -0x4c(%ebp),%eax
80104f68: 89 04 24 mov %eax,(%esp)
80104f6b: e8 90 c9 ff ff call 80101900 <iunlockput>
ip->nlink--;
80104f70: 66 83 6b 56 01 subw $0x1,0x56(%ebx)
iupdate(ip);
80104f75: 89 1c 24 mov %ebx,(%esp)
80104f78: e8 83 c6 ff ff call 80101600 <iupdate>
iunlockput(ip);
80104f7d: 89 1c 24 mov %ebx,(%esp)
80104f80: e8 7b c9 ff ff call 80101900 <iunlockput>
end_op();
80104f85: e8 76 dc ff ff call 80102c00 <end_op>
bad:
iunlockput(dp);
end_op();
return -1;
}
80104f8a: 83 c4 5c add $0x5c,%esp
iupdate(ip);
iunlockput(ip);
end_op();
return 0;
80104f8d: 31 c0 xor %eax,%eax
bad:
iunlockput(dp);
end_op();
return -1;
}
80104f8f: 5b pop %ebx
80104f90: 5e pop %esi
80104f91: 5f pop %edi
80104f92: 5d pop %ebp
80104f93: c3 ret
80104f94: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
isdirempty(struct inode *dp)
{
int off;
struct dirent de;
for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){
80104f98: 83 7b 58 20 cmpl $0x20,0x58(%ebx)
80104f9c: 0f 86 79 ff ff ff jbe 80104f1b <sys_unlink+0xbb>
80104fa2: bf 20 00 00 00 mov $0x20,%edi
80104fa7: eb 15 jmp 80104fbe <sys_unlink+0x15e>
80104fa9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80104fb0: 8d 57 10 lea 0x10(%edi),%edx
80104fb3: 3b 53 58 cmp 0x58(%ebx),%edx
80104fb6: 0f 83 5f ff ff ff jae 80104f1b <sys_unlink+0xbb>
80104fbc: 89 d7 mov %edx,%edi
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80104fbe: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp)
80104fc5: 00
80104fc6: 89 7c 24 08 mov %edi,0x8(%esp)
80104fca: 89 74 24 04 mov %esi,0x4(%esp)
80104fce: 89 1c 24 mov %ebx,(%esp)
80104fd1: e8 7a c9 ff ff call 80101950 <readi>
80104fd6: 83 f8 10 cmp $0x10,%eax
80104fd9: 75 42 jne 8010501d <sys_unlink+0x1bd>
panic("isdirempty: readi");
if(de.inum != 0)
80104fdb: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp)
80104fe0: 74 ce je 80104fb0 <sys_unlink+0x150>
ilock(ip);
if(ip->nlink < 1)
panic("unlink: nlink < 1");
if(ip->type == T_DIR && !isdirempty(ip)){
iunlockput(ip);
80104fe2: 89 1c 24 mov %ebx,(%esp)
80104fe5: e8 16 c9 ff ff call 80101900 <iunlockput>
end_op();
return 0;
bad:
iunlockput(dp);
80104fea: 8b 45 b4 mov -0x4c(%ebp),%eax
80104fed: 89 04 24 mov %eax,(%esp)
80104ff0: e8 0b c9 ff ff call 80101900 <iunlockput>
end_op();
80104ff5: e8 06 dc ff ff call 80102c00 <end_op>
return -1;
}
80104ffa: 83 c4 5c add $0x5c,%esp
return 0;
bad:
iunlockput(dp);
end_op();
return -1;
80104ffd: b8 ff ff ff ff mov $0xffffffff,%eax
}
80105002: 5b pop %ebx
80105003: 5e pop %esi
80105004: 5f pop %edi
80105005: 5d pop %ebp
80105006: c3 ret
80105007: 90 nop
memset(&de, 0, sizeof(de));
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("unlink: writei");
if(ip->type == T_DIR){
dp->nlink--;
80105008: 8b 45 b4 mov -0x4c(%ebp),%eax
8010500b: 66 83 68 56 01 subw $0x1,0x56(%eax)
iupdate(dp);
80105010: 89 04 24 mov %eax,(%esp)
80105013: e8 e8 c5 ff ff call 80101600 <iupdate>
80105018: e9 48 ff ff ff jmp 80104f65 <sys_unlink+0x105>
int off;
struct dirent de;
for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("isdirempty: readi");
8010501d: c7 04 24 84 77 10 80 movl $0x80107784,(%esp)
80105024: e8 37 b3 ff ff call 80100360 <panic>
goto bad;
}
memset(&de, 0, sizeof(de));
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("unlink: writei");
80105029: c7 04 24 96 77 10 80 movl $0x80107796,(%esp)
80105030: e8 2b b3 ff ff call 80100360 <panic>
if((ip = dirlookup(dp, name, &off)) == 0)
goto bad;
ilock(ip);
if(ip->nlink < 1)
panic("unlink: nlink < 1");
80105035: c7 04 24 72 77 10 80 movl $0x80107772,(%esp)
8010503c: e8 1f b3 ff ff call 80100360 <panic>
80105041: eb 0d jmp 80105050 <sys_open>
80105043: 90 nop
80105044: 90 nop
80105045: 90 nop
80105046: 90 nop
80105047: 90 nop
80105048: 90 nop
80105049: 90 nop
8010504a: 90 nop
8010504b: 90 nop
8010504c: 90 nop
8010504d: 90 nop
8010504e: 90 nop
8010504f: 90 nop
80105050 <sys_open>:
return ip;
}
int
sys_open(void)
{
80105050: 55 push %ebp
80105051: 89 e5 mov %esp,%ebp
80105053: 57 push %edi
80105054: 56 push %esi
80105055: 53 push %ebx
80105056: 83 ec 2c sub $0x2c,%esp
char *path;
int fd, omode;
struct file *f;
struct inode *ip;
if(argstr(0, &path) < 0 || argint(1, &omode) < 0)
80105059: 8d 45 e0 lea -0x20(%ebp),%eax
8010505c: 89 44 24 04 mov %eax,0x4(%esp)
80105060: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105067: e8 34 f8 ff ff call 801048a0 <argstr>
8010506c: 85 c0 test %eax,%eax
8010506e: 0f 88 81 00 00 00 js 801050f5 <sys_open+0xa5>
80105074: 8d 45 e4 lea -0x1c(%ebp),%eax
80105077: 89 44 24 04 mov %eax,0x4(%esp)
8010507b: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80105082: e8 89 f7 ff ff call 80104810 <argint>
80105087: 85 c0 test %eax,%eax
80105089: 78 6a js 801050f5 <sys_open+0xa5>
return -1;
begin_op();
8010508b: e8 00 db ff ff call 80102b90 <begin_op>
if(omode & O_CREATE){
80105090: f6 45 e5 02 testb $0x2,-0x1b(%ebp)
80105094: 75 72 jne 80105108 <sys_open+0xb8>
if(ip == 0){
end_op();
return -1;
}
} else {
if((ip = namei(path)) == 0){
80105096: 8b 45 e0 mov -0x20(%ebp),%eax
80105099: 89 04 24 mov %eax,(%esp)
8010509c: e8 4f ce ff ff call 80101ef0 <namei>
801050a1: 85 c0 test %eax,%eax
801050a3: 89 c7 mov %eax,%edi
801050a5: 74 49 je 801050f0 <sys_open+0xa0>
end_op();
return -1;
}
ilock(ip);
801050a7: 89 04 24 mov %eax,(%esp)
801050aa: e8 11 c6 ff ff call 801016c0 <ilock>
if(ip->type == T_DIR && omode != O_RDONLY){
801050af: 66 83 7f 50 01 cmpw $0x1,0x50(%edi)
801050b4: 0f 84 ae 00 00 00 je 80105168 <sys_open+0x118>
end_op();
return -1;
}
}
if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){
801050ba: e8 b1 bc ff ff call 80100d70 <filealloc>
801050bf: 85 c0 test %eax,%eax
801050c1: 89 c6 mov %eax,%esi
801050c3: 74 23 je 801050e8 <sys_open+0x98>
801050c5: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
801050cc: 31 db xor %ebx,%ebx
801050ce: 66 90 xchg %ax,%ax
fdalloc(struct file *f)
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
if(proc->ofile[fd] == 0){
801050d0: 8b 44 9a 28 mov 0x28(%edx,%ebx,4),%eax
801050d4: 85 c0 test %eax,%eax
801050d6: 74 50 je 80105128 <sys_open+0xd8>
static int
fdalloc(struct file *f)
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
801050d8: 83 c3 01 add $0x1,%ebx
801050db: 83 fb 10 cmp $0x10,%ebx
801050de: 75 f0 jne 801050d0 <sys_open+0x80>
}
}
if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){
if(f)
fileclose(f);
801050e0: 89 34 24 mov %esi,(%esp)
801050e3: e8 48 bd ff ff call 80100e30 <fileclose>
iunlockput(ip);
801050e8: 89 3c 24 mov %edi,(%esp)
801050eb: e8 10 c8 ff ff call 80101900 <iunlockput>
end_op();
801050f0: e8 0b db ff ff call 80102c00 <end_op>
f->ip = ip;
f->off = 0;
f->readable = !(omode & O_WRONLY);
f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
return fd;
}
801050f5: 83 c4 2c add $0x2c,%esp
if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){
if(f)
fileclose(f);
iunlockput(ip);
end_op();
return -1;
801050f8: b8 ff ff ff ff mov $0xffffffff,%eax
f->ip = ip;
f->off = 0;
f->readable = !(omode & O_WRONLY);
f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
return fd;
}
801050fd: 5b pop %ebx
801050fe: 5e pop %esi
801050ff: 5f pop %edi
80105100: 5d pop %ebp
80105101: c3 ret
80105102: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
return -1;
begin_op();
if(omode & O_CREATE){
ip = create(path, T_FILE, 0, 0);
80105108: 8b 45 e0 mov -0x20(%ebp),%eax
8010510b: 31 c9 xor %ecx,%ecx
8010510d: ba 02 00 00 00 mov $0x2,%edx
80105112: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105119: e8 72 f8 ff ff call 80104990 <create>
if(ip == 0){
8010511e: 85 c0 test %eax,%eax
return -1;
begin_op();
if(omode & O_CREATE){
ip = create(path, T_FILE, 0, 0);
80105120: 89 c7 mov %eax,%edi
if(ip == 0){
80105122: 75 96 jne 801050ba <sys_open+0x6a>
80105124: eb ca jmp 801050f0 <sys_open+0xa0>
80105126: 66 90 xchg %ax,%ax
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
if(proc->ofile[fd] == 0){
proc->ofile[fd] = f;
80105128: 89 74 9a 28 mov %esi,0x28(%edx,%ebx,4)
fileclose(f);
iunlockput(ip);
end_op();
return -1;
}
iunlock(ip);
8010512c: 89 3c 24 mov %edi,(%esp)
8010512f: e8 5c c6 ff ff call 80101790 <iunlock>
end_op();
80105134: e8 c7 da ff ff call 80102c00 <end_op>
f->type = FD_INODE;
80105139: c7 06 02 00 00 00 movl $0x2,(%esi)
f->ip = ip;
f->off = 0;
f->readable = !(omode & O_WRONLY);
8010513f: 8b 55 e4 mov -0x1c(%ebp),%edx
}
iunlock(ip);
end_op();
f->type = FD_INODE;
f->ip = ip;
80105142: 89 7e 10 mov %edi,0x10(%esi)
f->off = 0;
80105145: c7 46 14 00 00 00 00 movl $0x0,0x14(%esi)
f->readable = !(omode & O_WRONLY);
8010514c: 89 d0 mov %edx,%eax
8010514e: 83 e0 01 and $0x1,%eax
80105151: 83 f0 01 xor $0x1,%eax
f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
80105154: 83 e2 03 and $0x3,%edx
end_op();
f->type = FD_INODE;
f->ip = ip;
f->off = 0;
f->readable = !(omode & O_WRONLY);
80105157: 88 46 08 mov %al,0x8(%esi)
f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
return fd;
8010515a: 89 d8 mov %ebx,%eax
f->type = FD_INODE;
f->ip = ip;
f->off = 0;
f->readable = !(omode & O_WRONLY);
f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
8010515c: 0f 95 46 09 setne 0x9(%esi)
return fd;
}
80105160: 83 c4 2c add $0x2c,%esp
80105163: 5b pop %ebx
80105164: 5e pop %esi
80105165: 5f pop %edi
80105166: 5d pop %ebp
80105167: c3 ret
if((ip = namei(path)) == 0){
end_op();
return -1;
}
ilock(ip);
if(ip->type == T_DIR && omode != O_RDONLY){
80105168: 8b 55 e4 mov -0x1c(%ebp),%edx
8010516b: 85 d2 test %edx,%edx
8010516d: 0f 84 47 ff ff ff je 801050ba <sys_open+0x6a>
80105173: e9 70 ff ff ff jmp 801050e8 <sys_open+0x98>
80105178: 90 nop
80105179: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80105180 <sys_mkdir>:
return fd;
}
int
sys_mkdir(void)
{
80105180: 55 push %ebp
80105181: 89 e5 mov %esp,%ebp
80105183: 83 ec 28 sub $0x28,%esp
char *path;
struct inode *ip;
begin_op();
80105186: e8 05 da ff ff call 80102b90 <begin_op>
if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0){
8010518b: 8d 45 f4 lea -0xc(%ebp),%eax
8010518e: 89 44 24 04 mov %eax,0x4(%esp)
80105192: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105199: e8 02 f7 ff ff call 801048a0 <argstr>
8010519e: 85 c0 test %eax,%eax
801051a0: 78 2e js 801051d0 <sys_mkdir+0x50>
801051a2: 8b 45 f4 mov -0xc(%ebp),%eax
801051a5: 31 c9 xor %ecx,%ecx
801051a7: ba 01 00 00 00 mov $0x1,%edx
801051ac: c7 04 24 00 00 00 00 movl $0x0,(%esp)
801051b3: e8 d8 f7 ff ff call 80104990 <create>
801051b8: 85 c0 test %eax,%eax
801051ba: 74 14 je 801051d0 <sys_mkdir+0x50>
end_op();
return -1;
}
iunlockput(ip);
801051bc: 89 04 24 mov %eax,(%esp)
801051bf: e8 3c c7 ff ff call 80101900 <iunlockput>
end_op();
801051c4: e8 37 da ff ff call 80102c00 <end_op>
return 0;
801051c9: 31 c0 xor %eax,%eax
}
801051cb: c9 leave
801051cc: c3 ret
801051cd: 8d 76 00 lea 0x0(%esi),%esi
char *path;
struct inode *ip;
begin_op();
if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0){
end_op();
801051d0: e8 2b da ff ff call 80102c00 <end_op>
return -1;
801051d5: b8 ff ff ff ff mov $0xffffffff,%eax
}
iunlockput(ip);
end_op();
return 0;
}
801051da: c9 leave
801051db: c3 ret
801051dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801051e0 <sys_mknod>:
int
sys_mknod(void)
{
801051e0: 55 push %ebp
801051e1: 89 e5 mov %esp,%ebp
801051e3: 83 ec 28 sub $0x28,%esp
struct inode *ip;
char *path;
int major, minor;
begin_op();
801051e6: e8 a5 d9 ff ff call 80102b90 <begin_op>
if((argstr(0, &path)) < 0 ||
801051eb: 8d 45 ec lea -0x14(%ebp),%eax
801051ee: 89 44 24 04 mov %eax,0x4(%esp)
801051f2: c7 04 24 00 00 00 00 movl $0x0,(%esp)
801051f9: e8 a2 f6 ff ff call 801048a0 <argstr>
801051fe: 85 c0 test %eax,%eax
80105200: 78 5e js 80105260 <sys_mknod+0x80>
argint(1, &major) < 0 ||
80105202: 8d 45 f0 lea -0x10(%ebp),%eax
80105205: 89 44 24 04 mov %eax,0x4(%esp)
80105209: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80105210: e8 fb f5 ff ff call 80104810 <argint>
struct inode *ip;
char *path;
int major, minor;
begin_op();
if((argstr(0, &path)) < 0 ||
80105215: 85 c0 test %eax,%eax
80105217: 78 47 js 80105260 <sys_mknod+0x80>
argint(1, &major) < 0 ||
argint(2, &minor) < 0 ||
80105219: 8d 45 f4 lea -0xc(%ebp),%eax
8010521c: 89 44 24 04 mov %eax,0x4(%esp)
80105220: c7 04 24 02 00 00 00 movl $0x2,(%esp)
80105227: e8 e4 f5 ff ff call 80104810 <argint>
char *path;
int major, minor;
begin_op();
if((argstr(0, &path)) < 0 ||
argint(1, &major) < 0 ||
8010522c: 85 c0 test %eax,%eax
8010522e: 78 30 js 80105260 <sys_mknod+0x80>
argint(2, &minor) < 0 ||
(ip = create(path, T_DEV, major, minor)) == 0){
80105230: 0f bf 45 f4 movswl -0xc(%ebp),%eax
int major, minor;
begin_op();
if((argstr(0, &path)) < 0 ||
argint(1, &major) < 0 ||
argint(2, &minor) < 0 ||
80105234: ba 03 00 00 00 mov $0x3,%edx
(ip = create(path, T_DEV, major, minor)) == 0){
80105239: 0f bf 4d f0 movswl -0x10(%ebp),%ecx
8010523d: 89 04 24 mov %eax,(%esp)
int major, minor;
begin_op();
if((argstr(0, &path)) < 0 ||
argint(1, &major) < 0 ||
argint(2, &minor) < 0 ||
80105240: 8b 45 ec mov -0x14(%ebp),%eax
80105243: e8 48 f7 ff ff call 80104990 <create>
80105248: 85 c0 test %eax,%eax
8010524a: 74 14 je 80105260 <sys_mknod+0x80>
(ip = create(path, T_DEV, major, minor)) == 0){
end_op();
return -1;
}
iunlockput(ip);
8010524c: 89 04 24 mov %eax,(%esp)
8010524f: e8 ac c6 ff ff call 80101900 <iunlockput>
end_op();
80105254: e8 a7 d9 ff ff call 80102c00 <end_op>
return 0;
80105259: 31 c0 xor %eax,%eax
}
8010525b: c9 leave
8010525c: c3 ret
8010525d: 8d 76 00 lea 0x0(%esi),%esi
begin_op();
if((argstr(0, &path)) < 0 ||
argint(1, &major) < 0 ||
argint(2, &minor) < 0 ||
(ip = create(path, T_DEV, major, minor)) == 0){
end_op();
80105260: e8 9b d9 ff ff call 80102c00 <end_op>
return -1;
80105265: b8 ff ff ff ff mov $0xffffffff,%eax
}
iunlockput(ip);
end_op();
return 0;
}
8010526a: c9 leave
8010526b: c3 ret
8010526c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80105270 <sys_chdir>:
int
sys_chdir(void)
{
80105270: 55 push %ebp
80105271: 89 e5 mov %esp,%ebp
80105273: 53 push %ebx
80105274: 83 ec 24 sub $0x24,%esp
char *path;
struct inode *ip;
begin_op();
80105277: e8 14 d9 ff ff call 80102b90 <begin_op>
if(argstr(0, &path) < 0 || (ip = namei(path)) == 0){
8010527c: 8d 45 f4 lea -0xc(%ebp),%eax
8010527f: 89 44 24 04 mov %eax,0x4(%esp)
80105283: c7 04 24 00 00 00 00 movl $0x0,(%esp)
8010528a: e8 11 f6 ff ff call 801048a0 <argstr>
8010528f: 85 c0 test %eax,%eax
80105291: 78 5a js 801052ed <sys_chdir+0x7d>
80105293: 8b 45 f4 mov -0xc(%ebp),%eax
80105296: 89 04 24 mov %eax,(%esp)
80105299: e8 52 cc ff ff call 80101ef0 <namei>
8010529e: 85 c0 test %eax,%eax
801052a0: 89 c3 mov %eax,%ebx
801052a2: 74 49 je 801052ed <sys_chdir+0x7d>
end_op();
return -1;
}
ilock(ip);
801052a4: 89 04 24 mov %eax,(%esp)
801052a7: e8 14 c4 ff ff call 801016c0 <ilock>
if(ip->type != T_DIR){
801052ac: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx)
iunlockput(ip);
801052b1: 89 1c 24 mov %ebx,(%esp)
if(argstr(0, &path) < 0 || (ip = namei(path)) == 0){
end_op();
return -1;
}
ilock(ip);
if(ip->type != T_DIR){
801052b4: 75 32 jne 801052e8 <sys_chdir+0x78>
iunlockput(ip);
end_op();
return -1;
}
iunlock(ip);
801052b6: e8 d5 c4 ff ff call 80101790 <iunlock>
iput(proc->cwd);
801052bb: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801052c1: 8b 40 68 mov 0x68(%eax),%eax
801052c4: 89 04 24 mov %eax,(%esp)
801052c7: e8 04 c5 ff ff call 801017d0 <iput>
end_op();
801052cc: e8 2f d9 ff ff call 80102c00 <end_op>
proc->cwd = ip;
801052d1: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801052d7: 89 58 68 mov %ebx,0x68(%eax)
return 0;
}
801052da: 83 c4 24 add $0x24,%esp
}
iunlock(ip);
iput(proc->cwd);
end_op();
proc->cwd = ip;
return 0;
801052dd: 31 c0 xor %eax,%eax
}
801052df: 5b pop %ebx
801052e0: 5d pop %ebp
801052e1: c3 ret
801052e2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
end_op();
return -1;
}
ilock(ip);
if(ip->type != T_DIR){
iunlockput(ip);
801052e8: e8 13 c6 ff ff call 80101900 <iunlockput>
end_op();
801052ed: e8 0e d9 ff ff call 80102c00 <end_op>
iunlock(ip);
iput(proc->cwd);
end_op();
proc->cwd = ip;
return 0;
}
801052f2: 83 c4 24 add $0x24,%esp
}
ilock(ip);
if(ip->type != T_DIR){
iunlockput(ip);
end_op();
return -1;
801052f5: b8 ff ff ff ff mov $0xffffffff,%eax
iunlock(ip);
iput(proc->cwd);
end_op();
proc->cwd = ip;
return 0;
}
801052fa: 5b pop %ebx
801052fb: 5d pop %ebp
801052fc: c3 ret
801052fd: 8d 76 00 lea 0x0(%esi),%esi
80105300 <sys_exec>:
int
sys_exec(void)
{
80105300: 55 push %ebp
80105301: 89 e5 mov %esp,%ebp
80105303: 57 push %edi
80105304: 56 push %esi
80105305: 53 push %ebx
80105306: 81 ec ac 00 00 00 sub $0xac,%esp
char *path, *argv[MAXARG];
int i;
uint uargv, uarg;
if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
8010530c: 8d 85 5c ff ff ff lea -0xa4(%ebp),%eax
80105312: 89 44 24 04 mov %eax,0x4(%esp)
80105316: c7 04 24 00 00 00 00 movl $0x0,(%esp)
8010531d: e8 7e f5 ff ff call 801048a0 <argstr>
80105322: 85 c0 test %eax,%eax
80105324: 0f 88 84 00 00 00 js 801053ae <sys_exec+0xae>
8010532a: 8d 85 60 ff ff ff lea -0xa0(%ebp),%eax
80105330: 89 44 24 04 mov %eax,0x4(%esp)
80105334: c7 04 24 01 00 00 00 movl $0x1,(%esp)
8010533b: e8 d0 f4 ff ff call 80104810 <argint>
80105340: 85 c0 test %eax,%eax
80105342: 78 6a js 801053ae <sys_exec+0xae>
return -1;
}
memset(argv, 0, sizeof(argv));
80105344: 8d 85 68 ff ff ff lea -0x98(%ebp),%eax
for(i=0;; i++){
8010534a: 31 db xor %ebx,%ebx
uint uargv, uarg;
if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
return -1;
}
memset(argv, 0, sizeof(argv));
8010534c: c7 44 24 08 80 00 00 movl $0x80,0x8(%esp)
80105353: 00
80105354: 8d b5 68 ff ff ff lea -0x98(%ebp),%esi
8010535a: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80105361: 00
80105362: 8d bd 64 ff ff ff lea -0x9c(%ebp),%edi
80105368: 89 04 24 mov %eax,(%esp)
8010536b: e8 b0 f1 ff ff call 80104520 <memset>
for(i=0;; i++){
if(i >= NELEM(argv))
return -1;
if(fetchint(uargv+4*i, (int*)&uarg) < 0)
80105370: 8b 85 60 ff ff ff mov -0xa0(%ebp),%eax
80105376: 89 7c 24 04 mov %edi,0x4(%esp)
8010537a: 8d 04 98 lea (%eax,%ebx,4),%eax
8010537d: 89 04 24 mov %eax,(%esp)
80105380: e8 0b f4 ff ff call 80104790 <fetchint>
80105385: 85 c0 test %eax,%eax
80105387: 78 25 js 801053ae <sys_exec+0xae>
return -1;
if(uarg == 0){
80105389: 8b 85 64 ff ff ff mov -0x9c(%ebp),%eax
8010538f: 85 c0 test %eax,%eax
80105391: 74 2d je 801053c0 <sys_exec+0xc0>
argv[i] = 0;
break;
}
if(fetchstr(uarg, &argv[i]) < 0)
80105393: 89 74 24 04 mov %esi,0x4(%esp)
80105397: 89 04 24 mov %eax,(%esp)
8010539a: e8 21 f4 ff ff call 801047c0 <fetchstr>
8010539f: 85 c0 test %eax,%eax
801053a1: 78 0b js 801053ae <sys_exec+0xae>
if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
return -1;
}
memset(argv, 0, sizeof(argv));
for(i=0;; i++){
801053a3: 83 c3 01 add $0x1,%ebx
801053a6: 83 c6 04 add $0x4,%esi
if(i >= NELEM(argv))
801053a9: 83 fb 20 cmp $0x20,%ebx
801053ac: 75 c2 jne 80105370 <sys_exec+0x70>
}
if(fetchstr(uarg, &argv[i]) < 0)
return -1;
}
return exec(path, argv);
}
801053ae: 81 c4 ac 00 00 00 add $0xac,%esp
char *path, *argv[MAXARG];
int i;
uint uargv, uarg;
if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
return -1;
801053b4: b8 ff ff ff ff mov $0xffffffff,%eax
}
if(fetchstr(uarg, &argv[i]) < 0)
return -1;
}
return exec(path, argv);
}
801053b9: 5b pop %ebx
801053ba: 5e pop %esi
801053bb: 5f pop %edi
801053bc: 5d pop %ebp
801053bd: c3 ret
801053be: 66 90 xchg %ax,%ax
break;
}
if(fetchstr(uarg, &argv[i]) < 0)
return -1;
}
return exec(path, argv);
801053c0: 8d 85 68 ff ff ff lea -0x98(%ebp),%eax
801053c6: 89 44 24 04 mov %eax,0x4(%esp)
801053ca: 8b 85 5c ff ff ff mov -0xa4(%ebp),%eax
if(i >= NELEM(argv))
return -1;
if(fetchint(uargv+4*i, (int*)&uarg) < 0)
return -1;
if(uarg == 0){
argv[i] = 0;
801053d0: c7 84 9d 68 ff ff ff movl $0x0,-0x98(%ebp,%ebx,4)
801053d7: 00 00 00 00
break;
}
if(fetchstr(uarg, &argv[i]) < 0)
return -1;
}
return exec(path, argv);
801053db: 89 04 24 mov %eax,(%esp)
801053de: e8 cd b5 ff ff call 801009b0 <exec>
}
801053e3: 81 c4 ac 00 00 00 add $0xac,%esp
801053e9: 5b pop %ebx
801053ea: 5e pop %esi
801053eb: 5f pop %edi
801053ec: 5d pop %ebp
801053ed: c3 ret
801053ee: 66 90 xchg %ax,%ax
801053f0 <sys_pipe>:
int
sys_pipe(void)
{
801053f0: 55 push %ebp
801053f1: 89 e5 mov %esp,%ebp
801053f3: 57 push %edi
801053f4: 56 push %esi
801053f5: 53 push %ebx
801053f6: 83 ec 2c sub $0x2c,%esp
int *fd;
struct file *rf, *wf;
int fd0, fd1;
if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0)
801053f9: 8d 45 dc lea -0x24(%ebp),%eax
801053fc: c7 44 24 08 08 00 00 movl $0x8,0x8(%esp)
80105403: 00
80105404: 89 44 24 04 mov %eax,0x4(%esp)
80105408: c7 04 24 00 00 00 00 movl $0x0,(%esp)
8010540f: e8 3c f4 ff ff call 80104850 <argptr>
80105414: 85 c0 test %eax,%eax
80105416: 78 7a js 80105492 <sys_pipe+0xa2>
return -1;
if(pipealloc(&rf, &wf) < 0)
80105418: 8d 45 e4 lea -0x1c(%ebp),%eax
8010541b: 89 44 24 04 mov %eax,0x4(%esp)
8010541f: 8d 45 e0 lea -0x20(%ebp),%eax
80105422: 89 04 24 mov %eax,(%esp)
80105425: e8 a6 de ff ff call 801032d0 <pipealloc>
8010542a: 85 c0 test %eax,%eax
8010542c: 78 64 js 80105492 <sys_pipe+0xa2>
8010542e: 65 8b 0d 04 00 00 00 mov %gs:0x4,%ecx
static int
fdalloc(struct file *f)
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
80105435: 31 c0 xor %eax,%eax
if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0)
return -1;
if(pipealloc(&rf, &wf) < 0)
return -1;
fd0 = -1;
if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
80105437: 8b 5d e0 mov -0x20(%ebp),%ebx
fdalloc(struct file *f)
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
if(proc->ofile[fd] == 0){
8010543a: 8b 54 81 28 mov 0x28(%ecx,%eax,4),%edx
8010543e: 85 d2 test %edx,%edx
80105440: 74 16 je 80105458 <sys_pipe+0x68>
80105442: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
static int
fdalloc(struct file *f)
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
80105448: 83 c0 01 add $0x1,%eax
8010544b: 83 f8 10 cmp $0x10,%eax
8010544e: 74 2f je 8010547f <sys_pipe+0x8f>
if(proc->ofile[fd] == 0){
80105450: 8b 54 81 28 mov 0x28(%ecx,%eax,4),%edx
80105454: 85 d2 test %edx,%edx
80105456: 75 f0 jne 80105448 <sys_pipe+0x58>
if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0)
return -1;
if(pipealloc(&rf, &wf) < 0)
return -1;
fd0 = -1;
if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
80105458: 8b 7d e4 mov -0x1c(%ebp),%edi
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
if(proc->ofile[fd] == 0){
proc->ofile[fd] = f;
8010545b: 8d 70 08 lea 0x8(%eax),%esi
static int
fdalloc(struct file *f)
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
8010545e: 31 d2 xor %edx,%edx
if(proc->ofile[fd] == 0){
proc->ofile[fd] = f;
80105460: 89 5c b1 08 mov %ebx,0x8(%ecx,%esi,4)
80105464: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
fdalloc(struct file *f)
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
if(proc->ofile[fd] == 0){
80105468: 83 7c 91 28 00 cmpl $0x0,0x28(%ecx,%edx,4)
8010546d: 74 31 je 801054a0 <sys_pipe+0xb0>
static int
fdalloc(struct file *f)
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
8010546f: 83 c2 01 add $0x1,%edx
80105472: 83 fa 10 cmp $0x10,%edx
80105475: 75 f1 jne 80105468 <sys_pipe+0x78>
if(pipealloc(&rf, &wf) < 0)
return -1;
fd0 = -1;
if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
if(fd0 >= 0)
proc->ofile[fd0] = 0;
80105477: c7 44 b1 08 00 00 00 movl $0x0,0x8(%ecx,%esi,4)
8010547e: 00
fileclose(rf);
8010547f: 89 1c 24 mov %ebx,(%esp)
80105482: e8 a9 b9 ff ff call 80100e30 <fileclose>
fileclose(wf);
80105487: 8b 45 e4 mov -0x1c(%ebp),%eax
8010548a: 89 04 24 mov %eax,(%esp)
8010548d: e8 9e b9 ff ff call 80100e30 <fileclose>
return -1;
}
fd[0] = fd0;
fd[1] = fd1;
return 0;
}
80105492: 83 c4 2c add $0x2c,%esp
if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
if(fd0 >= 0)
proc->ofile[fd0] = 0;
fileclose(rf);
fileclose(wf);
return -1;
80105495: b8 ff ff ff ff mov $0xffffffff,%eax
}
fd[0] = fd0;
fd[1] = fd1;
return 0;
}
8010549a: 5b pop %ebx
8010549b: 5e pop %esi
8010549c: 5f pop %edi
8010549d: 5d pop %ebp
8010549e: c3 ret
8010549f: 90 nop
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
if(proc->ofile[fd] == 0){
proc->ofile[fd] = f;
801054a0: 89 7c 91 28 mov %edi,0x28(%ecx,%edx,4)
proc->ofile[fd0] = 0;
fileclose(rf);
fileclose(wf);
return -1;
}
fd[0] = fd0;
801054a4: 8b 4d dc mov -0x24(%ebp),%ecx
801054a7: 89 01 mov %eax,(%ecx)
fd[1] = fd1;
801054a9: 8b 45 dc mov -0x24(%ebp),%eax
801054ac: 89 50 04 mov %edx,0x4(%eax)
return 0;
}
801054af: 83 c4 2c add $0x2c,%esp
fileclose(wf);
return -1;
}
fd[0] = fd0;
fd[1] = fd1;
return 0;
801054b2: 31 c0 xor %eax,%eax
}
801054b4: 5b pop %ebx
801054b5: 5e pop %esi
801054b6: 5f pop %edi
801054b7: 5d pop %ebp
801054b8: c3 ret
801054b9: 66 90 xchg %ax,%ax
801054bb: 66 90 xchg %ax,%ax
801054bd: 66 90 xchg %ax,%ax
801054bf: 90 nop
801054c0 <sys_fork>:
#include "proc.h"
#include "stdint.h"
#define static uint8_t seed=7;
int
sys_fork(void)
{
801054c0: 55 push %ebp
801054c1: 89 e5 mov %esp,%ebp
return fork();
}
801054c3: 5d pop %ebp
#include "stdint.h"
#define static uint8_t seed=7;
int
sys_fork(void)
{
return fork();
801054c4: e9 d7 e4 ff ff jmp 801039a0 <fork>
801054c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801054d0 <sys_exit>:
}
int
sys_exit(void)
{
801054d0: 55 push %ebp
801054d1: 89 e5 mov %esp,%ebp
801054d3: 83 ec 08 sub $0x8,%esp
exit();
801054d6: e8 45 e8 ff ff call 80103d20 <exit>
return 0; // not reached
}
801054db: 31 c0 xor %eax,%eax
801054dd: c9 leave
801054de: c3 ret
801054df: 90 nop
801054e0 <sys_wait>:
int
sys_wait(void)
{
801054e0: 55 push %ebp
801054e1: 89 e5 mov %esp,%ebp
return wait();
}
801054e3: 5d pop %ebp
}
int
sys_wait(void)
{
return wait();
801054e4: e9 77 ea ff ff jmp 80103f60 <wait>
801054e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801054f0 <sys_kill>:
}
int
sys_kill(void)
{
801054f0: 55 push %ebp
801054f1: 89 e5 mov %esp,%ebp
801054f3: 83 ec 28 sub $0x28,%esp
int pid;
if(argint(0, &pid) < 0)
801054f6: 8d 45 f4 lea -0xc(%ebp),%eax
801054f9: 89 44 24 04 mov %eax,0x4(%esp)
801054fd: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105504: e8 07 f3 ff ff call 80104810 <argint>
80105509: 85 c0 test %eax,%eax
8010550b: 78 13 js 80105520 <sys_kill+0x30>
return -1;
return kill(pid);
8010550d: 8b 45 f4 mov -0xc(%ebp),%eax
80105510: 89 04 24 mov %eax,(%esp)
80105513: e8 a8 eb ff ff call 801040c0 <kill>
}
80105518: c9 leave
80105519: c3 ret
8010551a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
sys_kill(void)
{
int pid;
if(argint(0, &pid) < 0)
return -1;
80105520: b8 ff ff ff ff mov $0xffffffff,%eax
return kill(pid);
}
80105525: c9 leave
80105526: c3 ret
80105527: 89 f6 mov %esi,%esi
80105529: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80105530 <sys_getpid>:
int
sys_getpid(void)
{
return proc->pid;
80105530: 65 a1 04 00 00 00 mov %gs:0x4,%eax
return kill(pid);
}
int
sys_getpid(void)
{
80105536: 55 push %ebp
80105537: 89 e5 mov %esp,%ebp
return proc->pid;
}
80105539: 5d pop %ebp
}
int
sys_getpid(void)
{
return proc->pid;
8010553a: 8b 40 10 mov 0x10(%eax),%eax
}
8010553d: c3 ret
8010553e: 66 90 xchg %ax,%ax
80105540 <sys_sbrk>:
int
sys_sbrk(void)
{
80105540: 55 push %ebp
80105541: 89 e5 mov %esp,%ebp
80105543: 53 push %ebx
80105544: 83 ec 24 sub $0x24,%esp
int addr;
int n;
if(argint(0, &n) < 0)
80105547: 8d 45 f4 lea -0xc(%ebp),%eax
8010554a: 89 44 24 04 mov %eax,0x4(%esp)
8010554e: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105555: e8 b6 f2 ff ff call 80104810 <argint>
8010555a: 85 c0 test %eax,%eax
8010555c: 78 22 js 80105580 <sys_sbrk+0x40>
return -1;
addr = proc->sz;
8010555e: 65 a1 04 00 00 00 mov %gs:0x4,%eax
if(growproc(n) < 0)
80105564: 8b 55 f4 mov -0xc(%ebp),%edx
int addr;
int n;
if(argint(0, &n) < 0)
return -1;
addr = proc->sz;
80105567: 8b 18 mov (%eax),%ebx
if(growproc(n) < 0)
80105569: 89 14 24 mov %edx,(%esp)
8010556c: e8 5f e3 ff ff call 801038d0 <growproc>
80105571: 85 c0 test %eax,%eax
80105573: 78 0b js 80105580 <sys_sbrk+0x40>
return -1;
return addr;
80105575: 89 d8 mov %ebx,%eax
}
80105577: 83 c4 24 add $0x24,%esp
8010557a: 5b pop %ebx
8010557b: 5d pop %ebp
8010557c: c3 ret
8010557d: 8d 76 00 lea 0x0(%esi),%esi
{
int addr;
int n;
if(argint(0, &n) < 0)
return -1;
80105580: b8 ff ff ff ff mov $0xffffffff,%eax
80105585: eb f0 jmp 80105577 <sys_sbrk+0x37>
80105587: 89 f6 mov %esi,%esi
80105589: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80105590 <sys_sleep>:
return addr;
}
int
sys_sleep(void)
{
80105590: 55 push %ebp
80105591: 89 e5 mov %esp,%ebp
80105593: 53 push %ebx
80105594: 83 ec 24 sub $0x24,%esp
int n;
uint ticks0;
if(argint(0, &n) < 0)
80105597: 8d 45 f4 lea -0xc(%ebp),%eax
8010559a: 89 44 24 04 mov %eax,0x4(%esp)
8010559e: c7 04 24 00 00 00 00 movl $0x0,(%esp)
801055a5: e8 66 f2 ff ff call 80104810 <argint>
801055aa: 85 c0 test %eax,%eax
801055ac: 78 7e js 8010562c <sys_sleep+0x9c>
return -1;
acquire(&tickslock);
801055ae: c7 04 24 e0 54 11 80 movl $0x801154e0,(%esp)
801055b5: e8 e6 ed ff ff call 801043a0 <acquire>
ticks0 = ticks;
while(ticks - ticks0 < n){
801055ba: 8b 55 f4 mov -0xc(%ebp),%edx
uint ticks0;
if(argint(0, &n) < 0)
return -1;
acquire(&tickslock);
ticks0 = ticks;
801055bd: 8b 1d 20 5d 11 80 mov 0x80115d20,%ebx
while(ticks - ticks0 < n){
801055c3: 85 d2 test %edx,%edx
801055c5: 75 29 jne 801055f0 <sys_sleep+0x60>
801055c7: eb 4f jmp 80105618 <sys_sleep+0x88>
801055c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(proc->killed){
release(&tickslock);
return -1;
}
sleep(&ticks, &tickslock);
801055d0: c7 44 24 04 e0 54 11 movl $0x801154e0,0x4(%esp)
801055d7: 80
801055d8: c7 04 24 20 5d 11 80 movl $0x80115d20,(%esp)
801055df: e8 bc e8 ff ff call 80103ea0 <sleep>
if(argint(0, &n) < 0)
return -1;
acquire(&tickslock);
ticks0 = ticks;
while(ticks - ticks0 < n){
801055e4: a1 20 5d 11 80 mov 0x80115d20,%eax
801055e9: 29 d8 sub %ebx,%eax
801055eb: 3b 45 f4 cmp -0xc(%ebp),%eax
801055ee: 73 28 jae 80105618 <sys_sleep+0x88>
if(proc->killed){
801055f0: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801055f6: 8b 40 24 mov 0x24(%eax),%eax
801055f9: 85 c0 test %eax,%eax
801055fb: 74 d3 je 801055d0 <sys_sleep+0x40>
release(&tickslock);
801055fd: c7 04 24 e0 54 11 80 movl $0x801154e0,(%esp)
80105604: e8 c7 ee ff ff call 801044d0 <release>
return -1;
80105609: b8 ff ff ff ff mov $0xffffffff,%eax
}
sleep(&ticks, &tickslock);
}
release(&tickslock);
return 0;
}
8010560e: 83 c4 24 add $0x24,%esp
80105611: 5b pop %ebx
80105612: 5d pop %ebp
80105613: c3 ret
80105614: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
release(&tickslock);
return -1;
}
sleep(&ticks, &tickslock);
}
release(&tickslock);
80105618: c7 04 24 e0 54 11 80 movl $0x801154e0,(%esp)
8010561f: e8 ac ee ff ff call 801044d0 <release>
return 0;
}
80105624: 83 c4 24 add $0x24,%esp
return -1;
}
sleep(&ticks, &tickslock);
}
release(&tickslock);
return 0;
80105627: 31 c0 xor %eax,%eax
}
80105629: 5b pop %ebx
8010562a: 5d pop %ebp
8010562b: c3 ret
{
int n;
uint ticks0;
if(argint(0, &n) < 0)
return -1;
8010562c: b8 ff ff ff ff mov $0xffffffff,%eax
80105631: eb db jmp 8010560e <sys_sleep+0x7e>
80105633: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80105639: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80105640 <sys_random>:
}
//I am adding this syscall
static unsigned int sys_random(void)
{
seed ^= seed << 7;//7
80105640: 0f b6 15 0c a0 10 80 movzbl 0x8010a00c,%edx
release(&tickslock);
return 0;
}
//I am adding this syscall
static unsigned int sys_random(void)
{
80105647: 55 push %ebp
80105648: 89 e5 mov %esp,%ebp
seed ^= seed << 7;//7
seed ^= seed >> 5;//5
seed ^= seed << 3;//3
return seed;
}
8010564a: 5d pop %ebp
}
//I am adding this syscall
static unsigned int sys_random(void)
{
seed ^= seed << 7;//7
8010564b: 89 d0 mov %edx,%eax
8010564d: c1 e0 07 shl $0x7,%eax
80105650: 31 d0 xor %edx,%eax
seed ^= seed >> 5;//5
80105652: 89 c2 mov %eax,%edx
80105654: c0 ea 05 shr $0x5,%dl
80105657: 31 c2 xor %eax,%edx
seed ^= seed << 3;//3
80105659: 8d 04 d5 00 00 00 00 lea 0x0(,%edx,8),%eax
80105660: 31 d0 xor %edx,%eax
80105662: a2 0c a0 10 80 mov %al,0x8010a00c
return seed;
80105667: 0f b6 c0 movzbl %al,%eax
}
8010566a: c3 ret
8010566b: 90 nop
8010566c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80105670 <sys_chpr>:
//system call for changing priorty
int
sys_chpr (void)
{
80105670: 55 push %ebp
80105671: 89 e5 mov %esp,%ebp
80105673: 83 ec 28 sub $0x28,%esp
int pr;
int pid;
if(argint(0, &pid) < 0)
80105676: 8d 45 f4 lea -0xc(%ebp),%eax
80105679: 89 44 24 04 mov %eax,0x4(%esp)
8010567d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105684: e8 87 f1 ff ff call 80104810 <argint>
80105689: 85 c0 test %eax,%eax
8010568b: 78 2b js 801056b8 <sys_chpr+0x48>
return -1;
if(argint(1, &pr) < 0)
8010568d: 8d 45 f0 lea -0x10(%ebp),%eax
80105690: 89 44 24 04 mov %eax,0x4(%esp)
80105694: c7 04 24 01 00 00 00 movl $0x1,(%esp)
8010569b: e8 70 f1 ff ff call 80104810 <argint>
801056a0: 85 c0 test %eax,%eax
801056a2: 78 14 js 801056b8 <sys_chpr+0x48>
return -1;
return chpr(pid,pr);
801056a4: 8b 45 f0 mov -0x10(%ebp),%eax
801056a7: 89 44 24 04 mov %eax,0x4(%esp)
801056ab: 8b 45 f4 mov -0xc(%ebp),%eax
801056ae: 89 04 24 mov %eax,(%esp)
801056b1: e8 9a e2 ff ff call 80103950 <chpr>
}
801056b6: c9 leave
801056b7: c3 ret
sys_chpr (void)
{
int pr;
int pid;
if(argint(0, &pid) < 0)
return -1;
801056b8: b8 ff ff ff ff mov $0xffffffff,%eax
if(argint(1, &pr) < 0)
return -1;
return chpr(pid,pr);
}
801056bd: c9 leave
801056be: c3 ret
801056bf: 90 nop
801056c0 <sys_cps>:
//I am adding the cps syscall
int
sys_cps(void)
{
801056c0: 55 push %ebp
801056c1: 89 e5 mov %esp,%ebp
return cps();
}
801056c3: 5d pop %ebp
}
//I am adding the cps syscall
int
sys_cps(void)
{
return cps();
801056c4: e9 f7 e3 ff ff jmp 80103ac0 <cps>
801056c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801056d0 <sys_uptime>:
}
// return how many clock tick interrupts have occurred
// since start.
int
sys_uptime(void)
{
801056d0: 55 push %ebp
801056d1: 89 e5 mov %esp,%ebp
801056d3: 53 push %ebx
801056d4: 83 ec 14 sub $0x14,%esp
uint xticks;
acquire(&tickslock);
801056d7: c7 04 24 e0 54 11 80 movl $0x801154e0,(%esp)
801056de: e8 bd ec ff ff call 801043a0 <acquire>
xticks = ticks;
801056e3: 8b 1d 20 5d 11 80 mov 0x80115d20,%ebx
release(&tickslock);
801056e9: c7 04 24 e0 54 11 80 movl $0x801154e0,(%esp)
801056f0: e8 db ed ff ff call 801044d0 <release>
return xticks;
}
801056f5: 83 c4 14 add $0x14,%esp
801056f8: 89 d8 mov %ebx,%eax
801056fa: 5b pop %ebx
801056fb: 5d pop %ebp
801056fc: c3 ret
801056fd: 66 90 xchg %ax,%ax
801056ff: 90 nop
80105700 <timerinit>:
#define TIMER_RATEGEN 0x04 // mode 2, rate generator
#define TIMER_16BIT 0x30 // r/w counter 16 bits, LSB first
void
timerinit(void)
{
80105700: 55 push %ebp
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80105701: ba 43 00 00 00 mov $0x43,%edx
80105706: 89 e5 mov %esp,%ebp
80105708: b8 34 00 00 00 mov $0x34,%eax
8010570d: 83 ec 18 sub $0x18,%esp
80105710: ee out %al,(%dx)
80105711: b8 9c ff ff ff mov $0xffffff9c,%eax
80105716: b2 40 mov $0x40,%dl
80105718: ee out %al,(%dx)
80105719: b8 2e 00 00 00 mov $0x2e,%eax
8010571e: ee out %al,(%dx)
// Interrupt 100 times/sec.
outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT);
outb(IO_TIMER1, TIMER_DIV(100) % 256);
outb(IO_TIMER1, TIMER_DIV(100) / 256);
picenable(IRQ_TIMER);
8010571f: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105726: e8 d5 da ff ff call 80103200 <picenable>
}
8010572b: c9 leave
8010572c: c3 ret
8010572d <alltraps>:
8010572d: 1e push %ds
8010572e: 06 push %es
8010572f: 0f a0 push %fs
80105731: 0f a8 push %gs
80105733: 60 pusha
80105734: 66 b8 10 00 mov $0x10,%ax
80105738: 8e d8 mov %eax,%ds
8010573a: 8e c0 mov %eax,%es
8010573c: 66 b8 18 00 mov $0x18,%ax
80105740: 8e e0 mov %eax,%fs
80105742: 8e e8 mov %eax,%gs
80105744: 54 push %esp
80105745: e8 e6 00 00 00 call 80105830 <trap>
8010574a: 83 c4 04 add $0x4,%esp
8010574d <trapret>:
8010574d: 61 popa
8010574e: 0f a9 pop %gs
80105750: 0f a1 pop %fs
80105752: 07 pop %es
80105753: 1f pop %ds
80105754: 83 c4 08 add $0x8,%esp
80105757: cf iret
80105758: 66 90 xchg %ax,%ax
8010575a: 66 90 xchg %ax,%ax
8010575c: 66 90 xchg %ax,%ax
8010575e: 66 90 xchg %ax,%ax
80105760 <tvinit>:
void
tvinit(void)
{
int i;
for(i = 0; i < 256; i++)
80105760: 31 c0 xor %eax,%eax
80105762: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
80105768: 8b 14 85 0d a0 10 80 mov -0x7fef5ff3(,%eax,4),%edx
8010576f: b9 08 00 00 00 mov $0x8,%ecx
80105774: 66 89 0c c5 22 55 11 mov %cx,-0x7feeaade(,%eax,8)
8010577b: 80
8010577c: c6 04 c5 24 55 11 80 movb $0x0,-0x7feeaadc(,%eax,8)
80105783: 00
80105784: c6 04 c5 25 55 11 80 movb $0x8e,-0x7feeaadb(,%eax,8)
8010578b: 8e
8010578c: 66 89 14 c5 20 55 11 mov %dx,-0x7feeaae0(,%eax,8)
80105793: 80
80105794: c1 ea 10 shr $0x10,%edx
80105797: 66 89 14 c5 26 55 11 mov %dx,-0x7feeaada(,%eax,8)
8010579e: 80
void
tvinit(void)
{
int i;
for(i = 0; i < 256; i++)
8010579f: 83 c0 01 add $0x1,%eax
801057a2: 3d 00 01 00 00 cmp $0x100,%eax
801057a7: 75 bf jne 80105768 <tvinit+0x8>
struct spinlock tickslock;
uint ticks;
void
tvinit(void)
{
801057a9: 55 push %ebp
int i;
for(i = 0; i < 256; i++)
SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER);
801057aa: ba 08 00 00 00 mov $0x8,%edx
struct spinlock tickslock;
uint ticks;
void
tvinit(void)
{
801057af: 89 e5 mov %esp,%ebp
801057b1: 83 ec 18 sub $0x18,%esp
int i;
for(i = 0; i < 256; i++)
SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER);
801057b4: a1 0d a1 10 80 mov 0x8010a10d,%eax
initlock(&tickslock, "time");
801057b9: c7 44 24 04 a5 77 10 movl $0x801077a5,0x4(%esp)
801057c0: 80
801057c1: c7 04 24 e0 54 11 80 movl $0x801154e0,(%esp)
{
int i;
for(i = 0; i < 256; i++)
SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER);
801057c8: 66 89 15 22 57 11 80 mov %dx,0x80115722
801057cf: 66 a3 20 57 11 80 mov %ax,0x80115720
801057d5: c1 e8 10 shr $0x10,%eax
801057d8: c6 05 24 57 11 80 00 movb $0x0,0x80115724
801057df: c6 05 25 57 11 80 ef movb $0xef,0x80115725
801057e6: 66 a3 26 57 11 80 mov %ax,0x80115726
initlock(&tickslock, "time");
801057ec: e8 2f eb ff ff call 80104320 <initlock>
}
801057f1: c9 leave
801057f2: c3 ret
801057f3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801057f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80105800 <idtinit>:
void
idtinit(void)
{
80105800: 55 push %ebp
static inline void
lidt(struct gatedesc *p, int size)
{
volatile ushort pd[3];
pd[0] = size-1;
80105801: b8 ff 07 00 00 mov $0x7ff,%eax
80105806: 89 e5 mov %esp,%ebp
80105808: 83 ec 10 sub $0x10,%esp
8010580b: 66 89 45 fa mov %ax,-0x6(%ebp)
pd[1] = (uint)p;
8010580f: b8 20 55 11 80 mov $0x80115520,%eax
80105814: 66 89 45 fc mov %ax,-0x4(%ebp)
pd[2] = (uint)p >> 16;
80105818: c1 e8 10 shr $0x10,%eax
8010581b: 66 89 45 fe mov %ax,-0x2(%ebp)
asm volatile("lidt (%0)" : : "r" (pd));
8010581f: 8d 45 fa lea -0x6(%ebp),%eax
80105822: 0f 01 18 lidtl (%eax)
lidt(idt, sizeof(idt));
}
80105825: c9 leave
80105826: c3 ret
80105827: 89 f6 mov %esi,%esi
80105829: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80105830 <trap>:
//PAGEBREAK: 41
void
trap(struct trapframe *tf)
{
80105830: 55 push %ebp
80105831: 89 e5 mov %esp,%ebp
80105833: 57 push %edi
80105834: 56 push %esi
80105835: 53 push %ebx
80105836: 83 ec 2c sub $0x2c,%esp
80105839: 8b 5d 08 mov 0x8(%ebp),%ebx
if(tf->trapno == T_SYSCALL){
8010583c: 8b 43 30 mov 0x30(%ebx),%eax
8010583f: 83 f8 40 cmp $0x40,%eax
80105842: 0f 84 00 01 00 00 je 80105948 <trap+0x118>
if(proc->killed)
exit();
return;
}
switch(tf->trapno){
80105848: 83 e8 20 sub $0x20,%eax
8010584b: 83 f8 1f cmp $0x1f,%eax
8010584e: 77 60 ja 801058b0 <trap+0x80>
80105850: ff 24 85 4c 78 10 80 jmp *-0x7fef87b4(,%eax,4)
80105857: 90 nop
case T_IRQ0 + IRQ_TIMER:
if(cpunum() == 0){
80105858: e8 03 cf ff ff call 80102760 <cpunum>
8010585d: 85 c0 test %eax,%eax
8010585f: 90 nop
80105860: 0f 84 d2 01 00 00 je 80105a38 <trap+0x208>
acquire(&tickslock);
ticks++;
wakeup(&ticks);
release(&tickslock);
}
lapiceoi();
80105866: e8 95 cf ff ff call 80102800 <lapiceoi>
8010586b: 65 a1 04 00 00 00 mov %gs:0x4,%eax
}
// Force process exit if it has been killed and is in user space.
// (If it is still executing in the kernel, let it keep running
// until it gets to the regular system call return.)
if(proc && proc->killed && (tf->cs&3) == DPL_USER)
80105871: 85 c0 test %eax,%eax
80105873: 74 2d je 801058a2 <trap+0x72>
80105875: 8b 50 24 mov 0x24(%eax),%edx
80105878: 85 d2 test %edx,%edx
8010587a: 0f 85 9c 00 00 00 jne 8010591c <trap+0xec>
exit();
// Force process to give up CPU on clock tick.
// If interrupts were on while locks held, would need to check nlock.
if(proc && proc->state == RUNNING && tf->trapno == T_IRQ0+IRQ_TIMER)
80105880: 83 78 0c 04 cmpl $0x4,0xc(%eax)
80105884: 0f 84 86 01 00 00 je 80105a10 <trap+0x1e0>
yield();
// Check if the process has been killed since we yielded
if(proc && proc->killed && (tf->cs&3) == DPL_USER)
8010588a: 8b 40 24 mov 0x24(%eax),%eax
8010588d: 85 c0 test %eax,%eax
8010588f: 74 11 je 801058a2 <trap+0x72>
80105891: 0f b7 43 3c movzwl 0x3c(%ebx),%eax
80105895: 83 e0 03 and $0x3,%eax
80105898: 66 83 f8 03 cmp $0x3,%ax
8010589c: 0f 84 d0 00 00 00 je 80105972 <trap+0x142>
exit();
}
801058a2: 83 c4 2c add $0x2c,%esp
801058a5: 5b pop %ebx
801058a6: 5e pop %esi
801058a7: 5f pop %edi
801058a8: 5d pop %ebp
801058a9: c3 ret
801058aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
lapiceoi();
break;
//PAGEBREAK: 13
default:
if(proc == 0 || (tf->cs&3) == 0){
801058b0: 65 8b 0d 04 00 00 00 mov %gs:0x4,%ecx
801058b7: 85 c9 test %ecx,%ecx
801058b9: 0f 84 a9 01 00 00 je 80105a68 <trap+0x238>
801058bf: f6 43 3c 03 testb $0x3,0x3c(%ebx)
801058c3: 0f 84 9f 01 00 00 je 80105a68 <trap+0x238>
static inline uint
rcr2(void)
{
uint val;
asm volatile("movl %%cr2,%0" : "=r" (val));
801058c9: 0f 20 d7 mov %cr2,%edi
cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
tf->trapno, cpunum(), tf->eip, rcr2());
panic("trap");
}
// In user space, assume process misbehaved.
cprintf("pid %d %s: trap %d err %d on cpu %d "
801058cc: 8b 73 38 mov 0x38(%ebx),%esi
801058cf: e8 8c ce ff ff call 80102760 <cpunum>
"eip 0x%x addr 0x%x--kill proc\n",
proc->pid, proc->name, tf->trapno, tf->err, cpunum(), tf->eip,
801058d4: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
tf->trapno, cpunum(), tf->eip, rcr2());
panic("trap");
}
// In user space, assume process misbehaved.
cprintf("pid %d %s: trap %d err %d on cpu %d "
801058db: 89 7c 24 1c mov %edi,0x1c(%esp)
801058df: 89 74 24 18 mov %esi,0x18(%esp)
801058e3: 89 44 24 14 mov %eax,0x14(%esp)
801058e7: 8b 43 34 mov 0x34(%ebx),%eax
801058ea: 89 44 24 10 mov %eax,0x10(%esp)
801058ee: 8b 43 30 mov 0x30(%ebx),%eax
801058f1: 89 44 24 0c mov %eax,0xc(%esp)
"eip 0x%x addr 0x%x--kill proc\n",
proc->pid, proc->name, tf->trapno, tf->err, cpunum(), tf->eip,
801058f5: 8d 42 6c lea 0x6c(%edx),%eax
801058f8: 89 44 24 08 mov %eax,0x8(%esp)
cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
tf->trapno, cpunum(), tf->eip, rcr2());
panic("trap");
}
// In user space, assume process misbehaved.
cprintf("pid %d %s: trap %d err %d on cpu %d "
801058fc: 8b 42 10 mov 0x10(%edx),%eax
801058ff: c7 04 24 08 78 10 80 movl $0x80107808,(%esp)
80105906: 89 44 24 04 mov %eax,0x4(%esp)
8010590a: e8 41 ad ff ff call 80100650 <cprintf>
"eip 0x%x addr 0x%x--kill proc\n",
proc->pid, proc->name, tf->trapno, tf->err, cpunum(), tf->eip,
rcr2());
proc->killed = 1;
8010590f: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105915: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax)
}
// Force process exit if it has been killed and is in user space.
// (If it is still executing in the kernel, let it keep running
// until it gets to the regular system call return.)
if(proc && proc->killed && (tf->cs&3) == DPL_USER)
8010591c: 0f b7 53 3c movzwl 0x3c(%ebx),%edx
80105920: 83 e2 03 and $0x3,%edx
80105923: 66 83 fa 03 cmp $0x3,%dx
80105927: 0f 85 53 ff ff ff jne 80105880 <trap+0x50>
exit();
8010592d: e8 ee e3 ff ff call 80103d20 <exit>
// Force process to give up CPU on clock tick.
// If interrupts were on while locks held, would need to check nlock.
if(proc && proc->state == RUNNING && tf->trapno == T_IRQ0+IRQ_TIMER)
80105932: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105938: 85 c0 test %eax,%eax
8010593a: 0f 85 40 ff ff ff jne 80105880 <trap+0x50>
80105940: e9 5d ff ff ff jmp 801058a2 <trap+0x72>
80105945: 8d 76 00 lea 0x0(%esi),%esi
//PAGEBREAK: 41
void
trap(struct trapframe *tf)
{
if(tf->trapno == T_SYSCALL){
if(proc->killed)
80105948: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010594e: 8b 70 24 mov 0x24(%eax),%esi
80105951: 85 f6 test %esi,%esi
80105953: 0f 85 a7 00 00 00 jne 80105a00 <trap+0x1d0>
exit();
proc->tf = tf;
80105959: 89 58 18 mov %ebx,0x18(%eax)
syscall();
8010595c: e8 bf ef ff ff call 80104920 <syscall>
if(proc->killed)
80105961: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105967: 8b 58 24 mov 0x24(%eax),%ebx
8010596a: 85 db test %ebx,%ebx
8010596c: 0f 84 30 ff ff ff je 801058a2 <trap+0x72>
yield();
// Check if the process has been killed since we yielded
if(proc && proc->killed && (tf->cs&3) == DPL_USER)
exit();
}
80105972: 83 c4 2c add $0x2c,%esp
80105975: 5b pop %ebx
80105976: 5e pop %esi
80105977: 5f pop %edi
80105978: 5d pop %ebp
if(proc->killed)
exit();
proc->tf = tf;
syscall();
if(proc->killed)
exit();
80105979: e9 a2 e3 ff ff jmp 80103d20 <exit>
8010597e: 66 90 xchg %ax,%ax
break;
case T_IRQ0 + IRQ_IDE+1:
// Bochs generates spurious IDE1 interrupts.
break;
case T_IRQ0 + IRQ_KBD:
kbdintr();
80105980: e8 4b cc ff ff call 801025d0 <kbdintr>
lapiceoi();
80105985: e8 76 ce ff ff call 80102800 <lapiceoi>
8010598a: 65 a1 04 00 00 00 mov %gs:0x4,%eax
break;
80105990: e9 dc fe ff ff jmp 80105871 <trap+0x41>
80105995: 8d 76 00 lea 0x0(%esi),%esi
release(&tickslock);
}
lapiceoi();
break;
case T_IRQ0 + IRQ_IDE:
ideintr();
80105998: e8 e3 c6 ff ff call 80102080 <ideintr>
lapiceoi();
8010599d: e8 5e ce ff ff call 80102800 <lapiceoi>
801059a2: 65 a1 04 00 00 00 mov %gs:0x4,%eax
break;
801059a8: e9 c4 fe ff ff jmp 80105871 <trap+0x41>
801059ad: 8d 76 00 lea 0x0(%esi),%esi
case T_IRQ0 + IRQ_KBD:
kbdintr();
lapiceoi();
break;
case T_IRQ0 + IRQ_COM1:
uartintr();
801059b0: e8 1b 02 00 00 call 80105bd0 <uartintr>
lapiceoi();
801059b5: e8 46 ce ff ff call 80102800 <lapiceoi>
801059ba: 65 a1 04 00 00 00 mov %gs:0x4,%eax
break;
801059c0: e9 ac fe ff ff jmp 80105871 <trap+0x41>
801059c5: 8d 76 00 lea 0x0(%esi),%esi
case T_IRQ0 + 7:
case T_IRQ0 + IRQ_SPURIOUS:
cprintf("cpu%d: spurious interrupt at %x:%x\n",
801059c8: 8b 7b 38 mov 0x38(%ebx),%edi
801059cb: 0f b7 73 3c movzwl 0x3c(%ebx),%esi
801059cf: e8 8c cd ff ff call 80102760 <cpunum>
801059d4: c7 04 24 b0 77 10 80 movl $0x801077b0,(%esp)
801059db: 89 7c 24 0c mov %edi,0xc(%esp)
801059df: 89 74 24 08 mov %esi,0x8(%esp)
801059e3: 89 44 24 04 mov %eax,0x4(%esp)
801059e7: e8 64 ac ff ff call 80100650 <cprintf>
cpunum(), tf->cs, tf->eip);
lapiceoi();
801059ec: e8 0f ce ff ff call 80102800 <lapiceoi>
801059f1: 65 a1 04 00 00 00 mov %gs:0x4,%eax
break;
801059f7: e9 75 fe ff ff jmp 80105871 <trap+0x41>
801059fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
void
trap(struct trapframe *tf)
{
if(tf->trapno == T_SYSCALL){
if(proc->killed)
exit();
80105a00: e8 1b e3 ff ff call 80103d20 <exit>
80105a05: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105a0b: e9 49 ff ff ff jmp 80105959 <trap+0x129>
if(proc && proc->killed && (tf->cs&3) == DPL_USER)
exit();
// Force process to give up CPU on clock tick.
// If interrupts were on while locks held, would need to check nlock.
if(proc && proc->state == RUNNING && tf->trapno == T_IRQ0+IRQ_TIMER)
80105a10: 83 7b 30 20 cmpl $0x20,0x30(%ebx)
80105a14: 0f 85 70 fe ff ff jne 8010588a <trap+0x5a>
yield();
80105a1a: e8 41 e4 ff ff call 80103e60 <yield>
// Check if the process has been killed since we yielded
if(proc && proc->killed && (tf->cs&3) == DPL_USER)
80105a1f: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105a25: 85 c0 test %eax,%eax
80105a27: 0f 85 5d fe ff ff jne 8010588a <trap+0x5a>
80105a2d: e9 70 fe ff ff jmp 801058a2 <trap+0x72>
80105a32: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
}
switch(tf->trapno){
case T_IRQ0 + IRQ_TIMER:
if(cpunum() == 0){
acquire(&tickslock);
80105a38: c7 04 24 e0 54 11 80 movl $0x801154e0,(%esp)
80105a3f: e8 5c e9 ff ff call 801043a0 <acquire>
ticks++;
wakeup(&ticks);
80105a44: c7 04 24 20 5d 11 80 movl $0x80115d20,(%esp)
switch(tf->trapno){
case T_IRQ0 + IRQ_TIMER:
if(cpunum() == 0){
acquire(&tickslock);
ticks++;
80105a4b: 83 05 20 5d 11 80 01 addl $0x1,0x80115d20
wakeup(&ticks);
80105a52: e8 f9 e5 ff ff call 80104050 <wakeup>
release(&tickslock);
80105a57: c7 04 24 e0 54 11 80 movl $0x801154e0,(%esp)
80105a5e: e8 6d ea ff ff call 801044d0 <release>
80105a63: e9 fe fd ff ff jmp 80105866 <trap+0x36>
80105a68: 0f 20 d7 mov %cr2,%edi
//PAGEBREAK: 13
default:
if(proc == 0 || (tf->cs&3) == 0){
// In kernel, it must be our mistake.
cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
80105a6b: 8b 73 38 mov 0x38(%ebx),%esi
80105a6e: e8 ed cc ff ff call 80102760 <cpunum>
80105a73: 89 7c 24 10 mov %edi,0x10(%esp)
80105a77: 89 74 24 0c mov %esi,0xc(%esp)
80105a7b: 89 44 24 08 mov %eax,0x8(%esp)
80105a7f: 8b 43 30 mov 0x30(%ebx),%eax
80105a82: c7 04 24 d4 77 10 80 movl $0x801077d4,(%esp)
80105a89: 89 44 24 04 mov %eax,0x4(%esp)
80105a8d: e8 be ab ff ff call 80100650 <cprintf>
tf->trapno, cpunum(), tf->eip, rcr2());
panic("trap");
80105a92: c7 04 24 aa 77 10 80 movl $0x801077aa,(%esp)
80105a99: e8 c2 a8 ff ff call 80100360 <panic>
80105a9e: 66 90 xchg %ax,%ax
80105aa0 <uartgetc>:
}
static int
uartgetc(void)
{
if(!uart)
80105aa0: a1 c0 a5 10 80 mov 0x8010a5c0,%eax
outb(COM1+0, c);
}
static int
uartgetc(void)
{
80105aa5: 55 push %ebp
80105aa6: 89 e5 mov %esp,%ebp
if(!uart)
80105aa8: 85 c0 test %eax,%eax
80105aaa: 74 14 je 80105ac0 <uartgetc+0x20>
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80105aac: ba fd 03 00 00 mov $0x3fd,%edx
80105ab1: ec in (%dx),%al
return -1;
if(!(inb(COM1+5) & 0x01))
80105ab2: a8 01 test $0x1,%al
80105ab4: 74 0a je 80105ac0 <uartgetc+0x20>
80105ab6: b2 f8 mov $0xf8,%dl
80105ab8: ec in (%dx),%al
return -1;
return inb(COM1+0);
80105ab9: 0f b6 c0 movzbl %al,%eax
}
80105abc: 5d pop %ebp
80105abd: c3 ret
80105abe: 66 90 xchg %ax,%ax
static int
uartgetc(void)
{
if(!uart)
return -1;
80105ac0: b8 ff ff ff ff mov $0xffffffff,%eax
if(!(inb(COM1+5) & 0x01))
return -1;
return inb(COM1+0);
}
80105ac5: 5d pop %ebp
80105ac6: c3 ret
80105ac7: 89 f6 mov %esi,%esi
80105ac9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80105ad0 <uartputc>:
void
uartputc(int c)
{
int i;
if(!uart)
80105ad0: a1 c0 a5 10 80 mov 0x8010a5c0,%eax
80105ad5: 85 c0 test %eax,%eax
80105ad7: 74 3f je 80105b18 <uartputc+0x48>
uartputc(*p);
}
void
uartputc(int c)
{
80105ad9: 55 push %ebp
80105ada: 89 e5 mov %esp,%ebp
80105adc: 56 push %esi
80105add: be fd 03 00 00 mov $0x3fd,%esi
80105ae2: 53 push %ebx
int i;
if(!uart)
80105ae3: bb 80 00 00 00 mov $0x80,%ebx
uartputc(*p);
}
void
uartputc(int c)
{
80105ae8: 83 ec 10 sub $0x10,%esp
80105aeb: eb 14 jmp 80105b01 <uartputc+0x31>
80105aed: 8d 76 00 lea 0x0(%esi),%esi
int i;
if(!uart)
return;
for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
microdelay(10);
80105af0: c7 04 24 0a 00 00 00 movl $0xa,(%esp)
80105af7: e8 24 cd ff ff call 80102820 <microdelay>
{
int i;
if(!uart)
return;
for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
80105afc: 83 eb 01 sub $0x1,%ebx
80105aff: 74 07 je 80105b08 <uartputc+0x38>
80105b01: 89 f2 mov %esi,%edx
80105b03: ec in (%dx),%al
80105b04: a8 20 test $0x20,%al
80105b06: 74 e8 je 80105af0 <uartputc+0x20>
microdelay(10);
outb(COM1+0, c);
80105b08: 0f b6 45 08 movzbl 0x8(%ebp),%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80105b0c: ba f8 03 00 00 mov $0x3f8,%edx
80105b11: ee out %al,(%dx)
}
80105b12: 83 c4 10 add $0x10,%esp
80105b15: 5b pop %ebx
80105b16: 5e pop %esi
80105b17: 5d pop %ebp
80105b18: f3 c3 repz ret
80105b1a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80105b20 <uartinit>:
static int uart; // is there a uart?
void
uartinit(void)
{
80105b20: 55 push %ebp
80105b21: 31 c9 xor %ecx,%ecx
80105b23: 89 e5 mov %esp,%ebp
80105b25: 89 c8 mov %ecx,%eax
80105b27: 57 push %edi
80105b28: bf fa 03 00 00 mov $0x3fa,%edi
80105b2d: 56 push %esi
80105b2e: 89 fa mov %edi,%edx
80105b30: 53 push %ebx
80105b31: 83 ec 1c sub $0x1c,%esp
80105b34: ee out %al,(%dx)
80105b35: be fb 03 00 00 mov $0x3fb,%esi
80105b3a: b8 80 ff ff ff mov $0xffffff80,%eax
80105b3f: 89 f2 mov %esi,%edx
80105b41: ee out %al,(%dx)
80105b42: b8 0c 00 00 00 mov $0xc,%eax
80105b47: b2 f8 mov $0xf8,%dl
80105b49: ee out %al,(%dx)
80105b4a: bb f9 03 00 00 mov $0x3f9,%ebx
80105b4f: 89 c8 mov %ecx,%eax
80105b51: 89 da mov %ebx,%edx
80105b53: ee out %al,(%dx)
80105b54: b8 03 00 00 00 mov $0x3,%eax
80105b59: 89 f2 mov %esi,%edx
80105b5b: ee out %al,(%dx)
80105b5c: b2 fc mov $0xfc,%dl
80105b5e: 89 c8 mov %ecx,%eax
80105b60: ee out %al,(%dx)
80105b61: b8 01 00 00 00 mov $0x1,%eax
80105b66: 89 da mov %ebx,%edx
80105b68: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80105b69: b2 fd mov $0xfd,%dl
80105b6b: ec in (%dx),%al
outb(COM1+3, 0x03); // Lock divisor, 8 data bits.
outb(COM1+4, 0);
outb(COM1+1, 0x01); // Enable receive interrupts.
// If status is 0xFF, no serial port.
if(inb(COM1+5) == 0xFF)
80105b6c: 3c ff cmp $0xff,%al
80105b6e: 74 52 je 80105bc2 <uartinit+0xa2>
return;
uart = 1;
80105b70: c7 05 c0 a5 10 80 01 movl $0x1,0x8010a5c0
80105b77: 00 00 00
80105b7a: 89 fa mov %edi,%edx
80105b7c: ec in (%dx),%al
80105b7d: b2 f8 mov $0xf8,%dl
80105b7f: ec in (%dx),%al
// Acknowledge pre-existing interrupt conditions;
// enable interrupts.
inb(COM1+2);
inb(COM1+0);
picenable(IRQ_COM1);
80105b80: c7 04 24 04 00 00 00 movl $0x4,(%esp)
ioapicenable(IRQ_COM1, 0);
// Announce that we're here.
for(p="xv6...\n"; *p; p++)
80105b87: bb cc 78 10 80 mov $0x801078cc,%ebx
// Acknowledge pre-existing interrupt conditions;
// enable interrupts.
inb(COM1+2);
inb(COM1+0);
picenable(IRQ_COM1);
80105b8c: e8 6f d6 ff ff call 80103200 <picenable>
ioapicenable(IRQ_COM1, 0);
80105b91: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80105b98: 00
80105b99: c7 04 24 04 00 00 00 movl $0x4,(%esp)
80105ba0: e8 0b c7 ff ff call 801022b0 <ioapicenable>
// Announce that we're here.
for(p="xv6...\n"; *p; p++)
80105ba5: b8 78 00 00 00 mov $0x78,%eax
80105baa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
uartputc(*p);
80105bb0: 89 04 24 mov %eax,(%esp)
inb(COM1+0);
picenable(IRQ_COM1);
ioapicenable(IRQ_COM1, 0);
// Announce that we're here.
for(p="xv6...\n"; *p; p++)
80105bb3: 83 c3 01 add $0x1,%ebx
uartputc(*p);
80105bb6: e8 15 ff ff ff call 80105ad0 <uartputc>
inb(COM1+0);
picenable(IRQ_COM1);
ioapicenable(IRQ_COM1, 0);
// Announce that we're here.
for(p="xv6...\n"; *p; p++)
80105bbb: 0f be 03 movsbl (%ebx),%eax
80105bbe: 84 c0 test %al,%al
80105bc0: 75 ee jne 80105bb0 <uartinit+0x90>
uartputc(*p);
}
80105bc2: 83 c4 1c add $0x1c,%esp
80105bc5: 5b pop %ebx
80105bc6: 5e pop %esi
80105bc7: 5f pop %edi
80105bc8: 5d pop %ebp
80105bc9: c3 ret
80105bca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80105bd0 <uartintr>:
return inb(COM1+0);
}
void
uartintr(void)
{
80105bd0: 55 push %ebp
80105bd1: 89 e5 mov %esp,%ebp
80105bd3: 83 ec 18 sub $0x18,%esp
consoleintr(uartgetc);
80105bd6: c7 04 24 a0 5a 10 80 movl $0x80105aa0,(%esp)
80105bdd: e8 ce ab ff ff call 801007b0 <consoleintr>
}
80105be2: c9 leave
80105be3: c3 ret
80105be4 <vector0>:
80105be4: 6a 00 push $0x0
80105be6: 6a 00 push $0x0
80105be8: e9 40 fb ff ff jmp 8010572d <alltraps>
80105bed <vector1>:
80105bed: 6a 00 push $0x0
80105bef: 6a 01 push $0x1
80105bf1: e9 37 fb ff ff jmp 8010572d <alltraps>
80105bf6 <vector2>:
80105bf6: 6a 00 push $0x0
80105bf8: 6a 02 push $0x2
80105bfa: e9 2e fb ff ff jmp 8010572d <alltraps>
80105bff <vector3>:
80105bff: 6a 00 push $0x0
80105c01: 6a 03 push $0x3
80105c03: e9 25 fb ff ff jmp 8010572d <alltraps>
80105c08 <vector4>:
80105c08: 6a 00 push $0x0
80105c0a: 6a 04 push $0x4
80105c0c: e9 1c fb ff ff jmp 8010572d <alltraps>
80105c11 <vector5>:
80105c11: 6a 00 push $0x0
80105c13: 6a 05 push $0x5
80105c15: e9 13 fb ff ff jmp 8010572d <alltraps>
80105c1a <vector6>:
80105c1a: 6a 00 push $0x0
80105c1c: 6a 06 push $0x6
80105c1e: e9 0a fb ff ff jmp 8010572d <alltraps>
80105c23 <vector7>:
80105c23: 6a 00 push $0x0
80105c25: 6a 07 push $0x7
80105c27: e9 01 fb ff ff jmp 8010572d <alltraps>
80105c2c <vector8>:
80105c2c: 6a 08 push $0x8
80105c2e: e9 fa fa ff ff jmp 8010572d <alltraps>
80105c33 <vector9>:
80105c33: 6a 00 push $0x0
80105c35: 6a 09 push $0x9
80105c37: e9 f1 fa ff ff jmp 8010572d <alltraps>
80105c3c <vector10>:
80105c3c: 6a 0a push $0xa
80105c3e: e9 ea fa ff ff jmp 8010572d <alltraps>
80105c43 <vector11>:
80105c43: 6a 0b push $0xb
80105c45: e9 e3 fa ff ff jmp 8010572d <alltraps>
80105c4a <vector12>:
80105c4a: 6a 0c push $0xc
80105c4c: e9 dc fa ff ff jmp 8010572d <alltraps>
80105c51 <vector13>:
80105c51: 6a 0d push $0xd
80105c53: e9 d5 fa ff ff jmp 8010572d <alltraps>
80105c58 <vector14>:
80105c58: 6a 0e push $0xe
80105c5a: e9 ce fa ff ff jmp 8010572d <alltraps>
80105c5f <vector15>:
80105c5f: 6a 00 push $0x0
80105c61: 6a 0f push $0xf
80105c63: e9 c5 fa ff ff jmp 8010572d <alltraps>
80105c68 <vector16>:
80105c68: 6a 00 push $0x0
80105c6a: 6a 10 push $0x10
80105c6c: e9 bc fa ff ff jmp 8010572d <alltraps>
80105c71 <vector17>:
80105c71: 6a 11 push $0x11
80105c73: e9 b5 fa ff ff jmp 8010572d <alltraps>
80105c78 <vector18>:
80105c78: 6a 00 push $0x0
80105c7a: 6a 12 push $0x12
80105c7c: e9 ac fa ff ff jmp 8010572d <alltraps>
80105c81 <vector19>:
80105c81: 6a 00 push $0x0
80105c83: 6a 13 push $0x13
80105c85: e9 a3 fa ff ff jmp 8010572d <alltraps>
80105c8a <vector20>:
80105c8a: 6a 00 push $0x0
80105c8c: 6a 14 push $0x14
80105c8e: e9 9a fa ff ff jmp 8010572d <alltraps>
80105c93 <vector21>:
80105c93: 6a 00 push $0x0
80105c95: 6a 15 push $0x15
80105c97: e9 91 fa ff ff jmp 8010572d <alltraps>
80105c9c <vector22>:
80105c9c: 6a 00 push $0x0
80105c9e: 6a 16 push $0x16
80105ca0: e9 88 fa ff ff jmp 8010572d <alltraps>
80105ca5 <vector23>:
80105ca5: 6a 00 push $0x0
80105ca7: 6a 17 push $0x17
80105ca9: e9 7f fa ff ff jmp 8010572d <alltraps>
80105cae <vector24>:
80105cae: 6a 00 push $0x0
80105cb0: 6a 18 push $0x18
80105cb2: e9 76 fa ff ff jmp 8010572d <alltraps>
80105cb7 <vector25>:
80105cb7: 6a 00 push $0x0
80105cb9: 6a 19 push $0x19
80105cbb: e9 6d fa ff ff jmp 8010572d <alltraps>
80105cc0 <vector26>:
80105cc0: 6a 00 push $0x0
80105cc2: 6a 1a push $0x1a
80105cc4: e9 64 fa ff ff jmp 8010572d <alltraps>
80105cc9 <vector27>:
80105cc9: 6a 00 push $0x0
80105ccb: 6a 1b push $0x1b
80105ccd: e9 5b fa ff ff jmp 8010572d <alltraps>
80105cd2 <vector28>:
80105cd2: 6a 00 push $0x0
80105cd4: 6a 1c push $0x1c
80105cd6: e9 52 fa ff ff jmp 8010572d <alltraps>
80105cdb <vector29>:
80105cdb: 6a 00 push $0x0
80105cdd: 6a 1d push $0x1d
80105cdf: e9 49 fa ff ff jmp 8010572d <alltraps>
80105ce4 <vector30>:
80105ce4: 6a 00 push $0x0
80105ce6: 6a 1e push $0x1e
80105ce8: e9 40 fa ff ff jmp 8010572d <alltraps>
80105ced <vector31>:
80105ced: 6a 00 push $0x0
80105cef: 6a 1f push $0x1f
80105cf1: e9 37 fa ff ff jmp 8010572d <alltraps>
80105cf6 <vector32>:
80105cf6: 6a 00 push $0x0
80105cf8: 6a 20 push $0x20
80105cfa: e9 2e fa ff ff jmp 8010572d <alltraps>
80105cff <vector33>:
80105cff: 6a 00 push $0x0
80105d01: 6a 21 push $0x21
80105d03: e9 25 fa ff ff jmp 8010572d <alltraps>
80105d08 <vector34>:
80105d08: 6a 00 push $0x0
80105d0a: 6a 22 push $0x22
80105d0c: e9 1c fa ff ff jmp 8010572d <alltraps>
80105d11 <vector35>:
80105d11: 6a 00 push $0x0
80105d13: 6a 23 push $0x23
80105d15: e9 13 fa ff ff jmp 8010572d <alltraps>
80105d1a <vector36>:
80105d1a: 6a 00 push $0x0
80105d1c: 6a 24 push $0x24
80105d1e: e9 0a fa ff ff jmp 8010572d <alltraps>
80105d23 <vector37>:
80105d23: 6a 00 push $0x0
80105d25: 6a 25 push $0x25
80105d27: e9 01 fa ff ff jmp 8010572d <alltraps>
80105d2c <vector38>:
80105d2c: 6a 00 push $0x0
80105d2e: 6a 26 push $0x26
80105d30: e9 f8 f9 ff ff jmp 8010572d <alltraps>
80105d35 <vector39>:
80105d35: 6a 00 push $0x0
80105d37: 6a 27 push $0x27
80105d39: e9 ef f9 ff ff jmp 8010572d <alltraps>
80105d3e <vector40>:
80105d3e: 6a 00 push $0x0
80105d40: 6a 28 push $0x28
80105d42: e9 e6 f9 ff ff jmp 8010572d <alltraps>
80105d47 <vector41>:
80105d47: 6a 00 push $0x0
80105d49: 6a 29 push $0x29
80105d4b: e9 dd f9 ff ff jmp 8010572d <alltraps>
80105d50 <vector42>:
80105d50: 6a 00 push $0x0
80105d52: 6a 2a push $0x2a
80105d54: e9 d4 f9 ff ff jmp 8010572d <alltraps>
80105d59 <vector43>:
80105d59: 6a 00 push $0x0
80105d5b: 6a 2b push $0x2b
80105d5d: e9 cb f9 ff ff jmp 8010572d <alltraps>
80105d62 <vector44>:
80105d62: 6a 00 push $0x0
80105d64: 6a 2c push $0x2c
80105d66: e9 c2 f9 ff ff jmp 8010572d <alltraps>
80105d6b <vector45>:
80105d6b: 6a 00 push $0x0
80105d6d: 6a 2d push $0x2d
80105d6f: e9 b9 f9 ff ff jmp 8010572d <alltraps>
80105d74 <vector46>:
80105d74: 6a 00 push $0x0
80105d76: 6a 2e push $0x2e
80105d78: e9 b0 f9 ff ff jmp 8010572d <alltraps>
80105d7d <vector47>:
80105d7d: 6a 00 push $0x0
80105d7f: 6a 2f push $0x2f
80105d81: e9 a7 f9 ff ff jmp 8010572d <alltraps>
80105d86 <vector48>:
80105d86: 6a 00 push $0x0
80105d88: 6a 30 push $0x30
80105d8a: e9 9e f9 ff ff jmp 8010572d <alltraps>
80105d8f <vector49>:
80105d8f: 6a 00 push $0x0
80105d91: 6a 31 push $0x31
80105d93: e9 95 f9 ff ff jmp 8010572d <alltraps>
80105d98 <vector50>:
80105d98: 6a 00 push $0x0
80105d9a: 6a 32 push $0x32
80105d9c: e9 8c f9 ff ff jmp 8010572d <alltraps>
80105da1 <vector51>:
80105da1: 6a 00 push $0x0
80105da3: 6a 33 push $0x33
80105da5: e9 83 f9 ff ff jmp 8010572d <alltraps>
80105daa <vector52>:
80105daa: 6a 00 push $0x0
80105dac: 6a 34 push $0x34
80105dae: e9 7a f9 ff ff jmp 8010572d <alltraps>
80105db3 <vector53>:
80105db3: 6a 00 push $0x0
80105db5: 6a 35 push $0x35
80105db7: e9 71 f9 ff ff jmp 8010572d <alltraps>
80105dbc <vector54>:
80105dbc: 6a 00 push $0x0
80105dbe: 6a 36 push $0x36
80105dc0: e9 68 f9 ff ff jmp 8010572d <alltraps>
80105dc5 <vector55>:
80105dc5: 6a 00 push $0x0
80105dc7: 6a 37 push $0x37
80105dc9: e9 5f f9 ff ff jmp 8010572d <alltraps>
80105dce <vector56>:
80105dce: 6a 00 push $0x0
80105dd0: 6a 38 push $0x38
80105dd2: e9 56 f9 ff ff jmp 8010572d <alltraps>
80105dd7 <vector57>:
80105dd7: 6a 00 push $0x0
80105dd9: 6a 39 push $0x39
80105ddb: e9 4d f9 ff ff jmp 8010572d <alltraps>
80105de0 <vector58>:
80105de0: 6a 00 push $0x0
80105de2: 6a 3a push $0x3a
80105de4: e9 44 f9 ff ff jmp 8010572d <alltraps>
80105de9 <vector59>:
80105de9: 6a 00 push $0x0
80105deb: 6a 3b push $0x3b
80105ded: e9 3b f9 ff ff jmp 8010572d <alltraps>
80105df2 <vector60>:
80105df2: 6a 00 push $0x0
80105df4: 6a 3c push $0x3c
80105df6: e9 32 f9 ff ff jmp 8010572d <alltraps>
80105dfb <vector61>:
80105dfb: 6a 00 push $0x0
80105dfd: 6a 3d push $0x3d
80105dff: e9 29 f9 ff ff jmp 8010572d <alltraps>
80105e04 <vector62>:
80105e04: 6a 00 push $0x0
80105e06: 6a 3e push $0x3e
80105e08: e9 20 f9 ff ff jmp 8010572d <alltraps>
80105e0d <vector63>:
80105e0d: 6a 00 push $0x0
80105e0f: 6a 3f push $0x3f
80105e11: e9 17 f9 ff ff jmp 8010572d <alltraps>
80105e16 <vector64>:
80105e16: 6a 00 push $0x0
80105e18: 6a 40 push $0x40
80105e1a: e9 0e f9 ff ff jmp 8010572d <alltraps>
80105e1f <vector65>:
80105e1f: 6a 00 push $0x0
80105e21: 6a 41 push $0x41
80105e23: e9 05 f9 ff ff jmp 8010572d <alltraps>
80105e28 <vector66>:
80105e28: 6a 00 push $0x0
80105e2a: 6a 42 push $0x42
80105e2c: e9 fc f8 ff ff jmp 8010572d <alltraps>
80105e31 <vector67>:
80105e31: 6a 00 push $0x0
80105e33: 6a 43 push $0x43
80105e35: e9 f3 f8 ff ff jmp 8010572d <alltraps>
80105e3a <vector68>:
80105e3a: 6a 00 push $0x0
80105e3c: 6a 44 push $0x44
80105e3e: e9 ea f8 ff ff jmp 8010572d <alltraps>
80105e43 <vector69>:
80105e43: 6a 00 push $0x0
80105e45: 6a 45 push $0x45
80105e47: e9 e1 f8 ff ff jmp 8010572d <alltraps>
80105e4c <vector70>:
80105e4c: 6a 00 push $0x0
80105e4e: 6a 46 push $0x46
80105e50: e9 d8 f8 ff ff jmp 8010572d <alltraps>
80105e55 <vector71>:
80105e55: 6a 00 push $0x0
80105e57: 6a 47 push $0x47
80105e59: e9 cf f8 ff ff jmp 8010572d <alltraps>
80105e5e <vector72>:
80105e5e: 6a 00 push $0x0
80105e60: 6a 48 push $0x48
80105e62: e9 c6 f8 ff ff jmp 8010572d <alltraps>
80105e67 <vector73>:
80105e67: 6a 00 push $0x0
80105e69: 6a 49 push $0x49
80105e6b: e9 bd f8 ff ff jmp 8010572d <alltraps>
80105e70 <vector74>:
80105e70: 6a 00 push $0x0
80105e72: 6a 4a push $0x4a
80105e74: e9 b4 f8 ff ff jmp 8010572d <alltraps>
80105e79 <vector75>:
80105e79: 6a 00 push $0x0
80105e7b: 6a 4b push $0x4b
80105e7d: e9 ab f8 ff ff jmp 8010572d <alltraps>
80105e82 <vector76>:
80105e82: 6a 00 push $0x0
80105e84: 6a 4c push $0x4c
80105e86: e9 a2 f8 ff ff jmp 8010572d <alltraps>
80105e8b <vector77>:
80105e8b: 6a 00 push $0x0
80105e8d: 6a 4d push $0x4d
80105e8f: e9 99 f8 ff ff jmp 8010572d <alltraps>
80105e94 <vector78>:
80105e94: 6a 00 push $0x0
80105e96: 6a 4e push $0x4e
80105e98: e9 90 f8 ff ff jmp 8010572d <alltraps>
80105e9d <vector79>:
80105e9d: 6a 00 push $0x0
80105e9f: 6a 4f push $0x4f
80105ea1: e9 87 f8 ff ff jmp 8010572d <alltraps>
80105ea6 <vector80>:
80105ea6: 6a 00 push $0x0
80105ea8: 6a 50 push $0x50
80105eaa: e9 7e f8 ff ff jmp 8010572d <alltraps>
80105eaf <vector81>:
80105eaf: 6a 00 push $0x0
80105eb1: 6a 51 push $0x51
80105eb3: e9 75 f8 ff ff jmp 8010572d <alltraps>
80105eb8 <vector82>:
80105eb8: 6a 00 push $0x0
80105eba: 6a 52 push $0x52
80105ebc: e9 6c f8 ff ff jmp 8010572d <alltraps>
80105ec1 <vector83>:
80105ec1: 6a 00 push $0x0
80105ec3: 6a 53 push $0x53
80105ec5: e9 63 f8 ff ff jmp 8010572d <alltraps>
80105eca <vector84>:
80105eca: 6a 00 push $0x0
80105ecc: 6a 54 push $0x54
80105ece: e9 5a f8 ff ff jmp 8010572d <alltraps>
80105ed3 <vector85>:
80105ed3: 6a 00 push $0x0
80105ed5: 6a 55 push $0x55
80105ed7: e9 51 f8 ff ff jmp 8010572d <alltraps>
80105edc <vector86>:
80105edc: 6a 00 push $0x0
80105ede: 6a 56 push $0x56
80105ee0: e9 48 f8 ff ff jmp 8010572d <alltraps>
80105ee5 <vector87>:
80105ee5: 6a 00 push $0x0
80105ee7: 6a 57 push $0x57
80105ee9: e9 3f f8 ff ff jmp 8010572d <alltraps>
80105eee <vector88>:
80105eee: 6a 00 push $0x0
80105ef0: 6a 58 push $0x58
80105ef2: e9 36 f8 ff ff jmp 8010572d <alltraps>
80105ef7 <vector89>:
80105ef7: 6a 00 push $0x0
80105ef9: 6a 59 push $0x59
80105efb: e9 2d f8 ff ff jmp 8010572d <alltraps>
80105f00 <vector90>:
80105f00: 6a 00 push $0x0
80105f02: 6a 5a push $0x5a
80105f04: e9 24 f8 ff ff jmp 8010572d <alltraps>
80105f09 <vector91>:
80105f09: 6a 00 push $0x0
80105f0b: 6a 5b push $0x5b
80105f0d: e9 1b f8 ff ff jmp 8010572d <alltraps>
80105f12 <vector92>:
80105f12: 6a 00 push $0x0
80105f14: 6a 5c push $0x5c
80105f16: e9 12 f8 ff ff jmp 8010572d <alltraps>
80105f1b <vector93>:
80105f1b: 6a 00 push $0x0
80105f1d: 6a 5d push $0x5d
80105f1f: e9 09 f8 ff ff jmp 8010572d <alltraps>
80105f24 <vector94>:
80105f24: 6a 00 push $0x0
80105f26: 6a 5e push $0x5e
80105f28: e9 00 f8 ff ff jmp 8010572d <alltraps>
80105f2d <vector95>:
80105f2d: 6a 00 push $0x0
80105f2f: 6a 5f push $0x5f
80105f31: e9 f7 f7 ff ff jmp 8010572d <alltraps>
80105f36 <vector96>:
80105f36: 6a 00 push $0x0
80105f38: 6a 60 push $0x60
80105f3a: e9 ee f7 ff ff jmp 8010572d <alltraps>
80105f3f <vector97>:
80105f3f: 6a 00 push $0x0
80105f41: 6a 61 push $0x61
80105f43: e9 e5 f7 ff ff jmp 8010572d <alltraps>
80105f48 <vector98>:
80105f48: 6a 00 push $0x0
80105f4a: 6a 62 push $0x62
80105f4c: e9 dc f7 ff ff jmp 8010572d <alltraps>
80105f51 <vector99>:
80105f51: 6a 00 push $0x0
80105f53: 6a 63 push $0x63
80105f55: e9 d3 f7 ff ff jmp 8010572d <alltraps>
80105f5a <vector100>:
80105f5a: 6a 00 push $0x0
80105f5c: 6a 64 push $0x64
80105f5e: e9 ca f7 ff ff jmp 8010572d <alltraps>
80105f63 <vector101>:
80105f63: 6a 00 push $0x0
80105f65: 6a 65 push $0x65
80105f67: e9 c1 f7 ff ff jmp 8010572d <alltraps>
80105f6c <vector102>:
80105f6c: 6a 00 push $0x0
80105f6e: 6a 66 push $0x66
80105f70: e9 b8 f7 ff ff jmp 8010572d <alltraps>
80105f75 <vector103>:
80105f75: 6a 00 push $0x0
80105f77: 6a 67 push $0x67
80105f79: e9 af f7 ff ff jmp 8010572d <alltraps>
80105f7e <vector104>:
80105f7e: 6a 00 push $0x0
80105f80: 6a 68 push $0x68
80105f82: e9 a6 f7 ff ff jmp 8010572d <alltraps>
80105f87 <vector105>:
80105f87: 6a 00 push $0x0
80105f89: 6a 69 push $0x69
80105f8b: e9 9d f7 ff ff jmp 8010572d <alltraps>
80105f90 <vector106>:
80105f90: 6a 00 push $0x0
80105f92: 6a 6a push $0x6a
80105f94: e9 94 f7 ff ff jmp 8010572d <alltraps>
80105f99 <vector107>:
80105f99: 6a 00 push $0x0
80105f9b: 6a 6b push $0x6b
80105f9d: e9 8b f7 ff ff jmp 8010572d <alltraps>
80105fa2 <vector108>:
80105fa2: 6a 00 push $0x0
80105fa4: 6a 6c push $0x6c
80105fa6: e9 82 f7 ff ff jmp 8010572d <alltraps>
80105fab <vector109>:
80105fab: 6a 00 push $0x0
80105fad: 6a 6d push $0x6d
80105faf: e9 79 f7 ff ff jmp 8010572d <alltraps>
80105fb4 <vector110>:
80105fb4: 6a 00 push $0x0
80105fb6: 6a 6e push $0x6e
80105fb8: e9 70 f7 ff ff jmp 8010572d <alltraps>
80105fbd <vector111>:
80105fbd: 6a 00 push $0x0
80105fbf: 6a 6f push $0x6f
80105fc1: e9 67 f7 ff ff jmp 8010572d <alltraps>
80105fc6 <vector112>:
80105fc6: 6a 00 push $0x0
80105fc8: 6a 70 push $0x70
80105fca: e9 5e f7 ff ff jmp 8010572d <alltraps>
80105fcf <vector113>:
80105fcf: 6a 00 push $0x0
80105fd1: 6a 71 push $0x71
80105fd3: e9 55 f7 ff ff jmp 8010572d <alltraps>
80105fd8 <vector114>:
80105fd8: 6a 00 push $0x0
80105fda: 6a 72 push $0x72
80105fdc: e9 4c f7 ff ff jmp 8010572d <alltraps>
80105fe1 <vector115>:
80105fe1: 6a 00 push $0x0
80105fe3: 6a 73 push $0x73
80105fe5: e9 43 f7 ff ff jmp 8010572d <alltraps>
80105fea <vector116>:
80105fea: 6a 00 push $0x0
80105fec: 6a 74 push $0x74
80105fee: e9 3a f7 ff ff jmp 8010572d <alltraps>
80105ff3 <vector117>:
80105ff3: 6a 00 push $0x0
80105ff5: 6a 75 push $0x75
80105ff7: e9 31 f7 ff ff jmp 8010572d <alltraps>
80105ffc <vector118>:
80105ffc: 6a 00 push $0x0
80105ffe: 6a 76 push $0x76
80106000: e9 28 f7 ff ff jmp 8010572d <alltraps>
80106005 <vector119>:
80106005: 6a 00 push $0x0
80106007: 6a 77 push $0x77
80106009: e9 1f f7 ff ff jmp 8010572d <alltraps>
8010600e <vector120>:
8010600e: 6a 00 push $0x0
80106010: 6a 78 push $0x78
80106012: e9 16 f7 ff ff jmp 8010572d <alltraps>
80106017 <vector121>:
80106017: 6a 00 push $0x0
80106019: 6a 79 push $0x79
8010601b: e9 0d f7 ff ff jmp 8010572d <alltraps>
80106020 <vector122>:
80106020: 6a 00 push $0x0
80106022: 6a 7a push $0x7a
80106024: e9 04 f7 ff ff jmp 8010572d <alltraps>
80106029 <vector123>:
80106029: 6a 00 push $0x0
8010602b: 6a 7b push $0x7b
8010602d: e9 fb f6 ff ff jmp 8010572d <alltraps>
80106032 <vector124>:
80106032: 6a 00 push $0x0
80106034: 6a 7c push $0x7c
80106036: e9 f2 f6 ff ff jmp 8010572d <alltraps>
8010603b <vector125>:
8010603b: 6a 00 push $0x0
8010603d: 6a 7d push $0x7d
8010603f: e9 e9 f6 ff ff jmp 8010572d <alltraps>
80106044 <vector126>:
80106044: 6a 00 push $0x0
80106046: 6a 7e push $0x7e
80106048: e9 e0 f6 ff ff jmp 8010572d <alltraps>
8010604d <vector127>:
8010604d: 6a 00 push $0x0
8010604f: 6a 7f push $0x7f
80106051: e9 d7 f6 ff ff jmp 8010572d <alltraps>
80106056 <vector128>:
80106056: 6a 00 push $0x0
80106058: 68 80 00 00 00 push $0x80
8010605d: e9 cb f6 ff ff jmp 8010572d <alltraps>
80106062 <vector129>:
80106062: 6a 00 push $0x0
80106064: 68 81 00 00 00 push $0x81
80106069: e9 bf f6 ff ff jmp 8010572d <alltraps>
8010606e <vector130>:
8010606e: 6a 00 push $0x0
80106070: 68 82 00 00 00 push $0x82
80106075: e9 b3 f6 ff ff jmp 8010572d <alltraps>
8010607a <vector131>:
8010607a: 6a 00 push $0x0
8010607c: 68 83 00 00 00 push $0x83
80106081: e9 a7 f6 ff ff jmp 8010572d <alltraps>
80106086 <vector132>:
80106086: 6a 00 push $0x0
80106088: 68 84 00 00 00 push $0x84
8010608d: e9 9b f6 ff ff jmp 8010572d <alltraps>
80106092 <vector133>:
80106092: 6a 00 push $0x0
80106094: 68 85 00 00 00 push $0x85
80106099: e9 8f f6 ff ff jmp 8010572d <alltraps>
8010609e <vector134>:
8010609e: 6a 00 push $0x0
801060a0: 68 86 00 00 00 push $0x86
801060a5: e9 83 f6 ff ff jmp 8010572d <alltraps>
801060aa <vector135>:
801060aa: 6a 00 push $0x0
801060ac: 68 87 00 00 00 push $0x87
801060b1: e9 77 f6 ff ff jmp 8010572d <alltraps>
801060b6 <vector136>:
801060b6: 6a 00 push $0x0
801060b8: 68 88 00 00 00 push $0x88
801060bd: e9 6b f6 ff ff jmp 8010572d <alltraps>
801060c2 <vector137>:
801060c2: 6a 00 push $0x0
801060c4: 68 89 00 00 00 push $0x89
801060c9: e9 5f f6 ff ff jmp 8010572d <alltraps>
801060ce <vector138>:
801060ce: 6a 00 push $0x0
801060d0: 68 8a 00 00 00 push $0x8a
801060d5: e9 53 f6 ff ff jmp 8010572d <alltraps>
801060da <vector139>:
801060da: 6a 00 push $0x0
801060dc: 68 8b 00 00 00 push $0x8b
801060e1: e9 47 f6 ff ff jmp 8010572d <alltraps>
801060e6 <vector140>:
801060e6: 6a 00 push $0x0
801060e8: 68 8c 00 00 00 push $0x8c
801060ed: e9 3b f6 ff ff jmp 8010572d <alltraps>
801060f2 <vector141>:
801060f2: 6a 00 push $0x0
801060f4: 68 8d 00 00 00 push $0x8d
801060f9: e9 2f f6 ff ff jmp 8010572d <alltraps>
801060fe <vector142>:
801060fe: 6a 00 push $0x0
80106100: 68 8e 00 00 00 push $0x8e
80106105: e9 23 f6 ff ff jmp 8010572d <alltraps>
8010610a <vector143>:
8010610a: 6a 00 push $0x0
8010610c: 68 8f 00 00 00 push $0x8f
80106111: e9 17 f6 ff ff jmp 8010572d <alltraps>
80106116 <vector144>:
80106116: 6a 00 push $0x0
80106118: 68 90 00 00 00 push $0x90
8010611d: e9 0b f6 ff ff jmp 8010572d <alltraps>
80106122 <vector145>:
80106122: 6a 00 push $0x0
80106124: 68 91 00 00 00 push $0x91
80106129: e9 ff f5 ff ff jmp 8010572d <alltraps>
8010612e <vector146>:
8010612e: 6a 00 push $0x0
80106130: 68 92 00 00 00 push $0x92
80106135: e9 f3 f5 ff ff jmp 8010572d <alltraps>
8010613a <vector147>:
8010613a: 6a 00 push $0x0
8010613c: 68 93 00 00 00 push $0x93
80106141: e9 e7 f5 ff ff jmp 8010572d <alltraps>
80106146 <vector148>:
80106146: 6a 00 push $0x0
80106148: 68 94 00 00 00 push $0x94
8010614d: e9 db f5 ff ff jmp 8010572d <alltraps>
80106152 <vector149>:
80106152: 6a 00 push $0x0
80106154: 68 95 00 00 00 push $0x95
80106159: e9 cf f5 ff ff jmp 8010572d <alltraps>
8010615e <vector150>:
8010615e: 6a 00 push $0x0
80106160: 68 96 00 00 00 push $0x96
80106165: e9 c3 f5 ff ff jmp 8010572d <alltraps>
8010616a <vector151>:
8010616a: 6a 00 push $0x0
8010616c: 68 97 00 00 00 push $0x97
80106171: e9 b7 f5 ff ff jmp 8010572d <alltraps>
80106176 <vector152>:
80106176: 6a 00 push $0x0
80106178: 68 98 00 00 00 push $0x98
8010617d: e9 ab f5 ff ff jmp 8010572d <alltraps>
80106182 <vector153>:
80106182: 6a 00 push $0x0
80106184: 68 99 00 00 00 push $0x99
80106189: e9 9f f5 ff ff jmp 8010572d <alltraps>
8010618e <vector154>:
8010618e: 6a 00 push $0x0
80106190: 68 9a 00 00 00 push $0x9a
80106195: e9 93 f5 ff ff jmp 8010572d <alltraps>
8010619a <vector155>:
8010619a: 6a 00 push $0x0
8010619c: 68 9b 00 00 00 push $0x9b
801061a1: e9 87 f5 ff ff jmp 8010572d <alltraps>
801061a6 <vector156>:
801061a6: 6a 00 push $0x0
801061a8: 68 9c 00 00 00 push $0x9c
801061ad: e9 7b f5 ff ff jmp 8010572d <alltraps>
801061b2 <vector157>:
801061b2: 6a 00 push $0x0
801061b4: 68 9d 00 00 00 push $0x9d
801061b9: e9 6f f5 ff ff jmp 8010572d <alltraps>
801061be <vector158>:
801061be: 6a 00 push $0x0
801061c0: 68 9e 00 00 00 push $0x9e
801061c5: e9 63 f5 ff ff jmp 8010572d <alltraps>
801061ca <vector159>:
801061ca: 6a 00 push $0x0
801061cc: 68 9f 00 00 00 push $0x9f
801061d1: e9 57 f5 ff ff jmp 8010572d <alltraps>
801061d6 <vector160>:
801061d6: 6a 00 push $0x0
801061d8: 68 a0 00 00 00 push $0xa0
801061dd: e9 4b f5 ff ff jmp 8010572d <alltraps>
801061e2 <vector161>:
801061e2: 6a 00 push $0x0
801061e4: 68 a1 00 00 00 push $0xa1
801061e9: e9 3f f5 ff ff jmp 8010572d <alltraps>
801061ee <vector162>:
801061ee: 6a 00 push $0x0
801061f0: 68 a2 00 00 00 push $0xa2
801061f5: e9 33 f5 ff ff jmp 8010572d <alltraps>
801061fa <vector163>:
801061fa: 6a 00 push $0x0
801061fc: 68 a3 00 00 00 push $0xa3
80106201: e9 27 f5 ff ff jmp 8010572d <alltraps>
80106206 <vector164>:
80106206: 6a 00 push $0x0
80106208: 68 a4 00 00 00 push $0xa4
8010620d: e9 1b f5 ff ff jmp 8010572d <alltraps>
80106212 <vector165>:
80106212: 6a 00 push $0x0
80106214: 68 a5 00 00 00 push $0xa5
80106219: e9 0f f5 ff ff jmp 8010572d <alltraps>
8010621e <vector166>:
8010621e: 6a 00 push $0x0
80106220: 68 a6 00 00 00 push $0xa6
80106225: e9 03 f5 ff ff jmp 8010572d <alltraps>
8010622a <vector167>:
8010622a: 6a 00 push $0x0
8010622c: 68 a7 00 00 00 push $0xa7
80106231: e9 f7 f4 ff ff jmp 8010572d <alltraps>
80106236 <vector168>:
80106236: 6a 00 push $0x0
80106238: 68 a8 00 00 00 push $0xa8
8010623d: e9 eb f4 ff ff jmp 8010572d <alltraps>
80106242 <vector169>:
80106242: 6a 00 push $0x0
80106244: 68 a9 00 00 00 push $0xa9
80106249: e9 df f4 ff ff jmp 8010572d <alltraps>
8010624e <vector170>:
8010624e: 6a 00 push $0x0
80106250: 68 aa 00 00 00 push $0xaa
80106255: e9 d3 f4 ff ff jmp 8010572d <alltraps>
8010625a <vector171>:
8010625a: 6a 00 push $0x0
8010625c: 68 ab 00 00 00 push $0xab
80106261: e9 c7 f4 ff ff jmp 8010572d <alltraps>
80106266 <vector172>:
80106266: 6a 00 push $0x0
80106268: 68 ac 00 00 00 push $0xac
8010626d: e9 bb f4 ff ff jmp 8010572d <alltraps>
80106272 <vector173>:
80106272: 6a 00 push $0x0
80106274: 68 ad 00 00 00 push $0xad
80106279: e9 af f4 ff ff jmp 8010572d <alltraps>
8010627e <vector174>:
8010627e: 6a 00 push $0x0
80106280: 68 ae 00 00 00 push $0xae
80106285: e9 a3 f4 ff ff jmp 8010572d <alltraps>
8010628a <vector175>:
8010628a: 6a 00 push $0x0
8010628c: 68 af 00 00 00 push $0xaf
80106291: e9 97 f4 ff ff jmp 8010572d <alltraps>
80106296 <vector176>:
80106296: 6a 00 push $0x0
80106298: 68 b0 00 00 00 push $0xb0
8010629d: e9 8b f4 ff ff jmp 8010572d <alltraps>
801062a2 <vector177>:
801062a2: 6a 00 push $0x0
801062a4: 68 b1 00 00 00 push $0xb1
801062a9: e9 7f f4 ff ff jmp 8010572d <alltraps>
801062ae <vector178>:
801062ae: 6a 00 push $0x0
801062b0: 68 b2 00 00 00 push $0xb2
801062b5: e9 73 f4 ff ff jmp 8010572d <alltraps>
801062ba <vector179>:
801062ba: 6a 00 push $0x0
801062bc: 68 b3 00 00 00 push $0xb3
801062c1: e9 67 f4 ff ff jmp 8010572d <alltraps>
801062c6 <vector180>:
801062c6: 6a 00 push $0x0
801062c8: 68 b4 00 00 00 push $0xb4
801062cd: e9 5b f4 ff ff jmp 8010572d <alltraps>
801062d2 <vector181>:
801062d2: 6a 00 push $0x0
801062d4: 68 b5 00 00 00 push $0xb5
801062d9: e9 4f f4 ff ff jmp 8010572d <alltraps>
801062de <vector182>:
801062de: 6a 00 push $0x0
801062e0: 68 b6 00 00 00 push $0xb6
801062e5: e9 43 f4 ff ff jmp 8010572d <alltraps>
801062ea <vector183>:
801062ea: 6a 00 push $0x0
801062ec: 68 b7 00 00 00 push $0xb7
801062f1: e9 37 f4 ff ff jmp 8010572d <alltraps>
801062f6 <vector184>:
801062f6: 6a 00 push $0x0
801062f8: 68 b8 00 00 00 push $0xb8
801062fd: e9 2b f4 ff ff jmp 8010572d <alltraps>
80106302 <vector185>:
80106302: 6a 00 push $0x0
80106304: 68 b9 00 00 00 push $0xb9
80106309: e9 1f f4 ff ff jmp 8010572d <alltraps>
8010630e <vector186>:
8010630e: 6a 00 push $0x0
80106310: 68 ba 00 00 00 push $0xba
80106315: e9 13 f4 ff ff jmp 8010572d <alltraps>
8010631a <vector187>:
8010631a: 6a 00 push $0x0
8010631c: 68 bb 00 00 00 push $0xbb
80106321: e9 07 f4 ff ff jmp 8010572d <alltraps>
80106326 <vector188>:
80106326: 6a 00 push $0x0
80106328: 68 bc 00 00 00 push $0xbc
8010632d: e9 fb f3 ff ff jmp 8010572d <alltraps>
80106332 <vector189>:
80106332: 6a 00 push $0x0
80106334: 68 bd 00 00 00 push $0xbd
80106339: e9 ef f3 ff ff jmp 8010572d <alltraps>
8010633e <vector190>:
8010633e: 6a 00 push $0x0
80106340: 68 be 00 00 00 push $0xbe
80106345: e9 e3 f3 ff ff jmp 8010572d <alltraps>
8010634a <vector191>:
8010634a: 6a 00 push $0x0
8010634c: 68 bf 00 00 00 push $0xbf
80106351: e9 d7 f3 ff ff jmp 8010572d <alltraps>
80106356 <vector192>:
80106356: 6a 00 push $0x0
80106358: 68 c0 00 00 00 push $0xc0
8010635d: e9 cb f3 ff ff jmp 8010572d <alltraps>
80106362 <vector193>:
80106362: 6a 00 push $0x0
80106364: 68 c1 00 00 00 push $0xc1
80106369: e9 bf f3 ff ff jmp 8010572d <alltraps>
8010636e <vector194>:
8010636e: 6a 00 push $0x0
80106370: 68 c2 00 00 00 push $0xc2
80106375: e9 b3 f3 ff ff jmp 8010572d <alltraps>
8010637a <vector195>:
8010637a: 6a 00 push $0x0
8010637c: 68 c3 00 00 00 push $0xc3
80106381: e9 a7 f3 ff ff jmp 8010572d <alltraps>
80106386 <vector196>:
80106386: 6a 00 push $0x0
80106388: 68 c4 00 00 00 push $0xc4
8010638d: e9 9b f3 ff ff jmp 8010572d <alltraps>
80106392 <vector197>:
80106392: 6a 00 push $0x0
80106394: 68 c5 00 00 00 push $0xc5
80106399: e9 8f f3 ff ff jmp 8010572d <alltraps>
8010639e <vector198>:
8010639e: 6a 00 push $0x0
801063a0: 68 c6 00 00 00 push $0xc6
801063a5: e9 83 f3 ff ff jmp 8010572d <alltraps>
801063aa <vector199>:
801063aa: 6a 00 push $0x0
801063ac: 68 c7 00 00 00 push $0xc7
801063b1: e9 77 f3 ff ff jmp 8010572d <alltraps>
801063b6 <vector200>:
801063b6: 6a 00 push $0x0
801063b8: 68 c8 00 00 00 push $0xc8
801063bd: e9 6b f3 ff ff jmp 8010572d <alltraps>
801063c2 <vector201>:
801063c2: 6a 00 push $0x0
801063c4: 68 c9 00 00 00 push $0xc9
801063c9: e9 5f f3 ff ff jmp 8010572d <alltraps>
801063ce <vector202>:
801063ce: 6a 00 push $0x0
801063d0: 68 ca 00 00 00 push $0xca
801063d5: e9 53 f3 ff ff jmp 8010572d <alltraps>
801063da <vector203>:
801063da: 6a 00 push $0x0
801063dc: 68 cb 00 00 00 push $0xcb
801063e1: e9 47 f3 ff ff jmp 8010572d <alltraps>
801063e6 <vector204>:
801063e6: 6a 00 push $0x0
801063e8: 68 cc 00 00 00 push $0xcc
801063ed: e9 3b f3 ff ff jmp 8010572d <alltraps>
801063f2 <vector205>:
801063f2: 6a 00 push $0x0
801063f4: 68 cd 00 00 00 push $0xcd
801063f9: e9 2f f3 ff ff jmp 8010572d <alltraps>
801063fe <vector206>:
801063fe: 6a 00 push $0x0
80106400: 68 ce 00 00 00 push $0xce
80106405: e9 23 f3 ff ff jmp 8010572d <alltraps>
8010640a <vector207>:
8010640a: 6a 00 push $0x0
8010640c: 68 cf 00 00 00 push $0xcf
80106411: e9 17 f3 ff ff jmp 8010572d <alltraps>
80106416 <vector208>:
80106416: 6a 00 push $0x0
80106418: 68 d0 00 00 00 push $0xd0
8010641d: e9 0b f3 ff ff jmp 8010572d <alltraps>
80106422 <vector209>:
80106422: 6a 00 push $0x0
80106424: 68 d1 00 00 00 push $0xd1
80106429: e9 ff f2 ff ff jmp 8010572d <alltraps>
8010642e <vector210>:
8010642e: 6a 00 push $0x0
80106430: 68 d2 00 00 00 push $0xd2
80106435: e9 f3 f2 ff ff jmp 8010572d <alltraps>
8010643a <vector211>:
8010643a: 6a 00 push $0x0
8010643c: 68 d3 00 00 00 push $0xd3
80106441: e9 e7 f2 ff ff jmp 8010572d <alltraps>
80106446 <vector212>:
80106446: 6a 00 push $0x0
80106448: 68 d4 00 00 00 push $0xd4
8010644d: e9 db f2 ff ff jmp 8010572d <alltraps>
80106452 <vector213>:
80106452: 6a 00 push $0x0
80106454: 68 d5 00 00 00 push $0xd5
80106459: e9 cf f2 ff ff jmp 8010572d <alltraps>
8010645e <vector214>:
8010645e: 6a 00 push $0x0
80106460: 68 d6 00 00 00 push $0xd6
80106465: e9 c3 f2 ff ff jmp 8010572d <alltraps>
8010646a <vector215>:
8010646a: 6a 00 push $0x0
8010646c: 68 d7 00 00 00 push $0xd7
80106471: e9 b7 f2 ff ff jmp 8010572d <alltraps>
80106476 <vector216>:
80106476: 6a 00 push $0x0
80106478: 68 d8 00 00 00 push $0xd8
8010647d: e9 ab f2 ff ff jmp 8010572d <alltraps>
80106482 <vector217>:
80106482: 6a 00 push $0x0
80106484: 68 d9 00 00 00 push $0xd9
80106489: e9 9f f2 ff ff jmp 8010572d <alltraps>
8010648e <vector218>:
8010648e: 6a 00 push $0x0
80106490: 68 da 00 00 00 push $0xda
80106495: e9 93 f2 ff ff jmp 8010572d <alltraps>
8010649a <vector219>:
8010649a: 6a 00 push $0x0
8010649c: 68 db 00 00 00 push $0xdb
801064a1: e9 87 f2 ff ff jmp 8010572d <alltraps>
801064a6 <vector220>:
801064a6: 6a 00 push $0x0
801064a8: 68 dc 00 00 00 push $0xdc
801064ad: e9 7b f2 ff ff jmp 8010572d <alltraps>
801064b2 <vector221>:
801064b2: 6a 00 push $0x0
801064b4: 68 dd 00 00 00 push $0xdd
801064b9: e9 6f f2 ff ff jmp 8010572d <alltraps>
801064be <vector222>:
801064be: 6a 00 push $0x0
801064c0: 68 de 00 00 00 push $0xde
801064c5: e9 63 f2 ff ff jmp 8010572d <alltraps>
801064ca <vector223>:
801064ca: 6a 00 push $0x0
801064cc: 68 df 00 00 00 push $0xdf
801064d1: e9 57 f2 ff ff jmp 8010572d <alltraps>
801064d6 <vector224>:
801064d6: 6a 00 push $0x0
801064d8: 68 e0 00 00 00 push $0xe0
801064dd: e9 4b f2 ff ff jmp 8010572d <alltraps>
801064e2 <vector225>:
801064e2: 6a 00 push $0x0
801064e4: 68 e1 00 00 00 push $0xe1
801064e9: e9 3f f2 ff ff jmp 8010572d <alltraps>
801064ee <vector226>:
801064ee: 6a 00 push $0x0
801064f0: 68 e2 00 00 00 push $0xe2
801064f5: e9 33 f2 ff ff jmp 8010572d <alltraps>
801064fa <vector227>:
801064fa: 6a 00 push $0x0
801064fc: 68 e3 00 00 00 push $0xe3
80106501: e9 27 f2 ff ff jmp 8010572d <alltraps>
80106506 <vector228>:
80106506: 6a 00 push $0x0
80106508: 68 e4 00 00 00 push $0xe4
8010650d: e9 1b f2 ff ff jmp 8010572d <alltraps>
80106512 <vector229>:
80106512: 6a 00 push $0x0
80106514: 68 e5 00 00 00 push $0xe5
80106519: e9 0f f2 ff ff jmp 8010572d <alltraps>
8010651e <vector230>:
8010651e: 6a 00 push $0x0
80106520: 68 e6 00 00 00 push $0xe6
80106525: e9 03 f2 ff ff jmp 8010572d <alltraps>
8010652a <vector231>:
8010652a: 6a 00 push $0x0
8010652c: 68 e7 00 00 00 push $0xe7
80106531: e9 f7 f1 ff ff jmp 8010572d <alltraps>
80106536 <vector232>:
80106536: 6a 00 push $0x0
80106538: 68 e8 00 00 00 push $0xe8
8010653d: e9 eb f1 ff ff jmp 8010572d <alltraps>
80106542 <vector233>:
80106542: 6a 00 push $0x0
80106544: 68 e9 00 00 00 push $0xe9
80106549: e9 df f1 ff ff jmp 8010572d <alltraps>
8010654e <vector234>:
8010654e: 6a 00 push $0x0
80106550: 68 ea 00 00 00 push $0xea
80106555: e9 d3 f1 ff ff jmp 8010572d <alltraps>
8010655a <vector235>:
8010655a: 6a 00 push $0x0
8010655c: 68 eb 00 00 00 push $0xeb
80106561: e9 c7 f1 ff ff jmp 8010572d <alltraps>
80106566 <vector236>:
80106566: 6a 00 push $0x0
80106568: 68 ec 00 00 00 push $0xec
8010656d: e9 bb f1 ff ff jmp 8010572d <alltraps>
80106572 <vector237>:
80106572: 6a 00 push $0x0
80106574: 68 ed 00 00 00 push $0xed
80106579: e9 af f1 ff ff jmp 8010572d <alltraps>
8010657e <vector238>:
8010657e: 6a 00 push $0x0
80106580: 68 ee 00 00 00 push $0xee
80106585: e9 a3 f1 ff ff jmp 8010572d <alltraps>
8010658a <vector239>:
8010658a: 6a 00 push $0x0
8010658c: 68 ef 00 00 00 push $0xef
80106591: e9 97 f1 ff ff jmp 8010572d <alltraps>
80106596 <vector240>:
80106596: 6a 00 push $0x0
80106598: 68 f0 00 00 00 push $0xf0
8010659d: e9 8b f1 ff ff jmp 8010572d <alltraps>
801065a2 <vector241>:
801065a2: 6a 00 push $0x0
801065a4: 68 f1 00 00 00 push $0xf1
801065a9: e9 7f f1 ff ff jmp 8010572d <alltraps>
801065ae <vector242>:
801065ae: 6a 00 push $0x0
801065b0: 68 f2 00 00 00 push $0xf2
801065b5: e9 73 f1 ff ff jmp 8010572d <alltraps>
801065ba <vector243>:
801065ba: 6a 00 push $0x0
801065bc: 68 f3 00 00 00 push $0xf3
801065c1: e9 67 f1 ff ff jmp 8010572d <alltraps>
801065c6 <vector244>:
801065c6: 6a 00 push $0x0
801065c8: 68 f4 00 00 00 push $0xf4
801065cd: e9 5b f1 ff ff jmp 8010572d <alltraps>
801065d2 <vector245>:
801065d2: 6a 00 push $0x0
801065d4: 68 f5 00 00 00 push $0xf5
801065d9: e9 4f f1 ff ff jmp 8010572d <alltraps>
801065de <vector246>:
801065de: 6a 00 push $0x0
801065e0: 68 f6 00 00 00 push $0xf6
801065e5: e9 43 f1 ff ff jmp 8010572d <alltraps>
801065ea <vector247>:
801065ea: 6a 00 push $0x0
801065ec: 68 f7 00 00 00 push $0xf7
801065f1: e9 37 f1 ff ff jmp 8010572d <alltraps>
801065f6 <vector248>:
801065f6: 6a 00 push $0x0
801065f8: 68 f8 00 00 00 push $0xf8
801065fd: e9 2b f1 ff ff jmp 8010572d <alltraps>
80106602 <vector249>:
80106602: 6a 00 push $0x0
80106604: 68 f9 00 00 00 push $0xf9
80106609: e9 1f f1 ff ff jmp 8010572d <alltraps>
8010660e <vector250>:
8010660e: 6a 00 push $0x0
80106610: 68 fa 00 00 00 push $0xfa
80106615: e9 13 f1 ff ff jmp 8010572d <alltraps>
8010661a <vector251>:
8010661a: 6a 00 push $0x0
8010661c: 68 fb 00 00 00 push $0xfb
80106621: e9 07 f1 ff ff jmp 8010572d <alltraps>
80106626 <vector252>:
80106626: 6a 00 push $0x0
80106628: 68 fc 00 00 00 push $0xfc
8010662d: e9 fb f0 ff ff jmp 8010572d <alltraps>
80106632 <vector253>:
80106632: 6a 00 push $0x0
80106634: 68 fd 00 00 00 push $0xfd
80106639: e9 ef f0 ff ff jmp 8010572d <alltraps>
8010663e <vector254>:
8010663e: 6a 00 push $0x0
80106640: 68 fe 00 00 00 push $0xfe
80106645: e9 e3 f0 ff ff jmp 8010572d <alltraps>
8010664a <vector255>:
8010664a: 6a 00 push $0x0
8010664c: 68 ff 00 00 00 push $0xff
80106651: e9 d7 f0 ff ff jmp 8010572d <alltraps>
80106656: 66 90 xchg %ax,%ax
80106658: 66 90 xchg %ax,%ax
8010665a: 66 90 xchg %ax,%ax
8010665c: 66 90 xchg %ax,%ax
8010665e: 66 90 xchg %ax,%ax
80106660 <walkpgdir>:
// Return the address of the PTE in page table pgdir
// that corresponds to virtual address va. If alloc!=0,
// create any required page table pages.
static pte_t *
walkpgdir(pde_t *pgdir, const void *va, int alloc)
{
80106660: 55 push %ebp
80106661: 89 e5 mov %esp,%ebp
80106663: 57 push %edi
80106664: 56 push %esi
80106665: 89 d6 mov %edx,%esi
pde_t *pde;
pte_t *pgtab;
pde = &pgdir[PDX(va)];
80106667: c1 ea 16 shr $0x16,%edx
// Return the address of the PTE in page table pgdir
// that corresponds to virtual address va. If alloc!=0,
// create any required page table pages.
static pte_t *
walkpgdir(pde_t *pgdir, const void *va, int alloc)
{
8010666a: 53 push %ebx
pde_t *pde;
pte_t *pgtab;
pde = &pgdir[PDX(va)];
8010666b: 8d 3c 90 lea (%eax,%edx,4),%edi
// Return the address of the PTE in page table pgdir
// that corresponds to virtual address va. If alloc!=0,
// create any required page table pages.
static pte_t *
walkpgdir(pde_t *pgdir, const void *va, int alloc)
{
8010666e: 83 ec 1c sub $0x1c,%esp
pde_t *pde;
pte_t *pgtab;
pde = &pgdir[PDX(va)];
if(*pde & PTE_P){
80106671: 8b 1f mov (%edi),%ebx
80106673: f6 c3 01 test $0x1,%bl
80106676: 74 28 je 801066a0 <walkpgdir+0x40>
pgtab = (pte_t*)P2V(PTE_ADDR(*pde));
80106678: 81 e3 00 f0 ff ff and $0xfffff000,%ebx
8010667e: 81 c3 00 00 00 80 add $0x80000000,%ebx
// The permissions here are overly generous, but they can
// be further restricted by the permissions in the page table
// entries, if necessary.
*pde = V2P(pgtab) | PTE_P | PTE_W | PTE_U;
}
return &pgtab[PTX(va)];
80106684: c1 ee 0a shr $0xa,%esi
}
80106687: 83 c4 1c add $0x1c,%esp
// The permissions here are overly generous, but they can
// be further restricted by the permissions in the page table
// entries, if necessary.
*pde = V2P(pgtab) | PTE_P | PTE_W | PTE_U;
}
return &pgtab[PTX(va)];
8010668a: 89 f2 mov %esi,%edx
8010668c: 81 e2 fc 0f 00 00 and $0xffc,%edx
80106692: 8d 04 13 lea (%ebx,%edx,1),%eax
}
80106695: 5b pop %ebx
80106696: 5e pop %esi
80106697: 5f pop %edi
80106698: 5d pop %ebp
80106699: c3 ret
8010669a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
pde = &pgdir[PDX(va)];
if(*pde & PTE_P){
pgtab = (pte_t*)P2V(PTE_ADDR(*pde));
} else {
if(!alloc || (pgtab = (pte_t*)kalloc()) == 0)
801066a0: 85 c9 test %ecx,%ecx
801066a2: 74 34 je 801066d8 <walkpgdir+0x78>
801066a4: e8 f7 bd ff ff call 801024a0 <kalloc>
801066a9: 85 c0 test %eax,%eax
801066ab: 89 c3 mov %eax,%ebx
801066ad: 74 29 je 801066d8 <walkpgdir+0x78>
return 0;
// Make sure all those PTE_P bits are zero.
memset(pgtab, 0, PGSIZE);
801066af: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
801066b6: 00
801066b7: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
801066be: 00
801066bf: 89 04 24 mov %eax,(%esp)
801066c2: e8 59 de ff ff call 80104520 <memset>
// The permissions here are overly generous, but they can
// be further restricted by the permissions in the page table
// entries, if necessary.
*pde = V2P(pgtab) | PTE_P | PTE_W | PTE_U;
801066c7: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax
801066cd: 83 c8 07 or $0x7,%eax
801066d0: 89 07 mov %eax,(%edi)
801066d2: eb b0 jmp 80106684 <walkpgdir+0x24>
801066d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
}
return &pgtab[PTX(va)];
}
801066d8: 83 c4 1c add $0x1c,%esp
pde = &pgdir[PDX(va)];
if(*pde & PTE_P){
pgtab = (pte_t*)P2V(PTE_ADDR(*pde));
} else {
if(!alloc || (pgtab = (pte_t*)kalloc()) == 0)
return 0;
801066db: 31 c0 xor %eax,%eax
// be further restricted by the permissions in the page table
// entries, if necessary.
*pde = V2P(pgtab) | PTE_P | PTE_W | PTE_U;
}
return &pgtab[PTX(va)];
}
801066dd: 5b pop %ebx
801066de: 5e pop %esi
801066df: 5f pop %edi
801066e0: 5d pop %ebp
801066e1: c3 ret
801066e2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801066e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801066f0 <mappages>:
// Create PTEs for virtual addresses starting at va that refer to
// physical addresses starting at pa. va and size might not
// be page-aligned.
static int
mappages(pde_t *pgdir, void *va, uint size, uint pa, int perm)
{
801066f0: 55 push %ebp
801066f1: 89 e5 mov %esp,%ebp
801066f3: 57 push %edi
801066f4: 56 push %esi
801066f5: 53 push %ebx
char *a, *last;
pte_t *pte;
a = (char*)PGROUNDDOWN((uint)va);
801066f6: 89 d3 mov %edx,%ebx
// Create PTEs for virtual addresses starting at va that refer to
// physical addresses starting at pa. va and size might not
// be page-aligned.
static int
mappages(pde_t *pgdir, void *va, uint size, uint pa, int perm)
{
801066f8: 83 ec 1c sub $0x1c,%esp
801066fb: 8b 7d 08 mov 0x8(%ebp),%edi
char *a, *last;
pte_t *pte;
a = (char*)PGROUNDDOWN((uint)va);
801066fe: 81 e3 00 f0 ff ff and $0xfffff000,%ebx
// Create PTEs for virtual addresses starting at va that refer to
// physical addresses starting at pa. va and size might not
// be page-aligned.
static int
mappages(pde_t *pgdir, void *va, uint size, uint pa, int perm)
{
80106704: 89 45 e0 mov %eax,-0x20(%ebp)
char *a, *last;
pte_t *pte;
a = (char*)PGROUNDDOWN((uint)va);
last = (char*)PGROUNDDOWN(((uint)va) + size - 1);
80106707: 8d 44 0a ff lea -0x1(%edx,%ecx,1),%eax
8010670b: 89 45 e4 mov %eax,-0x1c(%ebp)
for(;;){
if((pte = walkpgdir(pgdir, a, 1)) == 0)
return -1;
if(*pte & PTE_P)
panic("remap");
*pte = pa | perm | PTE_P;
8010670e: 83 4d 0c 01 orl $0x1,0xc(%ebp)
{
char *a, *last;
pte_t *pte;
a = (char*)PGROUNDDOWN((uint)va);
last = (char*)PGROUNDDOWN(((uint)va) + size - 1);
80106712: 81 65 e4 00 f0 ff ff andl $0xfffff000,-0x1c(%ebp)
80106719: 29 df sub %ebx,%edi
8010671b: eb 18 jmp 80106735 <mappages+0x45>
8010671d: 8d 76 00 lea 0x0(%esi),%esi
for(;;){
if((pte = walkpgdir(pgdir, a, 1)) == 0)
return -1;
if(*pte & PTE_P)
80106720: f6 00 01 testb $0x1,(%eax)
80106723: 75 3d jne 80106762 <mappages+0x72>
panic("remap");
*pte = pa | perm | PTE_P;
80106725: 0b 75 0c or 0xc(%ebp),%esi
if(a == last)
80106728: 3b 5d e4 cmp -0x1c(%ebp),%ebx
for(;;){
if((pte = walkpgdir(pgdir, a, 1)) == 0)
return -1;
if(*pte & PTE_P)
panic("remap");
*pte = pa | perm | PTE_P;
8010672b: 89 30 mov %esi,(%eax)
if(a == last)
8010672d: 74 29 je 80106758 <mappages+0x68>
break;
a += PGSIZE;
8010672f: 81 c3 00 10 00 00 add $0x1000,%ebx
pte_t *pte;
a = (char*)PGROUNDDOWN((uint)va);
last = (char*)PGROUNDDOWN(((uint)va) + size - 1);
for(;;){
if((pte = walkpgdir(pgdir, a, 1)) == 0)
80106735: 8b 45 e0 mov -0x20(%ebp),%eax
80106738: b9 01 00 00 00 mov $0x1,%ecx
8010673d: 89 da mov %ebx,%edx
8010673f: 8d 34 3b lea (%ebx,%edi,1),%esi
80106742: e8 19 ff ff ff call 80106660 <walkpgdir>
80106747: 85 c0 test %eax,%eax
80106749: 75 d5 jne 80106720 <mappages+0x30>
break;
a += PGSIZE;
pa += PGSIZE;
}
return 0;
}
8010674b: 83 c4 1c add $0x1c,%esp
a = (char*)PGROUNDDOWN((uint)va);
last = (char*)PGROUNDDOWN(((uint)va) + size - 1);
for(;;){
if((pte = walkpgdir(pgdir, a, 1)) == 0)
return -1;
8010674e: b8 ff ff ff ff mov $0xffffffff,%eax
break;
a += PGSIZE;
pa += PGSIZE;
}
return 0;
}
80106753: 5b pop %ebx
80106754: 5e pop %esi
80106755: 5f pop %edi
80106756: 5d pop %ebp
80106757: c3 ret
80106758: 83 c4 1c add $0x1c,%esp
if(a == last)
break;
a += PGSIZE;
pa += PGSIZE;
}
return 0;
8010675b: 31 c0 xor %eax,%eax
}
8010675d: 5b pop %ebx
8010675e: 5e pop %esi
8010675f: 5f pop %edi
80106760: 5d pop %ebp
80106761: c3 ret
last = (char*)PGROUNDDOWN(((uint)va) + size - 1);
for(;;){
if((pte = walkpgdir(pgdir, a, 1)) == 0)
return -1;
if(*pte & PTE_P)
panic("remap");
80106762: c7 04 24 d4 78 10 80 movl $0x801078d4,(%esp)
80106769: e8 f2 9b ff ff call 80100360 <panic>
8010676e: 66 90 xchg %ax,%ax
80106770 <deallocuvm.part.0>:
// Deallocate user pages to bring the process size from oldsz to
// newsz. oldsz and newsz need not be page-aligned, nor does newsz
// need to be less than oldsz. oldsz can be larger than the actual
// process size. Returns the new process size.
int
deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
80106770: 55 push %ebp
80106771: 89 e5 mov %esp,%ebp
80106773: 57 push %edi
80106774: 89 c7 mov %eax,%edi
80106776: 56 push %esi
80106777: 89 d6 mov %edx,%esi
80106779: 53 push %ebx
uint a, pa;
if(newsz >= oldsz)
return oldsz;
a = PGROUNDUP(newsz);
8010677a: 8d 99 ff 0f 00 00 lea 0xfff(%ecx),%ebx
// Deallocate user pages to bring the process size from oldsz to
// newsz. oldsz and newsz need not be page-aligned, nor does newsz
// need to be less than oldsz. oldsz can be larger than the actual
// process size. Returns the new process size.
int
deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
80106780: 83 ec 1c sub $0x1c,%esp
uint a, pa;
if(newsz >= oldsz)
return oldsz;
a = PGROUNDUP(newsz);
80106783: 81 e3 00 f0 ff ff and $0xfffff000,%ebx
for(; a < oldsz; a += PGSIZE){
80106789: 39 d3 cmp %edx,%ebx
// Deallocate user pages to bring the process size from oldsz to
// newsz. oldsz and newsz need not be page-aligned, nor does newsz
// need to be less than oldsz. oldsz can be larger than the actual
// process size. Returns the new process size.
int
deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
8010678b: 89 4d e0 mov %ecx,-0x20(%ebp)
if(newsz >= oldsz)
return oldsz;
a = PGROUNDUP(newsz);
for(; a < oldsz; a += PGSIZE){
8010678e: 72 3b jb 801067cb <deallocuvm.part.0+0x5b>
80106790: eb 5e jmp 801067f0 <deallocuvm.part.0+0x80>
80106792: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
pte = walkpgdir(pgdir, (char*)a, 0);
if(!pte)
a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE;
else if((*pte & PTE_P) != 0){
80106798: 8b 10 mov (%eax),%edx
8010679a: f6 c2 01 test $0x1,%dl
8010679d: 74 22 je 801067c1 <deallocuvm.part.0+0x51>
pa = PTE_ADDR(*pte);
if(pa == 0)
8010679f: 81 e2 00 f0 ff ff and $0xfffff000,%edx
801067a5: 74 54 je 801067fb <deallocuvm.part.0+0x8b>
panic("kfree");
char *v = P2V(pa);
801067a7: 81 c2 00 00 00 80 add $0x80000000,%edx
kfree(v);
801067ad: 89 14 24 mov %edx,(%esp)
801067b0: 89 45 e4 mov %eax,-0x1c(%ebp)
801067b3: e8 38 bb ff ff call 801022f0 <kfree>
*pte = 0;
801067b8: 8b 45 e4 mov -0x1c(%ebp),%eax
801067bb: c7 00 00 00 00 00 movl $0x0,(%eax)
if(newsz >= oldsz)
return oldsz;
a = PGROUNDUP(newsz);
for(; a < oldsz; a += PGSIZE){
801067c1: 81 c3 00 10 00 00 add $0x1000,%ebx
801067c7: 39 f3 cmp %esi,%ebx
801067c9: 73 25 jae 801067f0 <deallocuvm.part.0+0x80>
pte = walkpgdir(pgdir, (char*)a, 0);
801067cb: 31 c9 xor %ecx,%ecx
801067cd: 89 da mov %ebx,%edx
801067cf: 89 f8 mov %edi,%eax
801067d1: e8 8a fe ff ff call 80106660 <walkpgdir>
if(!pte)
801067d6: 85 c0 test %eax,%eax
801067d8: 75 be jne 80106798 <deallocuvm.part.0+0x28>
a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE;
801067da: 81 e3 00 00 c0 ff and $0xffc00000,%ebx
801067e0: 81 c3 00 f0 3f 00 add $0x3ff000,%ebx
if(newsz >= oldsz)
return oldsz;
a = PGROUNDUP(newsz);
for(; a < oldsz; a += PGSIZE){
801067e6: 81 c3 00 10 00 00 add $0x1000,%ebx
801067ec: 39 f3 cmp %esi,%ebx
801067ee: 72 db jb 801067cb <deallocuvm.part.0+0x5b>
kfree(v);
*pte = 0;
}
}
return newsz;
}
801067f0: 8b 45 e0 mov -0x20(%ebp),%eax
801067f3: 83 c4 1c add $0x1c,%esp
801067f6: 5b pop %ebx
801067f7: 5e pop %esi
801067f8: 5f pop %edi
801067f9: 5d pop %ebp
801067fa: c3 ret
if(!pte)
a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE;
else if((*pte & PTE_P) != 0){
pa = PTE_ADDR(*pte);
if(pa == 0)
panic("kfree");
801067fb: c7 04 24 f2 71 10 80 movl $0x801071f2,(%esp)
80106802: e8 59 9b ff ff call 80100360 <panic>
80106807: 89 f6 mov %esi,%esi
80106809: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80106810 <seginit>:
// Set up CPU's kernel segment descriptors.
// Run once on entry on each CPU.
void
seginit(void)
{
80106810: 55 push %ebp
80106811: 89 e5 mov %esp,%ebp
80106813: 83 ec 18 sub $0x18,%esp
// Map "logical" addresses to virtual addresses using identity map.
// Cannot share a CODE descriptor for both kernel and user
// because it would have to have DPL_USR, but the CPU forbids
// an interrupt from CPL=0 to DPL=3.
c = &cpus[cpunum()];
80106816: e8 45 bf ff ff call 80102760 <cpunum>
c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
8010681b: 31 c9 xor %ecx,%ecx
8010681d: ba ff ff ff ff mov $0xffffffff,%edx
// Map "logical" addresses to virtual addresses using identity map.
// Cannot share a CODE descriptor for both kernel and user
// because it would have to have DPL_USR, but the CPU forbids
// an interrupt from CPL=0 to DPL=3.
c = &cpus[cpunum()];
80106822: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax
80106828: 05 a0 27 11 80 add $0x801127a0,%eax
c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
8010682d: 66 89 50 78 mov %dx,0x78(%eax)
c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
80106831: ba ff ff ff ff mov $0xffffffff,%edx
// Map "logical" addresses to virtual addresses using identity map.
// Cannot share a CODE descriptor for both kernel and user
// because it would have to have DPL_USR, but the CPU forbids
// an interrupt from CPL=0 to DPL=3.
c = &cpus[cpunum()];
c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
80106836: 66 89 48 7a mov %cx,0x7a(%eax)
c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
8010683a: 31 c9 xor %ecx,%ecx
8010683c: 66 89 90 80 00 00 00 mov %dx,0x80(%eax)
c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
80106843: ba ff ff ff ff mov $0xffffffff,%edx
// Cannot share a CODE descriptor for both kernel and user
// because it would have to have DPL_USR, but the CPU forbids
// an interrupt from CPL=0 to DPL=3.
c = &cpus[cpunum()];
c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
80106848: 66 89 88 82 00 00 00 mov %cx,0x82(%eax)
c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
8010684f: 31 c9 xor %ecx,%ecx
80106851: 66 89 90 90 00 00 00 mov %dx,0x90(%eax)
c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER);
80106858: ba ff ff ff ff mov $0xffffffff,%edx
// because it would have to have DPL_USR, but the CPU forbids
// an interrupt from CPL=0 to DPL=3.
c = &cpus[cpunum()];
c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
8010685d: 66 89 88 92 00 00 00 mov %cx,0x92(%eax)
c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER);
80106864: 31 c9 xor %ecx,%ecx
80106866: 66 89 90 98 00 00 00 mov %dx,0x98(%eax)
// Map cpu and proc -- these are private per cpu.
c->gdt[SEG_KCPU] = SEG(STA_W, &c->cpu, 8, 0);
8010686d: 8d 90 b4 00 00 00 lea 0xb4(%eax),%edx
// an interrupt from CPL=0 to DPL=3.
c = &cpus[cpunum()];
c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER);
80106873: 66 89 88 9a 00 00 00 mov %cx,0x9a(%eax)
// Map cpu and proc -- these are private per cpu.
c->gdt[SEG_KCPU] = SEG(STA_W, &c->cpu, 8, 0);
8010687a: 31 c9 xor %ecx,%ecx
8010687c: 66 89 88 88 00 00 00 mov %cx,0x88(%eax)
80106883: 89 d1 mov %edx,%ecx
80106885: c1 e9 10 shr $0x10,%ecx
80106888: 66 89 90 8a 00 00 00 mov %dx,0x8a(%eax)
8010688f: c1 ea 18 shr $0x18,%edx
80106892: 88 88 8c 00 00 00 mov %cl,0x8c(%eax)
static inline void
lgdt(struct segdesc *p, int size)
{
volatile ushort pd[3];
pd[0] = size-1;
80106898: b9 37 00 00 00 mov $0x37,%ecx
8010689d: 88 90 8f 00 00 00 mov %dl,0x8f(%eax)
lgdt(c->gdt, sizeof(c->gdt));
801068a3: 8d 50 70 lea 0x70(%eax),%edx
// Map "logical" addresses to virtual addresses using identity map.
// Cannot share a CODE descriptor for both kernel and user
// because it would have to have DPL_USR, but the CPU forbids
// an interrupt from CPL=0 to DPL=3.
c = &cpus[cpunum()];
c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
801068a6: c6 40 7d 9a movb $0x9a,0x7d(%eax)
801068aa: c6 40 7e cf movb $0xcf,0x7e(%eax)
c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
801068ae: c6 80 85 00 00 00 92 movb $0x92,0x85(%eax)
801068b5: c6 80 86 00 00 00 cf movb $0xcf,0x86(%eax)
c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
801068bc: c6 80 95 00 00 00 fa movb $0xfa,0x95(%eax)
801068c3: c6 80 96 00 00 00 cf movb $0xcf,0x96(%eax)
c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER);
801068ca: c6 80 9d 00 00 00 f2 movb $0xf2,0x9d(%eax)
801068d1: c6 80 9e 00 00 00 cf movb $0xcf,0x9e(%eax)
// Map cpu and proc -- these are private per cpu.
c->gdt[SEG_KCPU] = SEG(STA_W, &c->cpu, 8, 0);
801068d8: c6 80 8d 00 00 00 92 movb $0x92,0x8d(%eax)
801068df: c6 80 8e 00 00 00 c0 movb $0xc0,0x8e(%eax)
801068e6: 66 89 4d f2 mov %cx,-0xe(%ebp)
pd[1] = (uint)p;
801068ea: 66 89 55 f4 mov %dx,-0xc(%ebp)
pd[2] = (uint)p >> 16;
801068ee: c1 ea 10 shr $0x10,%edx
801068f1: 66 89 55 f6 mov %dx,-0xa(%ebp)
asm volatile("lgdt (%0)" : : "r" (pd));
801068f5: 8d 55 f2 lea -0xe(%ebp),%edx
// Map "logical" addresses to virtual addresses using identity map.
// Cannot share a CODE descriptor for both kernel and user
// because it would have to have DPL_USR, but the CPU forbids
// an interrupt from CPL=0 to DPL=3.
c = &cpus[cpunum()];
c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
801068f8: c6 40 7c 00 movb $0x0,0x7c(%eax)
801068fc: c6 40 7f 00 movb $0x0,0x7f(%eax)
c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
80106900: c6 80 84 00 00 00 00 movb $0x0,0x84(%eax)
80106907: c6 80 87 00 00 00 00 movb $0x0,0x87(%eax)
c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
8010690e: c6 80 94 00 00 00 00 movb $0x0,0x94(%eax)
80106915: c6 80 97 00 00 00 00 movb $0x0,0x97(%eax)
c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER);
8010691c: c6 80 9c 00 00 00 00 movb $0x0,0x9c(%eax)
80106923: c6 80 9f 00 00 00 00 movb $0x0,0x9f(%eax)
8010692a: 0f 01 12 lgdtl (%edx)
}
static inline void
loadgs(ushort v)
{
asm volatile("movw %0, %%gs" : : "r" (v));
8010692d: ba 18 00 00 00 mov $0x18,%edx
80106932: 8e ea mov %edx,%gs
lgdt(c->gdt, sizeof(c->gdt));
loadgs(SEG_KCPU << 3);
// Initialize cpu-local storage.
cpu = c;
proc = 0;
80106934: 65 c7 05 04 00 00 00 movl $0x0,%gs:0x4
8010693b: 00 00 00 00
lgdt(c->gdt, sizeof(c->gdt));
loadgs(SEG_KCPU << 3);
// Initialize cpu-local storage.
cpu = c;
8010693f: 65 a3 00 00 00 00 mov %eax,%gs:0x0
proc = 0;
}
80106945: c9 leave
80106946: c3 ret
80106947: 89 f6 mov %esi,%esi
80106949: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80106950 <setupkvm>:
};
// Set up kernel part of a page table.
pde_t*
setupkvm(void)
{
80106950: 55 push %ebp
80106951: 89 e5 mov %esp,%ebp
80106953: 56 push %esi
80106954: 53 push %ebx
80106955: 83 ec 10 sub $0x10,%esp
pde_t *pgdir;
struct kmap *k;
if((pgdir = (pde_t*)kalloc()) == 0)
80106958: e8 43 bb ff ff call 801024a0 <kalloc>
8010695d: 85 c0 test %eax,%eax
8010695f: 89 c6 mov %eax,%esi
80106961: 74 55 je 801069b8 <setupkvm+0x68>
return 0;
memset(pgdir, 0, PGSIZE);
80106963: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
8010696a: 00
if (P2V(PHYSTOP) > (void*)DEVSPACE)
panic("PHYSTOP too high");
for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
8010696b: bb 20 a4 10 80 mov $0x8010a420,%ebx
pde_t *pgdir;
struct kmap *k;
if((pgdir = (pde_t*)kalloc()) == 0)
return 0;
memset(pgdir, 0, PGSIZE);
80106970: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80106977: 00
80106978: 89 04 24 mov %eax,(%esp)
8010697b: e8 a0 db ff ff call 80104520 <memset>
if (P2V(PHYSTOP) > (void*)DEVSPACE)
panic("PHYSTOP too high");
for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
if(mappages(pgdir, k->virt, k->phys_end - k->phys_start,
80106980: 8b 53 0c mov 0xc(%ebx),%edx
80106983: 8b 43 04 mov 0x4(%ebx),%eax
80106986: 8b 4b 08 mov 0x8(%ebx),%ecx
80106989: 89 54 24 04 mov %edx,0x4(%esp)
8010698d: 8b 13 mov (%ebx),%edx
8010698f: 89 04 24 mov %eax,(%esp)
80106992: 29 c1 sub %eax,%ecx
80106994: 89 f0 mov %esi,%eax
80106996: e8 55 fd ff ff call 801066f0 <mappages>
8010699b: 85 c0 test %eax,%eax
8010699d: 78 19 js 801069b8 <setupkvm+0x68>
if((pgdir = (pde_t*)kalloc()) == 0)
return 0;
memset(pgdir, 0, PGSIZE);
if (P2V(PHYSTOP) > (void*)DEVSPACE)
panic("PHYSTOP too high");
for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
8010699f: 83 c3 10 add $0x10,%ebx
801069a2: 81 fb 60 a4 10 80 cmp $0x8010a460,%ebx
801069a8: 72 d6 jb 80106980 <setupkvm+0x30>
if(mappages(pgdir, k->virt, k->phys_end - k->phys_start,
(uint)k->phys_start, k->perm) < 0)
return 0;
return pgdir;
}
801069aa: 83 c4 10 add $0x10,%esp
801069ad: 89 f0 mov %esi,%eax
801069af: 5b pop %ebx
801069b0: 5e pop %esi
801069b1: 5d pop %ebp
801069b2: c3 ret
801069b3: 90 nop
801069b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801069b8: 83 c4 10 add $0x10,%esp
{
pde_t *pgdir;
struct kmap *k;
if((pgdir = (pde_t*)kalloc()) == 0)
return 0;
801069bb: 31 c0 xor %eax,%eax
for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
if(mappages(pgdir, k->virt, k->phys_end - k->phys_start,
(uint)k->phys_start, k->perm) < 0)
return 0;
return pgdir;
}
801069bd: 5b pop %ebx
801069be: 5e pop %esi
801069bf: 5d pop %ebp
801069c0: c3 ret
801069c1: eb 0d jmp 801069d0 <kvmalloc>
801069c3: 90 nop
801069c4: 90 nop
801069c5: 90 nop
801069c6: 90 nop
801069c7: 90 nop
801069c8: 90 nop
801069c9: 90 nop
801069ca: 90 nop
801069cb: 90 nop
801069cc: 90 nop
801069cd: 90 nop
801069ce: 90 nop
801069cf: 90 nop
801069d0 <kvmalloc>:
// Allocate one page table for the machine for the kernel address
// space for scheduler processes.
void
kvmalloc(void)
{
801069d0: 55 push %ebp
801069d1: 89 e5 mov %esp,%ebp
801069d3: 83 ec 08 sub $0x8,%esp
kpgdir = setupkvm();
801069d6: e8 75 ff ff ff call 80106950 <setupkvm>
801069db: a3 24 5d 11 80 mov %eax,0x80115d24
// Switch h/w page table register to the kernel-only page table,
// for when no process is running.
void
switchkvm(void)
{
lcr3(V2P(kpgdir)); // switch to the kernel page table
801069e0: 05 00 00 00 80 add $0x80000000,%eax
}
static inline void
lcr3(uint val)
{
asm volatile("movl %0,%%cr3" : : "r" (val));
801069e5: 0f 22 d8 mov %eax,%cr3
void
kvmalloc(void)
{
kpgdir = setupkvm();
switchkvm();
}
801069e8: c9 leave
801069e9: c3 ret
801069ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801069f0 <switchkvm>:
// Switch h/w page table register to the kernel-only page table,
// for when no process is running.
void
switchkvm(void)
{
lcr3(V2P(kpgdir)); // switch to the kernel page table
801069f0: a1 24 5d 11 80 mov 0x80115d24,%eax
// Switch h/w page table register to the kernel-only page table,
// for when no process is running.
void
switchkvm(void)
{
801069f5: 55 push %ebp
801069f6: 89 e5 mov %esp,%ebp
lcr3(V2P(kpgdir)); // switch to the kernel page table
801069f8: 05 00 00 00 80 add $0x80000000,%eax
801069fd: 0f 22 d8 mov %eax,%cr3
}
80106a00: 5d pop %ebp
80106a01: c3 ret
80106a02: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80106a09: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80106a10 <switchuvm>:
// Switch TSS and h/w page table to correspond to process p.
void
switchuvm(struct proc *p)
{
80106a10: 55 push %ebp
80106a11: 89 e5 mov %esp,%ebp
80106a13: 53 push %ebx
80106a14: 83 ec 14 sub $0x14,%esp
80106a17: 8b 5d 08 mov 0x8(%ebp),%ebx
if(p == 0)
80106a1a: 85 db test %ebx,%ebx
80106a1c: 0f 84 94 00 00 00 je 80106ab6 <switchuvm+0xa6>
panic("switchuvm: no process");
if(p->kstack == 0)
80106a22: 8b 43 08 mov 0x8(%ebx),%eax
80106a25: 85 c0 test %eax,%eax
80106a27: 0f 84 a1 00 00 00 je 80106ace <switchuvm+0xbe>
panic("switchuvm: no kstack");
if(p->pgdir == 0)
80106a2d: 8b 43 04 mov 0x4(%ebx),%eax
80106a30: 85 c0 test %eax,%eax
80106a32: 0f 84 8a 00 00 00 je 80106ac2 <switchuvm+0xb2>
panic("switchuvm: no pgdir");
pushcli();
80106a38: e8 13 da ff ff call 80104450 <pushcli>
cpu->gdt[SEG_TSS] = SEG16(STS_T32A, &cpu->ts, sizeof(cpu->ts)-1, 0);
80106a3d: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80106a43: b9 67 00 00 00 mov $0x67,%ecx
80106a48: 8d 50 08 lea 0x8(%eax),%edx
80106a4b: 66 89 88 a0 00 00 00 mov %cx,0xa0(%eax)
80106a52: 89 d1 mov %edx,%ecx
80106a54: 66 89 90 a2 00 00 00 mov %dx,0xa2(%eax)
80106a5b: c1 ea 18 shr $0x18,%edx
80106a5e: 88 90 a7 00 00 00 mov %dl,0xa7(%eax)
80106a64: c1 e9 10 shr $0x10,%ecx
cpu->gdt[SEG_TSS].s = 0;
cpu->ts.ss0 = SEG_KDATA << 3;
80106a67: ba 10 00 00 00 mov $0x10,%edx
80106a6c: 66 89 50 10 mov %dx,0x10(%eax)
panic("switchuvm: no kstack");
if(p->pgdir == 0)
panic("switchuvm: no pgdir");
pushcli();
cpu->gdt[SEG_TSS] = SEG16(STS_T32A, &cpu->ts, sizeof(cpu->ts)-1, 0);
80106a70: 88 88 a4 00 00 00 mov %cl,0xa4(%eax)
80106a76: c6 80 a6 00 00 00 40 movb $0x40,0xa6(%eax)
cpu->gdt[SEG_TSS].s = 0;
80106a7d: c6 80 a5 00 00 00 89 movb $0x89,0xa5(%eax)
cpu->ts.ss0 = SEG_KDATA << 3;
cpu->ts.esp0 = (uint)p->kstack + KSTACKSIZE;
80106a84: 8b 4b 08 mov 0x8(%ebx),%ecx
80106a87: 8d 91 00 10 00 00 lea 0x1000(%ecx),%edx
// setting IOPL=0 in eflags *and* iomb beyond the tss segment limit
// forbids I/O instructions (e.g., inb and outb) from user space
cpu->ts.iomb = (ushort) 0xFFFF;
80106a8d: b9 ff ff ff ff mov $0xffffffff,%ecx
pushcli();
cpu->gdt[SEG_TSS] = SEG16(STS_T32A, &cpu->ts, sizeof(cpu->ts)-1, 0);
cpu->gdt[SEG_TSS].s = 0;
cpu->ts.ss0 = SEG_KDATA << 3;
cpu->ts.esp0 = (uint)p->kstack + KSTACKSIZE;
80106a92: 89 50 0c mov %edx,0xc(%eax)
// setting IOPL=0 in eflags *and* iomb beyond the tss segment limit
// forbids I/O instructions (e.g., inb and outb) from user space
cpu->ts.iomb = (ushort) 0xFFFF;
80106a95: 66 89 48 6e mov %cx,0x6e(%eax)
}
static inline void
ltr(ushort sel)
{
asm volatile("ltr %0" : : "r" (sel));
80106a99: b8 30 00 00 00 mov $0x30,%eax
80106a9e: 0f 00 d8 ltr %ax
ltr(SEG_TSS << 3);
lcr3(V2P(p->pgdir)); // switch to process's address space
80106aa1: 8b 43 04 mov 0x4(%ebx),%eax
80106aa4: 05 00 00 00 80 add $0x80000000,%eax
}
static inline void
lcr3(uint val)
{
asm volatile("movl %0,%%cr3" : : "r" (val));
80106aa9: 0f 22 d8 mov %eax,%cr3
popcli();
}
80106aac: 83 c4 14 add $0x14,%esp
80106aaf: 5b pop %ebx
80106ab0: 5d pop %ebp
// setting IOPL=0 in eflags *and* iomb beyond the tss segment limit
// forbids I/O instructions (e.g., inb and outb) from user space
cpu->ts.iomb = (ushort) 0xFFFF;
ltr(SEG_TSS << 3);
lcr3(V2P(p->pgdir)); // switch to process's address space
popcli();
80106ab1: e9 ca d9 ff ff jmp 80104480 <popcli>
// Switch TSS and h/w page table to correspond to process p.
void
switchuvm(struct proc *p)
{
if(p == 0)
panic("switchuvm: no process");
80106ab6: c7 04 24 da 78 10 80 movl $0x801078da,(%esp)
80106abd: e8 9e 98 ff ff call 80100360 <panic>
if(p->kstack == 0)
panic("switchuvm: no kstack");
if(p->pgdir == 0)
panic("switchuvm: no pgdir");
80106ac2: c7 04 24 05 79 10 80 movl $0x80107905,(%esp)
80106ac9: e8 92 98 ff ff call 80100360 <panic>
switchuvm(struct proc *p)
{
if(p == 0)
panic("switchuvm: no process");
if(p->kstack == 0)
panic("switchuvm: no kstack");
80106ace: c7 04 24 f0 78 10 80 movl $0x801078f0,(%esp)
80106ad5: e8 86 98 ff ff call 80100360 <panic>
80106ada: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80106ae0 <inituvm>:
// Load the initcode into address 0 of pgdir.
// sz must be less than a page.
void
inituvm(pde_t *pgdir, char *init, uint sz)
{
80106ae0: 55 push %ebp
80106ae1: 89 e5 mov %esp,%ebp
80106ae3: 57 push %edi
80106ae4: 56 push %esi
80106ae5: 53 push %ebx
80106ae6: 83 ec 1c sub $0x1c,%esp
80106ae9: 8b 75 10 mov 0x10(%ebp),%esi
80106aec: 8b 45 08 mov 0x8(%ebp),%eax
80106aef: 8b 7d 0c mov 0xc(%ebp),%edi
char *mem;
if(sz >= PGSIZE)
80106af2: 81 fe ff 0f 00 00 cmp $0xfff,%esi
// Load the initcode into address 0 of pgdir.
// sz must be less than a page.
void
inituvm(pde_t *pgdir, char *init, uint sz)
{
80106af8: 89 45 e4 mov %eax,-0x1c(%ebp)
char *mem;
if(sz >= PGSIZE)
80106afb: 77 54 ja 80106b51 <inituvm+0x71>
panic("inituvm: more than a page");
mem = kalloc();
80106afd: e8 9e b9 ff ff call 801024a0 <kalloc>
memset(mem, 0, PGSIZE);
80106b02: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
80106b09: 00
80106b0a: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80106b11: 00
{
char *mem;
if(sz >= PGSIZE)
panic("inituvm: more than a page");
mem = kalloc();
80106b12: 89 c3 mov %eax,%ebx
memset(mem, 0, PGSIZE);
80106b14: 89 04 24 mov %eax,(%esp)
80106b17: e8 04 da ff ff call 80104520 <memset>
mappages(pgdir, 0, PGSIZE, V2P(mem), PTE_W|PTE_U);
80106b1c: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax
80106b22: b9 00 10 00 00 mov $0x1000,%ecx
80106b27: 89 04 24 mov %eax,(%esp)
80106b2a: 8b 45 e4 mov -0x1c(%ebp),%eax
80106b2d: 31 d2 xor %edx,%edx
80106b2f: c7 44 24 04 06 00 00 movl $0x6,0x4(%esp)
80106b36: 00
80106b37: e8 b4 fb ff ff call 801066f0 <mappages>
memmove(mem, init, sz);
80106b3c: 89 75 10 mov %esi,0x10(%ebp)
80106b3f: 89 7d 0c mov %edi,0xc(%ebp)
80106b42: 89 5d 08 mov %ebx,0x8(%ebp)
}
80106b45: 83 c4 1c add $0x1c,%esp
80106b48: 5b pop %ebx
80106b49: 5e pop %esi
80106b4a: 5f pop %edi
80106b4b: 5d pop %ebp
if(sz >= PGSIZE)
panic("inituvm: more than a page");
mem = kalloc();
memset(mem, 0, PGSIZE);
mappages(pgdir, 0, PGSIZE, V2P(mem), PTE_W|PTE_U);
memmove(mem, init, sz);
80106b4c: e9 7f da ff ff jmp 801045d0 <memmove>
inituvm(pde_t *pgdir, char *init, uint sz)
{
char *mem;
if(sz >= PGSIZE)
panic("inituvm: more than a page");
80106b51: c7 04 24 19 79 10 80 movl $0x80107919,(%esp)
80106b58: e8 03 98 ff ff call 80100360 <panic>
80106b5d: 8d 76 00 lea 0x0(%esi),%esi
80106b60 <loaduvm>:
// Load a program segment into pgdir. addr must be page-aligned
// and the pages from addr to addr+sz must already be mapped.
int
loaduvm(pde_t *pgdir, char *addr, struct inode *ip, uint offset, uint sz)
{
80106b60: 55 push %ebp
80106b61: 89 e5 mov %esp,%ebp
80106b63: 57 push %edi
80106b64: 56 push %esi
80106b65: 53 push %ebx
80106b66: 83 ec 1c sub $0x1c,%esp
uint i, pa, n;
pte_t *pte;
if((uint) addr % PGSIZE != 0)
80106b69: f7 45 0c ff 0f 00 00 testl $0xfff,0xc(%ebp)
80106b70: 0f 85 98 00 00 00 jne 80106c0e <loaduvm+0xae>
panic("loaduvm: addr must be page aligned");
for(i = 0; i < sz; i += PGSIZE){
80106b76: 8b 75 18 mov 0x18(%ebp),%esi
80106b79: 31 db xor %ebx,%ebx
80106b7b: 85 f6 test %esi,%esi
80106b7d: 75 1a jne 80106b99 <loaduvm+0x39>
80106b7f: eb 77 jmp 80106bf8 <loaduvm+0x98>
80106b81: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80106b88: 81 c3 00 10 00 00 add $0x1000,%ebx
80106b8e: 81 ee 00 10 00 00 sub $0x1000,%esi
80106b94: 39 5d 18 cmp %ebx,0x18(%ebp)
80106b97: 76 5f jbe 80106bf8 <loaduvm+0x98>
80106b99: 8b 55 0c mov 0xc(%ebp),%edx
if((pte = walkpgdir(pgdir, addr+i, 0)) == 0)
80106b9c: 31 c9 xor %ecx,%ecx
80106b9e: 8b 45 08 mov 0x8(%ebp),%eax
80106ba1: 01 da add %ebx,%edx
80106ba3: e8 b8 fa ff ff call 80106660 <walkpgdir>
80106ba8: 85 c0 test %eax,%eax
80106baa: 74 56 je 80106c02 <loaduvm+0xa2>
panic("loaduvm: address should exist");
pa = PTE_ADDR(*pte);
80106bac: 8b 00 mov (%eax),%eax
if(sz - i < PGSIZE)
n = sz - i;
else
n = PGSIZE;
80106bae: bf 00 10 00 00 mov $0x1000,%edi
80106bb3: 8b 4d 14 mov 0x14(%ebp),%ecx
if((uint) addr % PGSIZE != 0)
panic("loaduvm: addr must be page aligned");
for(i = 0; i < sz; i += PGSIZE){
if((pte = walkpgdir(pgdir, addr+i, 0)) == 0)
panic("loaduvm: address should exist");
pa = PTE_ADDR(*pte);
80106bb6: 25 00 f0 ff ff and $0xfffff000,%eax
if(sz - i < PGSIZE)
n = sz - i;
else
n = PGSIZE;
80106bbb: 81 fe 00 10 00 00 cmp $0x1000,%esi
80106bc1: 0f 42 fe cmovb %esi,%edi
if(readi(ip, P2V(pa), offset+i, n) != n)
80106bc4: 05 00 00 00 80 add $0x80000000,%eax
80106bc9: 89 44 24 04 mov %eax,0x4(%esp)
80106bcd: 8b 45 10 mov 0x10(%ebp),%eax
80106bd0: 01 d9 add %ebx,%ecx
80106bd2: 89 7c 24 0c mov %edi,0xc(%esp)
80106bd6: 89 4c 24 08 mov %ecx,0x8(%esp)
80106bda: 89 04 24 mov %eax,(%esp)
80106bdd: e8 6e ad ff ff call 80101950 <readi>
80106be2: 39 f8 cmp %edi,%eax
80106be4: 74 a2 je 80106b88 <loaduvm+0x28>
return -1;
}
return 0;
}
80106be6: 83 c4 1c add $0x1c,%esp
if(sz - i < PGSIZE)
n = sz - i;
else
n = PGSIZE;
if(readi(ip, P2V(pa), offset+i, n) != n)
return -1;
80106be9: b8 ff ff ff ff mov $0xffffffff,%eax
}
return 0;
}
80106bee: 5b pop %ebx
80106bef: 5e pop %esi
80106bf0: 5f pop %edi
80106bf1: 5d pop %ebp
80106bf2: c3 ret
80106bf3: 90 nop
80106bf4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80106bf8: 83 c4 1c add $0x1c,%esp
else
n = PGSIZE;
if(readi(ip, P2V(pa), offset+i, n) != n)
return -1;
}
return 0;
80106bfb: 31 c0 xor %eax,%eax
}
80106bfd: 5b pop %ebx
80106bfe: 5e pop %esi
80106bff: 5f pop %edi
80106c00: 5d pop %ebp
80106c01: c3 ret
if((uint) addr % PGSIZE != 0)
panic("loaduvm: addr must be page aligned");
for(i = 0; i < sz; i += PGSIZE){
if((pte = walkpgdir(pgdir, addr+i, 0)) == 0)
panic("loaduvm: address should exist");
80106c02: c7 04 24 33 79 10 80 movl $0x80107933,(%esp)
80106c09: e8 52 97 ff ff call 80100360 <panic>
{
uint i, pa, n;
pte_t *pte;
if((uint) addr % PGSIZE != 0)
panic("loaduvm: addr must be page aligned");
80106c0e: c7 04 24 d4 79 10 80 movl $0x801079d4,(%esp)
80106c15: e8 46 97 ff ff call 80100360 <panic>
80106c1a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80106c20 <allocuvm>:
// Allocate page tables and physical memory to grow process from oldsz to
// newsz, which need not be page aligned. Returns new size or 0 on error.
int
allocuvm(pde_t *pgdir, uint oldsz, uint newsz)
{
80106c20: 55 push %ebp
80106c21: 89 e5 mov %esp,%ebp
80106c23: 57 push %edi
80106c24: 56 push %esi
80106c25: 53 push %ebx
80106c26: 83 ec 1c sub $0x1c,%esp
80106c29: 8b 7d 10 mov 0x10(%ebp),%edi
char *mem;
uint a;
if(newsz >= KERNBASE)
80106c2c: 85 ff test %edi,%edi
80106c2e: 0f 88 7e 00 00 00 js 80106cb2 <allocuvm+0x92>
return 0;
if(newsz < oldsz)
80106c34: 3b 7d 0c cmp 0xc(%ebp),%edi
return oldsz;
80106c37: 8b 45 0c mov 0xc(%ebp),%eax
char *mem;
uint a;
if(newsz >= KERNBASE)
return 0;
if(newsz < oldsz)
80106c3a: 72 78 jb 80106cb4 <allocuvm+0x94>
return oldsz;
a = PGROUNDUP(oldsz);
80106c3c: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx
80106c42: 81 e3 00 f0 ff ff and $0xfffff000,%ebx
for(; a < newsz; a += PGSIZE){
80106c48: 39 df cmp %ebx,%edi
80106c4a: 77 4a ja 80106c96 <allocuvm+0x76>
80106c4c: eb 72 jmp 80106cc0 <allocuvm+0xa0>
80106c4e: 66 90 xchg %ax,%ax
if(mem == 0){
cprintf("allocuvm out of memory\n");
deallocuvm(pgdir, newsz, oldsz);
return 0;
}
memset(mem, 0, PGSIZE);
80106c50: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
80106c57: 00
80106c58: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80106c5f: 00
80106c60: 89 04 24 mov %eax,(%esp)
80106c63: e8 b8 d8 ff ff call 80104520 <memset>
if(mappages(pgdir, (char*)a, PGSIZE, V2P(mem), PTE_W|PTE_U) < 0){
80106c68: 8d 86 00 00 00 80 lea -0x80000000(%esi),%eax
80106c6e: b9 00 10 00 00 mov $0x1000,%ecx
80106c73: 89 04 24 mov %eax,(%esp)
80106c76: 8b 45 08 mov 0x8(%ebp),%eax
80106c79: 89 da mov %ebx,%edx
80106c7b: c7 44 24 04 06 00 00 movl $0x6,0x4(%esp)
80106c82: 00
80106c83: e8 68 fa ff ff call 801066f0 <mappages>
80106c88: 85 c0 test %eax,%eax
80106c8a: 78 44 js 80106cd0 <allocuvm+0xb0>
return 0;
if(newsz < oldsz)
return oldsz;
a = PGROUNDUP(oldsz);
for(; a < newsz; a += PGSIZE){
80106c8c: 81 c3 00 10 00 00 add $0x1000,%ebx
80106c92: 39 df cmp %ebx,%edi
80106c94: 76 2a jbe 80106cc0 <allocuvm+0xa0>
mem = kalloc();
80106c96: e8 05 b8 ff ff call 801024a0 <kalloc>
if(mem == 0){
80106c9b: 85 c0 test %eax,%eax
if(newsz < oldsz)
return oldsz;
a = PGROUNDUP(oldsz);
for(; a < newsz; a += PGSIZE){
mem = kalloc();
80106c9d: 89 c6 mov %eax,%esi
if(mem == 0){
80106c9f: 75 af jne 80106c50 <allocuvm+0x30>
cprintf("allocuvm out of memory\n");
80106ca1: c7 04 24 51 79 10 80 movl $0x80107951,(%esp)
80106ca8: e8 a3 99 ff ff call 80100650 <cprintf>
deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
{
pte_t *pte;
uint a, pa;
if(newsz >= oldsz)
80106cad: 3b 7d 0c cmp 0xc(%ebp),%edi
80106cb0: 77 48 ja 80106cfa <allocuvm+0xda>
memset(mem, 0, PGSIZE);
if(mappages(pgdir, (char*)a, PGSIZE, V2P(mem), PTE_W|PTE_U) < 0){
cprintf("allocuvm out of memory (2)\n");
deallocuvm(pgdir, newsz, oldsz);
kfree(mem);
return 0;
80106cb2: 31 c0 xor %eax,%eax
}
}
return newsz;
}
80106cb4: 83 c4 1c add $0x1c,%esp
80106cb7: 5b pop %ebx
80106cb8: 5e pop %esi
80106cb9: 5f pop %edi
80106cba: 5d pop %ebp
80106cbb: c3 ret
80106cbc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80106cc0: 83 c4 1c add $0x1c,%esp
80106cc3: 89 f8 mov %edi,%eax
80106cc5: 5b pop %ebx
80106cc6: 5e pop %esi
80106cc7: 5f pop %edi
80106cc8: 5d pop %ebp
80106cc9: c3 ret
80106cca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
deallocuvm(pgdir, newsz, oldsz);
return 0;
}
memset(mem, 0, PGSIZE);
if(mappages(pgdir, (char*)a, PGSIZE, V2P(mem), PTE_W|PTE_U) < 0){
cprintf("allocuvm out of memory (2)\n");
80106cd0: c7 04 24 69 79 10 80 movl $0x80107969,(%esp)
80106cd7: e8 74 99 ff ff call 80100650 <cprintf>
deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
{
pte_t *pte;
uint a, pa;
if(newsz >= oldsz)
80106cdc: 3b 7d 0c cmp 0xc(%ebp),%edi
80106cdf: 76 0d jbe 80106cee <allocuvm+0xce>
80106ce1: 8b 4d 0c mov 0xc(%ebp),%ecx
80106ce4: 89 fa mov %edi,%edx
80106ce6: 8b 45 08 mov 0x8(%ebp),%eax
80106ce9: e8 82 fa ff ff call 80106770 <deallocuvm.part.0>
}
memset(mem, 0, PGSIZE);
if(mappages(pgdir, (char*)a, PGSIZE, V2P(mem), PTE_W|PTE_U) < 0){
cprintf("allocuvm out of memory (2)\n");
deallocuvm(pgdir, newsz, oldsz);
kfree(mem);
80106cee: 89 34 24 mov %esi,(%esp)
80106cf1: e8 fa b5 ff ff call 801022f0 <kfree>
return 0;
80106cf6: 31 c0 xor %eax,%eax
80106cf8: eb ba jmp 80106cb4 <allocuvm+0x94>
80106cfa: 8b 4d 0c mov 0xc(%ebp),%ecx
80106cfd: 89 fa mov %edi,%edx
80106cff: 8b 45 08 mov 0x8(%ebp),%eax
80106d02: e8 69 fa ff ff call 80106770 <deallocuvm.part.0>
for(; a < newsz; a += PGSIZE){
mem = kalloc();
if(mem == 0){
cprintf("allocuvm out of memory\n");
deallocuvm(pgdir, newsz, oldsz);
return 0;
80106d07: 31 c0 xor %eax,%eax
80106d09: eb a9 jmp 80106cb4 <allocuvm+0x94>
80106d0b: 90 nop
80106d0c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80106d10 <deallocuvm>:
// newsz. oldsz and newsz need not be page-aligned, nor does newsz
// need to be less than oldsz. oldsz can be larger than the actual
// process size. Returns the new process size.
int
deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
{
80106d10: 55 push %ebp
80106d11: 89 e5 mov %esp,%ebp
80106d13: 8b 55 0c mov 0xc(%ebp),%edx
80106d16: 8b 4d 10 mov 0x10(%ebp),%ecx
80106d19: 8b 45 08 mov 0x8(%ebp),%eax
pte_t *pte;
uint a, pa;
if(newsz >= oldsz)
80106d1c: 39 d1 cmp %edx,%ecx
80106d1e: 73 08 jae 80106d28 <deallocuvm+0x18>
kfree(v);
*pte = 0;
}
}
return newsz;
}
80106d20: 5d pop %ebp
80106d21: e9 4a fa ff ff jmp 80106770 <deallocuvm.part.0>
80106d26: 66 90 xchg %ax,%ax
80106d28: 89 d0 mov %edx,%eax
80106d2a: 5d pop %ebp
80106d2b: c3 ret
80106d2c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80106d30 <freevm>:
// Free a page table and all the physical memory pages
// in the user part.
void
freevm(pde_t *pgdir)
{
80106d30: 55 push %ebp
80106d31: 89 e5 mov %esp,%ebp
80106d33: 56 push %esi
80106d34: 53 push %ebx
80106d35: 83 ec 10 sub $0x10,%esp
80106d38: 8b 75 08 mov 0x8(%ebp),%esi
uint i;
if(pgdir == 0)
80106d3b: 85 f6 test %esi,%esi
80106d3d: 74 59 je 80106d98 <freevm+0x68>
80106d3f: 31 c9 xor %ecx,%ecx
80106d41: ba 00 00 00 80 mov $0x80000000,%edx
80106d46: 89 f0 mov %esi,%eax
panic("freevm: no pgdir");
deallocuvm(pgdir, KERNBASE, 0);
for(i = 0; i < NPDENTRIES; i++){
80106d48: 31 db xor %ebx,%ebx
80106d4a: e8 21 fa ff ff call 80106770 <deallocuvm.part.0>
80106d4f: eb 12 jmp 80106d63 <freevm+0x33>
80106d51: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80106d58: 83 c3 01 add $0x1,%ebx
80106d5b: 81 fb 00 04 00 00 cmp $0x400,%ebx
80106d61: 74 27 je 80106d8a <freevm+0x5a>
if(pgdir[i] & PTE_P){
80106d63: 8b 14 9e mov (%esi,%ebx,4),%edx
80106d66: f6 c2 01 test $0x1,%dl
80106d69: 74 ed je 80106d58 <freevm+0x28>
char * v = P2V(PTE_ADDR(pgdir[i]));
80106d6b: 81 e2 00 f0 ff ff and $0xfffff000,%edx
uint i;
if(pgdir == 0)
panic("freevm: no pgdir");
deallocuvm(pgdir, KERNBASE, 0);
for(i = 0; i < NPDENTRIES; i++){
80106d71: 83 c3 01 add $0x1,%ebx
if(pgdir[i] & PTE_P){
char * v = P2V(PTE_ADDR(pgdir[i]));
80106d74: 81 c2 00 00 00 80 add $0x80000000,%edx
kfree(v);
80106d7a: 89 14 24 mov %edx,(%esp)
80106d7d: e8 6e b5 ff ff call 801022f0 <kfree>
uint i;
if(pgdir == 0)
panic("freevm: no pgdir");
deallocuvm(pgdir, KERNBASE, 0);
for(i = 0; i < NPDENTRIES; i++){
80106d82: 81 fb 00 04 00 00 cmp $0x400,%ebx
80106d88: 75 d9 jne 80106d63 <freevm+0x33>
if(pgdir[i] & PTE_P){
char * v = P2V(PTE_ADDR(pgdir[i]));
kfree(v);
}
}
kfree((char*)pgdir);
80106d8a: 89 75 08 mov %esi,0x8(%ebp)
}
80106d8d: 83 c4 10 add $0x10,%esp
80106d90: 5b pop %ebx
80106d91: 5e pop %esi
80106d92: 5d pop %ebp
if(pgdir[i] & PTE_P){
char * v = P2V(PTE_ADDR(pgdir[i]));
kfree(v);
}
}
kfree((char*)pgdir);
80106d93: e9 58 b5 ff ff jmp 801022f0 <kfree>
freevm(pde_t *pgdir)
{
uint i;
if(pgdir == 0)
panic("freevm: no pgdir");
80106d98: c7 04 24 85 79 10 80 movl $0x80107985,(%esp)
80106d9f: e8 bc 95 ff ff call 80100360 <panic>
80106da4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80106daa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80106db0 <clearpteu>:
// Clear PTE_U on a page. Used to create an inaccessible
// page beneath the user stack.
void
clearpteu(pde_t *pgdir, char *uva)
{
80106db0: 55 push %ebp
pte_t *pte;
pte = walkpgdir(pgdir, uva, 0);
80106db1: 31 c9 xor %ecx,%ecx
// Clear PTE_U on a page. Used to create an inaccessible
// page beneath the user stack.
void
clearpteu(pde_t *pgdir, char *uva)
{
80106db3: 89 e5 mov %esp,%ebp
80106db5: 83 ec 18 sub $0x18,%esp
pte_t *pte;
pte = walkpgdir(pgdir, uva, 0);
80106db8: 8b 55 0c mov 0xc(%ebp),%edx
80106dbb: 8b 45 08 mov 0x8(%ebp),%eax
80106dbe: e8 9d f8 ff ff call 80106660 <walkpgdir>
if(pte == 0)
80106dc3: 85 c0 test %eax,%eax
80106dc5: 74 05 je 80106dcc <clearpteu+0x1c>
panic("clearpteu");
*pte &= ~PTE_U;
80106dc7: 83 20 fb andl $0xfffffffb,(%eax)
}
80106dca: c9 leave
80106dcb: c3 ret
{
pte_t *pte;
pte = walkpgdir(pgdir, uva, 0);
if(pte == 0)
panic("clearpteu");
80106dcc: c7 04 24 96 79 10 80 movl $0x80107996,(%esp)
80106dd3: e8 88 95 ff ff call 80100360 <panic>
80106dd8: 90 nop
80106dd9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80106de0 <copyuvm>:
// Given a parent process's page table, create a copy
// of it for a child.
pde_t*
copyuvm(pde_t *pgdir, uint sz)
{
80106de0: 55 push %ebp
80106de1: 89 e5 mov %esp,%ebp
80106de3: 57 push %edi
80106de4: 56 push %esi
80106de5: 53 push %ebx
80106de6: 83 ec 2c sub $0x2c,%esp
pde_t *d;
pte_t *pte;
uint pa, i, flags;
char *mem;
if((d = setupkvm()) == 0)
80106de9: e8 62 fb ff ff call 80106950 <setupkvm>
80106dee: 85 c0 test %eax,%eax
80106df0: 89 45 e0 mov %eax,-0x20(%ebp)
80106df3: 0f 84 b2 00 00 00 je 80106eab <copyuvm+0xcb>
return 0;
for(i = 0; i < sz; i += PGSIZE){
80106df9: 8b 45 0c mov 0xc(%ebp),%eax
80106dfc: 85 c0 test %eax,%eax
80106dfe: 0f 84 9c 00 00 00 je 80106ea0 <copyuvm+0xc0>
80106e04: 31 db xor %ebx,%ebx
80106e06: eb 48 jmp 80106e50 <copyuvm+0x70>
panic("copyuvm: page not present");
pa = PTE_ADDR(*pte);
flags = PTE_FLAGS(*pte);
if((mem = kalloc()) == 0)
goto bad;
memmove(mem, (char*)P2V(pa), PGSIZE);
80106e08: 81 c7 00 00 00 80 add $0x80000000,%edi
80106e0e: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
80106e15: 00
80106e16: 89 7c 24 04 mov %edi,0x4(%esp)
80106e1a: 89 04 24 mov %eax,(%esp)
80106e1d: e8 ae d7 ff ff call 801045d0 <memmove>
if(mappages(d, (void*)i, PGSIZE, V2P(mem), flags) < 0)
80106e22: 8b 45 e4 mov -0x1c(%ebp),%eax
80106e25: 8d 96 00 00 00 80 lea -0x80000000(%esi),%edx
80106e2b: 89 14 24 mov %edx,(%esp)
80106e2e: b9 00 10 00 00 mov $0x1000,%ecx
80106e33: 89 da mov %ebx,%edx
80106e35: 89 44 24 04 mov %eax,0x4(%esp)
80106e39: 8b 45 e0 mov -0x20(%ebp),%eax
80106e3c: e8 af f8 ff ff call 801066f0 <mappages>
80106e41: 85 c0 test %eax,%eax
80106e43: 78 41 js 80106e86 <copyuvm+0xa6>
uint pa, i, flags;
char *mem;
if((d = setupkvm()) == 0)
return 0;
for(i = 0; i < sz; i += PGSIZE){
80106e45: 81 c3 00 10 00 00 add $0x1000,%ebx
80106e4b: 39 5d 0c cmp %ebx,0xc(%ebp)
80106e4e: 76 50 jbe 80106ea0 <copyuvm+0xc0>
if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0)
80106e50: 8b 45 08 mov 0x8(%ebp),%eax
80106e53: 31 c9 xor %ecx,%ecx
80106e55: 89 da mov %ebx,%edx
80106e57: e8 04 f8 ff ff call 80106660 <walkpgdir>
80106e5c: 85 c0 test %eax,%eax
80106e5e: 74 5b je 80106ebb <copyuvm+0xdb>
panic("copyuvm: pte should exist");
if(!(*pte & PTE_P))
80106e60: 8b 30 mov (%eax),%esi
80106e62: f7 c6 01 00 00 00 test $0x1,%esi
80106e68: 74 45 je 80106eaf <copyuvm+0xcf>
panic("copyuvm: page not present");
pa = PTE_ADDR(*pte);
80106e6a: 89 f7 mov %esi,%edi
flags = PTE_FLAGS(*pte);
80106e6c: 81 e6 ff 0f 00 00 and $0xfff,%esi
80106e72: 89 75 e4 mov %esi,-0x1c(%ebp)
for(i = 0; i < sz; i += PGSIZE){
if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0)
panic("copyuvm: pte should exist");
if(!(*pte & PTE_P))
panic("copyuvm: page not present");
pa = PTE_ADDR(*pte);
80106e75: 81 e7 00 f0 ff ff and $0xfffff000,%edi
flags = PTE_FLAGS(*pte);
if((mem = kalloc()) == 0)
80106e7b: e8 20 b6 ff ff call 801024a0 <kalloc>
80106e80: 85 c0 test %eax,%eax
80106e82: 89 c6 mov %eax,%esi
80106e84: 75 82 jne 80106e08 <copyuvm+0x28>
goto bad;
}
return d;
bad:
freevm(d);
80106e86: 8b 45 e0 mov -0x20(%ebp),%eax
80106e89: 89 04 24 mov %eax,(%esp)
80106e8c: e8 9f fe ff ff call 80106d30 <freevm>
return 0;
80106e91: 31 c0 xor %eax,%eax
}
80106e93: 83 c4 2c add $0x2c,%esp
80106e96: 5b pop %ebx
80106e97: 5e pop %esi
80106e98: 5f pop %edi
80106e99: 5d pop %ebp
80106e9a: c3 ret
80106e9b: 90 nop
80106e9c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80106ea0: 8b 45 e0 mov -0x20(%ebp),%eax
80106ea3: 83 c4 2c add $0x2c,%esp
80106ea6: 5b pop %ebx
80106ea7: 5e pop %esi
80106ea8: 5f pop %edi
80106ea9: 5d pop %ebp
80106eaa: c3 ret
pte_t *pte;
uint pa, i, flags;
char *mem;
if((d = setupkvm()) == 0)
return 0;
80106eab: 31 c0 xor %eax,%eax
80106ead: eb e4 jmp 80106e93 <copyuvm+0xb3>
for(i = 0; i < sz; i += PGSIZE){
if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0)
panic("copyuvm: pte should exist");
if(!(*pte & PTE_P))
panic("copyuvm: page not present");
80106eaf: c7 04 24 ba 79 10 80 movl $0x801079ba,(%esp)
80106eb6: e8 a5 94 ff ff call 80100360 <panic>
if((d = setupkvm()) == 0)
return 0;
for(i = 0; i < sz; i += PGSIZE){
if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0)
panic("copyuvm: pte should exist");
80106ebb: c7 04 24 a0 79 10 80 movl $0x801079a0,(%esp)
80106ec2: e8 99 94 ff ff call 80100360 <panic>
80106ec7: 89 f6 mov %esi,%esi
80106ec9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80106ed0 <uva2ka>:
//PAGEBREAK!
// Map user virtual address to kernel address.
char*
uva2ka(pde_t *pgdir, char *uva)
{
80106ed0: 55 push %ebp
pte_t *pte;
pte = walkpgdir(pgdir, uva, 0);
80106ed1: 31 c9 xor %ecx,%ecx
//PAGEBREAK!
// Map user virtual address to kernel address.
char*
uva2ka(pde_t *pgdir, char *uva)
{
80106ed3: 89 e5 mov %esp,%ebp
80106ed5: 83 ec 08 sub $0x8,%esp
pte_t *pte;
pte = walkpgdir(pgdir, uva, 0);
80106ed8: 8b 55 0c mov 0xc(%ebp),%edx
80106edb: 8b 45 08 mov 0x8(%ebp),%eax
80106ede: e8 7d f7 ff ff call 80106660 <walkpgdir>
if((*pte & PTE_P) == 0)
80106ee3: 8b 00 mov (%eax),%eax
80106ee5: 89 c2 mov %eax,%edx
80106ee7: 83 e2 05 and $0x5,%edx
return 0;
if((*pte & PTE_U) == 0)
80106eea: 83 fa 05 cmp $0x5,%edx
80106eed: 75 11 jne 80106f00 <uva2ka+0x30>
return 0;
return (char*)P2V(PTE_ADDR(*pte));
80106eef: 25 00 f0 ff ff and $0xfffff000,%eax
80106ef4: 05 00 00 00 80 add $0x80000000,%eax
}
80106ef9: c9 leave
80106efa: c3 ret
80106efb: 90 nop
80106efc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
pte = walkpgdir(pgdir, uva, 0);
if((*pte & PTE_P) == 0)
return 0;
if((*pte & PTE_U) == 0)
return 0;
80106f00: 31 c0 xor %eax,%eax
return (char*)P2V(PTE_ADDR(*pte));
}
80106f02: c9 leave
80106f03: c3 ret
80106f04: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80106f0a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80106f10 <copyout>:
// Copy len bytes from p to user address va in page table pgdir.
// Most useful when pgdir is not the current page table.
// uva2ka ensures this only works for PTE_U pages.
int
copyout(pde_t *pgdir, uint va, void *p, uint len)
{
80106f10: 55 push %ebp
80106f11: 89 e5 mov %esp,%ebp
80106f13: 57 push %edi
80106f14: 56 push %esi
80106f15: 53 push %ebx
80106f16: 83 ec 1c sub $0x1c,%esp
80106f19: 8b 5d 14 mov 0x14(%ebp),%ebx
80106f1c: 8b 4d 0c mov 0xc(%ebp),%ecx
80106f1f: 8b 7d 10 mov 0x10(%ebp),%edi
char *buf, *pa0;
uint n, va0;
buf = (char*)p;
while(len > 0){
80106f22: 85 db test %ebx,%ebx
80106f24: 75 3a jne 80106f60 <copyout+0x50>
80106f26: eb 68 jmp 80106f90 <copyout+0x80>
va0 = (uint)PGROUNDDOWN(va);
pa0 = uva2ka(pgdir, (char*)va0);
if(pa0 == 0)
return -1;
n = PGSIZE - (va - va0);
80106f28: 8b 4d e4 mov -0x1c(%ebp),%ecx
80106f2b: 89 f2 mov %esi,%edx
if(n > len)
n = len;
memmove(pa0 + (va - va0), buf, n);
80106f2d: 89 7c 24 04 mov %edi,0x4(%esp)
while(len > 0){
va0 = (uint)PGROUNDDOWN(va);
pa0 = uva2ka(pgdir, (char*)va0);
if(pa0 == 0)
return -1;
n = PGSIZE - (va - va0);
80106f31: 29 ca sub %ecx,%edx
80106f33: 81 c2 00 10 00 00 add $0x1000,%edx
80106f39: 39 da cmp %ebx,%edx
80106f3b: 0f 47 d3 cmova %ebx,%edx
if(n > len)
n = len;
memmove(pa0 + (va - va0), buf, n);
80106f3e: 29 f1 sub %esi,%ecx
80106f40: 01 c8 add %ecx,%eax
80106f42: 89 54 24 08 mov %edx,0x8(%esp)
80106f46: 89 04 24 mov %eax,(%esp)
80106f49: 89 55 e4 mov %edx,-0x1c(%ebp)
80106f4c: e8 7f d6 ff ff call 801045d0 <memmove>
len -= n;
buf += n;
80106f51: 8b 55 e4 mov -0x1c(%ebp),%edx
va = va0 + PGSIZE;
80106f54: 8d 8e 00 10 00 00 lea 0x1000(%esi),%ecx
n = PGSIZE - (va - va0);
if(n > len)
n = len;
memmove(pa0 + (va - va0), buf, n);
len -= n;
buf += n;
80106f5a: 01 d7 add %edx,%edi
{
char *buf, *pa0;
uint n, va0;
buf = (char*)p;
while(len > 0){
80106f5c: 29 d3 sub %edx,%ebx
80106f5e: 74 30 je 80106f90 <copyout+0x80>
va0 = (uint)PGROUNDDOWN(va);
pa0 = uva2ka(pgdir, (char*)va0);
80106f60: 8b 45 08 mov 0x8(%ebp),%eax
char *buf, *pa0;
uint n, va0;
buf = (char*)p;
while(len > 0){
va0 = (uint)PGROUNDDOWN(va);
80106f63: 89 ce mov %ecx,%esi
80106f65: 81 e6 00 f0 ff ff and $0xfffff000,%esi
pa0 = uva2ka(pgdir, (char*)va0);
80106f6b: 89 74 24 04 mov %esi,0x4(%esp)
char *buf, *pa0;
uint n, va0;
buf = (char*)p;
while(len > 0){
va0 = (uint)PGROUNDDOWN(va);
80106f6f: 89 4d e4 mov %ecx,-0x1c(%ebp)
pa0 = uva2ka(pgdir, (char*)va0);
80106f72: 89 04 24 mov %eax,(%esp)
80106f75: e8 56 ff ff ff call 80106ed0 <uva2ka>
if(pa0 == 0)
80106f7a: 85 c0 test %eax,%eax
80106f7c: 75 aa jne 80106f28 <copyout+0x18>
len -= n;
buf += n;
va = va0 + PGSIZE;
}
return 0;
}
80106f7e: 83 c4 1c add $0x1c,%esp
buf = (char*)p;
while(len > 0){
va0 = (uint)PGROUNDDOWN(va);
pa0 = uva2ka(pgdir, (char*)va0);
if(pa0 == 0)
return -1;
80106f81: b8 ff ff ff ff mov $0xffffffff,%eax
len -= n;
buf += n;
va = va0 + PGSIZE;
}
return 0;
}
80106f86: 5b pop %ebx
80106f87: 5e pop %esi
80106f88: 5f pop %edi
80106f89: 5d pop %ebp
80106f8a: c3 ret
80106f8b: 90 nop
80106f8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80106f90: 83 c4 1c add $0x1c,%esp
memmove(pa0 + (va - va0), buf, n);
len -= n;
buf += n;
va = va0 + PGSIZE;
}
return 0;
80106f93: 31 c0 xor %eax,%eax
}
80106f95: 5b pop %ebx
80106f96: 5e pop %esi
80106f97: 5f pop %edi
80106f98: 5d pop %ebp
80106f99: c3 ret
|
; A161342: Number of "ON" cubic cells at n-th stage in simple 3-dimensional cellular automaton: a(n) = A160428(n)/8.
; 0,1,8,15,64,71,120,169,512,519,568,617,960,1009,1352,1695,4096,4103,4152,4201,4544,4593,4936,5279,7680,7729,8072,8415,10816,11159,13560,15961,32768,32775,32824,32873
mov $2,$0
mov $6,$0
lpb $2
mov $0,$6
sub $2,1
sub $0,$2
mov $5,2
mov $8,$0
lpb $5
mov $0,$8
sub $0,1
sub $5,1
add $7,1
lpb $7
mul $0,2
mov $3,$0
sub $7,1
lpb $0
div $3,2
sub $0,$3
mov $4,7
lpe
pow $4,$0
lpe
lpe
add $1,$4
lpe
|
; this is an example of bios function: int 10h / ah=13h.
; refer to short list of dos interrupts for more info:
; c:\emu8086\documentation\
name "int10h"
org 100h
; set es (just in case):
push cs
pop es
mov bh, 0 ; page.
lea bp, msg ; offset.
mov bl, 0f3h ; default attribute.
mov cx, 12 ; char number.
mov dl, 2 ; col.
mov dh, 1 ; row.
mov ah, 13h ; function.
mov al, 1 ; sub-function.
int 10h
; show current cursor position:
mov al, '<'
mov ah, 0eh
int 10h
mov bh, 0 ; page.
lea bp, cmsg ; offset of string with attributes.
mov bl, 0f3h ; default attribute (not used when al=3).
mov cx, 12 ; char number.
mov dl, 2 ; col.
mov dh, 3 ; row.
mov ah, 13h ; function.
mov al, 3 ; sub-function.
int 10h
; show current cursor position:
mov al, '<'
mov ah, 0eh
int 10h
; wait for any key press....
mov ah, 0
int 16h
ret ; return control to the operating system.
msg db 'hello world!'
cmsg db 'h', 0cfh, 'e', 8bh, 'l', 0f0h, 'l', 5fh, 'o', 3ch, ' ', 0e0h
db 'w', 0b3h, 'o', 2eh, 'r', 0cah, 'l', 1ah, 'd', 0ach, '!', 2fh
|
lda #<{c1}
sta ({z1}),y
iny
lda #>{c1}
sta ({z1}),y
|
; A081656: 2*6^n-2^n.
; 1,10,68,424,2576,15520,93248,559744,3358976,20154880,120931328,725592064,4353560576,26121379840,156728311808,940369936384,5642219749376,33853318758400,203119913074688,1218719479496704,7312316879077376
mov $2,$0
mov $3,3
mov $4,$0
add $4,1
mul $4,5
mov $5,5
lpb $2
mov $1,2
lpb $4
mul $1,6
mul $3,2
sub $4,$5
mov $6,$3
lpe
sub $1,$6
mod $2,2
sub $2,1
lpe
trn $1,6
div $1,6
add $1,1
|
; attribute line offsets in the VRAM to control-key position
KEY_ATTR_OFS_HELP equ 0
KEY_ATTR_OFS_TURBO equ 5
KEY_ATTR_OFS_FULL equ 10
KEY_ATTR_OFS_RUN equ 15
KEY_ATTR_OFS_CORE equ 22
KEY_ATTR_OFS_INSTR equ 27
CHARPOS_INS_END equ 13
CHARPOS_ENCODING equ 15
CHARPOS_INS_KEY equ KEY_ATTR_OFS_INSTR
CHARPOS_STATUS equ 29
MachineInfoLabels:
; 0123456789A123456789A123456789A1
db '1Hlp 2T14 3Ful 5Go m',0,'c',0
InstructionMnemonics:
db 'ADD BC,**',0
db 'ADD BC,A',0
db 'ADD DE,**',0
db 'ADD DE,A',0
db 'ADD HL,**',0
db 'ADD HL,A',0
db 'LDDRX',0
db 'LDDX',0
db 'LDIRX',0
db 'LDIX',0
db 'LDPIRX',0
db 'LDWS',0
db 'MIRROR',0
db 'MUL D,E',0
db 'NEXTREG *r,*n',0
db 'NEXTREG *r,A',0
db 'OUTINB',0
db 'PIXELAD',0
db 'PIXELDN',0
db 'PUSH **',0
db 'SETAE',0
db 'SWAPNIB',0
db 'TEST *',0
; Two bytes per instruction: Char to display, location in key-array to test
InstructionsData_KeyLegends:
db 'Q', KEY_Q ; ADD BC,$nnnn
db 'W', KEY_W ; ADD BC,A
db 'E', KEY_E ; ADD DE,$nnnn
db 'R', KEY_R ; ADD DE,A
db 'T', KEY_T ; ADD HL,$nnnn
db 'Y', KEY_Y ; ADD HL,A
db 'U', KEY_U ; LDDRX
db 'I', KEY_I ; LDDX
db 'O', KEY_O ; LDIRX
db 'P', KEY_P ; LDIX
db 'A', KEY_A ; LDPIRX
db 'S', KEY_S ; LDWS
db 'D', KEY_D ; MIRROR
db 'F', KEY_F ; MUL D,E
db 'G', KEY_G ; NEXTREG $rr,$n
db 'H', KEY_H ; NEXTREG $rr,A
db 'J', KEY_J ; OUTINB
db 'K', KEY_K ; PIXELAD
db 'L', KEY_L ; PIXELDN
db 'Z', KEY_Z ; PUSH $nnnn
db 'X', KEY_X ; SETAE
db 'C', KEY_C ; SWAPNIB
db 'V', KEY_V ; TEST $nn
; four bytes per instruction, either real opcode byte, or special opcode equ
InstructionsData_Encoding:
db $ED, $36, OPCODE_TXT_LOW, OPCODE_TXT_HIGH ; ADD BC,$nnnn
db $ED, $33, 0, 0 ; ADD BC,A
db $ED, $35, OPCODE_TXT_LOW, OPCODE_TXT_HIGH ; ADD DE,$nnnn
db $ED, $32, 0, 0 ; ADD DE,A
db $ED, $34, OPCODE_TXT_LOW, OPCODE_TXT_HIGH ; ADD HL,$nnnn
db $ED, $31, 0, 0 ; ADD HL,A
db $ED, $BC, 0, 0 ; LDDRX
db $ED, $AC, 0, 0 ; LDDX
db $ED, $B4, 0, 0 ; LDIRX
db $ED, $A4, 0, 0 ; LDIX
db $ED, $B7, 0, 0 ; LDPIRX
db $ED, $A5, 0, 0 ; LDWS
db $ED, $24, 0, 0 ; MIRROR
db $ED, $30, 0, 0 ; MUL D,E
db $ED, $91, OPCODE_TXT_REG, OPCODE_TXT_VALUE ; NEXTREG $rr,$n
db $ED, $92, OPCODE_TXT_REG, 0 ; NEXTREG $rr,A
db $ED, $90, 0, 0 ; OUTINB
db $ED, $94, 0, 0 ; PIXELAD
db $ED, $93, 0, 0 ; PIXELDN
db $ED, $8A, OPCODE_TXT_HIGH, OPCODE_TXT_LOW ; PUSH $nnnn
db $ED, $95, 0, 0 ; SETAE
db $ED, $23, 0, 0 ; SWAPNIB
db $ED, $27, OPCODE_TXT_VALUE, 0 ; TEST $nn
; byte 0 = encoding bytes [2:0], special mask [7:3] (from top to bottom)
; byte 1 = result
; byte 2 = logIndex (first log index, 0 == no log)
; byte 3 = temporary scratch area for test
InstructionsData_Details:
db $34, RESULT_NONE, 0, -1 ; ADD BC,$nnnn
db $02, RESULT_NONE, 0, -1 ; ADD BC,A
db $34, RESULT_NONE, 0, -1 ; ADD DE,$nnnn
db $02, RESULT_NONE, 0, -1 ; ADD DE,A
db $34, RESULT_NONE, 0, -1 ; ADD HL,$nnnn
db $02, RESULT_NONE, 0, -1 ; ADD HL,A
db $02, RESULT_NONE, 0, -1 ; LDDRX
db $02, RESULT_NONE, 0, -1 ; LDDX
db $02, RESULT_NONE, 0, -1 ; LDIRX
db $02, RESULT_NONE, 0, -1 ; LDIX
db $02, RESULT_NONE, 0, -1 ; LDPIRX
db $02, RESULT_NONE, 0, -1 ; LDWS
db $02, RESULT_NONE, 0, -1 ; MIRROR
db $02, RESULT_NONE, 0, -1 ; MUL D,E
db $34, RESULT_NONE, 0, -1 ; NEXTREG $rr,$n
db $23, RESULT_NONE, 0, -1 ; NEXTREG $rr,A
db $02, RESULT_NONE, 0, -1 ; OUTINB
db $02, RESULT_NONE, 0, -1 ; PIXELAD
db $02, RESULT_NONE, 0, -1 ; PIXELDN
db $34, RESULT_NONE, 0, -1 ; PUSH $nnnn
db $02, RESULT_NONE, 0, -1 ; SETAE
db $02, RESULT_NONE, 0, -1 ; SWAPNIB
db $23, RESULT_NONE, 0, -1 ; TEST $nn
HelpTxt:
; 0123456789A123456789A123456789A1
db ' ',0
db 'Read the "!Z80N.txt" for details',0
db ' ',0
db 'Press 2 to switch 14Mhz turbo.',0
db 'Press 5 to run all tests (~12s).',0
db 'Option 3 for full tests (~5min).',0
db ' ',0
db 'To run particular test or check',0
db 'error log in case of "ERR" state',0
db 'press the highlighted letter.',0
db ' ',0
db 'Values in log are hexadecimal.',0
db ' ',0
db 'For instruction details you can',0
db 'check:',0
db 'http://devnext.referata.com/wiki',0
db '/Extended_Z80_instruction_set',0
db ' ',0
db 'Tests can be run only once.',0
db ' ',0
db ' Press any key',0
db 0
include "UIcode.i.asm"
|
; A282097: Coefficients in q-expansion of (3*E_2*E_4 - 2*E_6 - E_2^3)/1728, where E_2, E_4, E_6 are the Eisenstein series shown in A006352, A004009, A013973, respectively.
; 0,1,12,36,112,150,432,392,960,1053,1800,1452,4032,2366,4704,5400,7936,5202,12636,7220,16800,14112,17424,12696,34560,19375,28392,29160,43904,25230,64800,30752,64512,52272,62424,58800,117936,52022,86640,85176,144000,70602,169344,81356,162624,157950,152352,106032,285696,136857,232500,187272,264992,151686,349920,217800,376320,259920,302760,208860,604800,230702,369024,412776,520192,354900,627264,305252,582624,457056,705600,362952,1010880,394346,624264,697500,808640,569184,1022112,499280,1190400,793881,847224,578676,1580544,780300,976272,908280,1393920,712890,1895400,927472,1421952,1107072,1272384,1083000,2322432,922082,1642284,1528956
mov $2,$0
mul $2,$0
trn $0,1
seq $0,203 ; a(n) = sigma(n), the sum of the divisors of n. Also called sigma_1(n).
mul $0,$2
|
; int fsetpos_unlocked(FILE *stream, const fpos_t *pos)
SECTION code_clib
SECTION code_stdio
PUBLIC _fsetpos_unlocked
EXTERN asm_fsetpos_unlocked
_fsetpos_unlocked:
pop af
pop ix
pop hl
push hl
push hl
push af
jp asm_fsetpos_unlocked
|
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; ReadDr7.Asm
;
; Abstract:
;
; AsmReadDr7 function
;
; Notes:
;
;------------------------------------------------------------------------------
.586p
.model flat,C
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmReadDr7 (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadDr7 PROC
mov eax, dr7
ret
AsmReadDr7 ENDP
END
|
; ----------------------------------------------------------------
; Z88DK INTERFACE LIBRARY FOR NIRVANA+ ENGINE - by Einar Saukas
;
; See "nirvana+.h" for further details
; ----------------------------------------------------------------
; void NIRVANAM_drawTW(unsigned char tile, unsigned char lin, unsigned char col)
; callee
SECTION code_clib
SECTION code_nirvanam
PUBLIC _NIRVANAM_drawTW_callee
EXTERN asm_NIRVANAM_drawTW_di
_NIRVANAM_drawTW_callee:
pop hl
pop de ; d = line
ld a,e ; a = tile
dec sp
ex (sp),hl
ld e,h ; e = col
jp asm_NIRVANAM_drawTW_di
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: ExpParser.cpp
* Author: tonysulfaro
*
* Created on March 22, 2019, 9:08 PM
*/
#include "ExpParser.h"
|
SECTION code_crt0_sccz80
PUBLIC l_mod_u
EXTERN ___divu16_bcde
; signed division
; hl = de/hl, de = de%hl
l_mod_u:
; Delegate to the sdcc routine
; Entry BC=dividend, DE=divisor
; Exit: BC=quotient, DE=remainder
ld c,l
ld b,h
call ___divu16_bcde
ld l,e
ld h,d
ret
|
<%
from pwnlib.shellcraft.i386.linux import syscall
%>
<%page args="clock_id, evp, timerid"/>
<%docstring>
Invokes the syscall timer_create. See 'man 2 timer_create' for more information.
Arguments:
clock_id(clockid_t): clock_id
evp(sigevent): evp
timerid(timer_t): timerid
</%docstring>
${syscall('SYS_timer_create', clock_id, evp, timerid)}
|
; A108288: Main diagonal of table A060543; a(n) = C((n+1)^2-1, n*(n+1)).
; 1,3,28,455,10626,324632,12271512,553270671,28987537150,1731030945644,116068178638776,8634941152058949,705873715441872264,62895036884524942320,6067037854078498539696,629921975126394617164575
mov $1,$0
add $0,2
mul $0,$1
bin $0,$1
|
// Copyright 2014 BitPay Inc.
// Copyright (c) 2019 Bitcoin Association
// Copyright (c) 2020* Jimmy N. Lose
// * Gregorian calendar years
// Distributed under the Open BSV software license, see the accompanying file LICENSE.
#include <string.h>
#include <vector>
#include <stdio.h>
#include "univalue.h"
#include "univalue_utffilter.h"
static bool json_isdigit(int ch)
{
return ((ch >= '0') && (ch <= '9'));
}
// convert hexadecimal string to unsigned integer
static const char *hatoui(const char *first, const char *last,
unsigned int& out)
{
unsigned int result = 0;
for (; first != last; ++first)
{
int digit;
if (json_isdigit(*first))
digit = *first - '0';
else if (*first >= 'a' && *first <= 'f')
digit = *first - 'a' + 10;
else if (*first >= 'A' && *first <= 'F')
digit = *first - 'A' + 10;
else
break;
result = 16 * result + digit;
}
out = result;
return first;
}
enum jtokentype getJsonToken(std::string& tokenVal, unsigned int& consumed,
const char *raw, const char *end)
{
tokenVal.clear();
consumed = 0;
const char *rawStart = raw;
while (raw < end && (json_isspace(*raw))) // skip whitespace
raw++;
if (raw >= end)
return JTOK_NONE;
switch (*raw) {
case '{':
raw++;
consumed = (raw - rawStart);
return JTOK_OBJ_OPEN;
case '}':
raw++;
consumed = (raw - rawStart);
return JTOK_OBJ_CLOSE;
case '[':
raw++;
consumed = (raw - rawStart);
return JTOK_ARR_OPEN;
case ']':
raw++;
consumed = (raw - rawStart);
return JTOK_ARR_CLOSE;
case ':':
raw++;
consumed = (raw - rawStart);
return JTOK_COLON;
case ',':
raw++;
consumed = (raw - rawStart);
return JTOK_COMMA;
case 'n':
case 't':
case 'f':
if (!strncmp(raw, "null", 4)) {
raw += 4;
consumed = (raw - rawStart);
return JTOK_KW_NULL;
} else if (!strncmp(raw, "true", 4)) {
raw += 4;
consumed = (raw - rawStart);
return JTOK_KW_TRUE;
} else if (!strncmp(raw, "false", 5)) {
raw += 5;
consumed = (raw - rawStart);
return JTOK_KW_FALSE;
} else
return JTOK_ERR;
case '-':
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9': {
// part 1: int
std::string numStr;
const char *first = raw;
const char *firstDigit = first;
if (!json_isdigit(*firstDigit))
firstDigit++;
if ((*firstDigit == '0') && json_isdigit(firstDigit[1]))
return JTOK_ERR;
numStr += *raw; // copy first char
raw++;
if ((*first == '-') && (raw < end) && (!json_isdigit(*raw)))
return JTOK_ERR;
while (raw < end && json_isdigit(*raw)) { // copy digits
numStr += *raw;
raw++;
}
// part 2: frac
if (raw < end && *raw == '.') {
numStr += *raw; // copy .
raw++;
if (raw >= end || !json_isdigit(*raw))
return JTOK_ERR;
while (raw < end && json_isdigit(*raw)) { // copy digits
numStr += *raw;
raw++;
}
}
// part 3: exp
if (raw < end && (*raw == 'e' || *raw == 'E')) {
numStr += *raw; // copy E
raw++;
if (raw < end && (*raw == '-' || *raw == '+')) { // copy +/-
numStr += *raw;
raw++;
}
if (raw >= end || !json_isdigit(*raw))
return JTOK_ERR;
while (raw < end && json_isdigit(*raw)) { // copy digits
numStr += *raw;
raw++;
}
}
tokenVal = numStr;
consumed = (raw - rawStart);
return JTOK_NUMBER;
}
case '"': {
raw++; // skip "
std::string valStr;
JSONUTF8StringFilter writer(valStr);
while (true) {
if (raw >= end || (unsigned char)*raw < 0x20)
return JTOK_ERR;
else if (*raw == '\\') {
raw++; // skip backslash
if (raw >= end)
return JTOK_ERR;
switch (*raw) {
case '"': writer.push_back('\"'); break;
case '\\': writer.push_back('\\'); break;
case '/': writer.push_back('/'); break;
case 'b': writer.push_back('\b'); break;
case 'f': writer.push_back('\f'); break;
case 'n': writer.push_back('\n'); break;
case 'r': writer.push_back('\r'); break;
case 't': writer.push_back('\t'); break;
case 'u': {
unsigned int codepoint;
if (raw + 1 + 4 >= end ||
hatoui(raw + 1, raw + 1 + 4, codepoint) !=
raw + 1 + 4)
return JTOK_ERR;
writer.push_back_u(codepoint);
raw += 4;
break;
}
default:
return JTOK_ERR;
}
raw++; // skip esc'd char
}
else if (*raw == '"') {
raw++; // skip "
break; // stop scanning
}
else {
writer.push_back(*raw);
raw++;
}
}
if (!writer.finalize())
return JTOK_ERR;
tokenVal = valStr;
consumed = (raw - rawStart);
return JTOK_STRING;
}
default:
return JTOK_ERR;
}
}
enum expect_bits {
EXP_OBJ_NAME = (1U << 0),
EXP_COLON = (1U << 1),
EXP_ARR_VALUE = (1U << 2),
EXP_VALUE = (1U << 3),
EXP_NOT_VALUE = (1U << 4),
};
#define expect(bit) (expectMask & (EXP_##bit))
#define setExpect(bit) (expectMask |= EXP_##bit)
#define clearExpect(bit) (expectMask &= ~EXP_##bit)
bool UniValue::read(const char *raw, size_t size)
{
clear();
uint32_t expectMask = 0;
std::vector<UniValue*> stack;
std::string tokenVal;
unsigned int consumed;
enum jtokentype tok = JTOK_NONE;
enum jtokentype last_tok = JTOK_NONE;
const char* end = raw + size;
int ObjArrCounter (0);
do {
last_tok = tok;
tok = getJsonToken(tokenVal, consumed, raw, end);
if (tok == JTOK_NONE || tok == JTOK_ERR)
return false;
raw += consumed;
bool isValueOpen = jsonTokenIsValue(tok) ||
tok == JTOK_OBJ_OPEN || tok == JTOK_ARR_OPEN;
if (expect(VALUE)) {
if (!isValueOpen)
return false;
clearExpect(VALUE);
} else if (expect(ARR_VALUE)) {
bool isArrValue = isValueOpen || (tok == JTOK_ARR_CLOSE);
if (!isArrValue)
return false;
clearExpect(ARR_VALUE);
} else if (expect(OBJ_NAME)) {
bool isObjName = (tok == JTOK_OBJ_CLOSE || tok == JTOK_STRING);
if (!isObjName)
return false;
} else if (expect(COLON)) {
if (tok != JTOK_COLON)
return false;
clearExpect(COLON);
} else if (!expect(COLON) && (tok == JTOK_COLON)) {
return false;
}
if (expect(NOT_VALUE)) {
if (isValueOpen)
return false;
clearExpect(NOT_VALUE);
}
switch (tok) {
case JTOK_OBJ_OPEN:
case JTOK_ARR_OPEN: {
VType utyp = (tok == JTOK_OBJ_OPEN ? VOBJ : VARR);
if ( ObjArrCounter > m_JSONParseDepth ){
fprintf (stderr, "JSON NESTING DEPTH exceed %d > %d\n",ObjArrCounter,m_JSONParseDepth);
return false;
}
if (!stack.size()) {
if (utyp == VOBJ)
setObject();
else
setArray();
stack.push_back(this);
} else {
UniValue tmpVal(utyp);
UniValue *top = stack.back();
top->values.push_back(tmpVal);
UniValue *newTop = &(top->values.back());
stack.push_back(newTop);
}
if (utyp == VOBJ)
setExpect(OBJ_NAME);
else
setExpect(ARR_VALUE);
++ ObjArrCounter ;
break;
}
case JTOK_OBJ_CLOSE:
case JTOK_ARR_CLOSE: {
if (!stack.size() || (last_tok == JTOK_COMMA))
return false;
VType utyp = (tok == JTOK_OBJ_CLOSE ? VOBJ : VARR);
UniValue *top = stack.back();
if (utyp != top->getType())
return false;
stack.pop_back();
clearExpect(OBJ_NAME);
setExpect(NOT_VALUE);
--ObjArrCounter;
break;
}
case JTOK_COLON: {
if (!stack.size())
return false;
UniValue *top = stack.back();
if (top->getType() != VOBJ)
return false;
setExpect(VALUE);
break;
}
case JTOK_COMMA: {
if (!stack.size() ||
(last_tok == JTOK_COMMA) || (last_tok == JTOK_ARR_OPEN))
return false;
UniValue *top = stack.back();
if (top->getType() == VOBJ)
setExpect(OBJ_NAME);
else
setExpect(ARR_VALUE);
break;
}
case JTOK_KW_NULL:
case JTOK_KW_TRUE:
case JTOK_KW_FALSE: {
UniValue tmpVal;
switch (tok) {
case JTOK_KW_NULL:
// do nothing more
break;
case JTOK_KW_TRUE:
tmpVal.setBool(true);
break;
case JTOK_KW_FALSE:
tmpVal.setBool(false);
break;
default: /* impossible */ break;
}
if (!stack.size()) {
*this = tmpVal;
break;
}
UniValue *top = stack.back();
top->values.push_back(tmpVal);
setExpect(NOT_VALUE);
break;
}
case JTOK_NUMBER: {
UniValue tmpVal(VNUM, tokenVal);
if (!stack.size()) {
*this = tmpVal;
break;
}
UniValue *top = stack.back();
top->values.push_back(tmpVal);
setExpect(NOT_VALUE);
break;
}
case JTOK_STRING: {
if (expect(OBJ_NAME)) {
UniValue *top = stack.back();
top->keys.push_back(tokenVal);
clearExpect(OBJ_NAME);
setExpect(COLON);
} else {
UniValue tmpVal(VSTR, tokenVal);
if (!stack.size()) {
*this = tmpVal;
break;
}
UniValue *top = stack.back();
top->values.push_back(tmpVal);
}
setExpect(NOT_VALUE);
break;
}
default:
return false;
}
} while (!stack.empty ());
/* Check that nothing follows the initial construct (parsed above). */
tok = getJsonToken(tokenVal, consumed, raw, end);
if (tok != JTOK_NONE)
return false;
return true;
}
|
; DO NOT MODIFY THIS FILE DIRECTLY!
; author: @TinySecEx
; ssdt asm stub for 6.0.6001-sp1-windows-vista amd64
option casemap:none
option prologue:none
option epilogue:none
.code
; ULONG64 __stdcall NtMapUserPhysicalPagesScatter( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtMapUserPhysicalPagesScatter PROC STDCALL
mov r10 , rcx
mov eax , 0
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtMapUserPhysicalPagesScatter ENDP
; ULONG64 __stdcall NtWaitForSingleObject( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtWaitForSingleObject PROC STDCALL
mov r10 , rcx
mov eax , 1
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtWaitForSingleObject ENDP
; ULONG64 __stdcall NtCallbackReturn( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtCallbackReturn PROC STDCALL
mov r10 , rcx
mov eax , 2
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCallbackReturn ENDP
; ULONG64 __stdcall NtReadFile( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 );
_6_0_6001_sp1_windows_vista_NtReadFile PROC STDCALL
mov r10 , rcx
mov eax , 3
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtReadFile ENDP
; ULONG64 __stdcall NtDeviceIoControlFile( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 , ULONG64 arg_10 );
_6_0_6001_sp1_windows_vista_NtDeviceIoControlFile PROC STDCALL
mov r10 , rcx
mov eax , 4
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtDeviceIoControlFile ENDP
; ULONG64 __stdcall NtWriteFile( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 );
_6_0_6001_sp1_windows_vista_NtWriteFile PROC STDCALL
mov r10 , rcx
mov eax , 5
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtWriteFile ENDP
; ULONG64 __stdcall NtRemoveIoCompletion( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtRemoveIoCompletion PROC STDCALL
mov r10 , rcx
mov eax , 6
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtRemoveIoCompletion ENDP
; ULONG64 __stdcall NtReleaseSemaphore( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtReleaseSemaphore PROC STDCALL
mov r10 , rcx
mov eax , 7
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtReleaseSemaphore ENDP
; ULONG64 __stdcall NtReplyWaitReceivePort( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtReplyWaitReceivePort PROC STDCALL
mov r10 , rcx
mov eax , 8
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtReplyWaitReceivePort ENDP
; ULONG64 __stdcall NtReplyPort( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtReplyPort PROC STDCALL
mov r10 , rcx
mov eax , 9
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtReplyPort ENDP
; ULONG64 __stdcall NtSetInformationThread( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtSetInformationThread PROC STDCALL
mov r10 , rcx
mov eax , 10
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetInformationThread ENDP
; ULONG64 __stdcall NtSetEvent( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtSetEvent PROC STDCALL
mov r10 , rcx
mov eax , 11
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetEvent ENDP
; ULONG64 __stdcall NtClose( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtClose PROC STDCALL
mov r10 , rcx
mov eax , 12
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtClose ENDP
; ULONG64 __stdcall NtQueryObject( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtQueryObject PROC STDCALL
mov r10 , rcx
mov eax , 13
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryObject ENDP
; ULONG64 __stdcall NtQueryInformationFile( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtQueryInformationFile PROC STDCALL
mov r10 , rcx
mov eax , 14
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryInformationFile ENDP
; ULONG64 __stdcall NtOpenKey( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtOpenKey PROC STDCALL
mov r10 , rcx
mov eax , 15
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtOpenKey ENDP
; ULONG64 __stdcall NtEnumerateValueKey( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 );
_6_0_6001_sp1_windows_vista_NtEnumerateValueKey PROC STDCALL
mov r10 , rcx
mov eax , 16
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtEnumerateValueKey ENDP
; ULONG64 __stdcall NtFindAtom( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtFindAtom PROC STDCALL
mov r10 , rcx
mov eax , 17
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtFindAtom ENDP
; ULONG64 __stdcall NtQueryDefaultLocale( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtQueryDefaultLocale PROC STDCALL
mov r10 , rcx
mov eax , 18
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryDefaultLocale ENDP
; ULONG64 __stdcall NtQueryKey( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtQueryKey PROC STDCALL
mov r10 , rcx
mov eax , 19
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryKey ENDP
; ULONG64 __stdcall NtQueryValueKey( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 );
_6_0_6001_sp1_windows_vista_NtQueryValueKey PROC STDCALL
mov r10 , rcx
mov eax , 20
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryValueKey ENDP
; ULONG64 __stdcall NtAllocateVirtualMemory( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 );
_6_0_6001_sp1_windows_vista_NtAllocateVirtualMemory PROC STDCALL
mov r10 , rcx
mov eax , 21
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAllocateVirtualMemory ENDP
; ULONG64 __stdcall NtQueryInformationProcess( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtQueryInformationProcess PROC STDCALL
mov r10 , rcx
mov eax , 22
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryInformationProcess ENDP
; ULONG64 __stdcall NtWaitForMultipleObjects32( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtWaitForMultipleObjects32 PROC STDCALL
mov r10 , rcx
mov eax , 23
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtWaitForMultipleObjects32 ENDP
; ULONG64 __stdcall NtWriteFileGather( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 );
_6_0_6001_sp1_windows_vista_NtWriteFileGather PROC STDCALL
mov r10 , rcx
mov eax , 24
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtWriteFileGather ENDP
; ULONG64 __stdcall NtSetInformationProcess( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtSetInformationProcess PROC STDCALL
mov r10 , rcx
mov eax , 25
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetInformationProcess ENDP
; ULONG64 __stdcall NtCreateKey( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 );
_6_0_6001_sp1_windows_vista_NtCreateKey PROC STDCALL
mov r10 , rcx
mov eax , 26
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateKey ENDP
; ULONG64 __stdcall NtFreeVirtualMemory( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtFreeVirtualMemory PROC STDCALL
mov r10 , rcx
mov eax , 27
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtFreeVirtualMemory ENDP
; ULONG64 __stdcall NtImpersonateClientOfPort( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtImpersonateClientOfPort PROC STDCALL
mov r10 , rcx
mov eax , 28
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtImpersonateClientOfPort ENDP
; ULONG64 __stdcall NtReleaseMutant( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtReleaseMutant PROC STDCALL
mov r10 , rcx
mov eax , 29
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtReleaseMutant ENDP
; ULONG64 __stdcall NtQueryInformationToken( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtQueryInformationToken PROC STDCALL
mov r10 , rcx
mov eax , 30
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryInformationToken ENDP
; ULONG64 __stdcall NtRequestWaitReplyPort( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtRequestWaitReplyPort PROC STDCALL
mov r10 , rcx
mov eax , 31
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtRequestWaitReplyPort ENDP
; ULONG64 __stdcall NtQueryVirtualMemory( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 );
_6_0_6001_sp1_windows_vista_NtQueryVirtualMemory PROC STDCALL
mov r10 , rcx
mov eax , 32
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryVirtualMemory ENDP
; ULONG64 __stdcall NtOpenThreadToken( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtOpenThreadToken PROC STDCALL
mov r10 , rcx
mov eax , 33
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtOpenThreadToken ENDP
; ULONG64 __stdcall NtQueryInformationThread( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtQueryInformationThread PROC STDCALL
mov r10 , rcx
mov eax , 34
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryInformationThread ENDP
; ULONG64 __stdcall NtOpenProcess( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtOpenProcess PROC STDCALL
mov r10 , rcx
mov eax , 35
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtOpenProcess ENDP
; ULONG64 __stdcall NtSetInformationFile( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtSetInformationFile PROC STDCALL
mov r10 , rcx
mov eax , 36
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetInformationFile ENDP
; ULONG64 __stdcall NtMapViewOfSection( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 , ULONG64 arg_10 );
_6_0_6001_sp1_windows_vista_NtMapViewOfSection PROC STDCALL
mov r10 , rcx
mov eax , 37
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtMapViewOfSection ENDP
; ULONG64 __stdcall NtAccessCheckAndAuditAlarm( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 , ULONG64 arg_10 , ULONG64 arg_11 );
_6_0_6001_sp1_windows_vista_NtAccessCheckAndAuditAlarm PROC STDCALL
mov r10 , rcx
mov eax , 38
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAccessCheckAndAuditAlarm ENDP
; ULONG64 __stdcall NtUnmapViewOfSection( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtUnmapViewOfSection PROC STDCALL
mov r10 , rcx
mov eax , 39
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtUnmapViewOfSection ENDP
; ULONG64 __stdcall NtReplyWaitReceivePortEx( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtReplyWaitReceivePortEx PROC STDCALL
mov r10 , rcx
mov eax , 40
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtReplyWaitReceivePortEx ENDP
; ULONG64 __stdcall NtTerminateProcess( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtTerminateProcess PROC STDCALL
mov r10 , rcx
mov eax , 41
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtTerminateProcess ENDP
; ULONG64 __stdcall NtSetEventBoostPriority( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtSetEventBoostPriority PROC STDCALL
mov r10 , rcx
mov eax , 42
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetEventBoostPriority ENDP
; ULONG64 __stdcall NtReadFileScatter( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 );
_6_0_6001_sp1_windows_vista_NtReadFileScatter PROC STDCALL
mov r10 , rcx
mov eax , 43
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtReadFileScatter ENDP
; ULONG64 __stdcall NtOpenThreadTokenEx( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtOpenThreadTokenEx PROC STDCALL
mov r10 , rcx
mov eax , 44
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtOpenThreadTokenEx ENDP
; ULONG64 __stdcall NtOpenProcessTokenEx( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtOpenProcessTokenEx PROC STDCALL
mov r10 , rcx
mov eax , 45
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtOpenProcessTokenEx ENDP
; ULONG64 __stdcall NtQueryPerformanceCounter( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtQueryPerformanceCounter PROC STDCALL
mov r10 , rcx
mov eax , 46
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryPerformanceCounter ENDP
; ULONG64 __stdcall NtEnumerateKey( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 );
_6_0_6001_sp1_windows_vista_NtEnumerateKey PROC STDCALL
mov r10 , rcx
mov eax , 47
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtEnumerateKey ENDP
; ULONG64 __stdcall NtOpenFile( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 );
_6_0_6001_sp1_windows_vista_NtOpenFile PROC STDCALL
mov r10 , rcx
mov eax , 48
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtOpenFile ENDP
; ULONG64 __stdcall NtDelayExecution( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtDelayExecution PROC STDCALL
mov r10 , rcx
mov eax , 49
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtDelayExecution ENDP
; ULONG64 __stdcall NtQueryDirectoryFile( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 , ULONG64 arg_10 , ULONG64 arg_11 );
_6_0_6001_sp1_windows_vista_NtQueryDirectoryFile PROC STDCALL
mov r10 , rcx
mov eax , 50
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryDirectoryFile ENDP
; ULONG64 __stdcall NtQuerySystemInformation( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtQuerySystemInformation PROC STDCALL
mov r10 , rcx
mov eax , 51
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQuerySystemInformation ENDP
; ULONG64 __stdcall NtOpenSection( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtOpenSection PROC STDCALL
mov r10 , rcx
mov eax , 52
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtOpenSection ENDP
; ULONG64 __stdcall NtQueryTimer( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtQueryTimer PROC STDCALL
mov r10 , rcx
mov eax , 53
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryTimer ENDP
; ULONG64 __stdcall NtFsControlFile( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 , ULONG64 arg_10 );
_6_0_6001_sp1_windows_vista_NtFsControlFile PROC STDCALL
mov r10 , rcx
mov eax , 54
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtFsControlFile ENDP
; ULONG64 __stdcall NtWriteVirtualMemory( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtWriteVirtualMemory PROC STDCALL
mov r10 , rcx
mov eax , 55
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtWriteVirtualMemory ENDP
; ULONG64 __stdcall NtCloseObjectAuditAlarm( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtCloseObjectAuditAlarm PROC STDCALL
mov r10 , rcx
mov eax , 56
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCloseObjectAuditAlarm ENDP
; ULONG64 __stdcall NtDuplicateObject( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 );
_6_0_6001_sp1_windows_vista_NtDuplicateObject PROC STDCALL
mov r10 , rcx
mov eax , 57
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtDuplicateObject ENDP
; ULONG64 __stdcall NtQueryAttributesFile( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtQueryAttributesFile PROC STDCALL
mov r10 , rcx
mov eax , 58
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryAttributesFile ENDP
; ULONG64 __stdcall NtClearEvent( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtClearEvent PROC STDCALL
mov r10 , rcx
mov eax , 59
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtClearEvent ENDP
; ULONG64 __stdcall NtReadVirtualMemory( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtReadVirtualMemory PROC STDCALL
mov r10 , rcx
mov eax , 60
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtReadVirtualMemory ENDP
; ULONG64 __stdcall NtOpenEvent( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtOpenEvent PROC STDCALL
mov r10 , rcx
mov eax , 61
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtOpenEvent ENDP
; ULONG64 __stdcall NtAdjustPrivilegesToken( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 );
_6_0_6001_sp1_windows_vista_NtAdjustPrivilegesToken PROC STDCALL
mov r10 , rcx
mov eax , 62
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAdjustPrivilegesToken ENDP
; ULONG64 __stdcall NtDuplicateToken( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 );
_6_0_6001_sp1_windows_vista_NtDuplicateToken PROC STDCALL
mov r10 , rcx
mov eax , 63
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtDuplicateToken ENDP
; ULONG64 __stdcall NtContinue( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtContinue PROC STDCALL
mov r10 , rcx
mov eax , 64
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtContinue ENDP
; ULONG64 __stdcall NtQueryDefaultUILanguage( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtQueryDefaultUILanguage PROC STDCALL
mov r10 , rcx
mov eax , 65
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryDefaultUILanguage ENDP
; ULONG64 __stdcall NtQueueApcThread( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtQueueApcThread PROC STDCALL
mov r10 , rcx
mov eax , 66
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueueApcThread ENDP
; ULONG64 __stdcall NtYieldExecution( );
_6_0_6001_sp1_windows_vista_NtYieldExecution PROC STDCALL
mov r10 , rcx
mov eax , 67
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtYieldExecution ENDP
; ULONG64 __stdcall NtAddAtom( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtAddAtom PROC STDCALL
mov r10 , rcx
mov eax , 68
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAddAtom ENDP
; ULONG64 __stdcall NtCreateEvent( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtCreateEvent PROC STDCALL
mov r10 , rcx
mov eax , 69
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateEvent ENDP
; ULONG64 __stdcall NtQueryVolumeInformationFile( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtQueryVolumeInformationFile PROC STDCALL
mov r10 , rcx
mov eax , 70
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryVolumeInformationFile ENDP
; ULONG64 __stdcall NtCreateSection( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 );
_6_0_6001_sp1_windows_vista_NtCreateSection PROC STDCALL
mov r10 , rcx
mov eax , 71
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateSection ENDP
; ULONG64 __stdcall NtFlushBuffersFile( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtFlushBuffersFile PROC STDCALL
mov r10 , rcx
mov eax , 72
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtFlushBuffersFile ENDP
; ULONG64 __stdcall NtApphelpCacheControl( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtApphelpCacheControl PROC STDCALL
mov r10 , rcx
mov eax , 73
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtApphelpCacheControl ENDP
; ULONG64 __stdcall NtCreateProcessEx( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 );
_6_0_6001_sp1_windows_vista_NtCreateProcessEx PROC STDCALL
mov r10 , rcx
mov eax , 74
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateProcessEx ENDP
; ULONG64 __stdcall NtCreateThread( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 );
_6_0_6001_sp1_windows_vista_NtCreateThread PROC STDCALL
mov r10 , rcx
mov eax , 75
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateThread ENDP
; ULONG64 __stdcall NtIsProcessInJob( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtIsProcessInJob PROC STDCALL
mov r10 , rcx
mov eax , 76
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtIsProcessInJob ENDP
; ULONG64 __stdcall NtProtectVirtualMemory( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtProtectVirtualMemory PROC STDCALL
mov r10 , rcx
mov eax , 77
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtProtectVirtualMemory ENDP
; ULONG64 __stdcall NtQuerySection( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtQuerySection PROC STDCALL
mov r10 , rcx
mov eax , 78
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQuerySection ENDP
; ULONG64 __stdcall NtResumeThread( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtResumeThread PROC STDCALL
mov r10 , rcx
mov eax , 79
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtResumeThread ENDP
; ULONG64 __stdcall NtTerminateThread( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtTerminateThread PROC STDCALL
mov r10 , rcx
mov eax , 80
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtTerminateThread ENDP
; ULONG64 __stdcall NtReadRequestData( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 );
_6_0_6001_sp1_windows_vista_NtReadRequestData PROC STDCALL
mov r10 , rcx
mov eax , 81
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtReadRequestData ENDP
; ULONG64 __stdcall NtCreateFile( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 , ULONG64 arg_10 , ULONG64 arg_11 );
_6_0_6001_sp1_windows_vista_NtCreateFile PROC STDCALL
mov r10 , rcx
mov eax , 82
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateFile ENDP
; ULONG64 __stdcall NtQueryEvent( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtQueryEvent PROC STDCALL
mov r10 , rcx
mov eax , 83
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryEvent ENDP
; ULONG64 __stdcall NtWriteRequestData( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 );
_6_0_6001_sp1_windows_vista_NtWriteRequestData PROC STDCALL
mov r10 , rcx
mov eax , 84
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtWriteRequestData ENDP
; ULONG64 __stdcall NtOpenDirectoryObject( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtOpenDirectoryObject PROC STDCALL
mov r10 , rcx
mov eax , 85
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtOpenDirectoryObject ENDP
; ULONG64 __stdcall NtAccessCheckByTypeAndAuditAlarm( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 , ULONG64 arg_10 , ULONG64 arg_11 , ULONG64 arg_12 , ULONG64 arg_13 , ULONG64 arg_14 , ULONG64 arg_15 , ULONG64 arg_16 );
_6_0_6001_sp1_windows_vista_NtAccessCheckByTypeAndAuditAlarm PROC STDCALL
mov r10 , rcx
mov eax , 86
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAccessCheckByTypeAndAuditAlarm ENDP
; ULONG64 __stdcall NtQuerySystemTime( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtQuerySystemTime PROC STDCALL
mov r10 , rcx
mov eax , 87
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQuerySystemTime ENDP
; ULONG64 __stdcall NtWaitForMultipleObjects( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtWaitForMultipleObjects PROC STDCALL
mov r10 , rcx
mov eax , 88
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtWaitForMultipleObjects ENDP
; ULONG64 __stdcall NtSetInformationObject( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtSetInformationObject PROC STDCALL
mov r10 , rcx
mov eax , 89
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetInformationObject ENDP
; ULONG64 __stdcall NtCancelIoFile( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtCancelIoFile PROC STDCALL
mov r10 , rcx
mov eax , 90
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCancelIoFile ENDP
; ULONG64 __stdcall NtTraceEvent( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtTraceEvent PROC STDCALL
mov r10 , rcx
mov eax , 91
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtTraceEvent ENDP
; ULONG64 __stdcall NtPowerInformation( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtPowerInformation PROC STDCALL
mov r10 , rcx
mov eax , 92
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtPowerInformation ENDP
; ULONG64 __stdcall NtSetValueKey( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 );
_6_0_6001_sp1_windows_vista_NtSetValueKey PROC STDCALL
mov r10 , rcx
mov eax , 93
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetValueKey ENDP
; ULONG64 __stdcall NtCancelTimer( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtCancelTimer PROC STDCALL
mov r10 , rcx
mov eax , 94
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCancelTimer ENDP
; ULONG64 __stdcall NtSetTimer( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 );
_6_0_6001_sp1_windows_vista_NtSetTimer PROC STDCALL
mov r10 , rcx
mov eax , 95
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetTimer ENDP
; ULONG64 __stdcall NtAcceptConnectPort( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 );
_6_0_6001_sp1_windows_vista_NtAcceptConnectPort PROC STDCALL
mov r10 , rcx
mov eax , 96
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAcceptConnectPort ENDP
; ULONG64 __stdcall NtAccessCheck( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 );
_6_0_6001_sp1_windows_vista_NtAccessCheck PROC STDCALL
mov r10 , rcx
mov eax , 97
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAccessCheck ENDP
; ULONG64 __stdcall NtAccessCheckByType( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 , ULONG64 arg_10 , ULONG64 arg_11 );
_6_0_6001_sp1_windows_vista_NtAccessCheckByType PROC STDCALL
mov r10 , rcx
mov eax , 98
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAccessCheckByType ENDP
; ULONG64 __stdcall NtAccessCheckByTypeResultList( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 , ULONG64 arg_10 , ULONG64 arg_11 );
_6_0_6001_sp1_windows_vista_NtAccessCheckByTypeResultList PROC STDCALL
mov r10 , rcx
mov eax , 99
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAccessCheckByTypeResultList ENDP
; ULONG64 __stdcall NtAccessCheckByTypeResultListAndAuditAlarm( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 , ULONG64 arg_10 , ULONG64 arg_11 , ULONG64 arg_12 , ULONG64 arg_13 , ULONG64 arg_14 , ULONG64 arg_15 , ULONG64 arg_16 );
_6_0_6001_sp1_windows_vista_NtAccessCheckByTypeResultListAndAuditAlarm PROC STDCALL
mov r10 , rcx
mov eax , 100
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAccessCheckByTypeResultListAndAuditAlarm ENDP
; ULONG64 __stdcall NtAccessCheckByTypeResultListAndAuditAlarmByHandle( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 , ULONG64 arg_10 , ULONG64 arg_11 , ULONG64 arg_12 , ULONG64 arg_13 , ULONG64 arg_14 , ULONG64 arg_15 , ULONG64 arg_16 , ULONG64 arg_17 );
_6_0_6001_sp1_windows_vista_NtAccessCheckByTypeResultListAndAuditAlarmByHandle PROC STDCALL
mov r10 , rcx
mov eax , 101
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAccessCheckByTypeResultListAndAuditAlarmByHandle ENDP
; ULONG64 __stdcall NtAcquireCMFViewOwnership( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtAcquireCMFViewOwnership PROC STDCALL
mov r10 , rcx
mov eax , 102
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAcquireCMFViewOwnership ENDP
; ULONG64 __stdcall NtAddBootEntry( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtAddBootEntry PROC STDCALL
mov r10 , rcx
mov eax , 103
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAddBootEntry ENDP
; ULONG64 __stdcall NtAddDriverEntry( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtAddDriverEntry PROC STDCALL
mov r10 , rcx
mov eax , 104
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAddDriverEntry ENDP
; ULONG64 __stdcall NtAdjustGroupsToken( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 );
_6_0_6001_sp1_windows_vista_NtAdjustGroupsToken PROC STDCALL
mov r10 , rcx
mov eax , 105
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAdjustGroupsToken ENDP
; ULONG64 __stdcall NtAlertResumeThread( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtAlertResumeThread PROC STDCALL
mov r10 , rcx
mov eax , 106
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAlertResumeThread ENDP
; ULONG64 __stdcall NtAlertThread( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtAlertThread PROC STDCALL
mov r10 , rcx
mov eax , 107
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAlertThread ENDP
; ULONG64 __stdcall NtAllocateLocallyUniqueId( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtAllocateLocallyUniqueId PROC STDCALL
mov r10 , rcx
mov eax , 108
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAllocateLocallyUniqueId ENDP
; ULONG64 __stdcall NtAllocateUserPhysicalPages( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtAllocateUserPhysicalPages PROC STDCALL
mov r10 , rcx
mov eax , 109
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAllocateUserPhysicalPages ENDP
; ULONG64 __stdcall NtAllocateUuids( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtAllocateUuids PROC STDCALL
mov r10 , rcx
mov eax , 110
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAllocateUuids ENDP
; ULONG64 __stdcall NtAlpcAcceptConnectPort( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 );
_6_0_6001_sp1_windows_vista_NtAlpcAcceptConnectPort PROC STDCALL
mov r10 , rcx
mov eax , 111
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAlpcAcceptConnectPort ENDP
; ULONG64 __stdcall NtAlpcCancelMessage( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtAlpcCancelMessage PROC STDCALL
mov r10 , rcx
mov eax , 112
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAlpcCancelMessage ENDP
; ULONG64 __stdcall NtAlpcConnectPort( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 , ULONG64 arg_10 , ULONG64 arg_11 );
_6_0_6001_sp1_windows_vista_NtAlpcConnectPort PROC STDCALL
mov r10 , rcx
mov eax , 113
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAlpcConnectPort ENDP
; ULONG64 __stdcall NtAlpcCreatePort( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtAlpcCreatePort PROC STDCALL
mov r10 , rcx
mov eax , 114
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAlpcCreatePort ENDP
; ULONG64 __stdcall NtAlpcCreatePortSection( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 );
_6_0_6001_sp1_windows_vista_NtAlpcCreatePortSection PROC STDCALL
mov r10 , rcx
mov eax , 115
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAlpcCreatePortSection ENDP
; ULONG64 __stdcall NtAlpcCreateResourceReserve( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtAlpcCreateResourceReserve PROC STDCALL
mov r10 , rcx
mov eax , 116
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAlpcCreateResourceReserve ENDP
; ULONG64 __stdcall NtAlpcCreateSectionView( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtAlpcCreateSectionView PROC STDCALL
mov r10 , rcx
mov eax , 117
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAlpcCreateSectionView ENDP
; ULONG64 __stdcall NtAlpcCreateSecurityContext( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtAlpcCreateSecurityContext PROC STDCALL
mov r10 , rcx
mov eax , 118
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAlpcCreateSecurityContext ENDP
; ULONG64 __stdcall NtAlpcDeletePortSection( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtAlpcDeletePortSection PROC STDCALL
mov r10 , rcx
mov eax , 119
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAlpcDeletePortSection ENDP
; ULONG64 __stdcall NtAlpcDeleteResourceReserve( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtAlpcDeleteResourceReserve PROC STDCALL
mov r10 , rcx
mov eax , 120
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAlpcDeleteResourceReserve ENDP
; ULONG64 __stdcall NtAlpcDeleteSectionView( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtAlpcDeleteSectionView PROC STDCALL
mov r10 , rcx
mov eax , 121
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAlpcDeleteSectionView ENDP
; ULONG64 __stdcall NtAlpcDeleteSecurityContext( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtAlpcDeleteSecurityContext PROC STDCALL
mov r10 , rcx
mov eax , 122
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAlpcDeleteSecurityContext ENDP
; ULONG64 __stdcall NtAlpcDisconnectPort( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtAlpcDisconnectPort PROC STDCALL
mov r10 , rcx
mov eax , 123
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAlpcDisconnectPort ENDP
; ULONG64 __stdcall NtAlpcImpersonateClientOfPort( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtAlpcImpersonateClientOfPort PROC STDCALL
mov r10 , rcx
mov eax , 124
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAlpcImpersonateClientOfPort ENDP
; ULONG64 __stdcall NtAlpcOpenSenderProcess( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 );
_6_0_6001_sp1_windows_vista_NtAlpcOpenSenderProcess PROC STDCALL
mov r10 , rcx
mov eax , 125
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAlpcOpenSenderProcess ENDP
; ULONG64 __stdcall NtAlpcOpenSenderThread( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 );
_6_0_6001_sp1_windows_vista_NtAlpcOpenSenderThread PROC STDCALL
mov r10 , rcx
mov eax , 126
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAlpcOpenSenderThread ENDP
; ULONG64 __stdcall NtAlpcQueryInformation( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtAlpcQueryInformation PROC STDCALL
mov r10 , rcx
mov eax , 127
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAlpcQueryInformation ENDP
; ULONG64 __stdcall NtAlpcQueryInformationMessage( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 );
_6_0_6001_sp1_windows_vista_NtAlpcQueryInformationMessage PROC STDCALL
mov r10 , rcx
mov eax , 128
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAlpcQueryInformationMessage ENDP
; ULONG64 __stdcall NtAlpcRevokeSecurityContext( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtAlpcRevokeSecurityContext PROC STDCALL
mov r10 , rcx
mov eax , 129
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAlpcRevokeSecurityContext ENDP
; ULONG64 __stdcall NtAlpcSendWaitReceivePort( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 );
_6_0_6001_sp1_windows_vista_NtAlpcSendWaitReceivePort PROC STDCALL
mov r10 , rcx
mov eax , 130
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAlpcSendWaitReceivePort ENDP
; ULONG64 __stdcall NtAlpcSetInformation( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtAlpcSetInformation PROC STDCALL
mov r10 , rcx
mov eax , 131
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAlpcSetInformation ENDP
; ULONG64 __stdcall NtAreMappedFilesTheSame( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtAreMappedFilesTheSame PROC STDCALL
mov r10 , rcx
mov eax , 132
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAreMappedFilesTheSame ENDP
; ULONG64 __stdcall NtAssignProcessToJobObject( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtAssignProcessToJobObject PROC STDCALL
mov r10 , rcx
mov eax , 133
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtAssignProcessToJobObject ENDP
; ULONG64 __stdcall NtCancelDeviceWakeupRequest( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtCancelDeviceWakeupRequest PROC STDCALL
mov r10 , rcx
mov eax , 134
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCancelDeviceWakeupRequest ENDP
; ULONG64 __stdcall NtCancelIoFileEx( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtCancelIoFileEx PROC STDCALL
mov r10 , rcx
mov eax , 135
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCancelIoFileEx ENDP
; ULONG64 __stdcall NtCancelSynchronousIoFile( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtCancelSynchronousIoFile PROC STDCALL
mov r10 , rcx
mov eax , 136
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCancelSynchronousIoFile ENDP
; ULONG64 __stdcall NtCommitComplete( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtCommitComplete PROC STDCALL
mov r10 , rcx
mov eax , 137
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCommitComplete ENDP
; ULONG64 __stdcall NtCommitEnlistment( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtCommitEnlistment PROC STDCALL
mov r10 , rcx
mov eax , 138
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCommitEnlistment ENDP
; ULONG64 __stdcall NtCommitTransaction( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtCommitTransaction PROC STDCALL
mov r10 , rcx
mov eax , 139
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCommitTransaction ENDP
; ULONG64 __stdcall NtCompactKeys( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtCompactKeys PROC STDCALL
mov r10 , rcx
mov eax , 140
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCompactKeys ENDP
; ULONG64 __stdcall NtCompareTokens( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtCompareTokens PROC STDCALL
mov r10 , rcx
mov eax , 141
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCompareTokens ENDP
; ULONG64 __stdcall NtCompleteConnectPort( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtCompleteConnectPort PROC STDCALL
mov r10 , rcx
mov eax , 142
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCompleteConnectPort ENDP
; ULONG64 __stdcall NtCompressKey( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtCompressKey PROC STDCALL
mov r10 , rcx
mov eax , 143
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCompressKey ENDP
; ULONG64 __stdcall NtConnectPort( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 );
_6_0_6001_sp1_windows_vista_NtConnectPort PROC STDCALL
mov r10 , rcx
mov eax , 144
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtConnectPort ENDP
; ULONG64 __stdcall NtCreateDebugObject( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtCreateDebugObject PROC STDCALL
mov r10 , rcx
mov eax , 145
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateDebugObject ENDP
; ULONG64 __stdcall NtCreateDirectoryObject( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtCreateDirectoryObject PROC STDCALL
mov r10 , rcx
mov eax , 146
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateDirectoryObject ENDP
; ULONG64 __stdcall NtCreateEnlistment( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 );
_6_0_6001_sp1_windows_vista_NtCreateEnlistment PROC STDCALL
mov r10 , rcx
mov eax , 147
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateEnlistment ENDP
; ULONG64 __stdcall NtCreateEventPair( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtCreateEventPair PROC STDCALL
mov r10 , rcx
mov eax , 148
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateEventPair ENDP
; ULONG64 __stdcall NtCreateIoCompletion( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtCreateIoCompletion PROC STDCALL
mov r10 , rcx
mov eax , 149
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateIoCompletion ENDP
; ULONG64 __stdcall NtCreateJobObject( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtCreateJobObject PROC STDCALL
mov r10 , rcx
mov eax , 150
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateJobObject ENDP
; ULONG64 __stdcall NtCreateJobSet( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtCreateJobSet PROC STDCALL
mov r10 , rcx
mov eax , 151
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateJobSet ENDP
; ULONG64 __stdcall NtCreateKeyTransacted( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 );
_6_0_6001_sp1_windows_vista_NtCreateKeyTransacted PROC STDCALL
mov r10 , rcx
mov eax , 152
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateKeyTransacted ENDP
; ULONG64 __stdcall NtCreateKeyedEvent( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtCreateKeyedEvent PROC STDCALL
mov r10 , rcx
mov eax , 153
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateKeyedEvent ENDP
; ULONG64 __stdcall NtCreateMailslotFile( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 );
_6_0_6001_sp1_windows_vista_NtCreateMailslotFile PROC STDCALL
mov r10 , rcx
mov eax , 154
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateMailslotFile ENDP
; ULONG64 __stdcall NtCreateMutant( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtCreateMutant PROC STDCALL
mov r10 , rcx
mov eax , 155
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateMutant ENDP
; ULONG64 __stdcall NtCreateNamedPipeFile( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 , ULONG64 arg_10 , ULONG64 arg_11 , ULONG64 arg_12 , ULONG64 arg_13 , ULONG64 arg_14 );
_6_0_6001_sp1_windows_vista_NtCreateNamedPipeFile PROC STDCALL
mov r10 , rcx
mov eax , 156
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateNamedPipeFile ENDP
; ULONG64 __stdcall NtCreatePagingFile( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtCreatePagingFile PROC STDCALL
mov r10 , rcx
mov eax , 157
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreatePagingFile ENDP
; ULONG64 __stdcall NtCreatePort( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtCreatePort PROC STDCALL
mov r10 , rcx
mov eax , 158
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreatePort ENDP
; ULONG64 __stdcall NtCreatePrivateNamespace( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtCreatePrivateNamespace PROC STDCALL
mov r10 , rcx
mov eax , 159
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreatePrivateNamespace ENDP
; ULONG64 __stdcall NtCreateProcess( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 );
_6_0_6001_sp1_windows_vista_NtCreateProcess PROC STDCALL
mov r10 , rcx
mov eax , 160
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateProcess ENDP
; ULONG64 __stdcall NtCreateProfile( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 );
_6_0_6001_sp1_windows_vista_NtCreateProfile PROC STDCALL
mov r10 , rcx
mov eax , 161
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateProfile ENDP
; ULONG64 __stdcall NtCreateResourceManager( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 );
_6_0_6001_sp1_windows_vista_NtCreateResourceManager PROC STDCALL
mov r10 , rcx
mov eax , 162
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateResourceManager ENDP
; ULONG64 __stdcall NtCreateSemaphore( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtCreateSemaphore PROC STDCALL
mov r10 , rcx
mov eax , 163
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateSemaphore ENDP
; ULONG64 __stdcall NtCreateSymbolicLinkObject( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtCreateSymbolicLinkObject PROC STDCALL
mov r10 , rcx
mov eax , 164
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateSymbolicLinkObject ENDP
; ULONG64 __stdcall NtCreateThreadEx( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 , ULONG64 arg_10 , ULONG64 arg_11 );
_6_0_6001_sp1_windows_vista_NtCreateThreadEx PROC STDCALL
mov r10 , rcx
mov eax , 165
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateThreadEx ENDP
; ULONG64 __stdcall NtCreateTimer( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtCreateTimer PROC STDCALL
mov r10 , rcx
mov eax , 166
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateTimer ENDP
; ULONG64 __stdcall NtCreateToken( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 , ULONG64 arg_10 , ULONG64 arg_11 , ULONG64 arg_12 , ULONG64 arg_13 );
_6_0_6001_sp1_windows_vista_NtCreateToken PROC STDCALL
mov r10 , rcx
mov eax , 167
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateToken ENDP
; ULONG64 __stdcall NtCreateTransaction( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 , ULONG64 arg_10 );
_6_0_6001_sp1_windows_vista_NtCreateTransaction PROC STDCALL
mov r10 , rcx
mov eax , 168
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateTransaction ENDP
; ULONG64 __stdcall NtCreateTransactionManager( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 );
_6_0_6001_sp1_windows_vista_NtCreateTransactionManager PROC STDCALL
mov r10 , rcx
mov eax , 169
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateTransactionManager ENDP
; ULONG64 __stdcall NtCreateUserProcess( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 , ULONG64 arg_10 , ULONG64 arg_11 );
_6_0_6001_sp1_windows_vista_NtCreateUserProcess PROC STDCALL
mov r10 , rcx
mov eax , 170
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateUserProcess ENDP
; ULONG64 __stdcall NtCreateWaitablePort( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtCreateWaitablePort PROC STDCALL
mov r10 , rcx
mov eax , 171
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateWaitablePort ENDP
; ULONG64 __stdcall NtCreateWorkerFactory( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 , ULONG64 arg_10 );
_6_0_6001_sp1_windows_vista_NtCreateWorkerFactory PROC STDCALL
mov r10 , rcx
mov eax , 172
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtCreateWorkerFactory ENDP
; ULONG64 __stdcall NtDebugActiveProcess( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtDebugActiveProcess PROC STDCALL
mov r10 , rcx
mov eax , 173
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtDebugActiveProcess ENDP
; ULONG64 __stdcall NtDebugContinue( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtDebugContinue PROC STDCALL
mov r10 , rcx
mov eax , 174
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtDebugContinue ENDP
; ULONG64 __stdcall NtDeleteAtom( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtDeleteAtom PROC STDCALL
mov r10 , rcx
mov eax , 175
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtDeleteAtom ENDP
; ULONG64 __stdcall NtDeleteBootEntry( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtDeleteBootEntry PROC STDCALL
mov r10 , rcx
mov eax , 176
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtDeleteBootEntry ENDP
; ULONG64 __stdcall NtDeleteDriverEntry( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtDeleteDriverEntry PROC STDCALL
mov r10 , rcx
mov eax , 177
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtDeleteDriverEntry ENDP
; ULONG64 __stdcall NtDeleteFile( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtDeleteFile PROC STDCALL
mov r10 , rcx
mov eax , 178
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtDeleteFile ENDP
; ULONG64 __stdcall NtDeleteKey( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtDeleteKey PROC STDCALL
mov r10 , rcx
mov eax , 179
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtDeleteKey ENDP
; ULONG64 __stdcall NtDeleteObjectAuditAlarm( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtDeleteObjectAuditAlarm PROC STDCALL
mov r10 , rcx
mov eax , 180
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtDeleteObjectAuditAlarm ENDP
; ULONG64 __stdcall NtDeletePrivateNamespace( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtDeletePrivateNamespace PROC STDCALL
mov r10 , rcx
mov eax , 181
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtDeletePrivateNamespace ENDP
; ULONG64 __stdcall NtDeleteValueKey( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtDeleteValueKey PROC STDCALL
mov r10 , rcx
mov eax , 182
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtDeleteValueKey ENDP
; ULONG64 __stdcall NtDisplayString( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtDisplayString PROC STDCALL
mov r10 , rcx
mov eax , 183
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtDisplayString ENDP
; ULONG64 __stdcall NtEnumerateBootEntries( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtEnumerateBootEntries PROC STDCALL
mov r10 , rcx
mov eax , 184
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtEnumerateBootEntries ENDP
; ULONG64 __stdcall NtEnumerateDriverEntries( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtEnumerateDriverEntries PROC STDCALL
mov r10 , rcx
mov eax , 185
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtEnumerateDriverEntries ENDP
; ULONG64 __stdcall NtEnumerateSystemEnvironmentValuesEx( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtEnumerateSystemEnvironmentValuesEx PROC STDCALL
mov r10 , rcx
mov eax , 186
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtEnumerateSystemEnvironmentValuesEx ENDP
; ULONG64 __stdcall NtEnumerateTransactionObject( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtEnumerateTransactionObject PROC STDCALL
mov r10 , rcx
mov eax , 187
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtEnumerateTransactionObject ENDP
; ULONG64 __stdcall NtExtendSection( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtExtendSection PROC STDCALL
mov r10 , rcx
mov eax , 188
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtExtendSection ENDP
; ULONG64 __stdcall NtFilterToken( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 );
_6_0_6001_sp1_windows_vista_NtFilterToken PROC STDCALL
mov r10 , rcx
mov eax , 189
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtFilterToken ENDP
; ULONG64 __stdcall NtFlushInstallUILanguage( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtFlushInstallUILanguage PROC STDCALL
mov r10 , rcx
mov eax , 190
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtFlushInstallUILanguage ENDP
; ULONG64 __stdcall NtFlushInstructionCache( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtFlushInstructionCache PROC STDCALL
mov r10 , rcx
mov eax , 191
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtFlushInstructionCache ENDP
; ULONG64 __stdcall NtFlushKey( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtFlushKey PROC STDCALL
mov r10 , rcx
mov eax , 192
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtFlushKey ENDP
; ULONG64 __stdcall NtFlushProcessWriteBuffers( );
_6_0_6001_sp1_windows_vista_NtFlushProcessWriteBuffers PROC STDCALL
mov r10 , rcx
mov eax , 193
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtFlushProcessWriteBuffers ENDP
; ULONG64 __stdcall NtFlushVirtualMemory( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtFlushVirtualMemory PROC STDCALL
mov r10 , rcx
mov eax , 194
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtFlushVirtualMemory ENDP
; ULONG64 __stdcall NtFlushWriteBuffer( );
_6_0_6001_sp1_windows_vista_NtFlushWriteBuffer PROC STDCALL
mov r10 , rcx
mov eax , 195
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtFlushWriteBuffer ENDP
; ULONG64 __stdcall NtFreeUserPhysicalPages( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtFreeUserPhysicalPages PROC STDCALL
mov r10 , rcx
mov eax , 196
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtFreeUserPhysicalPages ENDP
; ULONG64 __stdcall NtFreezeRegistry( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtFreezeRegistry PROC STDCALL
mov r10 , rcx
mov eax , 197
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtFreezeRegistry ENDP
; ULONG64 __stdcall NtFreezeTransactions( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtFreezeTransactions PROC STDCALL
mov r10 , rcx
mov eax , 198
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtFreezeTransactions ENDP
; ULONG64 __stdcall NtGetContextThread( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtGetContextThread PROC STDCALL
mov r10 , rcx
mov eax , 199
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtGetContextThread ENDP
; ULONG64 __stdcall NtGetCurrentProcessorNumber( );
_6_0_6001_sp1_windows_vista_NtGetCurrentProcessorNumber PROC STDCALL
mov r10 , rcx
mov eax , 200
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtGetCurrentProcessorNumber ENDP
; ULONG64 __stdcall NtGetDevicePowerState( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtGetDevicePowerState PROC STDCALL
mov r10 , rcx
mov eax , 201
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtGetDevicePowerState ENDP
; ULONG64 __stdcall NtGetMUIRegistryInfo( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtGetMUIRegistryInfo PROC STDCALL
mov r10 , rcx
mov eax , 202
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtGetMUIRegistryInfo ENDP
; ULONG64 __stdcall NtGetNextProcess( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtGetNextProcess PROC STDCALL
mov r10 , rcx
mov eax , 203
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtGetNextProcess ENDP
; ULONG64 __stdcall NtGetNextThread( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 );
_6_0_6001_sp1_windows_vista_NtGetNextThread PROC STDCALL
mov r10 , rcx
mov eax , 204
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtGetNextThread ENDP
; ULONG64 __stdcall NtGetNlsSectionPtr( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtGetNlsSectionPtr PROC STDCALL
mov r10 , rcx
mov eax , 205
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtGetNlsSectionPtr ENDP
; ULONG64 __stdcall NtGetNotificationResourceManager( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 );
_6_0_6001_sp1_windows_vista_NtGetNotificationResourceManager PROC STDCALL
mov r10 , rcx
mov eax , 206
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtGetNotificationResourceManager ENDP
; ULONG64 __stdcall NtGetPlugPlayEvent( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtGetPlugPlayEvent PROC STDCALL
mov r10 , rcx
mov eax , 207
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtGetPlugPlayEvent ENDP
; ULONG64 __stdcall NtGetWriteWatch( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 );
_6_0_6001_sp1_windows_vista_NtGetWriteWatch PROC STDCALL
mov r10 , rcx
mov eax , 208
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtGetWriteWatch ENDP
; ULONG64 __stdcall NtImpersonateAnonymousToken( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtImpersonateAnonymousToken PROC STDCALL
mov r10 , rcx
mov eax , 209
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtImpersonateAnonymousToken ENDP
; ULONG64 __stdcall NtImpersonateThread( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtImpersonateThread PROC STDCALL
mov r10 , rcx
mov eax , 210
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtImpersonateThread ENDP
; ULONG64 __stdcall NtInitializeNlsFiles( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtInitializeNlsFiles PROC STDCALL
mov r10 , rcx
mov eax , 211
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtInitializeNlsFiles ENDP
; ULONG64 __stdcall NtInitializeRegistry( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtInitializeRegistry PROC STDCALL
mov r10 , rcx
mov eax , 212
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtInitializeRegistry ENDP
; ULONG64 __stdcall NtInitiatePowerAction( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtInitiatePowerAction PROC STDCALL
mov r10 , rcx
mov eax , 213
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtInitiatePowerAction ENDP
; ULONG64 __stdcall NtIsSystemResumeAutomatic( );
_6_0_6001_sp1_windows_vista_NtIsSystemResumeAutomatic PROC STDCALL
mov r10 , rcx
mov eax , 214
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtIsSystemResumeAutomatic ENDP
; ULONG64 __stdcall NtIsUILanguageComitted( );
_6_0_6001_sp1_windows_vista_NtIsUILanguageComitted PROC STDCALL
mov r10 , rcx
mov eax , 215
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtIsUILanguageComitted ENDP
; ULONG64 __stdcall NtListenPort( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtListenPort PROC STDCALL
mov r10 , rcx
mov eax , 216
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtListenPort ENDP
; ULONG64 __stdcall NtLoadDriver( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtLoadDriver PROC STDCALL
mov r10 , rcx
mov eax , 217
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtLoadDriver ENDP
; ULONG64 __stdcall NtLoadKey( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtLoadKey PROC STDCALL
mov r10 , rcx
mov eax , 218
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtLoadKey ENDP
; ULONG64 __stdcall NtLoadKey2( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtLoadKey2 PROC STDCALL
mov r10 , rcx
mov eax , 219
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtLoadKey2 ENDP
; ULONG64 __stdcall NtLoadKeyEx( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 );
_6_0_6001_sp1_windows_vista_NtLoadKeyEx PROC STDCALL
mov r10 , rcx
mov eax , 220
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtLoadKeyEx ENDP
; ULONG64 __stdcall NtLockFile( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 , ULONG64 arg_10 );
_6_0_6001_sp1_windows_vista_NtLockFile PROC STDCALL
mov r10 , rcx
mov eax , 221
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtLockFile ENDP
; ULONG64 __stdcall NtLockProductActivationKeys( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtLockProductActivationKeys PROC STDCALL
mov r10 , rcx
mov eax , 222
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtLockProductActivationKeys ENDP
; ULONG64 __stdcall NtLockRegistryKey( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtLockRegistryKey PROC STDCALL
mov r10 , rcx
mov eax , 223
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtLockRegistryKey ENDP
; ULONG64 __stdcall NtLockVirtualMemory( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtLockVirtualMemory PROC STDCALL
mov r10 , rcx
mov eax , 224
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtLockVirtualMemory ENDP
; ULONG64 __stdcall NtMakePermanentObject( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtMakePermanentObject PROC STDCALL
mov r10 , rcx
mov eax , 225
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtMakePermanentObject ENDP
; ULONG64 __stdcall NtMakeTemporaryObject( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtMakeTemporaryObject PROC STDCALL
mov r10 , rcx
mov eax , 226
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtMakeTemporaryObject ENDP
; ULONG64 __stdcall NtMapCMFModule( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 );
_6_0_6001_sp1_windows_vista_NtMapCMFModule PROC STDCALL
mov r10 , rcx
mov eax , 227
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtMapCMFModule ENDP
; ULONG64 __stdcall NtMapUserPhysicalPages( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtMapUserPhysicalPages PROC STDCALL
mov r10 , rcx
mov eax , 228
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtMapUserPhysicalPages ENDP
; ULONG64 __stdcall NtModifyBootEntry( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtModifyBootEntry PROC STDCALL
mov r10 , rcx
mov eax , 229
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtModifyBootEntry ENDP
; ULONG64 __stdcall NtModifyDriverEntry( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtModifyDriverEntry PROC STDCALL
mov r10 , rcx
mov eax , 230
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtModifyDriverEntry ENDP
; ULONG64 __stdcall NtNotifyChangeDirectoryFile( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 );
_6_0_6001_sp1_windows_vista_NtNotifyChangeDirectoryFile PROC STDCALL
mov r10 , rcx
mov eax , 231
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtNotifyChangeDirectoryFile ENDP
; ULONG64 __stdcall NtNotifyChangeKey( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 , ULONG64 arg_10 );
_6_0_6001_sp1_windows_vista_NtNotifyChangeKey PROC STDCALL
mov r10 , rcx
mov eax , 232
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtNotifyChangeKey ENDP
; ULONG64 __stdcall NtNotifyChangeMultipleKeys( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 , ULONG64 arg_10 , ULONG64 arg_11 , ULONG64 arg_12 );
_6_0_6001_sp1_windows_vista_NtNotifyChangeMultipleKeys PROC STDCALL
mov r10 , rcx
mov eax , 233
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtNotifyChangeMultipleKeys ENDP
; ULONG64 __stdcall NtOpenEnlistment( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtOpenEnlistment PROC STDCALL
mov r10 , rcx
mov eax , 234
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtOpenEnlistment ENDP
; ULONG64 __stdcall NtOpenEventPair( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtOpenEventPair PROC STDCALL
mov r10 , rcx
mov eax , 235
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtOpenEventPair ENDP
; ULONG64 __stdcall NtOpenIoCompletion( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtOpenIoCompletion PROC STDCALL
mov r10 , rcx
mov eax , 236
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtOpenIoCompletion ENDP
; ULONG64 __stdcall NtOpenJobObject( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtOpenJobObject PROC STDCALL
mov r10 , rcx
mov eax , 237
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtOpenJobObject ENDP
; ULONG64 __stdcall NtOpenKeyTransacted( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtOpenKeyTransacted PROC STDCALL
mov r10 , rcx
mov eax , 238
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtOpenKeyTransacted ENDP
; ULONG64 __stdcall NtOpenKeyedEvent( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtOpenKeyedEvent PROC STDCALL
mov r10 , rcx
mov eax , 239
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtOpenKeyedEvent ENDP
; ULONG64 __stdcall NtOpenMutant( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtOpenMutant PROC STDCALL
mov r10 , rcx
mov eax , 240
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtOpenMutant ENDP
; ULONG64 __stdcall NtOpenObjectAuditAlarm( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 , ULONG64 arg_10 , ULONG64 arg_11 , ULONG64 arg_12 );
_6_0_6001_sp1_windows_vista_NtOpenObjectAuditAlarm PROC STDCALL
mov r10 , rcx
mov eax , 241
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtOpenObjectAuditAlarm ENDP
; ULONG64 __stdcall NtOpenPrivateNamespace( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtOpenPrivateNamespace PROC STDCALL
mov r10 , rcx
mov eax , 242
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtOpenPrivateNamespace ENDP
; ULONG64 __stdcall NtOpenProcessToken( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtOpenProcessToken PROC STDCALL
mov r10 , rcx
mov eax , 243
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtOpenProcessToken ENDP
; ULONG64 __stdcall NtOpenResourceManager( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtOpenResourceManager PROC STDCALL
mov r10 , rcx
mov eax , 244
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtOpenResourceManager ENDP
; ULONG64 __stdcall NtOpenSemaphore( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtOpenSemaphore PROC STDCALL
mov r10 , rcx
mov eax , 245
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtOpenSemaphore ENDP
; ULONG64 __stdcall NtOpenSession( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtOpenSession PROC STDCALL
mov r10 , rcx
mov eax , 246
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtOpenSession ENDP
; ULONG64 __stdcall NtOpenSymbolicLinkObject( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtOpenSymbolicLinkObject PROC STDCALL
mov r10 , rcx
mov eax , 247
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtOpenSymbolicLinkObject ENDP
; ULONG64 __stdcall NtOpenThread( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtOpenThread PROC STDCALL
mov r10 , rcx
mov eax , 248
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtOpenThread ENDP
; ULONG64 __stdcall NtOpenTimer( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtOpenTimer PROC STDCALL
mov r10 , rcx
mov eax , 249
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtOpenTimer ENDP
; ULONG64 __stdcall NtOpenTransaction( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtOpenTransaction PROC STDCALL
mov r10 , rcx
mov eax , 250
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtOpenTransaction ENDP
; ULONG64 __stdcall NtOpenTransactionManager( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 );
_6_0_6001_sp1_windows_vista_NtOpenTransactionManager PROC STDCALL
mov r10 , rcx
mov eax , 251
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtOpenTransactionManager ENDP
; ULONG64 __stdcall NtPlugPlayControl( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtPlugPlayControl PROC STDCALL
mov r10 , rcx
mov eax , 252
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtPlugPlayControl ENDP
; ULONG64 __stdcall NtPrePrepareComplete( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtPrePrepareComplete PROC STDCALL
mov r10 , rcx
mov eax , 253
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtPrePrepareComplete ENDP
; ULONG64 __stdcall NtPrePrepareEnlistment( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtPrePrepareEnlistment PROC STDCALL
mov r10 , rcx
mov eax , 254
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtPrePrepareEnlistment ENDP
; ULONG64 __stdcall NtPrepareComplete( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtPrepareComplete PROC STDCALL
mov r10 , rcx
mov eax , 255
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtPrepareComplete ENDP
; ULONG64 __stdcall NtPrepareEnlistment( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtPrepareEnlistment PROC STDCALL
mov r10 , rcx
mov eax , 256
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtPrepareEnlistment ENDP
; ULONG64 __stdcall NtPrivilegeCheck( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtPrivilegeCheck PROC STDCALL
mov r10 , rcx
mov eax , 257
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtPrivilegeCheck ENDP
; ULONG64 __stdcall NtPrivilegeObjectAuditAlarm( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 );
_6_0_6001_sp1_windows_vista_NtPrivilegeObjectAuditAlarm PROC STDCALL
mov r10 , rcx
mov eax , 258
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtPrivilegeObjectAuditAlarm ENDP
; ULONG64 __stdcall NtPrivilegedServiceAuditAlarm( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtPrivilegedServiceAuditAlarm PROC STDCALL
mov r10 , rcx
mov eax , 259
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtPrivilegedServiceAuditAlarm ENDP
; ULONG64 __stdcall NtPropagationComplete( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtPropagationComplete PROC STDCALL
mov r10 , rcx
mov eax , 260
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtPropagationComplete ENDP
; ULONG64 __stdcall NtPropagationFailed( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtPropagationFailed PROC STDCALL
mov r10 , rcx
mov eax , 261
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtPropagationFailed ENDP
; ULONG64 __stdcall NtPulseEvent( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtPulseEvent PROC STDCALL
mov r10 , rcx
mov eax , 262
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtPulseEvent ENDP
; ULONG64 __stdcall NtQueryBootEntryOrder( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtQueryBootEntryOrder PROC STDCALL
mov r10 , rcx
mov eax , 263
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryBootEntryOrder ENDP
; ULONG64 __stdcall NtQueryBootOptions( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtQueryBootOptions PROC STDCALL
mov r10 , rcx
mov eax , 264
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryBootOptions ENDP
; ULONG64 __stdcall NtQueryDebugFilterState( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtQueryDebugFilterState PROC STDCALL
mov r10 , rcx
mov eax , 265
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryDebugFilterState ENDP
; ULONG64 __stdcall NtQueryDirectoryObject( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 );
_6_0_6001_sp1_windows_vista_NtQueryDirectoryObject PROC STDCALL
mov r10 , rcx
mov eax , 266
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryDirectoryObject ENDP
; ULONG64 __stdcall NtQueryDriverEntryOrder( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtQueryDriverEntryOrder PROC STDCALL
mov r10 , rcx
mov eax , 267
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryDriverEntryOrder ENDP
; ULONG64 __stdcall NtQueryEaFile( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 );
_6_0_6001_sp1_windows_vista_NtQueryEaFile PROC STDCALL
mov r10 , rcx
mov eax , 268
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryEaFile ENDP
; ULONG64 __stdcall NtQueryFullAttributesFile( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtQueryFullAttributesFile PROC STDCALL
mov r10 , rcx
mov eax , 269
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryFullAttributesFile ENDP
; ULONG64 __stdcall NtQueryInformationAtom( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtQueryInformationAtom PROC STDCALL
mov r10 , rcx
mov eax , 270
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryInformationAtom ENDP
; ULONG64 __stdcall NtQueryInformationEnlistment( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtQueryInformationEnlistment PROC STDCALL
mov r10 , rcx
mov eax , 271
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryInformationEnlistment ENDP
; ULONG64 __stdcall NtQueryInformationJobObject( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtQueryInformationJobObject PROC STDCALL
mov r10 , rcx
mov eax , 272
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryInformationJobObject ENDP
; ULONG64 __stdcall NtQueryInformationPort( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtQueryInformationPort PROC STDCALL
mov r10 , rcx
mov eax , 273
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryInformationPort ENDP
; ULONG64 __stdcall NtQueryInformationResourceManager( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtQueryInformationResourceManager PROC STDCALL
mov r10 , rcx
mov eax , 274
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryInformationResourceManager ENDP
; ULONG64 __stdcall NtQueryInformationTransaction( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtQueryInformationTransaction PROC STDCALL
mov r10 , rcx
mov eax , 275
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryInformationTransaction ENDP
; ULONG64 __stdcall NtQueryInformationTransactionManager( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtQueryInformationTransactionManager PROC STDCALL
mov r10 , rcx
mov eax , 276
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryInformationTransactionManager ENDP
; ULONG64 __stdcall NtQueryInformationWorkerFactory( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtQueryInformationWorkerFactory PROC STDCALL
mov r10 , rcx
mov eax , 277
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryInformationWorkerFactory ENDP
; ULONG64 __stdcall NtQueryInstallUILanguage( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtQueryInstallUILanguage PROC STDCALL
mov r10 , rcx
mov eax , 278
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryInstallUILanguage ENDP
; ULONG64 __stdcall NtQueryIntervalProfile( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtQueryIntervalProfile PROC STDCALL
mov r10 , rcx
mov eax , 279
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryIntervalProfile ENDP
; ULONG64 __stdcall NtQueryIoCompletion( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtQueryIoCompletion PROC STDCALL
mov r10 , rcx
mov eax , 280
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryIoCompletion ENDP
; ULONG64 __stdcall NtQueryLicenseValue( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtQueryLicenseValue PROC STDCALL
mov r10 , rcx
mov eax , 281
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryLicenseValue ENDP
; ULONG64 __stdcall NtQueryMultipleValueKey( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 );
_6_0_6001_sp1_windows_vista_NtQueryMultipleValueKey PROC STDCALL
mov r10 , rcx
mov eax , 282
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryMultipleValueKey ENDP
; ULONG64 __stdcall NtQueryMutant( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtQueryMutant PROC STDCALL
mov r10 , rcx
mov eax , 283
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryMutant ENDP
; ULONG64 __stdcall NtQueryOpenSubKeys( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtQueryOpenSubKeys PROC STDCALL
mov r10 , rcx
mov eax , 284
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryOpenSubKeys ENDP
; ULONG64 __stdcall NtQueryOpenSubKeysEx( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtQueryOpenSubKeysEx PROC STDCALL
mov r10 , rcx
mov eax , 285
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryOpenSubKeysEx ENDP
; ULONG64 __stdcall NtQueryPortInformationProcess( );
_6_0_6001_sp1_windows_vista_NtQueryPortInformationProcess PROC STDCALL
mov r10 , rcx
mov eax , 286
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryPortInformationProcess ENDP
; ULONG64 __stdcall NtQueryQuotaInformationFile( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 );
_6_0_6001_sp1_windows_vista_NtQueryQuotaInformationFile PROC STDCALL
mov r10 , rcx
mov eax , 287
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryQuotaInformationFile ENDP
; ULONG64 __stdcall NtQuerySecurityObject( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtQuerySecurityObject PROC STDCALL
mov r10 , rcx
mov eax , 288
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQuerySecurityObject ENDP
; ULONG64 __stdcall NtQuerySemaphore( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtQuerySemaphore PROC STDCALL
mov r10 , rcx
mov eax , 289
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQuerySemaphore ENDP
; ULONG64 __stdcall NtQuerySymbolicLinkObject( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtQuerySymbolicLinkObject PROC STDCALL
mov r10 , rcx
mov eax , 290
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQuerySymbolicLinkObject ENDP
; ULONG64 __stdcall NtQuerySystemEnvironmentValue( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtQuerySystemEnvironmentValue PROC STDCALL
mov r10 , rcx
mov eax , 291
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQuerySystemEnvironmentValue ENDP
; ULONG64 __stdcall NtQuerySystemEnvironmentValueEx( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtQuerySystemEnvironmentValueEx PROC STDCALL
mov r10 , rcx
mov eax , 292
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQuerySystemEnvironmentValueEx ENDP
; ULONG64 __stdcall NtQueryTimerResolution( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtQueryTimerResolution PROC STDCALL
mov r10 , rcx
mov eax , 293
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtQueryTimerResolution ENDP
; ULONG64 __stdcall NtRaiseException( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtRaiseException PROC STDCALL
mov r10 , rcx
mov eax , 294
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtRaiseException ENDP
; ULONG64 __stdcall NtRaiseHardError( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 );
_6_0_6001_sp1_windows_vista_NtRaiseHardError PROC STDCALL
mov r10 , rcx
mov eax , 295
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtRaiseHardError ENDP
; ULONG64 __stdcall NtReadOnlyEnlistment( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtReadOnlyEnlistment PROC STDCALL
mov r10 , rcx
mov eax , 296
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtReadOnlyEnlistment ENDP
; ULONG64 __stdcall NtRecoverEnlistment( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtRecoverEnlistment PROC STDCALL
mov r10 , rcx
mov eax , 297
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtRecoverEnlistment ENDP
; ULONG64 __stdcall NtRecoverResourceManager( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtRecoverResourceManager PROC STDCALL
mov r10 , rcx
mov eax , 298
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtRecoverResourceManager ENDP
; ULONG64 __stdcall NtRecoverTransactionManager( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtRecoverTransactionManager PROC STDCALL
mov r10 , rcx
mov eax , 299
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtRecoverTransactionManager ENDP
; ULONG64 __stdcall NtRegisterProtocolAddressInformation( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtRegisterProtocolAddressInformation PROC STDCALL
mov r10 , rcx
mov eax , 300
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtRegisterProtocolAddressInformation ENDP
; ULONG64 __stdcall NtRegisterThreadTerminatePort( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtRegisterThreadTerminatePort PROC STDCALL
mov r10 , rcx
mov eax , 301
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtRegisterThreadTerminatePort ENDP
; ULONG64 __stdcall NtReleaseCMFViewOwnership( );
_6_0_6001_sp1_windows_vista_NtReleaseCMFViewOwnership PROC STDCALL
mov r10 , rcx
mov eax , 302
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtReleaseCMFViewOwnership ENDP
; ULONG64 __stdcall NtReleaseKeyedEvent( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtReleaseKeyedEvent PROC STDCALL
mov r10 , rcx
mov eax , 303
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtReleaseKeyedEvent ENDP
; ULONG64 __stdcall NtReleaseWorkerFactoryWorker( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtReleaseWorkerFactoryWorker PROC STDCALL
mov r10 , rcx
mov eax , 304
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtReleaseWorkerFactoryWorker ENDP
; ULONG64 __stdcall NtRemoveIoCompletionEx( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 );
_6_0_6001_sp1_windows_vista_NtRemoveIoCompletionEx PROC STDCALL
mov r10 , rcx
mov eax , 305
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtRemoveIoCompletionEx ENDP
; ULONG64 __stdcall NtRemoveProcessDebug( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtRemoveProcessDebug PROC STDCALL
mov r10 , rcx
mov eax , 306
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtRemoveProcessDebug ENDP
; ULONG64 __stdcall NtRenameKey( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtRenameKey PROC STDCALL
mov r10 , rcx
mov eax , 307
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtRenameKey ENDP
; ULONG64 __stdcall NtRenameTransactionManager( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtRenameTransactionManager PROC STDCALL
mov r10 , rcx
mov eax , 308
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtRenameTransactionManager ENDP
; ULONG64 __stdcall NtReplaceKey( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtReplaceKey PROC STDCALL
mov r10 , rcx
mov eax , 309
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtReplaceKey ENDP
; ULONG64 __stdcall NtReplacePartitionUnit( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtReplacePartitionUnit PROC STDCALL
mov r10 , rcx
mov eax , 310
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtReplacePartitionUnit ENDP
; ULONG64 __stdcall NtReplyWaitReplyPort( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtReplyWaitReplyPort PROC STDCALL
mov r10 , rcx
mov eax , 311
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtReplyWaitReplyPort ENDP
; ULONG64 __stdcall NtRequestDeviceWakeup( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtRequestDeviceWakeup PROC STDCALL
mov r10 , rcx
mov eax , 312
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtRequestDeviceWakeup ENDP
; ULONG64 __stdcall NtRequestPort( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtRequestPort PROC STDCALL
mov r10 , rcx
mov eax , 313
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtRequestPort ENDP
; ULONG64 __stdcall NtRequestWakeupLatency( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtRequestWakeupLatency PROC STDCALL
mov r10 , rcx
mov eax , 314
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtRequestWakeupLatency ENDP
; ULONG64 __stdcall NtResetEvent( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtResetEvent PROC STDCALL
mov r10 , rcx
mov eax , 315
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtResetEvent ENDP
; ULONG64 __stdcall NtResetWriteWatch( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtResetWriteWatch PROC STDCALL
mov r10 , rcx
mov eax , 316
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtResetWriteWatch ENDP
; ULONG64 __stdcall NtRestoreKey( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtRestoreKey PROC STDCALL
mov r10 , rcx
mov eax , 317
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtRestoreKey ENDP
; ULONG64 __stdcall NtResumeProcess( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtResumeProcess PROC STDCALL
mov r10 , rcx
mov eax , 318
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtResumeProcess ENDP
; ULONG64 __stdcall NtRollbackComplete( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtRollbackComplete PROC STDCALL
mov r10 , rcx
mov eax , 319
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtRollbackComplete ENDP
; ULONG64 __stdcall NtRollbackEnlistment( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtRollbackEnlistment PROC STDCALL
mov r10 , rcx
mov eax , 320
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtRollbackEnlistment ENDP
; ULONG64 __stdcall NtRollbackTransaction( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtRollbackTransaction PROC STDCALL
mov r10 , rcx
mov eax , 321
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtRollbackTransaction ENDP
; ULONG64 __stdcall NtRollforwardTransactionManager( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtRollforwardTransactionManager PROC STDCALL
mov r10 , rcx
mov eax , 322
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtRollforwardTransactionManager ENDP
; ULONG64 __stdcall NtSaveKey( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtSaveKey PROC STDCALL
mov r10 , rcx
mov eax , 323
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSaveKey ENDP
; ULONG64 __stdcall NtSaveKeyEx( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtSaveKeyEx PROC STDCALL
mov r10 , rcx
mov eax , 324
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSaveKeyEx ENDP
; ULONG64 __stdcall NtSaveMergedKeys( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtSaveMergedKeys PROC STDCALL
mov r10 , rcx
mov eax , 325
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSaveMergedKeys ENDP
; ULONG64 __stdcall NtSecureConnectPort( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 , ULONG64 arg_07 , ULONG64 arg_08 , ULONG64 arg_09 );
_6_0_6001_sp1_windows_vista_NtSecureConnectPort PROC STDCALL
mov r10 , rcx
mov eax , 326
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSecureConnectPort ENDP
; ULONG64 __stdcall NtSetBootEntryOrder( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtSetBootEntryOrder PROC STDCALL
mov r10 , rcx
mov eax , 327
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetBootEntryOrder ENDP
; ULONG64 __stdcall NtSetBootOptions( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtSetBootOptions PROC STDCALL
mov r10 , rcx
mov eax , 328
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetBootOptions ENDP
; ULONG64 __stdcall NtSetContextThread( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtSetContextThread PROC STDCALL
mov r10 , rcx
mov eax , 329
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetContextThread ENDP
; ULONG64 __stdcall NtSetDebugFilterState( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtSetDebugFilterState PROC STDCALL
mov r10 , rcx
mov eax , 330
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetDebugFilterState ENDP
; ULONG64 __stdcall NtSetDefaultHardErrorPort( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtSetDefaultHardErrorPort PROC STDCALL
mov r10 , rcx
mov eax , 331
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetDefaultHardErrorPort ENDP
; ULONG64 __stdcall NtSetDefaultLocale( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtSetDefaultLocale PROC STDCALL
mov r10 , rcx
mov eax , 332
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetDefaultLocale ENDP
; ULONG64 __stdcall NtSetDefaultUILanguage( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtSetDefaultUILanguage PROC STDCALL
mov r10 , rcx
mov eax , 333
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetDefaultUILanguage ENDP
; ULONG64 __stdcall NtSetDriverEntryOrder( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtSetDriverEntryOrder PROC STDCALL
mov r10 , rcx
mov eax , 334
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetDriverEntryOrder ENDP
; ULONG64 __stdcall NtSetEaFile( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtSetEaFile PROC STDCALL
mov r10 , rcx
mov eax , 335
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetEaFile ENDP
; ULONG64 __stdcall NtSetHighEventPair( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtSetHighEventPair PROC STDCALL
mov r10 , rcx
mov eax , 336
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetHighEventPair ENDP
; ULONG64 __stdcall NtSetHighWaitLowEventPair( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtSetHighWaitLowEventPair PROC STDCALL
mov r10 , rcx
mov eax , 337
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetHighWaitLowEventPair ENDP
; ULONG64 __stdcall NtSetInformationDebugObject( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtSetInformationDebugObject PROC STDCALL
mov r10 , rcx
mov eax , 338
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetInformationDebugObject ENDP
; ULONG64 __stdcall NtSetInformationEnlistment( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtSetInformationEnlistment PROC STDCALL
mov r10 , rcx
mov eax , 339
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetInformationEnlistment ENDP
; ULONG64 __stdcall NtSetInformationJobObject( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtSetInformationJobObject PROC STDCALL
mov r10 , rcx
mov eax , 340
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetInformationJobObject ENDP
; ULONG64 __stdcall NtSetInformationKey( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtSetInformationKey PROC STDCALL
mov r10 , rcx
mov eax , 341
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetInformationKey ENDP
; ULONG64 __stdcall NtSetInformationResourceManager( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtSetInformationResourceManager PROC STDCALL
mov r10 , rcx
mov eax , 342
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetInformationResourceManager ENDP
; ULONG64 __stdcall NtSetInformationToken( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtSetInformationToken PROC STDCALL
mov r10 , rcx
mov eax , 343
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetInformationToken ENDP
; ULONG64 __stdcall NtSetInformationTransaction( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtSetInformationTransaction PROC STDCALL
mov r10 , rcx
mov eax , 344
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetInformationTransaction ENDP
; ULONG64 __stdcall NtSetInformationTransactionManager( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtSetInformationTransactionManager PROC STDCALL
mov r10 , rcx
mov eax , 345
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetInformationTransactionManager ENDP
; ULONG64 __stdcall NtSetInformationWorkerFactory( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtSetInformationWorkerFactory PROC STDCALL
mov r10 , rcx
mov eax , 346
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetInformationWorkerFactory ENDP
; ULONG64 __stdcall NtSetIntervalProfile( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtSetIntervalProfile PROC STDCALL
mov r10 , rcx
mov eax , 347
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetIntervalProfile ENDP
; ULONG64 __stdcall NtSetIoCompletion( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtSetIoCompletion PROC STDCALL
mov r10 , rcx
mov eax , 348
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetIoCompletion ENDP
; ULONG64 __stdcall NtSetLdtEntries( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 );
_6_0_6001_sp1_windows_vista_NtSetLdtEntries PROC STDCALL
mov r10 , rcx
mov eax , 349
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetLdtEntries ENDP
; ULONG64 __stdcall NtSetLowEventPair( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtSetLowEventPair PROC STDCALL
mov r10 , rcx
mov eax , 350
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetLowEventPair ENDP
; ULONG64 __stdcall NtSetLowWaitHighEventPair( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtSetLowWaitHighEventPair PROC STDCALL
mov r10 , rcx
mov eax , 351
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetLowWaitHighEventPair ENDP
; ULONG64 __stdcall NtSetQuotaInformationFile( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtSetQuotaInformationFile PROC STDCALL
mov r10 , rcx
mov eax , 352
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetQuotaInformationFile ENDP
; ULONG64 __stdcall NtSetSecurityObject( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtSetSecurityObject PROC STDCALL
mov r10 , rcx
mov eax , 353
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetSecurityObject ENDP
; ULONG64 __stdcall NtSetSystemEnvironmentValue( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtSetSystemEnvironmentValue PROC STDCALL
mov r10 , rcx
mov eax , 354
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetSystemEnvironmentValue ENDP
; ULONG64 __stdcall NtSetSystemEnvironmentValueEx( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtSetSystemEnvironmentValueEx PROC STDCALL
mov r10 , rcx
mov eax , 355
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetSystemEnvironmentValueEx ENDP
; ULONG64 __stdcall NtSetSystemInformation( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtSetSystemInformation PROC STDCALL
mov r10 , rcx
mov eax , 356
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetSystemInformation ENDP
; ULONG64 __stdcall NtSetSystemPowerState( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtSetSystemPowerState PROC STDCALL
mov r10 , rcx
mov eax , 357
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetSystemPowerState ENDP
; ULONG64 __stdcall NtSetSystemTime( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtSetSystemTime PROC STDCALL
mov r10 , rcx
mov eax , 358
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetSystemTime ENDP
; ULONG64 __stdcall NtSetThreadExecutionState( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtSetThreadExecutionState PROC STDCALL
mov r10 , rcx
mov eax , 359
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetThreadExecutionState ENDP
; ULONG64 __stdcall NtSetTimerResolution( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 );
_6_0_6001_sp1_windows_vista_NtSetTimerResolution PROC STDCALL
mov r10 , rcx
mov eax , 360
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetTimerResolution ENDP
; ULONG64 __stdcall NtSetUuidSeed( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtSetUuidSeed PROC STDCALL
mov r10 , rcx
mov eax , 361
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetUuidSeed ENDP
; ULONG64 __stdcall NtSetVolumeInformationFile( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtSetVolumeInformationFile PROC STDCALL
mov r10 , rcx
mov eax , 362
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSetVolumeInformationFile ENDP
; ULONG64 __stdcall NtShutdownSystem( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtShutdownSystem PROC STDCALL
mov r10 , rcx
mov eax , 363
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtShutdownSystem ENDP
; ULONG64 __stdcall NtShutdownWorkerFactory( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtShutdownWorkerFactory PROC STDCALL
mov r10 , rcx
mov eax , 364
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtShutdownWorkerFactory ENDP
; ULONG64 __stdcall NtSignalAndWaitForSingleObject( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtSignalAndWaitForSingleObject PROC STDCALL
mov r10 , rcx
mov eax , 365
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSignalAndWaitForSingleObject ENDP
; ULONG64 __stdcall NtSinglePhaseReject( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtSinglePhaseReject PROC STDCALL
mov r10 , rcx
mov eax , 366
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSinglePhaseReject ENDP
; ULONG64 __stdcall NtStartProfile( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtStartProfile PROC STDCALL
mov r10 , rcx
mov eax , 367
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtStartProfile ENDP
; ULONG64 __stdcall NtStopProfile( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtStopProfile PROC STDCALL
mov r10 , rcx
mov eax , 368
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtStopProfile ENDP
; ULONG64 __stdcall NtSuspendProcess( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtSuspendProcess PROC STDCALL
mov r10 , rcx
mov eax , 369
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSuspendProcess ENDP
; ULONG64 __stdcall NtSuspendThread( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtSuspendThread PROC STDCALL
mov r10 , rcx
mov eax , 370
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSuspendThread ENDP
; ULONG64 __stdcall NtSystemDebugControl( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 );
_6_0_6001_sp1_windows_vista_NtSystemDebugControl PROC STDCALL
mov r10 , rcx
mov eax , 371
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtSystemDebugControl ENDP
; ULONG64 __stdcall NtTerminateJobObject( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtTerminateJobObject PROC STDCALL
mov r10 , rcx
mov eax , 372
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtTerminateJobObject ENDP
; ULONG64 __stdcall NtTestAlert( );
_6_0_6001_sp1_windows_vista_NtTestAlert PROC STDCALL
mov r10 , rcx
mov eax , 373
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtTestAlert ENDP
; ULONG64 __stdcall NtThawRegistry( );
_6_0_6001_sp1_windows_vista_NtThawRegistry PROC STDCALL
mov r10 , rcx
mov eax , 374
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtThawRegistry ENDP
; ULONG64 __stdcall NtThawTransactions( );
_6_0_6001_sp1_windows_vista_NtThawTransactions PROC STDCALL
mov r10 , rcx
mov eax , 375
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtThawTransactions ENDP
; ULONG64 __stdcall NtTraceControl( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 , ULONG64 arg_06 );
_6_0_6001_sp1_windows_vista_NtTraceControl PROC STDCALL
mov r10 , rcx
mov eax , 376
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtTraceControl ENDP
; ULONG64 __stdcall NtTranslateFilePath( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtTranslateFilePath PROC STDCALL
mov r10 , rcx
mov eax , 377
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtTranslateFilePath ENDP
; ULONG64 __stdcall NtUnloadDriver( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtUnloadDriver PROC STDCALL
mov r10 , rcx
mov eax , 378
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtUnloadDriver ENDP
; ULONG64 __stdcall NtUnloadKey( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtUnloadKey PROC STDCALL
mov r10 , rcx
mov eax , 379
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtUnloadKey ENDP
; ULONG64 __stdcall NtUnloadKey2( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtUnloadKey2 PROC STDCALL
mov r10 , rcx
mov eax , 380
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtUnloadKey2 ENDP
; ULONG64 __stdcall NtUnloadKeyEx( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtUnloadKeyEx PROC STDCALL
mov r10 , rcx
mov eax , 381
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtUnloadKeyEx ENDP
; ULONG64 __stdcall NtUnlockFile( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 , ULONG64 arg_05 );
_6_0_6001_sp1_windows_vista_NtUnlockFile PROC STDCALL
mov r10 , rcx
mov eax , 382
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtUnlockFile ENDP
; ULONG64 __stdcall NtUnlockVirtualMemory( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtUnlockVirtualMemory PROC STDCALL
mov r10 , rcx
mov eax , 383
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtUnlockVirtualMemory ENDP
; ULONG64 __stdcall NtVdmControl( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtVdmControl PROC STDCALL
mov r10 , rcx
mov eax , 384
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtVdmControl ENDP
; ULONG64 __stdcall NtWaitForDebugEvent( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtWaitForDebugEvent PROC STDCALL
mov r10 , rcx
mov eax , 385
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtWaitForDebugEvent ENDP
; ULONG64 __stdcall NtWaitForKeyedEvent( ULONG64 arg_01 , ULONG64 arg_02 , ULONG64 arg_03 , ULONG64 arg_04 );
_6_0_6001_sp1_windows_vista_NtWaitForKeyedEvent PROC STDCALL
mov r10 , rcx
mov eax , 386
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtWaitForKeyedEvent ENDP
; ULONG64 __stdcall NtWaitForWorkViaWorkerFactory( ULONG64 arg_01 , ULONG64 arg_02 );
_6_0_6001_sp1_windows_vista_NtWaitForWorkViaWorkerFactory PROC STDCALL
mov r10 , rcx
mov eax , 387
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtWaitForWorkViaWorkerFactory ENDP
; ULONG64 __stdcall NtWaitHighEventPair( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtWaitHighEventPair PROC STDCALL
mov r10 , rcx
mov eax , 388
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtWaitHighEventPair ENDP
; ULONG64 __stdcall NtWaitLowEventPair( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtWaitLowEventPair PROC STDCALL
mov r10 , rcx
mov eax , 389
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtWaitLowEventPair ENDP
; ULONG64 __stdcall NtWorkerFactoryWorkerReady( ULONG64 arg_01 );
_6_0_6001_sp1_windows_vista_NtWorkerFactoryWorkerReady PROC STDCALL
mov r10 , rcx
mov eax , 390
;syscall
db 0Fh , 05h
ret
_6_0_6001_sp1_windows_vista_NtWorkerFactoryWorkerReady ENDP
|
;
; Z88 Graphics Functions - Small C+ stubs
;
; TI Calc version by Stefano Bodrato Mar - 2000
;
;
; $Id: clg.asm,v 1.5 2017-01-02 22:57:59 aralbrec Exp $
;
INCLUDE "graphics/grafix.inc" ; Contains fn defs
PUBLIC clg
PUBLIC _clg
EXTERN base_graphics
EXTERN cpygraph
.clg
._clg
ld hl,(base_graphics)
ld (hl),0
ld d,h
ld e,l
inc de
ld bc,row_bytes*64-1
ldir
jp cpygraph ; Copy GRAPH_MEM to LCD, then return
|
/*
* Copyright © <2010>, Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* This file was originally licensed under the following license
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
//=============== Spawn a chroma root thread ===============
//----- Create chroma root thread R0 header -----
#if defined(_DEBUG)
mov (1) EntrySignature:w 0xAABA:w
#endif
// Restore CT_R0Hdr.4:ud to r0.4:ud
// mov (1) CT_R0Hdr.4:ud r0.4:ud
// R0.2: Interface Discriptor Ptr. Add child offset for child kernel
add (1) CT_R0Hdr.2:ud r0.2:ud CHROMA_ROOT_OFFSET:w
// Assign a new Thread Count for this child
mov (1) CT_R0Hdr.6:ud 1:w // ThreadID=1 for chroma root
//----- Copy luma root r1 for launching chroma root thread -----
mov (16) m2.0:w RootParam<16;16,1>:w
#include "writeURB.asm"
//--------------------------------------------------
// Set URB handle for child thread launching:
// URB handle Length (bit 15:10) - 0000 0000 0000 0000 yyyy yy00 0000 0000
// URB handle offset (bit 9:0) - 0000 0000 0000 0000 0000 00xx xxxx xxxx
or (1) CT_R0Hdr.4:ud URB_EntriesPerMB_2:w URBOffset:uw
// 2 URB entries:
// Entry 0 - CT_R0Hdr
// Entry 1 - input parameter to child kernel
//----- Spawn a child now -----
send (8) null:ud CT_R0Hdr null:ud TS TSMSGDSC
// Restore CT_R0Hdr.4:ud to r0.4:ud for next use
mov (1) CT_R0Hdr.4:ud r0.4:ud
|
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <limits>
#include "src/common/globals.h"
#include "src/compiler/node-matchers.h"
#include "src/objects/objects-inl.h"
#include "test/unittests/compiler/backend/instruction-selector-unittest.h"
#if V8_ENABLE_WEBASSEMBLY
#include "src/wasm/simd-shuffle.h"
#endif // V8_ENABLE_WEBASSEMBLY
namespace v8 {
namespace internal {
namespace compiler {
// -----------------------------------------------------------------------------
// Conversions.
TEST_F(InstructionSelectorTest, ChangeFloat32ToFloat64WithParameter) {
StreamBuilder m(this, MachineType::Float32(), MachineType::Float64());
m.Return(m.ChangeFloat32ToFloat64(m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kSSEFloat32ToFloat64, s[0]->arch_opcode());
EXPECT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
TEST_F(InstructionSelectorTest, ChangeInt32ToInt64WithParameter) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Int32());
m.Return(m.ChangeInt32ToInt64(m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Movsxlq, s[0]->arch_opcode());
}
TEST_F(InstructionSelectorTest, ChangeUint32ToFloat64WithParameter) {
StreamBuilder m(this, MachineType::Float64(), MachineType::Uint32());
m.Return(m.ChangeUint32ToFloat64(m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kSSEUint32ToFloat64, s[0]->arch_opcode());
}
TEST_F(InstructionSelectorTest, ChangeUint32ToUint64WithParameter) {
StreamBuilder m(this, MachineType::Uint64(), MachineType::Uint32());
m.Return(m.ChangeUint32ToUint64(m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Movl, s[0]->arch_opcode());
}
TEST_F(InstructionSelectorTest, TruncateFloat64ToFloat32WithParameter) {
StreamBuilder m(this, MachineType::Float64(), MachineType::Float32());
m.Return(m.TruncateFloat64ToFloat32(m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kSSEFloat64ToFloat32, s[0]->arch_opcode());
EXPECT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
TEST_F(InstructionSelectorTest, TruncateInt64ToInt32WithParameter) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int64());
m.Return(m.TruncateInt64ToInt32(m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Movl, s[0]->arch_opcode());
}
namespace {
struct LoadWithToInt64Extension {
MachineType type;
ArchOpcode expected_opcode;
};
std::ostream& operator<<(std::ostream& os,
const LoadWithToInt64Extension& i32toi64) {
return os << i32toi64.type;
}
static const LoadWithToInt64Extension kLoadWithToInt64Extensions[] = {
{MachineType::Int8(), kX64Movsxbq},
{MachineType::Uint8(), kX64Movzxbq},
{MachineType::Int16(), kX64Movsxwq},
{MachineType::Uint16(), kX64Movzxwq},
{MachineType::Int32(), kX64Movsxlq}};
// The parameterized test that use the following type are intentionally part
// of the anonymous namespace. The issue here is that the type parameter is
// using a type that is in the anonymous namespace, but the class generated by
// TEST_P is not. This will cause GCC to generate a -Wsubobject-linkage warning.
//
// In this case there will only be single translation unit and the warning
// about subobject-linkage can be avoided by placing the class generated
// by TEST_P in the anoynmous namespace as well.
using InstructionSelectorChangeInt32ToInt64Test =
InstructionSelectorTestWithParam<LoadWithToInt64Extension>;
TEST_P(InstructionSelectorChangeInt32ToInt64Test, ChangeInt32ToInt64WithLoad) {
const LoadWithToInt64Extension extension = GetParam();
StreamBuilder m(this, MachineType::Int64(), MachineType::Pointer());
m.Return(m.ChangeInt32ToInt64(m.Load(extension.type, m.Parameter(0))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(extension.expected_opcode, s[0]->arch_opcode());
}
} // namespace
INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
InstructionSelectorChangeInt32ToInt64Test,
::testing::ValuesIn(kLoadWithToInt64Extensions));
// -----------------------------------------------------------------------------
// Loads and stores
namespace {
struct MemoryAccess {
MachineType type;
ArchOpcode load_opcode;
ArchOpcode store_opcode;
};
std::ostream& operator<<(std::ostream& os, const MemoryAccess& memacc) {
return os << memacc.type;
}
static const MemoryAccess kMemoryAccesses[] = {
{MachineType::Int8(), kX64Movsxbl, kX64Movb},
{MachineType::Uint8(), kX64Movzxbl, kX64Movb},
{MachineType::Int16(), kX64Movsxwl, kX64Movw},
{MachineType::Uint16(), kX64Movzxwl, kX64Movw},
{MachineType::Int32(), kX64Movl, kX64Movl},
{MachineType::Uint32(), kX64Movl, kX64Movl},
{MachineType::Int64(), kX64Movq, kX64Movq},
{MachineType::Uint64(), kX64Movq, kX64Movq},
{MachineType::Float32(), kX64Movss, kX64Movss},
{MachineType::Float64(), kX64Movsd, kX64Movsd}};
// The parameterized test that use the following type are intentionally part
// of the anonymous namespace. The issue here is that the type parameter is
// using a type that is in the anonymous namespace, but the class generated by
// TEST_P is not. This will cause GCC to generate a -Wsubobject-linkage warning.
//
// In this case there will only be single translation unit and the warning
// about subobject-linkage can be avoided by placing the class generated
// by TEST_P in the anoynmous namespace as well.
using InstructionSelectorMemoryAccessTest =
InstructionSelectorTestWithParam<MemoryAccess>;
TEST_P(InstructionSelectorMemoryAccessTest, LoadWithParameters) {
const MemoryAccess memacc = GetParam();
StreamBuilder m(this, memacc.type, MachineType::Pointer(),
MachineType::Int32());
m.Return(m.Load(memacc.type, m.Parameter(0), m.Parameter(1)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(memacc.load_opcode, s[0]->arch_opcode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
TEST_P(InstructionSelectorMemoryAccessTest, StoreWithParameters) {
const MemoryAccess memacc = GetParam();
StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer(),
MachineType::Int32(), memacc.type);
m.Store(memacc.type.representation(), m.Parameter(0), m.Parameter(1),
m.Parameter(2), kNoWriteBarrier);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(memacc.store_opcode, s[0]->arch_opcode());
EXPECT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(0U, s[0]->OutputCount());
}
} // namespace
INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
InstructionSelectorMemoryAccessTest,
::testing::ValuesIn(kMemoryAccesses));
// -----------------------------------------------------------------------------
// ChangeUint32ToUint64.
namespace {
using Constructor = Node* (RawMachineAssembler::*)(Node*, Node*);
struct BinaryOperation {
Constructor constructor;
const char* constructor_name;
};
std::ostream& operator<<(std::ostream& os, const BinaryOperation& bop) {
return os << bop.constructor_name;
}
const BinaryOperation kWord32BinaryOperations[] = {
{&RawMachineAssembler::Word32And, "Word32And"},
{&RawMachineAssembler::Word32Or, "Word32Or"},
{&RawMachineAssembler::Word32Xor, "Word32Xor"},
{&RawMachineAssembler::Word32Shl, "Word32Shl"},
{&RawMachineAssembler::Word32Shr, "Word32Shr"},
{&RawMachineAssembler::Word32Sar, "Word32Sar"},
{&RawMachineAssembler::Word32Ror, "Word32Ror"},
{&RawMachineAssembler::Word32Equal, "Word32Equal"},
{&RawMachineAssembler::Int32Add, "Int32Add"},
{&RawMachineAssembler::Int32Sub, "Int32Sub"},
{&RawMachineAssembler::Int32Mul, "Int32Mul"},
{&RawMachineAssembler::Int32MulHigh, "Int32MulHigh"},
{&RawMachineAssembler::Int32Div, "Int32Div"},
{&RawMachineAssembler::Int32LessThan, "Int32LessThan"},
{&RawMachineAssembler::Int32LessThanOrEqual, "Int32LessThanOrEqual"},
{&RawMachineAssembler::Int32Mod, "Int32Mod"},
{&RawMachineAssembler::Uint32Div, "Uint32Div"},
{&RawMachineAssembler::Uint32LessThan, "Uint32LessThan"},
{&RawMachineAssembler::Uint32LessThanOrEqual, "Uint32LessThanOrEqual"},
{&RawMachineAssembler::Uint32Mod, "Uint32Mod"}};
// The parameterized test that use the following type are intentionally part
// of the anonymous namespace. The issue here is that the type parameter is
// using a type that is in the anonymous namespace, but the class generated by
// TEST_P is not. This will cause GCC to generate a -Wsubobject-linkage warning.
//
// In this case there will only be single translation unit and the warning
// about subobject-linkage can be avoided by placing the class generated
// by TEST_P in the anoynmous namespace as well.
using InstructionSelectorChangeUint32ToUint64Test =
InstructionSelectorTestWithParam<BinaryOperation>;
TEST_P(InstructionSelectorChangeUint32ToUint64Test, ChangeUint32ToUint64) {
const BinaryOperation& bop = GetParam();
StreamBuilder m(this, MachineType::Uint64(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
m.Return(m.ChangeUint32ToUint64((m.*bop.constructor)(p0, p1)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
}
} // namespace
INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
InstructionSelectorChangeUint32ToUint64Test,
::testing::ValuesIn(kWord32BinaryOperations));
// -----------------------------------------------------------------------------
// CanElideChangeUint32ToUint64
namespace {
template <typename T>
struct MachInst {
T constructor;
const char* constructor_name;
ArchOpcode arch_opcode;
MachineType machine_type;
};
using MachInst2 = MachInst<Node* (RawMachineAssembler::*)(Node*, Node*)>;
// X64 instructions that clear the top 32 bits of the destination.
const MachInst2 kCanElideChangeUint32ToUint64[] = {
{&RawMachineAssembler::Word32And, "Word32And", kX64And32,
MachineType::Uint32()},
{&RawMachineAssembler::Word32Or, "Word32Or", kX64Or32,
MachineType::Uint32()},
{&RawMachineAssembler::Word32Xor, "Word32Xor", kX64Xor32,
MachineType::Uint32()},
{&RawMachineAssembler::Word32Shl, "Word32Shl", kX64Shl32,
MachineType::Uint32()},
{&RawMachineAssembler::Word32Shr, "Word32Shr", kX64Shr32,
MachineType::Uint32()},
{&RawMachineAssembler::Word32Sar, "Word32Sar", kX64Sar32,
MachineType::Uint32()},
{&RawMachineAssembler::Word32Ror, "Word32Ror", kX64Ror32,
MachineType::Uint32()},
{&RawMachineAssembler::Word32Equal, "Word32Equal", kX64Cmp32,
MachineType::Uint32()},
{&RawMachineAssembler::Int32Add, "Int32Add", kX64Lea32,
MachineType::Int32()},
{&RawMachineAssembler::Int32Sub, "Int32Sub", kX64Sub32,
MachineType::Int32()},
{&RawMachineAssembler::Int32Mul, "Int32Mul", kX64Imul32,
MachineType::Int32()},
{&RawMachineAssembler::Int32MulHigh, "Int32MulHigh", kX64ImulHigh32,
MachineType::Int32()},
{&RawMachineAssembler::Int32Div, "Int32Div", kX64Idiv32,
MachineType::Int32()},
{&RawMachineAssembler::Int32LessThan, "Int32LessThan", kX64Cmp32,
MachineType::Int32()},
{&RawMachineAssembler::Int32LessThanOrEqual, "Int32LessThanOrEqual",
kX64Cmp32, MachineType::Int32()},
{&RawMachineAssembler::Int32Mod, "Int32Mod", kX64Idiv32,
MachineType::Int32()},
{&RawMachineAssembler::Uint32Div, "Uint32Div", kX64Udiv32,
MachineType::Uint32()},
{&RawMachineAssembler::Uint32LessThan, "Uint32LessThan", kX64Cmp32,
MachineType::Uint32()},
{&RawMachineAssembler::Uint32LessThanOrEqual, "Uint32LessThanOrEqual",
kX64Cmp32, MachineType::Uint32()},
{&RawMachineAssembler::Uint32Mod, "Uint32Mod", kX64Udiv32,
MachineType::Uint32()},
};
// The parameterized test that use the following type are intentionally part
// of the anonymous namespace. The issue here is that the type parameter is
// using a type that is in the anonymous namespace, but the class generated by
// TEST_P is not. This will cause GCC to generate a -Wsubobject-linkage warning.
//
// In this case there will only be single translation unit and the warning
// about subobject-linkage can be avoided by placing the class generated
// by TEST_P in the anoynmous namespace as well.
using InstructionSelectorElidedChangeUint32ToUint64Test =
InstructionSelectorTestWithParam<MachInst2>;
TEST_P(InstructionSelectorElidedChangeUint32ToUint64Test, Parameter) {
const MachInst2 binop = GetParam();
StreamBuilder m(this, MachineType::Uint64(), binop.machine_type,
binop.machine_type);
m.Return(m.ChangeUint32ToUint64(
(m.*binop.constructor)(m.Parameter(0), m.Parameter(1))));
Stream s = m.Build();
// Make sure the `ChangeUint32ToUint64` node turned into a no-op.
ASSERT_EQ(1U, s.size());
EXPECT_EQ(binop.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
} // namespace
INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
InstructionSelectorElidedChangeUint32ToUint64Test,
::testing::ValuesIn(kCanElideChangeUint32ToUint64));
// ChangeUint32ToUint64AfterLoad
TEST_F(InstructionSelectorTest, ChangeUint32ToUint64AfterLoad) {
// For each case, make sure the `ChangeUint32ToUint64` node turned into a
// no-op.
// movzxbl
{
StreamBuilder m(this, MachineType::Uint64(), MachineType::Pointer(),
MachineType::Int32());
m.Return(m.ChangeUint32ToUint64(
m.Load(MachineType::Uint8(), m.Parameter(0), m.Parameter(1))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Movzxbl, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR1, s[0]->addressing_mode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
// movsxbl
{
StreamBuilder m(this, MachineType::Uint64(), MachineType::Pointer(),
MachineType::Int32());
m.Return(m.ChangeUint32ToUint64(
m.Load(MachineType::Int8(), m.Parameter(0), m.Parameter(1))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Movsxbl, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR1, s[0]->addressing_mode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
// movzxwl
{
StreamBuilder m(this, MachineType::Uint64(), MachineType::Pointer(),
MachineType::Int32());
m.Return(m.ChangeUint32ToUint64(
m.Load(MachineType::Uint16(), m.Parameter(0), m.Parameter(1))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Movzxwl, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR1, s[0]->addressing_mode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
// movsxwl
{
StreamBuilder m(this, MachineType::Uint64(), MachineType::Pointer(),
MachineType::Int32());
m.Return(m.ChangeUint32ToUint64(
m.Load(MachineType::Int16(), m.Parameter(0), m.Parameter(1))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Movsxwl, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR1, s[0]->addressing_mode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
// -----------------------------------------------------------------------------
// TruncateInt64ToInt32.
TEST_F(InstructionSelectorTest, TruncateInt64ToInt32WithWord64Sar) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int64());
Node* const p = m.Parameter(0);
Node* const t = m.TruncateInt64ToInt32(m.Word64Sar(p, m.Int64Constant(32)));
m.Return(t);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Shr, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(32, s.ToInt32(s[0]->InputAt(1)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_TRUE(s.IsSameAsFirst(s[0]->OutputAt(0)));
EXPECT_EQ(s.ToVreg(t), s.ToVreg(s[0]->OutputAt(0)));
}
TEST_F(InstructionSelectorTest, TruncateInt64ToInt32WithWord64Shr) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int64());
Node* const p = m.Parameter(0);
Node* const t = m.TruncateInt64ToInt32(m.Word64Shr(p, m.Int64Constant(32)));
m.Return(t);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Shr, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(32, s.ToInt32(s[0]->InputAt(1)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_TRUE(s.IsSameAsFirst(s[0]->OutputAt(0)));
EXPECT_EQ(s.ToVreg(t), s.ToVreg(s[0]->OutputAt(0)));
}
// -----------------------------------------------------------------------------
// Addition.
TEST_F(InstructionSelectorTest, Int32AddWithInt32ParametersLea) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const a0 = m.Int32Add(p0, p1);
// Additional uses of input to add chooses lea
Node* const a1 = m.Int32Div(p0, p1);
m.Return(m.Int32Div(a0, a1));
Stream s = m.Build();
ASSERT_EQ(3U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
}
TEST_F(InstructionSelectorTest, Int32AddConstantAsLeaSingle) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const c0 = m.Int32Constant(15);
// If one of the add's operands is only used once, use an "leal", even though
// an "addl" could be used. The "leal" has proven faster--out best guess is
// that it gives the register allocation more freedom and it doesn't set
// flags, reducing pressure in the CPU's pipeline. If we're lucky with
// register allocation, then code generation will select an "addl" later for
// the cases that have been measured to be faster.
Node* const v0 = m.Int32Add(p0, c0);
m.Return(v0);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MRI, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate());
}
TEST_F(InstructionSelectorTest, Int32AddConstantAsAdd) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const c0 = m.Int32Constant(1);
// If there is only a single use of an add's input and the immediate constant
// for the add is 1, don't use an inc. It is much slower on modern Intel
// architectures.
m.Return(m.Int32Add(p0, c0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MRI, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate());
}
TEST_F(InstructionSelectorTest, Int32AddConstantAsLeaDouble) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const c0 = m.Int32Constant(15);
// A second use of an add's input uses lea
Node* const a0 = m.Int32Add(p0, c0);
m.Return(m.Int32Div(a0, p0));
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MRI, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate());
}
TEST_F(InstructionSelectorTest, Int32AddCommutedConstantAsLeaSingle) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const c0 = m.Int32Constant(15);
// If one of the add's operands is only used once, use an "leal", even though
// an "addl" could be used. The "leal" has proven faster--out best guess is
// that it gives the register allocation more freedom and it doesn't set
// flags, reducing pressure in the CPU's pipeline. If we're lucky with
// register allocation, then code generation will select an "addl" later for
// the cases that have been measured to be faster.
m.Return(m.Int32Add(c0, p0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MRI, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate());
}
TEST_F(InstructionSelectorTest, Int32AddCommutedConstantAsLeaDouble) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const c0 = m.Int32Constant(15);
// A second use of an add's input uses lea
Node* const a0 = m.Int32Add(c0, p0);
USE(a0);
m.Return(m.Int32Div(a0, p0));
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MRI, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate());
}
TEST_F(InstructionSelectorTest, Int32AddSimpleAsAdd) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
// If one of the add's operands is only used once, use an "leal", even though
// an "addl" could be used. The "leal" has proven faster--out best guess is
// that it gives the register allocation more freedom and it doesn't set
// flags, reducing pressure in the CPU's pipeline. If we're lucky with
// register allocation, then code generation will select an "addl" later for
// the cases that have been measured to be faster.
m.Return(m.Int32Add(p0, p1));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR1, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
}
TEST_F(InstructionSelectorTest, Int32AddSimpleAsLea) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
// If all of of the add's operands are used multiple times, use an "leal".
Node* const v1 = m.Int32Add(p0, p1);
m.Return(m.Int32Add(m.Int32Add(v1, p1), p0));
Stream s = m.Build();
ASSERT_EQ(3U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR1, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
}
TEST_F(InstructionSelectorTest, Int32AddScaled2Mul) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const s0 = m.Int32Mul(p1, m.Int32Constant(2));
m.Return(m.Int32Add(p0, s0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR2, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
}
TEST_F(InstructionSelectorTest, Int32AddCommutedScaled2Mul) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const s0 = m.Int32Mul(p1, m.Int32Constant(2));
m.Return(m.Int32Add(s0, p0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR2, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
}
TEST_F(InstructionSelectorTest, Int32AddScaled2Shl) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const s0 = m.Word32Shl(p1, m.Int32Constant(1));
m.Return(m.Int32Add(p0, s0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR2, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
}
TEST_F(InstructionSelectorTest, Int32AddCommutedScaled2Shl) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const s0 = m.Word32Shl(p1, m.Int32Constant(1));
m.Return(m.Int32Add(s0, p0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR2, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
}
TEST_F(InstructionSelectorTest, Int32AddScaled4Mul) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const s0 = m.Int32Mul(p1, m.Int32Constant(4));
m.Return(m.Int32Add(p0, s0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR4, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
}
TEST_F(InstructionSelectorTest, Int32AddScaled4Shl) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const s0 = m.Word32Shl(p1, m.Int32Constant(2));
m.Return(m.Int32Add(p0, s0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR4, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
}
TEST_F(InstructionSelectorTest, Int32AddScaled8Mul) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const s0 = m.Int32Mul(p1, m.Int32Constant(8));
m.Return(m.Int32Add(p0, s0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR8, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
}
TEST_F(InstructionSelectorTest, Int32AddScaled8Shl) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const s0 = m.Word32Shl(p1, m.Int32Constant(3));
m.Return(m.Int32Add(p0, s0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR8, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
}
TEST_F(InstructionSelectorTest, Int32AddScaled2MulWithConstant) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const s0 = m.Int32Mul(p1, m.Int32Constant(2));
Node* const c0 = m.Int32Constant(15);
m.Return(m.Int32Add(c0, m.Int32Add(p0, s0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR2I, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_TRUE(s[0]->InputAt(2)->IsImmediate());
}
TEST_F(InstructionSelectorTest, Int32AddScaled2MulWithConstantShuffle1) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const s0 = m.Int32Mul(p1, m.Int32Constant(2));
Node* const c0 = m.Int32Constant(15);
m.Return(m.Int32Add(p0, m.Int32Add(s0, c0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR2I, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_TRUE(s[0]->InputAt(2)->IsImmediate());
}
TEST_F(InstructionSelectorTest, Int32AddScaled2MulWithConstantShuffle2) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const s0 = m.Int32Mul(p1, m.Int32Constant(2));
Node* const c0 = m.Int32Constant(15);
m.Return(m.Int32Add(s0, m.Int32Add(c0, p0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR2I, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_TRUE(s[0]->InputAt(2)->IsImmediate());
}
TEST_F(InstructionSelectorTest, Int32AddScaled2MulWithConstantShuffle3) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const s0 = m.Int32Mul(p1, m.Int32Constant(2));
Node* const c0 = m.Int32Constant(15);
m.Return(m.Int32Add(m.Int32Add(s0, c0), p0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR2I, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_TRUE(s[0]->InputAt(2)->IsImmediate());
}
TEST_F(InstructionSelectorTest, Int32AddScaled2MulWithConstantShuffle4) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const s0 = m.Int32Mul(p1, m.Int32Constant(2));
Node* const c0 = m.Int32Constant(15);
m.Return(m.Int32Add(m.Int32Add(c0, p0), s0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR2I, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_TRUE(s[0]->InputAt(2)->IsImmediate());
}
TEST_F(InstructionSelectorTest, Int32AddScaled2MulWithConstantShuffle5) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const s0 = m.Int32Mul(p1, m.Int32Constant(2));
Node* const c0 = m.Int32Constant(15);
m.Return(m.Int32Add(m.Int32Add(p0, s0), c0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR2I, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_TRUE(s[0]->InputAt(2)->IsImmediate());
}
TEST_F(InstructionSelectorTest, Int32AddScaled2ShlWithConstant) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const s0 = m.Word32Shl(p1, m.Int32Constant(1));
Node* const c0 = m.Int32Constant(15);
m.Return(m.Int32Add(c0, m.Int32Add(p0, s0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR2I, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_TRUE(s[0]->InputAt(2)->IsImmediate());
}
TEST_F(InstructionSelectorTest, Int32AddScaled4MulWithConstant) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const s0 = m.Int32Mul(p1, m.Int32Constant(4));
Node* const c0 = m.Int32Constant(15);
m.Return(m.Int32Add(c0, m.Int32Add(p0, s0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR4I, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_TRUE(s[0]->InputAt(2)->IsImmediate());
}
TEST_F(InstructionSelectorTest, Int32AddScaled4ShlWithConstant) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const s0 = m.Word32Shl(p1, m.Int32Constant(2));
Node* const c0 = m.Int32Constant(15);
m.Return(m.Int32Add(c0, m.Int32Add(p0, s0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR4I, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_TRUE(s[0]->InputAt(2)->IsImmediate());
}
TEST_F(InstructionSelectorTest, Int32AddScaled8MulWithConstant) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const s0 = m.Int32Mul(p1, m.Int32Constant(8));
Node* const c0 = m.Int32Constant(15);
m.Return(m.Int32Add(c0, m.Int32Add(p0, s0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR8I, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_TRUE(s[0]->InputAt(2)->IsImmediate());
}
TEST_F(InstructionSelectorTest, Int32AddScaled8ShlWithConstant) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const s0 = m.Word32Shl(p1, m.Int32Constant(3));
Node* const c0 = m.Int32Constant(15);
m.Return(m.Int32Add(c0, m.Int32Add(p0, s0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR8I, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_TRUE(s[0]->InputAt(2)->IsImmediate());
}
TEST_F(InstructionSelectorTest, Int32SubConstantAsSub) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const c0 = m.Int32Constant(-1);
// If there is only a single use of on of the sub's non-constant input, use a
// "subl" instruction.
m.Return(m.Int32Sub(p0, c0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MRI, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate());
}
TEST_F(InstructionSelectorTest, Int32SubConstantAsLea) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const c0 = m.Int32Constant(-1);
// If there are multiple uses of on of the sub's non-constant input, use a
// "leal" instruction.
Node* const v0 = m.Int32Sub(p0, c0);
m.Return(m.Int32Div(p0, v0));
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MRI, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate());
}
TEST_F(InstructionSelectorTest, Int32AddScaled2Other) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32(), MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const p2 = m.Parameter(2);
Node* const s0 = m.Int32Mul(p1, m.Int32Constant(2));
Node* const a0 = m.Int32Add(s0, p2);
Node* const a1 = m.Int32Add(p0, a0);
m.Return(a1);
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR2, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p2), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(s.ToVreg(a0), s.ToVreg(s[0]->OutputAt(0)));
ASSERT_EQ(2U, s[1]->InputCount());
EXPECT_EQ(kX64Lea32, s[1]->arch_opcode());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[1]->InputAt(0)));
EXPECT_EQ(s.ToVreg(a0), s.ToVreg(s[1]->InputAt(1)));
EXPECT_EQ(s.ToVreg(a1), s.ToVreg(s[1]->OutputAt(0)));
}
TEST_F(InstructionSelectorTest, Int32AddMinNegativeDisplacement) {
// This test case is simplified from a Wasm fuzz test in
// https://crbug.com/1091892. The key here is that we match on a
// sequence like: Int32Add(Int32Sub(-524288, -2147483648), -26048), which
// matches on an EmitLea, with -2147483648 as the displacement. Since we
// have a Int32Sub node, it sets kNegativeDisplacement, and later we try to
// negate -2147483648, which overflows.
StreamBuilder m(this, MachineType::Int32());
Node* const c0 = m.Int32Constant(-524288);
Node* const c1 = m.Int32Constant(std::numeric_limits<int32_t>::min());
Node* const c2 = m.Int32Constant(-26048);
Node* const a0 = m.Int32Sub(c0, c1);
Node* const a1 = m.Int32Add(a0, c2);
m.Return(a1);
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kX64Sub32, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(kMode_None, s[0]->addressing_mode());
EXPECT_EQ(s.ToVreg(c0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(c1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(s.ToVreg(a0), s.ToVreg(s[0]->OutputAt(0)));
EXPECT_EQ(kX64Add32, s[1]->arch_opcode());
ASSERT_EQ(2U, s[1]->InputCount());
EXPECT_EQ(kMode_None, s[1]->addressing_mode());
EXPECT_EQ(s.ToVreg(a0), s.ToVreg(s[1]->InputAt(0)));
EXPECT_TRUE(s[1]->InputAt(1)->IsImmediate());
EXPECT_EQ(s.ToVreg(a1), s.ToVreg(s[1]->OutputAt(0)));
}
// -----------------------------------------------------------------------------
// Multiplication.
TEST_F(InstructionSelectorTest, Int32MulWithInt32MulWithParameters) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const m0 = m.Int32Mul(p0, p1);
m.Return(m.Int32Mul(m0, p0));
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kX64Imul32, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(1)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(s.ToVreg(m0), s.ToVreg(s[0]->OutputAt(0)));
EXPECT_EQ(kX64Imul32, s[1]->arch_opcode());
ASSERT_EQ(2U, s[1]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[1]->InputAt(0)));
EXPECT_EQ(s.ToVreg(m0), s.ToVreg(s[1]->InputAt(1)));
}
TEST_F(InstructionSelectorTest, Int32MulHigh) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const n = m.Int32MulHigh(p0, p1);
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64ImulHigh32, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_TRUE(s.IsFixed(s[0]->InputAt(0), rax));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_TRUE(!s.IsUsedAtStart(s[0]->InputAt(1)));
ASSERT_LE(1U, s[0]->OutputCount());
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
EXPECT_TRUE(s.IsFixed(s[0]->OutputAt(0), rdx));
}
TEST_F(InstructionSelectorTest, Uint32MulHigh) {
StreamBuilder m(this, MachineType::Uint32(), MachineType::Uint32(),
MachineType::Uint32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const n = m.Uint32MulHigh(p0, p1);
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64UmulHigh32, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_TRUE(s.IsFixed(s[0]->InputAt(0), rax));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_TRUE(!s.IsUsedAtStart(s[0]->InputAt(1)));
ASSERT_LE(1U, s[0]->OutputCount());
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
EXPECT_TRUE(s.IsFixed(s[0]->OutputAt(0), rdx));
}
TEST_F(InstructionSelectorTest, Int32Mul2BecomesLea) {
StreamBuilder m(this, MachineType::Uint32(), MachineType::Uint32(),
MachineType::Uint32());
Node* const p0 = m.Parameter(0);
Node* const c1 = m.Int32Constant(2);
Node* const n = m.Int32Mul(p0, c1);
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR1, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(1)));
}
TEST_F(InstructionSelectorTest, Int32Mul3BecomesLea) {
StreamBuilder m(this, MachineType::Uint32(), MachineType::Uint32(),
MachineType::Uint32());
Node* const p0 = m.Parameter(0);
Node* const c1 = m.Int32Constant(3);
Node* const n = m.Int32Mul(p0, c1);
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR2, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(1)));
}
TEST_F(InstructionSelectorTest, Int32Mul4BecomesLea) {
StreamBuilder m(this, MachineType::Uint32(), MachineType::Uint32(),
MachineType::Uint32());
Node* const p0 = m.Parameter(0);
Node* const c1 = m.Int32Constant(4);
Node* const n = m.Int32Mul(p0, c1);
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_M4, s[0]->addressing_mode());
ASSERT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
}
TEST_F(InstructionSelectorTest, Int32Mul5BecomesLea) {
StreamBuilder m(this, MachineType::Uint32(), MachineType::Uint32(),
MachineType::Uint32());
Node* const p0 = m.Parameter(0);
Node* const c1 = m.Int32Constant(5);
Node* const n = m.Int32Mul(p0, c1);
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR4, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(1)));
}
TEST_F(InstructionSelectorTest, Int32Mul8BecomesLea) {
StreamBuilder m(this, MachineType::Uint32(), MachineType::Uint32(),
MachineType::Uint32());
Node* const p0 = m.Parameter(0);
Node* const c1 = m.Int32Constant(8);
Node* const n = m.Int32Mul(p0, c1);
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_M8, s[0]->addressing_mode());
ASSERT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
}
TEST_F(InstructionSelectorTest, Int32Mul9BecomesLea) {
StreamBuilder m(this, MachineType::Uint32(), MachineType::Uint32(),
MachineType::Uint32());
Node* const p0 = m.Parameter(0);
Node* const c1 = m.Int32Constant(9);
Node* const n = m.Int32Mul(p0, c1);
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR8, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(1)));
}
// -----------------------------------------------------------------------------
// Word32Shl.
TEST_F(InstructionSelectorTest, Int32Shl1BecomesLea) {
StreamBuilder m(this, MachineType::Uint32(), MachineType::Uint32(),
MachineType::Uint32());
Node* const p0 = m.Parameter(0);
Node* const c1 = m.Int32Constant(1);
Node* const n = m.Word32Shl(p0, c1);
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR1, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(1)));
}
TEST_F(InstructionSelectorTest, Int32Shl2BecomesLea) {
StreamBuilder m(this, MachineType::Uint32(), MachineType::Uint32(),
MachineType::Uint32());
Node* const p0 = m.Parameter(0);
Node* const c1 = m.Int32Constant(2);
Node* const n = m.Word32Shl(p0, c1);
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_M4, s[0]->addressing_mode());
ASSERT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
}
TEST_F(InstructionSelectorTest, Int32Shl4BecomesLea) {
StreamBuilder m(this, MachineType::Uint32(), MachineType::Uint32(),
MachineType::Uint32());
Node* const p0 = m.Parameter(0);
Node* const c1 = m.Int32Constant(3);
Node* const n = m.Word32Shl(p0, c1);
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
EXPECT_EQ(kMode_M8, s[0]->addressing_mode());
ASSERT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
}
// -----------------------------------------------------------------------------
// Binops with a memory operand.
TEST_F(InstructionSelectorTest, LoadCmp32) {
{
// Word32Equal(Load[Int8](p0, p1), Int32Constant(0)) -> cmpb [p0,p1], 0
StreamBuilder m(this, MachineType::Int32(), MachineType::Int64(),
MachineType::Int64());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
m.Return(
m.Word32Equal(m.Load(MachineType::Int8(), p0, p1), m.Int32Constant(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Cmp8, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR1, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_TRUE(s[0]->InputAt(2)->IsImmediate());
}
{
// Word32Equal(Load[Uint8](p0, p1), Int32Constant(0)) -> cmpb [p0,p1], 0
StreamBuilder m(this, MachineType::Int32(), MachineType::Int64(),
MachineType::Int64());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
m.Return(m.Word32Equal(m.Load(MachineType::Uint8(), p0, p1),
m.Int32Constant(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Cmp8, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR1, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_TRUE(s[0]->InputAt(2)->IsImmediate());
}
{
// Word32Equal(Load[Int16](p0, p1), Int32Constant(0)) -> cmpw [p0,p1], 0
StreamBuilder m(this, MachineType::Int32(), MachineType::Int64(),
MachineType::Int64());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
m.Return(m.Word32Equal(m.Load(MachineType::Int16(), p0, p1),
m.Int32Constant(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Cmp16, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR1, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_TRUE(s[0]->InputAt(2)->IsImmediate());
}
{
// Word32Equal(Load[Uint16](p0, p1), Int32Constant(0)) -> cmpw [p0,p1], 0
StreamBuilder m(this, MachineType::Int32(), MachineType::Int64(),
MachineType::Int64());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
m.Return(m.Word32Equal(m.Load(MachineType::Uint16(), p0, p1),
m.Int32Constant(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Cmp16, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR1, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_TRUE(s[0]->InputAt(2)->IsImmediate());
}
{
// Word32Equal(Load[Int32](p0, p1), Int32Constant(0)) -> cmpl [p0,p1], 0
StreamBuilder m(this, MachineType::Int32(), MachineType::Int64(),
MachineType::Int64());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
m.Return(m.Word32Equal(m.Load(MachineType::Int32(), p0, p1),
m.Int32Constant(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Cmp32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR1, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_TRUE(s[0]->InputAt(2)->IsImmediate());
}
{
// Word32Equal(Load[Uint32](p0, p1), Int32Constant(0)) -> cmpl [p0,p1], 0
StreamBuilder m(this, MachineType::Int32(), MachineType::Int64(),
MachineType::Int64());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
m.Return(m.Word32Equal(m.Load(MachineType::Uint32(), p0, p1),
m.Int32Constant(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Cmp32, s[0]->arch_opcode());
EXPECT_EQ(kMode_MR1, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_TRUE(s[0]->InputAt(2)->IsImmediate());
}
}
TEST_F(InstructionSelectorTest, LoadAnd32) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
m.Return(
m.Word32And(p0, m.Load(MachineType::Int32(), p1, m.Int32Constant(127))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64And32, s[0]->arch_opcode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
}
TEST_F(InstructionSelectorTest, LoadOr32) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
m.Return(
m.Word32Or(p0, m.Load(MachineType::Int32(), p1, m.Int32Constant(127))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Or32, s[0]->arch_opcode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
}
TEST_F(InstructionSelectorTest, LoadXor32) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
m.Return(
m.Word32Xor(p0, m.Load(MachineType::Int32(), p1, m.Int32Constant(127))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Xor32, s[0]->arch_opcode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
}
TEST_F(InstructionSelectorTest, LoadAdd32) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
m.Return(
m.Int32Add(p0, m.Load(MachineType::Int32(), p1, m.Int32Constant(127))));
Stream s = m.Build();
// Use lea instead of add, so memory operand is invalid.
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kX64Movl, s[0]->arch_opcode());
EXPECT_EQ(kX64Lea32, s[1]->arch_opcode());
}
TEST_F(InstructionSelectorTest, LoadSub32) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
m.Return(
m.Int32Sub(p0, m.Load(MachineType::Int32(), p1, m.Int32Constant(127))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Sub32, s[0]->arch_opcode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
}
TEST_F(InstructionSelectorTest, LoadAnd64) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(),
MachineType::Int64());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
m.Return(
m.Word64And(p0, m.Load(MachineType::Int64(), p1, m.Int32Constant(127))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64And, s[0]->arch_opcode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
}
TEST_F(InstructionSelectorTest, LoadOr64) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(),
MachineType::Int64());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
m.Return(
m.Word64Or(p0, m.Load(MachineType::Int64(), p1, m.Int32Constant(127))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Or, s[0]->arch_opcode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
}
TEST_F(InstructionSelectorTest, LoadXor64) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(),
MachineType::Int64());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
m.Return(
m.Word64Xor(p0, m.Load(MachineType::Int64(), p1, m.Int32Constant(127))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Xor, s[0]->arch_opcode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
}
TEST_F(InstructionSelectorTest, LoadAdd64) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(),
MachineType::Int64());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
m.Return(
m.Int64Add(p0, m.Load(MachineType::Int64(), p1, m.Int32Constant(127))));
Stream s = m.Build();
// Use lea instead of add, so memory operand is invalid.
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kX64Movq, s[0]->arch_opcode());
EXPECT_EQ(kX64Lea, s[1]->arch_opcode());
}
TEST_F(InstructionSelectorTest, LoadSub64) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(),
MachineType::Int64());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
m.Return(
m.Int64Sub(p0, m.Load(MachineType::Int64(), p1, m.Int32Constant(127))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Sub, s[0]->arch_opcode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
}
// -----------------------------------------------------------------------------
// Floating point operations.
TEST_F(InstructionSelectorTest, Float32Abs) {
{
StreamBuilder m(this, MachineType::Float32(), MachineType::Float32());
Node* const p0 = m.Parameter(0);
Node* const n = m.Float32Abs(p0);
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kSSEFloat32Abs, s[0]->arch_opcode());
ASSERT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_TRUE(s.IsSameAsFirst(s[0]->Output()));
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
EXPECT_EQ(kFlags_none, s[0]->flags_mode());
}
{
StreamBuilder m(this, MachineType::Float32(), MachineType::Float32());
Node* const p0 = m.Parameter(0);
Node* const n = m.Float32Abs(p0);
m.Return(n);
Stream s = m.Build(AVX);
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kAVXFloat32Abs, s[0]->arch_opcode());
ASSERT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
EXPECT_EQ(kFlags_none, s[0]->flags_mode());
}
}
TEST_F(InstructionSelectorTest, Float64Abs) {
{
StreamBuilder m(this, MachineType::Float64(), MachineType::Float64());
Node* const p0 = m.Parameter(0);
Node* const n = m.Float64Abs(p0);
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kSSEFloat64Abs, s[0]->arch_opcode());
ASSERT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_TRUE(s.IsSameAsFirst(s[0]->Output()));
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
EXPECT_EQ(kFlags_none, s[0]->flags_mode());
}
{
StreamBuilder m(this, MachineType::Float64(), MachineType::Float64());
Node* const p0 = m.Parameter(0);
Node* const n = m.Float64Abs(p0);
m.Return(n);
Stream s = m.Build(AVX);
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kAVXFloat64Abs, s[0]->arch_opcode());
ASSERT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
EXPECT_EQ(kFlags_none, s[0]->flags_mode());
}
}
TEST_F(InstructionSelectorTest, Float64BinopArithmetic) {
{
StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(),
MachineType::Float64());
Node* add = m.Float64Add(m.Parameter(0), m.Parameter(1));
Node* mul = m.Float64Mul(add, m.Parameter(1));
Node* sub = m.Float64Sub(mul, add);
Node* ret = m.Float64Div(mul, sub);
m.Return(ret);
Stream s = m.Build(AVX);
ASSERT_EQ(4U, s.size());
EXPECT_EQ(kAVXFloat64Add, s[0]->arch_opcode());
EXPECT_EQ(kAVXFloat64Mul, s[1]->arch_opcode());
EXPECT_EQ(kAVXFloat64Sub, s[2]->arch_opcode());
EXPECT_EQ(kAVXFloat64Div, s[3]->arch_opcode());
}
{
StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(),
MachineType::Float64());
Node* add = m.Float64Add(m.Parameter(0), m.Parameter(1));
Node* mul = m.Float64Mul(add, m.Parameter(1));
Node* sub = m.Float64Sub(mul, add);
Node* ret = m.Float64Div(mul, sub);
m.Return(ret);
Stream s = m.Build();
ASSERT_EQ(4U, s.size());
EXPECT_EQ(kSSEFloat64Add, s[0]->arch_opcode());
EXPECT_EQ(kSSEFloat64Mul, s[1]->arch_opcode());
EXPECT_EQ(kSSEFloat64Sub, s[2]->arch_opcode());
EXPECT_EQ(kSSEFloat64Div, s[3]->arch_opcode());
}
}
TEST_F(InstructionSelectorTest, Float32BinopArithmeticWithLoad) {
{
StreamBuilder m(this, MachineType::Float32(), MachineType::Float32(),
MachineType::Int64(), MachineType::Int64());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const p2 = m.Parameter(2);
Node* add = m.Float32Add(
p0, m.Load(MachineType::Float32(), p1, m.Int32Constant(127)));
Node* sub = m.Float32Sub(
add, m.Load(MachineType::Float32(), p1, m.Int32Constant(127)));
Node* ret = m.Float32Mul(
m.Load(MachineType::Float32(), p2, m.Int32Constant(127)), sub);
m.Return(ret);
Stream s = m.Build(AVX);
ASSERT_EQ(3U, s.size());
EXPECT_EQ(kAVXFloat32Add, s[0]->arch_opcode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(kAVXFloat32Sub, s[1]->arch_opcode());
ASSERT_EQ(3U, s[1]->InputCount());
EXPECT_EQ(kAVXFloat32Mul, s[2]->arch_opcode());
ASSERT_EQ(3U, s[2]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(s.ToVreg(p2), s.ToVreg(s[2]->InputAt(1)));
}
{
StreamBuilder m(this, MachineType::Float32(), MachineType::Float32(),
MachineType::Int64(), MachineType::Int64());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const p2 = m.Parameter(2);
Node* add = m.Float32Add(
p0, m.Load(MachineType::Float32(), p1, m.Int32Constant(127)));
Node* sub = m.Float32Sub(
add, m.Load(MachineType::Float32(), p1, m.Int32Constant(127)));
Node* ret = m.Float32Mul(
m.Load(MachineType::Float32(), p2, m.Int32Constant(127)), sub);
m.Return(ret);
Stream s = m.Build();
ASSERT_EQ(3U, s.size());
EXPECT_EQ(kSSEFloat32Add, s[0]->arch_opcode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(kSSEFloat32Sub, s[1]->arch_opcode());
ASSERT_EQ(3U, s[1]->InputCount());
EXPECT_EQ(kSSEFloat32Mul, s[2]->arch_opcode());
ASSERT_EQ(3U, s[2]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(s.ToVreg(p2), s.ToVreg(s[2]->InputAt(1)));
}
}
TEST_F(InstructionSelectorTest, Float64BinopArithmeticWithLoad) {
{
StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(),
MachineType::Int64(), MachineType::Int64());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const p2 = m.Parameter(2);
Node* add = m.Float64Add(
p0, m.Load(MachineType::Float64(), p1, m.Int32Constant(127)));
Node* sub = m.Float64Sub(
add, m.Load(MachineType::Float64(), p1, m.Int32Constant(127)));
Node* ret = m.Float64Mul(
m.Load(MachineType::Float64(), p2, m.Int32Constant(127)), sub);
m.Return(ret);
Stream s = m.Build(AVX);
ASSERT_EQ(3U, s.size());
EXPECT_EQ(kAVXFloat64Add, s[0]->arch_opcode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(kAVXFloat64Sub, s[1]->arch_opcode());
ASSERT_EQ(3U, s[1]->InputCount());
EXPECT_EQ(kAVXFloat64Mul, s[2]->arch_opcode());
ASSERT_EQ(3U, s[2]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(s.ToVreg(p2), s.ToVreg(s[2]->InputAt(1)));
}
{
StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(),
MachineType::Int64(), MachineType::Int64());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const p2 = m.Parameter(2);
Node* add = m.Float64Add(
p0, m.Load(MachineType::Float64(), p1, m.Int32Constant(127)));
Node* sub = m.Float64Sub(
add, m.Load(MachineType::Float64(), p1, m.Int32Constant(127)));
Node* ret = m.Float64Mul(
m.Load(MachineType::Float64(), p2, m.Int32Constant(127)), sub);
m.Return(ret);
Stream s = m.Build();
ASSERT_EQ(3U, s.size());
EXPECT_EQ(kSSEFloat64Add, s[0]->arch_opcode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(kSSEFloat64Sub, s[1]->arch_opcode());
ASSERT_EQ(3U, s[1]->InputCount());
EXPECT_EQ(kSSEFloat64Mul, s[2]->arch_opcode());
ASSERT_EQ(3U, s[2]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(s.ToVreg(p2), s.ToVreg(s[2]->InputAt(1)));
}
}
// -----------------------------------------------------------------------------
// Miscellaneous.
TEST_F(InstructionSelectorTest, Word64ShlWithChangeInt32ToInt64) {
TRACED_FORRANGE(int64_t, x, 32, 63) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const n = m.Word64Shl(m.ChangeInt32ToInt64(p0), m.Int64Constant(x));
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Shl, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(x, s.ToInt32(s[0]->InputAt(1)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_TRUE(s.IsSameAsFirst(s[0]->Output()));
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
}
}
TEST_F(InstructionSelectorTest, Word64ShlWithChangeUint32ToUint64) {
TRACED_FORRANGE(int64_t, x, 32, 63) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Uint32());
Node* const p0 = m.Parameter(0);
Node* const n = m.Word64Shl(m.ChangeUint32ToUint64(p0), m.Int64Constant(x));
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Shl, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(x, s.ToInt32(s[0]->InputAt(1)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_TRUE(s.IsSameAsFirst(s[0]->Output()));
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
}
}
TEST_F(InstructionSelectorTest, Word32AndWith0xFF) {
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const n = m.Word32And(p0, m.Int32Constant(0xFF));
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Movzxbl, s[0]->arch_opcode());
ASSERT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
}
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const n = m.Word32And(m.Int32Constant(0xFF), p0);
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Movzxbl, s[0]->arch_opcode());
ASSERT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
}
}
TEST_F(InstructionSelectorTest, Word32AndWith0xFFFF) {
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const n = m.Word32And(p0, m.Int32Constant(0xFFFF));
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Movzxwl, s[0]->arch_opcode());
ASSERT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
}
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const n = m.Word32And(m.Int32Constant(0xFFFF), p0);
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Movzxwl, s[0]->arch_opcode());
ASSERT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
}
}
TEST_F(InstructionSelectorTest, Word32Clz) {
StreamBuilder m(this, MachineType::Uint32(), MachineType::Uint32());
Node* const p0 = m.Parameter(0);
Node* const n = m.Word32Clz(p0);
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Lzcnt32, s[0]->arch_opcode());
ASSERT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
}
TEST_F(InstructionSelectorTest, LoadAndWord64ShiftRight32) {
{
StreamBuilder m(this, MachineType::Uint64(), MachineType::Uint32());
Node* const p0 = m.Parameter(0);
Node* const load = m.Load(MachineType::Uint64(), p0);
Node* const shift = m.Word64Shr(load, m.Int32Constant(32));
m.Return(shift);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Movl, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(4, s.ToInt32(s[0]->InputAt(1)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(s.ToVreg(shift), s.ToVreg(s[0]->Output()));
}
{
StreamBuilder m(this, MachineType::Int64(), MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const load = m.Load(MachineType::Int64(), p0);
Node* const shift = m.Word64Sar(load, m.Int32Constant(32));
m.Return(shift);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Movsxlq, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(4, s.ToInt32(s[0]->InputAt(1)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(s.ToVreg(shift), s.ToVreg(s[0]->Output()));
}
{
StreamBuilder m(this, MachineType::Int64(), MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const load = m.Load(MachineType::Int64(), p0);
Node* const shift = m.Word64Sar(load, m.Int32Constant(32));
Node* const truncate = m.TruncateInt64ToInt32(shift);
m.Return(truncate);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Movl, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(4, s.ToInt32(s[0]->InputAt(1)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(s.ToVreg(shift), s.ToVreg(s[0]->Output()));
}
}
// -----------------------------------------------------------------------------
// SIMD.
TEST_F(InstructionSelectorTest, SIMDSplatZero) {
// Test optimization for splat of contant 0.
// {i8x16,i16x8,i32x4,i64x2}.splat(const(0)) -> v128.zero().
// Optimizations for f32x4.splat and f64x2.splat not implemented since it
// doesn't improve the codegen as much (same number of instructions).
{
StreamBuilder m(this, MachineType::Simd128());
Node* const splat = m.I64x2Splat(m.Int64Constant(0));
m.Return(splat);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64S128Zero, s[0]->arch_opcode());
ASSERT_EQ(0U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
{
StreamBuilder m(this, MachineType::Simd128());
Node* const splat = m.I32x4Splat(m.Int32Constant(0));
m.Return(splat);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64S128Zero, s[0]->arch_opcode());
ASSERT_EQ(0U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
{
StreamBuilder m(this, MachineType::Simd128());
Node* const splat = m.I16x8Splat(m.Int32Constant(0));
m.Return(splat);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64S128Zero, s[0]->arch_opcode());
ASSERT_EQ(0U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
{
StreamBuilder m(this, MachineType::Simd128());
Node* const splat = m.I8x16Splat(m.Int32Constant(0));
m.Return(splat);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64S128Zero, s[0]->arch_opcode());
ASSERT_EQ(0U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
#if V8_ENABLE_WEBASSEMBLY
struct ArchShuffle {
uint8_t shuffle[kSimd128Size];
ArchOpcode arch_opcode;
size_t input_count;
bool inputs_are_swapped = false;
};
static constexpr ArchShuffle kArchShuffles[] = {
// These are architecture specific shuffles defined in
// instruction-selecor-x64.cc arch_shuffles.
{
{0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23},
kX64S64x2UnpackLow,
2,
},
{
{8, 9, 10, 11, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31},
kX64S64x2UnpackHigh,
2,
},
{
{0, 1, 2, 3, 16, 17, 18, 19, 4, 5, 6, 7, 20, 21, 22, 23},
kX64S32x4UnpackLow,
2,
},
{
{8, 9, 10, 11, 24, 25, 26, 27, 12, 13, 14, 15, 28, 29, 30, 31},
kX64S32x4UnpackHigh,
2,
},
{
{0, 1, 16, 17, 2, 3, 18, 19, 4, 5, 20, 21, 6, 7, 22, 23},
kX64S16x8UnpackLow,
2,
},
{
{8, 9, 24, 25, 10, 11, 26, 27, 12, 13, 28, 29, 14, 15, 30, 31},
kX64S16x8UnpackHigh,
2,
},
{
{0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23},
kX64S8x16UnpackLow,
2,
},
{
{8, 24, 9, 25, 10, 26, 11, 27, 12, 28, 13, 29, 14, 30, 15, 31},
kX64S8x16UnpackHigh,
2,
},
{
{0, 1, 4, 5, 8, 9, 12, 13, 16, 17, 20, 21, 24, 25, 28, 29},
kX64S16x8UnzipLow,
2,
},
{
{2, 3, 6, 7, 10, 11, 14, 15, 18, 19, 22, 23, 26, 27, 30, 31},
kX64S16x8UnzipHigh,
2,
},
{
{0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30},
kX64S8x16UnzipLow,
2,
},
{
{1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31},
kX64S8x16UnzipHigh,
2,
},
{
{0, 16, 2, 18, 4, 20, 6, 22, 8, 24, 10, 26, 12, 28, 14, 30},
kX64S8x16TransposeLow,
2,
},
{
{1, 17, 3, 19, 5, 21, 7, 23, 9, 25, 11, 27, 13, 29, 15, 31},
kX64S8x16TransposeHigh,
2,
},
{
{7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8},
kX64S8x8Reverse,
1,
},
{
{3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12},
kX64S8x4Reverse,
1,
},
{
{1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14},
kX64S8x2Reverse,
1,
},
// These are matched by TryMatchConcat && TryMatch32x4Rotate.
{
{4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3},
kX64S32x4Rotate,
2,
},
{
{8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7},
kX64S32x4Rotate,
2,
},
{
{12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11},
kX64S32x4Rotate,
2,
},
// These are matched by TryMatchConcat && !TryMatch32x4Rotate.
{
{3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2},
kX64S8x16Alignr,
3,
true,
},
{
{2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1},
kX64S8x16Alignr,
3,
true,
},
{
{2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17},
kX64S8x16Alignr,
3,
true,
},
// These are matched by TryMatch32x4Shuffle && is_swizzle.
{
{0, 1, 2, 3, 8, 9, 10, 11, 4, 5, 6, 7, 12, 13, 14, 15},
kX64S32x4Swizzle,
2,
},
{
{0, 1, 2, 3, 4, 5, 6, 7, 12, 13, 14, 15, 8, 9, 10, 11},
kX64S32x4Swizzle,
2,
},
// These are matched by TryMatch32x4Shuffle && !is_swizzle && TryMatchBlend.
{
{0, 1, 2, 3, 20, 21, 22, 23, 8, 9, 10, 11, 28, 29, 30, 31},
kX64S16x8Blend,
3,
},
{
{16, 17, 18, 19, 4, 5, 6, 7, 24, 25, 26, 27, 12, 13, 14, 15},
kX64S16x8Blend,
3,
},
// These are matched by TryMatch32x4Shuffle && !is_swizzle &&
// TryMatchShufps.
{
{0, 1, 2, 3, 8, 9, 10, 11, 28, 29, 30, 31, 28, 29, 30, 31},
kX64Shufps,
3,
},
{
{8, 9, 10, 11, 0, 1, 2, 3, 28, 29, 30, 31, 28, 29, 30, 31},
kX64Shufps,
3,
},
// These are matched by TryMatch32x4Shuffle && !is_swizzle.
{
{28, 29, 30, 31, 0, 1, 2, 3, 28, 29, 30, 31, 28, 29, 30, 31},
kX64S32x4Shuffle,
4,
},
// These are matched by TryMatch16x8Shuffle && TryMatchBlend.
{
{16, 17, 2, 3, 4, 5, 6, 7, 24, 25, 26, 27, 12, 13, 14, 15},
kX64S16x8Blend,
3,
},
// These are matched by TryMatch16x8Shuffle && TryMatchSplat<8>.
{
{2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3},
kX64S16x8Dup,
2,
},
// These are matched by TryMatch16x8Shuffle && TryMatch16x8HalfShuffle.
{
{6, 7, 4, 5, 2, 3, 0, 1, 14, 15, 12, 13, 10, 11, 8, 9},
kX64S16x8HalfShuffle1,
3,
},
{
{6, 7, 4, 5, 2, 3, 0, 1, 30, 31, 28, 29, 26, 27, 24, 25},
kX64S16x8HalfShuffle2,
5,
},
// These are matched by TryMatchSplat<16>.
{
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
kX64S8x16Dup,
2,
},
// Generic shuffle that only uses 1 input.
{
{1, 15, 2, 14, 3, 13, 4, 12, 5, 11, 6, 10, 7, 9, 8},
kX64I8x16Shuffle,
5,
},
// Generic shuffle that uses both input.
{
{1, 31, 2, 14, 3, 13, 4, 12, 5, 11, 6, 10, 7, 9, 8},
kX64I8x16Shuffle,
6,
},
};
using InstructionSelectorSIMDArchShuffleTest =
InstructionSelectorTestWithParam<ArchShuffle>;
TEST_P(InstructionSelectorSIMDArchShuffleTest, SIMDArchShuffle) {
MachineType type = MachineType::Simd128();
{
// Tests various shuffle optimizations
StreamBuilder m(this, type, type, type);
auto param = GetParam();
auto shuffle = param.shuffle;
// The shuffle constants defined in the test cases are not canonicalized.
bool needs_swap;
bool inputs_equal = false;
bool is_swizzle;
wasm::SimdShuffle::CanonicalizeShuffle(inputs_equal, shuffle, &needs_swap,
&is_swizzle);
const Operator* op = m.machine()->I8x16Shuffle(shuffle, is_swizzle);
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* n = m.AddNode(op, p0, p1);
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(param.arch_opcode, s[0]->arch_opcode());
ASSERT_EQ(param.input_count, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
if (param.inputs_are_swapped) {
ASSERT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(1)));
if (!is_swizzle) {
ASSERT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(0)));
}
} else {
ASSERT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
if (!is_swizzle) {
ASSERT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
}
}
}
}
INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
InstructionSelectorSIMDArchShuffleTest,
::testing::ValuesIn(kArchShuffles));
#endif // V8_ENABLE_WEBASSEMBLY
struct SwizzleConstants {
uint8_t shuffle[kSimd128Size];
bool omit_add;
};
static constexpr SwizzleConstants kSwizzleConstants[] = {
{
// all lanes < kSimd128Size
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
true,
},
{
// lanes that are >= kSimd128Size have top bit set
{12, 13, 14, 15, 0x90, 0x91, 0x92, 0x93, 0xA0, 0xA1, 0xA2, 0xA3, 0xFC,
0xFD, 0xFE, 0xFF},
true,
},
{
{12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27},
false,
},
};
using InstructionSelectorSIMDSwizzleConstantTest =
InstructionSelectorTestWithParam<SwizzleConstants>;
TEST_P(InstructionSelectorSIMDSwizzleConstantTest, SimdSwizzleConstant) {
// Test optimization of swizzle with constant indices.
auto param = GetParam();
StreamBuilder m(this, MachineType::Simd128(), MachineType::Simd128());
Node* const c = m.S128Const(param.shuffle);
Node* swizzle = m.AddNode(m.machine()->I8x16Swizzle(), m.Parameter(0), c);
m.Return(swizzle);
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
ASSERT_EQ(kX64I8x16Swizzle, s[1]->arch_opcode());
ASSERT_EQ(param.omit_add, s[1]->misc());
ASSERT_EQ(1U, s[0]->OutputCount());
}
INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
InstructionSelectorSIMDSwizzleConstantTest,
::testing::ValuesIn(kSwizzleConstants));
} // namespace compiler
} // namespace internal
} // namespace v8
|
; A274306: a(n) = Product_{k=1..n} (4*k^4+1).
; Submitted by Jon Maiga
; 1,5,325,105625,108265625,270772328125,1403954521328125,13484983177356640625,220951449360988556640625,5798870788479144669033203125,231960630409954265905997158203125,13584774319958971582784723570166015625
mov $2,1
lpb $0
mov $1,$0
sub $0,1
pow $1,4
mul $1,4
add $1,1
mul $2,$1
lpe
mov $0,$2
|
; vim: set ft=nasm et:
bits 64
%include "elf.inc"
%include "linkscr.inc"
org 0x10000
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
global _EHDR
_EHDR:
ehdr:
; e_ident
db 0x7F, "ELF"
db EI_CLASS, EI_DATA, EI_VERSION, 0;EI_OSABI
db 0;EI_OSABIVERSION
times 7 db 0
dw ELF_TYPE ; e_type
dw ELF_MACHINE ; e_machine
dd EI_VERSION ; e_version
dq _smol_start ; e_entry
dq phdr - ehdr ; e_phoff
dq 0 ; e_shoff
dd 0 ; e_flags
dw ehdr.end - ehdr ; e_ehsize
dw phdr.load - phdr.dynamic ; e_phentsize
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
global _PHDR
_PHDR:
phdr:
phdr.interp:
dd PT_INTERP ; p_type ; e_phnum, e_shentsize
dd 0 ; p_flags ; e_shnum, e_shstrndx
ehdr.end:
dq interp - ehdr ; p_offset
dq interp, interp ; p_vaddr, p_paddr
dq interp.end - interp ; p_filesz
dq interp.end - interp ; p_memsz
dq 0 ; p_align
phdr.dynamic:
dd PT_DYNAMIC ; p_type ; e_phnum, e_shentsize
dd 0 ; p_flags ; e_shnum, e_shstrndx
dq dynamic - ehdr ; p_offset
dq dynamic;, 0 ; p_vaddr, p_paddr
global _INTERP
_INTERP:
interp:
db "/lib64/ld-linux-x86-64.so.2",0
interp.end:
dd 0
;dq dynamic.end - dynamic ; p_filesz
;dq dynamic.end - dynamic ; p_memsz
;dq 0 ; p_align
phdr.load:
dd PT_LOAD ; p_type
dd PHDR_R | PHDR_W | PHDR_X ; p_flags
dq 0 ; p_offset
dq ehdr, 0 ; p_vaddr, p_paddr
dq END.FILE-ehdr ; p_filesz
dq END.MEM-ehdr ; p_memsz
dd 0x1000 ; p_align
phdr.end:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;global _INTERP
;_INTERP:
;interp:
; db "/lib64/ld-linux-x86-64.so.2",0
;interp.end:
; dd 0
global _DYNAMIC
_DYNAMIC:
dynamic:
dynamic.strtab:
dq DT_STRTAB ; d_tag
dq _dynstr ; d_un.d_ptr
;dynamic.debug:
; dq DT_DEBUG ; d_tag
;_DEBUG:
; dq 0 ; d_un.d_ptr
dynamic.needed:
dq DT_NEEDED
dq (_symbols.libc - _dynstr)
dynamic.symtab:
dq DT_SYMTAB
dq _dynsym;0 ; none
; some magic
dynamic.pltgot:
dq DT_PLTGOT
dq _gotplt
;dynamic.pltrelsz:
; dq DT_PLTRELSZ
; dq 24 ; sizeof(Elf64_Rela)
;dynamic.pltrel:
; dq DT_PLTREL
; dq DT_RELA
dynamic.jmprel:
dq DT_JMPREL
dq _rela_plt
dynamic.end:
db DT_NULL
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;global _rela_plt
;_rela_plt:
; ;; entry 0
; dq ehdr ; address
; dq ELF_R_INFO(0,R_JUMP_SLOT) ; symidx, type
; dq 0 ; addend
global _dynsym
_dynsym:
;; entry 0
dd _symbols.libc.puts - _dynstr ; name
db 0 ; info
; rest is ignored
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
%define SYS_exit 60
global _smol_start
_smol_start:
lea rsi, [rel _gotplt+8]
lodsq ; linkmap -> rax
xchg rax, rdx
lodsq ; fixup -> rax
call resolve_first
retaddr:
; and now we can call the resolved symbol
lea rdi, [rel symname]
call rax
; more symbols can also be looked up by calling [ehdr]
mov al, SYS_exit
; push 42
; pop rdi
syscall ; %rdi, %rsi, %rdx, %r10, %r8 and %r9
resolve_first:
pop rsi
push rsi
;mov rsi, [rsp]
sub si, retaddr-symname
; %rdi, %rsi, %rdx, %rcx, %r8 and %r9
; rdi = handle (RTLD_DEFAULT)
; rsi = name (symbol name)
; rdx = who (NULL is fine)
push 0 ; symbol ordinal (_dl_sym)
push rdx ; link_map
push 0
;push 0
pop rdi ; handle (RTLD_DEFAULT)
push rdi
pop rdx ; who (NULL, "If the address is not recognized the call comes from
; the main program (we hope)" -glibc src)
;lea rsi, [rel symname] ; symbol name
jmp rax
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
symname:
db "puts",0
;helloworld:
; db "hello, world!",0
global _dynstr
_dynstr:
; db 0
_symbols.libc: db "libc.so.6",0
_symbols.libc.puts: db "_dl_sym",0
global _rela_plt
_rela_plt:
dq ehdr ; address
db ELF_R_INFO(0,R_JUMP_SLOT) ; symidx, type
;dq 0 ; addend
END.FILE:
; yep, GOT in .bss
global _GLOBAL_OFFSET_TABLE_
_GLOBAL_OFFSET_TABLE_:
_gotplt: resq 1;db _DYNAMIC ; not a requirement!
linkmap: resq 1 ; address of link map, filled in by ld.so
fixup: resq 1 ; address of _dl_runtime_resolve, which is a trampoline calling _dl_fixup
END.MEM:
|
SECTION code_clib
PUBLIC in_LookupKey
PUBLIC _in_LookupKey
EXTERN in_keytranstbl
; Given the ascii code of a character, returns the scan row and mask
; corresponding to the key that needs to be pressed to generate the
; character.
;
; The scan row returned will have bit 7 set and bit 6 set to
; indicate if CAPS, SYM SHIFTS also have to be pressed to generate the
; ascii code, respectively.
; enter: L = ascii character code
; exit : L = scan row
; H = mask
; else: L = scan row, H = mask
; bit 7 of L set if SHIFT needs to be pressed
; bit 6 of L set if FUNC needs to be pressed
; uses : AF,BC,HL
; The 16-bit value returned is a scan code understood by
; in_KeyPressed.
.in_LookupKey
._in_LookupKey
ld a,l
ld hl,in_keytranstbl
ld bc,128 * 3
cpir
jr nz,notfound
; Try and find the position with the table here
ld de,0 ; Out resulting flags
ld hl, 128 * 3 - 1
and a
sbc hl,bc ; hl = position within table
ld bc,128
and a
sbc hl,bc
jr c, got_table
; Now try shifted
set 7,e
and a
sbc hl,bc
jr c,got_table
; It must be control
res 7,e
set 6,e
and a
sbc hl,de
got_table:
add hl,bc ;Add the 96 back on
ld a,l
ld h,a
srl a ;divide by 8
srl a
srl a
or e
ld l,a ; l = flags + row
; Now get the mask
ld a,h
ld h,1
shift_loop:
and 7
ret z ; nc
rl h
dec a
jr shift_loop
notfound:
ld hl,0
scf
ret |
// Copyright (c) 2002-2013, Boyce Griffith
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of New York University nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
// Config files
#include <IBAMR_prefix_config.h>
#include <IBTK_prefix_config.h>
#include <SAMRAI_config.h>
// Headers for basic PETSc functions
#include <petscsys.h>
// Headers for basic SAMRAI objects
#include <BergerRigoutsos.h>
#include <CartesianGridGeometry.h>
#include <LoadBalancer.h>
#include <StandardTagAndInitialize.h>
// Headers for basic libMesh objects
#include <libmesh/boundary_info.h>
#include <libmesh/equation_systems.h>
#include <libmesh/exodusII_io.h>
#include <libmesh/mesh.h>
#include <libmesh/mesh_function.h>
#include <libmesh/mesh_generation.h>
// Headers for application-specific algorithm/data structure objects
#include <ibamr/IBExplicitHierarchyIntegrator.h>
#include <ibamr/IBFEMethod.h>
#include <ibamr/INSCollocatedHierarchyIntegrator.h>
#include <ibamr/INSStaggeredHierarchyIntegrator.h>
#include <ibamr/app_namespaces.h>
#include <ibtk/AppInitializer.h>
#include <ibtk/libmesh_utilities.h>
#include <ibtk/muParserCartGridFunction.h>
#include <ibtk/muParserRobinBcCoefs.h>
// Elasticity model data.
namespace ModelData
{
static double kappa_s = 1.0e6;
// Tether (penalty) force function for the solid block.
void
block_tether_force_function(
VectorValue<double>& F,
const TensorValue<double>& /*FF*/,
const Point& X,
const Point& s,
Elem* const /*elem*/,
NumericVector<double>& /*X_vec*/,
const vector<NumericVector<double>*>& /*system_data*/,
double /*time*/,
void* /*ctx*/)
{
F = kappa_s*(s-X);
return;
}// block_tether_force_function
// Tether (penalty) force function for the thin beam.
void
beam_tether_force_function(
VectorValue<double>& F,
const TensorValue<double>& /*FF*/,
const Point& X,
const Point& s,
Elem* const /*elem*/,
NumericVector<double>& /*X_vec*/,
const vector<NumericVector<double>*>& /*system_data*/,
double /*time*/,
void* /*ctx*/)
{
const double r = sqrt((s(0) - 0.2)*(s(0) - 0.2) + (s(1) - 0.2)*(s(1) - 0.2));
if (r <= 0.05)
{
F = kappa_s*(s-X);
}
else
{
F.zero();
}
return;
}// beam_tether_force_function
// Stress tensor function for the thin beam.
static double mu_s, lambda_s;
void
beam_PK1_stress_function(
TensorValue<double>& PP,
const TensorValue<double>& FF,
const Point& /*X*/,
const Point& s,
Elem* const /*elem*/,
NumericVector<double>& /*X_vec*/,
const vector<NumericVector<double>*>& /*system_data*/,
double /*time*/,
void* /*ctx*/)
{
const double r = sqrt((s(0) - 0.2)*(s(0) - 0.2) + (s(1) - 0.2)*(s(1) - 0.2));
if (r > 0.05)
{
static const TensorValue<double> II(1.0,0.0,0.0,
0.0,1.0,0.0,
0.0,0.0,1.0);
const TensorValue<double> CC = FF.transpose()*FF;
const TensorValue<double> EE = 0.5*(CC - II);
const TensorValue<double> SS = lambda_s*EE.tr()*II + 2.0*mu_s*EE;
PP = FF*SS;
}
else
{
PP.zero();
}
return;
}// beam_PK1_stress_function
}
using namespace ModelData;
// Function prototypes
static ofstream drag_stream, lift_stream, A_x_posn_stream, A_y_posn_stream;
void
postprocess_data(
Pointer<PatchHierarchy<NDIM> > patch_hierarchy,
Pointer<INSHierarchyIntegrator> navier_stokes_integrator,
Mesh& beam_mesh,
EquationSystems* beam_equation_systems,
Mesh& block_mesh,
EquationSystems* block_equation_systems,
const int iteration_num,
const double loop_time,
const string& data_dump_dirname);
/*******************************************************************************
* For each run, the input filename and restart information (if needed) must *
* be given on the command line. For non-restarted case, command line is: *
* *
* executable <input file name> *
* *
* For restarted run, command line is: *
* *
* executable <input file name> <restart directory> <restart number> *
* *
*******************************************************************************/
int
main(
int argc,
char* argv[])
{
// Initialize libMesh, PETSc, MPI, and SAMRAI.
LibMeshInit init(argc, argv);
SAMRAI_MPI::setCommunicator(PETSC_COMM_WORLD);
SAMRAI_MPI::setCallAbortInSerialInsteadOfExit();
SAMRAIManager::startup();
{// cleanup dynamically allocated objects prior to shutdown
// Parse command line options, set some standard options from the input
// file, initialize the restart database (if this is a restarted run),
// and enable file logging.
Pointer<AppInitializer> app_initializer = new AppInitializer(argc, argv, "IB.log");
Pointer<Database> input_db = app_initializer->getInputDatabase();
// Get various standard options set in the input file.
const bool dump_viz_data = app_initializer->dumpVizData();
const int viz_dump_interval = app_initializer->getVizDumpInterval();
const bool uses_visit = dump_viz_data && app_initializer->getVisItDataWriter();
const bool uses_exodus = dump_viz_data && !app_initializer->getExodusIIFilename().empty();
const string block_exodus_filename = app_initializer->getExodusIIFilename("block");
const string beam_exodus_filename = app_initializer->getExodusIIFilename("beam" );
const bool dump_restart_data = app_initializer->dumpRestartData();
const int restart_dump_interval = app_initializer->getRestartDumpInterval();
const string restart_dump_dirname = app_initializer->getRestartDumpDirectory();
const bool dump_postproc_data = app_initializer->dumpPostProcessingData();
const int postproc_data_dump_interval = app_initializer->getPostProcessingDataDumpInterval();
const string postproc_data_dump_dirname = app_initializer->getPostProcessingDataDumpDirectory();
if (dump_postproc_data && (postproc_data_dump_interval > 0) && !postproc_data_dump_dirname.empty())
{
Utilities::recursiveMkdir(postproc_data_dump_dirname);
}
const bool dump_timer_data = app_initializer->dumpTimerData();
const int timer_dump_interval = app_initializer->getTimerDumpInterval();
// Create a simple FE mesh.
const double dx = input_db->getDouble("DX");
const double ds = input_db->getDouble("MFAC")*dx;
Mesh block_mesh(NDIM);
string block_elem_type = input_db->getString("BLOCK_ELEM_TYPE");
const double R = 0.05;
if (block_elem_type == "TRI3" || block_elem_type == "TRI6")
{
const int num_circum_nodes = ceil(2.0*M_PI*R/ds);
for (int k = 0; k < num_circum_nodes; ++k)
{
const double theta = 2.0*M_PI*static_cast<double>(k)/static_cast<double>(num_circum_nodes);
block_mesh.add_point(Point(R*cos(theta), R*sin(theta)));
}
TriangleInterface triangle(block_mesh);
triangle.triangulation_type() = TriangleInterface::GENERATE_CONVEX_HULL;
triangle.elem_type() = Utility::string_to_enum<ElemType>(block_elem_type);
triangle.desired_area() = sqrt(3.0)/4.0*ds*ds;
triangle.insert_extra_points() = true;
triangle.smooth_after_generating() = true;
triangle.triangulate();
block_mesh.prepare_for_use();
}
else
{
// NOTE: number of segments along boundary is 4*2^r.
const double num_circum_segments = ceil(2.0*M_PI*R/ds);
const int r = log2(0.25*num_circum_segments);
MeshTools::Generation::build_sphere(block_mesh, R, r, Utility::string_to_enum<ElemType>(block_elem_type));
}
for (MeshBase::node_iterator n_it = block_mesh.nodes_begin(); n_it != block_mesh.nodes_end(); ++n_it)
{
Node& n = **n_it;
n(0) += 0.2;
n(1) += 0.2;
}
Mesh beam_mesh(NDIM);
string beam_elem_type = input_db->getString("BEAM_ELEM_TYPE");
MeshTools::Generation::build_square(beam_mesh,
ceil(0.4/ds), ceil(0.02/ds),
0.2, 0.6, 0.19, 0.21,
Utility::string_to_enum<ElemType>(beam_elem_type));
beam_mesh.prepare_for_use();
vector<Mesh*> meshes(2);
meshes[0] = &block_mesh;
meshes[1] = & beam_mesh;
mu_s = input_db->getDouble("MU_S");
lambda_s = input_db->getDouble("LAMBDA_S");
kappa_s = input_db->getDouble("KAPPA_S");
// Create major algorithm and data objects that comprise the
// application. These objects are configured from the input database
// and, if this is a restarted run, from the restart database.
Pointer<INSHierarchyIntegrator> navier_stokes_integrator;
const string solver_type = app_initializer->getComponentDatabase("Main")->getString("solver_type");
if (solver_type == "STAGGERED")
{
navier_stokes_integrator = new INSStaggeredHierarchyIntegrator(
"INSStaggeredHierarchyIntegrator", app_initializer->getComponentDatabase("INSStaggeredHierarchyIntegrator"));
}
else if (solver_type == "COLLOCATED")
{
navier_stokes_integrator = new INSCollocatedHierarchyIntegrator(
"INSCollocatedHierarchyIntegrator", app_initializer->getComponentDatabase("INSCollocatedHierarchyIntegrator"));
}
else
{
TBOX_ERROR("Unsupported solver type: " << solver_type << "\n" <<
"Valid options are: COLLOCATED, STAGGERED");
}
Pointer<IBFEMethod> ib_method_ops = new IBFEMethod(
"IBFEMethod", app_initializer->getComponentDatabase("IBFEMethod"), meshes, app_initializer->getComponentDatabase("GriddingAlgorithm")->getInteger("max_levels"));
Pointer<IBHierarchyIntegrator> time_integrator = new IBExplicitHierarchyIntegrator(
"IBHierarchyIntegrator", app_initializer->getComponentDatabase("IBHierarchyIntegrator"), ib_method_ops, navier_stokes_integrator);
Pointer<CartesianGridGeometry<NDIM> > grid_geometry = new CartesianGridGeometry<NDIM>(
"CartesianGeometry", app_initializer->getComponentDatabase("CartesianGeometry"));
Pointer<PatchHierarchy<NDIM> > patch_hierarchy = new PatchHierarchy<NDIM>(
"PatchHierarchy", grid_geometry);
Pointer<StandardTagAndInitialize<NDIM> > error_detector = new StandardTagAndInitialize<NDIM>(
"StandardTagAndInitialize", time_integrator, app_initializer->getComponentDatabase("StandardTagAndInitialize"));
Pointer<BergerRigoutsos<NDIM> > box_generator = new BergerRigoutsos<NDIM>();
Pointer<LoadBalancer<NDIM> > load_balancer = new LoadBalancer<NDIM>(
"LoadBalancer", app_initializer->getComponentDatabase("LoadBalancer"));
Pointer<GriddingAlgorithm<NDIM> > gridding_algorithm = new GriddingAlgorithm<NDIM>(
"GriddingAlgorithm", app_initializer->getComponentDatabase("GriddingAlgorithm"), error_detector, box_generator, load_balancer);
// Configure the IBFE solver.
ib_method_ops->registerLagBodyForceFunction(&block_tether_force_function, std::vector<unsigned int>(), NULL, 0);
ib_method_ops->registerLagBodyForceFunction( &beam_tether_force_function, std::vector<unsigned int>(), NULL, 1);
ib_method_ops->registerPK1StressTensorFunction(&beam_PK1_stress_function, std::vector<unsigned int>(), NULL, 1);
EquationSystems* block_equation_systems = ib_method_ops->getFEDataManager(0)->getEquationSystems();
EquationSystems* beam_equation_systems = ib_method_ops->getFEDataManager(1)->getEquationSystems();
// Create Eulerian initial condition specification objects.
if (input_db->keyExists("VelocityInitialConditions"))
{
Pointer<CartGridFunction> u_init = new muParserCartGridFunction(
"u_init", app_initializer->getComponentDatabase("VelocityInitialConditions"), grid_geometry);
navier_stokes_integrator->registerVelocityInitialConditions(u_init);
}
if (input_db->keyExists("PressureInitialConditions"))
{
Pointer<CartGridFunction> p_init = new muParserCartGridFunction(
"p_init", app_initializer->getComponentDatabase("PressureInitialConditions"), grid_geometry);
navier_stokes_integrator->registerPressureInitialConditions(p_init);
}
// Create Eulerian boundary condition specification objects (when necessary).
const IntVector<NDIM>& periodic_shift = grid_geometry->getPeriodicShift();
vector<RobinBcCoefStrategy<NDIM>*> u_bc_coefs(NDIM);
if (periodic_shift.min() > 0)
{
for (unsigned int d = 0; d < NDIM; ++d)
{
u_bc_coefs[d] = NULL;
}
}
else
{
for (unsigned int d = 0; d < NDIM; ++d)
{
ostringstream bc_coefs_name_stream;
bc_coefs_name_stream << "u_bc_coefs_" << d;
const string bc_coefs_name = bc_coefs_name_stream.str();
ostringstream bc_coefs_db_name_stream;
bc_coefs_db_name_stream << "VelocityBcCoefs_" << d;
const string bc_coefs_db_name = bc_coefs_db_name_stream.str();
u_bc_coefs[d] = new muParserRobinBcCoefs(
bc_coefs_name, app_initializer->getComponentDatabase(bc_coefs_db_name), grid_geometry);
}
navier_stokes_integrator->registerPhysicalBoundaryConditions(u_bc_coefs);
}
// Create Eulerian body force function specification objects.
if (input_db->keyExists("ForcingFunction"))
{
Pointer<CartGridFunction> f_fcn = new muParserCartGridFunction(
"f_fcn", app_initializer->getComponentDatabase("ForcingFunction"), grid_geometry);
time_integrator->registerBodyForceFunction(f_fcn);
}
// Set up visualization plot file writers.
Pointer<VisItDataWriter<NDIM> > visit_data_writer = app_initializer->getVisItDataWriter();
if (uses_visit)
{
time_integrator->registerVisItDataWriter(visit_data_writer);
}
AutoPtr<ExodusII_IO> block_exodus_io(uses_exodus ? new ExodusII_IO(block_mesh) : NULL);
AutoPtr<ExodusII_IO> beam_exodus_io(uses_exodus ? new ExodusII_IO( beam_mesh) : NULL);
// Initialize hierarchy configuration and data on all patches.
ib_method_ops->initializeFEData();
time_integrator->initializePatchHierarchy(patch_hierarchy, gridding_algorithm);
// Deallocate initialization objects.
app_initializer.setNull();
// Print the input database contents to the log file.
plog << "Input database:\n";
input_db->printClassData(plog);
// Write out initial visualization data.
int iteration_num = time_integrator->getIntegratorStep();
double loop_time = time_integrator->getIntegratorTime();
if (dump_viz_data)
{
pout << "\n\nWriting visualization files...\n\n";
if (uses_visit)
{
time_integrator->setupPlotData();
visit_data_writer->writePlotData(patch_hierarchy, iteration_num, loop_time);
}
if (uses_exodus)
{
block_exodus_io->write_timestep(block_exodus_filename, *block_equation_systems, iteration_num/viz_dump_interval+1, loop_time);
beam_exodus_io ->write_timestep( beam_exodus_filename, * beam_equation_systems, iteration_num/viz_dump_interval+1, loop_time);
}
}
// Open streams to save lift and drag coefficients.
if (SAMRAI_MPI::getRank() == 0)
{
drag_stream.open("C_D.curve", ios_base::out | ios_base::trunc);
lift_stream.open("C_L.curve", ios_base::out | ios_base::trunc);
A_x_posn_stream.open("A_x.curve", ios_base::out | ios_base::trunc);
A_y_posn_stream.open("A_y.curve", ios_base::out | ios_base::trunc);
}
// Main time step loop.
double loop_time_end = time_integrator->getEndTime();
double dt = 0.0;
while (!MathUtilities<double>::equalEps(loop_time,loop_time_end) &&
time_integrator->stepsRemaining())
{
iteration_num = time_integrator->getIntegratorStep();
loop_time = time_integrator->getIntegratorTime();
pout << "\n";
pout << "+++++++++++++++++++++++++++++++++++++++++++++++++++\n";
pout << "At beginning of timestep # " << iteration_num << "\n";
pout << "Simulation time is " << loop_time << "\n";
dt = time_integrator->getMaximumTimeStepSize();
time_integrator->advanceHierarchy(dt);
loop_time += dt;
pout << "\n";
pout << "At end of timestep # " << iteration_num << "\n";
pout << "Simulation time is " << loop_time << "\n";
pout << "+++++++++++++++++++++++++++++++++++++++++++++++++++\n";
pout << "\n";
// At specified intervals, write visualization and restart files,
// print out timer data, and store hierarchy data for post
// processing.
iteration_num += 1;
const bool last_step = !time_integrator->stepsRemaining();
if (dump_viz_data && (iteration_num%viz_dump_interval == 0 || last_step))
{
pout << "\nWriting visualization files...\n\n";
if (uses_visit)
{
time_integrator->setupPlotData();
visit_data_writer->writePlotData(patch_hierarchy, iteration_num, loop_time);
}
if (uses_exodus)
{
block_exodus_io->write_timestep(block_exodus_filename, *block_equation_systems, iteration_num/viz_dump_interval+1, loop_time);
beam_exodus_io ->write_timestep( beam_exodus_filename, * beam_equation_systems, iteration_num/viz_dump_interval+1, loop_time);
}
}
if (dump_restart_data && (iteration_num%restart_dump_interval == 0 || last_step))
{
pout << "\nWriting restart files...\n\n";
RestartManager::getManager()->writeRestartFile(restart_dump_dirname, iteration_num);
}
if (dump_timer_data && (iteration_num%timer_dump_interval == 0 || last_step))
{
pout << "\nWriting timer data...\n\n";
TimerManager::getManager()->print(plog);
}
if (dump_postproc_data && (iteration_num%postproc_data_dump_interval == 0 || last_step))
{
pout << "\nWriting state data...\n\n";
postprocess_data(patch_hierarchy,
navier_stokes_integrator, beam_mesh, beam_equation_systems, block_mesh, block_equation_systems,
iteration_num, loop_time, postproc_data_dump_dirname);
}
}
// Close the logging streams.
if (SAMRAI_MPI::getRank() == 0)
{
drag_stream.close();
lift_stream.close();
A_x_posn_stream.close();
A_y_posn_stream.close();
}
// Cleanup Eulerian boundary condition specification objects (when
// necessary).
for (unsigned int d = 0; d < NDIM; ++d) delete u_bc_coefs[d];
}// cleanup dynamically allocated objects prior to shutdown
SAMRAIManager::shutdown();
return 0;
}// main
void
postprocess_data(
Pointer<PatchHierarchy<NDIM> > /*patch_hierarchy*/,
Pointer<INSHierarchyIntegrator> /*navier_stokes_integrator*/,
Mesh& beam_mesh,
EquationSystems* beam_equation_systems,
Mesh& block_mesh,
EquationSystems* block_equation_systems,
const int /*iteration_num*/,
const double loop_time,
const string& /*data_dump_dirname*/)
{
double F_integral[NDIM];
for (unsigned int d = 0; d < NDIM; ++d) F_integral[d] = 0.0;
Mesh* mesh[2] = {&beam_mesh , &block_mesh};
EquationSystems* equation_systems[2] = {beam_equation_systems , block_equation_systems};
for (unsigned int k = 0; k < 2; ++k)
{
System& F_system = equation_systems[k]->get_system<System>(IBFEMethod::FORCE_SYSTEM_NAME);
NumericVector<double>* F_vec = F_system.solution.get();
NumericVector<double>* F_ghost_vec = F_system.current_local_solution.get();
F_vec->localize(*F_ghost_vec);
DofMap& F_dof_map = F_system.get_dof_map();
blitz::Array<std::vector<unsigned int>,1> F_dof_indices(NDIM);
AutoPtr<FEBase> fe(FEBase::build(NDIM, F_dof_map.variable_type(0)));
AutoPtr<QBase> qrule = QBase::build(QGAUSS, NDIM, FIFTH);
fe->attach_quadrature_rule(qrule.get());
const std::vector<std::vector<double> >& phi = fe->get_phi();
const std::vector<double>& JxW = fe->get_JxW();
blitz::Array<double,2> F_node;
const MeshBase::const_element_iterator el_begin = mesh[k]->active_local_elements_begin();
const MeshBase::const_element_iterator el_end = mesh[k]->active_local_elements_end();
for (MeshBase::const_element_iterator el_it = el_begin; el_it != el_end; ++el_it)
{
Elem* const elem = *el_it;
fe->reinit(elem);
for (unsigned int d = 0; d < NDIM; ++d)
{
F_dof_map.dof_indices(elem, F_dof_indices(d), d);
}
const int n_qp = qrule->n_points();
const int n_basis = F_dof_indices(0).size();
get_values_for_interpolation(F_node, *F_ghost_vec, F_dof_indices);
for (int qp = 0; qp < n_qp; ++qp)
{
for (int k = 0; k < n_basis; ++k)
{
for (int d = 0; d < NDIM; ++d)
{
F_integral[d] += F_node(k,d)*phi[k][qp]*JxW[qp];
}
}
}
}
}
SAMRAI_MPI::sumReduction(F_integral,NDIM);
if (SAMRAI_MPI::getRank() == 0)
{
drag_stream.precision(12);
drag_stream.setf(ios::fixed,ios::floatfield);
drag_stream << loop_time << " " << -F_integral[0] << endl;
lift_stream.precision(12);
lift_stream.setf(ios::fixed,ios::floatfield);
lift_stream << loop_time << " " << -F_integral[1] << endl;
}
System& X_system = beam_equation_systems->get_system<System>(IBFEMethod::COORDS_SYSTEM_NAME);
NumericVector<double>* X_vec = X_system.solution.get();
AutoPtr<NumericVector<Number> > X_serial_vec = NumericVector<Number>::build();
X_serial_vec->init(X_vec->size(), true, SERIAL);
X_vec->localize(*X_serial_vec);
DofMap& X_dof_map = X_system.get_dof_map();
vector<unsigned int> vars(2);
vars[0] = 0; vars[1] = 1;
MeshFunction X_fcn(*beam_equation_systems, *X_serial_vec, X_dof_map, vars);
X_fcn.init();
DenseVector<double> X_A(2);
X_fcn(Point(0.6,0.2,0), 0.0, X_A);
if (SAMRAI_MPI::getRank() == 0)
{
A_x_posn_stream.precision(12);
A_x_posn_stream.setf(ios::fixed,ios::floatfield);
A_x_posn_stream << loop_time << " " << X_A(0) << endl;
A_y_posn_stream.precision(12);
A_y_posn_stream.setf(ios::fixed,ios::floatfield);
A_y_posn_stream << loop_time << " " << X_A(1) << endl;
}
return;
}// postprocess_data
|
; A075411: Squares of A002276.
; 0,4,484,49284,4937284,493817284,49382617284,4938270617284,493827150617284,49382715950617284,4938271603950617284,493827160483950617284,49382716049283950617284,4938271604937283950617284,493827160493817283950617284,49382716049382617283950617284,4938271604938270617283950617284,493827160493827150617283950617284,49382716049382715950617283950617284
mov $1,10
pow $1,$0
sub $1,1
pow $1,2
div $1,81
mul $1,4
mov $0,$1
|
;
; PC-6001 specific routines
; by Stefano Bodrato, Fall 2013
;
; int get_psg(int reg);
;
; Get a PSG register
;
;
; $Id: get_psg.asm,v 1.3 2016-06-10 21:13:58 dom Exp $
;
SECTION code_clib
PUBLIC get_psg
PUBLIC _get_psg
;;read & write
; ld a,register
; ld e,data
; call $1BBE
get_psg:
_get_psg:
LD BC,$A0
OUT (C),l
IN a,($A2)
ld l,a ; NOTE: A register has to keep the same value
ret
|
.386p
;对于驱动来说,和键盘相关的最重要的硬件是两个芯片。
;一个是 intel 8042 芯片,位于主板上,CPU 通过 IO 端口直接和这个芯片通信,获得按键的扫描码或者发送各种键盘命令。
;另一个是 intel 8048 芯片或者其兼容芯片,位于键盘中,这个芯片主要作用是从键盘的硬件中得到被按的键所产生的扫描码 与 i8042 通信控制键盘本身
;最简单是用xlat指令
;将ds:[BX]为首地址的,偏移地址为AL的内容送给AL
Kernel Segment public para use32
assume cs:Kernel
align 10h
__kKeyBoardProc proc
pushad
push ds
push es
push fs
push gs
push ss
mov ax,rwData32Seg
mov ds,ax
mov es,ax
mov ebx,KernelData
shl ebx,4
cmp dword ptr ds:[ebx + offset _kKbdProc],0
jz _kkbdProcEnd
call dword ptr ds:[ebx + offset _kKbdProc]
jmp _kkbdProcEnd
in al,60h
movzx eax,al
call near ptr _analyseScanCode
_kkbdProcEnd:
mov dword ptr ds:[CMOS_SECONDS_TOTAL],0
mov eax,TURNONSCREEN
int 80h
;mov ebp,esp
;add ebp,32
;push dword ptr ICW2_MASTER_INT_NO + 1
;push dword ptr eax
;push dword ptr [ebp]
;push dword ptr [ebp + 4]
;push dword ptr [ebp + 8]
;call __exceptionInfo
;add esp,20
;add ebp,32
mov al,20h
out 20h,al
pop ss
pop gs
pop fs
pop es
pop ds
popad
iretd
__kKeyBoardProc endp
_analyseScanCode proc near
mov ebx,KEYBOARD_BUFFER
cmp al,1dh ;1dh=Ctrl down
jz _ctrlLeftKey
cmp al,9dh ;9dh=Ctrl up
jz _ctrlLeftKey
cmp al,2ah ;2ah=Shift Left down
jz _shiftLeftKey
cmp al,0aah ;0aah=Shift Left up
jz _shiftLeftKey
cmp al,36h ;36h=Shift Right down
jz _shiftRightKey
cmp al,0b6h ;0b6h=Shift Right up
jz _shiftRightKey
cmp al,38h ;38h=left Alt down
jz _altLeftKey
cmp al,0b8h ;0b8h=left Alt up
jz _altLeftKey
;capsLock scrollLock numsLock could only use once,not both
cmp al,3ah ;3ah=CapsLock down
jz _CapsLock
;cmp al,0bah ;bah=CapsLock up
;jz _CapsLock
cmp al,46h ;46h=ScrollLock down
jz _ScrollLock
;cmp al,0c6h ;c6h=ScrollLock up
;jz _ScrollLock
cmp al,53h
jz _deleteKey
cmp al,45h ;45h=NumsLock down
jz _NumsLock
;cmp al,0c5h ;c5h=NumsLock up
;jz _NumsLock
cmp al,0e0h
jz _multiKeye0
cmp al,0e1h
jz _multiKeye1
cmp al,0e2h
jz _multiKeye2
cmp al,37h ;small kbd *
jz _codeSmallKbd
cmp al,47h
jb _filterUpKey
cmp al,53h
ja _filterUpKey
jmp _codeSmallKbd ;from 47h to 53h is small kbd vlaue
_filterUpKey:
test al,080h
jnz _parseKeyEnd
_saveKbdKey:
mov esi,ds:[ebx + KEYBOARDDATA._KbdBufHdr]
shl esi,2
mov dword ptr ds:[ebx + KEYBOARDDATA._kbdBuf + esi],eax
mov edx,dword ptr ds:[ebx + KEYBOARDDATA._KbdStatus]
mov dword ptr ds:[ebx + KEYBOARDDATA._kbdStatusBuf + esi],edx
add dword ptr ds:[ebx + KEYBOARDDATA._kbdBufHdr],1
cmp dword ptr ds:[ebx + KEYBOARDDATA._kbdBufHdr],KEYBORAD_BUF_LIMIT
jb _parseKeyEnd
mov dword ptr ds:[ebx + KEYBOARDDATA._kbdBufHdr],0
_parseKeyEnd:
ret
_deleteKey:
test dword ptr ds:[ebx + KEYBOARDDATA._KbdStatus],CTRLLEFT_SET_FLAG
jz _saveKbdKey
test dword ptr ds:[ebx + KEYBOARDDATA._KbdStatus],ALTLEFT_SET_FLAG
jz _saveKbdKey
call __resetSystem
jmp _parseKeyEnd
_shiftLeftKey:
xor dword ptr ds:[ebx + KEYBOARDDATA._KbdStatus],SHIFTLEFT_SET_FLAG
jmp _parseKeyEnd
_shiftRightKey:
xor dword ptr ds:[ebx + KEYBOARDDATA._KbdStatus],SHIFTRIGHT_SET_FLAG
jmp _parseKeyEnd
_ctrlLeftKey:
xor dword ptr ds:[ebx + KEYBOARDDATA._KbdStatus],CTRLLEFT_SET_FLAG
jmp _parseKeyEnd
_ctrlRightKey:
xor dword ptr ds:[ebx + KEYBOARDDATA._KbdStatus],CTRLRIGHT_SET_FLAG
jmp _parseKeyEnd
_altLeftKey:
xor dword ptr ds:[ebx + KEYBOARDDATA._KbdStatus],ALTLEFT_SET_FLAG
jmp _parseKeyEnd
_altRightKey:
xor dword ptr ds:[ebx + KEYBOARDDATA._KbdStatus],ALTRIGHT_SET_FLAG
jmp _parseKeyEnd
_ScrollLock:
xor dword ptr ds:[ebx + KEYBOARDDATA._KbdStatus],SCROLLLOCK_SET_FLAG
xor byte ptr ds:[ebx + KEYBOARDDATA._KbdLedStatus],1
mov al,byte ptr ds:[ebx + KEYBOARDDATA._KbdLedStatus]
call __setKbdLed
jmp _parseKeyEnd
_NumsLock:
xor dword ptr ds:[ebx + KEYBOARDDATA._KbdStatus],NUMSLOCK_SET_FLAG
xor byte ptr ds:[ebx + KEYBOARDDATA._KbdLedStatus],2
mov al,byte ptr ds:[ebx + KEYBOARDDATA._KbdLedStatus]
call __setKbdLed
jmp _parseKeyEnd
_CapsLock:
xor dword ptr ds:[ebx + KEYBOARDDATA._KbdStatus],CAPSLOCK_SET_FLAG
xor byte ptr ds:[ebx + KEYBOARDDATA._KbdLedStatus],4
mov al,byte ptr ds:[ebx + KEYBOARDDATA._KbdLedStatus]
call __setKbdLed
jmp _parseKeyEnd
_insertKey:
xor dword ptr ds:[ebx + KEYBOARDDATA._KbdStatus],INSERT_SET_FLAT
jmp _parseKeyEnd
_codeSmallKbd:
test dword ptr ds:[ebx + KEYBOARDDATA._kbdStatus],NUMSLOCK_SET_FLAG
jz _parseKeyEnd
;53h=small kbd Delete key down
;d3h=small kbd Delete key up
;cmp al,0d2h
;jz _insertKey ;;d2h=small kbd insert key up
cmp al,52h ;52h=small kbd insert key down
jz _insertKey
test al,080h
jnz _parseKeyEnd
jmp _saveKbdKey
_multiKeye0:
shl eax,8
in al,60h
cmp ax,0e053h
jz _deleteKey
CMP AX,0e01dh
jz _ctrlRightKey
CMP AX,0e09dh
jz _ctrlRightKey
cmp ax,0e038h
jz _altRightKey
cmp ax,0e0b8h
jz _altRightKey
CMP AX,0e05bh ;windows down
cmp ax,0e0dbh ;windows up
cmp ax,0e02ah
jnz _checkPrintScreen
shl eax,8
in al,60h
shl eax,8
in al,60h
cmp eax,0e02ae037h
jz _printScreen
jmp _parseKeyEnd
_checkPrintScreen:
cmp ax,0e0b7h
jnz _checkOtherMultiKeye0
shl eax,8
in al,60h
shl eax,8
in al,60h
cmp eax,0e0b7e0aah
;jz _printScreen ;printscreen break key,ignore it
jmp _parseKeyEnd
_checkOtherMultiKeye0:
cmp ax,0e052h ;insert down
jz _insertKey
;cmp ax,0e0d2h ;insert up
;jz _insertKey
cmp ax,0e01ch ;small kbd enter
jz _codeSmallKbd
;cmp ax,0e09ch ;small kbd enter
;jz _codeSmallKbd
cmp ax,0e035h ;small kbd /
jz _codeSmallKbd
;cmp ax,0e0b5h ;small kbd /
;jz _codeSmallKbd
test al,080h
jnz _parseKeyEnd
jmp _saveKbdKey
_multiKeye1:
shl eax,8
in al,60h
shl eax,8
in al,60h
;split pause/break e11d45e19dc5 into 2 keys
cmp eax,0e11d45h
jz _pauseBreak
cmp eax,0e19dc5h
jz _pauseBreak
test al,080h
jnz _parseKeyEnd
jmp _saveKbdKey
_multiKeye2:
shl eax,8
in al,60h
shl eax,8
in al,60h
shl eax,8
in al,60h
test al,080h
jnz _parseKeyEnd
jmp _saveKbdKey
_printScreen:
mov edi,KERNELData
shl edi,4
call dword ptr ds:[edi + _kPrintScreen]
jmp _parseKeyEnd
_pauseBreak:
call __shutdownSystem
jmp _parseKeyEnd
_analyseScanCode endp
__scancode2Ascii proc
mov ebx,KEYBOARD_BUFFER
mov esi,ds:[ebx + KEYBOARDDATA._KbdBufTail]
cmp esi,ds:[ebx + KEYBOARDDATA._kbdBufHdr]
jnz _kbdBufferFull
mov eax,0
ret
_kbdBufferFull:
shl esi,2
mov eax,ds:[ebx + KEYBOARDDATA._kbdBuf + esi]
mov edx,ds:[ebx + KEYBOARDDATA._kbdStatusBuf + esi]
;1 small keyboard
cmp eax,0e035h ;small kbd /
jz _smallKbdKey
cmp eax,0e01ch ;small kbd enter
jz _smallKbdKey
cmp eax,37h ;small kbd *
jz _smallKbdKey
cmp eax,47h
jb _checkPageKey
cmp eax,53h
ja _checkPageKey
jmp _smallKbdKey
;2 up down left right insert delete
_checkPageKey:
cmp eax,0e047h
jb _checkFunctionKey
cmp eax,0e053h
ja _checkFunctionKey
jmp _pageKey
;3 f0-f12
_checkFunctionKey:
cmp eax,57h
jz _functionKey
cmp eax,58h
jz _functionKey
cmp eax,3bh
jb _notFunctionKey
cmp eax,44h
ja _notFunctionKey
jmp _functionKey
_notFunctionKey:
_tranlateKeyCode:
movzx ecx,al
mov edi,KERNELData
shl edi,4
test edx,SHIFTLEFT_SET_FLAG
jnz _shiftTranlate
test edx,SHIFTRIGHT_SET_FLAG
jnz _shiftTranlate
movzx eax,byte ptr ds:[edi + ScanCodesBuf + ecx]
jmp _checkCapsLock
_shiftTranlate:
movzx eax,byte ptr ds:[edi + ScanCodesTransBuf + ecx]
_checkCapsLock:
test edx,CAPSLOCK_SET_FLAG
jz _resetKbdTail
cmp al,'A'
jb _resetKbdTail
cmp al,'Z'
ja _checkLowercase
add al,20h
jmp _resetKbdTail
_checkLowercase:
cmp al,'a'
jb _resetKbdTail
cmp al,'z'
ja _resetKbdTail
sub al,20h
_resetKbdTail:
add dword ptr ds:[ebx + KEYBOARDDATA._kbdBufTail],1
cmp dword ptr ds:[ebx + KEYBOARDDATA._kbdBufTail],KEYBORAD_BUF_LIMIT
jb _transferEnd
mov dword ptr ds:[ebx + KEYBOARDDATA._kbdBufTail],0
_transferEnd:
ret
_smallKbdKey:
or al,80h
test edx,NUMSLOCK_SET_FLAG
jnz _tranlateKeyCode
jmp _resetKbdTail
_functionKey:
or al,80h
jmp _resetKbdTail
_pageKey:
;mov eax,0
or al,80h
jmp _resetKbdTail
__scancode2Ascii endp
Kernel ends
|
; unsigned char esx_m_tapein_open(unsigned char *filename)
SECTION code_esxdos
PUBLIC _esx_m_tapein_open_fastcall
EXTERN asm_esx_m_tapein_open
_esx_m_tapein_open_fastcall:
push ix
call asm_esx_m_tapein_open
pop ix
ret
|
; A097309: Chebyshev polynomials of the second kind, U(n,x), evaluated at x=13.
; Submitted by Jamie Morken(s1.)
; 0,1,26,675,17524,454949,11811150,306634951,7960697576,206671502025,5365498355074,139296285729899,3616337930622300,93885489910449901,2437406399741075126,63278680903357503375,1642808297087554012624,42649737043373046824849,1107250354830611663433450,28745859488552530202444851,746285096347535173600132676,19374666645547361983401004725,502995047687883876394825990174,13058496573239433424282074739799,339017915856537385154939117244600,8801407315696732580604134973619801
mov $3,1
lpb $0
sub $0,$3
mov $1,$4
mul $1,24
add $2,1
add $2,$1
add $4,$2
lpe
mov $0,$2
|
#include "Mcu.inc"
#include "TestFixture.inc"
radix decimal
AssertNoIsr code 0x0004
.assert "false, 'ISR should not be called during this test.'"
retfie
end
|
BITS 64
%macro OFFSET 0
push $
call getOffsetAddr
%endmacro
;%macro BaseAddr 0
; push $
; call getBaseAddr
;%endmacro
jmp ENTRY
OC:
db ORIGIN_CODE
db 0x00
ENTRY:
push rbp
mov rbp , rsp
sub rsp , 0x40
; BaseAddr
; mov [rbp - 0x08] , rax
OFFSET
mov [rbp - 0x10] , rax
; get PEB address
mov rax , [gs:0x60]
mov [rbp - 0x18] , rax
; do any thing
; for abi]
mov rax , OC
add rax , [rbp-0x10]
mov r9 , rax ; push originCode
mov r8 , ORIGIN_ENTER ; push origin enter point
mov rdx , qword[rbp - 0x10] ; push offset
mov rcx , qword[rbp - 0x18] ; push PEB address
mov rax , SIZE
add rax , [rbp - 0x10]
call rax
mov rax , [rbp - 0x08]
add rax , ORIGIN_ENTER
leave
jmp rax
; Get memory offset
getOffsetAddr:
mov rax , [rsp]
sub rax , [rsp + 0x08]
sub rax , 0x0A
ret 8
; get the PE base address on runtime
; base address value store in eax
;getBaseAddr:
; mov rax , [rsp]
; sub rax , [rsp + 0x08]
; sub rax , NEW_ENTER+0x0A;new entry point +10
; ret 8
|
; A253120: Numbers n such that the sum of the octagonal numbers O(n), O(n+1), O(n+2) and O(n+3) is equal to the hexagonal number H(m) for some m.
; Submitted by Jon Maiga
; 6,705,69196,6780615,664431186,65107475725,6379868189976,625161975142035,61259493695729566,6002805220206355545,588213652086527113956,57638935099259450812255,5648027426075339652487146,553449048820284026492928165,54232358756961759256654473136,5314217709133432123125645439275,520739103136319386307056598575926,51027117889650166425968421015001585,5000136814082579990358598202871579516,489962380662203188888716655460399791095,48011313168081829931103873636916307947906
mul $0,2
add $0,1
mov $1,8
mov $2,3
lpb $0
sub $0,1
add $2,$1
add $1,$2
add $1,2
add $2,$1
add $1,$2
add $2,$1
lpe
mov $0,$2
sub $0,85
div $0,12
add $0,6
|
; A004652: Expansion of x*(1+x^2+x^4)/((1-x)*(1-x^2)*(1-x^3)).
; 0,1,1,3,4,7,9,13,16,21,25,31,36,43,49,57,64,73,81,91,100,111,121,133,144,157,169,183,196,211,225,241,256,273,289,307,324,343,361,381,400,421,441,463,484,507,529,553,576,601,625,651,676,703,729,757,784,813,841,871,900,931,961,993,1024,1057,1089,1123,1156,1191,1225,1261,1296,1333,1369,1407,1444,1483,1521,1561,1600,1641,1681,1723,1764,1807,1849,1893,1936,1981,2025,2071,2116,2163,2209,2257,2304,2353,2401,2451
pow $0,2
mov $1,3
add $1,$0
div $1,4
mov $0,$1
|
; A139279: a(n) = 40*n - 32.
; 8,48,88,128,168,208,248,288,328,368,408,448,488,528,568,608,648,688,728,768,808,848,888,928,968,1008,1048,1088,1128,1168,1208,1248,1288,1328,1368,1408,1448,1488,1528,1568,1608,1648,1688,1728,1768,1808,1848,1888,1928,1968,2008,2048,2088,2128,2168,2208,2248,2288,2328,2368,2408,2448,2488,2528,2568,2608,2648,2688,2728,2768,2808,2848,2888,2928,2968,3008,3048,3088,3128,3168,3208,3248,3288,3328,3368,3408,3448,3488,3528,3568,3608,3648,3688,3728,3768,3808,3848,3888,3928,3968
mul $0,40
add $0,8
|
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#ifdef HAVE_LIBREADLINE
# if defined(HAVE_READLINE_READLINE_H)
# include <readline/readline.h>
# elif defined(HAVE_READLINE_H)
# include <readline.h>
# else /* !defined(HAVE_READLINE_H) */
extern char *readline (const char *prompt);
# endif /* !defined(HAVE_READLINE_H) */
char *cmdline = NULL;
#else /* !defined(HAVE_READLINE_READLINE_H) */
/* no readline */
#define LINEMAX 1024
char *readline(const char *prompt) {
if (prompt) {
fprintf(stderr, "> ");
fflush(stderr);
}
char *buff = (char*)malloc(LINEMAX);
if (fgets(buff, LINEMAX, stdin) == NULL) {
delete[] buff;
return NULL;
}
return buff;
}
#endif /* HAVE_LIBREADLINE */
#ifdef HAVE_READLINE_HISTORY
# if defined(HAVE_READLINE_HISTORY_H)
# include <readline/history.h>
# elif defined(HAVE_HISTORY_H)
# include <history.h>
# else /* !defined(HAVE_HISTORY_H) */
extern void add_history (const char *string);
# endif /* defined(HAVE_READLINE_HISTORY_H) */
#else
/* no history */
void add_history(const char *string) {
}
#endif /* HAVE_READLINE_HISTORY */
template <class T> int size(T &x) { return x.size(); }
class expr {
public:
int height, width, lvc;
virtual ~expr() {
}
virtual void draw(char **res, int x, int y)=0;
};
class numexpr: public expr {
public:
string num;
numexpr(string num) {
this->num = num;
height = 1;
width = size(num);
lvc = 0;
}
~numexpr() {
}
void draw(char **res, int x, int y) {
for (int i = 0; i < size(num); i++) {
res[x][y + i] = num[i];
}
}
};
class powexpr: public expr {
public:
expr *a, *b;
powexpr(expr *a, expr *b) {
this->a = a;
this->b = b;
height = a->height + b->height;
width = a->width + b->width;
lvc = b->height + a->lvc;
}
~powexpr() {
delete a;
delete b;
}
void draw(char **res, int x, int y) {
a->draw(res, x + b->height, y);
b->draw(res, x, y + a->width);
}
};
class subexpr: public expr {
public:
expr *a, *b;
subexpr(expr *a, expr *b) {
this->a = a;
this->b = b;
height = a->height + b->height;
width = a->width + b->width;
lvc = a->lvc;
}
~subexpr() {
delete a;
delete b;
}
void draw(char **res, int x, int y) {
a->draw(res, x, y);
b->draw(res, x + a->height, y + a->width);
}
};
class divexpr: public expr {
public:
expr *a, *b;
divexpr(expr *a, expr *b) {
this->a = a;
this->b = b;
height = a->height + 1 + b->height;
width = max(a->width, b->width);
if (width > 1) {
width += 2;
}
lvc = a->height;
}
~divexpr() {
delete a;
delete b;
}
void draw(char **res, int x, int y) {
a->draw(res, x, y + (width - a->width + 1) / 2);
b->draw(res, x + a->height + 1, y + (width - b->width + 1) / 2);
for (int i = 0; i < width; i++) {
res[x + a->height][y + i] = '-';
}
}
};
class negexpr: public expr {
public:
expr *e;
negexpr(expr *e) {
this->e = e;
height = e->height;
width = 1 + e->width;
lvc = e->lvc;
}
~negexpr() {
delete e;
}
void draw(char **res, int x, int y) {
e->draw(res, x, y + 1);
res[x + e->lvc][y] = '-';
}
};
class twoexpr: public expr {
public:
char op;
expr *a, *b;
twoexpr(expr *a, char op, expr *b) {
this->a = a;
this->op = op;
this->b = b;
int aabove = a->lvc,
abelow = a->height - a->lvc - 1;
int babove = b->lvc,
bbelow = b->height - b->lvc - 1;
width = a->width + 3 + b->width;
height = max(aabove, babove) + 1 + max(abelow, bbelow);
lvc = max(aabove, babove);
}
~twoexpr() {
delete a;
delete b;
}
void draw(char **res, int x, int y) {
int aabove = a->lvc;
int babove = b->lvc;
int above = max(aabove, babove);
a->draw(res, x + (above - aabove), y);
b->draw(res, x + (above - babove), y + a->width + 3);
res[x + lvc][y + a->width + 1] = op;
}
};
class invmulexpr: public expr {
public:
char op;
expr *a, *b;
invmulexpr(expr *a, expr *b) {
this->a = a;
this->b = b;
int aabove = a->lvc,
abelow = a->height - a->lvc - 1;
int babove = b->lvc,
bbelow = b->height - b->lvc - 1;
width = a->width + 1 + b->width;
height = max(aabove, babove) + 1 + max(abelow, bbelow);
lvc = max(aabove, babove);
}
~invmulexpr() {
delete a;
delete b;
}
void draw(char **res, int x, int y) {
int aabove = a->lvc;
int babove = b->lvc;
int above = max(aabove, babove);
a->draw(res, x + (above - aabove), y);
b->draw(res, x + (above - babove), y + a->width + 1);
}
};
class insideexpr: public expr {
public:
expr *e;
insideexpr(expr *e) {
this->e = e;
height = e->height;
width = e->width + 2;
lvc = (e->height) / 2;
}
~insideexpr() {
delete e;
}
void draw(char **res, int x, int y) {
e->draw(res, x, y + 1);
if (height == 1) {
res[x][y] = '(';
res[x][y + e->width + 1] = ')';
} else {
res[x][y] = '/';
res[x][y + e->width + 1] = '\\';
for (int i = 1; i < height-1; i++) {
res[x+i][y] = '(';
res[x+i][y + e->width + 1] = ')';
}
res[x+height-1][y] = '\\';
res[x+height-1][y + e->width + 1] = '/';
}
}
};
class hiddeninsideexpr: public expr {
public:
expr *e;
hiddeninsideexpr(expr *e) {
this->e = e;
height = e->height;
width = e->width;
lvc = e->lvc;
}
~hiddeninsideexpr() {
delete e;
}
void draw(char **res, int x, int y) {
e->draw(res, x, y);
}
};
/*
NUM = [0-9]+(\.[0-9]+)?
IDENT = [a-zA-Z][a-zA-Z0-9]*
e0 := e1 = e0 |
e1
e1 := e2 + e1 |
e2 - e1 |
e2
e2 := e3 * e2 |
e3 / e2 |
e3 e2 |
e3
e3 := e3 ^ e4 |
e3
e4 := -e4 |
e5
e5 := NUM |
IDENT |
IDENT_e5 |
( e0 ) |
{ e0 }
*/
bool is_op(char c) {
switch (c) {
case '=':
case '+':
case '-':
case '*':
case '/':
case '^':
case '(':
case ')':
case '{':
case '}':
case '_':
return true;
}
return false;
}
string token;
stringstream ss;
string s;
int at = 0;
bool token_is_ident = false,
token_is_num = false;
void error(string msg) {
cerr << "error: " << msg << endl;
}
bool expect(string tok, string msg) {
if (token != tok) {
error(msg);
return false;
}
return true;
}
bool pop() {
token_is_ident = false;
token_is_num = false;
while (at < size(s) && s[at] == ' ')
at++;
if (at == size(s)) {
token = "";
return true;
}
ss.str("");
ss.clear();
if ('0' <= s[at] && s[at] <= '9') {
bool founddigit = false,
founddot = false,
afterdot = false;
while (at < size(s) && (('0' <= s[at] && s[at] <= '9') || (!founddot && s[at] == '.'))) {
if (s[at] == '.') founddot = true;
else {
if (founddot) {
afterdot = true;
}
founddigit = true;
}
ss << s[at++];
}
if (!founddigit || (founddot && !afterdot)) {
error("invalid numeric literal");
return false;
}
token_is_num = true;
} else if (('a' <= s[at] && s[at] <= 'z') || ('A' <= s[at] && s[at] <= 'Z')) {
while (at < size(s) && (('a' <= s[at] && s[at] <= 'z') || ('A' <= s[at] && s[at] <= 'Z') || ('0' <= s[at] && s[at] <= '9'))) {
ss << s[at++];
}
token_is_ident = true;
} else if (is_op(s[at])) {
ss << s[at++];
} else {
error(string("unrecognized token: ") + s[at]);
return false;
}
token = ss.str();
return true;
}
expr* e0();
expr* e5() {
if (token == "(") {
if (!pop()) return NULL;
expr *res = e0();
if (res == NULL) return NULL;
if (!expect(")", "expected ), got " + token)) {
delete res;
return NULL;
}
if (!pop()) {
delete res;
return NULL;
}
return new insideexpr(res);
} else if (token == "{") {
if (!pop()) return NULL;
expr *res = e0();
if (res == NULL) return NULL;
if (!expect("}", "expected }, got " + token)) {
delete res;
return NULL;
}
if (!pop()) {
delete res;
return NULL;
}
return new hiddeninsideexpr(res);
} else if (token_is_num) {
expr *res = new numexpr(token);
if (!pop()) {
delete res;
return NULL;
}
return res;
} else if (token_is_ident) {
expr *res = new numexpr(token);
if (!pop()) {
delete res;
return NULL;
}
if (token == "_") {
if (!pop()) {
delete res;
return NULL;
}
expr *rest = e5();
if (rest == NULL) {
delete res;
return NULL;
}
res = new subexpr(res, rest);
}
return res;
} else if (token == "") {
error("unexpected end of expression");
return NULL;
} else {
error(string("invalid literal: ") + token);
return NULL;
}
}
expr *e4() {
if (token == "-") {
if (!pop()) return NULL;
expr *e = e4();
if (e == NULL) return NULL;
return new negexpr(e);
} else {
return e5();
}
}
expr* e3() {
vector<expr*> exps;
expr *e = e4();
if (e == NULL) return NULL;
exps.push_back(e);
bool ok = true;
while (true) {
if (token == "^") {
if (!pop()) {
ok = false;
break;
}
expr *e = e4();
if (e == NULL) {
ok = false;
break;
}
exps.push_back(e);
} else {
break;
}
}
if (!ok) {
for (int i = 0; i < size(exps); i++)
delete exps[i];
return NULL;
}
expr *res = exps[size(exps) - 1];
for (int i = size(exps) - 2; i >= 0; i--) {
res = new powexpr(exps[i], res);
}
return res;
}
expr* e2() {
vector<expr*> exps;
vector<char> ops;
expr *e = e3();
if (e == NULL) return NULL;
exps.push_back(e);
bool ok = true;
while (true) {
if (token == "*") {
if (!pop()) {
ok = false;
break;
}
ops.push_back('*');
expr *e = e3();
if (e == NULL) {
ok = false;
break;
}
exps.push_back(e);
} else if (token == "/") {
if (!pop()) {
ok = false;
break;
}
ops.push_back('/');
expr *e = e3();
if (e == NULL) {
ok = false;
break;
}
exps.push_back(e);
} else if (token_is_ident || token_is_num || token == "(" || token == "{") {
ops.push_back(' ');
expr *e = e3();
if (e == NULL) {
ok = false;
break;
}
exps.push_back(e);
} else {
break;
}
}
if (!ok) {
for (int i = 0; i < size(exps); i++) {
delete exps[i];
}
return NULL;
}
expr *res = exps[0];
for (int i = 0; i < size(ops); i++) {
if (ops[i] == '*') {
res = new twoexpr(res, '*', exps[i+1]);
} else if (ops[i] == '/') {
res = new divexpr(res, exps[i+1]);
} else if (ops[i] == ' ') {
res = new invmulexpr(res, exps[i+1]);
} else {
assert(false);
}
}
return res;
}
expr* e1() {
vector<expr*> exps;
vector<char> ops;
expr *e = e2();
if (e == NULL) return NULL;
exps.push_back(e);
bool ok = true;
while (true) {
if (token == "+") {
if (!pop()) {
ok = false;
break;
}
ops.push_back('+');
expr *e = e2();
if (e == NULL) {
ok = false;
break;
}
exps.push_back(e);
} else if (token == "-") {
if (!pop()) {
ok = false;
break;
}
ops.push_back('-');
expr *e = e2();
if (e == NULL) {
ok = false;
break;
}
exps.push_back(e);
} else {
break;
}
}
if (!ok) {
for (int i = 0; i < size(exps); i++)
delete exps[i];
return NULL;
}
expr *res = exps[0];
for (int i = 0; i < size(ops); i++) {
if (ops[i] == '+') {
res = new twoexpr(res, '+', exps[i+1]);
} else if (ops[i] == '-') {
res = new twoexpr(res, '-', exps[i+1]);
} else {
assert(false);
}
}
return res;
}
expr* e0() {
vector<expr*> exps;
exps.push_back(e1());
bool ok = true;
while (true) {
if (token == "=") {
if (!pop()) {
ok = false;
break;
}
expr *e = e1();
if (e == NULL) {
ok = false;
break;
}
exps.push_back(e);
} else {
break;
}
}
if (!ok) {
for (int i = 0; i < size(exps); i++)
delete exps[i];
return NULL;
}
expr *res = exps[0];
for (int i = 1; i < size(exps); i++) {
res = new twoexpr(res, '=', exps[i]);
}
return res;
}
void display() {
at = 0;
if (!pop()) {
return;
}
expr *e = e0();
if (e == NULL) {
return;
}
if (!expect("", "unexpected token at end of expression: " + token)) {
delete e;
return;
}
char **res = new char*[e->height];
for (int i = 0; i < e->height; i++) {
res[i] = new char[e->width];
memset(res[i], ' ', e->width);
}
e->draw(res, 0, 0);
for (int i = 0; i < e->height; i++) {
int end = e->width - 1;
while (end >= 0 && res[i][end] == ' ') {
end--;
}
for (int j = 0; j <= end; j++) {
cout << res[i][j];
}
cout << endl;
}
for (int i = 0; i < e->height; i++)
delete[] res[i];
delete[] res;
delete e;
}
int main(int argc, char *argv[]) {
if (argc >= 2) {
stringstream ss;
for (int i = 1; i < argc; i++) {
ss << argv[i];
}
s = ss.str();
display();
} else {
while (true) {
char *line = readline("> ");
if (line == NULL) {
break;
}
add_history(line);
s = string(line);
free(line);
cerr << endl;
display();
cerr << endl;
}
}
return 0;
}
|
;++
;
; Copyright (c) Microsoft Corporation. All rights reserved.
;
; You may only use this code if you agree to the terms of the Windows Research Kernel Source Code License agreement (see License.txt).
; If you do not agree to the terms, do not use the code.
;
; Module Name:
;
; sysstubs.asm
;
; Abstract:
;
; This module implements the system service dispatch stub procedures.
;
; Revision History:
; Use Fast System call mechanism.
;
;--
include ks386.inc
include callconv.inc
.386
STUBS_BEGIN1 macro t
TITLE t
endm
STUBS_BEGIN2 macro t
endm
STUBS_BEGIN3 macro t
_TEXT SEGMENT DWORD PUBLIC 'CODE'
ASSUME DS:FLAT, ES:FLAT, SS:NOTHING, FS:NOTHING, GS:NOTHING
endm
STUBS_BEGIN4 macro t
endm
STUBS_BEGIN5 macro t
align 4
endm
STUBS_BEGIN6 macro t
endm
STUBS_BEGIN7 macro t
endm
STUBS_BEGIN8 macro t
endm
STUBS_END macro t
_TEXT ENDS
end
endm
SYSSTUBS_ENTRY1 macro ServiceNumber, Name, NumArgs
cPublicProc _Zw&Name,NumArgs
.FPO ( 0, NumArgs, 0, 0, 0, 0 )
extrn _KiSystemService:PROC
mov eax, ServiceNumber ; (eax) = service number
lea edx, [esp]+4 ; (edx) -> arguments
pushfd ; EFLAGS to trap frame
push KGDT_R0_CODE ; CS to trap frame
call _KiSystemService ; EIP to trap frame and enter handler
stdRET _Zw&Name
stdENDP _Zw&Name
endm
SYSSTUBS_ENTRY2 macro ServiceNumber, Name, NumArgs
endm
SYSSTUBS_ENTRY3 macro ServiceNumber, Name, NumArgs
endm
SYSSTUBS_ENTRY4 macro ServiceNumber, Name, NumArgs
endm
SYSSTUBS_ENTRY5 macro ServiceNumber, Name, NumArgs
endm
SYSSTUBS_ENTRY6 macro ServiceNumber, Name, NumArgs
endm
SYSSTUBS_ENTRY7 macro ServiceNumber, Name, NumArgs
endm
SYSSTUBS_ENTRY8 macro ServiceNumber, Name, NumArgs
endm
USRSTUBS_ENTRY1 macro ServiceNumber, Name, NumArgs
cPublicProc _Zw&Name, NumArgs
PUBLICP _Nt&Name, NumArgs
LABELP _Nt&Name, NumArgs
.FPO ( 0, NumArgs, 0, 0, 0, 0 )
mov eax, ServiceNumber ; (eax) = service number
mov edx, MM_SHARED_USER_DATA_VA+UsSystemCall
call [edx]
stdRET _Zw&Name
stdENDP _Zw&Name
endm
USRSTUBS_ENTRY2 macro ServiceNumber, Name, NumArgs
endm
USRSTUBS_ENTRY3 macro ServiceNumber, Name, NumArgs
endm
USRSTUBS_ENTRY4 macro ServiceNumber, Name, NumArgs
endm
USRSTUBS_ENTRY5 macro ServiceNumber, Name, NumArgs
endm
USRSTUBS_ENTRY6 macro ServiceNumber, Name, NumArgs
endm
USRSTUBS_ENTRY7 macro ServiceNumber, Name, NumArgs
endm
USRSTUBS_ENTRY8 macro ServiceNumber, Name, NumArgs
endm
STUBS_BEGIN1 <"System Service Stub Procedures">
STUBS_BEGIN2 <"System Service Stub Procedures">
STUBS_BEGIN3 <"System Service Stub Procedures">
STUBS_BEGIN4 <"System Service Stub Procedures">
STUBS_BEGIN5 <"System Service Stub Procedures">
STUBS_BEGIN6 <"System Service Stub Procedures">
STUBS_BEGIN7 <"System Service Stub Procedures">
STUBS_BEGIN8 <"System Service Stub Procedures">
SYSSTUBS_ENTRY1 0, AcceptConnectPort, 6
SYSSTUBS_ENTRY2 0, AcceptConnectPort, 6
SYSSTUBS_ENTRY3 0, AcceptConnectPort, 6
SYSSTUBS_ENTRY4 0, AcceptConnectPort, 6
SYSSTUBS_ENTRY5 0, AcceptConnectPort, 6
SYSSTUBS_ENTRY6 0, AcceptConnectPort, 6
SYSSTUBS_ENTRY7 0, AcceptConnectPort, 6
SYSSTUBS_ENTRY8 0, AcceptConnectPort, 6
SYSSTUBS_ENTRY1 1, AccessCheck, 8
SYSSTUBS_ENTRY2 1, AccessCheck, 8
SYSSTUBS_ENTRY3 1, AccessCheck, 8
SYSSTUBS_ENTRY4 1, AccessCheck, 8
SYSSTUBS_ENTRY5 1, AccessCheck, 8
SYSSTUBS_ENTRY6 1, AccessCheck, 8
SYSSTUBS_ENTRY7 1, AccessCheck, 8
SYSSTUBS_ENTRY8 1, AccessCheck, 8
SYSSTUBS_ENTRY1 2, AccessCheckAndAuditAlarm, 11
SYSSTUBS_ENTRY2 2, AccessCheckAndAuditAlarm, 11
SYSSTUBS_ENTRY3 2, AccessCheckAndAuditAlarm, 11
SYSSTUBS_ENTRY4 2, AccessCheckAndAuditAlarm, 11
SYSSTUBS_ENTRY5 2, AccessCheckAndAuditAlarm, 11
SYSSTUBS_ENTRY6 2, AccessCheckAndAuditAlarm, 11
SYSSTUBS_ENTRY7 2, AccessCheckAndAuditAlarm, 11
SYSSTUBS_ENTRY8 2, AccessCheckAndAuditAlarm, 11
SYSSTUBS_ENTRY1 3, AccessCheckByType, 11
SYSSTUBS_ENTRY2 3, AccessCheckByType, 11
SYSSTUBS_ENTRY3 3, AccessCheckByType, 11
SYSSTUBS_ENTRY4 3, AccessCheckByType, 11
SYSSTUBS_ENTRY5 3, AccessCheckByType, 11
SYSSTUBS_ENTRY6 3, AccessCheckByType, 11
SYSSTUBS_ENTRY7 3, AccessCheckByType, 11
SYSSTUBS_ENTRY8 3, AccessCheckByType, 11
SYSSTUBS_ENTRY1 4, AccessCheckByTypeAndAuditAlarm, 16
SYSSTUBS_ENTRY2 4, AccessCheckByTypeAndAuditAlarm, 16
SYSSTUBS_ENTRY3 4, AccessCheckByTypeAndAuditAlarm, 16
SYSSTUBS_ENTRY4 4, AccessCheckByTypeAndAuditAlarm, 16
SYSSTUBS_ENTRY5 4, AccessCheckByTypeAndAuditAlarm, 16
SYSSTUBS_ENTRY6 4, AccessCheckByTypeAndAuditAlarm, 16
SYSSTUBS_ENTRY7 4, AccessCheckByTypeAndAuditAlarm, 16
SYSSTUBS_ENTRY8 4, AccessCheckByTypeAndAuditAlarm, 16
SYSSTUBS_ENTRY1 5, AccessCheckByTypeResultList, 11
SYSSTUBS_ENTRY2 5, AccessCheckByTypeResultList, 11
SYSSTUBS_ENTRY3 5, AccessCheckByTypeResultList, 11
SYSSTUBS_ENTRY4 5, AccessCheckByTypeResultList, 11
SYSSTUBS_ENTRY5 5, AccessCheckByTypeResultList, 11
SYSSTUBS_ENTRY6 5, AccessCheckByTypeResultList, 11
SYSSTUBS_ENTRY7 5, AccessCheckByTypeResultList, 11
SYSSTUBS_ENTRY8 5, AccessCheckByTypeResultList, 11
SYSSTUBS_ENTRY1 6, AccessCheckByTypeResultListAndAuditAlarm, 16
SYSSTUBS_ENTRY2 6, AccessCheckByTypeResultListAndAuditAlarm, 16
SYSSTUBS_ENTRY3 6, AccessCheckByTypeResultListAndAuditAlarm, 16
SYSSTUBS_ENTRY4 6, AccessCheckByTypeResultListAndAuditAlarm, 16
SYSSTUBS_ENTRY5 6, AccessCheckByTypeResultListAndAuditAlarm, 16
SYSSTUBS_ENTRY6 6, AccessCheckByTypeResultListAndAuditAlarm, 16
SYSSTUBS_ENTRY7 6, AccessCheckByTypeResultListAndAuditAlarm, 16
SYSSTUBS_ENTRY8 6, AccessCheckByTypeResultListAndAuditAlarm, 16
SYSSTUBS_ENTRY1 7, AccessCheckByTypeResultListAndAuditAlarmByHandle, 17
SYSSTUBS_ENTRY2 7, AccessCheckByTypeResultListAndAuditAlarmByHandle, 17
SYSSTUBS_ENTRY3 7, AccessCheckByTypeResultListAndAuditAlarmByHandle, 17
SYSSTUBS_ENTRY4 7, AccessCheckByTypeResultListAndAuditAlarmByHandle, 17
SYSSTUBS_ENTRY5 7, AccessCheckByTypeResultListAndAuditAlarmByHandle, 17
SYSSTUBS_ENTRY6 7, AccessCheckByTypeResultListAndAuditAlarmByHandle, 17
SYSSTUBS_ENTRY7 7, AccessCheckByTypeResultListAndAuditAlarmByHandle, 17
SYSSTUBS_ENTRY8 7, AccessCheckByTypeResultListAndAuditAlarmByHandle, 17
SYSSTUBS_ENTRY1 8, AddAtom, 3
SYSSTUBS_ENTRY2 8, AddAtom, 3
SYSSTUBS_ENTRY3 8, AddAtom, 3
SYSSTUBS_ENTRY4 8, AddAtom, 3
SYSSTUBS_ENTRY5 8, AddAtom, 3
SYSSTUBS_ENTRY6 8, AddAtom, 3
SYSSTUBS_ENTRY7 8, AddAtom, 3
SYSSTUBS_ENTRY8 8, AddAtom, 3
SYSSTUBS_ENTRY1 9, AddBootEntry, 2
SYSSTUBS_ENTRY2 9, AddBootEntry, 2
SYSSTUBS_ENTRY3 9, AddBootEntry, 2
SYSSTUBS_ENTRY4 9, AddBootEntry, 2
SYSSTUBS_ENTRY5 9, AddBootEntry, 2
SYSSTUBS_ENTRY6 9, AddBootEntry, 2
SYSSTUBS_ENTRY7 9, AddBootEntry, 2
SYSSTUBS_ENTRY8 9, AddBootEntry, 2
SYSSTUBS_ENTRY1 10, AddDriverEntry, 2
SYSSTUBS_ENTRY2 10, AddDriverEntry, 2
SYSSTUBS_ENTRY3 10, AddDriverEntry, 2
SYSSTUBS_ENTRY4 10, AddDriverEntry, 2
SYSSTUBS_ENTRY5 10, AddDriverEntry, 2
SYSSTUBS_ENTRY6 10, AddDriverEntry, 2
SYSSTUBS_ENTRY7 10, AddDriverEntry, 2
SYSSTUBS_ENTRY8 10, AddDriverEntry, 2
SYSSTUBS_ENTRY1 11, AdjustGroupsToken, 6
SYSSTUBS_ENTRY2 11, AdjustGroupsToken, 6
SYSSTUBS_ENTRY3 11, AdjustGroupsToken, 6
SYSSTUBS_ENTRY4 11, AdjustGroupsToken, 6
SYSSTUBS_ENTRY5 11, AdjustGroupsToken, 6
SYSSTUBS_ENTRY6 11, AdjustGroupsToken, 6
SYSSTUBS_ENTRY7 11, AdjustGroupsToken, 6
SYSSTUBS_ENTRY8 11, AdjustGroupsToken, 6
SYSSTUBS_ENTRY1 12, AdjustPrivilegesToken, 6
SYSSTUBS_ENTRY2 12, AdjustPrivilegesToken, 6
SYSSTUBS_ENTRY3 12, AdjustPrivilegesToken, 6
SYSSTUBS_ENTRY4 12, AdjustPrivilegesToken, 6
SYSSTUBS_ENTRY5 12, AdjustPrivilegesToken, 6
SYSSTUBS_ENTRY6 12, AdjustPrivilegesToken, 6
SYSSTUBS_ENTRY7 12, AdjustPrivilegesToken, 6
SYSSTUBS_ENTRY8 12, AdjustPrivilegesToken, 6
SYSSTUBS_ENTRY1 13, AlertResumeThread, 2
SYSSTUBS_ENTRY2 13, AlertResumeThread, 2
SYSSTUBS_ENTRY3 13, AlertResumeThread, 2
SYSSTUBS_ENTRY4 13, AlertResumeThread, 2
SYSSTUBS_ENTRY5 13, AlertResumeThread, 2
SYSSTUBS_ENTRY6 13, AlertResumeThread, 2
SYSSTUBS_ENTRY7 13, AlertResumeThread, 2
SYSSTUBS_ENTRY8 13, AlertResumeThread, 2
SYSSTUBS_ENTRY1 14, AlertThread, 1
SYSSTUBS_ENTRY2 14, AlertThread, 1
SYSSTUBS_ENTRY3 14, AlertThread, 1
SYSSTUBS_ENTRY4 14, AlertThread, 1
SYSSTUBS_ENTRY5 14, AlertThread, 1
SYSSTUBS_ENTRY6 14, AlertThread, 1
SYSSTUBS_ENTRY7 14, AlertThread, 1
SYSSTUBS_ENTRY8 14, AlertThread, 1
SYSSTUBS_ENTRY1 15, AllocateLocallyUniqueId, 1
SYSSTUBS_ENTRY2 15, AllocateLocallyUniqueId, 1
SYSSTUBS_ENTRY3 15, AllocateLocallyUniqueId, 1
SYSSTUBS_ENTRY4 15, AllocateLocallyUniqueId, 1
SYSSTUBS_ENTRY5 15, AllocateLocallyUniqueId, 1
SYSSTUBS_ENTRY6 15, AllocateLocallyUniqueId, 1
SYSSTUBS_ENTRY7 15, AllocateLocallyUniqueId, 1
SYSSTUBS_ENTRY8 15, AllocateLocallyUniqueId, 1
SYSSTUBS_ENTRY1 16, AllocateUserPhysicalPages, 3
SYSSTUBS_ENTRY2 16, AllocateUserPhysicalPages, 3
SYSSTUBS_ENTRY3 16, AllocateUserPhysicalPages, 3
SYSSTUBS_ENTRY4 16, AllocateUserPhysicalPages, 3
SYSSTUBS_ENTRY5 16, AllocateUserPhysicalPages, 3
SYSSTUBS_ENTRY6 16, AllocateUserPhysicalPages, 3
SYSSTUBS_ENTRY7 16, AllocateUserPhysicalPages, 3
SYSSTUBS_ENTRY8 16, AllocateUserPhysicalPages, 3
SYSSTUBS_ENTRY1 17, AllocateUuids, 4
SYSSTUBS_ENTRY2 17, AllocateUuids, 4
SYSSTUBS_ENTRY3 17, AllocateUuids, 4
SYSSTUBS_ENTRY4 17, AllocateUuids, 4
SYSSTUBS_ENTRY5 17, AllocateUuids, 4
SYSSTUBS_ENTRY6 17, AllocateUuids, 4
SYSSTUBS_ENTRY7 17, AllocateUuids, 4
SYSSTUBS_ENTRY8 17, AllocateUuids, 4
SYSSTUBS_ENTRY1 18, AllocateVirtualMemory, 6
SYSSTUBS_ENTRY2 18, AllocateVirtualMemory, 6
SYSSTUBS_ENTRY3 18, AllocateVirtualMemory, 6
SYSSTUBS_ENTRY4 18, AllocateVirtualMemory, 6
SYSSTUBS_ENTRY5 18, AllocateVirtualMemory, 6
SYSSTUBS_ENTRY6 18, AllocateVirtualMemory, 6
SYSSTUBS_ENTRY7 18, AllocateVirtualMemory, 6
SYSSTUBS_ENTRY8 18, AllocateVirtualMemory, 6
SYSSTUBS_ENTRY1 19, ApphelpCacheControl, 2
SYSSTUBS_ENTRY2 19, ApphelpCacheControl, 2
SYSSTUBS_ENTRY3 19, ApphelpCacheControl, 2
SYSSTUBS_ENTRY4 19, ApphelpCacheControl, 2
SYSSTUBS_ENTRY5 19, ApphelpCacheControl, 2
SYSSTUBS_ENTRY6 19, ApphelpCacheControl, 2
SYSSTUBS_ENTRY7 19, ApphelpCacheControl, 2
SYSSTUBS_ENTRY8 19, ApphelpCacheControl, 2
SYSSTUBS_ENTRY1 20, AreMappedFilesTheSame, 2
SYSSTUBS_ENTRY2 20, AreMappedFilesTheSame, 2
SYSSTUBS_ENTRY3 20, AreMappedFilesTheSame, 2
SYSSTUBS_ENTRY4 20, AreMappedFilesTheSame, 2
SYSSTUBS_ENTRY5 20, AreMappedFilesTheSame, 2
SYSSTUBS_ENTRY6 20, AreMappedFilesTheSame, 2
SYSSTUBS_ENTRY7 20, AreMappedFilesTheSame, 2
SYSSTUBS_ENTRY8 20, AreMappedFilesTheSame, 2
SYSSTUBS_ENTRY1 21, AssignProcessToJobObject, 2
SYSSTUBS_ENTRY2 21, AssignProcessToJobObject, 2
SYSSTUBS_ENTRY3 21, AssignProcessToJobObject, 2
SYSSTUBS_ENTRY4 21, AssignProcessToJobObject, 2
SYSSTUBS_ENTRY5 21, AssignProcessToJobObject, 2
SYSSTUBS_ENTRY6 21, AssignProcessToJobObject, 2
SYSSTUBS_ENTRY7 21, AssignProcessToJobObject, 2
SYSSTUBS_ENTRY8 21, AssignProcessToJobObject, 2
SYSSTUBS_ENTRY1 22, CallbackReturn, 3
SYSSTUBS_ENTRY2 22, CallbackReturn, 3
SYSSTUBS_ENTRY3 22, CallbackReturn, 3
SYSSTUBS_ENTRY4 22, CallbackReturn, 3
SYSSTUBS_ENTRY5 22, CallbackReturn, 3
SYSSTUBS_ENTRY6 22, CallbackReturn, 3
SYSSTUBS_ENTRY7 22, CallbackReturn, 3
SYSSTUBS_ENTRY8 22, CallbackReturn, 3
SYSSTUBS_ENTRY1 23, CancelDeviceWakeupRequest, 1
SYSSTUBS_ENTRY2 23, CancelDeviceWakeupRequest, 1
SYSSTUBS_ENTRY3 23, CancelDeviceWakeupRequest, 1
SYSSTUBS_ENTRY4 23, CancelDeviceWakeupRequest, 1
SYSSTUBS_ENTRY5 23, CancelDeviceWakeupRequest, 1
SYSSTUBS_ENTRY6 23, CancelDeviceWakeupRequest, 1
SYSSTUBS_ENTRY7 23, CancelDeviceWakeupRequest, 1
SYSSTUBS_ENTRY8 23, CancelDeviceWakeupRequest, 1
SYSSTUBS_ENTRY1 24, CancelIoFile, 2
SYSSTUBS_ENTRY2 24, CancelIoFile, 2
SYSSTUBS_ENTRY3 24, CancelIoFile, 2
SYSSTUBS_ENTRY4 24, CancelIoFile, 2
SYSSTUBS_ENTRY5 24, CancelIoFile, 2
SYSSTUBS_ENTRY6 24, CancelIoFile, 2
SYSSTUBS_ENTRY7 24, CancelIoFile, 2
SYSSTUBS_ENTRY8 24, CancelIoFile, 2
SYSSTUBS_ENTRY1 25, CancelTimer, 2
SYSSTUBS_ENTRY2 25, CancelTimer, 2
SYSSTUBS_ENTRY3 25, CancelTimer, 2
SYSSTUBS_ENTRY4 25, CancelTimer, 2
SYSSTUBS_ENTRY5 25, CancelTimer, 2
SYSSTUBS_ENTRY6 25, CancelTimer, 2
SYSSTUBS_ENTRY7 25, CancelTimer, 2
SYSSTUBS_ENTRY8 25, CancelTimer, 2
SYSSTUBS_ENTRY1 26, ClearEvent, 1
SYSSTUBS_ENTRY2 26, ClearEvent, 1
SYSSTUBS_ENTRY3 26, ClearEvent, 1
SYSSTUBS_ENTRY4 26, ClearEvent, 1
SYSSTUBS_ENTRY5 26, ClearEvent, 1
SYSSTUBS_ENTRY6 26, ClearEvent, 1
SYSSTUBS_ENTRY7 26, ClearEvent, 1
SYSSTUBS_ENTRY8 26, ClearEvent, 1
SYSSTUBS_ENTRY1 27, Close, 1
SYSSTUBS_ENTRY2 27, Close, 1
SYSSTUBS_ENTRY3 27, Close, 1
SYSSTUBS_ENTRY4 27, Close, 1
SYSSTUBS_ENTRY5 27, Close, 1
SYSSTUBS_ENTRY6 27, Close, 1
SYSSTUBS_ENTRY7 27, Close, 1
SYSSTUBS_ENTRY8 27, Close, 1
SYSSTUBS_ENTRY1 28, CloseObjectAuditAlarm, 3
SYSSTUBS_ENTRY2 28, CloseObjectAuditAlarm, 3
SYSSTUBS_ENTRY3 28, CloseObjectAuditAlarm, 3
SYSSTUBS_ENTRY4 28, CloseObjectAuditAlarm, 3
SYSSTUBS_ENTRY5 28, CloseObjectAuditAlarm, 3
SYSSTUBS_ENTRY6 28, CloseObjectAuditAlarm, 3
SYSSTUBS_ENTRY7 28, CloseObjectAuditAlarm, 3
SYSSTUBS_ENTRY8 28, CloseObjectAuditAlarm, 3
SYSSTUBS_ENTRY1 29, CompactKeys, 2
SYSSTUBS_ENTRY2 29, CompactKeys, 2
SYSSTUBS_ENTRY3 29, CompactKeys, 2
SYSSTUBS_ENTRY4 29, CompactKeys, 2
SYSSTUBS_ENTRY5 29, CompactKeys, 2
SYSSTUBS_ENTRY6 29, CompactKeys, 2
SYSSTUBS_ENTRY7 29, CompactKeys, 2
SYSSTUBS_ENTRY8 29, CompactKeys, 2
SYSSTUBS_ENTRY1 30, CompareTokens, 3
SYSSTUBS_ENTRY2 30, CompareTokens, 3
SYSSTUBS_ENTRY3 30, CompareTokens, 3
SYSSTUBS_ENTRY4 30, CompareTokens, 3
SYSSTUBS_ENTRY5 30, CompareTokens, 3
SYSSTUBS_ENTRY6 30, CompareTokens, 3
SYSSTUBS_ENTRY7 30, CompareTokens, 3
SYSSTUBS_ENTRY8 30, CompareTokens, 3
SYSSTUBS_ENTRY1 31, CompleteConnectPort, 1
SYSSTUBS_ENTRY2 31, CompleteConnectPort, 1
SYSSTUBS_ENTRY3 31, CompleteConnectPort, 1
SYSSTUBS_ENTRY4 31, CompleteConnectPort, 1
SYSSTUBS_ENTRY5 31, CompleteConnectPort, 1
SYSSTUBS_ENTRY6 31, CompleteConnectPort, 1
SYSSTUBS_ENTRY7 31, CompleteConnectPort, 1
SYSSTUBS_ENTRY8 31, CompleteConnectPort, 1
SYSSTUBS_ENTRY1 32, CompressKey, 1
SYSSTUBS_ENTRY2 32, CompressKey, 1
SYSSTUBS_ENTRY3 32, CompressKey, 1
SYSSTUBS_ENTRY4 32, CompressKey, 1
SYSSTUBS_ENTRY5 32, CompressKey, 1
SYSSTUBS_ENTRY6 32, CompressKey, 1
SYSSTUBS_ENTRY7 32, CompressKey, 1
SYSSTUBS_ENTRY8 32, CompressKey, 1
SYSSTUBS_ENTRY1 33, ConnectPort, 8
SYSSTUBS_ENTRY2 33, ConnectPort, 8
SYSSTUBS_ENTRY3 33, ConnectPort, 8
SYSSTUBS_ENTRY4 33, ConnectPort, 8
SYSSTUBS_ENTRY5 33, ConnectPort, 8
SYSSTUBS_ENTRY6 33, ConnectPort, 8
SYSSTUBS_ENTRY7 33, ConnectPort, 8
SYSSTUBS_ENTRY8 33, ConnectPort, 8
SYSSTUBS_ENTRY1 34, Continue, 2
SYSSTUBS_ENTRY2 34, Continue, 2
SYSSTUBS_ENTRY3 34, Continue, 2
SYSSTUBS_ENTRY4 34, Continue, 2
SYSSTUBS_ENTRY5 34, Continue, 2
SYSSTUBS_ENTRY6 34, Continue, 2
SYSSTUBS_ENTRY7 34, Continue, 2
SYSSTUBS_ENTRY8 34, Continue, 2
SYSSTUBS_ENTRY1 35, CreateDebugObject, 4
SYSSTUBS_ENTRY2 35, CreateDebugObject, 4
SYSSTUBS_ENTRY3 35, CreateDebugObject, 4
SYSSTUBS_ENTRY4 35, CreateDebugObject, 4
SYSSTUBS_ENTRY5 35, CreateDebugObject, 4
SYSSTUBS_ENTRY6 35, CreateDebugObject, 4
SYSSTUBS_ENTRY7 35, CreateDebugObject, 4
SYSSTUBS_ENTRY8 35, CreateDebugObject, 4
SYSSTUBS_ENTRY1 36, CreateDirectoryObject, 3
SYSSTUBS_ENTRY2 36, CreateDirectoryObject, 3
SYSSTUBS_ENTRY3 36, CreateDirectoryObject, 3
SYSSTUBS_ENTRY4 36, CreateDirectoryObject, 3
SYSSTUBS_ENTRY5 36, CreateDirectoryObject, 3
SYSSTUBS_ENTRY6 36, CreateDirectoryObject, 3
SYSSTUBS_ENTRY7 36, CreateDirectoryObject, 3
SYSSTUBS_ENTRY8 36, CreateDirectoryObject, 3
SYSSTUBS_ENTRY1 37, CreateEvent, 5
SYSSTUBS_ENTRY2 37, CreateEvent, 5
SYSSTUBS_ENTRY3 37, CreateEvent, 5
SYSSTUBS_ENTRY4 37, CreateEvent, 5
SYSSTUBS_ENTRY5 37, CreateEvent, 5
SYSSTUBS_ENTRY6 37, CreateEvent, 5
SYSSTUBS_ENTRY7 37, CreateEvent, 5
SYSSTUBS_ENTRY8 37, CreateEvent, 5
SYSSTUBS_ENTRY1 38, CreateEventPair, 3
SYSSTUBS_ENTRY2 38, CreateEventPair, 3
SYSSTUBS_ENTRY3 38, CreateEventPair, 3
SYSSTUBS_ENTRY4 38, CreateEventPair, 3
SYSSTUBS_ENTRY5 38, CreateEventPair, 3
SYSSTUBS_ENTRY6 38, CreateEventPair, 3
SYSSTUBS_ENTRY7 38, CreateEventPair, 3
SYSSTUBS_ENTRY8 38, CreateEventPair, 3
SYSSTUBS_ENTRY1 39, CreateFile, 11
SYSSTUBS_ENTRY2 39, CreateFile, 11
SYSSTUBS_ENTRY3 39, CreateFile, 11
SYSSTUBS_ENTRY4 39, CreateFile, 11
SYSSTUBS_ENTRY5 39, CreateFile, 11
SYSSTUBS_ENTRY6 39, CreateFile, 11
SYSSTUBS_ENTRY7 39, CreateFile, 11
SYSSTUBS_ENTRY8 39, CreateFile, 11
SYSSTUBS_ENTRY1 40, CreateIoCompletion, 4
SYSSTUBS_ENTRY2 40, CreateIoCompletion, 4
SYSSTUBS_ENTRY3 40, CreateIoCompletion, 4
SYSSTUBS_ENTRY4 40, CreateIoCompletion, 4
SYSSTUBS_ENTRY5 40, CreateIoCompletion, 4
SYSSTUBS_ENTRY6 40, CreateIoCompletion, 4
SYSSTUBS_ENTRY7 40, CreateIoCompletion, 4
SYSSTUBS_ENTRY8 40, CreateIoCompletion, 4
SYSSTUBS_ENTRY1 41, CreateJobObject, 3
SYSSTUBS_ENTRY2 41, CreateJobObject, 3
SYSSTUBS_ENTRY3 41, CreateJobObject, 3
SYSSTUBS_ENTRY4 41, CreateJobObject, 3
SYSSTUBS_ENTRY5 41, CreateJobObject, 3
SYSSTUBS_ENTRY6 41, CreateJobObject, 3
SYSSTUBS_ENTRY7 41, CreateJobObject, 3
SYSSTUBS_ENTRY8 41, CreateJobObject, 3
SYSSTUBS_ENTRY1 42, CreateJobSet, 3
SYSSTUBS_ENTRY2 42, CreateJobSet, 3
SYSSTUBS_ENTRY3 42, CreateJobSet, 3
SYSSTUBS_ENTRY4 42, CreateJobSet, 3
SYSSTUBS_ENTRY5 42, CreateJobSet, 3
SYSSTUBS_ENTRY6 42, CreateJobSet, 3
SYSSTUBS_ENTRY7 42, CreateJobSet, 3
SYSSTUBS_ENTRY8 42, CreateJobSet, 3
SYSSTUBS_ENTRY1 43, CreateKey, 7
SYSSTUBS_ENTRY2 43, CreateKey, 7
SYSSTUBS_ENTRY3 43, CreateKey, 7
SYSSTUBS_ENTRY4 43, CreateKey, 7
SYSSTUBS_ENTRY5 43, CreateKey, 7
SYSSTUBS_ENTRY6 43, CreateKey, 7
SYSSTUBS_ENTRY7 43, CreateKey, 7
SYSSTUBS_ENTRY8 43, CreateKey, 7
SYSSTUBS_ENTRY1 44, CreateMailslotFile, 8
SYSSTUBS_ENTRY2 44, CreateMailslotFile, 8
SYSSTUBS_ENTRY3 44, CreateMailslotFile, 8
SYSSTUBS_ENTRY4 44, CreateMailslotFile, 8
SYSSTUBS_ENTRY5 44, CreateMailslotFile, 8
SYSSTUBS_ENTRY6 44, CreateMailslotFile, 8
SYSSTUBS_ENTRY7 44, CreateMailslotFile, 8
SYSSTUBS_ENTRY8 44, CreateMailslotFile, 8
SYSSTUBS_ENTRY1 45, CreateMutant, 4
SYSSTUBS_ENTRY2 45, CreateMutant, 4
SYSSTUBS_ENTRY3 45, CreateMutant, 4
SYSSTUBS_ENTRY4 45, CreateMutant, 4
SYSSTUBS_ENTRY5 45, CreateMutant, 4
SYSSTUBS_ENTRY6 45, CreateMutant, 4
SYSSTUBS_ENTRY7 45, CreateMutant, 4
SYSSTUBS_ENTRY8 45, CreateMutant, 4
SYSSTUBS_ENTRY1 46, CreateNamedPipeFile, 14
SYSSTUBS_ENTRY2 46, CreateNamedPipeFile, 14
SYSSTUBS_ENTRY3 46, CreateNamedPipeFile, 14
SYSSTUBS_ENTRY4 46, CreateNamedPipeFile, 14
SYSSTUBS_ENTRY5 46, CreateNamedPipeFile, 14
SYSSTUBS_ENTRY6 46, CreateNamedPipeFile, 14
SYSSTUBS_ENTRY7 46, CreateNamedPipeFile, 14
SYSSTUBS_ENTRY8 46, CreateNamedPipeFile, 14
SYSSTUBS_ENTRY1 47, CreatePagingFile, 4
SYSSTUBS_ENTRY2 47, CreatePagingFile, 4
SYSSTUBS_ENTRY3 47, CreatePagingFile, 4
SYSSTUBS_ENTRY4 47, CreatePagingFile, 4
SYSSTUBS_ENTRY5 47, CreatePagingFile, 4
SYSSTUBS_ENTRY6 47, CreatePagingFile, 4
SYSSTUBS_ENTRY7 47, CreatePagingFile, 4
SYSSTUBS_ENTRY8 47, CreatePagingFile, 4
SYSSTUBS_ENTRY1 48, CreatePort, 5
SYSSTUBS_ENTRY2 48, CreatePort, 5
SYSSTUBS_ENTRY3 48, CreatePort, 5
SYSSTUBS_ENTRY4 48, CreatePort, 5
SYSSTUBS_ENTRY5 48, CreatePort, 5
SYSSTUBS_ENTRY6 48, CreatePort, 5
SYSSTUBS_ENTRY7 48, CreatePort, 5
SYSSTUBS_ENTRY8 48, CreatePort, 5
SYSSTUBS_ENTRY1 49, CreateProcess, 8
SYSSTUBS_ENTRY2 49, CreateProcess, 8
SYSSTUBS_ENTRY3 49, CreateProcess, 8
SYSSTUBS_ENTRY4 49, CreateProcess, 8
SYSSTUBS_ENTRY5 49, CreateProcess, 8
SYSSTUBS_ENTRY6 49, CreateProcess, 8
SYSSTUBS_ENTRY7 49, CreateProcess, 8
SYSSTUBS_ENTRY8 49, CreateProcess, 8
SYSSTUBS_ENTRY1 50, CreateProcessEx, 9
SYSSTUBS_ENTRY2 50, CreateProcessEx, 9
SYSSTUBS_ENTRY3 50, CreateProcessEx, 9
SYSSTUBS_ENTRY4 50, CreateProcessEx, 9
SYSSTUBS_ENTRY5 50, CreateProcessEx, 9
SYSSTUBS_ENTRY6 50, CreateProcessEx, 9
SYSSTUBS_ENTRY7 50, CreateProcessEx, 9
SYSSTUBS_ENTRY8 50, CreateProcessEx, 9
SYSSTUBS_ENTRY1 51, CreateProfile, 9
SYSSTUBS_ENTRY2 51, CreateProfile, 9
SYSSTUBS_ENTRY3 51, CreateProfile, 9
SYSSTUBS_ENTRY4 51, CreateProfile, 9
SYSSTUBS_ENTRY5 51, CreateProfile, 9
SYSSTUBS_ENTRY6 51, CreateProfile, 9
SYSSTUBS_ENTRY7 51, CreateProfile, 9
SYSSTUBS_ENTRY8 51, CreateProfile, 9
SYSSTUBS_ENTRY1 52, CreateSection, 7
SYSSTUBS_ENTRY2 52, CreateSection, 7
SYSSTUBS_ENTRY3 52, CreateSection, 7
SYSSTUBS_ENTRY4 52, CreateSection, 7
SYSSTUBS_ENTRY5 52, CreateSection, 7
SYSSTUBS_ENTRY6 52, CreateSection, 7
SYSSTUBS_ENTRY7 52, CreateSection, 7
SYSSTUBS_ENTRY8 52, CreateSection, 7
SYSSTUBS_ENTRY1 53, CreateSemaphore, 5
SYSSTUBS_ENTRY2 53, CreateSemaphore, 5
SYSSTUBS_ENTRY3 53, CreateSemaphore, 5
SYSSTUBS_ENTRY4 53, CreateSemaphore, 5
SYSSTUBS_ENTRY5 53, CreateSemaphore, 5
SYSSTUBS_ENTRY6 53, CreateSemaphore, 5
SYSSTUBS_ENTRY7 53, CreateSemaphore, 5
SYSSTUBS_ENTRY8 53, CreateSemaphore, 5
SYSSTUBS_ENTRY1 54, CreateSymbolicLinkObject, 4
SYSSTUBS_ENTRY2 54, CreateSymbolicLinkObject, 4
SYSSTUBS_ENTRY3 54, CreateSymbolicLinkObject, 4
SYSSTUBS_ENTRY4 54, CreateSymbolicLinkObject, 4
SYSSTUBS_ENTRY5 54, CreateSymbolicLinkObject, 4
SYSSTUBS_ENTRY6 54, CreateSymbolicLinkObject, 4
SYSSTUBS_ENTRY7 54, CreateSymbolicLinkObject, 4
SYSSTUBS_ENTRY8 54, CreateSymbolicLinkObject, 4
SYSSTUBS_ENTRY1 55, CreateThread, 8
SYSSTUBS_ENTRY2 55, CreateThread, 8
SYSSTUBS_ENTRY3 55, CreateThread, 8
SYSSTUBS_ENTRY4 55, CreateThread, 8
SYSSTUBS_ENTRY5 55, CreateThread, 8
SYSSTUBS_ENTRY6 55, CreateThread, 8
SYSSTUBS_ENTRY7 55, CreateThread, 8
SYSSTUBS_ENTRY8 55, CreateThread, 8
SYSSTUBS_ENTRY1 56, CreateTimer, 4
SYSSTUBS_ENTRY2 56, CreateTimer, 4
SYSSTUBS_ENTRY3 56, CreateTimer, 4
SYSSTUBS_ENTRY4 56, CreateTimer, 4
SYSSTUBS_ENTRY5 56, CreateTimer, 4
SYSSTUBS_ENTRY6 56, CreateTimer, 4
SYSSTUBS_ENTRY7 56, CreateTimer, 4
SYSSTUBS_ENTRY8 56, CreateTimer, 4
SYSSTUBS_ENTRY1 57, CreateToken, 13
SYSSTUBS_ENTRY2 57, CreateToken, 13
SYSSTUBS_ENTRY3 57, CreateToken, 13
SYSSTUBS_ENTRY4 57, CreateToken, 13
SYSSTUBS_ENTRY5 57, CreateToken, 13
SYSSTUBS_ENTRY6 57, CreateToken, 13
SYSSTUBS_ENTRY7 57, CreateToken, 13
SYSSTUBS_ENTRY8 57, CreateToken, 13
SYSSTUBS_ENTRY1 58, CreateWaitablePort, 5
SYSSTUBS_ENTRY2 58, CreateWaitablePort, 5
SYSSTUBS_ENTRY3 58, CreateWaitablePort, 5
SYSSTUBS_ENTRY4 58, CreateWaitablePort, 5
SYSSTUBS_ENTRY5 58, CreateWaitablePort, 5
SYSSTUBS_ENTRY6 58, CreateWaitablePort, 5
SYSSTUBS_ENTRY7 58, CreateWaitablePort, 5
SYSSTUBS_ENTRY8 58, CreateWaitablePort, 5
SYSSTUBS_ENTRY1 59, DebugActiveProcess, 2
SYSSTUBS_ENTRY2 59, DebugActiveProcess, 2
SYSSTUBS_ENTRY3 59, DebugActiveProcess, 2
SYSSTUBS_ENTRY4 59, DebugActiveProcess, 2
SYSSTUBS_ENTRY5 59, DebugActiveProcess, 2
SYSSTUBS_ENTRY6 59, DebugActiveProcess, 2
SYSSTUBS_ENTRY7 59, DebugActiveProcess, 2
SYSSTUBS_ENTRY8 59, DebugActiveProcess, 2
SYSSTUBS_ENTRY1 60, DebugContinue, 3
SYSSTUBS_ENTRY2 60, DebugContinue, 3
SYSSTUBS_ENTRY3 60, DebugContinue, 3
SYSSTUBS_ENTRY4 60, DebugContinue, 3
SYSSTUBS_ENTRY5 60, DebugContinue, 3
SYSSTUBS_ENTRY6 60, DebugContinue, 3
SYSSTUBS_ENTRY7 60, DebugContinue, 3
SYSSTUBS_ENTRY8 60, DebugContinue, 3
SYSSTUBS_ENTRY1 61, DelayExecution, 2
SYSSTUBS_ENTRY2 61, DelayExecution, 2
SYSSTUBS_ENTRY3 61, DelayExecution, 2
SYSSTUBS_ENTRY4 61, DelayExecution, 2
SYSSTUBS_ENTRY5 61, DelayExecution, 2
SYSSTUBS_ENTRY6 61, DelayExecution, 2
SYSSTUBS_ENTRY7 61, DelayExecution, 2
SYSSTUBS_ENTRY8 61, DelayExecution, 2
SYSSTUBS_ENTRY1 62, DeleteAtom, 1
SYSSTUBS_ENTRY2 62, DeleteAtom, 1
SYSSTUBS_ENTRY3 62, DeleteAtom, 1
SYSSTUBS_ENTRY4 62, DeleteAtom, 1
SYSSTUBS_ENTRY5 62, DeleteAtom, 1
SYSSTUBS_ENTRY6 62, DeleteAtom, 1
SYSSTUBS_ENTRY7 62, DeleteAtom, 1
SYSSTUBS_ENTRY8 62, DeleteAtom, 1
SYSSTUBS_ENTRY1 63, DeleteBootEntry, 1
SYSSTUBS_ENTRY2 63, DeleteBootEntry, 1
SYSSTUBS_ENTRY3 63, DeleteBootEntry, 1
SYSSTUBS_ENTRY4 63, DeleteBootEntry, 1
SYSSTUBS_ENTRY5 63, DeleteBootEntry, 1
SYSSTUBS_ENTRY6 63, DeleteBootEntry, 1
SYSSTUBS_ENTRY7 63, DeleteBootEntry, 1
SYSSTUBS_ENTRY8 63, DeleteBootEntry, 1
SYSSTUBS_ENTRY1 64, DeleteDriverEntry, 1
SYSSTUBS_ENTRY2 64, DeleteDriverEntry, 1
SYSSTUBS_ENTRY3 64, DeleteDriverEntry, 1
SYSSTUBS_ENTRY4 64, DeleteDriverEntry, 1
SYSSTUBS_ENTRY5 64, DeleteDriverEntry, 1
SYSSTUBS_ENTRY6 64, DeleteDriverEntry, 1
SYSSTUBS_ENTRY7 64, DeleteDriverEntry, 1
SYSSTUBS_ENTRY8 64, DeleteDriverEntry, 1
SYSSTUBS_ENTRY1 65, DeleteFile, 1
SYSSTUBS_ENTRY2 65, DeleteFile, 1
SYSSTUBS_ENTRY3 65, DeleteFile, 1
SYSSTUBS_ENTRY4 65, DeleteFile, 1
SYSSTUBS_ENTRY5 65, DeleteFile, 1
SYSSTUBS_ENTRY6 65, DeleteFile, 1
SYSSTUBS_ENTRY7 65, DeleteFile, 1
SYSSTUBS_ENTRY8 65, DeleteFile, 1
SYSSTUBS_ENTRY1 66, DeleteKey, 1
SYSSTUBS_ENTRY2 66, DeleteKey, 1
SYSSTUBS_ENTRY3 66, DeleteKey, 1
SYSSTUBS_ENTRY4 66, DeleteKey, 1
SYSSTUBS_ENTRY5 66, DeleteKey, 1
SYSSTUBS_ENTRY6 66, DeleteKey, 1
SYSSTUBS_ENTRY7 66, DeleteKey, 1
SYSSTUBS_ENTRY8 66, DeleteKey, 1
SYSSTUBS_ENTRY1 67, DeleteObjectAuditAlarm, 3
SYSSTUBS_ENTRY2 67, DeleteObjectAuditAlarm, 3
SYSSTUBS_ENTRY3 67, DeleteObjectAuditAlarm, 3
SYSSTUBS_ENTRY4 67, DeleteObjectAuditAlarm, 3
SYSSTUBS_ENTRY5 67, DeleteObjectAuditAlarm, 3
SYSSTUBS_ENTRY6 67, DeleteObjectAuditAlarm, 3
SYSSTUBS_ENTRY7 67, DeleteObjectAuditAlarm, 3
SYSSTUBS_ENTRY8 67, DeleteObjectAuditAlarm, 3
SYSSTUBS_ENTRY1 68, DeleteValueKey, 2
SYSSTUBS_ENTRY2 68, DeleteValueKey, 2
SYSSTUBS_ENTRY3 68, DeleteValueKey, 2
SYSSTUBS_ENTRY4 68, DeleteValueKey, 2
SYSSTUBS_ENTRY5 68, DeleteValueKey, 2
SYSSTUBS_ENTRY6 68, DeleteValueKey, 2
SYSSTUBS_ENTRY7 68, DeleteValueKey, 2
SYSSTUBS_ENTRY8 68, DeleteValueKey, 2
SYSSTUBS_ENTRY1 69, DeviceIoControlFile, 10
SYSSTUBS_ENTRY2 69, DeviceIoControlFile, 10
SYSSTUBS_ENTRY3 69, DeviceIoControlFile, 10
SYSSTUBS_ENTRY4 69, DeviceIoControlFile, 10
SYSSTUBS_ENTRY5 69, DeviceIoControlFile, 10
SYSSTUBS_ENTRY6 69, DeviceIoControlFile, 10
SYSSTUBS_ENTRY7 69, DeviceIoControlFile, 10
SYSSTUBS_ENTRY8 69, DeviceIoControlFile, 10
SYSSTUBS_ENTRY1 70, DisplayString, 1
SYSSTUBS_ENTRY2 70, DisplayString, 1
SYSSTUBS_ENTRY3 70, DisplayString, 1
SYSSTUBS_ENTRY4 70, DisplayString, 1
SYSSTUBS_ENTRY5 70, DisplayString, 1
SYSSTUBS_ENTRY6 70, DisplayString, 1
SYSSTUBS_ENTRY7 70, DisplayString, 1
SYSSTUBS_ENTRY8 70, DisplayString, 1
SYSSTUBS_ENTRY1 71, DuplicateObject, 7
SYSSTUBS_ENTRY2 71, DuplicateObject, 7
SYSSTUBS_ENTRY3 71, DuplicateObject, 7
SYSSTUBS_ENTRY4 71, DuplicateObject, 7
SYSSTUBS_ENTRY5 71, DuplicateObject, 7
SYSSTUBS_ENTRY6 71, DuplicateObject, 7
SYSSTUBS_ENTRY7 71, DuplicateObject, 7
SYSSTUBS_ENTRY8 71, DuplicateObject, 7
SYSSTUBS_ENTRY1 72, DuplicateToken, 6
SYSSTUBS_ENTRY2 72, DuplicateToken, 6
SYSSTUBS_ENTRY3 72, DuplicateToken, 6
SYSSTUBS_ENTRY4 72, DuplicateToken, 6
SYSSTUBS_ENTRY5 72, DuplicateToken, 6
SYSSTUBS_ENTRY6 72, DuplicateToken, 6
SYSSTUBS_ENTRY7 72, DuplicateToken, 6
SYSSTUBS_ENTRY8 72, DuplicateToken, 6
SYSSTUBS_ENTRY1 73, EnumerateBootEntries, 2
SYSSTUBS_ENTRY2 73, EnumerateBootEntries, 2
SYSSTUBS_ENTRY3 73, EnumerateBootEntries, 2
SYSSTUBS_ENTRY4 73, EnumerateBootEntries, 2
SYSSTUBS_ENTRY5 73, EnumerateBootEntries, 2
SYSSTUBS_ENTRY6 73, EnumerateBootEntries, 2
SYSSTUBS_ENTRY7 73, EnumerateBootEntries, 2
SYSSTUBS_ENTRY8 73, EnumerateBootEntries, 2
SYSSTUBS_ENTRY1 74, EnumerateDriverEntries, 2
SYSSTUBS_ENTRY2 74, EnumerateDriverEntries, 2
SYSSTUBS_ENTRY3 74, EnumerateDriverEntries, 2
SYSSTUBS_ENTRY4 74, EnumerateDriverEntries, 2
SYSSTUBS_ENTRY5 74, EnumerateDriverEntries, 2
SYSSTUBS_ENTRY6 74, EnumerateDriverEntries, 2
SYSSTUBS_ENTRY7 74, EnumerateDriverEntries, 2
SYSSTUBS_ENTRY8 74, EnumerateDriverEntries, 2
SYSSTUBS_ENTRY1 75, EnumerateKey, 6
SYSSTUBS_ENTRY2 75, EnumerateKey, 6
SYSSTUBS_ENTRY3 75, EnumerateKey, 6
SYSSTUBS_ENTRY4 75, EnumerateKey, 6
SYSSTUBS_ENTRY5 75, EnumerateKey, 6
SYSSTUBS_ENTRY6 75, EnumerateKey, 6
SYSSTUBS_ENTRY7 75, EnumerateKey, 6
SYSSTUBS_ENTRY8 75, EnumerateKey, 6
SYSSTUBS_ENTRY1 76, EnumerateSystemEnvironmentValuesEx, 3
SYSSTUBS_ENTRY2 76, EnumerateSystemEnvironmentValuesEx, 3
SYSSTUBS_ENTRY3 76, EnumerateSystemEnvironmentValuesEx, 3
SYSSTUBS_ENTRY4 76, EnumerateSystemEnvironmentValuesEx, 3
SYSSTUBS_ENTRY5 76, EnumerateSystemEnvironmentValuesEx, 3
SYSSTUBS_ENTRY6 76, EnumerateSystemEnvironmentValuesEx, 3
SYSSTUBS_ENTRY7 76, EnumerateSystemEnvironmentValuesEx, 3
SYSSTUBS_ENTRY8 76, EnumerateSystemEnvironmentValuesEx, 3
SYSSTUBS_ENTRY1 77, EnumerateValueKey, 6
SYSSTUBS_ENTRY2 77, EnumerateValueKey, 6
SYSSTUBS_ENTRY3 77, EnumerateValueKey, 6
SYSSTUBS_ENTRY4 77, EnumerateValueKey, 6
SYSSTUBS_ENTRY5 77, EnumerateValueKey, 6
SYSSTUBS_ENTRY6 77, EnumerateValueKey, 6
SYSSTUBS_ENTRY7 77, EnumerateValueKey, 6
SYSSTUBS_ENTRY8 77, EnumerateValueKey, 6
SYSSTUBS_ENTRY1 78, ExtendSection, 2
SYSSTUBS_ENTRY2 78, ExtendSection, 2
SYSSTUBS_ENTRY3 78, ExtendSection, 2
SYSSTUBS_ENTRY4 78, ExtendSection, 2
SYSSTUBS_ENTRY5 78, ExtendSection, 2
SYSSTUBS_ENTRY6 78, ExtendSection, 2
SYSSTUBS_ENTRY7 78, ExtendSection, 2
SYSSTUBS_ENTRY8 78, ExtendSection, 2
SYSSTUBS_ENTRY1 79, FilterToken, 6
SYSSTUBS_ENTRY2 79, FilterToken, 6
SYSSTUBS_ENTRY3 79, FilterToken, 6
SYSSTUBS_ENTRY4 79, FilterToken, 6
SYSSTUBS_ENTRY5 79, FilterToken, 6
SYSSTUBS_ENTRY6 79, FilterToken, 6
SYSSTUBS_ENTRY7 79, FilterToken, 6
SYSSTUBS_ENTRY8 79, FilterToken, 6
SYSSTUBS_ENTRY1 80, FindAtom, 3
SYSSTUBS_ENTRY2 80, FindAtom, 3
SYSSTUBS_ENTRY3 80, FindAtom, 3
SYSSTUBS_ENTRY4 80, FindAtom, 3
SYSSTUBS_ENTRY5 80, FindAtom, 3
SYSSTUBS_ENTRY6 80, FindAtom, 3
SYSSTUBS_ENTRY7 80, FindAtom, 3
SYSSTUBS_ENTRY8 80, FindAtom, 3
SYSSTUBS_ENTRY1 81, FlushBuffersFile, 2
SYSSTUBS_ENTRY2 81, FlushBuffersFile, 2
SYSSTUBS_ENTRY3 81, FlushBuffersFile, 2
SYSSTUBS_ENTRY4 81, FlushBuffersFile, 2
SYSSTUBS_ENTRY5 81, FlushBuffersFile, 2
SYSSTUBS_ENTRY6 81, FlushBuffersFile, 2
SYSSTUBS_ENTRY7 81, FlushBuffersFile, 2
SYSSTUBS_ENTRY8 81, FlushBuffersFile, 2
SYSSTUBS_ENTRY1 82, FlushInstructionCache, 3
SYSSTUBS_ENTRY2 82, FlushInstructionCache, 3
SYSSTUBS_ENTRY3 82, FlushInstructionCache, 3
SYSSTUBS_ENTRY4 82, FlushInstructionCache, 3
SYSSTUBS_ENTRY5 82, FlushInstructionCache, 3
SYSSTUBS_ENTRY6 82, FlushInstructionCache, 3
SYSSTUBS_ENTRY7 82, FlushInstructionCache, 3
SYSSTUBS_ENTRY8 82, FlushInstructionCache, 3
SYSSTUBS_ENTRY1 83, FlushKey, 1
SYSSTUBS_ENTRY2 83, FlushKey, 1
SYSSTUBS_ENTRY3 83, FlushKey, 1
SYSSTUBS_ENTRY4 83, FlushKey, 1
SYSSTUBS_ENTRY5 83, FlushKey, 1
SYSSTUBS_ENTRY6 83, FlushKey, 1
SYSSTUBS_ENTRY7 83, FlushKey, 1
SYSSTUBS_ENTRY8 83, FlushKey, 1
SYSSTUBS_ENTRY1 84, FlushVirtualMemory, 4
SYSSTUBS_ENTRY2 84, FlushVirtualMemory, 4
SYSSTUBS_ENTRY3 84, FlushVirtualMemory, 4
SYSSTUBS_ENTRY4 84, FlushVirtualMemory, 4
SYSSTUBS_ENTRY5 84, FlushVirtualMemory, 4
SYSSTUBS_ENTRY6 84, FlushVirtualMemory, 4
SYSSTUBS_ENTRY7 84, FlushVirtualMemory, 4
SYSSTUBS_ENTRY8 84, FlushVirtualMemory, 4
SYSSTUBS_ENTRY1 85, FlushWriteBuffer, 0
SYSSTUBS_ENTRY2 85, FlushWriteBuffer, 0
SYSSTUBS_ENTRY3 85, FlushWriteBuffer, 0
SYSSTUBS_ENTRY4 85, FlushWriteBuffer, 0
SYSSTUBS_ENTRY5 85, FlushWriteBuffer, 0
SYSSTUBS_ENTRY6 85, FlushWriteBuffer, 0
SYSSTUBS_ENTRY7 85, FlushWriteBuffer, 0
SYSSTUBS_ENTRY8 85, FlushWriteBuffer, 0
SYSSTUBS_ENTRY1 86, FreeUserPhysicalPages, 3
SYSSTUBS_ENTRY2 86, FreeUserPhysicalPages, 3
SYSSTUBS_ENTRY3 86, FreeUserPhysicalPages, 3
SYSSTUBS_ENTRY4 86, FreeUserPhysicalPages, 3
SYSSTUBS_ENTRY5 86, FreeUserPhysicalPages, 3
SYSSTUBS_ENTRY6 86, FreeUserPhysicalPages, 3
SYSSTUBS_ENTRY7 86, FreeUserPhysicalPages, 3
SYSSTUBS_ENTRY8 86, FreeUserPhysicalPages, 3
SYSSTUBS_ENTRY1 87, FreeVirtualMemory, 4
SYSSTUBS_ENTRY2 87, FreeVirtualMemory, 4
SYSSTUBS_ENTRY3 87, FreeVirtualMemory, 4
SYSSTUBS_ENTRY4 87, FreeVirtualMemory, 4
SYSSTUBS_ENTRY5 87, FreeVirtualMemory, 4
SYSSTUBS_ENTRY6 87, FreeVirtualMemory, 4
SYSSTUBS_ENTRY7 87, FreeVirtualMemory, 4
SYSSTUBS_ENTRY8 87, FreeVirtualMemory, 4
SYSSTUBS_ENTRY1 88, FsControlFile, 10
SYSSTUBS_ENTRY2 88, FsControlFile, 10
SYSSTUBS_ENTRY3 88, FsControlFile, 10
SYSSTUBS_ENTRY4 88, FsControlFile, 10
SYSSTUBS_ENTRY5 88, FsControlFile, 10
SYSSTUBS_ENTRY6 88, FsControlFile, 10
SYSSTUBS_ENTRY7 88, FsControlFile, 10
SYSSTUBS_ENTRY8 88, FsControlFile, 10
SYSSTUBS_ENTRY1 89, GetContextThread, 2
SYSSTUBS_ENTRY2 89, GetContextThread, 2
SYSSTUBS_ENTRY3 89, GetContextThread, 2
SYSSTUBS_ENTRY4 89, GetContextThread, 2
SYSSTUBS_ENTRY5 89, GetContextThread, 2
SYSSTUBS_ENTRY6 89, GetContextThread, 2
SYSSTUBS_ENTRY7 89, GetContextThread, 2
SYSSTUBS_ENTRY8 89, GetContextThread, 2
SYSSTUBS_ENTRY1 90, GetDevicePowerState, 2
SYSSTUBS_ENTRY2 90, GetDevicePowerState, 2
SYSSTUBS_ENTRY3 90, GetDevicePowerState, 2
SYSSTUBS_ENTRY4 90, GetDevicePowerState, 2
SYSSTUBS_ENTRY5 90, GetDevicePowerState, 2
SYSSTUBS_ENTRY6 90, GetDevicePowerState, 2
SYSSTUBS_ENTRY7 90, GetDevicePowerState, 2
SYSSTUBS_ENTRY8 90, GetDevicePowerState, 2
SYSSTUBS_ENTRY1 91, GetPlugPlayEvent, 4
SYSSTUBS_ENTRY2 91, GetPlugPlayEvent, 4
SYSSTUBS_ENTRY3 91, GetPlugPlayEvent, 4
SYSSTUBS_ENTRY4 91, GetPlugPlayEvent, 4
SYSSTUBS_ENTRY5 91, GetPlugPlayEvent, 4
SYSSTUBS_ENTRY6 91, GetPlugPlayEvent, 4
SYSSTUBS_ENTRY7 91, GetPlugPlayEvent, 4
SYSSTUBS_ENTRY8 91, GetPlugPlayEvent, 4
SYSSTUBS_ENTRY1 92, GetWriteWatch, 7
SYSSTUBS_ENTRY2 92, GetWriteWatch, 7
SYSSTUBS_ENTRY3 92, GetWriteWatch, 7
SYSSTUBS_ENTRY4 92, GetWriteWatch, 7
SYSSTUBS_ENTRY5 92, GetWriteWatch, 7
SYSSTUBS_ENTRY6 92, GetWriteWatch, 7
SYSSTUBS_ENTRY7 92, GetWriteWatch, 7
SYSSTUBS_ENTRY8 92, GetWriteWatch, 7
SYSSTUBS_ENTRY1 93, ImpersonateAnonymousToken, 1
SYSSTUBS_ENTRY2 93, ImpersonateAnonymousToken, 1
SYSSTUBS_ENTRY3 93, ImpersonateAnonymousToken, 1
SYSSTUBS_ENTRY4 93, ImpersonateAnonymousToken, 1
SYSSTUBS_ENTRY5 93, ImpersonateAnonymousToken, 1
SYSSTUBS_ENTRY6 93, ImpersonateAnonymousToken, 1
SYSSTUBS_ENTRY7 93, ImpersonateAnonymousToken, 1
SYSSTUBS_ENTRY8 93, ImpersonateAnonymousToken, 1
SYSSTUBS_ENTRY1 94, ImpersonateClientOfPort, 2
SYSSTUBS_ENTRY2 94, ImpersonateClientOfPort, 2
SYSSTUBS_ENTRY3 94, ImpersonateClientOfPort, 2
SYSSTUBS_ENTRY4 94, ImpersonateClientOfPort, 2
SYSSTUBS_ENTRY5 94, ImpersonateClientOfPort, 2
SYSSTUBS_ENTRY6 94, ImpersonateClientOfPort, 2
SYSSTUBS_ENTRY7 94, ImpersonateClientOfPort, 2
SYSSTUBS_ENTRY8 94, ImpersonateClientOfPort, 2
SYSSTUBS_ENTRY1 95, ImpersonateThread, 3
SYSSTUBS_ENTRY2 95, ImpersonateThread, 3
SYSSTUBS_ENTRY3 95, ImpersonateThread, 3
SYSSTUBS_ENTRY4 95, ImpersonateThread, 3
SYSSTUBS_ENTRY5 95, ImpersonateThread, 3
SYSSTUBS_ENTRY6 95, ImpersonateThread, 3
SYSSTUBS_ENTRY7 95, ImpersonateThread, 3
SYSSTUBS_ENTRY8 95, ImpersonateThread, 3
SYSSTUBS_ENTRY1 96, InitializeRegistry, 1
SYSSTUBS_ENTRY2 96, InitializeRegistry, 1
SYSSTUBS_ENTRY3 96, InitializeRegistry, 1
SYSSTUBS_ENTRY4 96, InitializeRegistry, 1
SYSSTUBS_ENTRY5 96, InitializeRegistry, 1
SYSSTUBS_ENTRY6 96, InitializeRegistry, 1
SYSSTUBS_ENTRY7 96, InitializeRegistry, 1
SYSSTUBS_ENTRY8 96, InitializeRegistry, 1
SYSSTUBS_ENTRY1 97, InitiatePowerAction, 4
SYSSTUBS_ENTRY2 97, InitiatePowerAction, 4
SYSSTUBS_ENTRY3 97, InitiatePowerAction, 4
SYSSTUBS_ENTRY4 97, InitiatePowerAction, 4
SYSSTUBS_ENTRY5 97, InitiatePowerAction, 4
SYSSTUBS_ENTRY6 97, InitiatePowerAction, 4
SYSSTUBS_ENTRY7 97, InitiatePowerAction, 4
SYSSTUBS_ENTRY8 97, InitiatePowerAction, 4
SYSSTUBS_ENTRY1 98, IsProcessInJob, 2
SYSSTUBS_ENTRY2 98, IsProcessInJob, 2
SYSSTUBS_ENTRY3 98, IsProcessInJob, 2
SYSSTUBS_ENTRY4 98, IsProcessInJob, 2
SYSSTUBS_ENTRY5 98, IsProcessInJob, 2
SYSSTUBS_ENTRY6 98, IsProcessInJob, 2
SYSSTUBS_ENTRY7 98, IsProcessInJob, 2
SYSSTUBS_ENTRY8 98, IsProcessInJob, 2
SYSSTUBS_ENTRY1 99, IsSystemResumeAutomatic, 0
SYSSTUBS_ENTRY2 99, IsSystemResumeAutomatic, 0
SYSSTUBS_ENTRY3 99, IsSystemResumeAutomatic, 0
SYSSTUBS_ENTRY4 99, IsSystemResumeAutomatic, 0
SYSSTUBS_ENTRY5 99, IsSystemResumeAutomatic, 0
SYSSTUBS_ENTRY6 99, IsSystemResumeAutomatic, 0
SYSSTUBS_ENTRY7 99, IsSystemResumeAutomatic, 0
SYSSTUBS_ENTRY8 99, IsSystemResumeAutomatic, 0
SYSSTUBS_ENTRY1 100, ListenPort, 2
SYSSTUBS_ENTRY2 100, ListenPort, 2
SYSSTUBS_ENTRY3 100, ListenPort, 2
SYSSTUBS_ENTRY4 100, ListenPort, 2
SYSSTUBS_ENTRY5 100, ListenPort, 2
SYSSTUBS_ENTRY6 100, ListenPort, 2
SYSSTUBS_ENTRY7 100, ListenPort, 2
SYSSTUBS_ENTRY8 100, ListenPort, 2
SYSSTUBS_ENTRY1 101, LoadDriver, 1
SYSSTUBS_ENTRY2 101, LoadDriver, 1
SYSSTUBS_ENTRY3 101, LoadDriver, 1
SYSSTUBS_ENTRY4 101, LoadDriver, 1
SYSSTUBS_ENTRY5 101, LoadDriver, 1
SYSSTUBS_ENTRY6 101, LoadDriver, 1
SYSSTUBS_ENTRY7 101, LoadDriver, 1
SYSSTUBS_ENTRY8 101, LoadDriver, 1
SYSSTUBS_ENTRY1 102, LoadKey, 2
SYSSTUBS_ENTRY2 102, LoadKey, 2
SYSSTUBS_ENTRY3 102, LoadKey, 2
SYSSTUBS_ENTRY4 102, LoadKey, 2
SYSSTUBS_ENTRY5 102, LoadKey, 2
SYSSTUBS_ENTRY6 102, LoadKey, 2
SYSSTUBS_ENTRY7 102, LoadKey, 2
SYSSTUBS_ENTRY8 102, LoadKey, 2
SYSSTUBS_ENTRY1 103, LoadKey2, 3
SYSSTUBS_ENTRY2 103, LoadKey2, 3
SYSSTUBS_ENTRY3 103, LoadKey2, 3
SYSSTUBS_ENTRY4 103, LoadKey2, 3
SYSSTUBS_ENTRY5 103, LoadKey2, 3
SYSSTUBS_ENTRY6 103, LoadKey2, 3
SYSSTUBS_ENTRY7 103, LoadKey2, 3
SYSSTUBS_ENTRY8 103, LoadKey2, 3
SYSSTUBS_ENTRY1 104, LoadKeyEx, 4
SYSSTUBS_ENTRY2 104, LoadKeyEx, 4
SYSSTUBS_ENTRY3 104, LoadKeyEx, 4
SYSSTUBS_ENTRY4 104, LoadKeyEx, 4
SYSSTUBS_ENTRY5 104, LoadKeyEx, 4
SYSSTUBS_ENTRY6 104, LoadKeyEx, 4
SYSSTUBS_ENTRY7 104, LoadKeyEx, 4
SYSSTUBS_ENTRY8 104, LoadKeyEx, 4
SYSSTUBS_ENTRY1 105, LockFile, 10
SYSSTUBS_ENTRY2 105, LockFile, 10
SYSSTUBS_ENTRY3 105, LockFile, 10
SYSSTUBS_ENTRY4 105, LockFile, 10
SYSSTUBS_ENTRY5 105, LockFile, 10
SYSSTUBS_ENTRY6 105, LockFile, 10
SYSSTUBS_ENTRY7 105, LockFile, 10
SYSSTUBS_ENTRY8 105, LockFile, 10
SYSSTUBS_ENTRY1 106, LockProductActivationKeys, 2
SYSSTUBS_ENTRY2 106, LockProductActivationKeys, 2
SYSSTUBS_ENTRY3 106, LockProductActivationKeys, 2
SYSSTUBS_ENTRY4 106, LockProductActivationKeys, 2
SYSSTUBS_ENTRY5 106, LockProductActivationKeys, 2
SYSSTUBS_ENTRY6 106, LockProductActivationKeys, 2
SYSSTUBS_ENTRY7 106, LockProductActivationKeys, 2
SYSSTUBS_ENTRY8 106, LockProductActivationKeys, 2
SYSSTUBS_ENTRY1 107, LockRegistryKey, 1
SYSSTUBS_ENTRY2 107, LockRegistryKey, 1
SYSSTUBS_ENTRY3 107, LockRegistryKey, 1
SYSSTUBS_ENTRY4 107, LockRegistryKey, 1
SYSSTUBS_ENTRY5 107, LockRegistryKey, 1
SYSSTUBS_ENTRY6 107, LockRegistryKey, 1
SYSSTUBS_ENTRY7 107, LockRegistryKey, 1
SYSSTUBS_ENTRY8 107, LockRegistryKey, 1
SYSSTUBS_ENTRY1 108, LockVirtualMemory, 4
SYSSTUBS_ENTRY2 108, LockVirtualMemory, 4
SYSSTUBS_ENTRY3 108, LockVirtualMemory, 4
SYSSTUBS_ENTRY4 108, LockVirtualMemory, 4
SYSSTUBS_ENTRY5 108, LockVirtualMemory, 4
SYSSTUBS_ENTRY6 108, LockVirtualMemory, 4
SYSSTUBS_ENTRY7 108, LockVirtualMemory, 4
SYSSTUBS_ENTRY8 108, LockVirtualMemory, 4
SYSSTUBS_ENTRY1 109, MakePermanentObject, 1
SYSSTUBS_ENTRY2 109, MakePermanentObject, 1
SYSSTUBS_ENTRY3 109, MakePermanentObject, 1
SYSSTUBS_ENTRY4 109, MakePermanentObject, 1
SYSSTUBS_ENTRY5 109, MakePermanentObject, 1
SYSSTUBS_ENTRY6 109, MakePermanentObject, 1
SYSSTUBS_ENTRY7 109, MakePermanentObject, 1
SYSSTUBS_ENTRY8 109, MakePermanentObject, 1
SYSSTUBS_ENTRY1 110, MakeTemporaryObject, 1
SYSSTUBS_ENTRY2 110, MakeTemporaryObject, 1
SYSSTUBS_ENTRY3 110, MakeTemporaryObject, 1
SYSSTUBS_ENTRY4 110, MakeTemporaryObject, 1
SYSSTUBS_ENTRY5 110, MakeTemporaryObject, 1
SYSSTUBS_ENTRY6 110, MakeTemporaryObject, 1
SYSSTUBS_ENTRY7 110, MakeTemporaryObject, 1
SYSSTUBS_ENTRY8 110, MakeTemporaryObject, 1
SYSSTUBS_ENTRY1 111, MapUserPhysicalPages, 3
SYSSTUBS_ENTRY2 111, MapUserPhysicalPages, 3
SYSSTUBS_ENTRY3 111, MapUserPhysicalPages, 3
SYSSTUBS_ENTRY4 111, MapUserPhysicalPages, 3
SYSSTUBS_ENTRY5 111, MapUserPhysicalPages, 3
SYSSTUBS_ENTRY6 111, MapUserPhysicalPages, 3
SYSSTUBS_ENTRY7 111, MapUserPhysicalPages, 3
SYSSTUBS_ENTRY8 111, MapUserPhysicalPages, 3
SYSSTUBS_ENTRY1 112, MapUserPhysicalPagesScatter, 3
SYSSTUBS_ENTRY2 112, MapUserPhysicalPagesScatter, 3
SYSSTUBS_ENTRY3 112, MapUserPhysicalPagesScatter, 3
SYSSTUBS_ENTRY4 112, MapUserPhysicalPagesScatter, 3
SYSSTUBS_ENTRY5 112, MapUserPhysicalPagesScatter, 3
SYSSTUBS_ENTRY6 112, MapUserPhysicalPagesScatter, 3
SYSSTUBS_ENTRY7 112, MapUserPhysicalPagesScatter, 3
SYSSTUBS_ENTRY8 112, MapUserPhysicalPagesScatter, 3
SYSSTUBS_ENTRY1 113, MapViewOfSection, 10
SYSSTUBS_ENTRY2 113, MapViewOfSection, 10
SYSSTUBS_ENTRY3 113, MapViewOfSection, 10
SYSSTUBS_ENTRY4 113, MapViewOfSection, 10
SYSSTUBS_ENTRY5 113, MapViewOfSection, 10
SYSSTUBS_ENTRY6 113, MapViewOfSection, 10
SYSSTUBS_ENTRY7 113, MapViewOfSection, 10
SYSSTUBS_ENTRY8 113, MapViewOfSection, 10
SYSSTUBS_ENTRY1 114, ModifyBootEntry, 1
SYSSTUBS_ENTRY2 114, ModifyBootEntry, 1
SYSSTUBS_ENTRY3 114, ModifyBootEntry, 1
SYSSTUBS_ENTRY4 114, ModifyBootEntry, 1
SYSSTUBS_ENTRY5 114, ModifyBootEntry, 1
SYSSTUBS_ENTRY6 114, ModifyBootEntry, 1
SYSSTUBS_ENTRY7 114, ModifyBootEntry, 1
SYSSTUBS_ENTRY8 114, ModifyBootEntry, 1
SYSSTUBS_ENTRY1 115, ModifyDriverEntry, 1
SYSSTUBS_ENTRY2 115, ModifyDriverEntry, 1
SYSSTUBS_ENTRY3 115, ModifyDriverEntry, 1
SYSSTUBS_ENTRY4 115, ModifyDriverEntry, 1
SYSSTUBS_ENTRY5 115, ModifyDriverEntry, 1
SYSSTUBS_ENTRY6 115, ModifyDriverEntry, 1
SYSSTUBS_ENTRY7 115, ModifyDriverEntry, 1
SYSSTUBS_ENTRY8 115, ModifyDriverEntry, 1
SYSSTUBS_ENTRY1 116, NotifyChangeDirectoryFile, 9
SYSSTUBS_ENTRY2 116, NotifyChangeDirectoryFile, 9
SYSSTUBS_ENTRY3 116, NotifyChangeDirectoryFile, 9
SYSSTUBS_ENTRY4 116, NotifyChangeDirectoryFile, 9
SYSSTUBS_ENTRY5 116, NotifyChangeDirectoryFile, 9
SYSSTUBS_ENTRY6 116, NotifyChangeDirectoryFile, 9
SYSSTUBS_ENTRY7 116, NotifyChangeDirectoryFile, 9
SYSSTUBS_ENTRY8 116, NotifyChangeDirectoryFile, 9
SYSSTUBS_ENTRY1 117, NotifyChangeKey, 10
SYSSTUBS_ENTRY2 117, NotifyChangeKey, 10
SYSSTUBS_ENTRY3 117, NotifyChangeKey, 10
SYSSTUBS_ENTRY4 117, NotifyChangeKey, 10
SYSSTUBS_ENTRY5 117, NotifyChangeKey, 10
SYSSTUBS_ENTRY6 117, NotifyChangeKey, 10
SYSSTUBS_ENTRY7 117, NotifyChangeKey, 10
SYSSTUBS_ENTRY8 117, NotifyChangeKey, 10
SYSSTUBS_ENTRY1 118, NotifyChangeMultipleKeys, 12
SYSSTUBS_ENTRY2 118, NotifyChangeMultipleKeys, 12
SYSSTUBS_ENTRY3 118, NotifyChangeMultipleKeys, 12
SYSSTUBS_ENTRY4 118, NotifyChangeMultipleKeys, 12
SYSSTUBS_ENTRY5 118, NotifyChangeMultipleKeys, 12
SYSSTUBS_ENTRY6 118, NotifyChangeMultipleKeys, 12
SYSSTUBS_ENTRY7 118, NotifyChangeMultipleKeys, 12
SYSSTUBS_ENTRY8 118, NotifyChangeMultipleKeys, 12
SYSSTUBS_ENTRY1 119, OpenDirectoryObject, 3
SYSSTUBS_ENTRY2 119, OpenDirectoryObject, 3
SYSSTUBS_ENTRY3 119, OpenDirectoryObject, 3
SYSSTUBS_ENTRY4 119, OpenDirectoryObject, 3
SYSSTUBS_ENTRY5 119, OpenDirectoryObject, 3
SYSSTUBS_ENTRY6 119, OpenDirectoryObject, 3
SYSSTUBS_ENTRY7 119, OpenDirectoryObject, 3
SYSSTUBS_ENTRY8 119, OpenDirectoryObject, 3
SYSSTUBS_ENTRY1 120, OpenEvent, 3
SYSSTUBS_ENTRY2 120, OpenEvent, 3
SYSSTUBS_ENTRY3 120, OpenEvent, 3
SYSSTUBS_ENTRY4 120, OpenEvent, 3
SYSSTUBS_ENTRY5 120, OpenEvent, 3
SYSSTUBS_ENTRY6 120, OpenEvent, 3
SYSSTUBS_ENTRY7 120, OpenEvent, 3
SYSSTUBS_ENTRY8 120, OpenEvent, 3
SYSSTUBS_ENTRY1 121, OpenEventPair, 3
SYSSTUBS_ENTRY2 121, OpenEventPair, 3
SYSSTUBS_ENTRY3 121, OpenEventPair, 3
SYSSTUBS_ENTRY4 121, OpenEventPair, 3
SYSSTUBS_ENTRY5 121, OpenEventPair, 3
SYSSTUBS_ENTRY6 121, OpenEventPair, 3
SYSSTUBS_ENTRY7 121, OpenEventPair, 3
SYSSTUBS_ENTRY8 121, OpenEventPair, 3
SYSSTUBS_ENTRY1 122, OpenFile, 6
SYSSTUBS_ENTRY2 122, OpenFile, 6
SYSSTUBS_ENTRY3 122, OpenFile, 6
SYSSTUBS_ENTRY4 122, OpenFile, 6
SYSSTUBS_ENTRY5 122, OpenFile, 6
SYSSTUBS_ENTRY6 122, OpenFile, 6
SYSSTUBS_ENTRY7 122, OpenFile, 6
SYSSTUBS_ENTRY8 122, OpenFile, 6
SYSSTUBS_ENTRY1 123, OpenIoCompletion, 3
SYSSTUBS_ENTRY2 123, OpenIoCompletion, 3
SYSSTUBS_ENTRY3 123, OpenIoCompletion, 3
SYSSTUBS_ENTRY4 123, OpenIoCompletion, 3
SYSSTUBS_ENTRY5 123, OpenIoCompletion, 3
SYSSTUBS_ENTRY6 123, OpenIoCompletion, 3
SYSSTUBS_ENTRY7 123, OpenIoCompletion, 3
SYSSTUBS_ENTRY8 123, OpenIoCompletion, 3
SYSSTUBS_ENTRY1 124, OpenJobObject, 3
SYSSTUBS_ENTRY2 124, OpenJobObject, 3
SYSSTUBS_ENTRY3 124, OpenJobObject, 3
SYSSTUBS_ENTRY4 124, OpenJobObject, 3
SYSSTUBS_ENTRY5 124, OpenJobObject, 3
SYSSTUBS_ENTRY6 124, OpenJobObject, 3
SYSSTUBS_ENTRY7 124, OpenJobObject, 3
SYSSTUBS_ENTRY8 124, OpenJobObject, 3
SYSSTUBS_ENTRY1 125, OpenKey, 3
SYSSTUBS_ENTRY2 125, OpenKey, 3
SYSSTUBS_ENTRY3 125, OpenKey, 3
SYSSTUBS_ENTRY4 125, OpenKey, 3
SYSSTUBS_ENTRY5 125, OpenKey, 3
SYSSTUBS_ENTRY6 125, OpenKey, 3
SYSSTUBS_ENTRY7 125, OpenKey, 3
SYSSTUBS_ENTRY8 125, OpenKey, 3
SYSSTUBS_ENTRY1 126, OpenMutant, 3
SYSSTUBS_ENTRY2 126, OpenMutant, 3
SYSSTUBS_ENTRY3 126, OpenMutant, 3
SYSSTUBS_ENTRY4 126, OpenMutant, 3
SYSSTUBS_ENTRY5 126, OpenMutant, 3
SYSSTUBS_ENTRY6 126, OpenMutant, 3
SYSSTUBS_ENTRY7 126, OpenMutant, 3
SYSSTUBS_ENTRY8 126, OpenMutant, 3
SYSSTUBS_ENTRY1 127, OpenObjectAuditAlarm, 12
SYSSTUBS_ENTRY2 127, OpenObjectAuditAlarm, 12
SYSSTUBS_ENTRY3 127, OpenObjectAuditAlarm, 12
SYSSTUBS_ENTRY4 127, OpenObjectAuditAlarm, 12
SYSSTUBS_ENTRY5 127, OpenObjectAuditAlarm, 12
SYSSTUBS_ENTRY6 127, OpenObjectAuditAlarm, 12
SYSSTUBS_ENTRY7 127, OpenObjectAuditAlarm, 12
SYSSTUBS_ENTRY8 127, OpenObjectAuditAlarm, 12
SYSSTUBS_ENTRY1 128, OpenProcess, 4
SYSSTUBS_ENTRY2 128, OpenProcess, 4
SYSSTUBS_ENTRY3 128, OpenProcess, 4
SYSSTUBS_ENTRY4 128, OpenProcess, 4
SYSSTUBS_ENTRY5 128, OpenProcess, 4
SYSSTUBS_ENTRY6 128, OpenProcess, 4
SYSSTUBS_ENTRY7 128, OpenProcess, 4
SYSSTUBS_ENTRY8 128, OpenProcess, 4
SYSSTUBS_ENTRY1 129, OpenProcessToken, 3
SYSSTUBS_ENTRY2 129, OpenProcessToken, 3
SYSSTUBS_ENTRY3 129, OpenProcessToken, 3
SYSSTUBS_ENTRY4 129, OpenProcessToken, 3
SYSSTUBS_ENTRY5 129, OpenProcessToken, 3
SYSSTUBS_ENTRY6 129, OpenProcessToken, 3
SYSSTUBS_ENTRY7 129, OpenProcessToken, 3
SYSSTUBS_ENTRY8 129, OpenProcessToken, 3
SYSSTUBS_ENTRY1 130, OpenProcessTokenEx, 4
SYSSTUBS_ENTRY2 130, OpenProcessTokenEx, 4
SYSSTUBS_ENTRY3 130, OpenProcessTokenEx, 4
SYSSTUBS_ENTRY4 130, OpenProcessTokenEx, 4
SYSSTUBS_ENTRY5 130, OpenProcessTokenEx, 4
SYSSTUBS_ENTRY6 130, OpenProcessTokenEx, 4
SYSSTUBS_ENTRY7 130, OpenProcessTokenEx, 4
SYSSTUBS_ENTRY8 130, OpenProcessTokenEx, 4
SYSSTUBS_ENTRY1 131, OpenSection, 3
SYSSTUBS_ENTRY2 131, OpenSection, 3
SYSSTUBS_ENTRY3 131, OpenSection, 3
SYSSTUBS_ENTRY4 131, OpenSection, 3
SYSSTUBS_ENTRY5 131, OpenSection, 3
SYSSTUBS_ENTRY6 131, OpenSection, 3
SYSSTUBS_ENTRY7 131, OpenSection, 3
SYSSTUBS_ENTRY8 131, OpenSection, 3
SYSSTUBS_ENTRY1 132, OpenSemaphore, 3
SYSSTUBS_ENTRY2 132, OpenSemaphore, 3
SYSSTUBS_ENTRY3 132, OpenSemaphore, 3
SYSSTUBS_ENTRY4 132, OpenSemaphore, 3
SYSSTUBS_ENTRY5 132, OpenSemaphore, 3
SYSSTUBS_ENTRY6 132, OpenSemaphore, 3
SYSSTUBS_ENTRY7 132, OpenSemaphore, 3
SYSSTUBS_ENTRY8 132, OpenSemaphore, 3
SYSSTUBS_ENTRY1 133, OpenSymbolicLinkObject, 3
SYSSTUBS_ENTRY2 133, OpenSymbolicLinkObject, 3
SYSSTUBS_ENTRY3 133, OpenSymbolicLinkObject, 3
SYSSTUBS_ENTRY4 133, OpenSymbolicLinkObject, 3
SYSSTUBS_ENTRY5 133, OpenSymbolicLinkObject, 3
SYSSTUBS_ENTRY6 133, OpenSymbolicLinkObject, 3
SYSSTUBS_ENTRY7 133, OpenSymbolicLinkObject, 3
SYSSTUBS_ENTRY8 133, OpenSymbolicLinkObject, 3
SYSSTUBS_ENTRY1 134, OpenThread, 4
SYSSTUBS_ENTRY2 134, OpenThread, 4
SYSSTUBS_ENTRY3 134, OpenThread, 4
SYSSTUBS_ENTRY4 134, OpenThread, 4
SYSSTUBS_ENTRY5 134, OpenThread, 4
SYSSTUBS_ENTRY6 134, OpenThread, 4
SYSSTUBS_ENTRY7 134, OpenThread, 4
SYSSTUBS_ENTRY8 134, OpenThread, 4
SYSSTUBS_ENTRY1 135, OpenThreadToken, 4
SYSSTUBS_ENTRY2 135, OpenThreadToken, 4
SYSSTUBS_ENTRY3 135, OpenThreadToken, 4
SYSSTUBS_ENTRY4 135, OpenThreadToken, 4
SYSSTUBS_ENTRY5 135, OpenThreadToken, 4
SYSSTUBS_ENTRY6 135, OpenThreadToken, 4
SYSSTUBS_ENTRY7 135, OpenThreadToken, 4
SYSSTUBS_ENTRY8 135, OpenThreadToken, 4
SYSSTUBS_ENTRY1 136, OpenThreadTokenEx, 5
SYSSTUBS_ENTRY2 136, OpenThreadTokenEx, 5
SYSSTUBS_ENTRY3 136, OpenThreadTokenEx, 5
SYSSTUBS_ENTRY4 136, OpenThreadTokenEx, 5
SYSSTUBS_ENTRY5 136, OpenThreadTokenEx, 5
SYSSTUBS_ENTRY6 136, OpenThreadTokenEx, 5
SYSSTUBS_ENTRY7 136, OpenThreadTokenEx, 5
SYSSTUBS_ENTRY8 136, OpenThreadTokenEx, 5
SYSSTUBS_ENTRY1 137, OpenTimer, 3
SYSSTUBS_ENTRY2 137, OpenTimer, 3
SYSSTUBS_ENTRY3 137, OpenTimer, 3
SYSSTUBS_ENTRY4 137, OpenTimer, 3
SYSSTUBS_ENTRY5 137, OpenTimer, 3
SYSSTUBS_ENTRY6 137, OpenTimer, 3
SYSSTUBS_ENTRY7 137, OpenTimer, 3
SYSSTUBS_ENTRY8 137, OpenTimer, 3
SYSSTUBS_ENTRY1 138, PlugPlayControl, 3
SYSSTUBS_ENTRY2 138, PlugPlayControl, 3
SYSSTUBS_ENTRY3 138, PlugPlayControl, 3
SYSSTUBS_ENTRY4 138, PlugPlayControl, 3
SYSSTUBS_ENTRY5 138, PlugPlayControl, 3
SYSSTUBS_ENTRY6 138, PlugPlayControl, 3
SYSSTUBS_ENTRY7 138, PlugPlayControl, 3
SYSSTUBS_ENTRY8 138, PlugPlayControl, 3
SYSSTUBS_ENTRY1 139, PowerInformation, 5
SYSSTUBS_ENTRY2 139, PowerInformation, 5
SYSSTUBS_ENTRY3 139, PowerInformation, 5
SYSSTUBS_ENTRY4 139, PowerInformation, 5
SYSSTUBS_ENTRY5 139, PowerInformation, 5
SYSSTUBS_ENTRY6 139, PowerInformation, 5
SYSSTUBS_ENTRY7 139, PowerInformation, 5
SYSSTUBS_ENTRY8 139, PowerInformation, 5
SYSSTUBS_ENTRY1 140, PrivilegeCheck, 3
SYSSTUBS_ENTRY2 140, PrivilegeCheck, 3
SYSSTUBS_ENTRY3 140, PrivilegeCheck, 3
SYSSTUBS_ENTRY4 140, PrivilegeCheck, 3
SYSSTUBS_ENTRY5 140, PrivilegeCheck, 3
SYSSTUBS_ENTRY6 140, PrivilegeCheck, 3
SYSSTUBS_ENTRY7 140, PrivilegeCheck, 3
SYSSTUBS_ENTRY8 140, PrivilegeCheck, 3
SYSSTUBS_ENTRY1 141, PrivilegeObjectAuditAlarm, 6
SYSSTUBS_ENTRY2 141, PrivilegeObjectAuditAlarm, 6
SYSSTUBS_ENTRY3 141, PrivilegeObjectAuditAlarm, 6
SYSSTUBS_ENTRY4 141, PrivilegeObjectAuditAlarm, 6
SYSSTUBS_ENTRY5 141, PrivilegeObjectAuditAlarm, 6
SYSSTUBS_ENTRY6 141, PrivilegeObjectAuditAlarm, 6
SYSSTUBS_ENTRY7 141, PrivilegeObjectAuditAlarm, 6
SYSSTUBS_ENTRY8 141, PrivilegeObjectAuditAlarm, 6
SYSSTUBS_ENTRY1 142, PrivilegedServiceAuditAlarm, 5
SYSSTUBS_ENTRY2 142, PrivilegedServiceAuditAlarm, 5
SYSSTUBS_ENTRY3 142, PrivilegedServiceAuditAlarm, 5
SYSSTUBS_ENTRY4 142, PrivilegedServiceAuditAlarm, 5
SYSSTUBS_ENTRY5 142, PrivilegedServiceAuditAlarm, 5
SYSSTUBS_ENTRY6 142, PrivilegedServiceAuditAlarm, 5
SYSSTUBS_ENTRY7 142, PrivilegedServiceAuditAlarm, 5
SYSSTUBS_ENTRY8 142, PrivilegedServiceAuditAlarm, 5
SYSSTUBS_ENTRY1 143, ProtectVirtualMemory, 5
SYSSTUBS_ENTRY2 143, ProtectVirtualMemory, 5
SYSSTUBS_ENTRY3 143, ProtectVirtualMemory, 5
SYSSTUBS_ENTRY4 143, ProtectVirtualMemory, 5
SYSSTUBS_ENTRY5 143, ProtectVirtualMemory, 5
SYSSTUBS_ENTRY6 143, ProtectVirtualMemory, 5
SYSSTUBS_ENTRY7 143, ProtectVirtualMemory, 5
SYSSTUBS_ENTRY8 143, ProtectVirtualMemory, 5
SYSSTUBS_ENTRY1 144, PulseEvent, 2
SYSSTUBS_ENTRY2 144, PulseEvent, 2
SYSSTUBS_ENTRY3 144, PulseEvent, 2
SYSSTUBS_ENTRY4 144, PulseEvent, 2
SYSSTUBS_ENTRY5 144, PulseEvent, 2
SYSSTUBS_ENTRY6 144, PulseEvent, 2
SYSSTUBS_ENTRY7 144, PulseEvent, 2
SYSSTUBS_ENTRY8 144, PulseEvent, 2
SYSSTUBS_ENTRY1 145, QueryAttributesFile, 2
SYSSTUBS_ENTRY2 145, QueryAttributesFile, 2
SYSSTUBS_ENTRY3 145, QueryAttributesFile, 2
SYSSTUBS_ENTRY4 145, QueryAttributesFile, 2
SYSSTUBS_ENTRY5 145, QueryAttributesFile, 2
SYSSTUBS_ENTRY6 145, QueryAttributesFile, 2
SYSSTUBS_ENTRY7 145, QueryAttributesFile, 2
SYSSTUBS_ENTRY8 145, QueryAttributesFile, 2
SYSSTUBS_ENTRY1 146, QueryBootEntryOrder, 2
SYSSTUBS_ENTRY2 146, QueryBootEntryOrder, 2
SYSSTUBS_ENTRY3 146, QueryBootEntryOrder, 2
SYSSTUBS_ENTRY4 146, QueryBootEntryOrder, 2
SYSSTUBS_ENTRY5 146, QueryBootEntryOrder, 2
SYSSTUBS_ENTRY6 146, QueryBootEntryOrder, 2
SYSSTUBS_ENTRY7 146, QueryBootEntryOrder, 2
SYSSTUBS_ENTRY8 146, QueryBootEntryOrder, 2
SYSSTUBS_ENTRY1 147, QueryBootOptions, 2
SYSSTUBS_ENTRY2 147, QueryBootOptions, 2
SYSSTUBS_ENTRY3 147, QueryBootOptions, 2
SYSSTUBS_ENTRY4 147, QueryBootOptions, 2
SYSSTUBS_ENTRY5 147, QueryBootOptions, 2
SYSSTUBS_ENTRY6 147, QueryBootOptions, 2
SYSSTUBS_ENTRY7 147, QueryBootOptions, 2
SYSSTUBS_ENTRY8 147, QueryBootOptions, 2
SYSSTUBS_ENTRY1 148, QueryDebugFilterState, 2
SYSSTUBS_ENTRY2 148, QueryDebugFilterState, 2
SYSSTUBS_ENTRY3 148, QueryDebugFilterState, 2
SYSSTUBS_ENTRY4 148, QueryDebugFilterState, 2
SYSSTUBS_ENTRY5 148, QueryDebugFilterState, 2
SYSSTUBS_ENTRY6 148, QueryDebugFilterState, 2
SYSSTUBS_ENTRY7 148, QueryDebugFilterState, 2
SYSSTUBS_ENTRY8 148, QueryDebugFilterState, 2
SYSSTUBS_ENTRY1 149, QueryDefaultLocale, 2
SYSSTUBS_ENTRY2 149, QueryDefaultLocale, 2
SYSSTUBS_ENTRY3 149, QueryDefaultLocale, 2
SYSSTUBS_ENTRY4 149, QueryDefaultLocale, 2
SYSSTUBS_ENTRY5 149, QueryDefaultLocale, 2
SYSSTUBS_ENTRY6 149, QueryDefaultLocale, 2
SYSSTUBS_ENTRY7 149, QueryDefaultLocale, 2
SYSSTUBS_ENTRY8 149, QueryDefaultLocale, 2
SYSSTUBS_ENTRY1 150, QueryDefaultUILanguage, 1
SYSSTUBS_ENTRY2 150, QueryDefaultUILanguage, 1
SYSSTUBS_ENTRY3 150, QueryDefaultUILanguage, 1
SYSSTUBS_ENTRY4 150, QueryDefaultUILanguage, 1
SYSSTUBS_ENTRY5 150, QueryDefaultUILanguage, 1
SYSSTUBS_ENTRY6 150, QueryDefaultUILanguage, 1
SYSSTUBS_ENTRY7 150, QueryDefaultUILanguage, 1
SYSSTUBS_ENTRY8 150, QueryDefaultUILanguage, 1
SYSSTUBS_ENTRY1 151, QueryDirectoryFile, 11
SYSSTUBS_ENTRY2 151, QueryDirectoryFile, 11
SYSSTUBS_ENTRY3 151, QueryDirectoryFile, 11
SYSSTUBS_ENTRY4 151, QueryDirectoryFile, 11
SYSSTUBS_ENTRY5 151, QueryDirectoryFile, 11
SYSSTUBS_ENTRY6 151, QueryDirectoryFile, 11
SYSSTUBS_ENTRY7 151, QueryDirectoryFile, 11
SYSSTUBS_ENTRY8 151, QueryDirectoryFile, 11
SYSSTUBS_ENTRY1 152, QueryDirectoryObject, 7
SYSSTUBS_ENTRY2 152, QueryDirectoryObject, 7
SYSSTUBS_ENTRY3 152, QueryDirectoryObject, 7
SYSSTUBS_ENTRY4 152, QueryDirectoryObject, 7
SYSSTUBS_ENTRY5 152, QueryDirectoryObject, 7
SYSSTUBS_ENTRY6 152, QueryDirectoryObject, 7
SYSSTUBS_ENTRY7 152, QueryDirectoryObject, 7
SYSSTUBS_ENTRY8 152, QueryDirectoryObject, 7
SYSSTUBS_ENTRY1 153, QueryDriverEntryOrder, 2
SYSSTUBS_ENTRY2 153, QueryDriverEntryOrder, 2
SYSSTUBS_ENTRY3 153, QueryDriverEntryOrder, 2
SYSSTUBS_ENTRY4 153, QueryDriverEntryOrder, 2
SYSSTUBS_ENTRY5 153, QueryDriverEntryOrder, 2
SYSSTUBS_ENTRY6 153, QueryDriverEntryOrder, 2
SYSSTUBS_ENTRY7 153, QueryDriverEntryOrder, 2
SYSSTUBS_ENTRY8 153, QueryDriverEntryOrder, 2
SYSSTUBS_ENTRY1 154, QueryEaFile, 9
SYSSTUBS_ENTRY2 154, QueryEaFile, 9
SYSSTUBS_ENTRY3 154, QueryEaFile, 9
SYSSTUBS_ENTRY4 154, QueryEaFile, 9
SYSSTUBS_ENTRY5 154, QueryEaFile, 9
SYSSTUBS_ENTRY6 154, QueryEaFile, 9
SYSSTUBS_ENTRY7 154, QueryEaFile, 9
SYSSTUBS_ENTRY8 154, QueryEaFile, 9
SYSSTUBS_ENTRY1 155, QueryEvent, 5
SYSSTUBS_ENTRY2 155, QueryEvent, 5
SYSSTUBS_ENTRY3 155, QueryEvent, 5
SYSSTUBS_ENTRY4 155, QueryEvent, 5
SYSSTUBS_ENTRY5 155, QueryEvent, 5
SYSSTUBS_ENTRY6 155, QueryEvent, 5
SYSSTUBS_ENTRY7 155, QueryEvent, 5
SYSSTUBS_ENTRY8 155, QueryEvent, 5
SYSSTUBS_ENTRY1 156, QueryFullAttributesFile, 2
SYSSTUBS_ENTRY2 156, QueryFullAttributesFile, 2
SYSSTUBS_ENTRY3 156, QueryFullAttributesFile, 2
SYSSTUBS_ENTRY4 156, QueryFullAttributesFile, 2
SYSSTUBS_ENTRY5 156, QueryFullAttributesFile, 2
SYSSTUBS_ENTRY6 156, QueryFullAttributesFile, 2
SYSSTUBS_ENTRY7 156, QueryFullAttributesFile, 2
SYSSTUBS_ENTRY8 156, QueryFullAttributesFile, 2
SYSSTUBS_ENTRY1 157, QueryInformationAtom, 5
SYSSTUBS_ENTRY2 157, QueryInformationAtom, 5
SYSSTUBS_ENTRY3 157, QueryInformationAtom, 5
SYSSTUBS_ENTRY4 157, QueryInformationAtom, 5
SYSSTUBS_ENTRY5 157, QueryInformationAtom, 5
SYSSTUBS_ENTRY6 157, QueryInformationAtom, 5
SYSSTUBS_ENTRY7 157, QueryInformationAtom, 5
SYSSTUBS_ENTRY8 157, QueryInformationAtom, 5
SYSSTUBS_ENTRY1 158, QueryInformationFile, 5
SYSSTUBS_ENTRY2 158, QueryInformationFile, 5
SYSSTUBS_ENTRY3 158, QueryInformationFile, 5
SYSSTUBS_ENTRY4 158, QueryInformationFile, 5
SYSSTUBS_ENTRY5 158, QueryInformationFile, 5
SYSSTUBS_ENTRY6 158, QueryInformationFile, 5
SYSSTUBS_ENTRY7 158, QueryInformationFile, 5
SYSSTUBS_ENTRY8 158, QueryInformationFile, 5
SYSSTUBS_ENTRY1 159, QueryInformationJobObject, 5
SYSSTUBS_ENTRY2 159, QueryInformationJobObject, 5
SYSSTUBS_ENTRY3 159, QueryInformationJobObject, 5
SYSSTUBS_ENTRY4 159, QueryInformationJobObject, 5
SYSSTUBS_ENTRY5 159, QueryInformationJobObject, 5
SYSSTUBS_ENTRY6 159, QueryInformationJobObject, 5
SYSSTUBS_ENTRY7 159, QueryInformationJobObject, 5
SYSSTUBS_ENTRY8 159, QueryInformationJobObject, 5
SYSSTUBS_ENTRY1 160, QueryInformationPort, 5
SYSSTUBS_ENTRY2 160, QueryInformationPort, 5
SYSSTUBS_ENTRY3 160, QueryInformationPort, 5
SYSSTUBS_ENTRY4 160, QueryInformationPort, 5
SYSSTUBS_ENTRY5 160, QueryInformationPort, 5
SYSSTUBS_ENTRY6 160, QueryInformationPort, 5
SYSSTUBS_ENTRY7 160, QueryInformationPort, 5
SYSSTUBS_ENTRY8 160, QueryInformationPort, 5
SYSSTUBS_ENTRY1 161, QueryInformationProcess, 5
SYSSTUBS_ENTRY2 161, QueryInformationProcess, 5
SYSSTUBS_ENTRY3 161, QueryInformationProcess, 5
SYSSTUBS_ENTRY4 161, QueryInformationProcess, 5
SYSSTUBS_ENTRY5 161, QueryInformationProcess, 5
SYSSTUBS_ENTRY6 161, QueryInformationProcess, 5
SYSSTUBS_ENTRY7 161, QueryInformationProcess, 5
SYSSTUBS_ENTRY8 161, QueryInformationProcess, 5
SYSSTUBS_ENTRY1 162, QueryInformationThread, 5
SYSSTUBS_ENTRY2 162, QueryInformationThread, 5
SYSSTUBS_ENTRY3 162, QueryInformationThread, 5
SYSSTUBS_ENTRY4 162, QueryInformationThread, 5
SYSSTUBS_ENTRY5 162, QueryInformationThread, 5
SYSSTUBS_ENTRY6 162, QueryInformationThread, 5
SYSSTUBS_ENTRY7 162, QueryInformationThread, 5
SYSSTUBS_ENTRY8 162, QueryInformationThread, 5
SYSSTUBS_ENTRY1 163, QueryInformationToken, 5
SYSSTUBS_ENTRY2 163, QueryInformationToken, 5
SYSSTUBS_ENTRY3 163, QueryInformationToken, 5
SYSSTUBS_ENTRY4 163, QueryInformationToken, 5
SYSSTUBS_ENTRY5 163, QueryInformationToken, 5
SYSSTUBS_ENTRY6 163, QueryInformationToken, 5
SYSSTUBS_ENTRY7 163, QueryInformationToken, 5
SYSSTUBS_ENTRY8 163, QueryInformationToken, 5
SYSSTUBS_ENTRY1 164, QueryInstallUILanguage, 1
SYSSTUBS_ENTRY2 164, QueryInstallUILanguage, 1
SYSSTUBS_ENTRY3 164, QueryInstallUILanguage, 1
SYSSTUBS_ENTRY4 164, QueryInstallUILanguage, 1
SYSSTUBS_ENTRY5 164, QueryInstallUILanguage, 1
SYSSTUBS_ENTRY6 164, QueryInstallUILanguage, 1
SYSSTUBS_ENTRY7 164, QueryInstallUILanguage, 1
SYSSTUBS_ENTRY8 164, QueryInstallUILanguage, 1
SYSSTUBS_ENTRY1 165, QueryIntervalProfile, 2
SYSSTUBS_ENTRY2 165, QueryIntervalProfile, 2
SYSSTUBS_ENTRY3 165, QueryIntervalProfile, 2
SYSSTUBS_ENTRY4 165, QueryIntervalProfile, 2
SYSSTUBS_ENTRY5 165, QueryIntervalProfile, 2
SYSSTUBS_ENTRY6 165, QueryIntervalProfile, 2
SYSSTUBS_ENTRY7 165, QueryIntervalProfile, 2
SYSSTUBS_ENTRY8 165, QueryIntervalProfile, 2
SYSSTUBS_ENTRY1 166, QueryIoCompletion, 5
SYSSTUBS_ENTRY2 166, QueryIoCompletion, 5
SYSSTUBS_ENTRY3 166, QueryIoCompletion, 5
SYSSTUBS_ENTRY4 166, QueryIoCompletion, 5
SYSSTUBS_ENTRY5 166, QueryIoCompletion, 5
SYSSTUBS_ENTRY6 166, QueryIoCompletion, 5
SYSSTUBS_ENTRY7 166, QueryIoCompletion, 5
SYSSTUBS_ENTRY8 166, QueryIoCompletion, 5
SYSSTUBS_ENTRY1 167, QueryKey, 5
SYSSTUBS_ENTRY2 167, QueryKey, 5
SYSSTUBS_ENTRY3 167, QueryKey, 5
SYSSTUBS_ENTRY4 167, QueryKey, 5
SYSSTUBS_ENTRY5 167, QueryKey, 5
SYSSTUBS_ENTRY6 167, QueryKey, 5
SYSSTUBS_ENTRY7 167, QueryKey, 5
SYSSTUBS_ENTRY8 167, QueryKey, 5
SYSSTUBS_ENTRY1 168, QueryMultipleValueKey, 6
SYSSTUBS_ENTRY2 168, QueryMultipleValueKey, 6
SYSSTUBS_ENTRY3 168, QueryMultipleValueKey, 6
SYSSTUBS_ENTRY4 168, QueryMultipleValueKey, 6
SYSSTUBS_ENTRY5 168, QueryMultipleValueKey, 6
SYSSTUBS_ENTRY6 168, QueryMultipleValueKey, 6
SYSSTUBS_ENTRY7 168, QueryMultipleValueKey, 6
SYSSTUBS_ENTRY8 168, QueryMultipleValueKey, 6
SYSSTUBS_ENTRY1 169, QueryMutant, 5
SYSSTUBS_ENTRY2 169, QueryMutant, 5
SYSSTUBS_ENTRY3 169, QueryMutant, 5
SYSSTUBS_ENTRY4 169, QueryMutant, 5
SYSSTUBS_ENTRY5 169, QueryMutant, 5
SYSSTUBS_ENTRY6 169, QueryMutant, 5
SYSSTUBS_ENTRY7 169, QueryMutant, 5
SYSSTUBS_ENTRY8 169, QueryMutant, 5
SYSSTUBS_ENTRY1 170, QueryObject, 5
SYSSTUBS_ENTRY2 170, QueryObject, 5
SYSSTUBS_ENTRY3 170, QueryObject, 5
SYSSTUBS_ENTRY4 170, QueryObject, 5
SYSSTUBS_ENTRY5 170, QueryObject, 5
SYSSTUBS_ENTRY6 170, QueryObject, 5
SYSSTUBS_ENTRY7 170, QueryObject, 5
SYSSTUBS_ENTRY8 170, QueryObject, 5
SYSSTUBS_ENTRY1 171, QueryOpenSubKeys, 2
SYSSTUBS_ENTRY2 171, QueryOpenSubKeys, 2
SYSSTUBS_ENTRY3 171, QueryOpenSubKeys, 2
SYSSTUBS_ENTRY4 171, QueryOpenSubKeys, 2
SYSSTUBS_ENTRY5 171, QueryOpenSubKeys, 2
SYSSTUBS_ENTRY6 171, QueryOpenSubKeys, 2
SYSSTUBS_ENTRY7 171, QueryOpenSubKeys, 2
SYSSTUBS_ENTRY8 171, QueryOpenSubKeys, 2
SYSSTUBS_ENTRY1 172, QueryOpenSubKeysEx, 4
SYSSTUBS_ENTRY2 172, QueryOpenSubKeysEx, 4
SYSSTUBS_ENTRY3 172, QueryOpenSubKeysEx, 4
SYSSTUBS_ENTRY4 172, QueryOpenSubKeysEx, 4
SYSSTUBS_ENTRY5 172, QueryOpenSubKeysEx, 4
SYSSTUBS_ENTRY6 172, QueryOpenSubKeysEx, 4
SYSSTUBS_ENTRY7 172, QueryOpenSubKeysEx, 4
SYSSTUBS_ENTRY8 172, QueryOpenSubKeysEx, 4
SYSSTUBS_ENTRY1 173, QueryPerformanceCounter, 2
SYSSTUBS_ENTRY2 173, QueryPerformanceCounter, 2
SYSSTUBS_ENTRY3 173, QueryPerformanceCounter, 2
SYSSTUBS_ENTRY4 173, QueryPerformanceCounter, 2
SYSSTUBS_ENTRY5 173, QueryPerformanceCounter, 2
SYSSTUBS_ENTRY6 173, QueryPerformanceCounter, 2
SYSSTUBS_ENTRY7 173, QueryPerformanceCounter, 2
SYSSTUBS_ENTRY8 173, QueryPerformanceCounter, 2
SYSSTUBS_ENTRY1 174, QueryQuotaInformationFile, 9
SYSSTUBS_ENTRY2 174, QueryQuotaInformationFile, 9
SYSSTUBS_ENTRY3 174, QueryQuotaInformationFile, 9
SYSSTUBS_ENTRY4 174, QueryQuotaInformationFile, 9
SYSSTUBS_ENTRY5 174, QueryQuotaInformationFile, 9
SYSSTUBS_ENTRY6 174, QueryQuotaInformationFile, 9
SYSSTUBS_ENTRY7 174, QueryQuotaInformationFile, 9
SYSSTUBS_ENTRY8 174, QueryQuotaInformationFile, 9
SYSSTUBS_ENTRY1 175, QuerySection, 5
SYSSTUBS_ENTRY2 175, QuerySection, 5
SYSSTUBS_ENTRY3 175, QuerySection, 5
SYSSTUBS_ENTRY4 175, QuerySection, 5
SYSSTUBS_ENTRY5 175, QuerySection, 5
SYSSTUBS_ENTRY6 175, QuerySection, 5
SYSSTUBS_ENTRY7 175, QuerySection, 5
SYSSTUBS_ENTRY8 175, QuerySection, 5
SYSSTUBS_ENTRY1 176, QuerySecurityObject, 5
SYSSTUBS_ENTRY2 176, QuerySecurityObject, 5
SYSSTUBS_ENTRY3 176, QuerySecurityObject, 5
SYSSTUBS_ENTRY4 176, QuerySecurityObject, 5
SYSSTUBS_ENTRY5 176, QuerySecurityObject, 5
SYSSTUBS_ENTRY6 176, QuerySecurityObject, 5
SYSSTUBS_ENTRY7 176, QuerySecurityObject, 5
SYSSTUBS_ENTRY8 176, QuerySecurityObject, 5
SYSSTUBS_ENTRY1 177, QuerySemaphore, 5
SYSSTUBS_ENTRY2 177, QuerySemaphore, 5
SYSSTUBS_ENTRY3 177, QuerySemaphore, 5
SYSSTUBS_ENTRY4 177, QuerySemaphore, 5
SYSSTUBS_ENTRY5 177, QuerySemaphore, 5
SYSSTUBS_ENTRY6 177, QuerySemaphore, 5
SYSSTUBS_ENTRY7 177, QuerySemaphore, 5
SYSSTUBS_ENTRY8 177, QuerySemaphore, 5
SYSSTUBS_ENTRY1 178, QuerySymbolicLinkObject, 3
SYSSTUBS_ENTRY2 178, QuerySymbolicLinkObject, 3
SYSSTUBS_ENTRY3 178, QuerySymbolicLinkObject, 3
SYSSTUBS_ENTRY4 178, QuerySymbolicLinkObject, 3
SYSSTUBS_ENTRY5 178, QuerySymbolicLinkObject, 3
SYSSTUBS_ENTRY6 178, QuerySymbolicLinkObject, 3
SYSSTUBS_ENTRY7 178, QuerySymbolicLinkObject, 3
SYSSTUBS_ENTRY8 178, QuerySymbolicLinkObject, 3
SYSSTUBS_ENTRY1 179, QuerySystemEnvironmentValue, 4
SYSSTUBS_ENTRY2 179, QuerySystemEnvironmentValue, 4
SYSSTUBS_ENTRY3 179, QuerySystemEnvironmentValue, 4
SYSSTUBS_ENTRY4 179, QuerySystemEnvironmentValue, 4
SYSSTUBS_ENTRY5 179, QuerySystemEnvironmentValue, 4
SYSSTUBS_ENTRY6 179, QuerySystemEnvironmentValue, 4
SYSSTUBS_ENTRY7 179, QuerySystemEnvironmentValue, 4
SYSSTUBS_ENTRY8 179, QuerySystemEnvironmentValue, 4
SYSSTUBS_ENTRY1 180, QuerySystemEnvironmentValueEx, 5
SYSSTUBS_ENTRY2 180, QuerySystemEnvironmentValueEx, 5
SYSSTUBS_ENTRY3 180, QuerySystemEnvironmentValueEx, 5
SYSSTUBS_ENTRY4 180, QuerySystemEnvironmentValueEx, 5
SYSSTUBS_ENTRY5 180, QuerySystemEnvironmentValueEx, 5
SYSSTUBS_ENTRY6 180, QuerySystemEnvironmentValueEx, 5
SYSSTUBS_ENTRY7 180, QuerySystemEnvironmentValueEx, 5
SYSSTUBS_ENTRY8 180, QuerySystemEnvironmentValueEx, 5
SYSSTUBS_ENTRY1 181, QuerySystemInformation, 4
SYSSTUBS_ENTRY2 181, QuerySystemInformation, 4
SYSSTUBS_ENTRY3 181, QuerySystemInformation, 4
SYSSTUBS_ENTRY4 181, QuerySystemInformation, 4
SYSSTUBS_ENTRY5 181, QuerySystemInformation, 4
SYSSTUBS_ENTRY6 181, QuerySystemInformation, 4
SYSSTUBS_ENTRY7 181, QuerySystemInformation, 4
SYSSTUBS_ENTRY8 181, QuerySystemInformation, 4
SYSSTUBS_ENTRY1 182, QuerySystemTime, 1
SYSSTUBS_ENTRY2 182, QuerySystemTime, 1
SYSSTUBS_ENTRY3 182, QuerySystemTime, 1
SYSSTUBS_ENTRY4 182, QuerySystemTime, 1
SYSSTUBS_ENTRY5 182, QuerySystemTime, 1
SYSSTUBS_ENTRY6 182, QuerySystemTime, 1
SYSSTUBS_ENTRY7 182, QuerySystemTime, 1
SYSSTUBS_ENTRY8 182, QuerySystemTime, 1
SYSSTUBS_ENTRY1 183, QueryTimer, 5
SYSSTUBS_ENTRY2 183, QueryTimer, 5
SYSSTUBS_ENTRY3 183, QueryTimer, 5
SYSSTUBS_ENTRY4 183, QueryTimer, 5
SYSSTUBS_ENTRY5 183, QueryTimer, 5
SYSSTUBS_ENTRY6 183, QueryTimer, 5
SYSSTUBS_ENTRY7 183, QueryTimer, 5
SYSSTUBS_ENTRY8 183, QueryTimer, 5
SYSSTUBS_ENTRY1 184, QueryTimerResolution, 3
SYSSTUBS_ENTRY2 184, QueryTimerResolution, 3
SYSSTUBS_ENTRY3 184, QueryTimerResolution, 3
SYSSTUBS_ENTRY4 184, QueryTimerResolution, 3
SYSSTUBS_ENTRY5 184, QueryTimerResolution, 3
SYSSTUBS_ENTRY6 184, QueryTimerResolution, 3
SYSSTUBS_ENTRY7 184, QueryTimerResolution, 3
SYSSTUBS_ENTRY8 184, QueryTimerResolution, 3
SYSSTUBS_ENTRY1 185, QueryValueKey, 6
SYSSTUBS_ENTRY2 185, QueryValueKey, 6
SYSSTUBS_ENTRY3 185, QueryValueKey, 6
SYSSTUBS_ENTRY4 185, QueryValueKey, 6
SYSSTUBS_ENTRY5 185, QueryValueKey, 6
SYSSTUBS_ENTRY6 185, QueryValueKey, 6
SYSSTUBS_ENTRY7 185, QueryValueKey, 6
SYSSTUBS_ENTRY8 185, QueryValueKey, 6
SYSSTUBS_ENTRY1 186, QueryVirtualMemory, 6
SYSSTUBS_ENTRY2 186, QueryVirtualMemory, 6
SYSSTUBS_ENTRY3 186, QueryVirtualMemory, 6
SYSSTUBS_ENTRY4 186, QueryVirtualMemory, 6
SYSSTUBS_ENTRY5 186, QueryVirtualMemory, 6
SYSSTUBS_ENTRY6 186, QueryVirtualMemory, 6
SYSSTUBS_ENTRY7 186, QueryVirtualMemory, 6
SYSSTUBS_ENTRY8 186, QueryVirtualMemory, 6
SYSSTUBS_ENTRY1 187, QueryVolumeInformationFile, 5
SYSSTUBS_ENTRY2 187, QueryVolumeInformationFile, 5
SYSSTUBS_ENTRY3 187, QueryVolumeInformationFile, 5
SYSSTUBS_ENTRY4 187, QueryVolumeInformationFile, 5
SYSSTUBS_ENTRY5 187, QueryVolumeInformationFile, 5
SYSSTUBS_ENTRY6 187, QueryVolumeInformationFile, 5
SYSSTUBS_ENTRY7 187, QueryVolumeInformationFile, 5
SYSSTUBS_ENTRY8 187, QueryVolumeInformationFile, 5
SYSSTUBS_ENTRY1 188, QueueApcThread, 5
SYSSTUBS_ENTRY2 188, QueueApcThread, 5
SYSSTUBS_ENTRY3 188, QueueApcThread, 5
SYSSTUBS_ENTRY4 188, QueueApcThread, 5
SYSSTUBS_ENTRY5 188, QueueApcThread, 5
SYSSTUBS_ENTRY6 188, QueueApcThread, 5
SYSSTUBS_ENTRY7 188, QueueApcThread, 5
SYSSTUBS_ENTRY8 188, QueueApcThread, 5
SYSSTUBS_ENTRY1 189, RaiseException, 3
SYSSTUBS_ENTRY2 189, RaiseException, 3
SYSSTUBS_ENTRY3 189, RaiseException, 3
SYSSTUBS_ENTRY4 189, RaiseException, 3
SYSSTUBS_ENTRY5 189, RaiseException, 3
SYSSTUBS_ENTRY6 189, RaiseException, 3
SYSSTUBS_ENTRY7 189, RaiseException, 3
SYSSTUBS_ENTRY8 189, RaiseException, 3
SYSSTUBS_ENTRY1 190, RaiseHardError, 6
SYSSTUBS_ENTRY2 190, RaiseHardError, 6
SYSSTUBS_ENTRY3 190, RaiseHardError, 6
SYSSTUBS_ENTRY4 190, RaiseHardError, 6
SYSSTUBS_ENTRY5 190, RaiseHardError, 6
SYSSTUBS_ENTRY6 190, RaiseHardError, 6
SYSSTUBS_ENTRY7 190, RaiseHardError, 6
SYSSTUBS_ENTRY8 190, RaiseHardError, 6
SYSSTUBS_ENTRY1 191, ReadFile, 9
SYSSTUBS_ENTRY2 191, ReadFile, 9
SYSSTUBS_ENTRY3 191, ReadFile, 9
SYSSTUBS_ENTRY4 191, ReadFile, 9
SYSSTUBS_ENTRY5 191, ReadFile, 9
SYSSTUBS_ENTRY6 191, ReadFile, 9
SYSSTUBS_ENTRY7 191, ReadFile, 9
SYSSTUBS_ENTRY8 191, ReadFile, 9
SYSSTUBS_ENTRY1 192, ReadFileScatter, 9
SYSSTUBS_ENTRY2 192, ReadFileScatter, 9
SYSSTUBS_ENTRY3 192, ReadFileScatter, 9
SYSSTUBS_ENTRY4 192, ReadFileScatter, 9
SYSSTUBS_ENTRY5 192, ReadFileScatter, 9
SYSSTUBS_ENTRY6 192, ReadFileScatter, 9
SYSSTUBS_ENTRY7 192, ReadFileScatter, 9
SYSSTUBS_ENTRY8 192, ReadFileScatter, 9
SYSSTUBS_ENTRY1 193, ReadRequestData, 6
SYSSTUBS_ENTRY2 193, ReadRequestData, 6
SYSSTUBS_ENTRY3 193, ReadRequestData, 6
SYSSTUBS_ENTRY4 193, ReadRequestData, 6
SYSSTUBS_ENTRY5 193, ReadRequestData, 6
SYSSTUBS_ENTRY6 193, ReadRequestData, 6
SYSSTUBS_ENTRY7 193, ReadRequestData, 6
SYSSTUBS_ENTRY8 193, ReadRequestData, 6
SYSSTUBS_ENTRY1 194, ReadVirtualMemory, 5
SYSSTUBS_ENTRY2 194, ReadVirtualMemory, 5
SYSSTUBS_ENTRY3 194, ReadVirtualMemory, 5
SYSSTUBS_ENTRY4 194, ReadVirtualMemory, 5
SYSSTUBS_ENTRY5 194, ReadVirtualMemory, 5
SYSSTUBS_ENTRY6 194, ReadVirtualMemory, 5
SYSSTUBS_ENTRY7 194, ReadVirtualMemory, 5
SYSSTUBS_ENTRY8 194, ReadVirtualMemory, 5
SYSSTUBS_ENTRY1 195, RegisterThreadTerminatePort, 1
SYSSTUBS_ENTRY2 195, RegisterThreadTerminatePort, 1
SYSSTUBS_ENTRY3 195, RegisterThreadTerminatePort, 1
SYSSTUBS_ENTRY4 195, RegisterThreadTerminatePort, 1
SYSSTUBS_ENTRY5 195, RegisterThreadTerminatePort, 1
SYSSTUBS_ENTRY6 195, RegisterThreadTerminatePort, 1
SYSSTUBS_ENTRY7 195, RegisterThreadTerminatePort, 1
SYSSTUBS_ENTRY8 195, RegisterThreadTerminatePort, 1
SYSSTUBS_ENTRY1 196, ReleaseMutant, 2
SYSSTUBS_ENTRY2 196, ReleaseMutant, 2
SYSSTUBS_ENTRY3 196, ReleaseMutant, 2
SYSSTUBS_ENTRY4 196, ReleaseMutant, 2
SYSSTUBS_ENTRY5 196, ReleaseMutant, 2
SYSSTUBS_ENTRY6 196, ReleaseMutant, 2
SYSSTUBS_ENTRY7 196, ReleaseMutant, 2
SYSSTUBS_ENTRY8 196, ReleaseMutant, 2
SYSSTUBS_ENTRY1 197, ReleaseSemaphore, 3
SYSSTUBS_ENTRY2 197, ReleaseSemaphore, 3
SYSSTUBS_ENTRY3 197, ReleaseSemaphore, 3
SYSSTUBS_ENTRY4 197, ReleaseSemaphore, 3
SYSSTUBS_ENTRY5 197, ReleaseSemaphore, 3
SYSSTUBS_ENTRY6 197, ReleaseSemaphore, 3
SYSSTUBS_ENTRY7 197, ReleaseSemaphore, 3
SYSSTUBS_ENTRY8 197, ReleaseSemaphore, 3
SYSSTUBS_ENTRY1 198, RemoveIoCompletion, 5
SYSSTUBS_ENTRY2 198, RemoveIoCompletion, 5
SYSSTUBS_ENTRY3 198, RemoveIoCompletion, 5
SYSSTUBS_ENTRY4 198, RemoveIoCompletion, 5
SYSSTUBS_ENTRY5 198, RemoveIoCompletion, 5
SYSSTUBS_ENTRY6 198, RemoveIoCompletion, 5
SYSSTUBS_ENTRY7 198, RemoveIoCompletion, 5
SYSSTUBS_ENTRY8 198, RemoveIoCompletion, 5
SYSSTUBS_ENTRY1 199, RemoveProcessDebug, 2
SYSSTUBS_ENTRY2 199, RemoveProcessDebug, 2
SYSSTUBS_ENTRY3 199, RemoveProcessDebug, 2
SYSSTUBS_ENTRY4 199, RemoveProcessDebug, 2
SYSSTUBS_ENTRY5 199, RemoveProcessDebug, 2
SYSSTUBS_ENTRY6 199, RemoveProcessDebug, 2
SYSSTUBS_ENTRY7 199, RemoveProcessDebug, 2
SYSSTUBS_ENTRY8 199, RemoveProcessDebug, 2
SYSSTUBS_ENTRY1 200, RenameKey, 2
SYSSTUBS_ENTRY2 200, RenameKey, 2
SYSSTUBS_ENTRY3 200, RenameKey, 2
SYSSTUBS_ENTRY4 200, RenameKey, 2
SYSSTUBS_ENTRY5 200, RenameKey, 2
SYSSTUBS_ENTRY6 200, RenameKey, 2
SYSSTUBS_ENTRY7 200, RenameKey, 2
SYSSTUBS_ENTRY8 200, RenameKey, 2
SYSSTUBS_ENTRY1 201, ReplaceKey, 3
SYSSTUBS_ENTRY2 201, ReplaceKey, 3
SYSSTUBS_ENTRY3 201, ReplaceKey, 3
SYSSTUBS_ENTRY4 201, ReplaceKey, 3
SYSSTUBS_ENTRY5 201, ReplaceKey, 3
SYSSTUBS_ENTRY6 201, ReplaceKey, 3
SYSSTUBS_ENTRY7 201, ReplaceKey, 3
SYSSTUBS_ENTRY8 201, ReplaceKey, 3
SYSSTUBS_ENTRY1 202, ReplyPort, 2
SYSSTUBS_ENTRY2 202, ReplyPort, 2
SYSSTUBS_ENTRY3 202, ReplyPort, 2
SYSSTUBS_ENTRY4 202, ReplyPort, 2
SYSSTUBS_ENTRY5 202, ReplyPort, 2
SYSSTUBS_ENTRY6 202, ReplyPort, 2
SYSSTUBS_ENTRY7 202, ReplyPort, 2
SYSSTUBS_ENTRY8 202, ReplyPort, 2
SYSSTUBS_ENTRY1 203, ReplyWaitReceivePort, 4
SYSSTUBS_ENTRY2 203, ReplyWaitReceivePort, 4
SYSSTUBS_ENTRY3 203, ReplyWaitReceivePort, 4
SYSSTUBS_ENTRY4 203, ReplyWaitReceivePort, 4
SYSSTUBS_ENTRY5 203, ReplyWaitReceivePort, 4
SYSSTUBS_ENTRY6 203, ReplyWaitReceivePort, 4
SYSSTUBS_ENTRY7 203, ReplyWaitReceivePort, 4
SYSSTUBS_ENTRY8 203, ReplyWaitReceivePort, 4
SYSSTUBS_ENTRY1 204, ReplyWaitReceivePortEx, 5
SYSSTUBS_ENTRY2 204, ReplyWaitReceivePortEx, 5
SYSSTUBS_ENTRY3 204, ReplyWaitReceivePortEx, 5
SYSSTUBS_ENTRY4 204, ReplyWaitReceivePortEx, 5
SYSSTUBS_ENTRY5 204, ReplyWaitReceivePortEx, 5
SYSSTUBS_ENTRY6 204, ReplyWaitReceivePortEx, 5
SYSSTUBS_ENTRY7 204, ReplyWaitReceivePortEx, 5
SYSSTUBS_ENTRY8 204, ReplyWaitReceivePortEx, 5
SYSSTUBS_ENTRY1 205, ReplyWaitReplyPort, 2
SYSSTUBS_ENTRY2 205, ReplyWaitReplyPort, 2
SYSSTUBS_ENTRY3 205, ReplyWaitReplyPort, 2
SYSSTUBS_ENTRY4 205, ReplyWaitReplyPort, 2
SYSSTUBS_ENTRY5 205, ReplyWaitReplyPort, 2
SYSSTUBS_ENTRY6 205, ReplyWaitReplyPort, 2
SYSSTUBS_ENTRY7 205, ReplyWaitReplyPort, 2
SYSSTUBS_ENTRY8 205, ReplyWaitReplyPort, 2
SYSSTUBS_ENTRY1 206, RequestDeviceWakeup, 1
SYSSTUBS_ENTRY2 206, RequestDeviceWakeup, 1
SYSSTUBS_ENTRY3 206, RequestDeviceWakeup, 1
SYSSTUBS_ENTRY4 206, RequestDeviceWakeup, 1
SYSSTUBS_ENTRY5 206, RequestDeviceWakeup, 1
SYSSTUBS_ENTRY6 206, RequestDeviceWakeup, 1
SYSSTUBS_ENTRY7 206, RequestDeviceWakeup, 1
SYSSTUBS_ENTRY8 206, RequestDeviceWakeup, 1
SYSSTUBS_ENTRY1 207, RequestPort, 2
SYSSTUBS_ENTRY2 207, RequestPort, 2
SYSSTUBS_ENTRY3 207, RequestPort, 2
SYSSTUBS_ENTRY4 207, RequestPort, 2
SYSSTUBS_ENTRY5 207, RequestPort, 2
SYSSTUBS_ENTRY6 207, RequestPort, 2
SYSSTUBS_ENTRY7 207, RequestPort, 2
SYSSTUBS_ENTRY8 207, RequestPort, 2
SYSSTUBS_ENTRY1 208, RequestWaitReplyPort, 3
SYSSTUBS_ENTRY2 208, RequestWaitReplyPort, 3
SYSSTUBS_ENTRY3 208, RequestWaitReplyPort, 3
SYSSTUBS_ENTRY4 208, RequestWaitReplyPort, 3
SYSSTUBS_ENTRY5 208, RequestWaitReplyPort, 3
SYSSTUBS_ENTRY6 208, RequestWaitReplyPort, 3
SYSSTUBS_ENTRY7 208, RequestWaitReplyPort, 3
SYSSTUBS_ENTRY8 208, RequestWaitReplyPort, 3
SYSSTUBS_ENTRY1 209, RequestWakeupLatency, 1
SYSSTUBS_ENTRY2 209, RequestWakeupLatency, 1
SYSSTUBS_ENTRY3 209, RequestWakeupLatency, 1
SYSSTUBS_ENTRY4 209, RequestWakeupLatency, 1
SYSSTUBS_ENTRY5 209, RequestWakeupLatency, 1
SYSSTUBS_ENTRY6 209, RequestWakeupLatency, 1
SYSSTUBS_ENTRY7 209, RequestWakeupLatency, 1
SYSSTUBS_ENTRY8 209, RequestWakeupLatency, 1
SYSSTUBS_ENTRY1 210, ResetEvent, 2
SYSSTUBS_ENTRY2 210, ResetEvent, 2
SYSSTUBS_ENTRY3 210, ResetEvent, 2
SYSSTUBS_ENTRY4 210, ResetEvent, 2
SYSSTUBS_ENTRY5 210, ResetEvent, 2
SYSSTUBS_ENTRY6 210, ResetEvent, 2
SYSSTUBS_ENTRY7 210, ResetEvent, 2
SYSSTUBS_ENTRY8 210, ResetEvent, 2
SYSSTUBS_ENTRY1 211, ResetWriteWatch, 3
SYSSTUBS_ENTRY2 211, ResetWriteWatch, 3
SYSSTUBS_ENTRY3 211, ResetWriteWatch, 3
SYSSTUBS_ENTRY4 211, ResetWriteWatch, 3
SYSSTUBS_ENTRY5 211, ResetWriteWatch, 3
SYSSTUBS_ENTRY6 211, ResetWriteWatch, 3
SYSSTUBS_ENTRY7 211, ResetWriteWatch, 3
SYSSTUBS_ENTRY8 211, ResetWriteWatch, 3
SYSSTUBS_ENTRY1 212, RestoreKey, 3
SYSSTUBS_ENTRY2 212, RestoreKey, 3
SYSSTUBS_ENTRY3 212, RestoreKey, 3
SYSSTUBS_ENTRY4 212, RestoreKey, 3
SYSSTUBS_ENTRY5 212, RestoreKey, 3
SYSSTUBS_ENTRY6 212, RestoreKey, 3
SYSSTUBS_ENTRY7 212, RestoreKey, 3
SYSSTUBS_ENTRY8 212, RestoreKey, 3
SYSSTUBS_ENTRY1 213, ResumeProcess, 1
SYSSTUBS_ENTRY2 213, ResumeProcess, 1
SYSSTUBS_ENTRY3 213, ResumeProcess, 1
SYSSTUBS_ENTRY4 213, ResumeProcess, 1
SYSSTUBS_ENTRY5 213, ResumeProcess, 1
SYSSTUBS_ENTRY6 213, ResumeProcess, 1
SYSSTUBS_ENTRY7 213, ResumeProcess, 1
SYSSTUBS_ENTRY8 213, ResumeProcess, 1
SYSSTUBS_ENTRY1 214, ResumeThread, 2
SYSSTUBS_ENTRY2 214, ResumeThread, 2
SYSSTUBS_ENTRY3 214, ResumeThread, 2
SYSSTUBS_ENTRY4 214, ResumeThread, 2
SYSSTUBS_ENTRY5 214, ResumeThread, 2
SYSSTUBS_ENTRY6 214, ResumeThread, 2
SYSSTUBS_ENTRY7 214, ResumeThread, 2
SYSSTUBS_ENTRY8 214, ResumeThread, 2
SYSSTUBS_ENTRY1 215, SaveKey, 2
SYSSTUBS_ENTRY2 215, SaveKey, 2
SYSSTUBS_ENTRY3 215, SaveKey, 2
SYSSTUBS_ENTRY4 215, SaveKey, 2
SYSSTUBS_ENTRY5 215, SaveKey, 2
SYSSTUBS_ENTRY6 215, SaveKey, 2
SYSSTUBS_ENTRY7 215, SaveKey, 2
SYSSTUBS_ENTRY8 215, SaveKey, 2
SYSSTUBS_ENTRY1 216, SaveKeyEx, 3
SYSSTUBS_ENTRY2 216, SaveKeyEx, 3
SYSSTUBS_ENTRY3 216, SaveKeyEx, 3
SYSSTUBS_ENTRY4 216, SaveKeyEx, 3
SYSSTUBS_ENTRY5 216, SaveKeyEx, 3
SYSSTUBS_ENTRY6 216, SaveKeyEx, 3
SYSSTUBS_ENTRY7 216, SaveKeyEx, 3
SYSSTUBS_ENTRY8 216, SaveKeyEx, 3
SYSSTUBS_ENTRY1 217, SaveMergedKeys, 3
SYSSTUBS_ENTRY2 217, SaveMergedKeys, 3
SYSSTUBS_ENTRY3 217, SaveMergedKeys, 3
SYSSTUBS_ENTRY4 217, SaveMergedKeys, 3
SYSSTUBS_ENTRY5 217, SaveMergedKeys, 3
SYSSTUBS_ENTRY6 217, SaveMergedKeys, 3
SYSSTUBS_ENTRY7 217, SaveMergedKeys, 3
SYSSTUBS_ENTRY8 217, SaveMergedKeys, 3
SYSSTUBS_ENTRY1 218, SecureConnectPort, 9
SYSSTUBS_ENTRY2 218, SecureConnectPort, 9
SYSSTUBS_ENTRY3 218, SecureConnectPort, 9
SYSSTUBS_ENTRY4 218, SecureConnectPort, 9
SYSSTUBS_ENTRY5 218, SecureConnectPort, 9
SYSSTUBS_ENTRY6 218, SecureConnectPort, 9
SYSSTUBS_ENTRY7 218, SecureConnectPort, 9
SYSSTUBS_ENTRY8 218, SecureConnectPort, 9
SYSSTUBS_ENTRY1 219, SetBootEntryOrder, 2
SYSSTUBS_ENTRY2 219, SetBootEntryOrder, 2
SYSSTUBS_ENTRY3 219, SetBootEntryOrder, 2
SYSSTUBS_ENTRY4 219, SetBootEntryOrder, 2
SYSSTUBS_ENTRY5 219, SetBootEntryOrder, 2
SYSSTUBS_ENTRY6 219, SetBootEntryOrder, 2
SYSSTUBS_ENTRY7 219, SetBootEntryOrder, 2
SYSSTUBS_ENTRY8 219, SetBootEntryOrder, 2
SYSSTUBS_ENTRY1 220, SetBootOptions, 2
SYSSTUBS_ENTRY2 220, SetBootOptions, 2
SYSSTUBS_ENTRY3 220, SetBootOptions, 2
SYSSTUBS_ENTRY4 220, SetBootOptions, 2
SYSSTUBS_ENTRY5 220, SetBootOptions, 2
SYSSTUBS_ENTRY6 220, SetBootOptions, 2
SYSSTUBS_ENTRY7 220, SetBootOptions, 2
SYSSTUBS_ENTRY8 220, SetBootOptions, 2
SYSSTUBS_ENTRY1 221, SetContextThread, 2
SYSSTUBS_ENTRY2 221, SetContextThread, 2
SYSSTUBS_ENTRY3 221, SetContextThread, 2
SYSSTUBS_ENTRY4 221, SetContextThread, 2
SYSSTUBS_ENTRY5 221, SetContextThread, 2
SYSSTUBS_ENTRY6 221, SetContextThread, 2
SYSSTUBS_ENTRY7 221, SetContextThread, 2
SYSSTUBS_ENTRY8 221, SetContextThread, 2
SYSSTUBS_ENTRY1 222, SetDebugFilterState, 3
SYSSTUBS_ENTRY2 222, SetDebugFilterState, 3
SYSSTUBS_ENTRY3 222, SetDebugFilterState, 3
SYSSTUBS_ENTRY4 222, SetDebugFilterState, 3
SYSSTUBS_ENTRY5 222, SetDebugFilterState, 3
SYSSTUBS_ENTRY6 222, SetDebugFilterState, 3
SYSSTUBS_ENTRY7 222, SetDebugFilterState, 3
SYSSTUBS_ENTRY8 222, SetDebugFilterState, 3
SYSSTUBS_ENTRY1 223, SetDefaultHardErrorPort, 1
SYSSTUBS_ENTRY2 223, SetDefaultHardErrorPort, 1
SYSSTUBS_ENTRY3 223, SetDefaultHardErrorPort, 1
SYSSTUBS_ENTRY4 223, SetDefaultHardErrorPort, 1
SYSSTUBS_ENTRY5 223, SetDefaultHardErrorPort, 1
SYSSTUBS_ENTRY6 223, SetDefaultHardErrorPort, 1
SYSSTUBS_ENTRY7 223, SetDefaultHardErrorPort, 1
SYSSTUBS_ENTRY8 223, SetDefaultHardErrorPort, 1
SYSSTUBS_ENTRY1 224, SetDefaultLocale, 2
SYSSTUBS_ENTRY2 224, SetDefaultLocale, 2
SYSSTUBS_ENTRY3 224, SetDefaultLocale, 2
SYSSTUBS_ENTRY4 224, SetDefaultLocale, 2
SYSSTUBS_ENTRY5 224, SetDefaultLocale, 2
SYSSTUBS_ENTRY6 224, SetDefaultLocale, 2
SYSSTUBS_ENTRY7 224, SetDefaultLocale, 2
SYSSTUBS_ENTRY8 224, SetDefaultLocale, 2
SYSSTUBS_ENTRY1 225, SetDefaultUILanguage, 1
SYSSTUBS_ENTRY2 225, SetDefaultUILanguage, 1
SYSSTUBS_ENTRY3 225, SetDefaultUILanguage, 1
SYSSTUBS_ENTRY4 225, SetDefaultUILanguage, 1
SYSSTUBS_ENTRY5 225, SetDefaultUILanguage, 1
SYSSTUBS_ENTRY6 225, SetDefaultUILanguage, 1
SYSSTUBS_ENTRY7 225, SetDefaultUILanguage, 1
SYSSTUBS_ENTRY8 225, SetDefaultUILanguage, 1
SYSSTUBS_ENTRY1 226, SetDriverEntryOrder, 2
SYSSTUBS_ENTRY2 226, SetDriverEntryOrder, 2
SYSSTUBS_ENTRY3 226, SetDriverEntryOrder, 2
SYSSTUBS_ENTRY4 226, SetDriverEntryOrder, 2
SYSSTUBS_ENTRY5 226, SetDriverEntryOrder, 2
SYSSTUBS_ENTRY6 226, SetDriverEntryOrder, 2
SYSSTUBS_ENTRY7 226, SetDriverEntryOrder, 2
SYSSTUBS_ENTRY8 226, SetDriverEntryOrder, 2
SYSSTUBS_ENTRY1 227, SetEaFile, 4
SYSSTUBS_ENTRY2 227, SetEaFile, 4
SYSSTUBS_ENTRY3 227, SetEaFile, 4
SYSSTUBS_ENTRY4 227, SetEaFile, 4
SYSSTUBS_ENTRY5 227, SetEaFile, 4
SYSSTUBS_ENTRY6 227, SetEaFile, 4
SYSSTUBS_ENTRY7 227, SetEaFile, 4
SYSSTUBS_ENTRY8 227, SetEaFile, 4
SYSSTUBS_ENTRY1 228, SetEvent, 2
SYSSTUBS_ENTRY2 228, SetEvent, 2
SYSSTUBS_ENTRY3 228, SetEvent, 2
SYSSTUBS_ENTRY4 228, SetEvent, 2
SYSSTUBS_ENTRY5 228, SetEvent, 2
SYSSTUBS_ENTRY6 228, SetEvent, 2
SYSSTUBS_ENTRY7 228, SetEvent, 2
SYSSTUBS_ENTRY8 228, SetEvent, 2
SYSSTUBS_ENTRY1 229, SetEventBoostPriority, 1
SYSSTUBS_ENTRY2 229, SetEventBoostPriority, 1
SYSSTUBS_ENTRY3 229, SetEventBoostPriority, 1
SYSSTUBS_ENTRY4 229, SetEventBoostPriority, 1
SYSSTUBS_ENTRY5 229, SetEventBoostPriority, 1
SYSSTUBS_ENTRY6 229, SetEventBoostPriority, 1
SYSSTUBS_ENTRY7 229, SetEventBoostPriority, 1
SYSSTUBS_ENTRY8 229, SetEventBoostPriority, 1
SYSSTUBS_ENTRY1 230, SetHighEventPair, 1
SYSSTUBS_ENTRY2 230, SetHighEventPair, 1
SYSSTUBS_ENTRY3 230, SetHighEventPair, 1
SYSSTUBS_ENTRY4 230, SetHighEventPair, 1
SYSSTUBS_ENTRY5 230, SetHighEventPair, 1
SYSSTUBS_ENTRY6 230, SetHighEventPair, 1
SYSSTUBS_ENTRY7 230, SetHighEventPair, 1
SYSSTUBS_ENTRY8 230, SetHighEventPair, 1
SYSSTUBS_ENTRY1 231, SetHighWaitLowEventPair, 1
SYSSTUBS_ENTRY2 231, SetHighWaitLowEventPair, 1
SYSSTUBS_ENTRY3 231, SetHighWaitLowEventPair, 1
SYSSTUBS_ENTRY4 231, SetHighWaitLowEventPair, 1
SYSSTUBS_ENTRY5 231, SetHighWaitLowEventPair, 1
SYSSTUBS_ENTRY6 231, SetHighWaitLowEventPair, 1
SYSSTUBS_ENTRY7 231, SetHighWaitLowEventPair, 1
SYSSTUBS_ENTRY8 231, SetHighWaitLowEventPair, 1
SYSSTUBS_ENTRY1 232, SetInformationDebugObject, 5
SYSSTUBS_ENTRY2 232, SetInformationDebugObject, 5
SYSSTUBS_ENTRY3 232, SetInformationDebugObject, 5
SYSSTUBS_ENTRY4 232, SetInformationDebugObject, 5
SYSSTUBS_ENTRY5 232, SetInformationDebugObject, 5
SYSSTUBS_ENTRY6 232, SetInformationDebugObject, 5
SYSSTUBS_ENTRY7 232, SetInformationDebugObject, 5
SYSSTUBS_ENTRY8 232, SetInformationDebugObject, 5
SYSSTUBS_ENTRY1 233, SetInformationFile, 5
SYSSTUBS_ENTRY2 233, SetInformationFile, 5
SYSSTUBS_ENTRY3 233, SetInformationFile, 5
SYSSTUBS_ENTRY4 233, SetInformationFile, 5
SYSSTUBS_ENTRY5 233, SetInformationFile, 5
SYSSTUBS_ENTRY6 233, SetInformationFile, 5
SYSSTUBS_ENTRY7 233, SetInformationFile, 5
SYSSTUBS_ENTRY8 233, SetInformationFile, 5
SYSSTUBS_ENTRY1 234, SetInformationJobObject, 4
SYSSTUBS_ENTRY2 234, SetInformationJobObject, 4
SYSSTUBS_ENTRY3 234, SetInformationJobObject, 4
SYSSTUBS_ENTRY4 234, SetInformationJobObject, 4
SYSSTUBS_ENTRY5 234, SetInformationJobObject, 4
SYSSTUBS_ENTRY6 234, SetInformationJobObject, 4
SYSSTUBS_ENTRY7 234, SetInformationJobObject, 4
SYSSTUBS_ENTRY8 234, SetInformationJobObject, 4
SYSSTUBS_ENTRY1 235, SetInformationKey, 4
SYSSTUBS_ENTRY2 235, SetInformationKey, 4
SYSSTUBS_ENTRY3 235, SetInformationKey, 4
SYSSTUBS_ENTRY4 235, SetInformationKey, 4
SYSSTUBS_ENTRY5 235, SetInformationKey, 4
SYSSTUBS_ENTRY6 235, SetInformationKey, 4
SYSSTUBS_ENTRY7 235, SetInformationKey, 4
SYSSTUBS_ENTRY8 235, SetInformationKey, 4
SYSSTUBS_ENTRY1 236, SetInformationObject, 4
SYSSTUBS_ENTRY2 236, SetInformationObject, 4
SYSSTUBS_ENTRY3 236, SetInformationObject, 4
SYSSTUBS_ENTRY4 236, SetInformationObject, 4
SYSSTUBS_ENTRY5 236, SetInformationObject, 4
SYSSTUBS_ENTRY6 236, SetInformationObject, 4
SYSSTUBS_ENTRY7 236, SetInformationObject, 4
SYSSTUBS_ENTRY8 236, SetInformationObject, 4
SYSSTUBS_ENTRY1 237, SetInformationProcess, 4
SYSSTUBS_ENTRY2 237, SetInformationProcess, 4
SYSSTUBS_ENTRY3 237, SetInformationProcess, 4
SYSSTUBS_ENTRY4 237, SetInformationProcess, 4
SYSSTUBS_ENTRY5 237, SetInformationProcess, 4
SYSSTUBS_ENTRY6 237, SetInformationProcess, 4
SYSSTUBS_ENTRY7 237, SetInformationProcess, 4
SYSSTUBS_ENTRY8 237, SetInformationProcess, 4
SYSSTUBS_ENTRY1 238, SetInformationThread, 4
SYSSTUBS_ENTRY2 238, SetInformationThread, 4
SYSSTUBS_ENTRY3 238, SetInformationThread, 4
SYSSTUBS_ENTRY4 238, SetInformationThread, 4
SYSSTUBS_ENTRY5 238, SetInformationThread, 4
SYSSTUBS_ENTRY6 238, SetInformationThread, 4
SYSSTUBS_ENTRY7 238, SetInformationThread, 4
SYSSTUBS_ENTRY8 238, SetInformationThread, 4
SYSSTUBS_ENTRY1 239, SetInformationToken, 4
SYSSTUBS_ENTRY2 239, SetInformationToken, 4
SYSSTUBS_ENTRY3 239, SetInformationToken, 4
SYSSTUBS_ENTRY4 239, SetInformationToken, 4
SYSSTUBS_ENTRY5 239, SetInformationToken, 4
SYSSTUBS_ENTRY6 239, SetInformationToken, 4
SYSSTUBS_ENTRY7 239, SetInformationToken, 4
SYSSTUBS_ENTRY8 239, SetInformationToken, 4
SYSSTUBS_ENTRY1 240, SetIntervalProfile, 2
SYSSTUBS_ENTRY2 240, SetIntervalProfile, 2
SYSSTUBS_ENTRY3 240, SetIntervalProfile, 2
SYSSTUBS_ENTRY4 240, SetIntervalProfile, 2
SYSSTUBS_ENTRY5 240, SetIntervalProfile, 2
SYSSTUBS_ENTRY6 240, SetIntervalProfile, 2
SYSSTUBS_ENTRY7 240, SetIntervalProfile, 2
SYSSTUBS_ENTRY8 240, SetIntervalProfile, 2
SYSSTUBS_ENTRY1 241, SetIoCompletion, 5
SYSSTUBS_ENTRY2 241, SetIoCompletion, 5
SYSSTUBS_ENTRY3 241, SetIoCompletion, 5
SYSSTUBS_ENTRY4 241, SetIoCompletion, 5
SYSSTUBS_ENTRY5 241, SetIoCompletion, 5
SYSSTUBS_ENTRY6 241, SetIoCompletion, 5
SYSSTUBS_ENTRY7 241, SetIoCompletion, 5
SYSSTUBS_ENTRY8 241, SetIoCompletion, 5
SYSSTUBS_ENTRY1 242, SetLdtEntries, 6
SYSSTUBS_ENTRY2 242, SetLdtEntries, 6
SYSSTUBS_ENTRY3 242, SetLdtEntries, 6
SYSSTUBS_ENTRY4 242, SetLdtEntries, 6
SYSSTUBS_ENTRY5 242, SetLdtEntries, 6
SYSSTUBS_ENTRY6 242, SetLdtEntries, 6
SYSSTUBS_ENTRY7 242, SetLdtEntries, 6
SYSSTUBS_ENTRY8 242, SetLdtEntries, 6
SYSSTUBS_ENTRY1 243, SetLowEventPair, 1
SYSSTUBS_ENTRY2 243, SetLowEventPair, 1
SYSSTUBS_ENTRY3 243, SetLowEventPair, 1
SYSSTUBS_ENTRY4 243, SetLowEventPair, 1
SYSSTUBS_ENTRY5 243, SetLowEventPair, 1
SYSSTUBS_ENTRY6 243, SetLowEventPair, 1
SYSSTUBS_ENTRY7 243, SetLowEventPair, 1
SYSSTUBS_ENTRY8 243, SetLowEventPair, 1
SYSSTUBS_ENTRY1 244, SetLowWaitHighEventPair, 1
SYSSTUBS_ENTRY2 244, SetLowWaitHighEventPair, 1
SYSSTUBS_ENTRY3 244, SetLowWaitHighEventPair, 1
SYSSTUBS_ENTRY4 244, SetLowWaitHighEventPair, 1
SYSSTUBS_ENTRY5 244, SetLowWaitHighEventPair, 1
SYSSTUBS_ENTRY6 244, SetLowWaitHighEventPair, 1
SYSSTUBS_ENTRY7 244, SetLowWaitHighEventPair, 1
SYSSTUBS_ENTRY8 244, SetLowWaitHighEventPair, 1
SYSSTUBS_ENTRY1 245, SetQuotaInformationFile, 4
SYSSTUBS_ENTRY2 245, SetQuotaInformationFile, 4
SYSSTUBS_ENTRY3 245, SetQuotaInformationFile, 4
SYSSTUBS_ENTRY4 245, SetQuotaInformationFile, 4
SYSSTUBS_ENTRY5 245, SetQuotaInformationFile, 4
SYSSTUBS_ENTRY6 245, SetQuotaInformationFile, 4
SYSSTUBS_ENTRY7 245, SetQuotaInformationFile, 4
SYSSTUBS_ENTRY8 245, SetQuotaInformationFile, 4
SYSSTUBS_ENTRY1 246, SetSecurityObject, 3
SYSSTUBS_ENTRY2 246, SetSecurityObject, 3
SYSSTUBS_ENTRY3 246, SetSecurityObject, 3
SYSSTUBS_ENTRY4 246, SetSecurityObject, 3
SYSSTUBS_ENTRY5 246, SetSecurityObject, 3
SYSSTUBS_ENTRY6 246, SetSecurityObject, 3
SYSSTUBS_ENTRY7 246, SetSecurityObject, 3
SYSSTUBS_ENTRY8 246, SetSecurityObject, 3
SYSSTUBS_ENTRY1 247, SetSystemEnvironmentValue, 2
SYSSTUBS_ENTRY2 247, SetSystemEnvironmentValue, 2
SYSSTUBS_ENTRY3 247, SetSystemEnvironmentValue, 2
SYSSTUBS_ENTRY4 247, SetSystemEnvironmentValue, 2
SYSSTUBS_ENTRY5 247, SetSystemEnvironmentValue, 2
SYSSTUBS_ENTRY6 247, SetSystemEnvironmentValue, 2
SYSSTUBS_ENTRY7 247, SetSystemEnvironmentValue, 2
SYSSTUBS_ENTRY8 247, SetSystemEnvironmentValue, 2
SYSSTUBS_ENTRY1 248, SetSystemEnvironmentValueEx, 5
SYSSTUBS_ENTRY2 248, SetSystemEnvironmentValueEx, 5
SYSSTUBS_ENTRY3 248, SetSystemEnvironmentValueEx, 5
SYSSTUBS_ENTRY4 248, SetSystemEnvironmentValueEx, 5
SYSSTUBS_ENTRY5 248, SetSystemEnvironmentValueEx, 5
SYSSTUBS_ENTRY6 248, SetSystemEnvironmentValueEx, 5
SYSSTUBS_ENTRY7 248, SetSystemEnvironmentValueEx, 5
SYSSTUBS_ENTRY8 248, SetSystemEnvironmentValueEx, 5
SYSSTUBS_ENTRY1 249, SetSystemInformation, 3
SYSSTUBS_ENTRY2 249, SetSystemInformation, 3
SYSSTUBS_ENTRY3 249, SetSystemInformation, 3
SYSSTUBS_ENTRY4 249, SetSystemInformation, 3
SYSSTUBS_ENTRY5 249, SetSystemInformation, 3
SYSSTUBS_ENTRY6 249, SetSystemInformation, 3
SYSSTUBS_ENTRY7 249, SetSystemInformation, 3
SYSSTUBS_ENTRY8 249, SetSystemInformation, 3
SYSSTUBS_ENTRY1 250, SetSystemPowerState, 3
SYSSTUBS_ENTRY2 250, SetSystemPowerState, 3
SYSSTUBS_ENTRY3 250, SetSystemPowerState, 3
SYSSTUBS_ENTRY4 250, SetSystemPowerState, 3
SYSSTUBS_ENTRY5 250, SetSystemPowerState, 3
SYSSTUBS_ENTRY6 250, SetSystemPowerState, 3
SYSSTUBS_ENTRY7 250, SetSystemPowerState, 3
SYSSTUBS_ENTRY8 250, SetSystemPowerState, 3
SYSSTUBS_ENTRY1 251, SetSystemTime, 2
SYSSTUBS_ENTRY2 251, SetSystemTime, 2
SYSSTUBS_ENTRY3 251, SetSystemTime, 2
SYSSTUBS_ENTRY4 251, SetSystemTime, 2
SYSSTUBS_ENTRY5 251, SetSystemTime, 2
SYSSTUBS_ENTRY6 251, SetSystemTime, 2
SYSSTUBS_ENTRY7 251, SetSystemTime, 2
SYSSTUBS_ENTRY8 251, SetSystemTime, 2
SYSSTUBS_ENTRY1 252, SetThreadExecutionState, 2
SYSSTUBS_ENTRY2 252, SetThreadExecutionState, 2
SYSSTUBS_ENTRY3 252, SetThreadExecutionState, 2
SYSSTUBS_ENTRY4 252, SetThreadExecutionState, 2
SYSSTUBS_ENTRY5 252, SetThreadExecutionState, 2
SYSSTUBS_ENTRY6 252, SetThreadExecutionState, 2
SYSSTUBS_ENTRY7 252, SetThreadExecutionState, 2
SYSSTUBS_ENTRY8 252, SetThreadExecutionState, 2
SYSSTUBS_ENTRY1 253, SetTimer, 7
SYSSTUBS_ENTRY2 253, SetTimer, 7
SYSSTUBS_ENTRY3 253, SetTimer, 7
SYSSTUBS_ENTRY4 253, SetTimer, 7
SYSSTUBS_ENTRY5 253, SetTimer, 7
SYSSTUBS_ENTRY6 253, SetTimer, 7
SYSSTUBS_ENTRY7 253, SetTimer, 7
SYSSTUBS_ENTRY8 253, SetTimer, 7
SYSSTUBS_ENTRY1 254, SetTimerResolution, 3
SYSSTUBS_ENTRY2 254, SetTimerResolution, 3
SYSSTUBS_ENTRY3 254, SetTimerResolution, 3
SYSSTUBS_ENTRY4 254, SetTimerResolution, 3
SYSSTUBS_ENTRY5 254, SetTimerResolution, 3
SYSSTUBS_ENTRY6 254, SetTimerResolution, 3
SYSSTUBS_ENTRY7 254, SetTimerResolution, 3
SYSSTUBS_ENTRY8 254, SetTimerResolution, 3
SYSSTUBS_ENTRY1 255, SetUuidSeed, 1
SYSSTUBS_ENTRY2 255, SetUuidSeed, 1
SYSSTUBS_ENTRY3 255, SetUuidSeed, 1
SYSSTUBS_ENTRY4 255, SetUuidSeed, 1
SYSSTUBS_ENTRY5 255, SetUuidSeed, 1
SYSSTUBS_ENTRY6 255, SetUuidSeed, 1
SYSSTUBS_ENTRY7 255, SetUuidSeed, 1
SYSSTUBS_ENTRY8 255, SetUuidSeed, 1
SYSSTUBS_ENTRY1 256, SetValueKey, 6
SYSSTUBS_ENTRY2 256, SetValueKey, 6
SYSSTUBS_ENTRY3 256, SetValueKey, 6
SYSSTUBS_ENTRY4 256, SetValueKey, 6
SYSSTUBS_ENTRY5 256, SetValueKey, 6
SYSSTUBS_ENTRY6 256, SetValueKey, 6
SYSSTUBS_ENTRY7 256, SetValueKey, 6
SYSSTUBS_ENTRY8 256, SetValueKey, 6
SYSSTUBS_ENTRY1 257, SetVolumeInformationFile, 5
SYSSTUBS_ENTRY2 257, SetVolumeInformationFile, 5
SYSSTUBS_ENTRY3 257, SetVolumeInformationFile, 5
SYSSTUBS_ENTRY4 257, SetVolumeInformationFile, 5
SYSSTUBS_ENTRY5 257, SetVolumeInformationFile, 5
SYSSTUBS_ENTRY6 257, SetVolumeInformationFile, 5
SYSSTUBS_ENTRY7 257, SetVolumeInformationFile, 5
SYSSTUBS_ENTRY8 257, SetVolumeInformationFile, 5
SYSSTUBS_ENTRY1 258, ShutdownSystem, 1
SYSSTUBS_ENTRY2 258, ShutdownSystem, 1
SYSSTUBS_ENTRY3 258, ShutdownSystem, 1
SYSSTUBS_ENTRY4 258, ShutdownSystem, 1
SYSSTUBS_ENTRY5 258, ShutdownSystem, 1
SYSSTUBS_ENTRY6 258, ShutdownSystem, 1
SYSSTUBS_ENTRY7 258, ShutdownSystem, 1
SYSSTUBS_ENTRY8 258, ShutdownSystem, 1
SYSSTUBS_ENTRY1 259, SignalAndWaitForSingleObject, 4
SYSSTUBS_ENTRY2 259, SignalAndWaitForSingleObject, 4
SYSSTUBS_ENTRY3 259, SignalAndWaitForSingleObject, 4
SYSSTUBS_ENTRY4 259, SignalAndWaitForSingleObject, 4
SYSSTUBS_ENTRY5 259, SignalAndWaitForSingleObject, 4
SYSSTUBS_ENTRY6 259, SignalAndWaitForSingleObject, 4
SYSSTUBS_ENTRY7 259, SignalAndWaitForSingleObject, 4
SYSSTUBS_ENTRY8 259, SignalAndWaitForSingleObject, 4
SYSSTUBS_ENTRY1 260, StartProfile, 1
SYSSTUBS_ENTRY2 260, StartProfile, 1
SYSSTUBS_ENTRY3 260, StartProfile, 1
SYSSTUBS_ENTRY4 260, StartProfile, 1
SYSSTUBS_ENTRY5 260, StartProfile, 1
SYSSTUBS_ENTRY6 260, StartProfile, 1
SYSSTUBS_ENTRY7 260, StartProfile, 1
SYSSTUBS_ENTRY8 260, StartProfile, 1
SYSSTUBS_ENTRY1 261, StopProfile, 1
SYSSTUBS_ENTRY2 261, StopProfile, 1
SYSSTUBS_ENTRY3 261, StopProfile, 1
SYSSTUBS_ENTRY4 261, StopProfile, 1
SYSSTUBS_ENTRY5 261, StopProfile, 1
SYSSTUBS_ENTRY6 261, StopProfile, 1
SYSSTUBS_ENTRY7 261, StopProfile, 1
SYSSTUBS_ENTRY8 261, StopProfile, 1
SYSSTUBS_ENTRY1 262, SuspendProcess, 1
SYSSTUBS_ENTRY2 262, SuspendProcess, 1
SYSSTUBS_ENTRY3 262, SuspendProcess, 1
SYSSTUBS_ENTRY4 262, SuspendProcess, 1
SYSSTUBS_ENTRY5 262, SuspendProcess, 1
SYSSTUBS_ENTRY6 262, SuspendProcess, 1
SYSSTUBS_ENTRY7 262, SuspendProcess, 1
SYSSTUBS_ENTRY8 262, SuspendProcess, 1
SYSSTUBS_ENTRY1 263, SuspendThread, 2
SYSSTUBS_ENTRY2 263, SuspendThread, 2
SYSSTUBS_ENTRY3 263, SuspendThread, 2
SYSSTUBS_ENTRY4 263, SuspendThread, 2
SYSSTUBS_ENTRY5 263, SuspendThread, 2
SYSSTUBS_ENTRY6 263, SuspendThread, 2
SYSSTUBS_ENTRY7 263, SuspendThread, 2
SYSSTUBS_ENTRY8 263, SuspendThread, 2
SYSSTUBS_ENTRY1 264, SystemDebugControl, 6
SYSSTUBS_ENTRY2 264, SystemDebugControl, 6
SYSSTUBS_ENTRY3 264, SystemDebugControl, 6
SYSSTUBS_ENTRY4 264, SystemDebugControl, 6
SYSSTUBS_ENTRY5 264, SystemDebugControl, 6
SYSSTUBS_ENTRY6 264, SystemDebugControl, 6
SYSSTUBS_ENTRY7 264, SystemDebugControl, 6
SYSSTUBS_ENTRY8 264, SystemDebugControl, 6
SYSSTUBS_ENTRY1 265, TerminateJobObject, 2
SYSSTUBS_ENTRY2 265, TerminateJobObject, 2
SYSSTUBS_ENTRY3 265, TerminateJobObject, 2
SYSSTUBS_ENTRY4 265, TerminateJobObject, 2
SYSSTUBS_ENTRY5 265, TerminateJobObject, 2
SYSSTUBS_ENTRY6 265, TerminateJobObject, 2
SYSSTUBS_ENTRY7 265, TerminateJobObject, 2
SYSSTUBS_ENTRY8 265, TerminateJobObject, 2
SYSSTUBS_ENTRY1 266, TerminateProcess, 2
SYSSTUBS_ENTRY2 266, TerminateProcess, 2
SYSSTUBS_ENTRY3 266, TerminateProcess, 2
SYSSTUBS_ENTRY4 266, TerminateProcess, 2
SYSSTUBS_ENTRY5 266, TerminateProcess, 2
SYSSTUBS_ENTRY6 266, TerminateProcess, 2
SYSSTUBS_ENTRY7 266, TerminateProcess, 2
SYSSTUBS_ENTRY8 266, TerminateProcess, 2
SYSSTUBS_ENTRY1 267, TerminateThread, 2
SYSSTUBS_ENTRY2 267, TerminateThread, 2
SYSSTUBS_ENTRY3 267, TerminateThread, 2
SYSSTUBS_ENTRY4 267, TerminateThread, 2
SYSSTUBS_ENTRY5 267, TerminateThread, 2
SYSSTUBS_ENTRY6 267, TerminateThread, 2
SYSSTUBS_ENTRY7 267, TerminateThread, 2
SYSSTUBS_ENTRY8 267, TerminateThread, 2
SYSSTUBS_ENTRY1 268, TestAlert, 0
SYSSTUBS_ENTRY2 268, TestAlert, 0
SYSSTUBS_ENTRY3 268, TestAlert, 0
SYSSTUBS_ENTRY4 268, TestAlert, 0
SYSSTUBS_ENTRY5 268, TestAlert, 0
SYSSTUBS_ENTRY6 268, TestAlert, 0
SYSSTUBS_ENTRY7 268, TestAlert, 0
SYSSTUBS_ENTRY8 268, TestAlert, 0
SYSSTUBS_ENTRY1 269, TraceEvent, 4
SYSSTUBS_ENTRY2 269, TraceEvent, 4
SYSSTUBS_ENTRY3 269, TraceEvent, 4
SYSSTUBS_ENTRY4 269, TraceEvent, 4
SYSSTUBS_ENTRY5 269, TraceEvent, 4
SYSSTUBS_ENTRY6 269, TraceEvent, 4
SYSSTUBS_ENTRY7 269, TraceEvent, 4
SYSSTUBS_ENTRY8 269, TraceEvent, 4
SYSSTUBS_ENTRY1 270, TranslateFilePath, 4
SYSSTUBS_ENTRY2 270, TranslateFilePath, 4
SYSSTUBS_ENTRY3 270, TranslateFilePath, 4
SYSSTUBS_ENTRY4 270, TranslateFilePath, 4
SYSSTUBS_ENTRY5 270, TranslateFilePath, 4
SYSSTUBS_ENTRY6 270, TranslateFilePath, 4
SYSSTUBS_ENTRY7 270, TranslateFilePath, 4
SYSSTUBS_ENTRY8 270, TranslateFilePath, 4
SYSSTUBS_ENTRY1 271, UnloadDriver, 1
SYSSTUBS_ENTRY2 271, UnloadDriver, 1
SYSSTUBS_ENTRY3 271, UnloadDriver, 1
SYSSTUBS_ENTRY4 271, UnloadDriver, 1
SYSSTUBS_ENTRY5 271, UnloadDriver, 1
SYSSTUBS_ENTRY6 271, UnloadDriver, 1
SYSSTUBS_ENTRY7 271, UnloadDriver, 1
SYSSTUBS_ENTRY8 271, UnloadDriver, 1
SYSSTUBS_ENTRY1 272, UnloadKey, 1
SYSSTUBS_ENTRY2 272, UnloadKey, 1
SYSSTUBS_ENTRY3 272, UnloadKey, 1
SYSSTUBS_ENTRY4 272, UnloadKey, 1
SYSSTUBS_ENTRY5 272, UnloadKey, 1
SYSSTUBS_ENTRY6 272, UnloadKey, 1
SYSSTUBS_ENTRY7 272, UnloadKey, 1
SYSSTUBS_ENTRY8 272, UnloadKey, 1
SYSSTUBS_ENTRY1 273, UnloadKey2, 2
SYSSTUBS_ENTRY2 273, UnloadKey2, 2
SYSSTUBS_ENTRY3 273, UnloadKey2, 2
SYSSTUBS_ENTRY4 273, UnloadKey2, 2
SYSSTUBS_ENTRY5 273, UnloadKey2, 2
SYSSTUBS_ENTRY6 273, UnloadKey2, 2
SYSSTUBS_ENTRY7 273, UnloadKey2, 2
SYSSTUBS_ENTRY8 273, UnloadKey2, 2
SYSSTUBS_ENTRY1 274, UnloadKeyEx, 2
SYSSTUBS_ENTRY2 274, UnloadKeyEx, 2
SYSSTUBS_ENTRY3 274, UnloadKeyEx, 2
SYSSTUBS_ENTRY4 274, UnloadKeyEx, 2
SYSSTUBS_ENTRY5 274, UnloadKeyEx, 2
SYSSTUBS_ENTRY6 274, UnloadKeyEx, 2
SYSSTUBS_ENTRY7 274, UnloadKeyEx, 2
SYSSTUBS_ENTRY8 274, UnloadKeyEx, 2
SYSSTUBS_ENTRY1 275, UnlockFile, 5
SYSSTUBS_ENTRY2 275, UnlockFile, 5
SYSSTUBS_ENTRY3 275, UnlockFile, 5
SYSSTUBS_ENTRY4 275, UnlockFile, 5
SYSSTUBS_ENTRY5 275, UnlockFile, 5
SYSSTUBS_ENTRY6 275, UnlockFile, 5
SYSSTUBS_ENTRY7 275, UnlockFile, 5
SYSSTUBS_ENTRY8 275, UnlockFile, 5
SYSSTUBS_ENTRY1 276, UnlockVirtualMemory, 4
SYSSTUBS_ENTRY2 276, UnlockVirtualMemory, 4
SYSSTUBS_ENTRY3 276, UnlockVirtualMemory, 4
SYSSTUBS_ENTRY4 276, UnlockVirtualMemory, 4
SYSSTUBS_ENTRY5 276, UnlockVirtualMemory, 4
SYSSTUBS_ENTRY6 276, UnlockVirtualMemory, 4
SYSSTUBS_ENTRY7 276, UnlockVirtualMemory, 4
SYSSTUBS_ENTRY8 276, UnlockVirtualMemory, 4
SYSSTUBS_ENTRY1 277, UnmapViewOfSection, 2
SYSSTUBS_ENTRY2 277, UnmapViewOfSection, 2
SYSSTUBS_ENTRY3 277, UnmapViewOfSection, 2
SYSSTUBS_ENTRY4 277, UnmapViewOfSection, 2
SYSSTUBS_ENTRY5 277, UnmapViewOfSection, 2
SYSSTUBS_ENTRY6 277, UnmapViewOfSection, 2
SYSSTUBS_ENTRY7 277, UnmapViewOfSection, 2
SYSSTUBS_ENTRY8 277, UnmapViewOfSection, 2
SYSSTUBS_ENTRY1 278, VdmControl, 2
SYSSTUBS_ENTRY2 278, VdmControl, 2
SYSSTUBS_ENTRY3 278, VdmControl, 2
SYSSTUBS_ENTRY4 278, VdmControl, 2
SYSSTUBS_ENTRY5 278, VdmControl, 2
SYSSTUBS_ENTRY6 278, VdmControl, 2
SYSSTUBS_ENTRY7 278, VdmControl, 2
SYSSTUBS_ENTRY8 278, VdmControl, 2
SYSSTUBS_ENTRY1 279, WaitForDebugEvent, 4
SYSSTUBS_ENTRY2 279, WaitForDebugEvent, 4
SYSSTUBS_ENTRY3 279, WaitForDebugEvent, 4
SYSSTUBS_ENTRY4 279, WaitForDebugEvent, 4
SYSSTUBS_ENTRY5 279, WaitForDebugEvent, 4
SYSSTUBS_ENTRY6 279, WaitForDebugEvent, 4
SYSSTUBS_ENTRY7 279, WaitForDebugEvent, 4
SYSSTUBS_ENTRY8 279, WaitForDebugEvent, 4
SYSSTUBS_ENTRY1 280, WaitForMultipleObjects, 5
SYSSTUBS_ENTRY2 280, WaitForMultipleObjects, 5
SYSSTUBS_ENTRY3 280, WaitForMultipleObjects, 5
SYSSTUBS_ENTRY4 280, WaitForMultipleObjects, 5
SYSSTUBS_ENTRY5 280, WaitForMultipleObjects, 5
SYSSTUBS_ENTRY6 280, WaitForMultipleObjects, 5
SYSSTUBS_ENTRY7 280, WaitForMultipleObjects, 5
SYSSTUBS_ENTRY8 280, WaitForMultipleObjects, 5
SYSSTUBS_ENTRY1 281, WaitForSingleObject, 3
SYSSTUBS_ENTRY2 281, WaitForSingleObject, 3
SYSSTUBS_ENTRY3 281, WaitForSingleObject, 3
SYSSTUBS_ENTRY4 281, WaitForSingleObject, 3
SYSSTUBS_ENTRY5 281, WaitForSingleObject, 3
SYSSTUBS_ENTRY6 281, WaitForSingleObject, 3
SYSSTUBS_ENTRY7 281, WaitForSingleObject, 3
SYSSTUBS_ENTRY8 281, WaitForSingleObject, 3
SYSSTUBS_ENTRY1 282, WaitHighEventPair, 1
SYSSTUBS_ENTRY2 282, WaitHighEventPair, 1
SYSSTUBS_ENTRY3 282, WaitHighEventPair, 1
SYSSTUBS_ENTRY4 282, WaitHighEventPair, 1
SYSSTUBS_ENTRY5 282, WaitHighEventPair, 1
SYSSTUBS_ENTRY6 282, WaitHighEventPair, 1
SYSSTUBS_ENTRY7 282, WaitHighEventPair, 1
SYSSTUBS_ENTRY8 282, WaitHighEventPair, 1
SYSSTUBS_ENTRY1 283, WaitLowEventPair, 1
SYSSTUBS_ENTRY2 283, WaitLowEventPair, 1
SYSSTUBS_ENTRY3 283, WaitLowEventPair, 1
SYSSTUBS_ENTRY4 283, WaitLowEventPair, 1
SYSSTUBS_ENTRY5 283, WaitLowEventPair, 1
SYSSTUBS_ENTRY6 283, WaitLowEventPair, 1
SYSSTUBS_ENTRY7 283, WaitLowEventPair, 1
SYSSTUBS_ENTRY8 283, WaitLowEventPair, 1
SYSSTUBS_ENTRY1 284, WriteFile, 9
SYSSTUBS_ENTRY2 284, WriteFile, 9
SYSSTUBS_ENTRY3 284, WriteFile, 9
SYSSTUBS_ENTRY4 284, WriteFile, 9
SYSSTUBS_ENTRY5 284, WriteFile, 9
SYSSTUBS_ENTRY6 284, WriteFile, 9
SYSSTUBS_ENTRY7 284, WriteFile, 9
SYSSTUBS_ENTRY8 284, WriteFile, 9
SYSSTUBS_ENTRY1 285, WriteFileGather, 9
SYSSTUBS_ENTRY2 285, WriteFileGather, 9
SYSSTUBS_ENTRY3 285, WriteFileGather, 9
SYSSTUBS_ENTRY4 285, WriteFileGather, 9
SYSSTUBS_ENTRY5 285, WriteFileGather, 9
SYSSTUBS_ENTRY6 285, WriteFileGather, 9
SYSSTUBS_ENTRY7 285, WriteFileGather, 9
SYSSTUBS_ENTRY8 285, WriteFileGather, 9
SYSSTUBS_ENTRY1 286, WriteRequestData, 6
SYSSTUBS_ENTRY2 286, WriteRequestData, 6
SYSSTUBS_ENTRY3 286, WriteRequestData, 6
SYSSTUBS_ENTRY4 286, WriteRequestData, 6
SYSSTUBS_ENTRY5 286, WriteRequestData, 6
SYSSTUBS_ENTRY6 286, WriteRequestData, 6
SYSSTUBS_ENTRY7 286, WriteRequestData, 6
SYSSTUBS_ENTRY8 286, WriteRequestData, 6
SYSSTUBS_ENTRY1 287, WriteVirtualMemory, 5
SYSSTUBS_ENTRY2 287, WriteVirtualMemory, 5
SYSSTUBS_ENTRY3 287, WriteVirtualMemory, 5
SYSSTUBS_ENTRY4 287, WriteVirtualMemory, 5
SYSSTUBS_ENTRY5 287, WriteVirtualMemory, 5
SYSSTUBS_ENTRY6 287, WriteVirtualMemory, 5
SYSSTUBS_ENTRY7 287, WriteVirtualMemory, 5
SYSSTUBS_ENTRY8 287, WriteVirtualMemory, 5
SYSSTUBS_ENTRY1 288, YieldExecution, 0
SYSSTUBS_ENTRY2 288, YieldExecution, 0
SYSSTUBS_ENTRY3 288, YieldExecution, 0
SYSSTUBS_ENTRY4 288, YieldExecution, 0
SYSSTUBS_ENTRY5 288, YieldExecution, 0
SYSSTUBS_ENTRY6 288, YieldExecution, 0
SYSSTUBS_ENTRY7 288, YieldExecution, 0
SYSSTUBS_ENTRY8 288, YieldExecution, 0
SYSSTUBS_ENTRY1 289, CreateKeyedEvent, 4
SYSSTUBS_ENTRY2 289, CreateKeyedEvent, 4
SYSSTUBS_ENTRY3 289, CreateKeyedEvent, 4
SYSSTUBS_ENTRY4 289, CreateKeyedEvent, 4
SYSSTUBS_ENTRY5 289, CreateKeyedEvent, 4
SYSSTUBS_ENTRY6 289, CreateKeyedEvent, 4
SYSSTUBS_ENTRY7 289, CreateKeyedEvent, 4
SYSSTUBS_ENTRY8 289, CreateKeyedEvent, 4
SYSSTUBS_ENTRY1 290, OpenKeyedEvent, 3
SYSSTUBS_ENTRY2 290, OpenKeyedEvent, 3
SYSSTUBS_ENTRY3 290, OpenKeyedEvent, 3
SYSSTUBS_ENTRY4 290, OpenKeyedEvent, 3
SYSSTUBS_ENTRY5 290, OpenKeyedEvent, 3
SYSSTUBS_ENTRY6 290, OpenKeyedEvent, 3
SYSSTUBS_ENTRY7 290, OpenKeyedEvent, 3
SYSSTUBS_ENTRY8 290, OpenKeyedEvent, 3
SYSSTUBS_ENTRY1 291, ReleaseKeyedEvent, 4
SYSSTUBS_ENTRY2 291, ReleaseKeyedEvent, 4
SYSSTUBS_ENTRY3 291, ReleaseKeyedEvent, 4
SYSSTUBS_ENTRY4 291, ReleaseKeyedEvent, 4
SYSSTUBS_ENTRY5 291, ReleaseKeyedEvent, 4
SYSSTUBS_ENTRY6 291, ReleaseKeyedEvent, 4
SYSSTUBS_ENTRY7 291, ReleaseKeyedEvent, 4
SYSSTUBS_ENTRY8 291, ReleaseKeyedEvent, 4
SYSSTUBS_ENTRY1 292, WaitForKeyedEvent, 4
SYSSTUBS_ENTRY2 292, WaitForKeyedEvent, 4
SYSSTUBS_ENTRY3 292, WaitForKeyedEvent, 4
SYSSTUBS_ENTRY4 292, WaitForKeyedEvent, 4
SYSSTUBS_ENTRY5 292, WaitForKeyedEvent, 4
SYSSTUBS_ENTRY6 292, WaitForKeyedEvent, 4
SYSSTUBS_ENTRY7 292, WaitForKeyedEvent, 4
SYSSTUBS_ENTRY8 292, WaitForKeyedEvent, 4
SYSSTUBS_ENTRY1 293, QueryPortInformationProcess, 0
SYSSTUBS_ENTRY2 293, QueryPortInformationProcess, 0
SYSSTUBS_ENTRY3 293, QueryPortInformationProcess, 0
SYSSTUBS_ENTRY4 293, QueryPortInformationProcess, 0
SYSSTUBS_ENTRY5 293, QueryPortInformationProcess, 0
SYSSTUBS_ENTRY6 293, QueryPortInformationProcess, 0
SYSSTUBS_ENTRY7 293, QueryPortInformationProcess, 0
SYSSTUBS_ENTRY8 293, QueryPortInformationProcess, 0
SYSSTUBS_ENTRY1 294, GetCurrentProcessorNumber, 0
SYSSTUBS_ENTRY2 294, GetCurrentProcessorNumber, 0
SYSSTUBS_ENTRY3 294, GetCurrentProcessorNumber, 0
SYSSTUBS_ENTRY4 294, GetCurrentProcessorNumber, 0
SYSSTUBS_ENTRY5 294, GetCurrentProcessorNumber, 0
SYSSTUBS_ENTRY6 294, GetCurrentProcessorNumber, 0
SYSSTUBS_ENTRY7 294, GetCurrentProcessorNumber, 0
SYSSTUBS_ENTRY8 294, GetCurrentProcessorNumber, 0
SYSSTUBS_ENTRY1 295, WaitForMultipleObjects32, 5
SYSSTUBS_ENTRY2 295, WaitForMultipleObjects32, 5
SYSSTUBS_ENTRY3 295, WaitForMultipleObjects32, 5
SYSSTUBS_ENTRY4 295, WaitForMultipleObjects32, 5
SYSSTUBS_ENTRY5 295, WaitForMultipleObjects32, 5
SYSSTUBS_ENTRY6 295, WaitForMultipleObjects32, 5
SYSSTUBS_ENTRY7 295, WaitForMultipleObjects32, 5
SYSSTUBS_ENTRY8 295, WaitForMultipleObjects32, 5
STUBS_END
|
BITS 64
global asm_strchr:
section .text
asm_strchr:
; the order of registers used is: %rdi, %rsi, %rdx, %rcx, %r8, and %r9
while:
mov r8b, [rdi];pasamos a registro de 8 bites
cmp r8b, sil;como el argumento es de 1 bit llega en sil
je igual;salta si igual
cmp r8b, 0;verificamos que no haya llegado al final de el string
je noesta;salta si igual
inc rdi;pasamos a la siguiente letra
jmp while; salta a while:
igual:
mov rax, rdi
ret; salida
noesta:
mov eax, 0;seteamos eax con 0
ret; salida
|
#include <CEngine.h>
engine::CVec3 g_lightDirPosition = { 0.0f, 5.0f, 0.0f };
engine::CVec3 g_lightPointPosition = { 0.0f, 5.0f, 0.0f };
engine::CVec3 g_lightSpotPosition = { 0.0f, 5.0f, 0.0f };
// engine::CVec3 g_lightDirPosition = { -2.0f, 4.0f, -1.0f };
// engine::CVec3 g_lightPointPosition = { -2.0f, 4.0f, -1.0f };
// engine::CVec3 g_lightSpotPosition = { -2.0f, 4.0f, -1.0f };
engine::CVec3 g_lightDirDirection = ( -g_lightDirPosition ).normalized();
engine::CVec3 g_lightPointDirection = ( -g_lightPointPosition ).normalized();
engine::CVec3 g_lightSpotDirection = ( -g_lightSpotPosition ).normalized();
engine::CVec3 g_focusPoint = { 0.0f, 0.0f, 0.0f };
const engine::CVec3 g_worldUp = { 0.0f, 1.0f, 0.0f };
bool g_useAutofixToCamera = false;
float g_znearDir = 1.0f;
float g_zfarDir = 7.5f;
float g_widthDir = 20.0f;
float g_heightDir = 20.0f;
float g_znearPoint = 0.1f;
float g_zfarPoint = 15.0f;
float g_fovPoint = 120.0f;
float g_znearSpot = 0.1f;
float g_zfarSpot = 15.0f;
float g_fovSpot = 120.0f;
float g_extraWidth = 1.0f;
float g_extraHeight = 1.0f;
float g_extraDepth = 1.0f;
class ShadowsUtilsLayer : public engine::CImGuiLayer
{
public :
ShadowsUtilsLayer( const std::string& name )
: engine::CImGuiLayer( name )
{
auto _dirlight = std::make_unique<engine::CDirectionalLight>( "directional",
engine::CVec3( 0.2f, 0.2f, 0.2f ),
engine::CVec3( 0.4f, 0.4f, 0.4f ),
engine::CVec3( 0.8f, 0.8f, 0.8f ),
g_lightDirDirection );
auto _pointlight = std::make_unique<engine::CPointLight>( "point",
engine::CVec3( 0.2f, 0.2f, 0.2f ),
engine::CVec3( 0.5f, 0.5f, 0.5f ),
engine::CVec3( 0.8f, 0.8f, 0.8f ),
g_lightPointPosition,
1.0f, 0.05f, 0.005f );
auto _spotlight = std::make_unique<engine::CSpotLight>( "spot",
engine::CVec3( 0.2f, 0.2f, 0.2f ),
engine::CVec3( 0.5f, 0.5f, 0.5f ),
engine::CVec3( 0.8f, 0.8f, 0.8f ),
g_lightSpotPosition,
g_lightSpotDirection,
1.0f, 0.05f, 0.005f,
ENGINE_PI / 4.0f,
ENGINE_PI / 3.0f );
m_lights.push_back( std::move( _dirlight ) ); m_lightsNames.push_back( "directional" );
m_lights.push_back( std::move( _pointlight ) ); m_lightsNames.push_back( "point" );
m_lights.push_back( std::move( _spotlight ) ); m_lightsNames.push_back( "spot" );
m_lightSelectedIndex = 2;
m_lightSelectedName = m_lightsNames[m_lightSelectedIndex];
m_lightDirDirection = g_lightDirDirection;
m_lightPointDirection = g_lightPointDirection;
m_lightSpotDirection = g_lightSpotDirection;
m_lightPointPosition = g_lightPointPosition;
m_lightSpotPosition = g_lightSpotPosition;
m_wantsToCaptureMouse = false;
}
~ShadowsUtilsLayer() {}
engine::CILight* selectedLight() { return m_lights[m_lightSelectedIndex].get(); }
void render() override
{
m_wantsToCaptureMouse = false;
_menuUiLights();
ImGuiIO& io = ImGui::GetIO();
m_wantsToCaptureMouse = io.WantCaptureMouse;
}
bool onEvent( const engine::CInputEvent& event ) override
{
if ( event.type() == engine::eEventType::MOUSE_PRESSED )
return m_wantsToCaptureMouse;
return false;
}
private :
void _menuUiLights()
{
ImGui::Begin( "Lights shadowmapping configuration" );
ImGui::Spacing();
if ( ImGui::BeginCombo( "Lights", m_lightSelectedName.c_str() ) )
{
for ( size_t i = 0; i < m_lights.size(); i++ )
{
std::string _lightName = m_lightsNames[i];
bool _isSelected = ( _lightName == m_lightSelectedName );
if ( ImGui::Selectable( _lightName.c_str(), _isSelected ) )
{
m_lightSelectedName = _lightName;
m_lightSelectedIndex = i;
}
if ( _isSelected )
ImGui::SetItemDefaultFocus();
}
ImGui::EndCombo();
}
ImGui::Spacing();
_menuUiLightShadowProps();
ImGui::Spacing();
ImGui::Text( m_lights[ m_lightSelectedIndex ]->toString().c_str() );
ImGui::End();
}
void _menuUiLightShadowProps()
{
auto& _light = m_lights[m_lightSelectedIndex];
if ( _light->type() == engine::eLightType::DIRECTIONAL )
{
/* shadow frustum transform in world-space (view) */
float _direction[3] = { m_lightDirDirection.x(), m_lightDirDirection.y(), m_lightDirDirection.z() };
ImGui::SliderFloat3( "direction", _direction, -10.0f, 10.0f );
m_lightDirDirection = { _direction[0], _direction[1], _direction[2] };
g_lightDirDirection = m_lightDirDirection.normalized();
_light->direction = g_lightDirDirection;
// whether or not to use autofix-to-camera for directional lights shadowmapping
ImGui::Checkbox( "autofix-to-camera", &g_useAutofixToCamera );
/* shadow-frustum size properties (proj) */
if ( g_useAutofixToCamera )
{
ImGui::SliderFloat( "extra-width", &g_extraWidth, 0.0f, 5.0f );
ImGui::SliderFloat( "extra-height", &g_extraHeight, 0.0f, 5.0f );
ImGui::SliderFloat( "extra-depth", &g_extraDepth, 0.0f, 5.0f );
}
else
{
ImGui::SliderFloat( "znear", &g_znearDir, 0.1f, 5.0f );
ImGui::SliderFloat( "zfar", &g_zfarDir, g_znearDir, 20.0f );
ImGui::SliderFloat( "width", &g_widthDir, 20.0f, 40.0f );
ImGui::SliderFloat( "height", &g_heightDir, 20.0f, 40.0f );
float _focusp[3] = { g_focusPoint.x(), g_focusPoint.y(), g_focusPoint.z() };
ImGui::SliderFloat3( "focus", _focusp, -10.0f, 10.0f );
g_focusPoint = { _focusp[0], _focusp[1], _focusp[2] };
}
}
else if ( _light->type() == engine::eLightType::POINT )
{
float _position[3] = { m_lightPointPosition.x(), m_lightPointPosition.y(), m_lightPointPosition.z() };
ImGui::SliderFloat3( "position", _position, -10.0f, 10.0f );
m_lightPointPosition = { _position[0], _position[1], _position[2] };
g_lightPointDirection = m_lightPointDirection.normalized();
g_lightPointPosition = m_lightPointPosition;
_light->position = g_lightPointPosition;
ImGui::SliderFloat( "znear", &g_znearPoint, 0.1f, 5.0f );
ImGui::SliderFloat( "zfar", &g_zfarPoint, g_znearPoint, 20.0f );
ImGui::SliderFloat( "fov", &g_fovPoint, 20.0f, 150.0f );
float _focusp[3] = { g_focusPoint.x(), g_focusPoint.y(), g_focusPoint.z() };
ImGui::SliderFloat3( "focus", _focusp, -10.0f, 10.0f );
g_focusPoint = { _focusp[0], _focusp[1], _focusp[2] };
}
else if ( _light->type() == engine::eLightType::SPOT )
{
float _direction[3] = { m_lightSpotDirection.x(), m_lightSpotDirection.y(), m_lightSpotDirection.z() };
ImGui::SliderFloat3( "direction", _direction, -10.0f, 10.0f );
m_lightSpotDirection = { _direction[0], _direction[1], _direction[2] };
float _position[3] = { m_lightSpotPosition.x(), m_lightSpotPosition.y(), m_lightSpotPosition.z() };
ImGui::SliderFloat3( "position", _position, -10.0f, 10.0f );
m_lightSpotPosition = { _position[0], _position[1], _position[2] };
g_lightSpotDirection = m_lightSpotDirection.normalized();
g_lightSpotPosition = m_lightSpotPosition;
_light->direction = g_lightSpotDirection;
_light->position = g_lightSpotPosition;
ImGui::SliderFloat( "znear", &g_znearSpot, 0.1f, 5.0f );
ImGui::SliderFloat( "zfar", &g_zfarSpot, g_znearSpot, 20.0f );
ImGui::SliderFloat( "fov", &g_fovSpot, 20.0f, 150.0f );
}
}
std::vector< std::unique_ptr<engine::CILight> > m_lights;
std::vector< std::string > m_lightsNames;
std::string m_lightSelectedName;
int m_lightSelectedIndex;
engine::CVec3 m_lightDirDirection;
engine::CVec3 m_lightPointDirection;
engine::CVec3 m_lightSpotDirection;
engine::CVec3 m_lightPointPosition;
engine::CVec3 m_lightSpotPosition;
bool m_wantsToCaptureMouse;
};
void renderToShadowMap( engine::CILight* lightPtr,
engine::CICamera* cameraPtr,
engine::CShadowMap* shadowMapPtr,
engine::CShader* shaderPtr,
engine::CIRenderable* floor,
std::vector< engine::CIRenderable* > cubes );
void renderSceneWithShadows( engine::CILight* lightPtr,
engine::CICamera* cameraPtr,
engine::CShadowMap* shadowMapPtr,
engine::CShader* shaderPtr,
engine::CMaterial* floorMaterialPtr,
engine::CMaterial* cubeMaterialPtr,
engine::CIRenderable* floor,
std::vector< engine::CIRenderable* > cubes );
void renderShadowMapVisualization( engine::CILight* lightPtr,
engine::CVertexArray* quadVAO,
engine::CShader* shaderPtr,
engine::CShadowMap* shadowMapPtr );
struct ComparatorDotDirection
{
engine::CVec3 direction;
bool operator() ( engine::CVec3 v1, engine::CVec3 v2 )
{
auto _dot1 = direction.dot( v1 );
auto _dot2 = direction.dot( v2 );
return _dot1 < _dot2;
}
};
void computeLightSpaceViewProj( engine::CICamera* cameraPtr,
const engine::CVec3& direction,
engine::CMat4& mat_view,
engine::CMat4& mat_proj,
float ddf = 0.0f,
float ddr = 0.0f,
float ddu = 0.0f )
{
if ( !cameraPtr )
return;
// normalize in case someone passed a vector that wasn't normalized :(
auto _directionNorm = direction.normalized();
auto _viewProjMatrix = cameraPtr->mat_proj() * cameraPtr->mat_view();
/* get back the corners of the frustum in world space */
engine::CMat4 _invClipMatrix = tinymath::inverse( _viewProjMatrix );
engine::CVec3 _frustumPointsClipSpace[8] = {
/* near plane */
{ -1.0f, -1.0f, -1.0f },
{ 1.0f, -1.0f, -1.0f },
{ 1.0f, 1.0f, -1.0f },
{ -1.0f, 1.0f, -1.0f },
/* far plane */
{ -1.0f, -1.0f, 1.0f },
{ 1.0f, -1.0f, 1.0f },
{ 1.0f, 1.0f, 1.0f },
{ -1.0f, 1.0f, 1.0f }
};
std::vector< engine::CVec3 > _points3d;
for ( size_t q = 0; q < 8; q++ )
{
engine::CVec4 _pointFrustum = _invClipMatrix * engine::CVec4( _frustumPointsClipSpace[q], 1.0f );
engine::CVec3 _pointFrustumNormalized = { _pointFrustum.x() / _pointFrustum.w(),
_pointFrustum.y() / _pointFrustum.w(),
_pointFrustum.z() / _pointFrustum.w() };
_points3d.push_back( _pointFrustumNormalized );
}
/* construct a frame using the direction vector as front */
engine::CVec3 _fvec, _rvec, _uvec;
engine::CVec3 _worldUp = { 0.0f, 1.0f, 0.0f };
if ( _directionNorm == engine::CVec3( 0.0f, 1.0f, 0.0f ) )
{
_fvec = _worldUp;
_rvec = { _worldUp.z(), _worldUp.x(), _worldUp.y() };
_uvec = { _worldUp.y(), _worldUp.z(), _worldUp.x() };
}
else if ( ( _directionNorm + _worldUp ) == engine::CVec3( 0.0f, 0.0f, 0.0f ) )
{
_fvec = -_worldUp;
_rvec = { _worldUp.z(), _worldUp.x(), _worldUp.y() };
_uvec = { _worldUp.y(), _worldUp.z(), _worldUp.x() };
}
else
{
_fvec = _directionNorm;
_rvec = tinymath::cross( { 0.0f, 1.0f, 0.0f }, _fvec );
_uvec = tinymath::cross( _fvec, _rvec );
}
_fvec.normalize();
_rvec.normalize();
_uvec.normalize();
/* sort over f-vector */
auto _fPoints3d = _points3d; // create a copy
{
auto _fComparator = ComparatorDotDirection();
_fComparator.direction = _fvec;
std::sort( _fPoints3d.begin(), _fPoints3d.end(), _fComparator );
}
/* sort over r-vector */
auto _rPoints3d = _points3d; // create a copy
{
auto _rComparator = ComparatorDotDirection();
_rComparator.direction = _rvec;
std::sort( _rPoints3d.begin(), _rPoints3d.end(), _rComparator );
}
/* sort over u-vector */
auto _uPoints3d = _points3d; // create a copy
{
auto _uComparator = ComparatorDotDirection();
_uComparator.direction = _uvec;
std::sort( _uPoints3d.begin(), _uPoints3d.end(), _uComparator );
}
float _df = std::abs( ( _fPoints3d.back() - _fPoints3d.front() ).dot( _fvec ) );
float _dr = std::abs( ( _rPoints3d.back() - _rPoints3d.front() ).dot( _rvec ) );
float _du = std::abs( ( _uPoints3d.back() - _uPoints3d.front() ).dot( _uvec ) );
auto _center = ( 0.5f * ( _fPoints3d.front() + _fPoints3d.back() ) ).dot( _fvec ) * _fvec +
( 0.5f * ( _rPoints3d.front() + _rPoints3d.back() ) ).dot( _rvec ) * _rvec +
( 0.5f * ( _uPoints3d.front() + _uPoints3d.back() ) ).dot( _uvec ) * _uvec;
auto _position = _center - ( 0.5f * _df ) * _fvec;
auto _target = _position + _directionNorm;
mat_view = engine::lookAt( _position, _target, _worldUp );
mat_proj = engine::ortho( _dr + ddr, _du + ddu, -0.5f * ddf, _df + 0.5f * ddf );
}
void showDirectionalLightVolume( engine::CICamera* cameraPtr, const engine::CVec3& direction )
{
if ( !cameraPtr )
return;
engine::CMat4 _lspaceMatView, _lspaceMatProj;
computeLightSpaceViewProj( cameraPtr, direction, _lspaceMatView, _lspaceMatProj );
engine::CDebugDrawer::DrawClipVolume( cameraPtr->mat_proj() * cameraPtr->mat_view(), { 1.0f, 1.0f, 0.0f } );
engine::CDebugDrawer::DrawClipVolume( _lspaceMatProj * _lspaceMatView, { 0.7f, 0.5f, 0.3f } );
}
void showDirectionalLightVolumeLegacy( engine::CICamera* cameraPtr, const engine::CVec3& direction )
{
if ( !cameraPtr )
return;
// normalize in case someone passed a vector that wasn't normalized :(
auto _directionNorm = direction.normalized();
auto _viewProjMatrix = cameraPtr->mat_proj() * cameraPtr->mat_view();
engine::CDebugDrawer::DrawClipVolume( _viewProjMatrix, { 1.0f, 1.0f, 0.0f } );
/* get back the corners of the frustum in world space */
engine::CMat4 _invClipMatrix = tinymath::inverse( _viewProjMatrix );
engine::CVec3 _frustumPointsClipSpace[8] = {
/* near plane */
{ -1.0f, -1.0f, -1.0f },
{ 1.0f, -1.0f, -1.0f },
{ 1.0f, 1.0f, -1.0f },
{ -1.0f, 1.0f, -1.0f },
/* far plane */
{ -1.0f, -1.0f, 1.0f },
{ 1.0f, -1.0f, 1.0f },
{ 1.0f, 1.0f, 1.0f },
{ -1.0f, 1.0f, 1.0f }
};
std::vector< engine::CVec3 > _points3d;
for ( size_t q = 0; q < 8; q++ )
{
engine::CVec4 _pointFrustum = _invClipMatrix * engine::CVec4( _frustumPointsClipSpace[q], 1.0f );
engine::CVec3 _pointFrustumNormalized = { _pointFrustum.x() / _pointFrustum.w(),
_pointFrustum.y() / _pointFrustum.w(),
_pointFrustum.z() / _pointFrustum.w() };
_points3d.push_back( _pointFrustumNormalized );
}
/* construct a frame using the direction vector as front */
engine::CVec3 _fvec, _rvec, _uvec;
engine::CVec3 _worldUp = { 0.0f, 1.0f, 0.0f };
if ( _directionNorm == engine::CVec3( 0.0f, 1.0f, 0.0f ) )
{
_fvec = _worldUp;
_rvec = { _worldUp.z(), _worldUp.x(), _worldUp.y() };
_uvec = { _worldUp.y(), _worldUp.z(), _worldUp.x() };
}
else if ( ( _directionNorm + _worldUp ) == engine::CVec3( 0.0f, 0.0f, 0.0f ) )
{
_fvec = -_worldUp;
_rvec = { _worldUp.z(), _worldUp.x(), _worldUp.y() };
_uvec = { _worldUp.y(), _worldUp.z(), _worldUp.x() };
}
else
{
_fvec = _directionNorm;
_rvec = tinymath::cross( { 0.0f, 1.0f, 0.0f }, _fvec );
_uvec = tinymath::cross( _fvec, _rvec );
}
_fvec.normalize();
_rvec.normalize();
_uvec.normalize();
/* sort over f-vector */
auto _fPoints3d = _points3d; // create a copy
{
auto _fComparator = ComparatorDotDirection();
_fComparator.direction = _fvec;
std::sort( _fPoints3d.begin(), _fPoints3d.end(), _fComparator );
}
/* sort over r-vector */
auto _rPoints3d = _points3d; // create a copy
{
auto _rComparator = ComparatorDotDirection();
_rComparator.direction = _rvec;
std::sort( _rPoints3d.begin(), _rPoints3d.end(), _rComparator );
}
/* sort over u-vector */
auto _uPoints3d = _points3d; // create a copy
{
auto _uComparator = ComparatorDotDirection();
_uComparator.direction = _uvec;
std::sort( _uPoints3d.begin(), _uPoints3d.end(), _uComparator );
}
float _df = std::abs( ( _fPoints3d.back() - _fPoints3d.front() ).dot( _fvec ) );
float _dr = std::abs( ( _rPoints3d.back() - _rPoints3d.front() ).dot( _rvec ) );
float _du = std::abs( ( _uPoints3d.back() - _uPoints3d.front() ).dot( _uvec ) );
auto _center = ( 0.5f * ( _fPoints3d.front() + _fPoints3d.back() ) ).dot( _fvec ) * _fvec +
( 0.5f * ( _rPoints3d.front() + _rPoints3d.back() ) ).dot( _rvec ) * _rvec +
( 0.5f * ( _uPoints3d.front() + _uPoints3d.back() ) ).dot( _uvec ) * _uvec;
engine::CDebugDrawer::DrawLine( { 0.0f, 0.0f, 0.0f }, _fPoints3d.front(), { 0.5f, 0.0f, 0.0f } );
engine::CDebugDrawer::DrawLine( { 0.0f, 0.0f, 0.0f }, _fPoints3d.back(), { 1.0f, 0.0f, 0.0f } );
engine::CDebugDrawer::DrawLine( { 0.0f, 0.0f, 0.0f }, _rPoints3d.front(), { 0.0f, 0.5f, 0.0f } );
engine::CDebugDrawer::DrawLine( { 0.0f, 0.0f, 0.0f }, _rPoints3d.back(), { 0.0f, 1.0f, 0.0f } );
engine::CDebugDrawer::DrawLine( { 0.0f, 0.0f, 0.0f }, _uPoints3d.front(), { 0.0f, 0.0f, 0.5f } );
engine::CDebugDrawer::DrawLine( { 0.0f, 0.0f, 0.0f }, _uPoints3d.back(), { 0.0f, 0.0f, 1.0f } );
engine::CDebugDrawer::DrawArrow( { 3.0f, 3.0f, 3.0f }, engine::CVec3( 3.0f, 3.0f, 3.0f ) + _directionNorm, { 0.0f, 1.0f, 1.0f } );
engine::CDebugDrawer::DrawAxes( _fvec, _rvec, _uvec, _center, 0.5f );
// define the points of the oobb
auto _p0 = _center - ( 0.5f * _df ) * _fvec - ( 0.5f * _dr ) * _rvec - ( 0.5f * _du ) * _uvec;
auto _p1 = _center - ( 0.5f * _df ) * _fvec - ( 0.5f * _dr ) * _rvec + ( 0.5f * _du ) * _uvec;
auto _p2 = _center - ( 0.5f * _df ) * _fvec + ( 0.5f * _dr ) * _rvec - ( 0.5f * _du ) * _uvec;
auto _p3 = _center - ( 0.5f * _df ) * _fvec + ( 0.5f * _dr ) * _rvec + ( 0.5f * _du ) * _uvec;
auto _p4 = _center + ( 0.5f * _df ) * _fvec - ( 0.5f * _dr ) * _rvec - ( 0.5f * _du ) * _uvec;
auto _p5 = _center + ( 0.5f * _df ) * _fvec - ( 0.5f * _dr ) * _rvec + ( 0.5f * _du ) * _uvec;
auto _p6 = _center + ( 0.5f * _df ) * _fvec + ( 0.5f * _dr ) * _rvec - ( 0.5f * _du ) * _uvec;
auto _p7 = _center + ( 0.5f * _df ) * _fvec + ( 0.5f * _dr ) * _rvec + ( 0.5f * _du ) * _uvec;
engine::CVec3 _bcolor = { 0.7f, 0.5f, 0.3f };
engine::CDebugDrawer::DrawLine( _p0, _p1, _bcolor ); engine::CDebugDrawer::DrawLine( _p2, _p3, _bcolor );
engine::CDebugDrawer::DrawLine( _p0, _p2, _bcolor ); engine::CDebugDrawer::DrawLine( _p1, _p3, _bcolor );
engine::CDebugDrawer::DrawLine( _p4, _p5, _bcolor ); engine::CDebugDrawer::DrawLine( _p6, _p7, _bcolor );
engine::CDebugDrawer::DrawLine( _p4, _p6, _bcolor ); engine::CDebugDrawer::DrawLine( _p5, _p7, _bcolor );
engine::CDebugDrawer::DrawLine( _p2, _p6, _bcolor ); engine::CDebugDrawer::DrawLine( _p3, _p7, _bcolor );
engine::CDebugDrawer::DrawLine( _p0, _p4, _bcolor ); engine::CDebugDrawer::DrawLine( _p1, _p5, _bcolor );
}
int main()
{
auto _app = std::make_unique<engine::CApplication>();
auto _uiLayer = std::make_unique<ShadowsUtilsLayer>( "Shadows-utils" );
auto _uiLayerRef = dynamic_cast<ShadowsUtilsLayer*>( _app->addGuiLayer( std::move( _uiLayer ) ) );
/* load the shader used to render the scene normally (single-light for now) */
std::string _baseNamePhongWithShadows = std::string( ENGINE_EXAMPLES_PATH ) + "shadows/shaders/phong_with_shadows";
auto _shaderPhongWithShadowsRef = engine::CShaderManager::CreateShaderFromFiles( "phong_with_shadows_shader",
_baseNamePhongWithShadows + "_vs.glsl",
_baseNamePhongWithShadows + "_fs.glsl" );
ENGINE_ASSERT( _shaderPhongWithShadowsRef, "Could not load phong-with-shadows shader to render the scene using the shadowmap T_T" );
/* load the shader used for shadow mapping */
std::string _baseNameShadowMapProjection = std::string( ENGINE_EXAMPLES_PATH ) + "shadows/shaders/shadowmap_projection";
auto _shaderShadowMapProjRef = engine::CShaderManager::CreateShaderFromFiles( "shadowmap_projection_shader",
_baseNameShadowMapProjection + "_vs.glsl",
_baseNameShadowMapProjection + "_fs.glsl" );
ENGINE_ASSERT( _shaderShadowMapProjRef, "Couldn't load shadow-mapping shader use to create the depth-map T_T" );
/* load the shader in charge of depth-map visualization */
std::string _baseNameShadowMapViz = std::string( ENGINE_EXAMPLES_PATH ) + "shadows/shaders/shadowmap_visualization";
auto _shaderShadowMapVizRef = engine::CShaderManager::CreateShaderFromFiles( "shadowmap_visualization_shader",
_baseNameShadowMapViz + "_vs.glsl",
_baseNameShadowMapViz + "_fs.glsl" );
ENGINE_ASSERT( _shaderShadowMapVizRef, "Couldn't load the visualization shader to check the depth-map T_T" );
/* Create a simple scene for testing **********************************************************/
auto _cameraProjData = engine::CCameraProjData();
_cameraProjData.projection = engine::eCameraProjection::PERSPECTIVE;
_cameraProjData.fov = 45.0f;
_cameraProjData.aspect = _app->window()->aspect();
_cameraProjData.zNear = 0.1f;
_cameraProjData.zFar = 50.0f;
auto _camera = std::make_unique<engine::COrbitCamera>( "orbit",
engine::CVec3( 0.0f, 0.0f, 3.0f ),
engine::CVec3( 0.0f, 0.0f, 0.0f ),
engine::eAxis::Y,
_cameraProjData );
//// const float _cameraSensitivity = 0.25f;
//// const float _cameraSpeed = 250.0f;
//// const float _cameraMaxDelta = 10.0f;
////
//// auto _camera = std::make_unique<engine::CFpsCamera>( "fps",
//// engine::CVec3( 2.0f, 2.0f, 2.0f ),
//// engine::CVec3( 0.0f, 0.0f, 0.0f ),
//// engine::eAxis::Y,
//// _cameraProjData,
//// _cameraSensitivity,
//// _cameraSpeed,
//// _cameraMaxDelta );
auto _cameraRef = _app->scene()->AddCamera( std::move( _camera ) );
/* create a dummy camera to visualize the clipping volume */
auto _cameraProjDataTest = engine::CCameraProjData();
_cameraProjDataTest.projection = engine::eCameraProjection::PERSPECTIVE;
_cameraProjDataTest.fov = 45.0f;
_cameraProjDataTest.aspect = _app->window()->aspect();
_cameraProjDataTest.zNear = 1.0f;
_cameraProjDataTest.zFar = 3.0f;
auto _cameraTest = std::make_unique<engine::CFixedCamera>( "fixed",
engine::CVec3( 3.0f, 3.0f, 3.0f ),
engine::CVec3( 0.0f, 0.0f, 0.0f ),
engine::eAxis::Y,
_cameraProjDataTest );
auto _floor = engine::CMeshBuilder::createPlane( 30.0f, 30.0f, engine::eAxis::Y );
_floor->position = { 0.0f, 0.0f, 0.0f };
auto _cube1 = engine::CMeshBuilder::createBox( 1.0f, 1.0f, 1.0f );
_cube1->position = { 0.0f, 2.0f, 0.0f };
auto _cube2 = engine::CMeshBuilder::createBox( 1.0f, 1.0f, 1.0f );
_cube2->position = { 2.0f, 0.5f, 1.0f };
auto _cube3 = engine::CMeshBuilder::createBox( 1.0f, 1.0f, 1.0f );
_cube3->position = { -1.0f, 0.5f, 2.0f };
_cube3->rotation = engine::rotation( tinymath::rotation( engine::CVec3( 1.0f, 0.0f, 1.0f ), engine::toRadians( 60.0f ) ) );
_cube3->scale = { 0.5f, 0.5f, 0.5f };
auto _floorTextureRef = engine::CTextureManager::GetCachedTexture( "img_wooden_floor" );
auto _cubeTextureRef = engine::CTextureManager::GetCachedTexture( "img_wooden_floor" );
ENGINE_ASSERT( _floorTextureRef, "Could not retrieve valid texture for the sample - floor" );
ENGINE_ASSERT( _cubeTextureRef, "Could not retrieve valid texture for the sample - cube" );
auto _floorMaterial = std::make_unique<engine::CMaterial>( "floor_material",
engine::eMaterialType::PHONG,
engine::CVec3( 1.0f, 1.0f, 1.0f ),
engine::CVec3( 1.0f, 1.0f, 1.0f ),
engine::CVec3( 1.0f, 1.0f, 1.0f ),
64.0f,
_floorTextureRef,
_floorTextureRef );
auto _cubeMaterial = std::make_unique<engine::CMaterial>( "cube_material",
engine::eMaterialType::PHONG,
engine::CVec3( 1.0f, 1.0f, 1.0f ),
engine::CVec3( 1.0f, 1.0f, 1.0f ),
engine::CVec3( 1.0f, 1.0f, 1.0f ),
64.0f,
_floorTextureRef,
_floorTextureRef );
/**********************************************************************************************/
auto _currentLightRef = _uiLayerRef->selectedLight();
auto _shadowmap = std::make_unique<engine::CShadowMap>( 4096, 4096 );
engine::float32 _quad_buffData[] = {
/*| positions | uvs |*/
-1.0f, -1.0f, 0.0f, 0.0f,
1.0f, -1.0f, 1.0f, 0.0f,
1.0f, 1.0f, 1.0f, 1.0f,
-1.0f, 1.0f, 0.0f, 1.0f
};
engine::uint32 _quad_indices[] = {
0, 1, 2,
0, 2, 3
};
engine::CVertexBufferLayout _layout = { { "pos", engine::eElementType::Float2, false },
{ "uv", engine::eElementType::Float2, false } };
auto _quad_vbuffer = std::make_unique<engine::CVertexBuffer>( _layout, engine::eBufferUsage::STATIC,
sizeof( _quad_buffData ), _quad_buffData );
auto _quad_ibuffer = std::make_unique<engine::CIndexBuffer>( engine::eBufferUsage::STATIC, 6, _quad_indices );
auto _quad_varray = std::make_unique<engine::CVertexArray>();
_quad_varray->addVertexBuffer( std::move( _quad_vbuffer ) );
_quad_varray->setIndexBuffer( std::move( _quad_ibuffer ) );
while( _app->active() )
{
tinyutils::Clock::Tick();
if ( engine::CInputManager::CheckSingleKeyPress( engine::Keys::KEY_ESCAPE ) )
break;
else if ( engine::CInputManager::CheckSingleKeyPress( engine::Keys::KEY_SPACE ) )
_cameraRef->SetActiveMode( false );
else if ( engine::CInputManager::CheckSingleKeyPress( engine::Keys::KEY_ENTER ) )
_cameraRef->SetActiveMode( true );
else if ( engine::CInputManager::CheckSingleKeyPress( engine::Keys::KEY_F ) )
g_useAutofixToCamera = !g_useAutofixToCamera;
if ( _cameraRef->type() == engine::CFpsCamera::GetStaticType() )
{
if ( _cameraRef->active() )
_app->window()->disableCursor();
else
_app->window()->enableCursor();
}
engine::CDebugDrawer::DrawLine( { 0.0f, 0.0f, 0.0f }, { 5.0f, 0.0f, 0.0f }, { 1.0f, 0.0f, 0.0f } );
engine::CDebugDrawer::DrawLine( { 0.0f, 0.0f, 0.0f }, { 0.0f, 5.0f, 0.0f }, { 0.0f, 1.0f, 0.0f } );
engine::CDebugDrawer::DrawLine( { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 5.0f }, { 0.0f, 0.0f, 1.0f } );
engine::CDebugDrawer::DrawNormals( _cube3.get(), { 0.0f, 0.0f, 1.0f } );
/* use the light selected by the user */
_currentLightRef = _uiLayerRef->selectedLight();
float _t = glfwGetTime();
float _scaler = 1.0f;
float _ctheta = std::cos( _t * _scaler );
float _stheta = std::sin( _t * _scaler );
float _cphi = std::cos( _t * _scaler );
float _sphi = std::sin( _t * _scaler );
engine::CVec3 _testDirection = { _sphi * _ctheta, _sphi * _stheta, _cphi };
showDirectionalLightVolume( _cameraTest.get(), _testDirection.normalized() );
_app->update();
_app->begin();
_cameraRef->Update();
/* do our thing here ************************/
// render to shadow map first
renderToShadowMap( _currentLightRef, _cameraRef, _shadowmap.get(), _shaderShadowMapProjRef, _floor.get(), { _cube1.get(), _cube2.get(), _cube3.get() } );
// render the scene normally
renderSceneWithShadows( _currentLightRef, _cameraRef, _shadowmap.get(), _shaderPhongWithShadowsRef, _floorMaterial.get(), _cubeMaterial.get(), _floor.get(), { _cube1.get(), _cube2.get(), _cube3.get() } );
// render the shadowmap to a quad
renderShadowMapVisualization( _currentLightRef, _quad_varray.get(), _shaderShadowMapVizRef, _shadowmap.get() );
/********************************************/
_app->render();
_app->end();
tinyutils::Clock::Tock();
}
return 0;
}
void renderToShadowMap( engine::CILight* lightPtr,
engine::CICamera* cameraPtr,
engine::CShadowMap* shadowMapPtr,
engine::CShader* shaderPtr,
engine::CIRenderable* floor,
std::vector< engine::CIRenderable* > cubes )
{
// glCullFace( GL_FRONT );
shaderPtr->bind();
shadowMapPtr->bind();
engine::CMat4 _lightViewMat, _lightProjMat;
if ( g_useAutofixToCamera && lightPtr->type() == engine::eLightType::DIRECTIONAL )
{
computeLightSpaceViewProj( cameraPtr, g_lightDirDirection, _lightViewMat, _lightProjMat, g_extraWidth, g_extraHeight, g_extraDepth );
}
else
{
if ( lightPtr->type() == engine::eLightType::DIRECTIONAL )
{
_lightViewMat = engine::lookAt( g_focusPoint - 0.5f * ( g_zfarDir - g_znearDir ) * g_lightDirDirection, g_focusPoint, g_worldUp );
_lightProjMat = engine::ortho( g_widthDir, g_heightDir, g_znearDir, g_zfarDir );
}
else if ( lightPtr->type() == engine::eLightType::POINT )
{
_lightViewMat = engine::lookAt( g_lightPointPosition, g_focusPoint, g_worldUp );
_lightProjMat = engine::perspective( g_fovPoint, ((float)shadowMapPtr->width()) / shadowMapPtr->height(), g_znearPoint, g_zfarPoint );
}
else if ( lightPtr->type() == engine::eLightType::SPOT )
{
_lightViewMat = engine::lookAt( g_lightSpotPosition, g_lightSpotPosition + g_lightSpotDirection, g_worldUp );
_lightProjMat = engine::perspective( g_fovSpot, ((float)shadowMapPtr->width()) / shadowMapPtr->height(), g_znearSpot, g_zfarSpot );
}
}
shaderPtr->setMat4( "u_lightSpaceViewProjMatrix", _lightProjMat * _lightViewMat );
// auto _pointInClip = _lightProjMat * _lightViewMat * engine::CVec4( { 0.0f, 2.5f, 0.0f }, 1.0f );
// std::cout << "point: " << engine::toString( _pointInClip ) << std::endl;
{
shaderPtr->setMat4( "u_modelMatrix", floor->matModel() );
floor->render();
}
for ( size_t i = 0; i < cubes.size(); i++ )
{
shaderPtr->setMat4( "u_modelMatrix", cubes[i]->matModel() );
cubes[i]->render();
}
shadowMapPtr->unbind();
shaderPtr->unbind();
// glCullFace( GL_BACK );
}
void renderSceneWithShadows( engine::CILight* lightPtr,
engine::CICamera* cameraPtr,
engine::CShadowMap* shadowMapPtr,
engine::CShader* shaderPtr,
engine::CMaterial* floorMaterialPtr,
engine::CMaterial* cubeMaterialPtr,
engine::CIRenderable* floor,
std::vector< engine::CIRenderable* > cubes )
{
if ( !lightPtr || !cameraPtr || !shaderPtr )
return;
shaderPtr->bind();
shaderPtr->setInt( "u_spotLight.enabled", 0 );
shaderPtr->setInt( "u_pointLight.enabled", 0 );
shaderPtr->setInt( "u_directionalLight.enabled", 0 );
/* setup the light according to its type */
if ( lightPtr->type() == engine::eLightType::DIRECTIONAL )
{
shaderPtr->setInt( "u_directionalLight.enabled", 1 );
shaderPtr->setVec3( "u_directionalLight.ambient", lightPtr->ambient );
shaderPtr->setVec3( "u_directionalLight.diffuse", lightPtr->diffuse );
shaderPtr->setVec3( "u_directionalLight.specular", lightPtr->specular );
shaderPtr->setFloat( "u_directionalLight.intensity", lightPtr->intensity );
shaderPtr->setVec3( "u_directionalLight.direction", lightPtr->direction );
}
else if ( lightPtr->type() == engine::eLightType::POINT )
{
shaderPtr->setInt( "u_pointLight.enabled", 1 );
shaderPtr->setVec3( "u_pointLight.ambient", lightPtr->ambient );
shaderPtr->setVec3( "u_pointLight.diffuse", lightPtr->diffuse );
shaderPtr->setVec3( "u_pointLight.specular", lightPtr->specular );
shaderPtr->setFloat( "u_pointLight.intensity", lightPtr->intensity );
shaderPtr->setVec3( "u_pointLight.position", lightPtr->position );
shaderPtr->setFloat( "u_pointLight.attnk0", lightPtr->atnConstant );
shaderPtr->setFloat( "u_pointLight.attnk1", lightPtr->atnLinear );
shaderPtr->setFloat( "u_pointLight.attnk2", lightPtr->atnQuadratic );
}
else if ( lightPtr->type() == engine::eLightType::SPOT )
{
shaderPtr->setInt( "u_spotLight.enabled", 1 );
shaderPtr->setVec3( "u_spotLight.ambient", lightPtr->ambient );
shaderPtr->setVec3( "u_spotLight.diffuse", lightPtr->diffuse );
shaderPtr->setVec3( "u_spotLight.specular", lightPtr->specular );
shaderPtr->setFloat( "u_spotLight.intensity", lightPtr->intensity );
shaderPtr->setVec3( "u_spotLight.position", lightPtr->position );
shaderPtr->setFloat( "u_spotLight.attnk0", lightPtr->atnConstant );
shaderPtr->setFloat( "u_spotLight.attnk1", lightPtr->atnLinear );
shaderPtr->setFloat( "u_spotLight.attnk2", lightPtr->atnQuadratic );
shaderPtr->setVec3( "u_spotLight.direction", lightPtr->direction );
shaderPtr->setFloat( "u_spotLight.innerCutoffCos", std::cos( lightPtr->innerCutoff ) );
shaderPtr->setFloat( "u_spotLight.outerCutoffCos", std::cos( lightPtr->outerCutoff ) );
}
/* setup the view and proj matrices */
shaderPtr->setMat4( "u_viewProjMatrix", cameraPtr->mat_proj() * cameraPtr->mat_view() );
shaderPtr->setVec3( "u_viewerPosition", cameraPtr->position() );
/* setup the light-clip-space transform */
engine::CMat4 _lightViewMat, _lightProjMat;
if ( g_useAutofixToCamera && lightPtr->type() == engine::eLightType::DIRECTIONAL )
{
computeLightSpaceViewProj( cameraPtr, g_lightDirDirection, _lightViewMat, _lightProjMat, g_extraWidth, g_extraHeight, g_extraDepth );
}
else
{
if ( lightPtr->type() == engine::eLightType::DIRECTIONAL )
{
_lightViewMat = engine::lookAt( g_focusPoint - 0.5f * ( g_zfarDir - g_znearDir ) * g_lightDirDirection, g_focusPoint, g_worldUp );
_lightProjMat = engine::ortho( g_widthDir, g_heightDir, g_znearDir, g_zfarDir );
}
else if ( lightPtr->type() == engine::eLightType::POINT )
{
_lightViewMat = engine::lookAt( g_lightPointPosition, g_focusPoint, g_worldUp );
_lightProjMat = engine::perspective( g_fovPoint, ((float)shadowMapPtr->width()) / shadowMapPtr->height(), g_znearPoint, g_zfarPoint );
}
else if ( lightPtr->type() == engine::eLightType::SPOT )
{
_lightViewMat = engine::lookAt( g_lightSpotPosition, g_lightSpotPosition + g_lightSpotDirection, { 0.0f, 1.0f, 0.0f } );
_lightProjMat = engine::perspective( g_fovSpot, ((float)shadowMapPtr->width()) / shadowMapPtr->height(), g_znearSpot, g_zfarSpot );
}
}
engine::CDebugDrawer::DrawClipVolume( cameraPtr->mat_proj() * cameraPtr->mat_view(), { 1.0f, 1.0f, 0.0f } );
engine::CDebugDrawer::DrawClipVolume( _lightProjMat * _lightViewMat, { 0.7f, 0.5f, 0.3f } );
shaderPtr->setMat4( "u_viewProjLightSpaceMatrix", _lightProjMat * _lightViewMat );
// auto _pointInClip = _lightProjMat * _lightViewMat * engine::CVec4( { 0.0f, 2.5f, 0.0f }, 1.0f );
// std::cout << "point: " << engine::toString( _pointInClip ) << std::endl;
/* configure the texture unit for our shadowmap's depth texture (slot 3 in the shader) */
shaderPtr->setInt( "u_depthmapTexture", 3 );
glActiveTexture( GL_TEXTURE3 );
shadowMapPtr->frameBuffer()->getTextureAttachment( "shadow_depth_attachment" )->bind();
/* render the floor */
floorMaterialPtr->bind( shaderPtr );
{
auto _modelMat = floor->matModel();
shaderPtr->setMat4( "u_modelMatrix", _modelMat );
shaderPtr->setMat4( "u_normalMatrix", tinymath::inverse( _modelMat ).transpose() );
floor->render();
}
floorMaterialPtr->unbind();
/* render the cubes (all use the same material) */
cubeMaterialPtr->bind( shaderPtr );
for ( size_t i = 0; i < cubes.size(); i++ )
{
auto _modelMat = cubes[i]->matModel();
shaderPtr->setMat4( "u_modelMatrix", _modelMat );
shaderPtr->setMat4( "u_normalMatrix", tinymath::inverse( _modelMat ).transpose() );
cubes[i]->render();
}
cubeMaterialPtr->unbind();
shadowMapPtr->frameBuffer()->getTextureAttachment( "shadow_depth_attachment" )->unbind();
shaderPtr->unbind();
}
void renderShadowMapVisualization( engine::CILight* lightPtr,
engine::CVertexArray* quadVAO,
engine::CShader* shaderPtr,
engine::CShadowMap* shadowMapPtr )
{
glDisable( GL_DEPTH_TEST );
glViewport( 0, 0, 256, 256 );
shaderPtr->bind();
shadowMapPtr->frameBuffer()->getTextureAttachment( "shadow_depth_attachment" )->bind();
quadVAO->bind();
if ( lightPtr->type() == engine::eLightType::POINT || lightPtr->type() == engine::eLightType::SPOT )
{
shaderPtr->setInt( "u_linearizeDepth", 1 );
shaderPtr->setFloat( "u_znear", g_znearPoint );
shaderPtr->setFloat( "u_zfar", g_zfarPoint );
}
else
{
shaderPtr->setInt( "u_linearizeDepth", 0 );
}
glDrawElements( GL_TRIANGLES, quadVAO->indexBuffer()->count(), GL_UNSIGNED_INT, 0 );
quadVAO->unbind();
shadowMapPtr->frameBuffer()->getTextureAttachment( "shadow_depth_attachment" )->unbind();
shaderPtr->unbind();
glEnable( GL_DEPTH_TEST );
glViewport( 0, 0, engine::CApplication::GetInstance()->window()->width(), engine::CApplication::GetInstance()->window()->height() );
}
|
CGROUP group code
code segment dword 'CODE'
assume cs:CGROUP,ds:CGROUP
include errcodes.i
include abcdregs.i
MOUSEINT equ 51
public jgot_mouse
;Boolean ismouse(void); /* returns if mouse is installed */
jgot_mouse proc near
push ds
push ebx
mov ax,34h ;Phar Lap's ms-dos segment
mov ds,ax
; make sure there's an interrupt vector for Micky Microsoft.
mov eax,MOUSEINT*4
mov eax,[eax]
or eax,eax
jz ism_bad
; then call Micky driver with initialization code.
xor ax,ax
int MOUSEINT
cmp ax,0ffffh ; good init?
jnz ism_bad
mov eax,1
jmp ism_end
ism_bad:
xor eax,eax
ism_end:
pop ebx
pop ds
ret
jgot_mouse endp
public jmousey
; jmousey(USHORT *abcd_regs); /* parameter pointer to 4 short array of regs */
jmousey proc near
jmop struc
jmo_edi dd ?
jmo_esi dd ?
jmo_edx dd ?
jmo_ecx dd ?
jmo_ebx dd ?
jmo_ret dd ?
jmo_regs dd ?
jmop ends
push ebx
push ecx
push edx
push esi
push edi
mov esi,[esp].jmo_regs
mov ax,[esi].abcd_ax
mov bx,[esi].abcd_bx
mov cx,[esi].abcd_cx
mov dx,[esi].abcd_dx
int MOUSEINT
mov [esi].abcd_ax,ax
mov [esi].abcd_bx,bx
mov [esi].abcd_cx,cx
mov [esi].abcd_dx,dx
pop edi
pop esi
pop edx
pop ecx
pop ebx
ret
jmousey endp
code ends
end
|
_forktest: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
printf(1, "fork test OK\n");
}
int
main(void)
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 e4 f0 and $0xfffffff0,%esp
forktest();
6: e8 35 00 00 00 call 40 <forktest>
exit();
b: e8 32 03 00 00 call 342 <exit>
00000010 <printf>:
#define N 1000
void
printf(int fd, const char *s, ...)
{
10: 55 push %ebp
11: 89 e5 mov %esp,%ebp
13: 53 push %ebx
14: 83 ec 14 sub $0x14,%esp
17: 8b 5d 0c mov 0xc(%ebp),%ebx
write(fd, s, strlen(s));
1a: 89 1c 24 mov %ebx,(%esp)
1d: e8 7e 01 00 00 call 1a0 <strlen>
22: 89 5c 24 04 mov %ebx,0x4(%esp)
26: 89 44 24 08 mov %eax,0x8(%esp)
2a: 8b 45 08 mov 0x8(%ebp),%eax
2d: 89 04 24 mov %eax,(%esp)
30: e8 2d 03 00 00 call 362 <write>
}
35: 83 c4 14 add $0x14,%esp
38: 5b pop %ebx
39: 5d pop %ebp
3a: c3 ret
3b: 90 nop
3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000040 <forktest>:
void
forktest(void)
{
40: 55 push %ebp
41: 89 e5 mov %esp,%ebp
43: 53 push %ebx
int n, pid;
printf(1, "fork test\n");
for(n=0; n<N; n++){
44: 31 db xor %ebx,%ebx
write(fd, s, strlen(s));
}
void
forktest(void)
{
46: 83 ec 14 sub $0x14,%esp
int n, pid;
printf(1, "fork test\n");
49: c7 44 24 04 fc 03 00 movl $0x3fc,0x4(%esp)
50: 00
51: c7 04 24 01 00 00 00 movl $0x1,(%esp)
58: e8 b3 ff ff ff call 10 <printf>
5d: eb 13 jmp 72 <forktest+0x32>
5f: 90 nop
for(n=0; n<N; n++){
pid = fork();
if(pid < 0)
break;
if(pid == 0)
60: 0f 84 97 00 00 00 je fd <forktest+0xbd>
{
int n, pid;
printf(1, "fork test\n");
for(n=0; n<N; n++){
66: 83 c3 01 add $0x1,%ebx
69: 81 fb e8 03 00 00 cmp $0x3e8,%ebx
6f: 90 nop
70: 74 4e je c0 <forktest+0x80>
pid = fork();
72: e8 c3 02 00 00 call 33a <fork>
if(pid < 0)
77: 85 c0 test %eax,%eax
79: 79 e5 jns 60 <forktest+0x20>
if(n == N){
printf(1, "fork claimed to work N times!\n", N);
exit();
}
for(; n > 0; n--){
7b: 85 db test %ebx,%ebx
7d: 8d 76 00 lea 0x0(%esi),%esi
80: 74 15 je 97 <forktest+0x57>
82: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if(wait() < 0){
88: e8 bd 02 00 00 call 34a <wait>
8d: 85 c0 test %eax,%eax
8f: 90 nop
90: 78 57 js e9 <forktest+0xa9>
if(n == N){
printf(1, "fork claimed to work N times!\n", N);
exit();
}
for(; n > 0; n--){
92: 83 eb 01 sub $0x1,%ebx
95: 75 f1 jne 88 <forktest+0x48>
printf(1, "wait stopped early\n");
exit();
}
}
if(wait() != -1){
97: e8 ae 02 00 00 call 34a <wait>
9c: 83 f8 ff cmp $0xffffffff,%eax
9f: 90 nop
a0: 75 60 jne 102 <forktest+0xc2>
printf(1, "wait got too many\n");
exit();
}
printf(1, "fork test OK\n");
a2: c7 44 24 04 2e 04 00 movl $0x42e,0x4(%esp)
a9: 00
aa: c7 04 24 01 00 00 00 movl $0x1,(%esp)
b1: e8 5a ff ff ff call 10 <printf>
}
b6: 83 c4 14 add $0x14,%esp
b9: 5b pop %ebx
ba: 5d pop %ebp
bb: c3 ret
bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
#define N 1000
void
printf(int fd, const char *s, ...)
{
write(fd, s, strlen(s));
c0: c7 04 24 3c 04 00 00 movl $0x43c,(%esp)
c7: e8 d4 00 00 00 call 1a0 <strlen>
cc: c7 44 24 04 3c 04 00 movl $0x43c,0x4(%esp)
d3: 00
d4: c7 04 24 01 00 00 00 movl $0x1,(%esp)
db: 89 44 24 08 mov %eax,0x8(%esp)
df: e8 7e 02 00 00 call 362 <write>
exit();
}
if(n == N){
printf(1, "fork claimed to work N times!\n", N);
exit();
e4: e8 59 02 00 00 call 342 <exit>
}
for(; n > 0; n--){
if(wait() < 0){
printf(1, "wait stopped early\n");
e9: c7 44 24 04 07 04 00 movl $0x407,0x4(%esp)
f0: 00
f1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
f8: e8 13 ff ff ff call 10 <printf>
exit();
fd: e8 40 02 00 00 call 342 <exit>
}
}
if(wait() != -1){
printf(1, "wait got too many\n");
102: c7 44 24 04 1b 04 00 movl $0x41b,0x4(%esp)
109: 00
10a: c7 04 24 01 00 00 00 movl $0x1,(%esp)
111: e8 fa fe ff ff call 10 <printf>
exit();
116: e8 27 02 00 00 call 342 <exit>
11b: 66 90 xchg %ax,%ax
11d: 66 90 xchg %ax,%ax
11f: 90 nop
00000120 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, const char *t)
{
120: 55 push %ebp
121: 89 e5 mov %esp,%ebp
123: 8b 45 08 mov 0x8(%ebp),%eax
126: 8b 4d 0c mov 0xc(%ebp),%ecx
129: 53 push %ebx
char *os;
os = s;
while((*s++ = *t++) != 0)
12a: 89 c2 mov %eax,%edx
12c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
130: 83 c1 01 add $0x1,%ecx
133: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
137: 83 c2 01 add $0x1,%edx
13a: 84 db test %bl,%bl
13c: 88 5a ff mov %bl,-0x1(%edx)
13f: 75 ef jne 130 <strcpy+0x10>
;
return os;
}
141: 5b pop %ebx
142: 5d pop %ebp
143: c3 ret
144: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
14a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000150 <strcmp>:
int
strcmp(const char *p, const char *q)
{
150: 55 push %ebp
151: 89 e5 mov %esp,%ebp
153: 8b 55 08 mov 0x8(%ebp),%edx
156: 53 push %ebx
157: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
15a: 0f b6 02 movzbl (%edx),%eax
15d: 84 c0 test %al,%al
15f: 74 2d je 18e <strcmp+0x3e>
161: 0f b6 19 movzbl (%ecx),%ebx
164: 38 d8 cmp %bl,%al
166: 74 0e je 176 <strcmp+0x26>
168: eb 2b jmp 195 <strcmp+0x45>
16a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
170: 38 c8 cmp %cl,%al
172: 75 15 jne 189 <strcmp+0x39>
p++, q++;
174: 89 d9 mov %ebx,%ecx
176: 83 c2 01 add $0x1,%edx
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
179: 0f b6 02 movzbl (%edx),%eax
p++, q++;
17c: 8d 59 01 lea 0x1(%ecx),%ebx
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
17f: 0f b6 49 01 movzbl 0x1(%ecx),%ecx
183: 84 c0 test %al,%al
185: 75 e9 jne 170 <strcmp+0x20>
187: 31 c0 xor %eax,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
189: 29 c8 sub %ecx,%eax
}
18b: 5b pop %ebx
18c: 5d pop %ebp
18d: c3 ret
18e: 0f b6 09 movzbl (%ecx),%ecx
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
191: 31 c0 xor %eax,%eax
193: eb f4 jmp 189 <strcmp+0x39>
195: 0f b6 cb movzbl %bl,%ecx
198: eb ef jmp 189 <strcmp+0x39>
19a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
000001a0 <strlen>:
return (uchar)*p - (uchar)*q;
}
uint
strlen(const char *s)
{
1a0: 55 push %ebp
1a1: 89 e5 mov %esp,%ebp
1a3: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
1a6: 80 39 00 cmpb $0x0,(%ecx)
1a9: 74 12 je 1bd <strlen+0x1d>
1ab: 31 d2 xor %edx,%edx
1ad: 8d 76 00 lea 0x0(%esi),%esi
1b0: 83 c2 01 add $0x1,%edx
1b3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
1b7: 89 d0 mov %edx,%eax
1b9: 75 f5 jne 1b0 <strlen+0x10>
;
return n;
}
1bb: 5d pop %ebp
1bc: c3 ret
uint
strlen(const char *s)
{
int n;
for(n = 0; s[n]; n++)
1bd: 31 c0 xor %eax,%eax
;
return n;
}
1bf: 5d pop %ebp
1c0: c3 ret
1c1: eb 0d jmp 1d0 <memset>
1c3: 90 nop
1c4: 90 nop
1c5: 90 nop
1c6: 90 nop
1c7: 90 nop
1c8: 90 nop
1c9: 90 nop
1ca: 90 nop
1cb: 90 nop
1cc: 90 nop
1cd: 90 nop
1ce: 90 nop
1cf: 90 nop
000001d0 <memset>:
void*
memset(void *dst, int c, uint n)
{
1d0: 55 push %ebp
1d1: 89 e5 mov %esp,%ebp
1d3: 8b 55 08 mov 0x8(%ebp),%edx
1d6: 57 push %edi
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
1d7: 8b 4d 10 mov 0x10(%ebp),%ecx
1da: 8b 45 0c mov 0xc(%ebp),%eax
1dd: 89 d7 mov %edx,%edi
1df: fc cld
1e0: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
1e2: 89 d0 mov %edx,%eax
1e4: 5f pop %edi
1e5: 5d pop %ebp
1e6: c3 ret
1e7: 89 f6 mov %esi,%esi
1e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000001f0 <strchr>:
char*
strchr(const char *s, char c)
{
1f0: 55 push %ebp
1f1: 89 e5 mov %esp,%ebp
1f3: 8b 45 08 mov 0x8(%ebp),%eax
1f6: 53 push %ebx
1f7: 8b 55 0c mov 0xc(%ebp),%edx
for(; *s; s++)
1fa: 0f b6 18 movzbl (%eax),%ebx
1fd: 84 db test %bl,%bl
1ff: 74 1d je 21e <strchr+0x2e>
if(*s == c)
201: 38 d3 cmp %dl,%bl
203: 89 d1 mov %edx,%ecx
205: 75 0d jne 214 <strchr+0x24>
207: eb 17 jmp 220 <strchr+0x30>
209: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
210: 38 ca cmp %cl,%dl
212: 74 0c je 220 <strchr+0x30>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
214: 83 c0 01 add $0x1,%eax
217: 0f b6 10 movzbl (%eax),%edx
21a: 84 d2 test %dl,%dl
21c: 75 f2 jne 210 <strchr+0x20>
if(*s == c)
return (char*)s;
return 0;
21e: 31 c0 xor %eax,%eax
}
220: 5b pop %ebx
221: 5d pop %ebp
222: c3 ret
223: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
229: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000230 <gets>:
char*
gets(char *buf, int max)
{
230: 55 push %ebp
231: 89 e5 mov %esp,%ebp
233: 57 push %edi
234: 56 push %esi
int i, cc;
char c;
for(i=0; i+1 < max; ){
235: 31 f6 xor %esi,%esi
return 0;
}
char*
gets(char *buf, int max)
{
237: 53 push %ebx
238: 83 ec 2c sub $0x2c,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
cc = read(0, &c, 1);
23b: 8d 7d e7 lea -0x19(%ebp),%edi
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
23e: eb 31 jmp 271 <gets+0x41>
cc = read(0, &c, 1);
240: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
247: 00
248: 89 7c 24 04 mov %edi,0x4(%esp)
24c: c7 04 24 00 00 00 00 movl $0x0,(%esp)
253: e8 02 01 00 00 call 35a <read>
if(cc < 1)
258: 85 c0 test %eax,%eax
25a: 7e 1d jle 279 <gets+0x49>
break;
buf[i++] = c;
25c: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
260: 89 de mov %ebx,%esi
cc = read(0, &c, 1);
if(cc < 1)
break;
buf[i++] = c;
262: 8b 55 08 mov 0x8(%ebp),%edx
if(c == '\n' || c == '\r')
265: 3c 0d cmp $0xd,%al
for(i=0; i+1 < max; ){
cc = read(0, &c, 1);
if(cc < 1)
break;
buf[i++] = c;
267: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1)
if(c == '\n' || c == '\r')
26b: 74 0c je 279 <gets+0x49>
26d: 3c 0a cmp $0xa,%al
26f: 74 08 je 279 <gets+0x49>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
271: 8d 5e 01 lea 0x1(%esi),%ebx
274: 3b 5d 0c cmp 0xc(%ebp),%ebx
277: 7c c7 jl 240 <gets+0x10>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
279: 8b 45 08 mov 0x8(%ebp),%eax
27c: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
280: 83 c4 2c add $0x2c,%esp
283: 5b pop %ebx
284: 5e pop %esi
285: 5f pop %edi
286: 5d pop %ebp
287: c3 ret
288: 90 nop
289: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000290 <stat>:
int
stat(const char *n, struct stat *st)
{
290: 55 push %ebp
291: 89 e5 mov %esp,%ebp
293: 56 push %esi
294: 53 push %ebx
295: 83 ec 10 sub $0x10,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
298: 8b 45 08 mov 0x8(%ebp),%eax
29b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
2a2: 00
2a3: 89 04 24 mov %eax,(%esp)
2a6: e8 d7 00 00 00 call 382 <open>
if(fd < 0)
2ab: 85 c0 test %eax,%eax
stat(const char *n, struct stat *st)
{
int fd;
int r;
fd = open(n, O_RDONLY);
2ad: 89 c3 mov %eax,%ebx
if(fd < 0)
2af: 78 27 js 2d8 <stat+0x48>
return -1;
r = fstat(fd, st);
2b1: 8b 45 0c mov 0xc(%ebp),%eax
2b4: 89 1c 24 mov %ebx,(%esp)
2b7: 89 44 24 04 mov %eax,0x4(%esp)
2bb: e8 da 00 00 00 call 39a <fstat>
close(fd);
2c0: 89 1c 24 mov %ebx,(%esp)
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
return -1;
r = fstat(fd, st);
2c3: 89 c6 mov %eax,%esi
close(fd);
2c5: e8 a0 00 00 00 call 36a <close>
return r;
2ca: 89 f0 mov %esi,%eax
}
2cc: 83 c4 10 add $0x10,%esp
2cf: 5b pop %ebx
2d0: 5e pop %esi
2d1: 5d pop %ebp
2d2: c3 ret
2d3: 90 nop
2d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
int fd;
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
return -1;
2d8: b8 ff ff ff ff mov $0xffffffff,%eax
2dd: eb ed jmp 2cc <stat+0x3c>
2df: 90 nop
000002e0 <atoi>:
return r;
}
int
atoi(const char *s)
{
2e0: 55 push %ebp
2e1: 89 e5 mov %esp,%ebp
2e3: 8b 4d 08 mov 0x8(%ebp),%ecx
2e6: 53 push %ebx
int n;
n = 0;
while('0' <= *s && *s <= '9')
2e7: 0f be 11 movsbl (%ecx),%edx
2ea: 8d 42 d0 lea -0x30(%edx),%eax
2ed: 3c 09 cmp $0x9,%al
int
atoi(const char *s)
{
int n;
n = 0;
2ef: b8 00 00 00 00 mov $0x0,%eax
while('0' <= *s && *s <= '9')
2f4: 77 17 ja 30d <atoi+0x2d>
2f6: 66 90 xchg %ax,%ax
n = n*10 + *s++ - '0';
2f8: 83 c1 01 add $0x1,%ecx
2fb: 8d 04 80 lea (%eax,%eax,4),%eax
2fe: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
302: 0f be 11 movsbl (%ecx),%edx
305: 8d 5a d0 lea -0x30(%edx),%ebx
308: 80 fb 09 cmp $0x9,%bl
30b: 76 eb jbe 2f8 <atoi+0x18>
n = n*10 + *s++ - '0';
return n;
}
30d: 5b pop %ebx
30e: 5d pop %ebp
30f: c3 ret
00000310 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
310: 55 push %ebp
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
311: 31 d2 xor %edx,%edx
return n;
}
void*
memmove(void *vdst, const void *vsrc, int n)
{
313: 89 e5 mov %esp,%ebp
315: 56 push %esi
316: 8b 45 08 mov 0x8(%ebp),%eax
319: 53 push %ebx
31a: 8b 5d 10 mov 0x10(%ebp),%ebx
31d: 8b 75 0c mov 0xc(%ebp),%esi
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
320: 85 db test %ebx,%ebx
322: 7e 12 jle 336 <memmove+0x26>
324: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
328: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
32c: 88 0c 10 mov %cl,(%eax,%edx,1)
32f: 83 c2 01 add $0x1,%edx
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
332: 39 da cmp %ebx,%edx
334: 75 f2 jne 328 <memmove+0x18>
*dst++ = *src++;
return vdst;
}
336: 5b pop %ebx
337: 5e pop %esi
338: 5d pop %ebp
339: c3 ret
0000033a <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
33a: b8 01 00 00 00 mov $0x1,%eax
33f: cd 40 int $0x40
341: c3 ret
00000342 <exit>:
SYSCALL(exit)
342: b8 02 00 00 00 mov $0x2,%eax
347: cd 40 int $0x40
349: c3 ret
0000034a <wait>:
SYSCALL(wait)
34a: b8 03 00 00 00 mov $0x3,%eax
34f: cd 40 int $0x40
351: c3 ret
00000352 <pipe>:
SYSCALL(pipe)
352: b8 04 00 00 00 mov $0x4,%eax
357: cd 40 int $0x40
359: c3 ret
0000035a <read>:
SYSCALL(read)
35a: b8 05 00 00 00 mov $0x5,%eax
35f: cd 40 int $0x40
361: c3 ret
00000362 <write>:
SYSCALL(write)
362: b8 10 00 00 00 mov $0x10,%eax
367: cd 40 int $0x40
369: c3 ret
0000036a <close>:
SYSCALL(close)
36a: b8 15 00 00 00 mov $0x15,%eax
36f: cd 40 int $0x40
371: c3 ret
00000372 <kill>:
SYSCALL(kill)
372: b8 06 00 00 00 mov $0x6,%eax
377: cd 40 int $0x40
379: c3 ret
0000037a <exec>:
SYSCALL(exec)
37a: b8 07 00 00 00 mov $0x7,%eax
37f: cd 40 int $0x40
381: c3 ret
00000382 <open>:
SYSCALL(open)
382: b8 0f 00 00 00 mov $0xf,%eax
387: cd 40 int $0x40
389: c3 ret
0000038a <mknod>:
SYSCALL(mknod)
38a: b8 11 00 00 00 mov $0x11,%eax
38f: cd 40 int $0x40
391: c3 ret
00000392 <unlink>:
SYSCALL(unlink)
392: b8 12 00 00 00 mov $0x12,%eax
397: cd 40 int $0x40
399: c3 ret
0000039a <fstat>:
SYSCALL(fstat)
39a: b8 08 00 00 00 mov $0x8,%eax
39f: cd 40 int $0x40
3a1: c3 ret
000003a2 <link>:
SYSCALL(link)
3a2: b8 13 00 00 00 mov $0x13,%eax
3a7: cd 40 int $0x40
3a9: c3 ret
000003aa <mkdir>:
SYSCALL(mkdir)
3aa: b8 14 00 00 00 mov $0x14,%eax
3af: cd 40 int $0x40
3b1: c3 ret
000003b2 <chdir>:
SYSCALL(chdir)
3b2: b8 09 00 00 00 mov $0x9,%eax
3b7: cd 40 int $0x40
3b9: c3 ret
000003ba <dup>:
SYSCALL(dup)
3ba: b8 0a 00 00 00 mov $0xa,%eax
3bf: cd 40 int $0x40
3c1: c3 ret
000003c2 <getpid>:
SYSCALL(getpid)
3c2: b8 0b 00 00 00 mov $0xb,%eax
3c7: cd 40 int $0x40
3c9: c3 ret
000003ca <sbrk>:
SYSCALL(sbrk)
3ca: b8 0c 00 00 00 mov $0xc,%eax
3cf: cd 40 int $0x40
3d1: c3 ret
000003d2 <sleep>:
SYSCALL(sleep)
3d2: b8 0d 00 00 00 mov $0xd,%eax
3d7: cd 40 int $0x40
3d9: c3 ret
000003da <uptime>:
SYSCALL(uptime)
3da: b8 0e 00 00 00 mov $0xe,%eax
3df: cd 40 int $0x40
3e1: c3 ret
000003e2 <hello>:
SYSCALL(hello)
3e2: b8 16 00 00 00 mov $0x16,%eax
3e7: cd 40 int $0x40
3e9: c3 ret
000003ea <halt>:
SYSCALL(halt)
3ea: b8 17 00 00 00 mov $0x17,%eax
3ef: cd 40 int $0x40
3f1: c3 ret
000003f2 <gettop>:
SYSCALL(gettop)
3f2: b8 18 00 00 00 mov $0x18,%eax
3f7: cd 40 int $0x40
3f9: c3 ret
|
;;
;; Copyright (c) 2018-2020, Intel Corporation
;;
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions are met:
;;
;; * Redistributions of source code must retain the above copyright notice,
;; this list of conditions and the following disclaimer.
;; * Redistributions in binary form must reproduce the above copyright
;; notice, this list of conditions and the following disclaimer in the
;; documentation and/or other materials provided with the distribution.
;; * Neither the name of Intel Corporation nor the names of its contributors
;; may be used to endorse or promote products derived from this software
;; without specific prior written permission.
;;
;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
;; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
;; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
;; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;
%include "include/aesni_emu.inc"
%define AES_CFB_128_ONE aes_cfb_128_one_sse_no_aesni
%define AES_CFB_256_ONE aes_cfb_256_one_sse_no_aesni
%include "sse/aes_cfb_sse.asm"
|
; int fgetc_fastcall(FILE *stream)
INCLUDE "clib_cfg.asm"
SECTION code_stdio
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
IF __CLIB_OPT_MULTITHREAD & $02
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PUBLIC _fgetc_fastcall
EXTERN asm_fgetc
_fgetc_fastcall:
push hl
pop ix
jp asm_fgetc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ELSE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PUBLIC _fgetc_fastcall
EXTERN _fgetc_unlocked_fastcall
defc _fgetc_fastcall = _fgetc_unlocked_fastcall
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ENDIF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
; A231280: Number of n X 3 0..3 arrays x(i,j) with each element horizontally or antidiagonally next to at least one element with value (x(i,j)+1) mod 4, and upper left element zero.
; Submitted by Jon Maiga
; 0,2,8,66,400,2722,17688,117026,768800,5064642,33328168,219411586,1444225200,9506897762,62579419448,411934939746,2711589889600,17849253534082,117494042259528,773413479117506,5091052634882000,33512239684525602,220596853531096408,1452095488761320866,9558528465073922400,62919737169238144322,414173932583209258088,2726331262209885485826,17946281902754099330800,118132759068584450582242,777617828621157490952568,5118728218650565623708386,33694415961161939841027200,221796043561707374967151362
mov $3,1
lpb $0
sub $0,1
add $2,$3
mov $3,$1
mov $1,$2
mul $2,4
mul $3,17
lpe
mov $0,$1
mul $0,2
|
#include <bits/stdc++.h>
#define ROW 3
#define COLUMN 4
using namespace std;
/*
You are given a 2-d matrix where each cell represents number of coins in that cell.
Assuming we start at matrix[0][0], and can only move right or down,
find the maximum number of coins you can collect by the bottom right corner.
For example, in this matrix
0 3 1 1
2 0 0 4
1 5 3 1
The most we can collect is
0 + 2 + 1 + 5 + 3 + 1 = 12 coins.
*/
int maxCoins(int mat[ROW][COLUMN]){
for(int i=1; i<COLUMN; i++) mat[0][i] += mat[0][i-1];
for(int i=1; i<ROW; i++) mat[i][0] += mat[i-1][0];
for(int i=1; i<ROW; i++){
for(int j=1; j<COLUMN; j++){
mat[i][j] = mat[i][j] + max(mat[i-1][j], mat[i][j-1]);
}
}
return mat[ROW-1][COLUMN-1];
}
// main function
int main(){
int mat[ROW][COLUMN] = {
{0, 3, 1, 1},
{2, 0, 0, 4},
{1, 5, 3, 1}
};
cout << maxCoins(mat) << "\n";
return 0;
} |
; 16 bit dos assembly
.model small
.stack
.data
message db "Hello world!", "$"
.code
main proc
mov ax,seg message
mov ds,ax
mov ah,09
lea dx,message
int 21h
mov ax,4c00h
int 21h
main endp
end main |
; A105427: Numbers n such that the near-repdigit number consisting of a 1 followed by n 3's (i.e., of form 1333...33) is composite.
; 2,3,4,5,6,7,8,9,10,11,12,13,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75
add $0,1
mov $1,$0
add $0,2
mov $2,5
lpb $0
sub $0,5
mul $2,2
trn $0,$2
add $1,1
lpe
|
extrn _circle:byte
extrn _circle2:byte
code SEGMENT para public 'CODE'
ASSUME cs:code
.386
LOCALS
ALIGN 16
_rows dw 200 dup(0)
_blit16t dw 256 dup(0)
_vbufseg dw 0
clipleft dw 0
polyisides dw 0
polyixy dw 16 dup(0,0)
polysides dw 0
polyxy dw 16 dup(0,0)
include polyclip.asm
ALIGN 2
PUBLIC _sin1024
include sin1024.inc
REPOUTSB MACRO
local l1
l1: mov al,ds:[si]
inc si
out dx,al
dec cx
jnz l1
ENDM
PUBLIC _asminit
_asminit PROC FAR
push bp
mov bp,sp
push si
push di
push ds
mov ax,[bp+8]
mov cs:_vbufseg,ax
call blitinit
pop ds
pop di
pop si
pop bp
ret
_asminit ENDP
PUBLIC _asmdoit
_asmdoit PROC FAR
push bp
mov bp,sp
push si
push di
push ds
lds si,[bp+6]
les di,[bp+10]
call blit16
pop ds
pop di
pop si
pop bp
ret
_asmdoit ENDP
PUBLIC _asmdoit2
_asmdoit2 PROC FAR
push bp
mov bp,sp
push si
push di
push ds
lds si,[bp+6]
les di,[bp+10]
call blit16b
pop ds
pop di
pop si
pop bp
ret
_asmdoit2 ENDP
blitinit PROC NEAR
mov bx,OFFSET _rows
mov cx,200
mov dx,40
xor ax,ax
@@l1: mov cs:[bx],ax
add ax,dx
add bx,2
loop @@l1
xor al,al
mov bx,OFFSET _blit16t
mov cx,256
@@1: mov dh,255
mov dl,al
xor ah,ah
REPT 8
local l2
rcl dl,1
jnc l2
xor ah,dh
l2: shr dh,1
ENDM
mov cs:[bx],ah
ror ah,1
and ah,80h
mov cs:[bx+1],ah
add bx,2
inc al
loop @@1
ret
blitinit ENDP
blit16 PROC NEAR
xor ebx,ebx
mov cx,200
jmp @@1
ALIGN 16
@@1: zzz=0
xor dh,dh ;line starts black
REPT 40/2
mov bl,ds:[si+zzz]
xor bl,dh
mov ax,cs:_blit16t[ebx*2]
mov bl,ds:[si+1+zzz]
xor bl,ah
mov dx,cs:_blit16t[ebx*2]
mov ah,dl
mov es:[di+zzz],ax
zzz=zzz+2
ENDM
add si,40
add di,40
dec cx
jz @@2
jmp @@1
@@2:
ret
blit16 ENDP
blit16b PROC NEAR
xor ebx,ebx
mov cx,200
jmp @@1
ALIGN 16
@@1: zzz=0
xor dh,dh ;line starts black
REPT 40/2
mov bl,ds:[si+zzz]
xor bl,dh
mov ax,cs:_blit16t[ebx*2]
mov bl,ds:[si+1+zzz]
xor bl,ah
mov dx,cs:_blit16t[ebx*2]
mov ah,dl
mov es:[di+zzz],ax
zzz=zzz+2
ENDM
add si,40
add di,80
dec cx
jz @@2
jmp @@1
@@2:
ret
blit16b ENDP
drawline PROC NEAR
push si
push di
push bp
@@vis: movzx ebx,bx
cmp bx,cx
je @@0
jle @@1
xchg bx,cx
xchg ax,dx
@@1: sub cx,bx
mov di,cx
mov si,cs:_rows[ebx*2]
mov bp,cs:clipleft
or bp,bp
jz @@nl
push si
;left overflow fill
jge @@ndn
@@nup: add si,40
xor byte ptr ds:[si],080h
inc bp
jnz @@nup
jmp @@nl2
@@ndn: sub si,40
xor byte ptr ds:[si],080h
dec bp
jnz @@ndn
@@nl2: pop si
@@nl: ;
jcxz @@0
movzx ebp,ax
shr bp,3
add si,bp
mov bp,ax
and bp,7
;go on
cmp ax,dx
jl @@r
@@l: ;=============== left
neg dx
add dx,ax
mov bx,di
shr bx,1
neg bx
jmp cs:_loffs[ebp*2]
ALIGN 16
_loffs LABEL WORD
dw OFFSET @@l7
dw OFFSET @@l6
dw OFFSET @@l5
dw OFFSET @@l4
dw OFFSET @@l3
dw OFFSET @@l2
dw OFFSET @@l1
dw OFFSET @@l0
llinemacro MACRO mask,lbl1,lbl2,lbl3,lbl4,lbl5,lbl6,lbl7,lbl0
local l1,l2
;ds:si=startpoint
;di=ycnt
;dx=xcnt
;bx=counter
l1: xor byte ptr ds:[si],mask
add si,40
dec cx
jz @@0
add bx,dx
jl l1
l2: IF lbl1 EQ @@l0
dec si
ENDIF
sub bx,di
jl lbl1
IF lbl2 EQ @@l0
dec si
ENDIF
sub bx,di
jl lbl2
IF lbl3 EQ @@l0
dec si
ENDIF
sub bx,di
jl lbl3
IF lbl4 EQ @@l0
dec si
ENDIF
sub bx,di
jl lbl4
IF lbl5 EQ @@l0
dec si
ENDIF
sub bx,di
jl lbl5
IF lbl6 EQ @@l0
dec si
ENDIF
sub bx,di
jl lbl6
IF lbl7 EQ @@l0
dec si
ENDIF
sub bx,di
jl lbl7
IF lbl0 EQ @@l0
dec si
ENDIF
sub bx,di
jl l1
jmp l2
ENDM
@@l7: llinemacro 10000000b,@@l0,@@l1,@@l2,@@l3,@@l4,@@l5,@@l6,@@l7
@@l6: llinemacro 01000000b,@@l7,@@l0,@@l1,@@l2,@@l3,@@l4,@@l5,@@l6
@@l5: llinemacro 00100000b,@@l6,@@l7,@@l0,@@l1,@@l2,@@l3,@@l4,@@l5
@@l4: llinemacro 00010000b,@@l5,@@l6,@@l7,@@l0,@@l1,@@l2,@@l3,@@l4
@@l3: llinemacro 00001000b,@@l4,@@l5,@@l6,@@l7,@@l0,@@l1,@@l2,@@l3
@@l2: llinemacro 00000100b,@@l3,@@l4,@@l5,@@l6,@@l7,@@l0,@@l1,@@l2
@@l1: llinemacro 00000010b,@@l2,@@l3,@@l4,@@l5,@@l6,@@l7,@@l0,@@l1
@@l0: llinemacro 00000001b,@@l1,@@l2,@@l3,@@l4,@@l5,@@l6,@@l7,@@l0
@@r: ;=============== right
sub dx,ax
mov bx,di
shr bx,1
neg bx
jmp cs:_roffs[ebp*2]
ALIGN 16
_roffs LABEL WORD
dw OFFSET @@r7
dw OFFSET @@r6
dw OFFSET @@r5
dw OFFSET @@r4
dw OFFSET @@r3
dw OFFSET @@r2
dw OFFSET @@r1
dw OFFSET @@r0
rlinemacro MACRO mask,lbl1,lbl2,lbl3,lbl4,lbl5,lbl6,lbl7,lbl0
local l1,l2
;ds:si=startpoint
;di=ycnt
;dx=xcnt
;bx=counter
l1: xor byte ptr ds:[si],mask
add si,40
dec cx
jz @@0
add bx,dx
jl l1
l2: IF lbl1 EQ @@r7
inc si
ENDIF
sub bx,di
jl lbl1
IF lbl2 EQ @@r7
inc si
ENDIF
sub bx,di
jl lbl2
IF lbl3 EQ @@r7
inc si
ENDIF
sub bx,di
jl lbl3
IF lbl4 EQ @@r7
inc si
ENDIF
sub bx,di
jl lbl4
IF lbl5 EQ @@r7
inc si
ENDIF
sub bx,di
jl lbl5
IF lbl6 EQ @@r7
inc si
ENDIF
sub bx,di
jl lbl6
IF lbl7 EQ @@r7
inc si
ENDIF
sub bx,di
jl lbl7
IF lbl0 EQ @@r7
inc si
ENDIF
sub bx,di
jl l1
jmp l2
ENDM
@@r7: rlinemacro 10000000b,@@r6,@@r5,@@r4,@@r3,@@r2,@@r1,@@r0,@@r7
@@r6: rlinemacro 01000000b,@@r5,@@r4,@@r3,@@r2,@@r1,@@r0,@@r7,@@r6
@@r5: rlinemacro 00100000b,@@r4,@@r3,@@r2,@@r1,@@r0,@@r7,@@r6,@@r5
@@r4: rlinemacro 00010000b,@@r3,@@r2,@@r1,@@r0,@@r7,@@r6,@@r5,@@r4
@@r3: rlinemacro 00001000b,@@r2,@@r1,@@r0,@@r7,@@r6,@@r5,@@r4,@@r3
@@r2: rlinemacro 00000100b,@@r1,@@r0,@@r7,@@r6,@@r5,@@r4,@@r3,@@r2
@@r1: rlinemacro 00000010b,@@r0,@@r7,@@r6,@@r5,@@r4,@@r3,@@r2,@@r1
@@r0: rlinemacro 00000001b,@@r7,@@r6,@@r5,@@r4,@@r3,@@r2,@@r1,@@r0
@@0: pop bp
pop di
pop si
ret
drawline ENDP
PUBLIC _asmbox
_asmbox PROC FAR
push bp
mov bp,sp
push si
push di
push ds
mov eax,[bp+6]
mov dword ptr cs:polyixy[0],eax
mov eax,[bp+10]
mov dword ptr cs:polyixy[4],eax
mov eax,[bp+14]
mov dword ptr cs:polyixy[8],eax
mov eax,[bp+18]
mov dword ptr cs:polyixy[12],eax
mov cs:polyisides,4
call clipanypoly
mov ds,cs:_vbufseg
mov si,OFFSET polyxy
mov di,cs:polysides
or di,di
jz @@0
dec di
jz @@2
@@1: mov ax,cs:[si+0]
mov bx,cs:[si+2]
mov dx,cs:[si+4]
mov cx,cs:[si+6]
call drawline
add si,4
dec di
jnz @@1
@@2: mov ax,cs:[si+0]
mov bx,cs:[si+2]
mov dx,cs:polyxy[0]
mov cx,cs:polyxy[2]
call drawline
@@0: pop ds
pop di
pop si
pop bp
ret
_asmbox ENDP
;################################################################
ALIGN 16
flip8 LABEL BYTE
db 0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240,8,136,72,200
db 40,168,104,232,24,152,88,216,56,184,120,248,4,132,68,196,36,164,100
db 228,20,148,84,212,52,180,116,244,12,140,76,204,44,172,108,236,28,156
db 92,220,60,188,124,252,2,130,66,194,34,162,98,226,18,146,82,210,50,178
db 114,242,10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,6
db 134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,14,142,78,206
db 46,174,110,238,30,158,94,222,62,190,126,254,1,129,65,193,33,161,97,225
db 17,145,81,209,49,177,113,241,9,137,73,201,41,169,105,233,25,153,89,217
db 57,185,121,249,5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245
db 13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,3,131,67,195
db 35,163,99,227,19,147,83,211,51,179,115,243,11,139,75,203,43,171,107,235
db 27,155,91,219,59,187,123,251,7,135,71,199,39,167,103,231,23,151,87,215
db 55,183,119,247,15,143,79,207,47,175,111,239,31,159,95,223,63,191,127,255
circles dw 8 dup(0)
pal2 LABEL WORD
db 0, 0*7/9, 0
db 10,10*7/9,10
db 20,20*7/9,20
db 30,30*7/9,30
db 40,40*7/9,40
db 50,50*7/9,50
db 60,60*7/9,60
db 30,30*7/9,30
db 0, 0*7/9, 0
db 10,10*7/9,10
db 20,20*7/9,20
db 30,30*7/9,30
db 40,40*7/9,40
db 50,50*7/9,50
db 60,60*7/9,60
db 30,30*7/9,30
pal1 LABEL WORD
db 30,30*8/9,30
db 60,60*8/9,60
db 50,50*8/9,50
db 40,40*8/9,40
db 30,30*8/9,30
db 20,20*8/9,20
db 10,10*8/9,10
db 0, 0*8/9, 0
db 30,30*8/9,30
db 60,60*8/9,60
db 50,50*8/9,50
db 40,40*8/9,40
db 30,30*8/9,30
db 20,20*8/9,20
db 10,10*8/9,10
db 0, 0*8/9, 0
sinuspower db 0
powercnt db 0
PUBLIC _power0
_power0 LABEL WORD
power0 db 256 dup(0)
db 256 dup(0)
db 256 dup(0)
db 256 dup(0)
db 256 dup(0)
db 256 dup(0)
db 256 dup(0)
db 256 dup(0)
db 256 dup(0)
db 256 dup(0)
db 256 dup(0)
db 256 dup(0)
db 256 dup(0)
db 256 dup(0)
db 256 dup(0)
db 256 dup(0)
PLANE MACRO pl
mov dx,3c4h
mov ax,0002h+pl*100h
out dx,ax
ENDM
bltline PROC NEAR
push si
mov dx,3c4h
mov al,2
out dx,al
inc dx
@@1: mov al,ch
out dx,al
zzz=0
REPT 10
mov eax,ds:[si+zzz]
mov es:[di+zzz],eax
zzz=zzz+4
ENDM
add si,40
shl ch,1
dec cl
jnz @@1
pop si
ret
bltline ENDP
bltlinerev PROC NEAR
push si
mov dx,3c4h
mov al,2
out dx,al
inc dx
xor bx,bx
@@1: mov al,ch
out dx,al
zzz=0
REPT 10
mov bl,ds:[si+36-zzz]
mov al,cs:flip8[bx]
rol eax,8
mov bl,ds:[si+37-zzz]
mov al,cs:flip8[bx]
rol eax,8
mov bl,ds:[si+38-zzz]
mov al,cs:flip8[bx]
rol eax,8
mov bl,ds:[si+39-zzz]
mov al,cs:flip8[bx]
mov es:[di+zzz],eax
zzz=zzz+4
ENDM
add si,40
shl ch,1
dec cl
jnz @@1
pop si
ret
bltlinerev ENDP
resetmode13 PROC NEAR
mov ax,13
int 10h
mov dx,3dah
in al,dx
mov dx,3c0h
xor al,al
REPT 16
out dx,al
out dx,al
inc al
ENDM
mov al,11h
out dx,al
mov al,255
out dx,al
mov al,32
out dx,al
;clear pal
mov dx,3c8h
xor al,al
out dx,al
inc dx
mov cx,768
@@clp: out dx,al
loop @@clp
ret
resetmode13 ENDP
outpal PROC NEAR
mov dx,3c8h
out dx,al
mov ax,cs
mov ds,ax
inc dx
REPOUTSB
ret
outpal ENDP
waitb PROC NEAR
mov bx,1
int 0fch
ret
waitb ENDP
rotate1 PROC NEAR
xor si,si
mov cx,32000/32-2
cld
jmp @@2
;edx.eax
@@1: popf
zzz=0
REPT 16
mov ax,ds:[si+zzz]
rcr al,1
rcr ah,1
mov es:[si+zzz],ax
zzz=zzz+2
ENDM
@@2: pushf
add si,zzz
dec cx
jz @@0
jmp @@1
@@0: popf
ret
rotate1 ENDP
ALIGN 2
framecount dw 0
palanimc dw 0
palanimc2 dw 0
scrnpos dw 0
scrnposl dw 0
scrnx dw 0
scrny dw 0
scrnrot dw 0
sinurot dw 0
overrot dw 211
overx dw 0
overya dw 0
patdir dw 0
memseg dw 0
init_interference PROC NEAR
mov dx,3d4h
mov ax,2813h
out dx,ax
mov bx,20+100*80
;get mem for circles
mov ah,48h
mov bx,16384
int 21h
mov cs:memseg,ax
zzz=0
REPT 8
mov cs:circles[zzz],ax
add ax,2048
zzz=zzz+2
ENDM
mov ax,SEG _circle2
mov ds,ax
xor si,si
mov ax,0a000h
mov es,ax
mov cx,200
xor di,di
mov bp,80*399
@@1: push cx
push di
mov cx,0401h
call bltline
add di,40
mov cx,0401h
call bltlinerev
add di,40
mov di,bp
mov cx,0401h
call bltline
add di,40
mov cx,0401h
call bltlinerev
add di,40
pop di
add di,80
sub bp,80
add si,40
pop cx
loop @@1
mov dx,3ceh
mov ax,0204h
out dx,ax
mov cx,400
mov es,cs:circles[0]
mov ax,0a000h
mov ds,ax
mov cx,32000/4
xor si,si
xor di,di
rep movsd
zzz=0
REPT 7
mov ds,cs:circles[zzz]
mov es,cs:circles[zzz+2]
call rotate1
zzz=zzz+2
ENDM
mov ax,SEG _circle
mov ds,ax
xor si,si
mov ax,0a000h
mov es,ax
mov cx,200
xor di,di
mov bp,80*399
@@10: push cx
push di
mov cx,0103h ;start at plane 1, copy 3 planes
call bltline
add di,40
mov cx,0103h ;start at plane 1, copy 3 planes
call bltlinerev
add di,40
mov di,bp
mov cx,0103h ;start at plane 1, copy 3 planes
call bltline
add di,40
mov cx,0103h ;start at plane 1, copy 3 planes
call bltlinerev
add di,40
pop di
add di,80
sub bp,80
add si,40*3
pop cx
loop @@10
mov cs:framecount,0
ret
init_interference ENDP
do_interference PROC NEAR
@@aga: call waitb
mov dx,3c0h
mov al,13h
out dx,al
mov al,byte ptr cs:scrnposl
out dx,al
mov al,32
out dx,al
mov si,cs:palanimc
add si,cs:patdir
cmp si,0
jge @@a11
mov si,8*3-3
@@a11: cmp si,8*3
jb @@a1
xor si,si
@@a1: mov cs:palanimc,si
mov cs:palanimc2,si
mov si,cs:palanimc
add si,OFFSET pal1
xor al,al
mov cx,8*3
call outpal
mov si,cs:palanimc
add si,OFFSET pal2
mov al,8
mov cx,8*3
call outpal
PLANE 8
mov ax,0a000h
mov es,ax
xor si,si
mov di,cs:scrnpos
mov bp,cs:sinurot
add bp,7*2
and bp,2047
mov cs:sinurot,bp
mov cx,200
@@cp1: zzz=0
push si
add bp,9*2
and bp,2047
mov bx,cs:_sin1024[bp]
sar bx,3
mov bh,cs:sinuspower
movsx ax,byte ptr cs:power0[bx]
sub ax,cs:scrnposl
add ax,cs:overx
mov bx,ax
and bx,7
shl bx,1
neg bx
mov ds,cs:circles[bx+7*2]
sar ax,3
add si,ax
add si,cs:overya
REPT 40/4+1
mov eax,ds:[si+zzz]
mov es:[di+zzz],eax
zzz=zzz+4
ENDM
pop si
add di,80
add si,80
dec cx
jz @@cp0
jmp @@cp1
@@cp0:
;MOVE
mov bx,6
int 0fch
;bx=row
and bx,7
cmp bx,0
jne @@m1
mov cs:patdir,-3
@@m1: cmp bx,4
jne @@m2
mov cs:patdir,-3 ;-3
@@m2:
mov bx,cs:scrnrot
add bx,5
and bx,1023
mov cs:scrnrot,bx
shl bx,1
mov ax,cs:_sin1024[bx]
sar ax,2
add ax,160
mov cs:scrnx,ax
add bx,256*2
and bx,1024*2-1
mov ax,cs:_sin1024[bx]
sar ax,2
add ax,100
mov cs:scrny,ax
mov bx,cs:overrot
add bx,7
and bx,1023
mov cs:overrot,bx
shl bx,1
mov ax,cs:_sin1024[bx]
sar ax,2
add ax,160
mov cs:overx,ax
add bx,256*2
and bx,1024*2-1
mov ax,cs:_sin1024[bx]
sar ax,2
add ax,100
mov bx,80
mul bx
mov cs:overya,ax
mov ax,cs:scrnx
mov bx,ax
and ax,7
mov cs:scrnposl,ax
mov ax,80
mul cs:scrny
sar bx,3
add ax,bx
mov cs:scrnpos,ax
mov bx,cs:scrnpos
mov dx,3d4h
mov al,0ch
mov ah,bh
out dx,ax
inc al
mov ah,bl
out dx,ax
cmp cs:framecount,70*5
jb @@p1
inc cs:powercnt
cmp cs:powercnt,16
jb @@p1
mov cs:powercnt,0
cmp cs:sinuspower,15
jae @@p1
inc cs:sinuspower
@@p1:
inc cs:framecount
;cmp cs:framecount,70*13
;je @@xx
mov ax,0
mov bx,9
int 0fch
cmp ax,925
jae @@xx
mov bx,2
int 0fch
or ax,ax
jz @@aga
@@xx: ret
do_interference ENDP
PUBLIC _initinterference
_initinterference PROC FAR
push bp
mov bp,sp
push si
push di
push ds
; call resetmode13
;@@wm1: mov bx,2
; int 0fch
; or ax,ax
; jnz @@xit
; mov bx,6
; mov ax,0f1h
; int 0fch
; cmp ax,0f1h
; jne @@wm1
call init_interference
pop ds
pop di
pop si
pop bp
ret
_initinterference ENDP
PUBLIC _dointerference
_dointerference PROC FAR
push bp
mov bp,sp
push si
push di
push ds
call do_interference
mov es,cs:memseg
mov ah,49h
int 21h
pop ds
pop di
pop si
pop bp
ret
_dointerference ENDP
PUBLIC _inittwk
_inittwk PROC FAR
push bp
mov bp,sp
push si
push di
push ds
;clear palette
mov dx,3c8h
xor al,al
out dx,al
inc dx
mov cx,768
@@1: out dx,al
loop @@1
;400 rows
mov dx,3d4h
mov ax,00009h
out dx,ax
;tweak
mov dx,3d4h
mov ax,00014h
out dx,ax
mov ax,0e317h
out dx,ax
mov dx,3c4h
mov ax,0604h
out dx,ax
;
mov dx,3c4h
mov ax,0f02h
out dx,ax
mov ax,0a000h
mov es,ax
xor di,di
mov cx,32768
xor ax,ax
rep stosw
;
pop ds
pop di
pop si
pop bp
ret
_inittwk ENDP
PUBLIC _lineblit
_lineblit PROC FAR
push bp
mov bp,sp
push si
push di
push ds
mov di,[bp+6]
mov es,[bp+8]
mov si,[bp+10]
mov ds,[bp+12]
zpl=0
REPT 4
mov dx,3c4h
mov ax,02h+(100h shl zpl)
out dx,ax
zzz=0
REPT 80/2
mov al,ds:[si+(zzz+0)*4+zpl]
mov ah,ds:[si+(zzz+1)*4+zpl]
mov es:[di+zzz],ax
zzz=zzz+2
ENDM
zpl=zpl+1
ENDM
pop ds
pop di
pop si
pop bp
ret
_lineblit ENDP
PUBLIC _setpalarea
_setpalarea PROC FAR
push bp
mov bp,sp
push si
push di
push ds
mov si,[bp+6]
mov ds,[bp+8]
mov ax,[bp+10]
mov dx,3c8h
out dx,al
inc dx
mov cx,[bp+12]
shl cx,1
add cx,ax
REPOUTSB
pop ds
pop di
pop si
pop bp
ret
_setpalarea ENDP
code ENDS
END
|
#include <cstdio>
#include <queue>
#define MAX 2001
char fields[MAX][MAX];
bool visited[MAX][MAX];
std::queue<std::pair<int,int> > kol;
int cities = 0,n,m;
void bfs();
int main()
{
scanf("%d %d",&n,&m);getchar();
for(int i = 0; i < n; i++)
{
fgets(fields[i],MAX+1,stdin);
for(int j=0; j < m; j++ )
{
visited[i][j] = false;
}
}//my_test();return 0;
for(int i=0; i<n; i++)
{
for(int j=0; j<m; j++)
{
if(!visited[i][j])
{
visited[i][j] = true;
if(fields[i][j] != 'A' )
{
cities++;
kol.push(std::make_pair(i,j));
bfs();
}
}
}
}
printf("%d\n",cities );
return 0;
}
void bfs()
{
while(!kol.empty())
{
int i = kol.front().first, j= kol.front().second;
kol.pop();
if(fields[i][j] == 'B' || fields[i][j] == 'E' || fields[i][j] == 'F')
{
if( !(i+1 < 0 || i+1 >= n ) ){
if(!visited[i+1][j])
{
if( fields[i+1][j] == 'C' || fields[i+1][j] == 'D' || fields[i+1][j] == 'F')
{
visited[i+1][j] = true;
kol.push(std::make_pair(i+1,j));
}
}
}
}
if(fields[i][j] == 'B' || fields[i][j] == 'C' || fields[i][j] == 'F')
{
if( !( j-1 < 0 || j-1 >= m) ){
if(!visited[i][j-1])
{
if( fields[i][j-1] == 'D' || fields[i][j-1] == 'E' || fields[i][j-1] == 'F')
{
visited[i][j-1] = true;
kol.push(std::make_pair(i,j-1));
}
}
}
}
if(fields[i][j] == 'C' || fields[i][j] == 'D' || fields[i][j] == 'F')
{
if( !(i-1 < 0 || i-1 >= n ) ){
if(!visited[i-1][j])
{
if( fields[i-1][j] == 'B' || fields[i-1][j] == 'E' || fields[i-1][j] == 'F')
{
visited[i-1][j] = true;
kol.push(std::make_pair(i-1,j));
}
}
}
}
if( (fields[i][j] == 'D') || (fields[i][j] == 'E') || (fields[i][j] == 'F') )
{
if( !( j+1 < 0 || j+1 >= m) ){
if(!visited[i][j+1])
{
if( fields[i][j+1] == 'C' || fields[i][j+1] == 'B' || fields[i][j+1] == 'F')
{
visited[i][j+1] = true;
kol.push(std::make_pair(i,j+1));
}
}
}
}
}
}
|
;
; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
;
; Use of this source code is governed by a BSD-style license
; that can be found in the LICENSE file in the root of the source
; tree. An additional intellectual property rights grant can be found
; in the file PATENTS. All contributing project authors may
; be found in the AUTHORS file in the root of the source tree.
;
.globl vp8_sub_pixel_variance4x4_ppc
.globl vp8_sub_pixel_variance8x8_ppc
.globl vp8_sub_pixel_variance8x16_ppc
.globl vp8_sub_pixel_variance16x8_ppc
.globl vp8_sub_pixel_variance16x16_ppc
.macro load_c V, LABEL, OFF, R0, R1
lis \R0, \LABEL@ha
la \R1, \LABEL@l(\R0)
lvx \V, \OFF, \R1
.endm
.macro load_vfilter V0, V1
load_c \V0, vfilter_b, r6, r12, r10
addi r6, r6, 16
lvx \V1, r6, r10
.endm
.macro HProlog jump_label
;# load up horizontal filter
slwi. r5, r5, 4 ;# index into horizontal filter array
;# index to the next set of vectors in the row.
li r10, 16
;# downshift by 7 ( divide by 128 ) at the end
vspltish v19, 7
;# If there isn't any filtering to be done for the horizontal, then
;# just skip to the second pass.
beq \jump_label
load_c v20, hfilter_b, r5, r12, r0
;# setup constants
;# v14 permutation value for alignment
load_c v28, b_hperm_b, 0, r12, r0
;# index to the next set of vectors in the row.
li r12, 32
;# rounding added in on the multiply
vspltisw v21, 8
vspltisw v18, 3
vslw v18, v21, v18 ;# 0x00000040000000400000004000000040
slwi. r6, r6, 5 ;# index into vertical filter array
.endm
;# Filters a horizontal line
;# expects:
;# r3 src_ptr
;# r4 pitch
;# r10 16
;# r12 32
;# v17 perm intput
;# v18 rounding
;# v19 shift
;# v20 filter taps
;# v21 tmp
;# v22 tmp
;# v23 tmp
;# v24 tmp
;# v25 tmp
;# v26 tmp
;# v27 tmp
;# v28 perm output
;#
.macro hfilter_8 V, hp, lp, increment_counter
lvsl v17, 0, r3 ;# permutate value for alignment
;# input to filter is 9 bytes wide, output is 8 bytes.
lvx v21, 0, r3
lvx v22, r10, r3
.if \increment_counter
add r3, r3, r4
.endif
vperm v21, v21, v22, v17
vperm v24, v21, v21, \hp ;# v20 = 0123 1234 2345 3456
vperm v25, v21, v21, \lp ;# v21 = 4567 5678 6789 789A
vmsummbm v24, v20, v24, v18
vmsummbm v25, v20, v25, v18
vpkswus v24, v24, v25 ;# v24 = 0 4 8 C 1 5 9 D (16-bit)
vsrh v24, v24, v19 ;# divide v0, v1 by 128
vpkuhus \V, v24, v24 ;# \V = scrambled 8-bit result
.endm
.macro vfilter_16 P0 P1
vmuleub v22, \P0, v20 ;# 64 + 4 positive taps
vadduhm v22, v18, v22
vmuloub v23, \P0, v20
vadduhm v23, v18, v23
vmuleub v24, \P1, v21
vadduhm v22, v22, v24 ;# Re = evens, saturation unnecessary
vmuloub v25, \P1, v21
vadduhm v23, v23, v25 ;# Ro = odds
vsrh v22, v22, v19 ;# divide by 128
vsrh v23, v23, v19 ;# v16 v17 = evens, odds
vmrghh \P0, v22, v23 ;# v18 v19 = 16-bit result in order
vmrglh v23, v22, v23
vpkuhus \P0, \P0, v23 ;# P0 = 8-bit result
.endm
.macro compute_sum_sse src, ref, sum, sse, t1, t2, z0
;# Compute sum first. Unpack to so signed subract
;# can be used. Only have a half word signed
;# subract. Do high, then low.
vmrghb \t1, \z0, \src
vmrghb \t2, \z0, \ref
vsubshs \t1, \t1, \t2
vsum4shs \sum, \t1, \sum
vmrglb \t1, \z0, \src
vmrglb \t2, \z0, \ref
vsubshs \t1, \t1, \t2
vsum4shs \sum, \t1, \sum
;# Now compute sse.
vsububs \t1, \src, \ref
vsububs \t2, \ref, \src
vor \t1, \t1, \t2
vmsumubm \sse, \t1, \t1, \sse
.endm
.macro variance_final sum, sse, z0, DS
vsumsws \sum, \sum, \z0
vsumsws \sse, \sse, \z0
stvx \sum, 0, r1
lwz r3, 12(r1)
stvx \sse, 0, r1
lwz r4, 12(r1)
stw r4, 0(r9) ;# sse
mullw r3, r3, r3 ;# sum*sum
srawi r3, r3, \DS ;# (sum*sum) >> 8
subf r3, r3, r4 ;# sse - ((sum*sum) >> 8)
.endm
.macro compute_sum_sse_16 V, increment_counter
load_and_align_16 v16, r7, r8, \increment_counter
compute_sum_sse \V, v16, v18, v19, v20, v21, v23
.endm
.macro load_and_align_16 V, R, P, increment_counter
lvsl v17, 0, \R ;# permutate value for alignment
;# input to filter is 21 bytes wide, output is 16 bytes.
;# input will can span three vectors if not aligned correctly.
lvx v21, 0, \R
lvx v22, r10, \R
.if \increment_counter
add \R, \R, \P
.endif
vperm \V, v21, v22, v17
.endm
.align 2
;# r3 unsigned char *src_ptr
;# r4 int src_pixels_per_line
;# r5 int xoffset
;# r6 int yoffset
;# r7 unsigned char *dst_ptr
;# r8 int dst_pixels_per_line
;# r9 unsigned int *sse
;#
;# r3 return value
vp8_sub_pixel_variance4x4_ppc:
mfspr r11, 256 ;# get old VRSAVE
oris r12, r11, 0xf830
ori r12, r12, 0xfff8
mtspr 256, r12 ;# set VRSAVE
stwu r1,-32(r1) ;# create space on the stack
HProlog second_pass_4x4_pre_copy_b
;# Load up permutation constants
load_c v10, b_0123_b, 0, r12, r0
load_c v11, b_4567_b, 0, r12, r0
hfilter_8 v0, v10, v11, 1
hfilter_8 v1, v10, v11, 1
hfilter_8 v2, v10, v11, 1
hfilter_8 v3, v10, v11, 1
;# Finished filtering main horizontal block. If there is no
;# vertical filtering, jump to storing the data. Otherwise
;# load up and filter the additional line that is needed
;# for the vertical filter.
beq compute_sum_sse_4x4_b
hfilter_8 v4, v10, v11, 0
b second_pass_4x4_b
second_pass_4x4_pre_copy_b:
slwi r6, r6, 5 ;# index into vertical filter array
load_and_align_16 v0, r3, r4, 1
load_and_align_16 v1, r3, r4, 1
load_and_align_16 v2, r3, r4, 1
load_and_align_16 v3, r3, r4, 1
load_and_align_16 v4, r3, r4, 0
second_pass_4x4_b:
vspltish v20, 8
vspltish v18, 3
vslh v18, v20, v18 ;# 0x0040 0040 0040 0040 0040 0040 0040 0040
load_vfilter v20, v21
vfilter_16 v0, v1
vfilter_16 v1, v2
vfilter_16 v2, v3
vfilter_16 v3, v4
compute_sum_sse_4x4_b:
vspltish v18, 0 ;# sum
vspltish v19, 0 ;# sse
vspltish v23, 0 ;# unpack
li r10, 16
load_and_align_16 v4, r7, r8, 1
load_and_align_16 v5, r7, r8, 1
load_and_align_16 v6, r7, r8, 1
load_and_align_16 v7, r7, r8, 1
vmrghb v0, v0, v1
vmrghb v1, v2, v3
vmrghb v2, v4, v5
vmrghb v3, v6, v7
load_c v10, b_hilo_b, 0, r12, r0
vperm v0, v0, v1, v10
vperm v1, v2, v3, v10
compute_sum_sse v0, v1, v18, v19, v20, v21, v23
variance_final v18, v19, v23, 4
addi r1, r1, 32 ;# recover stack
mtspr 256, r11 ;# reset old VRSAVE
blr
.align 2
;# r3 unsigned char *src_ptr
;# r4 int src_pixels_per_line
;# r5 int xoffset
;# r6 int yoffset
;# r7 unsigned char *dst_ptr
;# r8 int dst_pixels_per_line
;# r9 unsigned int *sse
;#
;# r3 return value
vp8_sub_pixel_variance8x8_ppc:
mfspr r11, 256 ;# get old VRSAVE
oris r12, r11, 0xfff0
ori r12, r12, 0xffff
mtspr 256, r12 ;# set VRSAVE
stwu r1,-32(r1) ;# create space on the stack
HProlog second_pass_8x8_pre_copy_b
;# Load up permutation constants
load_c v10, b_0123_b, 0, r12, r0
load_c v11, b_4567_b, 0, r12, r0
hfilter_8 v0, v10, v11, 1
hfilter_8 v1, v10, v11, 1
hfilter_8 v2, v10, v11, 1
hfilter_8 v3, v10, v11, 1
hfilter_8 v4, v10, v11, 1
hfilter_8 v5, v10, v11, 1
hfilter_8 v6, v10, v11, 1
hfilter_8 v7, v10, v11, 1
;# Finished filtering main horizontal block. If there is no
;# vertical filtering, jump to storing the data. Otherwise
;# load up and filter the additional line that is needed
;# for the vertical filter.
beq compute_sum_sse_8x8_b
hfilter_8 v8, v10, v11, 0
b second_pass_8x8_b
second_pass_8x8_pre_copy_b:
slwi. r6, r6, 5 ;# index into vertical filter array
load_and_align_16 v0, r3, r4, 1
load_and_align_16 v1, r3, r4, 1
load_and_align_16 v2, r3, r4, 1
load_and_align_16 v3, r3, r4, 1
load_and_align_16 v4, r3, r4, 1
load_and_align_16 v5, r3, r4, 1
load_and_align_16 v6, r3, r4, 1
load_and_align_16 v7, r3, r4, 1
load_and_align_16 v8, r3, r4, 0
beq compute_sum_sse_8x8_b
second_pass_8x8_b:
vspltish v20, 8
vspltish v18, 3
vslh v18, v20, v18 ;# 0x0040 0040 0040 0040 0040 0040 0040 0040
load_vfilter v20, v21
vfilter_16 v0, v1
vfilter_16 v1, v2
vfilter_16 v2, v3
vfilter_16 v3, v4
vfilter_16 v4, v5
vfilter_16 v5, v6
vfilter_16 v6, v7
vfilter_16 v7, v8
compute_sum_sse_8x8_b:
vspltish v18, 0 ;# sum
vspltish v19, 0 ;# sse
vspltish v23, 0 ;# unpack
li r10, 16
vmrghb v0, v0, v1
vmrghb v1, v2, v3
vmrghb v2, v4, v5
vmrghb v3, v6, v7
load_and_align_16 v4, r7, r8, 1
load_and_align_16 v5, r7, r8, 1
load_and_align_16 v6, r7, r8, 1
load_and_align_16 v7, r7, r8, 1
load_and_align_16 v8, r7, r8, 1
load_and_align_16 v9, r7, r8, 1
load_and_align_16 v10, r7, r8, 1
load_and_align_16 v11, r7, r8, 0
vmrghb v4, v4, v5
vmrghb v5, v6, v7
vmrghb v6, v8, v9
vmrghb v7, v10, v11
compute_sum_sse v0, v4, v18, v19, v20, v21, v23
compute_sum_sse v1, v5, v18, v19, v20, v21, v23
compute_sum_sse v2, v6, v18, v19, v20, v21, v23
compute_sum_sse v3, v7, v18, v19, v20, v21, v23
variance_final v18, v19, v23, 6
addi r1, r1, 32 ;# recover stack
mtspr 256, r11 ;# reset old VRSAVE
blr
.align 2
;# r3 unsigned char *src_ptr
;# r4 int src_pixels_per_line
;# r5 int xoffset
;# r6 int yoffset
;# r7 unsigned char *dst_ptr
;# r8 int dst_pixels_per_line
;# r9 unsigned int *sse
;#
;# r3 return value
vp8_sub_pixel_variance8x16_ppc:
mfspr r11, 256 ;# get old VRSAVE
oris r12, r11, 0xffff
ori r12, r12, 0xfffc
mtspr 256, r12 ;# set VRSAVE
stwu r1,-32(r1) ;# create space on the stack
HProlog second_pass_8x16_pre_copy_b
;# Load up permutation constants
load_c v29, b_0123_b, 0, r12, r0
load_c v30, b_4567_b, 0, r12, r0
hfilter_8 v0, v29, v30, 1
hfilter_8 v1, v29, v30, 1
hfilter_8 v2, v29, v30, 1
hfilter_8 v3, v29, v30, 1
hfilter_8 v4, v29, v30, 1
hfilter_8 v5, v29, v30, 1
hfilter_8 v6, v29, v30, 1
hfilter_8 v7, v29, v30, 1
hfilter_8 v8, v29, v30, 1
hfilter_8 v9, v29, v30, 1
hfilter_8 v10, v29, v30, 1
hfilter_8 v11, v29, v30, 1
hfilter_8 v12, v29, v30, 1
hfilter_8 v13, v29, v30, 1
hfilter_8 v14, v29, v30, 1
hfilter_8 v15, v29, v30, 1
;# Finished filtering main horizontal block. If there is no
;# vertical filtering, jump to storing the data. Otherwise
;# load up and filter the additional line that is needed
;# for the vertical filter.
beq compute_sum_sse_8x16_b
hfilter_8 v16, v29, v30, 0
b second_pass_8x16_b
second_pass_8x16_pre_copy_b:
slwi. r6, r6, 5 ;# index into vertical filter array
load_and_align_16 v0, r3, r4, 1
load_and_align_16 v1, r3, r4, 1
load_and_align_16 v2, r3, r4, 1
load_and_align_16 v3, r3, r4, 1
load_and_align_16 v4, r3, r4, 1
load_and_align_16 v5, r3, r4, 1
load_and_align_16 v6, r3, r4, 1
load_and_align_16 v7, r3, r4, 1
load_and_align_16 v8, r3, r4, 1
load_and_align_16 v9, r3, r4, 1
load_and_align_16 v10, r3, r4, 1
load_and_align_16 v11, r3, r4, 1
load_and_align_16 v12, r3, r4, 1
load_and_align_16 v13, r3, r4, 1
load_and_align_16 v14, r3, r4, 1
load_and_align_16 v15, r3, r4, 1
load_and_align_16 v16, r3, r4, 0
beq compute_sum_sse_8x16_b
second_pass_8x16_b:
vspltish v20, 8
vspltish v18, 3
vslh v18, v20, v18 ;# 0x0040 0040 0040 0040 0040 0040 0040 0040
load_vfilter v20, v21
vfilter_16 v0, v1
vfilter_16 v1, v2
vfilter_16 v2, v3
vfilter_16 v3, v4
vfilter_16 v4, v5
vfilter_16 v5, v6
vfilter_16 v6, v7
vfilter_16 v7, v8
vfilter_16 v8, v9
vfilter_16 v9, v10
vfilter_16 v10, v11
vfilter_16 v11, v12
vfilter_16 v12, v13
vfilter_16 v13, v14
vfilter_16 v14, v15
vfilter_16 v15, v16
compute_sum_sse_8x16_b:
vspltish v18, 0 ;# sum
vspltish v19, 0 ;# sse
vspltish v23, 0 ;# unpack
li r10, 16
vmrghb v0, v0, v1
vmrghb v1, v2, v3
vmrghb v2, v4, v5
vmrghb v3, v6, v7
vmrghb v4, v8, v9
vmrghb v5, v10, v11
vmrghb v6, v12, v13
vmrghb v7, v14, v15
load_and_align_16 v8, r7, r8, 1
load_and_align_16 v9, r7, r8, 1
load_and_align_16 v10, r7, r8, 1
load_and_align_16 v11, r7, r8, 1
load_and_align_16 v12, r7, r8, 1
load_and_align_16 v13, r7, r8, 1
load_and_align_16 v14, r7, r8, 1
load_and_align_16 v15, r7, r8, 1
vmrghb v8, v8, v9
vmrghb v9, v10, v11
vmrghb v10, v12, v13
vmrghb v11, v14, v15
compute_sum_sse v0, v8, v18, v19, v20, v21, v23
compute_sum_sse v1, v9, v18, v19, v20, v21, v23
compute_sum_sse v2, v10, v18, v19, v20, v21, v23
compute_sum_sse v3, v11, v18, v19, v20, v21, v23
load_and_align_16 v8, r7, r8, 1
load_and_align_16 v9, r7, r8, 1
load_and_align_16 v10, r7, r8, 1
load_and_align_16 v11, r7, r8, 1
load_and_align_16 v12, r7, r8, 1
load_and_align_16 v13, r7, r8, 1
load_and_align_16 v14, r7, r8, 1
load_and_align_16 v15, r7, r8, 0
vmrghb v8, v8, v9
vmrghb v9, v10, v11
vmrghb v10, v12, v13
vmrghb v11, v14, v15
compute_sum_sse v4, v8, v18, v19, v20, v21, v23
compute_sum_sse v5, v9, v18, v19, v20, v21, v23
compute_sum_sse v6, v10, v18, v19, v20, v21, v23
compute_sum_sse v7, v11, v18, v19, v20, v21, v23
variance_final v18, v19, v23, 7
addi r1, r1, 32 ;# recover stack
mtspr 256, r11 ;# reset old VRSAVE
blr
;# Filters a horizontal line
;# expects:
;# r3 src_ptr
;# r4 pitch
;# r10 16
;# r12 32
;# v17 perm intput
;# v18 rounding
;# v19 shift
;# v20 filter taps
;# v21 tmp
;# v22 tmp
;# v23 tmp
;# v24 tmp
;# v25 tmp
;# v26 tmp
;# v27 tmp
;# v28 perm output
;#
.macro hfilter_16 V, increment_counter
lvsl v17, 0, r3 ;# permutate value for alignment
;# input to filter is 21 bytes wide, output is 16 bytes.
;# input will can span three vectors if not aligned correctly.
lvx v21, 0, r3
lvx v22, r10, r3
lvx v23, r12, r3
.if \increment_counter
add r3, r3, r4
.endif
vperm v21, v21, v22, v17
vperm v22, v22, v23, v17 ;# v8 v9 = 21 input pixels left-justified
;# set 0
vmsummbm v24, v20, v21, v18 ;# taps times elements
;# set 1
vsldoi v23, v21, v22, 1
vmsummbm v25, v20, v23, v18
;# set 2
vsldoi v23, v21, v22, 2
vmsummbm v26, v20, v23, v18
;# set 3
vsldoi v23, v21, v22, 3
vmsummbm v27, v20, v23, v18
vpkswus v24, v24, v25 ;# v24 = 0 4 8 C 1 5 9 D (16-bit)
vpkswus v25, v26, v27 ;# v25 = 2 6 A E 3 7 B F
vsrh v24, v24, v19 ;# divide v0, v1 by 128
vsrh v25, v25, v19
vpkuhus \V, v24, v25 ;# \V = scrambled 8-bit result
vperm \V, \V, v0, v28 ;# \V = correctly-ordered result
.endm
.align 2
;# r3 unsigned char *src_ptr
;# r4 int src_pixels_per_line
;# r5 int xoffset
;# r6 int yoffset
;# r7 unsigned char *dst_ptr
;# r8 int dst_pixels_per_line
;# r9 unsigned int *sse
;#
;# r3 return value
vp8_sub_pixel_variance16x8_ppc:
mfspr r11, 256 ;# get old VRSAVE
oris r12, r11, 0xffff
ori r12, r12, 0xfff8
mtspr 256, r12 ;# set VRSAVE
stwu r1, -32(r1) ;# create space on the stack
HProlog second_pass_16x8_pre_copy_b
hfilter_16 v0, 1
hfilter_16 v1, 1
hfilter_16 v2, 1
hfilter_16 v3, 1
hfilter_16 v4, 1
hfilter_16 v5, 1
hfilter_16 v6, 1
hfilter_16 v7, 1
;# Finished filtering main horizontal block. If there is no
;# vertical filtering, jump to storing the data. Otherwise
;# load up and filter the additional line that is needed
;# for the vertical filter.
beq compute_sum_sse_16x8_b
hfilter_16 v8, 0
b second_pass_16x8_b
second_pass_16x8_pre_copy_b:
slwi. r6, r6, 5 ;# index into vertical filter array
load_and_align_16 v0, r3, r4, 1
load_and_align_16 v1, r3, r4, 1
load_and_align_16 v2, r3, r4, 1
load_and_align_16 v3, r3, r4, 1
load_and_align_16 v4, r3, r4, 1
load_and_align_16 v5, r3, r4, 1
load_and_align_16 v6, r3, r4, 1
load_and_align_16 v7, r3, r4, 1
load_and_align_16 v8, r3, r4, 1
beq compute_sum_sse_16x8_b
second_pass_16x8_b:
vspltish v20, 8
vspltish v18, 3
vslh v18, v20, v18 ;# 0x0040 0040 0040 0040 0040 0040 0040 0040
load_vfilter v20, v21
vfilter_16 v0, v1
vfilter_16 v1, v2
vfilter_16 v2, v3
vfilter_16 v3, v4
vfilter_16 v4, v5
vfilter_16 v5, v6
vfilter_16 v6, v7
vfilter_16 v7, v8
compute_sum_sse_16x8_b:
vspltish v18, 0 ;# sum
vspltish v19, 0 ;# sse
vspltish v23, 0 ;# unpack
li r10, 16
compute_sum_sse_16 v0, 1
compute_sum_sse_16 v1, 1
compute_sum_sse_16 v2, 1
compute_sum_sse_16 v3, 1
compute_sum_sse_16 v4, 1
compute_sum_sse_16 v5, 1
compute_sum_sse_16 v6, 1
compute_sum_sse_16 v7, 0
variance_final v18, v19, v23, 7
addi r1, r1, 32 ;# recover stack
mtspr 256, r11 ;# reset old VRSAVE
blr
.align 2
;# r3 unsigned char *src_ptr
;# r4 int src_pixels_per_line
;# r5 int xoffset
;# r6 int yoffset
;# r7 unsigned char *dst_ptr
;# r8 int dst_pixels_per_line
;# r9 unsigned int *sse
;#
;# r3 return value
vp8_sub_pixel_variance16x16_ppc:
mfspr r11, 256 ;# get old VRSAVE
oris r12, r11, 0xffff
ori r12, r12, 0xfff8
mtspr 256, r12 ;# set VRSAVE
stwu r1, -32(r1) ;# create space on the stack
HProlog second_pass_16x16_pre_copy_b
hfilter_16 v0, 1
hfilter_16 v1, 1
hfilter_16 v2, 1
hfilter_16 v3, 1
hfilter_16 v4, 1
hfilter_16 v5, 1
hfilter_16 v6, 1
hfilter_16 v7, 1
hfilter_16 v8, 1
hfilter_16 v9, 1
hfilter_16 v10, 1
hfilter_16 v11, 1
hfilter_16 v12, 1
hfilter_16 v13, 1
hfilter_16 v14, 1
hfilter_16 v15, 1
;# Finished filtering main horizontal block. If there is no
;# vertical filtering, jump to storing the data. Otherwise
;# load up and filter the additional line that is needed
;# for the vertical filter.
beq compute_sum_sse_16x16_b
hfilter_16 v16, 0
b second_pass_16x16_b
second_pass_16x16_pre_copy_b:
slwi. r6, r6, 5 ;# index into vertical filter array
load_and_align_16 v0, r3, r4, 1
load_and_align_16 v1, r3, r4, 1
load_and_align_16 v2, r3, r4, 1
load_and_align_16 v3, r3, r4, 1
load_and_align_16 v4, r3, r4, 1
load_and_align_16 v5, r3, r4, 1
load_and_align_16 v6, r3, r4, 1
load_and_align_16 v7, r3, r4, 1
load_and_align_16 v8, r3, r4, 1
load_and_align_16 v9, r3, r4, 1
load_and_align_16 v10, r3, r4, 1
load_and_align_16 v11, r3, r4, 1
load_and_align_16 v12, r3, r4, 1
load_and_align_16 v13, r3, r4, 1
load_and_align_16 v14, r3, r4, 1
load_and_align_16 v15, r3, r4, 1
load_and_align_16 v16, r3, r4, 0
beq compute_sum_sse_16x16_b
second_pass_16x16_b:
vspltish v20, 8
vspltish v18, 3
vslh v18, v20, v18 ;# 0x0040 0040 0040 0040 0040 0040 0040 0040
load_vfilter v20, v21
vfilter_16 v0, v1
vfilter_16 v1, v2
vfilter_16 v2, v3
vfilter_16 v3, v4
vfilter_16 v4, v5
vfilter_16 v5, v6
vfilter_16 v6, v7
vfilter_16 v7, v8
vfilter_16 v8, v9
vfilter_16 v9, v10
vfilter_16 v10, v11
vfilter_16 v11, v12
vfilter_16 v12, v13
vfilter_16 v13, v14
vfilter_16 v14, v15
vfilter_16 v15, v16
compute_sum_sse_16x16_b:
vspltish v18, 0 ;# sum
vspltish v19, 0 ;# sse
vspltish v23, 0 ;# unpack
li r10, 16
compute_sum_sse_16 v0, 1
compute_sum_sse_16 v1, 1
compute_sum_sse_16 v2, 1
compute_sum_sse_16 v3, 1
compute_sum_sse_16 v4, 1
compute_sum_sse_16 v5, 1
compute_sum_sse_16 v6, 1
compute_sum_sse_16 v7, 1
compute_sum_sse_16 v8, 1
compute_sum_sse_16 v9, 1
compute_sum_sse_16 v10, 1
compute_sum_sse_16 v11, 1
compute_sum_sse_16 v12, 1
compute_sum_sse_16 v13, 1
compute_sum_sse_16 v14, 1
compute_sum_sse_16 v15, 0
variance_final v18, v19, v23, 8
addi r1, r1, 32 ;# recover stack
mtspr 256, r11 ;# reset old VRSAVE
blr
.data
.align 4
hfilter_b:
.byte 128, 0, 0, 0,128, 0, 0, 0,128, 0, 0, 0,128, 0, 0, 0
.byte 112, 16, 0, 0,112, 16, 0, 0,112, 16, 0, 0,112, 16, 0, 0
.byte 96, 32, 0, 0, 96, 32, 0, 0, 96, 32, 0, 0, 96, 32, 0, 0
.byte 80, 48, 0, 0, 80, 48, 0, 0, 80, 48, 0, 0, 80, 48, 0, 0
.byte 64, 64, 0, 0, 64, 64, 0, 0, 64, 64, 0, 0, 64, 64, 0, 0
.byte 48, 80, 0, 0, 48, 80, 0, 0, 48, 80, 0, 0, 48, 80, 0, 0
.byte 32, 96, 0, 0, 32, 96, 0, 0, 32, 96, 0, 0, 32, 96, 0, 0
.byte 16,112, 0, 0, 16,112, 0, 0, 16,112, 0, 0, 16,112, 0, 0
.align 4
vfilter_b:
.byte 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128
.byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
.byte 112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112
.byte 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16
.byte 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96
.byte 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32
.byte 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80
.byte 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48
.byte 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
.byte 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
.byte 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48
.byte 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80
.byte 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32
.byte 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96
.byte 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16
.byte 112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112
.align 4
b_hperm_b:
.byte 0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15
.align 4
b_0123_b:
.byte 0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6
.align 4
b_4567_b:
.byte 4, 5, 6, 7, 5, 6, 7, 8, 6, 7, 8, 9, 7, 8, 9, 10
b_hilo_b:
.byte 0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23
|
page ,132
title 87disp - common transcendental dispatch routine
;***
;87disp.asm - common transcendental dispatch routine (80x87/emulator version)
;
; Copyright (c) 1984-2001, Microsoft Corporation. All rights reserved.
;
;Purpose:
; Common transcendental dispatch routine (80x87/emulator version)
;
;Revision History:
; 07-07-84 GFW initial version
; 11-20-85 GFW mask overflow/underflow/precision exceptions;
; fixed affine/projective infinity confusion
; 09-12-86 BCM added _Flanguage to distinguish languages
; 10-21-86 BCM use _cpower rather than _Flanguage to
; distinguish C and FORTRAN exponentiation semantics
; 06-11-87 GFW faster dispatch code - all in-line
; 10-26-87 BCM minor changes for new cmacros.inc
; 04-25-88 WAJ _cpower is now on stack for MTHREAD
; 08-24-88 WAJ 386 version
; 02-01-92 GDP ported to NT
; 09-06-94 CFW Replace MTHREAD with _MT.
;
;*******************************************************************************
.xlist
include cruntime.inc
include mrt386.inc
include elem87.inc
.list
.data
globalT _indefinite, 0FFFFC000000000000000R
globalT _piby2, 03FFFC90FDAA22168C235R
staticQ One, 03FF0000000000000R
ifndef _MT ; by default assume C pow() semantics
globalB _cpower, 1 ; if zero, assume FORTRAN (or other) exponentiation
endif ;_MT ; semantics
labelB XAMtoTagTab
; C2 C1 C0 C3 Meaning Meaning Tag 0
db 2 * ISIZE ; 0 0 0 0 +Unnormal => NAN 10 0
db 1 * ISIZE ; 0 0 0 1 +Zero => Zero 01 0
db 2 * ISIZE ; 0 0 1 0 +NAN => NAN 10 0
db 2 * ISIZE ; 0 0 1 1 Empty => NAN 10 0
db 2 * ISIZE ; 0 1 0 0 -Unnormal => NAN 10 0
db 1 * ISIZE ; 0 1 0 1 -Zero => Zero 01 0
db 2 * ISIZE ; 0 1 1 0 -NAN => NAN 10 0
db 2 * ISIZE ; 0 1 1 1 Empty => NAN 10 0
db 0 * ISIZE ; 1 0 0 0 +Normal => Valid 00 0
db 1 * ISIZE ; 1 0 0 1 +Denormal => Zero 01 0
db 3 * ISIZE ; 1 0 1 0 +Infinity => Infinity 11 0
db 2 * ISIZE ; 1 0 1 1 Empty => NAN 10 0
db 0 * ISIZE ; 1 1 0 0 -Normal => Valid 00 0
db 1 * ISIZE ; 1 1 0 1 -Denormal => Zero 01 0
db 3 * ISIZE ; 1 1 1 0 -Infinity => Infinity 11 0
db 2 * ISIZE ; 1 1 1 1 Empty => NAN 10 0
CODESEG
xamTOS macro
cmp [rdx].fnumber, OP_SQRT ; check for sqrt
JSNE cwdefault
mov bx, word ptr (DSF.savCntrl)
or bh, 2 ; set precision control to 53 bits
and bh, 0feh
mov bl, 03fh ; mask exceptions
jmp setcw
lab cwdefault
mov bx, 133fh ; default cw
lab setcw
mov DSF.setCntrl, bx ; set new control word
fldcw DSF.setCntrl ; load new control word
mov rbx, dataoffset XAMtoTagTab ; Prepare for XLAT
fxam
mov DSF.Function, rdx ; save function jmp table address
fstsw DSF.StatusWord
mov DSF.ErrorType, 0 ; clear error code
endm
comdisp macro
CBI
and rcx, 0404h ; clear all but signs from CX
mov rbx, rdx
add rbx, rax
add rbx, size funtab ; skip over name, error vals, etc.
jmp [rbx] ; jmp to function
endm
; Will dispatch to the special case routines for the single argument
; transcendental functions. It assumes on entry that the 8087 stack
; has the argument on the top of its stack and that DX has been set
; to the address of the dispatch table (which should be in Tag order).
; This routine will FXAM the top of the 8087 stack, generate Tag info
; from the condition code, and jump to the corresponding dispatch table
; entry. In the process of creating the offset for the XLAT instruction
; bit 2 of CL will be loaded with the sign of the argument. DI may not
; be used in any computations.
_trandisp1 proc near
xamTOS ; setup control word and check TOS
fwait
mov cl, CondCode
shl cl, 1
sar cl, 1
rol cl, 1
mov al, cl
and al, 0fh
xlat
comdisp
_trandisp1 endp
; Will dispatch to the special case routines for the double argument
; transcendental functions. It assumes on entry that the 8087 has arg1
; next to the top and arg2 on top of the 8087 stack and that DX has
; been set to the address of the dispatch table (which should be in
; Tag-arg1,Tag-arg2 order). This routine will FXAM the top two
; registers of the 8087 stack,generate Tag info from the condition
; codes, and jump to the corresponding dispatch table entry. In the
; process of creating the offsets for the XLAT statements bit 2 of
; CH and bit 2 of CL will be loaded with the signs of the arguments
; next to the top and on top, respectively, of the 8087 stack. DI may
; not be used in any computations.
_trandisp2 proc near
xamTOS ; setup control word and check TOS
fxch
mov cl, CondCode
fxam
fstsw DSF.StatusWord
fxch
mov ch, CondCode
shl ch, 1
sar ch, 1
rol ch, 1
mov al, ch
and al, 0fh
xlat
mov ah, al
shl cl, 1
sar cl, 1
rol cl, 1
mov al, cl
and al, 0fh
xlat
shl ah, 1
shl ah, 1
or al, ah
comdisp
_trandisp2 endp
page
;----------------------------------------------------------
;
; SPECIAL CASE RETURN FUNCTIONS
;
;----------------------------------------------------------
;
; INPUTS - The signs of the last, second to last
; arguments are in CH, CL respectively.
;
; OUTPUT - The result is the stack top.
;
;----------------------------------------------------------
labelNP _rttospopde, PUBLIC
call setDOMAIN
labelNP _rttospop, PUBLIC
fxch ; remove ST(1)
labelNP _rtnospop, PUBLIC
fstp st(0) ; remove ST(0)
labelNP _rttosnpop, PUBLIC
ret ; return TOS
labelNP _rtnospopde, PUBLIC
call setDOMAIN
jmp _rtnospop
;----------------------------------------------------------
labelNP _rtzeropop, PUBLIC
fstp st(0) ; remove ST(0)
labelNP _rtzeronpop, PUBLIC
fstp st(0) ; remove ST(0)
fldz ; push 0.0 onto stack
ret
;----------------------------------------------------------
labelNP _rtonepop, PUBLIC
fstp st(0) ; remove ST(0)
labelNP _rtonenpop, PUBLIC
fstp st(0) ; remove ST(0)
fld1 ; push 1.0 onto stack
ret
;----------------------------------------------------------
isQNAN macro
fstp DSF.Fac ; use ten byte storage
fld DSF.Fac
test byte ptr [DSF.Fac+7], 40h ; Test for QNaN or SNaN
endm
labelNP _tosnan1, PUBLIC ; ST(0) is a NaN
isQNAN
JSZ _tossnan1
mov DSF.Errortype, DOMAIN_QNAN
ret
lab _tossnan1
mov DSF.Errortype, DOMAIN
fadd [One] ; Convert SNaN to QNaN
ret
labelNP _nosnan2, PUBLIC ; ST(1) is a NaN
fxch
labelNP _tosnan2, PUBLIC ; ST(0) is a NaN
isQNAN
JSZ _tossnan2
mov DSF.Errortype, DOMAIN_QNAN
jmp _tosnan2ret
lab _tossnan2
mov DSF.Errortype, DOMAIN
lab _tosnan2ret
fadd ; Propagate NaN and pop
ret
labelNP _nan2, PUBLIC
isQNAN
JSZ _snan2
fxch
isQNAN
JSZ _snan2
mov DSF.Errortype, DOMAIN_QNAN
jmp _nan2ret
lab _snan2
mov DSF.Errortype, DOMAIN
lab _nan2ret
fadd ; Propagate NaN and pop
ret
;----------------------------------------------------------
labelNP _rtindfpop, PUBLIC
fstp st(0) ; remove ST(0)
labelNP _rtindfnpop, PUBLIC
fstp st(0) ; remove ST(0)
fld [_indefinite] ; push real indefinite onto stack
cmp DSF.ErrorType, 0 ; if error set
JSG retj ; must be SING, don't set DOMAIN
labelNP _rttosnpopde, PUBLIC
lab setDOMAIN
mov DSF.ErrorType, DOMAIN
lab retj
or cl, cl ; test sign in cl
ret
;----------------------------------------------------------
labelNP _rtchsifneg, PUBLIC
or cl, cl ; if arg is negative
JSZ chsifnegret ; negate top of stack
fchs
lab chsifnegret
ret
end
|
levX0
; PF0
byte %00000000
byte %00000000
byte %00000000
byte %11111111
byte %00000000
byte %00000000
byte %00000000
byte %11111111
byte %00000000
byte %00000000
byte %00000000
byte %11111111
; PF1
byte %00000000
byte %00000000
byte %00000000
byte %11100000
byte %00000000
byte %00000000
byte %00000000
byte %11100000
byte %00000000
byte %00000000
byte %00000000
byte %11111001
; PF2
byte %00000000
byte %00000000
byte %00000000
byte %11111110
byte %00000000
byte %00000000
byte %00000000
byte %11111110
byte %00000000
byte %00000000
byte %00000000
byte %11111111
levX1
; PF0
byte %00000000
byte %00000000
byte %11111111
byte %00000000
byte %00000000
byte %00000000
byte %11111111
byte %00000000
byte %00000000
byte %00000000
byte %11111111
byte %00000000
; PF1
byte %00000000
byte %00000000
byte %11100000
byte %00000000
byte %00000000
byte %00000000
byte %11100000
byte %00000000
byte %00000000
byte %00000000
byte %11111001
byte %00000000
; PF2
byte %00000000
byte %00000000
byte %11111110
byte %00000000
byte %00000000
byte %00000000
byte %11111110
byte %00000000
byte %00000000
byte %00000000
byte %11111111
byte %00000000
levX2
; PF0
byte %00000000
byte %11111111
byte %00000000
byte %00000000
byte %00000000
byte %11111111
byte %00000000
byte %00000000
byte %00000000
byte %11111111
byte %00000000
byte %00000000
; PF1
byte %00000000
byte %11110000
byte %00000000
byte %00000000
byte %00000000
byte %11000000
byte %00000000
byte %00000000
byte %00000000
byte %11110000
byte %00000000
byte %00000000
; PF2
byte %00000000
byte %11111111
byte %00000000
byte %00000000
byte %00000000
byte %11111100
byte %00000000
byte %00000000
byte %00000000
byte %11111111
byte %00000000
byte %00000000
levX3
; PF0
byte %11111111
byte %00000000
byte %00000000
byte %00000000
byte %11111111
byte %00000000
byte %00000000
byte %00000000
byte %11111111
byte %00000000
byte %00000000
byte %00000000
; PF1
byte %11111001
byte %00000000
byte %00000000
byte %00000000
byte %11000000
byte %00000000
byte %00000000
byte %00000000
byte %11110000
byte %00000000
byte %00000000
byte %00000000
; PF2
byte %11111111
byte %00000000
byte %00000000
byte %00000000
byte %11111100
byte %00000000
byte %00000000
byte %00000000
byte %11111111
byte %00000000
byte %00000000
byte %00000000
; Default colors
colX0
colX1
colX2
colX3
byte $C8
byte $C8
byte $C8
byte $C8
byte $C8
byte $C8
|
;
; jdmrgss2-64.asm - merged upsampling/color conversion (64-bit SSE2)
;
; Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
; Copyright 2009 D. R. Commander
;
; Based on
; x86 SIMD extension for IJG JPEG library
; Copyright (C) 1999-2006, MIYASAKA Masaru.
; For conditions of distribution and use, see copyright notice in jsimdext.inc
;
; This file should be assembled with NASM (Netwide Assembler),
; can *not* be assembled with Microsoft's MASM or any compatible
; assembler (including Borland's Turbo Assembler).
; NASM is available from http://nasm.sourceforge.net/ for
; http://sourceforge.net/project/showfiles.php?group_id=6208
;
; [TAB8]
%include "jcolsamp.inc"
; --------------------------------------------------------------------------
SECTION SEG_TEXT
BITS 64
;
; Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical.
;
; GLOBAL(void)
; jsimd_h2v1_merged_upsample_sse2 (JDIMENSION output_width,
; JSAMPIMAGE input_buf,
; JDIMENSION in_row_group_ctr,
; JSAMPARRAY output_buf);
;
; r10 = JDIMENSION output_width
; r11 = JSAMPIMAGE input_buf
; r12 = JDIMENSION in_row_group_ctr
; r13 = JSAMPARRAY output_buf
%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM]
%define WK_NUM 3
align 16
global EXTN(jsimd_h2v1_merged_upsample_sse2) PRIVATE
EXTN(jsimd_h2v1_merged_upsample_sse2):
push rbp
mov rax,rsp ; rax = original rbp
sub rsp, byte 4
and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits
mov [rsp],rax
mov rbp,rsp ; rbp = aligned rbp
lea rsp, [wk(0)]
collect_args
push rbx
mov rcx, r10 ; col
test rcx,rcx
jz near .return
push rcx
mov rdi, r11
mov rcx, r12
mov rsi, JSAMPARRAY [rdi+0*SIZEOF_JSAMPARRAY]
mov rbx, JSAMPARRAY [rdi+1*SIZEOF_JSAMPARRAY]
mov rdx, JSAMPARRAY [rdi+2*SIZEOF_JSAMPARRAY]
mov rdi, r13
mov rsi, JSAMPROW [rsi+rcx*SIZEOF_JSAMPROW] ; inptr0
mov rbx, JSAMPROW [rbx+rcx*SIZEOF_JSAMPROW] ; inptr1
mov rdx, JSAMPROW [rdx+rcx*SIZEOF_JSAMPROW] ; inptr2
mov rdi, JSAMPROW [rdi] ; outptr
pop rcx ; col
.columnloop:
movdqa xmm6, XMMWORD [rbx] ; xmm6=Cb(0123456789ABCDEF)
movdqa xmm7, XMMWORD [rdx] ; xmm7=Cr(0123456789ABCDEF)
pxor xmm1,xmm1 ; xmm1=(all 0's)
pcmpeqw xmm3,xmm3
psllw xmm3,7 ; xmm3={0xFF80 0xFF80 0xFF80 0xFF80 ..}
movdqa xmm4,xmm6
punpckhbw xmm6,xmm1 ; xmm6=Cb(89ABCDEF)=CbH
punpcklbw xmm4,xmm1 ; xmm4=Cb(01234567)=CbL
movdqa xmm0,xmm7
punpckhbw xmm7,xmm1 ; xmm7=Cr(89ABCDEF)=CrH
punpcklbw xmm0,xmm1 ; xmm0=Cr(01234567)=CrL
paddw xmm6,xmm3
paddw xmm4,xmm3
paddw xmm7,xmm3
paddw xmm0,xmm3
; (Original)
; R = Y + 1.40200 * Cr
; G = Y - 0.34414 * Cb - 0.71414 * Cr
; B = Y + 1.77200 * Cb
;
; (This implementation)
; R = Y + 0.40200 * Cr + Cr
; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr
; B = Y - 0.22800 * Cb + Cb + Cb
movdqa xmm5,xmm6 ; xmm5=CbH
movdqa xmm2,xmm4 ; xmm2=CbL
paddw xmm6,xmm6 ; xmm6=2*CbH
paddw xmm4,xmm4 ; xmm4=2*CbL
movdqa xmm1,xmm7 ; xmm1=CrH
movdqa xmm3,xmm0 ; xmm3=CrL
paddw xmm7,xmm7 ; xmm7=2*CrH
paddw xmm0,xmm0 ; xmm0=2*CrL
pmulhw xmm6,[rel PW_MF0228] ; xmm6=(2*CbH * -FIX(0.22800))
pmulhw xmm4,[rel PW_MF0228] ; xmm4=(2*CbL * -FIX(0.22800))
pmulhw xmm7,[rel PW_F0402] ; xmm7=(2*CrH * FIX(0.40200))
pmulhw xmm0,[rel PW_F0402] ; xmm0=(2*CrL * FIX(0.40200))
paddw xmm6,[rel PW_ONE]
paddw xmm4,[rel PW_ONE]
psraw xmm6,1 ; xmm6=(CbH * -FIX(0.22800))
psraw xmm4,1 ; xmm4=(CbL * -FIX(0.22800))
paddw xmm7,[rel PW_ONE]
paddw xmm0,[rel PW_ONE]
psraw xmm7,1 ; xmm7=(CrH * FIX(0.40200))
psraw xmm0,1 ; xmm0=(CrL * FIX(0.40200))
paddw xmm6,xmm5
paddw xmm4,xmm2
paddw xmm6,xmm5 ; xmm6=(CbH * FIX(1.77200))=(B-Y)H
paddw xmm4,xmm2 ; xmm4=(CbL * FIX(1.77200))=(B-Y)L
paddw xmm7,xmm1 ; xmm7=(CrH * FIX(1.40200))=(R-Y)H
paddw xmm0,xmm3 ; xmm0=(CrL * FIX(1.40200))=(R-Y)L
movdqa XMMWORD [wk(0)], xmm6 ; wk(0)=(B-Y)H
movdqa XMMWORD [wk(1)], xmm7 ; wk(1)=(R-Y)H
movdqa xmm6,xmm5
movdqa xmm7,xmm2
punpcklwd xmm5,xmm1
punpckhwd xmm6,xmm1
pmaddwd xmm5,[rel PW_MF0344_F0285]
pmaddwd xmm6,[rel PW_MF0344_F0285]
punpcklwd xmm2,xmm3
punpckhwd xmm7,xmm3
pmaddwd xmm2,[rel PW_MF0344_F0285]
pmaddwd xmm7,[rel PW_MF0344_F0285]
paddd xmm5,[rel PD_ONEHALF]
paddd xmm6,[rel PD_ONEHALF]
psrad xmm5,SCALEBITS
psrad xmm6,SCALEBITS
paddd xmm2,[rel PD_ONEHALF]
paddd xmm7,[rel PD_ONEHALF]
psrad xmm2,SCALEBITS
psrad xmm7,SCALEBITS
packssdw xmm5,xmm6 ; xmm5=CbH*-FIX(0.344)+CrH*FIX(0.285)
packssdw xmm2,xmm7 ; xmm2=CbL*-FIX(0.344)+CrL*FIX(0.285)
psubw xmm5,xmm1 ; xmm5=CbH*-FIX(0.344)+CrH*-FIX(0.714)=(G-Y)H
psubw xmm2,xmm3 ; xmm2=CbL*-FIX(0.344)+CrL*-FIX(0.714)=(G-Y)L
movdqa XMMWORD [wk(2)], xmm5 ; wk(2)=(G-Y)H
mov al,2 ; Yctr
jmp short .Yloop_1st
.Yloop_2nd:
movdqa xmm0, XMMWORD [wk(1)] ; xmm0=(R-Y)H
movdqa xmm2, XMMWORD [wk(2)] ; xmm2=(G-Y)H
movdqa xmm4, XMMWORD [wk(0)] ; xmm4=(B-Y)H
.Yloop_1st:
movdqa xmm7, XMMWORD [rsi] ; xmm7=Y(0123456789ABCDEF)
pcmpeqw xmm6,xmm6
psrlw xmm6,BYTE_BIT ; xmm6={0xFF 0x00 0xFF 0x00 ..}
pand xmm6,xmm7 ; xmm6=Y(02468ACE)=YE
psrlw xmm7,BYTE_BIT ; xmm7=Y(13579BDF)=YO
movdqa xmm1,xmm0 ; xmm1=xmm0=(R-Y)(L/H)
movdqa xmm3,xmm2 ; xmm3=xmm2=(G-Y)(L/H)
movdqa xmm5,xmm4 ; xmm5=xmm4=(B-Y)(L/H)
paddw xmm0,xmm6 ; xmm0=((R-Y)+YE)=RE=R(02468ACE)
paddw xmm1,xmm7 ; xmm1=((R-Y)+YO)=RO=R(13579BDF)
packuswb xmm0,xmm0 ; xmm0=R(02468ACE********)
packuswb xmm1,xmm1 ; xmm1=R(13579BDF********)
paddw xmm2,xmm6 ; xmm2=((G-Y)+YE)=GE=G(02468ACE)
paddw xmm3,xmm7 ; xmm3=((G-Y)+YO)=GO=G(13579BDF)
packuswb xmm2,xmm2 ; xmm2=G(02468ACE********)
packuswb xmm3,xmm3 ; xmm3=G(13579BDF********)
paddw xmm4,xmm6 ; xmm4=((B-Y)+YE)=BE=B(02468ACE)
paddw xmm5,xmm7 ; xmm5=((B-Y)+YO)=BO=B(13579BDF)
packuswb xmm4,xmm4 ; xmm4=B(02468ACE********)
packuswb xmm5,xmm5 ; xmm5=B(13579BDF********)
%if RGB_PIXELSIZE == 3 ; ---------------
; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **)
; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **)
; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **)
; xmmG=(** ** ** ** ** ** ** ** **), xmmH=(** ** ** ** ** ** ** ** **)
punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E)
punpcklbw xmmE,xmmB ; xmmE=(20 01 22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F)
punpcklbw xmmD,xmmF ; xmmD=(11 21 13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F)
movdqa xmmG,xmmA
movdqa xmmH,xmmA
punpcklwd xmmA,xmmE ; xmmA=(00 10 20 01 02 12 22 03 04 14 24 05 06 16 26 07)
punpckhwd xmmG,xmmE ; xmmG=(08 18 28 09 0A 1A 2A 0B 0C 1C 2C 0D 0E 1E 2E 0F)
psrldq xmmH,2 ; xmmH=(02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E -- --)
psrldq xmmE,2 ; xmmE=(22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F -- --)
movdqa xmmC,xmmD
movdqa xmmB,xmmD
punpcklwd xmmD,xmmH ; xmmD=(11 21 02 12 13 23 04 14 15 25 06 16 17 27 08 18)
punpckhwd xmmC,xmmH ; xmmC=(19 29 0A 1A 1B 2B 0C 1C 1D 2D 0E 1E 1F 2F -- --)
psrldq xmmB,2 ; xmmB=(13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F -- --)
movdqa xmmF,xmmE
punpcklwd xmmE,xmmB ; xmmE=(22 03 13 23 24 05 15 25 26 07 17 27 28 09 19 29)
punpckhwd xmmF,xmmB ; xmmF=(2A 0B 1B 2B 2C 0D 1D 2D 2E 0F 1F 2F -- -- -- --)
pshufd xmmH,xmmA,0x4E; xmmH=(04 14 24 05 06 16 26 07 00 10 20 01 02 12 22 03)
movdqa xmmB,xmmE
punpckldq xmmA,xmmD ; xmmA=(00 10 20 01 11 21 02 12 02 12 22 03 13 23 04 14)
punpckldq xmmE,xmmH ; xmmE=(22 03 13 23 04 14 24 05 24 05 15 25 06 16 26 07)
punpckhdq xmmD,xmmB ; xmmD=(15 25 06 16 26 07 17 27 17 27 08 18 28 09 19 29)
pshufd xmmH,xmmG,0x4E; xmmH=(0C 1C 2C 0D 0E 1E 2E 0F 08 18 28 09 0A 1A 2A 0B)
movdqa xmmB,xmmF
punpckldq xmmG,xmmC ; xmmG=(08 18 28 09 19 29 0A 1A 0A 1A 2A 0B 1B 2B 0C 1C)
punpckldq xmmF,xmmH ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 2C 0D 1D 2D 0E 1E 2E 0F)
punpckhdq xmmC,xmmB ; xmmC=(1D 2D 0E 1E 2E 0F 1F 2F 1F 2F -- -- -- -- -- --)
punpcklqdq xmmA,xmmE ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05)
punpcklqdq xmmD,xmmG ; xmmD=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A)
punpcklqdq xmmF,xmmC ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F)
cmp rcx, byte SIZEOF_XMMWORD
jb short .column_st32
test rdi, SIZEOF_XMMWORD-1
jnz short .out1
; --(aligned)-------------------
movntdq XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA
movntdq XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD
movntdq XMMWORD [rdi+2*SIZEOF_XMMWORD], xmmF
add rdi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr
jmp short .out0
.out1: ; --(unaligned)-----------------
pcmpeqb xmmH,xmmH ; xmmH=(all 1's)
maskmovdqu xmmA,xmmH ; movntdqu XMMWORD [rdi], xmmA
add rdi, byte SIZEOF_XMMWORD ; outptr
maskmovdqu xmmD,xmmH ; movntdqu XMMWORD [rdi], xmmD
add rdi, byte SIZEOF_XMMWORD ; outptr
maskmovdqu xmmF,xmmH ; movntdqu XMMWORD [rdi], xmmF
add rdi, byte SIZEOF_XMMWORD ; outptr
.out0:
sub rcx, byte SIZEOF_XMMWORD
jz near .endcolumn
add rsi, byte SIZEOF_XMMWORD ; inptr0
dec al ; Yctr
jnz near .Yloop_2nd
add rbx, byte SIZEOF_XMMWORD ; inptr1
add rdx, byte SIZEOF_XMMWORD ; inptr2
jmp near .columnloop
.column_st32:
pcmpeqb xmmH,xmmH ; xmmH=(all 1's)
lea rcx, [rcx+rcx*2] ; imul ecx, RGB_PIXELSIZE
cmp rcx, byte 2*SIZEOF_XMMWORD
jb short .column_st16
maskmovdqu xmmA,xmmH ; movntdqu XMMWORD [rdi], xmmA
add rdi, byte SIZEOF_XMMWORD ; outptr
maskmovdqu xmmD,xmmH ; movntdqu XMMWORD [rdi], xmmD
add rdi, byte SIZEOF_XMMWORD ; outptr
movdqa xmmA,xmmF
sub rcx, byte 2*SIZEOF_XMMWORD
jmp short .column_st15
.column_st16:
cmp rcx, byte SIZEOF_XMMWORD
jb short .column_st15
maskmovdqu xmmA,xmmH ; movntdqu XMMWORD [rdi], xmmA
add rdi, byte SIZEOF_XMMWORD ; outptr
movdqa xmmA,xmmD
sub rcx, byte SIZEOF_XMMWORD
.column_st15:
%ifdef STRICT_MEMORY_ACCESS
; Store the lower 8 bytes of xmmA to the output when it has enough
; space.
cmp rcx, byte SIZEOF_MMWORD
jb short .column_st7
movq MMWORD [rdi], xmmA
add rdi, byte SIZEOF_MMWORD
sub rcx, byte SIZEOF_MMWORD
psrldq xmmA, SIZEOF_MMWORD
.column_st7:
; Store the lower 4 bytes of xmmA to the output when it has enough
; space.
cmp rcx, byte SIZEOF_DWORD
jb short .column_st3
movd DWORD [rdi], xmmA
add rdi, byte SIZEOF_DWORD
sub rcx, byte SIZEOF_DWORD
psrldq xmmA, SIZEOF_DWORD
.column_st3:
; Store the lower 2 bytes of rax to the output when it has enough
; space.
movd rax, xmmA
cmp rcx, byte SIZEOF_WORD
jb short .column_st1
mov WORD [rdi], ax
add rdi, byte SIZEOF_WORD
sub rcx, byte SIZEOF_WORD
shr rax, 16
.column_st1:
; Store the lower 1 byte of rax to the output when it has enough
; space.
test rcx, rcx
jz short .endcolumn
mov BYTE [rdi], al
%else
mov rax,rcx
xor rcx, byte 0x0F
shl rcx, 2
movd xmmB,ecx
psrlq xmmH,4
pcmpeqb xmmE,xmmE
psrlq xmmH,xmmB
psrlq xmmE,xmmB
punpcklbw xmmE,xmmH
; ----------------
mov rcx,rdi
and rcx, byte SIZEOF_XMMWORD-1
jz short .adj0
add rax,rcx
cmp rax, byte SIZEOF_XMMWORD
ja short .adj0
and rdi, byte (-SIZEOF_XMMWORD) ; align to 16-byte boundary
shl rcx, 3 ; pslldq xmmA,ecx & pslldq xmmE,ecx
movdqa xmmG,xmmA
movdqa xmmC,xmmE
pslldq xmmA, SIZEOF_XMMWORD/2
pslldq xmmE, SIZEOF_XMMWORD/2
movd xmmD,ecx
sub rcx, byte (SIZEOF_XMMWORD/2)*BYTE_BIT
jb short .adj1
movd xmmF,ecx
psllq xmmA,xmmF
psllq xmmE,xmmF
jmp short .adj0
.adj1: neg rcx
movd xmmF,ecx
psrlq xmmA,xmmF
psrlq xmmE,xmmF
psllq xmmG,xmmD
psllq xmmC,xmmD
por xmmA,xmmG
por xmmE,xmmC
.adj0: ; ----------------
maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA
%endif ; STRICT_MEMORY_ACCESS ; ---------------
%else ; RGB_PIXELSIZE == 4 ; -----------
%ifdef RGBX_FILLER_0XFF
pcmpeqb xmm6,xmm6 ; xmm6=XE=X(02468ACE********)
pcmpeqb xmm7,xmm7 ; xmm7=XO=X(13579BDF********)
%else
pxor xmm6,xmm6 ; xmm6=XE=X(02468ACE********)
pxor xmm7,xmm7 ; xmm7=XO=X(13579BDF********)
%endif
; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **)
; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **)
; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **)
; xmmG=(30 32 34 36 38 3A 3C 3E **), xmmH=(31 33 35 37 39 3B 3D 3F **)
punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E)
punpcklbw xmmE,xmmG ; xmmE=(20 30 22 32 24 34 26 36 28 38 2A 3A 2C 3C 2E 3E)
punpcklbw xmmB,xmmD ; xmmB=(01 11 03 13 05 15 07 17 09 19 0B 1B 0D 1D 0F 1F)
punpcklbw xmmF,xmmH ; xmmF=(21 31 23 33 25 35 27 37 29 39 2B 3B 2D 3D 2F 3F)
movdqa xmmC,xmmA
punpcklwd xmmA,xmmE ; xmmA=(00 10 20 30 02 12 22 32 04 14 24 34 06 16 26 36)
punpckhwd xmmC,xmmE ; xmmC=(08 18 28 38 0A 1A 2A 3A 0C 1C 2C 3C 0E 1E 2E 3E)
movdqa xmmG,xmmB
punpcklwd xmmB,xmmF ; xmmB=(01 11 21 31 03 13 23 33 05 15 25 35 07 17 27 37)
punpckhwd xmmG,xmmF ; xmmG=(09 19 29 39 0B 1B 2B 3B 0D 1D 2D 3D 0F 1F 2F 3F)
movdqa xmmD,xmmA
punpckldq xmmA,xmmB ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33)
punpckhdq xmmD,xmmB ; xmmD=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37)
movdqa xmmH,xmmC
punpckldq xmmC,xmmG ; xmmC=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B)
punpckhdq xmmH,xmmG ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F)
cmp rcx, byte SIZEOF_XMMWORD
jb short .column_st32
test rdi, SIZEOF_XMMWORD-1
jnz short .out1
; --(aligned)-------------------
movntdq XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA
movntdq XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD
movntdq XMMWORD [rdi+2*SIZEOF_XMMWORD], xmmC
movntdq XMMWORD [rdi+3*SIZEOF_XMMWORD], xmmH
add rdi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr
jmp short .out0
.out1: ; --(unaligned)-----------------
pcmpeqb xmmE,xmmE ; xmmE=(all 1's)
maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [rdi], xmmA
add rdi, byte SIZEOF_XMMWORD ; outptr
maskmovdqu xmmD,xmmE ; movntdqu XMMWORD [rdi], xmmD
add rdi, byte SIZEOF_XMMWORD ; outptr
maskmovdqu xmmC,xmmE ; movntdqu XMMWORD [rdi], xmmC
add rdi, byte SIZEOF_XMMWORD ; outptr
maskmovdqu xmmH,xmmE ; movntdqu XMMWORD [rdi], xmmH
add rdi, byte SIZEOF_XMMWORD ; outptr
.out0:
sub rcx, byte SIZEOF_XMMWORD
jz near .endcolumn
add rsi, byte SIZEOF_XMMWORD ; inptr0
dec al ; Yctr
jnz near .Yloop_2nd
add rbx, byte SIZEOF_XMMWORD ; inptr1
add rdx, byte SIZEOF_XMMWORD ; inptr2
jmp near .columnloop
.column_st32:
pcmpeqb xmmE,xmmE ; xmmE=(all 1's)
cmp rcx, byte SIZEOF_XMMWORD/2
jb short .column_st16
maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [rdi], xmmA
add rdi, byte SIZEOF_XMMWORD ; outptr
maskmovdqu xmmD,xmmE ; movntdqu XMMWORD [rdi], xmmD
add rdi, byte SIZEOF_XMMWORD ; outptr
movdqa xmmA,xmmC
movdqa xmmD,xmmH
sub rcx, byte SIZEOF_XMMWORD/2
.column_st16:
cmp rcx, byte SIZEOF_XMMWORD/4
jb short .column_st15
maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA
add rdi, byte SIZEOF_XMMWORD ; outptr
movdqa xmmA,xmmD
sub rcx, byte SIZEOF_XMMWORD/4
.column_st15:
%ifdef STRICT_MEMORY_ACCESS
; Store two pixels (8 bytes) of xmmA to the output when it has enough
; space.
cmp rcx, byte SIZEOF_XMMWORD/8
jb short .column_st7
movq MMWORD [rdi], xmmA
add rdi, byte SIZEOF_XMMWORD/8*4
sub rcx, byte SIZEOF_XMMWORD/8
psrldq xmmA, SIZEOF_XMMWORD/8*4
.column_st7:
; Store one pixel (4 bytes) of xmmA to the output when it has enough
; space.
test rcx, rcx
jz short .endcolumn
movd DWORD [rdi], xmmA
%else
cmp rcx, byte SIZEOF_XMMWORD/16
jb near .endcolumn
mov rax,rcx
xor rcx, byte 0x03
inc rcx
shl rcx, 4
movd xmmF,ecx
psrlq xmmE,xmmF
punpcklbw xmmE,xmmE
; ----------------
mov rcx,rdi
and rcx, byte SIZEOF_XMMWORD-1
jz short .adj0
lea rax, [rcx+rax*4] ; RGB_PIXELSIZE
cmp rax, byte SIZEOF_XMMWORD
ja short .adj0
and rdi, byte (-SIZEOF_XMMWORD) ; align to 16-byte boundary
shl rcx, 3 ; pslldq xmmA,ecx & pslldq xmmE,ecx
movdqa xmmB,xmmA
movdqa xmmG,xmmE
pslldq xmmA, SIZEOF_XMMWORD/2
pslldq xmmE, SIZEOF_XMMWORD/2
movd xmmC,ecx
sub rcx, byte (SIZEOF_XMMWORD/2)*BYTE_BIT
jb short .adj1
movd xmmH,ecx
psllq xmmA,xmmH
psllq xmmE,xmmH
jmp short .adj0
.adj1: neg rcx
movd xmmH,ecx
psrlq xmmA,xmmH
psrlq xmmE,xmmH
psllq xmmB,xmmC
psllq xmmG,xmmC
por xmmA,xmmB
por xmmE,xmmG
.adj0: ; ----------------
maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA
%endif ; STRICT_MEMORY_ACCESS ; ---------------
%endif ; RGB_PIXELSIZE ; ---------------
.endcolumn:
sfence ; flush the write buffer
.return:
pop rbx
uncollect_args
mov rsp,rbp ; rsp <- aligned rbp
pop rsp ; rsp <- original rbp
pop rbp
ret
; --------------------------------------------------------------------------
;
; Upsample and color convert for the case of 2:1 horizontal and 2:1 vertical.
;
; GLOBAL(void)
; jsimd_h2v2_merged_upsample_sse2 (JDIMENSION output_width,
; JSAMPIMAGE input_buf,
; JDIMENSION in_row_group_ctr,
; JSAMPARRAY output_buf);
;
; r10 = JDIMENSION output_width
; r11 = JSAMPIMAGE input_buf
; r12 = JDIMENSION in_row_group_ctr
; r13 = JSAMPARRAY output_buf
align 16
global EXTN(jsimd_h2v2_merged_upsample_sse2) PRIVATE
EXTN(jsimd_h2v2_merged_upsample_sse2):
push rbp
mov rax,rsp
mov rbp,rsp
collect_args
push rbx
mov rax, r10
mov rdi, r11
mov rcx, r12
mov rsi, JSAMPARRAY [rdi+0*SIZEOF_JSAMPARRAY]
mov rbx, JSAMPARRAY [rdi+1*SIZEOF_JSAMPARRAY]
mov rdx, JSAMPARRAY [rdi+2*SIZEOF_JSAMPARRAY]
mov rdi, r13
lea rsi, [rsi+rcx*SIZEOF_JSAMPROW]
push rdx ; inptr2
push rbx ; inptr1
push rsi ; inptr00
mov rbx,rsp
push rdi
push rcx
push rax
%ifdef WIN64
mov r8, rcx
mov r9, rdi
mov rcx, rax
mov rdx, rbx
%else
mov rdx, rcx
mov rcx, rdi
mov rdi, rax
mov rsi, rbx
%endif
call EXTN(jsimd_h2v1_merged_upsample_sse2)
pop rax
pop rcx
pop rdi
pop rsi
pop rbx
pop rdx
add rdi, byte SIZEOF_JSAMPROW ; outptr1
add rsi, byte SIZEOF_JSAMPROW ; inptr01
push rdx ; inptr2
push rbx ; inptr1
push rsi ; inptr00
mov rbx,rsp
push rdi
push rcx
push rax
%ifdef WIN64
mov r8, rcx
mov r9, rdi
mov rcx, rax
mov rdx, rbx
%else
mov rdx, rcx
mov rcx, rdi
mov rdi, rax
mov rsi, rbx
%endif
call EXTN(jsimd_h2v1_merged_upsample_sse2)
pop rax
pop rcx
pop rdi
pop rsi
pop rbx
pop rdx
pop rbx
uncollect_args
pop rbp
ret
; For some reason, the OS X linker does not honor the request to align the
; segment unless we do this.
align 16
|
lc r4, 0x00000000
lc r5, 0x0000101f
lc r6, 0x00000000
tlbse r6, r4
lc r8, 0x40000000
lc r9, 0x0000101f
lc r10, 0x00000001
tlbse r10, r8
lc r11, 0xdeadbeef
lc r12, 0x80000002
lc r13, 0x7fffffff
st4 r11, r12, 2
ld1 r30, r13, 2
halt
#@expected values
#r4 = 0x00000000
#r5 = 0x0000101f
#r6 = 0x00000000
#tlb 0:
# vpn = 0x00000
# os = 0x000
# ppn = 0x00001
# at = 0x01f
#r8 = 0x40000000
#r9 = 0x0000101f
#r10 = 0x00000001
#tlb 1:
# vpn = 0x40000
# os = 0x000
# ppn = 0x00001
# at = 0x01f
#r11 = 0xdeadbeef
#r12 = 0x80000002
#r13 = 0x7fffffff
#mem 0x00000004 = 0xef
#mem 0x00000005 = 0xbe
#mem 0x00000006 = 0xad
#mem 0x00000007 = 0xde
#r30 = 0xffffffad
#pc = 0x80000048
|
; void *p_forward_list_alt_back(p_forward_list_alt_t *list)
SECTION code_clib
SECTION code_adt_p_forward_list_alt
PUBLIC p_forward_list_alt_back
EXTERN asm_p_forward_list_alt_back
defc p_forward_list_alt_back = asm_p_forward_list_alt_back
; SDCC bridge for Classic
IF __CLASSIC
PUBLIC _p_forward_list_alt_back
defc _p_forward_list_alt_back = p_forward_list_alt_back
ENDIF
|
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1992 -- All Rights Reserved
PROJECT: PC GEOS
MODULE:
FILE: importManager.asm
AUTHOR: Maryann Simmons, Jul 13, 1992
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
MS 7/13/92 Initial revision
DESCRIPTION:
$Id: importManager.asm,v 1.1 97/04/07 11:24:52 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
include wmfGeode.def
include importMain.asm
|
include 'macros.inc'
.8086
.MODEL SMALL
.STACK 256
DATA SEGMENT
SPACE DB " $"
X_EQ DB "x=$"
Y_EQ DB "y=$"
SUM_MSG DB "x+y=$"
SUB_MSG DB "x-y=$"
SUB_MSG_2 DB "x-y=-$"
NUM1 DB ?
NUM2 DB ?
SUM DW ?
DATA ENDS
CODE SEGMENT
MAIN PROC FAR
MOV AX,@DATA
MOV DS,AX
START: CALL HEX_KEYB
ROL AL,4 ; move the digit in the first 4 MSB position (xxxx0000)
MOV BL,AL ; save it to BL
CALL HEX_KEYB ; read second digit
ADD BL,AL ; add the second digit to the saved number (xxxx0000)+(0000xxxx) = (xxxxxxxx)
MOV NUM1,BL ; NUM1 has the first number
CALL HEX_KEYB
ROL AL,4 ; move the digit in the first 4 MSB position (xxxx0000)
MOV BL,AL ; save it to BL
CALL HEX_KEYB ; read second digit
ADD BL,AL ; add the second digit to the saved number (xxxx0000)+(0000xxxx) = (xxxxxxxx)
MOV NUM2,BL ; NUM2 has the first number
NEW_LINE
PRINT_STRING X_EQ
MOV BL,NUM1 ; move NUM1 to BL in order to print it
CALL PRINT_HEX ; call print_hex to print the number
PRINT_STRING SPACE
PRINT_STRING Y_EQ
MOV BL,NUM2 ; move NUM2 to BL in order to print it
CALL PRINT_HEX ; call print_hex to print the number
NEW_LINE
PRINT_STRING SUM_MSG
MOV BH,0 ; BX will be equal BH = 0
MOV BL,NUM1 ; and BL = NUM1
MOV SUM,BX ; move BX to SUM
MOV BH,0 ; BX will be equal to BH =0
MOV BL,NUM2 ; and BL = NUM2
ADD SUM,BX ; SUM += BX
MOV BX,SUM ; Move SUM to BX in order to print the result
CALL PRINT_DEC ; call print_dec to print the result in DEC form
PRINT_STRING SPACE
MOV BH,0 ; BX will be equal to BH = 0
MOV BL,NUM2 ; and BL = NUM2
CMP NUM1,BL ; if num1 >= BL then
JAE POSITIVE ; jump positive
PRINT_STRING SUB_MSG_2
MOV BL,NUM2 ; else move num2 to bl
SUB BL,NUM1 ; and subract num1 from bl
CALL PRINT_DEC ; call print_dec to print result in DEC form
NEW_LINE
JMP START
POSITIVE: PRINT_STRING SUB_MSG ; if num1 is greater than num2
MOV BL,NUM1 ; move num1 to bl and subtract
SUB BL,NUM2 ; num2 from num1
CALL PRINT_DEC ; call print_dec to print result in DEC form
NEW_LINE
JMP START
MAIN ENDP
HEX_KEYB PROC NEAR
PUSH DX ; saving DX because READ macro uses DL
INVALID: READ
CMP AL, 46H ; if ASCII > 46 invalid input
JG INVALID ; jump invalid
CMP AL, 40H ; else if ASCII > 40 then
JG FINISH_LETTER ; and jump to FINISH_LETTER
CMP AL, 39H ; if ASCII < 30 invalid input
JG INVALID ; jump invalid
CMP AL, 29H ; if ASCII > 39 invalid input
JG FINISH_NUMB ; jump FINISH_NUMB else
JMP INVALID ; jump invalid
FINISH_LETTER: SUB AL, 37H ; subtract 37H (i.e 41H-37H = 0AH)
POP DX ; bring back DX
RET ; return
FINISH_NUMB: SUB AL, 30H ; subtract 30H (i.e 39H-30H = 09H)
POP DX
RET
HEX_KEYB ENDP
PRINT_DEC PROC NEAR
MOV AH,0
MOV AX,BX ; moving BX to AX
MOV BL,10 ; use for division with 10
MOV CX,0 ; digits counter starting from zero
DEC_LOOP: DIV BL ; divide number with 10
CMP AX,00H ; if AL is zero we converted the number
JE CALL PRINT_DIG ; so we jump to PRINT_DIG to print the number
PUSH AX ; save remainder
INC CX ; else increase number of digits
MOV AH,00H
JMP DEC_LOOP
RET
PRINT_DEC ENDP
PRINT_HEX PROC NEAR
MOV AH,0
MOV AL,BL ; AH = 0
MOV BL,16 ; AL = BL so AX = 00000000(BL)
MOV CX,1 ; BL = 16
HEX_LOOP: DIV BL ; digits counter
PUSH AX ; Divide with 16
CMP AL,00H ; save remainder
JE CALL PRINT_DIG ; if AL is zero we converted the number
INC CX ; and call print digit
MOV AH,00H ; else increase digits counter
JMP HEX_LOOP ; make AH = 0
RET ; keep looping
PRINT_HEX ENDP
PRINT_DIG PROC NEAR
CMP CX,0 ; in case of CX is not zero then
JNE PRINT_LOOP ; CX and stack have the right data
INC CX ; else means that x-y or x+y equals zero
MOV AX,0 ; so we need to increase CX and add to stack
PUSH AX ; zero before we start the printing proccess
PRINT_LOOP: POP DX ; pop digit to print it
MOV DL,DH ; move DH to DL and
MOV DH,00H ; make DH zero so as DX has the digit
CMP DX,09H ; if it's greater than 9 then it's a letter
JG LETTER ; go to letter
ADD DX,30H ; else add 30 for ascii convertion
JMP CONT ; and jump to cont label
LETTER: ADD DX,37H ; if its a letter then add 37h for ascii convertion
CONT: MOV AH,02H ; to print digit on screen
INT 21H ; interupt for print
LOOP PRINT_LOOP ; loop until the whole number is printed
RET
PRINT_DIG ENDP |
; A063498: Atoms in cluster of n layers around C_60.
; 0,32,104,236,448,760,1192,1764,2496,3408,4520,5852,7424,9256,11368,13780,16512,19584,23016,26828,31040,35672,40744,46276,52288,58800,65832,73404,81536,90248,99560,109492,120064,131296,143208,155820,169152,183224,198056,213668,230080,247312,265384,284316,304128,324840,346472,369044,392576,417088,442600,469132,496704,525336,555048,585860,617792,650864,685096,720508,757120,794952,834024,874356,915968,958880,1003112,1048684,1095616,1143928,1193640,1244772,1297344,1351376,1406888,1463900,1522432,1582504,1644136,1707348,1772160,1838592,1906664,1976396,2047808,2120920,2195752,2272324,2350656,2430768,2512680,2596412,2681984,2769416,2858728,2949940,3043072,3138144,3235176,3334188,3435200,3538232,3643304,3750436,3859648,3970960,4084392,4199964,4317696,4437608,4559720,4684052,4810624,4939456,5070568,5203980,5339712,5477784,5618216,5761028,5906240,6053872,6203944,6356476,6511488,6669000,6829032,6991604,7156736,7324448,7494760,7667692,7843264,8021496,8202408,8386020,8572352,8761424,8953256,9147868,9345280,9545512,9748584,9954516,10163328,10375040,10589672,10807244,11027776,11251288,11477800,11707332,11939904,12175536,12414248,12656060,12900992,13149064,13400296,13654708,13912320,14173152,14437224,14704556,14975168,15249080,15526312,15806884,16090816,16378128,16668840,16962972,17260544,17561576,17866088,18174100,18485632,18800704,19119336,19441548,19767360,20096792,20429864,20766596,21107008,21451120,21798952,22150524,22505856,22864968,23227880,23594612,23965184,24339616,24717928,25100140,25486272,25876344,26270376,26668388,27070400,27476432,27886504,28300636,28718848,29141160,29567592,29998164,30432896,30871808,31314920,31762252,32213824,32669656,33129768,33594180,34062912,34535984,35013416,35495228,35981440,36472072,36967144,37466676,37970688,38479200,38992232,39509804,40031936,40558648,41089960,41625892,42166464,42711696,43261608,43816220,44375552,44939624,45508456,46082068,46660480,47243712,47831784,48424716,49022528,49625240,50232872,50845444,51462976,52085488
mov $2,4
mov $3,$0
add $3,$0
lpb $0,1
sub $0,1
add $1,4
add $2,4
add $2,$3
add $2,$1
add $4,$2
add $4,$2
lpe
add $1,$4
|
; A173078: a(n) = (5*2^n - 2*(-1)^n - 9)/3.
; 1,3,11,23,51,103,211,423,851,1703,3411,6823,13651,27303,54611,109223,218451,436903,873811,1747623,3495251,6990503,13981011,27962023,55924051,111848103,223696211,447392423,894784851,1789569703,3579139411,7158278823,14316557651,28633115303,57266230611,114532461223,229064922451,458129844903,916259689811,1832519379623,3665038759251,7330077518503,14660155037011,29320310074023,58640620148051,117281240296103,234562480592211,469124961184423,938249922368851,1876499844737703,3752999689475411,7505999378950823
mov $1,2
pow $1,$0
mul $1,5
sub $1,5
div $1,3
mul $1,2
add $1,1
|
********************************************************************************
* Boot loader FD - Benoit Rousseau 05/11/2020
* ------------------------------------------------------------------------------
*
* Description
* -----------
* Animation de la palette: fondu vers une couleur cible PAL_TO
* Initialisation de la commutation de page pour l'espace Donnees (Mode registre)
* Chargement du code de Game Mode Engine en page 4 sur espace donnees
* Appel du Game Mode Engine
*
********************************************************************************
INCLUDE "./Engine/Macros.asm"
org $6200
PalInit
setdp $62
lda #$62
tfr a,dp * positionne la direct page a 62
PalFade
clr <pal_idx
ldx #pal_len * index limite de chargement pour couleur courante
ldu #pal_from * chargement pointeur valeur des couleurs actuelles
Vsync_1
tst $E7E7 * le faisceau n'est pas dans l'ecran utile
bpl Vsync_1 * tant que le bit est a 0 on boucle
Vsync_2
tst $E7E7 * le faisceau est dans l'ecran utile
bmi Vsync_2 * tant que le bit est a 1 on boucle
ldy #0320 * 40 lignes * 8 cycles
Tempo
leay -1,y
bne Tempo * tempo pour etre dans la bordure invisible
dec <pal_cycles * decremente le compteur du nombre de frame
beq InitVideo * si termine
PalRun
lda ,u * chargement de la composante verte et rouge
anda <pal_mask * on efface la valeur vert ou rouge par masque
ldb #$FF * composante verte et rouge couleur cible
andb <pal_mask * on efface la valeur vert ou rouge par masque
stb <pal_buffer * on stocke la valeur cible pour comparaison
ldb #$11 * preparation de la valeur d'increment de couleur
andb <pal_mask * on efface la valeur non utile par masque
stb <pal_buffer+1 * on stocke la valeur pour ADD ou SUB ulterieur
cmpa <pal_buffer * comparaison de la composante courante et cible
beq PalVRSuivante * si composante est egale a la cible on passe
bhi PalVRDec * si la composante est superieure on branche
lda ,u * on recharge la valeur avec vert et rouge
adda <pal_buffer+1 * on incremente la composante verte ou rouge
bra PalVRSave * on branche pour sauvegarder
PalVRDec
lda ,u * on recharge la valeur avec vert et rouge
suba <pal_buffer+1 * on decremente la composante verte ou rouge
PalVRSave
sta ,u * sauvegarde de la nouvelle valeur vert ou rouge
PalVRSuivante
com <pal_mask * inversion du masque pour traiter l'autre semioctet
bmi PalRun * si on traite $F0 on branche sinon on continue
SetPalBleu
ldb 1,u * chargement composante bleue courante
cmpb #$0F * comparaison composante courante et cible
beq SetPalNext * si composante est egale a la cible on passe
bhi SetPalBleudec * si la composante est superieure on branche
incb * on incremente la composante bleue
bra SetPalSaveBleu * on branche pour sauvegarder
SetPalBleudec
decb * on decremente la composante bleue
SetPalSaveBleu
stb 1,u * sauvegarde de la nouvelle valeur bleue
SetPalNext
lda <pal_idx * Lecture index couleur
sta $E7DB * selectionne l'indice de couleur a ecrire
adda #$02 * increment de l'indice de couleur (x2)
sta <pal_idx * stockage du nouvel index
lda ,u * chargement de la nouvelle couleur courante
sta $E7DA * positionne la nouvelle couleur (Vert et Rouge)
stb $E7DA * positionne la nouvelle couleur (Bleu)
lda <pal_idx * rechargement de l'index couleur
cmpa ,x * comparaison avec l'index limite pour cette couleur
bne SetPalNext * si inferieur on continue avec la meme couleur
leau 2,u * on avance le pointeur vers la nouvelle couleur
leax 1,x * on avance le pointeur vers la nouvelle limite
cmpx #end_pal_len * test de fin de liste
bne PalRun * on reboucle si fin de liste pas atteinte
bra PalFade
pal_buffer
fcb $42 * B et buffer de comparaison
fcb $41 * A et buffer de comparaison
fcb $53 * S
fcb $49 * I
fcb $43 * C
fcb $32 * 2
pal_idx
fcb $00 * index de la couleur courante dans le traitement
fcb $00 * espace reserve pour somme de controle
*-------------------------------------------------------------------------------
* A partir de ce point le code doit commencer a l'adresse $6280
*-------------------------------------------------------------------------------
********************************************************************************
* Initialisation du mode video
********************************************************************************
InitVideo
orcc #$50 * desactive les interruptions
lds #glb_system_stack * positionnement pile systeme
lda #$7B * passage en mode 160x200x16c
sta $E7DC
********************************************************************************
* Initialisation de la commutation de page pour l espace Donnees (Mode registre)
********************************************************************************
ldb $6081 * $6081 est l'image "lisible" de $E7E7
orb #$10 * positionne le bit d4 a 1
stb $6081 * maintient une image coherente de $E7E7
stb $E7E7 * bit d4 a 1 pour pages donnees en mode registre
ldb #$64 * bit7=0, bit6=1 : ecriture autorisee, bit5=1 : espace cartouche recouvert par de la RAM, bit4-0 : numero de page
stb $E7E6 * changement page 4 dans l'espace cartouche
********************************************************************************
* Lecture des donnees depuis la disquette et decompression par exomizer
********************************************************************************
DKLecture
setdp $60
lda #$60
tfr a,dp * positionne la direct page a 60
ldd #$0000
std <$604F * DK.BUF $0000 Destination des donnees lues
sta <$6049 * DK.DRV $00 Lecteur
std <$604A * DK.TRK $00 Piste
lda #$02
sta <$604C * DK.SEC $02 Secteur
sta <$6048 * DK.OPC $02 Operation - lecture d'un secteur
DKCO
jsr $E82A * DKCO Appel Moniteur - lecture d'un secteur
inc <$604C * increment du registre Moniteur DK.SEC
lda <$604C * chargement de DK.SEC
cmpa #$10 * si DK.SEC est inferieur ou egal a 16
bls DKContinue * on continue le traitement
lda #$01 * sinon on a depasse le secteur 16
sta <$604C * positionnement du secteur a 1
inc <$604B * increment du registre Moniteur DK.TRK
lda <$604B
cmpa #$4F * si DK.SEC est inferieur ou egal a 79
bls DKContinue * on continue le traitement
clr <$604B * positionnement de la piste a 0
inc <$6049 * increment du registre Moniteur DK.DRV
DKContinue
inc <$604F * increment de 256 octets de la zone a ecrire DK.BUF
ldd <$604F * chargement de la zone a ecrire DK.BUF
dk_dernier_bloc
cmpd #Build_BootLastBlock * test debut du dernier bloc de 256 octets a ecrire
bls DKCO * si DK.BUF inferieur ou egal a la limite alors DKCO
BOO_WaitVBL
tst $E7E7 ; le faisceau n'est pas dans l'ecran
bpl BOO_WaitVBL ; tant que le bit est a 0 on boucle
BOO_WaitVBL1
tst $E7E7 ; le faisceau est dans l'ecran
bmi BOO_WaitVBL1 ; tant que le bit est a 1 on boucle
* Positionnement de la page 3 a l'ecran et de la page 2 en zone A000-DFFF
***********************************************************
ldd #$C002 ; page 3, couleur de cadre 0 et page 2
sta $E7DD ; affiche la page a l'ecran
stb $E7E5 ; visible dans l'espace donnees
_ldd gmboot,$FF ; level to boot and flag for first level load
jmp $0000
* donnees pour le fondu de palette
********************************************************************************
pal_from
fdb $0000 * couleur $00 Noir (Thomson) => 06 change bordure
fdb $F00F * couleur $0C Turquoise (Bordure ecran)
fdb $FF0F * couleur $0E Blanc (TO8)
fdb $7707 * couleur $10 Gris (Fond Bas)
fdb $AA03 * couleur $16 Jaune (Interieur case)
fdb $330A * couleur $18 Mauve (Fond TO8)
pal_len
fcb $0C * pour chaque couleur on defini un index limite
fcb $0E * (exclu) de chargement. ex: 0C, 0E, ...
fcb $10 * la premiere couleur de PAL_FROM est chargee
fcb $16 * pour les couleurs 0(00) a 5(0A)
fcb $18 * la seconde couleur de PAL_FORM est chargee
fcb $20 * pour la couleur 6(0C)
end_pal_len
pal_cycles
fcb $10 * nombre de frames de la transition (VSYNC)
pal_mask
fcb $0F * masque pour l'aternance du traitemet vert/rouge |
// Copyright (c) 2019-2021 Intel Corporation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "mfx_common.h"
#if defined(MFX_ENABLE_H265_VIDEO_ENCODE)
#include "mfx_common_int.h"
#include "hevcehw_base_legacy.h"
#include "hevcehw_base_data.h"
#include "hevcehw_base_constraints.h"
#include "hevcehw_base_parser.h"
#include "fast_copy.h"
#include "mfx_common_int.h"
#include <algorithm>
#include <exception>
#include <iterator>
#include <numeric>
#include <set>
#include <cmath>
#include <iterator>
#include "libmfx_core.h"
using namespace HEVCEHW;
using namespace HEVCEHW::Base;
void Legacy::SetSupported(ParamSupport& blocks)
{
auto CopyRawBuffer = [](mfxU8* pSrcBuf, mfxU16 szSrcBuf, mfxU8* pDstBuf, mfxU16& szDstBuf)
{
bool bCopy = pSrcBuf && pDstBuf;
ThrowIf(bCopy && szSrcBuf > szDstBuf, MFX_ERR_NOT_ENOUGH_BUFFER);
if (bCopy)
{
std::copy_n(pSrcBuf, szSrcBuf, pDstBuf);
szDstBuf = szSrcBuf;
}
};
blocks.m_mvpCopySupported.emplace_back(
[](const mfxVideoParam* pSrc, mfxVideoParam* pDst) -> void
{
const auto& buf_src = *(const mfxVideoParam*)pSrc;
auto& buf_dst = *(mfxVideoParam*)pDst;
MFX_COPY_FIELD(IOPattern);
MFX_COPY_FIELD(Protected);
MFX_COPY_FIELD(AsyncDepth);
MFX_COPY_FIELD(mfx.CodecId);
MFX_COPY_FIELD(mfx.LowPower);
MFX_COPY_FIELD(mfx.CodecLevel);
MFX_COPY_FIELD(mfx.CodecProfile);
MFX_COPY_FIELD(mfx.TargetUsage);
MFX_COPY_FIELD(mfx.GopPicSize);
MFX_COPY_FIELD(mfx.GopRefDist);
MFX_COPY_FIELD(mfx.GopOptFlag);
MFX_COPY_FIELD(mfx.IdrInterval);
MFX_COPY_FIELD(mfx.BRCParamMultiplier);
MFX_COPY_FIELD(mfx.RateControlMethod);
MFX_COPY_FIELD(mfx.InitialDelayInKB);
MFX_COPY_FIELD(mfx.BufferSizeInKB);
MFX_COPY_FIELD(mfx.TargetKbps);
MFX_COPY_FIELD(mfx.MaxKbps);
MFX_COPY_FIELD(mfx.NumSlice);
MFX_COPY_FIELD(mfx.NumRefFrame);
MFX_COPY_FIELD(mfx.EncodedOrder);
MFX_COPY_FIELD(mfx.FrameInfo.Shift);
MFX_COPY_FIELD(mfx.FrameInfo.BitDepthLuma);
MFX_COPY_FIELD(mfx.FrameInfo.BitDepthChroma);
MFX_COPY_FIELD(mfx.FrameInfo.FourCC);
MFX_COPY_FIELD(mfx.FrameInfo.Width);
MFX_COPY_FIELD(mfx.FrameInfo.Height);
MFX_COPY_FIELD(mfx.FrameInfo.CropX);
MFX_COPY_FIELD(mfx.FrameInfo.CropY);
MFX_COPY_FIELD(mfx.FrameInfo.CropW);
MFX_COPY_FIELD(mfx.FrameInfo.CropH);
MFX_COPY_FIELD(mfx.FrameInfo.FrameRateExtN);
MFX_COPY_FIELD(mfx.FrameInfo.FrameRateExtD);
MFX_COPY_FIELD(mfx.FrameInfo.AspectRatioW);
MFX_COPY_FIELD(mfx.FrameInfo.AspectRatioH);
MFX_COPY_FIELD(mfx.FrameInfo.ChromaFormat);
MFX_COPY_FIELD(mfx.FrameInfo.PicStruct);
});
blocks.m_ebCopySupported[MFX_EXTBUFF_HEVC_PARAM].emplace_back(
[](const mfxExtBuffer* pSrc, mfxExtBuffer* pDst) -> void
{
const auto& buf_src = *(const mfxExtHEVCParam*)pSrc;
auto& buf_dst = *(mfxExtHEVCParam*)pDst;
MFX_COPY_FIELD(PicWidthInLumaSamples);
MFX_COPY_FIELD(PicHeightInLumaSamples);
MFX_COPY_FIELD(GeneralConstraintFlags);
MFX_COPY_FIELD(SampleAdaptiveOffset);
MFX_COPY_FIELD(LCUSize);
});
blocks.m_ebCopySupported[MFX_EXTBUFF_HEVC_TILES].emplace_back(
[](const mfxExtBuffer* pSrc, mfxExtBuffer* pDst) -> void
{
const auto& buf_src = *(const mfxExtHEVCTiles*)pSrc;
auto& buf_dst = *(mfxExtHEVCTiles*)pDst;
MFX_COPY_FIELD(NumTileRows);
MFX_COPY_FIELD(NumTileColumns);
});
blocks.m_ebCopySupported[MFX_EXTBUFF_AVC_REFLISTS].emplace_back(
[](const mfxExtBuffer* pSrc, mfxExtBuffer* pDst) -> void
{
const auto& buf_src = *(const mfxExtAVCRefLists*)pSrc;
auto& buf_dst = *(mfxExtAVCRefLists*)pDst;
MFX_COPY_FIELD(NumRefIdxL0Active);
MFX_COPY_FIELD(NumRefIdxL1Active);
for (mfxU32 i = 0; i < 16; i++)
{
MFX_COPY_FIELD(RefPicList0[i].FrameOrder);
MFX_COPY_FIELD(RefPicList1[i].FrameOrder);
}
});
blocks.m_ebCopySupported[MFX_EXTBUFF_CODING_OPTION].emplace_back(
[](const mfxExtBuffer* pSrc, mfxExtBuffer* pDst) -> void
{
const auto& buf_src = *(const mfxExtCodingOption*)pSrc;
auto& buf_dst = *(mfxExtCodingOption*)pDst;
MFX_COPY_FIELD(PicTimingSEI);
MFX_COPY_FIELD(VuiNalHrdParameters);
MFX_COPY_FIELD(NalHrdConformance);
MFX_COPY_FIELD(AUDelimiter);
});
blocks.m_ebCopySupported[MFX_EXTBUFF_CODING_OPTION2].emplace_back(
[](const mfxExtBuffer* pSrc, mfxExtBuffer* pDst) -> void
{
const auto& buf_src = *(const mfxExtCodingOption2*)pSrc;
auto& buf_dst = *(mfxExtCodingOption2*)pDst;
MFX_COPY_FIELD(IntRefType);
MFX_COPY_FIELD(IntRefCycleSize);
MFX_COPY_FIELD(IntRefQPDelta);
MFX_COPY_FIELD(MBBRC);
MFX_COPY_FIELD(BRefType);
MFX_COPY_FIELD(NumMbPerSlice);
MFX_COPY_FIELD(DisableDeblockingIdc);
MFX_COPY_FIELD(RepeatPPS);
MFX_COPY_FIELD(MaxSliceSize);
MFX_COPY_FIELD(ExtBRC);
MFX_COPY_FIELD(MinQPI);
MFX_COPY_FIELD(MaxQPI);
MFX_COPY_FIELD(MinQPP);
MFX_COPY_FIELD(MaxQPP);
MFX_COPY_FIELD(MinQPB);
MFX_COPY_FIELD(MaxQPB);
MFX_COPY_FIELD(SkipFrame);
});
blocks.m_ebCopySupported[MFX_EXTBUFF_CODING_OPTION3].emplace_back(
[](const mfxExtBuffer* pSrc, mfxExtBuffer* pDst) -> void
{
const auto& buf_src = *(const mfxExtCodingOption3*)pSrc;
auto& buf_dst = *(mfxExtCodingOption3*)pDst;
MFX_COPY_FIELD(PRefType);
MFX_COPY_FIELD(IntRefCycleDist);
MFX_COPY_FIELD(EnableQPOffset);
MFX_COPY_FIELD(GPB);
MFX_COPY_ARRAY_FIELD(QPOffset);
MFX_COPY_ARRAY_FIELD(NumRefActiveP);
MFX_COPY_ARRAY_FIELD(NumRefActiveBL0);
MFX_COPY_ARRAY_FIELD(NumRefActiveBL1);
MFX_COPY_FIELD(QVBRQuality);
MFX_COPY_FIELD(EnableMBQP);
MFX_COPY_FIELD(TransformSkip);
MFX_COPY_FIELD(TargetChromaFormatPlus1);
MFX_COPY_FIELD(TargetBitDepthLuma);
MFX_COPY_FIELD(TargetBitDepthChroma);
MFX_COPY_FIELD(WinBRCMaxAvgKbps);
MFX_COPY_FIELD(WinBRCSize);
MFX_COPY_FIELD(EnableNalUnitType);
MFX_COPY_FIELD(LowDelayBRC);
MFX_COPY_FIELD(BRCPanicMode);
MFX_COPY_FIELD(ScenarioInfo);
MFX_COPY_FIELD(AdaptiveCQM);
});
blocks.m_ebCopyPtrs[MFX_EXTBUFF_CODING_OPTION_SPSPPS].emplace_back(
[&](const mfxExtBuffer* pSrc, mfxExtBuffer* pDst) -> void
{
const auto& buf_src = *(const mfxExtCodingOptionSPSPPS*)pSrc;
auto& buf_dst = *(mfxExtCodingOptionSPSPPS*)pDst;
MFX_COPY_FIELD(SPSBuffer);
MFX_COPY_FIELD(SPSBufSize);
MFX_COPY_FIELD(PPSBuffer);
MFX_COPY_FIELD(PPSBufSize);
});
blocks.m_ebCopySupported[MFX_EXTBUFF_CODING_OPTION_SPSPPS].emplace_back(
[&](const mfxExtBuffer* pSrc, mfxExtBuffer* pDst) -> void
{
const auto& buf_src = *(const mfxExtCodingOptionSPSPPS*)pSrc;
auto& buf_dst = *(mfxExtCodingOptionSPSPPS*)pDst;
CopyRawBuffer(buf_src.SPSBuffer, buf_src.SPSBufSize, buf_dst.SPSBuffer, buf_dst.SPSBufSize);
CopyRawBuffer(buf_src.PPSBuffer, buf_src.PPSBufSize, buf_dst.PPSBuffer, buf_dst.PPSBufSize);
});
blocks.m_ebCopySupported[MFX_EXTBUFF_AVC_REFLIST_CTRL].emplace_back(
[](const mfxExtBuffer* pSrc, mfxExtBuffer* pDst) -> void
{
const auto& buf_src = *(const mfxExtAVCRefListCtrl*)pSrc;
auto& buf_dst = *(mfxExtAVCRefListCtrl*)pDst;
MFX_COPY_FIELD(NumRefIdxL0Active);
MFX_COPY_FIELD(NumRefIdxL1Active);
for (mfxU32 i = 0; i < 16; i++)
{
MFX_COPY_FIELD(PreferredRefList[i].FrameOrder);
MFX_COPY_FIELD(RejectedRefList[i].FrameOrder);
MFX_COPY_FIELD(LongTermRefList[i].FrameOrder);
}
});
blocks.m_ebCopySupported[MFX_EXTBUFF_AVC_TEMPORAL_LAYERS].emplace_back(
[](const mfxExtBuffer* pSrc, mfxExtBuffer* pDst) -> void
{
const auto& buf_src = *(const mfxExtAvcTemporalLayers*)pSrc;
auto& buf_dst = *(mfxExtAvcTemporalLayers*)pDst;
for (mfxU32 i = 0; i < 7; i++)
{
MFX_COPY_FIELD(Layer[i].Scale);
}
});
blocks.m_ebCopySupported[MFX_EXTBUFF_ENCODER_RESET_OPTION].emplace_back(
[](const mfxExtBuffer* pSrc, mfxExtBuffer* pDst) -> void
{
const auto& buf_src = *(const mfxExtEncoderResetOption*)pSrc;
auto& buf_dst = *(mfxExtEncoderResetOption*)pDst;
MFX_COPY_FIELD(StartNewSequence);
});
blocks.m_ebCopyPtrs[MFX_EXTBUFF_CODING_OPTION_VPS].emplace_back(
[&](const mfxExtBuffer* pSrc, mfxExtBuffer* pDst) -> void
{
const auto& buf_src = *(const mfxExtCodingOptionVPS*)pSrc;
auto& buf_dst = *(mfxExtCodingOptionVPS*)pDst;
MFX_COPY_FIELD(VPSBuffer);
MFX_COPY_FIELD(VPSBufSize);
});
blocks.m_ebCopySupported[MFX_EXTBUFF_CODING_OPTION_VPS].emplace_back(
[&](const mfxExtBuffer* pSrc, mfxExtBuffer* pDst) -> void
{
const auto& buf_src = *(const mfxExtCodingOptionVPS*)pSrc;
auto& buf_dst = *(mfxExtCodingOptionVPS*)pDst;
CopyRawBuffer(buf_src.VPSBuffer, buf_src.VPSBufSize, buf_dst.VPSBuffer, buf_dst.VPSBufSize);
});
blocks.m_ebCopySupported[MFX_EXTBUFF_VIDEO_SIGNAL_INFO].emplace_back(
[](const mfxExtBuffer* pSrc, mfxExtBuffer* pDst) -> void
{
const auto& buf_src = *(const mfxExtVideoSignalInfo*)pSrc;
auto& buf_dst = *(mfxExtVideoSignalInfo*)pDst;
buf_dst = buf_src;
});
blocks.m_ebCopySupported[MFX_EXTBUFF_MBQP].emplace_back(
[](const mfxExtBuffer* pSrc, mfxExtBuffer* pDst) -> void
{
const auto& buf_src = *(const mfxExtMBQP*)pSrc;
auto& buf_dst = *(mfxExtMBQP*)pDst;
MFX_COPY_FIELD(NumQPAlloc);
MFX_COPY_FIELD(QP);
});
blocks.m_ebCopySupported[MFX_EXTBUFF_ALLOCATION_HINTS].emplace_back(
[](const mfxExtBuffer*, mfxExtBuffer*) -> void
{
/* Just allow this buffer to be present at Init */
});
}
bool Legacy::IsTCBRC(const mfxVideoParam& par, mfxU16 tcbrcSupport)
{
const mfxExtCodingOption3& CO3 = ExtBuffer::Get(par);
const mfxExtCodingOption& CO = ExtBuffer::Get(par);
return (IsOn(CO3.LowDelayBRC) && tcbrcSupport && IsOff(CO.NalHrdConformance) &&
(par.mfx.RateControlMethod == MFX_RATECONTROL_VBR ||
par.mfx.RateControlMethod == MFX_RATECONTROL_QVBR ||
par.mfx.RateControlMethod == MFX_RATECONTROL_VCM ));
}
void Legacy::SetInherited(ParamInheritance& par)
{
par.m_mvpInheritDefault.emplace_back(
[](const mfxVideoParam* pSrc, mfxVideoParam* pDst)
{
auto& parInit = *pSrc;
auto& parReset = *pDst;
#define INHERIT_OPT(OPT) InheritOption(parInit.OPT, parReset.OPT)
#define INHERIT_BRC(OPT) { OPT tmp(parReset.mfx); InheritOption(OPT(parInit.mfx), tmp); }
INHERIT_OPT(AsyncDepth);
//INHERIT_OPT(mfx.BRCParamMultiplier);
INHERIT_OPT(mfx.LowPower);
INHERIT_OPT(mfx.CodecId);
INHERIT_OPT(mfx.CodecProfile);
INHERIT_OPT(mfx.CodecLevel);
INHERIT_OPT(mfx.NumThread);
INHERIT_OPT(mfx.TargetUsage);
INHERIT_OPT(mfx.GopPicSize);
INHERIT_OPT(mfx.GopRefDist);
INHERIT_OPT(mfx.GopOptFlag);
INHERIT_OPT(mfx.IdrInterval);
INHERIT_OPT(mfx.RateControlMethod);
INHERIT_OPT(mfx.BufferSizeInKB);
INHERIT_OPT(mfx.NumSlice);
INHERIT_OPT(mfx.NumRefFrame);
mfxU16 RC = parInit.mfx.RateControlMethod
* (parInit.mfx.RateControlMethod == parReset.mfx.RateControlMethod);
static const std::map<
mfxU16 , std::function<void(const mfxVideoParam&, mfxVideoParam&)>
> InheritBrcOpt =
{
{
mfxU16(MFX_RATECONTROL_CBR)
, [](const mfxVideoParam& parInit, mfxVideoParam& parReset)
{
INHERIT_BRC(InitialDelayInKB);
INHERIT_BRC(TargetKbps);
}
}
, {
mfxU16(MFX_RATECONTROL_VBR)
, [](const mfxVideoParam& parInit, mfxVideoParam& parReset)
{
INHERIT_BRC(InitialDelayInKB);
INHERIT_BRC(TargetKbps);
INHERIT_BRC(MaxKbps);
}
}
, {
mfxU16(MFX_RATECONTROL_CQP)
, [](const mfxVideoParam& parInit, mfxVideoParam& parReset)
{
INHERIT_OPT(mfx.QPI);
INHERIT_OPT(mfx.QPP);
INHERIT_OPT(mfx.QPB);
}
}
, {
mfxU16(MFX_RATECONTROL_ICQ)
, [](const mfxVideoParam& parInit, mfxVideoParam& parReset)
{
INHERIT_OPT(mfx.ICQQuality);
}
}
, {
mfxU16(MFX_RATECONTROL_LA_ICQ)
, [](const mfxVideoParam& parInit, mfxVideoParam& parReset)
{
INHERIT_OPT(mfx.ICQQuality);
}
}
, {
mfxU16(MFX_RATECONTROL_VCM)
, [](const mfxVideoParam& parInit, mfxVideoParam& parReset)
{
INHERIT_BRC(InitialDelayInKB);
INHERIT_BRC(TargetKbps);
INHERIT_BRC(MaxKbps);
}
}
, {
mfxU16(MFX_RATECONTROL_QVBR)
, [](const mfxVideoParam& parInit, mfxVideoParam& parReset)
{
INHERIT_BRC(InitialDelayInKB);
INHERIT_BRC(TargetKbps);
INHERIT_BRC(MaxKbps);
}
}
};
auto itInheritBrcOpt = InheritBrcOpt.find(RC);
if (itInheritBrcOpt != InheritBrcOpt.end())
itInheritBrcOpt->second(parInit, parReset);
INHERIT_OPT(mfx.FrameInfo.FourCC);
INHERIT_OPT(mfx.FrameInfo.Width);
INHERIT_OPT(mfx.FrameInfo.Height);
INHERIT_OPT(mfx.FrameInfo.CropX);
INHERIT_OPT(mfx.FrameInfo.CropY);
INHERIT_OPT(mfx.FrameInfo.CropW);
INHERIT_OPT(mfx.FrameInfo.CropH);
INHERIT_OPT(mfx.FrameInfo.FrameRateExtN);
INHERIT_OPT(mfx.FrameInfo.FrameRateExtD);
INHERIT_OPT(mfx.FrameInfo.AspectRatioW);
INHERIT_OPT(mfx.FrameInfo.AspectRatioH);
#undef INHERIT_OPT
#undef INHERIT_BRC
});
#define INIT_EB(TYPE)\
if (!pSrc || !pDst) return;\
auto& ebInit = *(TYPE*)pSrc;\
auto& ebReset = *(TYPE*)pDst;
#define INHERIT_OPT(OPT) InheritOption(ebInit.OPT, ebReset.OPT);
par.m_ebInheritDefault[MFX_EXTBUFF_HEVC_PARAM].emplace_back(
[](const mfxVideoParam& /*parInit*/
, const mfxExtBuffer* pSrc
, const mfxVideoParam& /*parReset*/
, mfxExtBuffer* pDst)
{
INIT_EB(mfxExtHEVCParam);
INHERIT_OPT(GeneralConstraintFlags);
INHERIT_OPT(SampleAdaptiveOffset);
INHERIT_OPT(LCUSize);
});
par.m_ebInheritDefault[MFX_EXTBUFF_HEVC_TILES].emplace_back(
[](const mfxVideoParam& /*parInit*/
, const mfxExtBuffer* pSrc
, const mfxVideoParam& /*parReset*/
, mfxExtBuffer* pDst)
{
INIT_EB(mfxExtHEVCTiles);
INHERIT_OPT(NumTileColumns);
INHERIT_OPT(NumTileRows);
});
par.m_ebInheritDefault[MFX_EXTBUFF_CODING_OPTION].emplace_back(
[](const mfxVideoParam& /*parInit*/
, const mfxExtBuffer* pSrc
, const mfxVideoParam& /*parReset*/
, mfxExtBuffer* pDst)
{
INIT_EB(mfxExtCodingOption);
INHERIT_OPT(VuiNalHrdParameters);
INHERIT_OPT(NalHrdConformance);
INHERIT_OPT(PicTimingSEI);
});
par.m_ebInheritDefault[MFX_EXTBUFF_CODING_OPTION2].emplace_back(
[](const mfxVideoParam& /*parInit*/
, const mfxExtBuffer* pSrc
, const mfxVideoParam& /*parReset*/
, mfxExtBuffer* pDst)
{
INIT_EB(mfxExtCodingOption2);
INHERIT_OPT(IntRefType);
INHERIT_OPT(IntRefCycleSize);
INHERIT_OPT(IntRefQPDelta);
INHERIT_OPT(MBBRC);
INHERIT_OPT(BRefType);
INHERIT_OPT(NumMbPerSlice);
INHERIT_OPT(MinQPI);
INHERIT_OPT(MinQPP);
INHERIT_OPT(MinQPB);
INHERIT_OPT(MaxQPI);
INHERIT_OPT(MaxQPP);
INHERIT_OPT(MaxQPB);
});
par.m_ebInheritDefault[MFX_EXTBUFF_CODING_OPTION3].emplace_back(
[this](const mfxVideoParam& parInit
, const mfxExtBuffer* pSrc
, const mfxVideoParam& parReset
, mfxExtBuffer* pDst)
{
INIT_EB(mfxExtCodingOption3);
INHERIT_OPT(LowDelayBRC);
INHERIT_OPT(IntRefCycleDist);
INHERIT_OPT(PRefType);
INHERIT_OPT(GPB);
INHERIT_OPT(TransformSkip);
INHERIT_OPT(TargetChromaFormatPlus1);
INHERIT_OPT(TargetBitDepthLuma);
INHERIT_OPT(TargetBitDepthChroma);
INHERIT_OPT(WinBRCMaxAvgKbps);
INHERIT_OPT(WinBRCSize);
INHERIT_OPT(EnableMBQP);
INHERIT_OPT(ScenarioInfo);
INHERIT_OPT(AdaptiveCQM);
mfxU16 RC = parInit.mfx.RateControlMethod
* (parInit.mfx.RateControlMethod == parReset.mfx.RateControlMethod);
if (RC == MFX_RATECONTROL_QVBR)
INHERIT_OPT(QVBRQuality);
if (parInit.mfx.TargetUsage != parReset.mfx.TargetUsage)
{
auto maxRef = m_GetMaxRef(parReset);
auto ClipRefP = [maxRef](mfxU16 ref) { return std::min<mfxU16>(ref, std::get<P>(maxRef)); };
auto ClipRefBL0 = [maxRef](mfxU16 ref) { return std::min<mfxU16>(ref, std::get<BL0>(maxRef)); };
auto ClipRefBL1 = [maxRef](mfxU16 ref) { return std::min<mfxU16>(ref, std::get<BL1>(maxRef)); };
std::transform(ebInit.NumRefActiveP, ebInit.NumRefActiveP + 8, ebReset.NumRefActiveP, ClipRefP);
std::transform(ebInit.NumRefActiveBL0, ebInit.NumRefActiveBL0 + 8, ebReset.NumRefActiveBL0, ClipRefBL0);
std::transform(ebInit.NumRefActiveBL1, ebInit.NumRefActiveBL1 + 8, ebReset.NumRefActiveBL1, ClipRefBL1);
}
else
{
InheritOptions(ebInit.NumRefActiveP, ebInit.NumRefActiveP + 8, ebReset.NumRefActiveP);
InheritOptions(ebInit.NumRefActiveBL0, ebInit.NumRefActiveBL0 + 8, ebReset.NumRefActiveBL0);
InheritOptions(ebInit.NumRefActiveBL1, ebInit.NumRefActiveBL1 + 8, ebReset.NumRefActiveBL1);
}
});
par.m_ebInheritDefault[MFX_EXTBUFF_VIDEO_SIGNAL_INFO].emplace_back(
[](const mfxVideoParam& /*parInit*/
, const mfxExtBuffer* pSrc
, const mfxVideoParam& /*parReset*/
, mfxExtBuffer* pDst)
{
INIT_EB(mfxExtVideoSignalInfo);
INHERIT_OPT(VideoFormat);
INHERIT_OPT(ColourPrimaries);
INHERIT_OPT(TransferCharacteristics);
INHERIT_OPT(MatrixCoefficients);
INHERIT_OPT(VideoFullRange);
INHERIT_OPT(ColourDescriptionPresent);
});
#undef INIT_EB
#undef INHERIT_OPT
}
void Legacy::Query0(const FeatureBlocks& blocks, TPushQ0 Push)
{
using namespace std::placeholders;
Push( BLK_Query0, std::bind(&Legacy::CheckQuery0, this, std::cref(blocks), _1));
}
void Legacy::Query1NoCaps(const FeatureBlocks& blocks, TPushQ1 Push)
{
Push(BLK_SetDefaultsCallChain,
[this](const mfxVideoParam&, mfxVideoParam&, StorageRW& strg) -> mfxStatus
{
auto& defaults = Glob::Defaults::GetOrConstruct(strg);
auto& bSet = defaults.SetForFeature[GetID()];
MFX_CHECK(!bSet, MFX_ERR_NONE);
PushDefaults(defaults);
VideoCORE * pCore = &Glob::VideoCore::Get(strg);
defaults.RunFastCopyWrapper.Push([pCore](Defaults::TRunFastCopyWrapper::TExt
, mfxFrameSurface1 &surfDst
, mfxU16 dstMemType
, mfxFrameSurface1 &surfSrc
, mfxU16 srcMemType) -> mfxStatus
{
return pCore->DoFastCopyWrapper(&surfDst, dstMemType, &surfSrc, srcMemType);
});
bSet = true;
m_pQNCDefaults = &defaults;
m_hw = Glob::VideoCore::Get(strg).GetHWType();
return MFX_ERR_NONE;
});
Push(BLK_PreCheckCodecId,
[this](const mfxVideoParam& in, mfxVideoParam&, StorageRW& /*strg*/) -> mfxStatus
{
return m_pQNCDefaults->PreCheckCodecId(in);
});
Push(BLK_PreCheckChromaFormat,
[this](const mfxVideoParam& in, mfxVideoParam&, StorageW&) -> mfxStatus
{
return m_pQNCDefaults->PreCheckChromaFormat(in);
});
Push(BLK_PreCheckExtBuffers
, [this, &blocks](const mfxVideoParam& in, mfxVideoParam& out, StorageW&) -> mfxStatus
{
return CheckBuffers(blocks, in, &out);
});
Push(BLK_CopyConfigurable
, [this, &blocks](const mfxVideoParam& in, mfxVideoParam& out, StorageW&) -> mfxStatus
{
return CopyConfigurable(blocks, in, out);
});
Push(BLK_SetLowPowerDefault
, [this](const mfxVideoParam&, mfxVideoParam& out, StorageW& /*strg*/) -> mfxStatus
{
auto lowPower = m_pQNCDefaults->GetLowPower(out, m_hw);
bool bChanged = out.mfx.LowPower && out.mfx.LowPower != lowPower;
out.mfx.LowPower = lowPower;
MFX_CHECK(!bChanged, MFX_WRN_INCOMPATIBLE_VIDEO_PARAM);
return MFX_ERR_NONE;
});
Push(BLK_SetGUID
, [](const mfxVideoParam&, mfxVideoParam& out, StorageRW& strg) -> mfxStatus
{
MFX_CHECK(!strg.Contains(Glob::GUID::Key), MFX_ERR_NONE);
if (strg.Contains(Glob::RealState::Key))
{
//don't change GUID in Reset
auto& initPar = Glob::RealState::Get(strg);
strg.Insert(Glob::GUID::Key, make_storable<GUID>(Glob::GUID::Get(initPar)));
return MFX_ERR_NONE;
}
VideoCORE& core = Glob::VideoCore::Get(strg);
auto pGUID = make_storable<GUID>();
auto& defaults = Glob::Defaults::Get(strg);
EncodeCapsHevc fakeCaps;
Defaults::Param defPar(out, fakeCaps, core.GetHWType(), defaults);
fakeCaps.MaxEncodedBitDepth = true;
fakeCaps.YUV422ReconSupport = !IsOn(out.mfx.LowPower);
fakeCaps.YUV444ReconSupport = true;
MFX_CHECK(defaults.GetGUID(defPar, *pGUID), MFX_ERR_NONE);
strg.Insert(Glob::GUID::Key, std::move(pGUID));
return MFX_ERR_NONE;
});
}
void Legacy::Query1WithCaps(const FeatureBlocks& /*blocks*/, TPushQ1 Push)
{
Push(BLK_CheckHeaders
, [this](const mfxVideoParam&, mfxVideoParam& out, StorageW& strg) -> mfxStatus
{
mfxStatus sts = MFX_ERR_NONE;
m_pQWCDefaults.reset(
new Defaults::Param(
out
, Glob::EncodeCaps::Get(strg)
, Glob::VideoCore::Get(strg).GetHWType()
, Glob::Defaults::Get(strg)));
if (strg.Contains(Glob::SPS::Key))
sts = CheckSPS(Glob::SPS::Get(strg), m_pQWCDefaults->caps, m_pQWCDefaults->hw);
if (!sts && strg.Contains(Glob::PPS::Key))
sts = CheckPPS(Glob::PPS::Get(strg), m_pQWCDefaults->caps, m_pQWCDefaults->hw);
return sts;
});
Push(BLK_CheckLCUSize
, [this](const mfxVideoParam&, mfxVideoParam& out, StorageW& ) -> mfxStatus
{
return m_pQWCDefaults->base.CheckLCUSize(*m_pQWCDefaults, out);
});
Push(BLK_CheckFormat
, [this](const mfxVideoParam&, mfxVideoParam& out, StorageW&) -> mfxStatus
{
auto sts = m_pQWCDefaults->base.CheckFourCC(*m_pQWCDefaults, out);
MFX_CHECK_STS(sts);
sts = m_pQWCDefaults->base.CheckInputFormatByFourCC(*m_pQWCDefaults, out);
MFX_CHECK_STS(sts);
sts = m_pQWCDefaults->base.CheckTargetChromaFormat(*m_pQWCDefaults, out);
MFX_CHECK_STS(sts);
sts = m_pQWCDefaults->base.CheckTargetBitDepth(*m_pQWCDefaults, out);
MFX_CHECK_STS(sts);
return m_pQWCDefaults->base.CheckFourCCByTargetFormat(*m_pQWCDefaults, out);
});
Push(BLK_CheckLowDelayBRC
, [this](const mfxVideoParam&, mfxVideoParam& out, StorageW&) -> mfxStatus
{
return m_pQWCDefaults->base.CheckLowDelayBRC(*m_pQWCDefaults, out);
});
Push(BLK_CheckLevel
, [this](const mfxVideoParam&, mfxVideoParam& out, StorageW&) -> mfxStatus
{
return m_pQWCDefaults->base.CheckLevel(*m_pQWCDefaults, out);
});
Push(BLK_CheckSurfSize
, [this](const mfxVideoParam&, mfxVideoParam& out, StorageW&) -> mfxStatus
{
return m_pQWCDefaults->base.CheckSurfSize(*m_pQWCDefaults, out);
});
Push(BLK_CheckCodedPicSize
, [this](const mfxVideoParam&, mfxVideoParam& out, StorageW&) -> mfxStatus
{
return CheckCodedPicSize(out, *m_pQWCDefaults);
});
Push(BLK_CheckTiles
, [this](const mfxVideoParam&, mfxVideoParam& out, StorageW&) -> mfxStatus
{
return CheckTiles(out, *m_pQWCDefaults);
});
Push(BLK_CheckTU
, [this](const mfxVideoParam&, mfxVideoParam& out, StorageW&) -> mfxStatus
{
return CheckTU(out, m_pQWCDefaults->caps);
});
Push(BLK_CheckTemporalLayers
, [this](const mfxVideoParam&, mfxVideoParam& out, StorageW&) -> mfxStatus
{
return CheckTemporalLayers(out);
});
Push(BLK_CheckGopRefDist
, [this](const mfxVideoParam&, mfxVideoParam& out, StorageW&) -> mfxStatus
{
return CheckGopRefDist(out, m_pQWCDefaults->caps);
});
Push(BLK_CheckNumRefFrame
, [this](const mfxVideoParam&, mfxVideoParam& out, StorageW&) -> mfxStatus
{
return CheckNumRefFrame(out, *m_pQWCDefaults);
});
Push(BLK_CheckIOPattern
, [this](const mfxVideoParam&, mfxVideoParam& out, StorageW&) -> mfxStatus
{
return CheckIOPattern(out);
});
Push(BLK_CheckBRC
, [this](const mfxVideoParam&, mfxVideoParam& out, StorageW&) -> mfxStatus
{
return CheckBRC(out, *m_pQWCDefaults);
});
Push(BLK_CheckCrops
, [this](const mfxVideoParam&, mfxVideoParam& out, StorageW&) -> mfxStatus
{
return CheckCrops(out, *m_pQWCDefaults);
});
Push(BLK_CheckShift
, [this](const mfxVideoParam&, mfxVideoParam& out, StorageW&) -> mfxStatus
{
return CheckShift(out);
});
Push(BLK_CheckFrameRate
, [this](const mfxVideoParam&, mfxVideoParam& out, StorageW&) -> mfxStatus
{
return CheckFrameRate(out);
});
Push(BLK_CheckSlices
, [this](const mfxVideoParam&, mfxVideoParam& out, StorageW&) -> mfxStatus
{
return m_pQWCDefaults->base.CheckSlices(*m_pQWCDefaults, out);
});
Push(BLK_CheckBPyramid
, [this](const mfxVideoParam&, mfxVideoParam& out, StorageW&) -> mfxStatus
{
return CheckBPyramid(out, *m_pQWCDefaults);
});
Push(BLK_CheckPPyramid
, [this](const mfxVideoParam&, mfxVideoParam& out, StorageW&) -> mfxStatus
{
return CheckPPyramid(out);
});
Push(BLK_CheckIntraRefresh
, [this](const mfxVideoParam&, mfxVideoParam& out, StorageW&) -> mfxStatus
{
return CheckIntraRefresh(out, *m_pQWCDefaults);
});
Push(BLK_CheckSkipFrame
, [this](const mfxVideoParam&, mfxVideoParam& out, StorageW&) -> mfxStatus
{
return CheckSkipFrame(out);
});
Push(BLK_CheckGPB
, [this](const mfxVideoParam&, mfxVideoParam& out, StorageW&) -> mfxStatus
{
return CheckGPB(out);
});
Push(BLK_CheckESPackParam
, [this](const mfxVideoParam&, mfxVideoParam& out, StorageW&) -> mfxStatus
{
return CheckESPackParam(out, m_pQWCDefaults->hw);
});
Push(BLK_CheckNumRefActive
, [this](const mfxVideoParam&, mfxVideoParam& out, StorageW&) -> mfxStatus
{
return m_pQWCDefaults->base.CheckNumRefActive(*m_pQWCDefaults, out);
});
Push(BLK_CheckSAO
, [this](const mfxVideoParam&, mfxVideoParam& out, StorageW&) -> mfxStatus
{
return m_pQWCDefaults->base.CheckSAO(*m_pQWCDefaults, out);
});
Push(BLK_CheckProfile
, [this](const mfxVideoParam&, mfxVideoParam& out, StorageW&) -> mfxStatus
{
return m_pQWCDefaults->base.CheckProfile(*m_pQWCDefaults, out);
});
Push(BLK_CheckLevelConstraints
, [this](const mfxVideoParam&, mfxVideoParam& out, StorageW&) -> mfxStatus
{
return CheckLevelConstraints(out, *m_pQWCDefaults);
});
}
void Legacy::QueryIOSurf(const FeatureBlocks& blocks, TPushQIS Push)
{
Push(BLK_CheckIOPattern
, [](const mfxVideoParam& par, mfxFrameAllocRequest&, StorageRW&) -> mfxStatus
{
bool check_result = Check<mfxU16
, MFX_IOPATTERN_IN_VIDEO_MEMORY
, MFX_IOPATTERN_IN_SYSTEM_MEMORY>
(par.IOPattern);
MFX_CHECK(!check_result, MFX_ERR_INVALID_VIDEO_PARAM);
return MFX_ERR_NONE;
});
Push(BLK_CheckVideoParam
, [&blocks](const mfxVideoParam& par, mfxFrameAllocRequest&, StorageRW& strg) -> mfxStatus
{
mfxStatus sts = MFX_ERR_NONE;
auto pTmpPar = make_storable<ExtBuffer::Param<mfxVideoParam>>(par);
auto& queryNC = FeatureBlocks::BQ<FeatureBlocks::BQ_Query1NoCaps>::Get(blocks);
sts = RunBlocks(CheckGE<mfxStatus, MFX_ERR_NONE>, queryNC, par, *pTmpPar, strg);
MFX_CHECK(sts != MFX_ERR_UNSUPPORTED, MFX_ERR_INVALID_VIDEO_PARAM);
MFX_CHECK(sts >= MFX_ERR_NONE, sts);
auto& queryWC = FeatureBlocks::BQ<FeatureBlocks::BQ_Query1WithCaps>::Get(blocks);
sts = RunBlocks(CheckGE<mfxStatus, MFX_ERR_NONE>, queryWC, par, *pTmpPar, strg);
MFX_CHECK(sts != MFX_ERR_UNSUPPORTED, MFX_ERR_INVALID_VIDEO_PARAM);
MFX_CHECK(sts >= MFX_ERR_NONE, sts);
strg.Insert(Glob::VideoParam::Key, std::move(pTmpPar));
return MFX_ERR_NONE;
});
Push(BLK_SetDefaults
, [&blocks](const mfxVideoParam&, mfxFrameAllocRequest&, StorageRW& strg) -> mfxStatus
{
ExtBuffer::Param<mfxVideoParam>& par = Glob::VideoParam::Get(strg);
StorageRW local;
auto& qSD = FeatureBlocks::BQ<FeatureBlocks::BQ_SetDefaults>::Get(blocks);
return RunBlocks(IgnoreSts, qSD, par, strg, local);
});
Push(BLK_SetFrameAllocRequest
, [this](const mfxVideoParam&, mfxFrameAllocRequest& req, StorageRW& strg) -> mfxStatus
{
ExtBuffer::Param<mfxVideoParam>& par = Glob::VideoParam::Get(strg);
auto fourCC = par.mfx.FrameInfo.FourCC;
req.Info = par.mfx.FrameInfo;
SetDefault(req.Info.Shift, (fourCC == MFX_FOURCC_P010 || fourCC == MFX_FOURCC_Y210));
bool bSYS = par.IOPattern == MFX_IOPATTERN_IN_SYSTEM_MEMORY;
bool bVID = par.IOPattern == MFX_IOPATTERN_IN_VIDEO_MEMORY;
req.Type =
bSYS * (MFX_MEMTYPE_FROM_ENCODE | MFX_MEMTYPE_SYSTEM_MEMORY | MFX_MEMTYPE_EXTERNAL_FRAME)
+ bVID * (MFX_MEMTYPE_FROM_ENCODE | MFX_MEMTYPE_DXVA2_DECODER_TARGET | MFX_MEMTYPE_EXTERNAL_FRAME);
MFX_CHECK(req.Type, MFX_ERR_INVALID_VIDEO_PARAM);
req.NumFrameMin = GetMaxRaw(par);
req.NumFrameSuggested = req.NumFrameMin;
return MFX_ERR_NONE;
});
}
void Legacy::SetDefaults(const FeatureBlocks& /*blocks*/, TPushSD Push)
{
Push(BLK_SetDefaults
, [this](mfxVideoParam& par, StorageW& strg, StorageRW&)
{
auto& core = Glob::VideoCore::Get(strg);
auto& caps = Glob::EncodeCaps::Get(strg);
auto& defchain = Glob::Defaults::Get(strg);
SetDefaults(par, Defaults::Param(par, caps, core.GetHWType(), defchain), core.IsExternalFrameAllocator());
});
}
void Legacy::InitExternal(const FeatureBlocks& blocks, TPushIE Push)
{
Push(BLK_SetGUID
, [&blocks](const mfxVideoParam& in, StorageRW& strg, StorageRW&) -> mfxStatus
{
const auto& query = FeatureBlocks::BQ<FeatureBlocks::BQ_Query1NoCaps>::Get(blocks);
mfxStatus sts = MFX_ERR_NONE;
auto pPar = make_storable<ExtBuffer::Param<mfxVideoParam>>(in);
ExtBuffer::Param<mfxVideoParam>& par = *pPar;
sts = RunBlocks(CheckGE<mfxStatus, MFX_ERR_NONE>, query, in, par, strg);
MFX_CHECK(sts != MFX_ERR_UNSUPPORTED, MFX_ERR_INVALID_VIDEO_PARAM);
MFX_CHECK(sts >= MFX_ERR_NONE, sts);
strg.Insert(Glob::VideoParam::Key, std::move(pPar));
return sts;
});
Push(BLK_CheckVideoParam
, [&blocks](const mfxVideoParam& in, StorageRW& strg, StorageRW&) -> mfxStatus
{
const auto& query = FeatureBlocks::BQ<FeatureBlocks::BQ_Query1WithCaps>::Get(blocks);
mfxStatus sts = MFX_ERR_NONE;
ExtBuffer::Param<mfxVideoParam>& par = Glob::VideoParam::Get(strg);
sts = RunBlocks(CheckGE<mfxStatus, MFX_ERR_NONE>, query, in, par, strg);
MFX_CHECK(sts != MFX_ERR_UNSUPPORTED, MFX_ERR_INVALID_VIDEO_PARAM);
MFX_CHECK(sts >= MFX_ERR_NONE, sts);
MFX_CHECK(in.mfx.FrameInfo.Width == par.mfx.FrameInfo.Width
&& in.mfx.FrameInfo.Height == par.mfx.FrameInfo.Height, MFX_ERR_INVALID_VIDEO_PARAM);
return sts;
});
Push(BLK_SetDefaults
, [&blocks](const mfxVideoParam&, StorageRW& strg, StorageRW& local) -> mfxStatus
{
auto& par = Glob::VideoParam::Get(strg);
for (auto& eb : blocks.m_ebCopySupported)
par.NewEB(eb.first, false);
auto& qSD = FeatureBlocks::BQ<FeatureBlocks::BQ_SetDefaults>::Get(blocks);
return RunBlocks(IgnoreSts, qSD, par, strg, local);
});
}
void Legacy::InitInternal(const FeatureBlocks& /*blocks*/, TPushII Push)
{
Push(BLK_SetReorder
, [this](StorageRW& strg, StorageRW&) -> mfxStatus
{
using namespace std::placeholders;
auto& par = Glob::VideoParam::Get(strg);
auto pReorderer = make_storable<Reorderer>();
pReorderer->BufferSize = par.mfx.GopRefDist - 1;
pReorderer->MaxReorder = par.mfx.GopRefDist - 1;
pReorderer->DPB = &m_prevTask.DPB.After;
pReorderer->Push(
[&](Reorderer::TExt, const DpbArray& DPB, TTaskIt begin, TTaskIt end, bool bFlush)
{
auto IsIdrFrame = [](TItWrap::reference fi) { return IsIdr(fi.FrameType); };
auto newEnd = std::find_if(TItWrap(begin), TItWrap(end), IsIdrFrame);
bFlush |= (newEnd != begin && newEnd != end);
return Reorder(par, DPB, TItWrap(begin), newEnd, bFlush).it;
});
strg.Insert(Glob::Reorder::Key, std::move(pReorderer));
return MFX_ERR_NONE;
});
Push(BLK_SetVPS
, [this](StorageRW& strg, StorageRW&) -> mfxStatus
{
MFX_CHECK(!strg.Contains(Glob::VPS::Key), MFX_ERR_NONE);
auto dflts = GetRTDefaults(strg);
auto sts = dflts.base.GetVPS(dflts, Glob::VPS::GetOrConstruct(strg));
MFX_CHECK_STS(sts);
return MFX_ERR_NONE;
});
Push(BLK_SetSPS
, [this](StorageRW& strg, StorageRW&) -> mfxStatus
{
if (!strg.Contains(Glob::SPS::Key))
{
auto pSPS = make_storable<SPS>();
auto dflts = GetRTDefaults(strg);
auto sts = dflts.base.GetSPS(dflts, Glob::VPS::Get(strg), *pSPS);
MFX_CHECK_STS(sts);
strg.Insert(Glob::SPS::Key, std::move(pSPS));
}
if (strg.Contains(Glob::RealState::Key))
{
auto& hint = Glob::ResetHint::Get(strg);
const SPS& oldSPS = Glob::SPS::Get(Glob::RealState::Get(strg));
SPS& newSPS = Glob::SPS::Get(strg);
SPS oldSPScopy = oldSPS;
std::copy(newSPS.strps, newSPS.strps + Size(newSPS.strps), oldSPScopy.strps);
oldSPScopy.num_short_term_ref_pic_sets = newSPS.num_short_term_ref_pic_sets;
if (!oldSPS.vui_parameters_present_flag)
oldSPScopy.vui = newSPS.vui;
bool bSPSChanged = !!memcmp(&newSPS, &oldSPScopy, sizeof(SPS));
hint.Flags |= RF_SPS_CHANGED * (bSPSChanged || (hint.Flags & RF_IDR_REQUIRED));
}
return CheckSPS(Glob::SPS::Get(strg)
, Glob::EncodeCaps::Get(strg)
, Glob::VideoCore::Get(strg).GetHWType());
});
Push(BLK_NestSTRPS
, [](StorageRW& strg, StorageRW&) -> mfxStatus
{
MFX_CHECK(
strg.Contains(Glob::RealState::Key)
&& !(Glob::ResetHint::Get(strg).Flags & RF_SPS_CHANGED)
, MFX_ERR_NONE);
SPS& newSPS = Glob::SPS::Get(strg);
const SPS& oldSPS = Glob::SPS::Get(Glob::RealState::Get(strg));
//sacrifice STRPS optimization at Reset to avoid IDR insertion
newSPS.num_short_term_ref_pic_sets = oldSPS.num_short_term_ref_pic_sets;
std::copy(oldSPS.strps, oldSPS.strps + Size(oldSPS.strps), newSPS.strps);
return MFX_ERR_NONE;
});
Push(BLK_SetSTRPS
, [this](StorageRW& strg, StorageRW&) -> mfxStatus
{
SPS& sps = Glob::SPS::Get(strg);
MFX_CHECK(
!sps.num_short_term_ref_pic_sets
&& !(strg.Contains(Glob::RealState::Key)
&& !(Glob::ResetHint::Get(strg).Flags & RF_SPS_CHANGED))
, MFX_ERR_NONE);
auto dflts = GetRTDefaults(strg);
MFX_CHECK(!dflts.base.GetNonStdReordering(dflts), MFX_ERR_NONE);
SetSTRPS(dflts, sps, Glob::Reorder::Get(strg));
return MFX_ERR_NONE;
});
Push(BLK_SetPPS
, [this](StorageRW& strg, StorageRW&) -> mfxStatus
{
if (!strg.Contains(Glob::PPS::Key))
{
std::unique_ptr<MakeStorable<PPS>> pPPS(new MakeStorable<PPS>);
auto dflts = GetRTDefaults(strg);
auto sts = dflts.base.GetPPS(dflts, Glob::SPS::Get(strg), *pPPS);
MFX_CHECK_STS(sts);
strg.Insert(Glob::PPS::Key, std::move(pPPS));
}
if (strg.Contains(Glob::RealState::Key))
{
const PPS& oldPPS = Glob::PPS::Get(Glob::RealState::Get(strg));
PPS& newPPS = Glob::PPS::Get(strg);
if (memcmp(&oldPPS, &newPPS, sizeof(PPS)))
Glob::ResetHint::Get(strg).Flags |= RF_PPS_CHANGED;
}
return CheckPPS(Glob::PPS::Get(strg)
, Glob::EncodeCaps::Get(strg)
, Glob::VideoCore::Get(strg).GetHWType());
});
Push(BLK_SetSlices
, [this](StorageRW& strg, StorageRW&) -> mfxStatus
{
auto dflts = GetRTDefaults(strg);
dflts.base.GetSlices(dflts, Glob::SliceInfo::GetOrConstruct(strg));
return MFX_ERR_NONE;
});
Push(BLK_SetRawInfo
, [this](StorageRW& strg, StorageRW& local) -> mfxStatus
{
auto& par = Glob::VideoParam::Get(strg);
mfxFrameAllocRequest raw = {};
raw.Info = par.mfx.FrameInfo;
auto& rawInfo = Tmp::RawInfo::GetOrConstruct(local, raw);
SetDefault(rawInfo.NumFrameMin, GetMaxRaw(par));
SetDefault(rawInfo.Type
, mfxU16(MFX_MEMTYPE_FROM_ENCODE
| MFX_MEMTYPE_DXVA2_DECODER_TARGET
| MFX_MEMTYPE_INTERNAL_FRAME));
return MFX_ERR_NONE;
});
}
void Legacy::InitAlloc(const FeatureBlocks& /*blocks*/, TPushIA Push)
{
Push(BLK_AllocRaw
, [this](StorageRW& strg, StorageRW& local) -> mfxStatus
{
mfxStatus sts = MFX_ERR_NONE;
auto& par = Glob::VideoParam::Get(strg);
const mfxExtCodingOption2& CO2 = ExtBuffer::Get(par);
auto& rawInfo = Tmp::RawInfo::Get(local);
auto AllocRaw = [&](mfxU16 NumFrameMin)
{
std::unique_ptr<IAllocation> pAlloc(Tmp::MakeAlloc::Get(local)(Glob::VideoCore::Get(strg)));
mfxFrameAllocRequest req = rawInfo;
req.NumFrameMin = NumFrameMin;
sts = pAlloc->Alloc(req, true);
MFX_CHECK_STS(sts);
strg.Insert(Glob::AllocRaw::Key, std::move(pAlloc));
return MFX_ERR_NONE;
};
bool isD3D9SimWithVideoMem = IsD3D9Simulation(Glob::VideoCore::Get(strg)) && (par.IOPattern & MFX_IOPATTERN_IN_VIDEO_MEMORY);
if (par.IOPattern == MFX_IOPATTERN_IN_SYSTEM_MEMORY || isD3D9SimWithVideoMem)
{
sts = AllocRaw(rawInfo.NumFrameMin);
MFX_CHECK_STS(sts);
}
bool bSkipFramesMode = (
(IsSWBRC(par)
&& (par.mfx.RateControlMethod == MFX_RATECONTROL_CBR || par.mfx.RateControlMethod == MFX_RATECONTROL_VBR))
|| (CO2.SkipFrame == MFX_SKIPFRAME_INSERT_DUMMY))
&& !strg.Contains(Glob::AllocRaw::Key);
if (bSkipFramesMode)
{
sts = AllocRaw(GetMaxBS(par));
MFX_CHECK_STS(sts);
}
return sts;
});
Push(BLK_AllocBS
, [this](StorageRW& strg, StorageRW& local) -> mfxStatus
{
mfxStatus sts = MFX_ERR_NONE;
auto& par = Glob::VideoParam::Get(strg);
std::unique_ptr<IAllocation> pAlloc(Tmp::MakeAlloc::Get(local)(Glob::VideoCore::Get(strg)));
MFX_CHECK(local.Contains(Tmp::BSAllocInfo::Key), MFX_ERR_UNDEFINED_BEHAVIOR);
auto& req = Tmp::BSAllocInfo::Get(local);
SetDefault(req.NumFrameMin, GetMaxBS(par));
SetDefault(req.Type
, mfxU16(MFX_MEMTYPE_FROM_ENCODE
| MFX_MEMTYPE_DXVA2_DECODER_TARGET
| MFX_MEMTYPE_INTERNAL_FRAME));
mfxU32 minBS = GetMinBsSize(par);
if (mfxU32(req.Info.Width * req.Info.Height) < minBS)
{
MFX_CHECK(req.Info.Width != 0, MFX_ERR_UNDEFINED_BEHAVIOR);
req.Info.Height = (mfxU16)CeilDiv<mfxU32>(minBS, req.Info.Width);
}
sts = pAlloc->Alloc(req, false);
MFX_CHECK_STS(sts);
strg.Insert(Glob::AllocBS::Key, std::move(pAlloc));
return sts;
});
Push(BLK_AllocMBQP
, [this](StorageRW& strg, StorageRW& local) -> mfxStatus
{
mfxStatus sts = MFX_ERR_NONE;
auto& par = Glob::VideoParam::Get(strg);
//const mfxExtCodingOption3& CO3 = ExtBuffer::Get(par);
auto& core = Glob::VideoCore::Get(strg);
auto& caps = Glob::EncodeCaps::Get(strg);
MFX_CHECK(IsMBQP(par,caps.MbQpDataSupport) && core.GetVAType() != MFX_HW_VAAPI, MFX_ERR_NONE);
MFX_CHECK(local.Contains(Tmp::MBQPAllocInfo::Key), MFX_ERR_UNDEFINED_BEHAVIOR);
auto& req = Tmp::MBQPAllocInfo::Get(local);
SetDefault(req.NumFrameMin, GetMaxBS(par));
SetDefault(req.Type
, mfxU16(MFX_MEMTYPE_FROM_ENCODE
| MFX_MEMTYPE_DXVA2_DECODER_TARGET
| MFX_MEMTYPE_INTERNAL_FRAME));
std::tie(sts, m_CUQPBlkW, m_CUQPBlkH) = GetCUQPMapBlockSize(
par.mfx.FrameInfo.Width
, par.mfx.FrameInfo.Height
, req.Info.Width
, req.Info.Height);
MFX_CHECK_STS(sts);
// need LCU aligned width for the buffer for proper averaging
const mfxExtHEVCParam& hpar = ExtBuffer::Get(par);
mfxU16 numVal = mfxU16(hpar.LCUSize / m_CUQPBlkW);
if (numVal > 1)
req.Info.Width = (req.Info.Width + (numVal - 1)) & ~(numVal - 1);
std::unique_ptr<IAllocation> pAlloc(Tmp::MakeAlloc::Get(local)(core));
sts = pAlloc->Alloc(req, true);
MFX_CHECK_STS(sts);
strg.Insert(Glob::AllocMBQP::Key, std::move(pAlloc));
return sts;
});
Push(BLK_ResetState
, [this](StorageRW& /*strg*/, StorageRW& /*local*/) -> mfxStatus
{
ResetState();
return MFX_ERR_NONE;
});
}
void Legacy::Reset(const FeatureBlocks& blocks, TPushR Push)
{
Push(BLK_ResetInit
, [this, &blocks](
const mfxVideoParam& par
, StorageRW& global
, StorageRW& local) -> mfxStatus
{
mfxStatus wrn = MFX_ERR_NONE;
auto& init = Glob::RealState::Get(global);
if (par.NumExtParam != 0)
MFX_CHECK(std::none_of(par.ExtParam, par.ExtParam + par.NumExtParam, [](mfxExtBuffer* buf) { return buf == nullptr; }), MFX_ERR_NULL_PTR);
auto pParNew = make_storable<ExtBuffer::Param<mfxVideoParam>>(par);
ExtBuffer::Param<mfxVideoParam>& parNew = *pParNew;
auto& parOld = Glob::VideoParam::Get(init);
auto& core = Glob::VideoCore::Get(init);
global.Insert(Glob::ResetHint::Key, make_storable<ResetHint>(ResetHint{}));
auto& hint = Glob::ResetHint::Get(global);
const mfxExtEncoderResetOption* pResetOpt = ExtBuffer::Get(par);
hint.Flags = RF_IDR_REQUIRED * (pResetOpt && IsOn(pResetOpt->StartNewSequence));
m_GetMaxRef = [&](const mfxVideoParam& par)
{
auto& def = Glob::Defaults::Get(init);
auto hw = core.GetHWType();
auto& caps = Glob::EncodeCaps::Get(init);
return def.GetMaxNumRef(Defaults::Param(par, caps, hw, def));
};
std::for_each(std::begin(blocks.m_ebCopySupported)
, std::end(blocks.m_ebCopySupported)
, [&](decltype(*std::begin(blocks.m_ebCopySupported)) eb) { parNew.NewEB(eb.first, false); });
std::for_each(std::begin(blocks.m_mvpInheritDefault)
, std::end(blocks.m_mvpInheritDefault)
, [&](decltype(*std::begin(blocks.m_mvpInheritDefault)) inherit) { inherit(&parOld, &parNew); });
std::for_each(std::begin(blocks.m_ebInheritDefault)
, std::end(blocks.m_ebInheritDefault)
, [&](decltype(*std::begin(blocks.m_ebInheritDefault)) eb)
{
auto pEbNew = ExtBuffer::Get(parNew, eb.first);
auto pEbOld = ExtBuffer::Get(parOld, eb.first);
MFX_CHECK(pEbNew && pEbOld, MFX_ERR_NONE);
std::for_each(std::begin(eb.second)
, std::end(eb.second)
, [&](decltype(*std::begin(eb.second)) inherit) { inherit(parOld, pEbOld, parNew, pEbNew); });
return MFX_ERR_NONE;
});
auto& qInitExternal = FeatureBlocks::BQ<FeatureBlocks::BQ_InitExternal>::Get(blocks);
auto& qInitInternal = FeatureBlocks::BQ<FeatureBlocks::BQ_InitInternal>::Get(blocks);
auto sts = RunBlocks(CheckGE<mfxStatus, MFX_ERR_NONE>, qInitExternal, parNew, global, local);
MFX_CHECK(sts >= MFX_ERR_NONE, sts);
wrn = sts;
sts = RunBlocks(CheckGE<mfxStatus, MFX_ERR_NONE>, qInitInternal, global, local);
MFX_CHECK(sts >= MFX_ERR_NONE, sts);
return GetWorstSts(sts, wrn);
});
Push(BLK_ResetCheck
, [this](
const mfxVideoParam& par
, StorageRW& global
, StorageRW& local) -> mfxStatus
{
auto& init = Glob::RealState::Get(global);
auto& parOld = Glob::VideoParam::Get(init);
auto& parNew = Glob::VideoParam::Get(global);
auto& hint = Glob::ResetHint::Get(global);
auto defOld = GetRTDefaults(init);
auto defNew = GetRTDefaults(global);
const mfxExtEncoderResetOption* pResetOpt = ExtBuffer::Get(par);
const mfxExtHEVCParam (&hevcPar)[2] = { ExtBuffer::Get(parOld), ExtBuffer::Get(parNew) };
MFX_CHECK(hevcPar[0].LCUSize == hevcPar[1].LCUSize, MFX_ERR_INCOMPATIBLE_VIDEO_PARAM); // LCU Size Can't be changed
MFX_CHECK(parOld.AsyncDepth == parNew.AsyncDepth, MFX_ERR_INCOMPATIBLE_VIDEO_PARAM);
MFX_CHECK(parOld.mfx.GopRefDist >= parNew.mfx.GopRefDist, MFX_ERR_INCOMPATIBLE_VIDEO_PARAM);
MFX_CHECK(parOld.mfx.NumRefFrame >= parNew.mfx.NumRefFrame, MFX_ERR_INCOMPATIBLE_VIDEO_PARAM);
MFX_CHECK(parOld.mfx.RateControlMethod == parNew.mfx.RateControlMethod, MFX_ERR_INCOMPATIBLE_VIDEO_PARAM);
MFX_CHECK(parOld.mfx.FrameInfo.ChromaFormat == parNew.mfx.FrameInfo.ChromaFormat, MFX_ERR_INCOMPATIBLE_VIDEO_PARAM);
MFX_CHECK(parOld.IOPattern == parNew.IOPattern, MFX_ERR_INCOMPATIBLE_VIDEO_PARAM);
MFX_CHECK(local.Contains(Tmp::RecInfo::Key), MFX_ERR_UNDEFINED_BEHAVIOR);
auto recOld = Glob::AllocRec::Get(init).GetInfo();
auto& recNew = Tmp::RecInfo::Get(local).Info;
MFX_CHECK(recOld.Width >= recNew.Width, MFX_ERR_INCOMPATIBLE_VIDEO_PARAM);
MFX_CHECK(recOld.Height >= recNew.Height, MFX_ERR_INCOMPATIBLE_VIDEO_PARAM);
MFX_CHECK(recOld.FourCC == recNew.FourCC, MFX_ERR_INCOMPATIBLE_VIDEO_PARAM);
MFX_CHECK(
!( parOld.mfx.RateControlMethod == MFX_RATECONTROL_CBR
|| parOld.mfx.RateControlMethod == MFX_RATECONTROL_VBR
|| parOld.mfx.RateControlMethod == MFX_RATECONTROL_VCM)
||( (mfxU32)InitialDelayInKB(parOld.mfx) == (mfxU32)InitialDelayInKB(parNew.mfx)
&& (mfxU32)BufferSizeInKB(parOld.mfx) == (mfxU32)BufferSizeInKB(parNew.mfx))
, MFX_ERR_INCOMPATIBLE_VIDEO_PARAM);
mfxU32 tempLayerIdx = 0;
bool changeTScalLayers = false;
bool isIdrRequired = false;
// check if change of temporal scalability required by new parameters
auto numTlOld = defOld.base.GetNumTemporalLayers(defOld);
auto numTlNew = defNew.base.GetNumTemporalLayers(defNew);
bool bTlActive = numTlOld > 1 && numTlNew > 1;
if (bTlActive)
{
// calculate temporal layer for next frame
mfxGopHints GopHints = {};
tempLayerIdx = defOld.base.GetTId(defOld, m_frameOrder + 1, GopHints);
changeTScalLayers = numTlOld != numTlNew;
}
// check if IDR required after change of encoding parameters
const mfxExtCodingOption2(&CO2)[2] = { ExtBuffer::Get(parOld), ExtBuffer::Get(parNew) };
isIdrRequired =
(hint.Flags & RF_SPS_CHANGED)
|| (hint.Flags & RF_IDR_REQUIRED)
|| (tempLayerIdx != 0 && changeTScalLayers)
|| parOld.mfx.GopPicSize != parNew.mfx.GopPicSize
|| CO2[0].IntRefType != CO2[1].IntRefType;
hint.Flags |= RF_IDR_REQUIRED * isIdrRequired;
MFX_CHECK(!isIdrRequired || !(pResetOpt && IsOff(pResetOpt->StartNewSequence))
, MFX_ERR_INVALID_VIDEO_PARAM); // Reset can't change parameters w/o IDR. Report an error
bool brcReset =
( parOld.mfx.RateControlMethod == MFX_RATECONTROL_CBR
|| parOld.mfx.RateControlMethod == MFX_RATECONTROL_VBR
|| parOld.mfx.RateControlMethod == MFX_RATECONTROL_VCM)
&& ( (mfxU32)TargetKbps(parOld.mfx) != (mfxU32)TargetKbps(parNew.mfx)
|| (mfxU32)BufferSizeInKB(parOld.mfx) != (mfxU32)BufferSizeInKB(parNew.mfx)
|| (mfxU32)InitialDelayInKB(parOld.mfx) != (mfxU32)InitialDelayInKB(parNew.mfx)
|| parOld.mfx.FrameInfo.FrameRateExtN != parNew.mfx.FrameInfo.FrameRateExtN
|| parOld.mfx.FrameInfo.FrameRateExtD != parNew.mfx.FrameInfo.FrameRateExtD);
brcReset |=
( parOld.mfx.RateControlMethod == MFX_RATECONTROL_VBR
|| parOld.mfx.RateControlMethod == MFX_RATECONTROL_VCM)
&& ((mfxU32)MaxKbps(parOld.mfx) != (mfxU32)MaxKbps(parNew.mfx));
const mfxExtCodingOption(&CO)[2] = { ExtBuffer::Get(parOld), ExtBuffer::Get(parNew) };
bool HRDConformance = !(IsOff(CO[1].NalHrdConformance) || IsOff(CO[1].VuiNalHrdParameters));
MFX_CHECK(
!( brcReset
&& parOld.mfx.RateControlMethod == MFX_RATECONTROL_CBR
&& (HRDConformance || !isIdrRequired))
, MFX_ERR_INCOMPATIBLE_VIDEO_PARAM);
hint.Flags |= RF_BRC_RESET * (brcReset || isIdrRequired);
return MFX_ERR_NONE;
});
}
void Legacy::ResetState(const FeatureBlocks& blocks, TPushRS Push)
{
Push(BLK_ResetState
, [this, &blocks](
StorageRW& global
, StorageRW&) -> mfxStatus
{
auto& real = Glob::RealState::Get(global);
auto& parInt = Glob::VideoParam::Get(real);
auto& parNew = Glob::VideoParam::Get(global);
auto& hint = Glob::ResetHint::Get(global);
CopyConfigurable(blocks, parNew, parInt);
Glob::VPS::Get(real) = Glob::VPS::Get(global);
Glob::SPS::Get(real) = Glob::SPS::Get(global);
Glob::PPS::Get(real) = Glob::PPS::Get(global);
Glob::SliceInfo::Get(real) = Glob::SliceInfo::Get(global);
m_forceHeaders |= !!(hint.Flags & RF_PPS_CHANGED) * INSERT_PPS;
MFX_CHECK(hint.Flags & RF_IDR_REQUIRED, MFX_ERR_NONE);
Glob::AllocRec::Get(real).UnlockAll();
Glob::AllocBS::Get(real).UnlockAll();
if (real.Contains(Glob::AllocMBQP::Key))
Glob::AllocMBQP::Get(real).UnlockAll();
if (real.Contains(Glob::AllocRaw::Key))
Glob::AllocRaw::Get(real).UnlockAll();
ResetState();
return MFX_ERR_NONE;
});
}
void Legacy::FrameSubmit(const FeatureBlocks& /*blocks*/, TPushFS Push)
{
Push(BLK_CheckSurf
, [](
const mfxEncodeCtrl* /*pCtrl*/
, const mfxFrameSurface1* pSurf
, mfxBitstream& /*bs*/
, StorageW& global
, StorageRW& /*local*/) -> mfxStatus
{
MFX_CHECK(pSurf, MFX_ERR_NONE);
auto& par = Glob::VideoParam::Get(global);
MFX_CHECK(LumaIsNull(pSurf) == (pSurf->Data.UV == 0), MFX_ERR_UNDEFINED_BEHAVIOR);
MFX_CHECK(pSurf->Info.Width >= par.mfx.FrameInfo.Width, MFX_ERR_INVALID_VIDEO_PARAM);
MFX_CHECK(pSurf->Info.Height >= par.mfx.FrameInfo.Height, MFX_ERR_INVALID_VIDEO_PARAM);
return MFX_ERR_NONE;
});
Push(BLK_CheckBS
, [](
const mfxEncodeCtrl* /*pCtrl*/
, const mfxFrameSurface1* /*pSurf*/
, mfxBitstream& bs
, StorageW& global
, StorageRW& local) -> mfxStatus
{
auto& par = Glob::VideoParam::Get(global);
BsDataInfo bsData = {};
bsData.Data = bs.Data;
bsData.DataLength = bs.DataLength;
bsData.DataOffset = bs.DataOffset;
bsData.MaxLength = bs.MaxLength;
if (local.Contains(Tmp::BsDataInfo::Key))
bsData = Tmp::BsDataInfo::Get(local);
MFX_CHECK(bsData.DataOffset <= bsData.MaxLength, MFX_ERR_UNDEFINED_BEHAVIOR);
MFX_CHECK(bsData.DataOffset + bsData.DataLength + BufferSizeInKB(par.mfx) * 1000u <= bsData.MaxLength, MFX_ERR_NOT_ENOUGH_BUFFER);
MFX_CHECK_NULL_PTR1(bsData.Data);
return MFX_ERR_NONE;
});
}
void Legacy::AllocTask(const FeatureBlocks& /*blocks*/, TPushAT Push)
{
Push(BLK_AllocTask
, [](
StorageR& /*global*/
, StorageRW& task) -> mfxStatus
{
task.Insert(Task::Common::Key, new Task::Common::TRef);
task.Insert(Task::SSH::Key, new MakeStorable<Task::SSH::TRef>);
return MFX_ERR_NONE;
});
}
void Legacy::InitTask(const FeatureBlocks& /*blocks*/, TPushIT Push)
{
Push(BLK_InitTask
, [this](
mfxEncodeCtrl* pCtrl
, mfxFrameSurface1* pSurf
, mfxBitstream* pBs
, StorageW& global
, StorageW& task) -> mfxStatus
{
auto& core = Glob::VideoCore::Get(global);
auto& tpar = Task::Common::Get(task);
auto stage = tpar.stage;
tpar = TaskCommonPar();
tpar.stage = stage;
tpar.pBsOut = pBs;
MFX_CHECK(pSurf, MFX_ERR_NONE);
tpar.pSurfIn = pSurf;
if (pCtrl)
{
tpar.ctrl = *pCtrl;
}
tpar.pSurfReal = tpar.pSurfIn;
core.IncreaseReference(*tpar.pSurfIn);
auto dflts = GetRTDefaults(global);
m_frameOrder = dflts.base.GetFrameOrder(dflts, task, m_frameOrder);
tpar.DisplayOrder = m_frameOrder;
return MFX_ERR_NONE;
});
}
void Legacy::PreReorderTask(const FeatureBlocks& /*blocks*/, TPushPreRT Push)
{
Push(BLK_PrepareTask
, [this](
StorageW& global
, StorageW& s_task) -> mfxStatus
{
auto& par = Glob::VideoParam::Get(global);
auto& task = Task::Common::Get(s_task);
auto dflts = GetRTDefaults(global);
auto sts = dflts.base.GetPreReorderInfo(
dflts, task, task.pSurfIn, &task.ctrl, { LastKeyFrameInfo.lastIDROrder, LastKeyFrameInfo.lastIPOrder, m_prevTask.LastKeyFrameInfo.lastIPoc}, task.DisplayOrder, task.GopHints);
MFX_CHECK_STS(sts);
if (par.mfx.EncodedOrder)
{
auto BufferSize = Glob::Reorder::Get(global).BufferSize;
auto MaxReorder = Glob::Reorder::Get(global).MaxReorder;
bool bFrameFromPast = task.DisplayOrder && (task.DisplayOrder < m_prevTask.DisplayOrder);
MFX_CHECK(!bFrameFromPast || ((m_prevTask.DisplayOrder - task.DisplayOrder) <= MaxReorder), MFX_ERR_UNDEFINED_BEHAVIOR);
MFX_CHECK(task.DisplayOrder <= (m_prevTask.EncodedOrder + 1 + BufferSize), MFX_ERR_UNDEFINED_BEHAVIOR);
MFX_CHECK(isValid(m_prevTask.DPB.After[0]) || IsIdr(task.FrameType), MFX_ERR_UNDEFINED_BEHAVIOR);
}
task.LastKeyFrameInfo = m_prevTask.LastKeyFrameInfo;
SetIf(LastKeyFrameInfo.lastIDROrder, IsIdr(task.FrameType), task.DisplayOrder);
SetIf(task.LastKeyFrameInfo.lastIPoc, IsI(task.FrameType), task.POC);
SetIf(LastKeyFrameInfo.lastIPOrder, IsI(task.FrameType) || IsP(task.FrameType), task.DisplayOrder);
return MFX_ERR_NONE;
});
}
void Legacy::PostReorderTask(const FeatureBlocks& /*blocks*/, TPushPostRT Push)
{
Push(BLK_ConfigureTask
, [this](
StorageW& global
, StorageW& s_task) -> mfxStatus
{
auto& task = Task::Common::Get(s_task);
if (global.Contains(Glob::AllocRaw::Key))
{
task.Raw = Glob::AllocRaw::Get(global).Acquire();
MFX_CHECK(task.Raw.Mid, MFX_ERR_UNDEFINED_BEHAVIOR);
}
if (global.Contains(Glob::AllocMBQP::Key))
{
task.CUQP = Glob::AllocMBQP::Get(global).Acquire();
MFX_CHECK(task.CUQP.Mid, MFX_ERR_UNDEFINED_BEHAVIOR);
}
task.Rec = Glob::AllocRec::Get(global).Acquire();
task.BS = Glob::AllocBS::Get(global).Acquire();
MFX_CHECK(task.BS.Idx != IDX_INVALID, MFX_ERR_UNDEFINED_BEHAVIOR);
MFX_CHECK(task.Rec.Idx != IDX_INVALID, MFX_ERR_UNDEFINED_BEHAVIOR);
MFX_CHECK(task.Rec.Mid && task.BS.Mid, MFX_ERR_UNDEFINED_BEHAVIOR);
auto& par = Glob::VideoParam::Get(global);
auto& sps = Glob::SPS::Get(global);
auto& pps = Glob::PPS::Get(global);
auto def = GetRTDefaults(global);
ConfigureTask(task, def, sps);
auto sts = GetSliceHeader(par, task, sps, pps, Task::SSH::Get(s_task));
MFX_CHECK_STS(sts);
return sts;
});
}
void Legacy::SubmitTask(const FeatureBlocks& /*blocks*/, TPushST Push)
{
Push(BLK_SkipFrame
, [](
StorageW& global
, StorageW& s_task) -> mfxStatus
{
auto& par = Glob::VideoParam::Get(global);
auto& task = Task::Common::Get(s_task);
bool bCheckSkip =
!task.bSkip
&& IsB(task.FrameType)
&& !task.isLDB
&& IsSWBRC(par);
auto& allocRec = Glob::AllocRec::Get(global);
task.bSkip |=
bCheckSkip
&& !!(allocRec.GetFlag(task.DPB.Active[task.RefPicList[1][0]].Rec.Idx) & REC_SKIPPED);
MFX_CHECK(task.bSkip, MFX_ERR_NONE);
task.bForceSync = true;
if (IsI(task.FrameType))
{
MFX_CHECK(
par.mfx.FrameInfo.FourCC == MFX_FOURCC_NV12
|| par.mfx.FrameInfo.FourCC == MFX_FOURCC_P010
, MFX_ERR_UNDEFINED_BEHAVIOR);
FrameLocker raw(Glob::VideoCore::Get(global), task.Raw.Mid);
mfxU32 size = raw.Pitch * par.mfx.FrameInfo.Height;
int UVFiller = (par.mfx.FrameInfo.FourCC == MFX_FOURCC_NV12) * 126;
memset(raw.Y, 0, size);
memset(raw.UV, UVFiller, size >> 1);
allocRec.SetFlag(task.Rec.Idx, REC_SKIPPED);
return MFX_ERR_NONE;
}
auto& core = Glob::VideoCore::Get(global);
bool bL1 = (IsB(task.FrameType) && !task.isLDB && task.NumRefActive[1] && !task.b2ndField);
auto idx = task.RefPicList[bL1][0];
mfxFrameSurface1 surfSrc = {};
mfxFrameSurface1 surfDst = {};
surfSrc.Info = par.mfx.FrameInfo;
surfDst.Info = allocRec.GetInfo();
MFX_CHECK(!memcmp(&surfSrc.Info, &surfDst.Info, sizeof(mfxFrameInfo)), MFX_ERR_UNDEFINED_BEHAVIOR);
MFX_CHECK(idx < MAX_DPB_SIZE, MFX_ERR_UNDEFINED_BEHAVIOR);
auto& ref = task.DPB.Active[idx];
allocRec.SetFlag(task.Rec.Idx, REC_SKIPPED);
MFX_CHECK(allocRec.GetFlag(ref.Rec.Idx) & REC_READY, MFX_ERR_NONE);
surfSrc.Data.MemId = ref.Rec.Mid;
surfDst.Data.MemId = task.Raw.Mid;
mfxStatus sts = core.DoFastCopyWrapper(
&surfDst, MFX_MEMTYPE_INTERNAL_FRAME | MFX_MEMTYPE_DXVA2_DECODER_TARGET | MFX_MEMTYPE_FROM_ENCODE,
&surfSrc, MFX_MEMTYPE_INTERNAL_FRAME | MFX_MEMTYPE_DXVA2_DECODER_TARGET | MFX_MEMTYPE_FROM_ENCODE);
MFX_CHECK_STS(sts);
allocRec.SetFlag(ref.Rec.Idx, REC_SKIPPED * !!idx);
return MFX_ERR_NONE;
});
Push(BLK_GetRawHDL
, [](
StorageW& global
, StorageW& s_task) -> mfxStatus
{
auto& core = Glob::VideoCore::Get(global);
auto& par = Glob::VideoParam::Get(global);
auto& task = Task::Common::Get(s_task);
bool bInternalFrame =
par.IOPattern == MFX_IOPATTERN_IN_SYSTEM_MEMORY ||
(IsD3D9Simulation(Glob::VideoCore::Get(global)) && (par.IOPattern & MFX_IOPATTERN_IN_VIDEO_MEMORY))
|| task.bSkip;
mfxFrameSurface1* surface = task.pSurfReal;
bool bIntAlloc = surface && (surface->Data.MemType & MFX_MEMTYPE_INTERNAL_FRAME);
// Video memory internal allocation
MFX_CHECK(!(bIntAlloc && par.IOPattern == MFX_IOPATTERN_IN_VIDEO_MEMORY),
core.GetFrameHDL(*task.pSurfReal, task.HDLRaw));
// System memory
MFX_CHECK(!(bInternalFrame || bIntAlloc), core.GetFrameHDL(task.Raw.Mid, &task.HDLRaw.first));
// Video memory external allocation
MFX_CHECK(par.IOPattern != MFX_IOPATTERN_IN_VIDEO_MEMORY
, core.GetExternalFrameHDL(*task.pSurfReal, task.HDLRaw));
return core.GetFrameHDL(task.pSurfReal->Data.MemId, &task.HDLRaw.first);
});
Push(BLK_CopySysToRaw
, [this](
StorageW& global
, StorageW& s_task)->mfxStatus
{
auto& par = Glob::VideoParam::Get(global);
auto& task = Task::Common::Get(s_task);
auto dflts = GetRTDefaults(global);
bool videoMemory =
(par.IOPattern == MFX_IOPATTERN_IN_VIDEO_MEMORY
&& !IsD3D9Simulation(Glob::VideoCore::Get(global)));
MFX_CHECK(!(task.bSkip || videoMemory), MFX_ERR_NONE);
mfxFrameSurface1 surfSrc = MakeSurface(par.mfx.FrameInfo, *task.pSurfReal);
mfxFrameSurface1 surfDst = MakeSurface(par.mfx.FrameInfo, task.Raw.Mid);
surfDst.Info.Shift =
surfDst.Info.FourCC == MFX_FOURCC_P010
|| surfDst.Info.FourCC == MFX_FOURCC_Y210; // convert to native shift in core.CopyFrame() if required
mfxU16 inMemType = static_cast<mfxU16>((par.IOPattern & MFX_IOPATTERN_IN_SYSTEM_MEMORY ? MFX_MEMTYPE_SYSTEM_MEMORY : MFX_MEMTYPE_DXVA2_DECODER_TARGET) |
MFX_MEMTYPE_EXTERNAL_FRAME);
return dflts.base.RunFastCopyWrapper(
surfDst,
MFX_MEMTYPE_INTERNAL_FRAME | MFX_MEMTYPE_DXVA2_DECODER_TARGET | MFX_MEMTYPE_FROM_ENCODE,
surfSrc,
inMemType);
});
Push(BLK_FillCUQPSurf
, [this](
StorageW& global
, StorageW& s_task)->mfxStatus
{
auto& task = Task::Common::Get(s_task);
MFX_CHECK(task.CUQP.Mid && task.bCUQPMap, MFX_ERR_NONE);
mfxExtMBQP *mbqp = ExtBuffer::Get(task.ctrl);
auto& par = Glob::VideoParam::Get(global);
auto& core = Glob::VideoCore::Get(global);
auto CUQPFrameInfo = Glob::AllocMBQP::Get(global).GetInfo();
MFX_CHECK(CUQPFrameInfo.Width && CUQPFrameInfo.Height, MFX_ERR_UNDEFINED_BEHAVIOR);
MFX_CHECK(m_CUQPBlkW && m_CUQPBlkH, MFX_ERR_UNDEFINED_BEHAVIOR);
mfxU32 drBlkW = m_CUQPBlkW; // block size of driver
mfxU32 drBlkH = m_CUQPBlkH; // block size of driver
mfxU16 inBlkSize = 16; //mbqp->BlockSize ? mbqp->BlockSize : 16; //input block size
mfxU32 pitch_MBQP = (par.mfx.FrameInfo.Width + inBlkSize - 1) / inBlkSize;
MFX_CHECK(mbqp && mbqp->NumQPAlloc, MFX_ERR_NONE);
// CUQPFrameInfo.Width is LCU aligned, so compute unaligned
mfxU32 unalignedWidth = (par.mfx.FrameInfo.Width + drBlkW - 1) / drBlkW;
bool bInvalid =
(mbqp->NumQPAlloc * inBlkSize * inBlkSize) < (drBlkW * drBlkH * unalignedWidth * CUQPFrameInfo.Height);
bInvalid &= (drBlkW < inBlkSize || drBlkH < inBlkSize); // needs changing filling loop
task.bCUQPMap &= !bInvalid;
MFX_CHECK(!bInvalid, MFX_WRN_INCOMPATIBLE_VIDEO_PARAM);
FrameLocker lock(core, task.CUQP.Mid);
MFX_CHECK(lock.Y, MFX_ERR_LOCK_MEMORY);
auto itSrcRow = MakeStepIter(mbqp->QP, drBlkH / inBlkSize * pitch_MBQP);
auto itDstRow = MakeStepIter(lock.Y, lock.Pitch);
auto stepSrcRow = drBlkW / inBlkSize;
std::for_each(itSrcRow, std::next(itSrcRow, CUQPFrameInfo.Height)
, [&](mfxU8& rSrcRowBegin)
{
std::copy_n(MakeStepIter(&rSrcRowBegin, stepSrcRow), unalignedWidth, &*itDstRow);
// fill till EO LCU aligned width
auto ItLastPos = MakeStepIter(&*itDstRow++ + unalignedWidth - 1);
std::fill_n(std::next(ItLastPos), CUQPFrameInfo.Width - unalignedWidth, *ItLastPos);
});
return MFX_ERR_NONE;
});
}
void Legacy::QueryTask(const FeatureBlocks& /*blocks*/, TPushQT Push)
{
Push(BLK_CopyBS
, [](StorageW& global, StorageW& s_task) -> mfxStatus
{
auto& task = Task::Common::Get(s_task);
if (!task.pBsData)
{
auto& bs = *task.pBsOut;
task.pBsData = bs.Data + bs.DataOffset + bs.DataLength;
task.pBsDataLength = &bs.DataLength;
task.BsBytesAvailable = bs.MaxLength - bs.DataOffset - bs.DataLength;
}
MFX_CHECK(task.BsDataLength, MFX_ERR_NONE);
mfxStatus sts = MFX_ERR_NONE;
MFX_CHECK(task.BsBytesAvailable >= task.BsDataLength, MFX_ERR_NOT_ENOUGH_BUFFER);
FrameLocker codedFrame(Glob::VideoCore::Get(global), task.BS.Mid);
MFX_CHECK(codedFrame.Y, MFX_ERR_LOCK_MEMORY);
sts = FastCopy::Copy(
task.pBsData
, task.BsDataLength
, codedFrame.Y
, codedFrame.Pitch
, { int(task.BsDataLength), 1 }
, COPY_VIDEO_TO_SYS);
MFX_CHECK_STS(sts);
task.BsBytesAvailable -= task.BsDataLength;
return MFX_ERR_NONE;
});
Push(BLK_DoPadding
, [](StorageW& /*global*/, StorageW& s_task) -> mfxStatus
{
auto& task = Task::Common::Get(s_task);
MFX_CHECK(task.MinFrameSize >= task.BsDataLength, MFX_ERR_NONE);
MFX_CHECK(!task.bDontPatchBS, MFX_ERR_UNDEFINED_BEHAVIOR);
mfxU32 padding = task.MinFrameSize - task.BsDataLength;
MFX_CHECK(task.BsBytesAvailable >= padding, MFX_ERR_NOT_ENOUGH_BUFFER);
memset(task.pBsData + task.BsDataLength, 0, padding);
task.BsDataLength += padding;
task.BsBytesAvailable -= padding;
return MFX_ERR_NONE;
});
Push(BLK_UpdateBsInfo
, [](StorageW& global, StorageW& s_task) -> mfxStatus
{
const auto& par = Glob::VideoParam::Get(global);
auto& task = Task::Common::Get(s_task);
auto& sps = Glob::SPS::Get(global);
auto& bs = *task.pBsOut;
mfxI32 dpbOutputDelay =
task.DisplayOrder
+ sps.sub_layer[sps.max_sub_layers_minus1].max_num_reorder_pics
- task.EncodedOrder;
bs.TimeStamp = task.pSurfIn->Data.TimeStamp;
bs.DecodeTimeStamp = MFX_TIMESTAMP_UNKNOWN;
if (bs.TimeStamp != mfxU64(MFX_TIMESTAMP_UNKNOWN))
{
mfxF64 tcDuration90KHz = (mfxF64)par.mfx.FrameInfo.FrameRateExtD / par.mfx.FrameInfo.FrameRateExtN * 90000;
bs.DecodeTimeStamp = mfxI64(bs.TimeStamp - tcDuration90KHz * dpbOutputDelay);
}
bs.PicStruct = task.pSurfIn->Info.PicStruct;
bs.FrameType = task.FrameType;
bs.FrameType &= ~(task.isLDB * MFX_FRAMETYPE_B);
bs.FrameType |= task.isLDB * MFX_FRAMETYPE_P;
*task.pBsDataLength += task.BsDataLength;
return MFX_ERR_NONE;
});
}
inline bool ReleaseResource(IAllocation& a, Resource& r)
{
if (r.Mid)
{
a.Release(r.Idx);
r = Resource();
return true;
}
return r.Idx == IDX_INVALID;
}
void Legacy::FreeTask(const FeatureBlocks& /*blocks*/, TPushFT Push)
{
Push(BLK_FreeTask
, [](StorageW& global, StorageW& s_task) -> mfxStatus
{
auto& task = Task::Common::Get(s_task);
auto& core = Glob::VideoCore::Get(global);
ThrowAssert(
!ReleaseResource(Glob::AllocBS::Get(global), task.BS)
, "task.BS resource is invalid");
ThrowAssert(
global.Contains(Glob::AllocMBQP::Key)
&& !ReleaseResource(Glob::AllocMBQP::Get(global), task.CUQP)
, "task.CUQP resource is invalid");
ThrowAssert(
global.Contains(Glob::AllocRaw::Key)
&& !ReleaseResource(Glob::AllocRaw::Get(global), task.Raw)
, "task.Raw resource is invalid");
SetIf(task.pSurfIn, task.pSurfIn && !core.DecreaseReference(*task.pSurfIn), nullptr);
ThrowAssert(!!task.pSurfIn, "failed in core.DecreaseReference");
auto& atrRec = Glob::AllocRec::Get(global);
if (task.Rec.Idx != IDX_INVALID)
atrRec.SetFlag(task.Rec.Idx, REC_READY);
ThrowAssert(
!IsRef(task.FrameType)
&& !ReleaseResource(atrRec, task.Rec)
, "task.Rec resource is invalid");
auto pDPBBeforeEnd = std::find_if_not(
task.DPB.Before, task.DPB.Before + Size(task.DPB.Before), isValid);
auto pDPBAfterEnd = std::find_if_not(
task.DPB.After, task.DPB.After + Size(task.DPB.After), isValid);
auto DPBFrameReleaseVerify = [&](DpbFrame& ref)
{
auto IsSameRecIdx = [&](DpbFrame& refA) { return refA.Rec.Idx == ref.Rec.Idx; };
return pDPBAfterEnd != std::find_if(task.DPB.After, pDPBAfterEnd, IsSameRecIdx)
|| ReleaseResource(atrRec, ref.Rec);
};
auto nDPBFramesValid = std::count_if(task.DPB.Before, pDPBBeforeEnd, DPBFrameReleaseVerify);
ThrowAssert(nDPBFramesValid != (pDPBBeforeEnd - task.DPB.Before), "task.DPB.Before is invalid");
return MFX_ERR_NONE;
});
}
void Legacy::GetVideoParam(const FeatureBlocks& blocks, TPushGVP Push)
{
Push(BLK_CopyConfigurable
, [this, &blocks](mfxVideoParam& out, StorageR& global) -> mfxStatus
{
return CopyConfigurable(blocks, Glob::VideoParam::Get(global), out);
});
}
IntraRefreshState GetIntraRefreshState(
const ExtBuffer::Param<mfxVideoParam> & par
, const mfxEncodeCtrl& ctrl
, mfxU32 frameOrderInGopDispOrder
, mfxU32 IntraRefreshBlockUnitSize)
{
IntraRefreshState state={};
const mfxExtCodingOption2& CO2 = ExtBuffer::Get(par);
const mfxExtCodingOption3& CO3 = ExtBuffer::Get(par);
const mfxExtHEVCParam& HEVCParam = ExtBuffer::Get(par);
const mfxExtCodingOption2* pCO2RT = ExtBuffer::Get(ctrl);
mfxU32 refreshPeriod = std::max<mfxU32>(CO3.IntRefCycleDist + (!CO3.IntRefCycleDist * CO2.IntRefCycleSize), 1);
mfxU32 offsetFromStartOfGop = std::max<mfxU32>(!!CO3.IntRefCycleDist * refreshPeriod, 1); // 1st refresh cycle in GOP starts with offset
mfxI32 frameOrderMinusOffset = frameOrderInGopDispOrder - offsetFromStartOfGop;
mfxU32 frameOrderInRefreshPeriod = frameOrderMinusOffset % refreshPeriod;
state.firstFrameInCycle = false;
bool bNoUpdate =
CO2.IntRefType == 0
|| frameOrderMinusOffset < 0 // too early to start refresh
|| frameOrderInRefreshPeriod >= CO2.IntRefCycleSize; // for current refresh period refresh cycle is already passed
if (bNoUpdate)
return state;
mfxU32 IRBlockSize = 1 << (3 + IntraRefreshBlockUnitSize);
// refreshing parts (stripes) in frame
mfxU32 refreshDimension = CO2.IntRefType == MFX_REFRESH_HORIZONTAL
? CeilDiv<mfxU32>(HEVCParam.PicHeightInLumaSamples, IRBlockSize)
: CeilDiv<mfxU32>(HEVCParam.PicWidthInLumaSamples, IRBlockSize);
// In most cases number of refresh stripes is no aligned with number of frames for refresh.
// In head frames are refreshed min stripes (can be 0), in tail min+1
// min * head + (min+1) * tail == min * frames + tail == refreshDimension
mfxU32 frames = CO2.IntRefCycleSize; // frames to commit full refresh
mfxU32 minStr = refreshDimension / frames; // minimal refreshed stripes
mfxU32 tail = refreshDimension % frames; // tail frames have minStr+1 stripes
mfxU32 head = frames - tail; // head frames with minStr stripes
if (frameOrderInRefreshPeriod < head) // min, can be 0
{
if (!minStr)
return state; // actual refresh isn't started yet within current refresh cycle, no Intra column/row required for current frame
state.IntraSize = (mfxU16)minStr;
state.IntraLocation = (mfxU16)(frameOrderInRefreshPeriod * minStr);
}
else
{
state.IntraSize = (mfxU16)(minStr + 1);
state.IntraLocation = (mfxU16)(frameOrderInRefreshPeriod * minStr + (frameOrderInRefreshPeriod - head));
}
state.firstFrameInCycle = (frameOrderInRefreshPeriod == 0);
state.refrType = CO2.IntRefType;
// set QP for Intra macroblocks within refreshing line
state.IntRefQPDelta = CO2.IntRefQPDelta;
bool bUpdateQPDelta = pCO2RT && pCO2RT->IntRefQPDelta <= 51 && pCO2RT->IntRefQPDelta >= -51;
if (bUpdateQPDelta)
state.IntRefQPDelta = pCO2RT->IntRefQPDelta;
return state;
}
mfxU8 GetCodingType(const TaskCommonPar & task)
{
const mfxU8 I = 1; // I picture.
const mfxU8 P = 2; // P or GPB picture at base temporal level.
const mfxU8 B = 3; // P, GPB or B picture at temporal level 1.
const mfxU8 B1 = 4; // P, GPB or B picture at temporal level 2.
const mfxU8 B2 = 5; // P, GPB or B picture at temporal level 3.
auto IsBX = [&](mfxU8 idx)
{
auto& ref = task.DPB.Active[idx];
return !ref.isLDB && ref.CodingType > B;
};
auto IsB0 = [&](mfxU8 idx)
{
auto& ref = task.DPB.Active[idx];
return !ref.isLDB && ref.CodingType == B;
};
mfxU8 type = 0;
type += I * IsI(task.FrameType);
type += P * (!type && IsP(task.FrameType));
type += B * (!type && task.isLDB);
type += B2 * (!type && std::any_of(task.RefPicList[0], task.RefPicList[0] + task.NumRefActive[0], IsBX));
type += B2 * (!type && std::any_of(task.RefPicList[1], task.RefPicList[1] + task.NumRefActive[1], IsBX));
type += B1 * (!type && std::any_of(task.RefPicList[0], task.RefPicList[0] + task.NumRefActive[0], IsB0));
type += B1 * (!type && std::any_of(task.RefPicList[1], task.RefPicList[1] + task.NumRefActive[1], IsB0));
type += B * !type;
return type;
}
class SkipMode
{
private:
eSkipMode m_mode;
mfxU32 m_cmd;
void SetCMD()
{
m_cmd = 0;
m_cmd |= NeedInputReplacement() * SKIPCMD_NeedInputReplacement;
m_cmd |= NeedDriverCall() * SKIPCMD_NeedDriverCall;
m_cmd |= NeedSkipSliceGen() * SKIPCMD_NeedSkipSliceGen;
m_cmd |= NeedCurrentFrameSkipping() * SKIPCMD_NeedCurrentFrameSkipping;
m_cmd |= NeedNumSkipAdding() * SKIPCMD_NeedNumSkipAdding;
}
public:
SkipMode(eSkipMode mode = SKIPFRAME_NO)
: m_mode(mode)
{
SetCMD();
}
SkipMode(mfxU16 mode, bool bProtected)
{
SetMode(mode, bProtected);
}
void SetMode(mfxU16 skipModeMFX, bool bProtected)
{
m_mode = eSkipMode(
SKIPFRAME_INSERT_DUMMY_PROTECTED * (skipModeMFX == MFX_SKIPFRAME_INSERT_DUMMY && bProtected)
+ SKIPFRAME_INSERT_DUMMY * (skipModeMFX == MFX_SKIPFRAME_INSERT_DUMMY && !bProtected)
+ SKIPFRAME_INSERT_NOTHING * (skipModeMFX == MFX_SKIPFRAME_INSERT_NOTHING)
+ SKIPFRAME_BRC_ONLY * (skipModeMFX == MFX_SKIPFRAME_BRC_ONLY));
SetCMD();
}
void SetPseudoSkip()
{
m_mode = SKIPFRAME_EXT_PSEUDO;
}
eSkipMode GetMode() { return m_mode; }
mfxU32 GetCMD() { return m_cmd; }
bool NeedInputReplacement()
{
return m_mode == SKIPFRAME_EXT_PSEUDO;
}
bool NeedDriverCall()
{
return m_mode == SKIPFRAME_INSERT_DUMMY_PROTECTED
|| m_mode == SKIPFRAME_EXT_PSEUDO
|| m_mode == SKIPFRAME_NO
|| m_mode == SKIPFRAME_EXT_PSEUDO;
}
bool NeedSkipSliceGen()
{
return m_mode == SKIPFRAME_INSERT_DUMMY_PROTECTED
|| m_mode == SKIPFRAME_INSERT_DUMMY;
}
bool NeedCurrentFrameSkipping()
{
return m_mode == SKIPFRAME_INSERT_DUMMY_PROTECTED
|| m_mode == SKIPFRAME_INSERT_DUMMY
|| m_mode == SKIPFRAME_INSERT_NOTHING;
}
bool NeedNumSkipAdding()
{
return m_mode == SKIPFRAME_BRC_ONLY;
}
};
static void SetTaskQpY(
TaskCommonPar & task
, const ExtBuffer::Param<mfxVideoParam> & par
, const SPS& sps
, const Defaults::Param& dflts)
{
const mfxExtCodingOption2& CO2 = ExtBuffer::Get(par);
const mfxExtCodingOption3& CO3 = ExtBuffer::Get(par);
const mfxU8 maxQP = mfxU8(51 + 6 * (CO3.TargetBitDepthLuma - 8));
if (par.mfx.RateControlMethod != MFX_RATECONTROL_CQP)
{
task.QpY = 0;
return;
}
bool bUseQPP = IsP(task.FrameType) || task.isLDB;
bool bUseQPB = !bUseQPP && IsB(task.FrameType);
bool bUseQPOffset =
(bUseQPB && CO2.BRefType == MFX_B_REF_PYRAMID)
|| (bUseQPP && CO3.PRefType == MFX_P_REF_PYRAMID);
// set coding type and QP
if (bUseQPB)
{
task.QpY = (mfxI8)par.mfx.QPB;
if (bUseQPOffset)
{
task.QpY = (mfxI8)mfx::clamp<mfxI32>(
CO3.QPOffset[mfx::clamp<mfxI32>(task.PyramidLevel - 1, 0, 7)] + task.QpY
, 1, maxQP);
}
}
else if (bUseQPP)
{
// encode P as GPB
task.QpY = (mfxI8)par.mfx.QPP;
if (dflts.base.GetNumTemporalLayers(dflts) > 1)
{
task.QpY = (mfxI8)mfx::clamp<mfxI32>(CO3.QPOffset[task.TemporalID] + task.QpY, 1, maxQP);
}
else if (bUseQPOffset)
{
task.QpY = (mfxI8)mfx::clamp<mfxI32>(
CO3.QPOffset[std::min<size_t>(task.PyramidLevel, Size(CO3.QPOffset) - 1)] + task.QpY
, 1, maxQP);
}
}
else
{
assert(IsI(task.FrameType));
task.QpY = (mfxI8)par.mfx.QPI;
}
SetIf(task.QpY, !!task.ctrl.QP, (mfxI8)task.ctrl.QP);
task.QpY -= 6 * sps.bit_depth_luma_minus8;
task.QpY &= 0xff * !(task.QpY < 0 && IsOn(par.mfx.LowPower));
}
void Legacy::ConfigureTask(
TaskCommonPar & task
, const Defaults::Param& dflts
, const SPS& sps)
{
auto& par = dflts.mvp;
const mfxExtCodingOption& CO = ExtBuffer::Get(par);
const mfxExtCodingOption2& CO2 = ExtBuffer::Get(par);
const mfxExtCodingOption3& CO3 = ExtBuffer::Get(par);
const bool isI = IsI(task.FrameType);
const bool isP = IsP(task.FrameType);
const bool isIDR = IsIdr(task.FrameType);
mfxExtAVCRefLists* pExtLists = ExtBuffer::Get(task.ctrl);
mfxExtAVCRefListCtrl* pExtListCtrl = ExtBuffer::Get(task.ctrl);
{
const mfxExtCodingOption2* pCO2 = ExtBuffer::Get(task.ctrl);
SkipMode mode;
SetDefault(pCO2, &CO2);
mode.SetMode(mfxU16(!!task.ctrl.SkipFrame * pCO2->SkipFrame), !!par.Protected);
task.FrameType &= ~(MFX_FRAMETYPE_REF
* (mode.NeedCurrentFrameSkipping() && par.mfx.GopRefDist == 1 && isP));
if (IsRef(task.FrameType))
{
task.ctrl.SkipFrame = 0;
mode.SetMode(MFX_SKIPFRAME_NO_SKIP, !!par.Protected);
}
task.SkipCMD = mode.GetCMD();
}
task.ctrl.MfxNalUnitType &= 0xffff * IsOn(CO3.EnableNalUnitType);
const mfxExtMBQP *pMBQP = ExtBuffer::Get(task.ctrl);
task.bCUQPMap |= (IsOn(CO3.EnableMBQP) && pMBQP && pMBQP->NumQPAlloc > 0); // Do not use IsMBQP()
bool bUpdateIRState = task.TemporalID == 0 && CO2.IntRefType;
if (bUpdateIRState)
{
m_baseLayerOrder *= !isI;
task.IRState = GetIntraRefreshState(
par, task.ctrl, m_baseLayerOrder++, dflts.caps.IntraRefreshBlockUnitSize);
}
if (IsTCBRC(par, dflts.caps.TCBRCSupport) && task.TCBRCTargetFrameSize == 0)
{
ThrowAssert(par.mfx.FrameInfo.FrameRateExtD == 0, "FrameRateExtD = 0");
mfxU32 AvgFrameSizeInBytes = mfxU32(1000.0 / 8.0*(par.mfx.TargetKbps) * std::max<mfxU32>(par.mfx.BRCParamMultiplier,1) /
(mfxF64(par.mfx.FrameInfo.FrameRateExtN) / par.mfx.FrameInfo.FrameRateExtD));
task.TCBRCTargetFrameSize = AvgFrameSizeInBytes;
}
mfxU32 needRecoveryPointSei = (CO.RecoveryPointSEI == MFX_CODINGOPTION_ON
&& ( (CO2.IntRefType && task.IRState.firstFrameInCycle && task.IRState.IntraLocation == 0)
|| (CO2.IntRefType == 0 && isI)));
mfxU32 needCpbRemovalDelay = isIDR || needRecoveryPointSei;
const bool isRef = IsRef(task.FrameType);
// encode P as GPB
task.isLDB = IsOn(CO3.GPB) && isP;
task.FrameType &= ~(MFX_FRAMETYPE_P * task.isLDB);
task.FrameType |= (MFX_FRAMETYPE_B * task.isLDB);
task.LastKeyFrameInfo = m_prevTask.LastKeyFrameInfo;
task.PrevRAP = m_prevTask.PrevRAP;
task.EncodedOrder = m_prevTask.EncodedOrder + 1;
InitDPB(task, m_prevTask, pExtListCtrl);
//construct ref lists
std::tie(task.NumRefActive[0], task.NumRefActive[1]) = dflts.base.GetFrameNumRefActive(dflts, task);
if (!isI)
{
ConstructRPL(dflts, task.DPB.Active, task, task.RefPicList, task.NumRefActive, pExtLists, pExtListCtrl);
}
SetTaskQpY(task, par, sps, dflts);
task.CodingType = GetCodingType(task);
task.InsertHeaders |= m_forceHeaders;
m_forceHeaders = 0;
task.InsertHeaders |= (INSERT_VPS | INSERT_SPS | INSERT_PPS) * isIDR;
task.InsertHeaders |= INSERT_BPSEI * (needCpbRemovalDelay && sps.vui.hrd_parameters_present_flag );
task.InsertHeaders |= INSERT_PTSEI
* (sps.vui.frame_field_info_present_flag
|| sps.vui.hrd.nal_hrd_parameters_present_flag
|| sps.vui.hrd.vcl_hrd_parameters_present_flag);
task.InsertHeaders |= INSERT_PPS * IsOn(CO2.RepeatPPS);
task.InsertHeaders |= INSERT_AUD * IsOn(CO.AUDelimiter);
// update dpb
std::copy(task.DPB.Active, task.DPB.Active + Size(task.DPB.Active), task.DPB.After);
Remove(task.DPB.After, 0, MAX_DPB_SIZE * isIDR);
if (isRef)
{
task.LastKeyFrameInfo.lastIPoc = isI * task.POC + !isI * task.LastKeyFrameInfo.lastIPoc;
UpdateDPB(dflts, task, task.DPB.After, pExtListCtrl);
using TRLtrDesc = decltype(pExtListCtrl->LongTermRefList[0]);
auto IsCurFrame = [&](TRLtrDesc ltr)
{
return ltr.FrameOrder == task.DisplayOrder;
};
task.isLTR |=
pExtListCtrl
&& std::any_of(
std::begin(pExtListCtrl->LongTermRefList)
, std::end(pExtListCtrl->LongTermRefList)
, IsCurFrame);
}
task.SliceNUT = dflts.base.GetSHNUT(dflts, task, true);
bool bRAP =
task.SliceNUT == CRA_NUT
|| task.SliceNUT == IDR_W_RADL
|| task.SliceNUT == IDR_N_LP;
task.PrevRAP = bRAP * task.POC + !bRAP * task.PrevRAP;
task.StatusReportId = std::max<mfxU32>(1, m_prevTask.StatusReportId + 1);
task.bForceSync = !!(task.InsertHeaders & INSERT_BPSEI);
if (task.FrameType & MFX_FRAMETYPE_I)
{
task.m_minQP = CO2.MinQPI;
task.m_maxQP = CO2.MaxQPI;
}
else if (task.FrameType & MFX_FRAMETYPE_P)
{
task.m_minQP = CO2.MinQPP;
task.m_maxQP = CO2.MaxQPP;
}
else if (task.FrameType & MFX_FRAMETYPE_B)
{
task.m_minQP = CO2.MinQPB;
task.m_maxQP = CO2.MaxQPB;
}
m_prevTask = task;
}
static mfxU32 CountL1(DpbArray const & dpb, mfxI32 poc)
{
mfxU32 c = 0;
for (mfxU32 i = 0; !isDpbEnd(dpb, i); i++)
c += dpb[i].POC > poc;
return c;
}
static mfxU32 GetEncodingOrder(
mfxU32 displayOrder
, mfxU32 begin
, mfxU32 end
, mfxU32 &level
, mfxU32 before
, bool & ref)
{
assert(displayOrder >= begin);
assert(displayOrder < end);
ref = (end - begin > 1);
mfxU32 pivot = (begin + end) / 2;
if (displayOrder == pivot)
return level + before;
level++;
if (displayOrder < pivot)
return GetEncodingOrder(displayOrder, begin, pivot, level, before, ref);
else
return GetEncodingOrder(displayOrder, pivot + 1, end, level, before + pivot - begin, ref);
}
mfxU32 Legacy::GetBiFrameLocation(mfxU32 i, mfxU32 num, bool &ref, mfxU32 &level)
{
ref = false;
level = 1;
return GetEncodingOrder(i, 0, num, level, 0, ref);
}
Legacy::TItWrapIt Legacy::BPyrReorder(TItWrapIt begin, TItWrapIt end)
{
using TRef = std::iterator_traits<TItWrapIt>::reference;
mfxU32 num = mfxU32(std::distance(begin, end));
bool bSetOrder = num && (*begin)->BPyramidOrder == mfxU32(MFX_FRAMEORDER_UNKNOWN);
if (bSetOrder)
{
mfxU32 i = 0;
std::for_each(begin, end, [&](TRef bref)
{
bool bRef = false;
bref->BPyramidOrder = Legacy::GetBiFrameLocation(i++, num, bRef, bref->PyramidLevel);
bref->FrameType |= mfxU16(MFX_FRAMETYPE_REF * bRef);
});
}
return std::min_element(begin, end
, [](TRef a, TRef b) { return a->BPyramidOrder < b->BPyramidOrder; });
}
Legacy::TItWrap Legacy::Reorder(
ExtBuffer::Param<mfxVideoParam> const & par
, DpbArray const & dpb
, TItWrap begin
, TItWrap end
, bool flush)
{
using TRef = TItWrap::reference;
const mfxExtCodingOption2& CO2 = ExtBuffer::Get(par);
bool isBPyramid = (CO2.BRefType == MFX_B_REF_PYRAMID);
TItWrap top = begin;
std::list<TItWrap> brefs;
auto IsB = [](TRef f) { return HEVCEHW::IsB(f.FrameType); };
auto NoL1 = [&](TItWrap& f) { return !CountL1(dpb, f->POC); };
std::generate_n(
std::back_inserter(brefs)
, std::distance(begin, std::find_if_not(begin, end, IsB))
, [&]() { return top++; });
brefs.remove_if(NoL1);
bool bNoPyramidB = !isBPyramid && !brefs.empty();
if (bNoPyramidB)
{
auto B0POC = brefs.front()->POC;
auto RefB = [B0POC](TItWrap& f)
{
return IsRef(f->FrameType) && (f->POC - B0POC < 2);
};
TItWrapIt BCand[2] =
{
std::find_if(brefs.begin() , brefs.end(), RefB)
, brefs.begin()
};
return *BCand[BCand[0] == brefs.end()];
}
if (!brefs.empty())
return *BPyrReorder(brefs.begin(), brefs.end());
bool bForcePRef = flush && top == end && begin != end;
if (bForcePRef)
{
--top;
top->FrameType = mfxU16(MFX_FRAMETYPE_P | MFX_FRAMETYPE_REF);
}
return top;
}
std::tuple<mfxStatus, mfxU16, mfxU16>
Legacy::GetCUQPMapBlockSize(
mfxU16 frameWidth
, mfxU16 frameHeight
, mfxU16 CUQPWidth
, mfxU16 CUHeight)
{
bool bValid = CUQPWidth && CUHeight;
if (bValid)
{
const mfxU16 BlkSizes[] = { 4, 8, 16, 32, 64 };
auto itBlkWidth = std::lower_bound(BlkSizes, std::end(BlkSizes), frameWidth / CUQPWidth);
auto itBlkHeight = std::lower_bound(BlkSizes, std::end(BlkSizes), frameHeight / CUHeight);
bValid =
itBlkWidth != std::end(BlkSizes)
&& itBlkHeight != std::end(BlkSizes)
&& (*itBlkWidth * (CUQPWidth - 1) < frameWidth)
&& (*itBlkHeight * (CUHeight - 1) < frameHeight);
if (bValid)
return std::make_tuple(MFX_ERR_NONE, *itBlkWidth, *itBlkHeight);
}
return std::make_tuple(MFX_ERR_UNDEFINED_BEHAVIOR, mfxU16(0), mfxU16(0));
}
mfxU32 Legacy::GetMinBsSize(
const ExtBuffer::Param<mfxVideoParam>& par)
{
const mfxExtHEVCParam& HEVCParam = ExtBuffer::Get(par);
const mfxExtCodingOption3& CO3 = ExtBuffer::Get(par);
mfxU32 size = HEVCParam.PicHeightInLumaSamples * HEVCParam.PicWidthInLumaSamples;
SetDefault(size, par.mfx.FrameInfo.Width * par.mfx.FrameInfo.Height);
bool b10bit = (CO3.TargetBitDepthLuma == 10);
bool b422 = (CO3.TargetChromaFormatPlus1 == (MFX_CHROMAFORMAT_YUV422 + 1));
bool b444 = (CO3.TargetChromaFormatPlus1 == (MFX_CHROMAFORMAT_YUV444 + 1));
mfxF64 k = 2.0
+ (b10bit * 0.3)
+ (b422 * 0.5)
+ (b444 * 1.5);
size = mfxU32(k * size);
bool bUseAvgSize =
par.mfx.RateControlMethod == MFX_RATECONTROL_CBR
&& IsSWBRC(par)
&& par.mfx.FrameInfo.FrameRateExtD != 0;
if (!bUseAvgSize)
return size;
mfxU32 avgSize = TargetKbps(par.mfx) * 1000 * par.mfx.FrameInfo.FrameRateExtD / (par.mfx.FrameInfo.FrameRateExtN * 8);
return std::max<mfxU32>(size, avgSize * 2);
}
typedef std::remove_reference<decltype(((mfxExtAVCRefListCtrl*)nullptr)->PreferredRefList[0])>::type TLCtrlRLE;
void Legacy::InitDPB(
TaskCommonPar & task,
TaskCommonPar const & prevTask,
const mfxExtAVCRefListCtrl* pLCtrl)
{
bool b1stTrail =
task.POC > task.PrevRAP
&& prevTask.POC <= prevTask.PrevRAP;
if ((task.IRState.refrType && !task.IRState.firstFrameInCycle) // IntRefCycle
|| (!task.IRState.refrType && prevTask.IRState.refrType)) // First frame after IntRefCycle
{
Remove(task.DPB.Active, 0, MAX_DPB_SIZE);
for (mfxU8 i = 0; !isDpbEnd(prevTask.DPB.After, i); i++)
{
const DpbFrame& ref = prevTask.DPB.After[i]; // initial POC = -1
if (ref.POC > task.DPB.Active[0].POC && ref.TemporalID == 0) // disable multiref within IntraRefCycle and next frame
// and update DPB.Active only if temporal layer id = 0 for IntraRef cases
task.DPB.Active[0] = ref;
}
}
else if (b1stTrail)
{
Remove(task.DPB.Active, 0, MAX_DPB_SIZE);
// Temporally always check, will add mode to disable this check.
std::copy_if(
prevTask.DPB.After
, prevTask.DPB.After + Size(prevTask.DPB.After)
, task.DPB.Active
, [&](const DpbFrame& ref)
{
return isValid(ref) && (ref.POC == task.PrevRAP || ref.isLTR);
});
}
else
{
std::copy_n(prevTask.DPB.After, Size(prevTask.DPB.After), task.DPB.Active);
}
std::copy_n(prevTask.DPB.After, Size(prevTask.DPB.After), task.DPB.Before);
DpbArray& dpb = task.DPB.Active;
auto dpbEnd = std::find_if_not(dpb, dpb + Size(dpb), isValid);
dpbEnd = RemoveIf(dpb, dpbEnd
, [&](const DpbFrame& ref)
{
return ref.TemporalID > 0 && ref.TemporalID >= task.TemporalID;
});
if (pLCtrl)
{
std::list<mfxU32> rejectIDX;
std::transform(
std::begin(pLCtrl->RejectedRefList)
, std::end(pLCtrl->RejectedRefList)
, std::back_inserter(rejectIDX)
, [&](const TLCtrlRLE& lt)
{
mfxU16 idx = GetDPBIdxByFO(dpb, lt.FrameOrder);
bool bInvalid = (idx >= MAX_DPB_SIZE) || !dpb[idx].isLTR;
return std::max(lt.FrameOrder, mfxU32(bInvalid * MFX_FRAMEORDER_UNKNOWN));
});
rejectIDX.sort();
rejectIDX.unique();
rejectIDX.remove(mfxU32(MFX_FRAMEORDER_UNKNOWN));
std::for_each(rejectIDX.begin(), rejectIDX.end()
, [&](mfxU32 fo)
{
Remove(dpb, GetDPBIdxByFO(dpb, fo));
});
}
}
mfxU16 Legacy::UpdateDPB(
const Defaults::Param& def
, const DpbFrame& task
, DpbArray & dpb
, const mfxExtAVCRefListCtrl * pLCtrl)
{
auto& par = def.mvp;
const mfxExtCodingOption2& CO2 = ExtBuffer::Get(par);
bool isBPyramid = (CO2.BRefType == MFX_B_REF_PYRAMID);
mfxU16 end = 0; // DPB end
mfxU16 st0 = 0; // first ST ref in DPB
bool bClearCodingType = isBPyramid && (task.isLDB || task.CodingType < CODING_TYPE_B);
auto ClearCodingType = [](DpbFrame& ref) { ref.CodingType = 0; };
auto IsLTR = [](DpbFrame& f) { return f.isLTR; };
auto POCLess = [](DpbFrame& l, DpbFrame& r) { return l.POC < r.POC; };
end = mfxU16(std::find_if_not(dpb, dpb + Size(dpb), isValid) - dpb);
st0 = mfxU16(std::find_if_not(dpb, dpb + end, IsLTR) - dpb);
// frames stored in DPB in POC ascending order,
// LTRs before STRs (use LTR-candidate as STR as long as it is possible)
std::sort(dpb, dpb + st0, POCLess);
std::sort(dpb + st0, dpb + end, POCLess);
// sliding window over STRs
bool bRunSlidingWindow = end && end == par.mfx.NumRefFrame;
if (bRunSlidingWindow)
{
st0 = mfxU16(def.base.GetWeakRef(def, task, dpb + st0, dpb + end) - dpb);
Remove(dpb, st0 * (st0 < end));
--end;
}
ThrowAssert(end >= MAX_DPB_SIZE, "DPB overflow, no space for new frame");
//don't keep coding types for prev. mini-GOP
std::for_each(dpb, dpb + (end * bClearCodingType), ClearCodingType);
dpb[end++] = task;
if (pLCtrl)
{
st0 = mfxU16(std::find_if_not(dpb, dpb + end, IsLTR) - dpb);
auto lctrlLtrEnd = std::find_if(
pLCtrl->LongTermRefList
, pLCtrl->LongTermRefList + Size(pLCtrl->LongTermRefList)
, [](const TLCtrlRLE& lt) { return lt.FrameOrder == mfxU32(MFX_FRAMEORDER_UNKNOWN); });
std::list<mfxU16> markLTR;
std::transform(pLCtrl->LongTermRefList, lctrlLtrEnd, std::back_inserter(markLTR)
, [&](const TLCtrlRLE& lt)
{
mfxU16 idx = GetDPBIdxByFO(dpb, lt.FrameOrder);
idx += !!dpb[idx].isLTR * MAX_DPB_SIZE;
return std::min<mfxU16>(idx, MAX_DPB_SIZE);
});
markLTR.sort();
markLTR.remove(mfxU16(MAX_DPB_SIZE));
markLTR.unique();
std::for_each(markLTR.begin(), markLTR.end()
, [&](mfxU16 idx)
{
DpbFrame ltr = dpb[idx];
ltr.isLTR = true;
Remove(dpb, idx);
Insert(dpb, st0, ltr);
st0++;
});
std::sort(dpb, dpb + st0, POCLess);
}
return end;
}
void Legacy::ConstructRPL(
const Defaults::Param& dflts
, const DpbArray & DPB
, const FrameBaseInfo& cur
, mfxU8(&RefPicList)[2][MAX_DPB_SIZE]
, mfxU8(&numRefActive)[2]
, const mfxExtAVCRefLists * pExtLists
, const mfxExtAVCRefListCtrl * pLCtrl)
{
auto GetRPLFromExt = [&]()
{
return dflts.base.GetRPLFromExt(
dflts
, DPB
, numRefActive[0]
, numRefActive[1]
, *pExtLists
, RefPicList);
};
auto GetRPLFromCtrl = [&]()
{
return dflts.base.GetRPLFromCtrl (
dflts
, DPB
, numRefActive[0]
, numRefActive[1]
, cur
, *pLCtrl
, RefPicList);
};
std::tuple<mfxU8, mfxU8> nRef(mfxU8(0), mfxU8(0));
SetIf(nRef, !!pExtLists, GetRPLFromExt);
SetIf(nRef, !std::get<0>(nRef)
, dflts.base.GetRefPicList
, dflts
, DPB
, numRefActive[0]
, numRefActive[1]
, cur
, RefPicList);
SetIf(nRef, !!pLCtrl, GetRPLFromCtrl);
ThrowAssert(!std::get<0>(nRef), "L0 is empty");
nRef = dflts.base.GetRPLMod(
dflts
, DPB
, numRefActive[0]
, numRefActive[1]
, cur
, RefPicList);
numRefActive[0] = std::get<0>(nRef);
numRefActive[1] = std::get<1>(nRef);
}
void Legacy::ConstructSTRPS(
const DpbArray & DPB
, const mfxU8(&RefPicList)[2][MAX_DPB_SIZE]
, const mfxU8(&numRefActive)[2]
, mfxI32 poc
, STRPS& rps)
{
mfxU32 i, nRef;
for (i = 0, nRef = 0; !isDpbEnd(DPB, i); i ++)
{
if (DPB[i].isLTR)
continue;
rps.pic[nRef].DeltaPocSX = (mfxI16)(DPB[i].POC - poc);
rps.pic[nRef].used_by_curr_pic_sx_flag = IsCurrRef(DPB, RefPicList, numRefActive, DPB[i].POC);
rps.num_negative_pics += rps.pic[nRef].DeltaPocSX < 0;
rps.num_positive_pics += rps.pic[nRef].DeltaPocSX > 0;
nRef ++;
}
std::sort(rps.pic, rps.pic + nRef
, [](decltype(rps.pic[0]) l, decltype(rps.pic[0]) r) { return l.DeltaPocSX < r.DeltaPocSX; });
std::sort(rps.pic, rps.pic + rps.num_negative_pics
, [](decltype(rps.pic[0]) l, decltype(rps.pic[0]) r) { return l.DeltaPocSX > r.DeltaPocSX; });
for (i = 0; i < nRef; i ++)
{
mfxI16 prev = (!i || i == rps.num_negative_pics) ? 0 : rps.pic[i-1].DeltaPocSX;
rps.pic[i].delta_poc_sx_minus1 = mfxU16(abs(rps.pic[i].DeltaPocSX - prev) - 1);
}
}
mfxU32 EstimateRpsBits(const STRPS* pSpsRps, mfxU8 nSet, const STRPS & rps, mfxU8 idx)
{
auto NBitsUE = [](mfxU32 b) -> mfxU32
{
return CeilLog2(b + 2) * 2 - 1;
};
auto IsNotUsed = [](const STRPSPic& pic)
{
return !pic.used_by_curr_pic_flag;
};
auto AccNBitsDPoc = [&](mfxU32 x, const STRPSPic& pic)
{
return std::move(x) + NBitsUE(pic.delta_poc_sx_minus1) + 1;
};
mfxU32 n = (idx != 0);
if (!rps.inter_ref_pic_set_prediction_flag)
{
mfxU32 nPic = mfxU32(rps.num_negative_pics + rps.num_positive_pics);
n += NBitsUE(rps.num_negative_pics);
n += NBitsUE(rps.num_positive_pics);
return std::accumulate(rps.pic, rps.pic + nPic, n, AccNBitsDPoc);
}
assert(idx > rps.delta_idx_minus1);
STRPS const & ref = pSpsRps[idx - rps.delta_idx_minus1 - 1];
mfxU32 nPic = mfxU32(ref.num_negative_pics + ref.num_positive_pics);
if (idx == nSet)
n += NBitsUE(rps.delta_idx_minus1);
n += 1;
n += NBitsUE(rps.abs_delta_rps_minus1);
n += nPic;
n += mfxU32(std::count_if(rps.pic, rps.pic + nPic + 1, IsNotUsed));
return n;
}
bool GetInterRps(STRPS const & refRPS, STRPS& rps, mfxU8 dIdxMinus1)
{
auto oldRPS = rps;
auto newRPS = oldRPS;
newRPS.inter_ref_pic_set_prediction_flag = 1;
newRPS.delta_idx_minus1 = dIdxMinus1;
std::list<mfxI16> dPocs[2];
auto AddDPoc = [&dPocs](mfxI16 dPoc)
{
if (dPoc)
dPocs[dPoc > 0].push_back(dPoc);
};
std::for_each(oldRPS.pic, oldRPS.pic + oldRPS.num_negative_pics + oldRPS.num_positive_pics
, [&](STRPSPic& oldPic)
{
AddDPoc(oldPic.DeltaPocSX);
std::for_each(refRPS.pic, refRPS.pic + refRPS.num_negative_pics + refRPS.num_positive_pics
, [&](const STRPSPic& refPic)
{
AddDPoc(oldPic.DeltaPocSX - refPic.DeltaPocSX);
});
});
dPocs[0].sort(std::greater<mfxI16>());
dPocs[1].sort(std::less<mfxI16>());
dPocs[0].unique();
dPocs[1].unique();
mfxI16 dPoc = 0;
bool bDPocFound = false;
auto NextDPock = [&]()
{
return ((!dPocs[0].empty() || !dPocs[1].empty()) && !bDPocFound);
};
while (NextDPock())
{
dPoc *= -1;
bool bPositive = (dPoc > 0 && !dPocs[1].empty()) || dPocs[0].empty();
dPoc = dPocs[bPositive].front();
dPocs[bPositive].pop_front();
std::for_each(newRPS.pic
, newRPS.pic + refRPS.num_negative_pics + refRPS.num_positive_pics + 1
, [&](STRPSPic& newPic)
{
newPic.used_by_curr_pic_flag = 0;
newPic.use_delta_flag = 0;
});
auto pOldPic = oldRPS.pic;
auto UseDelta = [&pOldPic, dPoc](STRPSPic& newPic, mfxI16 refDeltaPocSX, mfxI16 sign)
{
bool bUse =
((pOldPic->DeltaPocSX * sign) > 0)
&& ((pOldPic->DeltaPocSX - refDeltaPocSX) == dPoc);
newPic.used_by_curr_pic_flag =
(bUse && pOldPic->used_by_curr_pic_sx_flag)
|| (!bUse && newPic.used_by_curr_pic_flag);
newPic.use_delta_flag = bUse || (!bUse && newPic.use_delta_flag);
pOldPic += bUse;
};
auto pRefPic = refRPS.pic + refRPS.num_negative_pics + refRPS.num_positive_pics - 1;
std::for_each(
MakeRIter(newRPS.pic + refRPS.num_negative_pics + refRPS.num_positive_pics)
, MakeRIter(newRPS.pic + refRPS.num_negative_pics)
, [&](STRPSPic& newPic)
{
UseDelta(newPic, pRefPic->DeltaPocSX, -1);
--pRefPic;
});
UseDelta(newRPS.pic[refRPS.num_negative_pics + refRPS.num_positive_pics], 0, (dPoc < 0) * -1);
pRefPic = refRPS.pic;
std::for_each(newRPS.pic, newRPS.pic + refRPS.num_negative_pics
, [&](STRPSPic& newPic)
{
UseDelta(newPic, pRefPic->DeltaPocSX, -1);
++pRefPic;
});
if (pOldPic != (oldRPS.pic + oldRPS.num_negative_pics))
continue;
pRefPic = refRPS.pic + refRPS.num_negative_pics - 1;
std::for_each(
MakeRIter(newRPS.pic + refRPS.num_negative_pics)
, MakeRIter(newRPS.pic)
, [&](STRPSPic& newPic)
{
UseDelta(newPic, pRefPic->DeltaPocSX, +1);
--pRefPic;
});
UseDelta(newRPS.pic[refRPS.num_negative_pics + refRPS.num_positive_pics], 0, dPoc > 0);
pRefPic = refRPS.pic + refRPS.num_negative_pics;
std::for_each(
newRPS.pic + refRPS.num_negative_pics
, newRPS.pic + refRPS.num_negative_pics + refRPS.num_positive_pics
, [&](STRPSPic& newPic)
{
UseDelta(newPic, pRefPic->DeltaPocSX, +1);
++pRefPic;
});
bDPocFound = (pOldPic == (oldRPS.pic + oldRPS.num_negative_pics + oldRPS.num_positive_pics));
}
newRPS.delta_rps_sign = (dPoc < 0);
newRPS.abs_delta_rps_minus1 = mfxU16(abs(dPoc) - 1);
SetIf(rps, bDPocFound, newRPS);
return bDPocFound;
}
void OptimizeSTRPS(const STRPS* pSpsRps, mfxU8 n, STRPS& oldRPS, mfxU8 idx)
{
auto IsEnoughPics = [&](const STRPS& refRPS)
{
return (refRPS.num_negative_pics + refRPS.num_positive_pics + 1)
< (oldRPS.num_negative_pics + oldRPS.num_positive_pics);
};
auto itRBegin = MakeRIter(pSpsRps + idx);
auto itREnd = MakeRIter(pSpsRps + ((idx < n && idx > 1) * (idx - 1)));
auto itSearchRBegin = std::find_if_not(itRBegin, itREnd, IsEnoughPics);
mfxU8 dIdxMinus1 = mfxU8(std::distance(itRBegin, itSearchRBegin));
auto UpdateRPS = [&](const STRPS& refRPS)
{
STRPS newRPS = oldRPS;
bool bUpdateRps =
GetInterRps(refRPS, newRPS, dIdxMinus1++)
&& (EstimateRpsBits(pSpsRps, n, newRPS, idx) < EstimateRpsBits(pSpsRps, n, oldRPS, idx));
SetIf(oldRPS, bUpdateRps, newRPS);
};
auto itSearchREnd = itREnd;
bool b1Ref = (idx < n) && (itSearchRBegin != itREnd);
SetIf(itSearchREnd, b1Ref, std::next(itSearchRBegin, b1Ref));
std::for_each(itSearchRBegin, itSearchREnd, UpdateRPS);
}
bool Equal(const STRPS & l, const STRPS & r)
{
//ignore inter_ref_pic_set_prediction_flag, check only DeltaPocSX
auto IsSame = [](const STRPSPic & l, const STRPSPic & r)
{
return
l.DeltaPocSX == r.DeltaPocSX
&& l.used_by_curr_pic_sx_flag == r.used_by_curr_pic_sx_flag;
};
auto nPic = l.num_negative_pics + l.num_positive_pics;
return
l.num_negative_pics == r.num_negative_pics
&& l.num_positive_pics == r.num_positive_pics
&& (std::mismatch(l.pic, l.pic + nPic, r.pic, IsSame) == std::make_pair(l.pic + nPic, r.pic + nPic));
}
void Legacy::SetSTRPS(
const Defaults::Param& dflts
, SPS& sps
, const Reorderer& reorder)
{
std::list<StorageRW> frames;
auto& par = dflts.mvp;
STRPS sets[65] = {};
auto pSetsBegin = sets;
auto pSetsEnd = pSetsBegin;
bool bTL = dflts.base.GetNumTemporalLayers(dflts) > 1;
mfxI32 nGops = par.mfx.IdrInterval + !par.mfx.IdrInterval * 4;
mfxI32 stDist = std::min<mfxI32>(par.mfx.GopPicSize * nGops, 128);
mfxLastKeyFrameInfo m_LastKeyFrameInfo = {};
bool bDone = false;
mfxI32 i = 0;
mfxI32 RAPPOC = -1; // if >= 0 first frame with bigger POC clears refs previous to RAP
bool bFields = (par.mfx.FrameInfo.PicStruct & (MFX_PICSTRUCT_FIELD_TOP | MFX_PICSTRUCT_FIELD_BOTTOM));
bool bIisRAP = !bFields; // control to match real encoding here
Reorderer localReorder;
DpbArray dpb;
localReorder = reorder;
localReorder.DPB = &dpb; //use own DPB
do
{
{
FrameBaseInfo fi;
mfxGopHints GopHints = {};
auto sts = dflts.base.GetPreReorderInfo(dflts, fi, nullptr, nullptr, m_LastKeyFrameInfo, mfxU32(i), GopHints);
ThrowIf(!!sts, "failed at GetPreReorderInfo");
SetIf(m_LastKeyFrameInfo.lastIPOrder, !IsB(fi.FrameType), i);
frames.push_back(StorageRW());
frames.back().Insert(Task::Common::Key, new FrameBaseInfo(fi));
}
auto frIt = localReorder(frames.begin(), frames.end(), false);
bool bNext = frIt == frames.end();
FrameBaseInfo* cur = nullptr;
SetIf(cur, !bNext, [&]() { return &frIt->Write<FrameBaseInfo>(Task::Common::Key); });
bDone =
(i > 0 && !bNext && IsIdr(cur->FrameType))
|| (!bNext && cur->POC >= stDist)
|| (pSetsEnd + 1) >= std::end(sets);
bNext |= bDone;
if (!bNext)
{
bool bAfterRAP = (RAPPOC >= 0) && (cur->POC > RAPPOC); // if true - need to remove refs <RAPPOC
RemoveIf(dpb, dpb + Size(dpb) * (bTL | bAfterRAP)
, [&](DpbFrame& ref)
{
return
isValid(ref)
&& ((bAfterRAP && ref.POC != RAPPOC && !ref.isLTR) // only RAP and LTR remains
|| (ref.TemporalID > 0 && ref.TemporalID >= cur->TemporalID));
});
bool bIDR = IsIdr(cur->FrameType);
bool bI = IsI(cur->FrameType);
bool bB = IsB(cur->FrameType);
bool bP = IsP(cur->FrameType);
bool bRef = IsRef(cur->FrameType);
SetIf(RAPPOC, bAfterRAP, -1); // clear after use
SetIf(RAPPOC, bI && bIisRAP, cur->POC); // enable at I if conrol allows
if (!bIDR)
{
mfxU8 nRef[2] = {};
mfxU8 RefPicList[2][MAX_DPB_SIZE];
std::fill_n(RefPicList[0], Size(RefPicList[0]), IDX_INVALID);
std::fill_n(RefPicList[1], Size(RefPicList[1]), IDX_INVALID);
auto SetRPL = [&]()
{
ConstructRPL(dflts, dpb, *cur, RefPicList, nRef);
return true;
};
std::tie(nRef[0], nRef[1]) = dflts.base.GetFrameNumRefActive(dflts, *cur);
bool bRPL =
(bB && nRef[0] && SetRPL())
|| (bP && nRef[0] && SetRPL())
|| (bI); //I picture is not using any refs, but saves them in RPS to be used by future pics.
// but currently every I is RAP and frames after it won't use refs before it
ThrowAssert(!bRPL, "failed to construct RefPicList");
STRPS rps = {};
ConstructSTRPS(dpb, RefPicList, nRef, cur->POC, rps);
auto pCurSet = std::find_if(pSetsBegin, pSetsEnd
, [&](const STRPS& x) { return Equal(x, rps); });
pSetsEnd += SetIf(*pCurSet, pSetsEnd == pCurSet, rps);
++pCurSet->WeightInGop;
}
SetIf(m_LastKeyFrameInfo.lastIPoc, bI, cur->POC);
DpbFrame tmp;
(FrameBaseInfo&)tmp = *cur;
tmp.Rec.Idx += bRef;
ThrowAssert(bRef && !UpdateDPB(dflts, tmp, dpb), "failed to UpdateDPB");
frames.erase(frIt);
}
++i;
} while (!bDone);
mfxU8 nSet = mfxU8(std::distance(pSetsBegin, pSetsEnd));
auto IsRpsOptimal = [&nSet, &par, pSetsBegin](const STRPS& curRps)
{
STRPS rps = curRps;
mfxU32 n = curRps.WeightInGop; //current RPS used for N frames
//bits for RPS in SPS and SSHs
mfxU32 bits0 =
EstimateRpsBits(pSetsBegin, nSet, rps, nSet - 1) //bits for RPS in SPS
+ (CeilLog2(nSet + 1) - CeilLog2(nSet)) * 2 //diff of bits for STRPS num in SPS (ue() coded)
+ (nSet > 1) * (par.mfx.NumSlice * CeilLog2(nSet) * n); //bits for RPS idx in SSHs
// count frames that use SPS RPS
auto AccFrWithRPS = [](mfxU32 x, const STRPS& r)
{
return std::move(x) + r.inter_ref_pic_set_prediction_flag * r.WeightInGop;
};
if (CeilLog2(nSet) - CeilLog2(nSet - 1)) //diff RPS idx bits with bigger RPS for ALL frames
bits0 = par.mfx.NumSlice * std::accumulate(pSetsBegin, pSetsBegin + nSet - 1, bits0, AccFrWithRPS);
//emulate removal of current RPS from SPS
--nSet;
rps.inter_ref_pic_set_prediction_flag = 0;
OptimizeSTRPS(pSetsBegin, nSet, rps, nSet);
//bits for RPS in SSHs (no RPS in SPS)
mfxU32 bits1 =
EstimateRpsBits(pSetsBegin, nSet, rps, nSet)
* par.mfx.NumSlice
* n;
return bits0 <= bits1;
};
std::sort(pSetsBegin, pSetsEnd
, [&](const STRPS& l, const STRPS& r) { return l.WeightInGop > r.WeightInGop; });
i = 0;
std::for_each(pSetsBegin, pSetsEnd
, [&](STRPS& sf) { OptimizeSTRPS(sets, nSet, sf, mfxU8(i++)); });
auto ritLastRps = std::find_if(MakeRIter(pSetsEnd), MakeRIter(pSetsBegin), IsRpsOptimal);
// Also makes sense to try cut nSet to 2^n. Shorter idx code can overweight
sps.num_short_term_ref_pic_sets = mfxU8(std::distance(ritLastRps, MakeRIter(pSetsBegin)));
std::copy_n(pSetsBegin, sps.num_short_term_ref_pic_sets, sps.strps);
}
mfxStatus Legacy::CheckSPS(const SPS& sps, const ENCODE_CAPS_HEVC& caps, eMFXHWType hw)
{
(void)hw;
MFX_CHECK_COND(
sps.log2_min_luma_coding_block_size_minus3 == 0
&& sps.separate_colour_plane_flag == 0
&& sps.pcm_enabled_flag == 0);
MFX_CHECK_COND(sps.amp_enabled_flag == 1);
MFX_CHECK_COND(
!( (!caps.YUV444ReconSupport && (sps.chroma_format_idc == 3))
|| (!caps.YUV422ReconSupport && (sps.chroma_format_idc == 2))
|| (caps.Color420Only && (sps.chroma_format_idc != 1))));
MFX_CHECK_COND(
!( sps.pic_width_in_luma_samples > caps.MaxPicWidth
|| sps.pic_height_in_luma_samples > caps.MaxPicHeight));
MFX_CHECK_COND(
!( (caps.MaxEncodedBitDepth == 0 || caps.BitDepth8Only)
&& (sps.bit_depth_luma_minus8 != 0 || sps.bit_depth_chroma_minus8 != 0)));
MFX_CHECK_COND(
!( (caps.MaxEncodedBitDepth == 2 || caps.MaxEncodedBitDepth == 1 || !caps.BitDepth8Only)
&& ( !(sps.bit_depth_luma_minus8 == 0
|| sps.bit_depth_luma_minus8 == 2
|| sps.bit_depth_luma_minus8 == 4)
|| !(sps.bit_depth_chroma_minus8 == 0
|| sps.bit_depth_chroma_minus8 == 2
|| sps.bit_depth_chroma_minus8 == 4))));
MFX_CHECK_COND(
!( caps.MaxEncodedBitDepth == 2
&& ( !(sps.bit_depth_luma_minus8 == 0
|| sps.bit_depth_luma_minus8 == 2
|| sps.bit_depth_luma_minus8 == 4)
|| !(sps.bit_depth_chroma_minus8 == 0
|| sps.bit_depth_chroma_minus8 == 2
|| sps.bit_depth_chroma_minus8 == 4))));
MFX_CHECK_COND(
!( caps.MaxEncodedBitDepth == 3
&& ( !(sps.bit_depth_luma_minus8 == 0
|| sps.bit_depth_luma_minus8 == 2
|| sps.bit_depth_luma_minus8 == 4
|| sps.bit_depth_luma_minus8 == 8)
|| !(sps.bit_depth_chroma_minus8 == 0
|| sps.bit_depth_chroma_minus8 == 2
|| sps.bit_depth_chroma_minus8 == 4
|| sps.bit_depth_chroma_minus8 == 8))));
return MFX_ERR_NONE;
}
mfxStatus Legacy::CheckPPS(const PPS& pps, const ENCODE_CAPS_HEVC& caps, eMFXHWType /*hw*/)
{
if (pps.tiles_enabled_flag)
{
MFX_CHECK_COND(pps.loop_filter_across_tiles_enabled_flag);
}
MFX_CHECK_COND(!((mfxU32)(((pps.num_tile_columns_minus1 + 1) * (pps.num_tile_rows_minus1 + 1)) > 1) > caps.TileSupport));
return MFX_ERR_NONE;
}
void SetDefaultFormat(
mfxVideoParam& par
, const Defaults::Param& defPar
, mfxExtCodingOption3* pCO3)
{
auto& fi = par.mfx.FrameInfo;
assert(fi.FourCC);
SetDefault(fi.BitDepthLuma, [&]() { return defPar.base.GetMaxBitDepth(defPar); });
SetDefault(fi.BitDepthChroma, fi.BitDepthLuma);
if (pCO3)
{
pCO3->TargetChromaFormatPlus1 = defPar.base.GetTargetChromaFormat(defPar);
pCO3->TargetBitDepthLuma = defPar.base.GetTargetBitDepthLuma(defPar);
SetDefault(pCO3->TargetBitDepthChroma, pCO3->TargetBitDepthLuma);
}
}
void SetDefaultSize(
mfxVideoParam & par
, const Defaults::Param& defPar
, mfxExtHEVCParam* pHEVC)
{
auto& fi = par.mfx.FrameInfo;
mfxU16 PicWidthInLumaSamples = defPar.base.GetCodedPicWidth(defPar);
mfxU16 PicHeightInLumaSamples = defPar.base.GetCodedPicHeight(defPar);
if (pHEVC)
{
SetDefault(pHEVC->PicWidthInLumaSamples, PicWidthInLumaSamples);
SetDefault(pHEVC->PicHeightInLumaSamples, PicHeightInLumaSamples);
}
SetDefault(fi.CropW, mfxU16(PicWidthInLumaSamples - fi.CropX));
SetDefault(fi.CropH, mfxU16(PicHeightInLumaSamples - fi.CropY));
SetDefault(fi.AspectRatioW, mfxU16(1));
SetDefault(fi.AspectRatioH, mfxU16(1));
std::tie(fi.FrameRateExtN, fi.FrameRateExtD) = defPar.base.GetFrameRate(defPar);
}
void SetDefaultGOP(
mfxVideoParam& par
, const Defaults::Param& defPar
, mfxExtCodingOption2* pCO2
, mfxExtCodingOption3* pCO3)
{
par.mfx.GopPicSize = defPar.base.GetGopPicSize(defPar);
par.mfx.GopRefDist = defPar.base.GetGopRefDist(defPar);
SetIf(pCO2->BRefType, pCO2 && !pCO2->BRefType, [&]() { return defPar.base.GetBRefType(defPar); });
SetIf(pCO3->PRefType, pCO3 && !pCO3->PRefType, [&]() { return defPar.base.GetPRefType(defPar); });
par.mfx.NumRefFrame = defPar.base.GetNumRefFrames(defPar);
if (pCO3)
{
SetDefault<mfxU16>(pCO3->GPB, MFX_CODINGOPTION_ON);
defPar.base.GetNumRefActive(
defPar
, &pCO3->NumRefActiveP
, &pCO3->NumRefActiveBL0
, &pCO3->NumRefActiveBL1);
}
}
void SetDefaultBRC(
mfxVideoParam& par
, const Defaults::Param& defPar
, mfxExtCodingOption2* pCO2
, mfxExtCodingOption3* pCO3)
{
par.mfx.RateControlMethod = defPar.base.GetRateControlMethod(defPar);
BufferSizeInKB(par.mfx) = defPar.base.GetBufferSizeInKB(defPar);
if (pCO2)
pCO2->MBBRC = defPar.base.GetMBBRC(defPar);
bool bSetQP = par.mfx.RateControlMethod == MFX_RATECONTROL_CQP
&& !(par.mfx.QPI && par.mfx.QPP && par.mfx.QPB);
bool bSetRCPar = (par.mfx.RateControlMethod == MFX_RATECONTROL_CBR
|| par.mfx.RateControlMethod == MFX_RATECONTROL_VBR
|| par.mfx.RateControlMethod == MFX_RATECONTROL_QVBR
|| par.mfx.RateControlMethod == MFX_RATECONTROL_VCM);
bool bSetICQ = (par.mfx.RateControlMethod == MFX_RATECONTROL_ICQ);
bool bSetQVBR = (par.mfx.RateControlMethod == MFX_RATECONTROL_QVBR && pCO3);
if (bSetQP)
{
std::tie(par.mfx.QPI, par.mfx.QPP, par.mfx.QPB) = defPar.base.GetQPMFX(defPar);
}
if (bSetRCPar)
{
TargetKbps(par.mfx) = defPar.base.GetTargetKbps(defPar);
SetDefault<mfxU16>(par.mfx.MaxKbps, par.mfx.TargetKbps);
SetDefault<mfxU16>(par.mfx.InitialDelayInKB
, par.mfx.BufferSizeInKB * (2 + (par.mfx.RateControlMethod == MFX_RATECONTROL_VBR && Legacy::IsSWBRC(par))) / 4);
}
if (bSetICQ)
SetDefault<mfxU16>(par.mfx.ICQQuality, 26);
if (bSetQVBR)
SetDefault<mfxU16>(pCO3->QVBRQuality, 26);
if (pCO3)
{
SetDefault<mfxU16>(pCO3->LowDelayBRC, MFX_CODINGOPTION_OFF);
pCO3->EnableQPOffset = defPar.base.GetQPOffset(defPar, &pCO3->QPOffset);
SetDefault<mfxU16>(pCO3->EnableMBQP
, Bool2CO(
!( par.mfx.RateControlMethod == MFX_RATECONTROL_CQP
|| Legacy::IsSWBRC(par)
|| !defPar.caps.MbQpDataSupport)));
bool bSetWinBRC = pCO3->WinBRCSize || pCO3->WinBRCMaxAvgKbps;
if (bSetWinBRC)
{
SetDefault<mfxU16>(pCO3->WinBRCSize
, (mfxU16)CeilDiv(par.mfx.FrameInfo.FrameRateExtN, par.mfx.FrameInfo.FrameRateExtD));
SetDefault<mfxU16>(pCO3->WinBRCMaxAvgKbps, par.mfx.MaxKbps);
}
SetDefault<mfxU16>(pCO3->BRCPanicMode, Bool2CO(defPar.caps.HRDConformanceSupport));
}
}
void SetDefaultEsOptions(
mfxVideoParam& par
, const Defaults::Param& defPar
, mfxExtHEVCParam* pHEVC
, mfxExtCodingOption* pCO
, mfxExtCodingOption2* pCO2
, mfxExtCodingOption3* pCO3)
{
if (pCO)
{
bool bHRDConformance = defPar.base.GetHRDConformanceON(defPar);
SetDefault(pCO->NalHrdConformance, Bool2CO(bHRDConformance));
SetDefault(pCO->VuiNalHrdParameters, Bool2CO(bHRDConformance));
SetDefault(pCO->AUDelimiter, mfxU16(MFX_CODINGOPTION_OFF));
pCO->PicTimingSEI = defPar.base.GetPicTimingSEI(defPar);
}
if (pCO2)
SetDefault(pCO2->RepeatPPS, mfxU16(MFX_CODINGOPTION_OFF));
if (pCO3)
{
SetDefault(pCO3->TransformSkip, mfxU16(MFX_CODINGOPTION_ON));
SetDefault(pCO3->TransformSkip, mfxU16(MFX_CODINGOPTION_OFF));
SetDefault(pCO3->EnableNalUnitType, Bool2CO(!!par.mfx.EncodedOrder));
}
if (pHEVC)
{
bool bNoSAO =
SetDefault(pHEVC->SampleAdaptiveOffset, mfxU16(MFX_SAO_ENABLE_LUMA | MFX_SAO_ENABLE_CHROMA))
&& defPar.base.CheckSAO(defPar, par);
pHEVC->SampleAdaptiveOffset *= !bNoSAO;
SetDefault(pHEVC->SampleAdaptiveOffset, mfxU16(MFX_SAO_DISABLE));
}
}
void Legacy::SetDefaults(
mfxVideoParam& par
, const Defaults::Param& defPar
, bool bExternalFrameAllocator)
{
auto& fi = par.mfx.FrameInfo;
mfxExtHEVCParam* pHEVC = ExtBuffer::Get(par);
mfxExtHEVCTiles* pTile = ExtBuffer::Get(par);
mfxExtAvcTemporalLayers* pTL = ExtBuffer::Get(par);
mfxExtCodingOption* pCO = ExtBuffer::Get(par);
mfxExtCodingOption2* pCO2 = ExtBuffer::Get(par);
mfxExtCodingOption3* pCO3 = ExtBuffer::Get(par);
mfxU16 IOPByAlctr[2] = { MFX_IOPATTERN_IN_SYSTEM_MEMORY, MFX_IOPATTERN_IN_VIDEO_MEMORY };
auto GetNumSlices = [&]()
{
std::vector<SliceInfo> slices;
return defPar.base.GetSlices(defPar, slices);
};
auto GetDefaultLevel = [&]()
{
mfxU16 nCol = 0, nRow = 0;
std::tie(nCol, nRow) = defPar.base.GetNumTiles(defPar);
return GetMinLevel(
fi.FrameRateExtN
, fi.FrameRateExtD
, defPar.base.GetCodedPicWidth(defPar)
, defPar.base.GetCodedPicHeight(defPar)
, par.mfx.NumRefFrame
, nCol
, nRow
, par.mfx.NumSlice
, BufferSizeInKB(par.mfx)
, MaxKbps(par.mfx)
, MFX_LEVEL_HEVC_1);
};
if (pHEVC)
{
pHEVC->LCUSize = defPar.base.GetLCUSize(defPar);
}
SetDefaultFormat(par, defPar, pCO3);
SetDefault(par.mfx.CodecProfile, defPar.base.GetProfile(defPar));
SetDefault(par.AsyncDepth, defPar.base.GetAsyncDepth(defPar));
SetDefault(par.IOPattern, IOPByAlctr[!!bExternalFrameAllocator]);
SetDefault(par.mfx.TargetUsage, mfxU16(4)) && CheckTU(par, defPar.caps);
if (pTile)
{
std::tie(pTile->NumTileColumns, pTile->NumTileRows) = defPar.base.GetNumTiles(defPar);
}
SetDefault(par.mfx.NumSlice, GetNumSlices);
SetDefaultSize(par, defPar, pHEVC);
SetDefaultGOP(par, defPar, pCO2, pCO3);
SetDefaultBRC(par, defPar, pCO2, pCO3);
if (pTL)
{
SetDefault(pTL->Layer[0].Scale, mfxU16(1));
}
SetDefault(par.mfx.CodecLevel, GetDefaultLevel);
SetDefaultEsOptions(par, defPar, pHEVC, pCO, pCO2, pCO3);
if (pCO2)
{
auto minQP = defPar.base.GetMinQPMFX(defPar);
auto maxQP = defPar.base.GetMaxQPMFX(defPar);
SetDefault(pCO2->IntRefCycleSize, mfxU16(CeilDiv(fi.FrameRateExtN, fi.FrameRateExtD) * !!pCO2->IntRefType));
SetDefault(pCO2->MinQPI, minQP);
SetDefault(pCO2->MinQPP, minQP);
SetDefault(pCO2->MinQPB, minQP);
SetDefault(pCO2->MaxQPI, maxQP);
SetDefault(pCO2->MaxQPP, maxQP);
SetDefault(pCO2->MaxQPB, maxQP);
}
bool bSetConstr = pHEVC && (par.mfx.CodecProfile >= MFX_PROFILE_HEVC_REXT && !pHEVC->GeneralConstraintFlags);
if (bSetConstr)
{
auto& constr = pHEVC->GeneralConstraintFlags;
mfxU16 bdY = defPar.base.GetTargetBitDepthLuma(defPar);
mfxU16 cf = defPar.base.GetTargetChromaFormat(defPar) - 1;
constr |= MFX_HEVC_CONSTR_REXT_MAX_422CHROMA * (cf <= MFX_CHROMAFORMAT_YUV422);
constr |= MFX_HEVC_CONSTR_REXT_MAX_420CHROMA * (cf <= MFX_CHROMAFORMAT_YUV420);
constr |= MFX_HEVC_CONSTR_REXT_MAX_12BIT * (bdY <= 12);
constr |= MFX_HEVC_CONSTR_REXT_MAX_10BIT * (bdY <= 10);
//there is no Main 4:2:2 in current standard spec.(2016/12), only Main 4:2:2 10
constr |= MFX_HEVC_CONSTR_REXT_MAX_8BIT * (bdY <= 8 && (cf != MFX_CHROMAFORMAT_YUV422));
constr |= MFX_HEVC_CONSTR_REXT_LOWER_BIT_RATE;
}
}
mfxStatus Legacy::CheckLevelConstraints(
mfxVideoParam & par
, const Defaults::Param& defPar)
{
MFX_CHECK(par.mfx.CodecLevel, MFX_ERR_NONE);
mfxU16 PicWidthInLumaSamples = defPar.base.GetCodedPicWidth(defPar);
mfxU16 PicHeightInLumaSamples = defPar.base.GetCodedPicHeight(defPar);
mfxU16 MinRef = defPar.base.GetNumRefFrames(defPar);
mfxU32 NumSlice = defPar.base.GetNumSlices(defPar);
mfxU32 BufferSizeInKB = defPar.base.GetBufferSizeInKB(defPar);
mfxU32 MaxKbps = 0;
mfxU16 rc = defPar.base.GetRateControlMethod(defPar);
auto tiles = defPar.base.GetNumTiles(defPar);
auto frND = defPar.base.GetFrameRate(defPar);
SetIf(MaxKbps
, rc != MFX_RATECONTROL_CQP && rc != MFX_RATECONTROL_ICQ
, [&]() { return defPar.base.GetMaxKbps(defPar); });
mfxU16 minLevel = GetMinLevel(
std::get<0>(frND)
, std::get<1>(frND)
, PicWidthInLumaSamples
, PicHeightInLumaSamples
, MinRef
, std::get<0>(tiles)
, std::get<1>(tiles)
, NumSlice
, BufferSizeInKB
, MaxKbps
, par.mfx.CodecLevel);
MFX_CHECK(!CheckMinOrClip(par.mfx.CodecLevel, minLevel), MFX_WRN_INCOMPATIBLE_VIDEO_PARAM);
return MFX_ERR_NONE;
}
mfxStatus Legacy::CheckESPackParam(mfxVideoParam & par, eMFXHWType hw)
{
(void)hw;
mfxU32 changed = 0;
mfxExtCodingOption* pCO = ExtBuffer::Get(par);
mfxExtCodingOption2* pCO2 = ExtBuffer::Get(par);
mfxExtCodingOption3* pCO3 = ExtBuffer::Get(par);
mfxExtVideoSignalInfo* pVSI = ExtBuffer::Get(par);
if (pCO)
{
bool bNoHRD = par.mfx.RateControlMethod != MFX_RATECONTROL_CBR
&& par.mfx.RateControlMethod != MFX_RATECONTROL_VBR
&& par.mfx.RateControlMethod != MFX_RATECONTROL_VCM
&& par.mfx.RateControlMethod != MFX_RATECONTROL_QVBR;
changed += CheckOrZero<mfxU16>(
pCO->NalHrdConformance
, mfxU16(MFX_CODINGOPTION_UNKNOWN)
, mfxU16(MFX_CODINGOPTION_OFF)
, mfxU16(MFX_CODINGOPTION_ON * !bNoHRD));
changed += CheckOrZero<mfxU16>(
pCO->VuiNalHrdParameters
, mfxU16(MFX_CODINGOPTION_UNKNOWN)
, mfxU16(MFX_CODINGOPTION_OFF)
, mfxU16(MFX_CODINGOPTION_ON * !(bNoHRD || IsOff(pCO->NalHrdConformance))));
changed += CheckTriStateOrZero(pCO->PicTimingSEI);
changed += CheckTriStateOrZero(pCO->AUDelimiter);
}
if (pCO2)
changed += CheckTriStateOrZero(pCO2->RepeatPPS);
if (pVSI)
{
changed += CheckRangeOrSetDefault<mfxU16>(pVSI->VideoFormat, 0, 8, 5);
changed += CheckRangeOrSetDefault<mfxU16>(pVSI->ColourPrimaries, 0, 255, 2);
changed += CheckRangeOrSetDefault<mfxU16>(pVSI->TransferCharacteristics, 0, 255, 2);
changed += CheckRangeOrSetDefault<mfxU16>(pVSI->MatrixCoefficients, 0, 255, 2);
changed += CheckOrZero<mfxU16, 0, 1>(pVSI->VideoFullRange);
changed += CheckOrZero<mfxU16, 0, 1>(pVSI->ColourDescriptionPresent);
}
if (pCO3)
{
changed += CheckOrZero<mfxU16>(
pCO3->TransformSkip
, mfxU16(MFX_CODINGOPTION_UNKNOWN)
, mfxU16(MFX_CODINGOPTION_OFF)
, mfxU16(MFX_CODINGOPTION_ON));
changed += CheckOrZero<mfxU16>(
pCO3->EnableNalUnitType
, mfxU16(MFX_CODINGOPTION_UNKNOWN)
, mfxU16(MFX_CODINGOPTION_OFF)
, mfxU16(MFX_CODINGOPTION_ON * !!par.mfx.EncodedOrder));
}
MFX_CHECK(!changed, MFX_WRN_INCOMPATIBLE_VIDEO_PARAM);
return MFX_ERR_NONE;
}
mfxStatus Legacy::CheckGPB(mfxVideoParam & par)
{
mfxU32 changed = 0;
mfxExtCodingOption3* pCO3 = ExtBuffer::Get(par);
if (pCO3)
{
changed += CheckOrZero<mfxU16>(
pCO3->GPB
, mfxU16(MFX_CODINGOPTION_ON)
, mfxU16(MFX_CODINGOPTION_OFF * !!m_pQWCDefaults->caps.msdk.PSliceSupport)
, mfxU16(MFX_CODINGOPTION_UNKNOWN));
}
MFX_CHECK(!changed, MFX_WRN_INCOMPATIBLE_VIDEO_PARAM);
return MFX_ERR_NONE;
}
mfxStatus Legacy::CheckSkipFrame(mfxVideoParam & par)
{
mfxExtCodingOption2* pCO2 = ExtBuffer::Get(par);
if (pCO2 && CheckOrZero<mfxU16
, MFX_SKIPFRAME_NO_SKIP
, MFX_SKIPFRAME_INSERT_DUMMY
, MFX_SKIPFRAME_INSERT_NOTHING>
(pCO2->SkipFrame))
return MFX_WRN_INCOMPATIBLE_VIDEO_PARAM;
return MFX_ERR_NONE;
}
mfxStatus Legacy::CheckIntraRefresh(
mfxVideoParam & par
, const Defaults::Param& defPar)
{
mfxStatus sts = MFX_ERR_NONE;
mfxU32 changed = 0;
mfxExtCodingOption2* pCO2 = ExtBuffer::Get(par);
mfxExtCodingOption3* pCO3 = ExtBuffer::Get(par);
if (pCO2)
{
MFX_CHECK_NO_RET(
!CheckMaxOrClip(pCO2->IntRefType, MFX_REFRESH_HORIZONTAL)
, sts, MFX_ERR_UNSUPPORTED);
MFX_CHECK_NO_RET(
defPar.caps.RollingIntraRefresh
|| !CheckOrZero<mfxU16>(pCO2->IntRefType, MFX_REFRESH_NO)
, sts, MFX_ERR_UNSUPPORTED);
MFX_CHECK_NO_RET(
defPar.caps.RollingIntraRefresh
|| !CheckOrZero<mfxU16>(pCO2->IntRefCycleSize, 0)
, sts, MFX_ERR_UNSUPPORTED);
MFX_CHECK_NO_RET(
defPar.caps.RollingIntraRefresh
|| !pCO3
|| !CheckOrZero<mfxU16>(pCO3->IntRefCycleDist, 0)
, sts, MFX_ERR_UNSUPPORTED);
// B-Frames should be disabled for intra refresh
if (pCO2->IntRefType && par.mfx.GopRefDist > 1)
{
pCO2->IntRefType = MFX_REFRESH_NO;
++changed;
}
// refresh cycle length shouldn't be greater or equal to GOP size
bool bInvalidCycle =
pCO2->IntRefCycleSize != 0
&& par.mfx.GopPicSize != 0
&& pCO2->IntRefCycleSize >= par.mfx.GopPicSize;
pCO2->IntRefType *= !bInvalidCycle;
pCO2->IntRefCycleSize *= !bInvalidCycle;
changed += bInvalidCycle;
// refresh period shouldn't be greater than refresh cycle size
bool bInvalidDist =
pCO3
&& pCO3->IntRefCycleDist != 0
&& pCO2->IntRefCycleSize != 0
&& pCO2->IntRefCycleSize > pCO3->IntRefCycleDist;
if (bInvalidDist)
{
pCO3->IntRefCycleDist = 0;
++changed;
}
mfxI16 qpDiff = defPar.base.GetMaxQPMFX(defPar) - defPar.base.GetMinQPMFX(defPar);
changed += CheckRangeOrSetDefault(pCO2->IntRefQPDelta, mfxI16(-qpDiff), qpDiff, mfxI16(0));
}
MFX_CHECK_STS(sts);
MFX_CHECK(!changed, MFX_WRN_INCOMPATIBLE_VIDEO_PARAM);
return MFX_ERR_NONE;
}
mfxStatus Legacy::CheckTemporalLayers(mfxVideoParam & par)
{
mfxU32 changed = 0;
mfxExtAvcTemporalLayers* pTL = ExtBuffer::Get(par);
MFX_CHECK(pTL, MFX_ERR_NONE);
MFX_CHECK(!CheckOrZero<mfxU16>(pTL->Layer[0].Scale, 0, 1), MFX_ERR_UNSUPPORTED);
MFX_CHECK(!CheckOrZero<mfxU16>(pTL->Layer[7].Scale, 0), MFX_ERR_UNSUPPORTED);
mfxU16 nTL = 1;
for (mfxU16 i = 1, prev = 0; i < 7; ++i)
{
if (!pTL->Layer[i].Scale)
continue;
auto& scaleCurr = pTL->Layer[i].Scale;
auto scalePrev = pTL->Layer[prev].Scale;
MFX_CHECK(!CheckMinOrZero(scaleCurr, scalePrev + 1), MFX_ERR_UNSUPPORTED);
MFX_CHECK(scalePrev, MFX_ERR_UNSUPPORTED);
MFX_CHECK(!CheckOrZero(scaleCurr, mfxU16(scaleCurr - (scaleCurr % scalePrev))), MFX_ERR_UNSUPPORTED);
prev = i;
++nTL;
}
changed += CheckOrZero<mfxU16>(par.mfx.GopRefDist, 0, 1, par.mfx.GopRefDist * (nTL <= 1));
MFX_CHECK(!changed, MFX_WRN_INCOMPATIBLE_VIDEO_PARAM);
return MFX_ERR_NONE;
}
mfxStatus Legacy::CheckPPyramid(mfxVideoParam & par)
{
mfxU32 changed = 0;
mfxExtCodingOption3* pCO3 = ExtBuffer::Get(par);
if (pCO3)
{
changed += CheckOrZero<mfxU16
, MFX_P_REF_DEFAULT
, MFX_P_REF_SIMPLE
, MFX_P_REF_PYRAMID>
(pCO3->PRefType);
if (pCO3->PRefType == MFX_P_REF_PYRAMID && par.mfx.GopRefDist > 1)
{
pCO3->PRefType = MFX_P_REF_DEFAULT;
changed++;
}
}
MFX_CHECK(!changed, MFX_WRN_INCOMPATIBLE_VIDEO_PARAM);
return MFX_ERR_NONE;
}
mfxStatus Legacy::CheckBPyramid(
mfxVideoParam & par
, const Defaults::Param& defPar)
{
mfxU32 changed = 0;
mfxExtCodingOption2* pCO2 = ExtBuffer::Get(par);
if (pCO2)
{
mfxU16 minRefForPyramid = 3;
if (par.mfx.GopRefDist)
minRefForPyramid = defPar.base.GetMinRefForBPyramid(defPar);
bool bNoBPyramid =
par.mfx.GopRefDist > 0
&& ( par.mfx.GopRefDist < 2
|| minRefForPyramid > 16
|| (par.mfx.NumRefFrame
&& (minRefForPyramid > par.mfx.NumRefFrame)
&& !defPar.base.GetNonStdReordering(defPar)));
changed += CheckOrZero(pCO2->BRefType
, mfxU16(MFX_B_REF_UNKNOWN)
, mfxU16(MFX_B_REF_OFF)
, mfxU16(MFX_B_REF_PYRAMID * !bNoBPyramid));
}
MFX_CHECK(!changed, MFX_WRN_INCOMPATIBLE_VIDEO_PARAM);
return MFX_ERR_NONE;
}
mfxStatus Legacy::CheckNumRefFrame(
mfxVideoParam & par
, const Defaults::Param& defPar)
{
mfxU32 changed = 0;
changed += CheckMaxOrClip(par.mfx.NumRefFrame, defPar.base.GetMaxDPB(defPar) - 1);
changed += SetIf(
par.mfx.NumRefFrame
, (par.mfx.GopRefDist > 1
&& par.mfx.NumRefFrame == 1
&& !defPar.base.GetNonStdReordering(defPar))
, defPar.base.GetMinRefForBNoPyramid(defPar));
MFX_CHECK(!changed, MFX_WRN_INCOMPATIBLE_VIDEO_PARAM);
return MFX_ERR_NONE;
}
mfxStatus Legacy::CheckFrameRate(mfxVideoParam & par)
{
auto& fi = par.mfx.FrameInfo;
if (fi.FrameRateExtN && fi.FrameRateExtD) // FR <= 300
{
if (fi.FrameRateExtN > mfxU32(300 * fi.FrameRateExtD))
{
fi.FrameRateExtN = fi.FrameRateExtD = 0;
return MFX_ERR_UNSUPPORTED;
}
}
if ((fi.FrameRateExtN == 0) != (fi.FrameRateExtD == 0))
{
fi.FrameRateExtN = 0;
fi.FrameRateExtD = 0;
return MFX_ERR_UNSUPPORTED;
}
return MFX_ERR_NONE;
}
bool Legacy::IsInVideoMem(const mfxVideoParam & par)
{
if (par.IOPattern == MFX_IOPATTERN_IN_VIDEO_MEMORY)
return true;
return false;
}
mfxStatus Legacy::CheckShift(mfxVideoParam & par)
{
auto& fi = par.mfx.FrameInfo;
bool bVideoMem = IsInVideoMem(par);
if (bVideoMem && !fi.Shift)
{
if (fi.FourCC == MFX_FOURCC_P010 || fi.FourCC == MFX_FOURCC_P210)
{
fi.Shift = 1;
return MFX_WRN_INCOMPATIBLE_VIDEO_PARAM;
}
}
return MFX_ERR_NONE;
}
mfxStatus Legacy::CheckCrops(
mfxVideoParam & par
, const Defaults::Param& defPar)
{
mfxU32 changed = 0;
auto W = defPar.base.GetCodedPicWidth(defPar);
auto H = defPar.base.GetCodedPicHeight(defPar);
auto& fi = par.mfx.FrameInfo;
changed += CheckMaxOrClip(fi.CropX, W);
changed += CheckMaxOrClip(fi.CropW, W - fi.CropX);
changed += CheckMaxOrClip(fi.CropY, H);
changed += CheckMaxOrClip(fi.CropH, H - fi.CropY);
MFX_CHECK(!changed, MFX_WRN_INCOMPATIBLE_VIDEO_PARAM);
return MFX_ERR_NONE;
}
bool Legacy::IsSWBRC(const ExtBuffer::Param<mfxVideoParam>& par)
{
const mfxExtCodingOption2* pCO2 = ExtBuffer::Get(par);
#ifdef MFX_ENABLE_ENCTOOLS
const mfxExtEncToolsConfig *pCfg = ExtBuffer::Get(par);
#endif
return
( ((pCO2 && IsOn(pCO2->ExtBRC))
#ifdef MFX_ENABLE_ENCTOOLS
|| (pCfg && IsOn(pCfg->BRC))
#endif
)
&& ( par.mfx.RateControlMethod == MFX_RATECONTROL_CBR
|| par.mfx.RateControlMethod == MFX_RATECONTROL_VBR));
}
bool Legacy::IsEnctoolsLABRC(const ExtBuffer::Param<mfxVideoParam>&par)
{
#if !defined(MFX_ENABLE_ENCTOOLS)
std::ignore = par;
#else
const mfxExtCodingOption2 * pCO2 = ExtBuffer::Get(par);
const mfxExtCodingOption3 * pCO3 = ExtBuffer::Get(par);
const mfxExtEncToolsConfig * pCfg = ExtBuffer::Get(par);
if (
(
((par.mfx.GopRefDist == 2 || par.mfx.GopRefDist == 8)
&& pCO2 && pCO2->ExtBRC == MFX_CODINGOPTION_ON && pCO2->LookAheadDepth > par.mfx.GopRefDist
&& (pCO3 && pCO3->ScenarioInfo != MFX_SCENARIO_GAME_STREAMING)
)
|| (pCfg && IsOn(pCfg->BRC) && pCO2 && pCO2->LookAheadDepth > par.mfx.GopRefDist)
)
&& (par.mfx.RateControlMethod == MFX_RATECONTROL_CBR || par.mfx.RateControlMethod == MFX_RATECONTROL_VBR)
)
return true;
#endif
return false;
}
bool Legacy::IsMBQP(const ExtBuffer::Param<mfxVideoParam>& par, bool bMBQPSupport)
{
const mfxExtCodingOption3* pCO3 = ExtBuffer::Get(par);
if (pCO3 && IsOn(pCO3->EnableMBQP))
return true;
else if (IsEnctoolsLABRC(par) && bMBQPSupport)
return true;
return false;
}
bool CheckBufferSizeInKB(
mfxVideoParam & par
, const Defaults::Param& defPar
, mfxU16 bd)
{
mfxU32 changed = 0;
auto W = defPar.base.GetCodedPicWidth(defPar);
auto H = defPar.base.GetCodedPicHeight(defPar);
mfxU16 cf = defPar.base.GetTargetChromaFormat(defPar) - 1;
mfxU32 rawBytes = Legacy::GetRawBytes(W, H, cf, bd) / 1000;
bool bCqpOrIcq =
par.mfx.RateControlMethod == MFX_RATECONTROL_CQP
|| par.mfx.RateControlMethod == MFX_RATECONTROL_ICQ;
bool bSetToRaw = bCqpOrIcq && BufferSizeInKB(par.mfx) < rawBytes;
if (bSetToRaw)
{
BufferSizeInKB(par.mfx) = rawBytes;
changed++;
}
else if (!bCqpOrIcq)
{
mfxU32 frN = 0, frD = 0;
std::tie(frN, frD) = defPar.base.GetFrameRate(defPar);
mfxU32 avgFS = mfxU32(std::ceil((mfxF64)TargetKbps(par.mfx) * frD / frN / 8));
if (BufferSizeInKB(par.mfx) < avgFS * 2 + 1)
{
BufferSizeInKB(par.mfx) = avgFS * 2 + 1;
changed++;
}
if (par.mfx.CodecLevel)
{
mfxU32 maxCPB = GetMaxCpbInKBByLevel(par);
if (BufferSizeInKB(par.mfx) > maxCPB)
{
BufferSizeInKB(par.mfx) = maxCPB;
changed++;
}
}
}
return !!changed;
}
mfxStatus Legacy::CheckBRC(
mfxVideoParam & par
, const Defaults::Param& defPar)
{
mfxU32 changed = 0;
mfxExtCodingOption2* pCO2 = ExtBuffer::Get(par);
mfxExtCodingOption3* pCO3 = ExtBuffer::Get(par);
if (par.mfx.RateControlMethod == MFX_RATECONTROL_AVBR)
{
par.mfx.RateControlMethod = MFX_RATECONTROL_VBR;
par.mfx.Accuracy = 0;
par.mfx.Convergence = 0;
changed++;
}
bool supportedRateControl = !CheckOrZero<mfxU16>(par.mfx.RateControlMethod
, 0
, !!defPar.caps.msdk.CBRSupport * MFX_RATECONTROL_CBR
, !!defPar.caps.msdk.VBRSupport * MFX_RATECONTROL_VBR
, !!defPar.caps.msdk.CQPSupport * MFX_RATECONTROL_CQP
, !!defPar.caps.msdk.ICQSupport * MFX_RATECONTROL_ICQ
, !!defPar.caps.VCMBitRateControl * MFX_RATECONTROL_VCM
, !!defPar.caps.QVBRBRCSupport * MFX_RATECONTROL_QVBR
);
MFX_CHECK(supportedRateControl, MFX_ERR_UNSUPPORTED);
MFX_CHECK(par.mfx.RateControlMethod != MFX_RATECONTROL_ICQ
|| !CheckMaxOrZero(par.mfx.ICQQuality, 51), MFX_ERR_UNSUPPORTED);
changed += (( par.mfx.RateControlMethod == MFX_RATECONTROL_VBR
|| par.mfx.RateControlMethod == MFX_RATECONTROL_QVBR
|| par.mfx.RateControlMethod == MFX_RATECONTROL_VCM)
&& par.mfx.MaxKbps != 0
&& par.mfx.TargetKbps != 0)
&& CheckMinOrClip(par.mfx.MaxKbps, par.mfx.TargetKbps)
&& CheckMaxOrClip(par.mfx.TargetKbps, par.mfx.MaxKbps);
auto bd = defPar.base.GetTargetBitDepthLuma(defPar);
auto minQP = defPar.base.GetMinQPMFX(defPar);
auto maxQP = defPar.base.GetMaxQPMFX(defPar);
if (par.mfx.RateControlMethod == MFX_RATECONTROL_CQP)
{
changed += par.mfx.QPI && CheckMinOrClip<mfxU16>(par.mfx.QPI, minQP);
changed += par.mfx.QPI && CheckMaxOrClip<mfxU16>(par.mfx.QPI, maxQP);
changed += par.mfx.QPP && CheckMinOrClip<mfxU16>(par.mfx.QPP, minQP);
changed += par.mfx.QPP && CheckMaxOrClip<mfxU16>(par.mfx.QPP, maxQP);
changed += par.mfx.QPB && CheckMinOrClip<mfxU16>(par.mfx.QPB, minQP);
changed += par.mfx.QPB && CheckMaxOrClip<mfxU16>(par.mfx.QPB, maxQP);
}
changed += par.mfx.BufferSizeInKB && CheckBufferSizeInKB(par, defPar, bd);
if (pCO3)
{
MFX_CHECK(par.mfx.RateControlMethod != MFX_RATECONTROL_QVBR
|| !CheckMaxOrZero(pCO3->QVBRQuality, 51), MFX_ERR_UNSUPPORTED);
auto GopRefDist = defPar.base.GetGopRefDist(defPar);
mfxU16 QPPB[2] = { par.mfx.QPP, par.mfx.QPB };
mfxI16 QPX = QPPB[GopRefDist != 1] * (par.mfx.RateControlMethod == MFX_RATECONTROL_CQP);
bool bNoQpOffset = (par.mfx.RateControlMethod != MFX_RATECONTROL_CQP)
|| (GopRefDist > 1 && defPar.base.GetBRefType(defPar) == MFX_B_REF_OFF)
|| (GopRefDist == 1 && defPar.base.GetPRefType(defPar) == MFX_P_REF_SIMPLE);
changed += CheckOrZero<mfxU16>(pCO3->EnableQPOffset
, mfxU16(MFX_CODINGOPTION_UNKNOWN)
, mfxU16(MFX_CODINGOPTION_OFF)
, mfxU16(MFX_CODINGOPTION_ON * !bNoQpOffset));
auto CheckQPOffset = [&](mfxI16& QPO)
{
return
CheckMinOrClip(QPO, minQP - QPX)
+ CheckMaxOrClip(QPO, maxQP - QPX);
};
changed +=
IsOn(pCO3->EnableQPOffset)
&& QPX
&& std::count_if(std::begin(pCO3->QPOffset), std::end(pCO3->QPOffset), CheckQPOffset);
changed += CheckOrZero(pCO3->EnableMBQP
, mfxU16(MFX_CODINGOPTION_UNKNOWN)
, mfxU16(MFX_CODINGOPTION_OFF)
, mfxU16(MFX_CODINGOPTION_ON * !!(defPar.caps.MbQpDataSupport)));
auto sts = defPar.base.CheckWinBRC(defPar, par);
MFX_CHECK(sts >= MFX_ERR_NONE, sts);
changed += (sts > MFX_ERR_NONE);
changed += CheckOrZero(pCO3->BRCPanicMode
, mfxU16(MFX_CODINGOPTION_UNKNOWN)
, mfxU16(MFX_CODINGOPTION_OFF)
, mfxU16(MFX_CODINGOPTION_ON * !!(defPar.caps.HRDConformanceSupport)));
}
if (pCO2)
{
changed += CheckTriStateOrZero(pCO2->MBBRC);
changed += ( defPar.caps.MBBRCSupport == 0
|| par.mfx.RateControlMethod == MFX_RATECONTROL_CQP
|| IsSWBRC(par))
&& CheckOrZero<mfxU16, 0, MFX_CODINGOPTION_OFF>(pCO2->MBBRC);
changed += !defPar.caps.SliceByteSizeCtrl && CheckOrZero<mfxU32, 0>(pCO2->MaxSliceSize);
bool bMinMaxQpAllowed = (par.mfx.RateControlMethod != MFX_RATECONTROL_CQP) && (IsSWBRC(par)||IsOn(par.mfx.LowPower));
if (bMinMaxQpAllowed)
{
changed += pCO2->MinQPI && CheckRangeOrSetDefault<mfxU8>(pCO2->MinQPI, minQP, maxQP, 0);
changed += pCO2->MaxQPI && CheckRangeOrSetDefault<mfxU8>(pCO2->MaxQPI, std::max(pCO2->MinQPI, minQP), maxQP, 0);
changed += pCO2->MinQPP && CheckRangeOrSetDefault<mfxU8>(pCO2->MinQPP, minQP, maxQP, 0);
changed += pCO2->MaxQPP && CheckRangeOrSetDefault<mfxU8>(pCO2->MaxQPP, std::max(pCO2->MinQPP, minQP), maxQP, 0);
changed += pCO2->MinQPB && CheckRangeOrSetDefault<mfxU8>(pCO2->MinQPB, minQP, maxQP, 0);
changed += pCO2->MaxQPB && CheckRangeOrSetDefault<mfxU8>(pCO2->MaxQPB, std::max(pCO2->MinQPB, minQP), maxQP, 0);
}
else
{
changed += CheckOrZero<mfxU8>(pCO2->MinQPI, 0, minQP);
changed += CheckOrZero<mfxU8>(pCO2->MaxQPI, 0, maxQP);
changed += CheckOrZero<mfxU8>(pCO2->MinQPP, 0, minQP);
changed += CheckOrZero<mfxU8>(pCO2->MaxQPP, 0, maxQP);
changed += CheckOrZero<mfxU8>(pCO2->MinQPB, 0, minQP);
changed += CheckOrZero<mfxU8>(pCO2->MaxQPB, 0, maxQP);
}
}
MFX_CHECK(!changed, MFX_WRN_INCOMPATIBLE_VIDEO_PARAM);
return MFX_ERR_NONE;
}
mfxU32 Legacy::GetRawBytes(mfxU16 w, mfxU16 h, mfxU16 ChromaFormat, mfxU16 BitDepth)
{
mfxU32 s = w * h;
if (ChromaFormat == MFX_CHROMAFORMAT_YUV420)
s = s * 3 / 2;
else if (ChromaFormat == MFX_CHROMAFORMAT_YUV422)
s *= 2;
else if (ChromaFormat == MFX_CHROMAFORMAT_YUV444)
s *= 3;
assert(BitDepth >= 8);
if (BitDepth != 8)
s = (s * BitDepth + 7) / 8;
return s;
}
mfxStatus Legacy::CheckIOPattern(mfxVideoParam & par)
{
bool check_result = Check<mfxU16
, MFX_IOPATTERN_IN_VIDEO_MEMORY
, MFX_IOPATTERN_IN_SYSTEM_MEMORY
, 0>
(par.IOPattern);
MFX_CHECK(!check_result, MFX_ERR_INVALID_VIDEO_PARAM);
return MFX_ERR_NONE;
}
mfxStatus Legacy::CheckGopRefDist(mfxVideoParam & par, const ENCODE_CAPS_HEVC& caps)
{
MFX_CHECK(par.mfx.GopRefDist, MFX_ERR_NONE);
mfxU16 maxRefDist = std::max<mfxU16>(1, !caps.SliceIPOnly * (par.mfx.GopPicSize - 1));
MFX_CHECK(!CheckMaxOrClip(par.mfx.GopRefDist, maxRefDist), MFX_WRN_INCOMPATIBLE_VIDEO_PARAM);
return MFX_ERR_NONE;
}
mfxStatus Legacy::CheckTU(mfxVideoParam & par, const ENCODE_CAPS_HEVC& caps)
{
auto& tu = par.mfx.TargetUsage;
if (CheckMaxOrZero(tu, 7u))
return MFX_ERR_UNSUPPORTED;
if (!tu)
return MFX_ERR_NONE;
auto support = caps.TUSupport;
mfxI16 abs_diff = 0;
bool sign = 0;
mfxI16 newtu = tu;
do
{
newtu = tu + (1 - 2 * sign) * abs_diff;
abs_diff += !sign;
sign = !sign;
} while (!(support & (1 << (newtu - 1))) && newtu > 0);
if (tu != newtu)
{
tu = newtu;
return MFX_WRN_INCOMPATIBLE_VIDEO_PARAM;
}
return MFX_ERR_NONE;
}
mfxStatus Legacy::CheckTiles(
mfxVideoParam & par
, const Defaults::Param& defPar)
{
mfxExtHEVCTiles* pTile = ExtBuffer::Get(par);
MFX_CHECK(pTile, MFX_ERR_NONE);
mfxU16
MaxTileColumns = MAX_NUM_TILE_COLUMNS
, MaxTileRows = MAX_NUM_TILE_ROWS
, changed = 0;
if (!defPar.caps.TileSupport)
{
MaxTileColumns = 1;
MaxTileRows = 1;
}
else
{
mfxU32 minTileWidth = MIN_TILE_WIDTH_IN_SAMPLES;
mfxU32 minTileHeight = MIN_TILE_HEIGHT_IN_SAMPLES;
// min 2x2 lcu is supported on VDEnc
SetIf(minTileHeight, defPar.caps.NumScalablePipesMinus1 > 0 && IsOn(par.mfx.LowPower), 128);
mfxU16 maxCol = std::max<mfxU16>(1, mfxU16(defPar.base.GetCodedPicWidth(defPar) / minTileWidth));
mfxU16 maxRow = std::max<mfxU16>(1, mfxU16(defPar.base.GetCodedPicHeight(defPar) / minTileHeight));
changed += CheckMaxOrClip(pTile->NumTileColumns, maxCol);
changed += CheckMaxOrClip(pTile->NumTileRows, maxRow);
}
MFX_CHECK(!CheckMaxOrClip(pTile->NumTileColumns, MaxTileColumns), MFX_ERR_UNSUPPORTED);
MFX_CHECK(!CheckMaxOrClip(pTile->NumTileRows, MaxTileRows), MFX_ERR_UNSUPPORTED);
MFX_CHECK(!changed, MFX_WRN_INCOMPATIBLE_VIDEO_PARAM);
return MFX_ERR_NONE;
}
void Legacy::CheckQuery0(const ParamSupport& sprt, mfxVideoParam& par)
{
std::vector<mfxU8> onesBuf(sizeof(par), 1);
auto ExtParam = par.ExtParam;
auto NumExtParam = par.NumExtParam;
par = mfxVideoParam{};
for (auto& copy : sprt.m_mvpCopySupported)
copy((mfxVideoParam*)onesBuf.data(), &par);
par.ExtParam = ExtParam;
par.NumExtParam = NumExtParam;
if (par.ExtParam)
{
for (mfxU32 i = 0; i < par.NumExtParam; i++)
{
if (!par.ExtParam[i])
continue;
mfxExtBuffer header = *par.ExtParam[i];
memset(par.ExtParam[i], 0, header.BufferSz);
*par.ExtParam[i] = header;
auto it = sprt.m_ebCopySupported.find(header.BufferId);
if (it != sprt.m_ebCopySupported.end())
{
if (onesBuf.size() < header.BufferSz)
onesBuf.insert(onesBuf.end(), header.BufferSz - mfxU32(onesBuf.size()), 1);
auto pSrc = (mfxExtBuffer*)onesBuf.data();
*pSrc = header;
for (auto& copy : it->second)
copy(pSrc, par.ExtParam[i]);
}
}
}
}
mfxStatus Legacy::CheckBuffers(const ParamSupport& sprt, const mfxVideoParam& in, const mfxVideoParam* out)
{
MFX_CHECK(!(!in.NumExtParam && (!out || !out->NumExtParam)), MFX_ERR_NONE);
MFX_CHECK(in.ExtParam, MFX_ERR_UNDEFINED_BEHAVIOR);
MFX_CHECK(!(out && (!out->ExtParam || out->NumExtParam != in.NumExtParam))
, MFX_ERR_UNDEFINED_BEHAVIOR);
std::map<mfxU32, mfxU32> detected[2];
mfxU32 dId = 0;
for (auto pPar : { &in, out })
{
if (!pPar)
continue;
for (mfxU32 i = 0; i < pPar->NumExtParam; i++)
{
MFX_CHECK_NULL_PTR1(pPar->ExtParam[i]);
auto id = pPar->ExtParam[i]->BufferId;
MFX_CHECK(sprt.m_ebCopySupported.find(id) != sprt.m_ebCopySupported.end(), MFX_ERR_UNSUPPORTED);
MFX_CHECK(!(detected[dId][id]++), MFX_ERR_UNDEFINED_BEHAVIOR);
}
dId++;
}
MFX_CHECK(!(out && detected[0] != detected[1]), MFX_ERR_UNDEFINED_BEHAVIOR);
return MFX_ERR_NONE;
}
mfxStatus Legacy::CopyConfigurable(const ParamSupport& sprt, const mfxVideoParam& in, mfxVideoParam& out)
{
using TFnCopyMVP = std::function<void(const mfxVideoParam*, mfxVideoParam*)>;
using TFnCopyEB = std::function<void(const mfxExtBuffer*, mfxExtBuffer*)>;
auto CopyMVP = [&](const mfxVideoParam& src, mfxVideoParam& dst)
{
std::for_each(sprt.m_mvpCopySupported.begin(), sprt.m_mvpCopySupported.end()
, [&](const TFnCopyMVP& copy)
{
copy(&src, &dst);
});
};
auto CopyEB = [](const std::list<TFnCopyEB>& copyList, const mfxExtBuffer* pIn, mfxExtBuffer* pOut)
{
std::for_each(copyList.begin(), copyList.end()
, [&](const TFnCopyEB& copy)
{
copy(pIn, pOut);
});
};
mfxVideoParam tmpMVP = {};
CopyMVP(in, tmpMVP);
tmpMVP.NumExtParam = out.NumExtParam;
tmpMVP.ExtParam = out.ExtParam;
out = tmpMVP;
std::list<mfxExtBuffer*> outBufs(out.ExtParam, out.ExtParam + out.NumExtParam);
outBufs.sort();
outBufs.remove(nullptr);
std::for_each(outBufs.begin(), outBufs.end()
, [&](mfxExtBuffer* pEbOut)
{
std::vector<mfxU8> ebTmp(pEbOut->BufferSz, mfxU8(0));
auto pEbIn = ExtBuffer::Get(in, pEbOut->BufferId);
auto copyIt = sprt.m_ebCopySupported.find(pEbOut->BufferId);
auto copyPtrsIt = sprt.m_ebCopyPtrs.find(pEbOut->BufferId);
mfxExtBuffer* pEbTmp = (mfxExtBuffer*)ebTmp.data();
bool bCopyPar = pEbIn && copyIt != sprt.m_ebCopySupported.end();
bool bCopyPtr = copyPtrsIt != sprt.m_ebCopyPtrs.end();
*pEbTmp = *pEbOut;
if (bCopyPtr)
{
CopyEB(copyPtrsIt->second, pEbOut, pEbTmp);
}
if (bCopyPar)
{
CopyEB(copyIt->second, pEbIn, pEbTmp);
}
std::copy_n(ebTmp.data(), ebTmp.size(), (mfxU8*)pEbOut);
});
return MFX_ERR_NONE;
}
mfxStatus Legacy::CheckCodedPicSize(
mfxVideoParam & par
, const Defaults::Param& defPar)
{
mfxExtHEVCParam* pHEVC = ExtBuffer::Get(par);
MFX_CHECK(pHEVC, MFX_ERR_NONE);
auto alignment = defPar.base.GetCodedPicAlignment(defPar);
auto& W = pHEVC->PicWidthInLumaSamples;
auto& H = pHEVC->PicHeightInLumaSamples;
auto AW = mfx::align2_value(W, alignment);
auto AH = mfx::align2_value(H, alignment);
MFX_CHECK(!CheckMaxOrZero(W, par.mfx.FrameInfo.Width), MFX_ERR_UNSUPPORTED);
MFX_CHECK(!CheckMaxOrZero(H, par.mfx.FrameInfo.Height), MFX_ERR_UNSUPPORTED);
if ((W != AW) || (H != AH))
{
W = AW;
H = AH;
return MFX_WRN_INCOMPATIBLE_VIDEO_PARAM;
}
return MFX_ERR_NONE;
}
mfxU16 FrameType2SliceType(mfxU32 ft)
{
bool bB = IsB(ft);
bool bP = !bB && IsP(ft);
return 1 * bP + 2 * !(bB || bP);
}
bool isCurrLt(
DpbArray const & DPB,
mfxU8 const (&RefPicList)[2][MAX_DPB_SIZE],
mfxU8 const (&numRefActive)[2],
mfxI32 poc)
{
for (mfxU32 i = 0; i < 2; i++)
for (mfxU32 j = 0; j < numRefActive[i]; j++)
if (poc == DPB[RefPicList[i][j]].POC)
return DPB[RefPicList[i][j]].isLTR;
return false;
}
inline bool isCurrLt(const TaskCommonPar & task, mfxI32 poc)
{
return isCurrLt(task.DPB.Active, task.RefPicList, task.NumRefActive, poc);
}
template<class T> inline T Lsb(T val, mfxU32 maxLSB)
{
if (val >= 0)
return val % maxLSB;
return (maxLSB - ((-val) % maxLSB)) % maxLSB;
}
bool isForcedDeltaPocMsbPresent(
const TaskCommonPar & prevTask,
mfxI32 poc,
mfxU32 MaxPocLsb)
{
DpbArray const & DPB = prevTask.DPB.Active;
if (Lsb(prevTask.POC, MaxPocLsb) == Lsb(poc, MaxPocLsb))
return true;
for (mfxU16 i = 0; !isDpbEnd(DPB, i); i++)
if (DPB[i].POC != poc && Lsb(DPB[i].POC, MaxPocLsb) == Lsb(poc, MaxPocLsb))
return true;
return false;
}
mfxU16 GetSliceHeaderLTRs(
const TaskCommonPar& task
, const TaskCommonPar& prevTask
, const DpbArray & DPB
, const SPS& sps
, mfxI32 (<R)[MAX_NUM_LONG_TERM_PICS]
, Slice & s)
{
mfxU16 nLTR = 0;
size_t nDPBLT = 0;
mfxU32 MaxPocLsb = (1<<(sps.log2_max_pic_order_cnt_lsb_minus4+4));
mfxU32 dPocCycleMSBprev = 0;
mfxI32 DPBLT[MAX_DPB_SIZE] = {};
mfxI32 InvalidPOC = -9000;
std::transform(DPB, DPB + Size(DPB), DPBLT
, [InvalidPOC](const DpbFrame& x) { return (x.isLTR && isValid(x)) ? x.POC : InvalidPOC; });
nDPBLT = std::remove_if(DPBLT, DPBLT + Size(DPBLT)
, [InvalidPOC](mfxI32 x) { return x == InvalidPOC; }) - DPBLT;
std::sort(DPBLT, DPBLT + nDPBLT, std::greater<mfxI32>()); // sort for DeltaPocMsbCycleLt (may only increase)
// insert LTR using lt_ref_pic_poc_lsb_sps
std::for_each(DPBLT, DPBLT + nDPBLT, [&](mfxI32& ltpoc) {
mfxU32 dPocCycleMSB = (task.POC / MaxPocLsb - ltpoc / MaxPocLsb);
mfxU32 dPocLSB = ltpoc - (task.POC - dPocCycleMSB * MaxPocLsb - s.pic_order_cnt_lsb);
size_t ltId = std::find_if(
sps.lt_ref_pic_poc_lsb_sps
, sps.lt_ref_pic_poc_lsb_sps + sps.num_long_term_ref_pics_sps
, [&](const mfxU16& ltPocLsb) {
return dPocLSB == ltPocLsb
&& isCurrLt(task, DPBLT[ltpoc])
== !!sps.used_by_curr_pic_lt_sps_flag[sps.lt_ref_pic_poc_lsb_sps - <PocLsb]
&& dPocCycleMSB >= dPocCycleMSBprev;
}) - sps.lt_ref_pic_poc_lsb_sps;
if (ltId >= sps.num_long_term_ref_pics_sps)
return;
auto& curlt = s.lt[s.num_long_term_sps];
curlt.lt_idx_sps = ltId;
curlt.used_by_curr_pic_lt_flag = !!sps.used_by_curr_pic_lt_sps_flag[ltId];
curlt.poc_lsb_lt = sps.lt_ref_pic_poc_lsb_sps[ltId];
curlt.delta_poc_msb_cycle_lt = dPocCycleMSB - dPocCycleMSBprev;
curlt.delta_poc_msb_present_flag =
!!curlt.delta_poc_msb_cycle_lt || isForcedDeltaPocMsbPresent(prevTask, ltpoc, MaxPocLsb);
dPocCycleMSBprev = dPocCycleMSB;
++s.num_long_term_sps;
if (curlt.used_by_curr_pic_lt_flag)
{
assert(nLTR < MAX_NUM_LONG_TERM_PICS);
LTR[nLTR++] = ltpoc;
}
ltpoc = InvalidPOC;
});
nDPBLT = std::remove_if(DPBLT, DPBLT + nDPBLT
, [InvalidPOC](mfxI32 x) { return x == InvalidPOC; }) - DPBLT;
dPocCycleMSBprev = 0;
std::for_each(DPBLT, DPBLT + nDPBLT, [&](mfxI32 ltpoc) {
auto& curlt = s.lt[s.num_long_term_sps + s.num_long_term_pics];
mfxU32 dPocCycleMSB = (task.POC / MaxPocLsb - ltpoc / MaxPocLsb);
mfxU32 dPocLSB = ltpoc - (task.POC - dPocCycleMSB * MaxPocLsb - s.pic_order_cnt_lsb);
assert(dPocCycleMSB >= dPocCycleMSBprev);
curlt.used_by_curr_pic_lt_flag = isCurrLt(task, ltpoc);
curlt.poc_lsb_lt = dPocLSB;
curlt.delta_poc_msb_cycle_lt = dPocCycleMSB - dPocCycleMSBprev;
curlt.delta_poc_msb_present_flag =
!!curlt.delta_poc_msb_cycle_lt || isForcedDeltaPocMsbPresent(prevTask, ltpoc, MaxPocLsb);
dPocCycleMSBprev = dPocCycleMSB;
++s.num_long_term_pics;
if (curlt.used_by_curr_pic_lt_flag)
{
if (nLTR < MAX_NUM_LONG_TERM_PICS) //KW
LTR[nLTR++] = ltpoc;
else
assert(!"too much LTRs");
}
});
return nLTR;
}
void GetSliceHeaderRPLMod(
const TaskCommonPar& task
, const DpbArray & DPB
, const mfxI32 (&STR)[2][MAX_DPB_SIZE]
, const mfxU16 (&nSTR)[2]
, const mfxI32 LTR[MAX_NUM_LONG_TERM_PICS]
, mfxU16 nLTR
, Slice & s)
{
auto& RefPicList = task.RefPicList;
auto ModLX = [&](mfxU16 lx, mfxU16 NumRpsCurrTempListX)
{
mfxU16 rIdx = 0;
mfxI32 RPLTempX[16] = {}; // default ref. list without modifications
auto AddRef = [&](mfxI32 ref) { RPLTempX[rIdx++] = ref; };
while (rIdx < NumRpsCurrTempListX)
{
std::for_each(STR[lx], STR[lx] + std::min<mfxU16>(nSTR[lx], NumRpsCurrTempListX - rIdx), AddRef);
std::for_each(STR[!lx], STR[!lx] + std::min<mfxU16>(nSTR[!lx], NumRpsCurrTempListX - rIdx), AddRef);
std::for_each(LTR, LTR + std::min<mfxU16>(nLTR, NumRpsCurrTempListX - rIdx), AddRef);
}
for (rIdx = 0; rIdx < task.NumRefActive[lx]; rIdx++)
{
auto pRef = std::find_if(RPLTempX, RPLTempX + NumRpsCurrTempListX
, [&](mfxI32 ref) {return DPB[RefPicList[lx][rIdx]].POC == ref; });
s.list_entry_lx[lx][rIdx] = mfxU8(pRef - RPLTempX);
s.ref_pic_list_modification_flag_lx[lx] |= (s.list_entry_lx[lx][rIdx] != rIdx);
}
};
ModLX(0, std::max<mfxU16>(nSTR[0] + nSTR[1] + nLTR, task.NumRefActive[0]));
ModLX(1, std::max<mfxU16>(nSTR[0] + nSTR[1] + nLTR, task.NumRefActive[1]));
}
mfxStatus Legacy::GetSliceHeader(
const ExtBuffer::Param<mfxVideoParam> & par
, const TaskCommonPar& task
, const SPS& sps
, const PPS& pps
, Slice & s)
{
bool isP = IsP(task.FrameType);
bool isB = IsB(task.FrameType);
bool isI = IsI(task.FrameType);
ThrowAssert(isP + isB + isI != 1, "task.FrameType is invalid");
s = {};
s.first_slice_segment_in_pic_flag = 1;
s.no_output_of_prior_pics_flag = 0;
s.pic_parameter_set_id = pps.pic_parameter_set_id;
s.type = FrameType2SliceType(task.FrameType);
s.pic_output_flag = !!pps.output_flag_present_flag;
assert(0 == sps.separate_colour_plane_flag);
bool bNonIdrNut = task.SliceNUT != IDR_W_RADL && task.SliceNUT != IDR_N_LP;
if (bNonIdrNut)
{
mfxU16 nLTR = 0, nSTR[2] = {};
mfxI32 STR[2][MAX_DPB_SIZE] = {}; // used short-term references
mfxI32 LTR[MAX_NUM_LONG_TERM_PICS] = {}; // used long-term references
const auto& DPB = task.DPB.Active; // DPB before encoding
const auto& RefPicList = task.RefPicList; // Ref. Pic. List
auto IsSame = [&s](const STRPS& x) { return Equal(x, s.strps); };
auto IsLTR = [](const DpbFrame& ref) { return isValid(ref) && ref.isLTR; };
auto IsL0Pic = [](const STRPSPic& pic) { return pic.used_by_curr_pic_sx_flag && (pic.DeltaPocSX <= 0); };
auto IsL1Pic = [](const STRPSPic& pic) { return pic.used_by_curr_pic_sx_flag && (pic.DeltaPocSX > 0); };
auto PicToPOC = [&](const STRPSPic& pic) { return (task.POC + pic.DeltaPocSX); };
ConstructSTRPS(DPB, RefPicList, task.NumRefActive, task.POC, s.strps);
s.pic_order_cnt_lsb = (task.POC & ~(0xFFFFFFFF << (sps.log2_max_pic_order_cnt_lsb_minus4 + 4)));
s.short_term_ref_pic_set_idx = mfxU8(std::find_if(sps.strps, sps.strps + sps.num_short_term_ref_pic_sets, IsSame) - sps.strps);
s.short_term_ref_pic_set_sps_flag = (s.short_term_ref_pic_set_idx < sps.num_short_term_ref_pic_sets);
if (!s.short_term_ref_pic_set_sps_flag)
OptimizeSTRPS(sps.strps, sps.num_short_term_ref_pic_sets, s.strps, sps.num_short_term_ref_pic_sets);
std::list<STRPSPic> picsUsed[2];
auto itStrpsPicsBegin = s.strps.pic;
auto itStrpsPicsEnd = s.strps.pic + mfxU32(s.strps.num_negative_pics + s.strps.num_positive_pics);
std::copy_if(itStrpsPicsBegin, itStrpsPicsEnd, std::back_inserter(picsUsed[0]), IsL0Pic);
std::copy_if(itStrpsPicsBegin, itStrpsPicsEnd, std::back_inserter(picsUsed[1]), IsL1Pic);
nSTR[0] = mfxU16(std::transform(picsUsed[0].begin(), picsUsed[0].end(), STR[0], PicToPOC) - STR[0]);
nSTR[1] = mfxU16(std::transform(picsUsed[1].begin(), picsUsed[1].end(), STR[1], PicToPOC) - STR[1]);
if (std::any_of(DPB, DPB + Size(DPB), IsLTR))
{
assert(sps.long_term_ref_pics_present_flag);
nLTR = GetSliceHeaderLTRs(task, m_prevTask, DPB, sps, LTR, s);
}
if (pps.lists_modification_present_flag)
{
GetSliceHeaderRPLMod(task, DPB, STR, nSTR, LTR, nLTR, s);
}
}
s.temporal_mvp_enabled_flag = !!sps.temporal_mvp_enabled_flag;
if (sps.sample_adaptive_offset_enabled_flag)
{
const mfxExtHEVCParam* rtHEVCParam = ExtBuffer::Get(task.ctrl);
const mfxExtHEVCParam& HEVCParam = ExtBuffer::Get(par);
mfxU16 FrameSAO = (rtHEVCParam && rtHEVCParam->SampleAdaptiveOffset)
? rtHEVCParam->SampleAdaptiveOffset
: HEVCParam.SampleAdaptiveOffset;
s.sao_luma_flag = !!(FrameSAO & MFX_SAO_ENABLE_LUMA);
s.sao_chroma_flag = !!(FrameSAO & MFX_SAO_ENABLE_CHROMA);
}
if (!isI)
{
s.num_ref_idx_active_override_flag =
( pps.num_ref_idx_l0_default_active_minus1 + 1 != task.NumRefActive[0]
|| (isB && pps.num_ref_idx_l1_default_active_minus1 + 1 != task.NumRefActive[1]));
s.num_ref_idx_l0_active_minus1 = task.NumRefActive[0] - 1;
s.num_ref_idx_l1_active_minus1 = isB * (task.NumRefActive[1] - 1);
s.mvd_l1_zero_flag &= !isB;
s.cabac_init_flag = 0;
s.collocated_from_l0_flag = !!s.temporal_mvp_enabled_flag;
s.five_minus_max_num_merge_cand = 0;
}
bool bSetQPd = par.mfx.RateControlMethod == MFX_RATECONTROL_CQP;
s.slice_qp_delta = mfxI8((task.QpY - (pps.init_qp_minus26 + 26)) * bSetQPd);
s.slice_cb_qp_offset = 0;
s.slice_cr_qp_offset = 0;
const mfxExtCodingOption2& CO2 = ExtBuffer::Get(par);
const mfxExtCodingOption2* pCO2 = ExtBuffer::Get(task.ctrl);
SetDefault(pCO2, &CO2);
s.deblocking_filter_disabled_flag = !!pCO2->DisableDeblockingIdc;
s.deblocking_filter_override_flag = (s.deblocking_filter_disabled_flag != pps.deblocking_filter_disabled_flag);
s.beta_offset_div2 = pps.beta_offset_div2;
s.tc_offset_div2 = pps.tc_offset_div2;
s.loop_filter_across_slices_enabled_flag = pps.loop_filter_across_slices_enabled_flag;
s.num_entry_point_offsets *= !(pps.tiles_enabled_flag || pps.entropy_coding_sync_enabled_flag);
return MFX_ERR_NONE;
}
bool Legacy::IsMain10SP(const mfxU16 codecProfile, const mfxExtHEVCParam* pHEVC)
{
return codecProfile == MFX_PROFILE_HEVC_MAIN10 && pHEVC && pHEVC->GeneralConstraintFlags == MFX_HEVC_CONSTR_REXT_ONE_PICTURE_ONLY;
}
#endif
|
// Copyright (c) 2012 Pieter Wuille
// Copyright (c) 2012-2014 The Bitcoin developers
// Copyright (c) 2017 The PIVX developers
// Copyright (c) 2018-2019 The Ingenuity developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "addrman.h"
#include "hash.h"
#include "serialize.h"
#include "streams.h"
using namespace std;
int CAddrInfo::GetTriedBucket(const uint256& nKey) const
{
uint64_t hash1 = (CHashWriter(SER_GETHASH, 0) << nKey << GetKey()).GetHash().GetLow64();
uint64_t hash2 = (CHashWriter(SER_GETHASH, 0) << nKey << GetGroup() << (hash1 % ADDRMAN_TRIED_BUCKETS_PER_GROUP)).GetHash().GetLow64();
return hash2 % ADDRMAN_TRIED_BUCKET_COUNT;
}
int CAddrInfo::GetNewBucket(const uint256& nKey, const CNetAddr& src) const
{
std::vector<unsigned char> vchSourceGroupKey = src.GetGroup();
uint64_t hash1 = (CHashWriter(SER_GETHASH, 0) << nKey << GetGroup() << vchSourceGroupKey).GetHash().GetLow64();
uint64_t hash2 = (CHashWriter(SER_GETHASH, 0) << nKey << vchSourceGroupKey << (hash1 % ADDRMAN_NEW_BUCKETS_PER_SOURCE_GROUP)).GetHash().GetLow64();
return hash2 % ADDRMAN_NEW_BUCKET_COUNT;
}
int CAddrInfo::GetBucketPosition(const uint256& nKey, bool fNew, int nBucket) const
{
uint64_t hash1 = (CHashWriter(SER_GETHASH, 0) << nKey << (fNew ? 'N' : 'K') << nBucket << GetKey()).GetHash().GetLow64();
return hash1 % ADDRMAN_BUCKET_SIZE;
}
bool CAddrInfo::IsTerrible(int64_t nNow) const
{
if (nLastTry && nLastTry >= nNow - 60) // never remove things tried in the last minute
return false;
if (nTime > nNow + 10 * 60) // came in a flying DeLorean
return true;
if (nTime == 0 || nNow - nTime > ADDRMAN_HORIZON_DAYS * 24 * 60 * 60) // not seen in recent history
return true;
if (nLastSuccess == 0 && nAttempts >= ADDRMAN_RETRIES) // tried N times and never a success
return true;
if (nNow - nLastSuccess > ADDRMAN_MIN_FAIL_DAYS * 24 * 60 * 60 && nAttempts >= ADDRMAN_MAX_FAILURES) // N successive failures in the last week
return true;
return false;
}
double CAddrInfo::GetChance(int64_t nNow) const
{
double fChance = 1.0;
int64_t nSinceLastSeen = nNow - nTime;
int64_t nSinceLastTry = nNow - nLastTry;
if (nSinceLastSeen < 0)
nSinceLastSeen = 0;
if (nSinceLastTry < 0)
nSinceLastTry = 0;
// deprioritize very recent attempts away
if (nSinceLastTry < 60 * 10)
fChance *= 0.01;
// deprioritize 66% after each failed attempt, but at most 1/28th to avoid the search taking forever or overly penalizing outages.
fChance *= pow(0.66, min(nAttempts, 8));
return fChance;
}
CAddrInfo* CAddrMan::Find(const CNetAddr& addr, int* pnId)
{
std::map<CNetAddr, int>::iterator it = mapAddr.find(addr);
if (it == mapAddr.end())
return NULL;
if (pnId)
*pnId = (*it).second;
std::map<int, CAddrInfo>::iterator it2 = mapInfo.find((*it).second);
if (it2 != mapInfo.end())
return &(*it2).second;
return NULL;
}
CAddrInfo* CAddrMan::Create(const CAddress& addr, const CNetAddr& addrSource, int* pnId)
{
int nId = nIdCount++;
mapInfo[nId] = CAddrInfo(addr, addrSource);
mapAddr[addr] = nId;
mapInfo[nId].nRandomPos = vRandom.size();
vRandom.push_back(nId);
if (pnId)
*pnId = nId;
return &mapInfo[nId];
}
void CAddrMan::SwapRandom(unsigned int nRndPos1, unsigned int nRndPos2)
{
if (nRndPos1 == nRndPos2)
return;
assert(nRndPos1 < vRandom.size() && nRndPos2 < vRandom.size());
int nId1 = vRandom[nRndPos1];
int nId2 = vRandom[nRndPos2];
assert(mapInfo.count(nId1) == 1);
assert(mapInfo.count(nId2) == 1);
mapInfo[nId1].nRandomPos = nRndPos2;
mapInfo[nId2].nRandomPos = nRndPos1;
vRandom[nRndPos1] = nId2;
vRandom[nRndPos2] = nId1;
}
void CAddrMan::Delete(int nId)
{
assert(mapInfo.count(nId) != 0);
CAddrInfo& info = mapInfo[nId];
assert(!info.fInTried);
assert(info.nRefCount == 0);
SwapRandom(info.nRandomPos, vRandom.size() - 1);
vRandom.pop_back();
mapAddr.erase(info);
mapInfo.erase(nId);
nNew--;
}
void CAddrMan::ClearNew(int nUBucket, int nUBucketPos)
{
// if there is an entry in the specified bucket, delete it.
if (vvNew[nUBucket][nUBucketPos] != -1) {
int nIdDelete = vvNew[nUBucket][nUBucketPos];
CAddrInfo& infoDelete = mapInfo[nIdDelete];
assert(infoDelete.nRefCount > 0);
infoDelete.nRefCount--;
vvNew[nUBucket][nUBucketPos] = -1;
if (infoDelete.nRefCount == 0) {
Delete(nIdDelete);
}
}
}
void CAddrMan::MakeTried(CAddrInfo& info, int nId)
{
// remove the entry from all new buckets
for (int bucket = 0; bucket < ADDRMAN_NEW_BUCKET_COUNT; bucket++) {
int pos = info.GetBucketPosition(nKey, true, bucket);
if (vvNew[bucket][pos] == nId) {
vvNew[bucket][pos] = -1;
info.nRefCount--;
}
}
nNew--;
assert(info.nRefCount == 0);
// which tried bucket to move the entry to
int nKBucket = info.GetTriedBucket(nKey);
int nKBucketPos = info.GetBucketPosition(nKey, false, nKBucket);
// first make space to add it (the existing tried entry there is moved to new, deleting whatever is there).
if (vvTried[nKBucket][nKBucketPos] != -1) {
// find an item to evict
int nIdEvict = vvTried[nKBucket][nKBucketPos];
assert(mapInfo.count(nIdEvict) == 1);
CAddrInfo& infoOld = mapInfo[nIdEvict];
// Remove the to-be-evicted item from the tried set.
infoOld.fInTried = false;
vvTried[nKBucket][nKBucketPos] = -1;
nTried--;
// find which new bucket it belongs to
int nUBucket = infoOld.GetNewBucket(nKey);
int nUBucketPos = infoOld.GetBucketPosition(nKey, true, nUBucket);
ClearNew(nUBucket, nUBucketPos);
assert(vvNew[nUBucket][nUBucketPos] == -1);
// Enter it into the new set again.
infoOld.nRefCount = 1;
vvNew[nUBucket][nUBucketPos] = nIdEvict;
nNew++;
}
assert(vvTried[nKBucket][nKBucketPos] == -1);
vvTried[nKBucket][nKBucketPos] = nId;
nTried++;
info.fInTried = true;
}
void CAddrMan::Good_(const CService& addr, int64_t nTime)
{
int nId;
CAddrInfo* pinfo = Find(addr, &nId);
// if not found, bail out
if (!pinfo)
return;
CAddrInfo& info = *pinfo;
// check whether we are talking about the exact same CService (including same port)
if (info != addr)
return;
// update info
info.nLastSuccess = nTime;
info.nLastTry = nTime;
info.nAttempts = 0;
// nTime is not updated here, to avoid leaking information about
// currently-connected peers.
// if it is already in the tried set, don't do anything else
if (info.fInTried)
return;
// find a bucket it is in now
int nRnd = GetRandInt(ADDRMAN_NEW_BUCKET_COUNT);
int nUBucket = -1;
for (unsigned int n = 0; n < ADDRMAN_NEW_BUCKET_COUNT; n++) {
int nB = (n + nRnd) % ADDRMAN_NEW_BUCKET_COUNT;
int nBpos = info.GetBucketPosition(nKey, true, nB);
if (vvNew[nB][nBpos] == nId) {
nUBucket = nB;
break;
}
}
// if no bucket is found, something bad happened;
// TODO: maybe re-add the node, but for now, just bail out
if (nUBucket == -1)
return;
LogPrint("addrman", "Moving %s to tried\n", addr.ToString());
// move nId to the tried tables
MakeTried(info, nId);
}
bool CAddrMan::Add_(const CAddress& addr, const CNetAddr& source, int64_t nTimePenalty)
{
if (!addr.IsRoutable())
return false;
bool fNew = false;
int nId;
CAddrInfo* pinfo = Find(addr, &nId);
if (pinfo) {
// periodically update nTime
bool fCurrentlyOnline = (GetAdjustedTime() - addr.nTime < 24 * 60 * 60);
int64_t nUpdateInterval = (fCurrentlyOnline ? 60 * 60 : 24 * 60 * 60);
if (addr.nTime && (!pinfo->nTime || pinfo->nTime < addr.nTime - nUpdateInterval - nTimePenalty))
pinfo->nTime = max((int64_t)0, addr.nTime - nTimePenalty);
// add services
pinfo->nServices |= addr.nServices;
// do not update if no new information is present
if (!addr.nTime || (pinfo->nTime && addr.nTime <= pinfo->nTime))
return false;
// do not update if the entry was already in the "tried" table
if (pinfo->fInTried)
return false;
// do not update if the max reference count is reached
if (pinfo->nRefCount == ADDRMAN_NEW_BUCKETS_PER_ADDRESS)
return false;
// stochastic test: previous nRefCount == N: 2^N times harder to increase it
int nFactor = 1;
for (int n = 0; n < pinfo->nRefCount; n++)
nFactor *= 2;
if (nFactor > 1 && (GetRandInt(nFactor) != 0))
return false;
} else {
pinfo = Create(addr, source, &nId);
pinfo->nTime = max((int64_t)0, (int64_t)pinfo->nTime - nTimePenalty);
nNew++;
fNew = true;
}
int nUBucket = pinfo->GetNewBucket(nKey, source);
int nUBucketPos = pinfo->GetBucketPosition(nKey, true, nUBucket);
if (vvNew[nUBucket][nUBucketPos] != nId) {
bool fInsert = vvNew[nUBucket][nUBucketPos] == -1;
if (!fInsert) {
CAddrInfo& infoExisting = mapInfo[vvNew[nUBucket][nUBucketPos]];
if (infoExisting.IsTerrible() || (infoExisting.nRefCount > 1 && pinfo->nRefCount == 0)) {
// Overwrite the existing new table entry.
fInsert = true;
}
}
if (fInsert) {
ClearNew(nUBucket, nUBucketPos);
pinfo->nRefCount++;
vvNew[nUBucket][nUBucketPos] = nId;
} else {
if (pinfo->nRefCount == 0) {
Delete(nId);
}
}
}
return fNew;
}
void CAddrMan::Attempt_(const CService& addr, int64_t nTime)
{
CAddrInfo* pinfo = Find(addr);
// if not found, bail out
if (!pinfo)
return;
CAddrInfo& info = *pinfo;
// check whether we are talking about the exact same CService (including same port)
if (info != addr)
return;
// update info
info.nLastTry = nTime;
info.nAttempts++;
}
CAddress CAddrMan::Select_()
{
if (size() == 0)
return CAddress();
// Use a 50% chance for choosing between tried and new table entries.
if (nTried > 0 && (nNew == 0 || GetRandInt(2) == 0)) {
// use a tried node
double fChanceFactor = 1.0;
while (1) {
int nKBucket = GetRandInt(ADDRMAN_TRIED_BUCKET_COUNT);
int nKBucketPos = GetRandInt(ADDRMAN_BUCKET_SIZE);
if (vvTried[nKBucket][nKBucketPos] == -1)
continue;
int nId = vvTried[nKBucket][nKBucketPos];
assert(mapInfo.count(nId) == 1);
CAddrInfo& info = mapInfo[nId];
if (GetRandInt(1 << 30) < fChanceFactor * info.GetChance() * (1 << 30))
return info;
fChanceFactor *= 1.2;
}
} else {
// use a new node
double fChanceFactor = 1.0;
while (1) {
int nUBucket = GetRandInt(ADDRMAN_NEW_BUCKET_COUNT);
int nUBucketPos = GetRandInt(ADDRMAN_BUCKET_SIZE);
if (vvNew[nUBucket][nUBucketPos] == -1)
continue;
int nId = vvNew[nUBucket][nUBucketPos];
assert(mapInfo.count(nId) == 1);
CAddrInfo& info = mapInfo[nId];
if (GetRandInt(1 << 30) < fChanceFactor * info.GetChance() * (1 << 30))
return info;
fChanceFactor *= 1.2;
}
}
}
#ifdef DEBUG_ADDRMAN
int CAddrMan::Check_()
{
std::set<int> setTried;
std::map<int, int> mapNew;
if (vRandom.size() != nTried + nNew)
return -7;
for (std::map<int, CAddrInfo>::iterator it = mapInfo.begin(); it != mapInfo.end(); it++) {
int n = (*it).first;
CAddrInfo& info = (*it).second;
if (info.fInTried) {
if (!info.nLastSuccess)
return -1;
if (info.nRefCount)
return -2;
setTried.insert(n);
} else {
if (info.nRefCount < 0 || info.nRefCount > ADDRMAN_NEW_BUCKETS_PER_ADDRESS)
return -3;
if (!info.nRefCount)
return -4;
mapNew[n] = info.nRefCount;
}
if (mapAddr[info] != n)
return -5;
if (info.nRandomPos < 0 || info.nRandomPos >= vRandom.size() || vRandom[info.nRandomPos] != n)
return -14;
if (info.nLastTry < 0)
return -6;
if (info.nLastSuccess < 0)
return -8;
}
if (setTried.size() != nTried)
return -9;
if (mapNew.size() != nNew)
return -10;
for (int n = 0; n < ADDRMAN_TRIED_BUCKET_COUNT; n++) {
for (int i = 0; i < ADDRMAN_BUCKET_SIZE; i++) {
if (vvTried[n][i] != -1) {
if (!setTried.count(vvTried[n][i]))
return -11;
if (mapInfo[vvTried[n][i]].GetTriedBucket(nKey) != n)
return -17;
if (mapInfo[vvTried[n][i]].GetBucketPosition(nKey, false, n) != i)
return -18;
setTried.erase(vvTried[n][i]);
}
}
}
for (int n = 0; n < ADDRMAN_NEW_BUCKET_COUNT; n++) {
for (int i = 0; i < ADDRMAN_BUCKET_SIZE; i++) {
if (vvNew[n][i] != -1) {
if (!mapNew.count(vvNew[n][i]))
return -12;
if (mapInfo[vvNew[n][i]].GetBucketPosition(nKey, true, n) != i)
return -19;
if (--mapNew[vvNew[n][i]] == 0)
mapNew.erase(vvNew[n][i]);
}
}
}
if (setTried.size())
return -13;
if (mapNew.size())
return -15;
if (nKey.IsNull())
return -16;
return 0;
}
#endif
void CAddrMan::GetAddr_(std::vector<CAddress>& vAddr)
{
unsigned int nNodes = ADDRMAN_GETADDR_MAX_PCT * vRandom.size() / 100;
if (nNodes > ADDRMAN_GETADDR_MAX)
nNodes = ADDRMAN_GETADDR_MAX;
// gather a list of random nodes, skipping those of low quality
for (unsigned int n = 0; n < vRandom.size(); n++) {
if (vAddr.size() >= nNodes)
break;
int nRndPos = GetRandInt(vRandom.size() - n) + n;
SwapRandom(n, nRndPos);
assert(mapInfo.count(vRandom[n]) == 1);
const CAddrInfo& ai = mapInfo[vRandom[n]];
if (!ai.IsTerrible())
vAddr.push_back(ai);
}
}
void CAddrMan::Connected_(const CService& addr, int64_t nTime)
{
CAddrInfo* pinfo = Find(addr);
// if not found, bail out
if (!pinfo)
return;
CAddrInfo& info = *pinfo;
// check whether we are talking about the exact same CService (including same port)
if (info != addr)
return;
// update info
int64_t nUpdateInterval = 20 * 60;
if (nTime - info.nTime > nUpdateInterval)
info.nTime = nTime;
}
|
.text
.global _start
_start:
movzbw %ah,%ax
movzbl %ah,%eax
movzbq %r8b,%rax
movzwl %ax,%eax
movzwq %r8w,%rax
int $0x80
|
.size 8000
.text@48
jp lstatint
.text@100
jp lbegin
.data@143
c0
.text@150
lbegin:
ld a, 00
ldff(ff), a
ld a, 30
ldff(00), a
ld a, 01
ldff(4d), a
stop, 00
ld a, ff
ldff(45), a
ld b, 91
call lwaitly_b
ld hl, fe00
ld d, 10
ld a, d
ld(hl++), a
ld a, 08
ld(hl++), a
inc l
inc l
ld a, d
ld(hl++), a
ld(hl++), a
inc l
inc l
ld(hl++), a
ld a, 18
ld(hl++), a
inc l
inc l
ld a, d
ld(hl++), a
ld a, 20
ld(hl++), a
inc l
inc l
ld a, d
ld(hl++), a
ld a, 28
ld(hl++), a
inc l
inc l
ld a, d
ld(hl++), a
ld a, 30
ld(hl++), a
inc l
inc l
ld a, d
ld(hl++), a
ld a, 38
ld(hl++), a
inc l
inc l
ld a, d
ld(hl++), a
ld a, 40
ld(hl++), a
inc l
inc l
ld a, d
ld(hl++), a
ld a, a6
ld(hl++), a
inc l
inc l
ld a, d
ld(hl++), a
ld a, 50
ld(hl++), a
ld a, 40
ldff(41), a
ld a, 02
ldff(ff), a
xor a, a
ldff(0f), a
ei
ld a, 01
ldff(45), a
ld c, 41
ld a, 93
ldff(40), a
.text@1000
lstatint:
nop
.text@10a9
ldff a, (c)
and a, 03
jp lprint_a
.text@7000
lprint_a:
push af
ld b, 91
call lwaitly_b
xor a, a
ldff(40), a
pop af
ld(9800), a
ld bc, 7a00
ld hl, 8000
ld d, a0
lprint_copytiles:
ld a, (bc)
inc bc
ld(hl++), a
dec d
jrnz lprint_copytiles
ld a, c0
ldff(47), a
ld a, 80
ldff(68), a
ld a, ff
ldff(69), a
ldff(69), a
ldff(69), a
ldff(69), a
ldff(69), a
ldff(69), a
xor a, a
ldff(69), a
ldff(69), a
ldff(43), a
ld a, 91
ldff(40), a
lprint_limbo:
jr lprint_limbo
.text@7400
lwaitly_b:
ld c, 44
lwaitly_b_loop:
ldff a, (c)
cmp a, b
jrnz lwaitly_b_loop
ret
.data@7a00
00 00 7f 7f 41 41 41 41
41 41 41 41 41 41 7f 7f
00 00 08 08 08 08 08 08
08 08 08 08 08 08 08 08
00 00 7f 7f 01 01 01 01
7f 7f 40 40 40 40 7f 7f
00 00 7f 7f 01 01 01 01
3f 3f 01 01 01 01 7f 7f
00 00 41 41 41 41 41 41
7f 7f 01 01 01 01 01 01
00 00 7f 7f 40 40 40 40
7e 7e 01 01 01 01 7e 7e
00 00 7f 7f 40 40 40 40
7f 7f 41 41 41 41 7f 7f
00 00 7f 7f 01 01 02 02
04 04 08 08 10 10 10 10
00 00 3e 3e 41 41 41 41
3e 3e 41 41 41 41 3e 3e
00 00 7f 7f 41 41 41 41
7f 7f 01 01 01 01 7f 7f
|
/*
* Copyright (c) 2021, krishpranav
*
* SPDX-License-Identifier: BSD-2-Clause
*/
// includes
#include "archs/x86_32/GDT.h"
namespace Arch::x86_32
{
static TSS tss = {
.prev_tss = 0,
.esp0 = 0,
.ss0 = 0x10,
.esp1 = 0,
.ss1 = 0,
.esp2 = 0,
.ss2 = 0,
.cr3 = 0,
.eip = 0,
.eflags = 0x0202,
.eax = 0,
.ecx = 0,
.edx = 0,
.ebx = 0,
.esp = 0,
.ebp = 0,
.esi = 0,
.edi = 0,
.es = 0,
.cs = 0,
.ss = 0,
.ds = 0,
.fs = 0,
.gs = 0,
.ldt = 0,
.trap = 0,
.iomap_base = 0,
};
static GDTEntry gdt[GDT_ENTRY_COUNT];
static GDTDescriptor gdt_descriptor = {
.size = sizeof(GDTEntry) * GDT_ENTRY_COUNT,
.offset = (uint32_t)&gdt[0],
};
void gdt_initialize()
{
gdt[0] = {0, 0, 0, 0};
gdt[1] = {0, 0xffffffff, GDT_PRESENT | GDT_READWRITE | GDT_EXECUTABLE, GDT_FLAGS};
gdt[2] = {0, 0xffffffff, GDT_PRESENT | GDT_READWRITE, GDT_FLAGS};
gdt[3] = {0, 0xffffffff, GDT_PRESENT | GDT_READWRITE | GDT_USER | GDT_EXECUTABLE, GDT_FLAGS};
gdt[4] = {0, 0xffffffff, GDT_PRESENT | GDT_READWRITE | GDT_USER, GDT_FLAGS};
gdt[5] = {&tss, GDT_TSS_PRESENT | GDT_ACCESSED | GDT_EXECUTABLE | GDT_USER, TSS_FLAGS};
gdt_flush((uint32_t)&gdt_descriptor);
}
void set_kernel_stack(uint32_t stack)
{
tss.esp0 = stack;
}
} |
; dskcpy check for type
; and parses special case
dskcpy
lda #$e0 ; kill bam buffer
sta bufuse
jsr clnbam ; clr tbam
jsr bam2x ; get bam lindx in .x
lda #$ff
sta buf0,x ; mark bam out-of-memory
lda #$0f
sta linuse ; free all lindxs
jsr prscln ; find ":"
bne dx0000
jmp duplct ; bad command error, cx=x not allowed
;
;jsr prseq
;
;lda #'* ;cpy all
;ldx #39 ;put at buffer end
;stx filtbl+1
;sta cmdbuf,x ;place *
;inx
;stx cmdsiz
;ldx #1 ;set up cnt's
;stx f1cnt
;inx
;stx f2cnt
;jmp movlp2 ;enter routine
;
dx0000 jsr tc30 ; normal parse
dx0005 jsr alldrs ; put drv's in filtbl
lda image ; get parse image
and #%01010101 ; val for patt copy
bne dx0020 ; must be concat or normal
ldx filtbl ; chk for *
lda cmdbuf,x
cmp #'*'
bne dx0020
;ldx #1 ;set cnt's
; no pattern matching allowed
;stx f1cnt
;inx
;stx f2cnt
;jmp cpydtd ;go copy
dx0010 lda #badsyn ; syntax error
jmp cmderr
dx0020 lda image ; chk for normal
and #%11011001
bne dx0010
jmp copy
;.end
;prseq
; lda #'= ; special case
; jsr parse
; bne x0020
;x0015 lda #badsyn
; jmp cmderr
;x0020 lda cmdbuf,y
; jsr tst0v1
; bmi x0015
; sta fildrv+1 ; src drv
; dey
; dey
; lda cmdbuf,y
; jsr tst0v1
; bmi x0015
; cmp fildrv+1 ; cannot be equal
; beq x0015
; sta fildrv ; dest drv
; rts
|
DEZ_Header:
smpsHeaderStartSong 2
smpsHeaderVoice DEZ_Voices
smpsHeaderChan $06, $03
smpsHeaderTempo $01, $60
smpsHeaderDAC DEZ_DAC
smpsHeaderFM DEZ_FM1, $00, $16
smpsHeaderFM DEZ_FM2, $00, $08
smpsHeaderFM DEZ_FM3, $00, $10
smpsHeaderFM DEZ_FM4, $00, $10
smpsHeaderFM DEZ_FM5, $00, $06
smpsHeaderPSG DEZ_PSG1, $E8, $06, $00, $00
smpsHeaderPSG DEZ_PSG2, $E8, $06, $00, $00
smpsHeaderPSG DEZ_PSG3, $00, $02, $00, fTone_01
; FM1 Data
DEZ_FM1:
smpsSetvoice $00
DEZ_Jump01:
dc.b nA5, $04, nG5, nBb5, nFs5, nA5, nF5, nAb5, nFs5, nB5, nF5, nA5
dc.b nG5, nBb5, nFs5, nAb5, nF5, nA5, nG5, nB5, nF5, nBb5, nFs5, nC6
dc.b nF5, nBb5, nG5, nB5, nFs5, nA5, nF5, nAb5, nFs5, nBb5, nE5, nG5
dc.b nEb5, nA5, nF5, nBb5, nFs5, nB5, nG5, nA5, nF5, nAb5, nFs5, nBb5
dc.b nG5, nB5, nAb5, nC6, nA5, nCs6, nG5, nC6, nF5, nB5, nFs5, nBb5
dc.b nG5, nA5, nF5, nAb5, nE5, nG5, nEb5, nA5, nF5, nBb5, nFs5, nB5
dc.b nG5, nC6, nAb5, nEb6, nG5, nD6, nF5, nC6, nG5, nB5, nFs5, nBb5
dc.b nG5, nA5, nF5, nAb5, nFs5, nB5, nF5, nA5, nG5, nBb5, nFs5, nC6
dc.b nF5, nBb5, nFs5, nB5, nF5, nA5, nE5, nAb5, nEb5, nA5, nE5, nBb5
dc.b nF5, nB5, nFs5, nC6, nG5, nD6, nF5, nBb5, nFs5, nA5, nG5, nB5
dc.b nFs5, nBb5, nF5, nB5, nE5, nA5, nF5, nBb5, nG5, nB5, nFs5, nA5
dc.b nF5, nBb5, nFs5, nC6, nE5, nD6, nEb5, nCs6, nF5, nC6, nFs5, nB5
dc.b nF5, nBb5, nG5, nA5, nFs5, nAb5, nF5, nA5, nFs5, nBb5, nG5, nB5
dc.b nAb5, nC6, nF5, nA5, nFs5, nBb5, nF5, nB5, nE5, nC6, nF5, nB5
dc.b nFs5, nA5, nG5, nBb5, nFs5, nAb5, nF5, nA5, nG5, nBb5, nFs5, nB5
dc.b nF5, nC6, nE5, nBb5, nF5, nA5, nFs5, nB5, nG5, nAb5, nF5, nA5
dc.b nFs5, nBb5, nF5, nB5, nE5, nC6, nEb5, nCs6, nE5, nBb5, nF5, nA5
dc.b nFs5, nAb5, nG5, nB5, nF5, nA5, nFs5, nBb5, nG5, nAb5, nF5, nB5
dc.b nE5, nC6, nEb5, nBb5, nF5, nA5, nFs5, nB5, nG5, nBb5, nF5, nA5
dc.b nFs5, nAb5, nG5, nB5, nF5, nBb5, nFs5, nC6, nD5, nB5, nF5, nA5
dc.b nFs5, nBb5, nG5, nAb5, nFs5, nA5, nF5, nBb5, nE5, nB5, nEb5, nC6
dc.b nF5, nCs6, nFs5, nB5, nG5, nBb5, nFs5, nA5, nF5, nAb5, nEb5, nG5
dc.b nF5, nA5, nFs5, nBb5, nG5, nB5, nAb5, nC6, nG5, nBb5, nFs5, nA5
dc.b nG5, nB5, nF5, nBb5, nFs5, nA5, nG5, nB5, nF5, nBb5, nFs5, nA5
dc.b nF5
smpsJump DEZ_Jump01
; FM3 Data
DEZ_FM3:
smpsSetvoice $02
smpsModSet $08, $01, $05, $04
DEZ_Loop06:
dc.b nRst, $30
DEZ_Loop05:
dc.b nRst, $08, nEb6, $02, nCs6, nA5, nRst, nEb6, nCs6, nA5, nRst
smpsLoop $01, $02, DEZ_Loop05
smpsLoop $00, $02, DEZ_Loop06
smpsCall DEZ_Call00
dc.b nA4, $10, nB4, $08, nCs5, $10, nA4, $08, nE5, $0C, nFs5, $04
dc.b nE5, $08, nCs5, $10, nA4, $08, nA5, $10, nFs5, $04, nA5, nFs5
dc.b $10, nE5, $04, nFs5, nE5, $18, nFs5, $10, nCs5, $08, nA4, $10
dc.b nB4, $08, nCs5, $10, nA4, $08, nE5, $0C, nFs5, $04, nE5, $08
dc.b nCs5, $10, nA4, $08, nA5, $60
DEZ_Loop07:
dc.b nE6, $04, nD6, nCs6, $10
smpsLoop $00, $03, DEZ_Loop07
dc.b nE6, $04, nD6, nCs6, $08, nA5, nCs6, $30, nRst
smpsJump DEZ_FM3
DEZ_Call00:
smpsSetvoice $03
dc.b nA4, $10, nB4, $08, nCs5, $10, nA4, $08, nE5, $0C, nFs5, $04
dc.b nE5, $08, nCs5, $10, nA4, $08, nA5, $18, nFs5, nE5, nCs5, nA4
dc.b $10, nB4, $08, nCs5, $10, nA4, $08, nE5, $0C, nFs5, $04, nE5
dc.b $08, nCs5, $10, nA4, $08, nA5, $20, nFs5, $08, nAb5, nA5, $30
smpsReturn
; FM4 Data
DEZ_FM4:
smpsSetvoice $02
smpsModSet $08, $01, $05, $04
DEZ_Loop03:
smpsAlterNote $02
dc.b nRst, $30
DEZ_Loop02:
dc.b nRst, $08, nEb6, $02, nCs6, nA5, nRst, nEb6, nCs6, nA5, nRst
smpsLoop $01, $02, DEZ_Loop02
smpsLoop $00, $02, DEZ_Loop03
smpsCall DEZ_Call00
dc.b nCs5, $10, nD5, $08, nE5, $10, nCs5, $08, nAb5, $0C, nA5, $04
dc.b nAb5, $08, nE5, $10, nCs5, $08, nCs6, $10, nA5, $04, nCs6, nA5
dc.b $10, nAb5, $04, nA5, nAb5, $18, nA5, $10, nE5, $08, nCs5, $10
dc.b nD5, $08, nE5, $10, nCs5, $08, nAb5, $0C, nA5, $04, nAb5, $08
dc.b nE5, $10, nCs5, $08, nCs6, $60
DEZ_Loop04:
dc.b nCs6, $04, nB5, nA5, $10
smpsLoop $00, $03, DEZ_Loop04
dc.b nCs6, $04, nB5, nA5, $08, nFs5, nA5, $30, nRst
smpsJump DEZ_Loop03
; FM5 Data
DEZ_FM5:
smpsSetvoice $05
smpsNoteFill $00
smpsAlterVol $0C
dc.b nA2, $30
smpsModSet $10, $01, $FF, $FF
dc.b smpsNoAttack, $30, smpsNoAttack
smpsModSet $00, $01, $10, $FF
dc.b nG2, $08
smpsModOff
dc.b nC3, $40
smpsModSet $10, $01, $FE, $FF
dc.b smpsNoAttack, $18
smpsAlterVol $F4
smpsSetvoice $04
smpsNoteFill $09
DEZ_Loop00:
dc.b nA2, $04, nRst, $28, nAb2, $04, nA2, nA2, $02, nRst, $2A, nA2
dc.b $04, nRst, $28, nAb2, $04, nA2, nA2, nRst, $18, nA4, $04, nB4
dc.b nC5, nCs5
smpsLoop $00, $04, DEZ_Loop00
DEZ_Loop01:
dc.b nA2, $04, nRst, nA4, nA4, nFs4, nA4
smpsLoop $00, $04, DEZ_Loop01
dc.b nA2, $04, nRst, $28, nAb2, $04, nA2, nA2, nA4, nB4, nC5, nCs5
dc.b nRst, $08, nA4, $04, nB4, nC5, nCs5
smpsJump DEZ_FM5
; FM2 Data
DEZ_FM2:
smpsSetvoice $01
smpsNoteFill $0A
DEZ_Jump00:
dc.b nA1, $04, nA2, nA2, nA1, nG2, nA1, nFs2, nA1, nF2, nF2, nA1
dc.b nE2, nA1, $02, nRst, $2E, nA1, $04, nA2, nA2, nA1, nG2, nA1
dc.b nFs2, nA1, nC3, nC3, nA1, nC3, nA1, $02, nRst, $2E
smpsJump DEZ_Jump00
; PSG2 Data
DEZ_PSG2:
smpsAlterNote $FE
; PSG1 Data
DEZ_PSG1:
dc.b nRst, $18
smpsLoop $00, $18, DEZ_PSG1
DEZ_Loop09:
smpsModSet $06, $02, $FE, $FF
dc.b nG2, $18
smpsModOff
dc.b nA2, $30
smpsModSet $06, $01, $01, $FF
dc.b smpsNoAttack, $18
smpsModSet $00, $01, $FA, $FF
dc.b nG2, $08
smpsModOff
dc.b nC3, $40
smpsModSet $00, $01, $01, $FF
dc.b smpsNoAttack, $18
smpsLoop $00, $02, DEZ_Loop09
DEZ_Loop0A:
smpsModSet $00, $01, $FD, $FF
dc.b nG2, $08
smpsModOff
dc.b nA2, $10
smpsModSet $00, $01, $FC, $FF
dc.b $08
smpsModOff
dc.b nC3, $10
smpsLoop $00, $02, DEZ_Loop0A
smpsModSet $00, $01, $FD, $FF
dc.b nG2, $08
smpsModOff
dc.b nA2, $40
smpsModSet $06, $01, $01, $FF
dc.b smpsNoAttack, $18
smpsJump DEZ_PSG1
; DAC Data
DEZ_DAC:
dc.b nRst, $30, dSnare, $04, dKick, dKick, $10, dSnare, $04, dKick, dKick, $10
dc.b nRst, $30, dSnare, $04, dKick, nRst, dKick, nRst, dKick, dKick, dKick, dSnare
dc.b $08, dSnare, dKick, $08, dSnare, $04, $04, $08, dKick, dSnare, dSnare, dKick
dc.b dSnare, $0C, $04, dKick, $08, dSnare, dSnare, dKick, dSnare, $04, $08, $04
dc.b dKick, $08, dSnare, dSnare, dKick, dSnare, $04, $08, $04, dKick, $08, dSnare
dc.b $04, $04, $08, dKick, dSnare, dSnare, dKick, dSnare, $04, $08, $04, dKick
dc.b $08, dSnare, dSnare, dKick, $08, dSnare, $04, $04, $08, dKick, dSnare, dSnare
dc.b dKick, dSnare, $04, $08, $04, dKick, $08, dSnare, dSnare, dKick, dSnare, $04
dc.b dSnare, dKick, dSnare, dKick, $08, dSnare, dSnare, dKick, dSnare, $04, $08, $04
dc.b dKick, $08, dSnare, dSnare, dKick, $08, dSnare, $04, $04, $08, dKick, dSnare
dc.b dSnare, dKick, dSnare, $04, $08, $04, dKick, $08, dSnare, dSnare, dKick, $04
dc.b dKick, dSnare, dKick, dSnare, dKick, dKick, $08, dSnare, dSnare, dKick, dSnare, $04
dc.b $08, $04, dKick, $08, dSnare, dSnare, dKick, dSnare, $04, $04, $08, dKick
dc.b dSnare, dSnare, dKick, dSnare, $04, $08, $04, dKick, $08, dSnare, dSnare, dSnare
dc.b $04, dKick, $08, $04, dSnare, dKick, dKick, $08, dSnare, dSnare, dKick, $08
dc.b dSnare, $04, dSnare, dSnare, dSnare, dKick, $08, dSnare, dSnare, dKick, $08, dSnare
dc.b $04, dSnare, dSnare, dSnare, dKick, $08, dSnare, dSnare, dKick, $08, dSnare, $04
dc.b $08, $04, dSnare, $04, dKick, $08, $04, dSnare, dKick, dSnare, $04, dKick
dc.b $08, $04, dSnare, dKick
smpsJump DEZ_DAC
; PSG3 Data
DEZ_PSG3:
smpsPSGform $E7
DEZ_Jump02:
dc.b nRst, $08, nMaxPSG, nMaxPSG, nRst, $08, nMaxPSG, nMaxPSG, nRst, $30, nRst, $08
dc.b nMaxPSG, nMaxPSG, nRst, $08, nMaxPSG, nMaxPSG, nRst, $30
DEZ_Loop08:
dc.b nRst, $18
smpsLoop $00, $28, DEZ_Loop08
smpsJump DEZ_Jump02
DEZ_Voices:
; Voice $00
; $30
; $75, $75, $71, $31, $D8, $58, $96, $94, $01, $1B, $03, $08
; $01, $04, $01, $01, $FF, $2F, $3F, $3F, $34, $29, $10, $80
smpsVcAlgorithm $00
smpsVcFeedback $06
smpsVcUnusedBits $00
smpsVcDetune $03, $07, $07, $07
smpsVcCoarseFreq $01, $01, $05, $05
smpsVcRateScale $02, $02, $01, $03
smpsVcAttackRate $14, $16, $18, $18
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $08, $03, $1B, $01
smpsVcDecayRate2 $01, $01, $04, $01
smpsVcDecayLevel $03, $03, $02, $0F
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $00, $10, $29, $34
; Voice $01
; $3A
; $32, $11, $72, $11, $1F, $1F, $9F, $1F, $03, $0A, $03, $0A
; $02, $02, $02, $02, $AF, $7F, $AF, $7F, $1E, $00, $28, $80
smpsVcAlgorithm $02
smpsVcFeedback $07
smpsVcUnusedBits $00
smpsVcDetune $01, $07, $01, $03
smpsVcCoarseFreq $01, $02, $01, $02
smpsVcRateScale $00, $02, $00, $00
smpsVcAttackRate $1F, $1F, $1F, $1F
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $0A, $03, $0A, $03
smpsVcDecayRate2 $02, $02, $02, $02
smpsVcDecayLevel $07, $0A, $07, $0A
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $00, $28, $00, $1E
; Voice $02
; $3A
; $11, $15, $01, $11, $59, $59, $5C, $4E, $0A, $0B, $0D, $04
; $00, $00, $00, $00, $1F, $5F, $2F, $0F, $1A, $0E, $2E, $80
smpsVcAlgorithm $02
smpsVcFeedback $07
smpsVcUnusedBits $00
smpsVcDetune $01, $00, $01, $01
smpsVcCoarseFreq $01, $01, $05, $01
smpsVcRateScale $01, $01, $01, $01
smpsVcAttackRate $0E, $1C, $19, $19
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $04, $0D, $0B, $0A
smpsVcDecayRate2 $00, $00, $00, $00
smpsVcDecayLevel $00, $02, $05, $01
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $00, $2E, $0E, $1A
; Voice $03
; $06
; $01, $33, $72, $31, $0A, $8C, $4C, $52, $00, $00, $00, $00
; $01, $00, $01, $00, $0F, $0F, $2F, $0F, $4D, $87, $80, $91
smpsVcAlgorithm $06
smpsVcFeedback $00
smpsVcUnusedBits $00
smpsVcDetune $03, $07, $03, $00
smpsVcCoarseFreq $01, $02, $03, $01
smpsVcRateScale $01, $01, $02, $00
smpsVcAttackRate $12, $0C, $0C, $0A
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $00, $00, $00, $00
smpsVcDecayRate2 $00, $01, $00, $01
smpsVcDecayLevel $00, $02, $00, $00
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $11, $00, $07, $4D
; Voice $04
; $3A
; $01, $02, $01, $01, $10, $0E, $14, $10, $0C, $0E, $0E, $0E
; $00, $00, $00, $00, $0F, $FF, $7F, $1F, $1C, $28, $31, $80
smpsVcAlgorithm $02
smpsVcFeedback $07
smpsVcUnusedBits $00
smpsVcDetune $00, $00, $00, $00
smpsVcCoarseFreq $01, $01, $02, $01
smpsVcRateScale $00, $00, $00, $00
smpsVcAttackRate $10, $14, $0E, $10
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $0E, $0E, $0E, $0C
smpsVcDecayRate2 $00, $00, $00, $00
smpsVcDecayLevel $01, $07, $0F, $00
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $00, $31, $28, $1C
; Voice $05
; $39
; $02, $01, $02, $01, $1F, $1F, $1F, $1F, $00, $00, $00, $00
; $00, $00, $00, $00, $0F, $0F, $0F, $0F, $1B, $32, $28, $80
smpsVcAlgorithm $01
smpsVcFeedback $07
smpsVcUnusedBits $00
smpsVcDetune $00, $00, $00, $00
smpsVcCoarseFreq $01, $02, $01, $02
smpsVcRateScale $00, $00, $00, $00
smpsVcAttackRate $1F, $1F, $1F, $1F
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $00, $00, $00, $00
smpsVcDecayRate2 $00, $00, $00, $00
smpsVcDecayLevel $00, $00, $00, $00
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $00, $28, $32, $1B
|
; A116525: a(0)=1, a(1)=1, a(n) = 11*a(n/2) for even n, and a(n) = 10*a((n-1)/2) + a((n+1)/2) for odd n >= 3.
; 0,1,11,21,121,131,231,331,1331,1341,1441,1541,2541,2641,3641,4641,14641,14651,14751,14851,15851,15951,16951,17951,27951,28051,29051,30051,40051,41051,51051,61051,161051,161061,161161,161261,162261,162361,163361,164361,174361,174461,175461,176461,186461,187461,197461,207461,307461,307561,308561,309561,319561,320561,330561,340561,440561,441561,451561,461561,561561,571561,671561,771561,1771561,1771571,1771671,1771771,1772771,1772871,1773871,1774871,1784871,1784971,1785971,1786971,1796971,1797971,1807971,1817971,1917971,1918071,1919071,1920071,1930071,1931071,1941071,1951071,2051071,2052071,2062071,2072071,2172071,2182071,2282071,2382071,3382071,3382171,3383171,3384171
mov $2,$0
mov $5,$0
lpb $2
mov $0,$5
sub $2,1
sub $0,$2
sub $0,1
mul $0,2
mov $3,$0
lpb $0
div $3,2
sub $0,$3
mov $4,10
lpe
pow $4,$0
add $1,$4
lpe
mov $0,$1
|
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/webui/settings/chromeos/internet_handler.h"
#include <memory>
#include <vector>
#include "ash/constants/ash_pref_names.h"
#include "base/bind.h"
#include "base/values.h"
#include "chrome/browser/apps/app_service/app_service_proxy.h"
#include "chrome/browser/apps/app_service/app_service_proxy_factory.h"
#include "chrome/browser/ash/profiles/profile_helper.h"
#include "chrome/browser/ash/tether/tether_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
#include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
#include "chromeos/network/network_connect.h"
#include "chromeos/network/network_event_log.h"
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
#include "components/arc/mojom/net.mojom.h"
#include "components/arc/session/arc_bridge_service.h"
#include "components/arc/session/arc_service_manager.h"
#include "components/onc/onc_constants.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "extensions/browser/api/vpn_provider/vpn_service.h"
#include "extensions/browser/api/vpn_provider/vpn_service_factory.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
#include "ui/events/event_constants.h"
namespace chromeos {
namespace {
const char kAddThirdPartyVpnMessage[] = "addThirdPartyVpn";
const char kConfigureThirdPartyVpnMessage[] = "configureThirdPartyVpn";
const char kShowCarrierAccountDetail[] = "showCarrierAccountDetail";
const char kShowCellularSetupUI[] = "showCellularSetupUI";
const char kRequestGmsCoreNotificationsDisabledDeviceNames[] =
"requestGmsCoreNotificationsDisabledDeviceNames";
const char kSendGmsCoreNotificationsDisabledDeviceNames[] =
"sendGmsCoreNotificationsDisabledDeviceNames";
Profile* GetProfileForPrimaryUser() {
return ProfileHelper::Get()->GetProfileByUser(
user_manager::UserManager::Get()->GetPrimaryUser());
}
bool IsVpnConfigAllowed() {
PrefService* prefs = GetProfileForPrimaryUser()->GetPrefs();
DCHECK(prefs);
return prefs->GetBoolean(prefs::kVpnConfigAllowed);
}
} // namespace
namespace settings {
InternetHandler::InternetHandler(Profile* profile) : profile_(profile) {
DCHECK(profile_);
auto* tether_service = tether::TetherService::Get(profile);
gms_core_notifications_state_tracker_ =
tether_service ? tether_service->GetGmsCoreNotificationsStateTracker()
: nullptr;
if (gms_core_notifications_state_tracker_)
gms_core_notifications_state_tracker_->AddObserver(this);
}
InternetHandler::~InternetHandler() {
if (gms_core_notifications_state_tracker_)
gms_core_notifications_state_tracker_->RemoveObserver(this);
}
void InternetHandler::RegisterMessages() {
web_ui()->RegisterDeprecatedMessageCallback(
kAddThirdPartyVpnMessage,
base::BindRepeating(&InternetHandler::AddThirdPartyVpn,
base::Unretained(this)));
web_ui()->RegisterDeprecatedMessageCallback(
kConfigureThirdPartyVpnMessage,
base::BindRepeating(&InternetHandler::ConfigureThirdPartyVpn,
base::Unretained(this)));
web_ui()->RegisterDeprecatedMessageCallback(
kRequestGmsCoreNotificationsDisabledDeviceNames,
base::BindRepeating(
&InternetHandler::RequestGmsCoreNotificationsDisabledDeviceNames,
base::Unretained(this)));
web_ui()->RegisterDeprecatedMessageCallback(
kShowCarrierAccountDetail,
base::BindRepeating(&InternetHandler::ShowCarrierAccountDetail,
base::Unretained(this)));
web_ui()->RegisterDeprecatedMessageCallback(
kShowCellularSetupUI,
base::BindRepeating(&InternetHandler::ShowCellularSetupUI,
base::Unretained(this)));
}
void InternetHandler::OnJavascriptAllowed() {}
void InternetHandler::OnJavascriptDisallowed() {}
void InternetHandler::OnGmsCoreNotificationStateChanged() {
SetGmsCoreNotificationsDisabledDeviceNames();
}
void InternetHandler::AddThirdPartyVpn(const base::ListValue* args) {
if (args->GetList().size() < 1 || !args->GetList()[0].is_string()) {
NOTREACHED() << "Invalid args for: " << kAddThirdPartyVpnMessage;
return;
}
const std::string& app_id = args->GetList()[0].GetString();
if (app_id.empty()) {
NET_LOG(ERROR) << "Empty app id for " << kAddThirdPartyVpnMessage;
return;
}
if (profile_ != GetProfileForPrimaryUser() || profile_->IsChild()) {
NET_LOG(ERROR)
<< "Only the primary user and non-child accounts can add VPNs";
return;
}
if (!IsVpnConfigAllowed()) {
NET_LOG(ERROR) << "Cannot add VPN; prohibited by policy";
return;
}
// Request to launch Arc VPN provider.
const auto* arc_app_list_prefs = ArcAppListPrefs::Get(profile_);
if (arc_app_list_prefs && arc_app_list_prefs->GetApp(app_id)) {
DCHECK(apps::AppServiceProxyFactory::IsAppServiceAvailableForProfile(
profile_));
apps::AppServiceProxyFactory::GetForProfile(profile_)->Launch(
app_id, ui::EF_NONE, apps::mojom::LaunchSource::kFromParentalControls);
return;
}
// Request that the third-party VPN provider identified by |provider_id|
// show its "add network" dialog.
VpnServiceFactory::GetForBrowserContext(GetProfileForPrimaryUser())
->SendShowAddDialogToExtension(app_id);
}
void InternetHandler::ConfigureThirdPartyVpn(const base::ListValue* args) {
if (args->GetList().size() < 1 || !args->GetList()[0].is_string()) {
NOTREACHED() << "Invalid args for: " << kConfigureThirdPartyVpnMessage;
return;
}
const std::string& guid = args->GetList()[0].GetString();
if (profile_ != GetProfileForPrimaryUser()) {
NET_LOG(ERROR) << "Only the primary user can configure VPNs";
return;
}
if (!IsVpnConfigAllowed()) {
NET_LOG(ERROR) << "Cannot configure VPN; prohibited by policy";
return;
}
const NetworkState* network =
NetworkHandler::Get()->network_state_handler()->GetNetworkStateFromGuid(
guid);
if (!network) {
NET_LOG(ERROR) << "ConfigureThirdPartyVpn: Network not found: " << guid;
return;
}
if (network->type() != shill::kTypeVPN) {
NET_LOG(ERROR) << "ConfigureThirdPartyVpn: Network is not a VPN: "
<< NetworkId(network);
return;
}
if (network->GetVpnProviderType() == shill::kProviderThirdPartyVpn) {
// Request that the third-party VPN provider used by the |network| show a
// configuration dialog for it.
VpnServiceFactory::GetForBrowserContext(profile_)
->SendShowConfigureDialogToExtension(network->vpn_provider()->id,
network->name());
return;
}
if (network->GetVpnProviderType() == shill::kProviderArcVpn) {
auto* net_instance = ARC_GET_INSTANCE_FOR_METHOD(
arc::ArcServiceManager::Get()->arc_bridge_service()->net(),
ConfigureAndroidVpn);
if (!net_instance) {
NET_LOG(ERROR) << "ConfigureThirdPartyVpn: API is unavailable";
return;
}
net_instance->ConfigureAndroidVpn();
return;
}
NET_LOG(ERROR) << "ConfigureThirdPartyVpn: Unsupported VPN type: "
<< network->GetVpnProviderType()
<< " For: " << NetworkId(network);
}
void InternetHandler::RequestGmsCoreNotificationsDisabledDeviceNames(
const base::ListValue* args) {
AllowJavascript();
SetGmsCoreNotificationsDisabledDeviceNames();
}
void InternetHandler::ShowCarrierAccountDetail(const base::ListValue* args) {
if (args->GetList().size() < 1 || !args->GetList()[0].is_string()) {
NOTREACHED() << "Invalid args for: " << kShowCarrierAccountDetail;
return;
}
const std::string& guid = args->GetList()[0].GetString();
chromeos::NetworkConnect::Get()->ShowCarrierAccountDetail(guid);
}
void InternetHandler::ShowCellularSetupUI(const base::ListValue* args) {
if (args->GetList().size() < 1 || !args->GetList()[0].is_string()) {
NOTREACHED() << "Invalid args for: " << kConfigureThirdPartyVpnMessage;
return;
}
const std::string& guid = args->GetList()[0].GetString();
chromeos::NetworkConnect::Get()->ShowMobileSetup(guid);
}
void InternetHandler::SetGmsCoreNotificationsDisabledDeviceNames() {
if (!gms_core_notifications_state_tracker_) {
// No device names should be present in the list if
// |gms_core_notifications_state_tracker_| is null.
DCHECK(device_names_without_notifications_.empty());
return;
}
device_names_without_notifications_.clear();
const std::vector<std::string> device_names =
gms_core_notifications_state_tracker_
->GetGmsCoreNotificationsDisabledDeviceNames();
for (const auto& device_name : device_names) {
device_names_without_notifications_.emplace_back(
std::make_unique<base::Value>(device_name));
}
SendGmsCoreNotificationsDisabledDeviceNames();
}
void InternetHandler::SendGmsCoreNotificationsDisabledDeviceNames() {
if (!IsJavascriptAllowed())
return;
base::ListValue device_names_value;
for (const auto& device_name : device_names_without_notifications_)
device_names_value.Append(device_name->Clone());
FireWebUIListener(kSendGmsCoreNotificationsDisabledDeviceNames,
device_names_value);
}
gfx::NativeWindow InternetHandler::GetNativeWindow() {
return web_ui()->GetWebContents()->GetTopLevelNativeWindow();
}
void InternetHandler::SetGmsCoreNotificationsStateTrackerForTesting(
chromeos::tether::GmsCoreNotificationsStateTracker*
gms_core_notifications_state_tracker) {
if (gms_core_notifications_state_tracker_)
gms_core_notifications_state_tracker_->RemoveObserver(this);
gms_core_notifications_state_tracker_ = gms_core_notifications_state_tracker;
gms_core_notifications_state_tracker_->AddObserver(this);
}
} // namespace settings
} // namespace chromeos
|
* Sprite f4
*
* Mode 4
* +|-------+
* -ggg g -
* |g g g |
* |g g g |
* |gg gggg|
* |g g |
* |g g |
* |g g |
* +|-------+
*
section sprite
xdef sp_f4
xref sp_zero
sp_f4
dc.w $0100,$0000
dc.w 8,7,0,0
dc.l sc4_f4-*
dc.l sp_zero-*
dc.l 0
sc4_f4
dc.w $E800,$0000
dc.w $8A00,$0000
dc.w $8A00,$0000
dc.w $CF00,$0000
dc.w $8200,$0000
dc.w $8200,$0000
dc.w $8200,$0000
*
end
|
/*
* Copyright (c) 2020, Sergey Bugaev <bugaevc@serenityos.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <Kernel/FileSystem/Plan9FileSystem.h>
#include <Kernel/Process.h>
namespace Kernel {
NonnullRefPtr<Plan9FS> Plan9FS::create(FileDescription& file_description)
{
return adopt(*new Plan9FS(file_description));
}
Plan9FS::Plan9FS(FileDescription& file_description)
: FileBackedFS(file_description)
, m_completion_blocker(*this)
{
}
Plan9FS::~Plan9FS()
{
// Make sure to destroy the root inode before the FS gets destroyed.
if (m_root_inode) {
ASSERT(m_root_inode->ref_count() == 1);
m_root_inode = nullptr;
}
}
class Plan9FS::Message {
public:
enum class Type : u8 {
// 9P2000.L
Tlerror = 6,
Rlerror = 7,
Tstatfs = 8,
Rstatfs = 9,
Tlopen = 12,
Rlopen = 13,
Tlcreate = 14,
Rlcreate = 15,
Tsymlink = 16,
Rsymlink = 17,
Tmknod = 18,
Rmknod = 19,
Trename = 20,
Rrename = 21,
Treadlink = 22,
Rreadlink = 23,
Tgetattr = 24,
Rgetattr = 25,
Tsetattr = 26,
Rsetattr = 27,
Txattrwalk = 30,
Rxattrwalk = 31,
Txattrcreate = 32,
Rxattrcreate = 33,
Treaddir = 40,
Rreaddir = 41,
Tfsync = 50,
Rfsync = 51,
Tlock = 52,
Rlock = 53,
Tgetlock = 54,
Rgetlock = 55,
Tlink = 70,
Rlink = 71,
Tmkdir = 72,
Rmkdir = 73,
Trenameat = 74,
Rrenameat = 75,
Tunlinkat = 76,
Runlinkat = 77,
// 9P2000
Tversion = 100,
Rversion = 101,
Tauth = 102,
Rauth = 103,
Tattach = 104,
Rattach = 105,
Terror = 106,
Rerror = 107,
Tflush = 108,
Rflush = 109,
Twalk = 110,
Rwalk = 111,
Topen = 112,
Ropen = 113,
Tcreate = 114,
Rcreate = 115,
Tread = 116,
Rread = 117,
Twrite = 118,
Rwrite = 119,
Tclunk = 120,
Rclunk = 121,
Tremove = 122,
Rremove = 123,
Tstat = 124,
Rstat = 125,
Twstat = 126,
Rwstat = 127
};
class Decoder {
public:
explicit Decoder(const StringView& data)
: m_data(data)
{
}
Decoder& operator>>(u8&);
Decoder& operator>>(u16&);
Decoder& operator>>(u32&);
Decoder& operator>>(u64&);
Decoder& operator>>(StringView&);
Decoder& operator>>(qid&);
StringView read_data();
bool has_more_data() const { return !m_data.is_empty(); }
private:
StringView m_data;
template<typename N>
Decoder& read_number(N& number)
{
ASSERT(sizeof(number) <= m_data.length());
memcpy(&number, m_data.characters_without_null_termination(), sizeof(number));
m_data = m_data.substring_view(sizeof(number), m_data.length() - sizeof(number));
return *this;
}
};
Message& operator<<(u8);
Message& operator<<(u16);
Message& operator<<(u32);
Message& operator<<(u64);
Message& operator<<(const StringView&);
void append_data(const StringView&);
template<typename T>
Message& operator>>(T& t)
{
ASSERT(m_have_been_built);
m_built.decoder >> t;
return *this;
}
StringView read_data()
{
ASSERT(m_have_been_built);
return m_built.decoder.read_data();
}
Type type() const { return m_type; }
u16 tag() const { return m_tag; }
Message(Plan9FS&, Type);
Message(NonnullOwnPtr<KBuffer>&&);
~Message();
Message& operator=(Message&&);
const KBuffer& build();
static constexpr ssize_t max_header_size = 24;
private:
template<typename N>
Message& append_number(N number)
{
ASSERT(!m_have_been_built);
m_builder.append(reinterpret_cast<const char*>(&number), sizeof(number));
return *this;
}
union {
KBufferBuilder m_builder;
struct {
NonnullOwnPtr<KBuffer> buffer;
Decoder decoder;
} m_built;
};
u16 m_tag { 0 };
Type m_type { 0 };
bool m_have_been_built { false };
};
bool Plan9FS::initialize()
{
ensure_thread();
Message version_message { *this, Message::Type::Tversion };
version_message << (u32)m_max_message_size << "9P2000.L";
auto result = post_message_and_wait_for_a_reply(version_message);
if (result.is_error())
return false;
u32 msize;
StringView remote_protocol_version;
version_message >> msize >> remote_protocol_version;
dbg() << "Remote supports msize=" << msize << " and protocol version " << remote_protocol_version;
m_remote_protocol_version = parse_protocol_version(remote_protocol_version);
m_max_message_size = min(m_max_message_size, (size_t)msize);
// TODO: auth
u32 root_fid = allocate_fid();
Message attach_message { *this, Message::Type::Tattach };
// FIXME: This needs a user name and an "export" name; but how do we get them?
// Perhaps initialize() should accept a string of FS-specific options...
attach_message << root_fid << (u32)-1 << "sergey"
<< "/";
if (m_remote_protocol_version >= ProtocolVersion::v9P2000u)
attach_message << (u32)-1;
result = post_message_and_wait_for_a_reply(attach_message);
if (result.is_error()) {
dbg() << "Attaching failed";
return false;
}
m_root_inode = Plan9FSInode::create(*this, root_fid);
return true;
}
Plan9FS::ProtocolVersion Plan9FS::parse_protocol_version(const StringView& s) const
{
if (s == "9P2000.L")
return ProtocolVersion::v9P2000L;
if (s == "9P2000.u")
return ProtocolVersion::v9P2000u;
return ProtocolVersion::v9P2000;
}
NonnullRefPtr<Inode> Plan9FS::root_inode() const
{
return *m_root_inode;
}
Plan9FS::Message& Plan9FS::Message::operator<<(u8 number)
{
return append_number(number);
}
Plan9FS::Message& Plan9FS::Message::operator<<(u16 number)
{
return append_number(number);
}
Plan9FS::Message& Plan9FS::Message::operator<<(u32 number)
{
return append_number(number);
}
Plan9FS::Message& Plan9FS::Message::operator<<(u64 number)
{
return append_number(number);
}
Plan9FS::Message& Plan9FS::Message::operator<<(const StringView& string)
{
*this << static_cast<u16>(string.length());
m_builder.append(string);
return *this;
}
void Plan9FS::Message::append_data(const StringView& data)
{
*this << static_cast<u32>(data.length());
m_builder.append(data);
}
Plan9FS::Message::Decoder& Plan9FS::Message::Decoder::operator>>(u8& number)
{
return read_number(number);
}
Plan9FS::Message::Decoder& Plan9FS::Message::Decoder::operator>>(u16& number)
{
return read_number(number);
}
Plan9FS::Message::Decoder& Plan9FS::Message::Decoder::operator>>(u32& number)
{
return read_number(number);
}
Plan9FS::Message::Decoder& Plan9FS::Message::Decoder::operator>>(u64& number)
{
return read_number(number);
}
Plan9FS::Message::Decoder& Plan9FS::Message::Decoder::operator>>(qid& qid)
{
return *this >> qid.type >> qid.version >> qid.path;
}
Plan9FS::Message::Decoder& Plan9FS::Message::Decoder::operator>>(StringView& string)
{
u16 length;
*this >> length;
ASSERT(length <= m_data.length());
string = m_data.substring_view(0, length);
m_data = m_data.substring_view_starting_after_substring(string);
return *this;
}
StringView Plan9FS::Message::Decoder::read_data()
{
u32 length;
*this >> length;
ASSERT(length <= m_data.length());
auto data = m_data.substring_view(0, length);
m_data = m_data.substring_view_starting_after_substring(data);
return data;
}
Plan9FS::Message::Message(Plan9FS& fs, Type type)
: m_builder()
, m_tag(fs.allocate_tag())
, m_type(type)
, m_have_been_built(false)
{
u32 size_placeholder = 0;
*this << size_placeholder << (u8)type << m_tag;
}
Plan9FS::Message::Message(NonnullOwnPtr<KBuffer>&& buffer)
: m_built { move(buffer), Decoder({ buffer->data(), buffer->size() }) }
, m_have_been_built(true)
{
u32 size;
u8 raw_type;
*this >> size >> raw_type >> m_tag;
m_type = (Type)raw_type;
}
Plan9FS::Message::~Message()
{
if (m_have_been_built) {
m_built.buffer.~NonnullOwnPtr<KBuffer>();
m_built.decoder.~Decoder();
} else {
m_builder.~KBufferBuilder();
}
}
Plan9FS::Message& Plan9FS::Message::operator=(Message&& message)
{
m_tag = message.m_tag;
m_type = message.m_type;
if (m_have_been_built) {
m_built.buffer.~NonnullOwnPtr<KBuffer>();
m_built.decoder.~Decoder();
} else {
m_builder.~KBufferBuilder();
}
m_have_been_built = message.m_have_been_built;
if (m_have_been_built) {
new (&m_built.buffer) NonnullOwnPtr<KBuffer>(move(message.m_built.buffer));
new (&m_built.decoder) Decoder(move(message.m_built.decoder));
} else {
new (&m_builder) KBufferBuilder(move(message.m_builder));
}
return *this;
}
const KBuffer& Plan9FS::Message::build()
{
ASSERT(!m_have_been_built);
auto tmp_buffer = m_builder.build();
// FIXME: We should not assume success here.
ASSERT(tmp_buffer);
m_have_been_built = true;
m_builder.~KBufferBuilder();
new (&m_built.buffer) NonnullOwnPtr<KBuffer>(tmp_buffer.release_nonnull());
new (&m_built.decoder) Decoder({ m_built.buffer->data(), m_built.buffer->size() });
u32* size = reinterpret_cast<u32*>(m_built.buffer->data());
*size = m_built.buffer->size();
return *m_built.buffer;
}
Plan9FS::ReceiveCompletion::ReceiveCompletion(u16 tag)
: tag(tag)
{
}
Plan9FS::ReceiveCompletion::~ReceiveCompletion()
{
}
bool Plan9FS::Blocker::unblock(u16 tag)
{
{
ScopedSpinLock lock(m_lock);
if (m_did_unblock)
return false;
m_did_unblock = true;
if (m_completion->tag != tag)
return false;
if (!m_completion->result.is_error())
m_message = move(*m_completion->message);
}
return unblock();
}
void Plan9FS::Blocker::not_blocking(bool)
{
{
ScopedSpinLock lock(m_lock);
if (m_did_unblock)
return;
}
m_fs.m_completion_blocker.try_unblock(*this);
}
bool Plan9FS::Blocker::is_completed() const
{
ScopedSpinLock lock(m_completion->lock);
return m_completion->completed;
}
bool Plan9FS::Plan9FSBlockCondition::should_add_blocker(Thread::Blocker& b, void*)
{
// NOTE: m_lock is held already!
auto& blocker = static_cast<Blocker&>(b);
return !blocker.is_completed();
}
void Plan9FS::Plan9FSBlockCondition::unblock_completed(u16 tag)
{
unblock([&](Thread::Blocker& b, void*, bool&) {
ASSERT(b.blocker_type() == Thread::Blocker::Type::Plan9FS);
auto& blocker = static_cast<Blocker&>(b);
return blocker.unblock(tag);
});
}
void Plan9FS::Plan9FSBlockCondition::unblock_all()
{
unblock([&](Thread::Blocker& b, void*, bool&) {
ASSERT(b.blocker_type() == Thread::Blocker::Type::Plan9FS);
auto& blocker = static_cast<Blocker&>(b);
return blocker.unblock();
});
}
void Plan9FS::Plan9FSBlockCondition::try_unblock(Plan9FS::Blocker& blocker)
{
if (m_fs.is_complete(*blocker.completion())) {
ScopedSpinLock lock(m_lock);
blocker.unblock(blocker.completion()->tag);
}
}
bool Plan9FS::is_complete(const ReceiveCompletion& completion)
{
LOCKER(m_lock);
if (m_completions.contains(completion.tag)) {
// If it's still in the map then it can't be complete
ASSERT(!completion.completed);
return false;
}
// if it's not in the map anymore, it must be complete. But we MUST
// hold m_lock to be able to check completion.completed!
ASSERT(completion.completed);
return true;
}
KResult Plan9FS::post_message(Message& message, RefPtr<ReceiveCompletion> completion)
{
auto& buffer = message.build();
const u8* data = buffer.data();
size_t size = buffer.size();
auto& description = file_description();
LOCKER(m_send_lock);
if (completion) {
// Save the completion record *before* we send the message. This
// ensures that it exists when the thread reads the response
LOCKER(m_lock);
auto tag = completion->tag;
m_completions.set(tag, completion.release_nonnull());
// TODO: What if there is a collision? Do we need to wait until
// the existing record with the tag completes before queueing
// this one?
}
while (size > 0) {
if (!description.can_write()) {
auto unblock_flags = Thread::FileBlocker::BlockFlags::None;
if (Thread::current()->block<Thread::WriteBlocker>(nullptr, description, unblock_flags).was_interrupted())
return KResult(-EINTR);
}
auto data_buffer = UserOrKernelBuffer::for_kernel_buffer(const_cast<u8*>(data));
auto nwritten_or_error = description.write(data_buffer, size);
if (nwritten_or_error.is_error())
return nwritten_or_error.error();
auto nwritten = nwritten_or_error.value();
data += nwritten;
size -= nwritten;
}
return KSuccess;
}
KResult Plan9FS::do_read(u8* data, size_t size)
{
auto& description = file_description();
while (size > 0) {
if (!description.can_read()) {
auto unblock_flags = Thread::FileBlocker::BlockFlags::None;
if (Thread::current()->block<Thread::ReadBlocker>(nullptr, description, unblock_flags).was_interrupted())
return KResult(-EINTR);
}
auto data_buffer = UserOrKernelBuffer::for_kernel_buffer(data);
auto nread_or_error = description.read(data_buffer, size);
if (nread_or_error.is_error())
return nread_or_error.error();
auto nread = nread_or_error.value();
if (nread == 0)
return KResult(-EIO);
data += nread;
size -= nread;
}
return KSuccess;
}
KResult Plan9FS::read_and_dispatch_one_message()
{
struct [[gnu::packed]] Header {
u32 size;
u8 type;
u16 tag;
};
Header header;
KResult result = do_read(reinterpret_cast<u8*>(&header), sizeof(header));
if (result.is_error())
return result;
auto buffer = KBuffer::try_create_with_size(header.size, Region::Access::Read | Region::Access::Write);
if (!buffer)
return KResult(-ENOMEM);
// Copy the already read header into the buffer.
memcpy(buffer->data(), &header, sizeof(header));
result = do_read(buffer->data() + sizeof(header), header.size - sizeof(header));
if (result.is_error())
return result;
LOCKER(m_lock);
auto optional_completion = m_completions.get(header.tag);
if (optional_completion.has_value()) {
auto completion = optional_completion.value();
ScopedSpinLock lock(completion->lock);
completion->result = KSuccess;
completion->message = new Message { buffer.release_nonnull() };
completion->completed = true;
m_completions.remove(header.tag);
m_completion_blocker.unblock_completed(header.tag);
} else {
dbg() << "Received a 9p message of type " << header.type << " with an unexpected tag " << header.tag << ", dropping";
}
return KSuccess;
}
KResult Plan9FS::post_message_and_explicitly_ignore_reply(Message& message)
{
return post_message(message, {});
}
KResult Plan9FS::post_message_and_wait_for_a_reply(Message& message)
{
auto request_type = message.type();
auto tag = message.tag();
auto completion = adopt(*new ReceiveCompletion(tag));
auto result = post_message(message, completion);
if (result.is_error())
return result;
if (Thread::current()->block<Plan9FS::Blocker>(nullptr, *this, message, completion).was_interrupted())
return KResult(-EINTR);
if (completion->result.is_error()) {
dbg() << "Plan9FS: Message was aborted with error " << completion->result;
return KResult(-EIO);
}
auto reply_type = message.type();
if (reply_type == Message::Type::Rlerror) {
// Contains a numerical Linux errno; hopefully our errno numbers match.
u32 error_code;
message >> error_code;
return KResult(-error_code);
} else if (reply_type == Message::Type::Rerror) {
// Contains an error message. We could attempt to parse it, but for now
// we simply return -EIO instead. In 9P200.u, it can also contain a
// numerical errno in an unspecified encoding; we ignore those too.
StringView error_name;
message >> error_name;
dbg() << "Plan9FS: Received error name " << error_name;
return KResult(-EIO);
} else if ((u8)reply_type != (u8)request_type + 1) {
// Other than those error messages. we only expect the matching reply
// message type.
dbg() << "Plan9FS: Received unexpected message type " << (u8)reply_type
<< " in response to " << (u8)request_type;
return KResult(-EIO);
} else {
return KSuccess;
}
}
ssize_t Plan9FS::adjust_buffer_size(ssize_t size) const
{
ssize_t max_size = m_max_message_size - Message::max_header_size;
return min(size, max_size);
}
void Plan9FS::thread_main()
{
dbg() << "Plan9FS: Thread running";
do {
auto result = read_and_dispatch_one_message();
if (result.is_error()) {
// If we fail to read, wake up everyone with an error.
LOCKER(m_lock);
for (auto& it : m_completions) {
it.value->result = result;
it.value->completed = true;
}
m_completions.clear();
m_completion_blocker.unblock_all();
dbg() << "Plan9FS: Thread terminating, error reading";
return;
}
} while (!m_thread_shutdown);
dbg() << "Plan9FS: Thread terminating";
}
void Plan9FS::ensure_thread()
{
ScopedSpinLock lock(m_thread_lock);
if (!m_thread_running.exchange(true, AK::MemoryOrder::memory_order_acq_rel)) {
Process::create_kernel_process(m_thread, "Plan9FS", [&]() {
thread_main();
m_thread_running.store(false, AK::MemoryOrder::memory_order_release);
});
}
}
Plan9FSInode::Plan9FSInode(Plan9FS& fs, u32 fid)
: Inode(fs, fid)
{
}
NonnullRefPtr<Plan9FSInode> Plan9FSInode::create(Plan9FS& fs, u32 fid)
{
return adopt(*new Plan9FSInode(fs, fid));
}
Plan9FSInode::~Plan9FSInode()
{
Plan9FS::Message clunk_request { fs(), Plan9FS::Message::Type::Tclunk };
clunk_request << fid();
// FIXME: Should we observe this error somehow?
[[maybe_unused]] auto rc = fs().post_message_and_explicitly_ignore_reply(clunk_request);
}
KResult Plan9FSInode::ensure_open_for_mode(int mode)
{
bool use_lopen = fs().m_remote_protocol_version >= Plan9FS::ProtocolVersion::v9P2000L;
u32 l_mode = 0;
u8 p9_mode = 0;
{
LOCKER(m_lock);
// If it's already open in this mode, we're done.
if ((m_open_mode & mode) == mode)
return KSuccess;
m_open_mode |= mode;
if ((m_open_mode & O_RDWR) == O_RDWR) {
l_mode |= 2;
p9_mode |= 2;
} else if (m_open_mode & O_WRONLY) {
l_mode |= 1;
p9_mode |= 1;
} else if (m_open_mode & O_RDONLY) {
// Leave the values at 0.
}
}
if (use_lopen) {
Plan9FS::Message message { fs(), Plan9FS::Message::Type::Tlopen };
message << fid() << l_mode;
return fs().post_message_and_wait_for_a_reply(message);
} else {
Plan9FS::Message message { fs(), Plan9FS::Message::Type::Topen };
message << fid() << p9_mode;
return fs().post_message_and_wait_for_a_reply(message);
}
}
ssize_t Plan9FSInode::read_bytes(off_t offset, ssize_t size, UserOrKernelBuffer& buffer, FileDescription*) const
{
auto result = const_cast<Plan9FSInode&>(*this).ensure_open_for_mode(O_RDONLY);
if (result.is_error())
return result;
size = fs().adjust_buffer_size(size);
Plan9FS::Message message { fs(), Plan9FS::Message::Type::Treadlink };
StringView data;
// Try readlink first.
bool readlink_succeded = false;
if (fs().m_remote_protocol_version >= Plan9FS::ProtocolVersion::v9P2000L && offset == 0) {
message << fid();
result = fs().post_message_and_wait_for_a_reply(message);
if (result.is_success()) {
readlink_succeded = true;
message >> data;
}
}
if (!readlink_succeded) {
message = Plan9FS::Message { fs(), Plan9FS::Message::Type::Tread };
message << fid() << (u64)offset << (u32)size;
result = fs().post_message_and_wait_for_a_reply(message);
if (result.is_error())
return result.error();
data = message.read_data();
}
// Guard against the server returning more data than requested.
size_t nread = min(data.length(), (size_t)size);
if (!buffer.write(data.characters_without_null_termination(), nread))
return -EFAULT;
return nread;
}
ssize_t Plan9FSInode::write_bytes(off_t offset, ssize_t size, const UserOrKernelBuffer& data, FileDescription*)
{
auto result = ensure_open_for_mode(O_WRONLY);
if (result.is_error())
return result;
size = fs().adjust_buffer_size(size);
auto data_copy = data.copy_into_string(size); // FIXME: this seems ugly
if (data_copy.is_null())
return -EFAULT;
Plan9FS::Message message { fs(), Plan9FS::Message::Type::Twrite };
message << fid() << (u64)offset;
message.append_data(data_copy);
result = fs().post_message_and_wait_for_a_reply(message);
if (result.is_error())
return result.error();
u32 nwritten;
message >> nwritten;
return nwritten;
}
InodeMetadata Plan9FSInode::metadata() const
{
InodeMetadata metadata;
metadata.inode = identifier();
// 9P2000.L; TODO: 9P2000 & 9P2000.u
Plan9FS::Message message { fs(), Plan9FS::Message::Type::Tgetattr };
message << fid() << (u64)GetAttrMask::Basic;
auto result = fs().post_message_and_wait_for_a_reply(message);
if (result.is_error()) {
// Just return blank metadata; hopefully that's enough to result in an
// error at some upper layer. Ideally, there would be a way for
// Inode::metadata() to return failure.
return metadata;
}
u64 valid;
Plan9FS::qid qid;
u32 mode;
u32 uid;
u32 gid;
u64 nlink;
u64 rdev;
u64 size;
u64 blksize;
u64 blocks;
message >> valid >> qid >> mode >> uid >> gid >> nlink >> rdev >> size >> blksize >> blocks;
// TODO: times...
if (valid & (u64)GetAttrMask::Mode)
metadata.mode = mode;
if (valid & (u64)GetAttrMask::NLink)
metadata.link_count = nlink;
#if 0
// FIXME: Map UID/GID somehow? Or what do we do?
if (valid & (u64)GetAttrMask::UID)
metadata.uid = uid;
if (valid & (u64)GetAttrMask::GID)
metadata.uid = gid;
// FIXME: What about device nodes?
if (valid & (u64)GetAttrMask::RDev)
metadata.encoded_device = 0; // TODO
#endif
if (valid & (u64)GetAttrMask::Size)
metadata.size = size;
if (valid & (u64)GetAttrMask::Blocks) {
metadata.block_size = blksize;
metadata.block_count = blocks;
}
return metadata;
}
void Plan9FSInode::flush_metadata()
{
// Do nothing.
}
KResultOr<size_t> Plan9FSInode::directory_entry_count() const
{
size_t count = 0;
KResult result = traverse_as_directory([&count](auto&) {
count++;
return true;
});
if (result.is_error())
return result;
return count;
}
KResult Plan9FSInode::traverse_as_directory(Function<bool(const FS::DirectoryEntryView&)> callback) const
{
KResult result = KSuccess;
// TODO: Should we synthesize "." and ".." here?
if (fs().m_remote_protocol_version >= Plan9FS::ProtocolVersion::v9P2000L) {
// Start by cloning the fid and opening it.
auto clone_fid = fs().allocate_fid();
{
Plan9FS::Message clone_message { fs(), Plan9FS::Message::Type::Twalk };
clone_message << fid() << clone_fid << (u16)0;
result = fs().post_message_and_wait_for_a_reply(clone_message);
if (result.is_error())
return result;
Plan9FS::Message open_message { fs(), Plan9FS::Message::Type::Tlopen };
open_message << clone_fid << (u32)0;
result = fs().post_message_and_wait_for_a_reply(open_message);
if (result.is_error()) {
Plan9FS::Message close_message { fs(), Plan9FS::Message::Type::Tclunk };
close_message << clone_fid;
// FIXME: Should we observe this error?
[[maybe_unused]] auto rc = fs().post_message_and_explicitly_ignore_reply(close_message);
return result;
}
}
u64 offset = 0;
u32 count = fs().adjust_buffer_size(8 * MiB);
while (true) {
Plan9FS::Message message { fs(), Plan9FS::Message::Type::Treaddir };
message << clone_fid << offset << count;
result = fs().post_message_and_wait_for_a_reply(message);
if (result.is_error())
break;
StringView data = message.read_data();
if (data.is_empty()) {
// We've reached the end.
break;
}
for (Plan9FS::Message::Decoder decoder { data }; decoder.has_more_data();) {
Plan9FS::qid qid;
u8 type;
StringView name;
decoder >> qid >> offset >> type >> name;
callback({ name, { fsid(), fs().allocate_fid() }, 0 });
}
}
Plan9FS::Message close_message { fs(), Plan9FS::Message::Type::Tclunk };
close_message << clone_fid;
// FIXME: Should we observe this error?
[[maybe_unused]] auto rc = fs().post_message_and_explicitly_ignore_reply(close_message);
return result;
} else {
// TODO
return KResult(-ENOTIMPL);
}
}
RefPtr<Inode> Plan9FSInode::lookup(StringView name)
{
u32 newfid = fs().allocate_fid();
Plan9FS::Message message { fs(), Plan9FS::Message::Type::Twalk };
message << fid() << newfid << (u16)1 << name;
auto result = fs().post_message_and_wait_for_a_reply(message);
if (result.is_error())
return nullptr;
return Plan9FSInode::create(fs(), newfid);
}
KResultOr<NonnullRefPtr<Inode>> Plan9FSInode::create_child(const String&, mode_t, dev_t, uid_t, gid_t)
{
// TODO
return KResult(-ENOTIMPL);
}
KResult Plan9FSInode::add_child(Inode&, const StringView&, mode_t)
{
// TODO
return KResult(-ENOTIMPL);
}
KResult Plan9FSInode::remove_child(const StringView&)
{
// TODO
return KResult(-ENOTIMPL);
}
KResult Plan9FSInode::chmod(mode_t)
{
// TODO
return KResult(-ENOTIMPL);
}
KResult Plan9FSInode::chown(uid_t, gid_t)
{
// TODO
return KResult(-ENOTIMPL);
}
KResult Plan9FSInode::truncate(u64 new_size)
{
if (fs().m_remote_protocol_version >= Plan9FS::ProtocolVersion::v9P2000L) {
Plan9FS::Message message { fs(), Plan9FS::Message::Type::Tsetattr };
SetAttrMask valid = SetAttrMask::Size;
u32 mode = 0;
u32 uid = 0;
u32 gid = 0;
u64 atime_sec = 0;
u64 atime_nsec = 0;
u64 mtime_sec = 0;
u64 mtime_nsec = 0;
message << fid() << (u64)valid << mode << uid << gid << new_size << atime_sec << atime_nsec << mtime_sec << mtime_nsec;
return fs().post_message_and_wait_for_a_reply(message);
} else {
// TODO: wstat version
return KSuccess;
}
}
}
|
//--------------------------------------------------------------------------
// Code generated by the SmartSoft MDSD Toolchain
// The SmartSoft Toolchain has been developed by:
//
// Service Robotics Research Center
// University of Applied Sciences Ulm
// Prittwitzstr. 10
// 89075 Ulm (Germany)
//
// Information about the SmartSoft MDSD Toolchain is available at:
// www.servicerobotik-ulm.de
//
// Please do not modify this file. It will be re-generated
// running the code generator.
//--------------------------------------------------------------------------
#ifndef COMMNAVIGATIONOBJECTS_COMMPLANNEREVENTPARAMETER_DATA_H_
#define COMMNAVIGATIONOBJECTS_COMMPLANNEREVENTPARAMETER_DATA_H_
#include "CommNavigationObjects/enumPlannerEventTypeData.hh"
namespace CommNavigationObjectsIDL
{
struct CommPlannerEventParameter
{
CommNavigationObjectsIDL::PlannerEventType oldState;
};
};
#endif /* COMMNAVIGATIONOBJECTS_COMMPLANNEREVENTPARAMETER_DATA_H_ */
|
//===- AArch64RegisterInfo.cpp - AArch64 Register Information -------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file contains the AArch64 implementation of the TargetRegisterInfo
// class.
//
//===----------------------------------------------------------------------===//
#include "AArch64RegisterInfo.h"
#include "AArch64FrameLowering.h"
#include "AArch64InstrInfo.h"
#include "AArch64MachineFunctionInfo.h"
#include "AArch64Subtarget.h"
#include "MCTargetDesc/AArch64AddressingModes.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/Triple.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/RegisterScavenging.h"
#include "llvm/CodeGen/TargetFrameLowering.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/Function.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetOptions.h"
using namespace llvm;
#define GET_REGINFO_TARGET_DESC
#include "AArch64GenRegisterInfo.inc"
AArch64RegisterInfo::AArch64RegisterInfo(const Triple &TT)
: AArch64GenRegisterInfo(AArch64::LR), TT(TT) {
AArch64_MC::initLLVMToCVRegMapping(this);
}
/// Return whether the register needs a CFI entry. Not all unwinders may know
/// about SVE registers, so we assume the lowest common denominator, i.e. the
/// callee-saves required by the base ABI. For the SVE registers z8-z15 only the
/// lower 64-bits (d8-d15) need to be saved. The lower 64-bits subreg is
/// returned in \p RegToUseForCFI.
bool AArch64RegisterInfo::regNeedsCFI(unsigned Reg,
unsigned &RegToUseForCFI) const {
if (AArch64::PPRRegClass.contains(Reg))
return false;
if (AArch64::ZPRRegClass.contains(Reg)) {
RegToUseForCFI = getSubReg(Reg, AArch64::dsub);
for (int I = 0; CSR_AArch64_AAPCS_SaveList[I]; ++I) {
if (CSR_AArch64_AAPCS_SaveList[I] == RegToUseForCFI)
return true;
}
return false;
}
RegToUseForCFI = Reg;
return true;
}
bool AArch64RegisterInfo::hasSVEArgsOrReturn(const MachineFunction *MF) {
const Function &F = MF->getFunction();
return isa<ScalableVectorType>(F.getReturnType()) ||
any_of(F.args(), [](const Argument &Arg) {
return isa<ScalableVectorType>(Arg.getType());
});
}
const MCPhysReg *
AArch64RegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
assert(MF && "Invalid MachineFunction pointer.");
if (MF->getFunction().getCallingConv() == CallingConv::GHC)
// GHC set of callee saved regs is empty as all those regs are
// used for passing STG regs around
return CSR_AArch64_NoRegs_SaveList;
if (MF->getFunction().getCallingConv() == CallingConv::AnyReg)
return CSR_AArch64_AllRegs_SaveList;
// Darwin has its own CSR_AArch64_AAPCS_SaveList, which means most CSR save
// lists depending on that will need to have their Darwin variant as well.
if (MF->getSubtarget<AArch64Subtarget>().isTargetDarwin())
return getDarwinCalleeSavedRegs(MF);
if (MF->getFunction().getCallingConv() == CallingConv::CFGuard_Check)
return CSR_Win_AArch64_CFGuard_Check_SaveList;
if (MF->getSubtarget<AArch64Subtarget>().isTargetWindows())
return CSR_Win_AArch64_AAPCS_SaveList;
if (MF->getFunction().getCallingConv() == CallingConv::AArch64_VectorCall)
return CSR_AArch64_AAVPCS_SaveList;
if (MF->getFunction().getCallingConv() == CallingConv::AArch64_SVE_VectorCall)
return CSR_AArch64_SVE_AAPCS_SaveList;
if (MF->getSubtarget<AArch64Subtarget>().getTargetLowering()
->supportSwiftError() &&
MF->getFunction().getAttributes().hasAttrSomewhere(
Attribute::SwiftError))
return CSR_AArch64_AAPCS_SwiftError_SaveList;
if (MF->getFunction().getCallingConv() == CallingConv::SwiftTail)
return CSR_AArch64_AAPCS_SwiftTail_SaveList;
if (MF->getFunction().getCallingConv() == CallingConv::PreserveMost)
return CSR_AArch64_RT_MostRegs_SaveList;
if (MF->getFunction().getCallingConv() == CallingConv::Win64)
// This is for OSes other than Windows; Windows is a separate case further
// above.
return CSR_AArch64_AAPCS_X18_SaveList;
if (hasSVEArgsOrReturn(MF))
return CSR_AArch64_SVE_AAPCS_SaveList;
return CSR_AArch64_AAPCS_SaveList;
}
const MCPhysReg *
AArch64RegisterInfo::getDarwinCalleeSavedRegs(const MachineFunction *MF) const {
assert(MF && "Invalid MachineFunction pointer.");
assert(MF->getSubtarget<AArch64Subtarget>().isTargetDarwin() &&
"Invalid subtarget for getDarwinCalleeSavedRegs");
if (MF->getFunction().getCallingConv() == CallingConv::CFGuard_Check)
report_fatal_error(
"Calling convention CFGuard_Check is unsupported on Darwin.");
if (MF->getFunction().getCallingConv() == CallingConv::AArch64_VectorCall)
return CSR_Darwin_AArch64_AAVPCS_SaveList;
if (MF->getFunction().getCallingConv() == CallingConv::AArch64_SVE_VectorCall)
report_fatal_error(
"Calling convention SVE_VectorCall is unsupported on Darwin.");
if (MF->getFunction().getCallingConv() == CallingConv::CXX_FAST_TLS)
return MF->getInfo<AArch64FunctionInfo>()->isSplitCSR()
? CSR_Darwin_AArch64_CXX_TLS_PE_SaveList
: CSR_Darwin_AArch64_CXX_TLS_SaveList;
if (MF->getSubtarget<AArch64Subtarget>().getTargetLowering()
->supportSwiftError() &&
MF->getFunction().getAttributes().hasAttrSomewhere(
Attribute::SwiftError))
return CSR_Darwin_AArch64_AAPCS_SwiftError_SaveList;
if (MF->getFunction().getCallingConv() == CallingConv::SwiftTail)
return CSR_Darwin_AArch64_AAPCS_SwiftTail_SaveList;
if (MF->getFunction().getCallingConv() == CallingConv::PreserveMost)
return CSR_Darwin_AArch64_RT_MostRegs_SaveList;
return CSR_Darwin_AArch64_AAPCS_SaveList;
}
const MCPhysReg *AArch64RegisterInfo::getCalleeSavedRegsViaCopy(
const MachineFunction *MF) const {
assert(MF && "Invalid MachineFunction pointer.");
if (MF->getFunction().getCallingConv() == CallingConv::CXX_FAST_TLS &&
MF->getInfo<AArch64FunctionInfo>()->isSplitCSR())
return CSR_Darwin_AArch64_CXX_TLS_ViaCopy_SaveList;
return nullptr;
}
void AArch64RegisterInfo::UpdateCustomCalleeSavedRegs(
MachineFunction &MF) const {
const MCPhysReg *CSRs = getCalleeSavedRegs(&MF);
SmallVector<MCPhysReg, 32> UpdatedCSRs;
for (const MCPhysReg *I = CSRs; *I; ++I)
UpdatedCSRs.push_back(*I);
for (size_t i = 0; i < AArch64::GPR64commonRegClass.getNumRegs(); ++i) {
if (MF.getSubtarget<AArch64Subtarget>().isXRegCustomCalleeSaved(i)) {
UpdatedCSRs.push_back(AArch64::GPR64commonRegClass.getRegister(i));
}
}
// Register lists are zero-terminated.
UpdatedCSRs.push_back(0);
MF.getRegInfo().setCalleeSavedRegs(UpdatedCSRs);
}
const TargetRegisterClass *
AArch64RegisterInfo::getSubClassWithSubReg(const TargetRegisterClass *RC,
unsigned Idx) const {
// edge case for GPR/FPR register classes
if (RC == &AArch64::GPR32allRegClass && Idx == AArch64::hsub)
return &AArch64::FPR32RegClass;
else if (RC == &AArch64::GPR64allRegClass && Idx == AArch64::hsub)
return &AArch64::FPR64RegClass;
// Forward to TableGen's default version.
return AArch64GenRegisterInfo::getSubClassWithSubReg(RC, Idx);
}
const uint32_t *
AArch64RegisterInfo::getDarwinCallPreservedMask(const MachineFunction &MF,
CallingConv::ID CC) const {
assert(MF.getSubtarget<AArch64Subtarget>().isTargetDarwin() &&
"Invalid subtarget for getDarwinCallPreservedMask");
if (CC == CallingConv::CXX_FAST_TLS)
return CSR_Darwin_AArch64_CXX_TLS_RegMask;
if (CC == CallingConv::AArch64_VectorCall)
return CSR_Darwin_AArch64_AAVPCS_RegMask;
if (CC == CallingConv::AArch64_SVE_VectorCall)
report_fatal_error(
"Calling convention SVE_VectorCall is unsupported on Darwin.");
if (CC == CallingConv::CFGuard_Check)
report_fatal_error(
"Calling convention CFGuard_Check is unsupported on Darwin.");
if (MF.getSubtarget<AArch64Subtarget>()
.getTargetLowering()
->supportSwiftError() &&
MF.getFunction().getAttributes().hasAttrSomewhere(Attribute::SwiftError))
return CSR_Darwin_AArch64_AAPCS_SwiftError_RegMask;
if (CC == CallingConv::SwiftTail)
return CSR_Darwin_AArch64_AAPCS_SwiftTail_RegMask;
if (CC == CallingConv::PreserveMost)
return CSR_Darwin_AArch64_RT_MostRegs_RegMask;
return CSR_Darwin_AArch64_AAPCS_RegMask;
}
const uint32_t *
AArch64RegisterInfo::getCallPreservedMask(const MachineFunction &MF,
CallingConv::ID CC) const {
bool SCS = MF.getFunction().hasFnAttribute(Attribute::ShadowCallStack);
if (CC == CallingConv::GHC)
// This is academic because all GHC calls are (supposed to be) tail calls
return SCS ? CSR_AArch64_NoRegs_SCS_RegMask : CSR_AArch64_NoRegs_RegMask;
if (CC == CallingConv::AnyReg)
return SCS ? CSR_AArch64_AllRegs_SCS_RegMask : CSR_AArch64_AllRegs_RegMask;
// All the following calling conventions are handled differently on Darwin.
if (MF.getSubtarget<AArch64Subtarget>().isTargetDarwin()) {
if (SCS)
report_fatal_error("ShadowCallStack attribute not supported on Darwin.");
return getDarwinCallPreservedMask(MF, CC);
}
if (CC == CallingConv::AArch64_VectorCall)
return SCS ? CSR_AArch64_AAVPCS_SCS_RegMask : CSR_AArch64_AAVPCS_RegMask;
if (CC == CallingConv::AArch64_SVE_VectorCall)
return SCS ? CSR_AArch64_SVE_AAPCS_SCS_RegMask
: CSR_AArch64_SVE_AAPCS_RegMask;
if (CC == CallingConv::CFGuard_Check)
return CSR_Win_AArch64_CFGuard_Check_RegMask;
if (MF.getSubtarget<AArch64Subtarget>().getTargetLowering()
->supportSwiftError() &&
MF.getFunction().getAttributes().hasAttrSomewhere(Attribute::SwiftError))
return SCS ? CSR_AArch64_AAPCS_SwiftError_SCS_RegMask
: CSR_AArch64_AAPCS_SwiftError_RegMask;
if (CC == CallingConv::SwiftTail) {
if (SCS)
report_fatal_error("ShadowCallStack attribute not supported with swifttail");
return CSR_AArch64_AAPCS_SwiftTail_RegMask;
}
if (CC == CallingConv::PreserveMost)
return SCS ? CSR_AArch64_RT_MostRegs_SCS_RegMask
: CSR_AArch64_RT_MostRegs_RegMask;
else
return SCS ? CSR_AArch64_AAPCS_SCS_RegMask : CSR_AArch64_AAPCS_RegMask;
}
const uint32_t *AArch64RegisterInfo::getCustomEHPadPreservedMask(
const MachineFunction &MF) const {
if (MF.getSubtarget<AArch64Subtarget>().isTargetLinux())
return CSR_AArch64_AAPCS_RegMask;
return nullptr;
}
const uint32_t *AArch64RegisterInfo::getTLSCallPreservedMask() const {
if (TT.isOSDarwin())
return CSR_Darwin_AArch64_TLS_RegMask;
assert(TT.isOSBinFormatELF() && "Invalid target");
return CSR_AArch64_TLS_ELF_RegMask;
}
void AArch64RegisterInfo::UpdateCustomCallPreservedMask(MachineFunction &MF,
const uint32_t **Mask) const {
uint32_t *UpdatedMask = MF.allocateRegMask();
unsigned RegMaskSize = MachineOperand::getRegMaskSize(getNumRegs());
memcpy(UpdatedMask, *Mask, sizeof(UpdatedMask[0]) * RegMaskSize);
for (size_t i = 0; i < AArch64::GPR64commonRegClass.getNumRegs(); ++i) {
if (MF.getSubtarget<AArch64Subtarget>().isXRegCustomCalleeSaved(i)) {
for (MCSubRegIterator SubReg(AArch64::GPR64commonRegClass.getRegister(i),
this, true);
SubReg.isValid(); ++SubReg) {
// See TargetRegisterInfo::getCallPreservedMask for how to interpret the
// register mask.
UpdatedMask[*SubReg / 32] |= 1u << (*SubReg % 32);
}
}
}
*Mask = UpdatedMask;
}
const uint32_t *AArch64RegisterInfo::getNoPreservedMask() const {
return CSR_AArch64_NoRegs_RegMask;
}
const uint32_t *
AArch64RegisterInfo::getThisReturnPreservedMask(const MachineFunction &MF,
CallingConv::ID CC) const {
// This should return a register mask that is the same as that returned by
// getCallPreservedMask but that additionally preserves the register used for
// the first i64 argument (which must also be the register used to return a
// single i64 return value)
//
// In case that the calling convention does not use the same register for
// both, the function should return NULL (does not currently apply)
assert(CC != CallingConv::GHC && "should not be GHC calling convention.");
if (MF.getSubtarget<AArch64Subtarget>().isTargetDarwin())
return CSR_Darwin_AArch64_AAPCS_ThisReturn_RegMask;
return CSR_AArch64_AAPCS_ThisReturn_RegMask;
}
const uint32_t *AArch64RegisterInfo::getWindowsStackProbePreservedMask() const {
return CSR_AArch64_StackProbe_Windows_RegMask;
}
BitVector
AArch64RegisterInfo::getReservedRegs(const MachineFunction &MF) const {
const AArch64FrameLowering *TFI = getFrameLowering(MF);
// FIXME: avoid re-calculating this every time.
BitVector Reserved(getNumRegs());
markSuperRegs(Reserved, AArch64::WSP);
markSuperRegs(Reserved, AArch64::WZR);
if (TFI->hasFP(MF) || TT.isOSDarwin())
markSuperRegs(Reserved, AArch64::W29);
for (size_t i = 0; i < AArch64::GPR32commonRegClass.getNumRegs(); ++i) {
if (MF.getSubtarget<AArch64Subtarget>().isXRegisterReserved(i))
markSuperRegs(Reserved, AArch64::GPR32commonRegClass.getRegister(i));
}
if (hasBasePointer(MF))
markSuperRegs(Reserved, AArch64::W19);
// SLH uses register W16/X16 as the taint register.
if (MF.getFunction().hasFnAttribute(Attribute::SpeculativeLoadHardening))
markSuperRegs(Reserved, AArch64::W16);
assert(checkAllSuperRegsMarked(Reserved));
return Reserved;
}
bool AArch64RegisterInfo::isReservedReg(const MachineFunction &MF,
MCRegister Reg) const {
return getReservedRegs(MF)[Reg];
}
bool AArch64RegisterInfo::isAnyArgRegReserved(const MachineFunction &MF) const {
return llvm::any_of(*AArch64::GPR64argRegClass.MC, [this, &MF](MCPhysReg r) {
return isReservedReg(MF, r);
});
}
void AArch64RegisterInfo::emitReservedArgRegCallError(
const MachineFunction &MF) const {
const Function &F = MF.getFunction();
F.getContext().diagnose(DiagnosticInfoUnsupported{F, ("AArch64 doesn't support"
" function calls if any of the argument registers is reserved.")});
}
bool AArch64RegisterInfo::isAsmClobberable(const MachineFunction &MF,
MCRegister PhysReg) const {
return !isReservedReg(MF, PhysReg);
}
bool AArch64RegisterInfo::isConstantPhysReg(MCRegister PhysReg) const {
return PhysReg == AArch64::WZR || PhysReg == AArch64::XZR;
}
const TargetRegisterClass *
AArch64RegisterInfo::getPointerRegClass(const MachineFunction &MF,
unsigned Kind) const {
return &AArch64::GPR64spRegClass;
}
const TargetRegisterClass *
AArch64RegisterInfo::getCrossCopyRegClass(const TargetRegisterClass *RC) const {
if (RC == &AArch64::CCRRegClass)
return &AArch64::GPR64RegClass; // Only MSR & MRS copy NZCV.
return RC;
}
unsigned AArch64RegisterInfo::getBaseRegister() const { return AArch64::X19; }
bool AArch64RegisterInfo::hasBasePointer(const MachineFunction &MF) const {
const MachineFrameInfo &MFI = MF.getFrameInfo();
// In the presence of variable sized objects or funclets, if the fixed stack
// size is large enough that referencing from the FP won't result in things
// being in range relatively often, we can use a base pointer to allow access
// from the other direction like the SP normally works.
//
// Furthermore, if both variable sized objects are present, and the
// stack needs to be dynamically re-aligned, the base pointer is the only
// reliable way to reference the locals.
if (MFI.hasVarSizedObjects() || MF.hasEHFunclets()) {
if (hasStackRealignment(MF))
return true;
if (MF.getSubtarget<AArch64Subtarget>().hasSVE()) {
const AArch64FunctionInfo *AFI = MF.getInfo<AArch64FunctionInfo>();
// Frames that have variable sized objects and scalable SVE objects,
// should always use a basepointer.
if (!AFI->hasCalculatedStackSizeSVE() || AFI->getStackSizeSVE())
return true;
}
// Conservatively estimate whether the negative offset from the frame
// pointer will be sufficient to reach. If a function has a smallish
// frame, it's less likely to have lots of spills and callee saved
// space, so it's all more likely to be within range of the frame pointer.
// If it's wrong, we'll materialize the constant and still get to the
// object; it's just suboptimal. Negative offsets use the unscaled
// load/store instructions, which have a 9-bit signed immediate.
return MFI.getLocalFrameSize() >= 256;
}
return false;
}
Register
AArch64RegisterInfo::getFrameRegister(const MachineFunction &MF) const {
const AArch64FrameLowering *TFI = getFrameLowering(MF);
return TFI->hasFP(MF) ? AArch64::FP : AArch64::SP;
}
bool AArch64RegisterInfo::requiresRegisterScavenging(
const MachineFunction &MF) const {
return true;
}
bool AArch64RegisterInfo::requiresVirtualBaseRegisters(
const MachineFunction &MF) const {
return true;
}
bool
AArch64RegisterInfo::useFPForScavengingIndex(const MachineFunction &MF) const {
// This function indicates whether the emergency spillslot should be placed
// close to the beginning of the stackframe (closer to FP) or the end
// (closer to SP).
//
// The beginning works most reliably if we have a frame pointer.
// In the presence of any non-constant space between FP and locals,
// (e.g. in case of stack realignment or a scalable SVE area), it is
// better to use SP or BP.
const AArch64FrameLowering &TFI = *getFrameLowering(MF);
const AArch64FunctionInfo *AFI = MF.getInfo<AArch64FunctionInfo>();
assert((!MF.getSubtarget<AArch64Subtarget>().hasSVE() ||
AFI->hasCalculatedStackSizeSVE()) &&
"Expected SVE area to be calculated by this point");
return TFI.hasFP(MF) && !hasStackRealignment(MF) && !AFI->getStackSizeSVE();
}
bool AArch64RegisterInfo::requiresFrameIndexScavenging(
const MachineFunction &MF) const {
return true;
}
bool
AArch64RegisterInfo::cannotEliminateFrame(const MachineFunction &MF) const {
const MachineFrameInfo &MFI = MF.getFrameInfo();
if (MF.getTarget().Options.DisableFramePointerElim(MF) && MFI.adjustsStack())
return true;
return MFI.hasVarSizedObjects() || MFI.isFrameAddressTaken();
}
/// needsFrameBaseReg - Returns true if the instruction's frame index
/// reference would be better served by a base register other than FP
/// or SP. Used by LocalStackFrameAllocation to determine which frame index
/// references it should create new base registers for.
bool AArch64RegisterInfo::needsFrameBaseReg(MachineInstr *MI,
int64_t Offset) const {
for (unsigned i = 0; !MI->getOperand(i).isFI(); ++i)
assert(i < MI->getNumOperands() &&
"Instr doesn't have FrameIndex operand!");
// It's the load/store FI references that cause issues, as it can be difficult
// to materialize the offset if it won't fit in the literal field. Estimate
// based on the size of the local frame and some conservative assumptions
// about the rest of the stack frame (note, this is pre-regalloc, so
// we don't know everything for certain yet) whether this offset is likely
// to be out of range of the immediate. Return true if so.
// We only generate virtual base registers for loads and stores, so
// return false for everything else.
if (!MI->mayLoad() && !MI->mayStore())
return false;
// Without a virtual base register, if the function has variable sized
// objects, all fixed-size local references will be via the frame pointer,
// Approximate the offset and see if it's legal for the instruction.
// Note that the incoming offset is based on the SP value at function entry,
// so it'll be negative.
MachineFunction &MF = *MI->getParent()->getParent();
const AArch64FrameLowering *TFI = getFrameLowering(MF);
MachineFrameInfo &MFI = MF.getFrameInfo();
// Estimate an offset from the frame pointer.
// Conservatively assume all GPR callee-saved registers get pushed.
// FP, LR, X19-X28, D8-D15. 64-bits each.
int64_t FPOffset = Offset - 16 * 20;
// Estimate an offset from the stack pointer.
// The incoming offset is relating to the SP at the start of the function,
// but when we access the local it'll be relative to the SP after local
// allocation, so adjust our SP-relative offset by that allocation size.
Offset += MFI.getLocalFrameSize();
// Assume that we'll have at least some spill slots allocated.
// FIXME: This is a total SWAG number. We should run some statistics
// and pick a real one.
Offset += 128; // 128 bytes of spill slots
// If there is a frame pointer, try using it.
// The FP is only available if there is no dynamic realignment. We
// don't know for sure yet whether we'll need that, so we guess based
// on whether there are any local variables that would trigger it.
if (TFI->hasFP(MF) && isFrameOffsetLegal(MI, AArch64::FP, FPOffset))
return false;
// If we can reference via the stack pointer or base pointer, try that.
// FIXME: This (and the code that resolves the references) can be improved
// to only disallow SP relative references in the live range of
// the VLA(s). In practice, it's unclear how much difference that
// would make, but it may be worth doing.
if (isFrameOffsetLegal(MI, AArch64::SP, Offset))
return false;
// If even offset 0 is illegal, we don't want a virtual base register.
if (!isFrameOffsetLegal(MI, AArch64::SP, 0))
return false;
// The offset likely isn't legal; we want to allocate a virtual base register.
return true;
}
bool AArch64RegisterInfo::isFrameOffsetLegal(const MachineInstr *MI,
Register BaseReg,
int64_t Offset) const {
assert(MI && "Unable to get the legal offset for nil instruction.");
StackOffset SaveOffset = StackOffset::getFixed(Offset);
return isAArch64FrameOffsetLegal(*MI, SaveOffset) & AArch64FrameOffsetIsLegal;
}
/// Insert defining instruction(s) for BaseReg to be a pointer to FrameIdx
/// at the beginning of the basic block.
Register
AArch64RegisterInfo::materializeFrameBaseRegister(MachineBasicBlock *MBB,
int FrameIdx,
int64_t Offset) const {
MachineBasicBlock::iterator Ins = MBB->begin();
DebugLoc DL; // Defaults to "unknown"
if (Ins != MBB->end())
DL = Ins->getDebugLoc();
const MachineFunction &MF = *MBB->getParent();
const AArch64InstrInfo *TII =
MF.getSubtarget<AArch64Subtarget>().getInstrInfo();
const MCInstrDesc &MCID = TII->get(AArch64::ADDXri);
MachineRegisterInfo &MRI = MBB->getParent()->getRegInfo();
Register BaseReg = MRI.createVirtualRegister(&AArch64::GPR64spRegClass);
MRI.constrainRegClass(BaseReg, TII->getRegClass(MCID, 0, this, MF));
unsigned Shifter = AArch64_AM::getShifterImm(AArch64_AM::LSL, 0);
BuildMI(*MBB, Ins, DL, MCID, BaseReg)
.addFrameIndex(FrameIdx)
.addImm(Offset)
.addImm(Shifter);
return BaseReg;
}
void AArch64RegisterInfo::resolveFrameIndex(MachineInstr &MI, Register BaseReg,
int64_t Offset) const {
// ARM doesn't need the general 64-bit offsets
StackOffset Off = StackOffset::getFixed(Offset);
unsigned i = 0;
while (!MI.getOperand(i).isFI()) {
++i;
assert(i < MI.getNumOperands() && "Instr doesn't have FrameIndex operand!");
}
const MachineFunction *MF = MI.getParent()->getParent();
const AArch64InstrInfo *TII =
MF->getSubtarget<AArch64Subtarget>().getInstrInfo();
bool Done = rewriteAArch64FrameIndex(MI, i, BaseReg, Off, TII);
assert(Done && "Unable to resolve frame index!");
(void)Done;
}
// Create a scratch register for the frame index elimination in an instruction.
// This function has special handling of stack tagging loop pseudos, in which
// case it can also change the instruction opcode.
static Register
createScratchRegisterForInstruction(MachineInstr &MI, unsigned FIOperandNum,
const AArch64InstrInfo *TII) {
// ST*Gloop have a reserved scratch register in operand 1. Use it, and also
// replace the instruction with the writeback variant because it will now
// satisfy the operand constraints for it.
Register ScratchReg;
if (MI.getOpcode() == AArch64::STGloop ||
MI.getOpcode() == AArch64::STZGloop) {
assert(FIOperandNum == 3 &&
"Wrong frame index operand for STGloop/STZGloop");
unsigned Op = MI.getOpcode() == AArch64::STGloop ? AArch64::STGloop_wback
: AArch64::STZGloop_wback;
ScratchReg = MI.getOperand(1).getReg();
MI.getOperand(3).ChangeToRegister(ScratchReg, false, false, true);
MI.setDesc(TII->get(Op));
MI.tieOperands(1, 3);
} else {
ScratchReg =
MI.getMF()->getRegInfo().createVirtualRegister(&AArch64::GPR64RegClass);
MI.getOperand(FIOperandNum)
.ChangeToRegister(ScratchReg, false, false, true);
}
return ScratchReg;
}
void AArch64RegisterInfo::getOffsetOpcodes(
const StackOffset &Offset, SmallVectorImpl<uint64_t> &Ops) const {
// The smallest scalable element supported by scaled SVE addressing
// modes are predicates, which are 2 scalable bytes in size. So the scalable
// byte offset must always be a multiple of 2.
assert(Offset.getScalable() % 2 == 0 && "Invalid frame offset");
// Add fixed-sized offset using existing DIExpression interface.
DIExpression::appendOffset(Ops, Offset.getFixed());
unsigned VG = getDwarfRegNum(AArch64::VG, true);
int64_t VGSized = Offset.getScalable() / 2;
if (VGSized > 0) {
Ops.push_back(dwarf::DW_OP_constu);
Ops.push_back(VGSized);
Ops.append({dwarf::DW_OP_bregx, VG, 0ULL});
Ops.push_back(dwarf::DW_OP_mul);
Ops.push_back(dwarf::DW_OP_plus);
} else if (VGSized < 0) {
Ops.push_back(dwarf::DW_OP_constu);
Ops.push_back(-VGSized);
Ops.append({dwarf::DW_OP_bregx, VG, 0ULL});
Ops.push_back(dwarf::DW_OP_mul);
Ops.push_back(dwarf::DW_OP_minus);
}
}
void AArch64RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
int SPAdj, unsigned FIOperandNum,
RegScavenger *RS) const {
assert(SPAdj == 0 && "Unexpected");
MachineInstr &MI = *II;
MachineBasicBlock &MBB = *MI.getParent();
MachineFunction &MF = *MBB.getParent();
const MachineFrameInfo &MFI = MF.getFrameInfo();
const AArch64InstrInfo *TII =
MF.getSubtarget<AArch64Subtarget>().getInstrInfo();
const AArch64FrameLowering *TFI = getFrameLowering(MF);
int FrameIndex = MI.getOperand(FIOperandNum).getIndex();
bool Tagged =
MI.getOperand(FIOperandNum).getTargetFlags() & AArch64II::MO_TAGGED;
Register FrameReg;
// Special handling of dbg_value, stackmap patchpoint statepoint instructions.
if (MI.getOpcode() == TargetOpcode::STACKMAP ||
MI.getOpcode() == TargetOpcode::PATCHPOINT ||
MI.getOpcode() == TargetOpcode::STATEPOINT) {
StackOffset Offset =
TFI->resolveFrameIndexReference(MF, FrameIndex, FrameReg,
/*PreferFP=*/true,
/*ForSimm=*/false);
Offset += StackOffset::getFixed(MI.getOperand(FIOperandNum + 1).getImm());
MI.getOperand(FIOperandNum).ChangeToRegister(FrameReg, false /*isDef*/);
MI.getOperand(FIOperandNum + 1).ChangeToImmediate(Offset.getFixed());
return;
}
if (MI.getOpcode() == TargetOpcode::LOCAL_ESCAPE) {
MachineOperand &FI = MI.getOperand(FIOperandNum);
StackOffset Offset = TFI->getNonLocalFrameIndexReference(MF, FrameIndex);
assert(!Offset.getScalable() &&
"Frame offsets with a scalable component are not supported");
FI.ChangeToImmediate(Offset.getFixed());
return;
}
StackOffset Offset;
if (MI.getOpcode() == AArch64::TAGPstack) {
// TAGPstack must use the virtual frame register in its 3rd operand.
const AArch64FunctionInfo *AFI = MF.getInfo<AArch64FunctionInfo>();
FrameReg = MI.getOperand(3).getReg();
Offset = StackOffset::getFixed(MFI.getObjectOffset(FrameIndex) +
AFI->getTaggedBasePointerOffset());
} else if (Tagged) {
StackOffset SPOffset = StackOffset::getFixed(
MFI.getObjectOffset(FrameIndex) + (int64_t)MFI.getStackSize());
if (MFI.hasVarSizedObjects() ||
isAArch64FrameOffsetLegal(MI, SPOffset, nullptr, nullptr, nullptr) !=
(AArch64FrameOffsetCanUpdate | AArch64FrameOffsetIsLegal)) {
// Can't update to SP + offset in place. Precalculate the tagged pointer
// in a scratch register.
Offset = TFI->resolveFrameIndexReference(
MF, FrameIndex, FrameReg, /*PreferFP=*/false, /*ForSimm=*/true);
Register ScratchReg =
MF.getRegInfo().createVirtualRegister(&AArch64::GPR64RegClass);
emitFrameOffset(MBB, II, MI.getDebugLoc(), ScratchReg, FrameReg, Offset,
TII);
BuildMI(MBB, MI, MI.getDebugLoc(), TII->get(AArch64::LDG), ScratchReg)
.addReg(ScratchReg)
.addReg(ScratchReg)
.addImm(0);
MI.getOperand(FIOperandNum)
.ChangeToRegister(ScratchReg, false, false, true);
return;
}
FrameReg = AArch64::SP;
Offset = StackOffset::getFixed(MFI.getObjectOffset(FrameIndex) +
(int64_t)MFI.getStackSize());
} else {
Offset = TFI->resolveFrameIndexReference(
MF, FrameIndex, FrameReg, /*PreferFP=*/false, /*ForSimm=*/true);
}
// Modify MI as necessary to handle as much of 'Offset' as possible
if (rewriteAArch64FrameIndex(MI, FIOperandNum, FrameReg, Offset, TII))
return;
assert((!RS || !RS->isScavengingFrameIndex(FrameIndex)) &&
"Emergency spill slot is out of reach");
// If we get here, the immediate doesn't fit into the instruction. We folded
// as much as possible above. Handle the rest, providing a register that is
// SP+LargeImm.
Register ScratchReg =
createScratchRegisterForInstruction(MI, FIOperandNum, TII);
emitFrameOffset(MBB, II, MI.getDebugLoc(), ScratchReg, FrameReg, Offset, TII);
}
unsigned AArch64RegisterInfo::getRegPressureLimit(const TargetRegisterClass *RC,
MachineFunction &MF) const {
const AArch64FrameLowering *TFI = getFrameLowering(MF);
switch (RC->getID()) {
default:
return 0;
case AArch64::GPR32RegClassID:
case AArch64::GPR32spRegClassID:
case AArch64::GPR32allRegClassID:
case AArch64::GPR64spRegClassID:
case AArch64::GPR64allRegClassID:
case AArch64::GPR64RegClassID:
case AArch64::GPR32commonRegClassID:
case AArch64::GPR64commonRegClassID:
return 32 - 1 // XZR/SP
- (TFI->hasFP(MF) || TT.isOSDarwin()) // FP
- MF.getSubtarget<AArch64Subtarget>().getNumXRegisterReserved()
- hasBasePointer(MF); // X19
case AArch64::FPR8RegClassID:
case AArch64::FPR16RegClassID:
case AArch64::FPR32RegClassID:
case AArch64::FPR64RegClassID:
case AArch64::FPR128RegClassID:
return 32;
case AArch64::MatrixIndexGPR32_12_15RegClassID:
return 4;
case AArch64::DDRegClassID:
case AArch64::DDDRegClassID:
case AArch64::DDDDRegClassID:
case AArch64::QQRegClassID:
case AArch64::QQQRegClassID:
case AArch64::QQQQRegClassID:
return 32;
case AArch64::FPR128_loRegClassID:
case AArch64::FPR64_loRegClassID:
case AArch64::FPR16_loRegClassID:
return 16;
}
}
unsigned AArch64RegisterInfo::getLocalAddressRegister(
const MachineFunction &MF) const {
const auto &MFI = MF.getFrameInfo();
if (!MF.hasEHFunclets() && !MFI.hasVarSizedObjects())
return AArch64::SP;
else if (hasStackRealignment(MF))
return getBaseRegister();
return getFrameRegister(MF);
}
/// SrcRC and DstRC will be morphed into NewRC if this returns true
bool AArch64RegisterInfo::shouldCoalesce(
MachineInstr *MI, const TargetRegisterClass *SrcRC, unsigned SubReg,
const TargetRegisterClass *DstRC, unsigned DstSubReg,
const TargetRegisterClass *NewRC, LiveIntervals &LIS) const {
if (MI->isCopy() &&
((DstRC->getID() == AArch64::GPR64RegClassID) ||
(DstRC->getID() == AArch64::GPR64commonRegClassID)) &&
MI->getOperand(0).getSubReg() && MI->getOperand(1).getSubReg())
// Do not coalesce in the case of a 32-bit subregister copy
// which implements a 32 to 64 bit zero extension
// which relies on the upper 32 bits being zeroed.
return false;
return true;
}
|
;------------------------------------------------------------------------------ ;
; Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent
;
; Module Name:
;
; ExceptionHandler.Asm
;
; Abstract:
;
; IA32 CPU Exception Handler
;
; Notes:
;
;------------------------------------------------------------------------------
extern ASM_PFX(CommonExceptionHandler)
SECTION .text
;
; exception handler stub table
;
ALIGN 4
AsmIdtVectorBegin:
%rep 32
db 0x6a ; push #VectorNum
db ($ - AsmIdtVectorBegin) / ((AsmIdtVectorEnd - AsmIdtVectorBegin) / 32) ; VectorNum
jmp ASM_PFX(CommonInterruptEntry)
%endrep
AsmIdtVectorEnd:
;----------------------------------------------------------------------------;
; CommonInterruptEntry ;
;----------------------------------------------------------------------------;
; The follow algorithm is used for the common interrupt routine.
; Stack:
; +---------------------+
; + EFlags +
; +---------------------+
; + CS +
; +---------------------+
; + EIP +
; +---------------------+
; + Error Code +
; +---------------------+
; + Vector Number +
; +---------------------+
global ASM_PFX(CommonInterruptEntry)
ASM_PFX(CommonInterruptEntry):
cli
mov rcx, rsp
mov rdx, [rsp]
call ASM_PFX(CommonExceptionHandler)
jmp $
;----------------------------------------------------------------------------;
; _AsmGetTemplateAddressMap ;
;----------------------------------------------------------------------------;
;
; VOID
; AsmGetTemplateAddressMap (
; EXCEPTION_HANDLER_TEMPLATE_MAP *AddressMap
; );
;
; Routine Description:
;
; Return address map of interrupt handler template so that C code can generate
; interrupt table.
;
; Arguments:
; AddressMap: Address of EXCEPTION_HANDLER_TEMPLATE_MAP structure
;
; Returns:
; Nothing
;-----------------------------------------------------------------------------;
global ASM_PFX(AsmGetTemplateAddressMap)
ASM_PFX(AsmGetTemplateAddressMap):
mov rax, AsmIdtVectorBegin
mov [rcx], rax
mov rax, (AsmIdtVectorEnd - AsmIdtVectorBegin) / 32
mov [rcx + 8], rax
ret
|
;===============================================================================
; Copyright 2015-2020 Intel Corporation
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;===============================================================================
;
;
; Purpose: Cryptography Primitive.
; Rijndael Inverse Cipher function
;
; Content:
; Decrypt_RIJ128_AES_NI()
;
;
%include "asmdefs.inc"
%include "ia_32e.inc"
%include "pcpvariant.inc"
%if (_AES_NI_ENABLING_ == _FEATURE_ON_) || (_AES_NI_ENABLING_ == _FEATURE_TICKTOCK_)
%if (_IPP32E >= _IPP32E_Y8)
%macro COPY_8U 4.nolist
%xdefine %%dst %1
%xdefine %%src %2
%xdefine %%limit %3
%xdefine %%tmp %4
xor rcx, rcx
%%next_byte:
mov %%tmp, byte [%%src+rcx]
mov byte [%%dst+rcx], %%tmp
add rcx, 1
cmp rcx, %%limit
jl %%next_byte
%endmacro
%macro COPY_32U 4.nolist
%xdefine %%dst %1
%xdefine %%src %2
%xdefine %%limit %3
%xdefine %%tmp %4
xor rcx, rcx
%%next_dword:
mov %%tmp, dword [%%src+rcx]
mov dword [%%dst+rcx], %%tmp
add rcx, 4
cmp rcx, %%limit
jl %%next_dword
%endmacro
%macro COPY_128U 4.nolist
%xdefine %%dst %1
%xdefine %%src %2
%xdefine %%limit %3
%xdefine %%tmp %4
xor rcx, rcx
%%next_oword:
movdqu %%tmp, oword [%%src+rcx]
movdqu oword [%%dst+rcx], %%tmp
add rcx, 16
cmp rcx, %%limit
jl %%next_oword
%endmacro
segment .text align=IPP_ALIGN_FACTOR
;***************************************************************
;* Purpose: pipelined RIJ128 CFB decryption
;*
;* void DecryptCFB_RIJ128pipe_AES_NI(const Ipp32u* inpBlk,
;* Ipp32u* outBlk,
;* int nr,
;* const Ipp32u* pRKey,
;* int cfbBlks,
;* int cfbSize,
;* const Ipp8u* pIV)
;***************************************************************
;;
;; Lib = Y8
;;
;; Caller = ippsRijndael128DecryptCFB
;;
align IPP_ALIGN_FACTOR
IPPASM DecryptCFB_RIJ128pipe_AES_NI,PUBLIC
%assign LOCAL_FRAME (1+4+4)*16
USES_GPR rsi,rdi,r13,r14,r15
USES_XMM xmm6,xmm7
COMP_ABI 7
;; rdi: pInpBlk: DWORD, ; input blocks address
;; rsi: pOutBlk: DWORD, ; output blocks address
;; rdx: nr: DWORD, ; number of rounds
;; rcx pKey: DWORD ; key material address
;; r8d cfbBlks: DWORD ; length of stream in cfbSize
;; r9d cfbSize: DWORD ; cfb blk size
;; [rsp+ARG_7] pIV BYTE ; pointer to the IV
%xdefine SC (4)
%assign BLKS_PER_LOOP (4)
mov rax, [rsp+ARG_7] ; IV address
movdqu xmm4, oword [rax] ; get IV
movdqa oword [rsp+0*16], xmm4 ; into the stack
mov r13, rdi
mov r14, rsi
mov r15, rcx
movsxd r8, r8d ; length of stream
movsxd r9, r9d ; cfb blk size
sub r8, BLKS_PER_LOOP
jl .short_input
;;
;; pipelined processing
;;
lea r10, [r9*BLKS_PER_LOOP]
.blks_loop:
COPY_32U {rsp+16}, r13, r10, r11d ; move 4 input blocks to stack
movdqa xmm4, oword [r15]
lea r10, [r9+r9*2]
movdqa xmm0, oword [rsp] ; get encoded blocks
movdqu xmm1, oword [rsp+r9]
movdqu xmm2, oword [rsp+r9*2]
movdqu xmm3, oword [rsp+r10]
mov r10, r15 ; set pointer to the key material
pxor xmm0, xmm4 ; whitening
pxor xmm1, xmm4
pxor xmm2, xmm4
pxor xmm3, xmm4
movdqa xmm4, oword [r10+16] ; pre load operation's keys
add r10, 16
mov r11, rdx ; counter depending on key length
sub r11, 1
.cipher_loop:
aesenc xmm0, xmm4 ; regular round
aesenc xmm1, xmm4
aesenc xmm2, xmm4
aesenc xmm3, xmm4
movdqa xmm4, oword [r10+16]; pre load operation's keys
add r10, 16
dec r11
jnz .cipher_loop
aesenclast xmm0, xmm4 ; irregular round and IV
aesenclast xmm1, xmm4
aesenclast xmm2, xmm4
aesenclast xmm3, xmm4
lea r10, [r9+r9*2] ; get src blocks from the stack
movdqa xmm4, oword [rsp+16]
movdqu xmm5, oword [rsp+16+r9]
movdqu xmm6, oword [rsp+16+r9*2]
movdqu xmm7, oword [rsp+16+r10]
pxor xmm0, xmm4 ; xor src
movdqa oword [rsp+5*16],xmm0;and store into the stack
pxor xmm1, xmm5
movdqu oword [rsp+5*16+r9], xmm1
pxor xmm2, xmm6
movdqu oword [rsp+5*16+r9*2], xmm2
pxor xmm3, xmm7
movdqu oword [rsp+5*16+r10], xmm3
lea r10, [r9*BLKS_PER_LOOP]
;COPY_8U r14, {rsp+5*16}, r10 ; move 4 blocks to output
COPY_32U r14, {rsp+5*16}, r10, r11d ; move 4 blocks to output
movdqu xmm0, oword [rsp+r10]; update IV
movdqu oword [rsp], xmm0
add r13, r10
add r14, r10
sub r8, BLKS_PER_LOOP
jge .blks_loop
;;
;; block-by-block processing
;;
.short_input:
add r8, BLKS_PER_LOOP
jz .quit
lea r10, [r9*2]
lea r11, [r9+r9*2]
cmp r8, 2
cmovl r10, r9
cmovg r10, r11
COPY_8U {rsp+16}, r13, r10, al ; move recent input blocks to stack
; get actual address of key material: pRKeys += (nr-9) * SC
lea rax,[rdx*4]
lea rax, [r15+rax*4-9*(SC)*4] ; AES-128 round keys
xor r11, r11 ; index
.single_blk_loop:
movdqu xmm0, oword [rsp+r11] ; get encoded block
pxor xmm0, oword [r15] ; whitening
cmp rdx,12 ; switch according to number of rounds
jl .key_128_s
jz .key_192_s
.key_256_s:
aesenc xmm0, oword [rax-4*4*SC]
aesenc xmm0, oword [rax-3*4*SC]
.key_192_s:
aesenc xmm0, oword [rax-2*4*SC]
aesenc xmm0, oword [rax-1*4*SC]
.key_128_s:
aesenc xmm0, oword [rax+0*4*SC]
aesenc xmm0, oword [rax+1*4*SC]
aesenc xmm0, oword [rax+2*4*SC]
aesenc xmm0, oword [rax+3*4*SC]
aesenc xmm0, oword [rax+4*4*SC]
aesenc xmm0, oword [rax+5*4*SC]
aesenc xmm0, oword [rax+6*4*SC]
aesenc xmm0, oword [rax+7*4*SC]
aesenc xmm0, oword [rax+8*4*SC]
aesenclast xmm0, oword [rax+9*4*SC]
movdqu xmm1, oword [rsp+r11+16] ; get input block from the stack
pxor xmm0, xmm1 ; xor src
movdqu oword [rsp+5*16+r11], xmm0 ; and save output
add r11, r9
dec r8
jnz .single_blk_loop
COPY_8U r14, {rsp+5*16}, r10, al ; copy rest output from the stack
.quit:
REST_XMM
REST_GPR
ret
ENDFUNC DecryptCFB_RIJ128pipe_AES_NI
align IPP_ALIGN_FACTOR
IPPASM DecryptCFB32_RIJ128pipe_AES_NI,PUBLIC
%assign LOCAL_FRAME (1+4+4)*16
USES_GPR rsi,rdi,r13,r14,r15
USES_XMM xmm6,xmm7
COMP_ABI 7
;; rdi: pInpBlk: DWORD, ; input blocks address
;; rsi: pOutBlk: DWORD, ; output blocks address
;; rdx: nr: DWORD, ; number of rounds
;; rcx pKey: DWORD ; key material address
;; r8d cfbBlks: DWORD ; length of stream in cfbSize
;; r9d cfbSize: DWORD ; cfb blk size (4 bytes multible)
;; [rsp+ARG_7] pIV BYTE ; pointer to the IV
%xdefine SC (4)
%assign BLKS_PER_LOOP (4)
mov rax, [rsp+ARG_7] ; IV address
movdqu xmm4, oword [rax] ; get IV
movdqa oword [rsp+0*16], xmm4 ; into the stack
mov r13, rdi
mov r14, rsi
mov r15, rcx
movsxd r8, r8d ; length of stream
movsxd r9, r9d ; cfb blk size
sub r8, BLKS_PER_LOOP
jl .short_input
;;
;; pipelined processing
;;
lea r10, [r9*BLKS_PER_LOOP]
.blks_loop:
COPY_128U {rsp+16}, r13, r10, xmm0 ; move 4 input blocks to stack
movdqa xmm4, oword [r15]
lea r10, [r9+r9*2]
movdqa xmm0, oword [rsp] ; get encoded blocks
movdqu xmm1, oword [rsp+r9]
movdqu xmm2, oword [rsp+r9*2]
movdqu xmm3, oword [rsp+r10]
mov r10, r15 ; set pointer to the key material
pxor xmm0, xmm4 ; whitening
pxor xmm1, xmm4
pxor xmm2, xmm4
pxor xmm3, xmm4
movdqa xmm4, oword [r10+16] ; pre load operation's keys
add r10, 16
mov r11, rdx ; counter depending on key length
sub r11, 1
.cipher_loop:
aesenc xmm0, xmm4 ; regular round
aesenc xmm1, xmm4
aesenc xmm2, xmm4
aesenc xmm3, xmm4
movdqa xmm4, oword [r10+16]; pre load operation's keys
add r10, 16
dec r11
jnz .cipher_loop
aesenclast xmm0, xmm4 ; irregular round and IV
aesenclast xmm1, xmm4
aesenclast xmm2, xmm4
aesenclast xmm3, xmm4
lea r10, [r9+r9*2] ; get src blocks from the stack
movdqa xmm4, oword [rsp+16]
movdqu xmm5, oword [rsp+16+r9]
movdqu xmm6, oword [rsp+16+r9*2]
movdqu xmm7, oword [rsp+16+r10]
pxor xmm0, xmm4 ; xor src
movdqa oword [rsp+5*16],xmm0;and store into the stack
pxor xmm1, xmm5
movdqu oword [rsp+5*16+r9], xmm1
pxor xmm2, xmm6
movdqu oword [rsp+5*16+r9*2], xmm2
pxor xmm3, xmm7
movdqu oword [rsp+5*16+r10], xmm3
lea r10, [r9*BLKS_PER_LOOP]
COPY_128U r14, {rsp+5*16}, r10, xmm0 ; move 4 blocks to output
movdqu xmm0, oword [rsp+r10] ; update IV
movdqu oword [rsp], xmm0
add r13, r10
add r14, r10
sub r8, BLKS_PER_LOOP
jge .blks_loop
;;
;; block-by-block processing
;;
.short_input:
add r8, BLKS_PER_LOOP
jz .quit
lea r10, [r9*2]
lea r11, [r9+r9*2]
cmp r8, 2
cmovl r10, r9
cmovg r10, r11
COPY_32U {rsp+16}, r13, r10, eax ; move recent input blocks to stack
; get actual address of key material: pRKeys += (nr-9) * SC
lea rax,[rdx*4]
lea rax, [r15+rax*4-9*(SC)*4] ; AES-128 round keys
xor r11, r11 ; index
.single_blk_loop:
movdqu xmm0, oword [rsp+r11] ; get encoded block
pxor xmm0, oword [r15] ; whitening
cmp rdx,12 ; switch according to number of rounds
jl .key_128_s
jz .key_192_s
.key_256_s:
aesenc xmm0, oword [rax-4*4*SC]
aesenc xmm0, oword [rax-3*4*SC]
.key_192_s:
aesenc xmm0, oword [rax-2*4*SC]
aesenc xmm0, oword [rax-1*4*SC]
.key_128_s:
aesenc xmm0, oword [rax+0*4*SC]
aesenc xmm0, oword [rax+1*4*SC]
aesenc xmm0, oword [rax+2*4*SC]
aesenc xmm0, oword [rax+3*4*SC]
aesenc xmm0, oword [rax+4*4*SC]
aesenc xmm0, oword [rax+5*4*SC]
aesenc xmm0, oword [rax+6*4*SC]
aesenc xmm0, oword [rax+7*4*SC]
aesenc xmm0, oword [rax+8*4*SC]
aesenclast xmm0, oword [rax+9*4*SC]
movdqu xmm1, oword [rsp+r11+16] ; get input block from the stack
pxor xmm0, xmm1 ; xor src
movdqu oword [rsp+5*16+r11], xmm0 ; and save output
add r11, r9
dec r8
jnz .single_blk_loop
COPY_32U r14, {rsp+5*16}, r10, eax ; copy rest output from the stack
.quit:
REST_XMM
REST_GPR
ret
ENDFUNC DecryptCFB32_RIJ128pipe_AES_NI
;;
;; Lib = Y8
;;
;; Caller = ippsRijndael128DecryptCFB
;;
align IPP_ALIGN_FACTOR
IPPASM DecryptCFB128_RIJ128pipe_AES_NI,PUBLIC
%assign LOCAL_FRAME 0
USES_GPR rsi,rdi
USES_XMM xmm6,xmm7
COMP_ABI 6
;; rdi: pInpBlk: DWORD, ; input blocks address
;; rsi: pOutBlk: DWORD, ; output blocks address
;; rdx: nr: DWORD, ; number of rounds
;; rcx pKey: DWORD ; key material address
;; r8d lenBytes: DWORD ; length of stream in bytes
;; r9 pIV BYTE ; pointer to the IV
%xdefine SC (4)
%assign BLKS_PER_LOOP (4)
%assign BYTES_PER_BLK (16)
%assign BYTES_PER_LOOP (BYTES_PER_BLK*BLKS_PER_LOOP)
movdqu xmm0, oword [r9] ; get IV
movsxd r8, r8d ; length of the stream
sub r8, BYTES_PER_LOOP
jl .short_input
;;
;; pipelined processing
;;
.blks_loop:
movdqa xmm7, oword [rcx] ; get initial key material
mov r10, rcx ; set pointer to the key material
movdqu xmm1, oword [rdi+0*BYTES_PER_BLK] ; get another encoded cblocks
movdqu xmm2, oword [rdi+1*BYTES_PER_BLK]
movdqu xmm3, oword [rdi+2*BYTES_PER_BLK]
pxor xmm0, xmm7 ; whitening
pxor xmm1, xmm7
pxor xmm2, xmm7
pxor xmm3, xmm7
movdqa xmm7, oword [r10+16] ; pre load operation's keys
add r10, 16
mov r11, rdx ; counter depending on key length
sub r11, 1
.cipher_loop:
aesenc xmm0, xmm7 ; regular round
aesenc xmm1, xmm7
aesenc xmm2, xmm7
aesenc xmm3, xmm7
movdqa xmm7, oword [r10+16] ; pre load operation's keys
add r10, 16
dec r11
jnz .cipher_loop
aesenclast xmm0, xmm7 ; irregular round and IV
movdqu xmm4, oword [rdi+0*BYTES_PER_BLK] ; 4 input blocks
aesenclast xmm1, xmm7
movdqu xmm5, oword [rdi+1*BYTES_PER_BLK]
aesenclast xmm2, xmm7
movdqu xmm6, oword [rdi+2*BYTES_PER_BLK]
aesenclast xmm3, xmm7
movdqu xmm7, oword [rdi+3*BYTES_PER_BLK]
add rdi, BYTES_PER_LOOP
pxor xmm0, xmm4 ; 4 output blocks
movdqu oword [rsi+0*16], xmm0
pxor xmm1, xmm5
movdqu oword [rsi+1*16], xmm1
pxor xmm2, xmm6
movdqu oword [rsi+2*16], xmm2
pxor xmm3, xmm7
movdqu oword [rsi+3*16], xmm3
add rsi, BYTES_PER_LOOP
movdqa xmm0, xmm7 ; update IV
sub r8, BYTES_PER_LOOP
jge .blks_loop
;;
;; block-by-block processing
;;
.short_input:
add r8, BYTES_PER_LOOP
jz .quit
; get actual address of key material: pRKeys += (nr-9) * SC
lea rax, [rdx*4]
lea rax, [rcx+rax*4-9*(SC)*4] ; AES-128 round keys
.single_blk_loop:
pxor xmm0, oword [rcx] ; whitening
cmp rdx,12 ; switch according to number of rounds
jl .key_128_s
jz .key_192_s
.key_256_s:
aesenc xmm0, oword [rax-4*4*SC]
aesenc xmm0, oword [rax-3*4*SC]
.key_192_s:
aesenc xmm0, oword [rax-2*4*SC]
aesenc xmm0, oword [rax-1*4*SC]
.key_128_s:
aesenc xmm0, oword [rax+0*4*SC]
aesenc xmm0, oword [rax+1*4*SC]
aesenc xmm0, oword [rax+2*4*SC]
aesenc xmm0, oword [rax+3*4*SC]
aesenc xmm0, oword [rax+4*4*SC]
aesenc xmm0, oword [rax+5*4*SC]
aesenc xmm0, oword [rax+6*4*SC]
aesenc xmm0, oword [rax+7*4*SC]
aesenc xmm0, oword [rax+8*4*SC]
aesenclast xmm0, oword [rax+9*4*SC]
movdqu xmm1, oword [rdi] ; input block from the stream
add rdi, BYTES_PER_BLK
pxor xmm0, xmm1 ; xor src
movdqu oword [rsi], xmm0 ; and save output
add rsi, BYTES_PER_BLK
movdqa xmm0, xmm1 ; update IV
sub r8, BYTES_PER_BLK
jnz .single_blk_loop
.quit:
REST_XMM
REST_GPR
ret
ENDFUNC DecryptCFB128_RIJ128pipe_AES_NI
%endif
%endif ;; _AES_NI_ENABLING_
|
; A340504: Fixed under 0 -> 03, 1 -> 23, 2 -> 21, 3 -> 01.
; Submitted by Stefano Spezia
; 0,3,0,1,0,3,2,3,0,3,0,1,2,1,0,1,0,3,0,1,0,3,2,3,2,1,2,3,0,3,2,3,0,3,0,1,0,3,2,3,0,3,0,1,2,1,0,1,2,1,2,3,2,1,0,1,0,3,0,1,2,1,0,1,0,3,0,1,0,3,2,3,0,3,0,1,2,1,0,1,0,3,0,1,0,3,2,3,2,1,2,3,0,3,2,3,2,1,2,3
mul $0,2
add $0,1
mov $2,3
lpb $0
mod $1,4
mov $3,$0
div $0,2
mul $3,$0
mod $3,2
mul $3,$2
add $1,$3
mov $2,2
lpe
mov $0,$1
|
;*****************************************************************************
;* MMX/SSE2/AVX-optimized 10-bit H.264 qpel code
;*****************************************************************************
;* Copyright (C) 2011 x264 project
;*
;* Authors: Daniel Kang <daniel.d.kang@gmail.com>
;*
;* This file is part of FFmpeg.
;*
;* FFmpeg is free software; you can redistribute it and/or
;* modify it under the terms of the GNU Lesser General Public
;* License as published by the Free Software Foundation; either
;* version 2.1 of the License, or (at your option) any later version.
;*
;* FFmpeg is distributed in the hope that it will be useful,
;* but WITHOUT ANY WARRANTY; without even the implied warranty of
;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;* Lesser General Public License for more details.
;*
;* You should have received a copy of the GNU Lesser General Public
;* License along with FFmpeg; if not, write to the Free Software
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
%include "libavutil/x86/x86util.asm"
SECTION_RODATA 32
cextern pw_16
cextern pw_1
cextern pb_0
pw_pixel_max: times 8 dw ((1 << 10)-1)
pad10: times 8 dw 10*1023
pad20: times 8 dw 20*1023
pad30: times 8 dw 30*1023
depad: times 4 dd 32*20*1023 + 512
depad2: times 8 dw 20*1023 + 16*1022 + 16
unpad: times 8 dw 16*1022/32 ; needs to be mod 16
tap1: times 4 dw 1, -5
tap2: times 4 dw 20, 20
tap3: times 4 dw -5, 1
pd_0f: times 4 dd 0xffff
SECTION .text
%macro AVG_MOV 2
pavgw %2, %1
mova %1, %2
%endmacro
%macro ADDW 3
%if mmsize == 8
paddw %1, %2
%else
movu %3, %2
paddw %1, %3
%endif
%endmacro
%macro FILT_H 4
paddw %1, %4
psubw %1, %2 ; a-b
psraw %1, 2 ; (a-b)/4
psubw %1, %2 ; (a-b)/4-b
paddw %1, %3 ; (a-b)/4-b+c
psraw %1, 2 ; ((a-b)/4-b+c)/4
paddw %1, %3 ; ((a-b)/4-b+c)/4+c = (a-5*b+20*c)/16
%endmacro
%macro PRELOAD_V 0
lea r3, [r2*3]
sub r1, r3
movu m0, [r1+r2]
movu m1, [r1+r2*2]
add r1, r3
movu m2, [r1]
movu m3, [r1+r2]
movu m4, [r1+r2*2]
add r1, r3
%endmacro
%macro FILT_V 8
movu %6, [r1]
paddw %1, %6
mova %7, %2
paddw %7, %5
mova %8, %3
paddw %8, %4
FILT_H %1, %7, %8, [pw_16]
psraw %1, 1
CLIPW %1, [pb_0], [pw_pixel_max]
%endmacro
%macro MC 1
%define OP_MOV mova
INIT_MMX mmxext
%1 put, 4
INIT_XMM sse2
%1 put, 8
%define OP_MOV AVG_MOV
INIT_MMX mmxext
%1 avg, 4
INIT_XMM sse2
%1 avg, 8
%endmacro
%macro MCAxA_OP 7
%if ARCH_X86_32
cglobal %1_h264_qpel%4_%2_10, %5,%6,%7
call stub_%1_h264_qpel%3_%2_10 %+ SUFFIX
mov r0, r0m
mov r1, r1m
add r0, %3*2
add r1, %3*2
call stub_%1_h264_qpel%3_%2_10 %+ SUFFIX
mov r0, r0m
mov r1, r1m
lea r0, [r0+r2*%3]
lea r1, [r1+r2*%3]
call stub_%1_h264_qpel%3_%2_10 %+ SUFFIX
mov r0, r0m
mov r1, r1m
lea r0, [r0+r2*%3+%3*2]
lea r1, [r1+r2*%3+%3*2]
call stub_%1_h264_qpel%3_%2_10 %+ SUFFIX
RET
%else ; ARCH_X86_64
cglobal %1_h264_qpel%4_%2_10, %5,%6 + 2,%7
mov r%6, r0
%assign p1 %6+1
mov r %+ p1, r1
call stub_%1_h264_qpel%3_%2_10 %+ SUFFIX
lea r0, [r%6+%3*2]
lea r1, [r %+ p1+%3*2]
call stub_%1_h264_qpel%3_%2_10 %+ SUFFIX
lea r0, [r%6+r2*%3]
lea r1, [r %+ p1+r2*%3]
call stub_%1_h264_qpel%3_%2_10 %+ SUFFIX
lea r0, [r%6+r2*%3+%3*2]
lea r1, [r %+ p1+r2*%3+%3*2]
%if UNIX64 == 0 ; fall through to function
call stub_%1_h264_qpel%3_%2_10 %+ SUFFIX
RET
%endif
%endif
%endmacro
;cpu, put/avg, mc, 4/8, ...
%macro cglobal_mc 6
%assign i %3*2
%if ARCH_X86_32 || cpuflag(sse2)
MCAxA_OP %1, %2, %3, i, %4,%5,%6
%endif
cglobal %1_h264_qpel%3_%2_10, %4,%5,%6
%if UNIX64 == 0 ; no prologue or epilogue for UNIX64
call stub_%1_h264_qpel%3_%2_10 %+ SUFFIX
RET
%endif
stub_%1_h264_qpel%3_%2_10 %+ SUFFIX:
%endmacro
;-----------------------------------------------------------------------------
; void ff_h264_qpel_mc00(uint8_t *dst, uint8_t *src, int stride)
;-----------------------------------------------------------------------------
%macro COPY4 0
movu m0, [r1 ]
OP_MOV [r0 ], m0
movu m0, [r1+r2 ]
OP_MOV [r0+r2 ], m0
movu m0, [r1+r2*2]
OP_MOV [r0+r2*2], m0
movu m0, [r1+r3 ]
OP_MOV [r0+r3 ], m0
%endmacro
%macro MC00 1
INIT_MMX mmxext
cglobal_mc %1, mc00, 4, 3,4,0
lea r3, [r2*3]
COPY4
ret
INIT_XMM sse2
cglobal %1_h264_qpel8_mc00_10, 3,4
lea r3, [r2*3]
COPY4
lea r0, [r0+r2*4]
lea r1, [r1+r2*4]
COPY4
RET
cglobal %1_h264_qpel16_mc00_10, 3,4
mov r3d, 8
.loop:
movu m0, [r1 ]
movu m1, [r1 +16]
OP_MOV [r0 ], m0
OP_MOV [r0 +16], m1
movu m0, [r1+r2 ]
movu m1, [r1+r2+16]
OP_MOV [r0+r2 ], m0
OP_MOV [r0+r2+16], m1
lea r0, [r0+r2*2]
lea r1, [r1+r2*2]
dec r3d
jg .loop
REP_RET
%endmacro
%define OP_MOV mova
MC00 put
%define OP_MOV AVG_MOV
MC00 avg
;-----------------------------------------------------------------------------
; void ff_h264_qpel_mc20(uint8_t *dst, uint8_t *src, int stride)
;-----------------------------------------------------------------------------
%macro MC_CACHE 1
%define OP_MOV mova
INIT_MMX mmxext
%1 put, 4
INIT_XMM sse2, cache64
%1 put, 8
INIT_XMM ssse3, cache64
%1 put, 8
INIT_XMM sse2
%1 put, 8
%define OP_MOV AVG_MOV
INIT_MMX mmxext
%1 avg, 4
INIT_XMM sse2, cache64
%1 avg, 8
INIT_XMM ssse3, cache64
%1 avg, 8
INIT_XMM sse2
%1 avg, 8
%endmacro
%macro MC20 2
cglobal_mc %1, mc20, %2, 3,4,9
mov r3d, %2
mova m1, [pw_pixel_max]
%if num_mmregs > 8
mova m8, [pw_16]
%define p16 m8
%else
%define p16 [pw_16]
%endif
.nextrow:
%if %0 == 4
movu m2, [r1-4]
movu m3, [r1-2]
movu m4, [r1+0]
ADDW m2, [r1+6], m5
ADDW m3, [r1+4], m5
ADDW m4, [r1+2], m5
%else ; movu is slow on these processors
%if mmsize==16
movu m2, [r1-4]
movu m0, [r1+6]
mova m6, m0
psrldq m0, 6
paddw m6, m2
PALIGNR m3, m0, m2, 2, m5
PALIGNR m7, m0, m2, 8, m5
paddw m3, m7
PALIGNR m4, m0, m2, 4, m5
PALIGNR m7, m0, m2, 6, m5
paddw m4, m7
SWAP 2, 6
%else
movu m2, [r1-4]
movu m6, [r1+4]
PALIGNR m3, m6, m2, 2, m5
paddw m3, m6
PALIGNR m4, m6, m2, 4, m5
PALIGNR m7, m6, m2, 6, m5
paddw m4, m7
paddw m2, [r1+6]
%endif
%endif
FILT_H m2, m3, m4, p16
psraw m2, 1
pxor m0, m0
CLIPW m2, m0, m1
OP_MOV [r0], m2
add r0, r2
add r1, r2
dec r3d
jg .nextrow
rep ret
%endmacro
MC_CACHE MC20
;-----------------------------------------------------------------------------
; void ff_h264_qpel_mc30(uint8_t *dst, uint8_t *src, int stride)
;-----------------------------------------------------------------------------
%macro MC30 2
cglobal_mc %1, mc30, %2, 3,5,9
lea r4, [r1+2]
jmp stub_%1_h264_qpel%2_mc10_10 %+ SUFFIX %+ .body
%endmacro
MC_CACHE MC30
;-----------------------------------------------------------------------------
; void ff_h264_qpel_mc10(uint8_t *dst, uint8_t *src, int stride)
;-----------------------------------------------------------------------------
%macro MC10 2
cglobal_mc %1, mc10, %2, 3,5,9
mov r4, r1
.body:
mov r3d, %2
mova m1, [pw_pixel_max]
%if num_mmregs > 8
mova m8, [pw_16]
%define p16 m8
%else
%define p16 [pw_16]
%endif
.nextrow:
%if %0 == 4
movu m2, [r1-4]
movu m3, [r1-2]
movu m4, [r1+0]
ADDW m2, [r1+6], m5
ADDW m3, [r1+4], m5
ADDW m4, [r1+2], m5
%else ; movu is slow on these processors
%if mmsize==16
movu m2, [r1-4]
movu m0, [r1+6]
mova m6, m0
psrldq m0, 6
paddw m6, m2
PALIGNR m3, m0, m2, 2, m5
PALIGNR m7, m0, m2, 8, m5
paddw m3, m7
PALIGNR m4, m0, m2, 4, m5
PALIGNR m7, m0, m2, 6, m5
paddw m4, m7
SWAP 2, 6
%else
movu m2, [r1-4]
movu m6, [r1+4]
PALIGNR m3, m6, m2, 2, m5
paddw m3, m6
PALIGNR m4, m6, m2, 4, m5
PALIGNR m7, m6, m2, 6, m5
paddw m4, m7
paddw m2, [r1+6]
%endif
%endif
FILT_H m2, m3, m4, p16
psraw m2, 1
pxor m0, m0
CLIPW m2, m0, m1
movu m3, [r4]
pavgw m2, m3
OP_MOV [r0], m2
add r0, r2
add r1, r2
add r4, r2
dec r3d
jg .nextrow
rep ret
%endmacro
MC_CACHE MC10
;-----------------------------------------------------------------------------
; void ff_h264_qpel_mc02(uint8_t *dst, uint8_t *src, int stride)
;-----------------------------------------------------------------------------
%macro V_FILT 10
v_filt%9_%10_10
add r4, r2
.no_addr4:
FILT_V m0, m1, m2, m3, m4, m5, m6, m7
add r1, r2
add r0, r2
ret
%endmacro
INIT_MMX mmxext
RESET_MM_PERMUTATION
%assign i 0
%rep 4
V_FILT m0, m1, m2, m3, m4, m5, m6, m7, 4, i
SWAP 0,1,2,3,4,5
%assign i i+1
%endrep
INIT_XMM sse2
RESET_MM_PERMUTATION
%assign i 0
%rep 6
V_FILT m0, m1, m2, m3, m4, m5, m6, m7, 8, i
SWAP 0,1,2,3,4,5
%assign i i+1
%endrep
%macro MC02 2
cglobal_mc %1, mc02, %2, 3,4,8
PRELOAD_V
sub r0, r2
%assign j 0
%rep %2
%assign i (j % 6)
call v_filt%2_ %+ i %+ _10.no_addr4
OP_MOV [r0], m0
SWAP 0,1,2,3,4,5
%assign j j+1
%endrep
ret
%endmacro
MC MC02
;-----------------------------------------------------------------------------
; void ff_h264_qpel_mc01(uint8_t *dst, uint8_t *src, int stride)
;-----------------------------------------------------------------------------
%macro MC01 2
cglobal_mc %1, mc01, %2, 3,5,8
mov r4, r1
.body:
PRELOAD_V
sub r4, r2
sub r0, r2
%assign j 0
%rep %2
%assign i (j % 6)
call v_filt%2_ %+ i %+ _10
movu m7, [r4]
pavgw m0, m7
OP_MOV [r0], m0
SWAP 0,1,2,3,4,5
%assign j j+1
%endrep
ret
%endmacro
MC MC01
;-----------------------------------------------------------------------------
; void ff_h264_qpel_mc03(uint8_t *dst, uint8_t *src, int stride)
;-----------------------------------------------------------------------------
%macro MC03 2
cglobal_mc %1, mc03, %2, 3,5,8
lea r4, [r1+r2]
jmp stub_%1_h264_qpel%2_mc01_10 %+ SUFFIX %+ .body
%endmacro
MC MC03
;-----------------------------------------------------------------------------
; void ff_h264_qpel_mc11(uint8_t *dst, uint8_t *src, int stride)
;-----------------------------------------------------------------------------
%macro H_FILT_AVG 2-3
h_filt%1_%2_10:
;FILT_H with fewer registers and averaged with the FILT_V result
;m6,m7 are tmp registers, m0 is the FILT_V result, the rest are to be used next in the next iteration
;unfortunately I need three registers, so m5 will have to be re-read from memory
movu m5, [r4-4]
ADDW m5, [r4+6], m7
movu m6, [r4-2]
ADDW m6, [r4+4], m7
paddw m5, [pw_16]
psubw m5, m6 ; a-b
psraw m5, 2 ; (a-b)/4
psubw m5, m6 ; (a-b)/4-b
movu m6, [r4+0]
ADDW m6, [r4+2], m7
paddw m5, m6 ; (a-b)/4-b+c
psraw m5, 2 ; ((a-b)/4-b+c)/4
paddw m5, m6 ; ((a-b)/4-b+c)/4+c = (a-5*b+20*c)/16
psraw m5, 1
CLIPW m5, [pb_0], [pw_pixel_max]
;avg FILT_V, FILT_H
pavgw m0, m5
%if %0!=4
movu m5, [r1+r5]
%endif
ret
%endmacro
INIT_MMX mmxext
RESET_MM_PERMUTATION
%assign i 0
%rep 3
H_FILT_AVG 4, i
SWAP 0,1,2,3,4,5
%assign i i+1
%endrep
H_FILT_AVG 4, i, 0
INIT_XMM sse2
RESET_MM_PERMUTATION
%assign i 0
%rep 6
%if i==1
H_FILT_AVG 8, i, 0
%else
H_FILT_AVG 8, i
%endif
SWAP 0,1,2,3,4,5
%assign i i+1
%endrep
%macro MC11 2
; this REALLY needs x86_64
cglobal_mc %1, mc11, %2, 3,6,8
mov r4, r1
.body:
PRELOAD_V
sub r0, r2
sub r4, r2
mov r5, r2
neg r5
%assign j 0
%rep %2
%assign i (j % 6)
call v_filt%2_ %+ i %+ _10
call h_filt%2_ %+ i %+ _10
%if %2==8 && i==1
movu m5, [r1+r5]
%endif
OP_MOV [r0], m0
SWAP 0,1,2,3,4,5
%assign j j+1
%endrep
ret
%endmacro
MC MC11
;-----------------------------------------------------------------------------
; void ff_h264_qpel_mc31(uint8_t *dst, uint8_t *src, int stride)
;-----------------------------------------------------------------------------
%macro MC31 2
cglobal_mc %1, mc31, %2, 3,6,8
mov r4, r1
add r1, 2
jmp stub_%1_h264_qpel%2_mc11_10 %+ SUFFIX %+ .body
%endmacro
MC MC31
;-----------------------------------------------------------------------------
; void ff_h264_qpel_mc13(uint8_t *dst, uint8_t *src, int stride)
;-----------------------------------------------------------------------------
%macro MC13 2
cglobal_mc %1, mc13, %2, 3,7,12
lea r4, [r1+r2]
jmp stub_%1_h264_qpel%2_mc11_10 %+ SUFFIX %+ .body
%endmacro
MC MC13
;-----------------------------------------------------------------------------
; void ff_h264_qpel_mc33(uint8_t *dst, uint8_t *src, int stride)
;-----------------------------------------------------------------------------
%macro MC33 2
cglobal_mc %1, mc33, %2, 3,6,8
lea r4, [r1+r2]
add r1, 2
jmp stub_%1_h264_qpel%2_mc11_10 %+ SUFFIX %+ .body
%endmacro
MC MC33
;-----------------------------------------------------------------------------
; void ff_h264_qpel_mc22(uint8_t *dst, uint8_t *src, int stride)
;-----------------------------------------------------------------------------
%macro FILT_H2 3
psubw %1, %2 ; a-b
psubw %2, %3 ; b-c
psllw %2, 2
psubw %1, %2 ; a-5*b+4*c
psllw %3, 4
paddw %1, %3 ; a-5*b+20*c
%endmacro
%macro FILT_VNRD 8
movu %6, [r1]
paddw %1, %6
mova %7, %2
paddw %7, %5
mova %8, %3
paddw %8, %4
FILT_H2 %1, %7, %8
%endmacro
%macro HV 1
%if mmsize==16
%define PAD 12
%define COUNT 2
%else
%define PAD 4
%define COUNT 3
%endif
put_hv%1_10:
neg r2 ; This actually saves instructions
lea r1, [r1+r2*2-mmsize+PAD]
lea r4, [rsp+PAD+gprsize]
mov r3d, COUNT
.v_loop:
movu m0, [r1]
sub r1, r2
movu m1, [r1]
sub r1, r2
movu m2, [r1]
sub r1, r2
movu m3, [r1]
sub r1, r2
movu m4, [r1]
sub r1, r2
%assign i 0
%rep %1-1
FILT_VNRD m0, m1, m2, m3, m4, m5, m6, m7
psubw m0, [pad20]
movu [r4+i*mmsize*3], m0
sub r1, r2
SWAP 0,1,2,3,4,5
%assign i i+1
%endrep
FILT_VNRD m0, m1, m2, m3, m4, m5, m6, m7
psubw m0, [pad20]
movu [r4+i*mmsize*3], m0
add r4, mmsize
lea r1, [r1+r2*8+mmsize]
%if %1==8
lea r1, [r1+r2*4]
%endif
dec r3d
jg .v_loop
neg r2
ret
%endmacro
INIT_MMX mmxext
HV 4
INIT_XMM sse2
HV 8
%macro H_LOOP 1
%if num_mmregs > 8
%define s1 m8
%define s2 m9
%define s3 m10
%define d1 m11
%else
%define s1 [tap1]
%define s2 [tap2]
%define s3 [tap3]
%define d1 [depad]
%endif
h%1_loop_op:
movu m1, [r1+mmsize-4]
movu m2, [r1+mmsize-2]
mova m3, [r1+mmsize+0]
movu m4, [r1+mmsize+2]
movu m5, [r1+mmsize+4]
movu m6, [r1+mmsize+6]
%if num_mmregs > 8
pmaddwd m1, s1
pmaddwd m2, s1
pmaddwd m3, s2
pmaddwd m4, s2
pmaddwd m5, s3
pmaddwd m6, s3
paddd m1, d1
paddd m2, d1
%else
mova m0, s1
pmaddwd m1, m0
pmaddwd m2, m0
mova m0, s2
pmaddwd m3, m0
pmaddwd m4, m0
mova m0, s3
pmaddwd m5, m0
pmaddwd m6, m0
mova m0, d1
paddd m1, m0
paddd m2, m0
%endif
paddd m3, m5
paddd m4, m6
paddd m1, m3
paddd m2, m4
psrad m1, 10
psrad m2, 10
pslld m2, 16
pand m1, [pd_0f]
por m1, m2
%if num_mmregs <= 8
pxor m0, m0
%endif
CLIPW m1, m0, m7
add r1, mmsize*3
ret
%endmacro
INIT_MMX mmxext
H_LOOP 4
INIT_XMM sse2
H_LOOP 8
%macro MC22 2
cglobal_mc %1, mc22, %2, 3,7,12
%define PAD mmsize*8*4*2 ; SIZE*16*4*sizeof(pixel)
mov r6, rsp ; backup stack pointer
and rsp, ~(mmsize-1) ; align stack
sub rsp, PAD
call put_hv%2_10
mov r3d, %2
mova m7, [pw_pixel_max]
%if num_mmregs > 8
pxor m0, m0
mova m8, [tap1]
mova m9, [tap2]
mova m10, [tap3]
mova m11, [depad]
%endif
mov r1, rsp
.h_loop:
call h%2_loop_op
OP_MOV [r0], m1
add r0, r2
dec r3d
jg .h_loop
mov rsp, r6 ; restore stack pointer
ret
%endmacro
MC MC22
;-----------------------------------------------------------------------------
; void ff_h264_qpel_mc12(uint8_t *dst, uint8_t *src, int stride)
;-----------------------------------------------------------------------------
%macro MC12 2
cglobal_mc %1, mc12, %2, 3,7,12
%define PAD mmsize*8*4*2 ; SIZE*16*4*sizeof(pixel)
mov r6, rsp ; backup stack pointer
and rsp, ~(mmsize-1) ; align stack
sub rsp, PAD
call put_hv%2_10
xor r4d, r4d
.body:
mov r3d, %2
pxor m0, m0
mova m7, [pw_pixel_max]
%if num_mmregs > 8
mova m8, [tap1]
mova m9, [tap2]
mova m10, [tap3]
mova m11, [depad]
%endif
mov r1, rsp
.h_loop:
call h%2_loop_op
movu m3, [r1+r4-2*mmsize] ; movu needed for mc32, etc
paddw m3, [depad2]
psrlw m3, 5
psubw m3, [unpad]
CLIPW m3, m0, m7
pavgw m1, m3
OP_MOV [r0], m1
add r0, r2
dec r3d
jg .h_loop
mov rsp, r6 ; restore stack pointer
ret
%endmacro
MC MC12
;-----------------------------------------------------------------------------
; void ff_h264_qpel_mc32(uint8_t *dst, uint8_t *src, int stride)
;-----------------------------------------------------------------------------
%macro MC32 2
cglobal_mc %1, mc32, %2, 3,7,12
%define PAD mmsize*8*3*2 ; SIZE*16*4*sizeof(pixel)
mov r6, rsp ; backup stack pointer
and rsp, ~(mmsize-1) ; align stack
sub rsp, PAD
call put_hv%2_10
mov r4d, 2 ; sizeof(pixel)
jmp stub_%1_h264_qpel%2_mc12_10 %+ SUFFIX %+ .body
%endmacro
MC MC32
;-----------------------------------------------------------------------------
; void ff_h264_qpel_mc21(uint8_t *dst, uint8_t *src, int stride)
;-----------------------------------------------------------------------------
%macro H_NRD 1
put_h%1_10:
add rsp, gprsize
mov r3d, %1
xor r4d, r4d
mova m6, [pad20]
.nextrow:
movu m2, [r5-4]
movu m3, [r5-2]
movu m4, [r5+0]
ADDW m2, [r5+6], m5
ADDW m3, [r5+4], m5
ADDW m4, [r5+2], m5
FILT_H2 m2, m3, m4
psubw m2, m6
mova [rsp+r4], m2
add r4d, mmsize*3
add r5, r2
dec r3d
jg .nextrow
sub rsp, gprsize
ret
%endmacro
INIT_MMX mmxext
H_NRD 4
INIT_XMM sse2
H_NRD 8
%macro MC21 2
cglobal_mc %1, mc21, %2, 3,7,12
mov r5, r1
.body:
%define PAD mmsize*8*3*2 ; SIZE*16*4*sizeof(pixel)
mov r6, rsp ; backup stack pointer
and rsp, ~(mmsize-1) ; align stack
sub rsp, PAD
call put_h%2_10
sub rsp, PAD
call put_hv%2_10
mov r4d, PAD-mmsize ; H buffer
jmp stub_%1_h264_qpel%2_mc12_10 %+ SUFFIX %+ .body
%endmacro
MC MC21
;-----------------------------------------------------------------------------
; void ff_h264_qpel_mc23(uint8_t *dst, uint8_t *src, int stride)
;-----------------------------------------------------------------------------
%macro MC23 2
cglobal_mc %1, mc23, %2, 3,7,12
lea r5, [r1+r2]
jmp stub_%1_h264_qpel%2_mc21_10 %+ SUFFIX %+ .body
%endmacro
MC MC23
|
; Just probe the memory banks
PROGRAM_ROM = 0
INCLUDE "common.asm"
SAVE "probe.bin", entry_point, end_of_code
|
.text
main:
b next
li $a0, 0
li $v0, 1
syscall
next:
li $a0, 1
li $v0, 1
syscall |
;
; jfdctfst.asm - fast integer FDCT (SSE2)
;
; Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
; Copyright (C) 2016, D. R. Commander.
;
; Based on the x86 SIMD extension for IJG JPEG library
; Copyright (C) 1999-2006, MIYASAKA Masaru.
; For conditions of distribution and use, see copyright notice in jsimdext.inc
;
; This file should be assembled with NASM (Netwide Assembler),
; can *not* be assembled with Microsoft's MASM or any compatible
; assembler (including Borland's Turbo Assembler).
; NASM is available from http://nasm.sourceforge.net/ or
; http://sourceforge.net/project/showfiles.php?group_id=6208
;
; This file contains a fast, not so accurate integer implementation of
; the forward DCT (Discrete Cosine Transform). The following code is
; based directly on the IJG's original jfdctfst.c; see the jfdctfst.c
; for more details.
;
; [TAB8]
%include "jsimdext.inc"
%include "jdct.inc"
; --------------------------------------------------------------------------
%define CONST_BITS 8 ; 14 is also OK.
%if CONST_BITS == 8
F_0_382 equ 98 ; FIX(0.382683433)
F_0_541 equ 139 ; FIX(0.541196100)
F_0_707 equ 181 ; FIX(0.707106781)
F_1_306 equ 334 ; FIX(1.306562965)
%else
; NASM cannot do compile-time arithmetic on floating-point constants.
%define DESCALE(x, n) (((x) + (1 << ((n) - 1))) >> (n))
F_0_382 equ DESCALE( 410903207, 30 - CONST_BITS) ; FIX(0.382683433)
F_0_541 equ DESCALE( 581104887, 30 - CONST_BITS) ; FIX(0.541196100)
F_0_707 equ DESCALE( 759250124, 30 - CONST_BITS) ; FIX(0.707106781)
F_1_306 equ DESCALE(1402911301, 30 - CONST_BITS) ; FIX(1.306562965)
%endif
; --------------------------------------------------------------------------
SECTION SEG_CONST
; PRE_MULTIPLY_SCALE_BITS <= 2 (to avoid overflow)
; CONST_BITS + CONST_SHIFT + PRE_MULTIPLY_SCALE_BITS == 16 (for pmulhw)
%define PRE_MULTIPLY_SCALE_BITS 2
%define CONST_SHIFT (16 - PRE_MULTIPLY_SCALE_BITS - CONST_BITS)
alignz 32
GLOBAL_DATA(jconst_fdct_ifast_sse2)
EXTN(jconst_fdct_ifast_sse2):
PW_F0707 times 8 dw F_0_707 << CONST_SHIFT
PW_F0382 times 8 dw F_0_382 << CONST_SHIFT
PW_F0541 times 8 dw F_0_541 << CONST_SHIFT
PW_F1306 times 8 dw F_1_306 << CONST_SHIFT
alignz 32
; --------------------------------------------------------------------------
SECTION SEG_TEXT
BITS 32
;
; Perform the forward DCT on one block of samples.
;
; GLOBAL(void)
; jsimd_fdct_ifast_sse2(DCTELEM *data)
;
%define data(b) (b) + 8 ; DCTELEM *data
%define original_ebp ebp + 0
%define wk(i) ebp - (WK_NUM - (i)) * SIZEOF_XMMWORD
; xmmword wk[WK_NUM]
%define WK_NUM 2
align 32
GLOBAL_FUNCTION(jsimd_fdct_ifast_sse2)
EXTN(jsimd_fdct_ifast_sse2):
push ebp
mov eax, esp ; eax = original ebp
sub esp, byte 4
and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits
mov [esp], eax
mov ebp, esp ; ebp = aligned ebp
lea esp, [wk(0)]
pushpic ebx
; push ecx ; unused
; push edx ; need not be preserved
; push esi ; unused
; push edi ; unused
get_GOT ebx ; get GOT address
; ---- Pass 1: process rows.
mov edx, POINTER [data(eax)] ; (DCTELEM *)
movdqa xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_DCTELEM)]
movdqa xmm1, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_DCTELEM)]
movdqa xmm2, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_DCTELEM)]
movdqa xmm3, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_DCTELEM)]
; xmm0=(00 01 02 03 04 05 06 07), xmm2=(20 21 22 23 24 25 26 27)
; xmm1=(10 11 12 13 14 15 16 17), xmm3=(30 31 32 33 34 35 36 37)
movdqa xmm4, xmm0 ; transpose coefficients(phase 1)
punpcklwd xmm0, xmm1 ; xmm0=(00 10 01 11 02 12 03 13)
punpckhwd xmm4, xmm1 ; xmm4=(04 14 05 15 06 16 07 17)
movdqa xmm5, xmm2 ; transpose coefficients(phase 1)
punpcklwd xmm2, xmm3 ; xmm2=(20 30 21 31 22 32 23 33)
punpckhwd xmm5, xmm3 ; xmm5=(24 34 25 35 26 36 27 37)
movdqa xmm6, XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_DCTELEM)]
movdqa xmm7, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_DCTELEM)]
movdqa xmm1, XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_DCTELEM)]
movdqa xmm3, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_DCTELEM)]
; xmm6=( 4 12 20 28 36 44 52 60), xmm1=( 6 14 22 30 38 46 54 62)
; xmm7=( 5 13 21 29 37 45 53 61), xmm3=( 7 15 23 31 39 47 55 63)
movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=(20 30 21 31 22 32 23 33)
movdqa XMMWORD [wk(1)], xmm5 ; wk(1)=(24 34 25 35 26 36 27 37)
movdqa xmm2, xmm6 ; transpose coefficients(phase 1)
punpcklwd xmm6, xmm7 ; xmm6=(40 50 41 51 42 52 43 53)
punpckhwd xmm2, xmm7 ; xmm2=(44 54 45 55 46 56 47 57)
movdqa xmm5, xmm1 ; transpose coefficients(phase 1)
punpcklwd xmm1, xmm3 ; xmm1=(60 70 61 71 62 72 63 73)
punpckhwd xmm5, xmm3 ; xmm5=(64 74 65 75 66 76 67 77)
movdqa xmm7, xmm6 ; transpose coefficients(phase 2)
punpckldq xmm6, xmm1 ; xmm6=(40 50 60 70 41 51 61 71)
punpckhdq xmm7, xmm1 ; xmm7=(42 52 62 72 43 53 63 73)
movdqa xmm3, xmm2 ; transpose coefficients(phase 2)
punpckldq xmm2, xmm5 ; xmm2=(44 54 64 74 45 55 65 75)
punpckhdq xmm3, xmm5 ; xmm3=(46 56 66 76 47 57 67 77)
movdqa xmm1, XMMWORD [wk(0)] ; xmm1=(20 30 21 31 22 32 23 33)
movdqa xmm5, XMMWORD [wk(1)] ; xmm5=(24 34 25 35 26 36 27 37)
movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=(42 52 62 72 43 53 63 73)
movdqa XMMWORD [wk(1)], xmm2 ; wk(1)=(44 54 64 74 45 55 65 75)
movdqa xmm7, xmm0 ; transpose coefficients(phase 2)
punpckldq xmm0, xmm1 ; xmm0=(00 10 20 30 01 11 21 31)
punpckhdq xmm7, xmm1 ; xmm7=(02 12 22 32 03 13 23 33)
movdqa xmm2, xmm4 ; transpose coefficients(phase 2)
punpckldq xmm4, xmm5 ; xmm4=(04 14 24 34 05 15 25 35)
punpckhdq xmm2, xmm5 ; xmm2=(06 16 26 36 07 17 27 37)
movdqa xmm1, xmm0 ; transpose coefficients(phase 3)
punpcklqdq xmm0, xmm6 ; xmm0=(00 10 20 30 40 50 60 70)=data0
punpckhqdq xmm1, xmm6 ; xmm1=(01 11 21 31 41 51 61 71)=data1
movdqa xmm5, xmm2 ; transpose coefficients(phase 3)
punpcklqdq xmm2, xmm3 ; xmm2=(06 16 26 36 46 56 66 76)=data6
punpckhqdq xmm5, xmm3 ; xmm5=(07 17 27 37 47 57 67 77)=data7
movdqa xmm6, xmm1
movdqa xmm3, xmm0
psubw xmm1, xmm2 ; xmm1=data1-data6=tmp6
psubw xmm0, xmm5 ; xmm0=data0-data7=tmp7
paddw xmm6, xmm2 ; xmm6=data1+data6=tmp1
paddw xmm3, xmm5 ; xmm3=data0+data7=tmp0
movdqa xmm2, XMMWORD [wk(0)] ; xmm2=(42 52 62 72 43 53 63 73)
movdqa xmm5, XMMWORD [wk(1)] ; xmm5=(44 54 64 74 45 55 65 75)
movdqa XMMWORD [wk(0)], xmm1 ; wk(0)=tmp6
movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=tmp7
movdqa xmm1, xmm7 ; transpose coefficients(phase 3)
punpcklqdq xmm7, xmm2 ; xmm7=(02 12 22 32 42 52 62 72)=data2
punpckhqdq xmm1, xmm2 ; xmm1=(03 13 23 33 43 53 63 73)=data3
movdqa xmm0, xmm4 ; transpose coefficients(phase 3)
punpcklqdq xmm4, xmm5 ; xmm4=(04 14 24 34 44 54 64 74)=data4
punpckhqdq xmm0, xmm5 ; xmm0=(05 15 25 35 45 55 65 75)=data5
movdqa xmm2, xmm1
movdqa xmm5, xmm7
paddw xmm1, xmm4 ; xmm1=data3+data4=tmp3
paddw xmm7, xmm0 ; xmm7=data2+data5=tmp2
psubw xmm2, xmm4 ; xmm2=data3-data4=tmp4
psubw xmm5, xmm0 ; xmm5=data2-data5=tmp5
; -- Even part
movdqa xmm4, xmm3
movdqa xmm0, xmm6
psubw xmm3, xmm1 ; xmm3=tmp13
psubw xmm6, xmm7 ; xmm6=tmp12
paddw xmm4, xmm1 ; xmm4=tmp10
paddw xmm0, xmm7 ; xmm0=tmp11
paddw xmm6, xmm3
psllw xmm6, PRE_MULTIPLY_SCALE_BITS
pmulhw xmm6, [GOTOFF(ebx,PW_F0707)] ; xmm6=z1
movdqa xmm1, xmm4
movdqa xmm7, xmm3
psubw xmm4, xmm0 ; xmm4=data4
psubw xmm3, xmm6 ; xmm3=data6
paddw xmm1, xmm0 ; xmm1=data0
paddw xmm7, xmm6 ; xmm7=data2
movdqa xmm0, XMMWORD [wk(0)] ; xmm0=tmp6
movdqa xmm6, XMMWORD [wk(1)] ; xmm6=tmp7
movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=data4
movdqa XMMWORD [wk(1)], xmm3 ; wk(1)=data6
; -- Odd part
paddw xmm2, xmm5 ; xmm2=tmp10
paddw xmm5, xmm0 ; xmm5=tmp11
paddw xmm0, xmm6 ; xmm0=tmp12, xmm6=tmp7
psllw xmm2, PRE_MULTIPLY_SCALE_BITS
psllw xmm0, PRE_MULTIPLY_SCALE_BITS
psllw xmm5, PRE_MULTIPLY_SCALE_BITS
pmulhw xmm5, [GOTOFF(ebx,PW_F0707)] ; xmm5=z3
movdqa xmm4, xmm2 ; xmm4=tmp10
psubw xmm2, xmm0
pmulhw xmm2, [GOTOFF(ebx,PW_F0382)] ; xmm2=z5
pmulhw xmm4, [GOTOFF(ebx,PW_F0541)] ; xmm4=MULTIPLY(tmp10,FIX_0_541196)
pmulhw xmm0, [GOTOFF(ebx,PW_F1306)] ; xmm0=MULTIPLY(tmp12,FIX_1_306562)
paddw xmm4, xmm2 ; xmm4=z2
paddw xmm0, xmm2 ; xmm0=z4
movdqa xmm3, xmm6
psubw xmm6, xmm5 ; xmm6=z13
paddw xmm3, xmm5 ; xmm3=z11
movdqa xmm2, xmm6
movdqa xmm5, xmm3
psubw xmm6, xmm4 ; xmm6=data3
psubw xmm3, xmm0 ; xmm3=data7
paddw xmm2, xmm4 ; xmm2=data5
paddw xmm5, xmm0 ; xmm5=data1
; ---- Pass 2: process columns.
; mov edx, POINTER [data(eax)] ; (DCTELEM *)
; xmm1=(00 10 20 30 40 50 60 70), xmm7=(02 12 22 32 42 52 62 72)
; xmm5=(01 11 21 31 41 51 61 71), xmm6=(03 13 23 33 43 53 63 73)
movdqa xmm4, xmm1 ; transpose coefficients(phase 1)
punpcklwd xmm1, xmm5 ; xmm1=(00 01 10 11 20 21 30 31)
punpckhwd xmm4, xmm5 ; xmm4=(40 41 50 51 60 61 70 71)
movdqa xmm0, xmm7 ; transpose coefficients(phase 1)
punpcklwd xmm7, xmm6 ; xmm7=(02 03 12 13 22 23 32 33)
punpckhwd xmm0, xmm6 ; xmm0=(42 43 52 53 62 63 72 73)
movdqa xmm5, XMMWORD [wk(0)] ; xmm5=col4
movdqa xmm6, XMMWORD [wk(1)] ; xmm6=col6
; xmm5=(04 14 24 34 44 54 64 74), xmm6=(06 16 26 36 46 56 66 76)
; xmm2=(05 15 25 35 45 55 65 75), xmm3=(07 17 27 37 47 57 67 77)
movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=(02 03 12 13 22 23 32 33)
movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=(42 43 52 53 62 63 72 73)
movdqa xmm7, xmm5 ; transpose coefficients(phase 1)
punpcklwd xmm5, xmm2 ; xmm5=(04 05 14 15 24 25 34 35)
punpckhwd xmm7, xmm2 ; xmm7=(44 45 54 55 64 65 74 75)
movdqa xmm0, xmm6 ; transpose coefficients(phase 1)
punpcklwd xmm6, xmm3 ; xmm6=(06 07 16 17 26 27 36 37)
punpckhwd xmm0, xmm3 ; xmm0=(46 47 56 57 66 67 76 77)
movdqa xmm2, xmm5 ; transpose coefficients(phase 2)
punpckldq xmm5, xmm6 ; xmm5=(04 05 06 07 14 15 16 17)
punpckhdq xmm2, xmm6 ; xmm2=(24 25 26 27 34 35 36 37)
movdqa xmm3, xmm7 ; transpose coefficients(phase 2)
punpckldq xmm7, xmm0 ; xmm7=(44 45 46 47 54 55 56 57)
punpckhdq xmm3, xmm0 ; xmm3=(64 65 66 67 74 75 76 77)
movdqa xmm6, XMMWORD [wk(0)] ; xmm6=(02 03 12 13 22 23 32 33)
movdqa xmm0, XMMWORD [wk(1)] ; xmm0=(42 43 52 53 62 63 72 73)
movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=(24 25 26 27 34 35 36 37)
movdqa XMMWORD [wk(1)], xmm7 ; wk(1)=(44 45 46 47 54 55 56 57)
movdqa xmm2, xmm1 ; transpose coefficients(phase 2)
punpckldq xmm1, xmm6 ; xmm1=(00 01 02 03 10 11 12 13)
punpckhdq xmm2, xmm6 ; xmm2=(20 21 22 23 30 31 32 33)
movdqa xmm7, xmm4 ; transpose coefficients(phase 2)
punpckldq xmm4, xmm0 ; xmm4=(40 41 42 43 50 51 52 53)
punpckhdq xmm7, xmm0 ; xmm7=(60 61 62 63 70 71 72 73)
movdqa xmm6, xmm1 ; transpose coefficients(phase 3)
punpcklqdq xmm1, xmm5 ; xmm1=(00 01 02 03 04 05 06 07)=data0
punpckhqdq xmm6, xmm5 ; xmm6=(10 11 12 13 14 15 16 17)=data1
movdqa xmm0, xmm7 ; transpose coefficients(phase 3)
punpcklqdq xmm7, xmm3 ; xmm7=(60 61 62 63 64 65 66 67)=data6
punpckhqdq xmm0, xmm3 ; xmm0=(70 71 72 73 74 75 76 77)=data7
movdqa xmm5, xmm6
movdqa xmm3, xmm1
psubw xmm6, xmm7 ; xmm6=data1-data6=tmp6
psubw xmm1, xmm0 ; xmm1=data0-data7=tmp7
paddw xmm5, xmm7 ; xmm5=data1+data6=tmp1
paddw xmm3, xmm0 ; xmm3=data0+data7=tmp0
movdqa xmm7, XMMWORD [wk(0)] ; xmm7=(24 25 26 27 34 35 36 37)
movdqa xmm0, XMMWORD [wk(1)] ; xmm0=(44 45 46 47 54 55 56 57)
movdqa XMMWORD [wk(0)], xmm6 ; wk(0)=tmp6
movdqa XMMWORD [wk(1)], xmm1 ; wk(1)=tmp7
movdqa xmm6, xmm2 ; transpose coefficients(phase 3)
punpcklqdq xmm2, xmm7 ; xmm2=(20 21 22 23 24 25 26 27)=data2
punpckhqdq xmm6, xmm7 ; xmm6=(30 31 32 33 34 35 36 37)=data3
movdqa xmm1, xmm4 ; transpose coefficients(phase 3)
punpcklqdq xmm4, xmm0 ; xmm4=(40 41 42 43 44 45 46 47)=data4
punpckhqdq xmm1, xmm0 ; xmm1=(50 51 52 53 54 55 56 57)=data5
movdqa xmm7, xmm6
movdqa xmm0, xmm2
paddw xmm6, xmm4 ; xmm6=data3+data4=tmp3
paddw xmm2, xmm1 ; xmm2=data2+data5=tmp2
psubw xmm7, xmm4 ; xmm7=data3-data4=tmp4
psubw xmm0, xmm1 ; xmm0=data2-data5=tmp5
; -- Even part
movdqa xmm4, xmm3
movdqa xmm1, xmm5
psubw xmm3, xmm6 ; xmm3=tmp13
psubw xmm5, xmm2 ; xmm5=tmp12
paddw xmm4, xmm6 ; xmm4=tmp10
paddw xmm1, xmm2 ; xmm1=tmp11
paddw xmm5, xmm3
psllw xmm5, PRE_MULTIPLY_SCALE_BITS
pmulhw xmm5, [GOTOFF(ebx,PW_F0707)] ; xmm5=z1
movdqa xmm6, xmm4
movdqa xmm2, xmm3
psubw xmm4, xmm1 ; xmm4=data4
psubw xmm3, xmm5 ; xmm3=data6
paddw xmm6, xmm1 ; xmm6=data0
paddw xmm2, xmm5 ; xmm2=data2
movdqa XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_DCTELEM)], xmm4
movdqa XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_DCTELEM)], xmm3
movdqa XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_DCTELEM)], xmm6
movdqa XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_DCTELEM)], xmm2
; -- Odd part
movdqa xmm1, XMMWORD [wk(0)] ; xmm1=tmp6
movdqa xmm5, XMMWORD [wk(1)] ; xmm5=tmp7
paddw xmm7, xmm0 ; xmm7=tmp10
paddw xmm0, xmm1 ; xmm0=tmp11
paddw xmm1, xmm5 ; xmm1=tmp12, xmm5=tmp7
psllw xmm7, PRE_MULTIPLY_SCALE_BITS
psllw xmm1, PRE_MULTIPLY_SCALE_BITS
psllw xmm0, PRE_MULTIPLY_SCALE_BITS
pmulhw xmm0, [GOTOFF(ebx,PW_F0707)] ; xmm0=z3
movdqa xmm4, xmm7 ; xmm4=tmp10
psubw xmm7, xmm1
pmulhw xmm7, [GOTOFF(ebx,PW_F0382)] ; xmm7=z5
pmulhw xmm4, [GOTOFF(ebx,PW_F0541)] ; xmm4=MULTIPLY(tmp10,FIX_0_541196)
pmulhw xmm1, [GOTOFF(ebx,PW_F1306)] ; xmm1=MULTIPLY(tmp12,FIX_1_306562)
paddw xmm4, xmm7 ; xmm4=z2
paddw xmm1, xmm7 ; xmm1=z4
movdqa xmm3, xmm5
psubw xmm5, xmm0 ; xmm5=z13
paddw xmm3, xmm0 ; xmm3=z11
movdqa xmm6, xmm5
movdqa xmm2, xmm3
psubw xmm5, xmm4 ; xmm5=data3
psubw xmm3, xmm1 ; xmm3=data7
paddw xmm6, xmm4 ; xmm6=data5
paddw xmm2, xmm1 ; xmm2=data1
movdqa XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_DCTELEM)], xmm5
movdqa XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_DCTELEM)], xmm3
movdqa XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_DCTELEM)], xmm6
movdqa XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_DCTELEM)], xmm2
; pop edi ; unused
; pop esi ; unused
; pop edx ; need not be preserved
; pop ecx ; unused
poppic ebx
mov esp, ebp ; esp <- aligned ebp
pop esp ; esp <- original ebp
pop ebp
ret
; For some reason, the OS X linker does not honor the request to align the
; segment unless we do this.
align 32
|
/*
* Copyright (c) 2020-2021, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* ---------------------------------------------------------------------------*
* @brief wrapper calling gunrock's HITS analytic
* --------------------------------------------------------------------------*/
#include <cugraph/algorithms.hpp>
#include <cugraph/graph.hpp>
#include <cugraph/utilities/error.hpp>
#include <gunrock/gunrock.h>
namespace cugraph {
namespace gunrock {
const int HOST{1}; // gunrock should expose the device constant at the API level.
const int DEVICE{2}; // gunrock should expose the device constant at the API level.
template <typename vertex_t, typename edge_t, typename weight_t>
void hits(cugraph::GraphCSRView<vertex_t, edge_t, weight_t> const &graph,
int max_iter,
weight_t tolerance,
weight_t const *starting_value,
bool normalized,
weight_t *hubs,
weight_t *authorities)
{
CUGRAPH_EXPECTS(hubs != nullptr, "Invalid input argument: hubs array should be of size V");
CUGRAPH_EXPECTS(authorities != nullptr,
"Invalid input argument: authorities array should be of size V");
//
// NOTE: gunrock doesn't support passing a starting value
//
::hits(graph.number_of_vertices,
graph.number_of_edges,
graph.offsets,
graph.indices,
max_iter,
tolerance,
HITS_NORMALIZATION_METHOD_1,
hubs,
authorities,
DEVICE);
}
template void hits(cugraph::GraphCSRView<int32_t, int32_t, float> const &,
int,
float,
float const *,
bool,
float *,
float *);
} // namespace gunrock
} // namespace cugraph
|
/*
* GAMS - General Algebraic Modeling System C++ API
*
* Copyright (c) 2017-2021 GAMS Software GmbH <support@gams.com>
* Copyright (c) 2017-2021 GAMS Development Corp. <support@gams.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include "gams.h"
#include <iostream>
#include <map>
#include <tuple>
#include <vector>
using namespace gams;
using namespace std;
/// Get model as string
string getBaseModelText()
{
return "$onempty \n"
" Sets \n"
" i(*) canning plants / / \n"
" j(*) markets / / \n"
" \n"
" Parameters \n"
" a(i) capacity of plant i in cases / / \n"
" b(j) demand at market j in cases / / \n"
" d(i,j) distance in thousands of miles / / \n"
" Scalar f freight in dollars per case per thousand miles /0/; \n"
" \n"
" Parameter c(i,j) transport cost in thousands of dollars per case ; \n"
" \n"
" c(i,j) = f * d(i,j) / 1000 ; \n"
" \n"
" Variables \n"
" x(i,j) shipment quantities in cases \n"
" z total transportation costs in thousands of dollars ; \n"
" \n"
" Positive Variable x ; \n"
" \n"
" Equations \n"
" cost define objective function \n"
" supply(i) observe supply limit at plant i \n"
" demand(j) satisfy demand at market j ; \n"
" \n"
" cost .. z =e= sum((i,j), c(i,j)*x(i,j)) ; \n"
" \n"
" supply(i) .. sum(j, x(i,j)) =l= a(i) ; \n"
" \n"
" demand(j) .. sum(i, x(i,j)) =g= b(j) ; \n"
" \n"
" Model transport /all/ ; \n"
" \n"
" Solve transport using lp minimizing z ; \n";
}
/// Get model as string
string getModelText()
{
return "$if not set gdxincname $abort 'no include file name for data file provided'\n"
"$gdxin %gdxincname% \n"
"$onMulti \n"
"$load i j a b d f \n"
"$gdxin \n"
" \n"
" Display x.l, x.m ; \n";
}
/// Create Save and Restart checkpoint
void createSaveRestart(int argc, char* argv[], const string &checkpointName)
{
GAMSWorkspaceInfo wsInfo;
if (argc > 1)
wsInfo.setSystemDirectory(argv[1]);
wsInfo.setWorkingDirectory("." +(cPathSep+ checkpointName));
GAMSWorkspace ws(wsInfo);
GAMSJob j1 = ws.addJobFromString(getBaseModelText());
GAMSOptions opt = ws.addOptions();
opt.setAction(GAMSOptions::EAction::CompileOnly);
auto checkpoint = ws.workingDirectory() + cPathSep + checkpointName;
GAMSCheckpoint cp = ws.addCheckpoint(checkpoint);
j1.run(opt, cp);
}
/// \file transport11.cpp
/// \brief This is the 11th model in a series of tutorial examples.
///
/// Here we show:
/// - How to create and use a save/restart file
int main(int argc, char* argv[])
{
cout << "---------- Transport 11 --------------" << endl;
try {
// Create a save/restart file usually supplied by an application provider
// We create it for demonstration purpose
std::string cpName = "tbase";
createSaveRestart(argc, argv, cpName);
// define some data by using C++ data structures
vector<string> plants { "Seattle", "San-Diego" };
vector<string> markets {"New-York", "Chicago", "Topeka" };
map<string, double> capacity {
{ "Seattle", 350.0 }, { "San-Diego", 600.0 }
};
map<string, double> demand {
{ "New-York", 325.0 }, { "Chicago", 300.0 }, { "Topeka", 275.0 }
};
map<tuple<string,string>, double> distance {
{ make_tuple("Seattle", "New-York"), 2.5 },
{ make_tuple("Seattle", "Chicago"), 1.7 },
{ make_tuple("Seattle", "Topeka"), 1.8 },
{ make_tuple("San-Diego", "New-York"), 2.5 },
{ make_tuple("San-Diego", "Chicago"), 1.8 },
{ make_tuple("San-Diego", "Topeka"), 1.4 }
};
GAMSWorkspaceInfo wsInfo;
if (argc > 1)
wsInfo.setSystemDirectory(argv[1]);
wsInfo.setWorkingDirectory("." +(cPathSep+ cpName));
GAMSWorkspace ws(wsInfo);
ws.gamsLib("trnsport");
// prepare a GAMSDatabase with data from the C++ data structures
GAMSDatabase db = ws.addDatabase();
GAMSSet i = db.addSet("i", 1, "canning plants");
for (auto plant : plants)
i.addRecord(plant);
GAMSSet j = db.addSet("j", 1, "markets");
for (auto market : markets)
j.addRecord(market);
GAMSParameter a = db.addParameter("a", "capacity of plant i in cases", i);
for (auto plant : plants)
a.addRecord(plant).setValue(capacity[plant]);
GAMSParameter b = db.addParameter("b", "demand at market j in cases", j);
for (auto market : markets)
b.addRecord(market).setValue(demand[market]);
GAMSParameter d = db.addParameter("d", "distance in thousands of miles", i, j);
for (auto t : distance) {
auto tuple = t.first;
auto t1 = get<0>(tuple);
auto t2 = get<1>(tuple);
d.addRecord(t1, t2).setValue(distance[tuple]);
}
GAMSParameter f = db.addParameter("f", "freight in dollars per case per thousand miles");
f.addRecord().setValue(90);
// run a job using data from the created GAMSDatabase
GAMSCheckpoint cpBase = ws.addCheckpoint("tbase");
GAMSOptions opt = ws.addOptions();
GAMSJob t4 = ws.addJobFromString(getModelText(), cpBase);
opt.setDefine("gdxincname", db.name());
opt.setAllModelTypes("xpress");
t4.run(opt, db);
for (auto record : t4.outDB().getVariable("x"))
cout << "x(" << record.key(0) << "," << record.key(1) << "): level=" << record.level() <<
" marginal=" << record.marginal() << endl;
} catch (GAMSException &ex) {
cout << "GAMSException occured: " << ex.what() << endl;
} catch (exception &ex) {
cout << ex.what() << endl;
}
return 0;
}
|
global IHT_calc3DByteDepthBackProject_ASM
extern GLOBAL_startTimer
extern GLOBAL_stopTimer
%define PIXELS_PER_ITER 5
%define CHANNELS 3
section .data
align 16
section .text
; rdi-->r12 imgdata
; rsi-->r13 histdata
; rdx-->r14 resdata
; rcx-->r15 imgrows
; r8-->rax imgcols
; r9-->rbx imgstep
; r9 i
; r10 j
IHT_calc3DByteDepthBackProject_ASM:
push r12 ; aligned
push r13 ; unaligned
push r14 ; aligned
push r15 ; unaligned
push rbx ; aligned
mov r12, rdi ; r12 <-- imgdata
mov r13, rsi ; r13 <-- histdata
mov r14, rdx ; r14 <-- resdata
mov r15, rcx ; r15 <-- imgrows
mov rbx, r9 ; rbx <-- imgstep
sub rsp, 16
mov [rsp], r8d
call GLOBAL_startTimer
mov r8d, [rsp]
add rsp, 16
mov eax, r8d ; rax <-- imgcols
lea r11, [rax+rax*2] ; r11 now contains imgcols * 3
sub rbx, r11 ; rbx now contains padding
; i = 0
xor r9, r9
.rows_loop:
xor r10, r10
.cols_loop:
; xmm0 = x|r4|g4|b4|r3|g3|b3|r2|g2|b2|r1|g1|b1|r0|g0|b0
movdqu xmm0, [r12]
movd r11d, xmm0 ; r11 <-- g2 b2 r1 g1 b1 r0 g0 b0
and r11, 0x0000000000FFFFFF ; r11 <-- 0 0 0 0 0 r0 g0 b0
movzx rdi, word [r13 + 2*r11] ; leave in position 0
psrldq xmm0, 3 ; crush p0
movd r11d, xmm0
and r11, 0x0000000000FFFFFF ; r11 <-- 0 0 0 0 0 r1 g1 b1
movzx rsi, word [r13 + 2*r11]
sal rsi, 16 ; place in position 1
psrldq xmm0, 3 ; crush p1
movd r11d, xmm0
and r11, 0x0000000000FFFFFF ; r11 <-- 0 0 0 0 0 r2 g2 b2
movzx rdx, word [r13 + 2*r11]
sal rdx, 32 ; place in position 2
psrldq xmm0, 3 ; crush p2
movd r11d, xmm0
and r11, 0x0000000000FFFFFF ; r11 <-- 0 0 0 0 0 r3 g3 b3
movzx rcx, word [r13 + 2*r11]
sal rcx, 48 ; place in position 3
; junt pixel0,1,2,3 bin values
or rcx, rdi
or rcx, rsi
or rcx, rdx ; rcx <-- p3 p2 p1 p0
movq xmm1, rcx ; xmm1 <-- 0 | 0 | 0 | 0 | p3 | p2 | p1 | p0
psrldq xmm0, 3 ; crush p3
movd r11d, xmm0 ;
and r11, 0x0000000000FFFFFF ; r11 <-- 0 0 0 0 0 r4 g4 b4
movzx rdi, word [r13 + 2*r11] ; rdi ya está libre acá porque se hicieron los or para acomodar rcx
movd xmm2, edi
pslldq xmm2, 8 ; place in position 4
por xmm1, xmm2
; escribo en res
movdqu [r14], xmm1
add r12, 15 ; advance imgdata, 15 = CHANNELS * sizeof(uchar) * PIXELS_PER_ITER
add r14, 10 ; advance resdata POR AHÍ MEJOR índices y usar lea en el loop?
add r10, PIXELS_PER_ITER ; 5 = PIXELS_PER_ITER
lea rdi, [rax - PIXELS_PER_ITER] ; cmp j, vectoriation limit
cmp r10, rdi
jle .cols_loop ; iterate of lower or equal
.end_of_row:
cmp r10, rax
je .next_row
mov edi, dword [r12] ; rdi <-- x | x | x | x | x | r | g | b
and rdi, 0x0000000000FFFFFF ; rdi <-- 0 | 0 | 0 | 0 | 0 | r | g | b
mov di, word [r13 + 2*rdi] ; rdi <-- 0 | 0 | 0 | 0 | 0 | 0 | val val
mov [r14], di
inc r10
add r12, CHANNELS ; increment imgdata by CHANNELS * sizeof(uchar)
add r14, 2 ; increment resdata by SIZEOF(short)
jmp .end_of_row
.next_row:
add r12, rbx ; imgdata += padding | RESDATA SE SUPONE CONTINUO
add r9, 1 ; i += 1
cmp r9, r15
jne .rows_loop
call GLOBAL_stopTimer
pop rbx
pop r15
pop r14
pop r13
pop r12
ret
|
IDD_DLGMENUEDIT equ 1500
IDC_EDTITEMCAPTION equ 2512
IDC_HOTMENU equ 2513
IDC_EDTITEMNAME equ 2516
IDC_EDTITEMID equ 2518
IDC_EDTHELPID equ 2529
IDC_BTNADD equ 2532
IDC_BTNINSERT equ 2519
IDC_BTNDELETE equ 2520
IDC_BTNL equ 2521
IDC_BTNR equ 2522
IDC_BTNU equ 2523
IDC_BTND equ 2524
IDC_BTNMNUPREVIEW equ 2503
IDC_LSTMNU equ 2525
IDC_CHKCHECKED equ 2526
IDC_CHKGRAYED equ 2527
IDC_CHKRIGHTALIGN equ 2500
IDC_CHKRADIO equ 2509
IDC_CHKOWNERDRAW equ 2530
IDD_DLGMNUPREVIEW equ 1510
.data
szMnuErr db 'Menu skipped a level.',0
szMnuName db 'IDR_MENU',0
szMnuItemName db 'IDM_',0
szShift db 'Shift+',0
szCtrl db 'Ctrl+',0
szAlt db 'Alt+',0
hMnuMem dd 0
nMnuInx dd 0
fMnuSel dd FALSE
MnuTabs dd 135,140,145,150,155,160
.data?
lpOldHotProc dd ?
fHotFocus dd ?
lpOldNameEditProc dd ?
.code
MnuSaveDefine proc uses esi,lpName:DWORD,lpID:DWORD
LOCAL buffer[16]:BYTE
LOCAL val:DWORD
mov esi,lpName
mov al,[esi]
.if al
mov esi,lpID
mov eax,[esi]
.if eax
invoke ExportName,lpName,eax,edi
lea edi,[edi+eax]
.endif
.endif
ret
MnuSaveDefine endp
MnuSpc proc val:DWORD
push eax
push ecx
mov eax,val
inc eax
add eax,eax
mov ecx,eax
mov al,' '
rep stosb
pop ecx
pop eax
ret
MnuSpc endp
MnuSaveAccel proc uses esi edi,nAccel:DWORD,lpDest:DWORD
mov esi,nAccel
mov edi,lpDest
shr esi,9
.if CARRY?
invoke SaveStr,edi,offset szShift
add edi,eax
.endif
shr esi,1
.if CARRY?
invoke SaveStr,edi,offset szCtrl
add edi,eax
.endif
shr esi,1
.if CARRY?
invoke SaveStr,edi,offset szAlt
add edi,eax
.endif
mov eax,nAccel
movzx eax,al
.if eax>='A' && eax<='Z'
stosb
.elseif eax>=VK_F1 && eax<=VK_F12
mov byte ptr [edi],'F'
inc edi
sub eax,VK_F1-1
invoke ResEdBinToDec,eax,edi
invoke strlen,edi
lea edi,[edi+eax]
.endif
mov byte ptr [edi],0
mov eax,edi
sub eax,lpDest
ret
MnuSaveAccel endp
ExportMenuNames proc uses esi edi,hMem:DWORD
invoke xGlobalAlloc,GMEM_FIXED or GMEM_ZEROINIT,256*1024
mov edi,eax
invoke GlobalLock,edi
push edi
mov esi,hMem
invoke MnuSaveDefine,addr (MNUHEAD ptr [esi]).menuname,addr (MNUHEAD ptr [esi]).menuid
add esi,sizeof MNUHEAD
@@:
mov eax,(MNUITEM ptr [esi]).itemflag
.if eax
.if eax!=-1
invoke MnuSaveDefine,addr (MNUITEM ptr [esi]).itemname,addr (MNUITEM ptr [esi]).itemid
.endif
add esi,sizeof MNUITEM
jmp @b
.endif
pop eax
ret
ExportMenuNames endp
MnuSaveItemEx proc uses ebx,lpItem:DWORD,fPopUp:DWORD
LOCAL val:DWORD
invoke SaveStr,edi,lpItem
add edi,eax
mov al,' '
stosb
mov al,22h
stosb
.if byte ptr (MNUITEM ptr [esi]).itemcaption!='-'
invoke SaveText,edi,addr (MNUITEM ptr [esi]).itemcaption
add edi,eax
.endif
mov eax,(MNUITEM ptr [esi]).shortcut
.if eax
mov val,eax
mov ax,'t\'
stosw
invoke MnuSaveAccel,val,edi
add edi,eax
.endif
mov al,22h
stosb
mov ebx,edi
mov al,','
stosb
mov al,(MNUITEM ptr [esi]).itemname
.if !al
m2m val,(MNUITEM ptr [esi]).itemid
.if val!=0 && val!=-1
invoke SaveVal,val,FALSE
mov ebx,edi
.endif
.else
invoke SaveStr,edi,addr (MNUITEM ptr [esi]).itemname
add edi,eax
mov ebx,edi
.endif
mov al,','
stosb
;MFT_
mov edx,(MNUITEM ptr [esi]).ntype
.if byte ptr (MNUITEM ptr [esi]).itemcaption=='-'
or edx,MFT_SEPARATOR
.endif
.if edx
invoke SaveHexVal,edx,FALSE
mov ebx,edi
.endif
mov al,','
stosb
;MFS_
mov eax,(MNUITEM ptr [esi]).nstate
.if eax
invoke SaveHexVal,eax,FALSE
mov ebx,edi
.endif
.if fPopUp
;HelpID
mov al,','
stosb
mov eax,(MNUITEM ptr [esi]).helpid
.if eax
invoke SaveVal,eax,FALSE
mov ebx,edi
.endif
.endif
mov edi,ebx
Ex:
mov ax,0A0Dh
stosw
ret
MnuSaveItemEx endp
MenuSkippedLevel proc uses esi,lpMenu:DWORD
LOCAL buffer[256]:BYTE
mov esi,lpMenu
invoke lstrcpy,addr buffer,addr [esi].MNUHEAD.menuname
invoke lstrcat,addr buffer,addr szCrLf
invoke lstrcat,addr buffer,addr szMnuErr
invoke MessageBox,hDEd,addr buffer,addr szAppName,MB_OK or MB_ICONERROR
mov fMenuErr,TRUE
ret
MenuSkippedLevel endp
ExportMenuEx proc uses esi edi,hMem:DWORD
LOCAL val:DWORD
LOCAL level:DWORD
invoke xGlobalAlloc,GMEM_FIXED or GMEM_ZEROINIT,256*1024
mov edi,eax
invoke GlobalLock,edi
push edi
mov esi,hMem
mov al,(MNUHEAD ptr [esi]).menuname
.if al
invoke SaveStr,edi,addr (MNUHEAD ptr [esi]).menuname
add edi,eax
.else
m2m val,(MNUHEAD ptr [esi]).menuid
invoke SaveVal,val,FALSE
.endif
mov al,' '
stosb
invoke SaveStr,edi,addr szMENUEX
add edi,eax
mov ax,0A0Dh
stosw
.if [esi].MNUHEAD.lang.lang || [esi].MNUHEAD.lang.sublang
invoke SaveLanguage,addr [esi].MNUHEAD.lang,edi
add edi,eax
.endif
invoke SaveStr,edi,addr szBEGIN
add edi,eax
mov ax,0A0Dh
stosw
mov level,0
add esi,sizeof MNUHEAD
Nx:
mov eax,(MNUITEM ptr [esi]).itemflag
.if eax
.if eax!=-1
mov eax,(MNUITEM ptr [esi]).level
.if eax!=level
invoke MenuSkippedLevel,hMem
jmp MnExEx
.endif
push esi
@@:
add esi,sizeof MNUITEM
mov eax,(MNUITEM ptr [esi]).itemflag
.if eax
.if eax==-1
jmp @b
.endif
mov eax,(MNUITEM ptr [esi]).level
.endif
mov val,eax
pop esi
invoke MnuSpc,level
.if eax>level
invoke MnuSaveItemEx,addr szPOPUP,TRUE
.else
invoke MnuSaveItemEx,addr szMENUITEM,FALSE
.endif
mov eax,val
.if eax>level
sub eax,level
.if eax!=1
invoke MenuSkippedLevel,hMem
jmp MnExEx
.endif
invoke MnuSpc,level
m2m level,val
invoke SaveStr,edi,addr szBEGIN
add edi,eax
mov ax,0A0Dh
stosw
.elseif eax<level
@@:
mov eax,val
.if eax!=level
dec level
invoke MnuSpc,level
invoke SaveStr,edi,addr szEND
add edi,eax
mov ax,0A0Dh
stosw
jmp @b
.endif
.endif
add esi,sizeof MNUITEM
jmp Nx
.endif
.endif
invoke SaveStr,edi,addr szEND
add edi,eax
mov eax,0A0Dh
stosw
stosd
pop eax
ret
MnExEx:
pop edi
invoke GlobalUnlock,edi
invoke GlobalFree,edi
xor eax,eax
ret
ExportMenuEx endp
MnuSaveItem proc uses ebx,lpItem:DWORD,fPopUp:DWORD
LOCAL val:DWORD
invoke SaveStr,edi,lpItem
add edi,eax
mov al,' '
stosb
.if byte ptr (MNUITEM ptr [esi]).itemcaption=='-' || byte ptr (MNUITEM ptr [esi]).itemcaption==0
invoke SaveStr,edi,offset szSEPARATOR
add edi,eax
.else
mov al,22h
stosb
invoke SaveText,edi,addr (MNUITEM ptr [esi]).itemcaption
add edi,eax
mov eax,(MNUITEM ptr [esi]).shortcut
.if eax
mov val,eax
mov ax,'t\'
stosw
invoke MnuSaveAccel,val,edi
add edi,eax
.endif
mov al,22h
stosb
.if !fPopUp
mov ebx,edi
mov al,','
stosb
mov al,(MNUITEM ptr [esi]).itemname
.if !al
m2m val,(MNUITEM ptr [esi]).itemid
.if val!=0 && val!=-1
invoke SaveVal,val,FALSE
mov ebx,edi
.endif
.else
invoke SaveStr,edi,addr (MNUITEM ptr [esi]).itemname
add edi,eax
mov ebx,edi
.endif
.endif
mov eax,(MNUITEM ptr [esi]).nstate
and eax,MFS_CHECKED
.if eax==MFS_CHECKED
mov al,','
stosb
invoke SaveStr,edi,offset szCHECKED
add edi,eax
.endif
mov eax,(MNUITEM ptr [esi]).nstate
and eax,MFS_GRAYED
.if eax==MFS_GRAYED
mov al,','
stosb
invoke SaveStr,edi,offset szGRAYED
add edi,eax
.endif
mov eax,(MNUITEM ptr [esi]).ntype
and eax,MFT_RIGHTJUSTIFY
.if eax==MFT_RIGHTJUSTIFY
mov al,','
stosb
invoke SaveStr,edi,offset szHELP
add edi,eax
.endif
.endif
mov ax,0A0Dh
stosw
ret
MnuSaveItem endp
ExportMenu proc uses esi edi,hMem:DWORD
LOCAL val:DWORD
LOCAL level:DWORD
mov fMenuErr,FALSE
invoke xGlobalAlloc,GMEM_FIXED or GMEM_ZEROINIT,256*1024
mov edi,eax
invoke GlobalLock,edi
push edi
mov esi,hMem
mov al,(MNUHEAD ptr [esi]).menuname
.if al
invoke SaveStr,edi,addr (MNUHEAD ptr [esi]).menuname
add edi,eax
.else
m2m val,(MNUHEAD ptr [esi]).menuid
invoke SaveVal,val,FALSE
.endif
mov al,' '
stosb
invoke SaveStr,edi,addr szMENU
add edi,eax
mov ax,0A0Dh
stosw
.if [esi].MNUHEAD.lang.lang || [esi].MNUHEAD.lang.sublang
invoke SaveLanguage,addr (MNUHEAD ptr [esi]).lang,edi
add edi,eax
.endif
invoke SaveStr,edi,addr szBEGIN
add edi,eax
mov ax,0A0Dh
stosw
mov level,0
add esi,sizeof MNUHEAD
Nx:
mov eax,(MNUITEM ptr [esi]).itemflag
.if eax
.if eax!=-1
mov eax,(MNUITEM ptr [esi]).level
.if eax!=level
invoke MenuSkippedLevel,hMem
jmp MnExEx
.endif
push esi
@@:
add esi,sizeof MNUITEM
mov eax,(MNUITEM ptr [esi]).itemflag
.if eax
.if eax==-1
jmp @b
.endif
mov eax,(MNUITEM ptr [esi]).level
.endif
mov val,eax
pop esi
invoke MnuSpc,level
.if eax>level
invoke MnuSaveItem,addr szPOPUP,TRUE
.else
invoke MnuSaveItem,addr szMENUITEM,FALSE
.endif
mov eax,val
.if eax>level
sub eax,level
.if eax!=1
invoke MenuSkippedLevel,hMem
jmp MnExEx
.endif
invoke MnuSpc,level
m2m level,val
invoke SaveStr,edi,addr szBEGIN
add edi,eax
mov ax,0A0Dh
stosw
.elseif eax<level
@@:
mov eax,val
.if eax!=level
dec level
invoke MnuSpc,level
invoke SaveStr,edi,addr szEND
add edi,eax
mov ax,0A0Dh
stosw
jmp @b
.endif
.endif
add esi,sizeof MNUITEM
jmp Nx
.endif
.endif
invoke SaveStr,edi,addr szEND
add edi,eax
mov eax,0A0Dh
stosw
stosd
pop eax
ret
MnExEx:
pop edi
invoke GlobalUnlock,edi
invoke GlobalFree,edi
xor eax,eax
ret
ExportMenu endp
MnuGetFreeMem proc uses esi
mov esi,hMnuMem
add esi,sizeof MNUHEAD
sub esi,sizeof MNUITEM
@@:
add esi,sizeof MNUITEM
mov eax,(MNUITEM ptr [esi]).itemflag
.if eax==-1
xor eax,eax
.endif
or eax,eax
jne @b
mov eax,esi
ret
MnuGetFreeMem endp
MnuGetFreeID proc uses esi
LOCAL nId:DWORD
mov esi,hMnuMem
m2m nId,(MNUHEAD ptr [esi]).startid
add esi,sizeof MNUHEAD
sub esi,sizeof MNUITEM
@@:
add esi,sizeof MNUITEM
mov eax,(MNUITEM ptr [esi]).itemflag
cmp eax,-1
je @b
.if eax
mov eax,(MNUITEM ptr [esi]).itemid
.if eax==nId
inc nId
mov esi,hMnuMem
add esi,sizeof MNUHEAD
sub esi,sizeof MNUITEM
.endif
jmp @b
.endif
mov eax,nId
ret
MnuGetFreeID endp
MnuGetMem proc uses esi,hWin:HWND
LOCAL val:DWORD
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_GETCURSEL,0,0
mov nMnuInx,eax
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_GETITEMDATA,nMnuInx,0
.if !eax
.if fMnuSel==FALSE
invoke MnuGetFreeMem
mov esi,eax
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_SETITEMDATA,nMnuInx,esi
mov (MNUITEM ptr [esi]).itemflag,1
invoke GetDlgItemText,hWin,IDC_EDTITEMCAPTION,addr (MNUITEM ptr [esi]).itemcaption,64
invoke GetDlgItemText,hWin,IDC_EDTITEMNAME,addr (MNUITEM ptr [esi]).itemname,MaxName
invoke GetDlgItemInt,hWin,IDC_EDTITEMID,addr val,FALSE
m2m (MNUITEM ptr [esi]).itemid,eax
mov eax,nMnuInx
.if eax
dec eax
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_GETITEMDATA,eax,0
mov eax,[eax].MNUITEM.level
mov [esi].MNUITEM.level,eax
.endif
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_GETCOUNT,0,0
.if eax
dec eax
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_GETITEMDATA,eax,0
.if eax
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_ADDSTRING,0,addr szNULL
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_SETITEMDATA,eax,0
.endif
.endif
mov eax,esi
.endif
.endif
ret
MnuGetMem endp
MenuUpdateMem proc uses esi edi,hWin:HWND
LOCAL hMem:DWORD
LOCAL nInx:DWORD
invoke xGlobalAlloc,GMEM_FIXED or GMEM_ZEROINIT,MaxMem
mov hMem,eax
invoke GlobalLock,hMem
mov esi,hMnuMem
mov edi,hMem
mov ecx,sizeof MNUHEAD
rep movsb
mov nInx,0
@@:
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_GETITEMDATA,nInx,0
.if eax!=LB_ERR
.if eax
mov esi,eax
mov eax,(MNUITEM ptr [esi]).itemflag
.if eax!=-1
mov ecx,sizeof MNUITEM
rep movsb
.endif
.endif
inc nInx
jmp @b
.endif
mov eax,hMem
ret
MenuUpdateMem endp
MenuUpdate proc uses esi edi,hWin:HWND
LOCAL hMem:DWORD
LOCAL nInx:DWORD
invoke MenuUpdateMem,hWin
mov hMem,eax
mov esi,hMem
mov edi,hMnuMem
mov ecx,MaxMem/4
rep movsd
invoke GlobalUnlock,hMem
invoke GlobalFree,hMem
mov esi,hMnuMem
lea esi,[esi+sizeof MNUHEAD]
mov nInx,0
@@:
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_GETITEMDATA,nInx,0
.if eax!=LB_ERR
.if eax && eax!=-1
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_SETITEMDATA,nInx,esi
lea esi,[esi+sizeof MNUITEM]
.endif
inc nInx
jmp @b
.endif
ret
MenuUpdate endp
HotProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM, lParam:LPARAM
LOCAL msg:MSG
mov eax,uMsg
.if eax==WM_SETFOCUS
invoke CallWindowProc,lpOldHotProc,hWin,uMsg,wParam,lParam
mov fHotFocus,TRUE
.while fHotFocus
invoke GetMessage,addr msg,NULL,0,0
.BREAK .if !eax
invoke IsDialogMessage,hDialog,addr msg
.if !eax
invoke TranslateMessage,addr msg
invoke DispatchMessage,addr msg
.endif
.endw
.elseif eax==WM_KILLFOCUS
mov fHotFocus,FALSE
.else
invoke CallWindowProc,lpOldHotProc,hWin,uMsg,wParam,lParam
.endif
ret
HotProc endp
ItemNameEditProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM, lParam:LPARAM
LOCAL msg:MSG
mov eax,uMsg
.if eax==WM_CHAR
invoke IsCharAlphaNumeric,wParam
mov edx,wParam
.if !eax && edx!='_' && edx!=VK_BACK && edx!=01h && edx!=03h && edx!=16h && edx!=1Ah
xor eax,eax
jmp Ex
.endif
.endif
invoke CallWindowProc,lpOldNameEditProc,hWin,uMsg,wParam,lParam
Ex:
ret
ItemNameEditProc endp
DlgMnuPreviewProc proc uses esi edi,hWin:HWND,uMsg:UINT,wParam:WPARAM, lParam:LPARAM
mov eax,uMsg
.if eax==WM_INITDIALOG
invoke MakeMnuBar,lParam
invoke SetMenu,hWin,eax
.elseif eax==WM_CLOSE
invoke GetMenu,hWin
invoke DestroyMenu,eax
invoke EndDialog,hWin,wParam
.elseif eax==WM_COMMAND
mov edx,wParam
movzx eax,dx
shr edx,16
.if edx==BN_CLICKED
.if eax==IDCANCEL
invoke SendMessage,hWin,WM_CLOSE,FALSE,0
.endif
.endif
.elseif eax==WM_SIZE
invoke GetDlgItem,hWin,IDCANCEL
mov edx,lParam
movzx ecx,dx
shr edx,16
sub ecx,66
sub edx,23
invoke MoveWindow,eax,ecx,edx,64,21,TRUE
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
DlgMnuPreviewProc endp
DlgMenuEditProc proc uses esi edi,hWin:HWND,uMsg:UINT,wParam:WPARAM, lParam:LPARAM
LOCAL hCtl:DWORD
LOCAL buffer[64]:byte
LOCAL buffer1[256]:byte
LOCAL val:DWORD
LOCAL rect:RECT
LOCAL hMem:DWORD
mov eax,uMsg
.if eax==WM_INITDIALOG
mov eax,lParam
mov hMnuMem,eax
invoke SendDlgItemMessage,hWin,IDC_EDTITEMCAPTION,EM_LIMITTEXT,63,0
invoke SendDlgItemMessage,hWin,IDC_EDTITEMNAME,EM_LIMITTEXT,MaxName-1,0
invoke SendDlgItemMessage,hWin,IDC_EDTITEMID,EM_LIMITTEXT,5,0
invoke SendDlgItemMessage,hWin,IDC_EDTHELPID,EM_LIMITTEXT,5,0
invoke GetDlgItem,hWin,IDC_BTNL
mov hCtl,eax
invoke ImageList_GetIcon,hMnuIml,0,ILD_NORMAL
invoke SendMessage,hCtl,BM_SETIMAGE,IMAGE_ICON,eax
invoke GetDlgItem,hWin,IDC_BTNR
mov hCtl,eax
invoke ImageList_GetIcon,hMnuIml,1,ILD_NORMAL
invoke SendMessage,hCtl,BM_SETIMAGE,IMAGE_ICON,eax
invoke GetDlgItem,hWin,IDC_BTNU
mov hCtl,eax
invoke ImageList_GetIcon,hMnuIml,2,ILD_NORMAL
invoke SendMessage,hCtl,BM_SETIMAGE,IMAGE_ICON,eax
invoke GetDlgItem,hWin,IDC_BTND
mov hCtl,eax
invoke ImageList_GetIcon,hMnuIml,3,ILD_NORMAL
invoke SendMessage,hCtl,BM_SETIMAGE,IMAGE_ICON,eax
mov esi,hMnuMem
invoke GetDlgItem,hWin,IDC_LSTMNU
mov hCtl,eax
invoke SendMessage,hCtl,LB_SETTABSTOPS,6,addr MnuTabs
add esi,sizeof MNUHEAD
mov nMnuInx,0
@@:
mov eax,(MNUITEM ptr [esi]).itemflag
.if eax
invoke SendMessage,hCtl,LB_INSERTSTRING,nMnuInx,addr szNULL
invoke SendMessage,hCtl,LB_SETITEMDATA,nMnuInx,esi
invoke SendMessage,hCtl,LB_SETCURSEL,nMnuInx,0
mov eax,LBN_SELCHANGE
shl eax,16
or eax,IDC_LSTMNU
invoke SendMessage,hWin,WM_COMMAND,eax,0
add esi,sizeof MNUITEM
inc nMnuInx
jmp @b
.endif
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_ADDSTRING,0,addr szNULL
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_SETITEMDATA,eax,0
;=================================
; *** MOD 22.1.2012 width 800 pixel for HSCROLLBAR
invoke SendDlgItemMessage, hWin, IDC_LSTMNU, LB_SETHORIZONTALEXTENT, 800, 0
; ================================
mov nMnuInx,0
invoke SendMessage,hCtl,LB_SETCURSEL,nMnuInx,0
mov eax,LBN_SELCHANGE
shl eax,16
or eax,IDC_LSTMNU
invoke SendMessage,hWin,WM_COMMAND,eax,0
mov esi,hMnuMem
mov lpResType,offset szMENU
lea eax,[esi].MNUHEAD.menuname
mov lpResName,eax
lea eax,[esi].MNUHEAD.menuid
mov lpResID,eax
lea eax,[esi].MNUHEAD.startid
mov lpResStartID,eax
lea eax,[esi].MNUHEAD.lang
mov lpResLang,eax
lea eax,[esi].MNUHEAD.menuex
mov lpResMenuEx,eax
invoke PropertyList,-7
mov fNoScroll,TRUE
invoke ShowScrollBar,hDEd,SB_BOTH,FALSE
invoke SendMessage,hWin,WM_SIZE,0,0
mov fDialogChanged,FALSE
invoke GetDlgItem,hWin,IDC_HOTMENU
invoke SetWindowLong,eax,GWL_WNDPROC,offset HotProc
mov lpOldHotProc,eax
invoke GetDlgItem,hWin,IDC_EDTITEMNAME
invoke SetWindowLong,eax,GWL_WNDPROC,offset ItemNameEditProc
mov lpOldNameEditProc,eax
.elseif eax==WM_CLOSE
mov fNoScroll,FALSE
invoke ShowScrollBar,hDEd,SB_BOTH,TRUE
invoke DestroyWindow,hWin
.elseif eax==WM_COMMAND
mov edx,wParam
movzx eax,dx
shr edx,16
.if edx==BN_CLICKED
.if eax==IDCANCEL
invoke SendMessage,hWin,WM_CLOSE,FALSE,0
invoke PropertyList,0
.elseif eax==IDOK
invoke GetWindowLong,hWin,GWL_USERDATA
mov esi,eax
invoke GetProjectItemName,esi,addr buffer1
invoke SetProjectItemName,esi,addr buffer1
.if fDialogChanged
mov fDialogChanged,FALSE
invoke MenuUpdate,hWin
invoke SendMessage,hRes,PRO_SETMODIFY,TRUE,0
.endif
.elseif eax==IDC_BTNL
invoke MnuGetMem,hWin
.if eax
mov esi,eax
mov eax,(MNUITEM ptr[esi]).level
.if eax
dec (MNUITEM ptr[esi]).level
invoke SendMessage,hWin,WM_COMMAND,(EN_CHANGE shl 16) or IDC_EDTITEMCAPTION,0
mov fDialogChanged,TRUE
.endif
.endif
.elseif eax==IDC_BTNR
invoke MnuGetMem,hWin
.if eax
mov esi,eax
mov eax,(MNUITEM ptr[esi]).level
.if eax<5
inc (MNUITEM ptr[esi]).level
invoke SendMessage,hWin,WM_COMMAND,(EN_CHANGE shl 16) or IDC_EDTITEMCAPTION,0
mov fDialogChanged,TRUE
.endif
.endif
.elseif eax==IDC_BTNU
.if nMnuInx
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_GETITEMDATA,nMnuInx,0
.if eax
mov esi,eax
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_DELETESTRING,nMnuInx,0
dec nMnuInx
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_INSERTSTRING,nMnuInx,addr szNULL
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_SETITEMDATA,nMnuInx,esi
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_SETCURSEL,nMnuInx,0
invoke SendMessage,hWin,WM_COMMAND,(LBN_SELCHANGE shl 16) or IDC_LSTMNU,0
mov fDialogChanged,TRUE
.endif
.endif
.elseif eax==IDC_BTND
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_GETCOUNT,0,0
dec eax
.if eax!=nMnuInx
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_GETITEMDATA,nMnuInx,0
.if eax
mov esi,eax
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_DELETESTRING,nMnuInx,0
inc nMnuInx
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_INSERTSTRING,nMnuInx,addr szNULL
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_SETITEMDATA,nMnuInx,esi
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_SETCURSEL,nMnuInx,0
invoke SendMessage,hWin,WM_COMMAND,(LBN_SELCHANGE shl 16) or IDC_LSTMNU,0
mov fDialogChanged,TRUE
.endif
.endif
.elseif eax==IDC_BTNADD
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_GETCOUNT,0,0
dec eax
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_SETCURSEL,eax,0
invoke SendMessage,hWin,WM_COMMAND,(LBN_SELCHANGE shl 16) or IDC_LSTMNU,0
mov fDialogChanged,TRUE
.elseif eax==IDC_BTNINSERT
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_GETCURSEL,0,0
mov nMnuInx,eax
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_GETITEMDATA,eax,0
.if eax
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_INSERTSTRING,nMnuInx,addr szNULL
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_SETCURSEL,nMnuInx,0
invoke SendMessage,hWin,WM_COMMAND,(LBN_SELCHANGE shl 16) or IDC_LSTMNU,0
mov fDialogChanged,TRUE
.endif
.elseif eax==IDC_BTNDELETE
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_GETCOUNT,0,0
dec eax
.if eax!=nMnuInx
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_GETITEMDATA,nMnuInx,0
.if eax
mov esi,eax
mov (MNUITEM ptr [esi]).itemflag,-1
mov fDialogChanged,TRUE
.endif
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_DELETESTRING,nMnuInx,0
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_SETCURSEL,nMnuInx,0
.if eax!=LB_ERR
invoke SendMessage,hWin,WM_COMMAND,(LBN_SELCHANGE shl 16) or IDC_LSTMNU,0
.endif
.endif
.elseif eax==IDC_BTNMNUPREVIEW
invoke MenuUpdateMem,hWin
mov hMem,eax
invoke DialogBoxParam,hInstance,IDD_DLGMNUPREVIEW,hWin,addr DlgMnuPreviewProc,hMem
invoke GlobalUnlock,hMem
invoke GlobalFree,hMem
.elseif eax==IDC_CHKCHECKED
invoke MnuGetMem,hWin
.if eax
mov esi,eax
and (MNUITEM ptr [esi]).nstate,-1 xor MFS_CHECKED
invoke SendDlgItemMessage,hWin,IDC_CHKCHECKED,BM_GETCHECK,0,0
.if eax==BST_CHECKED
or (MNUITEM ptr [esi]).nstate,MFS_CHECKED
.endif
.if !fMnuSel
mov fDialogChanged,TRUE
.endif
.endif
.elseif eax==IDC_CHKGRAYED
invoke MnuGetMem,hWin
.if eax
mov esi,eax
and (MNUITEM ptr [esi]).nstate,-1 xor MFS_GRAYED
invoke SendDlgItemMessage,hWin,IDC_CHKGRAYED,BM_GETCHECK,0,0
.if eax==BST_CHECKED
or (MNUITEM ptr [esi]).nstate,MFS_GRAYED
.endif
.if !fMnuSel
mov fDialogChanged,TRUE
.endif
.endif
.elseif eax==IDC_CHKRIGHTALIGN
invoke MnuGetMem,hWin
.if eax
mov esi,eax
and (MNUITEM ptr [esi]).ntype,-1 xor MFT_RIGHTJUSTIFY
invoke SendDlgItemMessage,hWin,IDC_CHKRIGHTALIGN,BM_GETCHECK,0,0
.if eax==BST_CHECKED
or (MNUITEM ptr [esi]).ntype,MFT_RIGHTJUSTIFY
.endif
.if !fMnuSel
mov fDialogChanged,TRUE
.endif
.endif
.elseif eax==IDC_CHKRADIO
invoke MnuGetMem,hWin
.if eax
mov esi,eax
and (MNUITEM ptr [esi]).ntype,-1 xor MFT_RADIOCHECK
invoke SendDlgItemMessage,hWin,IDC_CHKRADIO,BM_GETCHECK,0,0
.if eax==BST_CHECKED
or (MNUITEM ptr [esi]).ntype,MFT_RADIOCHECK
.endif
.if !fMnuSel
mov fDialogChanged,TRUE
.endif
.endif
.elseif eax==IDC_CHKOWNERDRAW
invoke MnuGetMem,hWin
.if eax
mov esi,eax
and (MNUITEM ptr [esi]).ntype,-1 xor MFT_OWNERDRAW
invoke SendDlgItemMessage,hWin,IDC_CHKOWNERDRAW,BM_GETCHECK,0,0
.if eax==BST_CHECKED
or (MNUITEM ptr [esi]).ntype,MFT_OWNERDRAW
.endif
.endif
.if !fMnuSel
mov fDialogChanged,TRUE
.endif
.endif
.elseif edx==EN_CHANGE
.if eax==IDC_EDTITEMCAPTION
invoke MnuGetMem,hWin
.if eax
mov esi,eax
invoke GetDlgItemText,hWin,IDC_EDTITEMCAPTION,addr buffer,64
invoke strcpy,addr (MNUITEM ptr [esi]).itemcaption,addr buffer
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_DELETESTRING,nMnuInx,0
lea edi,buffer1
mov ecx,(MNUITEM ptr [esi]).level
.if ecx
mov al,'<'
mov ah,'>' ; *** MOD 21.1.2012
@@:
stosw
;stosb
loop @b
.endif
invoke strcpy,edi,addr buffer
invoke SendDlgItemMessage,hWin,IDC_HOTMENU,HKM_GETHOTKEY,0,0
.if al
mov word ptr buffer,VK_TAB
mov edx,eax
invoke MnuSaveAccel,edx,addr buffer[1]
invoke strcat,addr buffer1,addr buffer
.endif
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_INSERTSTRING,nMnuInx,addr buffer1
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_SETITEMDATA,nMnuInx,esi
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_SETCURSEL,nMnuInx,0
.if !fMnuSel
mov fDialogChanged,TRUE
.endif
.endif
.elseif eax==IDC_EDTITEMNAME
invoke MnuGetMem,hWin
.if eax
mov esi,eax
invoke GetDlgItemText,hWin,IDC_EDTITEMNAME,addr (MNUITEM ptr [esi]).itemname,MaxName
.if !fMnuSel
mov fDialogChanged,TRUE
.endif
.endif
.elseif eax==IDC_EDTITEMID
invoke MnuGetMem,hWin
.if eax
mov esi,eax
invoke GetDlgItemInt,hWin,IDC_EDTITEMID,addr val,FALSE
mov (MNUITEM ptr [esi]).itemid,eax
.if !fMnuSel
mov fDialogChanged,TRUE
.endif
.endif
.elseif eax==IDC_EDTHELPID
invoke MnuGetMem,hWin
.if eax
mov esi,eax
invoke GetDlgItemInt,hWin,IDC_EDTHELPID,addr val,FALSE
mov (MNUITEM ptr [esi]).helpid,eax
.if !fMnuSel
mov fDialogChanged,TRUE
.endif
.endif
.elseif eax==IDC_HOTMENU
invoke MnuGetMem,hWin
.if eax
mov esi,eax
invoke SendDlgItemMessage,hWin,IDC_HOTMENU,HKM_GETHOTKEY,0,0
mov (MNUITEM ptr [esi]).shortcut,eax
invoke SendMessage,hWin,WM_COMMAND,(EN_CHANGE shl 16) or IDC_EDTITEMCAPTION,0
.if !fMnuSel
mov fDialogChanged,TRUE
.endif
.endif
.endif
.elseif edx==LBN_SELCHANGE
.if eax==IDC_LSTMNU
mov fMnuSel,TRUE
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_GETCURSEL,0,0
mov nMnuInx,eax
invoke SendDlgItemMessage,hWin,IDC_LSTMNU,LB_GETITEMDATA,nMnuInx,0
.if !eax
invoke SendDlgItemMessage,hWin,IDC_HOTMENU,HKM_SETHOTKEY,0,0
invoke SetDlgItemText,hWin,IDC_EDTITEMCAPTION,addr szNULL
invoke SetDlgItemText,hWin,IDC_EDTITEMNAME,addr szMnuItemName
invoke MnuGetFreeID
invoke SetDlgItemInt,hWin,IDC_EDTITEMID,eax,FALSE
invoke SetDlgItemInt,hWin,IDC_EDTHELPID,0,FALSE
invoke SendDlgItemMessage,hWin,IDC_CHKCHECKED,BM_SETCHECK,BST_UNCHECKED,0
invoke SendDlgItemMessage,hWin,IDC_CHKGRAYED,BM_SETCHECK,BST_UNCHECKED,0
invoke SendDlgItemMessage,hWin,IDC_CHKRIGHTALIGN,BM_SETCHECK,BST_UNCHECKED,0
invoke SendDlgItemMessage,hWin,IDC_CHKRADIO,BM_SETCHECK,BST_UNCHECKED,0
invoke SendDlgItemMessage,hWin,IDC_CHKOWNERDRAW,BM_SETCHECK,BST_UNCHECKED,0
.else
mov esi,eax
invoke SendDlgItemMessage,hWin,IDC_HOTMENU,HKM_SETHOTKEY,(MNUITEM ptr [esi]).shortcut,0
invoke SetDlgItemText,hWin,IDC_EDTITEMCAPTION,addr (MNUITEM ptr [esi]).itemcaption
invoke SetDlgItemText,hWin,IDC_EDTITEMNAME,addr (MNUITEM ptr [esi]).itemname
invoke SetDlgItemInt,hWin,IDC_EDTITEMID,(MNUITEM ptr [esi]).itemid,FALSE
invoke SetDlgItemInt,hWin,IDC_EDTHELPID,(MNUITEM ptr [esi]).helpid,FALSE
mov eax,(MNUITEM ptr [esi]).nstate
and eax,MFS_CHECKED
.if eax==MFS_CHECKED
mov eax,BST_CHECKED
.else
mov eax,BST_UNCHECKED
.endif
invoke SendDlgItemMessage,hWin,IDC_CHKCHECKED,BM_SETCHECK,eax,0
mov eax,(MNUITEM ptr [esi]).nstate
and eax,MFS_GRAYED
.if eax==MFS_GRAYED
mov eax,BST_CHECKED
.else
mov eax,BST_UNCHECKED
.endif
invoke SendDlgItemMessage,hWin,IDC_CHKGRAYED,BM_SETCHECK,eax,0
mov eax,(MNUITEM ptr [esi]).ntype
and eax,MFT_RIGHTJUSTIFY
.if eax==MFT_RIGHTJUSTIFY
mov eax,BST_CHECKED
.else
mov eax,BST_UNCHECKED
.endif
invoke SendDlgItemMessage,hWin,IDC_CHKRIGHTALIGN,BM_SETCHECK,eax,0
mov eax,(MNUITEM ptr [esi]).ntype
and eax,MFT_RADIOCHECK
.if eax==MFT_RADIOCHECK
mov eax,BST_CHECKED
.else
mov eax,BST_UNCHECKED
.endif
invoke SendDlgItemMessage,hWin,IDC_CHKRADIO,BM_SETCHECK,eax,0
mov eax,(MNUITEM ptr [esi]).ntype
and eax,MFT_OWNERDRAW
.if eax==MFT_OWNERDRAW
mov eax,BST_CHECKED
.else
mov eax,BST_UNCHECKED
.endif
invoke SendDlgItemMessage,hWin,IDC_CHKOWNERDRAW,BM_SETCHECK,eax,0
.endif
mov fMnuSel,FALSE
.endif
.endif
.elseif eax==WM_SIZE
invoke SendMessage,hDEd,WM_VSCROLL,SB_THUMBTRACK,0
invoke SendMessage,hDEd,WM_HSCROLL,SB_THUMBTRACK,0
invoke GetClientRect,hDEd,addr rect
mov rect.left,3
mov rect.top,3
sub rect.right,6
sub rect.bottom,6
invoke MoveWindow,hWin,rect.left,rect.top,rect.right,rect.bottom,TRUE
; MOD 22.1.2012 =============================
; invoke GetClientRect,hWin,addr rect
; invoke GetDlgItem,hWin,IDC_LSTMNU
; mov hCtl,eax
; mov rect.left,12 ; move doesnt work
; mov rect.top,170
; mov rect.right,305
; sub rect.bottom,170+12
; invoke MoveWindow,hCtl,rect.left,rect.top,rect.right,rect.bottom,TRUE
; ===========================================
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
DlgMenuEditProc endp
CreateMnu proc uses ebx esi edi,hWin:HWND,lpProItemMem:DWORD
mov eax,lpProItemMem
.if !eax
invoke xGlobalAlloc,GMEM_FIXED or GMEM_ZEROINIT,MaxMem
mov esi,eax
invoke GlobalLock,esi
invoke strcpy,addr (MNUHEAD ptr [esi]).menuname,addr szMnuName
invoke GetUnikeName,addr (MNUHEAD ptr [esi]).menuname
invoke GetFreeProjectitemID,TPE_MENU
mov (MNUHEAD ptr [esi]).menuid,eax
inc eax
mov (MNUHEAD ptr [esi]).startid,eax
invoke CreateDialogParam,hInstance,IDD_DLGMENUEDIT,hWin,addr DlgMenuEditProc,esi
mov hDialog,eax
mov fDialogChanged,TRUE
mov eax,esi
.else
mov esi,lpProItemMem
mov esi,[esi].PROJECT.hmem
invoke CreateDialogParam,hInstance,IDD_DLGMENUEDIT,hWin,addr DlgMenuEditProc,esi
mov hDialog,eax
invoke SetWindowLong,hDialog,GWL_USERDATA,lpProItemMem
mov eax,esi
.endif
ret
CreateMnu endp
|
/*
keybar.cpp
Keybar
*/
/*
Copyright © 1996 Eugene Roshal
Copyright © 2000 Far Group
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the authors may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// Self:
#include "keybar.hpp"
// Internal:
#include "farcolor.hpp"
#include "keyboard.hpp"
#include "keys.hpp"
#include "manager.hpp"
#include "syslog.hpp"
#include "lang.hpp"
#include "interf.hpp"
#include "config.hpp"
#include "configdb.hpp"
#include "strmix.hpp"
#include "global.hpp"
#include "plugin.hpp"
// Platform:
// Common:
#include "common.hpp"
#include "common/enum_tokens.hpp"
#include "common/range.hpp"
// External:
#include "format.hpp"
//----------------------------------------------------------------------------
enum
{
KEY_COUNT = 12
};
KeyBar::KeyBar(window_ptr Owner):
SimpleScreenObject(std::move(Owner)),
Items(KBL_GROUP_COUNT),
CustomArea(),
AltState(),
CtrlState(),
ShiftState(),
CustomLabelsReaded(false)
{
for (auto& i: Items)
{
i.resize(KEY_COUNT);
}
_OT(SysLog(L"[%p] KeyBar::KeyBar()", this));
}
void KeyBar::DisplayObject()
{
GotoXY(m_Where.left, m_Where.top);
AltState = IntKeyState.AltPressed();
CtrlState = IntKeyState.CtrlPressed();
ShiftState = IntKeyState.ShiftPressed();
int KeyWidth = (m_Where.width() - 2) / 12;
if (KeyWidth<8)
KeyWidth=8;
const auto LabelWidth = KeyWidth - 2;
for (size_t i=0; i<KEY_COUNT; i++)
{
if (WhereX() + LabelWidth >= m_Where.right)
break;
SetColor(COL_KEYBARNUM);
Text(str(i + 1));
SetColor(COL_KEYBARTEXT);
static const std::pair<bool(FarKeyboardState::*)() const, keybar_group> Mapping[] =
{
{ &FarKeyboardState::NonePressed, KBL_MAIN },
{ &FarKeyboardState::OnlyAltPressed, KBL_ALT },
{ &FarKeyboardState::OnlyCtrlPressed, KBL_CTRL },
{ &FarKeyboardState::OnlyShiftPressed, KBL_SHIFT },
{ &FarKeyboardState::OnlyCtrlAltPressed, KBL_CTRLALT },
{ &FarKeyboardState::OnlyAltShiftPressed, KBL_ALTSHIFT },
{ &FarKeyboardState::OnlyCtrlShiftPressed, KBL_CTRLSHIFT },
{ &FarKeyboardState::OnlyCtrlAltShiftPressed, KBL_CTRLALTSHIFT },
};
static_assert(std::size(Mapping) == KBL_GROUP_COUNT);
const auto State = std::find_if(ALL_CONST_RANGE(Mapping), [&](const auto& Item) { return std::invoke(Item.first, IntKeyState); });
// State should always be valid so check is excessive, but style is style
auto Label = Items[(State != std::cend(Mapping)? State : std::cbegin(Mapping))->second][i].first;
{
string_view Beginning, Ending;
auto FirstEntry = true;
for (const auto& Part: enum_tokens_with_quotes(Label, L"|"sv))
{
if (FirstEntry)
{
Beginning = Part;
FirstEntry = false;
continue;
}
if (Beginning.size() + Part.size() > static_cast<size_t>(LabelWidth))
break;
if (Part.size() > Ending.size())
Ending = Part;
}
if (!Beginning.empty())
{
Label = concat(Beginning, Ending);
}
}
Text(fit_to_left(Label, LabelWidth));
if (i<KEY_COUNT-1)
{
SetColor(COL_KEYBARBACKGROUND);
Text(L' ');
}
}
const auto Width = m_Where.right - WhereX() + 1;
if (Width>0)
{
SetColor(COL_KEYBARTEXT);
Text(string(Width, L' '));
}
}
void KeyBar::ClearKeyTitles(bool Custom)
{
const auto ItemGetter = Custom? &keybar_item::second : &keybar_item::first;
for (auto& i: Items)
{
for (auto& j: i)
{
std::invoke(ItemGetter, j).clear();
}
}
}
void KeyBar::SetLabels(lng StartIndex)
{
for (auto& Group: Items)
{
for (auto& i: Group)
{
i.first = msg(StartIndex);
StartIndex++;
}
}
}
static int FnGroup(DWORD ControlState)
{
static const struct
{
DWORD Group;
DWORD ControlState;
}
Area[] =
{
{KBL_MAIN, 0},
{KBL_SHIFT, KEY_SHIFT},
{KBL_ALT, KEY_ALT},
{KBL_CTRL, KEY_CTRL},
{KBL_ALTSHIFT, KEY_ALTSHIFT},
{KBL_CTRLSHIFT, KEY_CTRLSHIFT},
{KBL_CTRLALT, KEY_CTRLALT},
{KBL_CTRLALTSHIFT, KEY_CTRLALT|KEY_SHIFT}
};
static_assert(std::size(Area) == KBL_GROUP_COUNT);
const auto ItemIterator = std::find_if(CONST_RANGE(Area, i)
{
return i.ControlState == ControlState;
});
return ItemIterator == std::cend(Area)? -1 : ItemIterator->Group;
}
void KeyBar::SetCustomLabels(KEYBARAREA Area)
{
static const string_view Names[]
{
L"Shell"sv,
L"Info"sv,
L"Tree"sv,
L"QView"sv,
L"FindFolder"sv,
L"Editor"sv,
L"Viewer"sv,
L"Help"sv,
};
static_assert(std::size(Names) == KBA_COUNT);
if (Area < KBA_COUNT && (!CustomLabelsReaded || !equal_icase(strLanguage, Global->Opt->strLanguage.Get()) || Area != CustomArea))
{
strLanguage = Global->Opt->strLanguage.Get();
CustomArea = Area;
ClearKeyTitles(true);
for (auto& [Name, Value]: ConfigProvider().GeneralCfg()->ValuesEnumerator<string>(concat(L"KeyBarLabels."sv, strLanguage, L'.', Names[Area])))
{
const auto Key = KeyNameToKey(Name);
const auto fnum = (Key & ~KEY_CTRLMASK) - KEY_F1;
if (fnum < KEY_COUNT)
{
const auto fgroup = FnGroup(Key & KEY_CTRLMASK);
if (fgroup >= 0)
Items[fgroup][fnum].second = Value;
}
}
CustomLabelsReaded = true;
}
for (auto& Group: Items)
{
for (auto& [Title, CustomTitle]: Group)
{
if (!CustomTitle.empty())
{
Title = CustomTitle;
}
}
}
}
bool KeyBar::ProcessKey(const Manager::Key& Key)
{
const auto LocalKey = Key();
switch (LocalKey)
{
case KEY_KILLFOCUS:
case KEY_GOTFOCUS:
RedrawIfChanged();
return true;
}
return false;
}
bool KeyBar::ProcessMouse(const MOUSE_EVENT_RECORD *MouseEvent)
{
INPUT_RECORD rec;
size_t Key;
if (!IsVisible())
return false;
if (!(MouseEvent->dwButtonState & 3) || MouseEvent->dwEventFlags)
return false;
if (!m_Where.contains(MouseEvent->dwMousePosition))
return false;
int KeyWidth = (m_Where.width() - 2) / 12;
if (KeyWidth<8)
KeyWidth=8;
const auto X = MouseEvent->dwMousePosition.X - m_Where.left;
if (X<KeyWidth*9)
Key=X/KeyWidth;
else
Key=9+(X-KeyWidth*9)/(KeyWidth+1);
for (;;)
{
GetInputRecord(&rec);
if (rec.EventType==MOUSE_EVENT && !(rec.Event.MouseEvent.dwButtonState & 3))
break;
}
if (!m_Where.contains(MouseEvent->dwMousePosition))
return false;
const int NewX = MouseEvent->dwMousePosition.X - m_Where.left;
const size_t NewKey = NewX < KeyWidth * 9? NewX / KeyWidth : 9 + (NewX - KeyWidth * 9) / (KeyWidth + 1);
if (Key!=NewKey)
return false;
if (Key > F12)
Key = F12;
if (MouseEvent->dwControlKeyState & (RIGHT_ALT_PRESSED|LEFT_ALT_PRESSED) ||
(MouseEvent->dwButtonState & RIGHTMOST_BUTTON_PRESSED))
{
if (MouseEvent->dwControlKeyState & SHIFT_PRESSED)
Key+=KEY_ALTSHIFTF1;
else if (MouseEvent->dwControlKeyState & (RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED))
Key+=KEY_CTRLALTF1;
else
Key+=KEY_ALTF1;
}
else if (MouseEvent->dwControlKeyState & (RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED))
{
if (MouseEvent->dwControlKeyState & SHIFT_PRESSED)
Key+=KEY_CTRLSHIFTF1;
else
Key+=KEY_CTRLF1;
}
else if (MouseEvent->dwControlKeyState & SHIFT_PRESSED)
Key+=KEY_SHIFTF1;
else
Key+=KEY_F1;
Global->WindowManager->ProcessKey(Manager::Key(static_cast<int>(Key)));
return true;
}
void KeyBar::RedrawIfChanged()
{
if (
IntKeyState.ShiftPressed() != ShiftState ||
IntKeyState.CtrlPressed() != CtrlState ||
IntKeyState.AltPressed() != AltState)
{
//_SVS("KeyBar::RedrawIfChanged()");
Redraw();
}
}
size_t KeyBar::Change(const KeyBarTitles *Kbt)
{
if (!Kbt)
return 0;
size_t Result = 0;
for (const auto& i: span(Kbt->Labels, Kbt->CountLabels))
{
if (i.Key.VirtualKeyCode < VK_F1 || i.Key.VirtualKeyCode >= VK_F1 + KEY_COUNT)
continue;
const auto Pos = i.Key.VirtualKeyCode - VK_F1;
DWORD Shift = 0;
const auto Flags = i.Key.ControlKeyState;
if (Flags & (LEFT_CTRL_PRESSED|RIGHT_CTRL_PRESSED))
Shift |= KEY_CTRL;
if (Flags & (LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED))
Shift |= KEY_ALT;
if (Flags & SHIFT_PRESSED)
Shift |= KEY_SHIFT;
const auto Group = FnGroup(Shift);
if (Group < 0)
continue;
Items[Group][Pos].first = NullToEmpty(i.Text);
++Result;
}
return Result;
}
|
$NOMOD51
$INCLUDE(hwconf.inc)
;------------------------------------------------------------------------------
; This file is part of the C51 Compiler package
; Copyright (c) 1988-2002 Keil Elektronik GmbH and Keil Software, Inc.
;------------------------------------------------------------------------------
; STARTUP.A51: This code is executed after processor reset.
;
; To translate this file use A51 with the following invocation:
;
; A51 STARTUP.A51
;
; To link the modified STARTUP.OBJ file to your application use the following
; BL51 invocation:
;
; BL51 <your object file list>, STARTUP.OBJ <controls>
;
;------------------------------------------------------------------------------
;
; User-defined Power-On Initialization of Memory
;
; With the following EQU statements the initialization of memory
; at processor reset can be defined:
;
; ; the absolute start-address of IDATA memory is always 0
IDATALEN EQU 0FFH ; the length of IDATA memory in bytes.
;
; See hwconf.inc XDATASTART EQU 0000H ; the absolute start-address of XDATA memory
; See hwconf.inc XDATALEN EQU 8000H ; the length of XDATA memory in bytes.
;
PDATASTART EQU 0H ; the absolute start-address of PDATA memory
PDATALEN EQU 0H ; the length of PDATA memory in bytes.
;
; Notes: The IDATA space overlaps physically the DATA and BIT areas of the
; 8051 CPU. At minimum the memory space occupied from the C51
; run-time routines must be set to zero.
;------------------------------------------------------------------------------
;
; Reentrant Stack Initilization
;
; The following EQU statements define the stack pointer for reentrant
; functions and initialized it:
;
; Stack Space for reentrant functions in the SMALL model.
IBPSTACK EQU 0 ; set to 1 if small reentrant is used.
IBPSTACKTOP EQU 0FFH+1 ; set top of stack to highest location+1.
;
; Stack Space for reentrant functions in the LARGE model.
XBPSTACK EQU 0 ; set to 1 if large reentrant is used.
XBPSTACKTOP EQU 0FFFFH+1; set top of stack to highest location+1.
;
; Stack Space for reentrant functions in the COMPACT model.
PBPSTACK EQU 0 ; set to 1 if compact reentrant is used.
PBPSTACKTOP EQU 0FFFFH+1; set top of stack to highest location+1.
;
;------------------------------------------------------------------------------
;
; Page Definition for Using the Compact Model with 64 KByte xdata RAM
;
; The following EQU statements define the xdata page used for pdata
; variables. The EQU PPAGE must conform with the PPAGE control used
; in the linker invocation.
;
PPAGEENABLE EQU 0 ; set to 1 if pdata object are used.
;
PPAGE EQU 0 ; define PPAGE number.
;
PPAGE_SFR DATA 0A0H ; SFR that supplies uppermost address byte
; (most 8051 variants use P2 as uppermost address byte)
;
;------------------------------------------------------------------------------
; Standard SFR Symbols
ACC DATA 0E0H
B DATA 0F0H
SP DATA 81H
DPL DATA 82H
DPH DATA 83H
AUXR DATA 8EH
NAME ?C_STARTUP
?C_C51STARTUP SEGMENT CODE
?STACK SEGMENT IDATA
RSEG ?STACK
DS 1
EXTRN CODE (?C_START)
PUBLIC ?C_STARTUP
CSEG AT 0
?C_STARTUP: LJMP STARTUP1
RSEG ?C_C51STARTUP
STARTUP1:
; Mapping before memory and stack inialization
MOV SP,#?STACK-1
call hw_init
IF IDATALEN <> 0
MOV R0,#IDATALEN - 1
CLR A
IDATALOOP: MOV @R0,A
DJNZ R0,IDATALOOP
ENDIF
IF XDATALEN <> 0
STARTUP_XMEM
MOV DPTR,#XDATASTART
MOV R7,#LOW (XDATALEN)
IF (LOW (XDATALEN)) <> 0
MOV R6,#(HIGH (XDATALEN)) +1
ELSE
MOV R6,#HIGH (XDATALEN)
ENDIF
CLR A
XDATALOOP: MOVX @DPTR,A
INC DPTR
DJNZ R7,XDATALOOP
DJNZ R6,XDATALOOP
ENDIF
IF PPAGEENABLE <> 0
MOV PPAGE_SFR,#PPAGE
ENDIF
IF PDATALEN <> 0
MOV R0,#LOW (PDATASTART)
MOV R7,#LOW (PDATALEN)
CLR A
PDATALOOP: MOVX @R0,A
INC R0
DJNZ R7,PDATALOOP
ENDIF
IF IBPSTACK <> 0
EXTRN DATA (?C_IBP)
MOV ?C_IBP,#LOW IBPSTACKTOP
ENDIF
IF XBPSTACK <> 0
EXTRN DATA (?C_XBP)
MOV ?C_XBP,#HIGH XBPSTACKTOP
MOV ?C_XBP+1,#LOW XBPSTACKTOP
ENDIF
IF PBPSTACK <> 0
EXTRN DATA (?C_PBP)
MOV ?C_PBP,#LOW PBPSTACKTOP
ENDIF
MOV SP,#?STACK-1
; This code is required if you use L51_BANK.A51 with Banking Mode 4
; EXTRN CODE (?B_SWITCH0)
; CALL ?B_SWITCH0 ; init bank mechanism to code bank 0
LJMP ?C_START
hw_init:
; Speed up the SI interface by writing to IPU_CFG:SPI_MST_CFG.
MOV RA_DA3, #0
MOV RA_DA2, #0
MOV RA_DA1, #007H
MOV RA_DA0, #0EAH
MOV RA_AD3, #070H
MOV RA_AD2, #0
MOV RA_AD1, #0
MOV RA_AD0_WR, #03CH ; this write start the AHB write! for Ocelot
$IF (BOOT_VIA_SPI = 1)
; Configure registers for loading the internal memory from FLASH. ICPU_CFG:MEMACC
; It is defined in src\config\hwconf.inc
MOV RA_DA3,#HIGH (XDATASTART - 1)
MOV RA_DA2,#LOW (XDATASTART - 1)
MOV RA_DA1, #0
MOV RA_DA0, #0
; MOV RA_AD3, #070H
; MOV RA_AD2, #0
; MOV RA_AD1, #0
MOV RA_AD0_WR, #064H ; this write start the AHB write!ocelot
; Start the actual load, the 8051 will be gated while the load is going on,
; so we can just continue as if nothing had happend (8051 will be released
; once the onchip memory contains the progam). ICPU_CFG:MEMACC_CTRL
MOV RA_DA3, #0
MOV RA_DA2, #0
; MOV RA_DA1, #0
MOV RA_DA0, #001H
; MOV RA_AD3, #070H
; MOV RA_AD2, #0
; MOV RA_AD1, #0
MOV RA_AD0_WR, #060H ; this write start the AHB write!ocelot
$ENDIF
; Errata, clear SFR register 0x8E prior to mapping internal memory.
MOV 8EH, #000H
; Enable mapping of onchip memory, note that we use SFR reg - not the CSR
; counterpart, this means that if the 8051 is reset (without resetting the
; the AHB system), then we will again load from external FLASH!
$IF (UNMANAGED_ENHANCEMENT = 1)
MOV MMAP, #0A7H ; map code access in high 32KB memory range to Flash, others to onchip memory
$ELSE
MOV MMAP, #0AFH ; map all accesses to onchip memory (until 8051 reset)
$ENDIF
; MOV RA_DA0, #0AFH
; MOV RA_AD0_WR, #05CH; // this write start the AHB write!
;MOV RA_AD0_RD, #024H; // this write start the AHB read!
;MOV RA_DA0, #08FH; // clear bits 4:5 (of 0xAF)for ferret and jaguar2
;MOV RA_AD0_WR, #024H; // write back register!
ret
END
|
;
;==================================================================================================
; ROMWBW 2.X CONFIGURATION DEFAULTS FOR UNA
;==================================================================================================
;
; THIS FILE CONTAINS THE FULL SET OF DEFAULT CONFIGURATION SETTINGS FOR THE PLATFORM
; INDICATED ABOVE. THIS FILE SHOULD *NOT* NORMALLY BE CHANGED. INSTEAD, YOU SHOULD
; OVERRIDE ANY SETTINGS YOU WANT USING A CONFIGURATION FILE IN THE CONFIG DIRECTORY
; UNDER THIS DIRECTORY.
;
; THIS FILE CAN BE CONSIDERED A REFERENCE THAT LISTS ALL POSSIBLE CONFIGURATION SETTINGS
; FOR THE PLATFORM.
;
#DEFINE PLATFORM_NAME "UNA"
;
PLATFORM .EQU PLT_UNA ; PLT_[SBC|ZETA|ZETA2|N8|MK4|UNA|RCZ80|RCZ180|EZZ80|SCZ180|DYNO]
BIOS .EQU BIOS_UNA ; HARDWARE BIOS: BIOS_[WBW|UNA]
;
BOOTTYPE .EQU BT_MENU ; BT_[MENU|AUTO], IF AUTO, BOOT DEFAULT AFTER TIMEOUT
BOOT_TIMEOUT .EQU 20 ; AUTO BOOT TIMEOUT IN SECONDS, 0 FOR IMMEDIATE BOOT
BOOT_DEFAULT .EQU 'Z' ; AUTO BOOT SELECTION TO INVOKE AT TIMEOUT
;
CPUOSC .EQU 18432000 ; CPU OSC FREQ IN MHZ
INTMODE .EQU 0 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2
;
RAMSIZE .EQU 512 ; SIZE OF RAM IN KB (MUST MATCH YOUR HARDWARE!!!)
;
RTCIO .EQU $70 ; RTC LATCH REGISTER ADR
;
DSKYENABLE .EQU FALSE ; ENABLES DSKY (DO NOT COMBINE WITH PPIDE)
|
;--------------------------------------------------------
; File Created by SDCC : free open source ANSI-C Compiler
; Version 4.0.0 #11528 (MINGW64)
;--------------------------------------------------------
; MODULE 01_variables
.optsdcc -mgbz80
; Generated using the rgbds tokens.
; We have to define these here as sdcc doesn't make them global by default
GLOBAL __mulschar
GLOBAL __muluchar
GLOBAL __mulint
GLOBAL __divschar
GLOBAL __divuchar
GLOBAL __divsint
GLOBAL __divuint
GLOBAL __modschar
GLOBAL __moduchar
GLOBAL __modsint
GLOBAL __moduint
GLOBAL __mullong
GLOBAL __modslong
GLOBAL __divslong
GLOBAL banked_call
GLOBAL banked_ret
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
GLOBAL _variable
GLOBAL _global_i
;--------------------------------------------------------
; special function registers
;--------------------------------------------------------
;--------------------------------------------------------
; ram data
;--------------------------------------------------------
SECTION "src/01-variables.c_DATA",BSS
_global_i:
DS 1
;--------------------------------------------------------
; absolute external ram data
;--------------------------------------------------------
SECTION "DABS (ABS)",CODE
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
SECTION "HOME",CODE
SECTION "GSINIT",CODE
SECTION "GSFINAL",CODE
SECTION "GSINIT",CODE
;src/01-variables.c:1: volatile unsigned char global_i = 5;
ld hl, _global_i
ld [hl], $05
;--------------------------------------------------------
; Home
;--------------------------------------------------------
SECTION "src/01-variables.c_HOME",HOME
SECTION "src/01-variables.c_HOME",HOME
;--------------------------------------------------------
; code
;--------------------------------------------------------
SECTION "src/01-variables.c_CODE",CODE
;src/01-variables.c:3: void variable(void)
; ---------------------------------
; Function variable
; ---------------------------------
_variable::
dec sp
;src/01-variables.c:5: volatile unsigned char local_j = 123;
ld hl, [sp+0]
ld [hl], $7B
;src/01-variables.c:7: global_i = local_j;
push hl
ld a, [hl]
ld hl, _global_i
ld [hl], a
pop hl
;src/01-variables.c:9: ++local_j;
ld hl, [sp+0]
inc [hl]
;src/01-variables.c:11: global_i = local_j;
push hl
ld a, [hl]
ld hl, _global_i
ld [hl], a
pop hl
;src/01-variables.c:13: local_j = global_i;
push hl
ld hl, _global_i
ld a, [hl]
ld hl, [sp+2]
ld [hl], a
pop hl
;src/01-variables.c:15: local_j += 1;
ld hl, [sp+0]
ld a, [hl]
inc a
ld [hl], a
;src/01-variables.c:17: ++global_i;
ld hl, _global_i
inc [hl]
;src/01-variables.c:19: local_j = global_i;
push hl
ld a, [hl]
ld hl, [sp+2]
ld [hl], a
pop hl
;src/01-variables.c:21: return;
.l00101:
;src/01-variables.c:22: }
inc sp
ret
SECTION "src/01-variables.c_CODE",CODE
SECTION "CABS (ABS)",CODE
|
;*
;* Raster Music Tracker, RMT Atari routine version 1.20090108
;* (c) Radek Sterba, Raster/C.P.U., 2002 - 2009
;* http://raster.atari.org
;*
;* Warnings:
;*
;* 1. RMT player routine needs 19 itself reserved bytes in zero page (no accessed
;* from any other routines) as well as cca 1KB of memory before the "PLAYER"
;* address for frequency tables and functionary variables. It's:
;* a) from PLAYER-$03c0 to PLAYER for stereo RMTplayer
;* b) from PLAYER-$0320 to PLAYER for mono RMTplayer
;*
;* 2. RMT player routine MUST (!!!) be compiled from the begin of the memory page.
;* i.e. "PLAYER" address can be $..00 only!
;*
;* 3. Because of RMTplayer provides a lot of effects, it spent a lot of CPU time.
;*
;* STEREOMODE equ 0..3 ;0 => compile RMTplayer for 4 tracks mono
;* ;1 => compile RMTplayer for 8 tracks stereo
;* ;2 => compile RMTplayer for 4 tracks stereo L1 R2 R3 L4
;* ;3 => compile RMTplayer for 4 tracks stereo L1 L2 R3 R4
;*
STEREOMODE equ 0
;*
;* RMT FEATures definitions
;*
;* For optimizations of RMT player routine to concrete RMT modul only!
;* --------BEGIN--------
FEAT_RELOC equ 1
FEAT_SFX equ 0 ;* 0 => No SFX support, 1 => SFX support
FEAT_GLOBALVOLUMEFADE equ 0 ;* 0 => No RMTGLOBALVOLUMEFADE support, 1=> RMTGLOBALVOLUMEFADE support (+7 bytes)
FEAT_NOSTARTINGSONGLINE equ 0 ;* 0 => Init with starting songline, 1=> no starting songline (start from songline 0 always), cca 22 or 24 bytes
FEAT_INSTRSPEED equ 0 ;* cca 21 or 5 bytes
FEAT_CONSTANTSPEED equ 0 ;* cca 28 bytes
;* VARIOUS COMMANDS
FEAT_COMMAND1 equ 1 ;* cca 8 bytes
FEAT_COMMAND2 equ 1 ;* cca 20 bytes (+save 1 address in zero page) and quicker whole RMT routine
FEAT_COMMAND3 equ 1 ;* cca 12 bytes
FEAT_COMMAND4 equ 1 ;* cca 15 bytes
FEAT_COMMAND5 equ 1 ;* cca 67 bytes
FEAT_COMMAND6 equ 1 ;* cca 15 bytes
;* COMMAND7 SETNOTE (i.e. command 7 with parameter != $80)
FEAT_COMMAND7SETNOTE equ 1 ;* cca 12 bytes
;* COMMAND7 VOLUMEONLY (i.e. command 7 with parameter == $80)
FEAT_COMMAND7VOLUMEONLY equ 1 ;* cca 74 bytes
;* PORTAMENTO
FEAT_PORTAMENTO equ 1 ;* cca 138 bytes and quicker whole RMT routine
;* FILTER
FEAT_FILTER equ 1 ;* cca 179 bytes and quicker whole RMT routine
FEAT_FILTERG0L equ 1 ;* (cca 38 bytes for each)
FEAT_FILTERG1L equ 1
FEAT_FILTERG0R equ 1
FEAT_FILTERG1R equ 1
;* BASS16B (i.e. distortion value 6)
FEAT_BASS16 equ 1 ;* cca 194 bytes +128bytes freq table and quicker whole RMT routine
FEAT_BASS16G1L equ 1 ;* (cca 47 bytes for each)
FEAT_BASS16G3L equ 1
FEAT_BASS16G1R equ 1
FEAT_BASS16G3R equ 1
;* VOLUME ONLY for particular generators
FEAT_VOLUMEONLYG0L equ 1 ;* (cca 7 bytes for each)
FEAT_VOLUMEONLYG2L equ 1
FEAT_VOLUMEONLYG3L equ 1
FEAT_VOLUMEONLYG0R equ 1
FEAT_VOLUMEONLYG2R equ 1
FEAT_VOLUMEONLYG3R equ 1
;* TABLE TYPE (i.e. TABLETYPE=1)
FEAT_TABLETYPE equ 1 ;* cca 53 bytes and quicker whole RMT routine
;* TABLE MODE (i.e. TABLEMODE=1)
FEAT_TABLEMODE equ 1 ;* cca 16 bytes and quicker whole RMT routine
;* TABLE GO (i.e. TGO is nonzero value)
FEAT_TABLEGO equ 1 ;* cca 6 bytes and quicker whole RMT routine
;* AUDCTLMANUALSET (i.e. any MANUAL AUDCTL setting is nonzero value)
FEAT_AUDCTLMANUALSET equ 1 ;* cca 27 bytes and quicker whole RMT routine
;* VOLUME MINIMUM (i.e. VMIN is nonzero value)
FEAT_VOLUMEMIN equ 1 ;* cca 12 bytes and quicker whole RMT routine
;* INSTREUMENT EFFECTS (i.e. VIBRATO or FSHIFT are nonzero values with nonzero DELAY)
FEAT_EFFECTVIBRATO equ 1 ;* cca 65 bytes and quicker whole RMT routine
FEAT_EFFECTFSHIFT equ 1 ;* cca 11 bytes and quicker whole RMT routine
;* (btw - if no one from this two effect is used, it will save cca 102 bytes)
;* --------END--------
IFT STEREOMODE==1
TRACKS equ 8
ELS
TRACKS equ 4
EIF
;*
;Reserve space for variables (cannot we reserve this space after the player routine?)
;and align the address.
;Current address is then address of player routine.
IFT TRACKS>4
org *+$400+$40
ELS
org *+$400+$e0
EIF
.align $100
PLAYER
;PLAYER equ $3400
;*
;* RMT FEATures definitions file
;* For optimizations of RMT player routine to concrete RMT modul only!
; icl "rmt_feat.a65"
;*
;* RMT ZeroPage addresses
; org 203
org rmt_vars
;Following four addresses must be together (they are initialized in loop)
p_tis
p_instrstable org *+2
p_trackslbstable org *+2
p_trackshbstable org *+2
p_song org *+2
ns org *+2
nr org *+2
nt org *+2
reg1 org *+1
reg2 org *+1
reg3 org *+1
tmp org *+1
IFT FEAT_COMMAND2
frqaddcmd2 org *+1
EIF
IFT FEAT_RELOC
rmt_offset org *+2 ;real_address - expected address (real_address = expected_address + rmt_offset)
EIF
IFT TRACKS>4
org PLAYER-$400+$40
ELS
org PLAYER-$400+$e0
EIF
track_variables
trackn_db org *+TRACKS
trackn_hb org *+TRACKS
trackn_idx org *+TRACKS
trackn_pause org *+TRACKS
trackn_note org *+TRACKS
trackn_volume org *+TRACKS
trackn_distor org *+TRACKS
trackn_shiftfrq org *+TRACKS
IFT FEAT_PORTAMENTO
trackn_portafrqc org *+TRACKS
trackn_portafrqa org *+TRACKS
trackn_portaspeed org *+TRACKS
trackn_portaspeeda org *+TRACKS
trackn_portadepth org *+TRACKS
EIF
trackn_instrx2 org *+TRACKS
trackn_instrdb org *+TRACKS
trackn_instrhb org *+TRACKS
trackn_instridx org *+TRACKS
trackn_instrlen org *+TRACKS
trackn_instrlop org *+TRACKS
trackn_instrreachend org *+TRACKS
trackn_volumeslidedepth org *+TRACKS
trackn_volumeslidevalue org *+TRACKS
IFT FEAT_VOLUMEMIN
trackn_volumemin org *+TRACKS
EIF
FEAT_EFFECTS equ FEAT_EFFECTVIBRATO||FEAT_EFFECTFSHIFT
IFT FEAT_EFFECTS
trackn_effdelay org *+TRACKS
EIF
IFT FEAT_EFFECTVIBRATO
trackn_effvibratoa org *+TRACKS
EIF
IFT FEAT_EFFECTFSHIFT
trackn_effshift org *+TRACKS
EIF
trackn_tabletypespeed org *+TRACKS
IFT FEAT_TABLEMODE
trackn_tablemode org *+TRACKS
EIF
trackn_tablenote org *+TRACKS
trackn_tablea org *+TRACKS
trackn_tableend org *+TRACKS
IFT FEAT_TABLEGO
trackn_tablelop org *+TRACKS
EIF
trackn_tablespeeda org *+TRACKS
IFT FEAT_FILTER||FEAT_BASS16
trackn_command org *+TRACKS
EIF
IFT FEAT_BASS16
trackn_outnote org *+TRACKS
EIF
IFT FEAT_FILTER
trackn_filter org *+TRACKS
EIF
trackn_audf org *+TRACKS
trackn_audc org *+TRACKS
IFT FEAT_AUDCTLMANUALSET
trackn_audctl org *+TRACKS
EIF
v_aspeed org *+1
track_endvariables
org PLAYER-$100-$140-$40+2
INSTRPAR equ 12
tabbeganddistor
dta frqtabpure-frqtab,$00
dta frqtabpure-frqtab,$20
dta frqtabpure-frqtab,$40
dta frqtabbass1-frqtab,$c0
dta frqtabpure-frqtab,$80
dta frqtabpure-frqtab,$a0
dta frqtabbass1-frqtab,$c0
dta frqtabbass2-frqtab,$c0
IFT FEAT_EFFECTVIBRATO
vibtabbeg dta 0,vib1-vib0,vib2-vib0,vib3-vib0
vib0 dta 0
vib1 dta 1,-1,-1,1
vib2 dta 1,0,-1,-1,0,1
vib3 dta 1,1,0,-1,-1,-1,-1,0,1,1
vibtabnext
dta vib0-vib0+0
dta vib1-vib0+1,vib1-vib0+2,vib1-vib0+3,vib1-vib0+0
dta vib2-vib0+1,vib2-vib0+2,vib2-vib0+3,vib2-vib0+4,vib2-vib0+5,vib2-vib0+0
dta vib3-vib0+1,vib3-vib0+2,vib3-vib0+3,vib3-vib0+4,vib3-vib0+5,vib3-vib0+6,vib3-vib0+7,vib3-vib0+8,vib3-vib0+9,vib3-vib0+0
EIF
org PLAYER-$100-$140
IFT FEAT_BASS16
frqtabbasslo
dta $F2,$33,$96,$E2,$38,$8C,$00,$6A,$E8,$6A,$EF,$80,$08,$AE,$46,$E6
dta $95,$41,$F6,$B0,$6E,$30,$F6,$BB,$84,$52,$22,$F4,$C8,$A0,$7A,$55
dta $34,$14,$F5,$D8,$BD,$A4,$8D,$77,$60,$4E,$38,$27,$15,$06,$F7,$E8
dta $DB,$CF,$C3,$B8,$AC,$A2,$9A,$90,$88,$7F,$78,$70,$6A,$64,$5E,$00
EIF
org PLAYER-$100-$100
frqtab
ERT [<frqtab]!=0 ;* frqtab must begin at the memory page bound! (i.e. $..00 address)
frqtabbass1
dta $BF,$B6,$AA,$A1,$98,$8F,$89,$80,$F2,$E6,$DA,$CE,$BF,$B6,$AA,$A1
dta $98,$8F,$89,$80,$7A,$71,$6B,$65,$5F,$5C,$56,$50,$4D,$47,$44,$3E
dta $3C,$38,$35,$32,$2F,$2D,$2A,$28,$25,$23,$21,$1F,$1D,$1C,$1A,$18
dta $17,$16,$14,$13,$12,$11,$10,$0F,$0E,$0D,$0C,$0B,$0A,$09,$08,$07
frqtabbass2
dta $FF,$F1,$E4,$D8,$CA,$C0,$B5,$AB,$A2,$99,$8E,$87,$7F,$79,$73,$70
dta $66,$61,$5A,$55,$52,$4B,$48,$43,$3F,$3C,$39,$37,$33,$30,$2D,$2A
dta $28,$25,$24,$21,$1F,$1E,$1C,$1B,$19,$17,$16,$15,$13,$12,$11,$10
dta $0F,$0E,$0D,$0C,$0B,$0A,$09,$08,$07,$06,$05,$04,$03,$02,$01,$00
frqtabpure
dta $F3,$E6,$D9,$CC,$C1,$B5,$AD,$A2,$99,$90,$88,$80,$79,$72,$6C,$66
dta $60,$5B,$55,$51,$4C,$48,$44,$40,$3C,$39,$35,$32,$2F,$2D,$2A,$28
dta $25,$23,$21,$1F,$1D,$1C,$1A,$18,$17,$16,$14,$13,$12,$11,$10,$0F
dta $0E,$0D,$0C,$0B,$0A,$09,$08,$07,$06,$05,$04,$03,$02,$01,$00,$00
IFT FEAT_BASS16
frqtabbasshi
dta $0D,$0D,$0C,$0B,$0B,$0A,$0A,$09,$08,$08,$07,$07,$07,$06,$06,$05
dta $05,$05,$04,$04,$04,$04,$03,$03,$03,$03,$03,$02,$02,$02,$02,$02
dta $02,$02,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00
dta $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
EIF
org PLAYER-$0100
volumetab
dta $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dta $00,$00,$00,$00,$00,$00,$00,$00,$01,$01,$01,$01,$01,$01,$01,$01
dta $00,$00,$00,$00,$01,$01,$01,$01,$01,$01,$01,$01,$02,$02,$02,$02
dta $00,$00,$00,$01,$01,$01,$01,$01,$02,$02,$02,$02,$02,$03,$03,$03
dta $00,$00,$01,$01,$01,$01,$02,$02,$02,$02,$03,$03,$03,$03,$04,$04
dta $00,$00,$01,$01,$01,$02,$02,$02,$03,$03,$03,$04,$04,$04,$05,$05
dta $00,$00,$01,$01,$02,$02,$02,$03,$03,$04,$04,$04,$05,$05,$06,$06
dta $00,$00,$01,$01,$02,$02,$03,$03,$04,$04,$05,$05,$06,$06,$07,$07
dta $00,$01,$01,$02,$02,$03,$03,$04,$04,$05,$05,$06,$06,$07,$07,$08
dta $00,$01,$01,$02,$02,$03,$04,$04,$05,$05,$06,$07,$07,$08,$08,$09
dta $00,$01,$01,$02,$03,$03,$04,$05,$05,$06,$07,$07,$08,$09,$09,$0A
dta $00,$01,$01,$02,$03,$04,$04,$05,$06,$07,$07,$08,$09,$0A,$0A,$0B
dta $00,$01,$02,$02,$03,$04,$05,$06,$06,$07,$08,$09,$0A,$0A,$0B,$0C
dta $00,$01,$02,$03,$03,$04,$05,$06,$07,$08,$09,$0A,$0A,$0B,$0C,$0D
dta $00,$01,$02,$03,$04,$05,$06,$07,$07,$08,$09,$0A,$0B,$0C,$0D,$0E
dta $00,$01,$02,$03,$04,$05,$06,$07,$08,$09,$0A,$0B,$0C,$0D,$0E,$0F
org PLAYER
;*
;* Set of RMT main vectors:
;*
RASTERMUSICTRACKER
jmp rmt_init
jmp rmt_play
jmp rmt_p3
jmp rmt_silence
jmp SetPokey
IFT FEAT_SFX
jmp rmt_sfx ;* A=note(0,..,60),X=channel(0,..,3 or 0,..,7),Y=instrument*2(0,2,4,..,126)
EIF
rmt_init
IFT FEAT_NOSTARTINGSONGLINE==0
pha
EIF
IFT FEAT_RELOC==1
stx ns ;module address
sty ns+1
ldy #2
lda (ns),y
sta rmt_offset
iny
lda (ns),y
sta rmt_offset+1
txa
clc
adc #6
sta ns
bcc no_over
inc ns+1
no_over
lda ns ;rmt_offset = real_address - expected_address
sec
sbc rmt_offset
sta rmt_offset
lda ns+1
sbc rmt_offset+1
sta rmt_offset+1
ELS
stx ns ;module address
sty ns+1
EIF
IFT track_endvariables-track_variables>255
ldy #0
tya
ri0 sta track_variables,y
sta track_endvariables-$100,y
iny
bne ri0
ELS
ldy #track_endvariables-track_variables
lda #0
ri0 sta track_variables-1,y
dey
bne ri0
EIF
ldy #4
lda (ns),y
sta v_maxtracklen
iny
IFT FEAT_CONSTANTSPEED==0
lda (ns),y
sta v_speed
EIF
IFT FEAT_INSTRSPEED==0
iny
lda (ns),y
sta v_instrspeed
sta v_ainstrspeed
ELI FEAT_INSTRSPEED>1
lda #FEAT_INSTRSPEED
sta v_ainstrspeed
EIF
;RELOC: Addresses of tables instruments, tracks lo, track hi, song
IFT FEAT_RELOC==1
ldy #8
ri1 lda (ns),y
clc
adc rmt_offset
sta p_tis-8,y
iny
lda (ns),y
adc rmt_offset+1
sta p_tis-8,y
iny
cpy #8+8
bne ri1
ELS
ldy #8
ri1 lda (ns),y
sta p_tis-8,y
iny
cpy #8+8
bne ri1
EIF
IFT FEAT_NOSTARTINGSONGLINE==0
pla
pha
IFT TRACKS>4
asl @
asl @
asl @
clc
adc p_song
sta p_song
pla
php
and #$e0
asl @
rol @
rol @
rol @
ELS
asl @
asl @
clc
adc p_song
sta p_song
pla
php
and #$c0
asl @
rol @
rol @
EIF
plp
adc p_song+1
sta p_song+1
EIF
jsr GetSongLineTrackLineInitOfNewSetInstrumentsOnlyRmtp3
rmt_silence
IFT STEREOMODE>0
lda #0
sta $d208
sta $d218
ldy #3
sty $d20f
sty $d21f
ldy #8
si1 sta $d200,y
sta $d210,y
dey
bpl si1
ELS
lda #0
sta $d208
ldy #3
sty $d20f
ldy #8
si1 sta $d200,y
dey
bpl si1
EIF
IFT FEAT_INSTRSPEED==0
lda v_instrspeed
ELS
lda #FEAT_INSTRSPEED
EIF
rts
GetSongLineTrackLineInitOfNewSetInstrumentsOnlyRmtp3
GetSongLine
ldx #0
stx v_abeat
nn0
nn1 txa
tay
lda (p_song),y
cmp #$fe
bcs nn2
tay
lda (p_trackslbstable),y
IFT FEAT_RELOC==1
clc
adc rmt_offset
EIF
sta trackn_db,x
lda (p_trackshbstable),y
IFT FEAT_RELOC==1
adc rmt_offset+1
EIF
nn1a
sta trackn_hb,x
lda #0
sta trackn_idx,x
lda #1
nn1a2 sta trackn_pause,x
lda #$80
sta trackn_instrx2,x
inx
xtracks01 cpx #TRACKS
bne nn1
lda p_song
clc
xtracks02 adc #TRACKS
sta p_song
bcc GetTrackLine
inc p_song+1
nn1b
jmp GetTrackLine
nn2
beq nn3
nn2a
lda #0
beq nn1a2
nn3 ;Song jump instruction
ldy #2
lda (p_song),y
IFT FEAT_RELOC==1
clc
adc rmt_offset
EIF
tax
iny
lda (p_song),y
IFT FEAT_RELOC==1
adc rmt_offset+1
EIF
sta p_song+1
stx p_song
ldx #0
beq nn0
GetTrackLine
oo0
oo0a
IFT FEAT_CONSTANTSPEED==0
lda #$ff
v_speed equ *-1
sta v_bspeed
EIF
ldx #-1
oo1
inx
dec trackn_pause,x
bne oo1x
oo1b
lda trackn_db,x
sta ns
lda trackn_hb,x
sta ns+1
oo1i
ldy trackn_idx,x
inc trackn_idx,x
lda (ns),y
sta reg1
and #$3f
cmp #61
beq oo1a
bcs oo2
sta trackn_note,x
IFT FEAT_BASS16
sta trackn_outnote,x
EIF
iny
lda (ns),y
lsr @
and #$3f*2
sta trackn_instrx2,x
oo1a
lda #1
sta trackn_pause,x
ldy trackn_idx,x
inc trackn_idx,x
lda (ns),y
lsr @
ror reg1
lsr @
ror reg1
lda reg1
IFT FEAT_GLOBALVOLUMEFADE
sec
sbc #$00
RMTGLOBALVOLUMEFADE equ *-1
bcs voig
lda #0
voig
EIF
and #$f0
sta trackn_volume,x
oo1x
xtracks03sub1 cpx #TRACKS-1
bne oo1
IFT FEAT_CONSTANTSPEED==0
lda #$ff
v_bspeed equ *-1
sta v_speed
ELS
lda #FEAT_CONSTANTSPEED
EIF
sta v_aspeed
jmp InitOfNewSetInstrumentsOnly
oo2
cmp #63
beq oo63
lda reg1
and #$c0
beq oo62_b
asl @
rol @
rol @
sta trackn_pause,x
jmp oo1x
oo62_b
iny
lda (ns),y
sta trackn_pause,x
inc trackn_idx,x
jmp oo1x
oo63
lda reg1
IFT FEAT_CONSTANTSPEED==0
bmi oo63_1X
iny
lda (ns),y
sta v_bspeed
inc trackn_idx,x
jmp oo1i
oo63_1X
EIF
cmp #255
beq oo63_11
iny
lda (ns),y
sta trackn_idx,x
jmp oo1i
oo63_11
jmp GetSongLine
p2xrmtp3 jmp rmt_p3
p2x0 dex
bmi p2xrmtp3
InitOfNewSetInstrumentsOnly
p2x1 ldy trackn_instrx2,x
bmi p2x0
IFT FEAT_SFX
jsr SetUpInstrumentY2
jmp p2x0
rmt_sfx
sta trackn_note,x
IFT FEAT_BASS16
sta trackn_outnote,x
EIF
lda #$f0 ;* sfx note volume*16
RMTSFXVOLUME equ *-1 ;* label for sfx note volume parameter overwriting
sta trackn_volume,x
EIF
SetUpInstrumentY2
lda (p_instrstable),y
IFT FEAT_RELOC==1
clc
adc rmt_offset
EIF
sta trackn_instrdb,x
sta nt
iny
lda (p_instrstable),y
IFT FEAT_RELOC==1
adc rmt_offset+1
EIF
sta trackn_instrhb,x
sta nt+1
IFT FEAT_FILTER
lda #1
sta trackn_filter,x
EIF
IFT FEAT_TABLEGO
IFT FEAT_FILTER
tay
ELS
ldy #1
EIF
lda (nt),y
sta trackn_tablelop,x
iny
ELS
ldy #2
EIF
lda (nt),y
sta trackn_instrlen,x
iny
lda (nt),y
sta trackn_instrlop,x
iny
lda (nt),y
sta trackn_tabletypespeed,x
IFT FEAT_TABLETYPE||FEAT_TABLEMODE
and #$3f
EIF
sta trackn_tablespeeda,x
IFT FEAT_TABLEMODE
lda (nt),y
and #$40
sta trackn_tablemode,x
EIF
IFT FEAT_AUDCTLMANUALSET
iny
lda (nt),y
sta trackn_audctl,x
iny
ELS
ldy #6
EIF
lda (nt),y
sta trackn_volumeslidedepth,x
IFT FEAT_VOLUMEMIN
iny
lda (nt),y
sta trackn_volumemin,x
IFT FEAT_EFFECTS
iny
EIF
ELS
IFT FEAT_EFFECTS
ldy #8
EIF
EIF
IFT FEAT_EFFECTS
lda (nt),y
sta trackn_effdelay,x
IFT FEAT_EFFECTVIBRATO
iny
lda (nt),y
tay
lda vibtabbeg,y
sta trackn_effvibratoa,x
EIF
IFT FEAT_EFFECTFSHIFT
ldy #10
lda (nt),y
sta trackn_effshift,x
EIF
EIF
lda #128
sta trackn_volumeslidevalue,x
sta trackn_instrx2,x
asl @
sta trackn_instrreachend,x
sta trackn_shiftfrq,x
tay
lda (nt),y
sta trackn_tableend,x
adc #0
sta trackn_instridx,x
lda #INSTRPAR
sta trackn_tablea,x
tay
lda (nt),y
sta trackn_tablenote,x
xata_rtshere
IFT FEAT_SFX
rts
ELS
jmp p2x0
EIF
rmt_play
rmt_p0
jsr SetPokey
rmt_p1
IFT FEAT_INSTRSPEED==0||FEAT_INSTRSPEED>1
dec v_ainstrspeed
bne rmt_p3
EIF
IFT FEAT_INSTRSPEED==0
lda #$ff
v_instrspeed equ *-1
sta v_ainstrspeed
ELI FEAT_INSTRSPEED>1
lda #FEAT_INSTRSPEED
sta v_ainstrspeed
EIF
rmt_p2
dec v_aspeed
bne rmt_p3
inc v_abeat
lda #$ff
v_abeat equ *-1
cmp #$ff
v_maxtracklen equ *-1
beq p2o3
jmp GetTrackLine
p2o3
jmp GetSongLineTrackLineInitOfNewSetInstrumentsOnlyRmtp3
go_ppnext jmp ppnext
rmt_p3
lda #>frqtab
sta nr+1
xtracks05sub1 ldx #TRACKS-1
pp1
lda trackn_instrhb,x
beq go_ppnext
sta ns+1
lda trackn_instrdb,x
sta ns
ldy trackn_instridx,x
lda (ns),y
sta reg1
iny
lda (ns),y
sta reg2
iny
lda (ns),y
sta reg3
iny
tya
cmp trackn_instrlen,x
bcc pp2
beq pp2
lda #$80
sta trackn_instrreachend,x
pp1b
lda trackn_instrlop,x
pp2 sta trackn_instridx,x
lda reg1
IFT TRACKS>4
cpx #4
bcc pp2s
lsr @
lsr @
lsr @
lsr @
pp2s
EIF
and #$0f
ora trackn_volume,x
tay
lda volumetab,y
sta tmp
lda reg2
and #$0e
tay
lda tabbeganddistor,y
sta nr
lda tmp
ora tabbeganddistor+1,y
sta trackn_audc,x
InstrumentsEffects
IFT FEAT_EFFECTS
lda trackn_effdelay,x
beq ei2
cmp #1
bne ei1
lda trackn_shiftfrq,x
IFT FEAT_EFFECTFSHIFT
clc
adc trackn_effshift,x
EIF
IFT FEAT_EFFECTVIBRATO
clc
ldy trackn_effvibratoa,x
adc vib0,y
EIF
sta trackn_shiftfrq,x
IFT FEAT_EFFECTVIBRATO
lda vibtabnext,y
sta trackn_effvibratoa,x
EIF
jmp ei2
ei1
dec trackn_effdelay,x
ei2
EIF
ldy trackn_tableend,x
cpy #INSTRPAR+1
bcc ei3
lda trackn_tablespeeda,x
bpl ei2f
ei2c
tya
cmp trackn_tablea,x
bne ei2c2
IFT FEAT_TABLEGO
lda trackn_tablelop,x
ELS
lda #INSTRPAR
EIF
sta trackn_tablea,x
bne ei2a
ei2c2
inc trackn_tablea,x
ei2a
lda trackn_instrdb,x
sta nt
lda trackn_instrhb,x
sta nt+1
ldy trackn_tablea,x
lda (nt),y
IFT FEAT_TABLEMODE
ldy trackn_tablemode,x
beq ei2e
clc
adc trackn_tablenote,x
ei2e
EIF
sta trackn_tablenote,x
lda trackn_tabletypespeed,x
IFT FEAT_TABLETYPE||FEAT_TABLEMODE
and #$3f
EIF
ei2f
sec
sbc #1
sta trackn_tablespeeda,x
ei3
lda trackn_instrreachend,x
bpl ei4
lda trackn_volume,x
beq ei4
IFT FEAT_VOLUMEMIN
cmp trackn_volumemin,x
beq ei4
bcc ei4
EIF
tay
lda trackn_volumeslidevalue,x
clc
adc trackn_volumeslidedepth,x
sta trackn_volumeslidevalue,x
bcc ei4
tya
sbc #16
sta trackn_volume,x
ei4
IFT FEAT_COMMAND2
lda #0
sta frqaddcmd2
EIF
IFT FEAT_COMMAND1||FEAT_COMMAND2||FEAT_COMMAND3||FEAT_COMMAND4||FEAT_COMMAND5||FEAT_COMMAND6||FEAT_COMMAND7SETNOTE||FEAT_COMMAND7VOLUMEONLY
lda reg2
IFT FEAT_FILTER||FEAT_BASS16
sta trackn_command,x
EIF
and #$70
IFT 1==[FEAT_COMMAND1+FEAT_COMMAND2+FEAT_COMMAND3+FEAT_COMMAND4+FEAT_COMMAND5+FEAT_COMMAND6+[FEAT_COMMAND7SETNOTE||FEAT_COMMAND7VOLUMEONLY]]
beq cmd0
ELS
lsr @
lsr @
sta jmx+1
jmx bcc *
jmp cmd0
nop
jmp cmd1
IFT FEAT_COMMAND2||FEAT_COMMAND3||FEAT_COMMAND4||FEAT_COMMAND5||FEAT_COMMAND6||FEAT_COMMAND7SETNOTE||FEAT_COMMAND7VOLUMEONLY
nop
jmp cmd2
EIF
IFT FEAT_COMMAND3||FEAT_COMMAND4||FEAT_COMMAND5||FEAT_COMMAND6||FEAT_COMMAND7SETNOTE||FEAT_COMMAND7VOLUMEONLY
nop
jmp cmd3
EIF
IFT FEAT_COMMAND4||FEAT_COMMAND5||FEAT_COMMAND6||FEAT_COMMAND7SETNOTE||FEAT_COMMAND7VOLUMEONLY
nop
jmp cmd4
EIF
IFT FEAT_COMMAND5||FEAT_COMMAND6||FEAT_COMMAND7SETNOTE||FEAT_COMMAND7VOLUMEONLY
nop
jmp cmd5
EIF
IFT FEAT_COMMAND6||FEAT_COMMAND7SETNOTE||FEAT_COMMAND7VOLUMEONLY
nop
jmp cmd6
EIF
IFT FEAT_COMMAND7SETNOTE||FEAT_COMMAND7VOLUMEONLY
nop
jmp cmd7
EIF
EIF
ELS
IFT FEAT_FILTER||FEAT_BASS16
lda reg2
sta trackn_command,x
EIF
EIF
cmd1
IFT FEAT_COMMAND1
lda reg3
jmp cmd0c
EIF
cmd2
IFT FEAT_COMMAND2
lda reg3
sta frqaddcmd2
lda trackn_note,x
jmp cmd0a
EIF
cmd3
IFT FEAT_COMMAND3
lda trackn_note,x
clc
adc reg3
sta trackn_note,x
jmp cmd0a
EIF
cmd4
IFT FEAT_COMMAND4
lda trackn_shiftfrq,x
clc
adc reg3
sta trackn_shiftfrq,x
lda trackn_note,x
jmp cmd0a
EIF
cmd5
IFT FEAT_COMMAND5&&FEAT_PORTAMENTO
IFT FEAT_TABLETYPE
lda trackn_tabletypespeed,x
bpl cmd5a1
ldy trackn_note,x
lda (nr),y
clc
adc trackn_tablenote,x
jmp cmd5ax
EIF
cmd5a1
lda trackn_note,x
clc
adc trackn_tablenote,x
cmp #61
bcc cmd5a2
lda #63
cmd5a2
tay
lda (nr),y
cmd5ax
sta trackn_portafrqc,x
ldy reg3
bne cmd5a
sta trackn_portafrqa,x
cmd5a
tya
lsr @
lsr @
lsr @
lsr @
sta trackn_portaspeed,x
sta trackn_portaspeeda,x
lda reg3
and #$0f
sta trackn_portadepth,x
lda trackn_note,x
jmp cmd0a
ELI FEAT_COMMAND5
lda trackn_note,x
jmp cmd0a
EIF
cmd6
IFT FEAT_COMMAND6&&FEAT_FILTER
lda reg3
clc
adc trackn_filter,x
sta trackn_filter,x
lda trackn_note,x
jmp cmd0a
ELI FEAT_COMMAND6
lda trackn_note,x
jmp cmd0a
EIF
cmd7
IFT FEAT_COMMAND7SETNOTE||FEAT_COMMAND7VOLUMEONLY
IFT FEAT_COMMAND7SETNOTE
lda reg3
IFT FEAT_COMMAND7VOLUMEONLY
cmp #$80
beq cmd7a
EIF
sta trackn_note,x
jmp cmd0a
EIF
IFT FEAT_COMMAND7VOLUMEONLY
cmd7a
lda trackn_audc,x
ora #$f0
sta trackn_audc,x
lda trackn_note,x
jmp cmd0a
EIF
EIF
cmd0
lda trackn_note,x
clc
adc reg3
cmd0a
IFT FEAT_TABLETYPE
ldy trackn_tabletypespeed,x
bmi cmd0b
EIF
clc
adc trackn_tablenote,x
cmp #61
bcc cmd0a1
lda #0
sta trackn_audc,x
lda #63
cmd0a1
IFT FEAT_BASS16
sta trackn_outnote,x
EIF
tay
lda (nr),y
clc
adc trackn_shiftfrq,x
IFT FEAT_COMMAND2
clc
adc frqaddcmd2
EIF
IFT FEAT_TABLETYPE
jmp cmd0c
cmd0b
cmp #61
bcc cmd0b1
lda #0
sta trackn_audc,x
lda #63
cmd0b1
tay
lda trackn_shiftfrq,x
clc
adc trackn_tablenote,x
clc
adc (nr),y
IFT FEAT_COMMAND2
clc
adc frqaddcmd2
EIF
EIF
cmd0c
sta trackn_audf,x
pp9
IFT FEAT_PORTAMENTO
lda trackn_portaspeeda,x
beq pp10
dec trackn_portaspeeda,x
bne pp10
lda trackn_portaspeed,x
sta trackn_portaspeeda,x
lda trackn_portafrqa,x
cmp trackn_portafrqc,x
beq pp10
bcs pps1
adc trackn_portadepth,x
bcs pps8
cmp trackn_portafrqc,x
bcs pps8
jmp pps9
pps1
sbc trackn_portadepth,x
bcc pps8
cmp trackn_portafrqc,x
bcs pps9
pps8
lda trackn_portafrqc,x
pps9
sta trackn_portafrqa,x
pp10
lda reg2
and #$01
beq pp11
lda trackn_portafrqa,x
clc
adc trackn_shiftfrq,x
sta trackn_audf,x
pp11
EIF
ppnext
dex
bmi rmt_p4
jmp pp1
rmt_p4
IFT FEAT_AUDCTLMANUALSET
lda trackn_audctl+0
ora trackn_audctl+1
ora trackn_audctl+2
ora trackn_audctl+3
tax
ELS
ldx #0
EIF
qq1
stx v_audctl
IFT FEAT_FILTER
IFT FEAT_FILTERG0L
lda trackn_command+0
bpl qq2
lda trackn_audc+0
and #$0f
beq qq2
lda trackn_audf+0
clc
adc trackn_filter+0
sta trackn_audf+2
IFT FEAT_COMMAND7VOLUMEONLY&&FEAT_VOLUMEONLYG2L
lda trackn_audc+2
and #$10
bne qq1a
EIF
lda #0
sta trackn_audc+2
qq1a
txa
ora #4
tax
EIF
qq2
IFT FEAT_FILTERG1L
lda trackn_command+1
bpl qq3
lda trackn_audc+1
and #$0f
beq qq3
lda trackn_audf+1
clc
adc trackn_filter+1
sta trackn_audf+3
IFT FEAT_COMMAND7VOLUMEONLY&&FEAT_VOLUMEONLYG3L
lda trackn_audc+3
and #$10
bne qq2a
EIF
lda #0
sta trackn_audc+3
qq2a
txa
ora #2
tax
EIF
qq3
IFT FEAT_FILTERG0L||FEAT_FILTERG1L
cpx v_audctl
bne qq5
EIF
EIF
IFT FEAT_BASS16
IFT FEAT_BASS16G1L
lda trackn_command+1
and #$0e
cmp #6
bne qq4
lda trackn_audc+1
and #$0f
beq qq4
ldy trackn_outnote+1
lda frqtabbasslo,y
sta trackn_audf+0
lda frqtabbasshi,y
sta trackn_audf+1
IFT FEAT_COMMAND7VOLUMEONLY&&FEAT_VOLUMEONLYG0L
lda trackn_audc+0
and #$10
bne qq3a
EIF
lda #0
sta trackn_audc+0
qq3a
txa
ora #$50
tax
EIF
qq4
IFT FEAT_BASS16G3L
lda trackn_command+3
and #$0e
cmp #6
bne qq5
lda trackn_audc+3
and #$0f
beq qq5
ldy trackn_outnote+3
lda frqtabbasslo,y
sta trackn_audf+2
lda frqtabbasshi,y
sta trackn_audf+3
IFT FEAT_COMMAND7VOLUMEONLY&&FEAT_VOLUMEONLYG2L
lda trackn_audc+2
and #$10
bne qq4a
EIF
lda #0
sta trackn_audc+2
qq4a
txa
ora #$28
tax
EIF
EIF
qq5
stx v_audctl
IFT TRACKS>4
IFT FEAT_AUDCTLMANUALSET
lda trackn_audctl+4
ora trackn_audctl+5
ora trackn_audctl+6
ora trackn_audctl+7
tax
ELS
ldx #0
EIF
stx v_audctl2
IFT FEAT_FILTER
IFT FEAT_FILTERG0R
lda trackn_command+0+4
bpl qs2
lda trackn_audc+0+4
and #$0f
beq qs2
lda trackn_audf+0+4
clc
adc trackn_filter+0+4
sta trackn_audf+2+4
IFT FEAT_COMMAND7VOLUMEONLY&&FEAT_VOLUMEONLYG2R
lda trackn_audc+2+4
and #$10
bne qs1a
EIF
lda #0
sta trackn_audc+2+4
qs1a
txa
ora #4
tax
EIF
qs2
IFT FEAT_FILTERG1R
lda trackn_command+1+4
bpl qs3
lda trackn_audc+1+4
and #$0f
beq qs3
lda trackn_audf+1+4
clc
adc trackn_filter+1+4
sta trackn_audf+3+4
IFT FEAT_COMMAND7VOLUMEONLY&&FEAT_VOLUMEONLYG3R
lda trackn_audc+3+4
and #$10
bne qs2a
EIF
lda #0
sta trackn_audc+3+4
qs2a
txa
ora #2
tax
EIF
qs3
IFT FEAT_FILTERG0R||FEAT_FILTERG1R
cpx v_audctl2
bne qs5
EIF
EIF
IFT FEAT_BASS16
IFT FEAT_BASS16G1R
lda trackn_command+1+4
and #$0e
cmp #6
bne qs4
lda trackn_audc+1+4
and #$0f
beq qs4
ldy trackn_outnote+1+4
lda frqtabbasslo,y
sta trackn_audf+0+4
lda frqtabbasshi,y
sta trackn_audf+1+4
IFT FEAT_COMMAND7VOLUMEONLY&&FEAT_VOLUMEONLYG0R
lda trackn_audc+0+4
and #$10
bne qs3a
EIF
lda #0
sta trackn_audc+0+4
qs3a
txa
ora #$50
tax
EIF
qs4
IFT FEAT_BASS16G3R
lda trackn_command+3+4
and #$0e
cmp #6
bne qs5
lda trackn_audc+3+4
and #$0f
beq qs5
ldy trackn_outnote+3+4
lda frqtabbasslo,y
sta trackn_audf+2+4
lda frqtabbasshi,y
sta trackn_audf+3+4
IFT FEAT_COMMAND7VOLUMEONLY&&FEAT_VOLUMEONLYG2R
lda trackn_audc+2+4
and #$10
bne qs4a
EIF
lda #0
sta trackn_audc+2+4
qs4a
txa
ora #$28
tax
EIF
EIF
qs5
stx v_audctl2
EIF
rmt_p5
IFT FEAT_INSTRSPEED==0||FEAT_INSTRSPEED>1
lda #$ff
v_ainstrspeed equ *-1
ELS
lda #1
EIF
rts
SetPokey
IFT STEREOMODE==1 ;* L1 L2 L3 L4 R1 R2 R3 R4
ldy #$ff
v_audctl2 equ *-1
lda trackn_audf+0+4
ldx trackn_audf+0
xstastx01 sta $d210
stx $d200
lda trackn_audc+0+4
ldx trackn_audc+0
xstastx02 sta $d211
stx $d201
lda trackn_audf+1+4
ldx trackn_audf+1
xstastx03 sta $d212
stx $d202
lda trackn_audc+1+4
ldx trackn_audc+1
xstastx04 sta $d213
stx $d203
lda trackn_audf+2+4
ldx trackn_audf+2
xstastx05 sta $d214
stx $d204
lda trackn_audc+2+4
ldx trackn_audc+2
xstastx06 sta $d215
stx $d205
lda trackn_audf+3+4
ldx trackn_audf+3
xstastx07 sta $d216
stx $d206
lda trackn_audc+3+4
ldx trackn_audc+3
xstastx08 sta $d217
stx $d207
lda #$ff
v_audctl equ *-1
xstysta01 sty $d218
sta $d208
ELI STEREOMODE==0 ;* L1 L2 L3 L4
ldy #$ff
v_audctl equ *-1
lda trackn_audf+0
ldx trackn_audc+0
sta $d200
stx $d201
lda trackn_audf+1
ldx trackn_audc+1
sta $d200+2
stx $d201+2
lda trackn_audf+2
ldx trackn_audc+2
sta $d200+4
stx $d201+4
lda trackn_audf+3
ldx trackn_audc+3
sta $d200+6
stx $d201+6
sty $d208
ELI STEREOMODE==2 ;* L1 R2 R3 L4
ldy #$ff
v_audctl equ *-1
lda trackn_audf+0
ldx trackn_audc+0
sta $d200
stx $d201
sta $d210
lda trackn_audf+1
ldx trackn_audc+1
sta $d210+2
stx $d211+2
lda trackn_audf+2
ldx trackn_audc+2
sta $d210+4
stx $d211+4
sta $d200+4
lda trackn_audf+3
ldx trackn_audc+3
sta $d200+6
stx $d201+6
sta $d210+6
sty $d218
sty $d208
ELI STEREOMODE==3 ;* L1 L2 R3 R4
ldy #$ff
v_audctl equ *-1
lda trackn_audf+0
ldx trackn_audc+0
sta $d200
stx $d201
lda trackn_audf+1
ldx trackn_audc+1
sta $d200+2
stx $d201+2
lda trackn_audf+2
ldx trackn_audc+2
sta $d210+4
stx $d211+4
sta $d200+4
lda trackn_audf+3
ldx trackn_audc+3
sta $d210+6
stx $d211+6
sta $d200+6
sty $d218
sty $d208
EIF
rts
RMTPLAYEREND
|
; A157919: a(n) = 50*n^2 - 1.
; 49,199,449,799,1249,1799,2449,3199,4049,4999,6049,7199,8449,9799,11249,12799,14449,16199,18049,19999,22049,24199,26449,28799,31249,33799,36449,39199,42049,44999,48049,51199,54449,57799,61249,64799,68449,72199,76049,79999,84049,88199,92449,96799,101249,105799,110449,115199,120049,124999,130049,135199,140449,145799,151249,156799,162449,168199,174049,179999,186049,192199,198449,204799,211249,217799,224449,231199,238049,244999,252049,259199,266449,273799,281249,288799,296449,304199,312049,319999
mov $1,2
add $1,$0
mul $1,$0
mul $1,50
add $1,49
mov $0,$1
|
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2018, Lawrence Livermore National Security, LLC. Produced at the
// Lawrence Livermore National Laboratory in collaboration with University of
// Illinois Urbana-Champaign.
//
// Written by the LBANN Research Team (N. Dryden, N. Maruyama, et al.) listed in
// the CONTRIBUTORS file. <lbann-dev@llnl.gov>
//
// LLNL-CODE-756777.
// All rights reserved.
//
// This file is part of Aluminum GPU-aware Communication Library. For details, see
// http://software.llnl.gov/Aluminum or https://github.com/LLNL/Aluminum.
//
// Licensed under the Apache License, Version 2.0 (the "Licensee"); you
// may not use this file except in compliance with the License. You may
// obtain a copy of the License at:
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
// implied. See the License for the specific language governing
// permissions and limitations under the license.
////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <Al_config.hpp>
#include "aluminum/cuda/cuda.hpp"
namespace Al {
namespace internal {
namespace cuda {
/**
* An optimized version of CUDA events that only supports polling from the host.
* This essentially uses full/empty bit semantics to implement synchronization.
* A memory location is polled on by the host and written to by the device
* using the stream memory write operation.
* This falls back to the usual CUDA events when stream memory operations are
* not available.
* @note This is currently always falling back on CUDA events to work around a
* hang, the underlying cause of which has not been diagnosed.
*/
class GPUStatusFlag {
public:
/**
* Allocate the event.
*/
GPUStatusFlag();
~GPUStatusFlag();
/** Record the event into stream. */
void record(cudaStream_t stream);
/** Return true if the event has completed. */
bool query();
private:
struct stream_mem_t {
int32_t* sync_event __attribute__((aligned(64)));
CUdeviceptr sync_event_dev_ptr;
};
union {
stream_mem_t stream_mem;
cudaEvent_t plain_event;
};
};
} // namespace cuda
} // namespace internal
} // namespace Al
|
; A126130: a(n) = (n+1)^n - n!.
; Submitted by Jon Maiga
; 1,7,58,601,7656,116929,2092112,43006401,999637120,25933795801,742968453888,23297606120881,793708546233344,29192838847099425,1152920196932478976,48661170952876980481,2185911204051268435968,104127343895537535804841,5242879878354899591168000,278218427014049540460556401,15519448920009946800865411072,907846433651995447629132881329,55572324009576488446493418061824,3552713678180052527622381898530625,236773829992456378833464178954469376,16423203267857366685104862165125255289
mov $1,$0
add $0,1
add $1,2
pow $1,$0
seq $0,142 ; Factorial numbers: n! = 1*2*3*4*...*n (order of symmetric group S_n, number of permutations of n letters).
sub $1,$0
mov $0,$1
|
.thumb
.org 0x00
.macro blh to, reg=r3
ldr \reg, =\to
mov lr, \reg
.short 0xF800
.endm
Player:
mov r0, #0x48
mov r2, #51
mul r2, r0 @Size of Copy
ldr r1, =0x1F78 @Dest
add r1, r7, r1
ldr r0, =0x202BE4C @Player Unit Pool
blh 0x80D1724 @SaveToSram
Enemy:
mov r0, #0x48
mov r2, #50
mul r2, r0 @Size of Copy
ldr r1, =0x1F78+(51*0x48) @Dest
add r1, r7, r1
ldr r0, =0x202CFBC @Enemy Unit Pool
blh 0x80D1724 @SaveToSram
NPC:
mov r0, #0x48
mov r2, #10
mul r2, r0 @Size of Copy
ldr r1, =0x1F78+(51*0x48)+(50*0x48) @Dest
add r1, r7, r1
ldr r0, =0x202DDCC @NPC Unit Pool
blh 0x80D1724 @SaveToSram
ldr r3, =0x80A5B11
bx r3
.pool
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.