How to set up smartphones and PCs. Informational portal

UNIX-like operating system: writing the kernel in C. Manually configuring the Linux kernel

How to compose create semantic core site is correct.


Good afternoon, dear friend readers! Today in this article I want to discuss the issue of the correct compilation of the semantic core of the site and blog. After all, a correctly composed semantic core is a pledge successful promotion resource in search engines... It is a fact that the semantic core influences the nature of the promotion.

Before we consider the issue of compiling a semantic core, I would like to clarify what is all the same a semantic core?

So, semantic core of the site - a list of keywords characterizing the main topic of the resource. SEO gurus compose it so that the same site appears in search engines in top positions search results for various key queries that were compiled and included in the list of the semantic core. And so, it means that the correct compilation of the semantic core is a guarantee effective promotion site in search engines for different search queries but thematically similar to each other.

The compilation of the semantic core of a site and a blog is fundamentally different. And in general, the semantic core is used for the blog only because another name for this has probably not yet been invented.

Therefore, let's take a look at the differences between the core for a blog and a website and already decide on the methodology for compiling them. The semantic core of a blog is not a list of keywords that characterize the topic of the blog; this is a list of keywords for which promotion is planned. Do you feel the difference? If not, read this a few more times until you understand.

How to compose a semantic core

Now let's take a closer look. If in the site the semantic core is compiled and included in the structure of the site. That semantic core of the blog is the compilation of keywords in the notepad program or recorded in general in a notebook according to which the blogger decided to move to the top positions of search engines. That is, the core of the blog can be described as a search engine promotion plan and nothing more. Everything is simple, probably seoshniks deliberately powder their brains with all these terms so that a newbie in site building and blogging would run away from all this. Anyway…

And so, the semantic core of the site is composed approximately as follows! For example, you need to promote a site dedicated to selling shoes on the Internet to the top of the search results. The most suitable are calculated for this site. keywords... For example, using the service - Yandex. And so we drive a request into the service, we get something like this.

Selling shoes will most likely be included in the title of the site itself. And the rest will be written into the compiled semantic core of the site.

For example, if a site sells children's shoes, then the word "sale of children's shoes" should be included in the core, and if the site (online store) does not specialize in wholesale of shoes, then it makes no sense to include the keyword "wholesale of shoes" in the core ... After all, this is a vain advance search query... In fact, compiling a semantic core for a site is a very complex activity that requires a lot of knowledge and skills.

How to create the semantic core of your blog

Blog is another matter! He does not need to form the core so categorically. It is enough to compose keywords that define the topic of the blog and write optimized articles for them.

It is not necessary for a blog to promote the main pages, because a blog like electronic diary you can create thousands of pages and promote each page under several key queries... In order to find out how to correctly form keywords, read the article on the selection of keywords. Once you've made a list of keywords, start writing optimized articles for them. That's all selection of keywords and writing of optimized articles is the compilation of the semantic core.

Still, there is a plugin for WordPress blogs. All in One SEO Pack in which should register a list of keywords characterizing the topic of your blog. This plugin is very useful for search engine promotion Your blog. So, be sure to install it and configure this plugin in the admin panel.

I will show in the picture where to register the list of keywords for the blog core. Here is the main plugin menu, here you need to register the keywords for which you plan to promote in the search engines.

So, in order to correctly prescribe all these sections, you need to follow a certain algorithm.

In the title of the main page write the name of your blog and 1 - 2 keywords for which you want to go to the top.

In the description, you also need to make several sentences in which you also specify 2-3 keywords for which you want to reach the top.

And also in the column "Keywords" you need to select from 10 - 15 keywords for which you also want to reach the top positions of the search results.

I want to note that in this column you set up the promotion of the main page. If you choose the right keywords then home page will move up in the search engines for the given keywords.

But after installing the plugin, a similar field will be added to the records, where you can already configure and write various keywords for each separate page.

I think today I told you how to compose the semantic core of your blog and your site.

To compose a semantic core for a blog means to plan the promotion of certain words... Don't be overwhelmed by composing keywords and writing relevant articles to your blog. This is the first stage internal optimization your blog.

Well, I don’t say goodbye to you, dear friends! Until next time in new articles!

From now on I will write more and more about internal optimization, since it is very important. 80% of successful promotion depends on internal blog optimization and 20% depends on external factors... Don't rush to the stock exchanges and buy links to your blog. Instead, focus on the internal customization of your blog. In order not to miss helpful articles on internal optimization, do not forget to

Selection of the best interesting facts, take a look and relax!

When you start reading website promotion tutorials, it always starts with creating a semantic core. For beginners, this first step is the most difficult. In addition to the fact that it is not immediately clear what this semantic core is, it is not yet clear what purpose it has and how to create it correctly.

In this article, we will talk about how to correctly create the semantic core of the site. And also you will learn about what it is and why it is made. In fact, there is nothing complicated and difficult in the concept of a semantic core. Let's figure it out.

No one has yet answered the question of what the semantic core is such in simple words as we will do now. So, the semantic core of the site is a list of key phrases by which it will be promoted. Everything! The whole point of the concept in one short, clear sentence. And there is no need to muddy anything with clever terms.

If you go deeper into the term, then semantics is a science that deals with the semantic filling of lexical units. In simple terms, semantics studies the meaning of something. V SEO semantic the core makes it clear the meaning of the entire site, its any section or a single selected article. This becomes clear to the search engine, the visitor, all the developers who will work with the site.

The semantic core, without exaggeration, is the foundation of all progress.

How to use the semantic core and what it is for

The functions of the semantic core include the following aspects of website promotion:

  • The most the main task the semantic core is an understanding of the structure of the site and its fullness. Looking at it, you can imagine what sections the site will have, and what articles will be in each section. And thus, all the disadvantages and inconveniences of the structure are immediately visible, and they can be eliminated at an early stage.
  • Semantics defines the content vector. Thanks to a better understanding of the structure of the site, you can choose the most relevant and effective key phrases.
  • The semantic core is the content plan of the site for many years to come. Every time you need to write articles, you can look there and see what content was planned and in which section of the site it should be.
  • If planned paid promotion site, for example, due to contextual advertising, then thanks to the semantic core, you can calculate the cost of promotion.

How to make a semantic core

First you need to decide where you will get the key phrases for the kernel. The best source for beginners is the Yandex WordPStat service, which shows how many times a month a particular query was entered into Yandex search. WordStat has a variety of useful functions, for example, you can filter queries by region or device, watch similar queries, and much more. And most importantly, it is completely free. More on this.

You can use a variety of paid programs, but for beginners, WordStat is better suited, in view of its simplicity. In addition, it is suitable not only for Runet, where Yandex prevails. If you are promoting a site within the CIS, then you can safely use it, and the statistics on Google will be about the same.

The main essence of creating a semantic core is the collection of key phrases that somehow fit the topic of the site. They need to be formalized and systematized somehow. For this, tables are best suited, for example Excel, tables in Google doc or similar.

And for greater efficiency, additional graphs can be added to the semantic core table:

  • Naturally, there should be a graph with the most key phrase.
  • Of course, the column with the name of the site section where this phrase will be used.
  • You can add a column with meta tags titile and description and immediately write a title and description for the article using the specified key phrase... Firstly, it will be immediately clear what to write an article about, and secondly, then there will be no need to puzzle over and invent it.
  • You can make a column to indicate the number of characters in the article for a given key phrase in order to better understand the content plan.
  • When it comes to promotion contextual advertising, you need to add the ad cost for each request.
  • Everything that should be needed can be safely written into the table of the sematic core. There is no template for this, so you can do whatever you want and it is convenient there.

Common mistakes when creating a semantic core

Now you know how to correctly create the semantic core of the site. Let's take a look at some of the common mistakes beginner SEOs make.

  • If the core provides for the division of the site into categories, then common mistake is to create deep levels of nesting. The second level is recommended and no further. That is, you can create a heading, a sub-heading, and that's all, it is no longer possible to divide it further into smaller headings.
  • Beginners can ignore low-frequency queries, since they believe that it is impractical to use them, they still will not bring a lot of traffic. But in fact, the opposite is true. For a new site, it is precisely low-frequency, non-competitive queries that are needed.
  • You cannot completely trust the service with which key phrases will be extracted. And newbies do just that. Machines can be wrong and choose the wrong one.
  • No need to create an article for the sake of a key phrase. If you find the phrases “urgently sell a house” and “sell a house quickly”, then there is no point in making two different articles for them.

UNIX-like operating system interesting to parse, as well as to write your own kernel that will print a message. Well, shall we write?

UNIX-like operating system and booting an x86 machine

What is a UNIX-like operating system? It is an OS influenced by UNIX. But before we get into writing a kernel for it, let's see how the machine boots and transfers control to the kernel.

Most x86 processor registers have well-defined values ​​after power-up. The Instruction Pointer Register (EIP) contains the memory address for the instruction executed by the processor. EIP is hardcoded to the value 0xFFFFFFF0. Thus, the processor has clear instructions for the physical address 0xFFFFFFF0, which is essentially the last 16 bytes of the 32-bit address space. This address is called the reset vector.

The chipset memory stick now ensures that 0xFFFFFFF0 maps to a certain part BIOS, not RAM. Meanwhile, the BIOS copies itself to RAM for more quick access... This is called shadowing. Address 0xFFFFFFF0 will only contain the instruction to go to the memory address where the BIOS copied itself.

Thus, the BIOS code begins to execute. The BIOS first looks for boot device according to the configured boot device order. It looks for a certain magic number to determine if the device is bootable or not (bytes 511 and 512 of the first sector are 0xAA55).

After the BIOS detects the boot device, it copies the contents of the first sector of the device to RAM starting from physical address 0x7c00; then navigates to the address and executes the code you just loaded. This code is called the bootloader.

The bootloader then loads the kernel at physical address 0x100000. Address 0x100000 is used as the starting address for all large kernels on x86 machines.

All x86 processors start in a simplified 16-bit mode called real addresses. GRUB bootloader switches to 32-bit protected mode by setting the least significant bit of CR0 to 1. Thus, the kernel boots into 32-bit protected mode.

Please note that in case of detection Linux kernels, GRUB will get the boot log and boot the Linux kernel into real mode... And the Linux kernel will make the switch to protected mode.

What do we need?

  • x86 computer (of course)
  • NASM assembler
  • ld (GNU Linker)
  • Source

Well, it would be nice to have an idea of ​​how a UNIX-like OS works. The source code can be found in the Github repository.

Kernel entry point and launch

First, let's write a small file in x86 assembler that will be the starting point for starting the kernel. This file will call external function in C and then will stop the program flow.

How do you make sure this code serves as the starting point for the kernel?

We will use a linker script that links the object files to create the final executable file kernels. In this script, we will explicitly indicate that binary file must be loaded at address 0x100000. This address is where the kernel should be.

Here is the assembly code:

;; kernel.asm bits 32; nasm directive - 32 bit section .text global start extern kmain; kmain is defined in C-file start: cli; interrupt block mov esp, stack_space; set stack pointer call kmain hlt; processor stop section .bss resb 8192; 8KB per stack stack_space:

The first bits 32 instruction is not an x86 assembly instruction. This is a directive for the NASM assembler that states that it must generate code to run on a processor running in 32-bit mode. This is not required in our example, however it is good practice- to indicate such things explicitly.

The second line starts with a text section. This is where we will place all of our code.

global is another NASM directive used to set symbols source code as global.

kmain is a custom function that will be defined in our kernel.c file. extern declares that the function is defined elsewhere.

The start function calls the kmain function and stops the CPU with the hlt command. Interrupts can wake the CPU from executing an hlt instruction. Therefore, we first disable interrupts using the cli instruction.

Ideally, you should allocate some memory for the stack and point to it using a stack pointer (esp). However, GRUB does it for us, and the stack pointer is already set. However, to be sure, we will allocate some space in the BSS section and put the stack pointer at the beginning of the allocated memory. To do this, we use the resb command, which reserves memory in bytes. After that, a label remains that points to the edge of the reserved memory chunk. Before calling kmain, the stack pointer (esp) is used to point to this space using the mov command.

Kernel in C

In kernel.asm, we made a call to the kmain () function. Thus, the C code will start executing in kmain ():

/ * * kernel.c * / void kmain (void) (const char * str = "my first kernel"; char * vidptr = (char *) 0xb8000; // video memory starts here unsigned int i = 0; unsigned int j = 0; / * this loop clears the screen * / while (j< 80 * 25 * 2) { /* пустой символ */ vidptr[j] = " "; /* байт атрибутов */ vidptr = 0x07; j = j + 2; } j = 0; /* в этом цикле строка записывается в видео память */ while(str[j] != "\0") { /* ascii отображение */ vidptr[i] = str[j]; vidptr = 0x07; ++j; i = i + 2; } return; }

* kernel.c

void kmain (void)

const char * str = "my first kernel";

unsigned int i = 0;

unsigned int j = 0;

/ * this loop clears the screen * /

while (j< 80 * 25 * 2 ) {

/ * empty character * /

vidptr [j] = "";

/ * bytes of attributes * /

vidptr [j + 1] = 0x07;

j = j + 2;

j = 0;

/ * in this loop, the line is written to the video memory * /

while (str [j]! = "\ 0") (

/ * ascii display * /

vidptr [i] = str [j];

vidptr [i + 1] = 0x07;

i = i + 2;

return;

Our kernel will clear the screen and print the string "my first kernel" to it.

First, we create a vidptr pointer that points to 0xb8000. This address is the start of protected mode video memory. Screen text memory is just a chunk of memory in our address space. I / O for screen on memory card starts at 0xb8000 and supports 25 lines of 80 ascii characters each one.

Each character element in this text memory is represented by 16 bits (2 bytes), not the 8 bits (1 byte) we are used to. The first byte must have an ASCII character representation. The second byte is the attribute byte. It describes the formatting of the symbol, including various attributes such as color.

To print a character with in green on a black background, we will store the character s in the first byte of the video memory address and the value 0x02 in the second byte.

0 is black background and 2 is green.

Below is a table of codes for different colors:

0 - Black, 1 - Blue, 2 - Green, 3 - Cyan, 4 - Red, 5 - Magenta, 6 - Brown, 7 - Light Gray, 8 - Dark Gray, 9 - Light Blue, 10 / a - Light Green, 11 / b - Light Cyan, 12 / c - Light Red, 13 / d - Light Magenta, 14 / e - Light Brown, 15 / f - White.

0 - Black, 1 - Blue, 2 - Green, 3 - Cyan, 4 - Red, 5 - Magenta, 6 - Brown, 7 - Light Gray, 8 - Dark Gray, 9 - Light Blue, 10 / a - Light Green, 11 / b - Light Cyan, 12 / c - Light Red, 13 / d - Light Magenta, 14 / e - Light Brown, 15 / f - White.

In our kernel, we will use light gray characters on a black background. Therefore, our attribute byte must be 0x07.

In the first while loop the program writes a null character with attribute 0x07 across all 80 columns of 25 lines. This clears the screen.

In the second while loop, the characters of the string "my first kernel" are written to a piece of video memory. For each character, the attribute byte contains the value 0x07.

Thus, the line will be displayed on the screen.

Connecting part

We compile kernel.asm and NASM into an object file and then use GCC to compile kernel.c into another object file. Now our task is to associate these objects with the executable bootable kernel.

To do this, we use an explicit linker script that can be passed as an argument to ld (our linker).

/ * * link.ld * / OUTPUT_FORMAT (elf32-i386) ENTRY (start) SECTIONS (. = 0x100000; .text: (* (. text)) .data: (* (. data)) .bss: (* ( .bss)))

* link.ld

OUTPUT_FORMAT (elf32 - i386)

ENTRY (start)

SECTIONS

0x100000;

Text: (* (. Text))

Data: (* (. Data))

Bss: (* (. Bss))

First, we set the output format of the executable to 32-bit executable (ELF). ELF - standard format binary file for Unix-like systems on x86 architecture.

ENTRY takes one argument. It specifies the name of the symbol, which should be the entry point of our executable.

SECTIONS is the most important part where we define the markup of the executable file. This specifies how the different sections should be combined and where they will be placed.

V curly braces following a SECTIONS statement, the period character (.) - represents the location counter.

The location counter is always initialized to 0x0 at the beginning of the SECTIONS block. It can be changed by assigning a new value to it.

As mentioned, kernel code must start at 0x100000. Thus, we have set the location counter to 0x100000.

Look at next line .text: (* (. text))

The asterisk (*) is a special character that will match any file name. That is, the expression * (. Text) means all sections of the input .text from all input files.

Thus, the linker concatenates all the text sections of the object files into the text section of the executable file at the address stored in the location counter. The executable's code section starts at 0x100000.

After the linker places the text output section, the location counter is set to 0x1000000 + the size of the text output section.

Likewise, the data and bss sections are concatenated and placed on the location counter values.

Grub and Multiboot

Now all the files needed to build the kernel are ready. But since we intend to load the kernel with using GRUB, one more thing is needed.

There is a standard for booting various x86 kernels using a bootloader called the Multiboot specification.

GRUB will only boot a kernel if it conforms to the Multiboot specification.

According to it, the kernel must contain the header within its first 8 kilobytes.

In addition, this header must contain an additional 3 fields:

  • magic number field: contains the magic number 0x1BADB002, to identify the header.
  • flags field: we don't need it now, just set its value to zero.
  • checksum field: when specified, should return zero for a sum with the first two fields.

So kernel.asm will look like this:

;; kernel.asm; nasm directive - 32 bit bits 32 section .text; multiboot spec align 4 dd 0x1BADB002; magic numbers dd 0x00; flags dd - (0x1BADB002 + 0x00); check sum... mh + f + ks must be zero global start extern kmain; kmain is defined in the external file start: cli; interrupt blocking mov esp, stack_space; stack pointer call kmain hlt; processor stop section .bss resb 8192; 8KB per stack stack_space:

; ; kernel. asm

; nasm directive - 32 bit

bits 32

section. text

; multiboot spec

align 4

dd 0x1BADB002; magic numbers

dd 0x00; flags

dd - (0x1BADB002 + 0x00); check sum. mch + f + ks should equal zero

global start

extern kmain; kmain is defined in an external file

start:

cli; interruption blocking

mov esp, stack _ space; stack pointer

call kmain

hlt; stopping the processor

Top related articles