Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- push %esi #Save non-general-purpose registers
- push %edi #Save non-general-purpose registers
- push %ebp #Save non-general-purpose registers
- movl FILE, %edi #Move file descriptor into edi
- movl $0, %ebp #Offset to 0
- movl $0x2, %esi #MAP_PRIVATE
- movl $0x3, %edx #PROT_READ
- movl FSIZE, %ecx #File length
- movl $0, %ebx # *addr = NULL
- movl $90, %eax #mmap Sys Call
- int $0x80 #Call kernel
- test %eax, %eax #Error check
- js _error
- %define XRes 400h
- %define YRes 300h
- %define Mapsize (XRes*YRes*4) ; 1024x768x32
- section .text
- call MAP_FB ; mmap
- ;----------- Subroutine----
- MAP_FB: mov eax, 5 ; syscall nr: open
- xor edx, edx
- mov ebx, DEVICE ; pointer/offset auf File/Device-Name
- mov ecx, 2 ; /usr/include/bits/fcntl.h = O_RDWR
- int 80h
- mov [FD], eax ; File discriptor
- mov ebx, MMAP
- mov eax, 5Ah ; mmap(90)
- int 80h
- mov esi, eax ; pointer mmap-FRAMEBUFFER
- ret
- section .data
- DEVICE DB "/dev/fb0", 0, 0, 0, 0
- MMAP: DD 0 ; start - suggest memory address to allocate
- DD Mapsize ; length
- DD 3 ; prot (PROT_READ + PROT_WRITE)
- DD 1 ; flags (MAP_SHARED = 1)
- FD: DD 0 ; file discriptor(handle)
- DD 0 ; offset into file to start reading
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement