Debug, Updated gitignore
This commit is contained in:
parent
ae288941d5
commit
ede1b4ff6a
5 changed files with 235 additions and 2 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1 +1,2 @@
|
||||||
test/**
|
test/**
|
||||||
|
.gdb_history
|
||||||
171
src/aarch64-linux-flush-dcache/.gitignore
vendored
Normal file
171
src/aarch64-linux-flush-dcache/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,171 @@
|
||||||
|
# SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
#
|
||||||
|
# NOTE! Don't add files that are generated in specific
|
||||||
|
# subdirectories here. Add them in the ".gitignore" file
|
||||||
|
# in that subdirectory instead.
|
||||||
|
#
|
||||||
|
# NOTE! Please use 'git ls-files -i -c --exclude-per-directory=.gitignore'
|
||||||
|
# command after changing this file, to see if there are
|
||||||
|
# any tracked files which get ignored after the change.
|
||||||
|
#
|
||||||
|
# Normal rules (sorted alphabetically)
|
||||||
|
#
|
||||||
|
.*
|
||||||
|
*.a
|
||||||
|
*.asn1.[ch]
|
||||||
|
*.bin
|
||||||
|
*.bz2
|
||||||
|
*.c.[012]*.*
|
||||||
|
*.dt.yaml
|
||||||
|
*.dtb
|
||||||
|
*.dtbo
|
||||||
|
*.dtb.S
|
||||||
|
*.dtbo.S
|
||||||
|
*.dwo
|
||||||
|
*.elf
|
||||||
|
*.gcno
|
||||||
|
*.gz
|
||||||
|
*.i
|
||||||
|
*.ko
|
||||||
|
*.lex.c
|
||||||
|
*.ll
|
||||||
|
*.lst
|
||||||
|
*.lz4
|
||||||
|
*.lzma
|
||||||
|
*.lzo
|
||||||
|
*.mod
|
||||||
|
*.mod.c
|
||||||
|
*.o
|
||||||
|
*.o.*
|
||||||
|
*.patch
|
||||||
|
*.rmeta
|
||||||
|
*.rpm
|
||||||
|
*.rsi
|
||||||
|
*.s
|
||||||
|
*.so
|
||||||
|
*.so.dbg
|
||||||
|
*.su
|
||||||
|
*.symtypes
|
||||||
|
*.symversions
|
||||||
|
*.tab.[ch]
|
||||||
|
*.tar
|
||||||
|
*.xz
|
||||||
|
*.zst
|
||||||
|
Module.symvers
|
||||||
|
modules.order
|
||||||
|
|
||||||
|
#
|
||||||
|
# Top-level generic files
|
||||||
|
#
|
||||||
|
/linux
|
||||||
|
/modules-only.symvers
|
||||||
|
/vmlinux
|
||||||
|
/vmlinux.32
|
||||||
|
/vmlinux.map
|
||||||
|
/vmlinux.symvers
|
||||||
|
/vmlinux-gdb.py
|
||||||
|
/vmlinuz
|
||||||
|
/System.map
|
||||||
|
/Module.markers
|
||||||
|
/modules.builtin
|
||||||
|
/modules.builtin.modinfo
|
||||||
|
/modules.nsdeps
|
||||||
|
|
||||||
|
#
|
||||||
|
# RPM spec file (make rpm-pkg)
|
||||||
|
#
|
||||||
|
/rpmbuild/
|
||||||
|
|
||||||
|
#
|
||||||
|
# Debian directory (make deb-pkg)
|
||||||
|
#
|
||||||
|
/debian/
|
||||||
|
|
||||||
|
#
|
||||||
|
# Snap directory (make snap-pkg)
|
||||||
|
#
|
||||||
|
/snap/
|
||||||
|
|
||||||
|
#
|
||||||
|
# tar directory (make tar*-pkg)
|
||||||
|
#
|
||||||
|
/tar-install/
|
||||||
|
|
||||||
|
#
|
||||||
|
# We don't want to ignore the following even if they are dot-files
|
||||||
|
#
|
||||||
|
!.clang-format
|
||||||
|
!.cocciconfig
|
||||||
|
!.get_maintainer.ignore
|
||||||
|
!.gitattributes
|
||||||
|
!.gitignore
|
||||||
|
!.kunitconfig
|
||||||
|
!.mailmap
|
||||||
|
!.rustfmt.toml
|
||||||
|
|
||||||
|
#
|
||||||
|
# Generated include files
|
||||||
|
#
|
||||||
|
/include/config/
|
||||||
|
/include/generated/
|
||||||
|
/arch/*/include/generated/
|
||||||
|
|
||||||
|
# stgit generated dirs
|
||||||
|
patches-*
|
||||||
|
|
||||||
|
# quilt's files
|
||||||
|
patches
|
||||||
|
series
|
||||||
|
|
||||||
|
# ctags files
|
||||||
|
tags
|
||||||
|
TAGS
|
||||||
|
|
||||||
|
# cscope files
|
||||||
|
cscope.*
|
||||||
|
ncscope.*
|
||||||
|
|
||||||
|
# gnu global files
|
||||||
|
GPATH
|
||||||
|
GRTAGS
|
||||||
|
GSYMS
|
||||||
|
GTAGS
|
||||||
|
|
||||||
|
# id-utils files
|
||||||
|
ID
|
||||||
|
|
||||||
|
*.orig
|
||||||
|
*~
|
||||||
|
\#*#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Leavings from module signing
|
||||||
|
#
|
||||||
|
extra_certificates
|
||||||
|
signing_key.pem
|
||||||
|
signing_key.priv
|
||||||
|
signing_key.x509
|
||||||
|
x509.genkey
|
||||||
|
|
||||||
|
# Kconfig presets
|
||||||
|
/all.config
|
||||||
|
/alldef.config
|
||||||
|
/allmod.config
|
||||||
|
/allno.config
|
||||||
|
/allrandom.config
|
||||||
|
/allyes.config
|
||||||
|
|
||||||
|
# Kconfig savedefconfig output
|
||||||
|
/defconfig
|
||||||
|
|
||||||
|
# Kdevelop4
|
||||||
|
*.kdev4
|
||||||
|
|
||||||
|
# Clang's compilation database file
|
||||||
|
/compile_commands.json
|
||||||
|
|
||||||
|
# Documentation toolchain
|
||||||
|
sphinx_*/
|
||||||
|
|
||||||
|
# Rust analyzer configuration
|
||||||
|
/rust-project.json
|
||||||
|
|
@ -77,8 +77,10 @@ static vm_fault_t my_shmem_vmops_fault(struct vm_fault *vmf)
|
||||||
mutex_lock(&my_shmem_pages_mtx);
|
mutex_lock(&my_shmem_pages_mtx);
|
||||||
if (nr_pages_from_vm_start < my_shmem_page_count) {
|
if (nr_pages_from_vm_start < my_shmem_page_count) {
|
||||||
/* Offset in range, return existing page */
|
/* Offset in range, return existing page */
|
||||||
pr_info("[%s] Found remappable page nr: %lu, offset: %lu.\n",
|
pr_info("[%s] Found remappable page nr: %lu, offset: %lu. "
|
||||||
__func__, nr_pages_from_vm_start, _dbg_offset_from_page);
|
"Total pages allocated: %ld.\n",
|
||||||
|
__func__, nr_pages_from_vm_start, _dbg_offset_from_page,
|
||||||
|
my_shmem_page_count);
|
||||||
|
|
||||||
// We won't delete elements from list here!
|
// We won't delete elements from list here!
|
||||||
struct my_shmem_page *page_entry;
|
struct my_shmem_page *page_entry;
|
||||||
|
|
|
||||||
59
src/aarch64-linux-flush-dcache/userspace/writer_addr.c
Normal file
59
src/aarch64-linux-flush-dcache/userspace/writer_addr.c
Normal file
|
|
@ -0,0 +1,59 @@
|
||||||
|
#include <unistd.h> // sysconf
|
||||||
|
#include <stdio.h> // printf
|
||||||
|
#include <stdlib.h> // exit
|
||||||
|
#include <fcntl.h> // O_RDWR
|
||||||
|
#include <sys/mman.h> // mmap
|
||||||
|
#include <string.h> // strlen
|
||||||
|
#include <errno.h> // errno
|
||||||
|
|
||||||
|
#define eprintf(args...) fprintf(stderr, ##args)
|
||||||
|
|
||||||
|
const char *DEVICE_PATH = "/dev/my_shmem";
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
/* Have:
|
||||||
|
* - Different mm => different address space
|
||||||
|
* - Different virtual address
|
||||||
|
*/
|
||||||
|
void *addr = (void *) 0x10000000;
|
||||||
|
|
||||||
|
const long PAGE_SIZE = sysconf(_SC_PAGESIZE);
|
||||||
|
if (PAGE_SIZE == -1) {
|
||||||
|
eprintf("Error retrieving page size: %d.\n", errno);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// open device file w/ RW perms
|
||||||
|
FILE *fp = fopen(DEVICE_PATH, "r+");
|
||||||
|
if (!fp) {
|
||||||
|
eprintf("Error opening device %s: %d.\n", DEVICE_PATH, errno);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
int fd = fileno(fp);
|
||||||
|
if (fd == -1) {
|
||||||
|
eprintf("Error retrieving file descriptor: %d.\n", errno);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// mmap device
|
||||||
|
void *buf = mmap(addr, PAGE_SIZE * 2, PROT_READ | PROT_WRITE,
|
||||||
|
MAP_SHARED, fd, 0);
|
||||||
|
if (!buf) {
|
||||||
|
eprintf("Error mmap-ing: %d.\n", errno);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write to mmap-ed device
|
||||||
|
char to_write[] = {0x88, 0x77, 0x66, 0x55, 0x00};
|
||||||
|
memcpy(buf, to_write, strlen(to_write));
|
||||||
|
|
||||||
|
// Unmap device
|
||||||
|
munmap(buf, PAGE_SIZE * 2);
|
||||||
|
|
||||||
|
// Close device
|
||||||
|
fclose(fp);
|
||||||
|
|
||||||
|
printf("Finished!\n");
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue