From eac88b9f4b7708531a1dc6b30bc25f6a325a68d8 Mon Sep 17 00:00:00 2001 From: Mikhail Osipov Date: Thu, 23 Sep 2021 01:56:15 +0300 Subject: fix for dell xps 13 9300 --- main.s | 48 ++++++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 18 deletions(-) (limited to 'main.s') diff --git a/main.s b/main.s index 241d3fc..a548e94 100644 --- a/main.s +++ b/main.s @@ -74,6 +74,7 @@ DRAWCELL_ARGLEN = 8 + BYTES_PER_PIXEL .equ M_MMAP, 0002 .equ M_ICANON, 0004 .equ M_GRAPHICS, 0010 +.equ M_FBOPEN, 0020 .text .globl _start @@ -159,40 +160,40 @@ _start: cmpl $0, %eax jl open_error - orb $M_OPEN, (prog_mode) + movl %eax, (fbctl) - subl $200, %esp - movl %eax, (desc) + orb $M_FBOPEN, (prog_mode) # get frame buffer screeninfo movl %eax, %ebx movl $SYS_IOCTL, %eax movl $FBIOGET_VSCREENINFO, %ecx - movl %esp, %edx + movl $fbi, %edx int $0x80 testl %eax, %eax jnz ioctl_error - movl %esp, %esi + movl $fbi, %esi movl $fbx, %edi movsl movl $fby, %edi movsl - addl $200, %esp movl (fbx), %eax mull (fby) shll $BPP_SHIFT, %eax movl %eax, (fbsize) + orl $(FB_ACTIVATE_NOW | FB_ACTIVATE_FORCE), (fbi + FB_ACTIVATE) + # mmap fbdev into memory pushl $0 - pushl (desc) + pushl (fbctl) pushl $MAP_SHARED - pushl $(PROT_READ | PROT_WRITE) + pushl $PROT_WRITE pushl (fbsize) pushl $0 movl $SYS_MMAP, %eax @@ -209,12 +210,6 @@ _start: addl $24, %esp orb $M_MMAP, (prog_mode) - movl $SYS_CLOSE, %eax - movl (desc), %ebx - int $0x80 - - andb $~M_OPEN, (prog_mode) - # set signal handlers xorl %edx, %edx @@ -595,6 +590,15 @@ store_val: testl %edx, %edx jnz 1b + movl $SYS_IOCTL, %eax + movl (fbctl), %ebx + movl $FBIOPUT_VSCREENINFO, %ecx + movl $fbi, %edx + int $0x80 + + testl %eax, %eax + jnz ioctl_error + jmp life_loop event_handler: @@ -605,7 +609,7 @@ event_handler: testb $EV_RESTART, %al jnz read_file testb $EV_PRINT, %al - jnz export + jnz resume # is case when life is started, when its virtual terminal is nonactive # when this vt activated, process recieve SIGUSR2 signal @@ -646,14 +650,20 @@ restore: .rest_open: testb $M_OPEN, (prog_mode) - jz exit + jz .rest_fbopen movl $SYS_CLOSE, %eax movl (desc), %ebx int $0x80 -export: - jmp resume +.rest_fbopen: + testb $M_FBOPEN, (prog_mode) + jz exit + + movl $SYS_CLOSE, %eax + movl (fbctl), %ebx + int $0x80 + exit: movl %eax, %ebx @@ -1025,9 +1035,11 @@ timespec: .bss .comm desc, 4 +.comm fbctl, 4 .comm fbmem, 4 .comm fbsize, 4 .comm life_map, TOTAL_EXT +.comm fbi, 256 .comm fbx, 4 .comm fby, 4 .comm curx, 4 -- cgit v1.2.3-70-g09d2