Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

103
Visualizações
Kernel driver and mmap from userspace

I'm allocating a buffer in my driver using devm_kzalloc(.., .., GFP_KERNEL) and then I register this buffer as a framebuffer driver so that it appears as a file under /dev/fb0. I can then open this file and write to it. When I do it this way, everything works fine and my data arrives in the driver memory buffer.

However, if I then mmap it in the user process like this: mmap(NULL, size, PROT_WRITE, MAP_SHARED, fd, 0), using the same file fd and try to write to the returned memory space, nothing gets written into the driver memory.

Am I forgetting something here?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Got it! I was doing it all wrong. I had to setup the vm system to correctly handle mmap and this had to be done using fb_deferred_io (which I did not even have until I enabled some unrelated drivers which selected it). Then I had to use __get_free_pages instead of devm_kzmalloc() and one last detail was to use __pa(vmem) when assigning the screen buffer pointer for fbdev subsystem. Then it started working :-)

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda