我正在阅读这篇关于操作系统编程的精彩剧本
http://www.cs.bham.ac.uk/~exr/lectures/opsys/10_11/lectures/os-dev.pdf
在第 12 页上有一个简单的引导加载程序。
如果我理解正确,显示的代码是您必须在 NASM 中编写的代码才能让 BIOS 打印出字符。
我不明白的是:
它说
we need interrupt 0x10 and to set ah to 0x0e (to indicate tele-type mode)
and al to the ASCII code of the character we wish to print.
Run Code Online (Sandbox Code Playgroud)
但第一条指令是:
mov ah , 0x0e ;int 10/ ah = 0eh -> scrolling teletype BIOS routine
Run Code Online (Sandbox Code Playgroud)
我不明白该行的评论。为什么第一行代码没有说:
mov ah, 0xeh
int 0x10
Run Code Online (Sandbox Code Playgroud)
如果那是你需要做的?
感谢帮助!
我知道dataSource如果设置相关配置,spring boot会自动创建一个Bean application.properties,如:
spring.datasource.url = jdbc:mysql://192.168.10.103:3306/hms?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
spring.datasource.username=root
spring.datasource.password=test@123
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
Run Code Online (Sandbox Code Playgroud)
申请代码:
package com.synline.mdataserver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.apache.tomcat.jdbc.pool.DataSource;
@SpringBootApplication
public class Application implements CommandLineRunner {
@Autowired
AnnotationConfigApplicationContext context;
/*@Autowired
DataSource dataSource;*/
public static void main(String[] args) throws InterruptedException {
SpringApplication.run(Application.class, args);
}
@Override
public void run(String... args) throws Exception {
DataSource dataSource = (DataSource)context.getBean("dataSource");
System.out.println(dataSource);
while (true) {
Thread.sleep(5000);
}
}
}
Run Code Online (Sandbox Code Playgroud)
如果@Autowired DataSource被注释掉,将打印Bean信息:
org.apache.tomcat.jdbc.pool.DataSource@1800a575{ConnectionPool[defaultAutoCommit=null; defaultReadOnly=null; ....}
Run Code Online (Sandbox Code Playgroud)
所以我认为Spring Boot真的创建了Bean.
但是如果使用了@Autowried DataSource,那么抱怨No …
我试图按照这里的说明构建一个简单的操作系统内核:http://mikeos.sourceforge.net/write-your-own-os.html
除了从软盘启动,我想创建一个基于grub的ISO映像并在模拟器中启动多重启动CD.对于多引导头,我已将以下内容添加到该页面上列出的源:
MBALIGN equ 1<<0 ; align loaded modules on page boundaries
MEMINFO equ 1<<1 ; provide memory map
FLAGS equ MBALIGN | MEMINFO ; this is the Multiboot 'flag' field
MAGIC equ 0x1BADB002 ; 'magic number' lets bootloader find the header
CHECKSUM equ -(MAGIC + FLAGS) ; checksum of above, to prove we are multiboot
section .multiboot
align 4
dd MAGIC
dd FLAGS
dd CHECKSUM
Run Code Online (Sandbox Code Playgroud)
我正在做以下事情来创建图像:
nasm -felf32 -o init.bin init.s
cp init.bin target/boot/init.bin
grub2-mkrescue -o …Run Code Online (Sandbox Code Playgroud) 我在Visual Studio中创建的asm项目调用C函数时遇到问题(Win10 x64,Visual Studio 2015).项目由一个asm文件组成:
.586
.model flat, stdcall
option casemap:none
includelib msvcrt.lib
ExitProcess PROTO return:DWORD
extern printf:near
.data
text BYTE "Text", 0
.code
main PROC
push offset text
call printf
add esp,4
invoke ExitProcess,0
main ENDP
end main
Run Code Online (Sandbox Code Playgroud)
当我构建项目时,链接器输出错误:
错误LNK2019未解析的函数_main @ 0中引用的外部符号_printf
链接器输出参数:
/OUT:"C:\Users\apple\Documents\SP_Lab7\Debug\SP_Lab7_Demo.exe"/ MANIFEST:NO/NXCOMPAT /PDB:"C:\Users\apple\Documents\SP_Lab7\Debug\SP_Lab7_Demo.pdb"/ DYNAMICBASE "kernel32.lib""user32.lib""gdi32.lib""winspool.lib""comdlg32.lib""advapi32.lib""shell32.lib""ole32.lib""oleaut32.lib""uuid.lib" "odbc32.lib""odbccp32.lib"/ MACHINE:X86/SAFESEH:NO/INCREMENTAL:NO /PGD:"C:\Users\apple\Documents\SP_Lab7\Debug\SP_Lab7_Demo.pgd"/ SUBSYSTEM:WINDOWS/MANIFESTUAC: "level ='asInvoker'uiAccess ='false'"/ ManifestFile:"Debug\SP_Lab7_Demo.exe.intermediate.manifest"/ ERRORREPORT:PROMPT/NOLOGO/TLBID:1
如果我发表评论call print,那么一切都正常执行(甚至是Windows API函数).有没有办法从asm文件调用C函数而不创建包含的cpp文件<cstdio>?有可能吗?
集会:
[BITS 16]
global _start
_start:
mov ax, 0x07C0
mov ds, ax
mov si, hw
call print_string
jmp $
print_string:
mov ah, 0x0E
.char:
lodsb
cmp al, 0
je .exit
int 0x10
jmp .char
.exit: ret
times 0x100-($-$$) db 0
hw: db "Hello, World!", 0
times 510-($-$$) db 0
dw 0xAA55
Run Code Online (Sandbox Code Playgroud)
组装这个:
$ nasm file.asm -felf -o file.o
Run Code Online (Sandbox Code Playgroud)
然后将其与:
$ ld -melf_i386 -o file.bin file.o --oformat binary
Run Code Online (Sandbox Code Playgroud)
给出以下错误:
file.asm:(.text+0x6): relocation truncated to fit: R_386_16 against `.text'
Run Code Online (Sandbox Code Playgroud)
在稍微摆弄代码后,我发现更改mov si, hw …
我正在尝试下载 libcheck。但 Microsoft.com 上的链接已损坏,也无法在 Microsoft.com 上搜索
这个工具已经停产了吗?如果是的话,微软还有其他工具可以替代这个工具吗?
这就是问题:
当我用C语言链接我的脚本时,使用ld,当我在ld中生成elf32-i386文件作为输出格式,将它作为OUTPUT_FORMAT()放在ld脚本中时,我没有任何错误,但如果我尝试放入最后一个OUTPUT_FORMAT()"二进制"或尝试输出扩展名为.bin的文件,我得到的错误如下:
kernel.o: In function `k_main':
kernel.c:(.text+0xe): undefined reference to `_GLOBAL_OFFSET_TABLE_'
kernelutils.o: In function `k_clear_screen':
kernelutils.c:(.text+0xc): undefined reference to `_GLOBAL_OFFSET_TABLE_'
kernelutils.o: In function `k_clear_screen_front':
kernelutils.c:(.text+0x56): undefined reference to `_GLOBAL_OFFSET_TABLE_'
kernelutils.o: In function `k_printf':
kernelutils.c:(.text+0xa0): undefined reference to `_GLOBAL_OFFSET_TABLE_'
kernelutils.o: In function `k_sleep_3sec':
kernelutils.c:(.text+0x152): undefined reference to `_GLOBAL_OFFSET_TABLE_'
kernelmalloc.o:kernelmalloc.c:(.text+0xc): more undefined references to `_GLOBAL_OFFSET_TABLE_' follow
Run Code Online (Sandbox Code Playgroud)
这不仅发生在编译特定脚本时,所有尝试使用ld链接的脚本,或gcc,因为这会调用ld,在尝试获取带扩展名为.bin的二进制文件时死掉.
当显示其中一个可执行文件的符号(上面输出中的kernel.o)时,我看到符号_GLOBAL_OFFSET_TABLE_未定义,最可怕的部分,上面错误输出中返回错误的所有函数都删除了它们的符号,这是nm输出:
cristian@mymethodman:~/Desktop/kernel/0.0.3/Archivos$ nm kernel.o
U _GLOBAL_OFFSET_TABLE_
U k_clear_screen
U k_clear_screen_front
00000000 T k_main
U k_malloc
U k_printf
U k_sleep_3sec
00000000 T __x86.get_pc_thunk.bx
Run Code Online (Sandbox Code Playgroud)
我怎么能解决这个问题?我将保留下面的链接器脚本以确保它不是.ld文件的问题,同时具有"获取elf"和"获取二进制"版本.提前致谢!
Ld脚本:
获取二进制文件: …
我以前从未做过,而且大多数教程都没有提到如何处理.crt文件。
我从GoDaddy购买了SSL证书,并在下载时选择了Tomcat作为平台。压缩文件包含3个文件:
dea08asdjakjawl.crt
gd_bundle-g1-g1.crt
gdig.crt.pem
Run Code Online (Sandbox Code Playgroud)
我在CentOS7服务器上有一个正在运行的Spring Boot应用程序(在具有嵌入式Tomcat的端口80上)。(服务器在Digital Ocean上运行,它具有分配的域,并且可以使用简单的http)
我想将其切换到https://something.com
所有教程都建议我为此必须具有.jks或.p12文件,但无法将.crt文件转换为该文件。此外,我不确定2 .crt文件中的哪个应转换为.jks / .p12。
我已将此添加到我的application.yaml中,但没有帮助:
server:
port: 443
ssl:
enabled: true
key-alias: server
key-store: "cert.crt"
key-store-password: "***"
Run Code Online (Sandbox Code Playgroud)
如何使用此证书将正在运行的Spring Boot项目更改为接受HTTPS查询?
为什么以下代码不X使用emu8086中的Assignment Directive(=)为符号赋值:
.model small
.data
X = 8
.code
.startup
mov ax, @data
mov ds, ax
mov bx, X
X = 6
mov bx, X
mov ah, 02h
mov dx, bx
add dx, 48
int 21h ; It should display 6 but instead it display 8.
mov ah, 04ch
int 21h
end
Run Code Online (Sandbox Code Playgroud) 我在《 INTEL 80386程序员参考手册》(p112,S 6.3.1.3)中读到,
内部处理器寄存器记录当前特权级别(CPL)。
我对它指的是什么感到好奇。它甚至有名字吗?寄存器的大小是多少?它还有其他用途吗?